gridviz 2.0.35 → 2.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- /*! For license information please see gridviz.min.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gviz=e():t.gviz=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(){}function r(t){return null==t?n:function(){return this.querySelector(t)}}function i(){return[]}function o(t){return null==t?i:function(){return this.querySelectorAll(t)}}function s(t){return function(){return this.matches(t)}}function a(t){return function(e){return e.matches(t)}}t.r(e),t.d(e,{App:()=>Zl,BackgroundLayer:()=>Il,BackgroundLayerWMS:()=>Ml,BoundaryLayer:()=>Vl,CSVGrid:()=>Sr,ColorCategoryLegend:()=>rp,ColorDiscreteLegend:()=>Jd,ColorLegend:()=>Zd,CompositionStyle:()=>If,ContourStyle:()=>mh,Dataset:()=>Zn,DatasetComponent:()=>pr,DotDensityStyle:()=>Nh,GeoCanvas:()=>Rn,JoyPlotStyle:()=>bf,KernelSmoothingStyle:()=>th,LabelLayer:()=>Fl,Layer:()=>Vn,LegoStyle:()=>dd,MosaicStyle:()=>wd,NinjaStarStyle:()=>Td,PillarStyle:()=>ah,SegmentOrientationLegend:()=>mp,SegmentStyle:()=>Pf,SegmentWidthLegend:()=>dp,ShapeColorSizeStyle:()=>of,SideCatStyle:()=>Oh,SideStyle:()=>ph,SizeLegend:()=>up,SquareColorCatWGLStyle:()=>id,SquareColorWGLStyle:()=>Zh,StrokeStyle:()=>ff,Style:()=>Jl,TanakaStyle:()=>Xh,TextStyle:()=>Df,TiledGrid:()=>xl,getClass:()=>Vr,getEuronymeLabelLayer:()=>$y,getEurostatBoundariesLayer:()=>Gy,getParameterByName:()=>Yy,sCircleHigh:()=>Op,sCircleLow:()=>Sp,sExp:()=>_p,sExpInverse:()=>Ip,sExpRev:()=>xp,sExpRevInverse:()=>Tp,sPow:()=>gp,sPowInverse:()=>Ap,sPowRev:()=>wp,sPowRevInverse:()=>Mp});var u=Array.prototype.find;function c(){return this.firstElementChild}var l=Array.prototype.filter;function f(){return Array.from(this.children)}function h(t){return new Array(t.length)}function d(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function p(t,e,n,r,i,o){for(var s,a=0,u=e.length,c=o.length;a<c;++a)(s=e[a])?(s.__data__=o[a],r[a]=s):n[a]=new d(t,o[a]);for(;a<u;++a)(s=e[a])&&(i[a]=s)}function y(t,e,n,r,i,o,s){var a,u,c,l=new Map,f=e.length,h=o.length,p=new Array(f);for(a=0;a<f;++a)(u=e[a])&&(p[a]=c=s.call(u,u.__data__,a,e)+"",l.has(c)?i[a]=u:l.set(c,u));for(a=0;a<h;++a)c=s.call(t,o[a],a,o)+"",(u=l.get(c))?(r[a]=u,u.__data__=o[a],l.delete(c)):n[a]=new d(t,o[a]);for(a=0;a<f;++a)(u=e[a])&&l.get(p[a])===u&&(i[a]=u)}function v(t){return t.__data__}function b(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function m(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}d.prototype={constructor:d,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var g="http://www.w3.org/1999/xhtml";const w={svg:"http://www.w3.org/2000/svg",xhtml:g,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function _(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),w.hasOwnProperty(e)?{space:w[e],local:t}:t}function x(t){return function(){this.removeAttribute(t)}}function S(t){return function(){this.removeAttributeNS(t.space,t.local)}}function O(t,e){return function(){this.setAttribute(t,e)}}function I(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function T(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function A(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function M(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function E(t){return function(){this.style.removeProperty(t)}}function C(t,e,n){return function(){this.style.setProperty(t,e,n)}}function P(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function j(t,e){return t.style.getPropertyValue(e)||M(t).getComputedStyle(t,null).getPropertyValue(e)}function k(t){return function(){delete this[t]}}function B(t,e){return function(){this[t]=e}}function F(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function L(t){return t.trim().split(/^|\s+/)}function D(t){return t.classList||new N(t)}function N(t){this._node=t,this._names=L(t.getAttribute("class")||"")}function R(t,e){for(var n=D(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function z(t,e){for(var n=D(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function U(t){return function(){R(this,t)}}function V(t){return function(){z(this,t)}}function W(t,e){return function(){(e.apply(this,arguments)?R:z)(this,t)}}function $(){this.textContent=""}function G(t){return function(){this.textContent=t}}function Y(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Z(){this.innerHTML=""}function H(t){return function(){this.innerHTML=t}}function q(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function X(){this.nextSibling&&this.parentNode.appendChild(this)}function K(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function J(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===g&&e.documentElement.namespaceURI===g?e.createElement(t):e.createElementNS(n,t)}}function Q(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function tt(t){var e=_(t);return(e.local?Q:J)(e)}function et(){return null}function nt(){var t=this.parentNode;t&&t.removeChild(this)}function rt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function it(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ot(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function st(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var s=0,a=i.length;s<a;++s)if((r=i[s]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function at(t,e,n){var r=M(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function ut(t,e){return function(){return at(this,t,e)}}function ct(t,e){return function(){return at(this,t,e.apply(this,arguments))}}N.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var lt=[null];function ft(t,e){this._groups=t,this._parents=e}function ht(){return new ft([[document.documentElement]],lt)}ft.prototype=ht.prototype={constructor:ft,select:function(t){"function"!=typeof t&&(t=r(t));for(var e=this._groups,n=e.length,i=new Array(n),o=0;o<n;++o)for(var s,a,u=e[o],c=u.length,l=i[o]=new Array(c),f=0;f<c;++f)(s=u[f])&&(a=t.call(s,s.__data__,f,u))&&("__data__"in s&&(a.__data__=s.__data__),l[f]=a);return new ft(i,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}(t):o(t);for(var e=this._groups,n=e.length,r=[],i=[],s=0;s<n;++s)for(var a,u=e[s],c=u.length,l=0;l<c;++l)(a=u[l])&&(r.push(t.call(a,a.__data__,l,u)),i.push(a));return new ft(r,i)},selectChild:function(t){return this.select(null==t?c:function(t){return function(){return u.call(this.children,t)}}("function"==typeof t?t:a(t)))},selectChildren:function(t){return this.selectAll(null==t?f:function(t){return function(){return l.call(this.children,t)}}("function"==typeof t?t:a(t)))},filter:function(t){"function"!=typeof t&&(t=s(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,c=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&c.push(o);return new ft(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,v);var n,r=e?y:p,i=this._parents,o=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var s=o.length,a=new Array(s),u=new Array(s),c=new Array(s),l=0;l<s;++l){var f=i[l],h=o[l],d=h.length,m=b(t.call(f,f&&f.__data__,l,i)),g=m.length,w=u[l]=new Array(g),_=a[l]=new Array(g);r(f,h,w,_,c[l]=new Array(d),m,e);for(var x,S,O=0,I=0;O<g;++O)if(x=w[O]){for(O>=I&&(I=O+1);!(S=_[I])&&++I<g;);x._next=S||null}}return(a=new ft(a,i))._enter=u,a._exit=c,a},enter:function(){return new ft(this._enter||this._groups.map(h),this._parents)},exit:function(){return new ft(this._exit||this._groups.map(h),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),u=0;u<s;++u)for(var c,l=n[u],f=r[u],h=l.length,d=a[u]=new Array(h),p=0;p<h;++p)(c=l[p]||f[p])&&(d[p]=c);for(;u<i;++u)a[u]=n[u];return new ft(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,s=i[o];--o>=0;)(r=i[o])&&(s&&4^r.compareDocumentPosition(s)&&s.parentNode.insertBefore(r,s),s=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=m);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s,a=n[o],u=a.length,c=i[o]=new Array(u),l=0;l<u;++l)(s=a[l])&&(c[l]=s);c.sort(e)}return new ft(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],s=0,a=o.length;s<a;++s)(i=o[s])&&t.call(i,i.__data__,s,o);return this},attr:function(t,e){var n=_(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?S:x:"function"==typeof e?n.local?A:T:n.local?I:O)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?E:"function"==typeof e?P:C)(t,e,null==n?"":n)):j(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?k:"function"==typeof e?F:B)(t,e)):this.node()[t]},classed:function(t,e){var n=L(t+"");if(arguments.length<2){for(var r=D(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?W:e?U:V)(n,e))},text:function(t){return arguments.length?this.each(null==t?$:("function"==typeof t?Y:G)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Z:("function"==typeof t?q:H)(t)):this.node().innerHTML},raise:function(){return this.each(X)},lower:function(){return this.each(K)},append:function(t){var e="function"==typeof t?t:tt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:tt(t),i=null==e?et:"function"==typeof e?e:r(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(nt)},clone:function(t){return this.select(t?it:rt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),s=o.length;if(!(arguments.length<2)){for(a=e?st:ot,r=0;r<s;++r)this.each(a(o[r],e,n));return this}var a=this.node().__on;if(a)for(var u,c=0,l=a.length;c<l;++c)for(r=0,u=a[c];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value},dispatch:function(t,e){return this.each(("function"==typeof e?ct:ut)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,s=i.length;o<s;++o)(r=i[o])&&(yield r)}};const dt=ht;function pt(t){return"string"==typeof t?new ft([[document.querySelector(t)]],[document.documentElement]):new ft([[t]],lt)}var yt={value:()=>{}};function vt(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new bt(r)}function bt(t){this._=t}function mt(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function gt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=yt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}bt.prototype=vt.prototype={constructor:bt,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(n=(t=o[s]).type)i[n]=gt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=gt(i[n],t.name,null);return this}for(;++s<a;)if((n=(t=o[s]).type)&&(n=mt(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new bt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};const wt=vt,_t={capture:!0,passive:!1};function xt(t){t.preventDefault(),t.stopImmediatePropagation()}function St(t){return((t=Math.exp(t))+1/t)/2}const Ot=function t(e,n,r){function i(t,i){var o,s,a=t[0],u=t[1],c=t[2],l=i[0],f=i[1],h=i[2],d=l-a,p=f-u,y=d*d+p*p;if(y<1e-12)s=Math.log(h/c)/e,o=function(t){return[a+t*d,u+t*p,c*Math.exp(e*t*s)]};else{var v=Math.sqrt(y),b=(h*h-c*c+r*y)/(2*c*n*v),m=(h*h-c*c-r*y)/(2*h*n*v),g=Math.log(Math.sqrt(b*b+1)-b),w=Math.log(Math.sqrt(m*m+1)-m);s=(w-g)/e,o=function(t){var r,i=t*s,o=St(g),l=c/(n*v)*(o*(r=e*i+g,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[a+l*d,u+l*p,c*o/St(e*i+g)]}}return o.duration=1e3*s*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);function It(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var Tt,At,Mt=0,Et=0,Ct=0,Pt=1e3,jt=0,kt=0,Bt=0,Ft="object"==typeof performance&&performance.now?performance:Date,Lt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Dt(){return kt||(Lt(Nt),kt=Ft.now()+Bt)}function Nt(){kt=0}function Rt(){this._call=this._time=this._next=null}function zt(t,e,n){var r=new Rt;return r.restart(t,e,n),r}function Ut(){kt=(jt=Ft.now())+Bt,Mt=Et=0;try{!function(){Dt(),++Mt;for(var t,e=Tt;e;)(t=kt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Mt}()}finally{Mt=0,function(){for(var t,e,n=Tt,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Tt=e);At=t,Wt(r)}(),kt=0}}function Vt(){var t=Ft.now(),e=t-jt;e>Pt&&(Bt-=e,jt=t)}function Wt(t){Mt||(Et&&(Et=clearTimeout(Et)),t-kt>24?(t<1/0&&(Et=setTimeout(Ut,t-Ft.now()-Bt)),Ct&&(Ct=clearInterval(Ct))):(Ct||(jt=Ft.now(),Ct=setInterval(Vt,Pt)),Mt=1,Lt(Ut)))}function $t(t,e,n){var r=new Rt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Rt.prototype=zt.prototype={constructor:Rt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Dt():+n)+(null==e?0:+e),this._next||At===this||(At?At._next=this:Tt=this,At=this),this._call=t,this._time=n,Wt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Wt())}};var Gt=wt("start","end","cancel","interrupt"),Yt=[],Zt=0,Ht=2,qt=3,Xt=5,Kt=6;function Jt(t,e,n,r,i,o){var s=t.__transition;if(s){if(n in s)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(u){var c,l,f,h;if(1!==n.state)return a();for(c in i)if((h=i[c]).name===n.name){if(h.state===qt)return $t(o);4===h.state?(h.state=Kt,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[c]):+c<e&&(h.state=Kt,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete i[c])}if($t((function(){n.state===qt&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(u))})),n.state=Ht,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Ht){for(n.state=qt,r=new Array(f=n.tween.length),c=0,l=-1;c<f;++c)(h=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++l]=h);r.length=l+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(a),n.state=Xt,1),o=-1,s=r.length;++o<s;)r[o].call(t,i);n.state===Xt&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){for(var r in n.state=Kt,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=zt((function(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}),0,n.time)}(t,n,{name:e,index:r,group:i,on:Gt,tween:Yt,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Zt})}function Qt(t,e){var n=ee(t,e);if(n.state>Zt)throw new Error("too late; already scheduled");return n}function te(t,e){var n=ee(t,e);if(n.state>qt)throw new Error("too late; already running");return n}function ee(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ne(t,e){var n,r,i,o=t.__transition,s=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>Ht&&n.state<Xt,n.state=Kt,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):s=!1;s&&delete t.__transition}}function re(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var ie,oe=180/Math.PI,se={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ae(t,e,n,r,i,o){var s,a,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,u/=a),t*r<e*n&&(t=-t,e=-e,u=-u,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*oe,skewX:Math.atan(u)*oe,scaleX:s,scaleY:a}}function ue(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,s){var a=[],u=[];return o=t(o),s=t(s),function(t,r,i,o,s,a){if(t!==i||r!==o){var u=s.push("translate(",null,e,null,n);a.push({i:u-4,x:re(t,i)},{i:u-2,x:re(r,o)})}else(i||o)&&s.push("translate("+i+e+o+n)}(o.translateX,o.translateY,s.translateX,s.translateY,a,u),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:re(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,s.rotate,a,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:re(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,s.skewX,a,u),function(t,e,n,r,o,s){if(t!==n||e!==r){var a=o.push(i(o)+"scale(",null,",",null,")");s.push({i:a-4,x:re(t,n)},{i:a-2,x:re(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,a,u),o=s=null,function(t){for(var e,n=-1,r=u.length;++n<r;)a[(e=u[n]).i]=e.x(t);return a.join("")}}}var ce=ue((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?se:ae(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),le=ue((function(t){return null==t?se:(ie||(ie=document.createElementNS("http://www.w3.org/2000/svg","g")),ie.setAttribute("transform",t),(t=ie.transform.baseVal.consolidate())?ae((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):se)}),", ",")",")");function fe(t,e){var n,r;return function(){var i=te(this,t),o=i.tween;if(o!==n)for(var s=0,a=(r=n=o).length;s<a;++s)if(r[s].name===e){(r=r.slice()).splice(s,1);break}i.tween=r}}function he(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=te(this,t),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:e,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===e){i[u]=a;break}u===c&&i.push(a)}o.tween=i}}function de(t,e,n){var r=t._id;return t.each((function(){var t=te(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return ee(t,r).value[e]}}function pe(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ye(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ve(){}var be=.7,me=1/be,ge="\\s*([+-]?\\d+)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xe=/^#([0-9a-f]{3,8})$/,Se=new RegExp(`^rgb\\(${ge},${ge},${ge}\\)$`),Oe=new RegExp(`^rgb\\(${_e},${_e},${_e}\\)$`),Ie=new RegExp(`^rgba\\(${ge},${ge},${ge},${we}\\)$`),Te=new RegExp(`^rgba\\(${_e},${_e},${_e},${we}\\)$`),Ae=new RegExp(`^hsl\\(${we},${_e},${_e}\\)$`),Me=new RegExp(`^hsla\\(${we},${_e},${_e},${we}\\)$`),Ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ce(){return this.rgb().formatHex()}function Pe(){return this.rgb().formatRgb()}function je(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=xe.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ke(e):3===n?new Le(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Be(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Be(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Se.exec(t))?new Le(e[1],e[2],e[3],1):(e=Oe.exec(t))?new Le(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Ie.exec(t))?Be(e[1],e[2],e[3],e[4]):(e=Te.exec(t))?Be(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ae.exec(t))?Ve(e[1],e[2]/100,e[3]/100,1):(e=Me.exec(t))?Ve(e[1],e[2]/100,e[3]/100,e[4]):Ee.hasOwnProperty(t)?ke(Ee[t]):"transparent"===t?new Le(NaN,NaN,NaN,0):null}function ke(t){return new Le(t>>16&255,t>>8&255,255&t,1)}function Be(t,e,n,r){return r<=0&&(t=e=n=NaN),new Le(t,e,n,r)}function Fe(t,e,n,r){return 1===arguments.length?((i=t)instanceof ve||(i=je(i)),i?new Le((i=i.rgb()).r,i.g,i.b,i.opacity):new Le):new Le(t,e,n,null==r?1:r);var i}function Le(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function De(){return`#${Ue(this.r)}${Ue(this.g)}${Ue(this.b)}`}function Ne(){const t=Re(this.opacity);return`${1===t?"rgb(":"rgba("}${ze(this.r)}, ${ze(this.g)}, ${ze(this.b)}${1===t?")":`, ${t})`}`}function Re(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ze(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ue(t){return((t=ze(t))<16?"0":"")+t.toString(16)}function Ve(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new $e(t,e,n,r)}function We(t){if(t instanceof $e)return new $e(t.h,t.s,t.l,t.opacity);if(t instanceof ve||(t=je(t)),!t)return new $e;if(t instanceof $e)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,a=o-i,u=(o+i)/2;return a?(s=e===o?(n-r)/a+6*(n<r):n===o?(r-e)/a+2:(e-n)/a+4,a/=u<.5?o+i:2-o-i,s*=60):a=u>0&&u<1?0:s,new $e(s,a,u,t.opacity)}function $e(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ge(t){return(t=(t||0)%360)<0?t+360:t}function Ye(t){return Math.max(0,Math.min(1,t||0))}function Ze(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function He(t,e,n,r,i){var o=t*t,s=o*t;return((1-3*t+3*o-s)*e+(4-6*o+3*s)*n+(1+3*t+3*o-3*s)*r+s*i)/6}pe(ve,je,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ce,formatHex:Ce,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return We(this).formatHsl()},formatRgb:Pe,toString:Pe}),pe(Le,Fe,ye(ve,{brighter(t){return t=null==t?me:Math.pow(me,t),new Le(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?be:Math.pow(be,t),new Le(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Le(ze(this.r),ze(this.g),ze(this.b),Re(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:De,formatHex:De,formatHex8:function(){return`#${Ue(this.r)}${Ue(this.g)}${Ue(this.b)}${Ue(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ne,toString:Ne})),pe($e,(function(t,e,n,r){return 1===arguments.length?We(t):new $e(t,e,n,null==r?1:r)}),ye(ve,{brighter(t){return t=null==t?me:Math.pow(me,t),new $e(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?be:Math.pow(be,t),new $e(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Le(Ze(t>=240?t-240:t+120,i,r),Ze(t,i,r),Ze(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new $e(Ge(this.h),Ye(this.s),Ye(this.l),Re(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Re(this.opacity);return`${1===t?"hsl(":"hsla("}${Ge(this.h)}, ${100*Ye(this.s)}%, ${100*Ye(this.l)}%${1===t?")":`, ${t})`}`}}));const qe=t=>()=>t;function Xe(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):qe(isNaN(t)?e:t)}const Ke=function t(e){var n=function(t){return 1==(t=+t)?Xe:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):qe(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Fe(t)).r,(e=Fe(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),s=Xe(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=s(e),t+""}}return r.gamma=t,r}(1);function Je(t){return function(e){var n,r,i=e.length,o=new Array(i),s=new Array(i),a=new Array(i);for(n=0;n<i;++n)r=Fe(e[n]),o[n]=r.r||0,s[n]=r.g||0,a[n]=r.b||0;return o=t(o),s=t(s),a=t(a),r.opacity=1,function(t){return r.r=o(t),r.g=s(t),r.b=a(t),r+""}}}Je((function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],s=r>0?t[r-1]:2*i-o,a=r<e-1?t[r+2]:2*o-i;return He((n-r/e)*e,s,i,o,a)}})),Je((function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],s=t[(r+1)%e],a=t[(r+2)%e];return He((n-r/e)*e,i,o,s,a)}}));var Qe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tn=new RegExp(Qe.source,"g");function en(t,e){var n,r,i,o=Qe.lastIndex=tn.lastIndex=0,s=-1,a=[],u=[];for(t+="",e+="";(n=Qe.exec(t))&&(r=tn.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,u.push({i:s,x:re(n,r)})),o=tn.lastIndex;return o<e.length&&(i=e.slice(o),a[s]?a[s]+=i:a[++s]=i),a.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,r=0;r<e;++r)a[(n=u[r]).i]=n.x(t);return a.join("")})}function nn(t,e){var n;return("number"==typeof e?re:e instanceof je?Ke:(n=je(e))?(e=n,Ke):en)(t,e)}function rn(t){return function(){this.removeAttribute(t)}}function on(t){return function(){this.removeAttributeNS(t.space,t.local)}}function sn(t,e,n){var r,i,o=n+"";return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function an(t,e,n){var r,i,o=n+"";return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function un(t,e,n){var r,i,o;return function(){var s,a,u=n(this);if(null!=u)return(s=this.getAttribute(t))===(a=u+"")?null:s===r&&a===i?o:(i=a,o=e(r=s,u));this.removeAttribute(t)}}function cn(t,e,n){var r,i,o;return function(){var s,a,u=n(this);if(null!=u)return(s=this.getAttributeNS(t.space,t.local))===(a=u+"")?null:s===r&&a===i?o:(i=a,o=e(r=s,u));this.removeAttributeNS(t.space,t.local)}}function ln(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function fn(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function hn(t,e){return function(){Qt(this,t).delay=+e.apply(this,arguments)}}function dn(t,e){return e=+e,function(){Qt(this,t).delay=e}}function pn(t,e){return function(){te(this,t).duration=+e.apply(this,arguments)}}function yn(t,e){return e=+e,function(){te(this,t).duration=e}}var vn=dt.prototype.constructor;function bn(t){return function(){this.style.removeProperty(t)}}var mn=0;function gn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function wn(){return++mn}var _n=dt.prototype;gn.prototype=function(t){return dt().transition(t)}.prototype={constructor:gn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=r(t));for(var i=this._groups,o=i.length,s=new Array(o),a=0;a<o;++a)for(var u,c,l=i[a],f=l.length,h=s[a]=new Array(f),d=0;d<f;++d)(u=l[d])&&(c=t.call(u,u.__data__,d,l))&&("__data__"in u&&(c.__data__=u.__data__),h[d]=c,Jt(h[d],e,n,d,h,ee(u,n)));return new gn(s,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=o(t));for(var r=this._groups,i=r.length,s=[],a=[],u=0;u<i;++u)for(var c,l=r[u],f=l.length,h=0;h<f;++h)if(c=l[h]){for(var d,p=t.call(c,c.__data__,h,l),y=ee(c,n),v=0,b=p.length;v<b;++v)(d=p[v])&&Jt(d,e,n,v,p,y);s.push(p),a.push(c)}return new gn(s,a,e,n)},selectChild:_n.selectChild,selectChildren:_n.selectChildren,filter:function(t){"function"!=typeof t&&(t=s(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,c=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&c.push(o);return new gn(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var u,c=e[a],l=n[a],f=c.length,h=s[a]=new Array(f),d=0;d<f;++d)(u=c[d]||l[d])&&(h[d]=u);for(;a<r;++a)s[a]=e[a];return new gn(s,this._parents,this._name,this._id)},selection:function(){return new vn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=wn(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s,a=r[o],u=a.length,c=0;c<u;++c)if(s=a[c]){var l=ee(s,e);Jt(s,t,n,c,a,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new gn(r,this._parents,t,n)},call:_n.call,nodes:_n.nodes,node:_n.node,size:_n.size,empty:_n.empty,each:_n.each,on:function(t,e){var n=this._id;return arguments.length<2?ee(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Qt:te;return function(){var s=o(this,t),a=s.on;a!==r&&(i=(r=a).copy()).on(e,n),s.on=i}}(n,t,e))},attr:function(t,e){var n=_(t),r="transform"===n?le:nn;return this.attrTween(t,"function"==typeof e?(n.local?cn:un)(n,r,de(this,"attr."+t,e)):null==e?(n.local?on:rn)(n):(n.local?an:sn)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=_(t);return this.tween(n,(r.local?ln:fn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?ce:nn;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=j(this,t),s=(this.style.removeProperty(t),j(this,t));return o===s?null:o===n&&s===r?i:i=e(n=o,r=s)}}(t,r)).on("end.style."+t,bn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var s=j(this,t),a=n(this),u=a+"";return null==a&&(this.style.removeProperty(t),u=a=j(this,t)),s===u?null:s===r&&u===i?o:(i=u,o=e(r=s,a))}}(t,r,de(this,"style."+t,e))).each(function(t,e){var n,r,i,o,s="style."+e,a="end."+s;return function(){var u=te(this,t),c=u.on,l=null==u.value[s]?o||(o=bn(e)):void 0;c===n&&i===l||(r=(n=c).copy()).on(a,i=l),u.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var s=j(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(de(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=ee(this.node(),n).tween,o=0,s=i.length;o<s;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?fe:he)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?hn:dn)(e,t)):ee(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?pn:yn)(e,t)):ee(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){te(this,t).ease=e}}(e,t)):ee(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;te(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(o,s){var a={value:s},u={value:function(){0==--i&&o()}};n.each((function(){var n=te(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(a),e._.interrupt.push(a),e._.end.push(u)),n.on=e})),0===i&&o()}))},[Symbol.iterator]:_n[Symbol.iterator]};var xn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Sn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}dt.prototype.interrupt=function(t){return this.each((function(){ne(this,t)}))},dt.prototype.transition=function(t){var e,n;t instanceof gn?(e=t._id,t=t._name):(e=wn(),(n=xn).time=Dt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s,a=r[o],u=a.length,c=0;c<u;++c)(s=a[c])&&Jt(s,t,e,c,a,n||Sn(s,e));return new gn(r,this._parents,t,e)};const On=t=>()=>t;function In(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Tn(t,e,n){this.k=t,this.x=e,this.y=n}Tn.prototype={constructor:Tn,scale:function(t){return 1===t?this:new Tn(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Tn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var An=new Tn(1,0,0);function Mn(t){t.stopImmediatePropagation()}function En(t){t.preventDefault(),t.stopImmediatePropagation()}function Cn(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Pn(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function jn(){return this.__zoom||An}function kn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Bn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fn(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Ln(t){return Ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ln(t)}function Dn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Nn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Ln(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Ln(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Ln(i)?i:String(i)),r)}var i}Tn.prototype;var Rn=function(){function t(e,n,r,i){var o=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.opts=i||{},this.canvas=e,this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.canvas.width=this.w,this.canvas.height=this.h;var s=this.canvas.getContext("2d");if(!s)throw"Impossible to create canvas 2D context";if(this.ctx=s,this.center=n||{x:.5*this.w,y:.5*this.h},this.zf=r,this.backgroundColor=i.backgroundColor||"white",this.onZoomStartFun=i.onZoomStartFun,this.onZoomEndFun=i.onZoomEndFun,this.onZoomFun=i.onZoomFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo(),!i.disableZoom){var a=An;(function(){var t,e,n,r=Cn,i=Pn,o=Fn,s=kn,a=Bn,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,f=Ot,h=wt("start","zoom","end"),d=500,p=150,y=0,v=10;function b(t){t.property("__zoom",jn).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",A).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",E).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(t,e){return(e=Math.max(u[0],Math.min(u[1],e)))===t.k?t:new Tn(e,t.x,t.y)}function g(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new Tn(t.k,r,i)}function w(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function _(t,e,n,r){t.on("start.zoom",(function(){x(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){x(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,s=x(t,o).event(r),a=i.apply(t,o),u=null==n?w(a):"function"==typeof n?n.apply(t,o):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),l=t.__zoom,h="function"==typeof e?e.apply(t,o):e,d=f(l.invert(u).concat(c/l.k),h.invert(u).concat(c/h.k));return function(t){if(1===t)t=h;else{var e=d(t),n=c/e[2];t=new Tn(n,u[0]-e[0]*n,u[1]-e[1]*n)}s.zoom(null,t)}}))}function x(t,e,n){return!n&&t.__zooming||new S(t,e)}function S(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function O(t,...e){if(r.apply(this,arguments)){var n=x(this,e).event(t),i=this.__zoom,a=Math.max(u[0],Math.min(u[1],i.k*Math.pow(2,s.apply(this,arguments)))),l=It(t);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=i.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(i.k===a)return;n.mouse=[l,i.invert(l)],ne(this),n.start()}En(t),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),p),n.zoom("mouse",o(g(m(i,a),n.mouse[0],n.mouse[1]),n.extent,c))}}function I(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,s=x(this,e,!0).event(t),a=pt(t.view).on("mousemove.zoom",(function(t){if(En(t),!s.moved){var e=t.clientX-l,n=t.clientY-f;s.moved=e*e+n*n>y}s.event(t).zoom("mouse",o(g(s.that.__zoom,s.mouse[0]=It(t,i),s.mouse[1]),s.extent,c))}),!0).on("mouseup.zoom",(function(t){a.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=pt(t).on("dragstart.drag",null);e&&(r.on("click.drag",xt,_t),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,s.moved),En(t),s.event(t).end()}),!0),u=It(t,i),l=t.clientX,f=t.clientY;!function(t){var e=t.document.documentElement,n=pt(t).on("dragstart.drag",xt,_t);"onselectstart"in e?n.on("selectstart.drag",xt,_t):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),Mn(t),s.mouse=[u,this.__zoom.invert(u)],ne(this),s.start()}}function T(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,s=It(t.changedTouches?t.changedTouches[0]:t,this),a=n.invert(s),u=n.k*(t.shiftKey?.5:2),f=o(g(m(n,u),s,a),i.apply(this,e),c);En(t),l>0?pt(this).transition().duration(l).call(_,f,s,t):pt(this).call(b.transform,f,s,t)}}function A(n,...i){if(r.apply(this,arguments)){var o,s,a,u,c=n.touches,l=c.length,f=x(this,i,n.changedTouches.length===l).event(n);for(Mn(n),s=0;s<l;++s)u=[u=It(a=c[s],this),this.__zoom.invert(u),a.identifier],f.touch0?f.touch1||f.touch0[2]===u[2]||(f.touch1=u,f.taps=0):(f.touch0=u,o=!0,f.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(f.taps<2&&(e=u[0],t=setTimeout((function(){t=null}),d)),ne(this),f.start())}}function M(t,...e){if(this.__zooming){var n,r,i,s,a=x(this,e).event(t),u=t.changedTouches,l=u.length;for(En(t),n=0;n<l;++n)i=It(r=u[n],this),a.touch0&&a.touch0[2]===r.identifier?a.touch0[0]=i:a.touch1&&a.touch1[2]===r.identifier&&(a.touch1[0]=i);if(r=a.that.__zoom,a.touch1){var f=a.touch0[0],h=a.touch0[1],d=a.touch1[0],p=a.touch1[1],y=(y=d[0]-f[0])*y+(y=d[1]-f[1])*y,v=(v=p[0]-h[0])*v+(v=p[1]-h[1])*v;r=m(r,Math.sqrt(y/v)),i=[(f[0]+d[0])/2,(f[1]+d[1])/2],s=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!a.touch0)return;i=a.touch0[0],s=a.touch0[1]}a.zoom("touch",o(g(r,i,s),a.extent,c))}}function E(t,...r){if(this.__zooming){var i,o,s=x(this,r).event(t),a=t.changedTouches,u=a.length;for(Mn(t),n&&clearTimeout(n),n=setTimeout((function(){n=null}),d),i=0;i<u;++i)o=a[i],s.touch0&&s.touch0[2]===o.identifier?delete s.touch0:s.touch1&&s.touch1[2]===o.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(o=It(o,this),Math.hypot(e[0]-o[0],e[1]-o[1])<v)){var c=pt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return b.transform=function(t,e,n,r){var i=t.selection?t.selection():t;i.property("__zoom",jn),t!==i?_(t,e,n,r):i.interrupt().each((function(){x(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},b.scaleBy=function(t,e,n,r){b.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),n,r)},b.scaleTo=function(t,e,n,r){b.transform(t,(function(){var t=i.apply(this,arguments),r=this.__zoom,s=null==n?w(t):"function"==typeof n?n.apply(this,arguments):n,a=r.invert(s),u="function"==typeof e?e.apply(this,arguments):e;return o(g(m(r,u),s,a),t,c)}),n,r)},b.translateBy=function(t,e,n,r){b.transform(t,(function(){return o(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)}),null,r)},b.translateTo=function(t,e,n,r,s){b.transform(t,(function(){var t=i.apply(this,arguments),s=this.__zoom,a=null==r?w(t):"function"==typeof r?r.apply(this,arguments):r;return o(An.translate(a[0],a[1]).scale(s.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)}),r,s)},S.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=pt(this.that).datum();h.call(t,this.that,new In(t,{sourceEvent:this.sourceEvent,target:b,type:t,transform:this.that.__zoom,dispatch:h}),e)}},b.wheelDelta=function(t){return arguments.length?(s="function"==typeof t?t:On(+t),b):s},b.filter=function(t){return arguments.length?(r="function"==typeof t?t:On(!!t),b):r},b.touchable=function(t){return arguments.length?(a="function"==typeof t?t:On(!!t),b):a},b.extent=function(t){return arguments.length?(i="function"==typeof t?t:On([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),b):i},b.scaleExtent=function(t){return arguments.length?(u[0]=+t[0],u[1]=+t[1],b):[u[0],u[1]]},b.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],b):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},b.constrain=function(t){return arguments.length?(o=t,b):o},b.duration=function(t){return arguments.length?(l=+t,b):l},b.interpolate=function(t){return arguments.length?(f=t,b):f},b.on=function(){var t=h.on.apply(h,arguments);return t===h?b:t},b.clickDistance=function(t){return arguments.length?(y=(t=+t)*t,b):Math.sqrt(y)},b.tapDistance=function(t){return arguments.length?(v=+t,b):v},b})().wheelDelta((function(t){return-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004)})).on("zoom",(function(t){var e=t.transform,n=a.k/e.k;if(1==n){var r=a.x-e.x,i=a.y-e.y;o.pan(r*o.getZf(),-i*o.getZf())}else{var s=t.sourceEvent;if(s instanceof WheelEvent)o.zoom(n,o.pixToGeoX(t.sourceEvent.offsetX),o.pixToGeoY(t.sourceEvent.offsetY));else if(s instanceof TouchEvent){var u,c=0,l=0,f=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Dn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(s.targetTouches);try{for(f.s();!(u=f.n()).done;){var h=u.value;c+=h.clientX,l+=h.clientY}}catch(t){f.e(t)}finally{f.f()}c/=s.targetTouches.length,l/=s.targetTouches.length,o.zoom(n,o.pixToGeoX(c),o.pixToGeoY(l))}}a=e,o.onZoomFun&&o.onZoomFun(t)})).on("start",(function(t){o.canvasSave.c=document.createElement("canvas"),o.canvasSave.c.setAttribute("width",""+o.w),o.canvasSave.c.setAttribute("height",""+o.h),o.canvasSave.c.getContext("2d").drawImage(o.canvas,0,0),o.canvasSave.dx=0,o.canvasSave.dy=0,o.canvasSave.f=1,o.onZoomStartFun&&o.onZoomStartFun(t)})).on("end",(function(t){o.redraw(!0),o.canvasSave={c:null,dx:0,dy:0,f:1},o.onZoomEndFun&&o.onZoomEndFun(t)}))(pt(this.canvas))}this.zfExtent=[0,1/0],this.canvasSave={c:null,dx:0,dy:0,f:1}}var e,n,r;return e=t,n=[{key:"setCenter",value:function(t){this.center=t}},{key:"getCenter",value:function(){return this.center}},{key:"setZf",value:function(t){this.zf=t,this.slider&&this.slider.attr("value",+this.zf)}},{key:"getZf",value:function(){return this.zf}},{key:"setZfExtent",value:function(t){this.zfExtent=t}},{key:"getZfExtent",value:function(){return this.zfExtent}},{key:"initCanvasTransform",value:function(){this.ctx.setTransform(1,0,0,1,0,0)}},{key:"setCanvasTransform",value:function(){var t=1/this.getZf(),e=-this.center.x/this.getZf()+.5*this.w,n=this.center.y/this.getZf()+.5*this.h;this.ctx.setTransform(t,0,0,-t,e,n)}},{key:"getWebGLTransform",value:function(){var t=2/(this.w*this.getZf()),e=2/(this.h*this.getZf());return[t,0,0,0,e,0,-t*this.center.x,-e*this.center.y,1]}},{key:"redraw",value:function(){throw new Error("Method redraw not implemented.")}},{key:"clear",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"white";this.opts.transparentBackground?this.ctx.clearRect(0,0,this.w,this.h):(this.ctx&&(this.ctx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h))}},{key:"pan",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.center.x+=t,this.center.y+=e,this.updateExtentGeo(),this.canvasSave.c&&(this.canvasSave.dx-=t/this.getZf(),this.canvasSave.dy+=e/this.getZf(),this.clear(this.backgroundColor),this.ctx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy))}},{key:"zoom",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.center.x,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.center.y;if(!(this.zfExtent[0]==this.getZf()&&t<=1||this.zfExtent[1]==this.getZf()&&t>=1)){var r=t*this.getZf();r<this.zfExtent[0]&&(t=this.zfExtent[0]/this.getZf()),r>this.zfExtent[1]&&(t=this.zfExtent[1]/this.getZf()),this.setZf(t*this.getZf());var i=(e-this.center.x)*(1-t);this.center.x+=i;var o=(n-this.center.y)*(1-t);this.center.y+=o,this.updateExtentGeo(),this.canvasSave.c&&(this.clear(this.backgroundColor),this.canvasSave.f/=t,this.canvasSave.dx=this.geoToPixX(e)*(1-this.canvasSave.f),this.canvasSave.dy=this.geoToPixY(n)*(1-this.canvasSave.f),this.clear(this.backgroundColor),this.ctx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy,this.canvasSave.f*this.canvasSave.c.width,this.canvasSave.f*this.canvasSave.c.height))}}},{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.extGeo={xMin:this.pixToGeoX(-t),xMax:this.pixToGeoX(this.w+t),yMin:this.pixToGeoY(this.h+t),yMax:this.pixToGeoY(-t)},this.extGeo}},{key:"toDraw",value:function(t){return!(t.x<this.extGeo.xMin||t.x>this.extGeo.xMax||t.y<this.extGeo.yMin||t.y>this.extGeo.yMax)}},{key:"geoToPixX",value:function(t){return(t-this.center.x)/this.getZf()+.5*this.w}},{key:"geoToPixY",value:function(t){return-(t-this.center.y)/this.getZf()+.5*this.h}},{key:"pixToGeoX",value:function(t){return(t-.5*this.w)*this.getZf()+this.center.x}},{key:"pixToGeoY",value:function(t){return-(t-.5*this.h)*this.getZf()+this.center.y}},{key:"setViewFromURL",value:function(){var e=t.getParameterByName("x"),n=t.getParameterByName("y"),r=t.getParameterByName("z"),i=this.getCenter();null==e||null==e||isNaN(+e)||(i.x=+e),null==n||null==n||isNaN(+n)||(i.y=+n),null==r||null==r||isNaN(+r)||this.setZf(+r)}},{key:"addZoomSlider",value:function(t,e){(e=e||{}).width=e.width||"30px",e.height=e.height||"300px";var n=pt("#"+t);if(n.empty())return console.error("Could not find div element to build zoom slider. Id: "+t),this;var r=this;return this.slider=n.append("input").attr("type","range").attr("min",this.getZfExtent()[0]).attr("max",this.getZfExtent()[1]).attr("value",this.getZf()).on("input",(function(t){if(this&&this.value){var e=+this.value;pt(this).attr("value",e),r.setZf(e),r.redraw()}})).style("width",e.width).style("height",e.height).style("opacity",.7).on("mouseover",(function(t){pt(this).style("opacity",1)})).on("mouseout",(function(t){pt(this).style("opacity",.7)})).style("-webkit-appearance","slider-vertical").style("writing-mode","bt-lr").attr("orient","vertical").style("background","lightgray").style("outline","none").style("-webkit-transition",".2s").style("transition","opacity .2s"),this}}],r=[{key:"getParameterByName",value:function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return e?decodeURIComponent(e[1].replace(/\+/g," ")):null}}],n&&Nn(e.prototype,n),r&&Nn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function zn(t){return zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(t)}function Un(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==zn(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==zn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===zn(i)?i:String(i)),r)}var i}var Vn=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=r||{},this.dataset=e,this.styles=n,this.visible=0!=r.visible,this.minZoom=r.minZoom||0,this.maxZoom=r.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");this.pixNb=r.pixNb||3,this.cellInfoHTML=r.cellInfoHTML||t.defaultCellInfoHTML}var e,n,r;return e=t,r=[{key:"defaultCellInfoHTML",value:function(t){for(var e=[],n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];"x"!==i&&"y"!==i&&e.push("<b>",i,"</b>"," : ",t[i],"<br>")}return e.join("")}}],(n=[{key:"getDatasetComponent",value:function(t){if(!(t<this.minZoom||t>this.maxZoom)){if(1==this.dataset.datasetComponents.length)return this.dataset.datasetComponents[0];for(var e=this.dataset.resolutions,n=0,r=e[n]/this.pixNb;r<t&&n<e.length;)r=e[++n]/this.pixNb;return n==e.length?this.dataset.datasetComponents[e.length-1]:this.dataset.datasetComponents[n]}}}])&&Un(e.prototype,n),r&&Un(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Wn(t){return Wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wn(t)}function $n(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Gn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Gn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Yn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Wn(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Wn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Wn(i)?i:String(i)),r)}var i}var Zn=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=r||{},this.datasetComponents=e,this.resolutions=n,this.datasetComponents.length>1&&this.datasetComponents.length!=this.resolutions.length)throw new Error("Uncompatible number of datasets and resolutions: "+this.datasetComponents.length+" "+this.resolutions.length);r.preprocess&&this.setPrepocesses(r.preprocess)}var e,n,r;return e=t,r=[{key:"make",value:function(e,n,r){var i,o=[],s=$n(e);try{for(s.s();!(i=s.n()).done;){var a=i.value;o.push(n(a))}}catch(t){s.e(t)}finally{s.f()}return new t(o,e,r)}}],(n=[{key:"setPrepocesses",value:function(t){var e,n=$n(this.datasetComponents);try{for(n.s();!(e=n.n()).done;)e.value.preprocess=t}catch(t){n.e(t)}finally{n.f()}return this}}])&&Yn(e.prototype,n),r&&Yn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Hn(t){return Hn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hn(t)}function qn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Xn(r.key),r)}}function Xn(t){var e=function(t,e){if("object"!==Hn(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Hn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Hn(e)?e:String(e)}var Kn=function(){function t(e){var n,r,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n=this,i=function(t){var e=this.tooltip.node(),n=this.parentElement.getBoundingClientRect(),r=n.width,i=n.height;if(e.offsetLeft>n.left+r-e.clientWidth){var o=t.x-e.clientWidth-this.xOffset;if(e.style.left=o+"px",e.offsetLeft+e.clientWidth>t.x){var s=t.x-(e.clientWidth+this.xOffset);e.style.left=s+"px"}}e.offsetTop+e.clientHeight>n.top+i&&(e.style.top=e.offsetTop-e.clientHeight+"px")},(r=Xn(r="ensureTooltipInsideContainer"))in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,e=e||{},this.div=e.div||"tooltip_eurostat",this.maxWidth=e.maxWidth||"20em",this.fontSize=e.fontSize||"1.2em",this.background=e.background||"white",this.padding=e.padding||"5px",this.border=e.border||"0px",this["border-radius"]=e["border-radius"]||"5px",this["box-shadow"]=e["box-shadow"]||"5px 5px 5px grey",this["font-family"]=e["font-family"]||"Helvetica, Arial, sans-serif",this.transitionDuration=e.transitionDuration||100,this.xOffset=e.xOffset||30,this.yOffset=e.yOffset||20,this.yMouseOffset=e.yMouseOffset||0,this.xMouseOffset=e.xMouseOffset||0,this.parentElement=e.parentElement||document.body,this.tooltip=pt("#"+this.div),this.tooltip.empty()&&(this.tooltip=pt("#"+this.parentElement.id).append("div").attr("id",this.div)),this.tooltip.style("max-width",this.maxWidth),this.tooltip.style("overflow","hidden"),this.tooltip.style("font-size",this.fontSize),this.tooltip.style("background",this.background),this.tooltip.style("padding",this.padding),this.tooltip.style("border",this.border),this.tooltip.style("border-radius",this["border-radius"]),this.tooltip.style("box-shadow",this["box-shadow"]),this.tooltip.style("font-family",this["font-family"]),this.tooltip.style("position","absolute"),this.tooltip.style("pointer-events","none"),this.tooltip.style("opacity","0"),this.tooltip.attr("role","tooltip").attr("aria-live","polite")}var e,n;return e=t,n=[{key:"show",value:function(){this.tooltip.transition().duration(this.transitionDuration).style("opacity",1)}},{key:"hide",value:function(){this.tooltip.transition().duration(this.transitionDuration).style("opacity",0)}},{key:"html",value:function(t){this.tooltip.html(t)}},{key:"setPosition",value:function(t){this.tooltip.style("left",t.pageX+this.xOffset+"px").style("top",t.pageY-this.yOffset+"px"),this.ensureTooltipInsideContainer(t)}},{key:"style",value:function(t,e){return 1==arguments.length?this.tooltip.style(t):(this.tooltip.style(t,e),this)}},{key:"attr",value:function(t,e){return 1==arguments.length?this.tooltip.attr(t):(this.tooltip.attr(t,e),this)}}],n&&qn(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Jn={},Qn={};function tr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function er(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function nr(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function rr(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,s=0,a=0,u=o<=0,c=!1;function l(){if(u)return Qn;if(c)return c=!1,Jn;var e,r,i=s;if(34===t.charCodeAt(i)){for(;s++<o&&34!==t.charCodeAt(s)||34===t.charCodeAt(++s););return(e=s)>=o?u=!0:10===(r=t.charCodeAt(s++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(s)&&++s),t.slice(i+1,e-1).replace(/""/g,'"')}for(;s<o;){if(10===(r=t.charCodeAt(e=s++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(s)&&++s;else if(r!==n)continue;return t.slice(i,e)}return u=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=l())!==Qn;){for(var f=[];r!==Jn&&r!==Qn;)f.push(r),r=l();e&&null==(f=e(f,a++))||i.push(f)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return s(e[t])})).join(t)}))}function o(e){return e.map(s).join(t)}function s(t){return null==t?"":t instanceof Date?(i=(n=t).getUTCHours(),o=n.getUTCMinutes(),s=n.getUTCSeconds(),a=n.getUTCMilliseconds(),isNaN(n)?"Invalid Date":((r=n.getUTCFullYear())<0?"-"+nr(-r,6):r>9999?"+"+nr(r,6):nr(r,4))+"-"+nr(n.getUTCMonth()+1,2)+"-"+nr(n.getUTCDate(),2)+(a?"T"+nr(i,2)+":"+nr(o,2)+":"+nr(s,2)+"."+nr(a,3)+"Z":s?"T"+nr(i,2)+":"+nr(o,2)+":"+nr(s,2)+"Z":o||i?"T"+nr(i,2)+":"+nr(o,2)+"Z":"")):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t;var n,r,i,o,s,a}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=tr(t);return function(r,i){return e(n(r),i,t)}}(t,e):tr(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=er(e)),[n.map(s).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=er(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:s}}var ir=rr(","),or=ir.parse,sr=(ir.parseRows,ir.format,ir.formatBody,ir.formatRows,ir.formatRow,ir.formatValue,rr("\t")),ar=sr.parse;function ur(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function cr(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),function(t,e){return fetch(t,e).then(ur)}(e,n).then((function(e){return t(e,r)}))}}sr.parseRows,sr.format,sr.formatBody,sr.formatRows,sr.formatRow,sr.formatValue;var lr=cr(or);function fr(t){return fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fr(t)}function hr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function dr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==fr(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==fr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===fr(i)?i:String(i)),r)}var i}cr(ar);var pr=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=r||{},this.url=e,this.resolution=n,this.preprocess=r.preprocess||void 0,this.cellsViewCache=[]}var e,n;return e=t,(n=[{key:"getData",value:function(t,e){throw new Error("Method getData not implemented.")}},{key:"updateViewCache",value:function(t){throw new Error("Method updateViewCache not implemented.")}},{key:"getCellFromPosition",value:function(t,e){var n,r=this.getResolution(),i=r*Math.floor(t.x/r),o=r*Math.floor(t.y/r),s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return hr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(s.s();!(n=s.n()).done;){var a=n.value;if(a.x==i&&a.y==o)return a}}catch(t){s.e(t)}finally{s.f()}}},{key:"getResolution",value:function(){return this.resolution}},{key:"getViewCache",value:function(){return this.cellsViewCache}}])&&dr(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function yr(t){return yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(t)}function vr(){vr=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var o=e&&e.prototype instanceof h?e:h,s=Object.create(o.prototype),a=new I(i||[]);return r(s,"_invoke",{value:_(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==e&&n.call(b,o)&&(y=b);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(r,o,s,a){var u=l(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==yr(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function _(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=l(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,r(m,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new w(c(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},g(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function br(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return mr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function mr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function gr(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function wr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==yr(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==yr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===yr(i)?i:String(i)),r)}var i}function _r(t,e){return _r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_r(t,e)}function xr(t){return xr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xr(t)}var Sr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_r(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=xr(r);if(i){var n=xr(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===yr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(n=o.call(this,t,e,r)).cells=[],n.infoLoadingStatus="notLoaded",n}return e=s,n=[{key:"getData",value:function(t,e){var n,r=this;return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",(n=vr().mark((function t(){var n,i,o,s,a,u,c;return vr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,lr(r.url);case 3:n=t.sent,i=br(n);try{for(i.s();!(o=i.n()).done;)(s=o.value).x=+s.x,s.y=+s.y}catch(t){i.e(t)}finally{i.f()}if(!r.preprocess){t.next=29;break}r.cells=[],a=br(n),t.prev=9,a.s();case 11:if((u=a.n()).done){t.next=19;break}if(c=u.value,0!=r.preprocess(c)){t.next=16;break}return t.abrupt("continue",17);case 16:r.cells.push(c);case 17:t.next=11;break;case 19:t.next=24;break;case 21:t.prev=21,t.t0=t.catch(9),a.e(t.t0);case 24:return t.prev=24,a.f(),t.finish(24);case 27:t.next=30;break;case 29:r.cells=n;case 30:e&&e(),r.infoLoadingStatus="loaded",t.next=38;break;case 34:t.prev=34,t.t1=t.catch(0),r.infoLoadingStatus="failed",r.cells=[];case 38:case"end":return t.stop()}}),t,null,[[0,34],[9,21,24,27]])})),function(){var t=this,e=arguments;return new Promise((function(r,i){var o=n.apply(t,e);function s(t){gr(o,r,i,s,a,"next",t)}function a(t){gr(o,r,i,s,a,"throw",t)}s(void 0)}))})()),this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=br(this.cells);try{for(n.s();!(e=n.n()).done;){var r=e.value;+r.x+this.resolution<t.xMin||+r.x-this.resolution>t.xMax||+r.y+this.resolution<t.yMin||+r.y-this.resolution>t.yMax||this.cellsViewCache.push(r)}}catch(t){n.e(t)}finally{n.f()}}}}],n&&wr(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(pr);function Or(t){return Or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Or(t)}function Ir(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Tr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Or(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Or(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Or(i)?i:String(i)),r)}var i}function Ar(t,e,n){return e&&Tr(t.prototype,e),n&&Tr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var Mr,Er,Cr,Pr,jr,kr,Br,Fr,Lr,Dr,Nr,Rr,zr,Ur=Ar((function t(e,n,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cells=e,this.x=n,this.y=r;var o=i.resolutionGeo,s=i.tileSizeCell;this.extGeo={xMin:i.originPoint.x+o*s*this.x,xMax:i.originPoint.x+o*s*(this.x+1),yMin:i.originPoint.y+o*s*this.y,yMax:i.originPoint.y+o*s*(this.y+1)};var a,u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ir(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ir(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(this.cells);try{for(u.s();!(a=u.n()).done;){var c=a.value;c.x=this.extGeo.xMin+c.x*o,c.y=this.extGeo.yMin+c.y*o}}catch(t){u.e(t)}finally{u.f()}}));function Vr(t,e){if(e){if(0==e.length)return 0;if(t<=e[0])return 0;for(var n=1;n<e.length;n++)if(e[n-1]<t&&t<=e[n])return n;return e.length}}function Wr(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function $r(t,e){return fetch(t,e).then(Wr)}function Gr(t){if(null===t)return"null";if(void 0===t)return"undefined";switch(typeof t){case"number":case"bigint":return`${t}`;case"string":return`"${t}"`}return"function"==typeof t[Symbol.toPrimitive]?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map((t=>Gr(t)))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,((t,e)=>"bigint"==typeof e?`${e}`:e))}function Yr(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))}function Zr(t){return this instanceof Zr?(this.v=t,this):new Zr(t)}function Hr(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(t){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||a(t,e)}))})}function a(t,e){try{(n=i[t](e)).value instanceof Zr?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function u(t){a("next",t)}function c(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function qr(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,i){e[r]=t[r]?function(e){return(n=!n)?{value:Zr(t[r](e)),done:!1}:i?i(e):e}:i}}function Xr(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){!function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)}(r,i,(e=t[n](e)).done,e.value)}))}}}!function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"}(Mr||(Mr={})),(zr=Er||(Er={}))[zr.Sparse=0]="Sparse",zr[zr.Dense=1]="Dense",function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"}(Cr||(Cr={})),(Rr=Pr||(Pr={}))[Rr.DAY=0]="DAY",Rr[Rr.MILLISECOND=1]="MILLISECOND",(Nr=jr||(jr={}))[Nr.SECOND=0]="SECOND",Nr[Nr.MILLISECOND=1]="MILLISECOND",Nr[Nr.MICROSECOND=2]="MICROSECOND",Nr[Nr.NANOSECOND=3]="NANOSECOND",(Dr=kr||(kr={}))[Dr.YEAR_MONTH=0]="YEAR_MONTH",Dr[Dr.DAY_TIME=1]="DAY_TIME",Dr[Dr.MONTH_DAY_NANO=2]="MONTH_DAY_NANO",function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"}(Br||(Br={})),function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(Fr||(Fr={})),function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"}(Lr||(Lr={})),Object.create,Object.create;const Kr=new TextDecoder("utf-8"),Jr=t=>Kr.decode(t),Qr=new TextEncoder,ti=t=>Qr.encode(t),[ei,ni]=(()=>{const t=()=>{throw new Error("BigInt is not available in this environment")};function e(){throw t()}return e.asIntN=()=>{throw t()},e.asUintN=()=>{throw t()},"undefined"!=typeof BigInt?[BigInt,!0]:[e,!1]})(),[ri,ii]=(()=>{const t=()=>{throw new Error("BigInt64Array is not available in this environment")};return"undefined"!=typeof BigInt64Array?[BigInt64Array,!0]:[class{static get BYTES_PER_ELEMENT(){return 8}static of(){throw t()}static from(){throw t()}constructor(){throw t()}},!1]})(),[oi,si]=(()=>{const t=()=>{throw new Error("BigUint64Array is not available in this environment")};return"undefined"!=typeof BigUint64Array?[BigUint64Array,!0]:[class{static get BYTES_PER_ELEMENT(){return 8}static of(){throw t()}static from(){throw t()}constructor(){throw t()}},!1]})(),ai=t=>"function"==typeof t,ui=t=>null!=t&&Object(t)===t,ci=t=>ui(t)&&ai(t.then),li=t=>ui(t)&&ai(t[Symbol.iterator]),fi=t=>ui(t)&&ai(t[Symbol.asyncIterator]),hi=t=>ui(t)&&ui(t.schema),di=t=>ui(t)&&"done"in t&&"value"in t,pi=t=>ui(t)&&ai(t.stat)&&(t=>"number"==typeof t)(t.fd),yi=t=>ui(t)&&bi(t.body),vi=t=>"_getDOMStream"in t&&"_getNodeStream"in t,bi=t=>ui(t)&&ai(t.cancel)&&ai(t.getReader)&&!vi(t),mi=t=>ui(t)&&ai(t.read)&&ai(t.pipe)&&(t=>"boolean"==typeof t)(t.readable)&&!vi(t),gi=t=>ui(t)&&ai(t.clear)&&ai(t.bytes)&&ai(t.position)&&ai(t.setPosition)&&ai(t.capacity)&&ai(t.getBufferIdentifier)&&ai(t.createLong),wi="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;function _i(t,e,n=0,r=e.byteLength){const i=t.byteLength,o=new Uint8Array(t.buffer,t.byteOffset,i),s=new Uint8Array(e.buffer,e.byteOffset,Math.min(r,i));return o.set(s,n),t}function xi(t,e){const n=function(t){const e=t[0]?[t[0]]:[];let n,r,i,o;for(let s,a,u=0,c=0,l=t.length;++u<l;)s=e[c],a=t[u],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset?a&&(e[++c]=a):(({byteOffset:n,byteLength:i}=s),({byteOffset:r,byteLength:o}=a),n+i<r||r+o<n?a&&(e[++c]=a):e[c]=new Uint8Array(s.buffer,n,r-n+o));return e}(t),r=n.reduce(((t,e)=>t+e.byteLength),0);let i,o,s,a=0,u=-1;const c=Math.min(e||Number.POSITIVE_INFINITY,r);for(const t=n.length;++u<t;){if(i=n[u],o=i.subarray(0,Math.min(i.length,c-a)),c<=a+o.length){o.length<i.length?n[u]=i.subarray(o.length):o.length===i.length&&u++,s?_i(s,o,a):s=o;break}_i(s||(s=new Uint8Array(c)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(u),r-(s?s.byteLength:0)]}function Si(t,e){let n=di(e)?e.value:e;return n instanceof t?t===Uint8Array?new t(n.buffer,n.byteOffset,n.byteLength):n:n?("string"==typeof n&&(n=ti(n)),n instanceof ArrayBuffer||n instanceof wi?new t(n):gi(n)?Si(t,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new t(0):new t(n.buffer,n.byteOffset,n.byteLength/t.BYTES_PER_ELEMENT):t.from(n)):new t(0)}const Oi=t=>Si(Int32Array,t),Ii=t=>Si(Uint8Array,t),Ti=t=>(t.next(),t);function Ai(t,e){return Hr(this,arguments,(function*(){if(ci(e))return yield Zr(yield Zr(yield*qr(Xr(Ai(t,yield Zr(e))))));const n=function(t){return Hr(this,arguments,(function*(){yield yield Zr(yield Zr(t))}))},r="string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof wi?n(e):li(e)?function(t){return Hr(this,arguments,(function*(){yield Zr(yield*qr(Xr(Ti(function*(t){let e=null;do{e=t.next(yield null==e?void 0:e.value)}while(!e.done)}(t[Symbol.iterator]())))))}))}(e):fi(e)?e:n(e);return yield Zr(yield*qr(Xr(Ti(function(e){return Hr(this,arguments,(function*(){let n=null;do{n=yield Zr(e.next(yield yield Zr(Si(t,n))))}while(!n.done)}))}(r[Symbol.asyncIterator]()))))),yield Zr(new t)}))}const Mi=Symbol.for("isArrowBigNum");function Ei(t,...e){return 0===e.length?Object.setPrototypeOf(Si(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}function Ci(...t){return Ei.apply(this,t)}function Pi(...t){return Ei.apply(this,t)}function ji(...t){return Ei.apply(this,t)}function ki(t){const{buffer:e,byteOffset:n,length:r,signed:i}=t,o=new oi(e,n,r),s=i&&o[o.length-1]&BigInt(1)<<BigInt(63);let a=s?BigInt(1):BigInt(0),u=BigInt(0);if(s){for(const t of o)a+=~t*(BigInt(1)<<BigInt(32)*u++);a*=BigInt(-1)}else for(const t of o)a+=t*(BigInt(1)<<BigInt(32)*u++);return a}let Bi,Fi;function Li(t){let e="";const n=new Uint32Array(2);let r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);const i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer);let o=-1;const s=r.length-1;do{for(n[0]=r[o=0];o<s;)r[o++]=n[1]=n[0]/10,n[0]=(n[0]-10*n[1]<<16)+r[o];r[o]=n[1]=n[0]/10,n[0]=n[0]-10*n[1],e=`${n[0]}${e}`}while(i[0]||i[1]||i[2]||i[3]);return null!=e?e:"0"}Ei.prototype[Mi]=!0,Ei.prototype.toJSON=function(){return`"${Bi(this)}"`},Ei.prototype.valueOf=function(){return ki(this)},Ei.prototype.toString=function(){return Bi(this)},Ei.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return ki(this);case"string":return Bi(this);case"default":return Fi(this)}return Bi(this)},Object.setPrototypeOf(Ci.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Pi.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(ji.prototype,Object.create(Uint32Array.prototype)),Object.assign(Ci.prototype,Ei.prototype,{constructor:Ci,signed:!0,TypedArray:Int32Array,BigIntArray:ri}),Object.assign(Pi.prototype,Ei.prototype,{constructor:Pi,signed:!1,TypedArray:Uint32Array,BigIntArray:oi}),Object.assign(ji.prototype,Ei.prototype,{constructor:ji,signed:!0,TypedArray:Uint32Array,BigIntArray:oi}),ni?(Fi=t=>8===t.byteLength?new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:Li(t),Bi=t=>8===t.byteLength?`${new t.BigIntArray(t.buffer,t.byteOffset,1)[0]}`:Li(t)):(Bi=Li,Fi=Bi);class Di{static new(t,e){switch(e){case!0:return new Ci(t);case!1:return new Pi(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case ri:return new Ci(t)}return 16===t.byteLength?new ji(t):new Pi(t)}static signed(t){return new Ci(t)}static unsigned(t){return new Pi(t)}static decimal(t){return new ji(t)}constructor(t,e){return Di.new(t,e)}}var Ni,Ri,zi,Ui,Vi,Wi,$i,Gi,Yi,Zi,Hi,qi,Xi,Ki,Ji,Qi,to,eo,no,ro;class io{static isNull(t){return(null==t?void 0:t.typeId)===Fr.Null}static isInt(t){return(null==t?void 0:t.typeId)===Fr.Int}static isFloat(t){return(null==t?void 0:t.typeId)===Fr.Float}static isBinary(t){return(null==t?void 0:t.typeId)===Fr.Binary}static isUtf8(t){return(null==t?void 0:t.typeId)===Fr.Utf8}static isBool(t){return(null==t?void 0:t.typeId)===Fr.Bool}static isDecimal(t){return(null==t?void 0:t.typeId)===Fr.Decimal}static isDate(t){return(null==t?void 0:t.typeId)===Fr.Date}static isTime(t){return(null==t?void 0:t.typeId)===Fr.Time}static isTimestamp(t){return(null==t?void 0:t.typeId)===Fr.Timestamp}static isInterval(t){return(null==t?void 0:t.typeId)===Fr.Interval}static isList(t){return(null==t?void 0:t.typeId)===Fr.List}static isStruct(t){return(null==t?void 0:t.typeId)===Fr.Struct}static isUnion(t){return(null==t?void 0:t.typeId)===Fr.Union}static isFixedSizeBinary(t){return(null==t?void 0:t.typeId)===Fr.FixedSizeBinary}static isFixedSizeList(t){return(null==t?void 0:t.typeId)===Fr.FixedSizeList}static isMap(t){return(null==t?void 0:t.typeId)===Fr.Map}static isDictionary(t){return(null==t?void 0:t.typeId)===Fr.Dictionary}static isDenseUnion(t){return io.isUnion(t)&&t.mode===Er.Dense}static isSparseUnion(t){return io.isUnion(t)&&t.mode===Er.Sparse}get typeId(){return Fr.NONE}}Ni=Symbol.toStringTag,io[Ni]=((ro=io.prototype).children=null,ro.ArrayType=Array,ro[Symbol.toStringTag]="DataType");class oo extends io{toString(){return"Null"}get typeId(){return Fr.Null}}Ri=Symbol.toStringTag,oo[Ri]=(t=>t[Symbol.toStringTag]="Null")(oo.prototype);class so extends io{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return Fr.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}zi=Symbol.toStringTag,so[zi]=(t=>(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(so.prototype);class ao extends so{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(class extends so{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(class extends so{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(ao.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(class extends so{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}}.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty(class extends so{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(class extends so{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(class extends so{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(class extends so{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}}.prototype,"ArrayType",{value:BigUint64Array});class uo extends io{constructor(t){super(),this.precision=t}get typeId(){return Fr.Float}get ArrayType(){switch(this.precision){case Cr.HALF:return Uint16Array;case Cr.SINGLE:return Float32Array;case Cr.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Ui=Symbol.toStringTag,uo[Ui]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(uo.prototype),Object.defineProperty(class extends uo{constructor(){super(Cr.HALF)}}.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(class extends uo{constructor(){super(Cr.SINGLE)}}.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(class extends uo{constructor(){super(Cr.DOUBLE)}}.prototype,"ArrayType",{value:Float64Array});class co extends io{constructor(){super()}get typeId(){return Fr.Binary}toString(){return"Binary"}}Vi=Symbol.toStringTag,co[Vi]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(co.prototype);class lo extends io{constructor(){super()}get typeId(){return Fr.Utf8}toString(){return"Utf8"}}Wi=Symbol.toStringTag,lo[Wi]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(lo.prototype);class fo extends io{constructor(){super()}get typeId(){return Fr.Bool}toString(){return"Bool"}}$i=Symbol.toStringTag,fo[$i]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(fo.prototype);class ho extends io{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return Fr.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}Gi=Symbol.toStringTag,ho[Gi]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(ho.prototype);class po extends io{constructor(t){super(),this.unit=t}get typeId(){return Fr.Date}toString(){return`Date${32*(this.unit+1)}<${Pr[this.unit]}>`}}Yi=Symbol.toStringTag,po[Yi]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Date"))(po.prototype);class yo extends io{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return Fr.Time}toString(){return`Time${this.bitWidth}<${jr[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}Zi=Symbol.toStringTag,yo[Zi]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(yo.prototype);class vo extends io{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return Fr.Timestamp}toString(){return`Timestamp<${jr[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Hi=Symbol.toStringTag,vo[Hi]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Timestamp"))(vo.prototype);class bo extends io{constructor(t){super(),this.unit=t}get typeId(){return Fr.Interval}toString(){return`Interval<${kr[this.unit]}>`}}qi=Symbol.toStringTag,bo[qi]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(bo.prototype);class mo extends io{constructor(t){super(),this.children=[t]}get typeId(){return Fr.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}Xi=Symbol.toStringTag,mo[Xi]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(mo.prototype);class go extends io{constructor(t){super(),this.children=t}get typeId(){return Fr.Struct}toString(){return`Struct<{${this.children.map((t=>`${t.name}:${t.type}`)).join(", ")}}>`}}Ki=Symbol.toStringTag,go[Ki]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))(go.prototype);class wo extends io{constructor(t,e,n){super(),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce(((t,e,n)=>(t[e]=n)&&t||t),Object.create(null))}get typeId(){return Fr.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map((t=>`${t.type}`)).join(" | ")}>`}}Ji=Symbol.toStringTag,wo[Ji]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(wo.prototype);class _o extends io{constructor(t){super(),this.byteWidth=t}get typeId(){return Fr.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Qi=Symbol.toStringTag,_o[Qi]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(_o.prototype);class xo extends io{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return Fr.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}to=Symbol.toStringTag,xo[to]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(xo.prototype);class So extends io{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return Fr.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map((t=>`${t.name}:${t.type}`)).join(", ")}}>`}}eo=Symbol.toStringTag,So[eo]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(So.prototype);const Oo=(Io=-1,()=>++Io);var Io;class To extends io{constructor(t,e,n,r){super(),this.indices=e,this.dictionary=t,this.isOrdered=r||!1,this.id=null==n?Oo():"number"==typeof n?n:n.low}get typeId(){return Fr.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}function Ao(t){const e=t;switch(t.typeId){case Fr.Decimal:return t.bitWidth/32;case Fr.Timestamp:return 2;case Fr.Date:case Fr.Interval:return 1+e.unit;case Fr.FixedSizeList:return e.listSize;case Fr.FixedSizeBinary:return e.byteWidth;default:return 1}}no=Symbol.toStringTag,To[no]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(To.prototype);class Mo{visitMany(t,...e){return t.map(((t,n)=>this.visit(t,...e.map((t=>t[n])))))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return function(t,e,n=!0){return"number"==typeof e?Eo(t,e,n):"string"==typeof e&&e in Fr?Eo(t,Fr[e],n):e&&e instanceof io?Eo(t,Co(e),n):(null==e?void 0:e.type)&&e.type instanceof io?Eo(t,Co(e.type),n):Eo(t,Fr.NONE,n)}(this,t,e)}getVisitFnByTypeId(t,e=!0){return Eo(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function Eo(t,e,n=!0){let r=null;switch(e){case Fr.Null:r=t.visitNull;break;case Fr.Bool:r=t.visitBool;break;case Fr.Int:r=t.visitInt;break;case Fr.Int8:r=t.visitInt8||t.visitInt;break;case Fr.Int16:r=t.visitInt16||t.visitInt;break;case Fr.Int32:r=t.visitInt32||t.visitInt;break;case Fr.Int64:r=t.visitInt64||t.visitInt;break;case Fr.Uint8:r=t.visitUint8||t.visitInt;break;case Fr.Uint16:r=t.visitUint16||t.visitInt;break;case Fr.Uint32:r=t.visitUint32||t.visitInt;break;case Fr.Uint64:r=t.visitUint64||t.visitInt;break;case Fr.Float:r=t.visitFloat;break;case Fr.Float16:r=t.visitFloat16||t.visitFloat;break;case Fr.Float32:r=t.visitFloat32||t.visitFloat;break;case Fr.Float64:r=t.visitFloat64||t.visitFloat;break;case Fr.Utf8:r=t.visitUtf8;break;case Fr.Binary:r=t.visitBinary;break;case Fr.FixedSizeBinary:r=t.visitFixedSizeBinary;break;case Fr.Date:r=t.visitDate;break;case Fr.DateDay:r=t.visitDateDay||t.visitDate;break;case Fr.DateMillisecond:r=t.visitDateMillisecond||t.visitDate;break;case Fr.Timestamp:r=t.visitTimestamp;break;case Fr.TimestampSecond:r=t.visitTimestampSecond||t.visitTimestamp;break;case Fr.TimestampMillisecond:r=t.visitTimestampMillisecond||t.visitTimestamp;break;case Fr.TimestampMicrosecond:r=t.visitTimestampMicrosecond||t.visitTimestamp;break;case Fr.TimestampNanosecond:r=t.visitTimestampNanosecond||t.visitTimestamp;break;case Fr.Time:r=t.visitTime;break;case Fr.TimeSecond:r=t.visitTimeSecond||t.visitTime;break;case Fr.TimeMillisecond:r=t.visitTimeMillisecond||t.visitTime;break;case Fr.TimeMicrosecond:r=t.visitTimeMicrosecond||t.visitTime;break;case Fr.TimeNanosecond:r=t.visitTimeNanosecond||t.visitTime;break;case Fr.Decimal:r=t.visitDecimal;break;case Fr.List:r=t.visitList;break;case Fr.Struct:r=t.visitStruct;break;case Fr.Union:r=t.visitUnion;break;case Fr.DenseUnion:r=t.visitDenseUnion||t.visitUnion;break;case Fr.SparseUnion:r=t.visitSparseUnion||t.visitUnion;break;case Fr.Dictionary:r=t.visitDictionary;break;case Fr.Interval:r=t.visitInterval;break;case Fr.IntervalDayTime:r=t.visitIntervalDayTime||t.visitInterval;break;case Fr.IntervalYearMonth:r=t.visitIntervalYearMonth||t.visitInterval;break;case Fr.FixedSizeList:r=t.visitFixedSizeList;break;case Fr.Map:r=t.visitMap}if("function"==typeof r)return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${Fr[e]}'`)}function Co(t){switch(t.typeId){case Fr.Null:return Fr.Null;case Fr.Int:{const{bitWidth:e,isSigned:n}=t;switch(e){case 8:return n?Fr.Int8:Fr.Uint8;case 16:return n?Fr.Int16:Fr.Uint16;case 32:return n?Fr.Int32:Fr.Uint32;case 64:return n?Fr.Int64:Fr.Uint64}return Fr.Int}case Fr.Float:switch(t.precision){case Cr.HALF:return Fr.Float16;case Cr.SINGLE:return Fr.Float32;case Cr.DOUBLE:return Fr.Float64}return Fr.Float;case Fr.Binary:return Fr.Binary;case Fr.Utf8:return Fr.Utf8;case Fr.Bool:return Fr.Bool;case Fr.Decimal:return Fr.Decimal;case Fr.Time:switch(t.unit){case jr.SECOND:return Fr.TimeSecond;case jr.MILLISECOND:return Fr.TimeMillisecond;case jr.MICROSECOND:return Fr.TimeMicrosecond;case jr.NANOSECOND:return Fr.TimeNanosecond}return Fr.Time;case Fr.Timestamp:switch(t.unit){case jr.SECOND:return Fr.TimestampSecond;case jr.MILLISECOND:return Fr.TimestampMillisecond;case jr.MICROSECOND:return Fr.TimestampMicrosecond;case jr.NANOSECOND:return Fr.TimestampNanosecond}return Fr.Timestamp;case Fr.Date:switch(t.unit){case Pr.DAY:return Fr.DateDay;case Pr.MILLISECOND:return Fr.DateMillisecond}return Fr.Date;case Fr.Interval:switch(t.unit){case kr.DAY_TIME:return Fr.IntervalDayTime;case kr.YEAR_MONTH:return Fr.IntervalYearMonth}return Fr.Interval;case Fr.Map:return Fr.Map;case Fr.List:return Fr.List;case Fr.Struct:return Fr.Struct;case Fr.Union:switch(t.mode){case Er.Dense:return Fr.DenseUnion;case Er.Sparse:return Fr.SparseUnion}return Fr.Union;case Fr.FixedSizeBinary:return Fr.FixedSizeBinary;case Fr.FixedSizeList:return Fr.FixedSizeList;case Fr.Dictionary:return Fr.Dictionary}throw new Error(`Unrecognized type '${Fr[t.typeId]}'`)}Mo.prototype.visitInt8=null,Mo.prototype.visitInt16=null,Mo.prototype.visitInt32=null,Mo.prototype.visitInt64=null,Mo.prototype.visitUint8=null,Mo.prototype.visitUint16=null,Mo.prototype.visitUint32=null,Mo.prototype.visitUint64=null,Mo.prototype.visitFloat16=null,Mo.prototype.visitFloat32=null,Mo.prototype.visitFloat64=null,Mo.prototype.visitDateDay=null,Mo.prototype.visitDateMillisecond=null,Mo.prototype.visitTimestampSecond=null,Mo.prototype.visitTimestampMillisecond=null,Mo.prototype.visitTimestampMicrosecond=null,Mo.prototype.visitTimestampNanosecond=null,Mo.prototype.visitTimeSecond=null,Mo.prototype.visitTimeMillisecond=null,Mo.prototype.visitTimeMicrosecond=null,Mo.prototype.visitTimeNanosecond=null,Mo.prototype.visitDenseUnion=null,Mo.prototype.visitSparseUnion=null,Mo.prototype.visitIntervalDayTime=null,Mo.prototype.visitIntervalYearMonth=null;const Po=new Float64Array(1),jo=new Uint32Array(Po.buffer);function ko(t){const e=(31744&t)>>10,n=(1023&t)/1024,r=Math.pow(-1,(32768&t)>>15);switch(e){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,e-15)*(1+n)}class Bo extends Mo{}function Fo(t){return(e,n,r)=>{if(e.setValid(n,null!=r))return t(e,n,r)}}const Lo=(t,e,n)=>{t[e]=Math.trunc(n%4294967296),t[e+1]=Math.trunc(n/4294967296)},Do=(t,e,n,r)=>{if(n+1<e.length){const{[n]:i,[n+1]:o}=e;t.set(r.subarray(0,o-i),i)}},No=({values:t},e,n)=>{t[e]=n},Ro=({values:t},e,n)=>{t[e]=n},zo=({values:t},e,n)=>{t[e]=function(t){if(t!=t)return 32256;Po[0]=t;const e=(2147483648&jo[1])>>16&65535;let n=2146435072&jo[1],r=0;return n>=1089470464?jo[0]>0?n=31744:(n=(2080374784&n)>>16,r=(1048575&jo[1])>>10):n<=1056964608?(r=1048576+(1048575&jo[1]),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=512+(1048575&jo[1])>>10),e|n|65535&r}(n)},Uo=({values:t},e,n)=>{((t,e,n)=>{t[e]=Math.trunc(n/864e5)})(t,e,n.valueOf())},Vo=({values:t},e,n)=>{Lo(t,2*e,n.valueOf())},Wo=({values:t},e,n)=>Lo(t,2*e,n/1e3),$o=({values:t},e,n)=>Lo(t,2*e,n),Go=({values:t},e,n)=>((t,e,n)=>{t[e]=Math.trunc(1e3*n%4294967296),t[e+1]=Math.trunc(1e3*n/4294967296)})(t,2*e,n),Yo=({values:t},e,n)=>((t,e,n)=>{t[e]=Math.trunc(1e6*n%4294967296),t[e+1]=Math.trunc(1e6*n/4294967296)})(t,2*e,n),Zo=({values:t},e,n)=>{t[e]=n},Ho=({values:t},e,n)=>{t[e]=n},qo=({values:t},e,n)=>{t[e]=n},Xo=({values:t},e,n)=>{t[e]=n},Ko=(t,e,n)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[r];es.visit(i,t.valueOffsets[e],n)},Jo=(t,e,n)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[r];es.visit(i,e,n)},Qo=({values:t},e,n)=>{t.set(n.subarray(0,2),2*e)},ts=({values:t},e,n)=>{t[e]=12*n[0]+n[1]%12};Bo.prototype.visitBool=Fo((({offset:t,values:e},n,r)=>{const i=t+n;r?e[i>>3]|=1<<i%8:e[i>>3]&=~(1<<i%8)})),Bo.prototype.visitInt=Fo(No),Bo.prototype.visitInt8=Fo(No),Bo.prototype.visitInt16=Fo(No),Bo.prototype.visitInt32=Fo(No),Bo.prototype.visitInt64=Fo(No),Bo.prototype.visitUint8=Fo(No),Bo.prototype.visitUint16=Fo(No),Bo.prototype.visitUint32=Fo(No),Bo.prototype.visitUint64=Fo(No),Bo.prototype.visitFloat=Fo(((t,e,n)=>{switch(t.type.precision){case Cr.HALF:return zo(t,e,n);case Cr.SINGLE:case Cr.DOUBLE:return Ro(t,e,n)}})),Bo.prototype.visitFloat16=Fo(zo),Bo.prototype.visitFloat32=Fo(Ro),Bo.prototype.visitFloat64=Fo(Ro),Bo.prototype.visitUtf8=Fo((({values:t,valueOffsets:e},n,r)=>{Do(t,e,n,ti(r))})),Bo.prototype.visitBinary=Fo((({values:t,valueOffsets:e},n,r)=>Do(t,e,n,r))),Bo.prototype.visitFixedSizeBinary=Fo((({stride:t,values:e},n,r)=>{e.set(r.subarray(0,t),t*n)})),Bo.prototype.visitDate=Fo(((t,e,n)=>{t.type.unit===Pr.DAY?Uo(t,e,n):Vo(t,e,n)})),Bo.prototype.visitDateDay=Fo(Uo),Bo.prototype.visitDateMillisecond=Fo(Vo),Bo.prototype.visitTimestamp=Fo(((t,e,n)=>{switch(t.type.unit){case jr.SECOND:return Wo(t,e,n);case jr.MILLISECOND:return $o(t,e,n);case jr.MICROSECOND:return Go(t,e,n);case jr.NANOSECOND:return Yo(t,e,n)}})),Bo.prototype.visitTimestampSecond=Fo(Wo),Bo.prototype.visitTimestampMillisecond=Fo($o),Bo.prototype.visitTimestampMicrosecond=Fo(Go),Bo.prototype.visitTimestampNanosecond=Fo(Yo),Bo.prototype.visitTime=Fo(((t,e,n)=>{switch(t.type.unit){case jr.SECOND:return Zo(t,e,n);case jr.MILLISECOND:return Ho(t,e,n);case jr.MICROSECOND:return qo(t,e,n);case jr.NANOSECOND:return Xo(t,e,n)}})),Bo.prototype.visitTimeSecond=Fo(Zo),Bo.prototype.visitTimeMillisecond=Fo(Ho),Bo.prototype.visitTimeMicrosecond=Fo(qo),Bo.prototype.visitTimeNanosecond=Fo(Xo),Bo.prototype.visitDecimal=Fo((({values:t,stride:e},n,r)=>{t.set(r.subarray(0,e),e*n)})),Bo.prototype.visitList=Fo(((t,e,n)=>{const r=t.children[0],i=t.valueOffsets,o=es.getVisitFn(r);if(Array.isArray(n))for(let t=-1,s=i[e],a=i[e+1];s<a;)o(r,s++,n[++t]);else for(let t=-1,s=i[e],a=i[e+1];s<a;)o(r,s++,n.get(++t))})),Bo.prototype.visitStruct=Fo(((t,e,n)=>{const r=t.type.children.map((t=>es.getVisitFn(t.type))),i=n instanceof Map?(o=e,s=n,(t,e,n,r)=>e&&t(e,o,s.get(n.name))):n instanceof ba?((t,e)=>(n,r,i,o)=>r&&n(r,t,e.get(o)))(e,n):Array.isArray(n)?((t,e)=>(n,r,i,o)=>r&&n(r,t,e[o]))(e,n):((t,e)=>(n,r,i,o)=>r&&n(r,t,e[i.name]))(e,n);var o,s;t.type.children.forEach(((e,n)=>i(r[n],t.children[n],e,n)))})),Bo.prototype.visitUnion=Fo(((t,e,n)=>{t.type.mode===Er.Dense?Ko(t,e,n):Jo(t,e,n)})),Bo.prototype.visitDenseUnion=Fo(Ko),Bo.prototype.visitSparseUnion=Fo(Jo),Bo.prototype.visitDictionary=Fo(((t,e,n)=>{var r;null===(r=t.dictionary)||void 0===r||r.set(t.values[e],n)})),Bo.prototype.visitInterval=Fo(((t,e,n)=>{t.type.unit===kr.DAY_TIME?Qo(t,e,n):ts(t,e,n)})),Bo.prototype.visitIntervalDayTime=Fo(Qo),Bo.prototype.visitIntervalYearMonth=Fo(ts),Bo.prototype.visitFixedSizeList=Fo(((t,e,n)=>{const{stride:r}=t,i=t.children[0],o=es.getVisitFn(i);if(Array.isArray(n))for(let t=-1,s=e*r;++t<r;)o(i,s+t,n[t]);else for(let t=-1,s=e*r;++t<r;)o(i,s+t,n.get(t))})),Bo.prototype.visitMap=Fo(((t,e,n)=>{const r=t.children[0],{valueOffsets:i}=t,o=es.getVisitFn(r);let{[e]:s,[e+1]:a}=i;const u=n instanceof Map?n.entries():Object.entries(n);for(const t of u)if(o(r,s,t),++s>=a)break}));const es=new Bo,ns=Symbol.for("parent"),rs=Symbol.for("rowIndex");class is{constructor(t,e){return this[ns]=t,this[rs]=e,new Proxy(this,new ss)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[rs],e=this[ns],n=e.type.children,r={};for(let i=-1,o=n.length;++i<o;)r[n[i].name]=Ms.visit(e.children[i],t);return r}toString(){return`{${[...this].map((([t,e])=>`${Gr(t)}: ${Gr(e)}`)).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new os(this[ns],this[rs])}}class os{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Ms.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(is.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ns]:{writable:!0,enumerable:!1,configurable:!1,value:null},[rs]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class ss{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ns].type.children.map((t=>t.name))}has(t,e){return-1!==t[ns].type.children.findIndex((t=>t.name===e))}getOwnPropertyDescriptor(t,e){if(-1!==t[ns].type.children.findIndex((t=>t.name===e)))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[ns].type.children.findIndex((t=>t.name===e));if(-1!==n){const r=Ms.visit(t[ns].children[n],t[rs]);return Reflect.set(t,e,r),r}}set(t,e,n){const r=t[ns].type.children.findIndex((t=>t.name===e));return-1!==r?(es.visit(t[ns].children[r],t[rs],n),Reflect.set(t,e,n)):!(!Reflect.has(t,e)&&"symbol"!=typeof e)&&Reflect.set(t,e,n)}}class as extends Mo{}function us(t){return(e,n)=>e.getValid(n)?t(e,n):null}const cs=(t,e)=>4294967296*t[e+1]+(t[e]>>>0),ls=t=>new Date(t),fs=(t,e,n)=>{if(n+1>=e.length)return null;const r=e[n],i=e[n+1];return t.subarray(r,i)},hs=({values:t},e)=>((t,e)=>ls(((t,e)=>864e5*t[e])(t,e)))(t,e),ds=({values:t},e)=>((t,e)=>ls(cs(t,e)))(t,2*e),ps=({stride:t,values:e},n)=>e[t*n],ys=({values:t},e)=>t[e],vs=({values:t},e)=>1e3*cs(t,2*e),bs=({values:t},e)=>cs(t,2*e),ms=({values:t},e)=>((t,e)=>t[e+1]/1e3*4294967296+(t[e]>>>0)/1e3)(t,2*e),gs=({values:t},e)=>((t,e)=>t[e+1]/1e6*4294967296+(t[e]>>>0)/1e6)(t,2*e),ws=({values:t},e)=>t[e],_s=({values:t},e)=>t[e],xs=({values:t},e)=>t[e],Ss=({values:t},e)=>t[e],Os=(t,e)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];return Ms.visit(r,t.valueOffsets[e])},Is=(t,e)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];return Ms.visit(r,e)},Ts=({values:t},e)=>t.subarray(2*e,2*(e+1)),As=({values:t},e)=>{const n=t[e],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r};as.prototype.visitNull=us(((t,e)=>null)),as.prototype.visitBool=us((({offset:t,values:e},n)=>{const r=t+n;return 0!=(e[r>>3]&1<<r%8)})),as.prototype.visitInt=us((({values:t},e)=>t[e])),as.prototype.visitInt8=us(ps),as.prototype.visitInt16=us(ps),as.prototype.visitInt32=us(ps),as.prototype.visitInt64=us(ys),as.prototype.visitUint8=us(ps),as.prototype.visitUint16=us(ps),as.prototype.visitUint32=us(ps),as.prototype.visitUint64=us(ys),as.prototype.visitFloat=us((({type:t,values:e},n)=>t.precision!==Cr.HALF?e[n]:ko(e[n]))),as.prototype.visitFloat16=us((({stride:t,values:e},n)=>ko(e[t*n]))),as.prototype.visitFloat32=us(ps),as.prototype.visitFloat64=us(ps),as.prototype.visitUtf8=us((({values:t,valueOffsets:e},n)=>{const r=fs(t,e,n);return null!==r?Jr(r):null})),as.prototype.visitBinary=us((({values:t,valueOffsets:e},n)=>fs(t,e,n))),as.prototype.visitFixedSizeBinary=us((({stride:t,values:e},n)=>e.subarray(t*n,t*(n+1)))),as.prototype.visitDate=us(((t,e)=>t.type.unit===Pr.DAY?hs(t,e):ds(t,e))),as.prototype.visitDateDay=us(hs),as.prototype.visitDateMillisecond=us(ds),as.prototype.visitTimestamp=us(((t,e)=>{switch(t.type.unit){case jr.SECOND:return vs(t,e);case jr.MILLISECOND:return bs(t,e);case jr.MICROSECOND:return ms(t,e);case jr.NANOSECOND:return gs(t,e)}})),as.prototype.visitTimestampSecond=us(vs),as.prototype.visitTimestampMillisecond=us(bs),as.prototype.visitTimestampMicrosecond=us(ms),as.prototype.visitTimestampNanosecond=us(gs),as.prototype.visitTime=us(((t,e)=>{switch(t.type.unit){case jr.SECOND:return ws(t,e);case jr.MILLISECOND:return _s(t,e);case jr.MICROSECOND:return xs(t,e);case jr.NANOSECOND:return Ss(t,e)}})),as.prototype.visitTimeSecond=us(ws),as.prototype.visitTimeMillisecond=us(_s),as.prototype.visitTimeMicrosecond=us(xs),as.prototype.visitTimeNanosecond=us(Ss),as.prototype.visitDecimal=us((({values:t,stride:e},n)=>Di.decimal(t.subarray(e*n,e*(n+1))))),as.prototype.visitList=us(((t,e)=>{const{valueOffsets:n,stride:r,children:i}=t,{[e*r]:o,[e*r+1]:s}=n,a=i[0].slice(o,s-o);return new ba([a])})),as.prototype.visitStruct=us(((t,e)=>new is(t,e))),as.prototype.visitUnion=us(((t,e)=>t.type.mode===Er.Dense?Os(t,e):Is(t,e))),as.prototype.visitDenseUnion=us(Os),as.prototype.visitSparseUnion=us(Is),as.prototype.visitDictionary=us(((t,e)=>{var n;return null===(n=t.dictionary)||void 0===n?void 0:n.get(t.values[e])})),as.prototype.visitInterval=us(((t,e)=>t.type.unit===kr.DAY_TIME?Ts(t,e):As(t,e))),as.prototype.visitIntervalDayTime=us(Ts),as.prototype.visitIntervalYearMonth=us(As),as.prototype.visitFixedSizeList=us(((t,e)=>{const{stride:n,children:r}=t,i=r[0].slice(e*n,n);return new ba([i])})),as.prototype.visitMap=us(((t,e)=>{const{valueOffsets:n,children:r}=t,{[e]:i,[e+1]:o}=n,s=r[0];return new Ps(s.slice(i,o-i))}));const Ms=new as,Es=Symbol.for("keys"),Cs=Symbol.for("vals");class Ps{constructor(t){return this[Es]=new ba([t.children[0]]).memoize(),this[Cs]=t.children[1],new Proxy(this,new ks)}[Symbol.iterator](){return new js(this[Es],this[Cs])}get size(){return this[Es].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Es],e=this[Cs],n={};for(let r=-1,i=t.length;++r<i;)n[t.get(r)]=Ms.visit(e,r);return n}toString(){return`{${[...this].map((([t,e])=>`${Gr(t)}: ${Gr(e)}`)).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class js{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Ms.visit(this.vals,t)]})}}class ks{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Es].toArray().map(String)}has(t,e){return t[Es].includes(e)}getOwnPropertyDescriptor(t,e){if(-1!==t[Es].indexOf(e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[Es].indexOf(e);if(-1!==n){const r=Ms.visit(Reflect.get(t,Cs),n);return Reflect.set(t,e,r),r}}set(t,e,n){const r=t[Es].indexOf(e);return-1!==r?(es.visit(Reflect.get(t,Cs),r,n),Reflect.set(t,e,n)):!!Reflect.has(t,e)&&Reflect.set(t,e,n)}}let Bs;function Fs(t,e,n,r){const{length:i=0}=t;let o="number"!=typeof e?0:e,s="number"!=typeof n?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(Bs=o,o=s,s=Bs),s>i&&(s=i),r?r(t,o,s):[o,s]}Object.defineProperties(Ps.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Es]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Cs]:{writable:!0,enumerable:!1,configurable:!1,value:null}});const Ls=t=>t!=t;function Ds(t){if("object"!=typeof t||null===t)return Ls(t)?Ls:e=>e===t;if(t instanceof Date){const e=t.valueOf();return t=>t instanceof Date&&t.valueOf()===e}return ArrayBuffer.isView(t)?e=>!!e&&function(t,e){let n=0;const r=t.length;if(r!==e.length)return!1;if(r>0)do{if(t[n]!==e[n])return!1}while(++n<r);return!0}(t,e):t instanceof Map?function(t){let e=-1;const n=[];for(const r of t.values())n[++e]=Ds(r);return Ns(n)}(t):Array.isArray(t)?function(t){const e=[];for(let n=-1,r=t.length;++n<r;)e[n]=Ds(t[n]);return Ns(e)}(t):t instanceof ba?function(t){const e=[];for(let n=-1,r=t.length;++n<r;)e[n]=Ds(t.get(n));return Ns(e)}(t):function(t,e=!1){const n=Object.keys(t);if(!e&&0===n.length)return()=>!1;const r=[];for(let e=-1,i=n.length;++e<i;)r[e]=Ds(t[n[e]]);return Ns(r,n)}(t,!0)}function Ns(t,e){return n=>{if(!n||"object"!=typeof n)return!1;switch(n.constructor){case Array:return function(t,e){const n=t.length;if(e.length!==n)return!1;for(let r=-1;++r<n;)if(!t[r](e[r]))return!1;return!0}(t,n);case Map:return Rs(t,n,n.keys());case Ps:case is:case Object:case void 0:return Rs(t,n,e||Object.keys(n))}return n instanceof ba&&function(t,e){const n=t.length;if(e.length!==n)return!1;for(let r=-1;++r<n;)if(!t[r](e.get(r)))return!1;return!0}(t,n)}}function Rs(t,e,n){const r=n[Symbol.iterator](),i=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),o=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let s=0;const a=t.length;let u=o.next(),c=r.next(),l=i.next();for(;s<a&&!c.done&&!l.done&&!u.done&&c.value===l.value&&t[s](u.value);++s,c=r.next(),l=i.next(),u=o.next());return!!(s===a&&c.done&&l.done&&u.done)||(r.return&&r.return(),i.return&&i.return(),o.return&&o.return(),!1)}class zs{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function Us(t){return t.reduce(((t,e)=>t+e.nullCount),0)}function Vs(t){return t.reduce(((t,e,n)=>(t[n+1]=t[n]+e.length,t)),new Uint32Array(t.length+1))}function Ws(t,e,n,r){const i=[];for(let o=-1,s=t.length;++o<s;){const s=t[o],a=e[o],{length:u}=s;if(a>=r)break;if(n>=a+u)continue;if(a>=n&&a+u<=r){i.push(s);continue}const c=Math.max(0,n-a),l=Math.min(r-a,u);i.push(s.slice(c,l-c))}return 0===i.length&&i.push(t[0].slice(0,0)),i}function $s(t,e,n,r){let i=0,o=0,s=e.length-1;do{if(i>=s-1)return n<e[s]?r(t,i,n-e[i]):null;o=i+Math.trunc(.5*(s-i)),n<e[o]?s=o:i=o}while(i<s)}function Gs(t,e){return t.getValid(e)}function Ys(t){function e(e,n,r){return t(e[n],r)}return function(t){return $s(this.data,this._offsets,t,e)}}function Zs(t){let e;function n(n,r,i){return t(n[r],i,e)}return function(t,r){const i=this.data;e=r;const o=$s(i,this._offsets,t,n);return e=void 0,o}}function Hs(t){let e;function n(n,r,i){let o=i,s=0,a=0;for(let i=r-1,u=n.length;++i<u;){const r=n[i];if(~(s=t(r,e,o)))return a+s;o=0,a+=r.length}return-1}return function(t,r){e=t;const i=this.data,o="number"!=typeof r?n(i,0,0):$s(i,this._offsets,r,n);return e=void 0,o}}function qs(t,e,n,r){return 0!=(n&1<<r)}function Xs(t,e,n,r){return(n&1<<r)>>r}function Ks(t){const e=[];let n=0,r=0,i=0;for(const o of t)o&&(i|=1<<r),8==++r&&(e[n++]=i,i=r=0);(0===n||r>0)&&(e[n++]=i);const o=new Uint8Array(e.length+7&-8);return o.set(e),o}class Js{constructor(t,e,n,r,i){this.bytes=t,this.length=n,this.context=r,this.get=i,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(8===this.bit&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}function Qs(t,e,n){if(n-e<=0)return 0;if(n-e<8){let r=0;for(const i of new Js(t,e,n-e,t,Xs))r+=i;return r}const r=n>>3<<3,i=e+(e%8==0?0:8-e%8);return Qs(t,e,i)+Qs(t,r,n)+function(t,e,n){let r=0,i=Math.trunc(e);const o=new DataView(t.buffer,t.byteOffset,t.byteLength),s=void 0===n?t.byteLength:i+n;for(;s-i>=4;)r+=ta(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=ta(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=ta(o.getUint8(i)),i+=1;return r}(t,i>>3,r-i>>3)}function ta(t){let e=Math.trunc(t);return e-=e>>>1&1431655765,e=(858993459&e)+(e>>>2&858993459),16843009*(e+(e>>>4)&252645135)>>>24}class ea extends Mo{}function na(t,e,n){if(void 0===e)return-1;if(null===e)return function(t,e){const{nullBitmap:n}=t;if(!n||t.nullCount<=0)return-1;let r=0;for(const i of new Js(n,t.offset+(e||0),t.length,n,qs)){if(!i)return r;++r}return-1}(t,n);const r=Ms.getVisitFn(t),i=Ds(e);for(let e=(n||0)-1,o=t.length;++e<o;)if(i(r(t,e)))return e;return-1}function ra(t,e,n){const r=Ms.getVisitFn(t),i=Ds(e);for(let e=(n||0)-1,o=t.length;++e<o;)if(i(r(t,e)))return e;return-1}ea.prototype.visitNull=function(t,e){return null===e&&t.length>0?0:-1},ea.prototype.visitBool=na,ea.prototype.visitInt=na,ea.prototype.visitInt8=na,ea.prototype.visitInt16=na,ea.prototype.visitInt32=na,ea.prototype.visitInt64=na,ea.prototype.visitUint8=na,ea.prototype.visitUint16=na,ea.prototype.visitUint32=na,ea.prototype.visitUint64=na,ea.prototype.visitFloat=na,ea.prototype.visitFloat16=na,ea.prototype.visitFloat32=na,ea.prototype.visitFloat64=na,ea.prototype.visitUtf8=na,ea.prototype.visitBinary=na,ea.prototype.visitFixedSizeBinary=na,ea.prototype.visitDate=na,ea.prototype.visitDateDay=na,ea.prototype.visitDateMillisecond=na,ea.prototype.visitTimestamp=na,ea.prototype.visitTimestampSecond=na,ea.prototype.visitTimestampMillisecond=na,ea.prototype.visitTimestampMicrosecond=na,ea.prototype.visitTimestampNanosecond=na,ea.prototype.visitTime=na,ea.prototype.visitTimeSecond=na,ea.prototype.visitTimeMillisecond=na,ea.prototype.visitTimeMicrosecond=na,ea.prototype.visitTimeNanosecond=na,ea.prototype.visitDecimal=na,ea.prototype.visitList=na,ea.prototype.visitStruct=na,ea.prototype.visitUnion=na,ea.prototype.visitDenseUnion=ra,ea.prototype.visitSparseUnion=ra,ea.prototype.visitDictionary=na,ea.prototype.visitInterval=na,ea.prototype.visitIntervalDayTime=na,ea.prototype.visitIntervalYearMonth=na,ea.prototype.visitFixedSizeList=na,ea.prototype.visitMap=na;const ia=new ea;class oa extends Mo{}function sa(t){const{type:e}=t;if(0===t.nullCount&&1===t.stride&&(e.typeId===Fr.Timestamp||e instanceof so&&64!==e.bitWidth||e instanceof yo&&64!==e.bitWidth||e instanceof uo&&e.precision!==Cr.HALF))return new zs(t.data.length,(e=>{const n=t.data[e];return n.values.subarray(0,n.length)[Symbol.iterator]()}));let n=0;return new zs(t.data.length,(e=>{const r=t.data[e].length,i=t.slice(n,n+r);return n+=r,new aa(i)}))}class aa{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}oa.prototype.visitNull=sa,oa.prototype.visitBool=sa,oa.prototype.visitInt=sa,oa.prototype.visitInt8=sa,oa.prototype.visitInt16=sa,oa.prototype.visitInt32=sa,oa.prototype.visitInt64=sa,oa.prototype.visitUint8=sa,oa.prototype.visitUint16=sa,oa.prototype.visitUint32=sa,oa.prototype.visitUint64=sa,oa.prototype.visitFloat=sa,oa.prototype.visitFloat16=sa,oa.prototype.visitFloat32=sa,oa.prototype.visitFloat64=sa,oa.prototype.visitUtf8=sa,oa.prototype.visitBinary=sa,oa.prototype.visitFixedSizeBinary=sa,oa.prototype.visitDate=sa,oa.prototype.visitDateDay=sa,oa.prototype.visitDateMillisecond=sa,oa.prototype.visitTimestamp=sa,oa.prototype.visitTimestampSecond=sa,oa.prototype.visitTimestampMillisecond=sa,oa.prototype.visitTimestampMicrosecond=sa,oa.prototype.visitTimestampNanosecond=sa,oa.prototype.visitTime=sa,oa.prototype.visitTimeSecond=sa,oa.prototype.visitTimeMillisecond=sa,oa.prototype.visitTimeMicrosecond=sa,oa.prototype.visitTimeNanosecond=sa,oa.prototype.visitDecimal=sa,oa.prototype.visitList=sa,oa.prototype.visitStruct=sa,oa.prototype.visitUnion=sa,oa.prototype.visitDenseUnion=sa,oa.prototype.visitSparseUnion=sa,oa.prototype.visitDictionary=sa,oa.prototype.visitInterval=sa,oa.prototype.visitIntervalDayTime=sa,oa.prototype.visitIntervalYearMonth=sa,oa.prototype.visitFixedSizeList=sa,oa.prototype.visitMap=sa;const ua=new oa,ca=(t,e)=>t+e;class la extends Mo{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return 4*(t.type.unit+1)}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===jr.SECOND?4:8}visitInterval(t,e){return 4*(t.type.unit+1)}visitStruct(t,e){return t.children.reduce(((t,n)=>t+da.visit(n,e)),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce(((t,n)=>t+da.visit(n,e)),0)}visitDictionary(t,e){var n;return t.type.indices.bitWidth/8+((null===(n=t.dictionary)||void 0===n?void 0:n.getByteLength(t.values[e]))||0)}}const fa=({type:t,children:e,typeIds:n,valueOffsets:r},i)=>{const o=t.typeIdToChildIndex[n[i]];return 8+da.visit(e[o],r[i])},ha=({children:t},e)=>4+da.visitMany(t,t.map((()=>e))).reduce(ca,0);la.prototype.visitUtf8=({valueOffsets:t},e)=>t[e+1]-t[e]+8,la.prototype.visitBinary=({valueOffsets:t},e)=>t[e+1]-t[e]+8,la.prototype.visitList=({valueOffsets:t,stride:e,children:n},r)=>{const i=n[0],{[r*e]:o}=t,{[r*e+1]:s}=t,a=da.getVisitFn(i.type),u=i.slice(o,s-o);let c=8;for(let t=-1,e=s-o;++t<e;)c+=a(u,t);return c},la.prototype.visitFixedSizeList=({stride:t,children:e},n)=>{const r=e[0],i=r.slice(n*t,t),o=da.getVisitFn(r.type);let s=0;for(let t=-1,e=i.length;++t<e;)s+=o(i,t);return s},la.prototype.visitUnion=(t,e)=>t.type.mode===Er.Dense?fa(t,e):ha(t,e),la.prototype.visitDenseUnion=fa,la.prototype.visitSparseUnion=ha;const da=new la;var pa;const ya={},va={};class ba{constructor(t){var e,n,r;const i=t[0]instanceof ba?t.flatMap((t=>t.data)):t;if(0===i.length||i.some((t=>!(t instanceof ga))))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=null===(e=i[0])||void 0===e?void 0:e.type;switch(i.length){case 0:this._offsets=[0];break;case 1:{const{get:t,set:e,indexOf:n,byteLength:r}=ya[o.typeId],s=i[0];this.isValid=t=>Gs(s,t),this.get=e=>t(s,e),this.set=(t,n)=>e(s,t,n),this.indexOf=t=>n(s,t),this.getByteLength=t=>r(s,t),this._offsets=[0,s.length];break}default:Object.setPrototypeOf(this,va[o.typeId]),this._offsets=Vs(i)}this.data=i,this.type=o,this.stride=Ao(o),this.numChildren=null!==(r=null===(n=o.children)||void 0===n?void 0:n.length)&&void 0!==r?r:0,this.length=this._offsets[this._offsets.length-1]}get byteLength(){return-1===this._byteLength&&(this._byteLength=this.data.reduce(((t,e)=>t+e.byteLength),0)),this._byteLength}get nullCount(){return-1===this._nullCount&&(this._nullCount=Us(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${Fr[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>0}getByteLength(t){return 0}[Symbol.iterator](){return ua.visit(this)}concat(...t){return new ba(this.data.concat(t.flatMap((t=>t.data)).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new ba(Fs(this,t,e,(({data:t,_offsets:e},n,r)=>Ws(t,e,n,r))))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:r,ArrayType:i}=this;switch(t.typeId){case Fr.Int:case Fr.Float:case Fr.Decimal:case Fr.Time:case Fr.Timestamp:switch(e.length){case 0:return new i;case 1:return e[0].values.subarray(0,n*r);default:return e.reduce(((t,{values:e})=>(t.array.set(e,t.offset),t.offset+=e.length,t)),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt(null===(e=this.type.children)||void 0===e?void 0:e.findIndex((e=>e.name===t)))}getChildAt(t){return t>-1&&t<this.numChildren?new ba(this.data.map((({children:e})=>e[t]))):null}get isMemoized(){return!!io.isDictionary(this.type)&&this.data[0].dictionary.isMemoized}memoize(){if(io.isDictionary(this.type)){const t=new ma(this.data[0].dictionary),e=this.data.map((e=>{const n=e.clone();return n.dictionary=t,n}));return new ba(e)}return new ma(this)}unmemoize(){if(io.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map((e=>{const n=e.clone();return n.dictionary=t,n}));return new ba(e)}return this}}pa=Symbol.toStringTag,ba[pa]=(t=>{t.type=io.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._nullCount=-1,t._byteLength=-1,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;const e=Object.keys(Fr).map((t=>Fr[t])).filter((t=>"number"==typeof t&&t!==Fr.NONE));for(const n of e){const e=Ms.getVisitFnByTypeId(n),r=es.getVisitFnByTypeId(n),i=ia.getVisitFnByTypeId(n),o=da.getVisitFnByTypeId(n);ya[n]={get:e,set:r,indexOf:i,byteLength:o},va[n]=Object.create(t,{isValid:{value:Ys(Gs)},get:{value:Ys(Ms.getVisitFnByTypeId(n))},set:{value:Zs(es.getVisitFnByTypeId(n))},indexOf:{value:Hs(ia.getVisitFnByTypeId(n))},getByteLength:{value:Ys(da.getVisitFnByTypeId(n))}})}return"Vector"})(ba.prototype);class ma extends ba{constructor(t){super(t.data);const e=this.get,n=this.set,r=this.slice,i=new Array(this.length);Object.defineProperty(this,"get",{value(t){const n=i[t];if(void 0!==n)return n;const r=e.call(this,t);return i[t]=r,r}}),Object.defineProperty(this,"set",{value(t,e){n.call(this,t,e),i[t]=e}}),Object.defineProperty(this,"slice",{value:(t,e)=>new ma(r.call(this,t,e))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new ba(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class ga{constructor(t,e,n,r,i,o=[],s){let a;this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(r||0,-1)),i instanceof ga?(this.stride=i.stride,this.values=i.values,this.typeIds=i.typeIds,this.nullBitmap=i.nullBitmap,this.valueOffsets=i.valueOffsets):(this.stride=Ao(t),i&&((a=i[0])&&(this.valueOffsets=a),(a=i[1])&&(this.values=a),(a=i[2])&&(this.nullBitmap=a),(a=i[3])&&(this.typeIds=a))),this.nullable=0!==this._nullCount&&this.nullBitmap&&this.nullBitmap.byteLength>0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:r,typeIds:i}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),this.children.reduce(((t,e)=>t+e.byteLength),t)}get nullCount(){let t,e=this._nullCount;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=this.length-Qs(t,this.offset,this.offset+this.length)),e}getValid(t){if(this.nullable&&this.nullCount>0){const e=this.offset+t;return 0!=(this.nullBitmap[e>>3]&1<<e%8)}return!0}setValid(t,e){if(!this.nullable)return e;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){const{nullBitmap:t}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:t,_nullCount:0})}const{nullBitmap:n,offset:r}=this,i=r+t>>3,o=(r+t)%8,s=n[i]>>o&1;return e?0===s&&(n[i]|=1<<o,this._nullCount=this.nullCount+1):1===s&&(n[i]&=~(1<<o),this._nullCount=this.nullCount-1),e}clone(t=this.type,e=this.offset,n=this.length,r=this._nullCount,i=this,o=this.children){return new ga(t,e,n,r,i,o,this.dictionary)}slice(t,e){const{stride:n,typeId:r,children:i}=this,o=+(0===this._nullCount)-1,s=16===r?n:1,a=this._sliceBuffers(t,e,n,r);return this.clone(this.type,this.offset+t,e,o,a,0===i.length||this.valueOffsets?i:this._sliceChildren(i,s*t,s*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===Fr.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,r=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);r[e>>3]=(1<<e-(-8&e))-1,n>0&&r.set(function(t,e,n){const r=n.byteLength+7&-8;if(t>0||n.byteLength<r){const i=new Uint8Array(r);return i.set(t%8==0?n.subarray(t>>3):Ks(new Js(n,t,e,null,qs)).subarray(0,r)),i}return n}(this.offset,e,this.nullBitmap),0);const i=this.buffers;return i[Lr.VALIDITY]=r,this.clone(this.type,0,t,n+(t-e),i)}_sliceBuffers(t,e,n,r){let i;const{buffers:o}=this;return(i=o[Lr.TYPE])&&(o[Lr.TYPE]=i.subarray(t,t+e)),(i=o[Lr.OFFSET])&&(o[Lr.OFFSET]=i.subarray(t,t+e+1))||(i=o[Lr.DATA])&&(o[Lr.DATA]=6===r?i:i.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map((t=>t.slice(e,n)))}}ga.prototype.children=Object.freeze([]);class wa extends Mo{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{type:e,offset:n=0,length:r=0}=t;return new ga(e,n,r,0)}visitBool(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length>>3,nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitInt(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length,nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitFloat(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length,nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitUtf8(t){const{type:e,offset:n=0}=t,r=Ii(t.data),i=Ii(t.nullBitmap),o=Oi(t.valueOffsets),{length:s=o.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[o,r,i])}visitBinary(t){const{type:e,offset:n=0}=t,r=Ii(t.data),i=Ii(t.nullBitmap),o=Oi(t.valueOffsets),{length:s=o.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[o,r,i])}visitFixedSizeBinary(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitDate(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitTimestamp(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitTime(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitDecimal(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitList(t){const{type:e,offset:n=0,child:r}=t,i=Ii(t.nullBitmap),o=Oi(t.valueOffsets),{length:s=o.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[o,void 0,i],[r])}visitStruct(t){const{type:e,offset:n=0,children:r=[]}=t,i=Ii(t.nullBitmap),{length:o=r.reduce(((t,{length:e})=>Math.max(t,e)),0),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,void 0,i],r)}visitUnion(t){const{type:e,offset:n=0,children:r=[]}=t,i=Ii(t.nullBitmap),o=Si(e.ArrayType,t.typeIds),{length:s=o.length,nullCount:a=(t.nullBitmap?-1:0)}=t;if(io.isSparseUnion(e))return new ga(e,n,s,a,[void 0,void 0,i,o],r);const u=Oi(t.valueOffsets);return new ga(e,n,s,a,[u,void 0,i,o],r)}visitDictionary(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.indices.ArrayType,t.data),{dictionary:o=new ba([(new wa).visit({type:e.dictionary})])}=t,{length:s=i.length,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[void 0,i,r],[],o)}visitInterval(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitFixedSizeList(t){const{type:e,offset:n=0,child:r=(new wa).visit({type:e.valueType})}=t,i=Ii(t.nullBitmap),{length:o=r.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,void 0,i],[r])}visitMap(t){const{type:e,offset:n=0,child:r=(new wa).visit({type:e.childType})}=t,i=Ii(t.nullBitmap),o=Oi(t.valueOffsets),{length:s=o.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[o,void 0,i],[r])}}function _a(t){return(new wa).visit(t)}class xa{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Ia(t)),this.dictionaries=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map((t=>t.name))}toString(){return`Schema<{ ${this.fields.map(((t,e)=>`${e}: ${t}`)).join(", ")} }>`}select(t){const e=new Set(t),n=this.fields.filter((t=>e.has(t.name)));return new xa(n,this.metadata)}selectAt(t){const e=t.map((t=>this.fields[t])).filter(Boolean);return new xa(e,this.metadata)}assign(...t){const e=t[0]instanceof xa?t[0]:Array.isArray(t[0])?new xa(t[0]):new xa(t),n=[...this.fields],r=Oa(Oa(new Map,this.metadata),e.metadata),i=e.fields.filter((t=>{const e=n.findIndex((e=>e.name===t.name));return!~e||(n[e]=t.clone({metadata:Oa(Oa(new Map,n[e].metadata),t.metadata)}))&&!1})),o=Ia(i,new Map);return new xa([...n,...i],r,new Map([...this.dictionaries,...o]))}}xa.prototype.fields=null,xa.prototype.metadata=null,xa.prototype.dictionaries=null;class Sa{constructor(t,e,n=!1,r){this.name=t,this.type=e,this.nullable=n,this.metadata=r||new Map}static new(...t){let[e,n,r,i]=t;return t[0]&&"object"==typeof t[0]&&(({name:e}=t[0]),void 0===n&&(n=t[0].type),void 0===r&&(r=t[0].nullable),void 0===i&&(i=t[0].metadata)),new Sa(`${e}`,n,r,i)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,r,i]=t;return t[0]&&"object"==typeof t[0]?({name:e=this.name,type:n=this.type,nullable:r=this.nullable,metadata:i=this.metadata}=t[0]):[e=this.name,n=this.type,r=this.nullable,i=this.metadata]=t,Sa.new(e,n,r,i)}}function Oa(t,e){return new Map([...t||new Map,...e||new Map])}function Ia(t,e=new Map){for(let n=-1,r=t.length;++n<r;){const r=t[n].type;if(io.isDictionary(r))if(e.has(r.id)){if(e.get(r.id)!==r.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}else e.set(r.id,r.dictionary);r.children&&r.children.length>0&&Ia(r.children,e)}return e}Sa.prototype.type=null,Sa.prototype.name=null,Sa.prototype.nullable=null,Sa.prototype.metadata=null;class Ta extends Mo{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every(((t,n)=>this.compareFields(t,e[n])))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function Aa(t,e){return e instanceof t.constructor}function Ma(t,e){return t===e||Aa(t,e)}function Ea(t,e){return t===e||Aa(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function Ca(t,e){return t===e||Aa(t,e)&&t.precision===e.precision}function Pa(t,e){return t===e||Aa(t,e)&&t.unit===e.unit}function ja(t,e){return t===e||Aa(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function ka(t,e){return t===e||Aa(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function Ba(t,e){return t===e||Aa(t,e)&&t.mode===e.mode&&t.typeIds.every(((t,n)=>t===e.typeIds[n]))&&La.compareManyFields(t.children,e.children)}function Fa(t,e){return t===e||Aa(t,e)&&t.unit===e.unit}Ta.prototype.visitNull=Ma,Ta.prototype.visitBool=Ma,Ta.prototype.visitInt=Ea,Ta.prototype.visitInt8=Ea,Ta.prototype.visitInt16=Ea,Ta.prototype.visitInt32=Ea,Ta.prototype.visitInt64=Ea,Ta.prototype.visitUint8=Ea,Ta.prototype.visitUint16=Ea,Ta.prototype.visitUint32=Ea,Ta.prototype.visitUint64=Ea,Ta.prototype.visitFloat=Ca,Ta.prototype.visitFloat16=Ca,Ta.prototype.visitFloat32=Ca,Ta.prototype.visitFloat64=Ca,Ta.prototype.visitUtf8=Ma,Ta.prototype.visitBinary=Ma,Ta.prototype.visitFixedSizeBinary=function(t,e){return t===e||Aa(t,e)&&t.byteWidth===e.byteWidth},Ta.prototype.visitDate=Pa,Ta.prototype.visitDateDay=Pa,Ta.prototype.visitDateMillisecond=Pa,Ta.prototype.visitTimestamp=ja,Ta.prototype.visitTimestampSecond=ja,Ta.prototype.visitTimestampMillisecond=ja,Ta.prototype.visitTimestampMicrosecond=ja,Ta.prototype.visitTimestampNanosecond=ja,Ta.prototype.visitTime=ka,Ta.prototype.visitTimeSecond=ka,Ta.prototype.visitTimeMillisecond=ka,Ta.prototype.visitTimeMicrosecond=ka,Ta.prototype.visitTimeNanosecond=ka,Ta.prototype.visitDecimal=Ma,Ta.prototype.visitList=function(t,e){return t===e||Aa(t,e)&&t.children.length===e.children.length&&La.compareManyFields(t.children,e.children)},Ta.prototype.visitStruct=function(t,e){return t===e||Aa(t,e)&&t.children.length===e.children.length&&La.compareManyFields(t.children,e.children)},Ta.prototype.visitUnion=Ba,Ta.prototype.visitDenseUnion=Ba,Ta.prototype.visitSparseUnion=Ba,Ta.prototype.visitDictionary=function(t,e){return t===e||Aa(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&La.visit(t.indices,e.indices)&&La.visit(t.dictionary,e.dictionary)},Ta.prototype.visitInterval=Fa,Ta.prototype.visitIntervalDayTime=Fa,Ta.prototype.visitIntervalYearMonth=Fa,Ta.prototype.visitFixedSizeList=function(t,e){return t===e||Aa(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&La.compareManyFields(t.children,e.children)},Ta.prototype.visitMap=function(t,e){return t===e||Aa(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&La.compareManyFields(t.children,e.children)};const La=new Ta;function Da(t,e){return La.compareSchemas(t,e)}var Na,Ra;class za{constructor(...t){switch(t.length){case 2:if([this.schema]=t,!(this.schema instanceof xa))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=_a({nullCount:0,type:new go(this.schema.fields),children:this.schema.fields.map((t=>_a({type:t.type,nullCount:0})))})]=t,!(this.data instanceof ga))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Ua(this.schema,this.data.children);break;case 1:{const[e]=t,{fields:n,children:r,length:i}=Object.keys(e).reduce(((t,n,r)=>(t.children[r]=e[n],t.length=Math.max(t.length,e[n].length),t.fields[r]=Sa.new({name:n,type:e[n].type,nullable:!0}),t)),{length:0,fields:new Array,children:new Array}),o=new xa(n),s=_a({type:new go(n),length:i,children:r,nullCount:0});[this.schema,this.data]=Ua(o,s.children,i);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Va(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return Ms.visit(this.data,t)}set(t,e){return es.visit(this.data,t,e)}indexOf(t,e){return ia.visit(this.data,t,e)}getByteLength(t){return da.visit(this.data,t)}[Symbol.iterator](){return ua.visit(new ba([this.data]))}toArray(){return[...this]}concat(...t){return new Ya(this.schema,[this,...t])}slice(t,e){const[n]=new ba([this.data]).slice(t,e).data;return new za(this.schema,n)}getChild(t){var e;return this.getChildAt(null===(e=this.schema.fields)||void 0===e?void 0:e.findIndex((e=>e.name===t)))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new ba([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt(null===(n=this.schema.fields)||void 0===n?void 0:n.findIndex((e=>e.name===t)),e)}setChildAt(t,e){let n=this.schema,r=this.data;if(t>-1&&t<this.numCols){e||(e=new ba([_a({type:new oo,length:this.numRows})]));const i=n.fields.slice(),o=r.children.slice(),s=i[t].clone({type:e.type});[i[t],o[t]]=[s,e.data[0]],n=new xa(i,new Map(this.schema.metadata)),r=_a({type:new go(i),children:o})}return new za(n,r)}select(t){const e=this.schema.select(t),n=new go(e.fields),r=[];for(const e of t){const t=this.schema.fields.findIndex((t=>t.name===e));~t&&(r[t]=this.data.children[t])}return new za(e,_a({type:n,length:this.numRows,children:r}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map((t=>this.data.children[t])).filter(Boolean),r=_a({type:new go(e.fields),length:this.numRows,children:n});return new za(e,r)}}function Ua(t,e,n=e.reduce(((t,e)=>Math.max(t,e.length)),0)){var r;const i=[...t.fields],o=[...e],s=(n+63&-64)>>3;for(const[a,u]of t.fields.entries()){const t=e[a];t&&t.length===n||(i[a]=u.clone({nullable:!0}),o[a]=null!==(r=null==t?void 0:t._changeLengthAndBackfillNullBitmap(n))&&void 0!==r?r:_a({type:u.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[t.assign(i),_a({type:new go(i),length:n,children:o})]}function Va(t,e,n=new Map){for(let r=-1,i=t.length;++r<i;){const i=t[r].type,o=e[r];if(io.isDictionary(i))if(n.has(i.id)){if(n.get(i.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}else o.dictionary&&n.set(i.id,o.dictionary);i.children&&i.children.length>0&&Va(i.children,o.children,n)}return n}Na=Symbol.toStringTag,za[Na]=(t=>(t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(za.prototype);class Wa extends za{constructor(t){const e=t.fields.map((t=>_a({type:t.type})));super(t,_a({type:new go(t.fields),nullCount:0,children:e}))}}function $a(t,e){return function(t,e){const n=[...t.fields],r=[],i={numBatches:e.reduce(((t,e)=>Math.max(t,e.length)),0)};let o=0,s=0,a=-1;const u=e.length;let c,l=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<u;)l[a]=c=e[a].shift(),s=Math.min(s,c?c.length:s);Number.isFinite(s)&&(l=Ga(n,s,l,e,i),s>0&&(r[o++]=_a({type:new go(n),length:s,nullCount:0,children:l.slice()})))}return[t=t.assign(n),r.map((e=>new za(t,e)))]}(t,e.map((t=>t.data.concat())))}function Ga(t,e,n,r,i){var o;const s=(e+63&-64)>>3;for(let a=-1,u=r.length;++a<u;){const u=n[a],c=null==u?void 0:u.length;if(c>=e)c===e?n[a]=u:(n[a]=u.slice(0,e),i.numBatches=Math.max(i.numBatches,r[a].unshift(u.slice(e,c-e))));else{const r=t[a];t[a]=r.clone({nullable:!0}),n[a]=null!==(o=null==u?void 0:u._changeLengthAndBackfillNullBitmap(e))&&void 0!==o?o:_a({type:r.type,length:e,nullCount:e,nullBitmap:new Uint8Array(s)})}}return n}class Ya{constructor(...t){var e,n;if(0===t.length)return this.batches=[],this.schema=new xa([]),this._offsets=[0],this;let r,i;t[0]instanceof xa&&(r=t.shift()),t[t.length-1]instanceof Uint32Array&&(i=t.pop());const o=t=>{if(t){if(t instanceof za)return[t];if(t instanceof Ya)return t.batches;if(t instanceof ga){if(t.type instanceof go)return[new za(new xa(t.type.children),t)]}else{if(Array.isArray(t))return t.flatMap((t=>o(t)));if("function"==typeof t[Symbol.iterator])return[...t].flatMap((t=>o(t)));if("object"==typeof t){const e=Object.keys(t),n=e.map((e=>new ba([t[e]]))),r=new xa(e.map(((t,e)=>new Sa(String(t),n[e].type)))),[,i]=$a(r,n);return 0===i.length?[new za(t)]:i}}}return[]},s=t.flatMap((t=>o(t)));if(r=null!==(n=null!=r?r:null===(e=s[0])||void 0===e?void 0:e.schema)&&void 0!==n?n:new xa([]),!(r instanceof xa))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const t of s){if(!(t instanceof za))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Da(r,t.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=r,this.batches=s,this._offsets=null!=i?i:Vs(this.data)}get data(){return this.batches.map((({data:t})=>t))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce(((t,e)=>t+e.length),0)}get nullCount(){return-1===this._nullCount&&(this._nullCount=Us(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?ua.visit(new ba(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(",\n ")}\n]`}concat(...t){const e=this.schema,n=this.data.concat(t.flatMap((({data:t})=>t)));return new Ya(e,n.map((t=>new za(e,t))))}slice(t,e){const n=this.schema;[t,e]=Fs({length:this.numRows},t,e);const r=Ws(this.data,this._offsets,t,e);return new Ya(n,r.map((t=>new za(n,t))))}getChild(t){return this.getChildAt(this.schema.fields.findIndex((e=>e.name===t)))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){const e=this.data.map((e=>e.children[t]));if(0===e.length){const{type:n}=this.schema.fields[t],r=_a({type:n,length:0,nullCount:0});e.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new ba(e)}return null}setChild(t,e){var n;return this.setChildAt(null===(n=this.schema.fields)||void 0===n?void 0:n.findIndex((e=>e.name===t)),e)}setChildAt(t,e){let n=this.schema,r=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new ba([_a({type:new oo,length:this.numRows})]));const i=n.fields.slice(),o=i[t].clone({type:e.type}),s=this.schema.fields.map(((t,e)=>this.getChildAt(e)));[i[t],s[t]]=[o,e],[n,r]=$a(n,s)}return new Ya(n,r)}select(t){const e=this.schema.fields.reduce(((t,e,n)=>t.set(e.name,n)),new Map);return this.selectAt(t.map((t=>e.get(t))).filter((t=>t>-1)))}selectAt(t){const e=this.schema.selectAt(t),n=this.batches.map((e=>e.selectAt(t)));return new Ya(e,n)}assign(t){const e=this.schema.fields,[n,r]=t.schema.fields.reduce(((t,n,r)=>{const[i,o]=t,s=e.findIndex((t=>t.name===n.name));return~s?o[s]=r:i.push(r),t}),[[],[]]),i=this.schema.assign(t.schema),o=[...e.map(((t,e)=>[e,r[e]])).map((([e,n])=>void 0===n?this.getChildAt(e):t.getChildAt(n))),...n.map((e=>t.getChildAt(e)))].filter(Boolean);return new Ya(...$a(i,o))}}Ra=Symbol.toStringTag,Ya[Ra]=(t=>(t.schema=null,t.batches=[],t._offsets=new Uint32Array([0]),t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,t.isValid=Ys(Gs),t.get=Ys(Ms.getVisitFn(Fr.Struct)),t.set=Zs(es.getVisitFn(Fr.Struct)),t.indexOf=Hs(ia.getVisitFn(Fr.Struct)),t.getByteLength=Ys(da.getVisitFn(Fr.Struct)),"Table"))(Ya.prototype);class Za{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,r){return t.prep(8,24),t.writeInt64(r),t.pad(4),t.writeInt32(n),t.writeInt64(e),t.offset()}}const Ha=new Int32Array(2),qa=new Float32Array(Ha.buffer),Xa=new Float64Array(Ha.buffer),Ka=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];class Ja{constructor(t,e){this.low=0|t,this.high=0|e}static create(t,e){return 0==t&&0==e?Ja.ZERO:new Ja(t,e)}toFloat64(){return(this.low>>>0)+4294967296*this.high}equals(t){return this.low==t.low&&this.high==t.high}}var Qa,tu,eu,nu,ru;Ja.ZERO=new Ja(0,0),function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(Qa||(Qa={}));class iu{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new iu(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return new Ja(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new Ja(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return Ha[0]=this.readInt32(t),qa[0]}readFloat64(t){return Ha[Ka?0:1]=this.readInt32(t),Ha[Ka?1:0]=this.readInt32(t+4),Xa[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){qa[0]=e,this.writeInt32(t,Ha[0])}writeFloat64(t,e){Xa[0]=e,this.writeInt32(t,Ha[Ka?0:1]),this.writeInt32(t+4,Ha[Ka?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){const n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);const n=this.readInt32(t);let r="",i=0;if(t+=4,e===Qa.UTF8_BYTES)return this.bytes_.subarray(t,t+n);for(;i<n;){let e;const n=this.readUint8(t+i++);if(n<192)e=n;else{const r=this.readUint8(t+i++);if(n<224)e=(31&n)<<6|63&r;else{const o=this.readUint8(t+i++);e=n<240?(15&n)<<12|(63&r)<<6|63&o:(7&n)<<18|(63&r)<<12|(63&o)<<6|63&this.readUint8(t+i++)}}e<65536?r+=String.fromCharCode(e):(e-=65536,r+=String.fromCharCode(55296+(e>>10),56320+(1023&e)))}return r}__union_with_string(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createLong(t,e){return Ja.create(t,e)}createScalarList(t,e){const n=[];for(let r=0;r<e;++r)null!==t(r)&&n.push(t(r));return n}createObjList(t,e){const n=[];for(let r=0;r<e;++r){const e=t(r);null!==e&&n.push(e.unpack())}return n}}class ou{constructor(t){let e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,e=t||1024,this.bb=iu.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);const n=1+~(this.bb.capacity()-this.space+e)&t-1;for(;this.space<n+t+e;){const t=this.bb.capacity();this.bb=ou.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){!this.force_defaults&&e.equals(n)||(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(t){null!==this.vtable&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){const e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const n=e<<1,r=iu.allocate(n);return r.setPosition(n-e),r.bytes().set(t.bytes(),n-e),r}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&0==this.vtable[e];e--);const n=e+1;for(;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);const r=2*(n+2);this.addInt16(r);let i=0;const o=this.space;t:for(e=0;e<this.vtables.length;e++){const t=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(t)){for(let e=2;e<r;e+=2)if(this.bb.readInt16(o+e)!=this.bb.readInt16(t+e))continue t;i=this.vtables[e];break}}return i?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,i-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){const r=n?4:0;if(e){const t=e;if(this.prep(this.minalign,8+r),4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(let e=3;e>=0;e--)this.writeInt8(t.charCodeAt(e))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const n=this.bb.capacity()-t,r=n-this.bb.readInt32(n);if(0==this.bb.readInt16(r+e))throw new Error("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(!t)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let n=0;for(;n<t.length;){let r;const i=t.charCodeAt(n++);r=i<55296||i>=56320?i:(i<<10)+t.charCodeAt(n++)+-56613888,r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(63&r|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let t=0,n=this.space,r=this.bb.bytes();t<e.length;t++)r[n++]=e[t];return this.endVector()}createLong(t,e){return Ja.create(t,e)}createObjectOffset(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let n=0;n<t.length;++n){const r=t[n];if(null===r)throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}}class su{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new su).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new su).__init(t.readInt32(t.position())+t.position(),t)}key(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return su.startKeyValue(t),su.addKey(t,e),su.addValue(t,n),su.endKeyValue(t)}}!function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"}(tu||(tu={})),function(t){t[t.Little=0]="Little",t[t.Big=1]="Big"}(eu||(eu={})),function(t){t[t.DenseArray=0]="DenseArray"}(nu||(nu={}));class au{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new au).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new au).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return au.startInt(t),au.addBitWidth(t,e),au.addIsSigned(t,n),au.endInt(t)}}class uu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new uu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new uu).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}indexType(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new au).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):nu.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,nu.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct_=13]="Struct_",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList"}(ru||(ru={}));class cu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new cu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new cu).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ru.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new uu).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const n=this.bb.__offset(this.bb_pos,14);return n?(e||new cu).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,16);return n?(e||new su).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,ru.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}}class lu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new lu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new lu).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):eu.Little}fields(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new cu).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new su).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,eu.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,r,i){return lu.startSchema(t),lu.addEndianness(t,e),lu.addFields(t,n),lu.addCustomMetadata(t,r),lu.addFeatures(t,i),lu.endSchema(t)}}class fu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new fu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new fu).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tu.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new lu).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new Za).__init(this.bb.__vector(this.bb_pos+n)+24*t,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const n=this.bb.__offset(this.bb_pos,10);return n?(e||new Za).__init(this.bb.__vector(this.bb_pos+n)+24*t,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new su).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,tu.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}var hu=Ja,du=ou,pu=iu;class yu{constructor(t,e=Mr.V4,n,r){this.schema=t,this.version=e,n&&(this._recordBatches=n),r&&(this._dictionaryBatches=r)}static decode(t){t=new pu(Ii(t));const e=fu.getRootAsFooter(t),n=xa.decode(e.schema());return new vu(n,e)}static encode(t){const e=new du,n=xa.encode(e,t.schema);fu.startRecordBatchesVector(e,t.numRecordBatches);for(const n of[...t.recordBatches()].slice().reverse())bu.encode(e,n);const r=e.endVector();fu.startDictionariesVector(e,t.numDictionaries);for(const n of[...t.dictionaryBatches()].slice().reverse())bu.encode(e,n);const i=e.endVector();return fu.startFooter(e),fu.addSchema(e,n),fu.addVersion(e,Mr.V4),fu.addRecordBatches(e,r),fu.addDictionaries(e,i),fu.finishFooterBuffer(e,fu.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}}class vu extends yu{constructor(t,e){super(t,e.version()),this._footer=e}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const e=this._footer.recordBatches(t);if(e)return bu.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return bu.decode(e)}return null}}class bu{constructor(t,e,n){this.metaDataLength=t,this.offset="number"==typeof n?n:n.low,this.bodyLength="number"==typeof e?e:e.low}static decode(t){return new bu(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:n}=e,r=new hu(e.offset,0),i=new hu(e.bodyLength,0);return Za.createBlock(t,r,n,i)}}const mu={fromIterable:t=>gu(function*(t){let e,n,r,i,o=!1,s=[],a=0;({cmd:r,size:i}=yield null);const u=(c=t,function*(t,e){const n=function*(t){yield t},r="string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof wi?n(e):li(e)?e:n(e);return yield*Ti(function*(e){let n=null;do{n=e.next(yield Si(t,n))}while(!n.done)}(r[Symbol.iterator]())),new t}(Uint8Array,c))[Symbol.iterator]();var c;try{do{if(({done:e,value:n}=Number.isNaN(i-a)?u.next():u.next(i-a)),!e&&n.byteLength>0&&(s.push(n),a+=n.byteLength),e||i<=a)do{({cmd:r,size:i}=yield"peek"===r?xi(s,i)[0]:([n,s,a]=xi(s,i),n))}while(i<a)}while(!e)}catch(t){(o=!0)&&"function"==typeof u.throw&&u.throw(t)}finally{!1===o&&"function"==typeof u.return&&u.return(null)}return null}(t)),fromAsyncIterable:t=>gu(function(t){return Hr(this,arguments,(function*(){let e,n,r,i,o=!1,s=[],a=0;({cmd:r,size:i}=yield yield Zr(null));const u=(c=t,Ai(Uint8Array,c))[Symbol.asyncIterator]();var c;try{do{if(({done:e,value:n}=Number.isNaN(i-a)?yield Zr(u.next()):yield Zr(u.next(i-a))),!e&&n.byteLength>0&&(s.push(n),a+=n.byteLength),e||i<=a)do{({cmd:r,size:i}=yield yield Zr("peek"===r?xi(s,i)[0]:([n,s,a]=xi(s,i),n)))}while(i<a)}while(!e)}catch(t){(o=!0)&&"function"==typeof u.throw&&(yield Zr(u.throw(t)))}finally{!1===o&&"function"==typeof u.return&&(yield Zr(u.return(new Uint8Array(0))))}return yield Zr(null)}))}(t)),fromDOMStream:t=>gu(function(t){return Hr(this,arguments,(function*(){let e,n,r,i=!1,o=!1,s=[],a=0;({cmd:n,size:r}=yield yield Zr(null));const u=new wu(t);try{do{if(({done:i,value:e}=Number.isNaN(r-a)?yield Zr(u.read()):yield Zr(u.read(r-a))),!i&&e.byteLength>0&&(s.push(Ii(e)),a+=e.byteLength),i||r<=a)do{({cmd:n,size:r}=yield yield Zr("peek"===n?xi(s,r)[0]:([e,s,a]=xi(s,r),e)))}while(r<a)}while(!i)}catch(t){(o=!0)&&(yield Zr(u.cancel(t)))}finally{!1===o?yield Zr(u.cancel()):t.locked&&u.releaseLock()}return yield Zr(null)}))}(t)),fromNodeStream:t=>gu(function(t){return Hr(this,arguments,(function*(){const e=[];let n,r,i,o="error",s=!1,a=null,u=0,c=[];if(({cmd:n,size:r}=yield yield Zr(null)),t.isTTY)return yield yield Zr(new Uint8Array(0)),yield Zr(null);try{e[0]=_u(t,"end"),e[1]=_u(t,"error");do{if(e[2]=_u(t,"readable"),[o,a]=yield Zr(Promise.race(e.map((t=>t[2])))),"error"===o)break;if((s="end"===o)||(Number.isFinite(r-u)?(i=Ii(t.read(r-u)),i.byteLength<r-u&&(i=Ii(t.read()))):i=Ii(t.read()),i.byteLength>0&&(c.push(i),u+=i.byteLength)),s||r<=u)do{({cmd:n,size:r}=yield yield Zr("peek"===n?xi(c,r)[0]:([i,c,u]=xi(c,r),i)))}while(r<u)}while(!s)}finally{yield Zr(function(e,n){return i=c=null,new Promise(((r,i)=>{for(const[n,r]of e)t.off(n,r);try{const e=t.destroy;e&&e.call(t,n),n=void 0}catch(t){n=t||n}finally{null!=n?i(n):r()}}))}(e,"error"===o?a:null))}return yield Zr(null)}))}(t)),toDOMStream(t,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(t,e){throw new Error('"toNodeStream" not available in this environment')}},gu=t=>(t.next(),t);class wu{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch((()=>{}))}get closed(){return this.reader?this.reader.closed.catch((()=>{})):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Yr(this,void 0,void 0,(function*(){const{reader:e,source:n}=this;e&&(yield e.cancel(t).catch((()=>{}))),n&&n.locked&&this.releaseLock()}))}read(t){return Yr(this,void 0,void 0,(function*(){if(0===t)return{done:null==this.reader,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=Ii(e)),e}))}}const _u=(t,e)=>{const n=t=>r([e,t]);let r;return[e,n,new Promise((i=>(r=i)&&t.once(e,n)))]},xu=Object.freeze({done:!0,value:void 0});class Su{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class Ou{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class Iu extends Ou{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise((t=>this._closedPromiseResolve=t))}get closed(){return this._closedPromise}cancel(t){return Yr(this,void 0,void 0,(function*(){yield this.return(t)}))}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(xu);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return mu.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return mu.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Yr(this,void 0,void 0,(function*(){return yield this.abort(t),xu}))}return(t){return Yr(this,void 0,void 0,(function*(){return yield this.close(),xu}))}read(t){return Yr(this,void 0,void 0,(function*(){return(yield this.next(t,"read")).value}))}peek(t){return Yr(this,void 0,void 0,(function*(){return(yield this.next(t,"peek")).value}))}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise(((t,e)=>{this.resolvers.push({resolve:t,reject:e})})):Promise.resolve(xu)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Tu extends Iu{write(t){if((t=Ii(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Jr(this.toUint8Array(!0)):this.toUint8Array(!1).then(Jr)}toUint8Array(t=!1){return t?xi(this._values)[0]:(()=>Yr(this,void 0,void 0,(function*(){var t,e;const n=[];let r=0;try{for(var i,o=Xr(this);!(i=yield o.next()).done;){const t=i.value;n.push(t),r+=t.byteLength}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&(yield e.call(o))}finally{if(t)throw t.error}}return xi(n,r)[0]})))()}}class Au{constructor(t){t&&(this.source=new Eu(mu.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Mu{constructor(t){t instanceof Mu?this.source=t.source:t instanceof Tu?this.source=new Cu(mu.fromAsyncIterable(t)):mi(t)?this.source=new Cu(mu.fromNodeStream(t)):bi(t)?this.source=new Cu(mu.fromDOMStream(t)):yi(t)?this.source=new Cu(mu.fromDOMStream(t.body)):li(t)?this.source=new Cu(mu.fromIterable(t)):(ci(t)||fi(t))&&(this.source=new Cu(mu.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Eu{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||xu)}return(t){return Object.create(this.source.return&&this.source.return(t)||xu)}}class Cu{constructor(t){this.source=t,this._closedPromise=new Promise((t=>this._closedPromiseResolve=t))}cancel(t){return Yr(this,void 0,void 0,(function*(){yield this.return(t)}))}get closed(){return this._closedPromise}read(t){return Yr(this,void 0,void 0,(function*(){return(yield this.next(t,"read")).value}))}peek(t){return Yr(this,void 0,void 0,(function*(){return(yield this.next(t,"peek")).value}))}next(t,e="read"){return Yr(this,void 0,void 0,(function*(){return yield this.source.next({cmd:e,size:t})}))}throw(t){return Yr(this,void 0,void 0,(function*(){const e=this.source.throw&&(yield this.source.throw(t))||xu;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}))}return(t){return Yr(this,void 0,void 0,(function*(){const e=this.source.return&&(yield this.source.return(t))||xu;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}))}}class Pu extends Au{constructor(t,e){super(),this.position=0,this.buffer=Ii(t),this.size=void 0===e?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:e,size:n,position:r}=this;return e&&r<n?("number"!=typeof t&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,r+Math.min(n-r,t)),e.subarray(r,this.position)):null}readAt(t,e){const n=this.buffer,r=Math.min(this.size,t+e);return n?n.subarray(t,r):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}}class ju extends Mu{constructor(t,e){super(),this.position=0,this._handle=t,"number"==typeof e?this.size=e:this._pending=(()=>Yr(this,void 0,void 0,(function*(){this.size=(yield t.stat()).size,delete this._pending})))()}readInt32(t){return Yr(this,void 0,void 0,(function*(){const{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}))}seek(t){return Yr(this,void 0,void 0,(function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size}))}read(t){return Yr(this,void 0,void 0,(function*(){this._pending&&(yield this._pending);const{_handle:e,size:n,position:r}=this;if(e&&r<n){"number"!=typeof t&&(t=Number.POSITIVE_INFINITY);let i=r,o=0,s=0;const a=Math.min(n,i+Math.min(n-i,t)),u=new Uint8Array(Math.max(0,(this.position=a)-i));for(;(i+=s)<a&&(o+=s)<u.byteLength;)({bytesRead:s}=yield e.read(u,o,u.byteLength-o,i));return u}return null}))}readAt(t,e){return Yr(this,void 0,void 0,(function*(){this._pending&&(yield this._pending);const{_handle:n,size:r}=this;if(n&&t+e<r){const i=Math.min(r,t+e),o=new Uint8Array(i-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)}))}close(){return Yr(this,void 0,void 0,(function*(){const t=this._handle;this._handle=null,t&&(yield t.close())}))}throw(t){return Yr(this,void 0,void 0,(function*(){return yield this.close(),{done:!0,value:t}}))}return(t){return Yr(this,void 0,void 0,(function*(){return yield this.close(),{done:!0,value:t}}))}}function ku(t){return t<0&&(t=4294967295+t+1),`0x${t.toString(16)}`}const Bu=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Fu{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const e=new Uint32Array([this.buffer[1]>>>16,65535&this.buffer[1],this.buffer[0]>>>16,65535&this.buffer[0]]),n=new Uint32Array([t.buffer[1]>>>16,65535&t.buffer[1],t.buffer[0]>>>16,65535&t.buffer[0]]);let r=e[3]*n[3];this.buffer[0]=65535&r;let i=r>>>16;return r=e[2]*n[3],i+=r,r=e[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<r?65536:0,this.buffer[1]+=i>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${ku(this.buffer[1])} ${ku(this.buffer[0])}`}}class Lu extends Fu{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return Lu.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Lu.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.length,r=new Lu(e);for(let e=0;e<n;){const i=8<n-e?8:n-e,o=new Lu(new Uint32Array([Number.parseInt(t.slice(e,e+i),10),0])),s=new Lu(new Uint32Array([Bu[i],0]));r.times(s),r.plus(o),e+=i}return r}static convertArray(t){const e=new Uint32Array(2*t.length);for(let n=-1,r=t.length;++n<r;)Lu.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new Lu(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Lu(new Uint32Array(t.buffer)).plus(e)}}class Du extends Fu{negate(){return this.buffer[0]=1+~this.buffer[0],this.buffer[1]=~this.buffer[1],0==this.buffer[0]&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){const e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return Du.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Du.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.startsWith("-"),r=t.length,i=new Du(e);for(let e=n?1:0;e<r;){const n=8<r-e?8:r-e,o=new Du(new Uint32Array([Number.parseInt(t.slice(e,e+n),10),0])),s=new Du(new Uint32Array([Bu[n],0]));i.times(s),i.plus(o),e+=n}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(2*t.length);for(let n=-1,r=t.length;++n<r;)Du.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new Du(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Du(new Uint32Array(t.buffer)).plus(e)}}class Nu{constructor(t){this.buffer=t}high(){return new Du(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Du(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=1+~this.buffer[0],this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],0==this.buffer[0]&&++this.buffer[1],0==this.buffer[1]&&++this.buffer[2],0==this.buffer[2]&&++this.buffer[3],this}times(t){const e=new Lu(new Uint32Array([this.buffer[3],0])),n=new Lu(new Uint32Array([this.buffer[2],0])),r=new Lu(new Uint32Array([this.buffer[1],0])),i=new Lu(new Uint32Array([this.buffer[0],0])),o=new Lu(new Uint32Array([t.buffer[3],0])),s=new Lu(new Uint32Array([t.buffer[2],0])),a=new Lu(new Uint32Array([t.buffer[1],0])),u=new Lu(new Uint32Array([t.buffer[0],0]));let c=Lu.multiply(i,u);this.buffer[0]=c.low();const l=new Lu(new Uint32Array([c.high(),0]));return c=Lu.multiply(r,u),l.plus(c),c=Lu.multiply(i,a),l.plus(c),this.buffer[1]=l.low(),this.buffer[3]=l.lessThan(c)?1:0,this.buffer[2]=l.high(),new Lu(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Lu.multiply(n,u)).plus(Lu.multiply(r,a)).plus(Lu.multiply(i,s)),this.buffer[3]+=Lu.multiply(e,u).plus(Lu.multiply(n,a)).plus(Lu.multiply(r,s)).plus(Lu.multiply(i,o)).low(),this}plus(t){const e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${ku(this.buffer[3])} ${ku(this.buffer[2])} ${ku(this.buffer[1])} ${ku(this.buffer[0])}`}static multiply(t,e){return new Nu(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Nu(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Nu.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Nu.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),r=t.length,i=new Nu(e);for(let e=n?1:0;e<r;){const n=8<r-e?8:r-e,o=new Nu(new Uint32Array([Number.parseInt(t.slice(e,e+n),10),0,0,0])),s=new Nu(new Uint32Array([Bu[n],0,0,0]));i.times(s),i.plus(o),e+=n}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(4*t.length);for(let n=-1,r=t.length;++n<r;)Nu.from(t[n],new Uint32Array(e.buffer,e.byteOffset+16*n,4));return e}}class Ru extends Mo{constructor(t,e,n,r){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=r}visit(t){return super.visit(t instanceof Sa?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return _a({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===Er.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class zu extends Ru{constructor(t,e,n,r){super(new Uint8Array(0),e,n,r),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Ks(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return Si(Uint8Array,Si(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return Si(Uint8Array,Si(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:n}=this;return io.isTimestamp(t)||(io.isInt(t)||io.isTime(t))&&64===t.bitWidth||io.isDate(t)&&t.unit===Pr.MILLISECOND?Si(Uint8Array,Du.convertArray(n[e])):io.isDecimal(t)?Si(Uint8Array,Nu.convertArray(n[e])):io.isBinary(t)||io.isFixedSizeBinary(t)?function(t){const e=t.join(""),n=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2)n[t>>1]=Number.parseInt(e.slice(t,t+2),16);return n}(n[e]):io.isBool(t)?Ks(n[e]):io.isUtf8(t)?ti(n[e].join("")):Si(Uint8Array,Si(t.ArrayType,n[e].map((t=>+t))))}}var Uu,Vu,Wu,$u,Gu,Yu,Zu,Hu;!function(t){t[t.BUFFER=0]="BUFFER"}(Uu||(Uu={})),function(t){t[t.LZ4_FRAME=0]="LZ4_FRAME",t[t.ZSTD=1]="ZSTD"}(Vu||(Vu={}));class qu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new qu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new qu).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Vu.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Uu.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Vu.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Uu.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return qu.startBodyCompression(t),qu.addCodec(t,e),qu.addMethod(t,n),qu.endBodyCompression(t)}}class Xu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}}class Ku{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}}class Ju{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new Ju).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new Ju).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}nodes(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new Ku).__init(this.bb.__vector(this.bb_pos+n)+16*t,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new Xu).__init(this.bb.__vector(this.bb_pos+n)+16*t,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new qu).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}}class Qu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new Qu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new Qu).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}data(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ju).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){const t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}}!function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"}(Wu||(Wu={}));class tc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new tc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new tc).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Wu.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Wu.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return tc.startFloatingPoint(t),tc.addPrecision(t,e),tc.endFloatingPoint(t)}}class ec{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new ec).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new ec).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,r){return ec.startDecimal(t),ec.addPrecision(t,e),ec.addScale(t,n),ec.addBitWidth(t,r),ec.endDecimal(t)}}!function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"}($u||($u={}));class nc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new nc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new nc).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):$u.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,$u.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return nc.startDate(t),nc.addUnit(t,e),nc.endDate(t)}}!function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"}(Gu||(Gu={}));class rc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new rc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new rc).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Gu.MILLISECOND}bitWidth(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Gu.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return rc.startTime(t),rc.addUnit(t,e),rc.addBitWidth(t,n),rc.endTime(t)}}class ic{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new ic).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new ic).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Gu.SECOND}timezone(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Gu.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return ic.startTimestamp(t),ic.addUnit(t,e),ic.addTimezone(t,n),ic.endTimestamp(t)}}!function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"}(Yu||(Yu={}));class oc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new oc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new oc).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Yu.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Yu.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return oc.startInterval(t),oc.addUnit(t,e),oc.endInterval(t)}}!function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"}(Zu||(Zu={}));class sc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new sc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new sc).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zu.Sparse}typeIds(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Zu.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return sc.startUnion(t),sc.addMode(t,e),sc.addTypeIds(t,n),sc.endUnion(t)}}class ac{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new ac).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new ac).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return ac.startFixedSizeBinary(t),ac.addByteWidth(t,e),ac.endFixedSizeBinary(t)}}class uc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new uc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new uc).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return uc.startFixedSizeList(t),uc.addListSize(t,e),uc.endFixedSizeList(t)}}class cc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new cc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new cc).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const t=this.bb.__offset(this.bb_pos,4);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return cc.startMap(t),cc.addKeysSorted(t,e),cc.endMap(t)}}!function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"}(Hu||(Hu={}));class lc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new lc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new lc).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tu.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Hu.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new su).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,tu.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Hu.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,t.createLong(0,0))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,r,i,o){return lc.startMessage(t),lc.addVersion(t,e),lc.addHeaderType(t,n),lc.addHeader(t,r),lc.addBodyLength(t,i),lc.addCustomMetadata(t,o),lc.endMessage(t)}}class fc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new fc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new fc).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return fc.startNull(t),fc.endNull(t)}}class hc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new hc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new hc).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return hc.startBinary(t),hc.endBinary(t)}}class dc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new dc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new dc).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return dc.startBool(t),dc.endBool(t)}}class pc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new pc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new pc).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return pc.startUtf8(t),pc.endUtf8(t)}}class yc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new yc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new yc).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return yc.startList(t),yc.endList(t)}}class vc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new vc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new vc).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return vc.startStruct_(t),vc.endStruct_(t)}}var bc=Ja;const mc=new class extends Mo{visit(t,e){return null==t||null==e?void 0:super.visit(t,e)}visitNull(t,e){return fc.startNull(e),fc.endNull(e)}visitInt(t,e){return au.startInt(e),au.addBitWidth(e,t.bitWidth),au.addIsSigned(e,t.isSigned),au.endInt(e)}visitFloat(t,e){return tc.startFloatingPoint(e),tc.addPrecision(e,t.precision),tc.endFloatingPoint(e)}visitBinary(t,e){return hc.startBinary(e),hc.endBinary(e)}visitBool(t,e){return dc.startBool(e),dc.endBool(e)}visitUtf8(t,e){return pc.startUtf8(e),pc.endUtf8(e)}visitDecimal(t,e){return ec.startDecimal(e),ec.addScale(e,t.scale),ec.addPrecision(e,t.precision),ec.addBitWidth(e,t.bitWidth),ec.endDecimal(e)}visitDate(t,e){return nc.startDate(e),nc.addUnit(e,t.unit),nc.endDate(e)}visitTime(t,e){return rc.startTime(e),rc.addUnit(e,t.unit),rc.addBitWidth(e,t.bitWidth),rc.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return ic.startTimestamp(e),ic.addUnit(e,t.unit),void 0!==n&&ic.addTimezone(e,n),ic.endTimestamp(e)}visitInterval(t,e){return oc.startInterval(e),oc.addUnit(e,t.unit),oc.endInterval(e)}visitList(t,e){return yc.startList(e),yc.endList(e)}visitStruct(t,e){return vc.startStruct_(e),vc.endStruct_(e)}visitUnion(t,e){sc.startTypeIdsVector(e,t.typeIds.length);const n=sc.createTypeIdsVector(e,t.typeIds);return sc.startUnion(e),sc.addMode(e,t.mode),sc.addTypeIds(e,n),sc.endUnion(e)}visitDictionary(t,e){const n=this.visit(t.indices,e);return uu.startDictionaryEncoding(e),uu.addId(e,new bc(t.id,0)),uu.addIsOrdered(e,t.isOrdered),void 0!==n&&uu.addIndexType(e,n),uu.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return ac.startFixedSizeBinary(e),ac.addByteWidth(e,t.byteWidth),ac.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return uc.startFixedSizeList(e),uc.addListSize(e,t.listSize),uc.endFixedSizeList(e)}visitMap(t,e){return cc.startMap(e),cc.addKeysSorted(e,t.keysSorted),cc.endMap(e)}};function gc(t){return new Cc(t.count,_c(t.columns),xc(t.columns))}function wc(t,e){return(t.children||[]).filter(Boolean).map((t=>Sa.fromJSON(t,e)))}function _c(t){return(t||[]).reduce(((t,e)=>{return[...t,new kc(e.count,(n=e.VALIDITY,(n||[]).reduce(((t,e)=>t+ +(0===e)),0))),..._c(e.children)];var n}),[])}function xc(t,e=[]){for(let n=-1,r=(t||[]).length;++n<r;){const r=t[n];r.VALIDITY&&e.push(new jc(e.length,r.VALIDITY.length)),r.TYPE&&e.push(new jc(e.length,r.TYPE.length)),r.OFFSET&&e.push(new jc(e.length,r.OFFSET.length)),r.DATA&&e.push(new jc(e.length,r.DATA.length)),e=xc(r.children,e)}return e}function Sc(t){return new Map(Object.entries(t||{}))}function Oc(t){return new so(t.isSigned,t.bitWidth)}function Ic(t,e){const n=t.type.name;switch(n){case"NONE":case"null":return new oo;case"binary":return new co;case"utf8":return new lo;case"bool":return new fo;case"list":return new mo((e||[])[0]);case"struct":case"struct_":return new go(e||[])}switch(n){case"int":{const e=t.type;return new so(e.isSigned,e.bitWidth)}case"floatingpoint":{const e=t.type;return new uo(Cr[e.precision])}case"decimal":{const e=t.type;return new ho(e.scale,e.precision,e.bitWidth)}case"date":{const e=t.type;return new po(Pr[e.unit])}case"time":{const e=t.type;return new yo(jr[e.unit],e.bitWidth)}case"timestamp":{const e=t.type;return new vo(jr[e.unit],e.timezone)}case"interval":{const e=t.type;return new bo(kr[e.unit])}case"union":{const n=t.type;return new wo(Er[n.mode],n.typeIds||[],e||[])}case"fixedsizebinary":{const e=t.type;return new _o(e.byteWidth)}case"fixedsizelist":{const n=t.type;return new xo(n.listSize,(e||[])[0])}case"map":{const n=t.type;return new So((e||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Tc=Ja,Ac=ou,Mc=iu;class Ec{constructor(t,e,n,r){this._version=e,this._headerType=n,this.body=new Uint8Array(0),r&&(this._createHeader=()=>r),this._bodyLength="number"==typeof t?t:t.low}static fromJSON(t,e){const n=new Ec(0,Mr.V4,e);return n._createHeader=function(t,e){return()=>{switch(e){case Br.Schema:return xa.fromJSON(t);case Br.RecordBatch:return Cc.fromJSON(t);case Br.DictionaryBatch:return Pc.fromJSON(t)}throw new Error(`Unrecognized Message type: { name: ${Br[e]}, type: ${e} }`)}}(t,e),n}static decode(t){t=new Mc(Ii(t));const e=lc.getRootAsMessage(t),n=e.bodyLength(),r=e.version(),i=e.headerType(),o=new Ec(n,r,i);return o._createHeader=function(t,e){return()=>{switch(e){case Br.Schema:return xa.decode(t.header(new lu));case Br.RecordBatch:return Cc.decode(t.header(new Ju),t.version());case Br.DictionaryBatch:return Pc.decode(t.header(new Qu),t.version())}throw new Error(`Unrecognized Message type: { name: ${Br[e]}, type: ${e} }`)}}(e,i),o}static encode(t){const e=new Ac;let n=-1;return t.isSchema()?n=xa.encode(e,t.header()):t.isRecordBatch()?n=Cc.encode(e,t.header()):t.isDictionaryBatch()&&(n=Pc.encode(e,t.header())),lc.startMessage(e),lc.addVersion(e,Mr.V4),lc.addHeader(e,n),lc.addHeaderType(e,t.headerType),lc.addBodyLength(e,new Tc(t.bodyLength,0)),lc.finishMessageBuffer(e,lc.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof xa)return new Ec(0,Mr.V4,Br.Schema,t);if(t instanceof Cc)return new Ec(e,Mr.V4,Br.RecordBatch,t);if(t instanceof Pc)return new Ec(e,Mr.V4,Br.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Br.Schema}isRecordBatch(){return this.headerType===Br.RecordBatch}isDictionaryBatch(){return this.headerType===Br.DictionaryBatch}}class Cc{constructor(t,e,n){this._nodes=e,this._buffers=n,this._length="number"==typeof t?t:t.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}}class Pc{constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id="number"==typeof e?e:e.low}get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}}class jc{constructor(t,e){this.offset="number"==typeof t?t:t.low,this.length="number"==typeof e?e:e.low}}class kc{constructor(t,e){this.length="number"==typeof t?t:t.low,this.nullCount="number"==typeof e?e:e.low}}function Bc(t,e){const n=[];for(let r,i=-1,o=-1,s=t.childrenLength();++i<s;)(r=t.children(i))&&(n[++o]=Sa.decode(r,e));return n}function Fc(t){const e=new Map;if(t)for(let n,r,i=-1,o=Math.trunc(t.customMetadataLength());++i<o;)(n=t.customMetadata(i))&&null!=(r=n.key())&&e.set(r,n.value());return e}function Lc(t){return new so(t.isSigned(),t.bitWidth())}function Dc(t,e){const n=t.typeType();switch(n){case ru.NONE:case ru.Null:return new oo;case ru.Binary:return new co;case ru.Utf8:return new lo;case ru.Bool:return new fo;case ru.List:return new mo((e||[])[0]);case ru.Struct_:return new go(e||[])}switch(n){case ru.Int:{const e=t.type(new au);return new so(e.isSigned(),e.bitWidth())}case ru.FloatingPoint:{const e=t.type(new tc);return new uo(e.precision())}case ru.Decimal:{const e=t.type(new ec);return new ho(e.scale(),e.precision(),e.bitWidth())}case ru.Date:{const e=t.type(new nc);return new po(e.unit())}case ru.Time:{const e=t.type(new rc);return new yo(e.unit(),e.bitWidth())}case ru.Timestamp:{const e=t.type(new ic);return new vo(e.unit(),e.timezone())}case ru.Interval:{const e=t.type(new oc);return new bo(e.unit())}case ru.Union:{const n=t.type(new sc);return new wo(n.mode(),n.typeIdsArray()||[],e||[])}case ru.FixedSizeBinary:{const e=t.type(new ac);return new _o(e.byteWidth())}case ru.FixedSizeList:{const n=t.type(new uc);return new xo(n.listSize(),(e||[])[0])}case ru.Map:{const n=t.type(new cc);return new So((e||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${ru[n]}" (${n})`)}Sa.encode=function(t,e){let n=-1,r=-1,i=-1;const o=e.type;let s=e.typeId;io.isDictionary(o)?(s=o.dictionary.typeId,i=mc.visit(o,t),r=mc.visit(o.dictionary,t)):r=mc.visit(o,t);const a=(o.children||[]).map((e=>Sa.encode(t,e))),u=cu.createChildrenVector(t,a),c=e.metadata&&e.metadata.size>0?cu.createCustomMetadataVector(t,[...e.metadata].map((([e,n])=>{const r=t.createString(`${e}`),i=t.createString(`${n}`);return su.startKeyValue(t),su.addKey(t,r),su.addValue(t,i),su.endKeyValue(t)}))):-1;return e.name&&(n=t.createString(e.name)),cu.startField(t),cu.addType(t,r),cu.addTypeType(t,s),cu.addChildren(t,u),cu.addNullable(t,!!e.nullable),-1!==n&&cu.addName(t,n),-1!==i&&cu.addDictionary(t,i),-1!==c&&cu.addCustomMetadata(t,c),cu.endField(t)},Sa.decode=function(t,e){let n,r,i,o,s,a;return e&&(a=t.dictionary())?e.has(n=a.id().low)?(o=(o=a.indexType())?Lc(o):new ao,s=new To(e.get(n),o,n,a.isOrdered()),r=new Sa(t.name(),s,t.nullable(),Fc(t))):(o=(o=a.indexType())?Lc(o):new ao,e.set(n,i=Dc(t,Bc(t,e))),s=new To(i,o,n,a.isOrdered()),r=new Sa(t.name(),s,t.nullable(),Fc(t))):(i=Dc(t,Bc(t,e)),r=new Sa(t.name(),i,t.nullable(),Fc(t))),r||null},Sa.fromJSON=function(t,e){let n,r,i,o,s,a;return e&&(o=t.dictionary)?e.has(n=o.id)?(r=(r=o.indexType)?Oc(r):new ao,a=new To(e.get(n),r,n,o.isOrdered),i=new Sa(t.name,a,t.nullable,Sc(t.customMetadata))):(r=(r=o.indexType)?Oc(r):new ao,e.set(n,s=Ic(t,wc(t,e))),a=new To(s,r,n,o.isOrdered),i=new Sa(t.name,a,t.nullable,Sc(t.customMetadata))):(s=Ic(t,wc(t,e)),i=new Sa(t.name,s,t.nullable,Sc(t.customMetadata))),i||null},xa.encode=function(t,e){const n=e.fields.map((e=>Sa.encode(t,e)));lu.startFieldsVector(t,n.length);const r=lu.createFieldsVector(t,n),i=e.metadata&&e.metadata.size>0?lu.createCustomMetadataVector(t,[...e.metadata].map((([e,n])=>{const r=t.createString(`${e}`),i=t.createString(`${n}`);return su.startKeyValue(t),su.addKey(t,r),su.addValue(t,i),su.endKeyValue(t)}))):-1;return lu.startSchema(t),lu.addFields(t,r),lu.addEndianness(t,Nc?eu.Little:eu.Big),-1!==i&&lu.addCustomMetadata(t,i),lu.endSchema(t)},xa.decode=function(t,e=new Map){const n=function(t,e){const n=[];for(let r,i=-1,o=-1,s=t.fieldsLength();++i<s;)(r=t.fields(i))&&(n[++o]=Sa.decode(r,e));return n}(t,e);return new xa(n,Fc(t),e)},xa.fromJSON=function(t,e=new Map){return new xa(function(t,e){return(t.fields||[]).filter(Boolean).map((t=>Sa.fromJSON(t,e)))}(t,e),Sc(t.customMetadata),e)},Cc.encode=function(t,e){const n=e.nodes||[],r=e.buffers||[];Ju.startNodesVector(t,n.length);for(const e of n.slice().reverse())kc.encode(t,e);const i=t.endVector();Ju.startBuffersVector(t,r.length);for(const e of r.slice().reverse())jc.encode(t,e);const o=t.endVector();return Ju.startRecordBatch(t),Ju.addLength(t,new Tc(e.length,0)),Ju.addNodes(t,i),Ju.addBuffers(t,o),Ju.endRecordBatch(t)},Cc.decode=function(t,e=Mr.V4){if(null!==t.compression())throw new Error("Record batch compression not implemented");return new Cc(t.length(),function(t){const e=[];for(let n,r=-1,i=-1,o=t.nodesLength();++r<o;)(n=t.nodes(r))&&(e[++i]=kc.decode(n));return e}(t),function(t,e){const n=[];for(let r,i=-1,o=-1,s=t.buffersLength();++i<s;)(r=t.buffers(i))&&(e<Mr.V4&&(r.bb_pos+=8*(i+1)),n[++o]=jc.decode(r));return n}(t,e))},Cc.fromJSON=gc,Pc.encode=function(t,e){const n=Cc.encode(t,e.data);return Qu.startDictionaryBatch(t),Qu.addId(t,new Tc(e.id,0)),Qu.addIsDelta(t,e.isDelta),Qu.addData(t,n),Qu.endDictionaryBatch(t)},Pc.decode=function(t,e=Mr.V4){return new Pc(Cc.decode(t.data(),e),t.id(),t.isDelta())},Pc.fromJSON=function(t){return new Pc(gc(t.data),t.id,t.isDelta)},kc.encode=function(t,e){return Ku.createFieldNode(t,new Tc(e.length,0),new Tc(e.nullCount,0))},kc.decode=function(t){return new kc(t.length(),t.nullCount())},jc.encode=function(t,e){return Xu.createBuffer(t,new Tc(e.offset,0),new Tc(e.length,0))},jc.decode=function(t){return new jc(t.offset(),t.length())};const Nc=(()=>{const t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256===new Int16Array(t)[0]})(),Rc=t=>`Expected ${Br[t]} Message in stream, but was null or length 0.`,zc=t=>`Header pointer of flatbuffer-encoded ${Br[t]} Message is null or length 0.`,Uc=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,Vc=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`;class Wc{constructor(t){this.source=t instanceof Au?t:new Au(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||-1===t.value&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?xu:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Rc(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=Ii(this.source.read(t));if(e.byteLength<t)throw new Error(Vc(t,e.byteLength));return e.byteOffset%8==0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=Br.Schema,n=this.readMessage(e),r=null==n?void 0:n.header();if(t&&!r)throw new Error(zc(e));return r}readMetadataLength(){const t=this.source.read(Yc),e=t&&new iu(t),n=(null==e?void 0:e.readInt32(0))||0;return{done:0===n,value:n}}readMetadata(t){const e=this.source.read(t);if(!e)return xu;if(e.byteLength<t)throw new Error(Uc(t,e.byteLength));return{done:!1,value:Ec.decode(e)}}}class $c{constructor(t,e){this.source=t instanceof Mu?t:pi(t)?new ju(t,e):new Mu(t)}[Symbol.asyncIterator](){return this}next(){return Yr(this,void 0,void 0,(function*(){let t;return(t=yield this.readMetadataLength()).done||-1===t.value&&(t=yield this.readMetadataLength()).done||(t=yield this.readMetadata(t.value)).done?xu:t}))}throw(t){return Yr(this,void 0,void 0,(function*(){return yield this.source.throw(t)}))}return(t){return Yr(this,void 0,void 0,(function*(){return yield this.source.return(t)}))}readMessage(t){return Yr(this,void 0,void 0,(function*(){let e;if((e=yield this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Rc(t));return e.value}))}readMessageBody(t){return Yr(this,void 0,void 0,(function*(){if(t<=0)return new Uint8Array(0);const e=Ii(yield this.source.read(t));if(e.byteLength<t)throw new Error(Vc(t,e.byteLength));return e.byteOffset%8==0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}))}readSchema(t=!1){return Yr(this,void 0,void 0,(function*(){const e=Br.Schema,n=yield this.readMessage(e),r=null==n?void 0:n.header();if(t&&!r)throw new Error(zc(e));return r}))}readMetadataLength(){return Yr(this,void 0,void 0,(function*(){const t=yield this.source.read(Yc),e=t&&new iu(t),n=(null==e?void 0:e.readInt32(0))||0;return{done:0===n,value:n}}))}readMetadata(t){return Yr(this,void 0,void 0,(function*(){const e=yield this.source.read(t);if(!e)return xu;if(e.byteLength<t)throw new Error(Uc(t,e.byteLength));return{done:!1,value:Ec.decode(e)}}))}}class Gc extends Wc{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Su?t:new Su(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Ec.fromJSON(t.schema,Br.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:Ec.fromJSON(e,Br.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:Ec.fromJSON(e,Br.RecordBatch)}}return this._body=[],xu}readMessageBody(t){return function t(e){return(e||[]).reduce(((e,n)=>[...e,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE&&[n.TYPE]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...t(n.children)]),[])}(this._body)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Rc(t));return e.value}readSchema(){const t=Br.Schema,e=this.readMessage(t),n=null==e?void 0:e.header();if(!e||!n)throw new Error(zc(t));return n}}const Yc=4,Zc=new Uint8Array(6);for(let t=0;t<6;t+=1)Zc[t]="ARROW1".codePointAt(t);function Hc(t,e=0){for(let n=-1,r=Zc.length;++n<r;)if(Zc[n]!==t[e+n])return!1;return!0}const qc=Zc.length,Xc=qc+Yc,Kc=2*qc+Yc;class Jc extends Ou{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){const e=this._impl.open(t);return ci(e)?e.then((()=>this)):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return mu.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return mu.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Jc?t:hi(t)?function(t){return new Qc(new ul(t))}(t):pi(t)?function(t){return Yr(this,void 0,void 0,(function*(){const{size:e}=yield t.stat(),n=new ju(t,e);return e>=Kc&&Hc(yield n.readAt(0,qc+7&-8))?new nl(new al(n)):new tl(new ol(n))}))}(t):ci(t)?(()=>Yr(this,void 0,void 0,(function*(){return yield Jc.from(yield t)})))():yi(t)||bi(t)||mi(t)||fi(t)?function(t){return Yr(this,void 0,void 0,(function*(){const e=yield t.peek(qc+7&-8);return e&&e.byteLength>=4?Hc(e)?new el(new sl(yield t.read())):new tl(new ol(t)):new tl(new ol(function(){return Hr(this,arguments,(function*(){}))}()))}))}(new Mu(t)):function(t){const e=t.peek(qc+7&-8);return e&&e.byteLength>=4?Hc(e)?new el(new sl(t.read())):new Qc(new il(t)):new Qc(new il(function*(){}()))}(new Au(t))}static readAll(t){return t instanceof Jc?t.isSync()?ll(t):fl(t):hi(t)||ArrayBuffer.isView(t)||li(t)||di(t)?ll(t):fl(t)}}class Qc extends Jc{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Hr(this,arguments,(function*(){yield Zr(yield*qr(Xr(this[Symbol.iterator]())))}))}}class tl extends Jc{constructor(t){super(t),this._impl=t}readAll(){var t,e;return Yr(this,void 0,void 0,(function*(){const n=new Array;try{for(var r,i=Xr(this);!(r=yield i.next()).done;){const t=r.value;n.push(t)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=i.return)&&(yield e.call(i))}finally{if(t)throw t.error}}return n}))}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class el extends Qc{constructor(t){super(t),this._impl=t}}class nl extends tl{constructor(t){super(t),this._impl=t}}class rl{constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const n=this._loadVectors(t,e,this.schema.fields),r=_a({type:new go(this.schema.fields),length:t.length,children:n});return new za(this.schema,r)}_loadDictionaryBatch(t,e){const{id:n,isDelta:r}=t,{dictionaries:i,schema:o}=this,s=i.get(n);if(r||!s){const i=o.dictionaries.get(n),a=this._loadVectors(t.data,e,[i]);return(s&&r?s.concat(new ba(a)):new ba(a)).memoize()}return s.memoize()}_loadVectors(t,e,n){return new Ru(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}}class il extends rl{constructor(t,e){super(e),this._reader=hi(t)?new Gc(this._handle=t):new Wc(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=cl(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):xu}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):xu}next(){if(this.closed)return xu;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),r=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),r=e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new Wa(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class ol extends rl{constructor(t,e){super(e),this._reader=new $c(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Yr(this,void 0,void 0,(function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}))}open(t){return Yr(this,void 0,void 0,(function*(){return this.closed||(this.autoDestroy=cl(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this}))}throw(t){return Yr(this,void 0,void 0,(function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):xu}))}return(t){return Yr(this,void 0,void 0,(function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):xu}))}next(){return Yr(this,void 0,void 0,(function*(){if(this.closed)return xu;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),r=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),r=yield e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new Wa(this.schema)}):yield this.return()}))}_readNextMessageAndValidate(t){return Yr(this,void 0,void 0,(function*(){return yield this._reader.readMessage(t)}))}}class sl extends il{constructor(t,e){super(t instanceof Pu?t:new Pu(t),e)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const n=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){const t=this._reader.readMessage(Br.RecordBatch);if(null==t?void 0:t.isRecordBatch()){const e=t.header(),n=this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,n)}}return null}_readDictionaryBatch(t){var e;const n=null===(e=this._footer)||void 0===e?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){const t=this._reader.readMessage(Br.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){const e=t.header(),n=this._reader.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(e,n);this.dictionaries.set(e.id,r)}}}_readFooter(){const{_handle:t}=this,e=t.size-Xc,n=t.readInt32(e),r=t.readAt(e-n,n);return yu.decode(r)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const n=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}}class al extends ol{constructor(t,...e){const n="number"!=typeof e[0]?e.shift():void 0,r=e[0]instanceof Map?e.shift():void 0;super(t instanceof ju?t:new ju(t,n),r)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}open(t){const e=Object.create(null,{open:{get:()=>super.open}});return Yr(this,void 0,void 0,(function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)}))}readRecordBatch(t){var e;return Yr(this,void 0,void 0,(function*(){if(this.closed)return null;this._footer||(yield this.open());const n=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){const t=yield this._reader.readMessage(Br.RecordBatch);if(null==t?void 0:t.isRecordBatch()){const e=t.header(),n=yield this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,n)}}return null}))}_readDictionaryBatch(t){var e;return Yr(this,void 0,void 0,(function*(){const n=null===(e=this._footer)||void 0===e?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){const t=yield this._reader.readMessage(Br.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){const e=t.header(),n=yield this._reader.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(e,n);this.dictionaries.set(e.id,r)}}}))}_readFooter(){return Yr(this,void 0,void 0,(function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-Xc,n=yield t.readInt32(e),r=yield t.readAt(e-n,n);return yu.decode(r)}))}_readNextMessageAndValidate(t){return Yr(this,void 0,void 0,(function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null}))}}class ul extends il{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new zu(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}}function cl(t,e){return e&&"boolean"==typeof e.autoDestroy?e.autoDestroy:t.autoDestroy}function*ll(t){const e=Jc.from(t);try{if(!e.open({autoDestroy:!1}).closed)do{yield e}while(!e.reset().open().closed)}finally{e.cancel()}}function fl(t){return Hr(this,arguments,(function*(){const e=yield Zr(Jc.from(t));try{if(!(yield Zr(e.open({autoDestroy:!1}))).closed)do{yield yield Zr(e)}while(!(yield Zr(e.reset().open())).closed)}finally{yield Zr(e.cancel())}}))}function hl(t){const e=Jc.from(t);return ci(e)?e.then((t=>hl(t))):e.isAsync()?e.readAll().then((t=>new Ya(t))):new Ya(e.readAll())}function dl(t){return dl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dl(t)}function pl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return yl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function yl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function vl(){vl=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var o=e&&e.prototype instanceof h?e:h,s=Object.create(o.prototype),a=new I(i||[]);return r(s,"_invoke",{value:_(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==e&&n.call(b,o)&&(y=b);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(r,o,s,a){var u=l(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==dl(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function _(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=l(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,r(m,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new w(c(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},g(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function bl(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function ml(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){bl(o,r,i,s,a,"next",t)}function a(t){bl(o,r,i,s,a,"throw",t)}s(void 0)}))}}function gl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==dl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==dl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===dl(i)?i:String(i)),r)}var i}function wl(t,e){return wl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wl(t,e)}function _l(t){return _l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_l(t)}var xl=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wl(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=_l(r);if(i){var n=_l(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===dl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(n=o.call(this,t,0,r)).app=e,n.info=void 0,n.infoLoadingStatus="notLoaded",n.cache={},n.readParquetFun=r.readParquetFun,n}return e=s,n=[{key:"loadInfo",value:function(t){var e=this;return this.info||"notLoaded"!==this.infoLoadingStatus?!t||"loaded"!==this.infoLoadingStatus&&"failed"!==this.infoLoadingStatus||t():ml(vl().mark((function n(){var r;return vl().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,$r(e.url+"info.json");case 3:r=n.sent,e.info=r,e.resolution=r.resolutionGeo,e.infoLoadingStatus="loaded",t&&t(),n.next=13;break;case 10:n.prev=10,n.t0=n.catch(0),e.infoLoadingStatus="failed";case 13:case"end":return n.stop()}}),n,null,[[0,10]])})))(),this}},{key:"getTilingEnvelope",value:function(t){if(this.info){var e=this.info.originPoint,n=this.info.resolutionGeo,r=this.info.tileSizeCell;return{xMin:Math.floor((t.xMin-e.x)/(n*r)),xMax:Math.floor((t.xMax-e.x)/(n*r)),yMin:Math.floor((t.yMin-e.y)/(n*r)),yMax:Math.floor((t.yMax-e.y)/(n*r))}}this.loadInfo((function(){}))}},{key:"getData",value:function(t,e){var n=this;if(!this.info)return this;var r=this.getTilingEnvelope(t);if(!r)return this;for(var i=this.info.tilingBounds,o=this.info.format,s=function(t){for(var s=function(r){if(n.cache[t]||(n.cache[t]={}),n.cache[t][r])return"continue";n.cache[t][r]="loading",ml(vl().mark((function i(){var s,a,u,c,l,f,h,d,p,y,v,b,m,g,w,_,x,S,O,I,T;return vl().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(i.prev=0,o&&"CSV"!==o){i.next=33;break}return i.next=4,lr(n.url+t+"/"+r+".csv");case 4:if(a=i.sent,!n.preprocess){i.next=29;break}s=[],u=pl(a),i.prev=9,u.s();case 11:if((c=u.n()).done){i.next=19;break}if(l=c.value,0!=n.preprocess(l)){i.next=16;break}return i.abrupt("continue",17);case 16:s.push(l);case 17:i.next=11;break;case 19:i.next=24;break;case 21:i.prev=21,i.t0=i.catch(9),u.e(i.t0);case 24:return i.prev=24,u.f(),i.finish(24);case 27:i.next=30;break;case 29:s=a;case 30:i.next=74;break;case 33:if("PARQUET"!==o){i.next=73;break}if(n.readParquetFun){i.next=36;break}throw new Error("readParquet function needed for parquet dataset");case 36:return i.next=38,fetch(n.url+t+"/"+r+".parquet");case 38:return f=i.sent,i.t1=Uint8Array,i.next=42,f.arrayBuffer();case 42:i.t2=i.sent,h=new i.t1(i.t2),d=n.readParquetFun(h),p=hl(d),s=[],y=pl(p),i.prev=48,y.s();case 50:if((v=y.n()).done){i.next=63;break}if(b=v.value,m=b.toJSON(),!n.preprocess){i.next=60;break}if(0!=n.preprocess(m)){i.next=57;break}return i.abrupt("continue",61);case 57:s.push(m),i.next=61;break;case 60:s.push(m);case 61:i.next=50;break;case 63:i.next=68;break;case 65:i.prev=65,i.t3=i.catch(48),y.e(i.t3);case 68:return i.prev=68,y.f(),i.finish(68);case 71:i.next=74;break;case 73:throw new Error("Tiled format not supported: "+o);case 74:i.next=80;break;case 76:return i.prev=76,i.t4=i.catch(0),n.cache[t][r]="failed",i.abrupt("return");case 80:if(n.info){i.next=83;break}return console.error("Tile info inknown"),i.abrupt("return");case 83:if(g=new Ur(s,t,r,n.info),n.cache[t][r]=g,e){i.next=88;break}return i.abrupt("return");case 88:w=!1,_=n.app.getZoomFactor(),x=pl(n.app.layers),i.prev=91,x.s();case 93:if((S=x.n()).done){i.next=103;break}if((O=S.value).visible){i.next=97;break}return i.abrupt("continue",101);case 97:if(O.getDatasetComponent(_)==n){i.next=99;break}return i.abrupt("continue",101);case 99:return w=!0,i.abrupt("break",103);case 101:i.next=93;break;case 103:i.next=108;break;case 105:i.prev=105,i.t5=i.catch(91),x.e(i.t5);case 108:return i.prev=108,x.f(),i.finish(108);case 111:if(w){i.next=114;break}return i.abrupt("return");case 114:if(I=n.app.updateExtentGeo(),T=g.extGeo,!(I.xMax<=T.xMin)){i.next=118;break}return i.abrupt("return");case 118:if(!(I.xMin>=T.xMax)){i.next=120;break}return i.abrupt("return");case 120:if(!(I.yMax<=T.yMin)){i.next=122;break}return i.abrupt("return");case 122:if(!(I.yMin>=T.yMax)){i.next=124;break}return i.abrupt("return");case 124:e();case 127:case"end":return i.stop()}}),i,null,[[0,76],[9,21,24,27],[48,65,68,71],[91,105,108,111]])})))()},a=Math.max(r.yMin,i.yMin);a<=Math.min(r.yMax,i.yMax);a++)s(a)},a=Math.max(r.xMin,i.xMin);a<=Math.min(r.xMax,i.xMax);a++)s(a);return this}},{key:"updateViewCache",value:function(t){if(this.cellsViewCache=[],this.info){var e=this.getTilingEnvelope(t);if(e)for(var n=this.info.tilingBounds,r=Math.max(e.xMin,n.xMin);r<=Math.min(e.xMax,n.xMax);r++)if(this.cache[r])for(var i=Math.max(e.yMin,n.yMin);i<=Math.min(e.yMax,n.yMax);i++){var o=this.cache[r][i];if(o&&"string"!=typeof o){var s,a=pl(o.cells);try{for(a.s();!(s=a.n()).done;){var u=s.value;+u.x+this.resolution<t.xMin||+u.x-this.resolution>t.xMax||+u.y+this.resolution<t.yMin||+u.y-this.resolution>t.yMax||this.cellsViewCache.push(u)}}catch(t){a.e(t)}finally{a.f()}}}}}}],n&&gl(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(pr);function Sl(t){return Sl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sl(t)}function Ol(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Sl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Sl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Sl(i)?i:String(i)),r)}var i}var Il=function(){function t(e){var n=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.visible=0!=e.visible,this.minZoom=e.minZoom||0,this.maxZoom=e.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");if(this.cache={},this.url=e.url,this.urlFun=e.urlFun||function(t,e,r){return n.url+r+"/"+t+"/"+e+".png"},this.resolutions=e.resolutions,!this.resolutions||0==this.resolutions.length)throw new Error("No resolutions provided for background layer");this.nbPix=e.nbPix||256,this.origin=e.origin||[0,0],this.z0=e.z0||0,this.filterColor=e.filterColor}var e,n;return e=t,n=[{key:"get",value:function(t,e,n){var r=this.cache[t];if(r&&(r=r[e]))return r[n]}},{key:"put",value:function(t,e,n,r){this.cache[e]||(this.cache[e]={}),this.cache[e][n]||(this.cache[e][n]={}),this.cache[e][n][r]=t}},{key:"draw",value:function(t){var e=this;if(this.resolutions&&0!=this.resolutions.length){var n=t.getZf(),r=this.origin[0],i=this.origin[1],o=0;for(o=0;o<this.resolutions.length&&!(this.resolutions[o]<n);o++);o-=1,o=Math.max(0,o),o=Math.min(o,this.resolutions.length-1);var s=this.resolutions[o];o+=this.z0;for(var a=this.nbPix*s,u=a/n,c=function(t){return Math.ceil((t-r)/a)},l=function(t){return Math.ceil(-(t-i)/a)},f=c(t.extGeo.xMin)-1,h=c(t.extGeo.xMax),d=l(t.extGeo.yMin),p=l(t.extGeo.yMax)-1,y=function(n){for(var s=function(s){var c=e.get(o,n,s);if(!c){var l=new Image;return e.put(l,o,n,s),l.onload=function(){t.redraw()},l.onerror=function(){e.put("failed",o,n,s)},l.src=e.urlFun(n,s,o),"continue"}if("failed"===c)return"continue";if(!(c instanceof HTMLImageElement))return console.log(c),"continue";if(0==c.width||0==c.height)return"continue";var f=r+n*a,h=i-s*a;try{t.ctx.drawImage(c,t.geoToPixX(f),t.geoToPixY(h),u,u)}catch(t){console.error(t)}},c=p;c<d;c++)s(c)},v=f;v<h;v++)y(v);if(this.filterColor){var b=this.filterColor(n);b&&"none"!=b&&(t.ctx.fillStyle=b,t.ctx.fillRect(0,0,t.w,t.h))}}else console.error("No resolutions provided for background layer")}}],n&&Ol(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Tl(t){return Tl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tl(t)}function Al(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Tl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Tl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Tl(i)?i:String(i)),r)}var i}var Ml=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.visible=0!=e.visible,this.minZoom=e.minZoom||0,this.maxZoom=e.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");this.url=e.url,this.filterColor=e.filterColor,this.img=void 0,this.xMin=void 0,this.xMax=void 0,this.yMin=void 0,this.yMax=void 0}var e,n;return e=t,(n=[{key:"hasMoved",value:function(t){return t.xMin!=this.xMin||t.xMax!=this.xMax||t.yMin!=this.yMin||t.yMax!=this.yMax}},{key:"draw",value:function(t){if(t.updateExtentGeo(0),!this.hasMoved(t.extGeo)&&this.img)t.ctx.drawImage(this.img,0,0,t.w,t.h);else{this.xMin=t.extGeo.xMin,this.xMax=t.extGeo.xMax,this.yMin=t.extGeo.yMin,this.yMax=t.extGeo.yMax;var e=[];e.push(this.url),e.push("&width="),e.push(t.w),e.push("&height="),e.push(t.h),e.push("&bbox="),e.push(t.extGeo.xMin),e.push(","),e.push(t.extGeo.yMin),e.push(","),e.push(t.extGeo.xMax),e.push(","),e.push(t.extGeo.yMax);var n=e.join("");this.img||(this.img=new Image,this.img.onload=function(){t.redraw()},this.img.onerror=function(){console.warn("Could not retrieve WMS background image from",n)}),this.img.src=n}var r=t.getZf();if(this.filterColor){var i=this.filterColor(r);i&&"none"!=i&&(t.ctx.fillStyle=i,t.ctx.fillRect(0,0,t.w,t.h))}}}])&&Al(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function El(t){return El="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},El(t)}function Cl(){Cl=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var o=e&&e.prototype instanceof h?e:h,s=Object.create(o.prototype),a=new I(i||[]);return r(s,"_invoke",{value:_(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==e&&n.call(b,o)&&(y=b);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(r,o,s,a){var u=l(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==El(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function _(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=l(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,r(m,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new w(c(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},g(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function Pl(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function jl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return kl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function kl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Bl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==El(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==El(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===El(i)?i:String(i)),r)}var i}var Fl=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.url=e.url,this.style=e.style||function(){return"bold 1em Arial"},this.color=e.color||(e.dark?function(){return"#ddd"}:function(){return"#222"}),this.haloColor=e.haloColor||(e.dark?function(){return"#000000BB"}:function(){return"#FFFFFFBB"}),this.haloWidth=e.haloWidth||function(){return 4},this.textAlign=e.textAlign||"start",this.offsetPix=e.offsetPix||[5,5],this.preprocess=e.preprocess,this.labels=void 0,this.loadingStatus="notLoaded"}var e,n,r,i;return e=t,n=[{key:"draw",value:function(t){if(this.labels){var e=t.getZf();t.ctx.textAlign=this.textAlign||"start",t.ctx.lineJoin="bevel",t.ctx.lineCap="butt",t.initCanvasTransform();var n,r=jl(this.labels);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=this.style(i,e);if(o&&(t.ctx.font=o,t.toDraw(i))){var s=t.geoToPixX(i.x)+this.offsetPix[0],a=t.geoToPixY(i.y)-this.offsetPix[1];if(this.haloColor&&this.haloWidth){var u=this.haloColor(i,e),c=this.haloWidth(i,e);u&&c&&c>0&&(t.ctx.strokeStyle=u,t.ctx.lineWidth=c,t.ctx.strokeText(i.name,s,a))}if(this.color){var l=this.color(i,e);l&&(t.ctx.fillStyle=l,t.ctx.fillText(i.name,s,a))}}}}catch(t){r.e(t)}finally{r.f()}}else this.load(t.redraw)}},{key:"load",value:(r=Cl().mark((function t(e){var n,r,i,o;return Cl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.url){t.next=5;break}return console.log("Failed loading labels: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.abrupt("return");case 5:if("notLoaded"==this.loadingStatus){t.next=7;break}return t.abrupt("return");case 7:return this.loadingStatus="loading",t.prev=8,t.next=11,lr(this.url);case 11:if(n=t.sent,!this.preprocess){t.next=35;break}this.labels=[],r=jl(n),t.prev=15,r.s();case 17:if((i=r.n()).done){t.next=25;break}if(o=i.value,0!=this.preprocess(o)){t.next=22;break}return t.abrupt("continue",23);case 22:this.labels.push(o);case 23:t.next=17;break;case 25:t.next=30;break;case 27:t.prev=27,t.t0=t.catch(15),r.e(t.t0);case 30:return t.prev=30,r.f(),t.finish(30);case 33:t.next=36;break;case 35:this.labels=n;case 36:this.loadingStatus="loaded",e&&e(),t.next=45;break;case 40:t.prev=40,t.t1=t.catch(8),console.log("Failed loading labels from "+this.url),this.labels=[],this.loadingStatus="failed";case 45:case"end":return t.stop()}}),t,this,[[8,40],[15,27,30,33]])})),i=function(){var t=this,e=arguments;return new Promise((function(n,i){var o=r.apply(t,e);function s(t){Pl(o,n,i,s,a,"next",t)}function a(t){Pl(o,n,i,s,a,"throw",t)}s(void 0)}))},function(t){return i.apply(this,arguments)})}],n&&Bl(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ll(t){return Ll="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ll(t)}function Dl(){Dl=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var o=e&&e.prototype instanceof h?e:h,s=Object.create(o.prototype),a=new I(i||[]);return r(s,"_invoke",{value:_(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==e&&n.call(b,o)&&(y=b);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(r,o,s,a){var u=l(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==Ll(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function _(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=l(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,r(m,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new w(c(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},g(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function Nl(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function Rl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return zl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function zl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ul(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Ll(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Ll(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Ll(i)?i:String(i)),r)}var i}var Vl=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.url=e.url,this.preprocess=e.preprocess,this.color=e.color||function(t,e){return"gray"},this.width=e.width||function(t,e){return 2},this.lineDash=e.lineDash||function(t,e){},this.fs=void 0,this.loadingStatus="notLoaded"}var e,n,r,i;return e=t,n=[{key:"draw",value:function(t){if(this.fs){var e=t.getZf();t.setCanvasTransform();var n,r=Rl(this.fs);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.geometry.coordinates;if(!(o.length<2)){var s=this.color(i,e);if(s&&"none"!=s){t.ctx.strokeStyle=s;var a=this.width(i,e);if(a&&!(a<0)){t.ctx.lineWidth=a*e;var u=this.lineDash(i,e);u&&t.ctx.setLineDash(u),t.ctx.beginPath(),t.ctx.moveTo(o[0][0],o[0][1]);for(var c=1;c<o.length;c++)t.ctx.lineTo(o[c][0],o[c][1]);t.ctx.stroke()}}}}}catch(t){r.e(t)}finally{r.f()}t.ctx.setLineDash([])}else this.load(t.redraw)}},{key:"load",value:(r=Dl().mark((function t(e){var n,r,i,o,s;return Dl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.url){t.next=5;break}return console.log("Failed loading boundaries: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.abrupt("return");case 5:if("notLoaded"==this.loadingStatus){t.next=7;break}return t.abrupt("return");case 7:return this.loadingStatus="loading",t.prev=8,t.next=11,$r(this.url);case 11:if(n=t.sent,r=n.features,!this.preprocess){t.next=36;break}this.fs=[],i=Rl(r),t.prev=16,i.s();case 18:if((o=i.n()).done){t.next=26;break}if(s=o.value,0!=this.preprocess(s)){t.next=23;break}return t.abrupt("continue",24);case 23:this.fs.push(s);case 24:t.next=18;break;case 26:t.next=31;break;case 28:t.prev=28,t.t0=t.catch(16),i.e(t.t0);case 31:return t.prev=31,i.f(),t.finish(31);case 34:t.next=37;break;case 36:this.fs=r;case 37:this.loadingStatus="loaded",e&&e(),t.next=46;break;case 41:t.prev=41,t.t1=t.catch(8),console.log("Failed loading boundaries from "+this.url),this.fs=[],this.loadingStatus="failed";case 46:case"end":return t.stop()}}),t,this,[[8,41],[16,28,31,34]])})),i=function(){var t=this,e=arguments;return new Promise((function(n,i){var o=r.apply(t,e);function s(t){Nl(o,n,i,s,a,"next",t)}function a(t){Nl(o,n,i,s,a,"throw",t)}s(void 0)}))},function(t){return i.apply(this,arguments)})}],n&&Ul(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Wl(t){return Wl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wl(t)}function $l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Gl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Gl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Yl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Wl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Wl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Wl(i)?i:String(i)),r)}var i}var Zl=function(){function t(e,n){var r=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n=n||{},this.layers=[],e=e||document.getElementById("gridviz")){this.w=n.w||e.offsetWidth,this.h=n.h||e.offsetHeight;var i=n.canvas||null;i||((i=document.createElement("canvas")).setAttribute("width",""+this.w),i.setAttribute("height",""+this.h),e.appendChild(i)),this.cg=new Rn(i,void 0,1,n),this.cg.redraw=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];r.legend&&t&&r.legend.selectAll("*").remove(),r.cg.initCanvasTransform(),r.cg.clear(r.cg.backgroundColor);var n=r.getZoomFactor();r.updateExtentGeo();var o,s=$l(r.bgLayers);try{for(s.s();!(o=s.n()).done;){var a=o.value;a.visible&&(n>a.maxZoom||n<a.minZoom||a.draw(r.cg))}}catch(t){s.e(t)}finally{s.f()}var u,c=$l(r.layers);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(l.visible&&!(n>l.maxZoom||n<l.minZoom)){var f=l.getDatasetComponent(n);if(f){if(t&&f.getData(r.cg.extGeo,(function(){r.cg.redraw()})),t&&f.updateViewCache(r.cg.extGeo),t){var h,d=$l(l.styles);try{for(d.s();!(h=d.n()).done;){var p=h.value;n>p.maxZoom||n<p.minZoom||p.draw(f.getViewCache(),f.getResolution(),r.cg)}}catch(t){d.e(t)}finally{d.f()}}if(r.legend&&t){var y,v=$l(l.styles);try{for(v.s();!(y=v.n()).done;){var b=y.value;if(!(n>b.maxZoom||n<b.minZoom)){var m,g=$l(b.legends);try{for(g.s();!(m=g.n()).done;){var w=m.value;r.legend.node().append(w.div.node())}}catch(t){g.e(t)}finally{g.f()}if(b.styles){var _,x=$l(b.styles);try{for(x.s();!(_=x.n()).done;){var S=_.value;if(!(n>S.maxZoom||n<S.minZoom)){var O,I=$l(S.legends);try{for(I.s();!(O=I.n()).done;){var T=O.value;r.legend.node().append(T.div.node())}}catch(t){I.e(t)}finally{I.f()}}}}catch(t){x.e(t)}finally{x.f()}}}}}catch(t){v.e(t)}finally{v.f()}}}}}}catch(t){c.e(t)}finally{c.f()}return r.showBoundaries&&r.boundaryLayer&&r.boundaryLayer.draw(r.cg),r.showLabels&&r.labelLayer&&r.labelLayer.draw(r.cg),r.canvasSave=null,r.defineResizeObserver(e,i),r},this.bgLayers=[],this.showBgLayers=!0,this.labelLayer=void 0,this.showLabels=!0,this.boundaryLayer=void 0,this.showBoundaries=!0,this.legendDivId=n.legendDivId||"gvizLegend",this.legend=pt("#"+this.legendDivId),this.legend.empty()&&(this.legend=pt("#"+e.id).append("div").attr("id",this.legendDivId).style("position","absolute").style("width","auto").style("height","auto").style("background","#FFFFFFCC").style("border","0px").style("border-radius","5px").style("box-shadow","3px 3px 3px grey, -3px -3px 3px #ddd").style("font-family","Helvetica, Arial, sans-serif").style("top","20px").style("right","20px")),n.tooltip||(n.tooltip={}),n.tooltip.parentElement||(n.tooltip.parentElement=e),this.tooltip=new Kn(n.tooltip);var o=function(t){var e={x:r.cg.pixToGeoX(t.offsetX+r.tooltip.xMouseOffset),y:r.cg.pixToGeoY(t.offsetY+r.tooltip.yMouseOffset)},i=r.getCellFocusInfo(e);if(n.transparentBackground)return i?(r.tooltip.setPosition(t),r.tooltip.show(),r.tooltip.html(i.html)):r.tooltip.hide(),r.canvasSave=document.createElement("canvas"),r.canvasSave.setAttribute("width",""+r.w),r.canvasSave.setAttribute("height",""+r.h),r.canvasSave.getContext("2d").drawImage(r.cg.canvas,0,0),void r.cg.initCanvasTransform();if(i){r.tooltip.setPosition(t),r.tooltip.show(),r.tooltip.html(i.html),r.canvasSave?r.cg.ctx.drawImage(r.canvasSave,0,0):(r.canvasSave=document.createElement("canvas"),r.canvasSave.setAttribute("width",""+r.w),r.canvasSave.setAttribute("height",""+r.h),r.canvasSave.getContext("2d").drawImage(r.cg.canvas,0,0));var o=r.selectionRectangleWidthPix?r.selectionRectangleWidthPix(i.resolution,r.getZoomFactor()):4;r.cg.initCanvasTransform(),r.cg.ctx.strokeStyle=r.selectionRectangleColor,r.cg.ctx.lineWidth=o,r.cg.ctx.beginPath(),r.cg.ctx.rect(r.cg.geoToPixX(i.cell.x)-o/2,r.cg.geoToPixY(i.cell.y)+o/2,i.resolution/r.getZoomFactor()+o,-i.resolution/r.getZoomFactor()-o),r.cg.ctx.stroke()}else r.tooltip.hide(),r.canvasSave&&r.cg.ctx.drawImage(r.canvasSave,0,0)};e.addEventListener("mouseover",(function(t){o(t)})),e.addEventListener("mousemove",(function(t){o(t)})),e.addEventListener("mouseout",(function(){r.tooltip.hide()})),this.cg.onZoomStartFun=function(t){n.onZoomStartFun&&n.onZoomStartFun(t),r.tooltip.hide()},this.canvasSave=null,this.selectionRectangleColor=n.selectionRectangleColor||"red",this.selectionRectangleWidthPix=n.selectionRectangleWidthPix||function(){return 4}}else console.error("Cannot find gridviz container element.")}var e,n;return e=t,n=[{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.cg.updateExtentGeo(t)}},{key:"getCellFocusInfo",value:function(t){for(var e=this.getZoomFactor(),n=this.layers.length-1;n>=0;n--){var r=this.layers[n];if(r.visible&&r.cellInfoHTML&&"none"!==r.cellInfoHTML){var i=r.getDatasetComponent(e);if(i){var o=i.getCellFromPosition(t,i.getViewCache());if(!o)return;var s=r.cellInfoHTML(o,i.getResolution());if(!s)return;return{cell:o,html:s,resolution:i.getResolution()}}}}}},{key:"getGeoCenter",value:function(){return this.cg.getCenter()}},{key:"setGeoCenter",value:function(t){return this.cg.setCenter(t),this}},{key:"getZoomFactor",value:function(){return this.cg.getZf()}},{key:"setZoomFactor",value:function(t){return this.cg.setZf(t),this}},{key:"getZoomFactorExtent",value:function(){return this.cg.getZfExtent()}},{key:"setZoomFactorExtent",value:function(t){return this.cg.setZfExtent(t),this}},{key:"getBackgroundColor",value:function(){return this.cg.backgroundColor}},{key:"setBackgroundColor",value:function(t){return this.cg.backgroundColor=t,this}},{key:"getBoundaryLayer",value:function(){return this.boundaryLayer}},{key:"setBoundaryLayer",value:function(t){return this.boundaryLayer=new Vl(t),this}},{key:"getLabelLayer",value:function(){return this.labelLayer}},{key:"setLabelLayer",value:function(t){return this.labelLayer=new Fl(t),this}},{key:"redraw",value:function(){return this.cg.redraw(),this}},{key:"addLayerFromDataset",value:function(t,e,n){var r=new Vn(t,e,n);return this.layers.push(r),this}},{key:"makeCSVGridDataset",value:function(t,e,n){var r=this;return new Zn([new Sr(t,e,n).getData(void 0,(function(){r.cg.redraw()}))],[],n)}},{key:"makeTiledGridDataset",value:function(t,e){var n=this;return new Zn([new xl(t,this,e).loadInfo((function(){n.cg.redraw()}))],[],e)}},{key:"makeMultiScaleCSVGridDataset",value:function(t,e,n){var r=this;return Zn.make(t,(function(t){return new Sr(e(t),t,n).getData(void 0,(function(){r.cg.redraw()}))}),n)}},{key:"makeMultiScaleTiledGridDataset",value:function(t,e,n){var r=this;return Zn.make(t,(function(t){return new xl(e(t),r,n).loadInfo((function(){r.cg.redraw()}))}),n)}},{key:"addCSVGridLayer",value:function(t,e,n,r){var i=this.makeCSVGridDataset(t,e,r);return this.addLayerFromDataset(i,n,r)}},{key:"addTiledGridLayer",value:function(t,e,n){var r=this.makeTiledGridDataset(t,n);return this.addLayerFromDataset(r,e,n)}},{key:"addMultiScaleCSVGridLayer",value:function(t,e,n,r){var i=this.makeMultiScaleCSVGridDataset(t,e,r);return this.addLayerFromDataset(i,n,r)}},{key:"addMultiScaleTiledGridLayer",value:function(t,e,n,r){var i=this.makeMultiScaleTiledGridDataset(t,e,r);return this.addLayerFromDataset(i,n,r)}},{key:"addBackgroundLayer",value:function(t){return this.bgLayers.push(new Il(t)),this.redraw(),this}},{key:"addBackgroundLayerWMS",value:function(t){return this.bgLayers.push(new Ml(t)),this.redraw(),this}},{key:"addZoomSlider",value:function(t,e){return this.cg.addZoomSlider(t,e),this}},{key:"setViewFromURL",value:function(){return this.cg.setViewFromURL(),this}},{key:"defineResizeObserver",value:function(t,e){var n=this;new ResizeObserver((function(r){t.clientWidth>0&&t.clientHeight>0&&window.requestAnimationFrame((function(){Array.isArray(r)&&r.length&&(n.h===t.clientHeight&&n.w===t.clientWidth||(n.h=t.clientHeight,n.w=t.clientWidth,n.cg.h=t.clientHeight,n.cg.w=t.clientWidth,e.setAttribute("width",""+n.w),e.setAttribute("height",""+n.h),n.redraw()))}))})).observe(t)}}],n&&Yl(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Hl(t){return Hl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hl(t)}function ql(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Xl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Xl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Kl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Hl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Hl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Hl(i)?i:String(i)),r)}var i}var Jl=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.filter=e.filter||function(){return!0},this.offset=e.offset||function(t,e,n){return{dx:0,dy:0}},this.minZoom=e.minZoom||0,this.maxZoom=e.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");this.legends=[]}var e,n,r;return e=t,r=[{key:"getStatistics",value:function(t,e,n){if(t&&0!=t.length){var r,i=1/0,o=-1/0,s=ql(t);try{for(s.s();!(r=s.n()).done;){var a=+e(r.value);n&&!a||(a<i&&(i=a),a>o&&(o=a))}}catch(t){s.e(t)}finally{s.f()}return{min:i,max:o}}}}],(n=[{key:"draw",value:function(t,e,n){throw new Error("Method draw not implemented.")}},{key:"getOffset",value:function(){return this.offset}},{key:"setOffset",value:function(t){return this.offset=t,this}},{key:"updateLegends",value:function(t){var e,n=ql(this.legends);try{for(n.s();!(e=n.n()).done;)e.value.update(t)}catch(t){n.e(t)}finally{n.f()}return this}}])&&Kl(e.prototype,n),r&&Kl(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ql(t){return Ql="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ql(t)}function tf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ef(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Ql(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Ql(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Ql(i)?i:String(i)),r)}var i}function nf(t,e){return nf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nf(t,e)}function rf(t){return rf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rf(t)}var of=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=rf(r);if(i){var n=rf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Ql(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.sizeCol=t.sizeCol,e.size=t.size,e.shape=t.shape||function(){return"square"},e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s=n.getZf();this.sizeCol&&(t.sort((function(t,e){return e[r.sizeCol]-t[r.sizeCol]})),i=Jl.getStatistics(t,(function(t){return t[r.sizeCol]}),!0)),this.colorCol&&(o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),n.setCanvasTransform();var a,u=.5*e,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return tf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(c.s();!(a=c.n()).done;){var l=a.value,f=this.color?this.color(l[this.colorCol],e,o,s):void 0;if(f&&"none"!==f){n.ctx.fillStyle=f;var h=this.shape?this.shape(l):"square";if("none"!==h){var d=(this.size||function(){return e})(l[this.sizeCol],e,i,s),p=this.offset(l,e,s);if("square"===h){var y=e*(1-d/e)*.5;n.ctx.fillRect(l.x+y+p.dx,l.y+y+p.dy,d,d)}else if("circle"===h)n.ctx.beginPath(),n.ctx.arc(l.x+u+p.dx,l.y+u+p.dy,.5*d,0,2*Math.PI,!1),n.ctx.fill();else if("donut"===h){var v=l.x+u+p.dx,b=l.y+u+p.dy;n.ctx.beginPath(),n.ctx.moveTo(v,b),n.ctx.arc(v,b,u,0,2*Math.PI),n.ctx.arc(v,b,(1-d/e)*u,0,2*Math.PI,!0),n.ctx.closePath(),n.ctx.fill()}else{if("diamond"!==h)throw new Error("Unexpected shape:"+h);var m=.5*d;n.ctx.beginPath(),n.ctx.moveTo(l.x+u-m,l.y+u),n.ctx.lineTo(l.x+u,l.y+u+m),n.ctx.lineTo(l.x+u+m,l.y+u),n.ctx.lineTo(l.x+u,l.y+u-m),n.ctx.fill()}}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:s,sSize:i,sColor:o})}}])&&ef(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function sf(t){return sf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sf(t)}function af(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function uf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==sf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==sf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===sf(i)?i:String(i)),r)}var i}function cf(t,e){return cf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cf(t,e)}function lf(t){return lf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lf(t)}var ff=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=lf(r);if(i){var n=lf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===sf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.strokeColorCol=t.strokeColorCol,e.strokeColor=t.strokeColor||function(){return"#666"},e.sizeCol=t.sizeCol,e.size=t.size,e.strokeWidthCol=t.strokeWidthCol,e.strokeWidth=t.strokeWidth,e.shape=t.shape||function(){return"square"},e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s,a=n.getZf();this.strokeColorCol&&(i=Jl.getStatistics(t,(function(t){return t[r.strokeColorCol]}),!0)),this.sizeCol&&(o=Jl.getStatistics(t,(function(t){return t[r.sizeCol]}),!0)),this.strokeWidthCol&&(s=Jl.getStatistics(t,(function(t){return t[r.strokeWidthCol]}),!0)),n.setCanvasTransform();var u,c=.5*e,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return af(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?af(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(l.s();!(u=l.n()).done;){var f=u.value,h=this.strokeColor?this.strokeColor(f[this.strokeColorCol],e,i):void 0;if(h&&"none"!==h){n.ctx.strokeStyle=h;var d=(this.size||function(){return e})(f[this.sizeCol],e,o,a),p=this.strokeWidth?this.strokeWidth(f[this.strokeWidthCol],e,s,a):1*a;if(p&&!(p<=0)){n.ctx.lineWidth=p;var y=this.shape?this.shape(f):"square";if("none"!==y){var v=this.offset(f,e,a);if("square"===y){var b=e*(1-d/e)*.5;n.ctx.beginPath(),n.ctx.rect(f.x+b+v.dx,f.y+b+v.dy,d,d),n.ctx.stroke()}else if("circle"===y)n.ctx.beginPath(),n.ctx.arc(f.x+c+v.dx,f.y+c+v.dy,.5*d,0,2*Math.PI,!1),n.ctx.stroke();else if("diamond"===y){var m=.5*d;n.ctx.beginPath(),n.ctx.moveTo(f.x+c-m,f.y+c),n.ctx.lineTo(f.x+c,f.y+c+m),n.ctx.lineTo(f.x+c+m,f.y+c),n.ctx.lineTo(f.x+c,f.y+c-m),n.ctx.lineTo(f.x+c-m,f.y+c),n.ctx.stroke()}else{if("donut"!==y)throw new Error("Unexpected shape:"+y);console.error("Not implemented")}}}}}}catch(t){l.e(t)}finally{l.f()}}}])&&uf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function hf(t){return hf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hf(t)}function df(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function pf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==hf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==hf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===hf(i)?i:String(i)),r)}var i}function yf(t,e){return yf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yf(t,e)}function vf(t){return vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vf(t)}var bf=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=vf(r);if(i){var n=vf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===hf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.heightCol=t.heightCol,e.height=t.height||function(t){return Math.sqrt(t)},e.lineColor=t.lineColor||function(t,e,n,r){return"#BBB"},e.lineWidth=t.lineWidth||function(t,e,n,r){return r},e.fillColor=t.fillColor||function(t,e,n,r){return"#c08c5968"},e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter)),n.ctx.lineJoin="round";var i,o=n.getZf(),s=Jl.getStatistics(t,(function(t){return t[r.heightCol]}),!0),a={},u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return df(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?df(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(u.s();!(i=u.n()).done;){var c=i.value,l=a[c.y];l||(l={},a[c.y]=l),l[c.x]=this.height(c[this.heightCol],e,s,o)}}catch(t){u.e(t)}finally{u.f()}var f=n.extGeo;if(f){var h=Math.floor(f.xMin/e)*e,d=Math.floor(f.xMax/e)*e,p=Math.floor(f.yMin/e)*e,y=Math.floor(f.yMax/e)*e,v={min:p,max:y};n.setCanvasTransform();for(var b=y;b>=p;b-=e){var m=a[b];if(m){n.ctx.beginPath(),n.ctx.moveTo(h-e/2,b);for(var g=void 0,w=h;w<=d;w+=e){var _=m[w];_||(_=0),_||g?n.ctx.lineTo(w+e/2,b+_):n.ctx.moveTo(w+e/2,b),g=_}g&&n.ctx.lineTo(d+e/2,b);var x=this.fillColor(b,v,e,o);x&&"none"!=x&&(n.ctx.fillStyle=x,n.ctx.fill());var S=this.lineColor(b,v,e,o),O=this.lineWidth(b,v,e,o);S&&"none"!=S&&O>0&&(n.ctx.strokeStyle=S,n.ctx.lineWidth=O,n.ctx.stroke())}}}}}])&&pf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function mf(t){return mf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mf(t)}function gf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(t,e)||wf(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wf(t,e){if(t){if("string"==typeof t)return _f(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_f(t,e):void 0}}function _f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function xf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==mf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==mf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===mf(i)?i:String(i)),r)}var i}function Sf(t,e){return Sf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sf(t,e)}function Of(t){return Of=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Of(t)}var If=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Sf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Of(r);if(i){var n=Of(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===mf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.color=t.color,e.type=t.type,e.sizeCol=t.sizeCol,e.size=t.size||function(t,e,n,r){return e},e.stripesOrientation=t.stripesOrientation||function(){return 0},e.offsetAngle=t.offsetAngle||function(){return 0},e.agePyramidHeight=t.agePyramidHeight||function(t,e,n){return e},e.pieChartInternalRadiusFactor=t.pieChartInternalRadiusFactor||0,e}return e=s,n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o=n.getZf();this.sizeCol&&(t.sort((function(t,e){return e[r.sizeCol]-t[r.sizeCol]})),i=Jl.getStatistics(t,(function(t){return t[r.sizeCol]}),!0));var s=Object.entries(this.color).length;n.setCanvasTransform();var a,u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=wf(t))){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(u.s();!(a=u.n()).done;){var c=a.value,l=(this.size||function(){return e})(c[this.sizeCol],e,i,o),f=this.offset(c,e,o),h=this.type?this.type(c):"flag",d=c.x+f.dx+("agepyramid"===h?0:.5*e),p=c.y+f.dy+("agepyramid"===h?0:.5*e),y=this.offsetAngle?this.offsetAngle(c,e,o)*Math.PI/180:0;if("agepyramid"===h||"radar"===h||"halftone"===h){for(var v=-1/0,b=0,m=Object.keys(this.color);b<m.length;b++){var g=+c[m[b]];g>v&&(v=g)}var w=0;"agepyramid"===h&&this.agePyramidHeight&&(w=(e-this.agePyramidHeight(c,e,o))/2),"radar"!==h&&"halftone"!==h||(w=Math.PI/2+y);var _="agepyramid"===h?(this.agePyramidHeight?this.agePyramidHeight(c,e,o):e)/s:"radar"===h||"halftone"===h?2*Math.PI/s:void 0;if(void 0===_)throw new Error("Unexpected symbol type:"+h);for(var x=0,S=Object.entries(this.color);x<S.length;x++){var O=gf(S[x],2),I=O[0],T=O[1];if("agepyramid"===h){n.ctx.fillStyle=T;var A=l*c[I]/v;n.ctx.fillRect(d+(e-A)/2,p+w,A,_),w+=_}else if("radar"===h){n.ctx.fillStyle=T;var M=c[I],E=l/2*Math.sqrt(M/v);n.ctx.beginPath(),n.ctx.moveTo(d,p),n.ctx.arc(d,p,E,w-_,w),n.ctx.lineTo(d,p),n.ctx.fill(),w+=_}else{if("halftone"!==h)throw new Error("Unexpected symbol type:"+h);n.ctx.fillStyle=T;var C=c[I],P=.333*l*Math.sqrt(C/v);n.ctx.beginPath(),n.ctx.arc(d+.25*e*Math.cos(w),p+.25*e*Math.sin(w),P,0,2*Math.PI),n.ctx.fill(),w+=_}}}else{for(var j=0,k=0,B=Object.keys(this.color);k<B.length;k++){var F=+c[B[k]];F&&(j+=F)}if(!j||isNaN(j))continue;for(var L=0,D=e*(1-l/e)*.5,N=this.stripesOrientation(c,e,o),R=0,z=Object.entries(this.color);R<z.length;R++){var U=gf(z[R],2),V=U[0],W=U[1],$=c[V]/j;if($&&!isNaN($)){if(n.ctx.fillStyle=W,"flag"===h)0==N?n.ctx.fillRect(c.x+D+f.dx,c.y+D+L*l+f.dy,l,$*l):n.ctx.fillRect(c.x+D+L*l+f.dx,c.y+D+f.dy,$*l,l);else if("piechart"===h){var G=2*L*Math.PI,Y=2*(L+$)*Math.PI;n.ctx.beginPath(),n.ctx.moveTo(d,p),n.ctx.arc(d,p,.5*l,G+y,Y+y),this.pieChartInternalRadiusFactor&&n.ctx.arc(d,p,.5*l*this.pieChartInternalRadiusFactor,G+y,Y+y,!0),n.ctx.closePath(),n.ctx.fill()}else if("ring"===h)n.ctx.beginPath(),n.ctx.arc(d,p,Math.sqrt(1-L)*l*.5,0,2*Math.PI),n.ctx.fill();else{if("segment"!==h)throw new Error("Unexpected symbol type:"+h);var Z=l*l/e;0==N?n.ctx.fillRect(c.x+f.dx,c.y+(e-Z)/2+L*Z+f.dy,e,$*Z):n.ctx.fillRect(c.x+L*e+f.dx,c.y+(e-Z)/2+f.dy,$*e,Z)}L+=$}}}}}catch(t){u.e(t)}finally{u.f()}this.updateLegends({style:this,r:e,zf:o,sSize:i})}}],n&&xf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function Tf(t){return Tf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tf(t)}function Af(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Mf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Tf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Tf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Tf(i)?i:String(i)),r)}var i}function Ef(t,e){return Ef=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ef(t,e)}function Cf(t){return Cf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cf(t)}var Pf=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ef(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Cf(r);if(i){var n=Cf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Tf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.orientation=t.orientation||function(){return 0},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.lengthCol=t.lengthCol,e.length=t.length,e.widthCol=t.widthCol,e.width=t.width,e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s,a=n.getZf();this.colorCol&&(i=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),this.lengthCol&&(t.sort((function(t,e){return e[r.lengthCol]-t[r.lengthCol]})),o=Jl.getStatistics(t,(function(t){return t[r.lengthCol]}),!0)),this.widthCol&&(s=Jl.getStatistics(t,(function(t){return t[r.widthCol]}),!0)),n.ctx.lineCap="butt";var u=Math.PI/180;n.setCanvasTransform();var c,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Af(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Af(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(l.s();!(c=l.n()).done;){var f=c.value,h=this.color?this.color(f[this.colorCol],e,i):void 0;if(h){var d=this.width?this.width(f[this.widthCol],e,s,a):void 0;if(d&&!(d<0)){var p=this.length?this.length(f[this.lengthCol],e,o,a):void 0;if(p&&!(p<0)){var y=this.orientation(f)*u;if(void 0!==y&&!isNaN(y)){var v=this.offset(f,e,a);n.ctx.strokeStyle=h,n.ctx.lineWidth=d;var b=f.x+e/2+v.dx,m=f.y+e/2+v.dy,g=.5*Math.cos(y)*p,w=.5*Math.sin(y)*p;n.ctx.beginPath(),n.ctx.moveTo(b-g,m-w),n.ctx.lineTo(b+g,m+w),n.ctx.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,r:e,zf:a,sColor:i,sLength:o,sWidth:s})}}])&&Mf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function jf(t){return jf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jf(t)}function kf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Bf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==jf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==jf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===jf(i)?i:String(i)),r)}var i}function Ff(t,e){return Ff=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ff(t,e)}function Lf(t){return Lf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Lf(t)}var Df=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ff(t,e)}(a,t);var e,n,r,i,o,s=(i=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Lf(i);if(o){var n=Lf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===jf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),e=s.call(this,t),t=t||{},e.textCol=t.textCol,e.text=t.text||function(t,e,n,r){return"X"},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.fontSizeCol=t.fontSizeCol,e.fontSize=t.fontSize||function(t,e,n,r){return.8*e},e.fontFamily=t.fontFamily||"Arial",e.fontWeight=t.fontWeight||"bold",e}return e=a,r=[{key:"getCharLegendFun",value:function(t){var e=t.length;return function(n){return 0==n?"":1==n?t[e-1]:t[Math.floor(n*e)]}}}],(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s,a=n.getZf();this.textCol&&(i=Jl.getStatistics(t,(function(t){return t[r.textCol]}),!0)),this.colorCol&&(o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),this.fontSizeCol&&(t.sort((function(t,e){return e[r.fontSizeCol]-t[r.fontSizeCol]})),s=Jl.getStatistics(t,(function(t){return t[r.fontSizeCol]}),!0)),n.initCanvasTransform();var u,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return kf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(c.s();!(u=c.n()).done;){var l=u.value,f=this.text?this.text(l[this.textCol],e,i):void 0;if(null!=f&&null!=f&&f+""!=""){var h=this.color?this.color(l[this.colorCol],e,o):void 0;if(h){n.ctx.fillStyle=h;var d=this.fontSize(l[this.fontSizeCol],e,s,a)/a,p=this.fontFamily||"Arial",y=this.fontWeight||"bold";n.ctx.font=y+" "+d+"px "+p;var v=this.offset(l,e,a);n.ctx.textAlign="center";var b=n.geoToPixX(l.x+.5*e+v.dx),m=n.geoToPixY(l.y+.5*e+v.dy)+.3*d;n.ctx.fillText(f,b,m)}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:a,sColor:o})}}])&&Bf(e.prototype,n),r&&Bf(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(Jl);function Nf(t,e){return null==t?e:"function"==typeof t?t:e=>e[t]}function Rf(t,e=!1){const n=new Float64Array(5),r=new Float64Array(4);!function(t,e,n){const r=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/n),o=Math.exp(-1.723/n),s=.6318/n,a=1.997/n,u=Float64Array.of(-i*Math.cos(s),i*Math.sin(s),-i*Math.cos(-s),i*Math.sin(-s),-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a)),c=2.5066282746310007*n,l=Float64Array.of(r[0],r[1],0,0,0,0,0,0),f=Float64Array.of(1,0,u[0],u[1],0,0,0,0,0,0);let h,d;for(d=2;d<8;d+=2){for(l[d]=u[d]*l[d-2]-u[d+1]*l[d-1],l[d+1]=u[d]*l[d-1]+u[d+1]*l[d-2],h=d-2;h>0;h-=2)l[h]+=u[d]*l[h-2]-u[d+1]*l[h-1],l[h+1]+=u[d]*l[h-1]+u[d+1]*l[h-2];for(h=0;h<=d;h+=2)l[h]+=r[d]*f[h]-r[d+1]*f[h+1],l[h+1]+=r[d]*f[h+1]+r[d+1]*f[h];for(f[d+2]=u[d]*f[d]-u[d+1]*f[d+1],f[d+3]=u[d]*f[d+1]+u[d+1]*f[d],h=d;h>0;h-=2)f[h]+=u[d]*f[h-2]-u[d+1]*f[h-1],f[h+1]+=u[d]*f[h-1]+u[d+1]*f[h-2]}for(d=0;d<4;++d)h=d<<1,e[d]=l[h]/c,t[d+1]=f[h+2]}(n,r,t);const i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),o=1+n[1]+n[2]+n[3]+n[4];return{sigma:t,negative:e,a:n,b_causal:r,b_anticausal:i,sum_causal:(r[0]+r[1]+r[2]+r[3])/o,sum_anticausal:(i[1]+i[2]+i[3]+i[4])/o}}function zf(t,e,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,u=Uf){const c=2*r,l=3*r,f=4*r,h=r*n;let d,p;for(u(i,e,n,r,t.b_causal,3,t.a,4,t.sum_causal,s,t.sigma),p=4,d=f;p<n;++p,d+=r)i[p]=t.b_causal[0]*e[d]+t.b_causal[1]*e[d-r]+t.b_causal[2]*e[d-c]+t.b_causal[3]*e[d-l]-t.a[1]*i[p-1]-t.a[2]*i[p-2]-t.a[3]*i[p-3]-t.a[4]*i[p-4];for(u(o,e,n,-r,t.b_anticausal,4,t.a,4,t.sum_anticausal,s,t.sigma),p=4,d=h-5*r;p<n;++p,d-=r)o[p]=t.b_anticausal[1]*e[d+r]+t.b_anticausal[2]*e[d+c]+t.b_anticausal[3]*e[d+l]+t.b_anticausal[4]*e[d+f]-t.a[1]*o[p-1]-t.a[2]*o[p-2]-t.a[3]*o[p-3]-t.a[4]*o[p-4];if(t.negative)for(p=0,d=0;p<n;++p,d+=r)a[d]=i[p]+o[n-p-1];else for(p=0,d=0;p<n;++p,d+=r)a[d]=Math.max(0,i[p]+o[n-p-1]);return a}function Uf(t,e,n,r,i,o,s,a,u,c){const l=Math.abs(r)*n,f=r<0?l+r:0;let h,d,p;for(d=0;d<a;++d)for(c[d]=d<=o?i[d]:0,p=1;p<=a&&p<=d;++p)c[d]-=s[p]*c[d-p];for(p=0;p<a;++p)for(t[p]=0,d=1;d<=p;++d)h=f+r*d,h>=0&&h<l&&(t[p]+=c[p-d]*e[h]);const y=e[f];if(y>0)for(p=0;p<a;++p)t[p]+=c[p]*y}function Vf(t,e,n=0){const r=t.length;let i,o;for(let n=0;n<r;++n){const r=e(t[n],n,t);null!=r&&(void 0===i?r>=r&&(i=o=r):(r<i&&(i=r),r>o&&(o=r)))}return[i-n,o+n]}function Wf(t,e){const n=t.length;for(let r=0;r<n;++r)t[r]>e&&(e=t[r]);return e}function $f(t,e){const n=t.length;for(let r=0;r<n;++r)t[r]<e&&(e=t[r]);return e}function Gf(t,e){const n=t.map(e).filter((t=>null!=t&&t>=t));n.sort(((t,e)=>t-e));const r=function(t){const e=t.length;let n,r=0,i=0,o=0;for(let s=0;s<e;++s){const e=t[s];n=e-i,i+=n/++r,o+=n*(e-i)}return r>1?Math.sqrt(o/(r-1)):NaN}(n),i=Yf(n,.25),o=Yf(n,.75),s=n.length,a=(o-i)/1.34;return 1.06*(Math.min(r,a)||r||Math.abs(i)||1)*Math.pow(s,-.2)}function Yf(t,e){const n=t.length;if(!n)return NaN;if((e=+e)<=0||n<2)return t[0];if(e>=1)return t[n-1];const r=(n-1)*e,i=Math.floor(r),o=t[i];return o+(t[i+1]-o)*(r-i)}function Zf(t,e={}){const{adjust:n=1,pad:r=3,bins:i=[256,256]}=e,o=Nf(e.x,(t=>t[0])),s=Nf(e.y,(t=>t[1])),a=Nf(e.weight,(()=>1/t.length));let[u=n*Gf(t,o),c=n*Gf(t,s)]=Hf(e.bandwidth);const[[l,f]=Vf(t,o,r*u),[h,d]=Vf(t,s,r*c)]=null==(p=e.extent)?[void 0,void 0]:"number"==typeof p[0]?[p,p]:p;var p;const[y,v]=Hf(i),b=function(t,e,n,r,i,o,s,a,u,c){const l=new Float64Array(s*c),f=(s-1)/(o-i),h=(c-1)/(u-a);for(let o=0;o<t.length;++o){const u=t[o],d=e(u,o,t),p=n(u,o,t),y=r(u,o,t);if(!(Number.isFinite(d)&&Number.isFinite(p)&&Number.isFinite(y)))continue;const v=(d-i)*f,b=Math.floor(v),m=b+1,g=(p-a)*h,w=Math.floor(g),_=w+1;0<=b&&m<s?0<=w&&_<c?(l[b+w*s]+=(m-v)*(_-g)*y,l[b+_*s]+=(m-v)*(g-w)*y,l[m+w*s]+=(v-b)*(_-g)*y,l[m+_*s]+=(v-b)*(g-w)*y):-1===w?(l[b+_*s]+=(m-v)*(g-w)*y,l[m+_*s]+=(v-b)*(g-w)*y):_===c&&(l[m+w*s]+=(v-b)*(_-g)*y,l[b+w*s]+=(m-v)*(_-g)*y):-1===b?0<=w&&_<c?(l[m+w*s]+=(v-b)*(_-g)*y,l[m+_*s]+=(v-b)*(g-w)*y):-1===w?l[m+_*s]+=(v-b)*(g-w)*y:_===c&&(l[m+w*s]+=(v-b)*(_-g)*y):m===s&&(0<=w&&_<c?(l[b+w*s]+=(m-v)*(_-g)*y,l[b+_*s]+=(m-v)*(g-w)*y):-1===w?l[b+_*s]+=(m-v)*(g-w)*y:_===c&&(l[b+w*s]+=(m-v)*(_-g)*y))}return l}(t,o,s,a,l,f,y,h,d,v),m=(f-l)/(y-1),g=(d-h)/(v-1),w=b.some((t=>t<0));let _,x=Rf(u/m,w),S=Rf(c/g,w);function*O(t="x",e="y",n="z"){const r=I.grid(),i=1/(m*g);for(let o=0,s=0;s<v;++s)for(let a=0;a<y;++a,++o)yield{[t]:l+a*m,[e]:h+s*g,[n]:r[o]*i}}const I={[Symbol.iterator]:O,points:O,grid:()=>_||(_=function(t,e,n,[r,i]){const o=new Float64Array(Math.max(r,i)),s=new Float64Array(Math.max(r,i)),a=new Float64Array(5),u=new Float64Array(n.length);for(let e=0,c=0;e<i;++e,c+=r){const e=u.subarray(c);zf(t,n.subarray(c),r,1,o,s,a,e)}for(let t=0;t<r;++t){const n=u.subarray(t);zf(e,n,i,r,o,s,a,n)}return u}(x,S,b,[y,v])),extent:()=>[[l,f],[h,d]],heatmap:({color:t,clamp:e,canvas:n,maxColors:r}={})=>function(t,e,n,r=(t=>({r:0,g:0,b:0,opacity:t})),[i,o]=[$f(t,0),Wf(t,0)],s=function(t,e){if("undefined"!=typeof document){const n=document.createElement("canvas");return n.setAttribute("width",t),n.setAttribute("height",e),n}throw"Can not create a canvas instance, provide a canvas as a parameter."}(e,n),a=256){const u=1/(o-i),c=s.getContext("2d"),l=c.getImageData(0,0,e,n),f=l.data,h=a-1,d=function(t,e){const n=new Uint8ClampedArray(4*(t+1));for(let r=0;r<=t;++r){const i=e(r/t),{r:o,g:s,b:a,opacity:u=1}="string"==typeof i?Fe(i):i,c=r<<2;n[c+0]=o,n[c+1]=s,n[c+2]=a,n[c+3]=255*u|0}return n}(h,r);for(let r=0,o=0;r<n;++r)for(let s=0,a=(n-r-1)*e;s<e;++s,o+=4){const e=h*Math.min(1,Math.max(t[s+a]-i,0)*u)<<2;f[o+0]=d[e+0],f[o+1]=d[e+1],f[o+2]=d[e+2],f[o+3]=d[e+3]}return c.putImageData(l,0,0),s}(I.grid(),y,v,t,e,n,r),bandwidth(t){if(arguments.length){const[e,n]=Hf(t);return e!==u&&(_=null,x=Rf((u=e)/m,w)),n!==c&&(_=null,S=Rf((c=n)/g,w)),I}return[u,c]}};return I}function Hf(t){return null==t?[void 0,void 0]:"number"==typeof t?[t,t]:t}function qf(t){return qf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qf(t)}function Xf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Kf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==qf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==qf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===qf(i)?i:String(i)),r)}var i}function Jf(t,e){return Jf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jf(t,e)}function Qf(t){return Qf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qf(t)}var th=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Qf(r);if(i){var n=Qf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===qf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.value=t.value,e.sigma=t.sigma,e.factor=t.factor||2,e.filterSm=t.filterSm,e.sCol=t.sCol||"ksmval",e.styles=t.styles||[],e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),t&&0!=t.length){var i=this.sigma(e,n.zf),o=Math.ceil(n.w/this.factor),s=Math.ceil(n.h/this.factor),a=[[n.pixToGeoX(0),n.pixToGeoX(o*this.factor)],[n.pixToGeoY(s*this.factor),n.pixToGeoY(0)]],u=Zf(t,{x:function(t){return t.x+e/2},y:function(t){return t.y+e/2},weight:function(t){return r.value(t)},bins:[o,s],bandwidth:i,extent:a}).grid(),c=(a[0][1]-a[0][0])/o;t=[];for(var l=0;l<u.length;l++){var f=u[l];if(!this.filterSm||this.filterSm(f)){var h=Math.floor(l/o),d=l%o,p={x:a[0][0]+d*c,y:a[1][0]+h*c};p[this.sCol]=f,t.push(p)}}var y,v=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Xf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(this.styles);try{for(v.s();!(y=v.n()).done;)y.value.draw(t,c,n)}catch(t){v.e(t)}finally{v.f()}}}}])&&Kf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function eh(t){return eh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eh(t)}function nh(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return rh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function rh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ih(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==eh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==eh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===eh(i)?i:String(i)),r)}var i}function oh(t,e){return oh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oh(t,e)}function sh(t){return sh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sh(t)}var ah=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oh(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=sh(r);if(i){var n=sh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===eh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.heightCol=t.heightCol,e.height=t.height,e.colorCol=t.colorCol,e.color=t.color||function(){return"#c08c59"},e.widthCol=t.widthCol,e.width=t.width||function(t,e){return.5*e},e.simple=null!=t.simple,e.viewHeightFactor=t.viewHeightFactor||1.5,e.viewSX=null==t.viewSX?0:t.viewSX,e.viewSY=null==t.viewSY?-.5:t.viewSY,e.shadowDirection=null==t.shadowDirection?-40.3*Math.PI/180:t.shadowDirection,e.shadowFactor=t.shadowFactor||.3,e.shadowColor=t.shadowColor||"#00000033",e.outlineCol=t.outlineCol||"#FFFFFF",e.outlineWidthPix=null==t.outlineWidthPix?.5:t.outlineWidthPix,e}return e=s,n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s,a=n.getZf();this.heightCol&&(i=Jl.getStatistics(t,(function(t){return t[r.heightCol]}),!0)),this.colorCol&&(o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),this.widthCol&&(s=Jl.getStatistics(t,(function(t){return t[r.widthCol]}),!0));var u=n.getCenter().x+this.viewSX*n.w*a,c=n.getCenter().y+this.viewSY*n.h*a,l=this.viewHeightFactor*(n.w+n.h)*.5*a;t.sort((function(t,e){return 1e8*(e.y-t.y)+t.x-e.x})),n.ctx.lineCap=this.simple?"butt":"round",n.setCanvasTransform(),n.ctx.strokeStyle=this.shadowColor,n.ctx.fillStyle=this.shadowColor;var f,h=nh(t);try{for(h.s();!(f=h.n()).done;){var d=f.value,p=this.width?this.width(d[this.widthCol],e,s,a):void 0;if(p&&!(p<0)){var y=this.height?this.height(d[this.heightCol],e,i,a):void 0;if(y&&!(y<0)){this.offset(d,e,a),n.ctx.lineWidth=p;var v=d.x+e/2,b=d.y+e/2,m=y*this.shadowFactor;n.ctx.beginPath(),n.ctx.moveTo(v,b),n.ctx.lineTo(v+m*Math.cos(this.shadowDirection),b+m*Math.sin(this.shadowDirection)),n.ctx.stroke()}}}}catch(t){h.e(t)}finally{h.f()}var g,w=nh(t);try{for(w.s();!(g=w.n()).done;){var _=g.value,x=this.color?this.color(_[this.colorCol],e,o):void 0;if(x){var S=this.width?this.width(_[this.widthCol],e,s,a):void 0;if(S&&!(S<0)){var O=this.height?this.height(_[this.heightCol],e,i,a):void 0;if(O&&!(O<0)){this.offset(_,e,a);var I=_.x+e/2,T=_.y+e/2,A=I-u,M=T-c,E=Math.atan2(M,A),C=Math.sqrt(A*A+M*M)*O/(l-O);this.simple?(n.ctx.strokeStyle=x,n.ctx.lineWidth=S,n.ctx.beginPath(),n.ctx.moveTo(I,T),n.ctx.lineTo(I+C*Math.cos(E),T+C*Math.sin(E)),n.ctx.stroke()):(n.ctx.strokeStyle=this.outlineCol,n.ctx.lineWidth=S+2*this.outlineWidthPix*a,n.ctx.beginPath(),n.ctx.moveTo(I,T),n.ctx.lineTo(I+C*Math.cos(E),T+C*Math.sin(E)),n.ctx.stroke(),n.ctx.strokeStyle=x,n.ctx.lineWidth=S,n.ctx.beginPath(),n.ctx.moveTo(I,T),n.ctx.lineTo(I+C*Math.cos(E),T+C*Math.sin(E)),n.ctx.stroke(),n.ctx.strokeStyle=this.outlineCol,n.ctx.lineWidth=this.outlineWidthPix*a,n.ctx.beginPath(),n.ctx.arc(I+C*Math.cos(E),T+C*Math.sin(E),.5*S,0,2*Math.PI,!1),n.ctx.stroke())}}}}}catch(t){w.e(t)}finally{w.f()}n.ctx.lineCap="butt",this.updateLegends({style:this,r:e,zf:a,sColor:o})}}],n&&ih(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function uh(t){return uh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uh(t)}function ch(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return lh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function lh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function fh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==uh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==uh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===uh(i)?i:String(i)),r)}var i}function hh(t,e){return hh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hh(t,e)}function dh(t){return dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dh(t)}var ph=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hh(t,e)}(a,t);var e,n,r,i,o,s=(i=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=dh(i);if(o){var n=dh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===uh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),e=s.call(this,t),t=t||{},e.valueCol=t.valueCol,e.value=t.value||function(t,e,n,r,i){return 1},e.color=t.color||function(){return"#EA6BAC"},e.width=t.width||function(t,e,n,r){return e*t.value/5},e.orientation=t.orientation||0,e.fillColor=t.fillColor,e}return e=a,n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o=n.getZf();this.valueCol&&(i=Jl.getStatistics(t,(function(t){return t[r.valueCol]}),!0));var s=[],u=.001*e;t.sort((function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x}));for(var c=t[0],l=1;l<t.length;l++){var f=t[l];Math.abs(c.y+e-f.y)<=u&&Math.abs(c.x-f.x)<=u?s.push({x:c.x,y:f.y,or:"h",value:this.value(c[this.valueCol],f[this.valueCol],e,i,o)}):(s.push({x:c.x,y:c.y+e,or:"h",value:this.value(c[this.valueCol],void 0,e,i,o)}),s.push({x:f.x,y:f.y,or:"h",value:this.value(void 0,f[this.valueCol],e,i,o)})),c=f}t.sort((function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y})),c=t[0];for(var h=1;h<t.length;h++){var d=t[h];Math.abs(c.x+e-d.x)<=u&&Math.abs(c.y-d.y)<=u?s.push({x:c.x+e,y:c.y,or:"v",value:this.value(c[this.valueCol],d[this.valueCol],e,i,o)}):(s.push({x:c.x+e,y:c.y,or:"v",value:this.value(c[this.valueCol],void 0,e,i,o)}),s.push({x:d.x,y:d.y,or:"v",value:this.value(void 0,d[this.valueCol],e,i,o)})),c=d}if(0!=s.length){var p=a.getSideStatistics(s,!0);if(n.setCanvasTransform(),this.fillColor){var y,v=ch(t);try{for(v.s();!(y=v.n()).done;){var b=y.value,m=this.fillColor(b);m&&"none"!=m&&(n.ctx.fillStyle=m,n.ctx.fillRect(b.x,b.y,e,e))}}catch(t){v.e(t)}finally{v.f()}}n.ctx.lineCap="butt";for(var g=e/2,w=0,_=s;w<_.length;w++){var x=_[w],S=this.color?this.color(x,e,p,o):void 0;if(S&&"none"!=S){var O=this.width?this.width(x,e,p,o):void 0;!O||O<=0||(n.ctx.strokeStyle=S,n.ctx.lineWidth=O,n.ctx.beginPath(),90==this.orientation?(n.ctx.moveTo(x.x+g,x.y+g),"h"===x.or?n.ctx.lineTo(x.x+g,x.y-g):n.ctx.lineTo(x.x-g,x.y+g)):(n.ctx.moveTo(x.x,x.y),n.ctx.lineTo(x.x+("h"===x.or?e:0),x.y+("v"===x.or?e:0))),n.ctx.stroke())}}this.updateLegends({style:this,r:e,zf:o})}}}],r=[{key:"getSideStatistics",value:function(t,e){if(t&&0!=t.length){var n,r=1/0,i=-1/0,o=ch(t);try{for(o.s();!(n=o.n()).done;){var s=n.value.value;e&&!s||(s<r&&(r=s),s>i&&(i=s))}}catch(t){o.e(t)}finally{o.f()}return{min:r,max:i}}}}],n&&fh(e.prototype,n),r&&fh(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(Jl);function yh(t){return yh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yh(t)}function vh(t,e){return vh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vh(t,e)}function bh(t){return bh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bh(t)}var mh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vh(t,e)}(o,t);var e,n,r,i=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=bh(n);if(r){var i=bh(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===yh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function o(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),e=i.call(this,t),(t=t||{}).breaks=t.breaks||[100,1e3,1e4,1e5,1e6],t.width=t.width||function(){return 1},t.color=t.color||function(){return"#E7A935"};var n=function(e){if(null==e)return 0;for(var n=0;n<t.breaks.length;n++)if(e<t.breaks[n])return n;return t.breaks.length};return e.value=function(t,e,r,i,o){return Math.abs(n(e)-n(t))},e.color=function(e,n,r,i){return e.value?t.color(e,n,i):void 0},e.width=function(e,n,r,i){return e.value*i*t.width(e,n,i)},e}return e=o,Object.defineProperty(e,"prototype",{writable:!1}),e}(ph);function gh(t){return gh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gh(t)}function wh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==gh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==gh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===gh(i)?i:String(i)),r)}var i}function xh(t,e){return xh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},xh(t,e)}function Sh(t){return Sh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sh(t)}var Oh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&xh(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Sh(r);if(i){var n=Sh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===gh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.col=t.col,e.color=t.color,e.width=t.width||function(t,e,n){return.2*e},e.fillColor=t.fillColor,e}return e=s,n=[{key:"draw",value:function(t,e,n){if(this.filter&&(t=t.filter(this.filter)),t&&0!=t.length){var r=n.getZf(),i=[];t.sort((function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x}));for(var o=t[0],s=o[this.col],a=1;a<t.length;a++){var u=t[a],c=u[this.col];o.y+e==u.y&&o.x==u.x?s!=c&&i.push({x:o.x,y:u.y,or:"h",v1:s,v2:c}):(i.push({x:o.x,y:o.y+e,or:"h",v1:s,v2:void 0}),i.push({x:u.x,y:u.y,or:"h",v1:void 0,v2:c})),o=u,s=c}t.sort((function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y})),s=(o=t[0])[this.col];for(var l=1;l<t.length;l++){var f=t[l],h=f[this.col];o.x+e==f.x&&o.y==f.y?s!=h&&i.push({x:o.x+e,y:o.y,or:"v",v1:s,v2:h}):(i.push({x:o.x+e,y:o.y,or:"v",v1:s,v2:void 0}),i.push({x:f.x,y:f.y,or:"v",v1:void 0,v2:h})),o=f,s=h}if(0!=i.length){if(n.setCanvasTransform(),this.fillColor){var d,p=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(p.s();!(d=p.n()).done;){var y=d.value,v=this.fillColor(y);v&&"none"!=v&&(n.ctx.fillStyle=v,n.ctx.fillRect(y.x,y.y,e,e))}}catch(t){p.e(t)}finally{p.f()}}n.ctx.lineCap="butt";for(var b=0,m=i;b<m.length;b++){var g=m[b],w=this.width?this.width(g,e,r):void 0;if(w&&!(w<=0)){var _=.5*w;n.ctx.lineWidth=w,"h"===g.or?(g.v2&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[g.v2],n.ctx.moveTo(g.x,g.y+_),n.ctx.lineTo(g.x+e,g.y+_),n.ctx.stroke()),g.v1&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[g.v1],n.ctx.moveTo(g.x,g.y-_),n.ctx.lineTo(g.x+e,g.y-_),n.ctx.stroke())):(g.v2&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[g.v2],n.ctx.moveTo(g.x+_,g.y),n.ctx.lineTo(g.x+_,g.y+e),n.ctx.stroke()),g.v1&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[g.v1],n.ctx.moveTo(g.x-_,g.y),n.ctx.lineTo(g.x-_,g.y+e),n.ctx.stroke()))}}this.updateLegends({style:this,r:e,zf:r})}}}}],n&&_h(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);const Ih=function t(e){function n(t,n){var r,i;return t=null==t?0:+t,n=null==n?1:+n,function(){var o;if(null!=r)o=r,r=null;else do{r=2*e()-1,o=2*e()-1,i=r*r+o*o}while(!i||i>1);return t+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(Math.random);function Th(t,e,n){var r=document.createElement("canvas");r.setAttribute("width",t),r.setAttribute("height",e);var i=r.getContext("webgl",n);if(!i)throw new Error("Unable to initialize WebGL. Your browser or machine may not support it.");return{canvas:r,gl:i}}function Ah(t){var e=t.createProgram();if(null==e)throw new Error("Cannot create webGL program");for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=0,s=r;o<s.length;o++){var a=s[o];t.attachShader(e,a)}if(t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS))return e;throw new Error(t.getProgramInfoLog(e)||"Cannot create webGL program (2)")}function Mh(t,e){var n=t.createShader(e);if(null==n)throw new Error("Cannot create webGL shader");for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];if(t.shaderSource(n,i.join("\n")),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS))return n;throw new Error(t.getShaderInfoLog(n)||"Cannot create webGL shader (2)")}function Eh(t){return Eh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eh(t)}function Ch(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Eh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Eh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Eh(i)?i:String(i)),r)}var i}var Ph=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e,this.sizePix=n||10,this.program=Ah(e,Mh(e,e.VERTEX_SHADER,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vColor = color;\n }\n "),Mh(e,e.FRAGMENT_SHADER,"\n precision mediump float;\n varying vec4 vColor;\n void main(void) {\n vec4 vColor_ = vColor / 255.0;\n vColor_[3] = 255.0 * vColor_[3];\n gl_FragColor = vColor_;\n }")),e.useProgram(this.program),this.verticesBuffer=[],this.colorsBuffer=[]}var e,n;return e=t,(n=[{key:"addPointData",value:function(t,e,n){var r=je(n);r&&(this.verticesBuffer.push(t,e),this.colorsBuffer.push(r.r,r.g,r.b,r.opacity))}},{key:"addPointData2",value:function(t,e,n,r,i,o){this.verticesBuffer.push(t,e),this.colorsBuffer.push(n,r,i,o)}},{key:"draw",value:function(t){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,e.createBuffer()),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.verticesBuffer),e.STATIC_DRAW);var n=e.getAttribLocation(this.program,"pos");e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,e.createBuffer()),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.colorsBuffer),e.STATIC_DRAW);var r=e.getAttribLocation(this.program,"color");e.vertexAttribPointer(r,4,e.FLOAT,!1,0,0),e.enableVertexAttribArray(r),e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*this.sizePix),e.uniformMatrix3fv(e.getUniformLocation(this.program,"mat"),!1,new Float32Array(t)),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.POINTS,0,this.verticesBuffer.length/2)}}])&&Ch(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function jh(t){return jh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jh(t)}function kh(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Bh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Bh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Fh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==jh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==jh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===jh(i)?i:String(i)),r)}var i}function Lh(t,e){return Lh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lh(t,e)}function Dh(t){return Dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Dh(t)}var Nh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lh(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Dh(r);if(i){var n=Dh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===jh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.nbCol=t.nbCol,e.nb=t.nb||function(t,e,n,r){return.3*e*e/(r*r)*t/n.max},e.color=t.color||function(){return"#FF5733"},e.dotSize=t.dotSize,e.sigma=t.sigma,e}return e=s,n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o=n.getZf();if(this.nbCol&&(i=Jl.getStatistics(t,(function(t){return t[r.nbCol]}),!0)),i){var s=this.dotSize?this.dotSize(e,o):2*o,a=this.sigma?this.sigma(e,o):.4*e,u=Ih(0,a);if(function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}()){var c=Th(n.w+"",n.h+"");if(!c)return void console.error("No webGL");var l,f,h,d,p,y,v,b=new Ph(c.gl,s/o),m=e/2,g=kh(t);try{for(g.s();!(v=g.n()).done;){var w=v.value;if((l=this.color(w))&&"none"!==l){if(f=this.offset(w,e,o),h=this.nb(w[this.nbCol],e,i,o),d=w.x+f.dx+m,p=w.y+f.dy+m,!(y=je(l)))return;for(var _=0;_<=h;_++)b.addPointData2(d+u(),p+u(),y.r,y.g,y.b,y.opacity)}}}catch(t){g.e(t)}finally{g.f()}b.draw(n.getWebGLTransform()),n.initCanvasTransform(),n.ctx.drawImage(c.canvas,0,0)}else{n.setCanvasTransform();var x,S=kh(t);try{for(S.s();!(x=S.n()).done;){var O=x.value,I=this.color(O);if(I&&"none"!==I){n.ctx.fillStyle=I;for(var T=this.offset(O,e,o),A=this.nb(O[this.nbCol],e,i,o),M=O.x+T.dx+e/2,E=O.y+T.dy+e/2,C=0;C<=A;C++)n.ctx.fillRect(M+u(),E+u(),s,s)}}}catch(t){S.e(t)}finally{S.f()}}this.updateLegends({style:this,r:e,zf:o})}}}],n&&Fh(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function Rh(t){return Rh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rh(t)}function zh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Rh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Rh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Rh(i)?i:String(i)),r)}var i}var Uh=function(){function t(e,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e;var s=Mh(e,e.VERTEX_SHADER,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n\n attribute float t;\n varying float vt;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vt = t;\n }\n "),a="precision mediump float;\nvarying float vt;\nuniform float alpha;\n"+function(){for(var t=[],e=0;e<n.length;e++)t.push("uniform vec4 c"+e+";\n");return t.join("")}()+"void main(void) {\n";if(r?"pow"==r.fun?a+=" float t = pow(vt, alpha);\n":"powRev"==r.fun?a+=" float t = 1.0-pow(1.0-vt, 1.0/alpha);\n":"exp"==r.fun?a+=0==r.alpha?"float t = vt;":" float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);\n":"expRev"==r.fun?a+=0==r.alpha?"float t = vt;":" float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);\n":"circleLow"==r.fun?0==r.alpha?a+=" float t = vt;\n":1==r.alpha?a+=" float t = sqrt(vt * (2.0 - vt));\n":a+=" float a = alpha / (1.0 - alpha);\n float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;\n":"circleHigh"==r.fun?0==r.alpha?a+=" float t = vt;\n":1==r.alpha?a+=" float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));\n":a+=" float a = alpha / (1.0 - alpha);\n float t = 1.0 - sqrt(1.0 / (a * a) + (1.0-vt) * ( 2.0/a + 1.0 + vt )) + 1.0 / a;\n":(console.error("Unexpected stretching function code: "+r.fun),a+=" float t = vt;\n"):a+=" float t = vt;\n",1==n.length)a+=" vec4 cI=c0;\n vec4 cF=c0;\n";else if(2==n.length)a+=" vec4 cI=c0;\n vec4 cF=c1;\n";else{var u=n.length-1,c=u+".0";a+=" vec4 cI;\n",a+=" vec4 cF;\n",a+=" if(t<1.0/"+c+") { cI=c0; cF=c1; t=t*"+c+"; }\n";for(var l=2;l<u;l++)a+=" else if(t<"+l+".0/"+c+") { cI=c"+(l-1)+"; cF=c"+l+"; t="+c+"*t-"+(l-1)+".0; }\n";a+=" else { cI=c"+(u-1)+"; cF=c"+u+"; t="+c+"*t-"+(u-1)+".0; }\n"}1==n.length?a+=" gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}\n":a+=" gl_FragColor = mix(cI, cF, t);}\n";var f=Mh(e,e.FRAGMENT_SHADER,a);this.program=Ah(e,s,f),e.useProgram(this.program),e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*i),e.uniform1f(e.getUniformLocation(this.program,"alpha"),r?1*r.alpha:0);for(var h=0;h<n.length;h++){var d=je(n[h]),p=d.opacity;1==d.opacity&&null!=o&&(p=o),e.uniform4fv(e.getUniformLocation(this.program,"c"+h),[+d.r/255,+d.g/255,+d.b/255,+p])}}var e,n;return e=t,(n=[{key:"draw",value:function(t,e,n){var r=this.gl,i=this.program;r.bindBuffer(r.ARRAY_BUFFER,r.createBuffer()),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t),r.STATIC_DRAW);var o=r.getAttribLocation(i,"pos");r.vertexAttribPointer(o,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(o),r.bindBuffer(r.ARRAY_BUFFER,r.createBuffer()),r.bufferData(r.ARRAY_BUFFER,new Float32Array(e),r.STATIC_DRAW);var s=r.getAttribLocation(i,"t");r.vertexAttribPointer(s,1,r.FLOAT,!1,0,0),r.enableVertexAttribArray(s),r.uniformMatrix3fv(r.getUniformLocation(i,"mat"),!1,new Float32Array(n)),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.POINTS,0,t.length/2)}}])&&zh(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Vh(t){return Vh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vh(t)}function Wh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function $h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Vh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Vh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Vh(i)?i:String(i)),r)}var i}function Gh(t,e){return Gh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gh(t,e)}function Yh(t){return Yh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yh(t)}var Zh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gh(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Yh(r);if(i){var n=Yh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Vh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.tFun=t.tFun||function(t,e,n){return t/n.max},e.stretching=t.stretching,e.colors=t.colors||["rgb(158, 1, 66)","rgb(248, 142, 83)","rgb(251, 248, 176)","rgb(137, 207, 165)","rgb(94, 79, 162)"].reverse(),t.color&&(e.colors=[t.color(0),t.color(.2),t.color(.4),t.color(.6),t.color(.8),t.color(1)]),e.opacity=t.opacity,e.size=t.size,e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i=n.getZf(),o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0);if(o){var s=Th(n.w+"",n.h+"",null!=this.opacity?{premultipliedAlpha:!1}:void 0);if(s){var a,u=e/2,c=[],l=[],f=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Wh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(f.s();!(a=f.n()).done;){var h=a.value,d=this.tFun(h[this.colorCol],e,o);null!=d&&null!=d&&(c.push(h.x+u,h.y+u),l.push(d>1?1:d<0?0:d))}}catch(t){f.e(t)}finally{f.f()}var p=this.size?this.size(e,i):e+.2*i,y=this.opacity?this.opacity(e,i):void 0;new Uh(s.gl,this.colors,this.stretching,p/i,y).draw(c,l,n.getWebGLTransform()),n.initCanvasTransform(),n.ctx.drawImage(s.canvas,0,0),this.updateLegends({style:this,r:e,zf:i,sColor:o})}else console.error("No webGL")}}}])&&$h(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function Hh(t){return Hh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hh(t)}function qh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Hh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Hh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Hh(i)?i:String(i)),r)}var i}var Xh=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n;return e=t,n=[{key:"get",value:function(t,e){if(null!=(e=e||{}).nb){e.nb<2&&(console.error("unexpected number of colors in tanaka (<2): "+e.nb),e.nb=2),e.color||(console.error("color function not defined in tanaka"),e.color=function(){return"gray"}),e.colors=[];for(var n=0;n<e.nb;n++)e.colors.push(e.color(n/(e.nb-1)))}e.colors=e.colors||["#a9bb9e","#c9dcaa","#fde89f","#f9a579","#eb444b"];var r=e.colors.length;e.tFun=e.tFun||function(t,e,n){return(t-n.min)/(n.max-n.min)},e.colDark=e.colDark||"#111",e.colBright=e.colBright||"#ddd",e.widthFactor=e.widthFactor||.08,e.newShading=e.newShading,e.newShadingWidthPix=e.newShadingWidthPix||2,e.newShadingTr=e.newShadingTr||function(t,e){return Math.abs(t)/Math.max(Math.abs(e.min),Math.abs(e.max))};var i=function(t){if(isNaN(t)||null==t)return console.error("Unexpected t value 1: "+t),-9;for(var e=0;e<r;e++)if(t<=(e+1)/r)return e;return console.error("Unexpected t value 2: "+t),-9},o=new Zh({colorCol:t,colors:e.colors,tFun:function(t,n,o){var s=e.tFun(t,n,o);return i(s)/(r-1)},size:function(t,e){return t+.5*e},filter:e.filter}),s=new ph({valueCol:t,value:function(t,n,r,o,s){if(void 0===t&&void 0===n)return 0;if(void 0===n){var a=e.tFun(t,r,o);if(null==a||isNaN(a))throw new Error("Unexpected value: "+t+" - "+a);return i(a)+1}if(void 0===t){var u=e.tFun(n,r,o);if(null==u||isNaN(u))throw new Error("Unexpected value: "+n+" - "+u);return-i(u)-1}var c=e.tFun(t,r,o);if(null==c||isNaN(c))throw new Error("Unexpected value: "+t+" - "+c);var l=e.tFun(n,r,o);if(null==l||isNaN(l))throw new Error("Unexpected value: "+n+" - "+l);var f=i(c);return-i(l)+f},color:e.newShading?function(t,n,r,i){var o=e.newShadingTr(t.value,r);return t.value>0&&"h"===t.or||t.value<0&&"v"===t.or?"rgba(255,255,100,"+o+")":"rgba(0,0,0,"+o+")"}:function(t,n,r,i){if(0!==t.value)return"v"===t.or?t.value<0?e.colBright:e.colDark:t.value<0?e.colDark:e.colBright},width:e.newShading?function(t,n,r,i){return e.newShadingWidthPix*i}:function(t,n,r,i){return e.widthFactor*n*Math.abs(t.value)*("v"===t.or?.5:1)},filter:e.filter});return[o,s]}}],null&&qh(e.prototype,null),n&&qh(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Kh(t){return Kh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kh(t)}function Jh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Kh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Kh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Kh(i)?i:String(i)),r)}var i}var Qh=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.colors=e,this.vshString="\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n\n attribute float i;\n varying float vi;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vi = i;\n }\n ";var n=[];n.push("precision mediump float;\nvarying float vi;\n"),n.push("uniform vec4");for(var r=0;r<e.length;r++)r>0&&n.push(","),n.push(" c"+r);n.push(";\n"),n.push("void main(void) {\n");for(var i=0;i<e.length;i++)i>0&&n.push("else "),n.push("if(vi=="),n.push(i),n.push(".0) gl_FragColor = vec4(c"),n.push(i),n.push("[0], c"),n.push(i),n.push("[1], c"),n.push(i),n.push("[2], c"),n.push(i),n.push("[3]);\n");n.push("else gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n}"),this.fshString=n.join("")}var e,n;return e=t,n=[{key:"draw",value:function(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:10,o=Ah(t,Mh(t,t.VERTEX_SHADER,this.vshString),Mh(t,t.FRAGMENT_SHADER,this.fshString));t.useProgram(o),t.uniform1f(t.getUniformLocation(o,"sizePix"),1*i);for(var s=0;s<this.colors.length;s++){var a=je(this.colors[s]);t.uniform4fv(t.getUniformLocation(o,"c"+s),[+a.r/255,+a.g/255,+a.b/255,+a.opacity])}t.bindBuffer(t.ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW);var u=t.getAttribLocation(o,"pos");t.vertexAttribPointer(u,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(u),t.bindBuffer(t.ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ARRAY_BUFFER,new Float32Array(n),t.STATIC_DRAW);var c=t.getAttribLocation(o,"i");t.vertexAttribPointer(c,1,t.FLOAT,!1,0,0),t.enableVertexAttribArray(c),t.uniformMatrix3fv(t.getUniformLocation(o,"mat"),!1,new Float32Array(r)),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.POINTS,0,e.length/2)}}],n&&Jh(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function td(t){return td="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},td(t)}function ed(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==td(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==td(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===td(i)?i:String(i)),r)}var i}function nd(t,e){return nd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nd(t,e)}function rd(t){return rd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rd(t)}var id=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nd(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=rd(r);if(i){var n=rd(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===td(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,t.color=t.color||void 0;var n=Object.keys(t.color);e.catToI={};for(var r=0;r<n.length;r++)e.catToI[n[r]]=r+"";e.colors=[];for(var i=0;i<n.length;i++)e.colors.push(t.color[""+n[i]]);return e.size=t.size,e.wgp=new Qh(e.colors),e}return e=s,(n=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));for(var r,i=n.getZf(),o=e/2,s=t.length,a=[],u=[],c=0;c<s;c++){var l=(r=t[c])[this.colorCol];if(null!=l){var f=this.catToI[l];isNaN(+f)?console.log("Unexpected category index: "+l+" "+f):(a.push(r.x+o,r.y+o),u.push(+f))}else console.log("Unexpected category: "+l)}var h=Th(n.w+"",n.h+"");if(h){var d=this.size?this.size(e,i):e+.2*i;this.wgp.draw(h.gl,a,u,n.getWebGLTransform(),d/i),n.initCanvasTransform(),n.ctx.drawImage(h.canvas,0,0),this.updateLegends({style:this,r:e,zf:i})}else console.error("No webGL")}}])&&ed(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function od(t){return od="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},od(t)}function sd(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ad(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ad(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function ad(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ud(t,e){return ud=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ud(t,e)}function cd(t){return cd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cd(t)}function ld(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==od(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==od(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===od(i)?i:String(i)),r)}var i}function hd(t,e,n){return e&&fd(t.prototype,e),n&&fd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var dd=function(){function t(){ld(this,t)}return hd(t,null,[{key:"get",value:function(t,e){(e=e||{}).colors=e.colors||["#00852b","#afd246","#fac80a","#bb805a","#d67923","#cb4e29","#b40000","#720012"],e.colDark=e.colDark||"#333",e.colBright=e.colBright||"#aaa",e.widthFactor=e.widthFactor||.12;var n=Xh.get(t,e),r=new ff({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n,r){return.2*r},filter:e.filter});return[n[0],r,n[1],new pd({colDark:e.colDark,colBright:e.colBright,filter:e.filter})]}},{key:"getCat",value:function(t,e){return(e=e||{}).colDark=e.colDark||"#333",e.colBright=e.colBright||"#aaa",[new id({colorCol:t,color:e.color}),new ff({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n,r){return.2*r}}),new pd({colDark:e.colDark,colBright:e.colBright})]}}]),t}(),pd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ud(t,e)}(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=cd(e);if(n){var i=cd(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return function(t,e){if(e&&("object"===od(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function i(t){var e;return ld(this,i),e=r.call(this,t),t=t||{},e.colDark=t.colDark||"#333",e.colBright=t.colBright||"#aaa",e}return hd(i,[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter)),n.ctx.lineWidth=.6*n.getZf(),n.ctx.strokeStyle=this.colDark;var r,i=sd(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;n.ctx.beginPath(),n.ctx.arc(o.x+.5*e,o.y+.5*e,.55*e*.5,Math.PI/4,-Math.PI*(3/4),!0),n.ctx.stroke()}}catch(t){i.e(t)}finally{i.f()}n.ctx.strokeStyle=this.colBright;var s,a=sd(t);try{for(a.s();!(s=a.n()).done;){var u=s.value;n.ctx.beginPath(),n.ctx.arc(u.x+.5*e,u.y+.5*e,.55*e*.5,Math.PI/4,-Math.PI*(3/4),!1),n.ctx.stroke()}}catch(t){a.e(t)}finally{a.f()}}}]),i}(Jl);function yd(t){return yd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yd(t)}function vd(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function bd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==yd(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==yd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===yd(i)?i:String(i)),r)}var i}function md(t,e){return md=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},md(t,e)}function gd(t){return gd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gd(t)}var wd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&md(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=gd(r);if(i){var n=gd(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===yd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.mosaicFactor=t.mosaicFactor||.15,e.shadowFactor=t.shadowFactor||.2,e.shadowColor=t.shadowColor||"#555",e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o=n.getZf();this.colorCol&&(i=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),n.ctx.strokeStyle=this.shadowColor,n.ctx.lineWidth=this.shadowFactor*e,n.ctx.lineJoin="round",n.ctx.lineCap="butt";var s=e*this.mosaicFactor,a=function(){return{x:Math.random()*s,y:Math.random()*s}};n.setCanvasTransform();var u,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return vd(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vd(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(c.s();!(u=c.n()).done;){var l=u.value,f=this.color?this.color(l[this.colorCol],e,i):void 0;if(f&&"none"!==f){n.ctx.fillStyle=f;var h=this.offset(l,e,o),d=a(),p=a(),y=a(),v=a();this.shadowFactor>0&&(n.ctx.beginPath(),n.ctx.moveTo(l.x+h.dx+d.x,l.y+h.dy+d.y),n.ctx.lineTo(l.x+h.dx+e-y.x,l.y+h.dy+y.y),n.ctx.lineTo(l.x+h.dx+e-v.x,l.y+h.dy+e-v.y),n.ctx.stroke()),n.ctx.beginPath(),n.ctx.moveTo(l.x+h.dx+d.x,l.y+h.dy+d.y),n.ctx.lineTo(l.x+h.dx+e-y.x,l.y+h.dy+y.y),n.ctx.lineTo(l.x+h.dx+e-v.x,l.y+h.dy+e-v.y),n.ctx.lineTo(l.x+h.dx+p.x,l.y+h.dy+e-p.y),n.ctx.fill()}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:o,sColor:i})}}])&&bd(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function _d(t){return _d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_d(t)}function xd(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Sd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==_d(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==_d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===_d(i)?i:String(i)),r)}var i}function Od(t,e){return Od=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Od(t,e)}function Id(t){return Id=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Id(t)}var Td=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Od(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Id(r);if(i){var n=Id(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===_d(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.sizeCol=t.sizeCol,e.size=t.size,e.shape=t.shape||function(){return"o"},e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s=n.getZf();this.sizeCol&&(t.sort((function(t,e){return e[r.sizeCol]-t[r.sizeCol]})),i=Jl.getStatistics(t,(function(t){return t[r.sizeCol]}),!0)),this.colorCol&&(o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),n.setCanvasTransform();var a,u=.5*e,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return xd(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xd(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(c.s();!(a=c.n()).done;){var l=a.value,f=this.color?this.color(l[this.colorCol],e,o,s):void 0;if(f&&"none"!==f){n.ctx.fillStyle=f;var h=this.shape?this.shape(l):"o";if("none"!==h){var d=(this.size||function(){return.5})(l[this.sizeCol],e,i,s)*u,p=(this.offset(l,e,s),l.x+u),y=l.y+u;if("p"===h)n.ctx.beginPath(),n.ctx.moveTo(p,y+u),n.ctx.lineTo(p+d,y+d),n.ctx.lineTo(p+u,y),n.ctx.lineTo(p+d,y-d),n.ctx.lineTo(p,y-u),n.ctx.lineTo(p-d,y-d),n.ctx.lineTo(p-u,y),n.ctx.lineTo(p-d,y+d),n.ctx.fill();else{if("o"!==h)throw new Error("Unexpected shape:"+h);n.ctx.beginPath(),n.ctx.moveTo(p,y+d),n.ctx.lineTo(p+u,y+u),n.ctx.lineTo(p+d,y),n.ctx.lineTo(p+u,y-u),n.ctx.lineTo(p,y-d),n.ctx.lineTo(p-u,y-u),n.ctx.lineTo(p-d,y),n.ctx.lineTo(p-u,y+u),n.ctx.fill()}}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:s,sSize:i,sColor:o})}}])&&Sd(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function Ad(t){return Ad="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ad(t)}function Md(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Ad(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Ad(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Ad(i)?i:String(i)),r)}var i}var Ed=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.id=e.id,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.background=e.background||"none",this.padding=e.padding||"5px",this.border=e.border||"0px",this["border-radius"]=e["border-radius"]||"none",this["box-shadow"]=e["box-shadow"]||"none",this["font-family"]=e["font-family"]||"Helvetica, Arial, sans-serif",this.width=e.width,this.height=e.height,this.id&&(this.div=pt("#"+this.id)),this.div&&!this.div.empty()||(this.div=pt(document.createElement("div")),this.id&&this.div.attr("id",this.id)),this.div.style("background",this.background),this.div.style("padding",this.padding),this.div.style("border",this.border),this.div.style("border-radius",this["border-radius"]),this.div.style("box-shadow",this["box-shadow"]),this.div.style("font-family",this["font-family"]),this.width&&this.div.style("width",this.width),this.height&&this.div.style("height",this.height)}var e,n;return e=t,(n=[{key:"style",value:function(t,e){return this.div.style(t,e),this}},{key:"update",value:function(t){console.error("Legend update not implemented yet.")}}])&&Md(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Cd(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}var Pd,jd=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kd(t){if(!(e=jd.exec(t)))throw new Error("invalid format: "+t);var e;return new Bd({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Bd(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Fd(t,e){var n=Cd(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}kd.prototype=Bd.prototype,Bd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Ld={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Fd(100*t,e),r:Fd,s:function(t,e){var n=Cd(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Pd=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Cd(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Dd(t){return t}var Nd,Rd,zd=Array.prototype.map,Ud=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Vd(t){return Nd=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Dd:(e=zd.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],s=0,a=e[0],u=0;i>0&&a>0&&(u+a+1>r&&(a=Math.max(1,r-u)),o.push(t.substring(i-=a,i+a)),!((u+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",s=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?Dd:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(zd.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=kd(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,y=t.comma,v=t.precision,b=t.trim,m=t.type;"n"===m?(y=!0,m="g"):Ld[m]||(void 0===v&&(v=12),b=!0,m="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var g="$"===h?i:"#"===h&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===h?o:/[%p]/.test(m)?u:"",_=Ld[m],x=/[defgprs%]/.test(m);function S(t){var i,o,u,h=g,S=w;if("c"===m)S=_(t)+S,t="";else{var O=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:_(Math.abs(t),v),b&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),O&&0==+t&&"+"!==f&&(O=!1),h=(O?"("===f?f:c:"-"===f||"("===f?"":f)+h,S=("s"===m?Ud[8+Pd/3]:"")+S+(O&&"("===f?")":""),x)for(i=-1,o=t.length;++i<o;)if(48>(u=t.charCodeAt(i))||u>57){S=(46===u?s+t.slice(i+1):t.slice(i))+S,t=t.slice(0,i);break}}y&&!d&&(t=r(t,1/0));var I=h.length+t.length+S.length,T=I<p?new Array(p-I+1).join(e):"";switch(y&&d&&(t=r(T+t,T.length?p-S.length:1/0),T=""),n){case"<":t=h+t+S+T;break;case"=":t=h+T+t+S;break;case"^":t=T.slice(0,I=T.length>>1)+h+t+S+T.slice(I);break;default:t=T+h+t+S}return a(t)}return v=void 0===v?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),S.toString=function(){return t+""},S}return{format:f,formatPrefix:function(t,e){var n,r=f(((t=kd(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Cd(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),s=Ud[8+i/3];return function(t){return r(o*t)+s}}}}(t),Rd=Nd.format,Nd.formatPrefix,Nd}function Wd(t){return Wd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wd(t)}function $d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Wd(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Wd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Wd(i)?i:String(i)),r)}var i}function Gd(t,e){return Gd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gd(t,e)}function Yd(t){return Yd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yd(t)}Vd({thousands:",",grouping:[3],currency:["$",""]});var Zd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gd(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Yd(r);if(i){var n=Yd(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Wd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorRamp=t.colorRamp,e.fun=t.fun,e.title=t.title,e.tickSize=t.tickSize||6,e.width=t.width||300,e.height=t.height||15,e.margin=t.margin||5,e.ticks=t.ticks||Math.floor(e.width/50),e.tickFormat=t.tickFormat||",.0f",e.tickUnit=t.tickUnit,e.fontSize=t.fontSize||"0.8em",e.invert=t.invert,e}return e=s,n=[{key:"update",value:function(t){if(t.sColor){this.div.selectAll("*").remove();var e=this.width+2*this.margin,n=this.height+3*this.margin+12+this.tickSize+10,r=this.div.append("svg").attr("width",e).attr("height",n);r.append("text").attr("x",this.margin).attr("y",this.margin).style("font-size","0.8em").style("font-weight","bold").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(this.title);for(var i=r.append("g").attr("transform","translate("+this.margin+" "+(2*this.margin+12)+")"),o=this.width,s=this.height,a=0;a<o;a+=5){var u=a/(o-1);this.invert&&(u=1-u),i.append("rect").attr("x",a).attr("y",0).attr("width",5).attr("height",s).style("fill",this.colorRamp(u))}for(var c=0;c<this.ticks;c++){var l=c/(this.ticks-1);i.append("line").attr("x1",o*l).attr("y1",0).attr("x2",o*l).attr("y2",s+this.tickSize).style("stroke","black"),i.append("text").attr("id","ticklabel_"+c).attr("x",o*l).attr("y",s+this.tickSize+2).style("font-size",this.fontSize).style("text-anchor",0==c?"start":c==this.ticks-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none")}for(var f=this.tickFormat&&"text"!=this.tickFormat?Rd(this.tickFormat):function(t){return t},h=0;h<this.ticks;h++){var d=h/(this.ticks-1),p=this.fun(d,t.r,t.sColor),y=(p?f(p):"0")+(this.tickUnit?this.tickUnit:"");this.div.select("#ticklabel_"+h).text(y)}}}}],n&&$d(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function Hd(t){return Hd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hd(t)}function qd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Hd(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Hd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Hd(i)?i:String(i)),r)}var i}function Xd(t,e){return Xd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xd(t,e)}function Kd(t){return Kd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kd(t)}var Jd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xd(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Kd(r);if(i){var n=Kd(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Hd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colors=t.colors,e.breaksText=t.breaksText,e.width=t.width||300,e.height=t.height||15,e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.tickSize=t.tickSize||3,e.labelFontSize=t.labelFontSize||"0.8em",e.invert=t.invert,e}return e=s,(n=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.title&&this.div.append("div").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).style("margin-bottom","7px").text(this.title);var e=this.colors.length;if(0!=e){for(var n=this.width/e,r=this.div.append("svg").attr("width",this.width).attr("height",this.height+this.tickSize+2+10),i=0;i<e;i++)r.append("rect").attr("x",i*n).attr("y",0).attr("width",n).attr("height",this.height).style("fill",this.colors[i]);for(var o=1;o<e;o++)r.append("line").attr("x1",n*o).attr("y1",0).attr("x2",n*o).attr("y2",this.height+this.tickSize).style("stroke","black");for(var s=1;s<e;s++)r.append("text").attr("id","ticklabel_"+s).attr("x",n*s).attr("y",this.height+this.tickSize+2).style("font-size",this.labelFontSize).style("text-anchor",0==s?"start":s==this.ticks-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(this.breaksText[s-1])}}}])&&qd(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function Qd(t){return Qd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qd(t)}function tp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Qd(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Qd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Qd(i)?i:String(i)),r)}var i}function ep(t,e){return ep=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ep(t,e)}function np(t){return np=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},np(t)}var rp=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ep(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=np(r);if(i){var n=np(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Qd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colCat=t.colCat||[["gray","-"]],e.shape=t.shape||"circle",e.dimension=t.dimension||{r:8},e.strokeColor=t.strokeColor||"gray",e.strokeWidth=t.strokeWidth||1,e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.labelFontSize=t.labelFontSize||"0.8em",e}return e=s,n=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.title&&this.div.append("div").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).style("margin-bottom","7px").text(this.title);var e=this.colCat.length;if(0!=e)for(var n=0;n<e;n++){var r=this.colCat[n],i=this.div.append("div"),o=this.strokeWidth;if("square"===this.shape){var s=this.dimension.h||15,a=this.dimension.w||20;i.append("div").style("display","inline").append("svg").attr("width",a+2*o).attr("height",s+2*o).append("rect").attr("x",o).attr("y",o).attr("width",a).attr("height",s).style("fill",r[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}else{if("circle"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var u=this.dimension.r||8,c=2*u+2*o;i.append("div").style("display","inline").append("svg").attr("width",c).attr("height",c).append("circle").attr("cx",u+o).attr("cy",u+o).attr("r",u).style("fill",r[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}i.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(r[1])}}}],n&&tp(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function ip(t){return ip="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ip(t)}function op(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==ip(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==ip(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===ip(i)?i:String(i)),r)}var i}function sp(t,e){return sp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sp(t,e)}function ap(t){return ap=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ap(t)}var up=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&sp(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=ap(r);if(i){var n=ap(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===ip(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.exaggerationFactor=t.exaggerationFactor||.8,e.value=t.value||void 0,e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.shape=t.shape||"circle",e.fillColor=t.fillColor||"none",e.strokeColor=t.strokeColor||"gray",e.strokeWidth=t.strokeWidth||1,e.labelFontSize=t.labelFontSize||"0.8em",e.labelUnitText=t.labelUnitText||"",e.labelFormat=t.labelFormat||",.2r",e}return e=s,(n=[{key:"update",value:function(t){if(t.sSize){this.div.selectAll("*").remove();var e=this.value;if(null==e){var n=t.sSize.max*this.exaggerationFactor,r=Math.log10(n);r=Math.floor(r),8*(e=Math.pow(10,r))<=n?e*=8:6*e<=n?e*=6:5*e<=n?e*=5:4*e<=n?e*=4:2.5*e<=n?e*=2.5:2*e<=n&&(e*=2)}if(e){var i=this.div.append("div");this.title&&i.append("div").attr("class","title").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).text(this.title);var o=t.style.size(e,t.r,t.sSize,t.zf)/t.zf,s=i.append("svg").attr("width",o+this.strokeWidth+2).attr("height",o+this.strokeWidth+2).style("","inline-block");if("square"===this.shape)s.append("rect").attr("x",0).attr("y",0).attr("width",o).attr("height",o).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth);else if("circle"===this.shape){var a=.5*(o+this.strokeWidth);s.append("circle").attr("cx",a+1).attr("cy",a+1).attr("r",a).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}else if("donut"===this.shape);else if("diamond"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var u=Rd(this.labelFormat)(e);i.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(u+(this.labelUnitText?" ":"")+this.labelUnitText)}}}}])&&op(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function cp(t){return cp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cp(t)}function lp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==cp(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==cp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===cp(i)?i:String(i)),r)}var i}function fp(t,e){return fp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fp(t,e)}function hp(t){return hp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hp(t)}var dp=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fp(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=hp(r);if(i){var n=hp(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===cp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.exaggerationFactor=t.exaggerationFactor||.5,e.color=t.color||"gray",e.orientation=t.orientation||0,e.labelFontSize=t.labelFontSize||"0.8em",e.labelUnitText=t.labelUnitText||"",e}return e=s,(n=[{key:"update",value:function(t){if(t.sWidth){this.div.selectAll("*").remove();var e=this.div.append("div");this.title&&e.append("div").attr("class","title").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).text(this.title);var n=t.sWidth.max*this.exaggerationFactor,r=Math.log10(n);r=Math.floor(r);var i=Math.pow(10,r);8*i<=n?i*=8:6*i<=n?i*=6:5*i<=n?i*=5:4*i<=n?i*=4:2.5*i<=n?i*=2.5:2*i<=n&&(i*=2);var o=t.style.width(i,t.r,t.sWidth,t.zf)/t.zf,s=1*t.r/t.zf;e.append("svg").attr("width",s).attr("height",o).style("","inline-block").append("line").attr("x1",0).attr("y1",o/2).attr("x2",s).attr("y2",o/2).style("stroke",this.color).style("stroke-width",o);var a=Rd(",.2r")(i);e.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(a+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&lp(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function pp(t){return pp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pp(t)}function yp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==pp(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==pp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===pp(i)?i:String(i)),r)}var i}function vp(t,e){return vp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vp(t,e)}function bp(t){return bp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bp(t)}var mp=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vp(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=bp(r);if(i){var n=bp(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===pp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.exaggerationFactor=t.exaggerationFactor||.5,e.color=t.color||"gray",e.orientation=t.orientation||0,e.widthPix=t.widthPix||3,e.labelFontSize=t.labelFontSize||"0.8em",e.labelUnitText=t.labelUnitText||"",e}return e=s,n=[{key:"update",value:function(t){if(t.sWidth){this.div.selectAll("*").remove();var e=this.div.append("div");this.title&&e.append("div").attr("class","title").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).text(this.title);var n=this.widthPix,r=1*t.r/t.zf,i=Math.max(r,n),o=e.append("svg").attr("width",i).attr("height",i).style("","inline-block"),s=Math.cos(-this.orientation*Math.PI/180),a=Math.sin(-this.orientation*Math.PI/180),u=.5*i,c=.5*r;o.append("line").attr("x1",u-s*c).attr("y1",u-a*c).attr("x2",u+s*c).attr("y2",u+a*c).style("stroke",this.color).style("stroke-width",n),e.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(this.labelUnitText)}}}],n&&yp(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed),gp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return Math.pow(t,e)},wp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 1-Math.pow(1-t,1/e)},_p=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 0==e?t:(Math.exp(t*e)-1)/(Math.exp(e)-1)},xp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 0==e?t:1-1/e*Math.log(Math.exp(e)*(1-t)+t)},Sp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.8;if(0==e)return t;if(1==e)return Math.sqrt(t*(2-t));var n=e/(1-e);return Math.sqrt(1/(n*n)+t*(2/n+2-t))-1/n},Op=function(t){return 1-Sp(1-t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:.8)},Ip=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 0==e?t:1/e*Math.log(1-t+t*Math.exp(e))},Tp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return(Math.exp(-e*t)-1)/(Math.exp(-e)-1)},Ap=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return Math.pow(t,1/e)},Mp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 1-Math.pow(1-t,e)},Ep=1e-6,Cp=1e-12,Pp=Math.PI,jp=Pp/2,kp=Pp/4,Bp=2*Pp,Fp=180/Pp,Lp=Pp/180,Dp=Math.abs,Np=Math.atan,Rp=Math.atan2,zp=Math.cos,Up=(Math.ceil,Math.exp,Math.floor,Math.hypot,Math.log,Math.pow,Math.sin),Vp=Math.sign||function(t){return t>0?1:t<0?-1:0},Wp=Math.sqrt;function $p(t){return t>1?jp:t<-1?-jp:Math.asin(t)}function Gp(){}function Yp(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:Gp,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Zp(t,e){return Dp(t[0]-e[0])<Ep&&Dp(t[1]-e[1])<Ep}function Hp(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function qp(t,e,n,r,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],s=t[e];if(Zp(r,s)){if(!r[2]&&!s[2]){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}s[0]+=2*Ep}a.push(n=new Hp(r,t,null,!0)),u.push(n.o=new Hp(r,null,n,!1)),a.push(n=new Hp(s,t,null,!1)),u.push(n.o=new Hp(s,null,n,!0))}})),a.length){for(u.sort(e),Xp(a),Xp(u),o=0,s=u.length;o<s;++o)u[o].e=n=!n;for(var c,l,f=a[0];;){for(var h=f,d=!0;h.v;)if((h=h.n)===f)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,s=c.length;o<s;++o)i.point((l=c[o])[0],l[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(c=h.p.z,o=c.length-1;o>=0;--o)i.point((l=c[o])[0],l[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function Xp(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}Math.tan;class Kp{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],o=t+i,s=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);s&&(e[n++]=s),t=o}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}function Jp(t){return[Rp(t[1],t[0]),$p(t[2])]}function Qp(t){var e=t[0],n=t[1],r=zp(n);return[r*zp(e),r*Up(e),Up(n)]}function ty(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ey(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function ny(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ry(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function iy(t){var e=Wp(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function oy(t){return Dp(t[0])<=Pp?t[0]:Vp(t[0])*((Dp(t[0])+Pp)%Bp-Pp)}function sy(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function ay(t,e,n,r){return function(i){var o,s,a,u=e(i),c=Yp(),l=e(c),f=!1,h={point:d,lineStart:y,lineEnd:v,polygonStart:function(){h.point=b,h.lineStart=m,h.lineEnd=g,s=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=y,h.lineEnd=v,s=sy(s);var t=function(t,e){var n=oy(e),r=e[1],i=Up(r),o=[Up(n),-zp(n),0],s=0,a=0,u=new Kp;1===i?r=jp+Ep:-1===i&&(r=-jp-Ep);for(var c=0,l=t.length;c<l;++c)if(h=(f=t[c]).length)for(var f,h,d=f[h-1],p=oy(d),y=d[1]/2+kp,v=Up(y),b=zp(y),m=0;m<h;++m,p=w,v=x,b=S,d=g){var g=f[m],w=oy(g),_=g[1]/2+kp,x=Up(_),S=zp(_),O=w-p,I=O>=0?1:-1,T=I*O,A=T>Pp,M=v*x;if(u.add(Rp(M*I*Up(T),b*S+M*zp(T))),s+=A?O+I*Bp:O,A^p>=n^w>=n){var E=ey(Qp(d),Qp(g));iy(E);var C=ey(o,E);iy(C);var P=(A^O>=0?-1:1)*$p(C[2]);(r>P||r===P&&(E[0]||E[1]))&&(a+=A^O>=0?1:-1)}}return(s<-Ep||s<Ep&&u<-Cp)^1&a}(o,r);s.length?(f||(i.polygonStart(),f=!0),qp(s,cy,t,n,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),s=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){u.point(t,e)}function y(){h.point=p,u.lineStart()}function v(){h.point=d,u.lineEnd()}function b(t,e){a.push([t,e]),l.point(t,e)}function m(){l.lineStart(),a=[]}function g(){b(a[0][0],a[0][1]),l.lineEnd();var t,e,n,r,u=l.clean(),h=c.result(),d=h.length;if(a.pop(),o.push(a),a=null,d)if(1&u){if((e=(n=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else d>1&&2&u&&h.push(h.pop().concat(h.shift())),s.push(h.filter(uy))}return h}}function uy(t){return t.length>1}function cy(t,e){return((t=t.x)[0]<0?t[1]-jp-Ep:jp-t[1])-((e=e.x)[0]<0?e[1]-jp-Ep:jp-e[1])}const ly=ay((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?Pp:-Pp,u=Dp(o-n);Dp(u-Pp)<Ep?(t.point(n,r=(r+s)/2>0?jp:-jp),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=Pp&&(Dp(n-i)<Ep&&(n-=i*Ep),Dp(o-a)<Ep&&(o-=a*Ep),r=function(t,e,n,r){var i,o,s=Up(t-n);return Dp(s)>Ep?Np((Up(e)*(o=zp(r))*Up(n)-Up(r)*(i=zp(e))*Up(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*jp,r.point(-Pp,i),r.point(0,i),r.point(Pp,i),r.point(Pp,0),r.point(Pp,-i),r.point(0,-i),r.point(-Pp,-i),r.point(-Pp,0),r.point(-Pp,i);else if(Dp(t[0]-e[0])>Ep){var o=t[0]<e[0]?Pp:-Pp;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-Pp,-jp]);function fy(t,e){(e=Qp(e))[0]-=t,iy(e);var n,r=(n=-e[1])>1?0:n<-1?Pp:Math.acos(n);return((-e[2]<0?-r:r)+Bp-Ep)%Bp}var hy=1e9,dy=-hy;function py(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}const yy=t=>t;function vy(t,e){return Dp(t)>Pp&&(t-=Math.round(t/Bp)*Bp),[t,e]}function by(t){return function(e,n){return Dp(e+=t)>Pp&&(e-=Math.round(e/Bp)*Bp),[e,n]}}function my(t){var e=by(t);return e.invert=by(-t),e}function gy(t,e){var n=zp(t),r=Up(t),i=zp(e),o=Up(e);function s(t,e){var s=zp(e),a=zp(t)*s,u=Up(t)*s,c=Up(e),l=c*n+a*r;return[Rp(u*i-l*o,a*n-c*r),$p(l*i+u*o)]}return s.invert=function(t,e){var s=zp(e),a=zp(t)*s,u=Up(t)*s,c=Up(e),l=c*i-u*o;return[Rp(u*i+c*o,a*n+l*r),$p(l*n-a*r)]},s}function wy(t){return function(e){var n=new _y;for(var r in t)n[r]=t[r];return n.stream=e,n}}function _y(){}function xy(t,e){t&&Oy.hasOwnProperty(t.type)&&Oy[t.type](t,e)}vy.invert=vy,_y.prototype={constructor:_y,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Sy={Feature:function(t,e){xy(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)xy(n[r].geometry,e)}},Oy={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Iy(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Iy(n[r],e,0)},Polygon:function(t,e){Ty(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Ty(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)xy(n[r],e)}};function Iy(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Ty(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Iy(t[n],e,1);e.polygonEnd()}var Ay=1/0,My=Ay,Ey=-Ay,Cy=Ey,Py={point:function(t,e){t<Ay&&(Ay=t),t>Ey&&(Ey=t),e<My&&(My=e),e>Cy&&(Cy=e)},lineStart:Gp,lineEnd:Gp,polygonStart:Gp,polygonEnd:Gp,result:function(){var t=[[Ay,My],[Ey,Cy]];return Ey=Cy=-(My=Ay=1/0),t}};const jy=Py;function ky(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),function(t,e){t&&Sy.hasOwnProperty(t.type)?Sy[t.type](t,e):xy(t,e)}(n,t.stream(jy)),e(jy.result()),null!=r&&t.clipExtent(r),t}function By(t,e,n){return ky(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),s=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,a=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([s,a])}),n)}var Fy=16,Ly=zp(30*Lp);function Dy(t,e){return+e?function(t,e){function n(r,i,o,s,a,u,c,l,f,h,d,p,y,v){var b=c-r,m=l-i,g=b*b+m*m;if(g>4*e&&y--){var w=s+h,_=a+d,x=u+p,S=Wp(w*w+_*_+x*x),O=$p(x/=S),I=Dp(Dp(x)-1)<Ep||Dp(o-f)<Ep?(o+f)/2:Rp(_,w),T=t(I,O),A=T[0],M=T[1],E=A-r,C=M-i,P=m*E-b*C;(P*P/g>e||Dp((b*E+m*C)/g-.5)>.3||s*h+a*d+u*p<Ly)&&(n(r,i,o,s,a,u,A,M,I,w/=S,_/=S,x,y,v),v.point(A,M),n(A,M,I,w,_,x,c,l,f,h,d,p,y,v))}}return function(e){var r,i,o,s,a,u,c,l,f,h,d,p,y={point:v,lineStart:b,lineEnd:g,polygonStart:function(){e.polygonStart(),y.lineStart=w},polygonEnd:function(){e.polygonEnd(),y.lineStart=b}};function v(n,r){n=t(n,r),e.point(n[0],n[1])}function b(){l=NaN,y.point=m,e.lineStart()}function m(r,i){var o=Qp([r,i]),s=t(r,i);n(l,f,c,h,d,p,l=s[0],f=s[1],c=r,h=o[0],d=o[1],p=o[2],Fy,e),e.point(l,f)}function g(){y.point=v,e.lineEnd()}function w(){b(),y.point=_,y.lineEnd=x}function _(t,e){m(r=t,e),i=l,o=f,s=h,a=d,u=p,y.point=m}function x(){n(l,f,c,h,d,p,i,o,r,s,a,u,Fy,e),y.lineEnd=g,g()}return y}}(t,e):function(t){return wy({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Ny=wy({point:function(t,e){this.stream.point(t*Lp,e*Lp)}});function Ry(t,e,n,r,i,o){if(!o)return function(t,e,n,r,i){function o(o,s){return[e+t*(o*=r),n-t*(s*=i)]}return o.invert=function(o,s){return[(o-e)/t*r,(n-s)/t*i]},o}(t,e,n,r,i);var s=zp(o),a=Up(o),u=s*t,c=a*t,l=s/t,f=a/t,h=(a*n-s*e)/t,d=(a*e+s*n)/t;function p(t,o){return[u*(t*=r)-c*(o*=i)+e,n-c*t-u*o]}return p.invert=function(t,e){return[r*(l*t-f*e+h),i*(d-f*t-l*e)]},p}function zy(t){return function(t){var e,n,r,i,o,s,a,u,c,l,f=150,h=480,d=250,p=0,y=0,v=0,b=0,m=0,g=0,w=1,_=1,x=null,S=ly,O=null,I=yy,T=.5;function A(t){return u(t[0]*Lp,t[1]*Lp)}function M(t){return(t=u.invert(t[0],t[1]))&&[t[0]*Fp,t[1]*Fp]}function E(){var t=Ry(f,0,0,w,_,g).apply(null,e(p,y)),r=Ry(f,h-t[0],d-t[1],w,_,g);return n=function(t,e,n){return(t%=Bp)?e||n?py(my(t),gy(e,n)):my(t):e||n?gy(e,n):vy}(v,b,m),a=py(e,r),u=py(n,a),s=Dy(a,T),C()}function C(){return c=l=null,A}return A.stream=function(t){return c&&l===t?c:c=Ny(function(t){return wy({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(S(s(I(l=t)))))},A.preclip=function(t){return arguments.length?(S=t,x=void 0,C()):S},A.postclip=function(t){return arguments.length?(I=t,O=r=i=o=null,C()):I},A.clipAngle=function(t){return arguments.length?(S=+t?function(t){var e=zp(t),n=6*Lp,r=e>0,i=Dp(e)>Ep;function o(t,n){return zp(t)*zp(n)>e}function s(t,n,r){var i=[1,0,0],o=ey(Qp(t),Qp(n)),s=ty(o,o),a=o[0],u=s-a*a;if(!u)return!r&&t;var c=e*s/u,l=-e*a/u,f=ey(i,o),h=ry(i,c);ny(h,ry(o,l));var d=f,p=ty(h,d),y=ty(d,d),v=p*p-y*(ty(h,h)-1);if(!(v<0)){var b=Wp(v),m=ry(d,(-p-b)/y);if(ny(m,h),m=Jp(m),!r)return m;var g,w=t[0],_=n[0],x=t[1],S=n[1];_<w&&(g=w,w=_,_=g);var O=_-w,I=Dp(O-Pp)<Ep;if(!I&&S<x&&(g=x,x=S,S=g),I||O<Ep?I?x+S>0^m[1]<(Dp(m[0]-w)<Ep?x:S):x<=m[1]&&m[1]<=S:O>Pp^(w<=m[0]&&m[0]<=_)){var T=ry(d,(-p+b)/y);return ny(T,h),[m,Jp(T)]}}}function a(e,n){var i=r?t:Pp-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return ay(o,(function(t){var e,n,u,c,l;return{lineStart:function(){c=u=!1,l=1},point:function(f,h){var d,p=[f,h],y=o(f,h),v=r?y?0:a(f,h):y?a(f+(f<0?Pp:-Pp),h):0;if(!e&&(c=u=y)&&t.lineStart(),y!==u&&(!(d=s(e,p))||Zp(e,d)||Zp(p,d))&&(p[2]=1),y!==u)l=0,y?(t.lineStart(),d=s(p,e),t.point(d[0],d[1])):(d=s(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^y){var b;v&n||!(b=s(p,e,!0))||(l=0,r?(t.lineStart(),t.point(b[0][0],b[0][1]),t.point(b[1][0],b[1][1]),t.lineEnd()):(t.point(b[1][0],b[1][1]),t.lineEnd(),t.lineStart(),t.point(b[0][0],b[0][1],3)))}!y||e&&Zp(e,p)||t.point(p[0],p[1]),e=p,u=y,n=v},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return l|(c&&u)<<1}}}),(function(e,r,i,o){!function(t,e,n,r,i,o){if(n){var s=zp(e),a=Up(e),u=r*n;null==i?(i=e+r*Bp,o=e-u/2):(i=fy(s,i),o=fy(s,o),(r>0?i<o:i>o)&&(i+=r*Bp));for(var c,l=i;r>0?l>o:l<o;l-=u)c=Jp([s,-a*zp(l),-a*Up(l)]),t.point(c[0],c[1])}}(o,t,n,i,e,r)}),r?[0,-t]:[-Pp,t-Pp])}(x=t*Lp):(x=null,ly),C()):x*Fp},A.clipExtent=function(t){return arguments.length?(I=null==t?(O=r=i=o=null,yy):function(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,a,c){var l=0,f=0;if(null==i||(l=s(i,a))!==(f=s(o,a))||u(i,o)<0^a>0)do{c.point(0===l||3===l?t:n,l>1?r:e)}while((l=(l+a+4)%4)!==f);else c.point(o[0],o[1])}function s(r,i){return Dp(r[0]-t)<Ep?i>0?0:3:Dp(r[0]-n)<Ep?i>0?2:1:Dp(r[1]-e)<Ep?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var n=s(t,1),r=s(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){var u,c,l,f,h,d,p,y,v,b,m,g=s,w=Yp(),_={point:x,lineStart:function(){_.point=S,c&&c.push(l=[]),b=!0,v=!1,p=y=NaN},lineEnd:function(){u&&(S(f,h),d&&v&&w.rejoin(),u.push(w.result())),_.point=x,v&&g.lineEnd()},polygonStart:function(){g=w,u=[],c=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=c.length;n<i;++n)for(var o,s,a=c[n],u=1,l=a.length,f=a[0],h=f[0],d=f[1];u<l;++u)o=h,s=d,h=(f=a[u])[0],d=f[1],s<=r?d>r&&(h-o)*(r-s)>(d-s)*(t-o)&&++e:d<=r&&(h-o)*(r-s)<(d-s)*(t-o)&&--e;return e}(),n=m&&e,i=(u=sy(u)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&qp(u,a,e,o,s),s.polygonEnd()),g=s,u=c=l=null}};function x(t,e){i(t,e)&&g.point(t,e)}function S(o,s){var a=i(o,s);if(c&&l.push([o,s]),b)f=o,h=s,d=a,b=!1,a&&(g.lineStart(),g.point(o,s));else if(a&&v)g.point(o,s);else{var u=[p=Math.max(dy,Math.min(hy,p)),y=Math.max(dy,Math.min(hy,y))],w=[o=Math.max(dy,Math.min(hy,o)),s=Math.max(dy,Math.min(hy,s))];!function(t,e,n,r,i,o){var s,a=t[0],u=t[1],c=0,l=1,f=e[0]-a,h=e[1]-u;if(s=n-a,f||!(s>0)){if(s/=f,f<0){if(s<c)return;s<l&&(l=s)}else if(f>0){if(s>l)return;s>c&&(c=s)}if(s=i-a,f||!(s<0)){if(s/=f,f<0){if(s>l)return;s>c&&(c=s)}else if(f>0){if(s<c)return;s<l&&(l=s)}if(s=r-u,h||!(s>0)){if(s/=h,h<0){if(s<c)return;s<l&&(l=s)}else if(h>0){if(s>l)return;s>c&&(c=s)}if(s=o-u,h||!(s<0)){if(s/=h,h<0){if(s>l)return;s>c&&(c=s)}else if(h>0){if(s<c)return;s<l&&(l=s)}return c>0&&(t[0]=a+c*f,t[1]=u+c*h),l<1&&(e[0]=a+l*f,e[1]=u+l*h),!0}}}}}(u,w,t,e,n,r)?a&&(g.lineStart(),g.point(o,s),m=!1):(v||(g.lineStart(),g.point(u[0],u[1])),g.point(w[0],w[1]),a||g.lineEnd(),m=!1)}p=o,y=s,v=a}return _}}(O=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),C()):null==O?null:[[O,r],[i,o]]},A.scale=function(t){return arguments.length?(f=+t,E()):f},A.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],E()):[h,d]},A.center=function(t){return arguments.length?(p=t[0]%360*Lp,y=t[1]%360*Lp,E()):[p*Fp,y*Fp]},A.rotate=function(t){return arguments.length?(v=t[0]%360*Lp,b=t[1]%360*Lp,m=t.length>2?t[2]%360*Lp:0,E()):[v*Fp,b*Fp,m*Fp]},A.angle=function(t){return arguments.length?(g=t%360*Lp,E()):g*Fp},A.reflectX=function(t){return arguments.length?(w=t?-1:1,E()):w<0},A.reflectY=function(t){return arguments.length?(_=t?-1:1,E()):_<0},A.precision=function(t){return arguments.length?(s=Dy(a,T=t*t),C()):Wp(T)},A.fitExtent=function(t,e){return By(A,t,e)},A.fitSize=function(t,e){return function(t,e,n){return By(t,[[0,0],e],n)}(A,t,e)},A.fitWidth=function(t,e){return function(t,e,n){return ky(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,s=-i*n[0][1];t.scale(150*i).translate([o,s])}),n)}(A,t,e)},A.fitHeight=function(t,e){return function(t,e,n){return ky(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],s=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,s])}),n)}(A,t,e)},function(){return e=t.apply(this,arguments),A.invert=e.invert&&M,E()}}((function(){return t}))()}var Uy,Vy,Wy=(Uy=function(t){return Wp(2/(1+t))},function(t,e){var n=zp(t),r=zp(e),i=Uy(n*r);return i===1/0?[2,0]:[i*r*Up(t),i*Up(e)]});Wy.invert=(Vy=function(t){return 2*$p(t/2)},function(t,e){var n=Wp(t*t+e*e),r=Vy(n),i=Up(r),o=zp(r);return[Rp(t*i,n*o),$p(n&&e*i/n)]});var $y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"EUR",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,n=arguments.length>2?arguments[2]:void 0,r=(n=n||{}).ex||1.2,i=n.fontFamily||"Arial",o=n.exSize||1;return n.style=n.style||function(t,e){if(!(t.rs<r*e))return t.r1<r*e?o+"em "+i:1.5*o+"em "+i},n.proj=n.proj||zy(Wy).scale(124.75).clipAngle(179.999).rotate([-10,-52]).reflectX(!1).reflectY(!0).scale(6378137).translate([4321e3,321e4]),n.preprocess=function(t){if(n.ccIn&&t.cc&&!(n.ccIn.indexOf(t.cc)>=0))return!1;var e=n.proj([t.lon,t.lat]);t.x=e[0],t.y=e[1],delete t.lon,delete t.lat},n.baseURL=n.baseURL||"https://raw.githubusercontent.com/eurostat/euronym/main/pub/v2/UTF/",n.url=n.baseURL+e+"/"+t+".csv",n},Gy=function(t){var e=(t=t||{}).nutsYear||"2021",n=t.crs||"3035",r=t.scale||"03M",i=t.nutsLevel||"3",o=t.col||"#888",s=t.colKosovo||"#bcbcbc",a=null==t.showOth||t.showOth;return t.color=t.color||function(t,e){var n=t.properties;if(a||"T"==n.eu||"T"==n.cc||"T"==n.efta||"T"!==n.oth)return n.id>=1e5?s:"T"===n.co||e<400?o:e<1e3?n.lvl>=3?"":o:e<2e3?n.lvl>=2?"":o:n.lvl>=1?"":o},t.width=t.width||function(t,e){var n=t.properties;return"T"===n.co?.5:e<400?3==n.lvl||2==n.lvl||1==n.lvl?2.2:4:e<1e3?2==n.lvl||1==n.lvl?1.8:2.5:e<2e3?1==n.lvl?1.8:2.5:1.2},t.lineDash=t.lineDash||function(t,e){var n=t.properties;return"T"===n.co?[]:e<400?3==n.lvl?[2*e,2*e]:2==n.lvl||1==n.lvl?[5*e,2*e]:[10*e,3*e]:e<1e3?2==n.lvl||1==n.lvl?[5*e,2*e]:[10*e,3*e]:e<2e3&&1==n.lvl?[5*e,2*e]:[10*e,3*e]},t.baseURL=t.baseURL||"https://raw.githubusercontent.com/eurostat/Nuts2json/master/pub/v2/",t.url=t.baseURL+e+"/"+n+"/"+r+"/nutsbn_"+i+".json",t},Yy=Rn.getParameterByName;return Vd({decimal:".",thousands:" ",grouping:[3],currency:["","€"]}),e})()));
1
+ /*! For license information please see gridviz.min.js.LICENSE.txt */
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gviz=e():t.gviz=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(){}function r(t){return null==t?n:function(){return this.querySelector(t)}}function i(){return[]}function o(t){return null==t?i:function(){return this.querySelectorAll(t)}}function s(t){return function(){return this.matches(t)}}function a(t){return function(e){return e.matches(t)}}t.r(e),t.d(e,{App:()=>Zl,BackgroundLayer:()=>Il,BackgroundLayerWMS:()=>Ml,BoundaryLayer:()=>Vl,CSVGrid:()=>Sr,ColorCategoryLegend:()=>rp,ColorDiscreteLegend:()=>Jd,ColorLegend:()=>Zd,CompositionStyle:()=>If,ContourStyle:()=>mh,Dataset:()=>Zn,DatasetComponent:()=>pr,DotDensityStyle:()=>Nh,GeoCanvas:()=>Rn,JoyPlotStyle:()=>bf,KernelSmoothingStyle:()=>th,LabelLayer:()=>Fl,Layer:()=>Vn,LegoStyle:()=>dd,MosaicStyle:()=>wd,NinjaStarStyle:()=>Td,PillarStyle:()=>ah,SegmentOrientationLegend:()=>mp,SegmentStyle:()=>Pf,SegmentWidthLegend:()=>dp,ShapeColorSizeStyle:()=>of,SideCatStyle:()=>Oh,SideStyle:()=>ph,SizeLegend:()=>up,SquareColorCatWGLStyle:()=>id,SquareColorWGLStyle:()=>Zh,StrokeStyle:()=>ff,Style:()=>Jl,TanakaStyle:()=>Xh,TextStyle:()=>Df,TiledGrid:()=>xl,getClass:()=>Vr,getEuronymeLabelLayer:()=>$y,getEurostatBoundariesLayer:()=>Gy,getParameterByName:()=>Yy,sCircleHigh:()=>Op,sCircleLow:()=>Sp,sExp:()=>_p,sExpInverse:()=>Ip,sExpRev:()=>xp,sExpRevInverse:()=>Tp,sPow:()=>gp,sPowInverse:()=>Ap,sPowRev:()=>wp,sPowRevInverse:()=>Mp});var u=Array.prototype.find;function c(){return this.firstElementChild}var l=Array.prototype.filter;function f(){return Array.from(this.children)}function h(t){return new Array(t.length)}function d(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function p(t,e,n,r,i,o){for(var s,a=0,u=e.length,c=o.length;a<c;++a)(s=e[a])?(s.__data__=o[a],r[a]=s):n[a]=new d(t,o[a]);for(;a<u;++a)(s=e[a])&&(i[a]=s)}function y(t,e,n,r,i,o,s){var a,u,c,l=new Map,f=e.length,h=o.length,p=new Array(f);for(a=0;a<f;++a)(u=e[a])&&(p[a]=c=s.call(u,u.__data__,a,e)+"",l.has(c)?i[a]=u:l.set(c,u));for(a=0;a<h;++a)c=s.call(t,o[a],a,o)+"",(u=l.get(c))?(r[a]=u,u.__data__=o[a],l.delete(c)):n[a]=new d(t,o[a]);for(a=0;a<f;++a)(u=e[a])&&l.get(p[a])===u&&(i[a]=u)}function v(t){return t.__data__}function b(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function m(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}d.prototype={constructor:d,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var g="http://www.w3.org/1999/xhtml";const w={svg:"http://www.w3.org/2000/svg",xhtml:g,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function _(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),w.hasOwnProperty(e)?{space:w[e],local:t}:t}function x(t){return function(){this.removeAttribute(t)}}function S(t){return function(){this.removeAttributeNS(t.space,t.local)}}function O(t,e){return function(){this.setAttribute(t,e)}}function I(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function T(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function A(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function M(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function E(t){return function(){this.style.removeProperty(t)}}function C(t,e,n){return function(){this.style.setProperty(t,e,n)}}function P(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function j(t,e){return t.style.getPropertyValue(e)||M(t).getComputedStyle(t,null).getPropertyValue(e)}function k(t){return function(){delete this[t]}}function B(t,e){return function(){this[t]=e}}function F(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function L(t){return t.trim().split(/^|\s+/)}function D(t){return t.classList||new N(t)}function N(t){this._node=t,this._names=L(t.getAttribute("class")||"")}function R(t,e){for(var n=D(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function z(t,e){for(var n=D(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function U(t){return function(){R(this,t)}}function V(t){return function(){z(this,t)}}function W(t,e){return function(){(e.apply(this,arguments)?R:z)(this,t)}}function $(){this.textContent=""}function G(t){return function(){this.textContent=t}}function Y(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Z(){this.innerHTML=""}function H(t){return function(){this.innerHTML=t}}function q(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function X(){this.nextSibling&&this.parentNode.appendChild(this)}function K(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function J(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===g&&e.documentElement.namespaceURI===g?e.createElement(t):e.createElementNS(n,t)}}function Q(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function tt(t){var e=_(t);return(e.local?Q:J)(e)}function et(){return null}function nt(){var t=this.parentNode;t&&t.removeChild(this)}function rt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function it(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ot(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function st(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var s=0,a=i.length;s<a;++s)if((r=i[s]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function at(t,e,n){var r=M(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function ut(t,e){return function(){return at(this,t,e)}}function ct(t,e){return function(){return at(this,t,e.apply(this,arguments))}}N.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var lt=[null];function ft(t,e){this._groups=t,this._parents=e}function ht(){return new ft([[document.documentElement]],lt)}ft.prototype=ht.prototype={constructor:ft,select:function(t){"function"!=typeof t&&(t=r(t));for(var e=this._groups,n=e.length,i=new Array(n),o=0;o<n;++o)for(var s,a,u=e[o],c=u.length,l=i[o]=new Array(c),f=0;f<c;++f)(s=u[f])&&(a=t.call(s,s.__data__,f,u))&&("__data__"in s&&(a.__data__=s.__data__),l[f]=a);return new ft(i,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}(t):o(t);for(var e=this._groups,n=e.length,r=[],i=[],s=0;s<n;++s)for(var a,u=e[s],c=u.length,l=0;l<c;++l)(a=u[l])&&(r.push(t.call(a,a.__data__,l,u)),i.push(a));return new ft(r,i)},selectChild:function(t){return this.select(null==t?c:function(t){return function(){return u.call(this.children,t)}}("function"==typeof t?t:a(t)))},selectChildren:function(t){return this.selectAll(null==t?f:function(t){return function(){return l.call(this.children,t)}}("function"==typeof t?t:a(t)))},filter:function(t){"function"!=typeof t&&(t=s(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,c=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&c.push(o);return new ft(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,v);var n,r=e?y:p,i=this._parents,o=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var s=o.length,a=new Array(s),u=new Array(s),c=new Array(s),l=0;l<s;++l){var f=i[l],h=o[l],d=h.length,m=b(t.call(f,f&&f.__data__,l,i)),g=m.length,w=u[l]=new Array(g),_=a[l]=new Array(g);r(f,h,w,_,c[l]=new Array(d),m,e);for(var x,S,O=0,I=0;O<g;++O)if(x=w[O]){for(O>=I&&(I=O+1);!(S=_[I])&&++I<g;);x._next=S||null}}return(a=new ft(a,i))._enter=u,a._exit=c,a},enter:function(){return new ft(this._enter||this._groups.map(h),this._parents)},exit:function(){return new ft(this._exit||this._groups.map(h),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),u=0;u<s;++u)for(var c,l=n[u],f=r[u],h=l.length,d=a[u]=new Array(h),p=0;p<h;++p)(c=l[p]||f[p])&&(d[p]=c);for(;u<i;++u)a[u]=n[u];return new ft(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,s=i[o];--o>=0;)(r=i[o])&&(s&&4^r.compareDocumentPosition(s)&&s.parentNode.insertBefore(r,s),s=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=m);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s,a=n[o],u=a.length,c=i[o]=new Array(u),l=0;l<u;++l)(s=a[l])&&(c[l]=s);c.sort(e)}return new ft(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],s=0,a=o.length;s<a;++s)(i=o[s])&&t.call(i,i.__data__,s,o);return this},attr:function(t,e){var n=_(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?S:x:"function"==typeof e?n.local?A:T:n.local?I:O)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?E:"function"==typeof e?P:C)(t,e,null==n?"":n)):j(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?k:"function"==typeof e?F:B)(t,e)):this.node()[t]},classed:function(t,e){var n=L(t+"");if(arguments.length<2){for(var r=D(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?W:e?U:V)(n,e))},text:function(t){return arguments.length?this.each(null==t?$:("function"==typeof t?Y:G)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Z:("function"==typeof t?q:H)(t)):this.node().innerHTML},raise:function(){return this.each(X)},lower:function(){return this.each(K)},append:function(t){var e="function"==typeof t?t:tt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:tt(t),i=null==e?et:"function"==typeof e?e:r(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(nt)},clone:function(t){return this.select(t?it:rt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),s=o.length;if(!(arguments.length<2)){for(a=e?st:ot,r=0;r<s;++r)this.each(a(o[r],e,n));return this}var a=this.node().__on;if(a)for(var u,c=0,l=a.length;c<l;++c)for(r=0,u=a[c];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value},dispatch:function(t,e){return this.each(("function"==typeof e?ct:ut)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,s=i.length;o<s;++o)(r=i[o])&&(yield r)}};const dt=ht;function pt(t){return"string"==typeof t?new ft([[document.querySelector(t)]],[document.documentElement]):new ft([[t]],lt)}var yt={value:()=>{}};function vt(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new bt(r)}function bt(t){this._=t}function mt(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function gt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=yt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}bt.prototype=vt.prototype={constructor:bt,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(n=(t=o[s]).type)i[n]=gt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=gt(i[n],t.name,null);return this}for(;++s<a;)if((n=(t=o[s]).type)&&(n=mt(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new bt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};const wt=vt,_t={capture:!0,passive:!1};function xt(t){t.preventDefault(),t.stopImmediatePropagation()}function St(t){return((t=Math.exp(t))+1/t)/2}const Ot=function t(e,n,r){function i(t,i){var o,s,a=t[0],u=t[1],c=t[2],l=i[0],f=i[1],h=i[2],d=l-a,p=f-u,y=d*d+p*p;if(y<1e-12)s=Math.log(h/c)/e,o=function(t){return[a+t*d,u+t*p,c*Math.exp(e*t*s)]};else{var v=Math.sqrt(y),b=(h*h-c*c+r*y)/(2*c*n*v),m=(h*h-c*c-r*y)/(2*h*n*v),g=Math.log(Math.sqrt(b*b+1)-b),w=Math.log(Math.sqrt(m*m+1)-m);s=(w-g)/e,o=function(t){var r,i=t*s,o=St(g),l=c/(n*v)*(o*(r=e*i+g,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[a+l*d,u+l*p,c*o/St(e*i+g)]}}return o.duration=1e3*s*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);function It(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var Tt,At,Mt=0,Et=0,Ct=0,Pt=1e3,jt=0,kt=0,Bt=0,Ft="object"==typeof performance&&performance.now?performance:Date,Lt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Dt(){return kt||(Lt(Nt),kt=Ft.now()+Bt)}function Nt(){kt=0}function Rt(){this._call=this._time=this._next=null}function zt(t,e,n){var r=new Rt;return r.restart(t,e,n),r}function Ut(){kt=(jt=Ft.now())+Bt,Mt=Et=0;try{!function(){Dt(),++Mt;for(var t,e=Tt;e;)(t=kt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Mt}()}finally{Mt=0,function(){for(var t,e,n=Tt,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Tt=e);At=t,Wt(r)}(),kt=0}}function Vt(){var t=Ft.now(),e=t-jt;e>Pt&&(Bt-=e,jt=t)}function Wt(t){Mt||(Et&&(Et=clearTimeout(Et)),t-kt>24?(t<1/0&&(Et=setTimeout(Ut,t-Ft.now()-Bt)),Ct&&(Ct=clearInterval(Ct))):(Ct||(jt=Ft.now(),Ct=setInterval(Vt,Pt)),Mt=1,Lt(Ut)))}function $t(t,e,n){var r=new Rt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Rt.prototype=zt.prototype={constructor:Rt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Dt():+n)+(null==e?0:+e),this._next||At===this||(At?At._next=this:Tt=this,At=this),this._call=t,this._time=n,Wt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Wt())}};var Gt=wt("start","end","cancel","interrupt"),Yt=[],Zt=0,Ht=2,qt=3,Xt=5,Kt=6;function Jt(t,e,n,r,i,o){var s=t.__transition;if(s){if(n in s)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(u){var c,l,f,h;if(1!==n.state)return a();for(c in i)if((h=i[c]).name===n.name){if(h.state===qt)return $t(o);4===h.state?(h.state=Kt,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[c]):+c<e&&(h.state=Kt,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete i[c])}if($t((function(){n.state===qt&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(u))})),n.state=Ht,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Ht){for(n.state=qt,r=new Array(f=n.tween.length),c=0,l=-1;c<f;++c)(h=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++l]=h);r.length=l+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(a),n.state=Xt,1),o=-1,s=r.length;++o<s;)r[o].call(t,i);n.state===Xt&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){for(var r in n.state=Kt,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=zt((function(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}),0,n.time)}(t,n,{name:e,index:r,group:i,on:Gt,tween:Yt,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Zt})}function Qt(t,e){var n=ee(t,e);if(n.state>Zt)throw new Error("too late; already scheduled");return n}function te(t,e){var n=ee(t,e);if(n.state>qt)throw new Error("too late; already running");return n}function ee(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ne(t,e){var n,r,i,o=t.__transition,s=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>Ht&&n.state<Xt,n.state=Kt,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):s=!1;s&&delete t.__transition}}function re(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var ie,oe=180/Math.PI,se={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ae(t,e,n,r,i,o){var s,a,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,u/=a),t*r<e*n&&(t=-t,e=-e,u=-u,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*oe,skewX:Math.atan(u)*oe,scaleX:s,scaleY:a}}function ue(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,s){var a=[],u=[];return o=t(o),s=t(s),function(t,r,i,o,s,a){if(t!==i||r!==o){var u=s.push("translate(",null,e,null,n);a.push({i:u-4,x:re(t,i)},{i:u-2,x:re(r,o)})}else(i||o)&&s.push("translate("+i+e+o+n)}(o.translateX,o.translateY,s.translateX,s.translateY,a,u),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:re(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,s.rotate,a,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:re(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,s.skewX,a,u),function(t,e,n,r,o,s){if(t!==n||e!==r){var a=o.push(i(o)+"scale(",null,",",null,")");s.push({i:a-4,x:re(t,n)},{i:a-2,x:re(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,a,u),o=s=null,function(t){for(var e,n=-1,r=u.length;++n<r;)a[(e=u[n]).i]=e.x(t);return a.join("")}}}var ce=ue((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?se:ae(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),le=ue((function(t){return null==t?se:(ie||(ie=document.createElementNS("http://www.w3.org/2000/svg","g")),ie.setAttribute("transform",t),(t=ie.transform.baseVal.consolidate())?ae((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):se)}),", ",")",")");function fe(t,e){var n,r;return function(){var i=te(this,t),o=i.tween;if(o!==n)for(var s=0,a=(r=n=o).length;s<a;++s)if(r[s].name===e){(r=r.slice()).splice(s,1);break}i.tween=r}}function he(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=te(this,t),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:e,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===e){i[u]=a;break}u===c&&i.push(a)}o.tween=i}}function de(t,e,n){var r=t._id;return t.each((function(){var t=te(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return ee(t,r).value[e]}}function pe(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ye(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ve(){}var be=.7,me=1/be,ge="\\s*([+-]?\\d+)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xe=/^#([0-9a-f]{3,8})$/,Se=new RegExp(`^rgb\\(${ge},${ge},${ge}\\)$`),Oe=new RegExp(`^rgb\\(${_e},${_e},${_e}\\)$`),Ie=new RegExp(`^rgba\\(${ge},${ge},${ge},${we}\\)$`),Te=new RegExp(`^rgba\\(${_e},${_e},${_e},${we}\\)$`),Ae=new RegExp(`^hsl\\(${we},${_e},${_e}\\)$`),Me=new RegExp(`^hsla\\(${we},${_e},${_e},${we}\\)$`),Ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ce(){return this.rgb().formatHex()}function Pe(){return this.rgb().formatRgb()}function je(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=xe.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ke(e):3===n?new Le(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Be(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Be(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Se.exec(t))?new Le(e[1],e[2],e[3],1):(e=Oe.exec(t))?new Le(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Ie.exec(t))?Be(e[1],e[2],e[3],e[4]):(e=Te.exec(t))?Be(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ae.exec(t))?Ve(e[1],e[2]/100,e[3]/100,1):(e=Me.exec(t))?Ve(e[1],e[2]/100,e[3]/100,e[4]):Ee.hasOwnProperty(t)?ke(Ee[t]):"transparent"===t?new Le(NaN,NaN,NaN,0):null}function ke(t){return new Le(t>>16&255,t>>8&255,255&t,1)}function Be(t,e,n,r){return r<=0&&(t=e=n=NaN),new Le(t,e,n,r)}function Fe(t,e,n,r){return 1===arguments.length?((i=t)instanceof ve||(i=je(i)),i?new Le((i=i.rgb()).r,i.g,i.b,i.opacity):new Le):new Le(t,e,n,null==r?1:r);var i}function Le(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function De(){return`#${Ue(this.r)}${Ue(this.g)}${Ue(this.b)}`}function Ne(){const t=Re(this.opacity);return`${1===t?"rgb(":"rgba("}${ze(this.r)}, ${ze(this.g)}, ${ze(this.b)}${1===t?")":`, ${t})`}`}function Re(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ze(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ue(t){return((t=ze(t))<16?"0":"")+t.toString(16)}function Ve(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new $e(t,e,n,r)}function We(t){if(t instanceof $e)return new $e(t.h,t.s,t.l,t.opacity);if(t instanceof ve||(t=je(t)),!t)return new $e;if(t instanceof $e)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,a=o-i,u=(o+i)/2;return a?(s=e===o?(n-r)/a+6*(n<r):n===o?(r-e)/a+2:(e-n)/a+4,a/=u<.5?o+i:2-o-i,s*=60):a=u>0&&u<1?0:s,new $e(s,a,u,t.opacity)}function $e(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ge(t){return(t=(t||0)%360)<0?t+360:t}function Ye(t){return Math.max(0,Math.min(1,t||0))}function Ze(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function He(t,e,n,r,i){var o=t*t,s=o*t;return((1-3*t+3*o-s)*e+(4-6*o+3*s)*n+(1+3*t+3*o-3*s)*r+s*i)/6}pe(ve,je,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ce,formatHex:Ce,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return We(this).formatHsl()},formatRgb:Pe,toString:Pe}),pe(Le,Fe,ye(ve,{brighter(t){return t=null==t?me:Math.pow(me,t),new Le(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?be:Math.pow(be,t),new Le(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Le(ze(this.r),ze(this.g),ze(this.b),Re(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:De,formatHex:De,formatHex8:function(){return`#${Ue(this.r)}${Ue(this.g)}${Ue(this.b)}${Ue(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ne,toString:Ne})),pe($e,(function(t,e,n,r){return 1===arguments.length?We(t):new $e(t,e,n,null==r?1:r)}),ye(ve,{brighter(t){return t=null==t?me:Math.pow(me,t),new $e(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?be:Math.pow(be,t),new $e(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Le(Ze(t>=240?t-240:t+120,i,r),Ze(t,i,r),Ze(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new $e(Ge(this.h),Ye(this.s),Ye(this.l),Re(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Re(this.opacity);return`${1===t?"hsl(":"hsla("}${Ge(this.h)}, ${100*Ye(this.s)}%, ${100*Ye(this.l)}%${1===t?")":`, ${t})`}`}}));const qe=t=>()=>t;function Xe(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):qe(isNaN(t)?e:t)}const Ke=function t(e){var n=function(t){return 1==(t=+t)?Xe:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):qe(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Fe(t)).r,(e=Fe(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),s=Xe(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=s(e),t+""}}return r.gamma=t,r}(1);function Je(t){return function(e){var n,r,i=e.length,o=new Array(i),s=new Array(i),a=new Array(i);for(n=0;n<i;++n)r=Fe(e[n]),o[n]=r.r||0,s[n]=r.g||0,a[n]=r.b||0;return o=t(o),s=t(s),a=t(a),r.opacity=1,function(t){return r.r=o(t),r.g=s(t),r.b=a(t),r+""}}}Je((function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],s=r>0?t[r-1]:2*i-o,a=r<e-1?t[r+2]:2*o-i;return He((n-r/e)*e,s,i,o,a)}})),Je((function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],s=t[(r+1)%e],a=t[(r+2)%e];return He((n-r/e)*e,i,o,s,a)}}));var Qe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tn=new RegExp(Qe.source,"g");function en(t,e){var n,r,i,o=Qe.lastIndex=tn.lastIndex=0,s=-1,a=[],u=[];for(t+="",e+="";(n=Qe.exec(t))&&(r=tn.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,u.push({i:s,x:re(n,r)})),o=tn.lastIndex;return o<e.length&&(i=e.slice(o),a[s]?a[s]+=i:a[++s]=i),a.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,r=0;r<e;++r)a[(n=u[r]).i]=n.x(t);return a.join("")})}function nn(t,e){var n;return("number"==typeof e?re:e instanceof je?Ke:(n=je(e))?(e=n,Ke):en)(t,e)}function rn(t){return function(){this.removeAttribute(t)}}function on(t){return function(){this.removeAttributeNS(t.space,t.local)}}function sn(t,e,n){var r,i,o=n+"";return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function an(t,e,n){var r,i,o=n+"";return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function un(t,e,n){var r,i,o;return function(){var s,a,u=n(this);if(null!=u)return(s=this.getAttribute(t))===(a=u+"")?null:s===r&&a===i?o:(i=a,o=e(r=s,u));this.removeAttribute(t)}}function cn(t,e,n){var r,i,o;return function(){var s,a,u=n(this);if(null!=u)return(s=this.getAttributeNS(t.space,t.local))===(a=u+"")?null:s===r&&a===i?o:(i=a,o=e(r=s,u));this.removeAttributeNS(t.space,t.local)}}function ln(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function fn(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function hn(t,e){return function(){Qt(this,t).delay=+e.apply(this,arguments)}}function dn(t,e){return e=+e,function(){Qt(this,t).delay=e}}function pn(t,e){return function(){te(this,t).duration=+e.apply(this,arguments)}}function yn(t,e){return e=+e,function(){te(this,t).duration=e}}var vn=dt.prototype.constructor;function bn(t){return function(){this.style.removeProperty(t)}}var mn=0;function gn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function wn(){return++mn}var _n=dt.prototype;gn.prototype=function(t){return dt().transition(t)}.prototype={constructor:gn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=r(t));for(var i=this._groups,o=i.length,s=new Array(o),a=0;a<o;++a)for(var u,c,l=i[a],f=l.length,h=s[a]=new Array(f),d=0;d<f;++d)(u=l[d])&&(c=t.call(u,u.__data__,d,l))&&("__data__"in u&&(c.__data__=u.__data__),h[d]=c,Jt(h[d],e,n,d,h,ee(u,n)));return new gn(s,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=o(t));for(var r=this._groups,i=r.length,s=[],a=[],u=0;u<i;++u)for(var c,l=r[u],f=l.length,h=0;h<f;++h)if(c=l[h]){for(var d,p=t.call(c,c.__data__,h,l),y=ee(c,n),v=0,b=p.length;v<b;++v)(d=p[v])&&Jt(d,e,n,v,p,y);s.push(p),a.push(c)}return new gn(s,a,e,n)},selectChild:_n.selectChild,selectChildren:_n.selectChildren,filter:function(t){"function"!=typeof t&&(t=s(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,c=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&c.push(o);return new gn(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var u,c=e[a],l=n[a],f=c.length,h=s[a]=new Array(f),d=0;d<f;++d)(u=c[d]||l[d])&&(h[d]=u);for(;a<r;++a)s[a]=e[a];return new gn(s,this._parents,this._name,this._id)},selection:function(){return new vn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=wn(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s,a=r[o],u=a.length,c=0;c<u;++c)if(s=a[c]){var l=ee(s,e);Jt(s,t,n,c,a,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new gn(r,this._parents,t,n)},call:_n.call,nodes:_n.nodes,node:_n.node,size:_n.size,empty:_n.empty,each:_n.each,on:function(t,e){var n=this._id;return arguments.length<2?ee(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Qt:te;return function(){var s=o(this,t),a=s.on;a!==r&&(i=(r=a).copy()).on(e,n),s.on=i}}(n,t,e))},attr:function(t,e){var n=_(t),r="transform"===n?le:nn;return this.attrTween(t,"function"==typeof e?(n.local?cn:un)(n,r,de(this,"attr."+t,e)):null==e?(n.local?on:rn)(n):(n.local?an:sn)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=_(t);return this.tween(n,(r.local?ln:fn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?ce:nn;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=j(this,t),s=(this.style.removeProperty(t),j(this,t));return o===s?null:o===n&&s===r?i:i=e(n=o,r=s)}}(t,r)).on("end.style."+t,bn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var s=j(this,t),a=n(this),u=a+"";return null==a&&(this.style.removeProperty(t),u=a=j(this,t)),s===u?null:s===r&&u===i?o:(i=u,o=e(r=s,a))}}(t,r,de(this,"style."+t,e))).each(function(t,e){var n,r,i,o,s="style."+e,a="end."+s;return function(){var u=te(this,t),c=u.on,l=null==u.value[s]?o||(o=bn(e)):void 0;c===n&&i===l||(r=(n=c).copy()).on(a,i=l),u.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var s=j(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(de(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=ee(this.node(),n).tween,o=0,s=i.length;o<s;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?fe:he)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?hn:dn)(e,t)):ee(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?pn:yn)(e,t)):ee(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){te(this,t).ease=e}}(e,t)):ee(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;te(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(o,s){var a={value:s},u={value:function(){0==--i&&o()}};n.each((function(){var n=te(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(a),e._.interrupt.push(a),e._.end.push(u)),n.on=e})),0===i&&o()}))},[Symbol.iterator]:_n[Symbol.iterator]};var xn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Sn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}dt.prototype.interrupt=function(t){return this.each((function(){ne(this,t)}))},dt.prototype.transition=function(t){var e,n;t instanceof gn?(e=t._id,t=t._name):(e=wn(),(n=xn).time=Dt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s,a=r[o],u=a.length,c=0;c<u;++c)(s=a[c])&&Jt(s,t,e,c,a,n||Sn(s,e));return new gn(r,this._parents,t,e)};const On=t=>()=>t;function In(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Tn(t,e,n){this.k=t,this.x=e,this.y=n}Tn.prototype={constructor:Tn,scale:function(t){return 1===t?this:new Tn(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Tn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var An=new Tn(1,0,0);function Mn(t){t.stopImmediatePropagation()}function En(t){t.preventDefault(),t.stopImmediatePropagation()}function Cn(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Pn(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function jn(){return this.__zoom||An}function kn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Bn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fn(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Ln(t){return Ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ln(t)}function Dn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Nn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Ln(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Ln(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Ln(i)?i:String(i)),r)}var i}Tn.prototype;var Rn=function(){function t(e,n,r,i){var o=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.opts=i||{},this.canvas=e,this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.canvas.width=this.w,this.canvas.height=this.h;var s=this.canvas.getContext("2d");if(!s)throw"Impossible to create canvas 2D context";if(this.ctx=s,this.center=n||{x:.5*this.w,y:.5*this.h},this.zf=r,this.backgroundColor=i.backgroundColor||"white",this.onZoomStartFun=i.onZoomStartFun,this.onZoomEndFun=i.onZoomEndFun,this.onZoomFun=i.onZoomFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo(),!i.disableZoom){var a=An;(function(){var t,e,n,r=Cn,i=Pn,o=Fn,s=kn,a=Bn,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,f=Ot,h=wt("start","zoom","end"),d=500,p=150,y=0,v=10;function b(t){t.property("__zoom",jn).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",A).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",E).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(t,e){return(e=Math.max(u[0],Math.min(u[1],e)))===t.k?t:new Tn(e,t.x,t.y)}function g(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new Tn(t.k,r,i)}function w(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function _(t,e,n,r){t.on("start.zoom",(function(){x(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){x(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,s=x(t,o).event(r),a=i.apply(t,o),u=null==n?w(a):"function"==typeof n?n.apply(t,o):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),l=t.__zoom,h="function"==typeof e?e.apply(t,o):e,d=f(l.invert(u).concat(c/l.k),h.invert(u).concat(c/h.k));return function(t){if(1===t)t=h;else{var e=d(t),n=c/e[2];t=new Tn(n,u[0]-e[0]*n,u[1]-e[1]*n)}s.zoom(null,t)}}))}function x(t,e,n){return!n&&t.__zooming||new S(t,e)}function S(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function O(t,...e){if(r.apply(this,arguments)){var n=x(this,e).event(t),i=this.__zoom,a=Math.max(u[0],Math.min(u[1],i.k*Math.pow(2,s.apply(this,arguments)))),l=It(t);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=i.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(i.k===a)return;n.mouse=[l,i.invert(l)],ne(this),n.start()}En(t),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),p),n.zoom("mouse",o(g(m(i,a),n.mouse[0],n.mouse[1]),n.extent,c))}}function I(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,s=x(this,e,!0).event(t),a=pt(t.view).on("mousemove.zoom",(function(t){if(En(t),!s.moved){var e=t.clientX-l,n=t.clientY-f;s.moved=e*e+n*n>y}s.event(t).zoom("mouse",o(g(s.that.__zoom,s.mouse[0]=It(t,i),s.mouse[1]),s.extent,c))}),!0).on("mouseup.zoom",(function(t){a.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=pt(t).on("dragstart.drag",null);e&&(r.on("click.drag",xt,_t),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,s.moved),En(t),s.event(t).end()}),!0),u=It(t,i),l=t.clientX,f=t.clientY;!function(t){var e=t.document.documentElement,n=pt(t).on("dragstart.drag",xt,_t);"onselectstart"in e?n.on("selectstart.drag",xt,_t):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),Mn(t),s.mouse=[u,this.__zoom.invert(u)],ne(this),s.start()}}function T(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,s=It(t.changedTouches?t.changedTouches[0]:t,this),a=n.invert(s),u=n.k*(t.shiftKey?.5:2),f=o(g(m(n,u),s,a),i.apply(this,e),c);En(t),l>0?pt(this).transition().duration(l).call(_,f,s,t):pt(this).call(b.transform,f,s,t)}}function A(n,...i){if(r.apply(this,arguments)){var o,s,a,u,c=n.touches,l=c.length,f=x(this,i,n.changedTouches.length===l).event(n);for(Mn(n),s=0;s<l;++s)u=[u=It(a=c[s],this),this.__zoom.invert(u),a.identifier],f.touch0?f.touch1||f.touch0[2]===u[2]||(f.touch1=u,f.taps=0):(f.touch0=u,o=!0,f.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(f.taps<2&&(e=u[0],t=setTimeout((function(){t=null}),d)),ne(this),f.start())}}function M(t,...e){if(this.__zooming){var n,r,i,s,a=x(this,e).event(t),u=t.changedTouches,l=u.length;for(En(t),n=0;n<l;++n)i=It(r=u[n],this),a.touch0&&a.touch0[2]===r.identifier?a.touch0[0]=i:a.touch1&&a.touch1[2]===r.identifier&&(a.touch1[0]=i);if(r=a.that.__zoom,a.touch1){var f=a.touch0[0],h=a.touch0[1],d=a.touch1[0],p=a.touch1[1],y=(y=d[0]-f[0])*y+(y=d[1]-f[1])*y,v=(v=p[0]-h[0])*v+(v=p[1]-h[1])*v;r=m(r,Math.sqrt(y/v)),i=[(f[0]+d[0])/2,(f[1]+d[1])/2],s=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!a.touch0)return;i=a.touch0[0],s=a.touch0[1]}a.zoom("touch",o(g(r,i,s),a.extent,c))}}function E(t,...r){if(this.__zooming){var i,o,s=x(this,r).event(t),a=t.changedTouches,u=a.length;for(Mn(t),n&&clearTimeout(n),n=setTimeout((function(){n=null}),d),i=0;i<u;++i)o=a[i],s.touch0&&s.touch0[2]===o.identifier?delete s.touch0:s.touch1&&s.touch1[2]===o.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(o=It(o,this),Math.hypot(e[0]-o[0],e[1]-o[1])<v)){var c=pt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return b.transform=function(t,e,n,r){var i=t.selection?t.selection():t;i.property("__zoom",jn),t!==i?_(t,e,n,r):i.interrupt().each((function(){x(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},b.scaleBy=function(t,e,n,r){b.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),n,r)},b.scaleTo=function(t,e,n,r){b.transform(t,(function(){var t=i.apply(this,arguments),r=this.__zoom,s=null==n?w(t):"function"==typeof n?n.apply(this,arguments):n,a=r.invert(s),u="function"==typeof e?e.apply(this,arguments):e;return o(g(m(r,u),s,a),t,c)}),n,r)},b.translateBy=function(t,e,n,r){b.transform(t,(function(){return o(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)}),null,r)},b.translateTo=function(t,e,n,r,s){b.transform(t,(function(){var t=i.apply(this,arguments),s=this.__zoom,a=null==r?w(t):"function"==typeof r?r.apply(this,arguments):r;return o(An.translate(a[0],a[1]).scale(s.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)}),r,s)},S.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=pt(this.that).datum();h.call(t,this.that,new In(t,{sourceEvent:this.sourceEvent,target:b,type:t,transform:this.that.__zoom,dispatch:h}),e)}},b.wheelDelta=function(t){return arguments.length?(s="function"==typeof t?t:On(+t),b):s},b.filter=function(t){return arguments.length?(r="function"==typeof t?t:On(!!t),b):r},b.touchable=function(t){return arguments.length?(a="function"==typeof t?t:On(!!t),b):a},b.extent=function(t){return arguments.length?(i="function"==typeof t?t:On([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),b):i},b.scaleExtent=function(t){return arguments.length?(u[0]=+t[0],u[1]=+t[1],b):[u[0],u[1]]},b.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],b):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},b.constrain=function(t){return arguments.length?(o=t,b):o},b.duration=function(t){return arguments.length?(l=+t,b):l},b.interpolate=function(t){return arguments.length?(f=t,b):f},b.on=function(){var t=h.on.apply(h,arguments);return t===h?b:t},b.clickDistance=function(t){return arguments.length?(y=(t=+t)*t,b):Math.sqrt(y)},b.tapDistance=function(t){return arguments.length?(v=+t,b):v},b})().wheelDelta((function(t){return-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004)})).on("zoom",(function(t){var e=t.transform,n=a.k/e.k;if(1==n){var r=a.x-e.x,i=a.y-e.y;o.pan(r*o.getZf(),-i*o.getZf())}else{var s=t.sourceEvent;if(s instanceof WheelEvent)o.zoom(n,o.pixToGeoX(t.sourceEvent.offsetX),o.pixToGeoY(t.sourceEvent.offsetY));else if(s instanceof TouchEvent){var u,c=0,l=0,f=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Dn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(s.targetTouches);try{for(f.s();!(u=f.n()).done;){var h=u.value;c+=h.clientX,l+=h.clientY}}catch(t){f.e(t)}finally{f.f()}c/=s.targetTouches.length,l/=s.targetTouches.length,o.zoom(n,o.pixToGeoX(c),o.pixToGeoY(l))}}a=e,o.onZoomFun&&o.onZoomFun(t)})).on("start",(function(t){o.canvasSave.c=document.createElement("canvas"),o.canvasSave.c.setAttribute("width",""+o.w),o.canvasSave.c.setAttribute("height",""+o.h),o.canvasSave.c.getContext("2d").drawImage(o.canvas,0,0),o.canvasSave.dx=0,o.canvasSave.dy=0,o.canvasSave.f=1,o.onZoomStartFun&&o.onZoomStartFun(t)})).on("end",(function(t){o.redraw(!0),o.canvasSave={c:null,dx:0,dy:0,f:1},o.onZoomEndFun&&o.onZoomEndFun(t)}))(pt(this.canvas))}this.zfExtent=[0,1/0],this.canvasSave={c:null,dx:0,dy:0,f:1}}var e,n,r;return e=t,n=[{key:"setCenter",value:function(t){this.center=t}},{key:"getCenter",value:function(){return this.center}},{key:"setZf",value:function(t){this.zf=t,this.slider&&this.slider.attr("value",+this.zf)}},{key:"getZf",value:function(){return this.zf}},{key:"setZfExtent",value:function(t){this.zfExtent=t}},{key:"getZfExtent",value:function(){return this.zfExtent}},{key:"initCanvasTransform",value:function(){this.ctx.setTransform(1,0,0,1,0,0)}},{key:"setCanvasTransform",value:function(){var t=1/this.getZf(),e=-this.center.x/this.getZf()+.5*this.w,n=this.center.y/this.getZf()+.5*this.h;this.ctx.setTransform(t,0,0,-t,e,n)}},{key:"getWebGLTransform",value:function(){var t=2/(this.w*this.getZf()),e=2/(this.h*this.getZf());return[t,0,0,0,e,0,-t*this.center.x,-e*this.center.y,1]}},{key:"redraw",value:function(){throw new Error("Method redraw not implemented.")}},{key:"clear",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"white";this.opts.transparentBackground?this.ctx.clearRect(0,0,this.w,this.h):(this.ctx&&(this.ctx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h))}},{key:"pan",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.center.x+=t,this.center.y+=e,this.updateExtentGeo(),this.canvasSave.c&&(this.canvasSave.dx-=t/this.getZf(),this.canvasSave.dy+=e/this.getZf(),this.clear(this.backgroundColor),this.ctx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy))}},{key:"zoom",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.center.x,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.center.y;if(!(this.zfExtent[0]==this.getZf()&&t<=1||this.zfExtent[1]==this.getZf()&&t>=1)){var r=t*this.getZf();r<this.zfExtent[0]&&(t=this.zfExtent[0]/this.getZf()),r>this.zfExtent[1]&&(t=this.zfExtent[1]/this.getZf()),this.setZf(t*this.getZf());var i=(e-this.center.x)*(1-t);this.center.x+=i;var o=(n-this.center.y)*(1-t);this.center.y+=o,this.updateExtentGeo(),this.canvasSave.c&&(this.clear(this.backgroundColor),this.canvasSave.f/=t,this.canvasSave.dx=this.geoToPixX(e)*(1-this.canvasSave.f),this.canvasSave.dy=this.geoToPixY(n)*(1-this.canvasSave.f),this.clear(this.backgroundColor),this.ctx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy,this.canvasSave.f*this.canvasSave.c.width,this.canvasSave.f*this.canvasSave.c.height))}}},{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.extGeo={xMin:this.pixToGeoX(-t),xMax:this.pixToGeoX(this.w+t),yMin:this.pixToGeoY(this.h+t),yMax:this.pixToGeoY(-t)},this.extGeo}},{key:"toDraw",value:function(t){return!(t.x<this.extGeo.xMin||t.x>this.extGeo.xMax||t.y<this.extGeo.yMin||t.y>this.extGeo.yMax)}},{key:"geoToPixX",value:function(t){return(t-this.center.x)/this.getZf()+.5*this.w}},{key:"geoToPixY",value:function(t){return-(t-this.center.y)/this.getZf()+.5*this.h}},{key:"pixToGeoX",value:function(t){return(t-.5*this.w)*this.getZf()+this.center.x}},{key:"pixToGeoY",value:function(t){return-(t-.5*this.h)*this.getZf()+this.center.y}},{key:"setViewFromURL",value:function(){var e=t.getParameterByName("x"),n=t.getParameterByName("y"),r=t.getParameterByName("z"),i=this.getCenter();null==e||null==e||isNaN(+e)||(i.x=+e),null==n||null==n||isNaN(+n)||(i.y=+n),null==r||null==r||isNaN(+r)||this.setZf(+r)}},{key:"addZoomSlider",value:function(t,e){(e=e||{}).width=e.width||"30px",e.height=e.height||"300px";var n=pt("#"+t);if(n.empty())return console.error("Could not find div element to build zoom slider. Id: "+t),this;var r=this;return this.slider=n.append("input").attr("type","range").attr("min",this.getZfExtent()[0]).attr("max",this.getZfExtent()[1]).attr("value",this.getZf()).on("input",(function(t){if(this&&this.value){var e=+this.value;pt(this).attr("value",e),r.setZf(e),r.redraw()}})).style("width",e.width).style("height",e.height).style("opacity",.7).on("mouseover",(function(t){pt(this).style("opacity",1)})).on("mouseout",(function(t){pt(this).style("opacity",.7)})).style("-webkit-appearance","slider-vertical").style("writing-mode","bt-lr").attr("orient","vertical").style("background","lightgray").style("outline","none").style("-webkit-transition",".2s").style("transition","opacity .2s"),this}}],r=[{key:"getParameterByName",value:function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return e?decodeURIComponent(e[1].replace(/\+/g," ")):null}}],n&&Nn(e.prototype,n),r&&Nn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function zn(t){return zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(t)}function Un(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==zn(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==zn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===zn(i)?i:String(i)),r)}var i}var Vn=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=r||{},this.dataset=e,this.styles=n,this.visible=0!=r.visible,this.minZoom=r.minZoom||0,this.maxZoom=r.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");this.pixNb=r.pixNb||3,this.cellInfoHTML=r.cellInfoHTML||t.defaultCellInfoHTML}var e,n,r;return e=t,r=[{key:"defaultCellInfoHTML",value:function(t){for(var e=[],n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];"x"!==i&&"y"!==i&&e.push("<b>",i,"</b>"," : ",t[i],"<br>")}return e.join("")}}],(n=[{key:"getDatasetComponent",value:function(t){if(!(t<this.minZoom||t>this.maxZoom)){if(1==this.dataset.datasetComponents.length)return this.dataset.datasetComponents[0];for(var e=this.dataset.resolutions,n=0,r=e[n]/this.pixNb;r<t&&n<e.length;)r=e[++n]/this.pixNb;return n==e.length?this.dataset.datasetComponents[e.length-1]:this.dataset.datasetComponents[n]}}}])&&Un(e.prototype,n),r&&Un(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Wn(t){return Wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wn(t)}function $n(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Gn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Gn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Yn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Wn(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Wn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Wn(i)?i:String(i)),r)}var i}var Zn=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=r||{},this.datasetComponents=e,this.resolutions=n,this.datasetComponents.length>1&&this.datasetComponents.length!=this.resolutions.length)throw new Error("Uncompatible number of datasets and resolutions: "+this.datasetComponents.length+" "+this.resolutions.length);r.preprocess&&this.setPrepocesses(r.preprocess)}var e,n,r;return e=t,r=[{key:"make",value:function(e,n,r){var i,o=[],s=$n(e);try{for(s.s();!(i=s.n()).done;){var a=i.value;o.push(n(a))}}catch(t){s.e(t)}finally{s.f()}return new t(o,e,r)}}],(n=[{key:"setPrepocesses",value:function(t){var e,n=$n(this.datasetComponents);try{for(n.s();!(e=n.n()).done;)e.value.preprocess=t}catch(t){n.e(t)}finally{n.f()}return this}}])&&Yn(e.prototype,n),r&&Yn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Hn(t){return Hn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hn(t)}function qn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Xn(r.key),r)}}function Xn(t){var e=function(t,e){if("object"!==Hn(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Hn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Hn(e)?e:String(e)}var Kn=function(){function t(e){var n,r,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n=this,i=function(t){var e=this.tooltip.node(),n=this.parentElement.getBoundingClientRect();if(e.offsetLeft>n.left+n.width-e.clientWidth){var r=t.pageX-e.clientWidth-this.xOffset;if(e.style.left=r+"px",e.offsetLeft+e.clientWidth>t.pageX){var i=t.pageX-(e.clientWidth+this.xOffset);e.style.left=i+"px"}}t.pageY+e.clientHeight>n.top+n.height&&(e.style.top=t.pageY-e.clientHeight+"px")},(r=Xn(r="ensureTooltipInsideContainer"))in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,e=e||{},this.div=e.div||"tooltip_eurostat",this.maxWidth=e.maxWidth||"20em",this.fontSize=e.fontSize||"1.2em",this.background=e.background||"white",this.padding=e.padding||"5px",this.border=e.border||"0px",this["border-radius"]=e["border-radius"]||"5px",this["box-shadow"]=e["box-shadow"]||"5px 5px 5px grey",this["font-family"]=e["font-family"]||"Helvetica, Arial, sans-serif",this.transitionDuration=e.transitionDuration||100,this.xOffset=e.xOffset||30,this.yOffset=e.yOffset||20,this.yMouseOffset=e.yMouseOffset||0,this.xMouseOffset=e.xMouseOffset||0,this.parentElement=e.parentElement||document.body,this.tooltip=pt("#"+this.div),this.tooltip.empty()&&(this.tooltip=pt("#"+this.parentElement.id).append("div").attr("id",this.div)),this.tooltip.style("max-width",this.maxWidth),this.tooltip.style("overflow","hidden"),this.tooltip.style("font-size",this.fontSize),this.tooltip.style("background",this.background),this.tooltip.style("padding",this.padding),this.tooltip.style("border",this.border),this.tooltip.style("border-radius",this["border-radius"]),this.tooltip.style("box-shadow",this["box-shadow"]),this.tooltip.style("font-family",this["font-family"]),this.tooltip.style("position","absolute"),this.tooltip.style("pointer-events","none"),this.tooltip.style("opacity","0"),this.tooltip.attr("role","tooltip").attr("aria-live","polite")}var e,n;return e=t,n=[{key:"show",value:function(){this.tooltip.transition().duration(this.transitionDuration).style("opacity",1)}},{key:"hide",value:function(){this.tooltip.transition().duration(this.transitionDuration).style("opacity",0)}},{key:"html",value:function(t){this.tooltip.html(t)}},{key:"setPosition",value:function(t){this.tooltip.style("left",t.pageX+this.xOffset+"px").style("top",t.pageY-this.yOffset+"px"),this.ensureTooltipInsideContainer(t)}},{key:"style",value:function(t,e){return 1==arguments.length?this.tooltip.style(t):(this.tooltip.style(t,e),this)}},{key:"attr",value:function(t,e){return 1==arguments.length?this.tooltip.attr(t):(this.tooltip.attr(t,e),this)}}],n&&qn(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Jn={},Qn={};function tr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function er(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function nr(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function rr(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,s=0,a=0,u=o<=0,c=!1;function l(){if(u)return Qn;if(c)return c=!1,Jn;var e,r,i=s;if(34===t.charCodeAt(i)){for(;s++<o&&34!==t.charCodeAt(s)||34===t.charCodeAt(++s););return(e=s)>=o?u=!0:10===(r=t.charCodeAt(s++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(s)&&++s),t.slice(i+1,e-1).replace(/""/g,'"')}for(;s<o;){if(10===(r=t.charCodeAt(e=s++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(s)&&++s;else if(r!==n)continue;return t.slice(i,e)}return u=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=l())!==Qn;){for(var f=[];r!==Jn&&r!==Qn;)f.push(r),r=l();e&&null==(f=e(f,a++))||i.push(f)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return s(e[t])})).join(t)}))}function o(e){return e.map(s).join(t)}function s(t){return null==t?"":t instanceof Date?(i=(n=t).getUTCHours(),o=n.getUTCMinutes(),s=n.getUTCSeconds(),a=n.getUTCMilliseconds(),isNaN(n)?"Invalid Date":((r=n.getUTCFullYear())<0?"-"+nr(-r,6):r>9999?"+"+nr(r,6):nr(r,4))+"-"+nr(n.getUTCMonth()+1,2)+"-"+nr(n.getUTCDate(),2)+(a?"T"+nr(i,2)+":"+nr(o,2)+":"+nr(s,2)+"."+nr(a,3)+"Z":s?"T"+nr(i,2)+":"+nr(o,2)+":"+nr(s,2)+"Z":o||i?"T"+nr(i,2)+":"+nr(o,2)+"Z":"")):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t;var n,r,i,o,s,a}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=tr(t);return function(r,i){return e(n(r),i,t)}}(t,e):tr(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=er(e)),[n.map(s).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=er(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:s}}var ir=rr(","),or=ir.parse,sr=(ir.parseRows,ir.format,ir.formatBody,ir.formatRows,ir.formatRow,ir.formatValue,rr("\t")),ar=sr.parse;function ur(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function cr(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),function(t,e){return fetch(t,e).then(ur)}(e,n).then((function(e){return t(e,r)}))}}sr.parseRows,sr.format,sr.formatBody,sr.formatRows,sr.formatRow,sr.formatValue;var lr=cr(or);function fr(t){return fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fr(t)}function hr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function dr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==fr(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==fr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===fr(i)?i:String(i)),r)}var i}cr(ar);var pr=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=r||{},this.url=e,this.resolution=n,this.preprocess=r.preprocess||void 0,this.cellsViewCache=[]}var e,n;return e=t,(n=[{key:"getData",value:function(t,e){throw new Error("Method getData not implemented.")}},{key:"updateViewCache",value:function(t){throw new Error("Method updateViewCache not implemented.")}},{key:"getCellFromPosition",value:function(t,e){var n,r=this.getResolution(),i=r*Math.floor(t.x/r),o=r*Math.floor(t.y/r),s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return hr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(s.s();!(n=s.n()).done;){var a=n.value;if(a.x==i&&a.y==o)return a}}catch(t){s.e(t)}finally{s.f()}}},{key:"getResolution",value:function(){return this.resolution}},{key:"getViewCache",value:function(){return this.cellsViewCache}}])&&dr(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function yr(t){return yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(t)}function vr(){vr=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var o=e&&e.prototype instanceof h?e:h,s=Object.create(o.prototype),a=new I(i||[]);return r(s,"_invoke",{value:_(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==e&&n.call(b,o)&&(y=b);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(r,o,s,a){var u=l(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==yr(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function _(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=l(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,r(m,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new w(c(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},g(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function br(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return mr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function mr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function gr(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function wr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==yr(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==yr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===yr(i)?i:String(i)),r)}var i}function _r(t,e){return _r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_r(t,e)}function xr(t){return xr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xr(t)}var Sr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_r(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=xr(r);if(i){var n=xr(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===yr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(n=o.call(this,t,e,r)).cells=[],n.infoLoadingStatus="notLoaded",n}return e=s,n=[{key:"getData",value:function(t,e){var n,r=this;return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",(n=vr().mark((function t(){var n,i,o,s,a,u,c;return vr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,lr(r.url);case 3:n=t.sent,i=br(n);try{for(i.s();!(o=i.n()).done;)(s=o.value).x=+s.x,s.y=+s.y}catch(t){i.e(t)}finally{i.f()}if(!r.preprocess){t.next=29;break}r.cells=[],a=br(n),t.prev=9,a.s();case 11:if((u=a.n()).done){t.next=19;break}if(c=u.value,0!=r.preprocess(c)){t.next=16;break}return t.abrupt("continue",17);case 16:r.cells.push(c);case 17:t.next=11;break;case 19:t.next=24;break;case 21:t.prev=21,t.t0=t.catch(9),a.e(t.t0);case 24:return t.prev=24,a.f(),t.finish(24);case 27:t.next=30;break;case 29:r.cells=n;case 30:e&&e(),r.infoLoadingStatus="loaded",t.next=38;break;case 34:t.prev=34,t.t1=t.catch(0),r.infoLoadingStatus="failed",r.cells=[];case 38:case"end":return t.stop()}}),t,null,[[0,34],[9,21,24,27]])})),function(){var t=this,e=arguments;return new Promise((function(r,i){var o=n.apply(t,e);function s(t){gr(o,r,i,s,a,"next",t)}function a(t){gr(o,r,i,s,a,"throw",t)}s(void 0)}))})()),this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=br(this.cells);try{for(n.s();!(e=n.n()).done;){var r=e.value;+r.x+this.resolution<t.xMin||+r.x-this.resolution>t.xMax||+r.y+this.resolution<t.yMin||+r.y-this.resolution>t.yMax||this.cellsViewCache.push(r)}}catch(t){n.e(t)}finally{n.f()}}}}],n&&wr(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(pr);function Or(t){return Or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Or(t)}function Ir(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Tr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Or(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Or(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Or(i)?i:String(i)),r)}var i}function Ar(t,e,n){return e&&Tr(t.prototype,e),n&&Tr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var Mr,Er,Cr,Pr,jr,kr,Br,Fr,Lr,Dr,Nr,Rr,zr,Ur=Ar((function t(e,n,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cells=e,this.x=n,this.y=r;var o=i.resolutionGeo,s=i.tileSizeCell;this.extGeo={xMin:i.originPoint.x+o*s*this.x,xMax:i.originPoint.x+o*s*(this.x+1),yMin:i.originPoint.y+o*s*this.y,yMax:i.originPoint.y+o*s*(this.y+1)};var a,u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ir(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ir(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(this.cells);try{for(u.s();!(a=u.n()).done;){var c=a.value;c.x=this.extGeo.xMin+c.x*o,c.y=this.extGeo.yMin+c.y*o}}catch(t){u.e(t)}finally{u.f()}}));function Vr(t,e){if(e){if(0==e.length)return 0;if(t<=e[0])return 0;for(var n=1;n<e.length;n++)if(e[n-1]<t&&t<=e[n])return n;return e.length}}function Wr(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function $r(t,e){return fetch(t,e).then(Wr)}function Gr(t){if(null===t)return"null";if(void 0===t)return"undefined";switch(typeof t){case"number":case"bigint":return`${t}`;case"string":return`"${t}"`}return"function"==typeof t[Symbol.toPrimitive]?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map((t=>Gr(t)))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,((t,e)=>"bigint"==typeof e?`${e}`:e))}function Yr(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))}function Zr(t){return this instanceof Zr?(this.v=t,this):new Zr(t)}function Hr(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(t){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||a(t,e)}))})}function a(t,e){try{(n=i[t](e)).value instanceof Zr?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function u(t){a("next",t)}function c(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function qr(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,i){e[r]=t[r]?function(e){return(n=!n)?{value:Zr(t[r](e)),done:!1}:i?i(e):e}:i}}function Xr(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){!function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)}(r,i,(e=t[n](e)).done,e.value)}))}}}!function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"}(Mr||(Mr={})),(zr=Er||(Er={}))[zr.Sparse=0]="Sparse",zr[zr.Dense=1]="Dense",function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"}(Cr||(Cr={})),(Rr=Pr||(Pr={}))[Rr.DAY=0]="DAY",Rr[Rr.MILLISECOND=1]="MILLISECOND",(Nr=jr||(jr={}))[Nr.SECOND=0]="SECOND",Nr[Nr.MILLISECOND=1]="MILLISECOND",Nr[Nr.MICROSECOND=2]="MICROSECOND",Nr[Nr.NANOSECOND=3]="NANOSECOND",(Dr=kr||(kr={}))[Dr.YEAR_MONTH=0]="YEAR_MONTH",Dr[Dr.DAY_TIME=1]="DAY_TIME",Dr[Dr.MONTH_DAY_NANO=2]="MONTH_DAY_NANO",function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"}(Br||(Br={})),function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(Fr||(Fr={})),function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"}(Lr||(Lr={})),Object.create,Object.create;const Kr=new TextDecoder("utf-8"),Jr=t=>Kr.decode(t),Qr=new TextEncoder,ti=t=>Qr.encode(t),[ei,ni]=(()=>{const t=()=>{throw new Error("BigInt is not available in this environment")};function e(){throw t()}return e.asIntN=()=>{throw t()},e.asUintN=()=>{throw t()},"undefined"!=typeof BigInt?[BigInt,!0]:[e,!1]})(),[ri,ii]=(()=>{const t=()=>{throw new Error("BigInt64Array is not available in this environment")};return"undefined"!=typeof BigInt64Array?[BigInt64Array,!0]:[class{static get BYTES_PER_ELEMENT(){return 8}static of(){throw t()}static from(){throw t()}constructor(){throw t()}},!1]})(),[oi,si]=(()=>{const t=()=>{throw new Error("BigUint64Array is not available in this environment")};return"undefined"!=typeof BigUint64Array?[BigUint64Array,!0]:[class{static get BYTES_PER_ELEMENT(){return 8}static of(){throw t()}static from(){throw t()}constructor(){throw t()}},!1]})(),ai=t=>"function"==typeof t,ui=t=>null!=t&&Object(t)===t,ci=t=>ui(t)&&ai(t.then),li=t=>ui(t)&&ai(t[Symbol.iterator]),fi=t=>ui(t)&&ai(t[Symbol.asyncIterator]),hi=t=>ui(t)&&ui(t.schema),di=t=>ui(t)&&"done"in t&&"value"in t,pi=t=>ui(t)&&ai(t.stat)&&(t=>"number"==typeof t)(t.fd),yi=t=>ui(t)&&bi(t.body),vi=t=>"_getDOMStream"in t&&"_getNodeStream"in t,bi=t=>ui(t)&&ai(t.cancel)&&ai(t.getReader)&&!vi(t),mi=t=>ui(t)&&ai(t.read)&&ai(t.pipe)&&(t=>"boolean"==typeof t)(t.readable)&&!vi(t),gi=t=>ui(t)&&ai(t.clear)&&ai(t.bytes)&&ai(t.position)&&ai(t.setPosition)&&ai(t.capacity)&&ai(t.getBufferIdentifier)&&ai(t.createLong),wi="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;function _i(t,e,n=0,r=e.byteLength){const i=t.byteLength,o=new Uint8Array(t.buffer,t.byteOffset,i),s=new Uint8Array(e.buffer,e.byteOffset,Math.min(r,i));return o.set(s,n),t}function xi(t,e){const n=function(t){const e=t[0]?[t[0]]:[];let n,r,i,o;for(let s,a,u=0,c=0,l=t.length;++u<l;)s=e[c],a=t[u],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset?a&&(e[++c]=a):(({byteOffset:n,byteLength:i}=s),({byteOffset:r,byteLength:o}=a),n+i<r||r+o<n?a&&(e[++c]=a):e[c]=new Uint8Array(s.buffer,n,r-n+o));return e}(t),r=n.reduce(((t,e)=>t+e.byteLength),0);let i,o,s,a=0,u=-1;const c=Math.min(e||Number.POSITIVE_INFINITY,r);for(const t=n.length;++u<t;){if(i=n[u],o=i.subarray(0,Math.min(i.length,c-a)),c<=a+o.length){o.length<i.length?n[u]=i.subarray(o.length):o.length===i.length&&u++,s?_i(s,o,a):s=o;break}_i(s||(s=new Uint8Array(c)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(u),r-(s?s.byteLength:0)]}function Si(t,e){let n=di(e)?e.value:e;return n instanceof t?t===Uint8Array?new t(n.buffer,n.byteOffset,n.byteLength):n:n?("string"==typeof n&&(n=ti(n)),n instanceof ArrayBuffer||n instanceof wi?new t(n):gi(n)?Si(t,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new t(0):new t(n.buffer,n.byteOffset,n.byteLength/t.BYTES_PER_ELEMENT):t.from(n)):new t(0)}const Oi=t=>Si(Int32Array,t),Ii=t=>Si(Uint8Array,t),Ti=t=>(t.next(),t);function Ai(t,e){return Hr(this,arguments,(function*(){if(ci(e))return yield Zr(yield Zr(yield*qr(Xr(Ai(t,yield Zr(e))))));const n=function(t){return Hr(this,arguments,(function*(){yield yield Zr(yield Zr(t))}))},r="string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof wi?n(e):li(e)?function(t){return Hr(this,arguments,(function*(){yield Zr(yield*qr(Xr(Ti(function*(t){let e=null;do{e=t.next(yield null==e?void 0:e.value)}while(!e.done)}(t[Symbol.iterator]())))))}))}(e):fi(e)?e:n(e);return yield Zr(yield*qr(Xr(Ti(function(e){return Hr(this,arguments,(function*(){let n=null;do{n=yield Zr(e.next(yield yield Zr(Si(t,n))))}while(!n.done)}))}(r[Symbol.asyncIterator]()))))),yield Zr(new t)}))}const Mi=Symbol.for("isArrowBigNum");function Ei(t,...e){return 0===e.length?Object.setPrototypeOf(Si(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}function Ci(...t){return Ei.apply(this,t)}function Pi(...t){return Ei.apply(this,t)}function ji(...t){return Ei.apply(this,t)}function ki(t){const{buffer:e,byteOffset:n,length:r,signed:i}=t,o=new oi(e,n,r),s=i&&o[o.length-1]&BigInt(1)<<BigInt(63);let a=s?BigInt(1):BigInt(0),u=BigInt(0);if(s){for(const t of o)a+=~t*(BigInt(1)<<BigInt(32)*u++);a*=BigInt(-1)}else for(const t of o)a+=t*(BigInt(1)<<BigInt(32)*u++);return a}let Bi,Fi;function Li(t){let e="";const n=new Uint32Array(2);let r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);const i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer);let o=-1;const s=r.length-1;do{for(n[0]=r[o=0];o<s;)r[o++]=n[1]=n[0]/10,n[0]=(n[0]-10*n[1]<<16)+r[o];r[o]=n[1]=n[0]/10,n[0]=n[0]-10*n[1],e=`${n[0]}${e}`}while(i[0]||i[1]||i[2]||i[3]);return null!=e?e:"0"}Ei.prototype[Mi]=!0,Ei.prototype.toJSON=function(){return`"${Bi(this)}"`},Ei.prototype.valueOf=function(){return ki(this)},Ei.prototype.toString=function(){return Bi(this)},Ei.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return ki(this);case"string":return Bi(this);case"default":return Fi(this)}return Bi(this)},Object.setPrototypeOf(Ci.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Pi.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(ji.prototype,Object.create(Uint32Array.prototype)),Object.assign(Ci.prototype,Ei.prototype,{constructor:Ci,signed:!0,TypedArray:Int32Array,BigIntArray:ri}),Object.assign(Pi.prototype,Ei.prototype,{constructor:Pi,signed:!1,TypedArray:Uint32Array,BigIntArray:oi}),Object.assign(ji.prototype,Ei.prototype,{constructor:ji,signed:!0,TypedArray:Uint32Array,BigIntArray:oi}),ni?(Fi=t=>8===t.byteLength?new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:Li(t),Bi=t=>8===t.byteLength?`${new t.BigIntArray(t.buffer,t.byteOffset,1)[0]}`:Li(t)):(Bi=Li,Fi=Bi);class Di{static new(t,e){switch(e){case!0:return new Ci(t);case!1:return new Pi(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case ri:return new Ci(t)}return 16===t.byteLength?new ji(t):new Pi(t)}static signed(t){return new Ci(t)}static unsigned(t){return new Pi(t)}static decimal(t){return new ji(t)}constructor(t,e){return Di.new(t,e)}}var Ni,Ri,zi,Ui,Vi,Wi,$i,Gi,Yi,Zi,Hi,qi,Xi,Ki,Ji,Qi,to,eo,no,ro;class io{static isNull(t){return(null==t?void 0:t.typeId)===Fr.Null}static isInt(t){return(null==t?void 0:t.typeId)===Fr.Int}static isFloat(t){return(null==t?void 0:t.typeId)===Fr.Float}static isBinary(t){return(null==t?void 0:t.typeId)===Fr.Binary}static isUtf8(t){return(null==t?void 0:t.typeId)===Fr.Utf8}static isBool(t){return(null==t?void 0:t.typeId)===Fr.Bool}static isDecimal(t){return(null==t?void 0:t.typeId)===Fr.Decimal}static isDate(t){return(null==t?void 0:t.typeId)===Fr.Date}static isTime(t){return(null==t?void 0:t.typeId)===Fr.Time}static isTimestamp(t){return(null==t?void 0:t.typeId)===Fr.Timestamp}static isInterval(t){return(null==t?void 0:t.typeId)===Fr.Interval}static isList(t){return(null==t?void 0:t.typeId)===Fr.List}static isStruct(t){return(null==t?void 0:t.typeId)===Fr.Struct}static isUnion(t){return(null==t?void 0:t.typeId)===Fr.Union}static isFixedSizeBinary(t){return(null==t?void 0:t.typeId)===Fr.FixedSizeBinary}static isFixedSizeList(t){return(null==t?void 0:t.typeId)===Fr.FixedSizeList}static isMap(t){return(null==t?void 0:t.typeId)===Fr.Map}static isDictionary(t){return(null==t?void 0:t.typeId)===Fr.Dictionary}static isDenseUnion(t){return io.isUnion(t)&&t.mode===Er.Dense}static isSparseUnion(t){return io.isUnion(t)&&t.mode===Er.Sparse}get typeId(){return Fr.NONE}}Ni=Symbol.toStringTag,io[Ni]=((ro=io.prototype).children=null,ro.ArrayType=Array,ro[Symbol.toStringTag]="DataType");class oo extends io{toString(){return"Null"}get typeId(){return Fr.Null}}Ri=Symbol.toStringTag,oo[Ri]=(t=>t[Symbol.toStringTag]="Null")(oo.prototype);class so extends io{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return Fr.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}zi=Symbol.toStringTag,so[zi]=(t=>(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(so.prototype);class ao extends so{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(class extends so{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(class extends so{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(ao.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(class extends so{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}}.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty(class extends so{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(class extends so{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(class extends so{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(class extends so{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}}.prototype,"ArrayType",{value:BigUint64Array});class uo extends io{constructor(t){super(),this.precision=t}get typeId(){return Fr.Float}get ArrayType(){switch(this.precision){case Cr.HALF:return Uint16Array;case Cr.SINGLE:return Float32Array;case Cr.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Ui=Symbol.toStringTag,uo[Ui]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(uo.prototype),Object.defineProperty(class extends uo{constructor(){super(Cr.HALF)}}.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(class extends uo{constructor(){super(Cr.SINGLE)}}.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(class extends uo{constructor(){super(Cr.DOUBLE)}}.prototype,"ArrayType",{value:Float64Array});class co extends io{constructor(){super()}get typeId(){return Fr.Binary}toString(){return"Binary"}}Vi=Symbol.toStringTag,co[Vi]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(co.prototype);class lo extends io{constructor(){super()}get typeId(){return Fr.Utf8}toString(){return"Utf8"}}Wi=Symbol.toStringTag,lo[Wi]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(lo.prototype);class fo extends io{constructor(){super()}get typeId(){return Fr.Bool}toString(){return"Bool"}}$i=Symbol.toStringTag,fo[$i]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(fo.prototype);class ho extends io{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return Fr.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}Gi=Symbol.toStringTag,ho[Gi]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(ho.prototype);class po extends io{constructor(t){super(),this.unit=t}get typeId(){return Fr.Date}toString(){return`Date${32*(this.unit+1)}<${Pr[this.unit]}>`}}Yi=Symbol.toStringTag,po[Yi]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Date"))(po.prototype);class yo extends io{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return Fr.Time}toString(){return`Time${this.bitWidth}<${jr[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}Zi=Symbol.toStringTag,yo[Zi]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(yo.prototype);class vo extends io{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return Fr.Timestamp}toString(){return`Timestamp<${jr[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Hi=Symbol.toStringTag,vo[Hi]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Timestamp"))(vo.prototype);class bo extends io{constructor(t){super(),this.unit=t}get typeId(){return Fr.Interval}toString(){return`Interval<${kr[this.unit]}>`}}qi=Symbol.toStringTag,bo[qi]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(bo.prototype);class mo extends io{constructor(t){super(),this.children=[t]}get typeId(){return Fr.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}Xi=Symbol.toStringTag,mo[Xi]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(mo.prototype);class go extends io{constructor(t){super(),this.children=t}get typeId(){return Fr.Struct}toString(){return`Struct<{${this.children.map((t=>`${t.name}:${t.type}`)).join(", ")}}>`}}Ki=Symbol.toStringTag,go[Ki]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))(go.prototype);class wo extends io{constructor(t,e,n){super(),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce(((t,e,n)=>(t[e]=n)&&t||t),Object.create(null))}get typeId(){return Fr.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map((t=>`${t.type}`)).join(" | ")}>`}}Ji=Symbol.toStringTag,wo[Ji]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(wo.prototype);class _o extends io{constructor(t){super(),this.byteWidth=t}get typeId(){return Fr.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Qi=Symbol.toStringTag,_o[Qi]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(_o.prototype);class xo extends io{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return Fr.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}to=Symbol.toStringTag,xo[to]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(xo.prototype);class So extends io{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return Fr.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map((t=>`${t.name}:${t.type}`)).join(", ")}}>`}}eo=Symbol.toStringTag,So[eo]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(So.prototype);const Oo=(Io=-1,()=>++Io);var Io;class To extends io{constructor(t,e,n,r){super(),this.indices=e,this.dictionary=t,this.isOrdered=r||!1,this.id=null==n?Oo():"number"==typeof n?n:n.low}get typeId(){return Fr.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}function Ao(t){const e=t;switch(t.typeId){case Fr.Decimal:return t.bitWidth/32;case Fr.Timestamp:return 2;case Fr.Date:case Fr.Interval:return 1+e.unit;case Fr.FixedSizeList:return e.listSize;case Fr.FixedSizeBinary:return e.byteWidth;default:return 1}}no=Symbol.toStringTag,To[no]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(To.prototype);class Mo{visitMany(t,...e){return t.map(((t,n)=>this.visit(t,...e.map((t=>t[n])))))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return function(t,e,n=!0){return"number"==typeof e?Eo(t,e,n):"string"==typeof e&&e in Fr?Eo(t,Fr[e],n):e&&e instanceof io?Eo(t,Co(e),n):(null==e?void 0:e.type)&&e.type instanceof io?Eo(t,Co(e.type),n):Eo(t,Fr.NONE,n)}(this,t,e)}getVisitFnByTypeId(t,e=!0){return Eo(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function Eo(t,e,n=!0){let r=null;switch(e){case Fr.Null:r=t.visitNull;break;case Fr.Bool:r=t.visitBool;break;case Fr.Int:r=t.visitInt;break;case Fr.Int8:r=t.visitInt8||t.visitInt;break;case Fr.Int16:r=t.visitInt16||t.visitInt;break;case Fr.Int32:r=t.visitInt32||t.visitInt;break;case Fr.Int64:r=t.visitInt64||t.visitInt;break;case Fr.Uint8:r=t.visitUint8||t.visitInt;break;case Fr.Uint16:r=t.visitUint16||t.visitInt;break;case Fr.Uint32:r=t.visitUint32||t.visitInt;break;case Fr.Uint64:r=t.visitUint64||t.visitInt;break;case Fr.Float:r=t.visitFloat;break;case Fr.Float16:r=t.visitFloat16||t.visitFloat;break;case Fr.Float32:r=t.visitFloat32||t.visitFloat;break;case Fr.Float64:r=t.visitFloat64||t.visitFloat;break;case Fr.Utf8:r=t.visitUtf8;break;case Fr.Binary:r=t.visitBinary;break;case Fr.FixedSizeBinary:r=t.visitFixedSizeBinary;break;case Fr.Date:r=t.visitDate;break;case Fr.DateDay:r=t.visitDateDay||t.visitDate;break;case Fr.DateMillisecond:r=t.visitDateMillisecond||t.visitDate;break;case Fr.Timestamp:r=t.visitTimestamp;break;case Fr.TimestampSecond:r=t.visitTimestampSecond||t.visitTimestamp;break;case Fr.TimestampMillisecond:r=t.visitTimestampMillisecond||t.visitTimestamp;break;case Fr.TimestampMicrosecond:r=t.visitTimestampMicrosecond||t.visitTimestamp;break;case Fr.TimestampNanosecond:r=t.visitTimestampNanosecond||t.visitTimestamp;break;case Fr.Time:r=t.visitTime;break;case Fr.TimeSecond:r=t.visitTimeSecond||t.visitTime;break;case Fr.TimeMillisecond:r=t.visitTimeMillisecond||t.visitTime;break;case Fr.TimeMicrosecond:r=t.visitTimeMicrosecond||t.visitTime;break;case Fr.TimeNanosecond:r=t.visitTimeNanosecond||t.visitTime;break;case Fr.Decimal:r=t.visitDecimal;break;case Fr.List:r=t.visitList;break;case Fr.Struct:r=t.visitStruct;break;case Fr.Union:r=t.visitUnion;break;case Fr.DenseUnion:r=t.visitDenseUnion||t.visitUnion;break;case Fr.SparseUnion:r=t.visitSparseUnion||t.visitUnion;break;case Fr.Dictionary:r=t.visitDictionary;break;case Fr.Interval:r=t.visitInterval;break;case Fr.IntervalDayTime:r=t.visitIntervalDayTime||t.visitInterval;break;case Fr.IntervalYearMonth:r=t.visitIntervalYearMonth||t.visitInterval;break;case Fr.FixedSizeList:r=t.visitFixedSizeList;break;case Fr.Map:r=t.visitMap}if("function"==typeof r)return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${Fr[e]}'`)}function Co(t){switch(t.typeId){case Fr.Null:return Fr.Null;case Fr.Int:{const{bitWidth:e,isSigned:n}=t;switch(e){case 8:return n?Fr.Int8:Fr.Uint8;case 16:return n?Fr.Int16:Fr.Uint16;case 32:return n?Fr.Int32:Fr.Uint32;case 64:return n?Fr.Int64:Fr.Uint64}return Fr.Int}case Fr.Float:switch(t.precision){case Cr.HALF:return Fr.Float16;case Cr.SINGLE:return Fr.Float32;case Cr.DOUBLE:return Fr.Float64}return Fr.Float;case Fr.Binary:return Fr.Binary;case Fr.Utf8:return Fr.Utf8;case Fr.Bool:return Fr.Bool;case Fr.Decimal:return Fr.Decimal;case Fr.Time:switch(t.unit){case jr.SECOND:return Fr.TimeSecond;case jr.MILLISECOND:return Fr.TimeMillisecond;case jr.MICROSECOND:return Fr.TimeMicrosecond;case jr.NANOSECOND:return Fr.TimeNanosecond}return Fr.Time;case Fr.Timestamp:switch(t.unit){case jr.SECOND:return Fr.TimestampSecond;case jr.MILLISECOND:return Fr.TimestampMillisecond;case jr.MICROSECOND:return Fr.TimestampMicrosecond;case jr.NANOSECOND:return Fr.TimestampNanosecond}return Fr.Timestamp;case Fr.Date:switch(t.unit){case Pr.DAY:return Fr.DateDay;case Pr.MILLISECOND:return Fr.DateMillisecond}return Fr.Date;case Fr.Interval:switch(t.unit){case kr.DAY_TIME:return Fr.IntervalDayTime;case kr.YEAR_MONTH:return Fr.IntervalYearMonth}return Fr.Interval;case Fr.Map:return Fr.Map;case Fr.List:return Fr.List;case Fr.Struct:return Fr.Struct;case Fr.Union:switch(t.mode){case Er.Dense:return Fr.DenseUnion;case Er.Sparse:return Fr.SparseUnion}return Fr.Union;case Fr.FixedSizeBinary:return Fr.FixedSizeBinary;case Fr.FixedSizeList:return Fr.FixedSizeList;case Fr.Dictionary:return Fr.Dictionary}throw new Error(`Unrecognized type '${Fr[t.typeId]}'`)}Mo.prototype.visitInt8=null,Mo.prototype.visitInt16=null,Mo.prototype.visitInt32=null,Mo.prototype.visitInt64=null,Mo.prototype.visitUint8=null,Mo.prototype.visitUint16=null,Mo.prototype.visitUint32=null,Mo.prototype.visitUint64=null,Mo.prototype.visitFloat16=null,Mo.prototype.visitFloat32=null,Mo.prototype.visitFloat64=null,Mo.prototype.visitDateDay=null,Mo.prototype.visitDateMillisecond=null,Mo.prototype.visitTimestampSecond=null,Mo.prototype.visitTimestampMillisecond=null,Mo.prototype.visitTimestampMicrosecond=null,Mo.prototype.visitTimestampNanosecond=null,Mo.prototype.visitTimeSecond=null,Mo.prototype.visitTimeMillisecond=null,Mo.prototype.visitTimeMicrosecond=null,Mo.prototype.visitTimeNanosecond=null,Mo.prototype.visitDenseUnion=null,Mo.prototype.visitSparseUnion=null,Mo.prototype.visitIntervalDayTime=null,Mo.prototype.visitIntervalYearMonth=null;const Po=new Float64Array(1),jo=new Uint32Array(Po.buffer);function ko(t){const e=(31744&t)>>10,n=(1023&t)/1024,r=Math.pow(-1,(32768&t)>>15);switch(e){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,e-15)*(1+n)}class Bo extends Mo{}function Fo(t){return(e,n,r)=>{if(e.setValid(n,null!=r))return t(e,n,r)}}const Lo=(t,e,n)=>{t[e]=Math.trunc(n%4294967296),t[e+1]=Math.trunc(n/4294967296)},Do=(t,e,n,r)=>{if(n+1<e.length){const{[n]:i,[n+1]:o}=e;t.set(r.subarray(0,o-i),i)}},No=({values:t},e,n)=>{t[e]=n},Ro=({values:t},e,n)=>{t[e]=n},zo=({values:t},e,n)=>{t[e]=function(t){if(t!=t)return 32256;Po[0]=t;const e=(2147483648&jo[1])>>16&65535;let n=2146435072&jo[1],r=0;return n>=1089470464?jo[0]>0?n=31744:(n=(2080374784&n)>>16,r=(1048575&jo[1])>>10):n<=1056964608?(r=1048576+(1048575&jo[1]),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=512+(1048575&jo[1])>>10),e|n|65535&r}(n)},Uo=({values:t},e,n)=>{((t,e,n)=>{t[e]=Math.trunc(n/864e5)})(t,e,n.valueOf())},Vo=({values:t},e,n)=>{Lo(t,2*e,n.valueOf())},Wo=({values:t},e,n)=>Lo(t,2*e,n/1e3),$o=({values:t},e,n)=>Lo(t,2*e,n),Go=({values:t},e,n)=>((t,e,n)=>{t[e]=Math.trunc(1e3*n%4294967296),t[e+1]=Math.trunc(1e3*n/4294967296)})(t,2*e,n),Yo=({values:t},e,n)=>((t,e,n)=>{t[e]=Math.trunc(1e6*n%4294967296),t[e+1]=Math.trunc(1e6*n/4294967296)})(t,2*e,n),Zo=({values:t},e,n)=>{t[e]=n},Ho=({values:t},e,n)=>{t[e]=n},qo=({values:t},e,n)=>{t[e]=n},Xo=({values:t},e,n)=>{t[e]=n},Ko=(t,e,n)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[r];es.visit(i,t.valueOffsets[e],n)},Jo=(t,e,n)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[r];es.visit(i,e,n)},Qo=({values:t},e,n)=>{t.set(n.subarray(0,2),2*e)},ts=({values:t},e,n)=>{t[e]=12*n[0]+n[1]%12};Bo.prototype.visitBool=Fo((({offset:t,values:e},n,r)=>{const i=t+n;r?e[i>>3]|=1<<i%8:e[i>>3]&=~(1<<i%8)})),Bo.prototype.visitInt=Fo(No),Bo.prototype.visitInt8=Fo(No),Bo.prototype.visitInt16=Fo(No),Bo.prototype.visitInt32=Fo(No),Bo.prototype.visitInt64=Fo(No),Bo.prototype.visitUint8=Fo(No),Bo.prototype.visitUint16=Fo(No),Bo.prototype.visitUint32=Fo(No),Bo.prototype.visitUint64=Fo(No),Bo.prototype.visitFloat=Fo(((t,e,n)=>{switch(t.type.precision){case Cr.HALF:return zo(t,e,n);case Cr.SINGLE:case Cr.DOUBLE:return Ro(t,e,n)}})),Bo.prototype.visitFloat16=Fo(zo),Bo.prototype.visitFloat32=Fo(Ro),Bo.prototype.visitFloat64=Fo(Ro),Bo.prototype.visitUtf8=Fo((({values:t,valueOffsets:e},n,r)=>{Do(t,e,n,ti(r))})),Bo.prototype.visitBinary=Fo((({values:t,valueOffsets:e},n,r)=>Do(t,e,n,r))),Bo.prototype.visitFixedSizeBinary=Fo((({stride:t,values:e},n,r)=>{e.set(r.subarray(0,t),t*n)})),Bo.prototype.visitDate=Fo(((t,e,n)=>{t.type.unit===Pr.DAY?Uo(t,e,n):Vo(t,e,n)})),Bo.prototype.visitDateDay=Fo(Uo),Bo.prototype.visitDateMillisecond=Fo(Vo),Bo.prototype.visitTimestamp=Fo(((t,e,n)=>{switch(t.type.unit){case jr.SECOND:return Wo(t,e,n);case jr.MILLISECOND:return $o(t,e,n);case jr.MICROSECOND:return Go(t,e,n);case jr.NANOSECOND:return Yo(t,e,n)}})),Bo.prototype.visitTimestampSecond=Fo(Wo),Bo.prototype.visitTimestampMillisecond=Fo($o),Bo.prototype.visitTimestampMicrosecond=Fo(Go),Bo.prototype.visitTimestampNanosecond=Fo(Yo),Bo.prototype.visitTime=Fo(((t,e,n)=>{switch(t.type.unit){case jr.SECOND:return Zo(t,e,n);case jr.MILLISECOND:return Ho(t,e,n);case jr.MICROSECOND:return qo(t,e,n);case jr.NANOSECOND:return Xo(t,e,n)}})),Bo.prototype.visitTimeSecond=Fo(Zo),Bo.prototype.visitTimeMillisecond=Fo(Ho),Bo.prototype.visitTimeMicrosecond=Fo(qo),Bo.prototype.visitTimeNanosecond=Fo(Xo),Bo.prototype.visitDecimal=Fo((({values:t,stride:e},n,r)=>{t.set(r.subarray(0,e),e*n)})),Bo.prototype.visitList=Fo(((t,e,n)=>{const r=t.children[0],i=t.valueOffsets,o=es.getVisitFn(r);if(Array.isArray(n))for(let t=-1,s=i[e],a=i[e+1];s<a;)o(r,s++,n[++t]);else for(let t=-1,s=i[e],a=i[e+1];s<a;)o(r,s++,n.get(++t))})),Bo.prototype.visitStruct=Fo(((t,e,n)=>{const r=t.type.children.map((t=>es.getVisitFn(t.type))),i=n instanceof Map?(o=e,s=n,(t,e,n,r)=>e&&t(e,o,s.get(n.name))):n instanceof ba?((t,e)=>(n,r,i,o)=>r&&n(r,t,e.get(o)))(e,n):Array.isArray(n)?((t,e)=>(n,r,i,o)=>r&&n(r,t,e[o]))(e,n):((t,e)=>(n,r,i,o)=>r&&n(r,t,e[i.name]))(e,n);var o,s;t.type.children.forEach(((e,n)=>i(r[n],t.children[n],e,n)))})),Bo.prototype.visitUnion=Fo(((t,e,n)=>{t.type.mode===Er.Dense?Ko(t,e,n):Jo(t,e,n)})),Bo.prototype.visitDenseUnion=Fo(Ko),Bo.prototype.visitSparseUnion=Fo(Jo),Bo.prototype.visitDictionary=Fo(((t,e,n)=>{var r;null===(r=t.dictionary)||void 0===r||r.set(t.values[e],n)})),Bo.prototype.visitInterval=Fo(((t,e,n)=>{t.type.unit===kr.DAY_TIME?Qo(t,e,n):ts(t,e,n)})),Bo.prototype.visitIntervalDayTime=Fo(Qo),Bo.prototype.visitIntervalYearMonth=Fo(ts),Bo.prototype.visitFixedSizeList=Fo(((t,e,n)=>{const{stride:r}=t,i=t.children[0],o=es.getVisitFn(i);if(Array.isArray(n))for(let t=-1,s=e*r;++t<r;)o(i,s+t,n[t]);else for(let t=-1,s=e*r;++t<r;)o(i,s+t,n.get(t))})),Bo.prototype.visitMap=Fo(((t,e,n)=>{const r=t.children[0],{valueOffsets:i}=t,o=es.getVisitFn(r);let{[e]:s,[e+1]:a}=i;const u=n instanceof Map?n.entries():Object.entries(n);for(const t of u)if(o(r,s,t),++s>=a)break}));const es=new Bo,ns=Symbol.for("parent"),rs=Symbol.for("rowIndex");class is{constructor(t,e){return this[ns]=t,this[rs]=e,new Proxy(this,new ss)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[rs],e=this[ns],n=e.type.children,r={};for(let i=-1,o=n.length;++i<o;)r[n[i].name]=Ms.visit(e.children[i],t);return r}toString(){return`{${[...this].map((([t,e])=>`${Gr(t)}: ${Gr(e)}`)).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new os(this[ns],this[rs])}}class os{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Ms.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(is.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ns]:{writable:!0,enumerable:!1,configurable:!1,value:null},[rs]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class ss{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ns].type.children.map((t=>t.name))}has(t,e){return-1!==t[ns].type.children.findIndex((t=>t.name===e))}getOwnPropertyDescriptor(t,e){if(-1!==t[ns].type.children.findIndex((t=>t.name===e)))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[ns].type.children.findIndex((t=>t.name===e));if(-1!==n){const r=Ms.visit(t[ns].children[n],t[rs]);return Reflect.set(t,e,r),r}}set(t,e,n){const r=t[ns].type.children.findIndex((t=>t.name===e));return-1!==r?(es.visit(t[ns].children[r],t[rs],n),Reflect.set(t,e,n)):!(!Reflect.has(t,e)&&"symbol"!=typeof e)&&Reflect.set(t,e,n)}}class as extends Mo{}function us(t){return(e,n)=>e.getValid(n)?t(e,n):null}const cs=(t,e)=>4294967296*t[e+1]+(t[e]>>>0),ls=t=>new Date(t),fs=(t,e,n)=>{if(n+1>=e.length)return null;const r=e[n],i=e[n+1];return t.subarray(r,i)},hs=({values:t},e)=>((t,e)=>ls(((t,e)=>864e5*t[e])(t,e)))(t,e),ds=({values:t},e)=>((t,e)=>ls(cs(t,e)))(t,2*e),ps=({stride:t,values:e},n)=>e[t*n],ys=({values:t},e)=>t[e],vs=({values:t},e)=>1e3*cs(t,2*e),bs=({values:t},e)=>cs(t,2*e),ms=({values:t},e)=>((t,e)=>t[e+1]/1e3*4294967296+(t[e]>>>0)/1e3)(t,2*e),gs=({values:t},e)=>((t,e)=>t[e+1]/1e6*4294967296+(t[e]>>>0)/1e6)(t,2*e),ws=({values:t},e)=>t[e],_s=({values:t},e)=>t[e],xs=({values:t},e)=>t[e],Ss=({values:t},e)=>t[e],Os=(t,e)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];return Ms.visit(r,t.valueOffsets[e])},Is=(t,e)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];return Ms.visit(r,e)},Ts=({values:t},e)=>t.subarray(2*e,2*(e+1)),As=({values:t},e)=>{const n=t[e],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r};as.prototype.visitNull=us(((t,e)=>null)),as.prototype.visitBool=us((({offset:t,values:e},n)=>{const r=t+n;return 0!=(e[r>>3]&1<<r%8)})),as.prototype.visitInt=us((({values:t},e)=>t[e])),as.prototype.visitInt8=us(ps),as.prototype.visitInt16=us(ps),as.prototype.visitInt32=us(ps),as.prototype.visitInt64=us(ys),as.prototype.visitUint8=us(ps),as.prototype.visitUint16=us(ps),as.prototype.visitUint32=us(ps),as.prototype.visitUint64=us(ys),as.prototype.visitFloat=us((({type:t,values:e},n)=>t.precision!==Cr.HALF?e[n]:ko(e[n]))),as.prototype.visitFloat16=us((({stride:t,values:e},n)=>ko(e[t*n]))),as.prototype.visitFloat32=us(ps),as.prototype.visitFloat64=us(ps),as.prototype.visitUtf8=us((({values:t,valueOffsets:e},n)=>{const r=fs(t,e,n);return null!==r?Jr(r):null})),as.prototype.visitBinary=us((({values:t,valueOffsets:e},n)=>fs(t,e,n))),as.prototype.visitFixedSizeBinary=us((({stride:t,values:e},n)=>e.subarray(t*n,t*(n+1)))),as.prototype.visitDate=us(((t,e)=>t.type.unit===Pr.DAY?hs(t,e):ds(t,e))),as.prototype.visitDateDay=us(hs),as.prototype.visitDateMillisecond=us(ds),as.prototype.visitTimestamp=us(((t,e)=>{switch(t.type.unit){case jr.SECOND:return vs(t,e);case jr.MILLISECOND:return bs(t,e);case jr.MICROSECOND:return ms(t,e);case jr.NANOSECOND:return gs(t,e)}})),as.prototype.visitTimestampSecond=us(vs),as.prototype.visitTimestampMillisecond=us(bs),as.prototype.visitTimestampMicrosecond=us(ms),as.prototype.visitTimestampNanosecond=us(gs),as.prototype.visitTime=us(((t,e)=>{switch(t.type.unit){case jr.SECOND:return ws(t,e);case jr.MILLISECOND:return _s(t,e);case jr.MICROSECOND:return xs(t,e);case jr.NANOSECOND:return Ss(t,e)}})),as.prototype.visitTimeSecond=us(ws),as.prototype.visitTimeMillisecond=us(_s),as.prototype.visitTimeMicrosecond=us(xs),as.prototype.visitTimeNanosecond=us(Ss),as.prototype.visitDecimal=us((({values:t,stride:e},n)=>Di.decimal(t.subarray(e*n,e*(n+1))))),as.prototype.visitList=us(((t,e)=>{const{valueOffsets:n,stride:r,children:i}=t,{[e*r]:o,[e*r+1]:s}=n,a=i[0].slice(o,s-o);return new ba([a])})),as.prototype.visitStruct=us(((t,e)=>new is(t,e))),as.prototype.visitUnion=us(((t,e)=>t.type.mode===Er.Dense?Os(t,e):Is(t,e))),as.prototype.visitDenseUnion=us(Os),as.prototype.visitSparseUnion=us(Is),as.prototype.visitDictionary=us(((t,e)=>{var n;return null===(n=t.dictionary)||void 0===n?void 0:n.get(t.values[e])})),as.prototype.visitInterval=us(((t,e)=>t.type.unit===kr.DAY_TIME?Ts(t,e):As(t,e))),as.prototype.visitIntervalDayTime=us(Ts),as.prototype.visitIntervalYearMonth=us(As),as.prototype.visitFixedSizeList=us(((t,e)=>{const{stride:n,children:r}=t,i=r[0].slice(e*n,n);return new ba([i])})),as.prototype.visitMap=us(((t,e)=>{const{valueOffsets:n,children:r}=t,{[e]:i,[e+1]:o}=n,s=r[0];return new Ps(s.slice(i,o-i))}));const Ms=new as,Es=Symbol.for("keys"),Cs=Symbol.for("vals");class Ps{constructor(t){return this[Es]=new ba([t.children[0]]).memoize(),this[Cs]=t.children[1],new Proxy(this,new ks)}[Symbol.iterator](){return new js(this[Es],this[Cs])}get size(){return this[Es].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Es],e=this[Cs],n={};for(let r=-1,i=t.length;++r<i;)n[t.get(r)]=Ms.visit(e,r);return n}toString(){return`{${[...this].map((([t,e])=>`${Gr(t)}: ${Gr(e)}`)).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class js{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Ms.visit(this.vals,t)]})}}class ks{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Es].toArray().map(String)}has(t,e){return t[Es].includes(e)}getOwnPropertyDescriptor(t,e){if(-1!==t[Es].indexOf(e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[Es].indexOf(e);if(-1!==n){const r=Ms.visit(Reflect.get(t,Cs),n);return Reflect.set(t,e,r),r}}set(t,e,n){const r=t[Es].indexOf(e);return-1!==r?(es.visit(Reflect.get(t,Cs),r,n),Reflect.set(t,e,n)):!!Reflect.has(t,e)&&Reflect.set(t,e,n)}}let Bs;function Fs(t,e,n,r){const{length:i=0}=t;let o="number"!=typeof e?0:e,s="number"!=typeof n?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(Bs=o,o=s,s=Bs),s>i&&(s=i),r?r(t,o,s):[o,s]}Object.defineProperties(Ps.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Es]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Cs]:{writable:!0,enumerable:!1,configurable:!1,value:null}});const Ls=t=>t!=t;function Ds(t){if("object"!=typeof t||null===t)return Ls(t)?Ls:e=>e===t;if(t instanceof Date){const e=t.valueOf();return t=>t instanceof Date&&t.valueOf()===e}return ArrayBuffer.isView(t)?e=>!!e&&function(t,e){let n=0;const r=t.length;if(r!==e.length)return!1;if(r>0)do{if(t[n]!==e[n])return!1}while(++n<r);return!0}(t,e):t instanceof Map?function(t){let e=-1;const n=[];for(const r of t.values())n[++e]=Ds(r);return Ns(n)}(t):Array.isArray(t)?function(t){const e=[];for(let n=-1,r=t.length;++n<r;)e[n]=Ds(t[n]);return Ns(e)}(t):t instanceof ba?function(t){const e=[];for(let n=-1,r=t.length;++n<r;)e[n]=Ds(t.get(n));return Ns(e)}(t):function(t,e=!1){const n=Object.keys(t);if(!e&&0===n.length)return()=>!1;const r=[];for(let e=-1,i=n.length;++e<i;)r[e]=Ds(t[n[e]]);return Ns(r,n)}(t,!0)}function Ns(t,e){return n=>{if(!n||"object"!=typeof n)return!1;switch(n.constructor){case Array:return function(t,e){const n=t.length;if(e.length!==n)return!1;for(let r=-1;++r<n;)if(!t[r](e[r]))return!1;return!0}(t,n);case Map:return Rs(t,n,n.keys());case Ps:case is:case Object:case void 0:return Rs(t,n,e||Object.keys(n))}return n instanceof ba&&function(t,e){const n=t.length;if(e.length!==n)return!1;for(let r=-1;++r<n;)if(!t[r](e.get(r)))return!1;return!0}(t,n)}}function Rs(t,e,n){const r=n[Symbol.iterator](),i=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),o=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let s=0;const a=t.length;let u=o.next(),c=r.next(),l=i.next();for(;s<a&&!c.done&&!l.done&&!u.done&&c.value===l.value&&t[s](u.value);++s,c=r.next(),l=i.next(),u=o.next());return!!(s===a&&c.done&&l.done&&u.done)||(r.return&&r.return(),i.return&&i.return(),o.return&&o.return(),!1)}class zs{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function Us(t){return t.reduce(((t,e)=>t+e.nullCount),0)}function Vs(t){return t.reduce(((t,e,n)=>(t[n+1]=t[n]+e.length,t)),new Uint32Array(t.length+1))}function Ws(t,e,n,r){const i=[];for(let o=-1,s=t.length;++o<s;){const s=t[o],a=e[o],{length:u}=s;if(a>=r)break;if(n>=a+u)continue;if(a>=n&&a+u<=r){i.push(s);continue}const c=Math.max(0,n-a),l=Math.min(r-a,u);i.push(s.slice(c,l-c))}return 0===i.length&&i.push(t[0].slice(0,0)),i}function $s(t,e,n,r){let i=0,o=0,s=e.length-1;do{if(i>=s-1)return n<e[s]?r(t,i,n-e[i]):null;o=i+Math.trunc(.5*(s-i)),n<e[o]?s=o:i=o}while(i<s)}function Gs(t,e){return t.getValid(e)}function Ys(t){function e(e,n,r){return t(e[n],r)}return function(t){return $s(this.data,this._offsets,t,e)}}function Zs(t){let e;function n(n,r,i){return t(n[r],i,e)}return function(t,r){const i=this.data;e=r;const o=$s(i,this._offsets,t,n);return e=void 0,o}}function Hs(t){let e;function n(n,r,i){let o=i,s=0,a=0;for(let i=r-1,u=n.length;++i<u;){const r=n[i];if(~(s=t(r,e,o)))return a+s;o=0,a+=r.length}return-1}return function(t,r){e=t;const i=this.data,o="number"!=typeof r?n(i,0,0):$s(i,this._offsets,r,n);return e=void 0,o}}function qs(t,e,n,r){return 0!=(n&1<<r)}function Xs(t,e,n,r){return(n&1<<r)>>r}function Ks(t){const e=[];let n=0,r=0,i=0;for(const o of t)o&&(i|=1<<r),8==++r&&(e[n++]=i,i=r=0);(0===n||r>0)&&(e[n++]=i);const o=new Uint8Array(e.length+7&-8);return o.set(e),o}class Js{constructor(t,e,n,r,i){this.bytes=t,this.length=n,this.context=r,this.get=i,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(8===this.bit&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}function Qs(t,e,n){if(n-e<=0)return 0;if(n-e<8){let r=0;for(const i of new Js(t,e,n-e,t,Xs))r+=i;return r}const r=n>>3<<3,i=e+(e%8==0?0:8-e%8);return Qs(t,e,i)+Qs(t,r,n)+function(t,e,n){let r=0,i=Math.trunc(e);const o=new DataView(t.buffer,t.byteOffset,t.byteLength),s=void 0===n?t.byteLength:i+n;for(;s-i>=4;)r+=ta(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=ta(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=ta(o.getUint8(i)),i+=1;return r}(t,i>>3,r-i>>3)}function ta(t){let e=Math.trunc(t);return e-=e>>>1&1431655765,e=(858993459&e)+(e>>>2&858993459),16843009*(e+(e>>>4)&252645135)>>>24}class ea extends Mo{}function na(t,e,n){if(void 0===e)return-1;if(null===e)return function(t,e){const{nullBitmap:n}=t;if(!n||t.nullCount<=0)return-1;let r=0;for(const i of new Js(n,t.offset+(e||0),t.length,n,qs)){if(!i)return r;++r}return-1}(t,n);const r=Ms.getVisitFn(t),i=Ds(e);for(let e=(n||0)-1,o=t.length;++e<o;)if(i(r(t,e)))return e;return-1}function ra(t,e,n){const r=Ms.getVisitFn(t),i=Ds(e);for(let e=(n||0)-1,o=t.length;++e<o;)if(i(r(t,e)))return e;return-1}ea.prototype.visitNull=function(t,e){return null===e&&t.length>0?0:-1},ea.prototype.visitBool=na,ea.prototype.visitInt=na,ea.prototype.visitInt8=na,ea.prototype.visitInt16=na,ea.prototype.visitInt32=na,ea.prototype.visitInt64=na,ea.prototype.visitUint8=na,ea.prototype.visitUint16=na,ea.prototype.visitUint32=na,ea.prototype.visitUint64=na,ea.prototype.visitFloat=na,ea.prototype.visitFloat16=na,ea.prototype.visitFloat32=na,ea.prototype.visitFloat64=na,ea.prototype.visitUtf8=na,ea.prototype.visitBinary=na,ea.prototype.visitFixedSizeBinary=na,ea.prototype.visitDate=na,ea.prototype.visitDateDay=na,ea.prototype.visitDateMillisecond=na,ea.prototype.visitTimestamp=na,ea.prototype.visitTimestampSecond=na,ea.prototype.visitTimestampMillisecond=na,ea.prototype.visitTimestampMicrosecond=na,ea.prototype.visitTimestampNanosecond=na,ea.prototype.visitTime=na,ea.prototype.visitTimeSecond=na,ea.prototype.visitTimeMillisecond=na,ea.prototype.visitTimeMicrosecond=na,ea.prototype.visitTimeNanosecond=na,ea.prototype.visitDecimal=na,ea.prototype.visitList=na,ea.prototype.visitStruct=na,ea.prototype.visitUnion=na,ea.prototype.visitDenseUnion=ra,ea.prototype.visitSparseUnion=ra,ea.prototype.visitDictionary=na,ea.prototype.visitInterval=na,ea.prototype.visitIntervalDayTime=na,ea.prototype.visitIntervalYearMonth=na,ea.prototype.visitFixedSizeList=na,ea.prototype.visitMap=na;const ia=new ea;class oa extends Mo{}function sa(t){const{type:e}=t;if(0===t.nullCount&&1===t.stride&&(e.typeId===Fr.Timestamp||e instanceof so&&64!==e.bitWidth||e instanceof yo&&64!==e.bitWidth||e instanceof uo&&e.precision!==Cr.HALF))return new zs(t.data.length,(e=>{const n=t.data[e];return n.values.subarray(0,n.length)[Symbol.iterator]()}));let n=0;return new zs(t.data.length,(e=>{const r=t.data[e].length,i=t.slice(n,n+r);return n+=r,new aa(i)}))}class aa{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}oa.prototype.visitNull=sa,oa.prototype.visitBool=sa,oa.prototype.visitInt=sa,oa.prototype.visitInt8=sa,oa.prototype.visitInt16=sa,oa.prototype.visitInt32=sa,oa.prototype.visitInt64=sa,oa.prototype.visitUint8=sa,oa.prototype.visitUint16=sa,oa.prototype.visitUint32=sa,oa.prototype.visitUint64=sa,oa.prototype.visitFloat=sa,oa.prototype.visitFloat16=sa,oa.prototype.visitFloat32=sa,oa.prototype.visitFloat64=sa,oa.prototype.visitUtf8=sa,oa.prototype.visitBinary=sa,oa.prototype.visitFixedSizeBinary=sa,oa.prototype.visitDate=sa,oa.prototype.visitDateDay=sa,oa.prototype.visitDateMillisecond=sa,oa.prototype.visitTimestamp=sa,oa.prototype.visitTimestampSecond=sa,oa.prototype.visitTimestampMillisecond=sa,oa.prototype.visitTimestampMicrosecond=sa,oa.prototype.visitTimestampNanosecond=sa,oa.prototype.visitTime=sa,oa.prototype.visitTimeSecond=sa,oa.prototype.visitTimeMillisecond=sa,oa.prototype.visitTimeMicrosecond=sa,oa.prototype.visitTimeNanosecond=sa,oa.prototype.visitDecimal=sa,oa.prototype.visitList=sa,oa.prototype.visitStruct=sa,oa.prototype.visitUnion=sa,oa.prototype.visitDenseUnion=sa,oa.prototype.visitSparseUnion=sa,oa.prototype.visitDictionary=sa,oa.prototype.visitInterval=sa,oa.prototype.visitIntervalDayTime=sa,oa.prototype.visitIntervalYearMonth=sa,oa.prototype.visitFixedSizeList=sa,oa.prototype.visitMap=sa;const ua=new oa,ca=(t,e)=>t+e;class la extends Mo{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return 4*(t.type.unit+1)}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===jr.SECOND?4:8}visitInterval(t,e){return 4*(t.type.unit+1)}visitStruct(t,e){return t.children.reduce(((t,n)=>t+da.visit(n,e)),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce(((t,n)=>t+da.visit(n,e)),0)}visitDictionary(t,e){var n;return t.type.indices.bitWidth/8+((null===(n=t.dictionary)||void 0===n?void 0:n.getByteLength(t.values[e]))||0)}}const fa=({type:t,children:e,typeIds:n,valueOffsets:r},i)=>{const o=t.typeIdToChildIndex[n[i]];return 8+da.visit(e[o],r[i])},ha=({children:t},e)=>4+da.visitMany(t,t.map((()=>e))).reduce(ca,0);la.prototype.visitUtf8=({valueOffsets:t},e)=>t[e+1]-t[e]+8,la.prototype.visitBinary=({valueOffsets:t},e)=>t[e+1]-t[e]+8,la.prototype.visitList=({valueOffsets:t,stride:e,children:n},r)=>{const i=n[0],{[r*e]:o}=t,{[r*e+1]:s}=t,a=da.getVisitFn(i.type),u=i.slice(o,s-o);let c=8;for(let t=-1,e=s-o;++t<e;)c+=a(u,t);return c},la.prototype.visitFixedSizeList=({stride:t,children:e},n)=>{const r=e[0],i=r.slice(n*t,t),o=da.getVisitFn(r.type);let s=0;for(let t=-1,e=i.length;++t<e;)s+=o(i,t);return s},la.prototype.visitUnion=(t,e)=>t.type.mode===Er.Dense?fa(t,e):ha(t,e),la.prototype.visitDenseUnion=fa,la.prototype.visitSparseUnion=ha;const da=new la;var pa;const ya={},va={};class ba{constructor(t){var e,n,r;const i=t[0]instanceof ba?t.flatMap((t=>t.data)):t;if(0===i.length||i.some((t=>!(t instanceof ga))))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=null===(e=i[0])||void 0===e?void 0:e.type;switch(i.length){case 0:this._offsets=[0];break;case 1:{const{get:t,set:e,indexOf:n,byteLength:r}=ya[o.typeId],s=i[0];this.isValid=t=>Gs(s,t),this.get=e=>t(s,e),this.set=(t,n)=>e(s,t,n),this.indexOf=t=>n(s,t),this.getByteLength=t=>r(s,t),this._offsets=[0,s.length];break}default:Object.setPrototypeOf(this,va[o.typeId]),this._offsets=Vs(i)}this.data=i,this.type=o,this.stride=Ao(o),this.numChildren=null!==(r=null===(n=o.children)||void 0===n?void 0:n.length)&&void 0!==r?r:0,this.length=this._offsets[this._offsets.length-1]}get byteLength(){return-1===this._byteLength&&(this._byteLength=this.data.reduce(((t,e)=>t+e.byteLength),0)),this._byteLength}get nullCount(){return-1===this._nullCount&&(this._nullCount=Us(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${Fr[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>0}getByteLength(t){return 0}[Symbol.iterator](){return ua.visit(this)}concat(...t){return new ba(this.data.concat(t.flatMap((t=>t.data)).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new ba(Fs(this,t,e,(({data:t,_offsets:e},n,r)=>Ws(t,e,n,r))))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:r,ArrayType:i}=this;switch(t.typeId){case Fr.Int:case Fr.Float:case Fr.Decimal:case Fr.Time:case Fr.Timestamp:switch(e.length){case 0:return new i;case 1:return e[0].values.subarray(0,n*r);default:return e.reduce(((t,{values:e})=>(t.array.set(e,t.offset),t.offset+=e.length,t)),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt(null===(e=this.type.children)||void 0===e?void 0:e.findIndex((e=>e.name===t)))}getChildAt(t){return t>-1&&t<this.numChildren?new ba(this.data.map((({children:e})=>e[t]))):null}get isMemoized(){return!!io.isDictionary(this.type)&&this.data[0].dictionary.isMemoized}memoize(){if(io.isDictionary(this.type)){const t=new ma(this.data[0].dictionary),e=this.data.map((e=>{const n=e.clone();return n.dictionary=t,n}));return new ba(e)}return new ma(this)}unmemoize(){if(io.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map((e=>{const n=e.clone();return n.dictionary=t,n}));return new ba(e)}return this}}pa=Symbol.toStringTag,ba[pa]=(t=>{t.type=io.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._nullCount=-1,t._byteLength=-1,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;const e=Object.keys(Fr).map((t=>Fr[t])).filter((t=>"number"==typeof t&&t!==Fr.NONE));for(const n of e){const e=Ms.getVisitFnByTypeId(n),r=es.getVisitFnByTypeId(n),i=ia.getVisitFnByTypeId(n),o=da.getVisitFnByTypeId(n);ya[n]={get:e,set:r,indexOf:i,byteLength:o},va[n]=Object.create(t,{isValid:{value:Ys(Gs)},get:{value:Ys(Ms.getVisitFnByTypeId(n))},set:{value:Zs(es.getVisitFnByTypeId(n))},indexOf:{value:Hs(ia.getVisitFnByTypeId(n))},getByteLength:{value:Ys(da.getVisitFnByTypeId(n))}})}return"Vector"})(ba.prototype);class ma extends ba{constructor(t){super(t.data);const e=this.get,n=this.set,r=this.slice,i=new Array(this.length);Object.defineProperty(this,"get",{value(t){const n=i[t];if(void 0!==n)return n;const r=e.call(this,t);return i[t]=r,r}}),Object.defineProperty(this,"set",{value(t,e){n.call(this,t,e),i[t]=e}}),Object.defineProperty(this,"slice",{value:(t,e)=>new ma(r.call(this,t,e))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new ba(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class ga{constructor(t,e,n,r,i,o=[],s){let a;this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(r||0,-1)),i instanceof ga?(this.stride=i.stride,this.values=i.values,this.typeIds=i.typeIds,this.nullBitmap=i.nullBitmap,this.valueOffsets=i.valueOffsets):(this.stride=Ao(t),i&&((a=i[0])&&(this.valueOffsets=a),(a=i[1])&&(this.values=a),(a=i[2])&&(this.nullBitmap=a),(a=i[3])&&(this.typeIds=a))),this.nullable=0!==this._nullCount&&this.nullBitmap&&this.nullBitmap.byteLength>0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:r,typeIds:i}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),this.children.reduce(((t,e)=>t+e.byteLength),t)}get nullCount(){let t,e=this._nullCount;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=this.length-Qs(t,this.offset,this.offset+this.length)),e}getValid(t){if(this.nullable&&this.nullCount>0){const e=this.offset+t;return 0!=(this.nullBitmap[e>>3]&1<<e%8)}return!0}setValid(t,e){if(!this.nullable)return e;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){const{nullBitmap:t}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:t,_nullCount:0})}const{nullBitmap:n,offset:r}=this,i=r+t>>3,o=(r+t)%8,s=n[i]>>o&1;return e?0===s&&(n[i]|=1<<o,this._nullCount=this.nullCount+1):1===s&&(n[i]&=~(1<<o),this._nullCount=this.nullCount-1),e}clone(t=this.type,e=this.offset,n=this.length,r=this._nullCount,i=this,o=this.children){return new ga(t,e,n,r,i,o,this.dictionary)}slice(t,e){const{stride:n,typeId:r,children:i}=this,o=+(0===this._nullCount)-1,s=16===r?n:1,a=this._sliceBuffers(t,e,n,r);return this.clone(this.type,this.offset+t,e,o,a,0===i.length||this.valueOffsets?i:this._sliceChildren(i,s*t,s*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===Fr.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,r=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);r[e>>3]=(1<<e-(-8&e))-1,n>0&&r.set(function(t,e,n){const r=n.byteLength+7&-8;if(t>0||n.byteLength<r){const i=new Uint8Array(r);return i.set(t%8==0?n.subarray(t>>3):Ks(new Js(n,t,e,null,qs)).subarray(0,r)),i}return n}(this.offset,e,this.nullBitmap),0);const i=this.buffers;return i[Lr.VALIDITY]=r,this.clone(this.type,0,t,n+(t-e),i)}_sliceBuffers(t,e,n,r){let i;const{buffers:o}=this;return(i=o[Lr.TYPE])&&(o[Lr.TYPE]=i.subarray(t,t+e)),(i=o[Lr.OFFSET])&&(o[Lr.OFFSET]=i.subarray(t,t+e+1))||(i=o[Lr.DATA])&&(o[Lr.DATA]=6===r?i:i.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map((t=>t.slice(e,n)))}}ga.prototype.children=Object.freeze([]);class wa extends Mo{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{type:e,offset:n=0,length:r=0}=t;return new ga(e,n,r,0)}visitBool(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length>>3,nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitInt(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length,nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitFloat(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length,nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitUtf8(t){const{type:e,offset:n=0}=t,r=Ii(t.data),i=Ii(t.nullBitmap),o=Oi(t.valueOffsets),{length:s=o.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[o,r,i])}visitBinary(t){const{type:e,offset:n=0}=t,r=Ii(t.data),i=Ii(t.nullBitmap),o=Oi(t.valueOffsets),{length:s=o.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[o,r,i])}visitFixedSizeBinary(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitDate(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitTimestamp(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitTime(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitDecimal(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitList(t){const{type:e,offset:n=0,child:r}=t,i=Ii(t.nullBitmap),o=Oi(t.valueOffsets),{length:s=o.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[o,void 0,i],[r])}visitStruct(t){const{type:e,offset:n=0,children:r=[]}=t,i=Ii(t.nullBitmap),{length:o=r.reduce(((t,{length:e})=>Math.max(t,e)),0),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,void 0,i],r)}visitUnion(t){const{type:e,offset:n=0,children:r=[]}=t,i=Ii(t.nullBitmap),o=Si(e.ArrayType,t.typeIds),{length:s=o.length,nullCount:a=(t.nullBitmap?-1:0)}=t;if(io.isSparseUnion(e))return new ga(e,n,s,a,[void 0,void 0,i,o],r);const u=Oi(t.valueOffsets);return new ga(e,n,s,a,[u,void 0,i,o],r)}visitDictionary(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.indices.ArrayType,t.data),{dictionary:o=new ba([(new wa).visit({type:e.dictionary})])}=t,{length:s=i.length,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[void 0,i,r],[],o)}visitInterval(t){const{type:e,offset:n=0}=t,r=Ii(t.nullBitmap),i=Si(e.ArrayType,t.data),{length:o=i.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,i,r])}visitFixedSizeList(t){const{type:e,offset:n=0,child:r=(new wa).visit({type:e.valueType})}=t,i=Ii(t.nullBitmap),{length:o=r.length/Ao(e),nullCount:s=(t.nullBitmap?-1:0)}=t;return new ga(e,n,o,s,[void 0,void 0,i],[r])}visitMap(t){const{type:e,offset:n=0,child:r=(new wa).visit({type:e.childType})}=t,i=Ii(t.nullBitmap),o=Oi(t.valueOffsets),{length:s=o.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new ga(e,n,s,a,[o,void 0,i],[r])}}function _a(t){return(new wa).visit(t)}class xa{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Ia(t)),this.dictionaries=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map((t=>t.name))}toString(){return`Schema<{ ${this.fields.map(((t,e)=>`${e}: ${t}`)).join(", ")} }>`}select(t){const e=new Set(t),n=this.fields.filter((t=>e.has(t.name)));return new xa(n,this.metadata)}selectAt(t){const e=t.map((t=>this.fields[t])).filter(Boolean);return new xa(e,this.metadata)}assign(...t){const e=t[0]instanceof xa?t[0]:Array.isArray(t[0])?new xa(t[0]):new xa(t),n=[...this.fields],r=Oa(Oa(new Map,this.metadata),e.metadata),i=e.fields.filter((t=>{const e=n.findIndex((e=>e.name===t.name));return!~e||(n[e]=t.clone({metadata:Oa(Oa(new Map,n[e].metadata),t.metadata)}))&&!1})),o=Ia(i,new Map);return new xa([...n,...i],r,new Map([...this.dictionaries,...o]))}}xa.prototype.fields=null,xa.prototype.metadata=null,xa.prototype.dictionaries=null;class Sa{constructor(t,e,n=!1,r){this.name=t,this.type=e,this.nullable=n,this.metadata=r||new Map}static new(...t){let[e,n,r,i]=t;return t[0]&&"object"==typeof t[0]&&(({name:e}=t[0]),void 0===n&&(n=t[0].type),void 0===r&&(r=t[0].nullable),void 0===i&&(i=t[0].metadata)),new Sa(`${e}`,n,r,i)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,r,i]=t;return t[0]&&"object"==typeof t[0]?({name:e=this.name,type:n=this.type,nullable:r=this.nullable,metadata:i=this.metadata}=t[0]):[e=this.name,n=this.type,r=this.nullable,i=this.metadata]=t,Sa.new(e,n,r,i)}}function Oa(t,e){return new Map([...t||new Map,...e||new Map])}function Ia(t,e=new Map){for(let n=-1,r=t.length;++n<r;){const r=t[n].type;if(io.isDictionary(r))if(e.has(r.id)){if(e.get(r.id)!==r.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}else e.set(r.id,r.dictionary);r.children&&r.children.length>0&&Ia(r.children,e)}return e}Sa.prototype.type=null,Sa.prototype.name=null,Sa.prototype.nullable=null,Sa.prototype.metadata=null;class Ta extends Mo{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every(((t,n)=>this.compareFields(t,e[n])))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function Aa(t,e){return e instanceof t.constructor}function Ma(t,e){return t===e||Aa(t,e)}function Ea(t,e){return t===e||Aa(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function Ca(t,e){return t===e||Aa(t,e)&&t.precision===e.precision}function Pa(t,e){return t===e||Aa(t,e)&&t.unit===e.unit}function ja(t,e){return t===e||Aa(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function ka(t,e){return t===e||Aa(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function Ba(t,e){return t===e||Aa(t,e)&&t.mode===e.mode&&t.typeIds.every(((t,n)=>t===e.typeIds[n]))&&La.compareManyFields(t.children,e.children)}function Fa(t,e){return t===e||Aa(t,e)&&t.unit===e.unit}Ta.prototype.visitNull=Ma,Ta.prototype.visitBool=Ma,Ta.prototype.visitInt=Ea,Ta.prototype.visitInt8=Ea,Ta.prototype.visitInt16=Ea,Ta.prototype.visitInt32=Ea,Ta.prototype.visitInt64=Ea,Ta.prototype.visitUint8=Ea,Ta.prototype.visitUint16=Ea,Ta.prototype.visitUint32=Ea,Ta.prototype.visitUint64=Ea,Ta.prototype.visitFloat=Ca,Ta.prototype.visitFloat16=Ca,Ta.prototype.visitFloat32=Ca,Ta.prototype.visitFloat64=Ca,Ta.prototype.visitUtf8=Ma,Ta.prototype.visitBinary=Ma,Ta.prototype.visitFixedSizeBinary=function(t,e){return t===e||Aa(t,e)&&t.byteWidth===e.byteWidth},Ta.prototype.visitDate=Pa,Ta.prototype.visitDateDay=Pa,Ta.prototype.visitDateMillisecond=Pa,Ta.prototype.visitTimestamp=ja,Ta.prototype.visitTimestampSecond=ja,Ta.prototype.visitTimestampMillisecond=ja,Ta.prototype.visitTimestampMicrosecond=ja,Ta.prototype.visitTimestampNanosecond=ja,Ta.prototype.visitTime=ka,Ta.prototype.visitTimeSecond=ka,Ta.prototype.visitTimeMillisecond=ka,Ta.prototype.visitTimeMicrosecond=ka,Ta.prototype.visitTimeNanosecond=ka,Ta.prototype.visitDecimal=Ma,Ta.prototype.visitList=function(t,e){return t===e||Aa(t,e)&&t.children.length===e.children.length&&La.compareManyFields(t.children,e.children)},Ta.prototype.visitStruct=function(t,e){return t===e||Aa(t,e)&&t.children.length===e.children.length&&La.compareManyFields(t.children,e.children)},Ta.prototype.visitUnion=Ba,Ta.prototype.visitDenseUnion=Ba,Ta.prototype.visitSparseUnion=Ba,Ta.prototype.visitDictionary=function(t,e){return t===e||Aa(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&La.visit(t.indices,e.indices)&&La.visit(t.dictionary,e.dictionary)},Ta.prototype.visitInterval=Fa,Ta.prototype.visitIntervalDayTime=Fa,Ta.prototype.visitIntervalYearMonth=Fa,Ta.prototype.visitFixedSizeList=function(t,e){return t===e||Aa(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&La.compareManyFields(t.children,e.children)},Ta.prototype.visitMap=function(t,e){return t===e||Aa(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&La.compareManyFields(t.children,e.children)};const La=new Ta;function Da(t,e){return La.compareSchemas(t,e)}var Na,Ra;class za{constructor(...t){switch(t.length){case 2:if([this.schema]=t,!(this.schema instanceof xa))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=_a({nullCount:0,type:new go(this.schema.fields),children:this.schema.fields.map((t=>_a({type:t.type,nullCount:0})))})]=t,!(this.data instanceof ga))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Ua(this.schema,this.data.children);break;case 1:{const[e]=t,{fields:n,children:r,length:i}=Object.keys(e).reduce(((t,n,r)=>(t.children[r]=e[n],t.length=Math.max(t.length,e[n].length),t.fields[r]=Sa.new({name:n,type:e[n].type,nullable:!0}),t)),{length:0,fields:new Array,children:new Array}),o=new xa(n),s=_a({type:new go(n),length:i,children:r,nullCount:0});[this.schema,this.data]=Ua(o,s.children,i);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Va(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return Ms.visit(this.data,t)}set(t,e){return es.visit(this.data,t,e)}indexOf(t,e){return ia.visit(this.data,t,e)}getByteLength(t){return da.visit(this.data,t)}[Symbol.iterator](){return ua.visit(new ba([this.data]))}toArray(){return[...this]}concat(...t){return new Ya(this.schema,[this,...t])}slice(t,e){const[n]=new ba([this.data]).slice(t,e).data;return new za(this.schema,n)}getChild(t){var e;return this.getChildAt(null===(e=this.schema.fields)||void 0===e?void 0:e.findIndex((e=>e.name===t)))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new ba([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt(null===(n=this.schema.fields)||void 0===n?void 0:n.findIndex((e=>e.name===t)),e)}setChildAt(t,e){let n=this.schema,r=this.data;if(t>-1&&t<this.numCols){e||(e=new ba([_a({type:new oo,length:this.numRows})]));const i=n.fields.slice(),o=r.children.slice(),s=i[t].clone({type:e.type});[i[t],o[t]]=[s,e.data[0]],n=new xa(i,new Map(this.schema.metadata)),r=_a({type:new go(i),children:o})}return new za(n,r)}select(t){const e=this.schema.select(t),n=new go(e.fields),r=[];for(const e of t){const t=this.schema.fields.findIndex((t=>t.name===e));~t&&(r[t]=this.data.children[t])}return new za(e,_a({type:n,length:this.numRows,children:r}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map((t=>this.data.children[t])).filter(Boolean),r=_a({type:new go(e.fields),length:this.numRows,children:n});return new za(e,r)}}function Ua(t,e,n=e.reduce(((t,e)=>Math.max(t,e.length)),0)){var r;const i=[...t.fields],o=[...e],s=(n+63&-64)>>3;for(const[a,u]of t.fields.entries()){const t=e[a];t&&t.length===n||(i[a]=u.clone({nullable:!0}),o[a]=null!==(r=null==t?void 0:t._changeLengthAndBackfillNullBitmap(n))&&void 0!==r?r:_a({type:u.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[t.assign(i),_a({type:new go(i),length:n,children:o})]}function Va(t,e,n=new Map){for(let r=-1,i=t.length;++r<i;){const i=t[r].type,o=e[r];if(io.isDictionary(i))if(n.has(i.id)){if(n.get(i.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}else o.dictionary&&n.set(i.id,o.dictionary);i.children&&i.children.length>0&&Va(i.children,o.children,n)}return n}Na=Symbol.toStringTag,za[Na]=(t=>(t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(za.prototype);class Wa extends za{constructor(t){const e=t.fields.map((t=>_a({type:t.type})));super(t,_a({type:new go(t.fields),nullCount:0,children:e}))}}function $a(t,e){return function(t,e){const n=[...t.fields],r=[],i={numBatches:e.reduce(((t,e)=>Math.max(t,e.length)),0)};let o=0,s=0,a=-1;const u=e.length;let c,l=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<u;)l[a]=c=e[a].shift(),s=Math.min(s,c?c.length:s);Number.isFinite(s)&&(l=Ga(n,s,l,e,i),s>0&&(r[o++]=_a({type:new go(n),length:s,nullCount:0,children:l.slice()})))}return[t=t.assign(n),r.map((e=>new za(t,e)))]}(t,e.map((t=>t.data.concat())))}function Ga(t,e,n,r,i){var o;const s=(e+63&-64)>>3;for(let a=-1,u=r.length;++a<u;){const u=n[a],c=null==u?void 0:u.length;if(c>=e)c===e?n[a]=u:(n[a]=u.slice(0,e),i.numBatches=Math.max(i.numBatches,r[a].unshift(u.slice(e,c-e))));else{const r=t[a];t[a]=r.clone({nullable:!0}),n[a]=null!==(o=null==u?void 0:u._changeLengthAndBackfillNullBitmap(e))&&void 0!==o?o:_a({type:r.type,length:e,nullCount:e,nullBitmap:new Uint8Array(s)})}}return n}class Ya{constructor(...t){var e,n;if(0===t.length)return this.batches=[],this.schema=new xa([]),this._offsets=[0],this;let r,i;t[0]instanceof xa&&(r=t.shift()),t[t.length-1]instanceof Uint32Array&&(i=t.pop());const o=t=>{if(t){if(t instanceof za)return[t];if(t instanceof Ya)return t.batches;if(t instanceof ga){if(t.type instanceof go)return[new za(new xa(t.type.children),t)]}else{if(Array.isArray(t))return t.flatMap((t=>o(t)));if("function"==typeof t[Symbol.iterator])return[...t].flatMap((t=>o(t)));if("object"==typeof t){const e=Object.keys(t),n=e.map((e=>new ba([t[e]]))),r=new xa(e.map(((t,e)=>new Sa(String(t),n[e].type)))),[,i]=$a(r,n);return 0===i.length?[new za(t)]:i}}}return[]},s=t.flatMap((t=>o(t)));if(r=null!==(n=null!=r?r:null===(e=s[0])||void 0===e?void 0:e.schema)&&void 0!==n?n:new xa([]),!(r instanceof xa))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const t of s){if(!(t instanceof za))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Da(r,t.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=r,this.batches=s,this._offsets=null!=i?i:Vs(this.data)}get data(){return this.batches.map((({data:t})=>t))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce(((t,e)=>t+e.length),0)}get nullCount(){return-1===this._nullCount&&(this._nullCount=Us(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?ua.visit(new ba(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(",\n ")}\n]`}concat(...t){const e=this.schema,n=this.data.concat(t.flatMap((({data:t})=>t)));return new Ya(e,n.map((t=>new za(e,t))))}slice(t,e){const n=this.schema;[t,e]=Fs({length:this.numRows},t,e);const r=Ws(this.data,this._offsets,t,e);return new Ya(n,r.map((t=>new za(n,t))))}getChild(t){return this.getChildAt(this.schema.fields.findIndex((e=>e.name===t)))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){const e=this.data.map((e=>e.children[t]));if(0===e.length){const{type:n}=this.schema.fields[t],r=_a({type:n,length:0,nullCount:0});e.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new ba(e)}return null}setChild(t,e){var n;return this.setChildAt(null===(n=this.schema.fields)||void 0===n?void 0:n.findIndex((e=>e.name===t)),e)}setChildAt(t,e){let n=this.schema,r=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new ba([_a({type:new oo,length:this.numRows})]));const i=n.fields.slice(),o=i[t].clone({type:e.type}),s=this.schema.fields.map(((t,e)=>this.getChildAt(e)));[i[t],s[t]]=[o,e],[n,r]=$a(n,s)}return new Ya(n,r)}select(t){const e=this.schema.fields.reduce(((t,e,n)=>t.set(e.name,n)),new Map);return this.selectAt(t.map((t=>e.get(t))).filter((t=>t>-1)))}selectAt(t){const e=this.schema.selectAt(t),n=this.batches.map((e=>e.selectAt(t)));return new Ya(e,n)}assign(t){const e=this.schema.fields,[n,r]=t.schema.fields.reduce(((t,n,r)=>{const[i,o]=t,s=e.findIndex((t=>t.name===n.name));return~s?o[s]=r:i.push(r),t}),[[],[]]),i=this.schema.assign(t.schema),o=[...e.map(((t,e)=>[e,r[e]])).map((([e,n])=>void 0===n?this.getChildAt(e):t.getChildAt(n))),...n.map((e=>t.getChildAt(e)))].filter(Boolean);return new Ya(...$a(i,o))}}Ra=Symbol.toStringTag,Ya[Ra]=(t=>(t.schema=null,t.batches=[],t._offsets=new Uint32Array([0]),t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,t.isValid=Ys(Gs),t.get=Ys(Ms.getVisitFn(Fr.Struct)),t.set=Zs(es.getVisitFn(Fr.Struct)),t.indexOf=Hs(ia.getVisitFn(Fr.Struct)),t.getByteLength=Ys(da.getVisitFn(Fr.Struct)),"Table"))(Ya.prototype);class Za{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,r){return t.prep(8,24),t.writeInt64(r),t.pad(4),t.writeInt32(n),t.writeInt64(e),t.offset()}}const Ha=new Int32Array(2),qa=new Float32Array(Ha.buffer),Xa=new Float64Array(Ha.buffer),Ka=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];class Ja{constructor(t,e){this.low=0|t,this.high=0|e}static create(t,e){return 0==t&&0==e?Ja.ZERO:new Ja(t,e)}toFloat64(){return(this.low>>>0)+4294967296*this.high}equals(t){return this.low==t.low&&this.high==t.high}}var Qa,tu,eu,nu,ru;Ja.ZERO=new Ja(0,0),function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(Qa||(Qa={}));class iu{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new iu(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return new Ja(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new Ja(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return Ha[0]=this.readInt32(t),qa[0]}readFloat64(t){return Ha[Ka?0:1]=this.readInt32(t),Ha[Ka?1:0]=this.readInt32(t+4),Xa[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){qa[0]=e,this.writeInt32(t,Ha[0])}writeFloat64(t,e){Xa[0]=e,this.writeInt32(t,Ha[Ka?0:1]),this.writeInt32(t+4,Ha[Ka?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){const n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);const n=this.readInt32(t);let r="",i=0;if(t+=4,e===Qa.UTF8_BYTES)return this.bytes_.subarray(t,t+n);for(;i<n;){let e;const n=this.readUint8(t+i++);if(n<192)e=n;else{const r=this.readUint8(t+i++);if(n<224)e=(31&n)<<6|63&r;else{const o=this.readUint8(t+i++);e=n<240?(15&n)<<12|(63&r)<<6|63&o:(7&n)<<18|(63&r)<<12|(63&o)<<6|63&this.readUint8(t+i++)}}e<65536?r+=String.fromCharCode(e):(e-=65536,r+=String.fromCharCode(55296+(e>>10),56320+(1023&e)))}return r}__union_with_string(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createLong(t,e){return Ja.create(t,e)}createScalarList(t,e){const n=[];for(let r=0;r<e;++r)null!==t(r)&&n.push(t(r));return n}createObjList(t,e){const n=[];for(let r=0;r<e;++r){const e=t(r);null!==e&&n.push(e.unpack())}return n}}class ou{constructor(t){let e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,e=t||1024,this.bb=iu.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);const n=1+~(this.bb.capacity()-this.space+e)&t-1;for(;this.space<n+t+e;){const t=this.bb.capacity();this.bb=ou.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){!this.force_defaults&&e.equals(n)||(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(t){null!==this.vtable&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){const e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const n=e<<1,r=iu.allocate(n);return r.setPosition(n-e),r.bytes().set(t.bytes(),n-e),r}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&0==this.vtable[e];e--);const n=e+1;for(;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);const r=2*(n+2);this.addInt16(r);let i=0;const o=this.space;t:for(e=0;e<this.vtables.length;e++){const t=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(t)){for(let e=2;e<r;e+=2)if(this.bb.readInt16(o+e)!=this.bb.readInt16(t+e))continue t;i=this.vtables[e];break}}return i?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,i-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){const r=n?4:0;if(e){const t=e;if(this.prep(this.minalign,8+r),4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(let e=3;e>=0;e--)this.writeInt8(t.charCodeAt(e))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const n=this.bb.capacity()-t,r=n-this.bb.readInt32(n);if(0==this.bb.readInt16(r+e))throw new Error("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(!t)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let n=0;for(;n<t.length;){let r;const i=t.charCodeAt(n++);r=i<55296||i>=56320?i:(i<<10)+t.charCodeAt(n++)+-56613888,r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(63&r|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let t=0,n=this.space,r=this.bb.bytes();t<e.length;t++)r[n++]=e[t];return this.endVector()}createLong(t,e){return Ja.create(t,e)}createObjectOffset(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let n=0;n<t.length;++n){const r=t[n];if(null===r)throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}}class su{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new su).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new su).__init(t.readInt32(t.position())+t.position(),t)}key(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return su.startKeyValue(t),su.addKey(t,e),su.addValue(t,n),su.endKeyValue(t)}}!function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"}(tu||(tu={})),function(t){t[t.Little=0]="Little",t[t.Big=1]="Big"}(eu||(eu={})),function(t){t[t.DenseArray=0]="DenseArray"}(nu||(nu={}));class au{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new au).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new au).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return au.startInt(t),au.addBitWidth(t,e),au.addIsSigned(t,n),au.endInt(t)}}class uu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new uu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new uu).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}indexType(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new au).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):nu.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,nu.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct_=13]="Struct_",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList"}(ru||(ru={}));class cu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new cu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new cu).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ru.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new uu).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const n=this.bb.__offset(this.bb_pos,14);return n?(e||new cu).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,16);return n?(e||new su).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,ru.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}}class lu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new lu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new lu).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):eu.Little}fields(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new cu).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new su).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,eu.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,r,i){return lu.startSchema(t),lu.addEndianness(t,e),lu.addFields(t,n),lu.addCustomMetadata(t,r),lu.addFeatures(t,i),lu.endSchema(t)}}class fu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new fu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new fu).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tu.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new lu).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new Za).__init(this.bb.__vector(this.bb_pos+n)+24*t,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const n=this.bb.__offset(this.bb_pos,10);return n?(e||new Za).__init(this.bb.__vector(this.bb_pos+n)+24*t,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new su).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,tu.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}var hu=Ja,du=ou,pu=iu;class yu{constructor(t,e=Mr.V4,n,r){this.schema=t,this.version=e,n&&(this._recordBatches=n),r&&(this._dictionaryBatches=r)}static decode(t){t=new pu(Ii(t));const e=fu.getRootAsFooter(t),n=xa.decode(e.schema());return new vu(n,e)}static encode(t){const e=new du,n=xa.encode(e,t.schema);fu.startRecordBatchesVector(e,t.numRecordBatches);for(const n of[...t.recordBatches()].slice().reverse())bu.encode(e,n);const r=e.endVector();fu.startDictionariesVector(e,t.numDictionaries);for(const n of[...t.dictionaryBatches()].slice().reverse())bu.encode(e,n);const i=e.endVector();return fu.startFooter(e),fu.addSchema(e,n),fu.addVersion(e,Mr.V4),fu.addRecordBatches(e,r),fu.addDictionaries(e,i),fu.finishFooterBuffer(e,fu.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}}class vu extends yu{constructor(t,e){super(t,e.version()),this._footer=e}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const e=this._footer.recordBatches(t);if(e)return bu.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return bu.decode(e)}return null}}class bu{constructor(t,e,n){this.metaDataLength=t,this.offset="number"==typeof n?n:n.low,this.bodyLength="number"==typeof e?e:e.low}static decode(t){return new bu(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:n}=e,r=new hu(e.offset,0),i=new hu(e.bodyLength,0);return Za.createBlock(t,r,n,i)}}const mu={fromIterable:t=>gu(function*(t){let e,n,r,i,o=!1,s=[],a=0;({cmd:r,size:i}=yield null);const u=(c=t,function*(t,e){const n=function*(t){yield t},r="string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof wi?n(e):li(e)?e:n(e);return yield*Ti(function*(e){let n=null;do{n=e.next(yield Si(t,n))}while(!n.done)}(r[Symbol.iterator]())),new t}(Uint8Array,c))[Symbol.iterator]();var c;try{do{if(({done:e,value:n}=Number.isNaN(i-a)?u.next():u.next(i-a)),!e&&n.byteLength>0&&(s.push(n),a+=n.byteLength),e||i<=a)do{({cmd:r,size:i}=yield"peek"===r?xi(s,i)[0]:([n,s,a]=xi(s,i),n))}while(i<a)}while(!e)}catch(t){(o=!0)&&"function"==typeof u.throw&&u.throw(t)}finally{!1===o&&"function"==typeof u.return&&u.return(null)}return null}(t)),fromAsyncIterable:t=>gu(function(t){return Hr(this,arguments,(function*(){let e,n,r,i,o=!1,s=[],a=0;({cmd:r,size:i}=yield yield Zr(null));const u=(c=t,Ai(Uint8Array,c))[Symbol.asyncIterator]();var c;try{do{if(({done:e,value:n}=Number.isNaN(i-a)?yield Zr(u.next()):yield Zr(u.next(i-a))),!e&&n.byteLength>0&&(s.push(n),a+=n.byteLength),e||i<=a)do{({cmd:r,size:i}=yield yield Zr("peek"===r?xi(s,i)[0]:([n,s,a]=xi(s,i),n)))}while(i<a)}while(!e)}catch(t){(o=!0)&&"function"==typeof u.throw&&(yield Zr(u.throw(t)))}finally{!1===o&&"function"==typeof u.return&&(yield Zr(u.return(new Uint8Array(0))))}return yield Zr(null)}))}(t)),fromDOMStream:t=>gu(function(t){return Hr(this,arguments,(function*(){let e,n,r,i=!1,o=!1,s=[],a=0;({cmd:n,size:r}=yield yield Zr(null));const u=new wu(t);try{do{if(({done:i,value:e}=Number.isNaN(r-a)?yield Zr(u.read()):yield Zr(u.read(r-a))),!i&&e.byteLength>0&&(s.push(Ii(e)),a+=e.byteLength),i||r<=a)do{({cmd:n,size:r}=yield yield Zr("peek"===n?xi(s,r)[0]:([e,s,a]=xi(s,r),e)))}while(r<a)}while(!i)}catch(t){(o=!0)&&(yield Zr(u.cancel(t)))}finally{!1===o?yield Zr(u.cancel()):t.locked&&u.releaseLock()}return yield Zr(null)}))}(t)),fromNodeStream:t=>gu(function(t){return Hr(this,arguments,(function*(){const e=[];let n,r,i,o="error",s=!1,a=null,u=0,c=[];if(({cmd:n,size:r}=yield yield Zr(null)),t.isTTY)return yield yield Zr(new Uint8Array(0)),yield Zr(null);try{e[0]=_u(t,"end"),e[1]=_u(t,"error");do{if(e[2]=_u(t,"readable"),[o,a]=yield Zr(Promise.race(e.map((t=>t[2])))),"error"===o)break;if((s="end"===o)||(Number.isFinite(r-u)?(i=Ii(t.read(r-u)),i.byteLength<r-u&&(i=Ii(t.read()))):i=Ii(t.read()),i.byteLength>0&&(c.push(i),u+=i.byteLength)),s||r<=u)do{({cmd:n,size:r}=yield yield Zr("peek"===n?xi(c,r)[0]:([i,c,u]=xi(c,r),i)))}while(r<u)}while(!s)}finally{yield Zr(function(e,n){return i=c=null,new Promise(((r,i)=>{for(const[n,r]of e)t.off(n,r);try{const e=t.destroy;e&&e.call(t,n),n=void 0}catch(t){n=t||n}finally{null!=n?i(n):r()}}))}(e,"error"===o?a:null))}return yield Zr(null)}))}(t)),toDOMStream(t,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(t,e){throw new Error('"toNodeStream" not available in this environment')}},gu=t=>(t.next(),t);class wu{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch((()=>{}))}get closed(){return this.reader?this.reader.closed.catch((()=>{})):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Yr(this,void 0,void 0,(function*(){const{reader:e,source:n}=this;e&&(yield e.cancel(t).catch((()=>{}))),n&&n.locked&&this.releaseLock()}))}read(t){return Yr(this,void 0,void 0,(function*(){if(0===t)return{done:null==this.reader,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=Ii(e)),e}))}}const _u=(t,e)=>{const n=t=>r([e,t]);let r;return[e,n,new Promise((i=>(r=i)&&t.once(e,n)))]},xu=Object.freeze({done:!0,value:void 0});class Su{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class Ou{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class Iu extends Ou{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise((t=>this._closedPromiseResolve=t))}get closed(){return this._closedPromise}cancel(t){return Yr(this,void 0,void 0,(function*(){yield this.return(t)}))}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(xu);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return mu.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return mu.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Yr(this,void 0,void 0,(function*(){return yield this.abort(t),xu}))}return(t){return Yr(this,void 0,void 0,(function*(){return yield this.close(),xu}))}read(t){return Yr(this,void 0,void 0,(function*(){return(yield this.next(t,"read")).value}))}peek(t){return Yr(this,void 0,void 0,(function*(){return(yield this.next(t,"peek")).value}))}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise(((t,e)=>{this.resolvers.push({resolve:t,reject:e})})):Promise.resolve(xu)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Tu extends Iu{write(t){if((t=Ii(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Jr(this.toUint8Array(!0)):this.toUint8Array(!1).then(Jr)}toUint8Array(t=!1){return t?xi(this._values)[0]:(()=>Yr(this,void 0,void 0,(function*(){var t,e;const n=[];let r=0;try{for(var i,o=Xr(this);!(i=yield o.next()).done;){const t=i.value;n.push(t),r+=t.byteLength}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&(yield e.call(o))}finally{if(t)throw t.error}}return xi(n,r)[0]})))()}}class Au{constructor(t){t&&(this.source=new Eu(mu.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Mu{constructor(t){t instanceof Mu?this.source=t.source:t instanceof Tu?this.source=new Cu(mu.fromAsyncIterable(t)):mi(t)?this.source=new Cu(mu.fromNodeStream(t)):bi(t)?this.source=new Cu(mu.fromDOMStream(t)):yi(t)?this.source=new Cu(mu.fromDOMStream(t.body)):li(t)?this.source=new Cu(mu.fromIterable(t)):(ci(t)||fi(t))&&(this.source=new Cu(mu.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Eu{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||xu)}return(t){return Object.create(this.source.return&&this.source.return(t)||xu)}}class Cu{constructor(t){this.source=t,this._closedPromise=new Promise((t=>this._closedPromiseResolve=t))}cancel(t){return Yr(this,void 0,void 0,(function*(){yield this.return(t)}))}get closed(){return this._closedPromise}read(t){return Yr(this,void 0,void 0,(function*(){return(yield this.next(t,"read")).value}))}peek(t){return Yr(this,void 0,void 0,(function*(){return(yield this.next(t,"peek")).value}))}next(t,e="read"){return Yr(this,void 0,void 0,(function*(){return yield this.source.next({cmd:e,size:t})}))}throw(t){return Yr(this,void 0,void 0,(function*(){const e=this.source.throw&&(yield this.source.throw(t))||xu;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}))}return(t){return Yr(this,void 0,void 0,(function*(){const e=this.source.return&&(yield this.source.return(t))||xu;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}))}}class Pu extends Au{constructor(t,e){super(),this.position=0,this.buffer=Ii(t),this.size=void 0===e?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:e,size:n,position:r}=this;return e&&r<n?("number"!=typeof t&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,r+Math.min(n-r,t)),e.subarray(r,this.position)):null}readAt(t,e){const n=this.buffer,r=Math.min(this.size,t+e);return n?n.subarray(t,r):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}}class ju extends Mu{constructor(t,e){super(),this.position=0,this._handle=t,"number"==typeof e?this.size=e:this._pending=(()=>Yr(this,void 0,void 0,(function*(){this.size=(yield t.stat()).size,delete this._pending})))()}readInt32(t){return Yr(this,void 0,void 0,(function*(){const{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}))}seek(t){return Yr(this,void 0,void 0,(function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size}))}read(t){return Yr(this,void 0,void 0,(function*(){this._pending&&(yield this._pending);const{_handle:e,size:n,position:r}=this;if(e&&r<n){"number"!=typeof t&&(t=Number.POSITIVE_INFINITY);let i=r,o=0,s=0;const a=Math.min(n,i+Math.min(n-i,t)),u=new Uint8Array(Math.max(0,(this.position=a)-i));for(;(i+=s)<a&&(o+=s)<u.byteLength;)({bytesRead:s}=yield e.read(u,o,u.byteLength-o,i));return u}return null}))}readAt(t,e){return Yr(this,void 0,void 0,(function*(){this._pending&&(yield this._pending);const{_handle:n,size:r}=this;if(n&&t+e<r){const i=Math.min(r,t+e),o=new Uint8Array(i-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)}))}close(){return Yr(this,void 0,void 0,(function*(){const t=this._handle;this._handle=null,t&&(yield t.close())}))}throw(t){return Yr(this,void 0,void 0,(function*(){return yield this.close(),{done:!0,value:t}}))}return(t){return Yr(this,void 0,void 0,(function*(){return yield this.close(),{done:!0,value:t}}))}}function ku(t){return t<0&&(t=4294967295+t+1),`0x${t.toString(16)}`}const Bu=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Fu{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const e=new Uint32Array([this.buffer[1]>>>16,65535&this.buffer[1],this.buffer[0]>>>16,65535&this.buffer[0]]),n=new Uint32Array([t.buffer[1]>>>16,65535&t.buffer[1],t.buffer[0]>>>16,65535&t.buffer[0]]);let r=e[3]*n[3];this.buffer[0]=65535&r;let i=r>>>16;return r=e[2]*n[3],i+=r,r=e[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<r?65536:0,this.buffer[1]+=i>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${ku(this.buffer[1])} ${ku(this.buffer[0])}`}}class Lu extends Fu{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return Lu.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Lu.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.length,r=new Lu(e);for(let e=0;e<n;){const i=8<n-e?8:n-e,o=new Lu(new Uint32Array([Number.parseInt(t.slice(e,e+i),10),0])),s=new Lu(new Uint32Array([Bu[i],0]));r.times(s),r.plus(o),e+=i}return r}static convertArray(t){const e=new Uint32Array(2*t.length);for(let n=-1,r=t.length;++n<r;)Lu.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new Lu(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Lu(new Uint32Array(t.buffer)).plus(e)}}class Du extends Fu{negate(){return this.buffer[0]=1+~this.buffer[0],this.buffer[1]=~this.buffer[1],0==this.buffer[0]&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){const e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return Du.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Du.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.startsWith("-"),r=t.length,i=new Du(e);for(let e=n?1:0;e<r;){const n=8<r-e?8:r-e,o=new Du(new Uint32Array([Number.parseInt(t.slice(e,e+n),10),0])),s=new Du(new Uint32Array([Bu[n],0]));i.times(s),i.plus(o),e+=n}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(2*t.length);for(let n=-1,r=t.length;++n<r;)Du.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new Du(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Du(new Uint32Array(t.buffer)).plus(e)}}class Nu{constructor(t){this.buffer=t}high(){return new Du(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Du(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=1+~this.buffer[0],this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],0==this.buffer[0]&&++this.buffer[1],0==this.buffer[1]&&++this.buffer[2],0==this.buffer[2]&&++this.buffer[3],this}times(t){const e=new Lu(new Uint32Array([this.buffer[3],0])),n=new Lu(new Uint32Array([this.buffer[2],0])),r=new Lu(new Uint32Array([this.buffer[1],0])),i=new Lu(new Uint32Array([this.buffer[0],0])),o=new Lu(new Uint32Array([t.buffer[3],0])),s=new Lu(new Uint32Array([t.buffer[2],0])),a=new Lu(new Uint32Array([t.buffer[1],0])),u=new Lu(new Uint32Array([t.buffer[0],0]));let c=Lu.multiply(i,u);this.buffer[0]=c.low();const l=new Lu(new Uint32Array([c.high(),0]));return c=Lu.multiply(r,u),l.plus(c),c=Lu.multiply(i,a),l.plus(c),this.buffer[1]=l.low(),this.buffer[3]=l.lessThan(c)?1:0,this.buffer[2]=l.high(),new Lu(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Lu.multiply(n,u)).plus(Lu.multiply(r,a)).plus(Lu.multiply(i,s)),this.buffer[3]+=Lu.multiply(e,u).plus(Lu.multiply(n,a)).plus(Lu.multiply(r,s)).plus(Lu.multiply(i,o)).low(),this}plus(t){const e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${ku(this.buffer[3])} ${ku(this.buffer[2])} ${ku(this.buffer[1])} ${ku(this.buffer[0])}`}static multiply(t,e){return new Nu(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Nu(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Nu.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Nu.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),r=t.length,i=new Nu(e);for(let e=n?1:0;e<r;){const n=8<r-e?8:r-e,o=new Nu(new Uint32Array([Number.parseInt(t.slice(e,e+n),10),0,0,0])),s=new Nu(new Uint32Array([Bu[n],0,0,0]));i.times(s),i.plus(o),e+=n}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(4*t.length);for(let n=-1,r=t.length;++n<r;)Nu.from(t[n],new Uint32Array(e.buffer,e.byteOffset+16*n,4));return e}}class Ru extends Mo{constructor(t,e,n,r){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=r}visit(t){return super.visit(t instanceof Sa?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return _a({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===Er.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return _a({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class zu extends Ru{constructor(t,e,n,r){super(new Uint8Array(0),e,n,r),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Ks(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return Si(Uint8Array,Si(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return Si(Uint8Array,Si(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:n}=this;return io.isTimestamp(t)||(io.isInt(t)||io.isTime(t))&&64===t.bitWidth||io.isDate(t)&&t.unit===Pr.MILLISECOND?Si(Uint8Array,Du.convertArray(n[e])):io.isDecimal(t)?Si(Uint8Array,Nu.convertArray(n[e])):io.isBinary(t)||io.isFixedSizeBinary(t)?function(t){const e=t.join(""),n=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2)n[t>>1]=Number.parseInt(e.slice(t,t+2),16);return n}(n[e]):io.isBool(t)?Ks(n[e]):io.isUtf8(t)?ti(n[e].join("")):Si(Uint8Array,Si(t.ArrayType,n[e].map((t=>+t))))}}var Uu,Vu,Wu,$u,Gu,Yu,Zu,Hu;!function(t){t[t.BUFFER=0]="BUFFER"}(Uu||(Uu={})),function(t){t[t.LZ4_FRAME=0]="LZ4_FRAME",t[t.ZSTD=1]="ZSTD"}(Vu||(Vu={}));class qu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new qu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new qu).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Vu.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Uu.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Vu.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Uu.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return qu.startBodyCompression(t),qu.addCodec(t,e),qu.addMethod(t,n),qu.endBodyCompression(t)}}class Xu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}}class Ku{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(n),t.writeInt64(e),t.offset()}}class Ju{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new Ju).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new Ju).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}nodes(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new Ku).__init(this.bb.__vector(this.bb_pos+n)+16*t,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new Xu).__init(this.bb.__vector(this.bb_pos+n)+16*t,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new qu).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}}class Qu{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new Qu).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new Qu).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}data(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ju).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){const t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}}!function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"}(Wu||(Wu={}));class tc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new tc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new tc).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Wu.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Wu.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return tc.startFloatingPoint(t),tc.addPrecision(t,e),tc.endFloatingPoint(t)}}class ec{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new ec).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new ec).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,r){return ec.startDecimal(t),ec.addPrecision(t,e),ec.addScale(t,n),ec.addBitWidth(t,r),ec.endDecimal(t)}}!function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"}($u||($u={}));class nc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new nc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new nc).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):$u.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,$u.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return nc.startDate(t),nc.addUnit(t,e),nc.endDate(t)}}!function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"}(Gu||(Gu={}));class rc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new rc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new rc).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Gu.MILLISECOND}bitWidth(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Gu.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return rc.startTime(t),rc.addUnit(t,e),rc.addBitWidth(t,n),rc.endTime(t)}}class ic{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new ic).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new ic).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Gu.SECOND}timezone(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Gu.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return ic.startTimestamp(t),ic.addUnit(t,e),ic.addTimezone(t,n),ic.endTimestamp(t)}}!function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"}(Yu||(Yu={}));class oc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new oc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new oc).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Yu.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Yu.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return oc.startInterval(t),oc.addUnit(t,e),oc.endInterval(t)}}!function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"}(Zu||(Zu={}));class sc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new sc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new sc).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zu.Sparse}typeIds(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Zu.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return sc.startUnion(t),sc.addMode(t,e),sc.addTypeIds(t,n),sc.endUnion(t)}}class ac{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new ac).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new ac).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return ac.startFixedSizeBinary(t),ac.addByteWidth(t,e),ac.endFixedSizeBinary(t)}}class uc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new uc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new uc).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return uc.startFixedSizeList(t),uc.addListSize(t,e),uc.endFixedSizeList(t)}}class cc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new cc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new cc).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const t=this.bb.__offset(this.bb_pos,4);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return cc.startMap(t),cc.addKeysSorted(t,e),cc.endMap(t)}}!function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"}(Hu||(Hu={}));class lc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new lc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new lc).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tu.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Hu.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new su).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,tu.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Hu.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,t.createLong(0,0))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,r,i,o){return lc.startMessage(t),lc.addVersion(t,e),lc.addHeaderType(t,n),lc.addHeader(t,r),lc.addBodyLength(t,i),lc.addCustomMetadata(t,o),lc.endMessage(t)}}class fc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new fc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new fc).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return fc.startNull(t),fc.endNull(t)}}class hc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new hc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new hc).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return hc.startBinary(t),hc.endBinary(t)}}class dc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new dc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new dc).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return dc.startBool(t),dc.endBool(t)}}class pc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new pc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new pc).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return pc.startUtf8(t),pc.endUtf8(t)}}class yc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new yc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new yc).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return yc.startList(t),yc.endList(t)}}class vc{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new vc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new vc).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return vc.startStruct_(t),vc.endStruct_(t)}}var bc=Ja;const mc=new class extends Mo{visit(t,e){return null==t||null==e?void 0:super.visit(t,e)}visitNull(t,e){return fc.startNull(e),fc.endNull(e)}visitInt(t,e){return au.startInt(e),au.addBitWidth(e,t.bitWidth),au.addIsSigned(e,t.isSigned),au.endInt(e)}visitFloat(t,e){return tc.startFloatingPoint(e),tc.addPrecision(e,t.precision),tc.endFloatingPoint(e)}visitBinary(t,e){return hc.startBinary(e),hc.endBinary(e)}visitBool(t,e){return dc.startBool(e),dc.endBool(e)}visitUtf8(t,e){return pc.startUtf8(e),pc.endUtf8(e)}visitDecimal(t,e){return ec.startDecimal(e),ec.addScale(e,t.scale),ec.addPrecision(e,t.precision),ec.addBitWidth(e,t.bitWidth),ec.endDecimal(e)}visitDate(t,e){return nc.startDate(e),nc.addUnit(e,t.unit),nc.endDate(e)}visitTime(t,e){return rc.startTime(e),rc.addUnit(e,t.unit),rc.addBitWidth(e,t.bitWidth),rc.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return ic.startTimestamp(e),ic.addUnit(e,t.unit),void 0!==n&&ic.addTimezone(e,n),ic.endTimestamp(e)}visitInterval(t,e){return oc.startInterval(e),oc.addUnit(e,t.unit),oc.endInterval(e)}visitList(t,e){return yc.startList(e),yc.endList(e)}visitStruct(t,e){return vc.startStruct_(e),vc.endStruct_(e)}visitUnion(t,e){sc.startTypeIdsVector(e,t.typeIds.length);const n=sc.createTypeIdsVector(e,t.typeIds);return sc.startUnion(e),sc.addMode(e,t.mode),sc.addTypeIds(e,n),sc.endUnion(e)}visitDictionary(t,e){const n=this.visit(t.indices,e);return uu.startDictionaryEncoding(e),uu.addId(e,new bc(t.id,0)),uu.addIsOrdered(e,t.isOrdered),void 0!==n&&uu.addIndexType(e,n),uu.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return ac.startFixedSizeBinary(e),ac.addByteWidth(e,t.byteWidth),ac.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return uc.startFixedSizeList(e),uc.addListSize(e,t.listSize),uc.endFixedSizeList(e)}visitMap(t,e){return cc.startMap(e),cc.addKeysSorted(e,t.keysSorted),cc.endMap(e)}};function gc(t){return new Cc(t.count,_c(t.columns),xc(t.columns))}function wc(t,e){return(t.children||[]).filter(Boolean).map((t=>Sa.fromJSON(t,e)))}function _c(t){return(t||[]).reduce(((t,e)=>{return[...t,new kc(e.count,(n=e.VALIDITY,(n||[]).reduce(((t,e)=>t+ +(0===e)),0))),..._c(e.children)];var n}),[])}function xc(t,e=[]){for(let n=-1,r=(t||[]).length;++n<r;){const r=t[n];r.VALIDITY&&e.push(new jc(e.length,r.VALIDITY.length)),r.TYPE&&e.push(new jc(e.length,r.TYPE.length)),r.OFFSET&&e.push(new jc(e.length,r.OFFSET.length)),r.DATA&&e.push(new jc(e.length,r.DATA.length)),e=xc(r.children,e)}return e}function Sc(t){return new Map(Object.entries(t||{}))}function Oc(t){return new so(t.isSigned,t.bitWidth)}function Ic(t,e){const n=t.type.name;switch(n){case"NONE":case"null":return new oo;case"binary":return new co;case"utf8":return new lo;case"bool":return new fo;case"list":return new mo((e||[])[0]);case"struct":case"struct_":return new go(e||[])}switch(n){case"int":{const e=t.type;return new so(e.isSigned,e.bitWidth)}case"floatingpoint":{const e=t.type;return new uo(Cr[e.precision])}case"decimal":{const e=t.type;return new ho(e.scale,e.precision,e.bitWidth)}case"date":{const e=t.type;return new po(Pr[e.unit])}case"time":{const e=t.type;return new yo(jr[e.unit],e.bitWidth)}case"timestamp":{const e=t.type;return new vo(jr[e.unit],e.timezone)}case"interval":{const e=t.type;return new bo(kr[e.unit])}case"union":{const n=t.type;return new wo(Er[n.mode],n.typeIds||[],e||[])}case"fixedsizebinary":{const e=t.type;return new _o(e.byteWidth)}case"fixedsizelist":{const n=t.type;return new xo(n.listSize,(e||[])[0])}case"map":{const n=t.type;return new So((e||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Tc=Ja,Ac=ou,Mc=iu;class Ec{constructor(t,e,n,r){this._version=e,this._headerType=n,this.body=new Uint8Array(0),r&&(this._createHeader=()=>r),this._bodyLength="number"==typeof t?t:t.low}static fromJSON(t,e){const n=new Ec(0,Mr.V4,e);return n._createHeader=function(t,e){return()=>{switch(e){case Br.Schema:return xa.fromJSON(t);case Br.RecordBatch:return Cc.fromJSON(t);case Br.DictionaryBatch:return Pc.fromJSON(t)}throw new Error(`Unrecognized Message type: { name: ${Br[e]}, type: ${e} }`)}}(t,e),n}static decode(t){t=new Mc(Ii(t));const e=lc.getRootAsMessage(t),n=e.bodyLength(),r=e.version(),i=e.headerType(),o=new Ec(n,r,i);return o._createHeader=function(t,e){return()=>{switch(e){case Br.Schema:return xa.decode(t.header(new lu));case Br.RecordBatch:return Cc.decode(t.header(new Ju),t.version());case Br.DictionaryBatch:return Pc.decode(t.header(new Qu),t.version())}throw new Error(`Unrecognized Message type: { name: ${Br[e]}, type: ${e} }`)}}(e,i),o}static encode(t){const e=new Ac;let n=-1;return t.isSchema()?n=xa.encode(e,t.header()):t.isRecordBatch()?n=Cc.encode(e,t.header()):t.isDictionaryBatch()&&(n=Pc.encode(e,t.header())),lc.startMessage(e),lc.addVersion(e,Mr.V4),lc.addHeader(e,n),lc.addHeaderType(e,t.headerType),lc.addBodyLength(e,new Tc(t.bodyLength,0)),lc.finishMessageBuffer(e,lc.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof xa)return new Ec(0,Mr.V4,Br.Schema,t);if(t instanceof Cc)return new Ec(e,Mr.V4,Br.RecordBatch,t);if(t instanceof Pc)return new Ec(e,Mr.V4,Br.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Br.Schema}isRecordBatch(){return this.headerType===Br.RecordBatch}isDictionaryBatch(){return this.headerType===Br.DictionaryBatch}}class Cc{constructor(t,e,n){this._nodes=e,this._buffers=n,this._length="number"==typeof t?t:t.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}}class Pc{constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id="number"==typeof e?e:e.low}get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}}class jc{constructor(t,e){this.offset="number"==typeof t?t:t.low,this.length="number"==typeof e?e:e.low}}class kc{constructor(t,e){this.length="number"==typeof t?t:t.low,this.nullCount="number"==typeof e?e:e.low}}function Bc(t,e){const n=[];for(let r,i=-1,o=-1,s=t.childrenLength();++i<s;)(r=t.children(i))&&(n[++o]=Sa.decode(r,e));return n}function Fc(t){const e=new Map;if(t)for(let n,r,i=-1,o=Math.trunc(t.customMetadataLength());++i<o;)(n=t.customMetadata(i))&&null!=(r=n.key())&&e.set(r,n.value());return e}function Lc(t){return new so(t.isSigned(),t.bitWidth())}function Dc(t,e){const n=t.typeType();switch(n){case ru.NONE:case ru.Null:return new oo;case ru.Binary:return new co;case ru.Utf8:return new lo;case ru.Bool:return new fo;case ru.List:return new mo((e||[])[0]);case ru.Struct_:return new go(e||[])}switch(n){case ru.Int:{const e=t.type(new au);return new so(e.isSigned(),e.bitWidth())}case ru.FloatingPoint:{const e=t.type(new tc);return new uo(e.precision())}case ru.Decimal:{const e=t.type(new ec);return new ho(e.scale(),e.precision(),e.bitWidth())}case ru.Date:{const e=t.type(new nc);return new po(e.unit())}case ru.Time:{const e=t.type(new rc);return new yo(e.unit(),e.bitWidth())}case ru.Timestamp:{const e=t.type(new ic);return new vo(e.unit(),e.timezone())}case ru.Interval:{const e=t.type(new oc);return new bo(e.unit())}case ru.Union:{const n=t.type(new sc);return new wo(n.mode(),n.typeIdsArray()||[],e||[])}case ru.FixedSizeBinary:{const e=t.type(new ac);return new _o(e.byteWidth())}case ru.FixedSizeList:{const n=t.type(new uc);return new xo(n.listSize(),(e||[])[0])}case ru.Map:{const n=t.type(new cc);return new So((e||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${ru[n]}" (${n})`)}Sa.encode=function(t,e){let n=-1,r=-1,i=-1;const o=e.type;let s=e.typeId;io.isDictionary(o)?(s=o.dictionary.typeId,i=mc.visit(o,t),r=mc.visit(o.dictionary,t)):r=mc.visit(o,t);const a=(o.children||[]).map((e=>Sa.encode(t,e))),u=cu.createChildrenVector(t,a),c=e.metadata&&e.metadata.size>0?cu.createCustomMetadataVector(t,[...e.metadata].map((([e,n])=>{const r=t.createString(`${e}`),i=t.createString(`${n}`);return su.startKeyValue(t),su.addKey(t,r),su.addValue(t,i),su.endKeyValue(t)}))):-1;return e.name&&(n=t.createString(e.name)),cu.startField(t),cu.addType(t,r),cu.addTypeType(t,s),cu.addChildren(t,u),cu.addNullable(t,!!e.nullable),-1!==n&&cu.addName(t,n),-1!==i&&cu.addDictionary(t,i),-1!==c&&cu.addCustomMetadata(t,c),cu.endField(t)},Sa.decode=function(t,e){let n,r,i,o,s,a;return e&&(a=t.dictionary())?e.has(n=a.id().low)?(o=(o=a.indexType())?Lc(o):new ao,s=new To(e.get(n),o,n,a.isOrdered()),r=new Sa(t.name(),s,t.nullable(),Fc(t))):(o=(o=a.indexType())?Lc(o):new ao,e.set(n,i=Dc(t,Bc(t,e))),s=new To(i,o,n,a.isOrdered()),r=new Sa(t.name(),s,t.nullable(),Fc(t))):(i=Dc(t,Bc(t,e)),r=new Sa(t.name(),i,t.nullable(),Fc(t))),r||null},Sa.fromJSON=function(t,e){let n,r,i,o,s,a;return e&&(o=t.dictionary)?e.has(n=o.id)?(r=(r=o.indexType)?Oc(r):new ao,a=new To(e.get(n),r,n,o.isOrdered),i=new Sa(t.name,a,t.nullable,Sc(t.customMetadata))):(r=(r=o.indexType)?Oc(r):new ao,e.set(n,s=Ic(t,wc(t,e))),a=new To(s,r,n,o.isOrdered),i=new Sa(t.name,a,t.nullable,Sc(t.customMetadata))):(s=Ic(t,wc(t,e)),i=new Sa(t.name,s,t.nullable,Sc(t.customMetadata))),i||null},xa.encode=function(t,e){const n=e.fields.map((e=>Sa.encode(t,e)));lu.startFieldsVector(t,n.length);const r=lu.createFieldsVector(t,n),i=e.metadata&&e.metadata.size>0?lu.createCustomMetadataVector(t,[...e.metadata].map((([e,n])=>{const r=t.createString(`${e}`),i=t.createString(`${n}`);return su.startKeyValue(t),su.addKey(t,r),su.addValue(t,i),su.endKeyValue(t)}))):-1;return lu.startSchema(t),lu.addFields(t,r),lu.addEndianness(t,Nc?eu.Little:eu.Big),-1!==i&&lu.addCustomMetadata(t,i),lu.endSchema(t)},xa.decode=function(t,e=new Map){const n=function(t,e){const n=[];for(let r,i=-1,o=-1,s=t.fieldsLength();++i<s;)(r=t.fields(i))&&(n[++o]=Sa.decode(r,e));return n}(t,e);return new xa(n,Fc(t),e)},xa.fromJSON=function(t,e=new Map){return new xa(function(t,e){return(t.fields||[]).filter(Boolean).map((t=>Sa.fromJSON(t,e)))}(t,e),Sc(t.customMetadata),e)},Cc.encode=function(t,e){const n=e.nodes||[],r=e.buffers||[];Ju.startNodesVector(t,n.length);for(const e of n.slice().reverse())kc.encode(t,e);const i=t.endVector();Ju.startBuffersVector(t,r.length);for(const e of r.slice().reverse())jc.encode(t,e);const o=t.endVector();return Ju.startRecordBatch(t),Ju.addLength(t,new Tc(e.length,0)),Ju.addNodes(t,i),Ju.addBuffers(t,o),Ju.endRecordBatch(t)},Cc.decode=function(t,e=Mr.V4){if(null!==t.compression())throw new Error("Record batch compression not implemented");return new Cc(t.length(),function(t){const e=[];for(let n,r=-1,i=-1,o=t.nodesLength();++r<o;)(n=t.nodes(r))&&(e[++i]=kc.decode(n));return e}(t),function(t,e){const n=[];for(let r,i=-1,o=-1,s=t.buffersLength();++i<s;)(r=t.buffers(i))&&(e<Mr.V4&&(r.bb_pos+=8*(i+1)),n[++o]=jc.decode(r));return n}(t,e))},Cc.fromJSON=gc,Pc.encode=function(t,e){const n=Cc.encode(t,e.data);return Qu.startDictionaryBatch(t),Qu.addId(t,new Tc(e.id,0)),Qu.addIsDelta(t,e.isDelta),Qu.addData(t,n),Qu.endDictionaryBatch(t)},Pc.decode=function(t,e=Mr.V4){return new Pc(Cc.decode(t.data(),e),t.id(),t.isDelta())},Pc.fromJSON=function(t){return new Pc(gc(t.data),t.id,t.isDelta)},kc.encode=function(t,e){return Ku.createFieldNode(t,new Tc(e.length,0),new Tc(e.nullCount,0))},kc.decode=function(t){return new kc(t.length(),t.nullCount())},jc.encode=function(t,e){return Xu.createBuffer(t,new Tc(e.offset,0),new Tc(e.length,0))},jc.decode=function(t){return new jc(t.offset(),t.length())};const Nc=(()=>{const t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256===new Int16Array(t)[0]})(),Rc=t=>`Expected ${Br[t]} Message in stream, but was null or length 0.`,zc=t=>`Header pointer of flatbuffer-encoded ${Br[t]} Message is null or length 0.`,Uc=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,Vc=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`;class Wc{constructor(t){this.source=t instanceof Au?t:new Au(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||-1===t.value&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?xu:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Rc(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=Ii(this.source.read(t));if(e.byteLength<t)throw new Error(Vc(t,e.byteLength));return e.byteOffset%8==0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=Br.Schema,n=this.readMessage(e),r=null==n?void 0:n.header();if(t&&!r)throw new Error(zc(e));return r}readMetadataLength(){const t=this.source.read(Yc),e=t&&new iu(t),n=(null==e?void 0:e.readInt32(0))||0;return{done:0===n,value:n}}readMetadata(t){const e=this.source.read(t);if(!e)return xu;if(e.byteLength<t)throw new Error(Uc(t,e.byteLength));return{done:!1,value:Ec.decode(e)}}}class $c{constructor(t,e){this.source=t instanceof Mu?t:pi(t)?new ju(t,e):new Mu(t)}[Symbol.asyncIterator](){return this}next(){return Yr(this,void 0,void 0,(function*(){let t;return(t=yield this.readMetadataLength()).done||-1===t.value&&(t=yield this.readMetadataLength()).done||(t=yield this.readMetadata(t.value)).done?xu:t}))}throw(t){return Yr(this,void 0,void 0,(function*(){return yield this.source.throw(t)}))}return(t){return Yr(this,void 0,void 0,(function*(){return yield this.source.return(t)}))}readMessage(t){return Yr(this,void 0,void 0,(function*(){let e;if((e=yield this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Rc(t));return e.value}))}readMessageBody(t){return Yr(this,void 0,void 0,(function*(){if(t<=0)return new Uint8Array(0);const e=Ii(yield this.source.read(t));if(e.byteLength<t)throw new Error(Vc(t,e.byteLength));return e.byteOffset%8==0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}))}readSchema(t=!1){return Yr(this,void 0,void 0,(function*(){const e=Br.Schema,n=yield this.readMessage(e),r=null==n?void 0:n.header();if(t&&!r)throw new Error(zc(e));return r}))}readMetadataLength(){return Yr(this,void 0,void 0,(function*(){const t=yield this.source.read(Yc),e=t&&new iu(t),n=(null==e?void 0:e.readInt32(0))||0;return{done:0===n,value:n}}))}readMetadata(t){return Yr(this,void 0,void 0,(function*(){const e=yield this.source.read(t);if(!e)return xu;if(e.byteLength<t)throw new Error(Uc(t,e.byteLength));return{done:!1,value:Ec.decode(e)}}))}}class Gc extends Wc{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Su?t:new Su(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Ec.fromJSON(t.schema,Br.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:Ec.fromJSON(e,Br.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:Ec.fromJSON(e,Br.RecordBatch)}}return this._body=[],xu}readMessageBody(t){return function t(e){return(e||[]).reduce(((e,n)=>[...e,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE&&[n.TYPE]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...t(n.children)]),[])}(this._body)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Rc(t));return e.value}readSchema(){const t=Br.Schema,e=this.readMessage(t),n=null==e?void 0:e.header();if(!e||!n)throw new Error(zc(t));return n}}const Yc=4,Zc=new Uint8Array(6);for(let t=0;t<6;t+=1)Zc[t]="ARROW1".codePointAt(t);function Hc(t,e=0){for(let n=-1,r=Zc.length;++n<r;)if(Zc[n]!==t[e+n])return!1;return!0}const qc=Zc.length,Xc=qc+Yc,Kc=2*qc+Yc;class Jc extends Ou{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){const e=this._impl.open(t);return ci(e)?e.then((()=>this)):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return mu.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return mu.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Jc?t:hi(t)?function(t){return new Qc(new ul(t))}(t):pi(t)?function(t){return Yr(this,void 0,void 0,(function*(){const{size:e}=yield t.stat(),n=new ju(t,e);return e>=Kc&&Hc(yield n.readAt(0,qc+7&-8))?new nl(new al(n)):new tl(new ol(n))}))}(t):ci(t)?(()=>Yr(this,void 0,void 0,(function*(){return yield Jc.from(yield t)})))():yi(t)||bi(t)||mi(t)||fi(t)?function(t){return Yr(this,void 0,void 0,(function*(){const e=yield t.peek(qc+7&-8);return e&&e.byteLength>=4?Hc(e)?new el(new sl(yield t.read())):new tl(new ol(t)):new tl(new ol(function(){return Hr(this,arguments,(function*(){}))}()))}))}(new Mu(t)):function(t){const e=t.peek(qc+7&-8);return e&&e.byteLength>=4?Hc(e)?new el(new sl(t.read())):new Qc(new il(t)):new Qc(new il(function*(){}()))}(new Au(t))}static readAll(t){return t instanceof Jc?t.isSync()?ll(t):fl(t):hi(t)||ArrayBuffer.isView(t)||li(t)||di(t)?ll(t):fl(t)}}class Qc extends Jc{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Hr(this,arguments,(function*(){yield Zr(yield*qr(Xr(this[Symbol.iterator]())))}))}}class tl extends Jc{constructor(t){super(t),this._impl=t}readAll(){var t,e;return Yr(this,void 0,void 0,(function*(){const n=new Array;try{for(var r,i=Xr(this);!(r=yield i.next()).done;){const t=r.value;n.push(t)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=i.return)&&(yield e.call(i))}finally{if(t)throw t.error}}return n}))}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class el extends Qc{constructor(t){super(t),this._impl=t}}class nl extends tl{constructor(t){super(t),this._impl=t}}class rl{constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const n=this._loadVectors(t,e,this.schema.fields),r=_a({type:new go(this.schema.fields),length:t.length,children:n});return new za(this.schema,r)}_loadDictionaryBatch(t,e){const{id:n,isDelta:r}=t,{dictionaries:i,schema:o}=this,s=i.get(n);if(r||!s){const i=o.dictionaries.get(n),a=this._loadVectors(t.data,e,[i]);return(s&&r?s.concat(new ba(a)):new ba(a)).memoize()}return s.memoize()}_loadVectors(t,e,n){return new Ru(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}}class il extends rl{constructor(t,e){super(e),this._reader=hi(t)?new Gc(this._handle=t):new Wc(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=cl(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):xu}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):xu}next(){if(this.closed)return xu;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),r=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),r=e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new Wa(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class ol extends rl{constructor(t,e){super(e),this._reader=new $c(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Yr(this,void 0,void 0,(function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}))}open(t){return Yr(this,void 0,void 0,(function*(){return this.closed||(this.autoDestroy=cl(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this}))}throw(t){return Yr(this,void 0,void 0,(function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):xu}))}return(t){return Yr(this,void 0,void 0,(function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):xu}))}next(){return Yr(this,void 0,void 0,(function*(){if(this.closed)return xu;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),r=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),r=yield e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new Wa(this.schema)}):yield this.return()}))}_readNextMessageAndValidate(t){return Yr(this,void 0,void 0,(function*(){return yield this._reader.readMessage(t)}))}}class sl extends il{constructor(t,e){super(t instanceof Pu?t:new Pu(t),e)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const n=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){const t=this._reader.readMessage(Br.RecordBatch);if(null==t?void 0:t.isRecordBatch()){const e=t.header(),n=this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,n)}}return null}_readDictionaryBatch(t){var e;const n=null===(e=this._footer)||void 0===e?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){const t=this._reader.readMessage(Br.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){const e=t.header(),n=this._reader.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(e,n);this.dictionaries.set(e.id,r)}}}_readFooter(){const{_handle:t}=this,e=t.size-Xc,n=t.readInt32(e),r=t.readAt(e-n,n);return yu.decode(r)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const n=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}}class al extends ol{constructor(t,...e){const n="number"!=typeof e[0]?e.shift():void 0,r=e[0]instanceof Map?e.shift():void 0;super(t instanceof ju?t:new ju(t,n),r)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}open(t){const e=Object.create(null,{open:{get:()=>super.open}});return Yr(this,void 0,void 0,(function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)}))}readRecordBatch(t){var e;return Yr(this,void 0,void 0,(function*(){if(this.closed)return null;this._footer||(yield this.open());const n=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){const t=yield this._reader.readMessage(Br.RecordBatch);if(null==t?void 0:t.isRecordBatch()){const e=t.header(),n=yield this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,n)}}return null}))}_readDictionaryBatch(t){var e;return Yr(this,void 0,void 0,(function*(){const n=null===(e=this._footer)||void 0===e?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){const t=yield this._reader.readMessage(Br.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){const e=t.header(),n=yield this._reader.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(e,n);this.dictionaries.set(e.id,r)}}}))}_readFooter(){return Yr(this,void 0,void 0,(function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-Xc,n=yield t.readInt32(e),r=yield t.readAt(e-n,n);return yu.decode(r)}))}_readNextMessageAndValidate(t){return Yr(this,void 0,void 0,(function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null}))}}class ul extends il{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new zu(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}}function cl(t,e){return e&&"boolean"==typeof e.autoDestroy?e.autoDestroy:t.autoDestroy}function*ll(t){const e=Jc.from(t);try{if(!e.open({autoDestroy:!1}).closed)do{yield e}while(!e.reset().open().closed)}finally{e.cancel()}}function fl(t){return Hr(this,arguments,(function*(){const e=yield Zr(Jc.from(t));try{if(!(yield Zr(e.open({autoDestroy:!1}))).closed)do{yield yield Zr(e)}while(!(yield Zr(e.reset().open())).closed)}finally{yield Zr(e.cancel())}}))}function hl(t){const e=Jc.from(t);return ci(e)?e.then((t=>hl(t))):e.isAsync()?e.readAll().then((t=>new Ya(t))):new Ya(e.readAll())}function dl(t){return dl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dl(t)}function pl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return yl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function yl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function vl(){vl=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var o=e&&e.prototype instanceof h?e:h,s=Object.create(o.prototype),a=new I(i||[]);return r(s,"_invoke",{value:_(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==e&&n.call(b,o)&&(y=b);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(r,o,s,a){var u=l(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==dl(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function _(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=l(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,r(m,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new w(c(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},g(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function bl(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function ml(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){bl(o,r,i,s,a,"next",t)}function a(t){bl(o,r,i,s,a,"throw",t)}s(void 0)}))}}function gl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==dl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==dl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===dl(i)?i:String(i)),r)}var i}function wl(t,e){return wl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wl(t,e)}function _l(t){return _l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_l(t)}var xl=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wl(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=_l(r);if(i){var n=_l(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===dl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(n=o.call(this,t,0,r)).app=e,n.info=void 0,n.infoLoadingStatus="notLoaded",n.cache={},n.readParquetFun=r.readParquetFun,n}return e=s,n=[{key:"loadInfo",value:function(t){var e=this;return this.info||"notLoaded"!==this.infoLoadingStatus?!t||"loaded"!==this.infoLoadingStatus&&"failed"!==this.infoLoadingStatus||t():ml(vl().mark((function n(){var r;return vl().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,$r(e.url+"info.json");case 3:r=n.sent,e.info=r,e.resolution=r.resolutionGeo,e.infoLoadingStatus="loaded",t&&t(),n.next=13;break;case 10:n.prev=10,n.t0=n.catch(0),e.infoLoadingStatus="failed";case 13:case"end":return n.stop()}}),n,null,[[0,10]])})))(),this}},{key:"getTilingEnvelope",value:function(t){if(this.info){var e=this.info.originPoint,n=this.info.resolutionGeo,r=this.info.tileSizeCell;return{xMin:Math.floor((t.xMin-e.x)/(n*r)),xMax:Math.floor((t.xMax-e.x)/(n*r)),yMin:Math.floor((t.yMin-e.y)/(n*r)),yMax:Math.floor((t.yMax-e.y)/(n*r))}}this.loadInfo((function(){}))}},{key:"getData",value:function(t,e){var n=this;if(!this.info)return this;var r=this.getTilingEnvelope(t);if(!r)return this;for(var i=this.info.tilingBounds,o=this.info.format,s=function(t){for(var s=function(r){if(n.cache[t]||(n.cache[t]={}),n.cache[t][r])return"continue";n.cache[t][r]="loading",ml(vl().mark((function i(){var s,a,u,c,l,f,h,d,p,y,v,b,m,g,w,_,x,S,O,I,T;return vl().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(i.prev=0,o&&"CSV"!==o){i.next=33;break}return i.next=4,lr(n.url+t+"/"+r+".csv");case 4:if(a=i.sent,!n.preprocess){i.next=29;break}s=[],u=pl(a),i.prev=9,u.s();case 11:if((c=u.n()).done){i.next=19;break}if(l=c.value,0!=n.preprocess(l)){i.next=16;break}return i.abrupt("continue",17);case 16:s.push(l);case 17:i.next=11;break;case 19:i.next=24;break;case 21:i.prev=21,i.t0=i.catch(9),u.e(i.t0);case 24:return i.prev=24,u.f(),i.finish(24);case 27:i.next=30;break;case 29:s=a;case 30:i.next=74;break;case 33:if("PARQUET"!==o){i.next=73;break}if(n.readParquetFun){i.next=36;break}throw new Error("readParquet function needed for parquet dataset");case 36:return i.next=38,fetch(n.url+t+"/"+r+".parquet");case 38:return f=i.sent,i.t1=Uint8Array,i.next=42,f.arrayBuffer();case 42:i.t2=i.sent,h=new i.t1(i.t2),d=n.readParquetFun(h),p=hl(d),s=[],y=pl(p),i.prev=48,y.s();case 50:if((v=y.n()).done){i.next=63;break}if(b=v.value,m=b.toJSON(),!n.preprocess){i.next=60;break}if(0!=n.preprocess(m)){i.next=57;break}return i.abrupt("continue",61);case 57:s.push(m),i.next=61;break;case 60:s.push(m);case 61:i.next=50;break;case 63:i.next=68;break;case 65:i.prev=65,i.t3=i.catch(48),y.e(i.t3);case 68:return i.prev=68,y.f(),i.finish(68);case 71:i.next=74;break;case 73:throw new Error("Tiled format not supported: "+o);case 74:i.next=80;break;case 76:return i.prev=76,i.t4=i.catch(0),n.cache[t][r]="failed",i.abrupt("return");case 80:if(n.info){i.next=83;break}return console.error("Tile info inknown"),i.abrupt("return");case 83:if(g=new Ur(s,t,r,n.info),n.cache[t][r]=g,e){i.next=88;break}return i.abrupt("return");case 88:w=!1,_=n.app.getZoomFactor(),x=pl(n.app.layers),i.prev=91,x.s();case 93:if((S=x.n()).done){i.next=103;break}if((O=S.value).visible){i.next=97;break}return i.abrupt("continue",101);case 97:if(O.getDatasetComponent(_)==n){i.next=99;break}return i.abrupt("continue",101);case 99:return w=!0,i.abrupt("break",103);case 101:i.next=93;break;case 103:i.next=108;break;case 105:i.prev=105,i.t5=i.catch(91),x.e(i.t5);case 108:return i.prev=108,x.f(),i.finish(108);case 111:if(w){i.next=114;break}return i.abrupt("return");case 114:if(I=n.app.updateExtentGeo(),T=g.extGeo,!(I.xMax<=T.xMin)){i.next=118;break}return i.abrupt("return");case 118:if(!(I.xMin>=T.xMax)){i.next=120;break}return i.abrupt("return");case 120:if(!(I.yMax<=T.yMin)){i.next=122;break}return i.abrupt("return");case 122:if(!(I.yMin>=T.yMax)){i.next=124;break}return i.abrupt("return");case 124:e();case 127:case"end":return i.stop()}}),i,null,[[0,76],[9,21,24,27],[48,65,68,71],[91,105,108,111]])})))()},a=Math.max(r.yMin,i.yMin);a<=Math.min(r.yMax,i.yMax);a++)s(a)},a=Math.max(r.xMin,i.xMin);a<=Math.min(r.xMax,i.xMax);a++)s(a);return this}},{key:"updateViewCache",value:function(t){if(this.cellsViewCache=[],this.info){var e=this.getTilingEnvelope(t);if(e)for(var n=this.info.tilingBounds,r=Math.max(e.xMin,n.xMin);r<=Math.min(e.xMax,n.xMax);r++)if(this.cache[r])for(var i=Math.max(e.yMin,n.yMin);i<=Math.min(e.yMax,n.yMax);i++){var o=this.cache[r][i];if(o&&"string"!=typeof o){var s,a=pl(o.cells);try{for(a.s();!(s=a.n()).done;){var u=s.value;+u.x+this.resolution<t.xMin||+u.x-this.resolution>t.xMax||+u.y+this.resolution<t.yMin||+u.y-this.resolution>t.yMax||this.cellsViewCache.push(u)}}catch(t){a.e(t)}finally{a.f()}}}}}}],n&&gl(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(pr);function Sl(t){return Sl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sl(t)}function Ol(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Sl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Sl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Sl(i)?i:String(i)),r)}var i}var Il=function(){function t(e){var n=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.visible=0!=e.visible,this.minZoom=e.minZoom||0,this.maxZoom=e.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");if(this.cache={},this.url=e.url,this.urlFun=e.urlFun||function(t,e,r){return n.url+r+"/"+t+"/"+e+".png"},this.resolutions=e.resolutions,!this.resolutions||0==this.resolutions.length)throw new Error("No resolutions provided for background layer");this.nbPix=e.nbPix||256,this.origin=e.origin||[0,0],this.z0=e.z0||0,this.filterColor=e.filterColor}var e,n;return e=t,n=[{key:"get",value:function(t,e,n){var r=this.cache[t];if(r&&(r=r[e]))return r[n]}},{key:"put",value:function(t,e,n,r){this.cache[e]||(this.cache[e]={}),this.cache[e][n]||(this.cache[e][n]={}),this.cache[e][n][r]=t}},{key:"draw",value:function(t){var e=this;if(this.resolutions&&0!=this.resolutions.length){var n=t.getZf(),r=this.origin[0],i=this.origin[1],o=0;for(o=0;o<this.resolutions.length&&!(this.resolutions[o]<n);o++);o-=1,o=Math.max(0,o),o=Math.min(o,this.resolutions.length-1);var s=this.resolutions[o];o+=this.z0;for(var a=this.nbPix*s,u=a/n,c=function(t){return Math.ceil((t-r)/a)},l=function(t){return Math.ceil(-(t-i)/a)},f=c(t.extGeo.xMin)-1,h=c(t.extGeo.xMax),d=l(t.extGeo.yMin),p=l(t.extGeo.yMax)-1,y=function(n){for(var s=function(s){var c=e.get(o,n,s);if(!c){var l=new Image;return e.put(l,o,n,s),l.onload=function(){t.redraw()},l.onerror=function(){e.put("failed",o,n,s)},l.src=e.urlFun(n,s,o),"continue"}if("failed"===c)return"continue";if(!(c instanceof HTMLImageElement))return console.log(c),"continue";if(0==c.width||0==c.height)return"continue";var f=r+n*a,h=i-s*a;try{t.ctx.drawImage(c,t.geoToPixX(f),t.geoToPixY(h),u,u)}catch(t){console.error(t)}},c=p;c<d;c++)s(c)},v=f;v<h;v++)y(v);if(this.filterColor){var b=this.filterColor(n);b&&"none"!=b&&(t.ctx.fillStyle=b,t.ctx.fillRect(0,0,t.w,t.h))}}else console.error("No resolutions provided for background layer")}}],n&&Ol(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Tl(t){return Tl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tl(t)}function Al(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Tl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Tl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Tl(i)?i:String(i)),r)}var i}var Ml=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.visible=0!=e.visible,this.minZoom=e.minZoom||0,this.maxZoom=e.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");this.url=e.url,this.filterColor=e.filterColor,this.img=void 0,this.xMin=void 0,this.xMax=void 0,this.yMin=void 0,this.yMax=void 0}var e,n;return e=t,(n=[{key:"hasMoved",value:function(t){return t.xMin!=this.xMin||t.xMax!=this.xMax||t.yMin!=this.yMin||t.yMax!=this.yMax}},{key:"draw",value:function(t){if(t.updateExtentGeo(0),!this.hasMoved(t.extGeo)&&this.img)t.ctx.drawImage(this.img,0,0,t.w,t.h);else{this.xMin=t.extGeo.xMin,this.xMax=t.extGeo.xMax,this.yMin=t.extGeo.yMin,this.yMax=t.extGeo.yMax;var e=[];e.push(this.url),e.push("&width="),e.push(t.w),e.push("&height="),e.push(t.h),e.push("&bbox="),e.push(t.extGeo.xMin),e.push(","),e.push(t.extGeo.yMin),e.push(","),e.push(t.extGeo.xMax),e.push(","),e.push(t.extGeo.yMax);var n=e.join("");this.img||(this.img=new Image,this.img.onload=function(){t.redraw()},this.img.onerror=function(){console.warn("Could not retrieve WMS background image from",n)}),this.img.src=n}var r=t.getZf();if(this.filterColor){var i=this.filterColor(r);i&&"none"!=i&&(t.ctx.fillStyle=i,t.ctx.fillRect(0,0,t.w,t.h))}}}])&&Al(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function El(t){return El="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},El(t)}function Cl(){Cl=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var o=e&&e.prototype instanceof h?e:h,s=Object.create(o.prototype),a=new I(i||[]);return r(s,"_invoke",{value:_(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==e&&n.call(b,o)&&(y=b);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(r,o,s,a){var u=l(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==El(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function _(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=l(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,r(m,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new w(c(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},g(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function Pl(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function jl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return kl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function kl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Bl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==El(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==El(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===El(i)?i:String(i)),r)}var i}var Fl=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.url=e.url,this.style=e.style||function(){return"bold 1em Arial"},this.color=e.color||(e.dark?function(){return"#ddd"}:function(){return"#222"}),this.haloColor=e.haloColor||(e.dark?function(){return"#000000BB"}:function(){return"#FFFFFFBB"}),this.haloWidth=e.haloWidth||function(){return 4},this.textAlign=e.textAlign||"start",this.offsetPix=e.offsetPix||[5,5],this.preprocess=e.preprocess,this.labels=void 0,this.loadingStatus="notLoaded"}var e,n,r,i;return e=t,n=[{key:"draw",value:function(t){if(this.labels){var e=t.getZf();t.ctx.textAlign=this.textAlign||"start",t.ctx.lineJoin="bevel",t.ctx.lineCap="butt",t.initCanvasTransform();var n,r=jl(this.labels);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=this.style(i,e);if(o&&(t.ctx.font=o,t.toDraw(i))){var s=t.geoToPixX(i.x)+this.offsetPix[0],a=t.geoToPixY(i.y)-this.offsetPix[1];if(this.haloColor&&this.haloWidth){var u=this.haloColor(i,e),c=this.haloWidth(i,e);u&&c&&c>0&&(t.ctx.strokeStyle=u,t.ctx.lineWidth=c,t.ctx.strokeText(i.name,s,a))}if(this.color){var l=this.color(i,e);l&&(t.ctx.fillStyle=l,t.ctx.fillText(i.name,s,a))}}}}catch(t){r.e(t)}finally{r.f()}}else this.load(t.redraw)}},{key:"load",value:(r=Cl().mark((function t(e){var n,r,i,o;return Cl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.url){t.next=5;break}return console.log("Failed loading labels: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.abrupt("return");case 5:if("notLoaded"==this.loadingStatus){t.next=7;break}return t.abrupt("return");case 7:return this.loadingStatus="loading",t.prev=8,t.next=11,lr(this.url);case 11:if(n=t.sent,!this.preprocess){t.next=35;break}this.labels=[],r=jl(n),t.prev=15,r.s();case 17:if((i=r.n()).done){t.next=25;break}if(o=i.value,0!=this.preprocess(o)){t.next=22;break}return t.abrupt("continue",23);case 22:this.labels.push(o);case 23:t.next=17;break;case 25:t.next=30;break;case 27:t.prev=27,t.t0=t.catch(15),r.e(t.t0);case 30:return t.prev=30,r.f(),t.finish(30);case 33:t.next=36;break;case 35:this.labels=n;case 36:this.loadingStatus="loaded",e&&e(),t.next=45;break;case 40:t.prev=40,t.t1=t.catch(8),console.log("Failed loading labels from "+this.url),this.labels=[],this.loadingStatus="failed";case 45:case"end":return t.stop()}}),t,this,[[8,40],[15,27,30,33]])})),i=function(){var t=this,e=arguments;return new Promise((function(n,i){var o=r.apply(t,e);function s(t){Pl(o,n,i,s,a,"next",t)}function a(t){Pl(o,n,i,s,a,"throw",t)}s(void 0)}))},function(t){return i.apply(this,arguments)})}],n&&Bl(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ll(t){return Ll="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ll(t)}function Dl(){Dl=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var o=e&&e.prototype instanceof h?e:h,s=Object.create(o.prototype),a=new I(i||[]);return r(s,"_invoke",{value:_(t,n,a)}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function d(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==e&&n.call(b,o)&&(y=b);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(r,o,s,a){var u=l(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==Ll(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(f).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function _(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=l(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,r(m,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new w(c(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},g(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function Nl(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function Rl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return zl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function zl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ul(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Ll(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Ll(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Ll(i)?i:String(i)),r)}var i}var Vl=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.url=e.url,this.preprocess=e.preprocess,this.color=e.color||function(t,e){return"gray"},this.width=e.width||function(t,e){return 2},this.lineDash=e.lineDash||function(t,e){},this.fs=void 0,this.loadingStatus="notLoaded"}var e,n,r,i;return e=t,n=[{key:"draw",value:function(t){if(this.fs){var e=t.getZf();t.setCanvasTransform();var n,r=Rl(this.fs);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.geometry.coordinates;if(!(o.length<2)){var s=this.color(i,e);if(s&&"none"!=s){t.ctx.strokeStyle=s;var a=this.width(i,e);if(a&&!(a<0)){t.ctx.lineWidth=a*e;var u=this.lineDash(i,e);u&&t.ctx.setLineDash(u),t.ctx.beginPath(),t.ctx.moveTo(o[0][0],o[0][1]);for(var c=1;c<o.length;c++)t.ctx.lineTo(o[c][0],o[c][1]);t.ctx.stroke()}}}}}catch(t){r.e(t)}finally{r.f()}t.ctx.setLineDash([])}else this.load(t.redraw)}},{key:"load",value:(r=Dl().mark((function t(e){var n,r,i,o,s;return Dl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.url){t.next=5;break}return console.log("Failed loading boundaries: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.abrupt("return");case 5:if("notLoaded"==this.loadingStatus){t.next=7;break}return t.abrupt("return");case 7:return this.loadingStatus="loading",t.prev=8,t.next=11,$r(this.url);case 11:if(n=t.sent,r=n.features,!this.preprocess){t.next=36;break}this.fs=[],i=Rl(r),t.prev=16,i.s();case 18:if((o=i.n()).done){t.next=26;break}if(s=o.value,0!=this.preprocess(s)){t.next=23;break}return t.abrupt("continue",24);case 23:this.fs.push(s);case 24:t.next=18;break;case 26:t.next=31;break;case 28:t.prev=28,t.t0=t.catch(16),i.e(t.t0);case 31:return t.prev=31,i.f(),t.finish(31);case 34:t.next=37;break;case 36:this.fs=r;case 37:this.loadingStatus="loaded",e&&e(),t.next=46;break;case 41:t.prev=41,t.t1=t.catch(8),console.log("Failed loading boundaries from "+this.url),this.fs=[],this.loadingStatus="failed";case 46:case"end":return t.stop()}}),t,this,[[8,41],[16,28,31,34]])})),i=function(){var t=this,e=arguments;return new Promise((function(n,i){var o=r.apply(t,e);function s(t){Nl(o,n,i,s,a,"next",t)}function a(t){Nl(o,n,i,s,a,"throw",t)}s(void 0)}))},function(t){return i.apply(this,arguments)})}],n&&Ul(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Wl(t){return Wl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wl(t)}function $l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Gl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Gl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Yl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Wl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Wl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Wl(i)?i:String(i)),r)}var i}var Zl=function(){function t(e,n){var r=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n=n||{},this.layers=[],e=e||document.getElementById("gridviz")){this.w=n.w||e.offsetWidth,this.h=n.h||e.offsetHeight;var i=n.canvas||null;i||((i=document.createElement("canvas")).setAttribute("width",""+this.w),i.setAttribute("height",""+this.h),e.appendChild(i)),this.cg=new Rn(i,void 0,1,n),this.cg.redraw=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];r.legend&&t&&r.legend.selectAll("*").remove(),r.cg.initCanvasTransform(),r.cg.clear(r.cg.backgroundColor);var n=r.getZoomFactor();r.updateExtentGeo();var o,s=$l(r.bgLayers);try{for(s.s();!(o=s.n()).done;){var a=o.value;a.visible&&(n>a.maxZoom||n<a.minZoom||a.draw(r.cg))}}catch(t){s.e(t)}finally{s.f()}var u,c=$l(r.layers);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(l.visible&&!(n>l.maxZoom||n<l.minZoom)){var f=l.getDatasetComponent(n);if(f){if(t&&f.getData(r.cg.extGeo,(function(){r.cg.redraw()})),t&&f.updateViewCache(r.cg.extGeo),t){var h,d=$l(l.styles);try{for(d.s();!(h=d.n()).done;){var p=h.value;n>p.maxZoom||n<p.minZoom||p.draw(f.getViewCache(),f.getResolution(),r.cg)}}catch(t){d.e(t)}finally{d.f()}}if(r.legend&&t){var y,v=$l(l.styles);try{for(v.s();!(y=v.n()).done;){var b=y.value;if(!(n>b.maxZoom||n<b.minZoom)){var m,g=$l(b.legends);try{for(g.s();!(m=g.n()).done;){var w=m.value;r.legend.node().append(w.div.node())}}catch(t){g.e(t)}finally{g.f()}if(b.styles){var _,x=$l(b.styles);try{for(x.s();!(_=x.n()).done;){var S=_.value;if(!(n>S.maxZoom||n<S.minZoom)){var O,I=$l(S.legends);try{for(I.s();!(O=I.n()).done;){var T=O.value;r.legend.node().append(T.div.node())}}catch(t){I.e(t)}finally{I.f()}}}}catch(t){x.e(t)}finally{x.f()}}}}}catch(t){v.e(t)}finally{v.f()}}}}}}catch(t){c.e(t)}finally{c.f()}return r.showBoundaries&&r.boundaryLayer&&r.boundaryLayer.draw(r.cg),r.showLabels&&r.labelLayer&&r.labelLayer.draw(r.cg),r.canvasSave=null,r.defineResizeObserver(e,i),r},this.bgLayers=[],this.showBgLayers=!0,this.labelLayer=void 0,this.showLabels=!0,this.boundaryLayer=void 0,this.showBoundaries=!0,this.legendDivId=n.legendDivId||"gvizLegend",this.legend=pt("#"+this.legendDivId),this.legend.empty()&&(this.legend=pt("#"+e.id).append("div").attr("id",this.legendDivId).style("position","absolute").style("width","auto").style("height","auto").style("background","#FFFFFFCC").style("border","0px").style("border-radius","5px").style("box-shadow","3px 3px 3px grey, -3px -3px 3px #ddd").style("font-family","Helvetica, Arial, sans-serif").style("top","20px").style("right","20px")),n.tooltip||(n.tooltip={}),n.tooltip.parentElement||(n.tooltip.parentElement=e),this.tooltip=new Kn(n.tooltip);var o=function(t){var e={x:r.cg.pixToGeoX(t.offsetX+r.tooltip.xMouseOffset),y:r.cg.pixToGeoY(t.offsetY+r.tooltip.yMouseOffset)},i=r.getCellFocusInfo(e);if(n.transparentBackground)return i?(r.tooltip.setPosition(t),r.tooltip.show(),r.tooltip.html(i.html)):r.tooltip.hide(),r.canvasSave=document.createElement("canvas"),r.canvasSave.setAttribute("width",""+r.w),r.canvasSave.setAttribute("height",""+r.h),r.canvasSave.getContext("2d").drawImage(r.cg.canvas,0,0),void r.cg.initCanvasTransform();if(i){r.tooltip.setPosition(t),r.tooltip.show(),r.tooltip.html(i.html),r.canvasSave?r.cg.ctx.drawImage(r.canvasSave,0,0):(r.canvasSave=document.createElement("canvas"),r.canvasSave.setAttribute("width",""+r.w),r.canvasSave.setAttribute("height",""+r.h),r.canvasSave.getContext("2d").drawImage(r.cg.canvas,0,0));var o=r.selectionRectangleWidthPix?r.selectionRectangleWidthPix(i.resolution,r.getZoomFactor()):4;r.cg.initCanvasTransform(),r.cg.ctx.strokeStyle=r.selectionRectangleColor,r.cg.ctx.lineWidth=o,r.cg.ctx.beginPath(),r.cg.ctx.rect(r.cg.geoToPixX(i.cell.x)-o/2,r.cg.geoToPixY(i.cell.y)+o/2,i.resolution/r.getZoomFactor()+o,-i.resolution/r.getZoomFactor()-o),r.cg.ctx.stroke()}else r.tooltip.hide(),r.canvasSave&&r.cg.ctx.drawImage(r.canvasSave,0,0)};e.addEventListener("mouseover",(function(t){o(t)})),e.addEventListener("mousemove",(function(t){o(t)})),e.addEventListener("mouseout",(function(){r.tooltip.hide()})),this.cg.onZoomStartFun=function(t){n.onZoomStartFun&&n.onZoomStartFun(t),r.tooltip.hide()},this.canvasSave=null,this.selectionRectangleColor=n.selectionRectangleColor||"red",this.selectionRectangleWidthPix=n.selectionRectangleWidthPix||function(){return 4}}else console.error("Cannot find gridviz container element.")}var e,n;return e=t,n=[{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.cg.updateExtentGeo(t)}},{key:"getCellFocusInfo",value:function(t){for(var e=this.getZoomFactor(),n=this.layers.length-1;n>=0;n--){var r=this.layers[n];if(r.visible&&r.cellInfoHTML&&"none"!==r.cellInfoHTML){var i=r.getDatasetComponent(e);if(i){var o=i.getCellFromPosition(t,i.getViewCache());if(!o)return;var s=r.cellInfoHTML(o,i.getResolution());if(!s)return;return{cell:o,html:s,resolution:i.getResolution()}}}}}},{key:"getGeoCenter",value:function(){return this.cg.getCenter()}},{key:"setGeoCenter",value:function(t){return this.cg.setCenter(t),this}},{key:"getZoomFactor",value:function(){return this.cg.getZf()}},{key:"setZoomFactor",value:function(t){return this.cg.setZf(t),this}},{key:"getZoomFactorExtent",value:function(){return this.cg.getZfExtent()}},{key:"setZoomFactorExtent",value:function(t){return this.cg.setZfExtent(t),this}},{key:"getBackgroundColor",value:function(){return this.cg.backgroundColor}},{key:"setBackgroundColor",value:function(t){return this.cg.backgroundColor=t,this}},{key:"getBoundaryLayer",value:function(){return this.boundaryLayer}},{key:"setBoundaryLayer",value:function(t){return this.boundaryLayer=new Vl(t),this}},{key:"getLabelLayer",value:function(){return this.labelLayer}},{key:"setLabelLayer",value:function(t){return this.labelLayer=new Fl(t),this}},{key:"redraw",value:function(){return this.cg.redraw(),this}},{key:"addLayerFromDataset",value:function(t,e,n){var r=new Vn(t,e,n);return this.layers.push(r),this}},{key:"makeCSVGridDataset",value:function(t,e,n){var r=this;return new Zn([new Sr(t,e,n).getData(void 0,(function(){r.cg.redraw()}))],[],n)}},{key:"makeTiledGridDataset",value:function(t,e){var n=this;return new Zn([new xl(t,this,e).loadInfo((function(){n.cg.redraw()}))],[],e)}},{key:"makeMultiScaleCSVGridDataset",value:function(t,e,n){var r=this;return Zn.make(t,(function(t){return new Sr(e(t),t,n).getData(void 0,(function(){r.cg.redraw()}))}),n)}},{key:"makeMultiScaleTiledGridDataset",value:function(t,e,n){var r=this;return Zn.make(t,(function(t){return new xl(e(t),r,n).loadInfo((function(){r.cg.redraw()}))}),n)}},{key:"addCSVGridLayer",value:function(t,e,n,r){var i=this.makeCSVGridDataset(t,e,r);return this.addLayerFromDataset(i,n,r)}},{key:"addTiledGridLayer",value:function(t,e,n){var r=this.makeTiledGridDataset(t,n);return this.addLayerFromDataset(r,e,n)}},{key:"addMultiScaleCSVGridLayer",value:function(t,e,n,r){var i=this.makeMultiScaleCSVGridDataset(t,e,r);return this.addLayerFromDataset(i,n,r)}},{key:"addMultiScaleTiledGridLayer",value:function(t,e,n,r){var i=this.makeMultiScaleTiledGridDataset(t,e,r);return this.addLayerFromDataset(i,n,r)}},{key:"addBackgroundLayer",value:function(t){return this.bgLayers.push(new Il(t)),this.redraw(),this}},{key:"addBackgroundLayerWMS",value:function(t){return this.bgLayers.push(new Ml(t)),this.redraw(),this}},{key:"addZoomSlider",value:function(t,e){return this.cg.addZoomSlider(t,e),this}},{key:"setViewFromURL",value:function(){return this.cg.setViewFromURL(),this}},{key:"defineResizeObserver",value:function(t,e){var n=this;new ResizeObserver((function(r){t.clientWidth>0&&t.clientHeight>0&&window.requestAnimationFrame((function(){Array.isArray(r)&&r.length&&(n.h===t.clientHeight&&n.w===t.clientWidth||(n.h=t.clientHeight,n.w=t.clientWidth,n.cg.h=t.clientHeight,n.cg.w=t.clientWidth,e.setAttribute("width",""+n.w),e.setAttribute("height",""+n.h),n.redraw()))}))})).observe(t)}}],n&&Yl(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Hl(t){return Hl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hl(t)}function ql(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Xl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Xl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Kl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Hl(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Hl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Hl(i)?i:String(i)),r)}var i}var Jl=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.filter=e.filter||function(){return!0},this.offset=e.offset||function(t,e,n){return{dx:0,dy:0}},this.minZoom=e.minZoom||0,this.maxZoom=e.maxZoom||1/0,this.minZoom>=this.maxZoom)throw new Error("Unexpected zoom limits for layer. Zoom min should be smaller than zoom max.");this.legends=[]}var e,n,r;return e=t,r=[{key:"getStatistics",value:function(t,e,n){if(t&&0!=t.length){var r,i=1/0,o=-1/0,s=ql(t);try{for(s.s();!(r=s.n()).done;){var a=+e(r.value);n&&!a||(a<i&&(i=a),a>o&&(o=a))}}catch(t){s.e(t)}finally{s.f()}return{min:i,max:o}}}}],(n=[{key:"draw",value:function(t,e,n){throw new Error("Method draw not implemented.")}},{key:"getOffset",value:function(){return this.offset}},{key:"setOffset",value:function(t){return this.offset=t,this}},{key:"updateLegends",value:function(t){var e,n=ql(this.legends);try{for(n.s();!(e=n.n()).done;)e.value.update(t)}catch(t){n.e(t)}finally{n.f()}return this}}])&&Kl(e.prototype,n),r&&Kl(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ql(t){return Ql="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ql(t)}function tf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ef(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Ql(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Ql(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Ql(i)?i:String(i)),r)}var i}function nf(t,e){return nf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nf(t,e)}function rf(t){return rf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rf(t)}var of=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=rf(r);if(i){var n=rf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Ql(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.sizeCol=t.sizeCol,e.size=t.size,e.shape=t.shape||function(){return"square"},e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s=n.getZf();this.sizeCol&&(t.sort((function(t,e){return e[r.sizeCol]-t[r.sizeCol]})),i=Jl.getStatistics(t,(function(t){return t[r.sizeCol]}),!0)),this.colorCol&&(o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),n.setCanvasTransform();var a,u=.5*e,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return tf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(c.s();!(a=c.n()).done;){var l=a.value,f=this.color?this.color(l[this.colorCol],e,o,s):void 0;if(f&&"none"!==f){n.ctx.fillStyle=f;var h=this.shape?this.shape(l):"square";if("none"!==h){var d=(this.size||function(){return e})(l[this.sizeCol],e,i,s),p=this.offset(l,e,s);if("square"===h){var y=e*(1-d/e)*.5;n.ctx.fillRect(l.x+y+p.dx,l.y+y+p.dy,d,d)}else if("circle"===h)n.ctx.beginPath(),n.ctx.arc(l.x+u+p.dx,l.y+u+p.dy,.5*d,0,2*Math.PI,!1),n.ctx.fill();else if("donut"===h){var v=l.x+u+p.dx,b=l.y+u+p.dy;n.ctx.beginPath(),n.ctx.moveTo(v,b),n.ctx.arc(v,b,u,0,2*Math.PI),n.ctx.arc(v,b,(1-d/e)*u,0,2*Math.PI,!0),n.ctx.closePath(),n.ctx.fill()}else{if("diamond"!==h)throw new Error("Unexpected shape:"+h);var m=.5*d;n.ctx.beginPath(),n.ctx.moveTo(l.x+u-m,l.y+u),n.ctx.lineTo(l.x+u,l.y+u+m),n.ctx.lineTo(l.x+u+m,l.y+u),n.ctx.lineTo(l.x+u,l.y+u-m),n.ctx.fill()}}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:s,sSize:i,sColor:o})}}])&&ef(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function sf(t){return sf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sf(t)}function af(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function uf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==sf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==sf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===sf(i)?i:String(i)),r)}var i}function cf(t,e){return cf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cf(t,e)}function lf(t){return lf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lf(t)}var ff=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=lf(r);if(i){var n=lf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===sf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.strokeColorCol=t.strokeColorCol,e.strokeColor=t.strokeColor||function(){return"#666"},e.sizeCol=t.sizeCol,e.size=t.size,e.strokeWidthCol=t.strokeWidthCol,e.strokeWidth=t.strokeWidth,e.shape=t.shape||function(){return"square"},e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s,a=n.getZf();this.strokeColorCol&&(i=Jl.getStatistics(t,(function(t){return t[r.strokeColorCol]}),!0)),this.sizeCol&&(o=Jl.getStatistics(t,(function(t){return t[r.sizeCol]}),!0)),this.strokeWidthCol&&(s=Jl.getStatistics(t,(function(t){return t[r.strokeWidthCol]}),!0)),n.setCanvasTransform();var u,c=.5*e,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return af(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?af(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(l.s();!(u=l.n()).done;){var f=u.value,h=this.strokeColor?this.strokeColor(f[this.strokeColorCol],e,i):void 0;if(h&&"none"!==h){n.ctx.strokeStyle=h;var d=(this.size||function(){return e})(f[this.sizeCol],e,o,a),p=this.strokeWidth?this.strokeWidth(f[this.strokeWidthCol],e,s,a):1*a;if(p&&!(p<=0)){n.ctx.lineWidth=p;var y=this.shape?this.shape(f):"square";if("none"!==y){var v=this.offset(f,e,a);if("square"===y){var b=e*(1-d/e)*.5;n.ctx.beginPath(),n.ctx.rect(f.x+b+v.dx,f.y+b+v.dy,d,d),n.ctx.stroke()}else if("circle"===y)n.ctx.beginPath(),n.ctx.arc(f.x+c+v.dx,f.y+c+v.dy,.5*d,0,2*Math.PI,!1),n.ctx.stroke();else if("diamond"===y){var m=.5*d;n.ctx.beginPath(),n.ctx.moveTo(f.x+c-m,f.y+c),n.ctx.lineTo(f.x+c,f.y+c+m),n.ctx.lineTo(f.x+c+m,f.y+c),n.ctx.lineTo(f.x+c,f.y+c-m),n.ctx.lineTo(f.x+c-m,f.y+c),n.ctx.stroke()}else{if("donut"!==y)throw new Error("Unexpected shape:"+y);console.error("Not implemented")}}}}}}catch(t){l.e(t)}finally{l.f()}}}])&&uf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function hf(t){return hf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hf(t)}function df(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function pf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==hf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==hf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===hf(i)?i:String(i)),r)}var i}function yf(t,e){return yf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yf(t,e)}function vf(t){return vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vf(t)}var bf=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=vf(r);if(i){var n=vf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===hf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.heightCol=t.heightCol,e.height=t.height||function(t){return Math.sqrt(t)},e.lineColor=t.lineColor||function(t,e,n,r){return"#BBB"},e.lineWidth=t.lineWidth||function(t,e,n,r){return r},e.fillColor=t.fillColor||function(t,e,n,r){return"#c08c5968"},e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter)),n.ctx.lineJoin="round";var i,o=n.getZf(),s=Jl.getStatistics(t,(function(t){return t[r.heightCol]}),!0),a={},u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return df(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?df(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(u.s();!(i=u.n()).done;){var c=i.value,l=a[c.y];l||(l={},a[c.y]=l),l[c.x]=this.height(c[this.heightCol],e,s,o)}}catch(t){u.e(t)}finally{u.f()}var f=n.extGeo;if(f){var h=Math.floor(f.xMin/e)*e,d=Math.floor(f.xMax/e)*e,p=Math.floor(f.yMin/e)*e,y=Math.floor(f.yMax/e)*e,v={min:p,max:y};n.setCanvasTransform();for(var b=y;b>=p;b-=e){var m=a[b];if(m){n.ctx.beginPath(),n.ctx.moveTo(h-e/2,b);for(var g=void 0,w=h;w<=d;w+=e){var _=m[w];_||(_=0),_||g?n.ctx.lineTo(w+e/2,b+_):n.ctx.moveTo(w+e/2,b),g=_}g&&n.ctx.lineTo(d+e/2,b);var x=this.fillColor(b,v,e,o);x&&"none"!=x&&(n.ctx.fillStyle=x,n.ctx.fill());var S=this.lineColor(b,v,e,o),O=this.lineWidth(b,v,e,o);S&&"none"!=S&&O>0&&(n.ctx.strokeStyle=S,n.ctx.lineWidth=O,n.ctx.stroke())}}}}}])&&pf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function mf(t){return mf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mf(t)}function gf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(t,e)||wf(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wf(t,e){if(t){if("string"==typeof t)return _f(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_f(t,e):void 0}}function _f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function xf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==mf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==mf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===mf(i)?i:String(i)),r)}var i}function Sf(t,e){return Sf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sf(t,e)}function Of(t){return Of=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Of(t)}var If=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Sf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Of(r);if(i){var n=Of(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===mf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.color=t.color,e.type=t.type,e.sizeCol=t.sizeCol,e.size=t.size||function(t,e,n,r){return e},e.stripesOrientation=t.stripesOrientation||function(){return 0},e.offsetAngle=t.offsetAngle||function(){return 0},e.agePyramidHeight=t.agePyramidHeight||function(t,e,n){return e},e.pieChartInternalRadiusFactor=t.pieChartInternalRadiusFactor||0,e}return e=s,n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o=n.getZf();this.sizeCol&&(t.sort((function(t,e){return e[r.sizeCol]-t[r.sizeCol]})),i=Jl.getStatistics(t,(function(t){return t[r.sizeCol]}),!0));var s=Object.entries(this.color).length;n.setCanvasTransform();var a,u=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=wf(t))){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(u.s();!(a=u.n()).done;){var c=a.value,l=(this.size||function(){return e})(c[this.sizeCol],e,i,o),f=this.offset(c,e,o),h=this.type?this.type(c):"flag",d=c.x+f.dx+("agepyramid"===h?0:.5*e),p=c.y+f.dy+("agepyramid"===h?0:.5*e),y=this.offsetAngle?this.offsetAngle(c,e,o)*Math.PI/180:0;if("agepyramid"===h||"radar"===h||"halftone"===h){for(var v=-1/0,b=0,m=Object.keys(this.color);b<m.length;b++){var g=+c[m[b]];g>v&&(v=g)}var w=0;"agepyramid"===h&&this.agePyramidHeight&&(w=(e-this.agePyramidHeight(c,e,o))/2),"radar"!==h&&"halftone"!==h||(w=Math.PI/2+y);var _="agepyramid"===h?(this.agePyramidHeight?this.agePyramidHeight(c,e,o):e)/s:"radar"===h||"halftone"===h?2*Math.PI/s:void 0;if(void 0===_)throw new Error("Unexpected symbol type:"+h);for(var x=0,S=Object.entries(this.color);x<S.length;x++){var O=gf(S[x],2),I=O[0],T=O[1];if("agepyramid"===h){n.ctx.fillStyle=T;var A=l*c[I]/v;n.ctx.fillRect(d+(e-A)/2,p+w,A,_),w+=_}else if("radar"===h){n.ctx.fillStyle=T;var M=c[I],E=l/2*Math.sqrt(M/v);n.ctx.beginPath(),n.ctx.moveTo(d,p),n.ctx.arc(d,p,E,w-_,w),n.ctx.lineTo(d,p),n.ctx.fill(),w+=_}else{if("halftone"!==h)throw new Error("Unexpected symbol type:"+h);n.ctx.fillStyle=T;var C=c[I],P=.333*l*Math.sqrt(C/v);n.ctx.beginPath(),n.ctx.arc(d+.25*e*Math.cos(w),p+.25*e*Math.sin(w),P,0,2*Math.PI),n.ctx.fill(),w+=_}}}else{for(var j=0,k=0,B=Object.keys(this.color);k<B.length;k++){var F=+c[B[k]];F&&(j+=F)}if(!j||isNaN(j))continue;for(var L=0,D=e*(1-l/e)*.5,N=this.stripesOrientation(c,e,o),R=0,z=Object.entries(this.color);R<z.length;R++){var U=gf(z[R],2),V=U[0],W=U[1],$=c[V]/j;if($&&!isNaN($)){if(n.ctx.fillStyle=W,"flag"===h)0==N?n.ctx.fillRect(c.x+D+f.dx,c.y+D+L*l+f.dy,l,$*l):n.ctx.fillRect(c.x+D+L*l+f.dx,c.y+D+f.dy,$*l,l);else if("piechart"===h){var G=2*L*Math.PI,Y=2*(L+$)*Math.PI;n.ctx.beginPath(),n.ctx.moveTo(d,p),n.ctx.arc(d,p,.5*l,G+y,Y+y),this.pieChartInternalRadiusFactor&&n.ctx.arc(d,p,.5*l*this.pieChartInternalRadiusFactor,G+y,Y+y,!0),n.ctx.closePath(),n.ctx.fill()}else if("ring"===h)n.ctx.beginPath(),n.ctx.arc(d,p,Math.sqrt(1-L)*l*.5,0,2*Math.PI),n.ctx.fill();else{if("segment"!==h)throw new Error("Unexpected symbol type:"+h);var Z=l*l/e;0==N?n.ctx.fillRect(c.x+f.dx,c.y+(e-Z)/2+L*Z+f.dy,e,$*Z):n.ctx.fillRect(c.x+L*e+f.dx,c.y+(e-Z)/2+f.dy,$*e,Z)}L+=$}}}}}catch(t){u.e(t)}finally{u.f()}this.updateLegends({style:this,r:e,zf:o,sSize:i})}}],n&&xf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function Tf(t){return Tf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tf(t)}function Af(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Mf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Tf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Tf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Tf(i)?i:String(i)),r)}var i}function Ef(t,e){return Ef=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ef(t,e)}function Cf(t){return Cf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cf(t)}var Pf=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ef(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Cf(r);if(i){var n=Cf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Tf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.orientation=t.orientation||function(){return 0},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.lengthCol=t.lengthCol,e.length=t.length,e.widthCol=t.widthCol,e.width=t.width,e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s,a=n.getZf();this.colorCol&&(i=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),this.lengthCol&&(t.sort((function(t,e){return e[r.lengthCol]-t[r.lengthCol]})),o=Jl.getStatistics(t,(function(t){return t[r.lengthCol]}),!0)),this.widthCol&&(s=Jl.getStatistics(t,(function(t){return t[r.widthCol]}),!0)),n.ctx.lineCap="butt";var u=Math.PI/180;n.setCanvasTransform();var c,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Af(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Af(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(l.s();!(c=l.n()).done;){var f=c.value,h=this.color?this.color(f[this.colorCol],e,i):void 0;if(h){var d=this.width?this.width(f[this.widthCol],e,s,a):void 0;if(d&&!(d<0)){var p=this.length?this.length(f[this.lengthCol],e,o,a):void 0;if(p&&!(p<0)){var y=this.orientation(f)*u;if(void 0!==y&&!isNaN(y)){var v=this.offset(f,e,a);n.ctx.strokeStyle=h,n.ctx.lineWidth=d;var b=f.x+e/2+v.dx,m=f.y+e/2+v.dy,g=.5*Math.cos(y)*p,w=.5*Math.sin(y)*p;n.ctx.beginPath(),n.ctx.moveTo(b-g,m-w),n.ctx.lineTo(b+g,m+w),n.ctx.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,r:e,zf:a,sColor:i,sLength:o,sWidth:s})}}])&&Mf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function jf(t){return jf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jf(t)}function kf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Bf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==jf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==jf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===jf(i)?i:String(i)),r)}var i}function Ff(t,e){return Ff=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ff(t,e)}function Lf(t){return Lf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Lf(t)}var Df=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ff(t,e)}(a,t);var e,n,r,i,o,s=(i=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Lf(i);if(o){var n=Lf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===jf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),e=s.call(this,t),t=t||{},e.textCol=t.textCol,e.text=t.text||function(t,e,n,r){return"X"},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.fontSizeCol=t.fontSizeCol,e.fontSize=t.fontSize||function(t,e,n,r){return.8*e},e.fontFamily=t.fontFamily||"Arial",e.fontWeight=t.fontWeight||"bold",e}return e=a,r=[{key:"getCharLegendFun",value:function(t){var e=t.length;return function(n){return 0==n?"":1==n?t[e-1]:t[Math.floor(n*e)]}}}],(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s,a=n.getZf();this.textCol&&(i=Jl.getStatistics(t,(function(t){return t[r.textCol]}),!0)),this.colorCol&&(o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),this.fontSizeCol&&(t.sort((function(t,e){return e[r.fontSizeCol]-t[r.fontSizeCol]})),s=Jl.getStatistics(t,(function(t){return t[r.fontSizeCol]}),!0)),n.initCanvasTransform();var u,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return kf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(c.s();!(u=c.n()).done;){var l=u.value,f=this.text?this.text(l[this.textCol],e,i):void 0;if(null!=f&&null!=f&&f+""!=""){var h=this.color?this.color(l[this.colorCol],e,o):void 0;if(h){n.ctx.fillStyle=h;var d=this.fontSize(l[this.fontSizeCol],e,s,a)/a,p=this.fontFamily||"Arial",y=this.fontWeight||"bold";n.ctx.font=y+" "+d+"px "+p;var v=this.offset(l,e,a);n.ctx.textAlign="center";var b=n.geoToPixX(l.x+.5*e+v.dx),m=n.geoToPixY(l.y+.5*e+v.dy)+.3*d;n.ctx.fillText(f,b,m)}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:a,sColor:o})}}])&&Bf(e.prototype,n),r&&Bf(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(Jl);function Nf(t,e){return null==t?e:"function"==typeof t?t:e=>e[t]}function Rf(t,e=!1){const n=new Float64Array(5),r=new Float64Array(4);!function(t,e,n){const r=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/n),o=Math.exp(-1.723/n),s=.6318/n,a=1.997/n,u=Float64Array.of(-i*Math.cos(s),i*Math.sin(s),-i*Math.cos(-s),i*Math.sin(-s),-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a)),c=2.5066282746310007*n,l=Float64Array.of(r[0],r[1],0,0,0,0,0,0),f=Float64Array.of(1,0,u[0],u[1],0,0,0,0,0,0);let h,d;for(d=2;d<8;d+=2){for(l[d]=u[d]*l[d-2]-u[d+1]*l[d-1],l[d+1]=u[d]*l[d-1]+u[d+1]*l[d-2],h=d-2;h>0;h-=2)l[h]+=u[d]*l[h-2]-u[d+1]*l[h-1],l[h+1]+=u[d]*l[h-1]+u[d+1]*l[h-2];for(h=0;h<=d;h+=2)l[h]+=r[d]*f[h]-r[d+1]*f[h+1],l[h+1]+=r[d]*f[h+1]+r[d+1]*f[h];for(f[d+2]=u[d]*f[d]-u[d+1]*f[d+1],f[d+3]=u[d]*f[d+1]+u[d+1]*f[d],h=d;h>0;h-=2)f[h]+=u[d]*f[h-2]-u[d+1]*f[h-1],f[h+1]+=u[d]*f[h-1]+u[d+1]*f[h-2]}for(d=0;d<4;++d)h=d<<1,e[d]=l[h]/c,t[d+1]=f[h+2]}(n,r,t);const i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),o=1+n[1]+n[2]+n[3]+n[4];return{sigma:t,negative:e,a:n,b_causal:r,b_anticausal:i,sum_causal:(r[0]+r[1]+r[2]+r[3])/o,sum_anticausal:(i[1]+i[2]+i[3]+i[4])/o}}function zf(t,e,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,u=Uf){const c=2*r,l=3*r,f=4*r,h=r*n;let d,p;for(u(i,e,n,r,t.b_causal,3,t.a,4,t.sum_causal,s,t.sigma),p=4,d=f;p<n;++p,d+=r)i[p]=t.b_causal[0]*e[d]+t.b_causal[1]*e[d-r]+t.b_causal[2]*e[d-c]+t.b_causal[3]*e[d-l]-t.a[1]*i[p-1]-t.a[2]*i[p-2]-t.a[3]*i[p-3]-t.a[4]*i[p-4];for(u(o,e,n,-r,t.b_anticausal,4,t.a,4,t.sum_anticausal,s,t.sigma),p=4,d=h-5*r;p<n;++p,d-=r)o[p]=t.b_anticausal[1]*e[d+r]+t.b_anticausal[2]*e[d+c]+t.b_anticausal[3]*e[d+l]+t.b_anticausal[4]*e[d+f]-t.a[1]*o[p-1]-t.a[2]*o[p-2]-t.a[3]*o[p-3]-t.a[4]*o[p-4];if(t.negative)for(p=0,d=0;p<n;++p,d+=r)a[d]=i[p]+o[n-p-1];else for(p=0,d=0;p<n;++p,d+=r)a[d]=Math.max(0,i[p]+o[n-p-1]);return a}function Uf(t,e,n,r,i,o,s,a,u,c){const l=Math.abs(r)*n,f=r<0?l+r:0;let h,d,p;for(d=0;d<a;++d)for(c[d]=d<=o?i[d]:0,p=1;p<=a&&p<=d;++p)c[d]-=s[p]*c[d-p];for(p=0;p<a;++p)for(t[p]=0,d=1;d<=p;++d)h=f+r*d,h>=0&&h<l&&(t[p]+=c[p-d]*e[h]);const y=e[f];if(y>0)for(p=0;p<a;++p)t[p]+=c[p]*y}function Vf(t,e,n=0){const r=t.length;let i,o;for(let n=0;n<r;++n){const r=e(t[n],n,t);null!=r&&(void 0===i?r>=r&&(i=o=r):(r<i&&(i=r),r>o&&(o=r)))}return[i-n,o+n]}function Wf(t,e){const n=t.length;for(let r=0;r<n;++r)t[r]>e&&(e=t[r]);return e}function $f(t,e){const n=t.length;for(let r=0;r<n;++r)t[r]<e&&(e=t[r]);return e}function Gf(t,e){const n=t.map(e).filter((t=>null!=t&&t>=t));n.sort(((t,e)=>t-e));const r=function(t){const e=t.length;let n,r=0,i=0,o=0;for(let s=0;s<e;++s){const e=t[s];n=e-i,i+=n/++r,o+=n*(e-i)}return r>1?Math.sqrt(o/(r-1)):NaN}(n),i=Yf(n,.25),o=Yf(n,.75),s=n.length,a=(o-i)/1.34;return 1.06*(Math.min(r,a)||r||Math.abs(i)||1)*Math.pow(s,-.2)}function Yf(t,e){const n=t.length;if(!n)return NaN;if((e=+e)<=0||n<2)return t[0];if(e>=1)return t[n-1];const r=(n-1)*e,i=Math.floor(r),o=t[i];return o+(t[i+1]-o)*(r-i)}function Zf(t,e={}){const{adjust:n=1,pad:r=3,bins:i=[256,256]}=e,o=Nf(e.x,(t=>t[0])),s=Nf(e.y,(t=>t[1])),a=Nf(e.weight,(()=>1/t.length));let[u=n*Gf(t,o),c=n*Gf(t,s)]=Hf(e.bandwidth);const[[l,f]=Vf(t,o,r*u),[h,d]=Vf(t,s,r*c)]=null==(p=e.extent)?[void 0,void 0]:"number"==typeof p[0]?[p,p]:p;var p;const[y,v]=Hf(i),b=function(t,e,n,r,i,o,s,a,u,c){const l=new Float64Array(s*c),f=(s-1)/(o-i),h=(c-1)/(u-a);for(let o=0;o<t.length;++o){const u=t[o],d=e(u,o,t),p=n(u,o,t),y=r(u,o,t);if(!(Number.isFinite(d)&&Number.isFinite(p)&&Number.isFinite(y)))continue;const v=(d-i)*f,b=Math.floor(v),m=b+1,g=(p-a)*h,w=Math.floor(g),_=w+1;0<=b&&m<s?0<=w&&_<c?(l[b+w*s]+=(m-v)*(_-g)*y,l[b+_*s]+=(m-v)*(g-w)*y,l[m+w*s]+=(v-b)*(_-g)*y,l[m+_*s]+=(v-b)*(g-w)*y):-1===w?(l[b+_*s]+=(m-v)*(g-w)*y,l[m+_*s]+=(v-b)*(g-w)*y):_===c&&(l[m+w*s]+=(v-b)*(_-g)*y,l[b+w*s]+=(m-v)*(_-g)*y):-1===b?0<=w&&_<c?(l[m+w*s]+=(v-b)*(_-g)*y,l[m+_*s]+=(v-b)*(g-w)*y):-1===w?l[m+_*s]+=(v-b)*(g-w)*y:_===c&&(l[m+w*s]+=(v-b)*(_-g)*y):m===s&&(0<=w&&_<c?(l[b+w*s]+=(m-v)*(_-g)*y,l[b+_*s]+=(m-v)*(g-w)*y):-1===w?l[b+_*s]+=(m-v)*(g-w)*y:_===c&&(l[b+w*s]+=(m-v)*(_-g)*y))}return l}(t,o,s,a,l,f,y,h,d,v),m=(f-l)/(y-1),g=(d-h)/(v-1),w=b.some((t=>t<0));let _,x=Rf(u/m,w),S=Rf(c/g,w);function*O(t="x",e="y",n="z"){const r=I.grid(),i=1/(m*g);for(let o=0,s=0;s<v;++s)for(let a=0;a<y;++a,++o)yield{[t]:l+a*m,[e]:h+s*g,[n]:r[o]*i}}const I={[Symbol.iterator]:O,points:O,grid:()=>_||(_=function(t,e,n,[r,i]){const o=new Float64Array(Math.max(r,i)),s=new Float64Array(Math.max(r,i)),a=new Float64Array(5),u=new Float64Array(n.length);for(let e=0,c=0;e<i;++e,c+=r){const e=u.subarray(c);zf(t,n.subarray(c),r,1,o,s,a,e)}for(let t=0;t<r;++t){const n=u.subarray(t);zf(e,n,i,r,o,s,a,n)}return u}(x,S,b,[y,v])),extent:()=>[[l,f],[h,d]],heatmap:({color:t,clamp:e,canvas:n,maxColors:r}={})=>function(t,e,n,r=(t=>({r:0,g:0,b:0,opacity:t})),[i,o]=[$f(t,0),Wf(t,0)],s=function(t,e){if("undefined"!=typeof document){const n=document.createElement("canvas");return n.setAttribute("width",t),n.setAttribute("height",e),n}throw"Can not create a canvas instance, provide a canvas as a parameter."}(e,n),a=256){const u=1/(o-i),c=s.getContext("2d"),l=c.getImageData(0,0,e,n),f=l.data,h=a-1,d=function(t,e){const n=new Uint8ClampedArray(4*(t+1));for(let r=0;r<=t;++r){const i=e(r/t),{r:o,g:s,b:a,opacity:u=1}="string"==typeof i?Fe(i):i,c=r<<2;n[c+0]=o,n[c+1]=s,n[c+2]=a,n[c+3]=255*u|0}return n}(h,r);for(let r=0,o=0;r<n;++r)for(let s=0,a=(n-r-1)*e;s<e;++s,o+=4){const e=h*Math.min(1,Math.max(t[s+a]-i,0)*u)<<2;f[o+0]=d[e+0],f[o+1]=d[e+1],f[o+2]=d[e+2],f[o+3]=d[e+3]}return c.putImageData(l,0,0),s}(I.grid(),y,v,t,e,n,r),bandwidth(t){if(arguments.length){const[e,n]=Hf(t);return e!==u&&(_=null,x=Rf((u=e)/m,w)),n!==c&&(_=null,S=Rf((c=n)/g,w)),I}return[u,c]}};return I}function Hf(t){return null==t?[void 0,void 0]:"number"==typeof t?[t,t]:t}function qf(t){return qf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qf(t)}function Xf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Kf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==qf(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==qf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===qf(i)?i:String(i)),r)}var i}function Jf(t,e){return Jf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jf(t,e)}function Qf(t){return Qf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qf(t)}var th=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jf(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Qf(r);if(i){var n=Qf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===qf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.value=t.value,e.sigma=t.sigma,e.factor=t.factor||2,e.filterSm=t.filterSm,e.sCol=t.sCol||"ksmval",e.styles=t.styles||[],e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),t&&0!=t.length){var i=this.sigma(e,n.zf),o=Math.ceil(n.w/this.factor),s=Math.ceil(n.h/this.factor),a=[[n.pixToGeoX(0),n.pixToGeoX(o*this.factor)],[n.pixToGeoY(s*this.factor),n.pixToGeoY(0)]],u=Zf(t,{x:function(t){return t.x+e/2},y:function(t){return t.y+e/2},weight:function(t){return r.value(t)},bins:[o,s],bandwidth:i,extent:a}).grid(),c=(a[0][1]-a[0][0])/o;t=[];for(var l=0;l<u.length;l++){var f=u[l];if(!this.filterSm||this.filterSm(f)){var h=Math.floor(l/o),d=l%o,p={x:a[0][0]+d*c,y:a[1][0]+h*c};p[this.sCol]=f,t.push(p)}}var y,v=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Xf(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(this.styles);try{for(v.s();!(y=v.n()).done;)y.value.draw(t,c,n)}catch(t){v.e(t)}finally{v.f()}}}}])&&Kf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function eh(t){return eh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eh(t)}function nh(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return rh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function rh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ih(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==eh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==eh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===eh(i)?i:String(i)),r)}var i}function oh(t,e){return oh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oh(t,e)}function sh(t){return sh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sh(t)}var ah=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oh(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=sh(r);if(i){var n=sh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===eh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.heightCol=t.heightCol,e.height=t.height,e.colorCol=t.colorCol,e.color=t.color||function(){return"#c08c59"},e.widthCol=t.widthCol,e.width=t.width||function(t,e){return.5*e},e.simple=null!=t.simple,e.viewHeightFactor=t.viewHeightFactor||1.5,e.viewSX=null==t.viewSX?0:t.viewSX,e.viewSY=null==t.viewSY?-.5:t.viewSY,e.shadowDirection=null==t.shadowDirection?-40.3*Math.PI/180:t.shadowDirection,e.shadowFactor=t.shadowFactor||.3,e.shadowColor=t.shadowColor||"#00000033",e.outlineCol=t.outlineCol||"#FFFFFF",e.outlineWidthPix=null==t.outlineWidthPix?.5:t.outlineWidthPix,e}return e=s,n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s,a=n.getZf();this.heightCol&&(i=Jl.getStatistics(t,(function(t){return t[r.heightCol]}),!0)),this.colorCol&&(o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),this.widthCol&&(s=Jl.getStatistics(t,(function(t){return t[r.widthCol]}),!0));var u=n.getCenter().x+this.viewSX*n.w*a,c=n.getCenter().y+this.viewSY*n.h*a,l=this.viewHeightFactor*(n.w+n.h)*.5*a;t.sort((function(t,e){return 1e8*(e.y-t.y)+t.x-e.x})),n.ctx.lineCap=this.simple?"butt":"round",n.setCanvasTransform(),n.ctx.strokeStyle=this.shadowColor,n.ctx.fillStyle=this.shadowColor;var f,h=nh(t);try{for(h.s();!(f=h.n()).done;){var d=f.value,p=this.width?this.width(d[this.widthCol],e,s,a):void 0;if(p&&!(p<0)){var y=this.height?this.height(d[this.heightCol],e,i,a):void 0;if(y&&!(y<0)){this.offset(d,e,a),n.ctx.lineWidth=p;var v=d.x+e/2,b=d.y+e/2,m=y*this.shadowFactor;n.ctx.beginPath(),n.ctx.moveTo(v,b),n.ctx.lineTo(v+m*Math.cos(this.shadowDirection),b+m*Math.sin(this.shadowDirection)),n.ctx.stroke()}}}}catch(t){h.e(t)}finally{h.f()}var g,w=nh(t);try{for(w.s();!(g=w.n()).done;){var _=g.value,x=this.color?this.color(_[this.colorCol],e,o):void 0;if(x){var S=this.width?this.width(_[this.widthCol],e,s,a):void 0;if(S&&!(S<0)){var O=this.height?this.height(_[this.heightCol],e,i,a):void 0;if(O&&!(O<0)){this.offset(_,e,a);var I=_.x+e/2,T=_.y+e/2,A=I-u,M=T-c,E=Math.atan2(M,A),C=Math.sqrt(A*A+M*M)*O/(l-O);this.simple?(n.ctx.strokeStyle=x,n.ctx.lineWidth=S,n.ctx.beginPath(),n.ctx.moveTo(I,T),n.ctx.lineTo(I+C*Math.cos(E),T+C*Math.sin(E)),n.ctx.stroke()):(n.ctx.strokeStyle=this.outlineCol,n.ctx.lineWidth=S+2*this.outlineWidthPix*a,n.ctx.beginPath(),n.ctx.moveTo(I,T),n.ctx.lineTo(I+C*Math.cos(E),T+C*Math.sin(E)),n.ctx.stroke(),n.ctx.strokeStyle=x,n.ctx.lineWidth=S,n.ctx.beginPath(),n.ctx.moveTo(I,T),n.ctx.lineTo(I+C*Math.cos(E),T+C*Math.sin(E)),n.ctx.stroke(),n.ctx.strokeStyle=this.outlineCol,n.ctx.lineWidth=this.outlineWidthPix*a,n.ctx.beginPath(),n.ctx.arc(I+C*Math.cos(E),T+C*Math.sin(E),.5*S,0,2*Math.PI,!1),n.ctx.stroke())}}}}}catch(t){w.e(t)}finally{w.f()}n.ctx.lineCap="butt",this.updateLegends({style:this,r:e,zf:a,sColor:o})}}],n&&ih(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function uh(t){return uh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uh(t)}function ch(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return lh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function lh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function fh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==uh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==uh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===uh(i)?i:String(i)),r)}var i}function hh(t,e){return hh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hh(t,e)}function dh(t){return dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dh(t)}var ph=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hh(t,e)}(a,t);var e,n,r,i,o,s=(i=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=dh(i);if(o){var n=dh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===uh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),e=s.call(this,t),t=t||{},e.valueCol=t.valueCol,e.value=t.value||function(t,e,n,r,i){return 1},e.color=t.color||function(){return"#EA6BAC"},e.width=t.width||function(t,e,n,r){return e*t.value/5},e.orientation=t.orientation||0,e.fillColor=t.fillColor,e}return e=a,n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o=n.getZf();this.valueCol&&(i=Jl.getStatistics(t,(function(t){return t[r.valueCol]}),!0));var s=[],u=.001*e;t.sort((function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x}));for(var c=t[0],l=1;l<t.length;l++){var f=t[l];Math.abs(c.y+e-f.y)<=u&&Math.abs(c.x-f.x)<=u?s.push({x:c.x,y:f.y,or:"h",value:this.value(c[this.valueCol],f[this.valueCol],e,i,o)}):(s.push({x:c.x,y:c.y+e,or:"h",value:this.value(c[this.valueCol],void 0,e,i,o)}),s.push({x:f.x,y:f.y,or:"h",value:this.value(void 0,f[this.valueCol],e,i,o)})),c=f}t.sort((function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y})),c=t[0];for(var h=1;h<t.length;h++){var d=t[h];Math.abs(c.x+e-d.x)<=u&&Math.abs(c.y-d.y)<=u?s.push({x:c.x+e,y:c.y,or:"v",value:this.value(c[this.valueCol],d[this.valueCol],e,i,o)}):(s.push({x:c.x+e,y:c.y,or:"v",value:this.value(c[this.valueCol],void 0,e,i,o)}),s.push({x:d.x,y:d.y,or:"v",value:this.value(void 0,d[this.valueCol],e,i,o)})),c=d}if(0!=s.length){var p=a.getSideStatistics(s,!0);if(n.setCanvasTransform(),this.fillColor){var y,v=ch(t);try{for(v.s();!(y=v.n()).done;){var b=y.value,m=this.fillColor(b);m&&"none"!=m&&(n.ctx.fillStyle=m,n.ctx.fillRect(b.x,b.y,e,e))}}catch(t){v.e(t)}finally{v.f()}}n.ctx.lineCap="butt";for(var g=e/2,w=0,_=s;w<_.length;w++){var x=_[w],S=this.color?this.color(x,e,p,o):void 0;if(S&&"none"!=S){var O=this.width?this.width(x,e,p,o):void 0;!O||O<=0||(n.ctx.strokeStyle=S,n.ctx.lineWidth=O,n.ctx.beginPath(),90==this.orientation?(n.ctx.moveTo(x.x+g,x.y+g),"h"===x.or?n.ctx.lineTo(x.x+g,x.y-g):n.ctx.lineTo(x.x-g,x.y+g)):(n.ctx.moveTo(x.x,x.y),n.ctx.lineTo(x.x+("h"===x.or?e:0),x.y+("v"===x.or?e:0))),n.ctx.stroke())}}this.updateLegends({style:this,r:e,zf:o})}}}],r=[{key:"getSideStatistics",value:function(t,e){if(t&&0!=t.length){var n,r=1/0,i=-1/0,o=ch(t);try{for(o.s();!(n=o.n()).done;){var s=n.value.value;e&&!s||(s<r&&(r=s),s>i&&(i=s))}}catch(t){o.e(t)}finally{o.f()}return{min:r,max:i}}}}],n&&fh(e.prototype,n),r&&fh(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(Jl);function yh(t){return yh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yh(t)}function vh(t,e){return vh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vh(t,e)}function bh(t){return bh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bh(t)}var mh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vh(t,e)}(o,t);var e,n,r,i=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=bh(n);if(r){var i=bh(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===yh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function o(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),e=i.call(this,t),(t=t||{}).breaks=t.breaks||[100,1e3,1e4,1e5,1e6],t.width=t.width||function(){return 1},t.color=t.color||function(){return"#E7A935"};var n=function(e){if(null==e)return 0;for(var n=0;n<t.breaks.length;n++)if(e<t.breaks[n])return n;return t.breaks.length};return e.value=function(t,e,r,i,o){return Math.abs(n(e)-n(t))},e.color=function(e,n,r,i){return e.value?t.color(e,n,i):void 0},e.width=function(e,n,r,i){return e.value*i*t.width(e,n,i)},e}return e=o,Object.defineProperty(e,"prototype",{writable:!1}),e}(ph);function gh(t){return gh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gh(t)}function wh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==gh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==gh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===gh(i)?i:String(i)),r)}var i}function xh(t,e){return xh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},xh(t,e)}function Sh(t){return Sh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sh(t)}var Oh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&xh(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Sh(r);if(i){var n=Sh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===gh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.col=t.col,e.color=t.color,e.width=t.width||function(t,e,n){return.2*e},e.fillColor=t.fillColor,e}return e=s,n=[{key:"draw",value:function(t,e,n){if(this.filter&&(t=t.filter(this.filter)),t&&0!=t.length){var r=n.getZf(),i=[];t.sort((function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x}));for(var o=t[0],s=o[this.col],a=1;a<t.length;a++){var u=t[a],c=u[this.col];o.y+e==u.y&&o.x==u.x?s!=c&&i.push({x:o.x,y:u.y,or:"h",v1:s,v2:c}):(i.push({x:o.x,y:o.y+e,or:"h",v1:s,v2:void 0}),i.push({x:u.x,y:u.y,or:"h",v1:void 0,v2:c})),o=u,s=c}t.sort((function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y})),s=(o=t[0])[this.col];for(var l=1;l<t.length;l++){var f=t[l],h=f[this.col];o.x+e==f.x&&o.y==f.y?s!=h&&i.push({x:o.x+e,y:o.y,or:"v",v1:s,v2:h}):(i.push({x:o.x+e,y:o.y,or:"v",v1:s,v2:void 0}),i.push({x:f.x,y:f.y,or:"v",v1:void 0,v2:h})),o=f,s=h}if(0!=i.length){if(n.setCanvasTransform(),this.fillColor){var d,p=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(p.s();!(d=p.n()).done;){var y=d.value,v=this.fillColor(y);v&&"none"!=v&&(n.ctx.fillStyle=v,n.ctx.fillRect(y.x,y.y,e,e))}}catch(t){p.e(t)}finally{p.f()}}n.ctx.lineCap="butt";for(var b=0,m=i;b<m.length;b++){var g=m[b],w=this.width?this.width(g,e,r):void 0;if(w&&!(w<=0)){var _=.5*w;n.ctx.lineWidth=w,"h"===g.or?(g.v2&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[g.v2],n.ctx.moveTo(g.x,g.y+_),n.ctx.lineTo(g.x+e,g.y+_),n.ctx.stroke()),g.v1&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[g.v1],n.ctx.moveTo(g.x,g.y-_),n.ctx.lineTo(g.x+e,g.y-_),n.ctx.stroke())):(g.v2&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[g.v2],n.ctx.moveTo(g.x+_,g.y),n.ctx.lineTo(g.x+_,g.y+e),n.ctx.stroke()),g.v1&&(n.ctx.beginPath(),n.ctx.strokeStyle=this.color[g.v1],n.ctx.moveTo(g.x-_,g.y),n.ctx.lineTo(g.x-_,g.y+e),n.ctx.stroke()))}}this.updateLegends({style:this,r:e,zf:r})}}}}],n&&_h(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);const Ih=function t(e){function n(t,n){var r,i;return t=null==t?0:+t,n=null==n?1:+n,function(){var o;if(null!=r)o=r,r=null;else do{r=2*e()-1,o=2*e()-1,i=r*r+o*o}while(!i||i>1);return t+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(Math.random);function Th(t,e,n){var r=document.createElement("canvas");r.setAttribute("width",t),r.setAttribute("height",e);var i=r.getContext("webgl",n);if(!i)throw new Error("Unable to initialize WebGL. Your browser or machine may not support it.");return{canvas:r,gl:i}}function Ah(t){var e=t.createProgram();if(null==e)throw new Error("Cannot create webGL program");for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=0,s=r;o<s.length;o++){var a=s[o];t.attachShader(e,a)}if(t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS))return e;throw new Error(t.getProgramInfoLog(e)||"Cannot create webGL program (2)")}function Mh(t,e){var n=t.createShader(e);if(null==n)throw new Error("Cannot create webGL shader");for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];if(t.shaderSource(n,i.join("\n")),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS))return n;throw new Error(t.getShaderInfoLog(n)||"Cannot create webGL shader (2)")}function Eh(t){return Eh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eh(t)}function Ch(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Eh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Eh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Eh(i)?i:String(i)),r)}var i}var Ph=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e,this.sizePix=n||10,this.program=Ah(e,Mh(e,e.VERTEX_SHADER,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vColor = color;\n }\n "),Mh(e,e.FRAGMENT_SHADER,"\n precision mediump float;\n varying vec4 vColor;\n void main(void) {\n vec4 vColor_ = vColor / 255.0;\n vColor_[3] = 255.0 * vColor_[3];\n gl_FragColor = vColor_;\n }")),e.useProgram(this.program),this.verticesBuffer=[],this.colorsBuffer=[]}var e,n;return e=t,(n=[{key:"addPointData",value:function(t,e,n){var r=je(n);r&&(this.verticesBuffer.push(t,e),this.colorsBuffer.push(r.r,r.g,r.b,r.opacity))}},{key:"addPointData2",value:function(t,e,n,r,i,o){this.verticesBuffer.push(t,e),this.colorsBuffer.push(n,r,i,o)}},{key:"draw",value:function(t){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,e.createBuffer()),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.verticesBuffer),e.STATIC_DRAW);var n=e.getAttribLocation(this.program,"pos");e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,e.createBuffer()),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.colorsBuffer),e.STATIC_DRAW);var r=e.getAttribLocation(this.program,"color");e.vertexAttribPointer(r,4,e.FLOAT,!1,0,0),e.enableVertexAttribArray(r),e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*this.sizePix),e.uniformMatrix3fv(e.getUniformLocation(this.program,"mat"),!1,new Float32Array(t)),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.POINTS,0,this.verticesBuffer.length/2)}}])&&Ch(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function jh(t){return jh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jh(t)}function kh(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Bh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Bh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Fh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==jh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==jh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===jh(i)?i:String(i)),r)}var i}function Lh(t,e){return Lh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lh(t,e)}function Dh(t){return Dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Dh(t)}var Nh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lh(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Dh(r);if(i){var n=Dh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===jh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.nbCol=t.nbCol,e.nb=t.nb||function(t,e,n,r){return.3*e*e/(r*r)*t/n.max},e.color=t.color||function(){return"#FF5733"},e.dotSize=t.dotSize,e.sigma=t.sigma,e}return e=s,n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o=n.getZf();if(this.nbCol&&(i=Jl.getStatistics(t,(function(t){return t[r.nbCol]}),!0)),i){var s=this.dotSize?this.dotSize(e,o):2*o,a=this.sigma?this.sigma(e,o):.4*e,u=Ih(0,a);if(function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}()){var c=Th(n.w+"",n.h+"");if(!c)return void console.error("No webGL");var l,f,h,d,p,y,v,b=new Ph(c.gl,s/o),m=e/2,g=kh(t);try{for(g.s();!(v=g.n()).done;){var w=v.value;if((l=this.color(w))&&"none"!==l){if(f=this.offset(w,e,o),h=this.nb(w[this.nbCol],e,i,o),d=w.x+f.dx+m,p=w.y+f.dy+m,!(y=je(l)))return;for(var _=0;_<=h;_++)b.addPointData2(d+u(),p+u(),y.r,y.g,y.b,y.opacity)}}}catch(t){g.e(t)}finally{g.f()}b.draw(n.getWebGLTransform()),n.initCanvasTransform(),n.ctx.drawImage(c.canvas,0,0)}else{n.setCanvasTransform();var x,S=kh(t);try{for(S.s();!(x=S.n()).done;){var O=x.value,I=this.color(O);if(I&&"none"!==I){n.ctx.fillStyle=I;for(var T=this.offset(O,e,o),A=this.nb(O[this.nbCol],e,i,o),M=O.x+T.dx+e/2,E=O.y+T.dy+e/2,C=0;C<=A;C++)n.ctx.fillRect(M+u(),E+u(),s,s)}}}catch(t){S.e(t)}finally{S.f()}}this.updateLegends({style:this,r:e,zf:o})}}}],n&&Fh(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function Rh(t){return Rh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rh(t)}function zh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Rh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Rh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Rh(i)?i:String(i)),r)}var i}var Uh=function(){function t(e,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e;var s=Mh(e,e.VERTEX_SHADER,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n\n attribute float t;\n varying float vt;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vt = t;\n }\n "),a="precision mediump float;\nvarying float vt;\nuniform float alpha;\n"+function(){for(var t=[],e=0;e<n.length;e++)t.push("uniform vec4 c"+e+";\n");return t.join("")}()+"void main(void) {\n";if(r?"pow"==r.fun?a+=" float t = pow(vt, alpha);\n":"powRev"==r.fun?a+=" float t = 1.0-pow(1.0-vt, 1.0/alpha);\n":"exp"==r.fun?a+=0==r.alpha?"float t = vt;":" float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);\n":"expRev"==r.fun?a+=0==r.alpha?"float t = vt;":" float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);\n":"circleLow"==r.fun?0==r.alpha?a+=" float t = vt;\n":1==r.alpha?a+=" float t = sqrt(vt * (2.0 - vt));\n":a+=" float a = alpha / (1.0 - alpha);\n float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;\n":"circleHigh"==r.fun?0==r.alpha?a+=" float t = vt;\n":1==r.alpha?a+=" float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));\n":a+=" float a = alpha / (1.0 - alpha);\n float t = 1.0 - sqrt(1.0 / (a * a) + (1.0-vt) * ( 2.0/a + 1.0 + vt )) + 1.0 / a;\n":(console.error("Unexpected stretching function code: "+r.fun),a+=" float t = vt;\n"):a+=" float t = vt;\n",1==n.length)a+=" vec4 cI=c0;\n vec4 cF=c0;\n";else if(2==n.length)a+=" vec4 cI=c0;\n vec4 cF=c1;\n";else{var u=n.length-1,c=u+".0";a+=" vec4 cI;\n",a+=" vec4 cF;\n",a+=" if(t<1.0/"+c+") { cI=c0; cF=c1; t=t*"+c+"; }\n";for(var l=2;l<u;l++)a+=" else if(t<"+l+".0/"+c+") { cI=c"+(l-1)+"; cF=c"+l+"; t="+c+"*t-"+(l-1)+".0; }\n";a+=" else { cI=c"+(u-1)+"; cF=c"+u+"; t="+c+"*t-"+(u-1)+".0; }\n"}1==n.length?a+=" gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}\n":a+=" gl_FragColor = mix(cI, cF, t);}\n";var f=Mh(e,e.FRAGMENT_SHADER,a);this.program=Ah(e,s,f),e.useProgram(this.program),e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*i),e.uniform1f(e.getUniformLocation(this.program,"alpha"),r?1*r.alpha:0);for(var h=0;h<n.length;h++){var d=je(n[h]),p=d.opacity;1==d.opacity&&null!=o&&(p=o),e.uniform4fv(e.getUniformLocation(this.program,"c"+h),[+d.r/255,+d.g/255,+d.b/255,+p])}}var e,n;return e=t,(n=[{key:"draw",value:function(t,e,n){var r=this.gl,i=this.program;r.bindBuffer(r.ARRAY_BUFFER,r.createBuffer()),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t),r.STATIC_DRAW);var o=r.getAttribLocation(i,"pos");r.vertexAttribPointer(o,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(o),r.bindBuffer(r.ARRAY_BUFFER,r.createBuffer()),r.bufferData(r.ARRAY_BUFFER,new Float32Array(e),r.STATIC_DRAW);var s=r.getAttribLocation(i,"t");r.vertexAttribPointer(s,1,r.FLOAT,!1,0,0),r.enableVertexAttribArray(s),r.uniformMatrix3fv(r.getUniformLocation(i,"mat"),!1,new Float32Array(n)),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.POINTS,0,t.length/2)}}])&&zh(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Vh(t){return Vh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vh(t)}function Wh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function $h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Vh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Vh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Vh(i)?i:String(i)),r)}var i}function Gh(t,e){return Gh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gh(t,e)}function Yh(t){return Yh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yh(t)}var Zh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gh(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Yh(r);if(i){var n=Yh(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Vh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.tFun=t.tFun||function(t,e,n){return t/n.max},e.stretching=t.stretching,e.colors=t.colors||["rgb(158, 1, 66)","rgb(248, 142, 83)","rgb(251, 248, 176)","rgb(137, 207, 165)","rgb(94, 79, 162)"].reverse(),t.color&&(e.colors=[t.color(0),t.color(.2),t.color(.4),t.color(.6),t.color(.8),t.color(1)]),e.opacity=t.opacity,e.size=t.size,e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i=n.getZf(),o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0);if(o){var s=Th(n.w+"",n.h+"",null!=this.opacity?{premultipliedAlpha:!1}:void 0);if(s){var a,u=e/2,c=[],l=[],f=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Wh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(f.s();!(a=f.n()).done;){var h=a.value,d=this.tFun(h[this.colorCol],e,o);null!=d&&null!=d&&(c.push(h.x+u,h.y+u),l.push(d>1?1:d<0?0:d))}}catch(t){f.e(t)}finally{f.f()}var p=this.size?this.size(e,i):e+.2*i,y=this.opacity?this.opacity(e,i):void 0;new Uh(s.gl,this.colors,this.stretching,p/i,y).draw(c,l,n.getWebGLTransform()),n.initCanvasTransform(),n.ctx.drawImage(s.canvas,0,0),this.updateLegends({style:this,r:e,zf:i,sColor:o})}else console.error("No webGL")}}}])&&$h(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function Hh(t){return Hh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hh(t)}function qh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Hh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Hh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Hh(i)?i:String(i)),r)}var i}var Xh=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n;return e=t,n=[{key:"get",value:function(t,e){if(null!=(e=e||{}).nb){e.nb<2&&(console.error("unexpected number of colors in tanaka (<2): "+e.nb),e.nb=2),e.color||(console.error("color function not defined in tanaka"),e.color=function(){return"gray"}),e.colors=[];for(var n=0;n<e.nb;n++)e.colors.push(e.color(n/(e.nb-1)))}e.colors=e.colors||["#a9bb9e","#c9dcaa","#fde89f","#f9a579","#eb444b"];var r=e.colors.length;e.tFun=e.tFun||function(t,e,n){return(t-n.min)/(n.max-n.min)},e.colDark=e.colDark||"#111",e.colBright=e.colBright||"#ddd",e.widthFactor=e.widthFactor||.08,e.newShading=e.newShading,e.newShadingWidthPix=e.newShadingWidthPix||2,e.newShadingTr=e.newShadingTr||function(t,e){return Math.abs(t)/Math.max(Math.abs(e.min),Math.abs(e.max))};var i=function(t){if(isNaN(t)||null==t)return console.error("Unexpected t value 1: "+t),-9;for(var e=0;e<r;e++)if(t<=(e+1)/r)return e;return console.error("Unexpected t value 2: "+t),-9},o=new Zh({colorCol:t,colors:e.colors,tFun:function(t,n,o){var s=e.tFun(t,n,o);return i(s)/(r-1)},size:function(t,e){return t+.5*e},filter:e.filter}),s=new ph({valueCol:t,value:function(t,n,r,o,s){if(void 0===t&&void 0===n)return 0;if(void 0===n){var a=e.tFun(t,r,o);if(null==a||isNaN(a))throw new Error("Unexpected value: "+t+" - "+a);return i(a)+1}if(void 0===t){var u=e.tFun(n,r,o);if(null==u||isNaN(u))throw new Error("Unexpected value: "+n+" - "+u);return-i(u)-1}var c=e.tFun(t,r,o);if(null==c||isNaN(c))throw new Error("Unexpected value: "+t+" - "+c);var l=e.tFun(n,r,o);if(null==l||isNaN(l))throw new Error("Unexpected value: "+n+" - "+l);var f=i(c);return-i(l)+f},color:e.newShading?function(t,n,r,i){var o=e.newShadingTr(t.value,r);return t.value>0&&"h"===t.or||t.value<0&&"v"===t.or?"rgba(255,255,100,"+o+")":"rgba(0,0,0,"+o+")"}:function(t,n,r,i){if(0!==t.value)return"v"===t.or?t.value<0?e.colBright:e.colDark:t.value<0?e.colDark:e.colBright},width:e.newShading?function(t,n,r,i){return e.newShadingWidthPix*i}:function(t,n,r,i){return e.widthFactor*n*Math.abs(t.value)*("v"===t.or?.5:1)},filter:e.filter});return[o,s]}}],null&&qh(e.prototype,null),n&&qh(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Kh(t){return Kh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kh(t)}function Jh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Kh(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Kh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Kh(i)?i:String(i)),r)}var i}var Qh=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.colors=e,this.vshString="\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n\n attribute float i;\n varying float vi;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vi = i;\n }\n ";var n=[];n.push("precision mediump float;\nvarying float vi;\n"),n.push("uniform vec4");for(var r=0;r<e.length;r++)r>0&&n.push(","),n.push(" c"+r);n.push(";\n"),n.push("void main(void) {\n");for(var i=0;i<e.length;i++)i>0&&n.push("else "),n.push("if(vi=="),n.push(i),n.push(".0) gl_FragColor = vec4(c"),n.push(i),n.push("[0], c"),n.push(i),n.push("[1], c"),n.push(i),n.push("[2], c"),n.push(i),n.push("[3]);\n");n.push("else gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n}"),this.fshString=n.join("")}var e,n;return e=t,n=[{key:"draw",value:function(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:10,o=Ah(t,Mh(t,t.VERTEX_SHADER,this.vshString),Mh(t,t.FRAGMENT_SHADER,this.fshString));t.useProgram(o),t.uniform1f(t.getUniformLocation(o,"sizePix"),1*i);for(var s=0;s<this.colors.length;s++){var a=je(this.colors[s]);t.uniform4fv(t.getUniformLocation(o,"c"+s),[+a.r/255,+a.g/255,+a.b/255,+a.opacity])}t.bindBuffer(t.ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW);var u=t.getAttribLocation(o,"pos");t.vertexAttribPointer(u,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(u),t.bindBuffer(t.ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ARRAY_BUFFER,new Float32Array(n),t.STATIC_DRAW);var c=t.getAttribLocation(o,"i");t.vertexAttribPointer(c,1,t.FLOAT,!1,0,0),t.enableVertexAttribArray(c),t.uniformMatrix3fv(t.getUniformLocation(o,"mat"),!1,new Float32Array(r)),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.POINTS,0,e.length/2)}}],n&&Jh(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function td(t){return td="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},td(t)}function ed(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==td(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==td(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===td(i)?i:String(i)),r)}var i}function nd(t,e){return nd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nd(t,e)}function rd(t){return rd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rd(t)}var id=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nd(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=rd(r);if(i){var n=rd(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===td(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,t.color=t.color||void 0;var n=Object.keys(t.color);e.catToI={};for(var r=0;r<n.length;r++)e.catToI[n[r]]=r+"";e.colors=[];for(var i=0;i<n.length;i++)e.colors.push(t.color[""+n[i]]);return e.size=t.size,e.wgp=new Qh(e.colors),e}return e=s,(n=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));for(var r,i=n.getZf(),o=e/2,s=t.length,a=[],u=[],c=0;c<s;c++){var l=(r=t[c])[this.colorCol];if(null!=l){var f=this.catToI[l];isNaN(+f)?console.log("Unexpected category index: "+l+" "+f):(a.push(r.x+o,r.y+o),u.push(+f))}else console.log("Unexpected category: "+l)}var h=Th(n.w+"",n.h+"");if(h){var d=this.size?this.size(e,i):e+.2*i;this.wgp.draw(h.gl,a,u,n.getWebGLTransform(),d/i),n.initCanvasTransform(),n.ctx.drawImage(h.canvas,0,0),this.updateLegends({style:this,r:e,zf:i})}else console.error("No webGL")}}])&&ed(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function od(t){return od="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},od(t)}function sd(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ad(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ad(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function ad(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ud(t,e){return ud=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ud(t,e)}function cd(t){return cd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cd(t)}function ld(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==od(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==od(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===od(i)?i:String(i)),r)}var i}function hd(t,e,n){return e&&fd(t.prototype,e),n&&fd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var dd=function(){function t(){ld(this,t)}return hd(t,null,[{key:"get",value:function(t,e){(e=e||{}).colors=e.colors||["#00852b","#afd246","#fac80a","#bb805a","#d67923","#cb4e29","#b40000","#720012"],e.colDark=e.colDark||"#333",e.colBright=e.colBright||"#aaa",e.widthFactor=e.widthFactor||.12;var n=Xh.get(t,e),r=new ff({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n,r){return.2*r},filter:e.filter});return[n[0],r,n[1],new pd({colDark:e.colDark,colBright:e.colBright,filter:e.filter})]}},{key:"getCat",value:function(t,e){return(e=e||{}).colDark=e.colDark||"#333",e.colBright=e.colBright||"#aaa",[new id({colorCol:t,color:e.color}),new ff({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n,r){return.2*r}}),new pd({colDark:e.colDark,colBright:e.colBright})]}}]),t}(),pd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ud(t,e)}(i,t);var e,n,r=(e=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=cd(e);if(n){var i=cd(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return function(t,e){if(e&&("object"===od(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function i(t){var e;return ld(this,i),e=r.call(this,t),t=t||{},e.colDark=t.colDark||"#333",e.colBright=t.colBright||"#aaa",e}return hd(i,[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter)),n.ctx.lineWidth=.6*n.getZf(),n.ctx.strokeStyle=this.colDark;var r,i=sd(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;n.ctx.beginPath(),n.ctx.arc(o.x+.5*e,o.y+.5*e,.55*e*.5,Math.PI/4,-Math.PI*(3/4),!0),n.ctx.stroke()}}catch(t){i.e(t)}finally{i.f()}n.ctx.strokeStyle=this.colBright;var s,a=sd(t);try{for(a.s();!(s=a.n()).done;){var u=s.value;n.ctx.beginPath(),n.ctx.arc(u.x+.5*e,u.y+.5*e,.55*e*.5,Math.PI/4,-Math.PI*(3/4),!1),n.ctx.stroke()}}catch(t){a.e(t)}finally{a.f()}}}]),i}(Jl);function yd(t){return yd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yd(t)}function vd(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function bd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==yd(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==yd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===yd(i)?i:String(i)),r)}var i}function md(t,e){return md=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},md(t,e)}function gd(t){return gd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gd(t)}var wd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&md(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=gd(r);if(i){var n=gd(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===yd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.mosaicFactor=t.mosaicFactor||.15,e.shadowFactor=t.shadowFactor||.2,e.shadowColor=t.shadowColor||"#555",e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o=n.getZf();this.colorCol&&(i=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),n.ctx.strokeStyle=this.shadowColor,n.ctx.lineWidth=this.shadowFactor*e,n.ctx.lineJoin="round",n.ctx.lineCap="butt";var s=e*this.mosaicFactor,a=function(){return{x:Math.random()*s,y:Math.random()*s}};n.setCanvasTransform();var u,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return vd(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vd(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(c.s();!(u=c.n()).done;){var l=u.value,f=this.color?this.color(l[this.colorCol],e,i):void 0;if(f&&"none"!==f){n.ctx.fillStyle=f;var h=this.offset(l,e,o),d=a(),p=a(),y=a(),v=a();this.shadowFactor>0&&(n.ctx.beginPath(),n.ctx.moveTo(l.x+h.dx+d.x,l.y+h.dy+d.y),n.ctx.lineTo(l.x+h.dx+e-y.x,l.y+h.dy+y.y),n.ctx.lineTo(l.x+h.dx+e-v.x,l.y+h.dy+e-v.y),n.ctx.stroke()),n.ctx.beginPath(),n.ctx.moveTo(l.x+h.dx+d.x,l.y+h.dy+d.y),n.ctx.lineTo(l.x+h.dx+e-y.x,l.y+h.dy+y.y),n.ctx.lineTo(l.x+h.dx+e-v.x,l.y+h.dy+e-v.y),n.ctx.lineTo(l.x+h.dx+p.x,l.y+h.dy+e-p.y),n.ctx.fill()}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:o,sColor:i})}}])&&bd(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function _d(t){return _d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_d(t)}function xd(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Sd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==_d(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==_d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===_d(i)?i:String(i)),r)}var i}function Od(t,e){return Od=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Od(t,e)}function Id(t){return Id=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Id(t)}var Td=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Od(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Id(r);if(i){var n=Id(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===_d(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorCol=t.colorCol,e.color=t.color||function(){return"#EA6BAC"},e.sizeCol=t.sizeCol,e.size=t.size,e.shape=t.shape||function(){return"o"},e}return e=s,(n=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var i,o,s=n.getZf();this.sizeCol&&(t.sort((function(t,e){return e[r.sizeCol]-t[r.sizeCol]})),i=Jl.getStatistics(t,(function(t){return t[r.sizeCol]}),!0)),this.colorCol&&(o=Jl.getStatistics(t,(function(t){return t[r.colorCol]}),!0)),n.setCanvasTransform();var a,u=.5*e,c=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return xd(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xd(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(c.s();!(a=c.n()).done;){var l=a.value,f=this.color?this.color(l[this.colorCol],e,o,s):void 0;if(f&&"none"!==f){n.ctx.fillStyle=f;var h=this.shape?this.shape(l):"o";if("none"!==h){var d=(this.size||function(){return.5})(l[this.sizeCol],e,i,s)*u,p=(this.offset(l,e,s),l.x+u),y=l.y+u;if("p"===h)n.ctx.beginPath(),n.ctx.moveTo(p,y+u),n.ctx.lineTo(p+d,y+d),n.ctx.lineTo(p+u,y),n.ctx.lineTo(p+d,y-d),n.ctx.lineTo(p,y-u),n.ctx.lineTo(p-d,y-d),n.ctx.lineTo(p-u,y),n.ctx.lineTo(p-d,y+d),n.ctx.fill();else{if("o"!==h)throw new Error("Unexpected shape:"+h);n.ctx.beginPath(),n.ctx.moveTo(p,y+d),n.ctx.lineTo(p+u,y+u),n.ctx.lineTo(p+d,y),n.ctx.lineTo(p+u,y-u),n.ctx.lineTo(p,y-d),n.ctx.lineTo(p-u,y-u),n.ctx.lineTo(p-d,y),n.ctx.lineTo(p-u,y+u),n.ctx.fill()}}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,r:e,zf:s,sSize:i,sColor:o})}}])&&Sd(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Jl);function Ad(t){return Ad="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ad(t)}function Md(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Ad(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Ad(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Ad(i)?i:String(i)),r)}var i}var Ed=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.id=e.id,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.background=e.background||"none",this.padding=e.padding||"5px",this.border=e.border||"0px",this["border-radius"]=e["border-radius"]||"none",this["box-shadow"]=e["box-shadow"]||"none",this["font-family"]=e["font-family"]||"Helvetica, Arial, sans-serif",this.width=e.width,this.height=e.height,this.id&&(this.div=pt("#"+this.id)),this.div&&!this.div.empty()||(this.div=pt(document.createElement("div")),this.id&&this.div.attr("id",this.id)),this.div.style("background",this.background),this.div.style("padding",this.padding),this.div.style("border",this.border),this.div.style("border-radius",this["border-radius"]),this.div.style("box-shadow",this["box-shadow"]),this.div.style("font-family",this["font-family"]),this.width&&this.div.style("width",this.width),this.height&&this.div.style("height",this.height)}var e,n;return e=t,(n=[{key:"style",value:function(t,e){return this.div.style(t,e),this}},{key:"update",value:function(t){console.error("Legend update not implemented yet.")}}])&&Md(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Cd(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}var Pd,jd=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kd(t){if(!(e=jd.exec(t)))throw new Error("invalid format: "+t);var e;return new Bd({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Bd(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Fd(t,e){var n=Cd(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}kd.prototype=Bd.prototype,Bd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Ld={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Fd(100*t,e),r:Fd,s:function(t,e){var n=Cd(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Pd=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Cd(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Dd(t){return t}var Nd,Rd,zd=Array.prototype.map,Ud=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Vd(t){return Nd=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Dd:(e=zd.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],s=0,a=e[0],u=0;i>0&&a>0&&(u+a+1>r&&(a=Math.max(1,r-u)),o.push(t.substring(i-=a,i+a)),!((u+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",s=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?Dd:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(zd.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=kd(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,y=t.comma,v=t.precision,b=t.trim,m=t.type;"n"===m?(y=!0,m="g"):Ld[m]||(void 0===v&&(v=12),b=!0,m="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var g="$"===h?i:"#"===h&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===h?o:/[%p]/.test(m)?u:"",_=Ld[m],x=/[defgprs%]/.test(m);function S(t){var i,o,u,h=g,S=w;if("c"===m)S=_(t)+S,t="";else{var O=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:_(Math.abs(t),v),b&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),O&&0==+t&&"+"!==f&&(O=!1),h=(O?"("===f?f:c:"-"===f||"("===f?"":f)+h,S=("s"===m?Ud[8+Pd/3]:"")+S+(O&&"("===f?")":""),x)for(i=-1,o=t.length;++i<o;)if(48>(u=t.charCodeAt(i))||u>57){S=(46===u?s+t.slice(i+1):t.slice(i))+S,t=t.slice(0,i);break}}y&&!d&&(t=r(t,1/0));var I=h.length+t.length+S.length,T=I<p?new Array(p-I+1).join(e):"";switch(y&&d&&(t=r(T+t,T.length?p-S.length:1/0),T=""),n){case"<":t=h+t+S+T;break;case"=":t=h+T+t+S;break;case"^":t=T.slice(0,I=T.length>>1)+h+t+S+T.slice(I);break;default:t=T+h+t+S}return a(t)}return v=void 0===v?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),S.toString=function(){return t+""},S}return{format:f,formatPrefix:function(t,e){var n,r=f(((t=kd(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Cd(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),s=Ud[8+i/3];return function(t){return r(o*t)+s}}}}(t),Rd=Nd.format,Nd.formatPrefix,Nd}function Wd(t){return Wd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wd(t)}function $d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Wd(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Wd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Wd(i)?i:String(i)),r)}var i}function Gd(t,e){return Gd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gd(t,e)}function Yd(t){return Yd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yd(t)}Vd({thousands:",",grouping:[3],currency:["$",""]});var Zd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gd(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Yd(r);if(i){var n=Yd(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Wd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colorRamp=t.colorRamp,e.fun=t.fun,e.title=t.title,e.tickSize=t.tickSize||6,e.width=t.width||300,e.height=t.height||15,e.margin=t.margin||5,e.ticks=t.ticks||Math.floor(e.width/50),e.tickFormat=t.tickFormat||",.0f",e.tickUnit=t.tickUnit,e.fontSize=t.fontSize||"0.8em",e.invert=t.invert,e}return e=s,n=[{key:"update",value:function(t){if(t.sColor){this.div.selectAll("*").remove();var e=this.width+2*this.margin,n=this.height+3*this.margin+12+this.tickSize+10,r=this.div.append("svg").attr("width",e).attr("height",n);r.append("text").attr("x",this.margin).attr("y",this.margin).style("font-size","0.8em").style("font-weight","bold").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(this.title);for(var i=r.append("g").attr("transform","translate("+this.margin+" "+(2*this.margin+12)+")"),o=this.width,s=this.height,a=0;a<o;a+=5){var u=a/(o-1);this.invert&&(u=1-u),i.append("rect").attr("x",a).attr("y",0).attr("width",5).attr("height",s).style("fill",this.colorRamp(u))}for(var c=0;c<this.ticks;c++){var l=c/(this.ticks-1);i.append("line").attr("x1",o*l).attr("y1",0).attr("x2",o*l).attr("y2",s+this.tickSize).style("stroke","black"),i.append("text").attr("id","ticklabel_"+c).attr("x",o*l).attr("y",s+this.tickSize+2).style("font-size",this.fontSize).style("text-anchor",0==c?"start":c==this.ticks-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none")}for(var f=this.tickFormat&&"text"!=this.tickFormat?Rd(this.tickFormat):function(t){return t},h=0;h<this.ticks;h++){var d=h/(this.ticks-1),p=this.fun(d,t.r,t.sColor),y=(p?f(p):"0")+(this.tickUnit?this.tickUnit:"");this.div.select("#ticklabel_"+h).text(y)}}}}],n&&$d(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function Hd(t){return Hd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hd(t)}function qd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Hd(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Hd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Hd(i)?i:String(i)),r)}var i}function Xd(t,e){return Xd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xd(t,e)}function Kd(t){return Kd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kd(t)}var Jd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xd(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Kd(r);if(i){var n=Kd(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Hd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colors=t.colors,e.breaksText=t.breaksText,e.width=t.width||300,e.height=t.height||15,e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.tickSize=t.tickSize||3,e.labelFontSize=t.labelFontSize||"0.8em",e.invert=t.invert,e}return e=s,(n=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.title&&this.div.append("div").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).style("margin-bottom","7px").text(this.title);var e=this.colors.length;if(0!=e){for(var n=this.width/e,r=this.div.append("svg").attr("width",this.width).attr("height",this.height+this.tickSize+2+10),i=0;i<e;i++)r.append("rect").attr("x",i*n).attr("y",0).attr("width",n).attr("height",this.height).style("fill",this.colors[i]);for(var o=1;o<e;o++)r.append("line").attr("x1",n*o).attr("y1",0).attr("x2",n*o).attr("y2",this.height+this.tickSize).style("stroke","black");for(var s=1;s<e;s++)r.append("text").attr("id","ticklabel_"+s).attr("x",n*s).attr("y",this.height+this.tickSize+2).style("font-size",this.labelFontSize).style("text-anchor",0==s?"start":s==this.ticks-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(this.breaksText[s-1])}}}])&&qd(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function Qd(t){return Qd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qd(t)}function tp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==Qd(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==Qd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===Qd(i)?i:String(i)),r)}var i}function ep(t,e){return ep=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ep(t,e)}function np(t){return np=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},np(t)}var rp=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ep(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=np(r);if(i){var n=np(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Qd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.colCat=t.colCat||[["gray","-"]],e.shape=t.shape||"circle",e.dimension=t.dimension||{r:8},e.strokeColor=t.strokeColor||"gray",e.strokeWidth=t.strokeWidth||1,e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.labelFontSize=t.labelFontSize||"0.8em",e}return e=s,n=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.title&&this.div.append("div").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).style("margin-bottom","7px").text(this.title);var e=this.colCat.length;if(0!=e)for(var n=0;n<e;n++){var r=this.colCat[n],i=this.div.append("div"),o=this.strokeWidth;if("square"===this.shape){var s=this.dimension.h||15,a=this.dimension.w||20;i.append("div").style("display","inline").append("svg").attr("width",a+2*o).attr("height",s+2*o).append("rect").attr("x",o).attr("y",o).attr("width",a).attr("height",s).style("fill",r[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}else{if("circle"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var u=this.dimension.r||8,c=2*u+2*o;i.append("div").style("display","inline").append("svg").attr("width",c).attr("height",c).append("circle").attr("cx",u+o).attr("cy",u+o).attr("r",u).style("fill",r[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}i.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(r[1])}}}],n&&tp(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function ip(t){return ip="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ip(t)}function op(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==ip(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==ip(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===ip(i)?i:String(i)),r)}var i}function sp(t,e){return sp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sp(t,e)}function ap(t){return ap=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ap(t)}var up=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&sp(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=ap(r);if(i){var n=ap(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===ip(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.exaggerationFactor=t.exaggerationFactor||.8,e.value=t.value||void 0,e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.shape=t.shape||"circle",e.fillColor=t.fillColor||"none",e.strokeColor=t.strokeColor||"gray",e.strokeWidth=t.strokeWidth||1,e.labelFontSize=t.labelFontSize||"0.8em",e.labelUnitText=t.labelUnitText||"",e.labelFormat=t.labelFormat||",.2r",e}return e=s,(n=[{key:"update",value:function(t){if(t.sSize){this.div.selectAll("*").remove();var e=this.value;if(null==e){var n=t.sSize.max*this.exaggerationFactor,r=Math.log10(n);r=Math.floor(r),8*(e=Math.pow(10,r))<=n?e*=8:6*e<=n?e*=6:5*e<=n?e*=5:4*e<=n?e*=4:2.5*e<=n?e*=2.5:2*e<=n&&(e*=2)}if(e){var i=this.div.append("div");this.title&&i.append("div").attr("class","title").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).text(this.title);var o=t.style.size(e,t.r,t.sSize,t.zf)/t.zf,s=i.append("svg").attr("width",o+this.strokeWidth+2).attr("height",o+this.strokeWidth+2).style("","inline-block");if("square"===this.shape)s.append("rect").attr("x",0).attr("y",0).attr("width",o).attr("height",o).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth);else if("circle"===this.shape){var a=.5*(o+this.strokeWidth);s.append("circle").attr("cx",a+1).attr("cy",a+1).attr("r",a).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}else if("donut"===this.shape);else if("diamond"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var u=Rd(this.labelFormat)(e);i.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(u+(this.labelUnitText?" ":"")+this.labelUnitText)}}}}])&&op(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function cp(t){return cp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cp(t)}function lp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==cp(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==cp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===cp(i)?i:String(i)),r)}var i}function fp(t,e){return fp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fp(t,e)}function hp(t){return hp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hp(t)}var dp=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fp(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=hp(r);if(i){var n=hp(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===cp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.exaggerationFactor=t.exaggerationFactor||.5,e.color=t.color||"gray",e.orientation=t.orientation||0,e.labelFontSize=t.labelFontSize||"0.8em",e.labelUnitText=t.labelUnitText||"",e}return e=s,(n=[{key:"update",value:function(t){if(t.sWidth){this.div.selectAll("*").remove();var e=this.div.append("div");this.title&&e.append("div").attr("class","title").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).text(this.title);var n=t.sWidth.max*this.exaggerationFactor,r=Math.log10(n);r=Math.floor(r);var i=Math.pow(10,r);8*i<=n?i*=8:6*i<=n?i*=6:5*i<=n?i*=5:4*i<=n?i*=4:2.5*i<=n?i*=2.5:2*i<=n&&(i*=2);var o=t.style.width(i,t.r,t.sWidth,t.zf)/t.zf,s=1*t.r/t.zf;e.append("svg").attr("width",s).attr("height",o).style("","inline-block").append("line").attr("x1",0).attr("y1",o/2).attr("x2",s).attr("y2",o/2).style("stroke",this.color).style("stroke-width",o);var a=Rd(",.2r")(i);e.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(a+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&lp(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed);function pp(t){return pp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pp(t)}function yp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==pp(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==pp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===pp(i)?i:String(i)),r)}var i}function vp(t,e){return vp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vp(t,e)}function bp(t){return bp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bp(t)}var mp=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vp(t,e)}(s,t);var e,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=bp(r);if(i){var n=bp(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===pp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=o.call(this,t),t=t||{},e.title=t.title,e.titleFontSize=t.titleFontSize||"0.8em",e.titleFontWeight=t.titleFontWeight||"bold",e.exaggerationFactor=t.exaggerationFactor||.5,e.color=t.color||"gray",e.orientation=t.orientation||0,e.widthPix=t.widthPix||3,e.labelFontSize=t.labelFontSize||"0.8em",e.labelUnitText=t.labelUnitText||"",e}return e=s,n=[{key:"update",value:function(t){if(t.sWidth){this.div.selectAll("*").remove();var e=this.div.append("div");this.title&&e.append("div").attr("class","title").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).text(this.title);var n=this.widthPix,r=1*t.r/t.zf,i=Math.max(r,n),o=e.append("svg").attr("width",i).attr("height",i).style("","inline-block"),s=Math.cos(-this.orientation*Math.PI/180),a=Math.sin(-this.orientation*Math.PI/180),u=.5*i,c=.5*r;o.append("line").attr("x1",u-s*c).attr("y1",u-a*c).attr("x2",u+s*c).attr("y2",u+a*c).style("stroke",this.color).style("stroke-width",n),e.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(this.labelUnitText)}}}],n&&yp(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ed),gp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return Math.pow(t,e)},wp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 1-Math.pow(1-t,1/e)},_p=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 0==e?t:(Math.exp(t*e)-1)/(Math.exp(e)-1)},xp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 0==e?t:1-1/e*Math.log(Math.exp(e)*(1-t)+t)},Sp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.8;if(0==e)return t;if(1==e)return Math.sqrt(t*(2-t));var n=e/(1-e);return Math.sqrt(1/(n*n)+t*(2/n+2-t))-1/n},Op=function(t){return 1-Sp(1-t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:.8)},Ip=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 0==e?t:1/e*Math.log(1-t+t*Math.exp(e))},Tp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return(Math.exp(-e*t)-1)/(Math.exp(-e)-1)},Ap=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return Math.pow(t,1/e)},Mp=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return 1-Math.pow(1-t,e)},Ep=1e-6,Cp=1e-12,Pp=Math.PI,jp=Pp/2,kp=Pp/4,Bp=2*Pp,Fp=180/Pp,Lp=Pp/180,Dp=Math.abs,Np=Math.atan,Rp=Math.atan2,zp=Math.cos,Up=(Math.ceil,Math.exp,Math.floor,Math.hypot,Math.log,Math.pow,Math.sin),Vp=Math.sign||function(t){return t>0?1:t<0?-1:0},Wp=Math.sqrt;function $p(t){return t>1?jp:t<-1?-jp:Math.asin(t)}function Gp(){}function Yp(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:Gp,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Zp(t,e){return Dp(t[0]-e[0])<Ep&&Dp(t[1]-e[1])<Ep}function Hp(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function qp(t,e,n,r,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],s=t[e];if(Zp(r,s)){if(!r[2]&&!s[2]){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}s[0]+=2*Ep}a.push(n=new Hp(r,t,null,!0)),u.push(n.o=new Hp(r,null,n,!1)),a.push(n=new Hp(s,t,null,!1)),u.push(n.o=new Hp(s,null,n,!0))}})),a.length){for(u.sort(e),Xp(a),Xp(u),o=0,s=u.length;o<s;++o)u[o].e=n=!n;for(var c,l,f=a[0];;){for(var h=f,d=!0;h.v;)if((h=h.n)===f)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,s=c.length;o<s;++o)i.point((l=c[o])[0],l[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(c=h.p.z,o=c.length-1;o>=0;--o)i.point((l=c[o])[0],l[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function Xp(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}Math.tan;class Kp{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],o=t+i,s=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);s&&(e[n++]=s),t=o}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}function Jp(t){return[Rp(t[1],t[0]),$p(t[2])]}function Qp(t){var e=t[0],n=t[1],r=zp(n);return[r*zp(e),r*Up(e),Up(n)]}function ty(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ey(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function ny(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ry(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function iy(t){var e=Wp(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function oy(t){return Dp(t[0])<=Pp?t[0]:Vp(t[0])*((Dp(t[0])+Pp)%Bp-Pp)}function sy(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function ay(t,e,n,r){return function(i){var o,s,a,u=e(i),c=Yp(),l=e(c),f=!1,h={point:d,lineStart:y,lineEnd:v,polygonStart:function(){h.point=b,h.lineStart=m,h.lineEnd=g,s=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=y,h.lineEnd=v,s=sy(s);var t=function(t,e){var n=oy(e),r=e[1],i=Up(r),o=[Up(n),-zp(n),0],s=0,a=0,u=new Kp;1===i?r=jp+Ep:-1===i&&(r=-jp-Ep);for(var c=0,l=t.length;c<l;++c)if(h=(f=t[c]).length)for(var f,h,d=f[h-1],p=oy(d),y=d[1]/2+kp,v=Up(y),b=zp(y),m=0;m<h;++m,p=w,v=x,b=S,d=g){var g=f[m],w=oy(g),_=g[1]/2+kp,x=Up(_),S=zp(_),O=w-p,I=O>=0?1:-1,T=I*O,A=T>Pp,M=v*x;if(u.add(Rp(M*I*Up(T),b*S+M*zp(T))),s+=A?O+I*Bp:O,A^p>=n^w>=n){var E=ey(Qp(d),Qp(g));iy(E);var C=ey(o,E);iy(C);var P=(A^O>=0?-1:1)*$p(C[2]);(r>P||r===P&&(E[0]||E[1]))&&(a+=A^O>=0?1:-1)}}return(s<-Ep||s<Ep&&u<-Cp)^1&a}(o,r);s.length?(f||(i.polygonStart(),f=!0),qp(s,cy,t,n,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),s=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){u.point(t,e)}function y(){h.point=p,u.lineStart()}function v(){h.point=d,u.lineEnd()}function b(t,e){a.push([t,e]),l.point(t,e)}function m(){l.lineStart(),a=[]}function g(){b(a[0][0],a[0][1]),l.lineEnd();var t,e,n,r,u=l.clean(),h=c.result(),d=h.length;if(a.pop(),o.push(a),a=null,d)if(1&u){if((e=(n=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else d>1&&2&u&&h.push(h.pop().concat(h.shift())),s.push(h.filter(uy))}return h}}function uy(t){return t.length>1}function cy(t,e){return((t=t.x)[0]<0?t[1]-jp-Ep:jp-t[1])-((e=e.x)[0]<0?e[1]-jp-Ep:jp-e[1])}const ly=ay((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?Pp:-Pp,u=Dp(o-n);Dp(u-Pp)<Ep?(t.point(n,r=(r+s)/2>0?jp:-jp),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=Pp&&(Dp(n-i)<Ep&&(n-=i*Ep),Dp(o-a)<Ep&&(o-=a*Ep),r=function(t,e,n,r){var i,o,s=Up(t-n);return Dp(s)>Ep?Np((Up(e)*(o=zp(r))*Up(n)-Up(r)*(i=zp(e))*Up(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*jp,r.point(-Pp,i),r.point(0,i),r.point(Pp,i),r.point(Pp,0),r.point(Pp,-i),r.point(0,-i),r.point(-Pp,-i),r.point(-Pp,0),r.point(-Pp,i);else if(Dp(t[0]-e[0])>Ep){var o=t[0]<e[0]?Pp:-Pp;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-Pp,-jp]);function fy(t,e){(e=Qp(e))[0]-=t,iy(e);var n,r=(n=-e[1])>1?0:n<-1?Pp:Math.acos(n);return((-e[2]<0?-r:r)+Bp-Ep)%Bp}var hy=1e9,dy=-hy;function py(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}const yy=t=>t;function vy(t,e){return Dp(t)>Pp&&(t-=Math.round(t/Bp)*Bp),[t,e]}function by(t){return function(e,n){return Dp(e+=t)>Pp&&(e-=Math.round(e/Bp)*Bp),[e,n]}}function my(t){var e=by(t);return e.invert=by(-t),e}function gy(t,e){var n=zp(t),r=Up(t),i=zp(e),o=Up(e);function s(t,e){var s=zp(e),a=zp(t)*s,u=Up(t)*s,c=Up(e),l=c*n+a*r;return[Rp(u*i-l*o,a*n-c*r),$p(l*i+u*o)]}return s.invert=function(t,e){var s=zp(e),a=zp(t)*s,u=Up(t)*s,c=Up(e),l=c*i-u*o;return[Rp(u*i+c*o,a*n+l*r),$p(l*n-a*r)]},s}function wy(t){return function(e){var n=new _y;for(var r in t)n[r]=t[r];return n.stream=e,n}}function _y(){}function xy(t,e){t&&Oy.hasOwnProperty(t.type)&&Oy[t.type](t,e)}vy.invert=vy,_y.prototype={constructor:_y,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Sy={Feature:function(t,e){xy(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)xy(n[r].geometry,e)}},Oy={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Iy(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Iy(n[r],e,0)},Polygon:function(t,e){Ty(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Ty(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)xy(n[r],e)}};function Iy(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Ty(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Iy(t[n],e,1);e.polygonEnd()}var Ay=1/0,My=Ay,Ey=-Ay,Cy=Ey,Py={point:function(t,e){t<Ay&&(Ay=t),t>Ey&&(Ey=t),e<My&&(My=e),e>Cy&&(Cy=e)},lineStart:Gp,lineEnd:Gp,polygonStart:Gp,polygonEnd:Gp,result:function(){var t=[[Ay,My],[Ey,Cy]];return Ey=Cy=-(My=Ay=1/0),t}};const jy=Py;function ky(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),function(t,e){t&&Sy.hasOwnProperty(t.type)?Sy[t.type](t,e):xy(t,e)}(n,t.stream(jy)),e(jy.result()),null!=r&&t.clipExtent(r),t}function By(t,e,n){return ky(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),s=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,a=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([s,a])}),n)}var Fy=16,Ly=zp(30*Lp);function Dy(t,e){return+e?function(t,e){function n(r,i,o,s,a,u,c,l,f,h,d,p,y,v){var b=c-r,m=l-i,g=b*b+m*m;if(g>4*e&&y--){var w=s+h,_=a+d,x=u+p,S=Wp(w*w+_*_+x*x),O=$p(x/=S),I=Dp(Dp(x)-1)<Ep||Dp(o-f)<Ep?(o+f)/2:Rp(_,w),T=t(I,O),A=T[0],M=T[1],E=A-r,C=M-i,P=m*E-b*C;(P*P/g>e||Dp((b*E+m*C)/g-.5)>.3||s*h+a*d+u*p<Ly)&&(n(r,i,o,s,a,u,A,M,I,w/=S,_/=S,x,y,v),v.point(A,M),n(A,M,I,w,_,x,c,l,f,h,d,p,y,v))}}return function(e){var r,i,o,s,a,u,c,l,f,h,d,p,y={point:v,lineStart:b,lineEnd:g,polygonStart:function(){e.polygonStart(),y.lineStart=w},polygonEnd:function(){e.polygonEnd(),y.lineStart=b}};function v(n,r){n=t(n,r),e.point(n[0],n[1])}function b(){l=NaN,y.point=m,e.lineStart()}function m(r,i){var o=Qp([r,i]),s=t(r,i);n(l,f,c,h,d,p,l=s[0],f=s[1],c=r,h=o[0],d=o[1],p=o[2],Fy,e),e.point(l,f)}function g(){y.point=v,e.lineEnd()}function w(){b(),y.point=_,y.lineEnd=x}function _(t,e){m(r=t,e),i=l,o=f,s=h,a=d,u=p,y.point=m}function x(){n(l,f,c,h,d,p,i,o,r,s,a,u,Fy,e),y.lineEnd=g,g()}return y}}(t,e):function(t){return wy({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Ny=wy({point:function(t,e){this.stream.point(t*Lp,e*Lp)}});function Ry(t,e,n,r,i,o){if(!o)return function(t,e,n,r,i){function o(o,s){return[e+t*(o*=r),n-t*(s*=i)]}return o.invert=function(o,s){return[(o-e)/t*r,(n-s)/t*i]},o}(t,e,n,r,i);var s=zp(o),a=Up(o),u=s*t,c=a*t,l=s/t,f=a/t,h=(a*n-s*e)/t,d=(a*e+s*n)/t;function p(t,o){return[u*(t*=r)-c*(o*=i)+e,n-c*t-u*o]}return p.invert=function(t,e){return[r*(l*t-f*e+h),i*(d-f*t-l*e)]},p}function zy(t){return function(t){var e,n,r,i,o,s,a,u,c,l,f=150,h=480,d=250,p=0,y=0,v=0,b=0,m=0,g=0,w=1,_=1,x=null,S=ly,O=null,I=yy,T=.5;function A(t){return u(t[0]*Lp,t[1]*Lp)}function M(t){return(t=u.invert(t[0],t[1]))&&[t[0]*Fp,t[1]*Fp]}function E(){var t=Ry(f,0,0,w,_,g).apply(null,e(p,y)),r=Ry(f,h-t[0],d-t[1],w,_,g);return n=function(t,e,n){return(t%=Bp)?e||n?py(my(t),gy(e,n)):my(t):e||n?gy(e,n):vy}(v,b,m),a=py(e,r),u=py(n,a),s=Dy(a,T),C()}function C(){return c=l=null,A}return A.stream=function(t){return c&&l===t?c:c=Ny(function(t){return wy({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(S(s(I(l=t)))))},A.preclip=function(t){return arguments.length?(S=t,x=void 0,C()):S},A.postclip=function(t){return arguments.length?(I=t,O=r=i=o=null,C()):I},A.clipAngle=function(t){return arguments.length?(S=+t?function(t){var e=zp(t),n=6*Lp,r=e>0,i=Dp(e)>Ep;function o(t,n){return zp(t)*zp(n)>e}function s(t,n,r){var i=[1,0,0],o=ey(Qp(t),Qp(n)),s=ty(o,o),a=o[0],u=s-a*a;if(!u)return!r&&t;var c=e*s/u,l=-e*a/u,f=ey(i,o),h=ry(i,c);ny(h,ry(o,l));var d=f,p=ty(h,d),y=ty(d,d),v=p*p-y*(ty(h,h)-1);if(!(v<0)){var b=Wp(v),m=ry(d,(-p-b)/y);if(ny(m,h),m=Jp(m),!r)return m;var g,w=t[0],_=n[0],x=t[1],S=n[1];_<w&&(g=w,w=_,_=g);var O=_-w,I=Dp(O-Pp)<Ep;if(!I&&S<x&&(g=x,x=S,S=g),I||O<Ep?I?x+S>0^m[1]<(Dp(m[0]-w)<Ep?x:S):x<=m[1]&&m[1]<=S:O>Pp^(w<=m[0]&&m[0]<=_)){var T=ry(d,(-p+b)/y);return ny(T,h),[m,Jp(T)]}}}function a(e,n){var i=r?t:Pp-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return ay(o,(function(t){var e,n,u,c,l;return{lineStart:function(){c=u=!1,l=1},point:function(f,h){var d,p=[f,h],y=o(f,h),v=r?y?0:a(f,h):y?a(f+(f<0?Pp:-Pp),h):0;if(!e&&(c=u=y)&&t.lineStart(),y!==u&&(!(d=s(e,p))||Zp(e,d)||Zp(p,d))&&(p[2]=1),y!==u)l=0,y?(t.lineStart(),d=s(p,e),t.point(d[0],d[1])):(d=s(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^y){var b;v&n||!(b=s(p,e,!0))||(l=0,r?(t.lineStart(),t.point(b[0][0],b[0][1]),t.point(b[1][0],b[1][1]),t.lineEnd()):(t.point(b[1][0],b[1][1]),t.lineEnd(),t.lineStart(),t.point(b[0][0],b[0][1],3)))}!y||e&&Zp(e,p)||t.point(p[0],p[1]),e=p,u=y,n=v},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return l|(c&&u)<<1}}}),(function(e,r,i,o){!function(t,e,n,r,i,o){if(n){var s=zp(e),a=Up(e),u=r*n;null==i?(i=e+r*Bp,o=e-u/2):(i=fy(s,i),o=fy(s,o),(r>0?i<o:i>o)&&(i+=r*Bp));for(var c,l=i;r>0?l>o:l<o;l-=u)c=Jp([s,-a*zp(l),-a*Up(l)]),t.point(c[0],c[1])}}(o,t,n,i,e,r)}),r?[0,-t]:[-Pp,t-Pp])}(x=t*Lp):(x=null,ly),C()):x*Fp},A.clipExtent=function(t){return arguments.length?(I=null==t?(O=r=i=o=null,yy):function(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,a,c){var l=0,f=0;if(null==i||(l=s(i,a))!==(f=s(o,a))||u(i,o)<0^a>0)do{c.point(0===l||3===l?t:n,l>1?r:e)}while((l=(l+a+4)%4)!==f);else c.point(o[0],o[1])}function s(r,i){return Dp(r[0]-t)<Ep?i>0?0:3:Dp(r[0]-n)<Ep?i>0?2:1:Dp(r[1]-e)<Ep?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var n=s(t,1),r=s(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){var u,c,l,f,h,d,p,y,v,b,m,g=s,w=Yp(),_={point:x,lineStart:function(){_.point=S,c&&c.push(l=[]),b=!0,v=!1,p=y=NaN},lineEnd:function(){u&&(S(f,h),d&&v&&w.rejoin(),u.push(w.result())),_.point=x,v&&g.lineEnd()},polygonStart:function(){g=w,u=[],c=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=c.length;n<i;++n)for(var o,s,a=c[n],u=1,l=a.length,f=a[0],h=f[0],d=f[1];u<l;++u)o=h,s=d,h=(f=a[u])[0],d=f[1],s<=r?d>r&&(h-o)*(r-s)>(d-s)*(t-o)&&++e:d<=r&&(h-o)*(r-s)<(d-s)*(t-o)&&--e;return e}(),n=m&&e,i=(u=sy(u)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&qp(u,a,e,o,s),s.polygonEnd()),g=s,u=c=l=null}};function x(t,e){i(t,e)&&g.point(t,e)}function S(o,s){var a=i(o,s);if(c&&l.push([o,s]),b)f=o,h=s,d=a,b=!1,a&&(g.lineStart(),g.point(o,s));else if(a&&v)g.point(o,s);else{var u=[p=Math.max(dy,Math.min(hy,p)),y=Math.max(dy,Math.min(hy,y))],w=[o=Math.max(dy,Math.min(hy,o)),s=Math.max(dy,Math.min(hy,s))];!function(t,e,n,r,i,o){var s,a=t[0],u=t[1],c=0,l=1,f=e[0]-a,h=e[1]-u;if(s=n-a,f||!(s>0)){if(s/=f,f<0){if(s<c)return;s<l&&(l=s)}else if(f>0){if(s>l)return;s>c&&(c=s)}if(s=i-a,f||!(s<0)){if(s/=f,f<0){if(s>l)return;s>c&&(c=s)}else if(f>0){if(s<c)return;s<l&&(l=s)}if(s=r-u,h||!(s>0)){if(s/=h,h<0){if(s<c)return;s<l&&(l=s)}else if(h>0){if(s>l)return;s>c&&(c=s)}if(s=o-u,h||!(s<0)){if(s/=h,h<0){if(s>l)return;s>c&&(c=s)}else if(h>0){if(s<c)return;s<l&&(l=s)}return c>0&&(t[0]=a+c*f,t[1]=u+c*h),l<1&&(e[0]=a+l*f,e[1]=u+l*h),!0}}}}}(u,w,t,e,n,r)?a&&(g.lineStart(),g.point(o,s),m=!1):(v||(g.lineStart(),g.point(u[0],u[1])),g.point(w[0],w[1]),a||g.lineEnd(),m=!1)}p=o,y=s,v=a}return _}}(O=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),C()):null==O?null:[[O,r],[i,o]]},A.scale=function(t){return arguments.length?(f=+t,E()):f},A.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],E()):[h,d]},A.center=function(t){return arguments.length?(p=t[0]%360*Lp,y=t[1]%360*Lp,E()):[p*Fp,y*Fp]},A.rotate=function(t){return arguments.length?(v=t[0]%360*Lp,b=t[1]%360*Lp,m=t.length>2?t[2]%360*Lp:0,E()):[v*Fp,b*Fp,m*Fp]},A.angle=function(t){return arguments.length?(g=t%360*Lp,E()):g*Fp},A.reflectX=function(t){return arguments.length?(w=t?-1:1,E()):w<0},A.reflectY=function(t){return arguments.length?(_=t?-1:1,E()):_<0},A.precision=function(t){return arguments.length?(s=Dy(a,T=t*t),C()):Wp(T)},A.fitExtent=function(t,e){return By(A,t,e)},A.fitSize=function(t,e){return function(t,e,n){return By(t,[[0,0],e],n)}(A,t,e)},A.fitWidth=function(t,e){return function(t,e,n){return ky(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,s=-i*n[0][1];t.scale(150*i).translate([o,s])}),n)}(A,t,e)},A.fitHeight=function(t,e){return function(t,e,n){return ky(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],s=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,s])}),n)}(A,t,e)},function(){return e=t.apply(this,arguments),A.invert=e.invert&&M,E()}}((function(){return t}))()}var Uy,Vy,Wy=(Uy=function(t){return Wp(2/(1+t))},function(t,e){var n=zp(t),r=zp(e),i=Uy(n*r);return i===1/0?[2,0]:[i*r*Up(t),i*Up(e)]});Wy.invert=(Vy=function(t){return 2*$p(t/2)},function(t,e){var n=Wp(t*t+e*e),r=Vy(n),i=Up(r),o=zp(r);return[Rp(t*i,n*o),$p(n&&e*i/n)]});var $y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"EUR",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,n=arguments.length>2?arguments[2]:void 0,r=(n=n||{}).ex||1.2,i=n.fontFamily||"Arial",o=n.exSize||1;return n.style=n.style||function(t,e){if(!(t.rs<r*e))return t.r1<r*e?o+"em "+i:1.5*o+"em "+i},n.proj=n.proj||zy(Wy).scale(124.75).clipAngle(179.999).rotate([-10,-52]).reflectX(!1).reflectY(!0).scale(6378137).translate([4321e3,321e4]),n.preprocess=function(t){if(n.ccIn&&t.cc&&!(n.ccIn.indexOf(t.cc)>=0))return!1;var e=n.proj([t.lon,t.lat]);t.x=e[0],t.y=e[1],delete t.lon,delete t.lat},n.baseURL=n.baseURL||"https://raw.githubusercontent.com/eurostat/euronym/main/pub/v2/UTF/",n.url=n.baseURL+e+"/"+t+".csv",n},Gy=function(t){var e=(t=t||{}).nutsYear||"2021",n=t.crs||"3035",r=t.scale||"03M",i=t.nutsLevel||"3",o=t.col||"#888",s=t.colKosovo||"#bcbcbc",a=null==t.showOth||t.showOth;return t.color=t.color||function(t,e){var n=t.properties;if(a||"T"==n.eu||"T"==n.cc||"T"==n.efta||"T"!==n.oth)return n.id>=1e5?s:"T"===n.co||e<400?o:e<1e3?n.lvl>=3?"":o:e<2e3?n.lvl>=2?"":o:n.lvl>=1?"":o},t.width=t.width||function(t,e){var n=t.properties;return"T"===n.co?.5:e<400?3==n.lvl||2==n.lvl||1==n.lvl?2.2:4:e<1e3?2==n.lvl||1==n.lvl?1.8:2.5:e<2e3?1==n.lvl?1.8:2.5:1.2},t.lineDash=t.lineDash||function(t,e){var n=t.properties;return"T"===n.co?[]:e<400?3==n.lvl?[2*e,2*e]:2==n.lvl||1==n.lvl?[5*e,2*e]:[10*e,3*e]:e<1e3?2==n.lvl||1==n.lvl?[5*e,2*e]:[10*e,3*e]:e<2e3&&1==n.lvl?[5*e,2*e]:[10*e,3*e]},t.baseURL=t.baseURL||"https://raw.githubusercontent.com/eurostat/Nuts2json/master/pub/v2/",t.url=t.baseURL+e+"/"+n+"/"+r+"/nutsbn_"+i+".json",t},Yy=Rn.getParameterByName;return Vd({decimal:".",thousands:" ",grouping:[3],currency:["","€"]}),e})()));