gridviz 3.0.35 → 3.0.37

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.
Files changed (67) hide show
  1. package/README.md +129 -129
  2. package/dist/gridviz.js +21056 -17487
  3. package/dist/gridviz.min.js +2 -2
  4. package/package.json +74 -74
  5. package/src/button/Button.js +67 -67
  6. package/src/button/FullscreenButton.js +121 -121
  7. package/src/button/ZoomButtons.js +103 -103
  8. package/src/core/Dataset.js +232 -154
  9. package/src/core/Drawable.js +78 -78
  10. package/src/core/GeoCanvas.js +443 -443
  11. package/src/core/Layer.js +23 -23
  12. package/src/core/Legend.js +108 -108
  13. package/src/core/Map.js +650 -568
  14. package/src/core/MultiResolutionDataset.js +93 -93
  15. package/src/core/Style.js +98 -98
  16. package/src/core/Tooltip.js +182 -182
  17. package/src/dataset/COGeo.js +25 -25
  18. package/src/dataset/CSVGrid.js +112 -112
  19. package/src/dataset/GeoTIFF.js +122 -122
  20. package/src/dataset/JSGrid.js +55 -55
  21. package/src/dataset/TiledGrid.js +311 -302
  22. package/src/dataset/worker.js +18 -18
  23. package/src/index.js +79 -79
  24. package/src/layer/BackgroundLayer.js +173 -173
  25. package/src/layer/BackgroundLayerImage.js +81 -81
  26. package/src/layer/BackgroundLayerWMS.js +104 -104
  27. package/src/layer/GeoJSONLayer.js +276 -276
  28. package/src/layer/GridLayer.js +166 -166
  29. package/src/layer/LabelLayer.js +194 -194
  30. package/src/legend/ColorCategoryLegend.js +109 -109
  31. package/src/legend/ColorDiscreteLegend.js +100 -100
  32. package/src/legend/ColorLegend.js +115 -115
  33. package/src/legend/OrientationLegend.js +89 -89
  34. package/src/legend/SizeLegend.js +224 -224
  35. package/src/legend/TernaryLegend.js +302 -302
  36. package/src/style/CompositionStyle.js +291 -291
  37. package/src/style/DotDensityStyle.js +133 -133
  38. package/src/style/ImageStyle.js +100 -100
  39. package/src/style/Interpolator.js +258 -258
  40. package/src/style/IsoFenceStyle.js +217 -217
  41. package/src/style/JoyPlotStyle.js +180 -180
  42. package/src/style/LegoStyle.js +132 -132
  43. package/src/style/MosaicStyle.js +99 -99
  44. package/src/style/NinjaStarStyle.js +102 -102
  45. package/src/style/PillarStyle.js +207 -207
  46. package/src/style/SegmentStyle.js +105 -105
  47. package/src/style/ShadingRayStyle.js +280 -280
  48. package/src/style/ShadingStyle.js +72 -72
  49. package/src/style/ShapeColorSizeStyle.js +147 -147
  50. package/src/style/SideCategoryStyle.js +112 -112
  51. package/src/style/SideStyle.js +217 -217
  52. package/src/style/SideTanakaStyle.js +154 -154
  53. package/src/style/SquareColorCategoryWebGLStyle.js +311 -294
  54. package/src/style/SquareColorWebGLStyle.js +126 -126
  55. package/src/style/StrokeStyle.js +135 -135
  56. package/src/style/TextStyle.js +110 -110
  57. package/src/style/TimeSeriesStyle.js +222 -222
  58. package/src/utils/WebGLRectangleColoring.js +106 -106
  59. package/src/utils/WebGLSquareColoring.js +114 -118
  60. package/src/utils/WebGLSquareColoringAdvanced.js +223 -227
  61. package/src/utils/WebGLSquareColoringKS.js +153 -153
  62. package/src/utils/scale.js +255 -255
  63. package/src/utils/stretching.js +120 -120
  64. package/src/utils/ternary.js +208 -208
  65. package/src/utils/utils.js +125 -125
  66. package/src/utils/webGLUtils.js +178 -73
  67. package/src/utils/zoomUtils.js +142 -142
@@ -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.gridviz=e():t.gridviz=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 o(t){"function"!=typeof t&&(t=r(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var a,u,l=e[i],c=l.length,f=o[i]=new Array(c),s=0;s<c;++s)(a=l[s])&&(u=t.call(a,a.__data__,s,l))&&("__data__"in a&&(u.__data__=a.__data__),f[s]=u);return new Xt(o,this._parents)}function i(){return[]}function a(t){return null==t?i:function(){return this.querySelectorAll(t)}}function u(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):a(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var u,l=e[i],c=l.length,f=0;f<c;++f)(u=l[f])&&(r.push(t.call(u,u.__data__,f,l)),o.push(u));return new Xt(r,o)}function l(t){return function(){return this.matches(t)}}function c(t){return function(e){return e.matches(t)}}t.r(e),t.d(e,{BackgroundLayer:()=>Rf,BackgroundLayerImage:()=>qf,BackgroundLayerWMS:()=>Gf,CSVGrid:()=>Yi,ColorCategoryLegend:()=>Us,ColorDiscreteLegend:()=>Fs,ColorLegend:()=>Cs,CompositionStyle:()=>Ua,Dataset:()=>Jo,DotDensityStyle:()=>yl,GeoCanvas:()=>Zr,GeoJSONLayer:()=>ms,GridLayer:()=>Tf,ImageStyle:()=>cf,Interpolator:()=>bf,IsoFenceStyle:()=>qc,JSGrid:()=>ra,JoyPlotStyle:()=>za,LabelLayer:()=>as,Layer:()=>Ho,LegoStyle:()=>Kl,Map:()=>Po,MosaicStyle:()=>wc,MultiResolutionDataset:()=>ni,NinjaStarStyle:()=>kc,OrientationLegend:()=>fh,PillarStyle:()=>pu,SegmentStyle:()=>Ja,ShadingRayStyle:()=>Nu,ShadingStyle:()=>Hu,ShapeColorSizeStyle:()=>sa,SideCategoryStyle:()=>Ku,SideStyle:()=>Su,SideTanakaStyle:()=>xl,SizeLegend:()=>Qs,SquareColorCategoryWebGLStyle:()=>Mu,SquareColorWebGLStyle:()=>hc,StrokeStyle:()=>ga,Style:()=>Lo,TernaryLegend:()=>mh,TextStyle:()=>iu,TiledGrid:()=>Fi,TimeSeriesStyle:()=>Bc,cellsToMatrix:()=>_a,circularInverseScale:()=>Ph,circularScale:()=>jh,classifier:()=>Nl,classifierMinMax:()=>Dl,colorClassifier:()=>Gl,discreteColors:()=>Wl,exponentialScale:()=>wh,getParameterByName:()=>yy,logarithmicScale:()=>xh,nice:()=>Pa,orientationLegend:()=>sh,powerInverseScale:()=>Oh,powerScale:()=>Sh,sizeDiscreteLegend:()=>eh,sizeDiscreteViewScaleLegend:()=>nh,sizeLegend:()=>Ks,sizeLegendViewScale:()=>th,ternaryClassifier:()=>Xh,ternaryColorClassifier:()=>Vh,viewScale:()=>zl,viewScaleColor:()=>Il,viewScaleColorQuantile:()=>Fl,viewScaleCombination:()=>Ll,viewScaleQuantile:()=>Rl,viewScaleQuantileClassifer:()=>Bl}),Object.defineProperty(r,"name",{value:"default",configurable:!0}),Object.defineProperty(o,"name",{value:"default",configurable:!0}),Object.defineProperty(a,"name",{value:"default",configurable:!0}),Object.defineProperty(u,"name",{value:"default",configurable:!0}),Object.defineProperty(l,"name",{value:"default",configurable:!0}),Object.defineProperty(h,"name",{value:"default",configurable:!0});var f=Array.prototype.find;function s(){return this.firstElementChild}function h(t){return this.select(null==t?s:function(t){return function(){return f.call(this.children,t)}}("function"==typeof t?t:c(t)))}Object.defineProperty(v,"name",{value:"default",configurable:!0});var y=Array.prototype.filter;function p(){return Array.from(this.children)}function v(t){return this.selectAll(null==t?p:function(t){return function(){return y.call(this.children,t)}}("function"==typeof t?t:c(t)))}function d(t){"function"!=typeof t&&(t=l(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a=e[o],u=a.length,c=r[o]=[],f=0;f<u;++f)(i=a[f])&&t.call(i,i.__data__,f,a)&&c.push(i);return new Xt(r,this._parents)}function b(t){return new Array(t.length)}function m(){return new Xt(this._enter||this._groups.map(b),this._parents)}function g(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function w(t){return function(){return t}}function x(t,e,n,r,o,i){for(var a,u=0,l=e.length,c=i.length;u<c;++u)(a=e[u])?(a.__data__=i[u],r[u]=a):n[u]=new g(t,i[u]);for(;u<l;++u)(a=e[u])&&(o[u]=a)}function S(t,e,n,r,o,i,a){var u,l,c,f=new Map,s=e.length,h=i.length,y=new Array(s);for(u=0;u<s;++u)(l=e[u])&&(y[u]=c=a.call(l,l.__data__,u,e)+"",f.has(c)?o[u]=l:f.set(c,l));for(u=0;u<h;++u)c=a.call(t,i[u],u,i)+"",(l=f.get(c))?(r[u]=l,l.__data__=i[u],f.delete(c)):n[u]=new g(t,i[u]);for(u=0;u<s;++u)(l=e[u])&&f.get(y[u])===l&&(o[u]=l)}function O(t){return t.__data__}function j(t,e){if(!arguments.length)return Array.from(this,O);var n=e?S:x,r=this._parents,o=this._groups;"function"!=typeof t&&(t=w(t));for(var i=o.length,a=new Array(i),u=new Array(i),l=new Array(i),c=0;c<i;++c){var f=r[c],s=o[c],h=s.length,y=P(t.call(f,f&&f.__data__,c,r)),p=y.length,v=u[c]=new Array(p),d=a[c]=new Array(p);n(f,s,v,d,l[c]=new Array(h),y,e);for(var b,m,g=0,j=0;g<p;++g)if(b=v[g]){for(g>=j&&(j=g+1);!(m=d[j])&&++j<p;);b._next=m||null}}return(a=new Xt(a,r))._enter=u,a._exit=l,a}function P(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function _(){return new Xt(this._exit||this._groups.map(b),this._parents)}function T(t,e,n){var r=this.enter(),o=this,i=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(o=e(o))&&(o=o.selection()),null==n?i.remove():n(i),r&&o?r.merge(o).order():o}function k(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,a=Math.min(o,i),u=new Array(o),l=0;l<a;++l)for(var c,f=n[l],s=r[l],h=f.length,y=u[l]=new Array(h),p=0;p<h;++p)(c=f[p]||s[p])&&(y[p]=c);for(;l<o;++l)u[l]=n[l];return new Xt(u,this._parents)}function C(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,o=t[e],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this}function E(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=A);for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a,u=n[i],l=u.length,c=o[i]=new Array(l),f=0;f<l;++f)(a=u[f])&&(c[f]=a);c.sort(e)}return new Xt(o,this._parents).order()}function A(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function M(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function z(){return Array.from(this)}function R(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null}function I(){let t=0;for(const e of this)++t;return t}function F(){return!this.node()}function B(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o,i=e[n],a=0,u=i.length;a<u;++a)(o=i[a])&&t.call(o,o.__data__,a,i);return this}Object.defineProperty(d,"name",{value:"default",configurable:!0}),Object.defineProperty(b,"name",{value:"default",configurable:!0}),Object.defineProperty(m,"name",{value:"default",configurable:!0}),g.prototype={constructor:g,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)}},Object.defineProperty(w,"name",{value:"default",configurable:!0}),Object.defineProperty(j,"name",{value:"default",configurable:!0}),Object.defineProperty(_,"name",{value:"default",configurable:!0}),Object.defineProperty(T,"name",{value:"default",configurable:!0}),Object.defineProperty(k,"name",{value:"default",configurable:!0}),Object.defineProperty(C,"name",{value:"default",configurable:!0}),Object.defineProperty(E,"name",{value:"default",configurable:!0}),Object.defineProperty(M,"name",{value:"default",configurable:!0}),Object.defineProperty(z,"name",{value:"default",configurable:!0}),Object.defineProperty(R,"name",{value:"default",configurable:!0}),Object.defineProperty(I,"name",{value:"default",configurable:!0}),Object.defineProperty(F,"name",{value:"default",configurable:!0}),Object.defineProperty(B,"name",{value:"default",configurable:!0});var L="http://www.w3.org/1999/xhtml";const N={svg:"http://www.w3.org/2000/svg",xhtml:L,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function D(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),N.hasOwnProperty(e)?{space:N[e],local:t}:t}function G(t){return function(){this.removeAttribute(t)}}function W(t){return function(){this.removeAttributeNS(t.space,t.local)}}function U(t,e){return function(){this.setAttribute(t,e)}}function $(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function H(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function X(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 V(t,e){var n=D(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?W:G:"function"==typeof e?n.local?X:H:n.local?$:U)(n,e))}function q(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Y(t){return function(){this.style.removeProperty(t)}}function Z(t,e,n){return function(){this.style.setProperty(t,e,n)}}function J(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Q(t,e,n){return arguments.length>1?this.each((null==e?Y:"function"==typeof e?J:Z)(t,e,null==n?"":n)):K(this.node(),t)}function K(t,e){return t.style.getPropertyValue(e)||q(t).getComputedStyle(t,null).getPropertyValue(e)}function tt(t){return function(){delete this[t]}}function et(t,e){return function(){this[t]=e}}function nt(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function rt(t,e){return arguments.length>1?this.each((null==e?tt:"function"==typeof e?nt:et)(t,e)):this.node()[t]}function ot(t){return t.trim().split(/^|\s+/)}function it(t){return t.classList||new at(t)}function at(t){this._node=t,this._names=ot(t.getAttribute("class")||"")}function ut(t,e){for(var n=it(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function lt(t,e){for(var n=it(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function ct(t){return function(){ut(this,t)}}function ft(t){return function(){lt(this,t)}}function st(t,e){return function(){(e.apply(this,arguments)?ut:lt)(this,t)}}function ht(t,e){var n=ot(t+"");if(arguments.length<2){for(var r=it(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?st:e?ct:ft)(n,e))}function yt(){this.textContent=""}function pt(t){return function(){this.textContent=t}}function vt(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function dt(t){return arguments.length?this.each(null==t?yt:("function"==typeof t?vt:pt)(t)):this.node().textContent}function bt(){this.innerHTML=""}function mt(t){return function(){this.innerHTML=t}}function gt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function wt(t){return arguments.length?this.each(null==t?bt:("function"==typeof t?gt:mt)(t)):this.node().innerHTML}function xt(){this.nextSibling&&this.parentNode.appendChild(this)}function St(){return this.each(xt)}function Ot(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function jt(){return this.each(Ot)}function Pt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===L&&e.documentElement.namespaceURI===L?e.createElement(t):e.createElementNS(n,t)}}function _t(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Tt(t){var e=D(t);return(e.local?_t:Pt)(e)}function kt(t){var e="function"==typeof t?t:Tt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ct(){return null}function Et(t,e){var n="function"==typeof t?t:Tt(t),o=null==e?Ct:"function"==typeof e?e:r(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function At(){var t=this.parentNode;t&&t.removeChild(this)}function Mt(){return this.each(At)}function zt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Rt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function It(t){return this.select(t?Rt:zt)}function Ft(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Bt(t){return function(){var e=this.__on;if(e){for(var n,r=0,o=-1,i=e.length;r<i;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?e.length=o:delete this.__on}}}function Lt(t,e,n){return function(){var r,o=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=e);this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Nt(t,e,n){var r,o,i=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+""),a=i.length;if(!(arguments.length<2)){for(u=e?Lt:Bt,r=0;r<a;++r)this.each(u(i[r],e,n));return this}var u=this.node().__on;if(u)for(var l,c=0,f=u.length;c<f;++c)for(r=0,l=u[c];r<a;++r)if((o=i[r]).type===l.type&&o.name===l.name)return l.value}function Dt(t,e,n){var r=q(t),o=r.CustomEvent;"function"==typeof o?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function Gt(t,e){return function(){return Dt(this,t,e)}}function Wt(t,e){return function(){return Dt(this,t,e.apply(this,arguments))}}function Ut(t,e){return this.each(("function"==typeof e?Wt:Gt)(t,e))}function*$t(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,o=t[e],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}Object.defineProperty(D,"name",{value:"default",configurable:!0}),Object.defineProperty(V,"name",{value:"default",configurable:!0}),Object.defineProperty(q,"name",{value:"default",configurable:!0}),Object.defineProperty(Q,"name",{value:"default",configurable:!0}),Object.defineProperty(rt,"name",{value:"default",configurable:!0}),Object.defineProperty(ht,"name",{value:"default",configurable:!0}),at.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}},Object.defineProperty(dt,"name",{value:"default",configurable:!0}),Object.defineProperty(wt,"name",{value:"default",configurable:!0}),Object.defineProperty(St,"name",{value:"default",configurable:!0}),Object.defineProperty(jt,"name",{value:"default",configurable:!0}),Object.defineProperty(Tt,"name",{value:"default",configurable:!0}),Object.defineProperty(kt,"name",{value:"default",configurable:!0}),Object.defineProperty(Et,"name",{value:"default",configurable:!0}),Object.defineProperty(Mt,"name",{value:"default",configurable:!0}),Object.defineProperty(It,"name",{value:"default",configurable:!0}),Object.defineProperty(Ft,"name",{value:"default",configurable:!0}),Object.defineProperty(Nt,"name",{value:"default",configurable:!0}),Object.defineProperty(Ut,"name",{value:"default",configurable:!0}),Object.defineProperty($t,"name",{value:"default",configurable:!0});var Ht=[null];function Xt(t,e){this._groups=t,this._parents=e}function Vt(){return new Xt([[document.documentElement]],Ht)}Xt.prototype=Vt.prototype={constructor:Xt,select:o,selectAll:u,selectChild:h,selectChildren:v,filter:d,data:j,enter:m,exit:_,join:T,merge:k,selection:function(){return this},order:C,sort:E,call:M,nodes:z,node:R,size:I,empty:F,each:B,attr:V,style:Q,property:rt,classed:ht,text:dt,html:wt,raise:St,lower:jt,append:kt,insert:Et,remove:Mt,clone:It,datum:Ft,on:Nt,dispatch:Ut,[Symbol.iterator]:$t};const qt=Vt;function Yt(t){return"string"==typeof t?new Xt([[document.querySelector(t)]],[document.documentElement]):new Xt([[t]],Ht)}Object.defineProperty(Yt,"name",{value:"default",configurable:!0});var Zt={value:()=>{}};function Jt(){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 Qt(r)}function Qt(t){this._=t}function Kt(t,e){for(var n,r=0,o=t.length;r<o;++r)if((n=t[r]).name===e)return n.value}function te(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=Zt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Qt.prototype=Jt.prototype={constructor:Qt,on:function(t,e){var n,r,o=this._,i=(r=o,(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}})),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<u;)if(n=(t=i[a]).type)o[n]=te(o[n],t.name,e);else if(null==e)for(n in o)o[n]=te(o[n],t.name,null);return this}for(;++a<u;)if((n=(t=i[a]).type)&&(n=Kt(o[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Qt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,o=new Array(n),i=0;i<n;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,n=(r=this._[t]).length;i<n;++i)r[i].value.apply(e,o)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};const ee=Jt;Object.defineProperty(re,"name",{value:"default",configurable:!0});const ne={capture:!0,passive:!1};function re(t){t.preventDefault(),t.stopImmediatePropagation()}function oe(t){var e=t.document.documentElement,n=Yt(t).on("dragstart.drag",re,ne);"onselectstart"in e?n.on("selectstart.drag",re,ne):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ie(t){return((t=Math.exp(t))+1/t)/2}Object.defineProperty(oe,"name",{value:"default",configurable:!0});const ae=function t(e,n,r){function o(t,o){var i,a,u=t[0],l=t[1],c=t[2],f=o[0],s=o[1],h=o[2],y=f-u,p=s-l,v=y*y+p*p;if(v<1e-12)a=Math.log(h/c)/e,i=function(t){return[u+t*y,l+t*p,c*Math.exp(e*t*a)]};else{var d=Math.sqrt(v),b=(h*h-c*c+r*v)/(2*c*n*d),m=(h*h-c*c-r*v)/(2*h*n*d),g=Math.log(Math.sqrt(b*b+1)-b),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-g)/e,i=function(t){var r,o=t*a,i=ie(g),f=c/(n*d)*(i*(r=e*o+g,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[u+f*y,l+f*p,c*i/ie(e*o+g)]}}return i.duration=1e3*a*e/Math.SQRT2,i}return o.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},o}(Math.SQRT2,2,4);function ue(t){let e;for(;e=t.sourceEvent;)t=e;return t}function le(t,e){if(t=ue(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 o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}Object.defineProperty(ue,"name",{value:"default",configurable:!0}),Object.defineProperty(le,"name",{value:"default",configurable:!0});var ce,fe,se=0,he=0,ye=0,pe=0,ve=0,de=0,be="object"==typeof performance&&performance.now?performance:Date,me="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ge(){return ve||(me(we),ve=be.now()+de)}function we(){ve=0}function xe(){this._call=this._time=this._next=null}function Se(t,e,n){var r=new xe;return r.restart(t,e,n),r}function Oe(){ve=(pe=be.now())+de,se=he=0;try{!function(){ge(),++se;for(var t,e=ce;e;)(t=ve-e._time)>=0&&e._call.call(void 0,t),e=e._next;--se}()}finally{se=0,function(){for(var t,e,n=ce,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:ce=e);fe=t,Pe(r)}(),ve=0}}function je(){var t=be.now(),e=t-pe;e>1e3&&(de-=e,pe=t)}function Pe(t){se||(he&&(he=clearTimeout(he)),t-ve>24?(t<1/0&&(he=setTimeout(Oe,t-be.now()-de)),ye&&(ye=clearInterval(ye))):(ye||(pe=be.now(),ye=setInterval(je,1e3)),se=1,me(Oe)))}function _e(t,e,n){var r=new xe;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}xe.prototype=Se.prototype={constructor:xe,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?ge():+n)+(null==e?0:+e),this._next||fe===this||(fe?fe._next=this:ce=this,fe=this),this._call=t,this._time=n,Pe()},stop:function(){this._call&&(this._call=null,this._time=1/0,Pe())}},Object.defineProperty(_e,"name",{value:"default",configurable:!0}),Object.defineProperty(Fe,"name",{value:"default",configurable:!0});var Te=ee("start","end","cancel","interrupt"),ke=[],Ce=0,Ee=1,Ae=2,Me=3,ze=4,Re=5,Ie=6;function Fe(t,e,n,r,o,i){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,o=t.__transition;function i(l){var c,f,s,h;if(n.state!==Ee)return u();for(c in o)if((h=o[c]).name===n.name){if(h.state===Me)return _e(i);h.state===ze?(h.state=Ie,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[c]):+c<e&&(h.state=Ie,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete o[c])}if(_e(function(){n.state===Me&&(n.state=ze,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Ae,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Ae){for(n.state=Me,r=new Array(s=n.tween.length),c=0,f=-1;c<s;++c)(h=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(e){for(var o=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(u),n.state=Re,1),i=-1,a=r.length;++i<a;)r[i].call(t,o);n.state===Re&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){for(var r in n.state=Ie,n.timer.stop(),delete o[e],o)return;delete t.__transition}o[e]=n,n.timer=Se(function(t){n.state=Ee,n.timer.restart(i,n.delay,n.time),n.delay<=t&&i(t-n.delay)},0,n.time)}(t,n,{name:e,index:r,group:o,on:Te,tween:ke,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Ce})}function Be(t,e){var n=Ne(t,e);if(n.state>Ce)throw new Error("too late; already scheduled");return n}function Le(t,e){var n=Ne(t,e);if(n.state>Me)throw new Error("too late; already running");return n}function Ne(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function De(t,e){var n,r,o,i=t.__transition,a=!0;if(i){for(o in e=null==e?null:e+"",i)(n=i[o]).name===e?(r=n.state>Ae&&n.state<Re,n.state=Ie,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[o]):a=!1;a&&delete t.__transition}}function Ge(t){return this.each(function(){De(this,t)})}function We(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}Object.defineProperty(De,"name",{value:"default",configurable:!0}),Object.defineProperty(Ge,"name",{value:"default",configurable:!0}),Object.defineProperty(We,"name",{value:"default",configurable:!0}),Object.defineProperty(Xe,"name",{value:"default",configurable:!0});var Ue,$e=180/Math.PI,He={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Xe(t,e,n,r,o,i){var a,u,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,l/=u),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*$e,skewX:Math.atan(l)*$e,scaleX:a,scaleY:u}}function Ve(t,e,n,r){function o(t){return t.length?t.pop()+" ":""}return function(i,a){var u=[],l=[];return i=t(i),a=t(a),function(t,r,o,i,a,u){if(t!==o||r!==i){var l=a.push("translate(",null,e,null,n);u.push({i:l-4,x:We(t,o)},{i:l-2,x:We(r,i)})}else(o||i)&&a.push("translate("+o+e+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,u,l),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(o(n)+"rotate(",null,r)-2,x:We(t,e)})):e&&n.push(o(n)+"rotate("+e+r)}(i.rotate,a.rotate,u,l),function(t,e,n,i){t!==e?i.push({i:n.push(o(n)+"skewX(",null,r)-2,x:We(t,e)}):e&&n.push(o(n)+"skewX("+e+r)}(i.skewX,a.skewX,u,l),function(t,e,n,r,i,a){if(t!==n||e!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:We(t,n)},{i:u-2,x:We(e,r)})}else 1===n&&1===r||i.push(o(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,l),i=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)u[(e=l[n]).i]=e.x(t);return u.join("")}}}var qe=Ve(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?He:Xe(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),Ye=Ve(function(t){return null==t?He:(Ue||(Ue=document.createElementNS("http://www.w3.org/2000/svg","g")),Ue.setAttribute("transform",t),(t=Ue.transform.baseVal.consolidate())?Xe((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):He)},", ",")",")");function Ze(t,e){var n,r;return function(){var o=Le(this,t),i=o.tween;if(i!==n)for(var a=0,u=(r=n=i).length;a<u;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}o.tween=r}}function Je(t,e,n){var r,o;if("function"!=typeof n)throw new Error;return function(){var i=Le(this,t),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:e,value:n},l=0,c=o.length;l<c;++l)if(o[l].name===e){o[l]=u;break}l===c&&o.push(u)}i.tween=o}}function Qe(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,o=Ne(this.node(),n).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===t)return r.value;return null}return this.each((null==e?Ze:Je)(n,t,e))}function Ke(t,e,n){var r=t._id;return t.each(function(){var t=Le(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Ne(t,r).value[e]}}function tn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function en(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function nn(){}Object.defineProperty(Qe,"name",{value:"default",configurable:!0}),Object.defineProperty(tn,"name",{value:"default",configurable:!0});var rn=.7,on=1/rn,an="\\s*([+-]?\\d+)\\s*",un="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ln="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",cn=/^#([0-9a-f]{3,8})$/,fn=new RegExp(`^rgb\\(${an},${an},${an}\\)$`),sn=new RegExp(`^rgb\\(${ln},${ln},${ln}\\)$`),hn=new RegExp(`^rgba\\(${an},${an},${an},${un}\\)$`),yn=new RegExp(`^rgba\\(${ln},${ln},${ln},${un}\\)$`),pn=new RegExp(`^hsl\\(${un},${ln},${ln}\\)$`),vn=new RegExp(`^hsla\\(${un},${ln},${ln},${un}\\)$`),dn={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 bn(){return this.rgb().formatHex()}function mn(){return this.rgb().formatRgb()}function gn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=cn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?wn(e):3===n?new jn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?xn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?xn(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=fn.exec(t))?new jn(e[1],e[2],e[3],1):(e=sn.exec(t))?new jn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=hn.exec(t))?xn(e[1],e[2],e[3],e[4]):(e=yn.exec(t))?xn(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=pn.exec(t))?En(e[1],e[2]/100,e[3]/100,1):(e=vn.exec(t))?En(e[1],e[2]/100,e[3]/100,e[4]):dn.hasOwnProperty(t)?wn(dn[t]):"transparent"===t?new jn(NaN,NaN,NaN,0):null}function wn(t){return new jn(t>>16&255,t>>8&255,255&t,1)}function xn(t,e,n,r){return r<=0&&(t=e=n=NaN),new jn(t,e,n,r)}function Sn(t){return t instanceof nn||(t=gn(t)),t?new jn((t=t.rgb()).r,t.g,t.b,t.opacity):new jn}function On(t,e,n,r){return 1===arguments.length?Sn(t):new jn(t,e,n,null==r?1:r)}function jn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Pn(){return`#${Cn(this.r)}${Cn(this.g)}${Cn(this.b)}`}function _n(){const t=Tn(this.opacity);return`${1===t?"rgb(":"rgba("}${kn(this.r)}, ${kn(this.g)}, ${kn(this.b)}${1===t?")":`, ${t})`}`}function Tn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function kn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Cn(t){return((t=kn(t))<16?"0":"")+t.toString(16)}function En(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Mn(t,e,n,r)}function An(t){if(t instanceof Mn)return new Mn(t.h,t.s,t.l,t.opacity);if(t instanceof nn||(t=gn(t)),!t)return new Mn;if(t instanceof Mn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),a=NaN,u=i-o,l=(i+o)/2;return u?(a=e===i?(n-r)/u+6*(n<r):n===i?(r-e)/u+2:(e-n)/u+4,u/=l<.5?i+o:2-i-o,a*=60):u=l>0&&l<1?0:a,new Mn(a,u,l,t.opacity)}function Mn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function zn(t){return(t=(t||0)%360)<0?t+360:t}function Rn(t){return Math.max(0,Math.min(1,t||0))}function In(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 Fn(t,e,n,r,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*n+(1+3*t+3*i-3*a)*r+a*o)/6}function Bn(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),o=t[r],i=t[r+1],a=r>0?t[r-1]:2*o-i,u=r<e-1?t[r+2]:2*i-o;return Fn((n-r/e)*e,a,o,i,u)}}function Ln(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),o=t[(r+e-1)%e],i=t[r%e],a=t[(r+1)%e],u=t[(r+2)%e];return Fn((n-r/e)*e,o,i,a,u)}}tn(nn,gn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:bn,formatHex:bn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return An(this).formatHsl()},formatRgb:mn,toString:mn}),tn(jn,On,en(nn,{brighter(t){return t=null==t?on:Math.pow(on,t),new jn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?rn:Math.pow(rn,t),new jn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new jn(kn(this.r),kn(this.g),kn(this.b),Tn(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:Pn,formatHex:Pn,formatHex8:function(){return`#${Cn(this.r)}${Cn(this.g)}${Cn(this.b)}${Cn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:_n,toString:_n})),tn(Mn,function(t,e,n,r){return 1===arguments.length?An(t):new Mn(t,e,n,null==r?1:r)},en(nn,{brighter(t){return t=null==t?on:Math.pow(on,t),new Mn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?rn:Math.pow(rn,t),new Mn(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,o=2*n-r;return new jn(In(t>=240?t-240:t+120,o,r),In(t,o,r),In(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new Mn(zn(this.h),Rn(this.s),Rn(this.l),Tn(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=Tn(this.opacity);return`${1===t?"hsl(":"hsla("}${zn(this.h)}, ${100*Rn(this.s)}%, ${100*Rn(this.l)}%${1===t?")":`, ${t})`}`}})),Object.defineProperty(Bn,"name",{value:"default",configurable:!0}),Object.defineProperty(Ln,"name",{value:"default",configurable:!0});const Nn=t=>()=>t;function Dn(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Nn(isNaN(t)?e:t)}(Object.getOwnPropertyDescriptor(Nn,"name")||{}).writable||Object.defineProperty(Nn,"name",{value:"default",configurable:!0});const Gn=function t(e){var n=function(t){return 1===(t=+t)?Dn: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):Nn(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=On(t)).r,(e=On(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=Dn(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=o(e),t.b=i(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Wn(t){return function(e){var n,r,o=e.length,i=new Array(o),a=new Array(o),u=new Array(o);for(n=0;n<o;++n)r=On(e[n]),i[n]=r.r||0,a[n]=r.g||0,u[n]=r.b||0;return i=t(i),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=i(t),r.g=a(t),r.b=u(t),r+""}}}Wn(Bn),Wn(Ln),Object.defineProperty(Hn,"name",{value:"default",configurable:!0});var Un=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$n=new RegExp(Un.source,"g");function Hn(t,e){var n,r,o,i=Un.lastIndex=$n.lastIndex=0,a=-1,u=[],l=[];for(t+="",e+="";(n=Un.exec(t))&&(r=$n.exec(e));)(o=r.index)>i&&(o=e.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,l.push({i:a,x:We(n,r)})),i=$n.lastIndex;return i<e.length&&(o=e.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)u[(n=l[r]).i]=n.x(t);return u.join("")})}function Xn(t,e){var n;return("number"==typeof e?We:e instanceof gn?Gn:(n=gn(e))?(e=n,Gn):Hn)(t,e)}function Vn(t){return function(){this.removeAttribute(t)}}function qn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yn(t,e,n){var r,o,i=n+"";return function(){var a=this.getAttribute(t);return a===i?null:a===r?o:o=e(r=a,n)}}function Zn(t,e,n){var r,o,i=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===r?o:o=e(r=a,n)}}function Jn(t,e,n){var r,o,i;return function(){var a,u,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(u=l+"")?null:a===r&&u===o?i:(o=u,i=e(r=a,l));this.removeAttribute(t)}}function Qn(t,e,n){var r,o,i;return function(){var a,u,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(u=l+"")?null:a===r&&u===o?i:(o=u,i=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function Kn(t,e){var n=D(t),r="transform"===n?Ye:Xn;return this.attrTween(t,"function"==typeof e?(n.local?Qn:Jn)(n,r,Ke(this,"attr."+t,e)):null==e?(n.local?qn:Vn)(n):(n.local?Zn:Yn)(n,r,e))}function tr(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,o)),n}return o._value=e,o}function er(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,o)),n}return o._value=e,o}function nr(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=D(t);return this.tween(n,(r.local?tr:er)(r,e))}function rr(t,e){return function(){Be(this,t).delay=+e.apply(this,arguments)}}function or(t,e){return e=+e,function(){Be(this,t).delay=e}}function ir(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?rr:or)(e,t)):Ne(this.node(),e).delay}function ar(t,e){return function(){Le(this,t).duration=+e.apply(this,arguments)}}function ur(t,e){return e=+e,function(){Le(this,t).duration=e}}function lr(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?ar:ur)(e,t)):Ne(this.node(),e).duration}function cr(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Le(this,t).ease=e}}(e,t)):Ne(this.node(),e).ease}function fr(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;Le(this,t).ease=n}}(this._id,t))}function sr(t){"function"!=typeof t&&(t=l(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a=e[o],u=a.length,c=r[o]=[],f=0;f<u;++f)(i=a[f])&&t.call(i,i.__data__,f,a)&&c.push(i);return new Tr(r,this._parents,this._name,this._id)}function hr(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var l,c=e[u],f=n[u],s=c.length,h=a[u]=new Array(s),y=0;y<s;++y)(l=c[y]||f[y])&&(h[y]=l);for(;u<r;++u)a[u]=e[u];return new Tr(a,this._parents,this._name,this._id)}function yr(t,e){var n=this._id;return arguments.length<2?Ne(this.node(),n).on.on(t):this.each(function(t,e,n){var r,o,i=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)?Be:Le;return function(){var a=i(this,t),u=a.on;u!==r&&(o=(r=u).copy()).on(e,n),a.on=o}}(n,t,e))}function pr(){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))}function vr(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=r(t));for(var o=this._groups,i=o.length,a=new Array(i),u=0;u<i;++u)for(var l,c,f=o[u],s=f.length,h=a[u]=new Array(s),y=0;y<s;++y)(l=f[y])&&(c=t.call(l,l.__data__,y,f))&&("__data__"in l&&(c.__data__=l.__data__),h[y]=c,Fe(h[y],e,n,y,h,Ne(l,n)));return new Tr(a,this._parents,e,n)}function dr(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=a(t));for(var r=this._groups,o=r.length,i=[],u=[],l=0;l<o;++l)for(var c,f=r[l],s=f.length,h=0;h<s;++h)if(c=f[h]){for(var y,p=t.call(c,c.__data__,h,f),v=Ne(c,n),d=0,b=p.length;d<b;++d)(y=p[d])&&Fe(y,e,n,d,p,v);i.push(p),u.push(c)}return new Tr(i,u,e,n)}Object.defineProperty(Xn,"name",{value:"default",configurable:!0}),Object.defineProperty(Kn,"name",{value:"default",configurable:!0}),Object.defineProperty(nr,"name",{value:"default",configurable:!0}),Object.defineProperty(ir,"name",{value:"default",configurable:!0}),Object.defineProperty(lr,"name",{value:"default",configurable:!0}),Object.defineProperty(cr,"name",{value:"default",configurable:!0}),Object.defineProperty(fr,"name",{value:"default",configurable:!0}),Object.defineProperty(sr,"name",{value:"default",configurable:!0}),Object.defineProperty(hr,"name",{value:"default",configurable:!0}),Object.defineProperty(yr,"name",{value:"default",configurable:!0}),Object.defineProperty(pr,"name",{value:"default",configurable:!0}),Object.defineProperty(vr,"name",{value:"default",configurable:!0}),Object.defineProperty(dr,"name",{value:"default",configurable:!0}),Object.defineProperty(mr,"name",{value:"default",configurable:!0});var br=qt.prototype.constructor;function mr(){return new br(this._groups,this._parents)}function gr(t){return function(){this.style.removeProperty(t)}}function wr(t,e,n){var r="transform"==(t+="")?qe:Xn;return null==e?this.styleTween(t,function(t,e){var n,r,o;return function(){var i=K(this,t),a=(this.style.removeProperty(t),K(this,t));return i===a?null:i===n&&a===r?o:o=e(n=i,r=a)}}(t,r)).on("end.style."+t,gr(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,o,i;return function(){var a=K(this,t),u=n(this),l=u+"";return null==u&&(this.style.removeProperty(t),l=u=K(this,t)),a===l?null:a===r&&l===o?i:(o=l,i=e(r=a,u))}}(t,r,Ke(this,"style."+t,e))).each(function(t,e){var n,r,o,i,a="style."+e,u="end."+a;return function(){var l=Le(this,t),c=l.on,f=null==l.value[a]?i||(i=gr(e)):void 0;c===n&&o===f||(r=(n=c).copy()).on(u,o=f),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,o,i=n+"";return function(){var a=K(this,t);return a===i?null:a===r?o:o=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)}function xr(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,o;function i(){var i=e.apply(this,arguments);return i!==o&&(r=(o=i)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,i,n)),r}return i._value=e,i}(t,e,null==n?"":n))}function Sr(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Ke(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))}function Or(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))}function jr(){for(var t=this._name,e=this._id,n=kr(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],l=u.length,c=0;c<l;++c)if(a=u[c]){var f=Ne(a,e);Fe(a,t,n,c,u,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Tr(r,this._parents,t,n)}function Pr(){var t,e,n=this,r=n._id,o=n.size();return new Promise(function(i,a){var u={value:a},l={value:function(){0===--o&&i()}};n.each(function(){var n=Le(this,r),o=n.on;o!==t&&((e=(t=o).copy())._.cancel.push(u),e._.interrupt.push(u),e._.end.push(l)),n.on=e}),0===o&&i()})}Object.defineProperty(wr,"name",{value:"default",configurable:!0}),Object.defineProperty(xr,"name",{value:"default",configurable:!0}),Object.defineProperty(Sr,"name",{value:"default",configurable:!0}),Object.defineProperty(Or,"name",{value:"default",configurable:!0}),Object.defineProperty(jr,"name",{value:"default",configurable:!0}),Object.defineProperty(Pr,"name",{value:"default",configurable:!0});var _r=0;function Tr(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function kr(){return++_r}var Cr=qt.prototype;Tr.prototype=function(t){return qt().transition(t)}.prototype={constructor:Tr,select:vr,selectAll:dr,selectChild:Cr.selectChild,selectChildren:Cr.selectChildren,filter:sr,merge:hr,selection:mr,transition:jr,call:Cr.call,nodes:Cr.nodes,node:Cr.node,size:Cr.size,empty:Cr.empty,each:Cr.each,on:yr,attr:Kn,attrTween:nr,style:wr,styleTween:xr,text:Sr,textTween:Or,remove:pr,tween:Qe,delay:ir,duration:lr,ease:cr,easeVarying:fr,end:Pr,[Symbol.iterator]:Cr[Symbol.iterator]},Object.defineProperty(Mr,"name",{value:"default",configurable:!0});var Er={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Ar(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Mr(t){var e,n;t instanceof Tr?(e=t._id,t=t._name):(e=kr(),(n=Er).time=ge(),t=null==t?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],l=u.length,c=0;c<l;++c)(a=u[c])&&Fe(a,t,e,c,u,n||Ar(a,e));return new Tr(r,this._parents,t,e)}qt.prototype.interrupt=Ge,qt.prototype.transition=Mr;const zr=t=>()=>t;function Rr(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){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:o}})}function Ir(t,e,n){this.k=t,this.x=e,this.y=n}(Object.getOwnPropertyDescriptor(zr,"name")||{}).writable||Object.defineProperty(zr,"name",{value:"default",configurable:!0}),Ir.prototype={constructor:Ir,scale:function(t){return 1===t?this:new Ir(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Ir(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 Fr=new Ir(1,0,0);function Br(t){t.stopImmediatePropagation()}function Lr(t){t.preventDefault(),t.stopImmediatePropagation()}function Nr(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Dr(){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 Gr(){return this.__zoom||Fr}function Wr(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ur(){return navigator.maxTouchPoints||"ontouchstart"in this}function $r(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function Hr(){var t,e,n,r=Nr,o=Dr,i=$r,a=Wr,u=Ur,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],f=250,s=ae,h=ee("start","zoom","end"),y=0,p=10;function v(t){t.property("__zoom",Gr).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",j).filter(u).on("touchstart.zoom",P).on("touchmove.zoom",_).on("touchend.zoom touchcancel.zoom",T).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new Ir(e,t.x,t.y)}function b(t,e,n){var r=e[0]-n[0]*t.k,o=e[1]-n[1]*t.k;return r===t.x&&o===t.y?t:new Ir(t.k,r,o)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function g(t,e,n,r){t.on("start.zoom",function(){w(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(r).end()}).tween("zoom",function(){var t=this,i=arguments,a=w(t,i).event(r),u=o.apply(t,i),l=null==n?m(u):"function"==typeof n?n.apply(t,i):n,c=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),f=t.__zoom,h="function"==typeof e?e.apply(t,i):e,y=s(f.invert(l).concat(c/f.k),h.invert(l).concat(c/h.k));return function(t){if(1===t)t=h;else{var e=y(t),n=c/e[2];t=new Ir(n,l[0]-e[0]*n,l[1]-e[1]*n)}a.zoom(null,t)}})}function w(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=o.apply(t,e),this.taps=0}function S(t,...e){if(r.apply(this,arguments)){var n=w(this,e).event(t),o=this.__zoom,u=Math.max(l[0],Math.min(l[1],o.k*Math.pow(2,a.apply(this,arguments)))),f=le(t);if(n.wheel)n.mouse[0][0]===f[0]&&n.mouse[0][1]===f[1]||(n.mouse[1]=o.invert(n.mouse[0]=f)),clearTimeout(n.wheel);else{if(o.k===u)return;n.mouse=[f,o.invert(f)],De(this),n.start()}Lr(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(b(d(o,u),n.mouse[0],n.mouse[1]),n.extent,c))}}function O(t,...e){if(!n&&r.apply(this,arguments)){var o=t.currentTarget,a=w(this,e,!0).event(t),u=Yt(t.view).on("mousemove.zoom",function(t){if(Lr(t),!a.moved){var e=t.clientX-f,n=t.clientY-s;a.moved=e*e+n*n>y}a.event(t).zoom("mouse",i(b(a.that.__zoom,a.mouse[0]=le(t,o),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(t){u.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=Yt(t).on("dragstart.drag",null);e&&(r.on("click.drag",re,ne),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,a.moved),Lr(t),a.event(t).end()},!0),l=le(t,o),f=t.clientX,s=t.clientY;oe(t.view),Br(t),a.mouse=[l,this.__zoom.invert(l)],De(this),a.start()}}function j(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=le(t.changedTouches?t.changedTouches[0]:t,this),u=n.invert(a),l=n.k*(t.shiftKey?.5:2),s=i(b(d(n,l),a,u),o.apply(this,e),c);Lr(t),f>0?Yt(this).transition().duration(f).call(g,s,a,t):Yt(this).call(v.transform,s,a,t)}}function P(n,...o){if(r.apply(this,arguments)){var i,a,u,l,c=n.touches,f=c.length,s=w(this,o,n.changedTouches.length===f).event(n);for(Br(n),a=0;a<f;++a)l=[l=le(u=c[a],this),this.__zoom.invert(l),u.identifier],s.touch0?s.touch1||s.touch0[2]===l[2]||(s.touch1=l,s.taps=0):(s.touch0=l,i=!0,s.taps=1+!!t);t&&(t=clearTimeout(t)),i&&(s.taps<2&&(e=l[0],t=setTimeout(function(){t=null},500)),De(this),s.start())}}function _(t,...e){if(this.__zooming){var n,r,o,a,u=w(this,e).event(t),l=t.changedTouches,f=l.length;for(Lr(t),n=0;n<f;++n)o=le(r=l[n],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var s=u.touch0[0],h=u.touch0[1],y=u.touch1[0],p=u.touch1[1],v=(v=y[0]-s[0])*v+(v=y[1]-s[1])*v,m=(m=p[0]-h[0])*m+(m=p[1]-h[1])*m;r=d(r,Math.sqrt(v/m)),o=[(s[0]+y[0])/2,(s[1]+y[1])/2],a=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(b(r,o,a),u.extent,c))}}function T(t,...r){if(this.__zooming){var o,i,a=w(this,r).event(t),u=t.changedTouches,l=u.length;for(Br(t),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),o=0;o<l;++o)i=u[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=le(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<p)){var c=Yt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return v.transform=function(t,e,n,r){var o=t.selection?t.selection():t;o.property("__zoom",Gr),t!==o?g(t,e,n,r):o.interrupt().each(function(){w(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()})},v.scaleBy=function(t,e,n,r){v.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)},n,r)},v.scaleTo=function(t,e,n,r){v.transform(t,function(){var t=o.apply(this,arguments),r=this.__zoom,a=null==n?m(t):"function"==typeof n?n.apply(this,arguments):n,u=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return i(b(d(r,l),a,u),t,c)},n,r)},v.translateBy=function(t,e,n,r){v.transform(t,function(){return i(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),o.apply(this,arguments),c)},null,r)},v.translateTo=function(t,e,n,r,a){v.transform(t,function(){var t=o.apply(this,arguments),a=this.__zoom,u=null==r?m(t):"function"==typeof r?r.apply(this,arguments):r;return i(Fr.translate(u[0],u[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)},r,a)},x.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=Yt(this.that).datum();h.call(t,this.that,new Rr(t,{sourceEvent:this.sourceEvent,target:v,type:t,transform:this.that.__zoom,dispatch:h}),e)}},v.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:zr(+t),v):a},v.filter=function(t){return arguments.length?(r="function"==typeof t?t:zr(!!t),v):r},v.touchable=function(t){return arguments.length?(u="function"==typeof t?t:zr(!!t),v):u},v.extent=function(t){return arguments.length?(o="function"==typeof t?t:zr([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),v):o},v.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],v):[l[0],l[1]]},v.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],v):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},v.constrain=function(t){return arguments.length?(i=t,v):i},v.duration=function(t){return arguments.length?(f=+t,v):f},v.interpolate=function(t){return arguments.length?(s=t,v):s},v.on=function(){var t=h.on.apply(h,arguments);return t===h?v:t},v.clickDistance=function(t){return arguments.length?(y=(t=+t)*t,v):Math.sqrt(y)},v.tapDistance=function(t){return arguments.length?(p=+t,v):p},v}function Xr(t){return Xr="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},Xr(t)}function Vr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qr(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,Yr(r.key),r)}}function Yr(t){var e=function(t){if("object"!=Xr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Xr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xr(e)?e:e+""}Ir.prototype,Object.defineProperty(Lr,"name",{value:"default",configurable:!0}),Object.defineProperty(Hr,"name",{value:"default",configurable:!0});var Zr=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=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.opts=a||{},this.canvas=e,this.canvas.style.cursor="grab",this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.offscreenCanvas=document.createElement("canvas"),this.offscreenCanvas.width=this.w,this.offscreenCanvas.height=this.h;var u=this.canvas.getContext("2d"),l=this.offscreenCanvas.getContext("2d");if(!u)throw"Impossible to create canvas 2D context";if(!l)throw"Impossible to create canvas 2D context";if(this.ctx=u,this.offscreenCtx=l,this.view={x:r,y:o,z:i},this.backgroundColor=a.backgroundColor||"white",this.onZoomStartFun=a.onZoomStartFun,this.onZoomEndFun=a.onZoomEndFun,this.onZoomFun=a.onZoomFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo(),!a.disableZoom){var c=Fr;Hr().wheelDelta(function(t){return-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004)}).on("zoom",function(t){n._isZooming=!0;var e=t.transform,r=c.k/e.k;if(1==r){var o=c.x-e.x,i=c.y-e.y;n.applyPan(o*n.view.z,-i*n.view.z)}else f(t,r);c=e,n.onZoomFun&&n.onZoomFun(t)}).on("start",function(t){var e;try{n.canvas.style.cursor="grabbing"}catch(t){}n._isZooming=!0,n.canvasSave.c=document.createElement("canvas"),n.canvasSave.c.setAttribute("width",""+n.w),n.canvasSave.c.setAttribute("height",""+n.h),null===(e=n.canvasSave.c.getContext("2d"))||void 0===e||e.drawImage(n.canvas,0,0),n.canvasSave.dx=0,n.canvasSave.dy=0,n.canvasSave.f=1,n.onZoomStartFun&&n.onZoomStartFun(t)}).on("end",function(t){try{n.canvas.style.cursor="grab"}catch(t){}n._isZooming=!1,n.redraw(),n.canvasSave={c:null,dx:0,dy:0,f:1},n.onZoomEndFun&&n.onZoomEndFun(t)})(Yt(this.canvas));var f=function(t,e){n.cancelCurrentRequests();var r=t.sourceEvent;if(r instanceof WheelEvent)n.applyZoom(e,n.pixToGeoX(r.offsetX),n.pixToGeoY(r.offsetY));else if(r instanceof TouchEvent){var o,i=0,a=0,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 Vr(t,e);var n={}.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)?Vr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(r.targetTouches);try{for(u.s();!(o=u.n()).done;){var l=o.value;i+=l.clientX,a+=l.clientY}}catch(t){u.e(t)}finally{u.f()}i/=r.targetTouches.length,a/=r.targetTouches.length,n.applyZoom(e,n.pixToGeoX(i),n.pixToGeoY(a))}}}this.xMin=a.centerExtent?a.centerExtent[0]:void 0,this.yMin=a.centerExtent?a.centerExtent[1]:void 0,this.xMax=a.centerExtent?a.centerExtent[2]:void 0,this.yMax=a.centerExtent?a.centerExtent[3]:void 0,this.zoomExtent=a.zoomExtent||[0,1/0],this.canvasSave={c:null,dx:0,dy:0,f:1}}return e=t,n=[{key:"applyPan",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;if(null!=this.xMin&&this.view.x+t<this.xMin&&(t=this.xMin-this.view.x),null!=this.yMin&&this.view.y+e<this.yMin&&(e=this.yMin-this.view.y),null!=this.xMax&&this.view.x+t>this.xMax&&(t=this.xMax-this.view.x),null!=this.yMax&&this.view.y+e>this.yMax&&(e=this.yMax-this.view.y),this.view.x+=t,this.view.y+=e,this.updateExtentGeo(),this.canvasSave.c){var n=1/this.view.z;this.canvasSave.dx-=t*n,this.canvasSave.dy+=e*n,this.clear(this.backgroundColor),this.offscreenCtx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy),this.ctx.drawImage(this.offscreenCtx.canvas,0,0)}else console.log("no canvas save")}},{key:"applyZoom",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.view.x,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.view.y;if(!(this.zoomExtent[0]==this.view.z&&t<=1||this.zoomExtent[1]==this.view.z&&t>=1)){var r=t*this.view.z;r<this.zoomExtent[0]&&(t=this.zoomExtent[0]/this.view.z),r>this.zoomExtent[1]&&(t=this.zoomExtent[1]/this.view.z),this.view.z*=t;var o=(e-this.view.x)*(1-t),i=(n-this.view.y)*(1-t);null!=this.xMin&&this.view.x+o<this.xMin&&(o=this.xMin-this.view.x),null!=this.yMin&&this.view.y+i<this.yMin&&(i=this.yMin-this.view.y),null!=this.xMax&&this.view.x+o>this.xMax&&(o=this.xMax-this.view.x),null!=this.yMax&&this.view.y+i>this.yMax&&(i=this.yMax-this.view.y),this.view.x+=o,this.view.y+=i,this.updateExtentGeo(),this._drawZoomFrame(t,e,n)}}},{key:"_drawZoomFrame",value:function(t,e,n){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.offscreenCtx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy,this.canvasSave.f*this.canvasSave.c.width,this.canvasSave.f*this.canvasSave.c.height),this.ctx.drawImage(this.offscreenCanvas,0,0,this.canvas.width,this.canvas.height))}},{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.offscreenCtx.clearRect(0,0,this.w,this.h)):(this.ctx&&(this.ctx.fillStyle=t),this.offscreenCtx&&(this.offscreenCtx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h),this.offscreenCtx.fillRect(0,0,this.w,this.h))}},{key:"getView",value:function(){return this.view}},{key:"setCenterExtent",value:function(t){this.xMin=t[0],this.yMin=t[1],this.xMax=t[2],this.yMax=t[3]}},{key:"getCenterExtent",value:function(){return[this.xMin,this.yMin,this.xMax,this.yMax]}},{key:"setZoomExtent",value:function(t){this.zoomExtent=t}},{key:"getZoomExtent",value:function(){return this.zoomExtent}},{key:"initCanvasTransform",value:function(){this.ctx.setTransform(1,0,0,1,0,0),this.offscreenCtx.setTransform(1,0,0,1,0,0)}},{key:"setCanvasTransform",value:function(){var t=1/this.view.z,e=-this.view.x/this.view.z+.5*this.w,n=this.view.y/this.view.z+.5*this.h;this.ctx.setTransform(t,0,0,-t,e,n),this.offscreenCtx.setTransform(t,0,0,-t,e,n)}},{key:"getWebGLTransform",value:function(){var t=2/(this.w*this.view.z),e=2/(this.h*this.view.z);return[t,0,0,0,e,0,-t*this.view.x,-e*this.view.y,1]}},{key:"redraw",value:function(){throw new Error("Method redraw not implemented.")}},{key:"cancelCurrentRequests",value:function(){throw new Error("Method cancelCurrentRequests not implemented.")}},{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.view.x)/this.view.z+.5*this.w}},{key:"geoToPixY",value:function(t){return-(t-this.view.y)/this.view.z+.5*this.h}},{key:"pixToGeoX",value:function(t){return(t-.5*this.w)*this.view.z+this.view.x}},{key:"pixToGeoY",value:function(t){return-(t-.5*this.h)*this.view.z+this.view.y}},{key:"setViewFromURL",value:function(){var e=t.getParameterByName("x"),n=t.getParameterByName("y"),r=t.getParameterByName("z");null==e||null==e||isNaN(+e)||(this.view.x=+e),null==n||null==n||isNaN(+n)||(this.view.y=+n),null==r||null==r||isNaN(+r)||(this.view.z=+r)}}],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&&qr(e.prototype,n),r&&qr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function Jr(t){return Jr="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},Jr(t)}function Qr(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,Kr(r.key),r)}}function Kr(t){var e=function(t){if("object"!=Jr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Jr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Jr(e)?e:e+""}var to=function(){return t=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.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"]||"0px",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.tooltipElement=e.tooltipElement||null,this.tooltip=e.tooltipElement?Yt(e.tooltipElement):Yt(this.parentElement).append("div").attr("id","gridviz-tooltip").attr("class","gridviz-tooltip"),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.style("text-wrap","nowrap"),this.tooltip.style("z-index",99999999),this.tooltip.style("left","0"),this.tooltip.style("top","0"),this.tooltip.attr("role","tooltip").attr("aria-live","polite")},e=[{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){var e=this.parentElement.getBoundingClientRect(),n=t.clientX-e.left+this.xOffset,r=t.clientY-e.top-this.yOffset;this.tooltip.style("left",n+"px").style("top",r+"px"),this.ensureTooltipInsideContainer(t,e,this.tooltip.node())}},{key:"ensureTooltipInsideContainer",value:function(t,e,n){var r=n,o=e.width,i=e.height;if(r.offsetLeft+r.clientWidth>o){var a=t.clientX-r.clientWidth-this.xOffset;r.style.left=a+"px"}r.offsetTop+r.clientHeight>i&&(r.style.top=i-r.clientHeight+"px"),r.offsetTop<0&&(r.style.top="0px"),r.offsetLeft<0&&(r.style.left="0px")}},{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)}}],e&&Qr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function eo(t){return eo="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},eo(t)}function no(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,ro(r.key),r)}}function ro(t){var e=function(t){if("object"!=eo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=eo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==eo(e)?e:e+""}var oo=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=e.map,this.parentNode=e.parentNode||e.map.container,e.id&&(this.div=Yt("#"+e.id)),this.div&&!this.div.empty()||(this.div=Yt(document.createElement("div")),e.id&&this.div.attr("id",e.id)),e.title&&this.div.attr("title",e.title),e.class&&this.div.attr("class",e.class),e.onClickFunction&&this.div.on("click",e.onClickFunction),this.style("box-shadow","0 7px 8px rgba(0,47,103,.08), 0 0 22px rgba(0,47,103,.04), 0 12px 17px rgba(0,47,103,.04), 0 -4px 4px rgba(0,47,103,.04)"),this.style("background-color","#ffffff"),this.style("position","absolute"),this.style("cursor","pointer"),this.style("display","flex"),this.style("justify-content","center"),this.style("align-items","center"),this.style("width","35px"),this.style("height","30px"),this.parentNode.appendChild(this.div.node())},(e=[{key:"style",value:function(t,e){return this.div.style(t,e),this}}])&&no(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function io(t){return io="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},io(t)}function ao(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,uo(r.key),r)}}function uo(t){var e=function(t){if("object"!=io(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=io(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==io(e)?e:e+""}function lo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(lo=function(){return!!t})()}function co(t){return co=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},co(t)}function fo(t,e){return fo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fo(t,e)}var so=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=co(e),function(t,e){if(e&&("object"==io(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)}(t,lo()?Reflect.construct(e,n||[],co(t).constructor):e.apply(t,n))}(this,e,[t])).onZoom=t.onZoom,n.delta=t.delta||.2,n.zoomInBtn=document.createElement("a"),n.zoomInBtn.id="zoom-in",n.zoomInBtn.className="gridviz-zoom-button",n.zoomInBtn.title="Zoom in",n.zoomInBtn.textContent="+",n.zoomInBtn.addEventListener("click",function(t){n.zoomIn(t)}),n.zoomInBtn.addEventListener("mouseover",function(){n.zoomInBtn.style.backgroundColor="lightgrey"}),n.zoomInBtn.addEventListener("mouseout",function(){n.zoomInBtn.style.backgroundColor="#ffffff"}),n.zoomOutBtn=document.createElement("a"),n.zoomOutBtn.id="zoom-out",n.zoomOutBtn.className="gridviz-zoom-button",n.zoomOutBtn.title="Zoom out",n.zoomOutBtn.textContent="-",n.zoomOutBtn.addEventListener("click",function(t){n.zoomOut(t)}),n.zoomOutBtn.addEventListener("mouseover",function(){n.zoomOutBtn.style.backgroundColor="lightgrey"}),n.zoomOutBtn.addEventListener("mouseout",function(){n.zoomOutBtn.style.backgroundColor="#ffffff"}),[n.zoomInBtn,n.zoomOutBtn].forEach(function(t,e){t.style.alignItems="center",t.style.justifyContent="center",t.style.display="flex",t.style.border="none",t.style.color="black",t.style.textAlign="center",t.style.textDecoration="none",t.style.padding="4px",t.style.fontSize="24px",t.style.fontWeight="bold",t.style.userSelect="none",t.style.backgroundColor="#ffffff",0===e&&(t.style.borderBottom="1px solid grey")}),n.style("height","unset"),n.style("display","unset"),t.x?n.style("left",t.x+"px"):n.style("right","10px"),t.y?n.style("top",t.y+"px"):n.style("top","10px"),n.div.node().appendChild(n.zoomInBtn),n.div.node().appendChild(n.zoomOutBtn),n}return 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&&fo(t,e)}(e,t),n=e,r=[{key:"zoomIn",value:function(t){this.map.setZoom(this.map.getZoom()*(1-this.delta)).redraw(),this.onZoom&&this.onZoom(t),this.map.geoCanvas.onZoomFun&&this.map.geoCanvas.onZoomFun(t)}},{key:"zoomOut",value:function(t){this.map.setZoom(this.map.getZoom()*(1+this.delta)).redraw(),this.onZoom&&this.onZoom(t),this.map.geoCanvas.onZoomFun&&this.map.geoCanvas.onZoomFun(t)}}],r&&ao(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oo);function ho(t){return ho="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},ho(t)}function yo(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,mo(r.key),r)}}function po(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(po=function(){return!!t})()}function vo(t){return vo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vo(t)}function bo(t,e){return bo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bo(t,e)}function mo(t){var e=function(t){if("object"!=ho(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ho(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ho(e)?e:e+""}var go=function(t){function e(t){var n,r,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=vo(e),function(t,e){if(e&&("object"==ho(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)}(t,po()?Reflect.construct(e,n||[],vo(t).constructor):e.apply(t,n))}(this,e,[t]),r=n,i=!1,(o=mo(o="isFullscreen"))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,n.div.node().innerHTML='\n <svg\n style="height: 1.2rem; width: 1.2rem; fill:black; margin:0;"\n focusable="false"\n aria-hidden="true"\n >\n <svg fill="#000000" viewBox="0 0 96 96" xmlns="http://www.w3.org/2000/svg">\n <title/>\n <g>\n <path d="M30,0H6A5.9966,5.9966,0,0,0,0,6V30a6,6,0,0,0,12,0V12H30A6,6,0,0,0,30,0Z"/>\n <path d="M90,0H66a6,6,0,0,0,0,12H84V30a6,6,0,0,0,12,0V6A5.9966,5.9966,0,0,0,90,0Z"/>\n <path d="M30,84H12V66A6,6,0,0,0,0,66V90a5.9966,5.9966,0,0,0,6,6H30a6,6,0,0,0,0-12Z"/>\n <path d="M90,60a5.9966,5.9966,0,0,0-6,6V84H66a6,6,0,0,0,0,12H90a5.9966,5.9966,0,0,0,6-6V66A5.9966,5.9966,0,0,0,90,60Z"/>\n </g>\n </svg>\n </svg>\n ',n.defaultHeight=n.map.h,n.defaultWidth=n.map.w,n.div.on("click",function(t){n.onClickFunction(t)}),n.div.on("mouseover",function(t){n.style("background-color","lightgrey")}),n.div.on("mouseout",function(t){n.style("background-color","#ffffff")}),t.x?n.style("left",t.x+"px"):n.style("right","10px"),t.y?n.style("top",t.y+"px"):n.style("top","90px"),n}return 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&&bo(t,e)}(e,t),n=e,(r=[{key:"onClickFunction",value:function(t){this.isFullscreen?(this.closeFullscreen(this.map.container),this.map.h=this.defaultHeight,this.map.w=this.defaultWidth,this.map.geoCanvas.h=this.defaultHeight,this.map.geoCanvas.w=this.defaultWidth,this.map.geoCanvas.canvas.setAttribute("width",""+this.defaultWidth),this.map.geoCanvas.canvas.setAttribute("height",""+this.defaultHeight),this.map.redraw(),this.isFullscreen=!1):(this.openFullscreen(this.map.container),this.map.h=window.screen.height,this.map.w=window.screen.width,this.isFullscreen=!0)}},{key:"openFullscreen",value:function(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()}},{key:"closeFullscreen",value:function(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()}}])&&yo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oo);function wo(t){return wo="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},wo(t)}function xo(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 So(t,e);var n={}.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)?So(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function So(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Oo(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,jo(r.key),r)}}function jo(t){var e=function(t){if("object"!=wo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=wo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==wo(e)?e:e+""}var Po=function(){return t=function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n=n||{},this.layers=n.layers||[],this.container=e||document.getElementById("gridviz"),this.container?(this.container.style.position="relative",this.w=n.w||this.container.offsetWidth,this.h=n.h||this.container.offsetHeight,this._canvas=n.canvas||this.initialiseCanvas(),this.geoCanvas=new Zr(this._canvas,n.x,n.y,n.z,n),this.geoCanvas.redraw=function(){r.redraw()},this.geoCanvas.cancelCurrentRequests=function(){var t,e=xo(r.layers);try{for(e.s();!(t=e.n()).done;){var n,o,i,a=t.value;if(null!==(n=a.dataset)&&void 0!==n&&n.datasets){var u,l,c=xo(null===(u=a.dataset)||void 0===u?void 0:u.datasets);try{for(c.s();!(l=c.n()).done;){var f=l.value;null!=f&&f.cancelCurrentRequests&&f.cancelCurrentRequests()}}catch(t){c.e(t)}finally{c.f()}}null!==(o=a.dataset)&&void 0!==o&&o.cancelCurrentRequests&&(null===(i=a.dataset)||void 0===i||i.cancelCurrentRequests())}}catch(t){e.e(t)}finally{e.f()}},this.legend=n.legendContainer?Yt(n.legendContainer):null,this._legendProvidedByUser=!!n.legendContainer,this.legend||this.initialiseLegend(),n.tooltip||(n.tooltip={}),n.tooltip.parentElement||(n.tooltip.parentElement=this.container),this.tooltip=new to(n.tooltip),this.digForTooltip=n.digForTooltip||!1,this.mouseOverHandler=function(t){return r.focusCell(t)},this.mouseMoveHandler=function(t){return r.focusCell(t)},this.mouseOutHandler=function(t){return r.tooltip.hide()},this.geoCanvas.canvas.addEventListener("mouseover",this.mouseOverHandler),this.geoCanvas.canvas.addEventListener("mousemove",this.mouseMoveHandler),this.geoCanvas.canvas.addEventListener("mouseout",this.mouseOutHandler),this.defineResizeObserver(),this.geoCanvas.onZoomStartFun=function(t){n.onZoomStartFun&&n.onZoomStartFun(t),r.tooltip.hide()},this.canvasSave=null,this.selectionRectangleColor=n.selectionRectangleColor||"#FF6347",this.selectionRectangleWidthPix=n.selectionRectangleWidthPix||function(){return 4},this.transparentBackground=n.transparentBackground,this.defaultGlobalCompositeOperation=n.defaultGlobalCompositeOperation||this.geoCanvas.ctx.globalCompositeOperation):console.error("Cannot find gridviz container element.")},e=[{key:"initialiseCanvas",value:function(){var t=document.createElement("canvas");return t.setAttribute("width",""+this.w),t.setAttribute("height",""+this.h),this.container.appendChild(t),t}},{key:"initialiseLegend",value:function(){this.legend=Yt(this.container).append("div").attr("id","gridviz-legend").style("position","absolute").style("width","auto").style("height","auto").style("background","#FFFFFF").style("border","0px").style("box-shadow","3px 3px 3px grey, -3px -3px 3px #ddd").style("font-family","Helvetica, Arial, sans-serif").style("bottom","15px").style("right","15px")}},{key:"layers_",value:function(t){return 0===arguments.length?this.layers:(1===arguments.length?Array.isArray(t)?this.layers=t:this.layers=[t]:this.layers=arguments,this)}},{key:"redraw",value:function(){this.legend&&this.legend.selectAll("*").remove(),this.geoCanvas.initCanvasTransform(),this.geoCanvas.clear(this.geoCanvas.backgroundColor);var t=this.geoCanvas.view.z;this.updateExtentGeo();var e,n=this.geoCanvas.offscreenCtx,r=xo(this.layers);try{for(r.s();!(e=r.n()).done;){var o=e.value;o.visible&&!o.visible(t)||((o.alpha||o.blendOperation)&&(n.save(),o.alpha&&(n.globalAlpha=o.alpha(t)),o.blendOperation&&(n.globalCompositeOperation=o.blendOperation(t))),this.geoCanvas.setCanvasTransform(),o.draw(this.geoCanvas,this.legend),o.filterColor&&o.drawFilter(this.geoCanvas),(o.alpha||o.blendOperation)&&n.restore())}}catch(t){r.e(t)}finally{r.f()}return this.geoCanvas.initCanvasTransform(),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0),this.canvasSave=null,this}},{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.geoCanvas.updateExtentGeo(t)}},{key:"focusCell",value:function(t){if(!this.geoCanvas._isZooming){var e={x:this.geoCanvas.pixToGeoX(t.offsetX+this.tooltip.xMouseOffset),y:this.geoCanvas.pixToGeoY(t.offsetY+this.tooltip.yMouseOffset)},n=this.getCellFocusInfo(e);if(this.transparentBackground)if(this.geoCanvas.initCanvasTransform(),this.geoCanvas.ctx.clearRect(0,0,this.w,this.h),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0),n){this.tooltip.html(n.html),this.tooltip.setPosition(t),this.tooltip.show();var r=this.selectionRectangleWidthPix?this.selectionRectangleWidthPix(n.resolution,this.geoCanvas.view.z):4,o=this.geoCanvas.ctx;o.save(),o.strokeStyle=this.selectionRectangleColor,o.lineWidth=r,o.beginPath();var i=this.geoCanvas.geoToPixX(n.cell.x),a=this.geoCanvas.geoToPixY(n.cell.y),u=n.resolution/this.geoCanvas.view.z,l=-u;o.rect(i-r/2,a+r/2,u+r,l-r),o.stroke(),o.restore()}else this.tooltip.hide();else if(n){var c;this.geoCanvas.canvas.style.cursor="pointer",this.tooltip.html(n.html),this.tooltip.setPosition(t),this.tooltip.show(),this.canvasSave?this.geoCanvas.offscreenCtx.drawImage(this.canvasSave,0,0):(this.canvasSave=document.createElement("canvas"),this.canvasSave.setAttribute("width",""+this.w),this.canvasSave.setAttribute("height",""+this.h),null===(c=this.canvasSave.getContext("2d"))||void 0===c||c.drawImage(this.geoCanvas.offscreenCanvas,0,0));var f=this.selectionRectangleWidthPix?this.selectionRectangleWidthPix(n.resolution,this.geoCanvas.view.z):4;this.geoCanvas.initCanvasTransform();var s=this.geoCanvas.offscreenCtx;s.strokeStyle=this.selectionRectangleColor,s.lineWidth=f,s.beginPath(),s.rect(this.geoCanvas.geoToPixX(n.cell.x)-f/2,this.geoCanvas.geoToPixY(n.cell.y)+f/2,n.resolution/this.geoCanvas.view.z+f,-n.resolution/this.geoCanvas.view.z-f),s.stroke(),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0)}else this.geoCanvas.canvas.style.cursor="default",this.tooltip.hide(),this.canvasSave&&this.geoCanvas.ctx.drawImage(this.canvasSave,0,0)}}},{key:"getCellFocusInfo",value:function(t){for(var e=this.geoCanvas.view.z,n=this.layers.length-1;n>=0;n--){var r=this.layers[n];if((!r.visible||r.visible(e))&&"none"!==r.cellInfoHTML&&r.cellInfoHTML&&r.getDataset){var o=r.getDataset(e);if(o){var i=o.getCellFromPosition(t,o.getViewCache());if(!i){if(this.digForTooltip)continue;return}if(o.mixedResolution){var a=+o.mixedResolution(i),u=r.cellInfoHTML(i,a);if(!u)return;return{cell:i,html:u,resolution:a}}var l=r.cellInfoHTML(i,o.getResolution());if(!l)return;return{cell:i,html:l,resolution:o.getResolution()}}}}}},{key:"setView",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.geoCanvas.view.x=t,this.geoCanvas.view.y=e,null!=n&&(this.geoCanvas.view.z=n),this}},{key:"getView",value:function(){return this.geoCanvas.view}},{key:"getZoom",value:function(){return this.geoCanvas.view.z}},{key:"setZoom",value:function(t){return this.geoCanvas.view.z=t,this}},{key:"getCenterExtent",value:function(){return this.geoCanvas.getCenterExtent()}},{key:"setCenterExtent",value:function(t){return this.geoCanvas.setCenterExtent(t),this}},{key:"getZoomExtent",value:function(){return this.geoCanvas.getZoomExtent()}},{key:"setZoomExtent",value:function(t){return this.geoCanvas.setZoomExtent(t),this}},{key:"getBackgroundColor",value:function(){return this.geoCanvas.backgroundColor}},{key:"setBackgroundColor",value:function(t){return this.geoCanvas.backgroundColor=t,this}},{key:"addZoomButtons",value:function(t){return this.zoomButtons=new so({map:this,id:(null==t?void 0:t.id)||"gridviz-zoom-buttons-"+this.container.id,class:null==t?void 0:t.class,x:null==t?void 0:t.x,y:null==t?void 0:t.y,onZoom:null==t?void 0:t.onZoom,delta:(null==t?void 0:t.delta)||.2}),this}},{key:"addFullscreenButton",value:function(t){return this.fullscreenButton=new go({map:this,id:(null==t?void 0:t.id)||"gridviz-fullscreen-button",class:null==t?void 0:t.class,x:null==t?void 0:t.x,y:null==t?void 0:t.y}),this}},{key:"setViewFromURL",value:function(){return this.geoCanvas.setViewFromURL(),this}},{key:"defineResizeObserver",value:function(){var t=this,e=!1;new ResizeObserver(function(n){if(Array.isArray(n)&&n.length){var r=t.container;r.clientWidth>0&&r.clientHeight>0&&(e||(e=!0,window.requestAnimationFrame(function(){e=!1,t.h===r.clientHeight&&t.w===r.clientWidth||(t.h=r.clientHeight,t.w=r.clientWidth,t.geoCanvas.h=t.h,t.geoCanvas.w=t.w,t.geoCanvas.canvas.setAttribute("width",String(t.w)),t.geoCanvas.canvas.setAttribute("height",String(t.h)),t.geoCanvas.offscreenCanvas.setAttribute("width",String(t.w)),t.geoCanvas.offscreenCanvas.setAttribute("height",String(t.h)),t.redraw())})))}}).observe(this.container)}},{key:"destroy",value:function(){var t,e;this.layers=[],this.bgLayers=[],this.container.removeEventListener("mouseover",this.mouseOverHandler),this.container.removeEventListener("mousemove",this.mouseMoveHandler),this.container.removeEventListener("mouseout",this.mouseOutHandler),this.geoCanvas.canvas.remove(),this._legendProvidedByUser||null===(e=this.legend)||void 0===e||e.remove(),null===(t=this.tooltip.tooltip)||void 0===t||t.remove()}}],e&&Oo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function _o(t){return _o="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},_o(t)}function To(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,ko(r.key),r)}}function ko(t){var e=function(t){if("object"!=_o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=_o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_o(e)?e:e+""}var Co=function(){return t=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.visible=e.visible,this.alpha=e.alpha,this.blendOperation=e.blendOperation,this.filterColor=e.filterColor,this.filterBlendOperation=e.filterBlendOperation},(e=[{key:"drawFilter",value:function(t){if(this.filterColor){var e=this.filterColor(t.view.z);if(e&&"none"!=e){t.offscreenCtx.fillStyle=e;var n=void 0,r=void 0;this.filterBlendOperation&&(n=t.offscreenCtx.globalCompositeOperation,r=this.filterBlendOperation(t.view.z)),r&&"none"!=r&&(t.offscreenCtx.globalCompositeOperation=r),t.offscreenCtx.fillRect(0,0,t.w,t.h),n&&(t.offscreenCtx.globalCompositeOperation=n)}}}}])&&To(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Eo(t){return Eo="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},Eo(t)}function Ao(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 Mo(t,e);var n={}.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)?Mo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Mo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zo(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,Ro(r.key),r)}}function Ro(t){var e=function(t){if("object"!=Eo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Eo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Eo(e)?e:e+""}function Io(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Io=function(){return!!t})()}function Fo(t){return Fo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fo(t)}function Bo(t,e){return Bo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bo(t,e)}var Lo=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Fo(e),function(t,e){if(e&&("object"==Eo(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)}(t,Io()?Reflect.construct(e,n||[],Fo(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.viewScale=t.viewScale,n.filter=t.filter||void 0,n.offset=t.offset||function(t,e,n){return{dx:0,dy:0}},n.drawFun=t.drawFun,n.legends=[],n}return 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&&Bo(t,e)}(e,t),n=e,o=[{key:"updateLegendsRecursive",value:function(t,e){if(Array.isArray(t)){var n,r=Ao(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;this.updateLegendsRecursive(o,e)}}catch(t){r.e(t)}finally{r.f()}}else t.update(e)}}],(r=[{key:"draw",value:function(t,e,n){if(!this.drawFun)throw new Error("Method draw not implemented.");this.drawFun(t,e,n)}},{key:"getOffset",value:function(){return this.offset}},{key:"setOffset",value:function(t){return this.offset=t,this}},{key:"updateLegends",value:function(t){return e.updateLegendsRecursive(this.legends,t),this}},{key:"addLegends",value:function(t){var e,n=Ao(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.legends.push(r)}}catch(t){n.e(t)}finally{n.f()}return this}}])&&zo(n.prototype,r),o&&zo(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Co);function No(t){return No="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},No(t)}function Do(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,Go(r.key),r)}}function Go(t){var e=function(t){if("object"!=No(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=No(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==No(e)?e:e+""}function Wo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Wo=function(){return!!t})()}function Uo(t){return Uo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uo(t)}function $o(t,e){return $o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},$o(t,e)}var Ho=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Uo(e),function(t,e){if(e&&("object"==No(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)}(t,Wo()?Reflect.construct(e,n||[],Uo(t).constructor):e.apply(t,n))}(this,e,arguments)}return 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&&$o(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){throw new Error("Method draw not implemented.")}}])&&Do(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Co);function Xo(t){return Xo="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},Xo(t)}function Vo(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 qo(t,e);var n={}.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)?qo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function qo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Yo(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,Zo(r.key),r)}}function Zo(t){var e=function(t){if("object"!=Xo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Xo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xo(e)?e:e+""}var Jo=function(){return t=function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=e,this.url=n,this.resolution=r,this.mixedResolution=o.mixedResolution,this.preprocess=o.preprocess||void 0,this.cellsViewCache=[]},(e=[{key:"getData",value:function(){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){if(this.mixedResolution){var n,r=Vo(e);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=+this.mixedResolution(o);if(!(t.x<o.x||o.x+i<t.x||t.y<o.y||o.y+i<t.y))return o}}catch(t){r.e(t)}finally{r.f()}}else{var a,u=this.getResolution(),l=Vo(e);try{for(l.s();!(a=l.n()).done;){var c=a.value;if(!(t.x<c.x||c.x+u<t.x||t.y<c.y||c.y+u<t.y))return c}}catch(t){l.e(t)}finally{l.f()}}}},{key:"getResolution",value:function(){return this.resolution}},{key:"getViewCache",value:function(){return this.cellsViewCache}},{key:"getDataset",value:function(t,e){return this}}])&&Yo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Qo(t){return Qo="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},Qo(t)}function Ko(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ti(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,ei(r.key),r)}}function ei(t){var e=function(t){if("object"!=Qo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Qo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qo(e)?e:e+""}var ni=function(){return t=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.resolutions=e,this.datasets="function"==typeof n?this.resolutions.map(n):n,this.datasets.length>1&&this.datasets.length!=this.resolutions.length)throw new Error("Uncompatible number of datasets and resolutions: "+this.datasets.length+" "+this.resolutions.length);r.preprocess&&this.setPrepocesses(r.preprocess)},(e=[{key:"getDataset",value:function(t,e){if(1==this.datasets.length)return this.datasets[0];for(var n=this.resolutions,r=0,o=n[r]/e;o<t&&r<n.length;)o=n[++r]/e;return r==n.length?this.datasets[n.length-1]:this.datasets[r]}},{key:"setPrepocesses",value:function(t){var e,n=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 Ko(t,e);var n={}.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)?Ko(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(this.datasets);try{for(n.s();!(e=n.n()).done;)e.value.preprocess=t}catch(t){n.e(t)}finally{n.f()}return this}}])&&ti(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ri(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function oi(t,e){return fetch(t,e).then(ri)}Object.defineProperty(oi,"name",{value:"default",configurable:!0}),Object.defineProperty(yi,"name",{value:"default",configurable:!0});var ii={},ai={},ui=34,li=10,ci=13;function fi(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function si(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 hi(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function yi(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,o=[],i=t.length,a=0,u=0,l=i<=0,c=!1;function f(){if(l)return ai;if(c)return c=!1,ii;var e,r,o=a;if(t.charCodeAt(o)===ui){for(;a++<i&&t.charCodeAt(a)!==ui||t.charCodeAt(++a)===ui;);return(e=a)>=i?l=!0:(r=t.charCodeAt(a++))===li?c=!0:r===ci&&(c=!0,t.charCodeAt(a)===li&&++a),t.slice(o+1,e-1).replace(/""/g,'"')}for(;a<i;){if((r=t.charCodeAt(e=a++))===li)c=!0;else if(r===ci)c=!0,t.charCodeAt(a)===li&&++a;else if(r!==n)continue;return t.slice(o,e)}return l=!0,t.slice(o,i)}for(t.charCodeAt(i-1)===li&&--i,t.charCodeAt(i-1)===ci&&--i;(r=f())!==ai;){for(var s=[];r!==ii&&r!==ai;)s.push(r),r=f();e&&null==(s=e(s,u++))||o.push(s)}return o}function o(e,n){return e.map(function(e){return n.map(function(t){return a(e[t])}).join(t)})}function i(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?(o=(n=t).getUTCHours(),i=n.getUTCMinutes(),a=n.getUTCSeconds(),u=n.getUTCMilliseconds(),isNaN(n)?"Invalid Date":((r=n.getUTCFullYear())<0?"-"+hi(-r,6):r>9999?"+"+hi(r,6):hi(r,4))+"-"+hi(n.getUTCMonth()+1,2)+"-"+hi(n.getUTCDate(),2)+(u?"T"+hi(o,2)+":"+hi(i,2)+":"+hi(a,2)+"."+hi(u,3)+"Z":a?"T"+hi(o,2)+":"+hi(i,2)+":"+hi(a,2)+"Z":i||o?"T"+hi(o,2)+":"+hi(i,2)+"Z":"")):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t;var n,r,o,i,a,u}return{parse:function(t,e){var n,o,i=r(t,function(t,r){if(n)return n(t,r-1);o=t,n=e?function(t,e){var n=fi(t);return function(r,o){return e(n(r),o,t)}}(t,e):fi(t)});return i.columns=o||[],i},parseRows:r,format:function(e,n){return null==n&&(n=si(e)),[n.map(a).join(t)].concat(o(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=si(t)),o(t,e).join("\n")},formatRows:function(t){return t.map(i).join("\n")},formatRow:i,formatValue:a}}var pi=yi(","),vi=pi.parse,di=(pi.parseRows,pi.format,pi.formatBody,pi.formatRows,pi.formatRow,pi.formatValue,yi("\t")),bi=di.parse;function mi(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function gi(t,e){return fetch(t,e).then(mi)}function wi(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),gi(e,n).then(function(e){return t(e,r)})}}function xi(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var o=yi(t);return gi(e,n).then(function(t){return o.parse(t,r)})}di.parseRows,di.format,di.formatBody,di.formatRows,di.formatRow,di.formatValue,Object.defineProperty(gi,"name",{value:"default",configurable:!0});var Si=wi(vi);function Oi(t){return Oi="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},Oi(t)}function ji(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 Pi(t,e);var n={}.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)?Pi(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Pi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function _i(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(Oi(t)+" is not iterable")}function Ti(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return ki(c,"_invoke",function(n,r,o){var i,u,l,c=0,f=o||[],s=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!s&&c&&!o&&e<f.length;e++){var o,i=f[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw s=!0,r}return function(o,f,p){if(c>1)throw TypeError("Generator is already running");for(s&&1===f&&y(f,p),u=f,l=p;(e=u<2?t:l)||!s;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(s=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:s}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(ki(e={},r,function(){return this}),e),s=c.prototype=u.prototype=Object.create(f);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,ki(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return l.prototype=c,ki(s,"constructor",c),ki(c,"constructor",l),l.displayName="GeneratorFunction",ki(c,o,"GeneratorFunction"),ki(s),ki(s,o,"Generator"),ki(s,r,function(){return this}),ki(s,"toString",function(){return"[object Generator]"}),(Ti=function(){return{w:i,m:h}})()}function ki(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ki=function(t,e,n,r){function i(e,n){ki(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},ki(t,e,n,r)}function Ci(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function Ei(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){Ci(i,r,o,a,u,"next",t)}function u(t){Ci(i,r,o,a,u,"throw",t)}a(void 0)})}}function Ai(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,Mi(r.key),r)}}function Mi(t){var e=function(t){if("object"!=Oi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Oi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Oi(e)?e:e+""}function zi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zi=function(){return!!t})()}function Ri(t){return Ri=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ri(t)}function Ii(t,e){return Ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ii(t,e)}wi(bi);var Fi=function(t){function e(t,n){var r,o=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,e),(r=function(t,e,n){return e=Ri(e),function(t,e){if(e&&("object"==Oi(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)}(t,zi()?Reflect.construct(e,n||[],Ri(t).constructor):e.apply(t,n))}(this,e,[t,n,0,o])).onlyDrawWhenAllTilesReady=o.onlyDrawWhenAllTilesReady||!1,r.info=void 0,r.infoLoadingStatus="notLoaded",r.cache={},r.loadInfo(),r}return 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&&Ii(t,e)}(e,t),n=e,r=[{key:"loadInfo",value:function(){var t=this;return this.info||"notLoaded"!==this.infoLoadingStatus?"loaded"!==this.infoLoadingStatus&&"failed"!==this.infoLoadingStatus||this.map.redraw():Ei(Ti().m(function e(){var n;return Ti().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,oi(t.url+"info.json");case 1:n=e.v,t.info=n,t.resolution=n.resolutionGeo,t.infoLoadingStatus="loaded",t.map.redraw(),e.n=3;break;case 2:e.p=2,e.v,t.infoLoadingStatus="failed";case 3:return e.a(2)}},e,null,[[0,2]])}))(),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()}},{key:"getData",value:(i=Ei(Ti().m(function t(e){var n,r,o,i,a,u,l,c,f,s,h,y,p,v,d,b,m=this;return Ti().w(function(t){for(;;)switch(t.n){case 0:if(this.info){t.n=1;break}return t.a(2,this);case 1:if(this.abortController=new AbortController,n=this.abortController.signal,r=this.getTilingEnvelope(e)){t.n=2;break}return t.a(2,this);case 2:o=this.info.tilingBounds,i=o.xMin,a=o.xMax,u=o.yMin,l=o.yMax,c=Math.max(r.xMin,i),f=Math.min(r.xMax,a),s=Math.max(r.yMin,u),h=Math.min(r.yMax,l),y=(f-c+1)*(h-s+1),p=0,v=[],d=Ti().m(function t(e){var r,o;return Ti().w(function(t){for(;;)switch(t.n){case 0:r=Ti().m(function t(r){return Ti().w(function(t){for(;;)switch(t.n){case 0:if(m.cache[e]||(m.cache[e]={}),!m.cache[e][r]||"failed"===m.cache[e][r]){t.n=1;break}return++p,t.a(2,1);case 1:m.cache[e][r]="loading",v.push(m.loadTile(e,r,n).then(function(t){m.cache[e][r]=t;var n=++p===y;m.checkAndRedraw(t,n)}).catch(function(){m.cache[e][r]="failed",++p}));case 2:return t.a(2)}},t)}),o=s;case 1:if(!(o<=h)){t.n=4;break}return t.d(_i(r(o)),2);case 2:if(!t.v){t.n=3;break}return t.a(3,3);case 3:o++,t.n=1;break;case 4:return t.a(2)}},t)}),b=c;case 3:if(!(b<=f)){t.n=5;break}return t.d(_i(d(b)),4);case 4:b++,t.n=3;break;case 5:return t.n=6,Promise.allSettled(v);case 6:return t.a(2,this)}},t,this)})),function(t){return i.apply(this,arguments)})},{key:"loadTile",value:(o=Ei(Ti().m(function t(e,n,r){var o,i,a,u=this;return Ti().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,Si("".concat(this.url).concat(e,"/").concat(n,".csv"),{signal:r});case 1:if(o=t.v,i=this.preprocess?o.filter(function(t){return!1!==u.preprocess(t)}):o,this.info){t.n=2;break}throw new Error("Tile info unknown");case 2:return t.a(2,Bi(i,e,n,this.info));case 3:throw t.p=3,"AbortError"===(a=t.v).name&&console.warn("Tile request for ".concat(e,", ").concat(n," was aborted.")),a;case 4:return t.a(2)}},t,this,[[0,3]])})),function(t,e,n){return o.apply(this,arguments)})},{key:"cancelCurrentRequests",value:function(){this.abortController&&this.abortController.abort()}},{key:"checkAndRedraw",value:function(t,e){var n,r=!1,o=this.map.getZoom(),i=ji(this.map.layers);try{for(i.s();!(n=i.n()).done;){var a=n.value;if((!a.visible||a.visible(o))&&a.getDataset&&a.getDataset(o)==this){r=!0;break}}}catch(t){i.e(t)}finally{i.f()}if(r){var u=this.map.updateExtentGeo(),l=t.extGeo,c=l.xMin,f=l.xMax,s=l.yMin,h=l.yMax;u.xMax<=c||u.xMin>=f||u.yMax<=s||u.yMin>=h||(this.onlyDrawWhenAllTilesReady?e&&this.map.redraw():this.map.redraw())}}},{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 o=Math.max(e.yMin,n.yMin);o<=Math.min(e.yMax,n.yMax);o++){var i=this.cache[r][o];if(i&&"string"!=typeof i){var a,u=ji(i.cells);try{for(u.s();!(a=u.n()).done;){var l=a.value;+l.x+this.resolution<t.xMin||+l.x-this.resolution>t.xMax||+l.y+this.resolution<t.yMin||+l.y-this.resolution>t.yMax||this.cellsViewCache.push(l)}}catch(t){u.e(t)}finally{u.f()}}}}}}],r&&Ai(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Jo);function Bi(t,e,n,r){var o={};o.cells=t,o.x=e,o.y=n;var i=r.resolutionGeo,a=r.tileSizeCell;o.extGeo={xMin:r.originPoint.x+i*a*o.x,xMax:r.originPoint.x+i*a*(o.x+1),yMin:r.originPoint.y+i*a*o.y,yMax:r.originPoint.y+i*a*(o.y+1)};var u,l=ji(o.cells);try{for(l.s();!(u=l.n()).done;){var c=u.value;c.x=o.extGeo.xMin+c.x*i,c.y=o.extGeo.yMin+c.y*i}}catch(t){l.e(t)}finally{l.f()}return o}function Li(t){return Li="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},Li(t)}function Ni(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return Di(c,"_invoke",function(n,r,o){var i,u,l,c=0,f=o||[],s=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!s&&c&&!o&&e<f.length;e++){var o,i=f[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw s=!0,r}return function(o,f,p){if(c>1)throw TypeError("Generator is already running");for(s&&1===f&&y(f,p),u=f,l=p;(e=u<2?t:l)||!s;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(s=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:s}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(Di(e={},r,function(){return this}),e),s=c.prototype=u.prototype=Object.create(f);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Di(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return l.prototype=c,Di(s,"constructor",c),Di(c,"constructor",l),l.displayName="GeneratorFunction",Di(c,o,"GeneratorFunction"),Di(s),Di(s,o,"Generator"),Di(s,r,function(){return this}),Di(s,"toString",function(){return"[object Generator]"}),(Ni=function(){return{w:i,m:h}})()}function Di(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Di=function(t,e,n,r){function i(e,n){Di(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Di(t,e,n,r)}function Gi(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 Wi(t,e);var n={}.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)?Wi(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Wi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ui(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function $i(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,Hi(r.key),r)}}function Hi(t){var e=function(t){if("object"!=Li(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Li(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Li(e)?e:e+""}function Xi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xi=function(){return!!t})()}function Vi(t){return Vi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vi(t)}function qi(t,e){return qi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qi(t,e)}var Yi=function(t){function e(t,n,r){var o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=function(t,e,n){return e=Vi(e),function(t,e){if(e&&("object"==Li(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)}(t,Xi()?Reflect.construct(e,n||[],Vi(t).constructor):e.apply(t,n))}(this,e,[t,n,r,i])).cells=[],o.delimiter=i.delimiter||",",o.infoLoadingStatus="notLoaded",o.getData(void 0),o}return 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&&qi(t,e)}(e,t),n=e,r=[{key:"getData",value:function(t){var e,n=this;return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",(e=Ni().m(function t(){var e,r,o,i,a,u,l,c;return Ni().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,xi(n.delimiter,n.url);case 1:e=t.v,r=Gi(e);try{for(r.s();!(o=r.n()).done;)(i=o.value).x=+i.x,i.y=+i.y}catch(t){r.e(t)}finally{r.f()}if(!n.preprocess){t.n=10;break}n.cells=[],a=Gi(e),t.p=2,a.s();case 3:if((u=a.n()).done){t.n=6;break}if(l=u.value,0!=n.preprocess(l)){t.n=4;break}return t.a(3,5);case 4:n.cells.push(l);case 5:t.n=3;break;case 6:t.n=8;break;case 7:t.p=7,c=t.v,a.e(c);case 8:return t.p=8,a.f(),t.f(8);case 9:t.n=11;break;case 10:n.cells=e;case 11:n.map&&n.map.redraw(),n.infoLoadingStatus="loaded",t.n=13;break;case 12:t.p=12,t.v,n.infoLoadingStatus="failed",n.cells=[];case 13:return t.a(2)}},t,null,[[2,7,8,9],[0,12]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){Ui(i,r,o,a,u,"next",t)}function u(t){Ui(i,r,o,a,u,"throw",t)}a(void 0)})})()),this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=Gi(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()}}}}],r&&$i(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Jo);function Zi(t){return Zi="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},Zi(t)}function Ji(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Qi(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,Ki(r.key),r)}}function Ki(t){var e=function(t){if("object"!=Zi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Zi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zi(e)?e:e+""}function ta(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ta=function(){return!!t})()}function ea(t){return ea=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ea(t)}function na(t,e){return na=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},na(t,e)}var ra=function(t){function e(t,n){var r,o=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,e),(r=function(t,e,n){return e=ea(e),function(t,e){if(e&&("object"==Zi(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)}(t,ta()?Reflect.construct(e,n||[],ea(t).constructor):e.apply(t,n))}(this,e,[void 0,"",t,o])).cells=n||[],r}return 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&&na(t,e)}(e,t),n=e,(r=[{key:"getData",value:function(t){return this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=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 Ji(t,e);var n={}.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)?Ji(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(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()}}}}])&&Qi(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Jo);function oa(t){return oa="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},oa(t)}function ia(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function aa(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,ua(r.key),r)}}function ua(t){var e=function(t){if("object"!=oa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=oa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oa(e)?e:e+""}function la(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(la=function(){return!!t})()}function ca(t){return ca=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ca(t)}function fa(t,e){return fa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fa(t,e)}var sa=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ca(e),function(t,e){if(e&&("object"==oa(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)}(t,la()?Reflect.construct(e,n||[],ca(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||"#EA6BAC",n.size=t.size||function(t,e){return e},n.shape=t.shape||"square",n}return 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&&fa(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=this.viewScale?this.viewScale(t,n,o):void 0,a=.5*n,u="function"==typeof this.color,l="function"==typeof this.size,c="function"==typeof this.shape,f=this.color||"black",s=this.size||n,h=this.shape||"square",y=u?this.color:null,p=l?this.size:null,v=c?this.shape:null,d=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 ia(t,e);var n={}.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)?ia(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(d.s();!(r=d.n()).done;){var b=r.value,m=y?y(b,n,o,i):f;if(m&&"none"!==m){var g=p?p(b,n,o,i):s;if(g){var w=v?v(b,n,o,i):h;if("none"!==w){var x=this.offset(b,n,o),S=e.offscreenCtx;if(S.fillStyle=m,"square"===w){var O=n*(1-g/n)*.5;S.fillRect(b.x+O+x.dx,b.y+O+x.dy,g,g)}else if("circle"===w)S.beginPath(),S.arc(b.x+a+x.dx,b.y+a+x.dy,.5*g,0,2*Math.PI,!1),S.fill();else if("donut"===w){var j=b.x+a+x.dx,P=b.y+a+x.dy;S.beginPath(),S.moveTo(j,P),S.arc(j,P,a,0,2*Math.PI),S.arc(j,P,(1-g/n)*a,0,2*Math.PI,!0),S.closePath(),S.fill()}else if("diamond"===w){var _=.5*g;S.beginPath(),S.moveTo(b.x+a-_,b.y+a),S.lineTo(b.x+a,b.y+a+_),S.lineTo(b.x+a+_,b.y+a),S.lineTo(b.x+a,b.y+a-_),S.fill()}else if("triangle_up"===w){var T=(g-n)/2;S.beginPath(),S.moveTo(b.x-T,b.y-T),S.lineTo(b.x+a,b.y+n+T),S.lineTo(b.x+n+T,b.y-T),S.fill()}else if("triangle_down"===w){var k=(g-n)/2;S.beginPath(),S.moveTo(b.x-k,b.y+n+k),S.lineTo(b.x+a,b.y-k),S.lineTo(b.x+n+k,b.y+n+k),S.fill()}else if("triangle_left"===w){var C=(g-n)/2;S.beginPath(),S.moveTo(b.x+n+C,b.y+n+C),S.lineTo(b.x-C,b.y+a),S.lineTo(b.x+n+C,b.y-C),S.fill()}else{if("triangle_right"!==w)throw new Error("Unexpected shape:"+w);var E=(g-n)/2;S.beginPath(),S.moveTo(b.x-E,b.y-E),S.lineTo(b.x+n+E,b.y+a),S.lineTo(b.x-E,b.y+n+E),S.fill()}}}}}}catch(t){d.e(t)}finally{d.f()}this.updateLegends({viewScale:i,resolution:n,z:o,cells:t})}}],r&&aa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function ha(t){return ha="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},ha(t)}function ya(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function pa(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,va(r.key),r)}}function va(t){var e=function(t){if("object"!=ha(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ha(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ha(e)?e:e+""}function da(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(da=function(){return!!t})()}function ba(t){return ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ba(t)}function ma(t,e){return ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ma(t,e)}var ga=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ba(e),function(t,e){if(e&&("object"==ha(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)}(t,da()?Reflect.construct(e,n||[],ba(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.strokeColor=t.strokeColor||function(){return"#666"},n.size=t.size||function(t,e){return e},n.strokeWidth=t.strokeWidth||function(t,e,n){return 1.5*n},n.shape=t.shape||function(){return"square"},n}return 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&&ma(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=.5*n,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 ya(t,e);var n={}.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)?ya(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(l.s();!(r=l.n()).done;){var c=r.value,f=this.strokeColor?this.strokeColor(c,n,o,a):void 0;if(f&&"none"!==f){i.strokeStyle=f;var s=this.size?this.size(c,n,o,a):n,h=this.strokeWidth?this.strokeWidth(c,n,o,a):1*o;if(h&&!(h<=0)){i.lineWidth=h;var y=this.shape?this.shape(c,n,o,a):"square";if("none"!==y){var p=this.offset(c,n,o);if("square"===y){var v=n*(1-s/n)*.5;i.beginPath(),i.rect(c.x+v+p.dx,c.y+v+p.dy,s,s),i.stroke()}else if("circle"===y)i.beginPath(),i.arc(c.x+u+p.dx,c.y+u+p.dy,.5*s,0,2*Math.PI,!1),i.stroke();else if("diamond"===y){var d=.5*s;i.beginPath(),i.moveTo(c.x+u-d,c.y+u),i.lineTo(c.x+u,c.y+u+d),i.lineTo(c.x+u+d,c.y+u),i.lineTo(c.x+u,c.y+u-d),i.lineTo(c.x+u-d,c.y+u),i.stroke()}else if("donut"===y)console.error("Not implemented");else if("triangle_up"===y){var b=(s-n)/2;i.beginPath(),i.moveTo(c.x-b,c.y-b),i.lineTo(c.x+u,c.y+n+b),i.lineTo(c.x+n+b,c.y-b),i.closePath(),i.stroke()}else if("triangle_down"===y){var m=(s-n)/2;i.beginPath(),i.moveTo(c.x-m,c.y+n+m),i.lineTo(c.x+u,c.y-m),i.lineTo(c.x+n+m,c.y+n+m),i.closePath(),i.stroke()}else if("triangle_left"===y){var g=(s-n)/2;i.beginPath(),i.moveTo(c.x+n+g,c.y+n+g),i.lineTo(c.x-g,c.y+u),i.lineTo(c.x+n+g,c.y-g),i.closePath(),i.stroke()}else{if("triangle_right"!==y)throw new Error("Unexpected shape:"+y);var w=(s-n)/2;i.beginPath(),i.moveTo(c.x-w,c.y-w),i.lineTo(c.x+n+w,c.y+u),i.lineTo(c.x-w,c.y+n+w),i.closePath(),i.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&pa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function wa(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let o=-1;for(let i of t)null!=(i=e(i,++o,t))&&(void 0===n?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}return[n,r]}function xa(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Oa(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 Sa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Oa(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Oa(t,e){if(t){if("string"==typeof t)return ja(t,e);var n={}.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)?ja(t,e):void 0}}function ja(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Pa(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[8,6,5,4,2.5,2],r=Math.pow(10,Math.floor(Math.log10(t))),o=Sa(n);try{for(o.s();!(e=o.n()).done;){var i=e.value;if(r*i<=t)return r*i}}catch(t){o.e(t)}finally{o.f()}return r}function _a(t,e,n){var r=wa(t,function(t){return t.x}),o=xa(r,2),i=o[0],a=o[1],u=wa(t,function(t){return t.y}),l=xa(u,2),c=l[0],f=l[1],s=Math.ceil((f-c)/e)+1,h=Math.ceil((a-i)/e)+1,y=Array.from({length:s},function(){return new Array(h).fill(void 0)});y.x0=i,y.y0=f,y.resolution=e;var p,v=Sa(t);try{for(v.s();!(p=v.n()).done;){var d=p.value,b=Math.floor((f-d.y)/e),m=Math.floor((d.x-i)/e),g=n?n(d):d;y[b][m]=g}}catch(t){v.e(t)}finally{v.f()}return y}function Ta(t){return Ta="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},Ta(t)}function ka(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,Ca(r.key),r)}}function Ca(t){var e=function(t){if("object"!=Ta(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ta(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ta(e)?e:e+""}function Ea(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ea=function(){return!!t})()}function Aa(t){return Aa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Aa(t)}function Ma(t,e){return Ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ma(t,e)}var za=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Aa(e),function(t,e){if(e&&("object"==Ta(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)}(t,Ea()?Reflect.construct(e,n||[],Aa(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.height=t.height||function(t,e){return e*Math.random()},n.lineColor=t.lineColor||function(t,e,n,r){return"#BBB"},n.lineWidth=t.lineWidth||function(t,e,n,r){return r},n.fillColor=t.fillColor||function(t,e,n,r){return"#c08c5968"},n}return 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&&Ma(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=function(t,e){var n,r={},o=Sa(t);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=r[i.y];a||(a={},r[i.y]=a),a[i.x]=e?e(i):i}}catch(t){o.e(t)}finally{o.f()}return r}(t,function(t){return r.height(t,n,o,a)}),l=e.extGeo;if(l){var c=Math.floor(l.xMin/n)*n,f=Math.floor(l.xMax/n)*n,s=Math.floor(l.yMin/n)*n,h=Math.floor(l.yMax/n)*n,y={min:s,max:h};i.lineJoin="round";for(var p=h;p>=s;p-=n){var v=u[p];if(v){i.beginPath(),i.moveTo(c-n/2,p);for(var d=void 0,b=c;b<=f;b+=n){var m=v[b];m||(m=0),m||d?i.lineTo(b+n/2,p+m):i.moveTo(b+n/2,p),d=m}d&&i.lineTo(f+n/2,p);var g=this.fillColor(p,y,n,o);g&&"none"!=g&&(i.fillStyle=g,i.fill());var w=this.lineColor(p,y,n,o),x=this.lineWidth(p,y,n,o);w&&"none"!=w&&x>0&&(i.strokeStyle=w,i.lineWidth=x,i.stroke())}}}}}],r&&ka(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function Ra(t){return Ra="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},Ra(t)}function Ia(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Fa(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 Fa(t,e){if(t){if("string"==typeof t)return Ba(t,e);var n={}.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)?Ba(t,e):void 0}}function Ba(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function La(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,Na(r.key),r)}}function Na(t){var e=function(t){if("object"!=Ra(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ra(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ra(e)?e:e+""}function Da(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Da=function(){return!!t})()}function Ga(t){return Ga=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ga(t)}function Wa(t,e){return Wa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wa(t,e)}var Ua=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ga(e),function(t,e){if(e&&("object"==Ra(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)}(t,Da()?Reflect.construct(e,n||[],Ga(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color,n.type=t.type||function(){return"flag"},n.size=t.size||function(t,e){return e},n.stripesOrientation=t.stripesOrientation||function(){return 0},n.offsetAngle=t.offsetAngle||function(){return 0},n.agePyramidHeight=t.agePyramidHeight||function(t,e){return e},n.pieChartInternalRadiusFactor=t.pieChartInternalRadiusFactor||0,n}return 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&&Wa(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=Object.entries(this.color).length,l=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Fa(t))){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}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,i=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==e.return||e.return()}finally{if(a)throw o}}}}(t);try{for(l.s();!(r=l.n()).done;){var c=r.value,f=this.size?this.size(c,n,o,a):n;if(f){var s=this.offset(c,n,o),h=this.type?this.type(c,n,o,a):"flag",y=c.x+s.dx+("agepyramid"===h?0:.5*n),p=c.y+s.dy+("agepyramid"===h?0:.5*n),v=this.offsetAngle?this.offsetAngle(c,n,o,a)*Math.PI/180:0;if("agepyramid"===h||"radar"===h||"halftone"===h){for(var d=-1/0,b=0,m=Object.keys(this.color);b<m.length;b++){var g=+c[m[b]];g>d&&(d=g)}var w=0;"agepyramid"===h&&this.agePyramidHeight&&(w=(n-this.agePyramidHeight(c,n,o,a))/2),"radar"!==h&&"halftone"!==h||(w=Math.PI/2+v);var x="agepyramid"===h?(this.agePyramidHeight?this.agePyramidHeight(c,n,o,a):n)/u:"radar"===h||"halftone"===h?2*Math.PI/u:void 0;if(void 0===x)throw new Error("Unexpected symbol type:"+h);for(var S=0,O=Object.entries(this.color);S<O.length;S++){var j=Ia(O[S],2),P=j[0],_=j[1];if("agepyramid"===h){i.fillStyle=_;var T=f*c[P]/d;i.fillRect(y+(n-T)/2,p+w,T,x),w+=x}else if("radar"===h){i.fillStyle=_;var k=c[P],C=f/2*Math.sqrt(k/d);i.beginPath(),i.moveTo(y,p),i.arc(y,p,C,w-x,w),i.lineTo(y,p),i.fill(),w+=x}else{if("halftone"!==h)throw new Error("Unexpected symbol type:"+h);i.fillStyle=_;var E=c[P],A=.333*f*Math.sqrt(E/d);i.beginPath(),i.arc(y+.25*n*Math.cos(w),p+.25*n*Math.sin(w),A,0,2*Math.PI),i.fill(),w+=x}}}else{for(var M=0,z=0,R=Object.keys(this.color);z<R.length;z++){var I=+c[R[z]];I&&(M+=I)}if(!M||isNaN(M))continue;for(var F=0,B=n*(1-f/n)*.5,L=this.stripesOrientation(c,n,o,a),N=0,D=Object.entries(this.color);N<D.length;N++){var G=Ia(D[N],2),W=G[0],U=G[1],$=c[W]/M;if($&&!isNaN($)){if(i.fillStyle=U,"flag"===h)0==L?i.fillRect(c.x+B+s.dx,c.y+B+F*f+s.dy,f,$*f):i.fillRect(c.x+B+F*f+s.dx,c.y+B+s.dy,$*f,f);else if("piechart"===h){var H=2*F*Math.PI,X=2*(F+$)*Math.PI;i.beginPath(),i.moveTo(y,p),i.arc(y,p,.5*f,H+v,X+v),this.pieChartInternalRadiusFactor&&i.arc(y,p,.5*f*this.pieChartInternalRadiusFactor,H+v,X+v,!0),i.closePath(),i.fill()}else if("ring"===h)i.beginPath(),i.arc(y,p,Math.sqrt(1-F)*f*.5,0,2*Math.PI),i.fill();else{if("segment"!==h)throw new Error("Unexpected symbol type:"+h);var V=f*f/n;0==L?i.fillRect(c.x+s.dx,c.y+(n-V)/2+F*V+s.dy,n,$*V):i.fillRect(c.x+F*n+s.dx,c.y+(n-V)/2+s.dy,$*n,V)}F+=$}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&La(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function $a(t){return $a="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},$a(t)}function Ha(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Xa(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,Va(r.key),r)}}function Va(t){var e=function(t){if("object"!=$a(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$a(e)?e:e+""}function qa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(qa=function(){return!!t})()}function Ya(t){return Ya=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ya(t)}function Za(t,e){return Za=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Za(t,e)}var Ja=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ya(e),function(t,e){if(e&&("object"==$a(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)}(t,qa()?Reflect.construct(e,n||[],Ya(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.width=t.width||function(t,e){return.1*e},n.length=t.length||function(t,e){return.9*e},n.orientation=t.orientation||function(){return 180*Math.random()},n}return 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&&Za(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;o.lineCap="butt";var a,u=Math.PI/180,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 Ha(t,e);var n={}.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)?Ha(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(l.s();!(a=l.n()).done;){var c=a.value,f=this.color?this.color(c,n,r,i):void 0;if(f){var s=this.width?this.width(c,n,r,i):void 0;if(s&&!(s<0)){var h=this.length?this.length(c,n,r,i):void 0;if(h&&!(h<0)){var y=this.orientation(c,n,r,i)*u;if(void 0!==y&&!isNaN(y)){var p=this.offset(c,n,r);o.strokeStyle=f,o.lineWidth=s;var v=c.x+n/2+p.dx,d=c.y+n/2+p.dy,b=.5*Math.cos(y)*h,m=.5*Math.sin(y)*h;o.beginPath(),o.moveTo(v-b,d-m),o.lineTo(v+b,d+m),o.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({viewScale:i,resolution:n,z:r,cells:t})}}],r&&Xa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function Qa(t){return Qa="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},Qa(t)}function Ka(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function tu(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,eu(r.key),r)}}function eu(t){var e=function(t){if("object"!=Qa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Qa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qa(e)?e:e+""}function nu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(nu=function(){return!!t})()}function ru(t){return ru=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ru(t)}function ou(t,e){return ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ou(t,e)}var iu=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ru(e),function(t,e){if(e&&("object"==Qa(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)}(t,nu()?Reflect.construct(e,n||[],ru(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.text=t.text||function(){return"X"},n.color=t.color||function(){return"black"},n.fontSize=t.fontSize||function(t,e){return e},n.fontFamily=t.fontFamily||function(){return"Arial"},n.fontWeight=t.fontWeight||function(){return"bold"},n}return 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&&ou(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;e.initCanvasTransform();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 Ka(t,e);var n={}.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)?Ka(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(u.s();!(a=u.n()).done;){var l=a.value,c=this.text?this.text(l,n,r,i):void 0;if(null!=c&&null!=c&&c+""!=""){var f=this.color?this.color(l,n,r,i):void 0;if(f){o.fillStyle=f;var s=this.fontSize(l,n,r,i)/r;if(s){var h=this.fontFamily?this.fontFamily(l,n,r,i):"Arial",y=this.fontWeight?this.fontWeight(l,n,r,i):"bold";o.font=y+" "+s+"px "+h;var p=this.offset(l,n,r);o.textAlign="center";var v=e.geoToPixX(l.x+.5*n+p.dx),d=e.geoToPixY(l.y+.5*n+p.dy)+.3*s;o.fillText(c,v,d)}}}}}catch(t){u.e(t)}finally{u.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i})}}],o=[{key:"textScale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=t.length;return function(r){return e&&(r=e(r)),0==r?"":r>=1?t[n-1]:t[Math.floor(r*n)]}}}],r&&tu(n.prototype,r),o&&tu(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Lo);function au(t){return au="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},au(t)}function uu(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 lu(t,e);var n={}.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)?lu(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function lu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cu(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,fu(r.key),r)}}function fu(t){var e=function(t){if("object"!=au(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=au(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==au(e)?e:e+""}function su(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(su=function(){return!!t})()}function hu(t){return hu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hu(t)}function yu(t,e){return yu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yu(t,e)}var pu=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=hu(e),function(t,e){if(e&&("object"==au(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)}(t,su()?Reflect.construct(e,n||[],hu(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.height=t.height,n.color=t.color||function(){return"#c08c59"},n.width=t.width||function(t,e){return.5*e},n.simple=t.simple||function(){return!1},n.viewHeightFactor=t.viewHeightFactor||1.5,n.viewSX=null==t.viewSX?0:t.viewSX,n.viewSY=null==t.viewSY?-.5:t.viewSY,n.shadowDirection=null==t.shadowDirection?-40.3*Math.PI/180:t.shadowDirection,n.shadowFactor=t.shadowFactor||.3,n.shadowColor=t.shadowColor||"#00000033",n.outlineCol=t.outlineCol||"#FFFFFF",n.outlineWidthPix=null==t.outlineWidthPix?.5:t.outlineWidthPix,n}return 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&&yu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0,a=e.view.x+this.viewSX*e.w*r,u=e.view.y+this.viewSY*e.h*r,l=this.viewHeightFactor*(e.w+e.h)*.5*r;t.sort(function(t,e){return 1e8*(e.y-t.y)+t.x-e.x});var c=this.simple(n,r,i);o.lineCap=c?"butt":"round",o.strokeStyle=this.shadowColor,o.fillStyle=this.shadowColor;var f,s=uu(t);try{for(s.s();!(f=s.n()).done;){var h=f.value,y=this.width?this.width(h,n,r,i):void 0;if(y&&!(y<0)){var p=this.height?this.height(h,n,r,i):void 0;if(p&&!(p<0)){o.lineWidth=y;var v=h.x+n/2,d=h.y+n/2,b=p*this.shadowFactor;o.beginPath(),o.moveTo(v,d),o.lineTo(v+b*Math.cos(this.shadowDirection),d+b*Math.sin(this.shadowDirection)),o.stroke()}}}}catch(t){s.e(t)}finally{s.f()}var m,g=uu(t);try{for(g.s();!(m=g.n()).done;){var w=m.value,x=this.color?this.color(w,n,r,i):void 0;if(x){var S=this.width?this.width(w,n,r,i):void 0;if(S&&!(S<0)){var O=this.height?this.height(w,n,r,i):void 0;if(O&&!(O<0)){var j=w.x+n/2,P=w.y+n/2,_=j-a,T=P-u,k=Math.atan2(T,_),C=Math.sqrt(_*_+T*T)*O/(l-O);c?(o.strokeStyle=x,o.lineWidth=S,o.beginPath(),o.moveTo(j,P),o.lineTo(j+C*Math.cos(k),P+C*Math.sin(k)),o.stroke()):(o.strokeStyle=this.outlineCol,o.lineWidth=S+2*this.outlineWidthPix*r,o.beginPath(),o.moveTo(j,P),o.lineTo(j+C*Math.cos(k),P+C*Math.sin(k)),o.stroke(),o.strokeStyle=x,o.lineWidth=S,o.beginPath(),o.moveTo(j,P),o.lineTo(j+C*Math.cos(k),P+C*Math.sin(k)),o.stroke(),o.strokeStyle=this.outlineCol,o.lineWidth=this.outlineWidthPix*r,o.beginPath(),o.arc(j+C*Math.cos(k),P+C*Math.sin(k),.5*S,0,2*Math.PI,!1),o.stroke())}}}}}catch(t){g.e(t)}finally{g.f()}o.lineCap="butt",this.updateLegends({style:this,resolution:n,z:r,viewScale:i})}}],r&&cu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function vu(t){return vu="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},vu(t)}function du(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function bu(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,mu(r.key),r)}}function mu(t){var e=function(t){if("object"!=vu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=vu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vu(e)?e:e+""}function gu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(gu=function(){return!!t})()}function wu(t){return wu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wu(t)}function xu(t,e){return xu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},xu(t,e)}var Su=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,n){return e=wu(e),function(t,e){if(e&&("object"==vu(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)}(t,gu()?Reflect.construct(e,n||[],wu(t).constructor):e.apply(t,n))}(this,e,[n])).color=n.color||function(t,e,n,r){return"#EA6BAC"},t.width=n.width||function(t,e,n,r){return e/5},t.length=n.length||function(t,e,n,r){return e},t.diamond=n.diamond,t}return 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&&xu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n,r){this.filter&&(t=t.filter(this.filter));var o=n.view.z,i=n.offscreenCtx,a=e.buildSides(t,r);if(0!=a.length){var u=this.viewScale?this.viewScale(a,r,o):void 0;i.lineCap="butt";var l,c=.5*r,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 du(t,e);var n={}.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)?du(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(a);try{for(f.s();!(l=f.n()).done;){var s=l.value,h=this.color?this.color(s,r,o,u):void 0;if(h&&"none"!=h)if(this.diamond){i.fillStyle=h;var y=s.x,p=s.y;i.beginPath(),i.moveTo(y-c,p),i.lineTo(y,p+c),i.lineTo(y+c,p),i.lineTo(y,p-c),i.closePath(),i.fill()}else{var v=this.width?this.width(s,r,o,u):void 0;if(!v||v<=0)continue;var d=this.length?this.length(s,r,o,u):void 0;if(!d||d<=0)continue;var b=.5*d;i.lineWidth=v,i.strokeStyle=h;var m=s.x,g=s.y;i.beginPath(),"v"===s.or?(i.moveTo(m,g-b),i.lineTo(m,g+b)):(i.moveTo(m-b,g),i.lineTo(m+b,g)),i.stroke()}}}catch(t){f.e(t)}finally{f.f()}this.updateLegends({style:this,resolution:r,z:o,viewScale:u})}}}],o=[{key:"buildSides",value:function(t,e){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.01,r=[],o=arguments.length>4&&void 0!==arguments[4]&&!arguments[4]?0:e/2;n*=e;var i=Math.abs;t.sort(function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x});for(var a=t[0],u=1;u<t.length;u++){var l=t[u];i(a.y+e-l.y)<n&&i(a.x-l.x)<n?r.push({or:"h",x:a.x+o,y:l.y,c1:a,c2:l}):(r.push({or:"h",x:a.x+o,y:a.y+e,c1:a,c2:void 0}),r.push({or:"h",x:l.x+o,y:l.y,c1:void 0,c2:l})),a=l}t.sort(function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y}),a=t[0];for(var c=1;c<t.length;c++){var f=t[c];i(a.x+e-f.x)<n&&i(a.y-f.y)<n?r.push({or:"v",x:a.x+e,y:a.y+o,c1:a,c2:f}):(r.push({or:"v",x:a.x+e,y:a.y+o,c1:a,c2:void 0}),r.push({or:"v",x:f.x,y:f.y+o,c1:void 0,c2:f})),a=f}return r}}],r&&bu(n.prototype,r),o&&bu(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Lo);function Ou(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=document.createElement("canvas");r.setAttribute("width",t),r.setAttribute("height",e);var o=n&&2==+n.version?"2":"",i=r.getContext("webgl"+o,n);if(!i)throw new Error("Unable to initialize WebGL"+o+". Your browser or machine may not support it.");return{canvas:r,gl:i,width:t,height:e}}function ju(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),o=1;o<n;o++)r[o-1]=arguments[o];for(var i=0,a=r;i<a.length;i++){var u=a[i];t.attachShader(e,u)}if(t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS))return e;throw new Error(t.getProgramInfoLog(e)||"Cannot create webGL program (2)")}function Pu(t,e){var n=t.createShader(e);if(null==n)throw new Error("Cannot create webGL shader");for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];if(t.shaderSource(n,o.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 _u(t){return _u="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},_u(t)}function Tu(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,ku(r.key),r)}}function ku(t){var e=function(t){if("object"!=_u(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=_u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_u(e)?e:e+""}function Cu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Cu=function(){return!!t})()}function Eu(t){return Eu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Eu(t)}function Au(t,e){return Au=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Au(t,e)}var Mu=function(t){function e(t){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Eu(e),function(t,e){if(e&&("object"==_u(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)}(t,Cu()?Reflect.construct(e,n||[],Eu(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.code=t.code,t.color=t.color||void 0;var r=Object.keys(t.color);n.catToI={};for(var o=0;o<r.length;o++)n.catToI[r[o]]=o+"";n.colors=[];for(var i=0,a=r;i<a.length;i++){var u=a[i];n.colors.push(t.color[""+u])}return n.size=t.size,n.cvWGL=void 0,n.programm=void 0,n.x=void 0,n.y=void 0,n.z=void 0,n.cellsNb=void 0,n}return 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&&Au(t,e)}(e,t),n=e,r=[{key:"init",value:function(t,e){if(this.cvWGL=Ou(t+"",e+""),this.cvWGL){var n=this.cvWGL.gl,r=Pu(n,n.VERTEX_SHADER,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n attribute float i;\n varying float vi;\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vi = i;\n }"),o=Pu(n,n.FRAGMENT_SHADER,"\n precision highp float;\n varying float vi;\n uniform sampler2D colorLUT;\n uniform float lutSize;\n void main(void) {\n float idx = floor(vi + 0.5);\n float u = (idx + 0.5) / lutSize;\n gl_FragColor = texture2D(colorLUT, vec2(u, 0.5));\n }");this.program=ju(n,r,o),n.useProgram(this.program)}else console.error("No webGL")}},{key:"bindColors",value:function(){for(var t=this.cvWGL.gl,e=this.colors.length,n=new Uint8Array(4*e),r=0;r<e;r++){var o=gn(this.colors[r]);n[4*r]=+o.r,n[4*r+1]=o.g,n[4*r+2]=o.b,n[4*r+3]=255*(null==o?void 0:o.opacity)}var i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,1,0,t.RGBA,t.UNSIGNED_BYTE,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE);var a=t.getUniformLocation(this.program,"colorLUT"),u=t.getUniformLocation(this.program,"lutSize");t.uniform1i(a,0),t.uniform1f(u,e),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,i)}},{key:"bindVertices",value:function(t,e,n,r){for(var o,i=this.cvWGL.gl,a=e/2,u=t.length,l=[],c=[],f=0;f<u;f++){o=t[f];var s=this.code(o,e,n,r);if(null!=s){var h=this.catToI[s];isNaN(+h)?console.log("Unexpected category index: "+s+" "+h):(l.push(o.x+a,o.y+a),c.push(+h))}}i.bindBuffer(i.ARRAY_BUFFER,i.createBuffer()),i.bufferData(i.ARRAY_BUFFER,new Float32Array(l),i.STATIC_DRAW);var y=i.getAttribLocation(this.program,"pos");i.vertexAttribPointer(y,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(y),i.bindBuffer(i.ARRAY_BUFFER,i.createBuffer()),i.bufferData(i.ARRAY_BUFFER,new Float32Array(c),i.STATIC_DRAW);var p=i.getAttribLocation(this.program,"i");i.vertexAttribPointer(p,1,i.FLOAT,!1,0,0),i.enableVertexAttribArray(p)}},{key:"mapContentChanged",value:function(t,e){return(t.x!=this.x||t.y!=this.y||t.z!=this.z||this.cellsNb!=e)&&(this.x=t.x,this.y=t.y,this.z=t.z,this.cellsNb=e,!0)}},{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0;this.cvWGL&&e.w==this.cvWGL.width&&e.h==this.cvWGL.height||(this.init(e.w,e.h),this.bindColors());var i=this.cvWGL.gl,a=this.cvWGL.canvas,u=this.size?this.size(n,r)/r:n/r+.2;i.uniform1f(i.getUniformLocation(this.program,"sizePix"),1*u),this.mapContentChanged(e.view,t.length)&&this.bindVertices(t,n,r,o),i.uniformMatrix3fv(i.getUniformLocation(this.program,"mat"),!1,new Float32Array(e.getWebGLTransform())),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.POINTS,0,t.length),e.initCanvasTransform(),e.offscreenCtx.drawImage(a,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}}],r&&Tu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function zu(t){return zu="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},zu(t)}function Ru(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,Iu(r.key),r)}}function Iu(t){var e=function(t){if("object"!=zu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=zu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==zu(e)?e:e+""}function Fu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Fu=function(){return!!t})()}function Bu(t){return Bu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bu(t)}function Lu(t,e){return Lu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lu(t,e)}var Nu=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Bu(e),function(t,e){if(e&&("object"==zu(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)}(t,Fu()?Reflect.construct(e,n||[],Bu(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.elevation=t.elevation,n.sunAzimuth=t.sunAzimuth||function(){return 2.356},n.sunAltitude=t.sunAltitude||function(){return.2},n.color=t.color||function(){return"black"},n.undefinedValue=t.undefinedValue||0,n}return 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&&Lu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),0!=t.length){var o=e.view.z,i=this.viewScale?this.viewScale(t,n,o):void 0,a=_a(t,n,function(t){return r.elevation(t)}),u=a.x0,l=a.y0;a=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2.356,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.15,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,i=t.length,a=t[0].length,u=Math.sin(n),l=-Math.cos(n),c=Math.tan(r),f=Array.from({length:i},function(){return new Array(a).fill(void 0)}),s=0;s<i;s++)for(var h=0;h<a;h++){var y=t[s][h]||o;if(void 0!==y)for(var p=e;;){var v=h-u*p/e,d=s-l*p/e,b=Math.round(v),m=Math.round(d);if(b<0||m<0||b>=a||m>=i)break;var g=t[m][b]||o;if(void 0===g)break;if(g-y-c*p>0){f[s][h]=1;break}p+=e}}return f}(a,n,this.sunAzimuth(n,o,i),this.sunAltitude(n,o,i),this.undefinedValue),t=[];for(var c=0;c<a.length;c++)for(var f=a[c],s=l-c*n,h=0;h<f.length;h++)if(f[h]){var y={x:u+h*n,y:s};t.push(y)}new Mu({code:function(){return"a"},color:{a:this.color(n,o,i)}}).draw(t,e,n),this.updateLegends({style:this,resolution:n,z:o,viewScale:i})}}}],r&&Ru(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function Du(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let o of t)null!=(o=e(o,++r,t))&&(n<o||void 0===n&&o>=o)&&(n=o)}return n}function Gu(t){return Gu="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},Gu(t)}function Wu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Wu=function(){return!!t})()}function Uu(t){return Uu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uu(t)}function $u(t,e){return $u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},$u(t,e)}var Hu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=function(t,e,n){return e=Uu(e),function(t,e){if(e&&("object"==Gu(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)}(t,Wu()?Reflect.construct(e,n||[],Uu(t).constructor):e.apply(t,n))}(this,e,[n]);var r=n.elevation;t.viewScale=function(t){return Du(t,function(t){return(e=t).c1&&e.c2&&e.c1[r]&&e.c2[r]?e.v=+e.c2[r]-e.c1[r]:e.v=0,e.v;var e})};var o=n.colorTopLeft||"255,255,255",i=n.colorBottomRight||"0,0,0";if(null!=n.revert&&n.revert){var a=o;o=i,i=a}var u=n.scale;return t.color=function(t,e,n,r){if(0!=t.v){var a=Math.abs(t.v/r);return u&&(a=u(a)),t.v<0&&"h"===t.or||t.v>0&&"v"===t.or?"rgba("+o+","+a+")":"rgba("+i+","+a+")"}},t.width=function(t,e,r){return n.width|Math.min(2*r,e/3)},t.diamond=n.diamond,t}return 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&&$u(t,e)}(e,t),n=e,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(Su);function Xu(t){return Xu="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},Xu(t)}function Vu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qu(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,Yu(r.key),r)}}function Yu(t){var e=function(t){if("object"!=Xu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Xu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xu(e)?e:e+""}function Zu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Zu=function(){return!!t})()}function Ju(t){return Ju=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ju(t)}function Qu(t,e){return Qu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qu(t,e)}var Ku=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ju(e),function(t,e){if(e&&("object"==Xu(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)}(t,Zu()?Reflect.construct(e,n||[],Ju(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.code=t.code,n.color=t.color,n}return 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&&Qu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=Su.buildSides(t,n);if(0!=i.length){var a=this.viewScale?this.viewScale(i,n,r):void 0;o.lineCap="butt";var u,l=.5*n,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 Vu(t,e);var n={}.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)?Vu(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(i);try{for(c.s();!(u=c.n()).done;){var f=u.value,s=f.c1?this.code(f.c1,n,r):void 0,h=f.c2?this.code(f.c2,n,r):void 0;if(s!=h){var y=this.width?this.width(f,n,r,a):void 0;if(y&&!(y<=0)){var p=.5*y;o.lineWidth=y,"h"===f.or?(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(f.x-l,f.y+p),o.lineTo(f.x+l,f.y+p),o.stroke()),s&&(o.beginPath(),o.strokeStyle=this.color[s],o.moveTo(f.x-l,f.y-p),o.lineTo(f.x+l,f.y-p),o.stroke())):(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(f.x+p,f.y-l),o.lineTo(f.x+p,f.y+l),o.stroke()),s&&(o.beginPath(),o.strokeStyle=this.color[s],o.moveTo(f.x-p,f.y-l),o.lineTo(f.x-p,f.y+l),o.stroke()))}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:a})}}}],r&&qu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Su);const tl=function t(e){function n(t,n){var r,o;return t=null==t?0:+t,n=null==n?1:+n,function(){var i;if(null!=r)i=r,r=null;else do{r=2*e()-1,i=2*e()-1,o=r*r+i*i}while(!o||o>1);return t+n*i*Math.sqrt(-2*Math.log(o)/o)}}return n.source=t,n}(Math.random);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 nl(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,rl(r.key),r)}}function rl(t){var e=function(t){if("object"!=el(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=el(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==el(e)?e:e+""}var ol=function(){return t=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=ju(e,Pu(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 "),Pu(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=[]},(e=[{key:"addPointData",value:function(t,e,n){var r=gn(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,o,i){this.verticesBuffer.push(t,e),this.colorsBuffer.push(n,r,o,i)}},{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)}}])&&nl(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function il(t){return il="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},il(t)}function al(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 ul(t,e);var n={}.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)?ul(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function ul(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ll(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,cl(r.key),r)}}function cl(t){var e=function(t){if("object"!=il(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=il(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==il(e)?e:e+""}function fl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(fl=function(){return!!t})()}function sl(t){return sl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sl(t)}function hl(t,e){return hl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hl(t,e)}var yl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=sl(e),function(t,e){if(e&&("object"==il(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)}(t,fl()?Reflect.construct(e,n||[],sl(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.dotNumber=t.dotNumber||function(t,e){return e/100},n.color=t.color||function(){return"#FF5733"},n.dotSize=t.dotSize||function(t,e){return 1.5*e},n.sigma=t.sigma||function(t,e){return t/2},n}return 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&&hl(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=this.dotSize?this.dotSize(n,r,o):r,a=this.sigma?this.sigma(n,r,o):.4*n,u=tl(0,a),l=e.offscreenCtx;if(function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}()){var c=Ou(e.w+"",e.h+"");if(!c)return void console.error("No webGL");var f,s=new ol(c.gl,i/r),h=n/2,y=al(t);try{for(y.s();!(f=y.n()).done;){var p=f.value,v=this.color(p,n,r,o);if(v&&"none"!==v){var d=this.dotNumber(p,n,r,o),b=this.offset(p,n,r),m=p.x+b.dx+h,g=p.y+b.dy+h,w=gn(v);if(!w)return;for(var x=0;x<=d;x++)s.addPointData2(m+u(),g+u(),w.r,w.g,w.b,w.opacity)}}}catch(t){y.e(t)}finally{y.f()}s.draw(e.getWebGLTransform()),e.initCanvasTransform(),l.drawImage(c.canvas,0,0)}else{var S,O=al(t);try{for(O.s();!(S=O.n()).done;){var j=S.value,P=this.color(j,n,r,o);if(P&&"none"!==P){l.fillStyle=P;for(var _=this.dotNumber(j,n,r,o),T=this.offset(j,n,r),k=j.x+T.dx+n/2,C=j.y+T.dy+n/2,E=0;E<=_;E++)l.fillRect(k+u(),C+u(),i,i)}}}catch(t){O.e(t)}finally{O.f()}}this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}}],r&&ll(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function pl(t){return pl="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},pl(t)}function vl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function dl(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,bl(r.key),r)}}function bl(t){var e=function(t){if("object"!=pl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=pl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pl(e)?e:e+""}function ml(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ml=function(){return!!t})()}function gl(t){return gl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gl(t)}function wl(t,e){return wl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wl(t,e)}var xl=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,n){return e=gl(e),function(t,e){if(e&&("object"==pl(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)}(t,ml()?Reflect.construct(e,n||[],gl(t).constructor):e.apply(t,n))}(this,e,[n])).classifier=n.classifier||function(t,e,n){return function(t){return 1}},t.width=n.width||function(t,e,n,r,o){return Math.abs(e)*r},t.length=n.length||function(t,e,n,r){return e},t.colorDark=n.colorDark||"#111",t.colorBright=n.colorBright||"#ddd",t.revert=null!=n.revert&&n.revert,t.diamond=n.diamond,t.limit=n.limit||"steep",t}return 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)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.classifier(t,n,o),u=function(t){var e=t.c1?a(t.c1):void 0,n=t.c2?a(t.c2):void 0;if(void 0!==e||void 0!==n)return void 0===e?"none"==r.limit?void 0:"steep"==r.limit?n:Math.sign(n):void 0===n?"none"==r.limit?void 0:"steep"==r.limit?-e:Math.sign(-e):n-e},l=Su.buildSides(t,n);if(0!=l.length){var c=this.viewScale?this.viewScale(l,n,o):void 0;i.lineCap="butt";var f,s=.5*n,h=this.revert?this.colorBright:this.colorDark,y=this.revert?this.colorDark:this.colorBright,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 vl(t,e);var n={}.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)?vl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(l);try{for(p.s();!(f=p.n()).done;){var v=f.value,d=u(v);if(void 0!==d&&0!==d){var b=d<0&&"h"===v.or||d>0&&"v"===v.or?y:h;if(b&&"none"!=b)if(this.diamond){i.fillStyle=b;var m=v.x,g=v.y;i.beginPath(),i.moveTo(m-s,g),i.lineTo(m,g+s),i.lineTo(m+s,g),i.lineTo(m,g-s),i.closePath(),i.fill()}else{var w=this.width?this.width(v,d,n,o,c):void 0;if(!w||w<=0)continue;var x=this.length?this.length(v,n,o,c):void 0;if(!x||x<=0)continue;var S=.5*x;i.lineWidth=w,i.strokeStyle=b;var O=v.x,j=v.y;i.beginPath(),"v"===v.or?(i.moveTo(O,j-S),i.lineTo(O,j+S)):(i.moveTo(O-S,j),i.lineTo(O+S,j)),i.stroke()}}}}catch(t){p.e(t)}finally{p.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:c})}}}],r&&dl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function Sl(t){return null===t?NaN:+t}function Ol(t,e,n=Sl){if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,i=Math.floor(o),a=+n(t[i],i,t);return a+(+n(t[i+1],i+1,t)-a)*(o-i)}}function jl(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Pl(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _l(t){let e,n,r;function o(t,r,o=0,i=t.length){if(o<i){if(0!==e(r,r))return i;do{const e=o+i>>>1;n(t[e],r)<0?o=e+1:i=e}while(o<i)}return o}return 2!==t.length?(e=jl,n=(e,n)=>jl(t(e),n),r=(e,n)=>t(e)-n):(e=t===jl||t===Pl?t:Tl,n=t,r=t),{left:o,center:function(t,e,n=0,i=t.length){const a=o(t,e,n,i-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,o=0,i=t.length){if(o<i){if(0!==e(r,r))return i;do{const e=o+i>>>1;n(t[e],r)<=0?o=e+1:i=e}while(o<i)}return o}}}function Tl(){return 0}const kl=_l(jl),Cl=kl.right,El=(kl.left,_l(Sl).center,Cl);function Al(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ml(){var t,e=[],n=[],r=[];function o(){var t=0,o=Math.max(1,n.length);for(r=new Array(o-1);++t<o;)r[t-1]=Ol(e,t/o);return i}function i(e){return null==e||isNaN(e=+e)?t:n[El(r,e)]}return i.invertExtent=function(t){var o=n.indexOf(t);return o<0?[NaN,NaN]:[o>0?r[o-1]:e[0],o<r.length?r[o]:e[e.length-1]]},i.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(jl),o()},i.range=function(t){return arguments.length?(n=Array.from(t),o()):n.slice()},i.unknown=function(e){return arguments.length?(t=e,i):t},i.quantiles=function(){return r.slice()},i.copy=function(){return Ml().domain(e).range(n).unknown(t)},Al.apply(i,arguments)}var zl=function(t){var e=t.valueFunction,n=t.minValue||0,r=t.minSizePix||0,o=t.maxSizeFactor||1,i=t.stretching,a=t.range,u=t.domain,l=t.classNumber;return function(t,c,f){var s=u||[n,Du(t,e)],h=a||[r*f,c*o],y=s[1]-s[0],p=s[0],v=h[1]-h[0],d=h[0];return function(t){return t=(t-p)/y,i&&(t=i(t)),l&&(t=1==t?1:Math.floor(t*l)/(l-1)),d+t*v}}},Rl=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.minSizePix||1,o=t.maxSizeFactor||1,i=Ml();return function(t,a,u){i.domain(t.map(e));var l=r*u,c=a*o;return i.range(Array.from({length:n},function(t,e){return l+e*(c-l)/(n-1)})),i.breaks=i.quantiles(),i.values=i.range(),i}},Il=function(t){var e,n=t.valueFunction,r=t.stretching,o=t.colorScale||function(){return"purple"},i=null===(e=t.colors)||void 0===e?void 0:e.length;return t.colors&&i&&(o=function(e){return t.colors[1==e?i-1:Math.floor(e*i)]}),function(e){if(0!=e.length&&e){var a=wa(e,n);if(null!=a[0]){var u=a[1]-a[0],l=function(t){return t=(t-a[0])/u,r&&(t=r(t)),o(t)};if(l.invert=function(t){return r&&(t=r.invert(t)),a[0]+t*u},t.colors&&i){l.breaks=[];for(var c=1;c<i;c++)l.breaks.push(l.invert(c/i))}return l}}}},Fl=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.colors;t.colorScale&&(r=Wl(t.colorScale,n)),r=r||Array.from({length:n},function(t,e){return"rgb("+Math.floor(255*e/(n-1))+",150,150)"});var o=Ml().range(r);return function(t){return o.domain(t.map(e)),o.breaks=o.quantiles(),o.colors=r,o}},Bl=function(t){var e=t.valueFunction,n=t.classNumber||12,r=Ml().range(Array.from({length:n},function(t,e){return e}));return function(t){return r.domain(t.map(e)),r.breaks=r.quantiles(),r}},Ll=function(t){return function(e,n,r){var o={};for(var i in t)o[i]=t[i](e,n,r);return o}};function Nl(t){var e=t.length,n=function(n){for(var r=0;r<e;){if(n<=t[r])return r;r++}return r};return n.breaks=t,n}function Dl(t,e,n){for(var r=[],o=(e-t)/n,i=1;i<n;i++)r.push(t+i*o);return Nl(r)}function Gl(t,e){var n=Nl(t),r=function(t){return e[n(t)]};return r.breaks=t,r.colors=e,r}function Wl(t,e){if(1==e)return[t(.5)];for(var n=[],r=0;r<e;r++)n.push(t(r/(e-1)));return n}function Ul(t){return Ul="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},Ul(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 Hl(t,e);var n={}.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)?Hl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Hl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Xl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xl=function(){return!!t})()}function Vl(t){return Vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vl(t)}function ql(t,e){return ql=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ql(t,e)}function Yl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zl(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,Ql(r.key),r)}}function Jl(t,e,n){return e&&Zl(t.prototype,e),n&&Zl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ql(t){var e=function(t){if("object"!=Ul(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ul(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ul(e)?e:e+""}var Kl=function(){return Jl(function t(){Yl(this,t)},null,[{key:"get",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(r=r||{}).colorDark=r.colorDark||"#333",r.colorBright=r.colorBright||"#aaa";for(var o=Nl(e),i=function(e){return o(t(e))},a={},u=0;u<n.length;u++)a[u+""]=n[u];var l=new Mu({code:i,color:a}),c=new xl({classifier:function(){return i},colorDark:r.colorDark,colorBright:r.colorBright,diamond:r.diamond});return[l,new ga({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n},filter:r.filter}),c,new tc({colDark:r.colDark,colBright:r.colBright,filter:r.filter})]}},{key:"getCategory",value:function(t,e,n){return(n=n||{}).colDark=n.colDark||"#333",n.colBright=n.colBright||"#aaa",[new Mu({code:t,color:e}),new ga({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n}}),new tc({colDark:n.colDark,colBright:n.colBright})]}}])}(),tc=function(t){function e(t){var n,r,o,i;return Yl(this,e),r=this,i=[t],o=Vl(o=e),n=function(t,e){if(e&&("object"==Ul(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)}(r,Xl()?Reflect.construct(o,i||[],Vl(r).constructor):o.apply(r,i)),t=t||{},n.colDark=t.colDark||"#333",n.colBright=t.colBright||"#aaa",n}return 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&&ql(t,e)}(e,t),Jl(e,[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.offscreenCtx;r.lineWidth=.6*e.view.z,r.strokeStyle=this.colDark;var o,i=$l(t);try{for(i.s();!(o=i.n()).done;){var a=o.value;r.beginPath(),r.arc(a.x+.5*n,a.y+.5*n,.55*n*.5,Math.PI/4,-Math.PI*(3/4),!0),r.stroke()}}catch(t){i.e(t)}finally{i.f()}r.strokeStyle=this.colBright;var u,l=$l(t);try{for(l.s();!(u=l.n()).done;){var c=u.value;r.beginPath(),r.arc(c.x+.5*n,c.y+.5*n,.55*n*.5,Math.PI/4,-Math.PI*(3/4),!1),r.stroke()}}catch(t){l.e(t)}finally{l.f()}}}])}(Lo);function ec(t){return ec="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},ec(t)}function nc(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,rc(r.key),r)}}function rc(t){var e=function(t){if("object"!=ec(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ec(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ec(e)?e:e+""}var oc=function(){return t=function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=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 a=Pu(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 "),u=[];u.push("precision mediump float;"),u.push("varying float vt;"),u.push("uniform float alpha;");for(var l=0;l<n.length;l++)u.push("uniform vec4 c"+l+";");if(u.push("void main(void) {"),r?"pow"==r.fun?u.push(" float t = pow(vt, alpha);"):"powInv"==r.fun?u.push(" float t = 1.0-pow(1.0-vt, 1.0/alpha);"):"exp"==r.fun?u.push(0==r.alpha?"float t = vt;":" float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);"):"log"==r.fun?u.push(0==r.alpha?"float t = vt;":" float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);"):"circle"==r.fun?0==r.alpha?u.push(" float t = vt;"):1==r.alpha?u.push(" float t = sqrt(vt * (2.0 - vt));"):(u.push(" float a = alpha / (1.0 - alpha);"),u.push(" float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;")):"circleInv"==r.fun?0==r.alpha?u.push(" float t = vt;"):1==r.alpha?u.push(" float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));"):(u.push(" float a = alpha / (1.0 - alpha);"),u.push(" float t = 1.0 - sqrt(1.0 / (a * a) + (1.0-vt) * ( 2.0/a + 1.0 + vt )) + 1.0 / a;")):(console.error("Unexpected stretching function code: "+r.fun),u.push(" float t = vt;")):u.push(" float t = vt;"),1==n.length)u.push(" vec4 cI=c0;"),u.push(" vec4 cF=c0;");else if(2==n.length)u.push(" vec4 cI=c0;"),u.push(" vec4 cF=c1;");else{var c=n.length-1,f=c+".0";u.push(" vec4 cI;"),u.push(" vec4 cF;"),u.push(" if(t<1.0/"+f+") { cI=c0; cF=c1; t=t*"+f+"; }");for(var s=2;s<c;s++)u.push(" else if(t<"+s+".0/"+f+") { cI=c"+(s-1)+"; cF=c"+s+"; t="+f+"*t-"+(s-1)+".0; }");u.push(" else { cI=c"+(c-1)+"; cF=c"+c+"; t="+f+"*t-"+(c-1)+".0; }")}1==n.length?u.push(" gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}"):u.push(" gl_FragColor = mix(cI, cF, t);}");var h=u.join(""),y=Pu(e,e.FRAGMENT_SHADER,h);this.program=ju(e,a,y),e.useProgram(this.program),e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*o),e.uniform1f(e.getUniformLocation(this.program,"alpha"),r?1*r.alpha:0);for(var p=0;p<n.length;p++){var v=gn(n[p]),d=v.opacity;1==v.opacity&&null!=i&&(d=i);var b=[+v.r/255,+v.g/255,+v.b/255,+d];e.uniform4fv(e.getUniformLocation(this.program,"c"+p),b)}},e=[{key:"draw",value:function(t,e,n){var r=this.gl,o=this.program;r.bindBuffer(r.ARRAY_BUFFER,r.createBuffer()),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t),r.STATIC_DRAW);var i=r.getAttribLocation(o,"pos");r.vertexAttribPointer(i,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i),r.bindBuffer(r.ARRAY_BUFFER,r.createBuffer()),r.bufferData(r.ARRAY_BUFFER,new Float32Array(e),r.STATIC_DRAW);var a=r.getAttribLocation(o,"t");r.vertexAttribPointer(a,1,r.FLOAT,!1,0,0),r.enableVertexAttribArray(a),r.uniformMatrix3fv(r.getUniformLocation(o,"mat"),!1,new Float32Array(n)),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.POINTS,0,t.length/2)}}],e&&nc(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ic(t){return ic="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},ic(t)}function ac(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function uc(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,lc(r.key),r)}}function lc(t){var e=function(t){if("object"!=ic(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ic(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ic(e)?e:e+""}function cc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(cc=function(){return!!t})()}function fc(t){return fc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fc(t)}function sc(t,e){return sc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sc(t,e)}var hc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=fc(e),function(t,e){if(e&&("object"==ic(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)}(t,cc()?Reflect.construct(e,n||[],fc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.tFun=t.tFun,n.stretching=t.stretching,n.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&&(n.colors=[t.color(0),t.color(.2),t.color(.4),t.color(.6),t.color(.8),t.color(1)]),n.opacity=t.opacity,n.size=t.size,n}return 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&&sc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=Ou(e.w+"",e.h+"",null!=this.opacity?{premultipliedAlpha:!1}:void 0);if(i){var a,u=n/2,l=[],c=[],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 ac(t,e);var n={}.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)?ac(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(f.s();!(a=f.n()).done;){var s=a.value,h=this.tFun(s,n,r,o);null!=h&&null!=h&&(l.push(s.x+u,s.y+u),c.push(h>1?1:h<0?0:h))}}catch(t){f.e(t)}finally{f.f()}var y=this.size?this.size(n,r):n+.2*r,p=this.opacity?this.opacity(n,r):void 0;new oc(i.gl,this.colors,this.stretching,y/r,p).draw(l,c,e.getWebGLTransform()),e.initCanvasTransform(),e.offscreenCtx.drawImage(i.canvas,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}else console.error("No webGL")}}],r&&uc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function yc(t){return yc="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},yc(t)}function pc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function vc(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,dc(r.key),r)}}function dc(t){var e=function(t){if("object"!=yc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=yc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yc(e)?e:e+""}function bc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(bc=function(){return!!t})()}function mc(t){return mc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mc(t)}function gc(t,e){return gc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gc(t,e)}var wc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=mc(e),function(t,e){if(e&&("object"==yc(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)}(t,bc()?Reflect.construct(e,n||[],mc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.mosaicFactor=t.mosaicFactor||.15,n.shadowFactor=t.shadowFactor||.2,n.shadowColor=t.shadowColor||"#555",n}return 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&&gc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;o.strokeStyle=this.shadowColor,o.lineWidth=this.shadowFactor*n,o.lineJoin="round",o.lineCap="butt";var a,u=n*this.mosaicFactor,l=function(){return{x:Math.random()*u,y:Math.random()*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 pc(t,e);var n={}.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)?pc(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(c.s();!(a=c.n()).done;){var f=a.value,s=this.color?this.color(f,n,r,i):void 0;if(s&&"none"!==s){o.fillStyle=s;var h=this.offset(f,n,r),y=l(),p=l(),v=l(),d=l();this.shadowFactor>0&&(o.beginPath(),o.moveTo(f.x+h.dx+y.x,f.y+h.dy+y.y),o.lineTo(f.x+h.dx+n-v.x,f.y+h.dy+v.y),o.lineTo(f.x+h.dx+n-d.x,f.y+h.dy+n-d.y),o.stroke()),o.beginPath(),o.moveTo(f.x+h.dx+y.x,f.y+h.dy+y.y),o.lineTo(f.x+h.dx+n-v.x,f.y+h.dy+v.y),o.lineTo(f.x+h.dx+n-d.x,f.y+h.dy+n-d.y),o.lineTo(f.x+h.dx+p.x,f.y+h.dy+n-p.y),o.fill()}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i})}}],r&&vc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function xc(t){return xc="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},xc(t)}function Sc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Oc(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,jc(r.key),r)}}function jc(t){var e=function(t){if("object"!=xc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=xc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xc(e)?e:e+""}function Pc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Pc=function(){return!!t})()}function _c(t){return _c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_c(t)}function Tc(t,e){return Tc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tc(t,e)}var kc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=_c(e),function(t,e){if(e&&("object"==xc(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)}(t,Pc()?Reflect.construct(e,n||[],_c(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.size=t.size||function(t,e){return e},n.shape=t.shape||function(){return"o"},n}return 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&&Tc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=.5*n,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 Sc(t,e);var n={}.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)?Sc(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(l.s();!(r=l.n()).done;){var c=r.value,f=this.color?this.color(c,n,o,a):void 0;if(f&&"none"!==f){i.fillStyle=f;var s=this.size(c,n,o,a),h=(s=s<0?0:s>1?1:s)*u,y=this.shape?this.shape(c):"o";if("none"!==y){var p=c.x+u,v=c.y+u;if("p"===y)i.beginPath(),i.moveTo(p,v+u),i.lineTo(p+h,v+h),i.lineTo(p+u,v),i.lineTo(p+h,v-h),i.lineTo(p,v-u),i.lineTo(p-h,v-h),i.lineTo(p-u,v),i.lineTo(p-h,v+h),i.fill();else{if("o"!==y)throw new Error("Unexpected shape:"+y);i.beginPath(),i.moveTo(p,v+h),i.lineTo(p+u,v+u),i.lineTo(p+h,v),i.lineTo(p+u,v-u),i.lineTo(p,v-h),i.lineTo(p-u,v-u),i.lineTo(p-h,v),i.lineTo(p-u,v+u),i.fill()}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&Oc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function Cc(t){return Cc="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},Cc(t)}function Ec(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 Ac(t,e);var n={}.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)?Ac(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Ac(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Mc(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,zc(r.key),r)}}function zc(t){var e=function(t){if("object"!=Cc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Cc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Cc(e)?e:e+""}function Rc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Rc=function(){return!!t})()}function Ic(t){return Ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ic(t)}function Fc(t,e){return Fc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fc(t,e)}var Bc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ic(e),function(t,e){if(e&&("object"==Cc(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)}(t,Rc()?Reflect.construct(e,n||[],Ic(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.ts=t.ts,n.noData=t.noData||function(t){return void 0===t||""==t||null===t||isNaN(+t)},n.offsetX=t.offsetX||function(t,e,n){return 0},n.width=t.width||function(t,e,n){return e},n.offsetY=t.offsetY||function(t,e,n){return 0},n.height=t.height||function(t,e,n){return e},n.anchorModeY=t.anchorModeY||function(t,e,n){return"center"},n.lineWidth=t.lineWidth||function(t,e,n,r){return 1.5*r},n.color=t.color||function(){return"black"},n}return 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&&Fc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o,i,a=e.view.z,u=e.offscreenCtx,l=this.viewScale?this.viewScale(t,n,a):void 0,c=function(t){var e,n,o,i=Ec(r.ts);try{for(i.s();!(o=i.n()).done;){var a=t[o.value];null!=a&&((null==e||a<e)&&(e=a),(null==n||a>n)&&(n=a))}}catch(t){i.e(t)}finally{i.f()}if(null!=e)return n-e},f=Ec(t);try{for(f.s();!(i=f.n()).done;){var s=c(i.value);null!=s&&(null==o||s>o)&&(o=s)}}catch(t){f.e(t)}finally{f.f()}if(o){var h=this.ts.length;u.lineCap="butt";var y,p=Ec(t);try{for(p.s();!(y=p.n()).done;){var v=y.value,d=this.lineWidth?this.lineWidth(v,n,a,l):void 0;if(d&&!(d<0)){var b=this.color?this.color(v,n,a,l):void 0;if(b){var m=this.offsetX?this.offsetX(v,n,a):0;if(null!=m&&!isNaN(m)){var g=this.width?this.width(v,n,a):n;if(null!=g&&!isNaN(g)){var w=this.offsetY?this.offsetY(v,n,a):0;if(null!=w&&!isNaN(w)){var x=this.height?this.height(v,n,a):n;if(null!=x&&!isNaN(x)){var S=this.anchorModeY?this.anchorModeY(v,n,a):"center";if(S){u.lineWidth=d,u.strokeStyle=b;var O=void 0,j=void 0;if("first"===S)O=v[this.ts[0]],j=0;else if("last"===S)O=v[this.ts[this.ts.length-1]],j=0;else if("bottom"===S){var P,_=Ec(this.ts);try{for(_.s();!(P=_.n()).done;){var T=+v[P.value];null!=T&&(null==O||T<O)&&(O=T)}}catch(t){_.e(t)}finally{_.f()}j=0}else if("top"===S){var k,C=Ec(this.ts);try{for(C.s();!(k=C.n()).done;){var E=+v[k.value];null!=E&&(null==O||E>O)&&(O=E)}}catch(t){C.e(t)}finally{C.f()}j=n}else{if("center"!==S){console.log("Unexpected anchorModeY: "+S);continue}var A,M=void 0,z=void 0,R=Ec(this.ts);try{for(R.s();!(A=R.n()).done;){var I=v[A.value];null!=I&&((null==M||I<M)&&(M=I),(null==z||I>z)&&(z=I))}}catch(t){R.e(t)}finally{R.f()}O=.5*(+z+ +M),j=n/2}var F=g/(h-1),B=v[this.ts[0]];this.noData(B)||(u.beginPath(),u.moveTo(v.x+m,v.y+j+(B-O)*x/o+w));for(var L=void 0,N=1;N<h;N++)L=v[this.ts[N]],this.noData(B)&&this.noData(L)||(!this.noData(B)&&this.noData(L)?u.stroke():this.noData(B)&&!this.noData(L)?(u.beginPath(),u.moveTo(v.x+N*F+m,v.y+j+(L-O)*x/o+w)):(u.lineTo(v.x+N*F+m,v.y+j+(L-O)*x/o+w),N==h-1&&u.stroke())),B=L}}}}}}}}}catch(t){p.e(t)}finally{p.f()}this.updateLegends({style:this,resolution:n,z:a,viewScale:l})}}}],r&&Mc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo);function Lc(t){return Lc="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},Lc(t)}function Nc(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Gc(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 Dc(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Gc(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Gc(t,e){if(t){if("string"==typeof t)return Wc(t,e);var n={}.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)?Wc(t,e):void 0}}function Wc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Uc(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,$c(r.key),r)}}function $c(t){var e=function(t){if("object"!=Lc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Lc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Lc(e)?e:e+""}function Hc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Hc=function(){return!!t})()}function Xc(t){return Xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xc(t)}function Vc(t,e){return Vc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vc(t,e)}var qc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Xc(e),function(t,e){if(e&&("object"==Lc(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)}(t,Hc()?Reflect.construct(e,n||[],Xc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color,n.height=t.height||function(t,e,n,r){return.4*e},n.angle=null!=t.angle?t.angle:50,n.cornerLineStrokeColor=t.cornerLineStrokeColor||function(t,e,n,r){return"#999"},n.cornerLineWidth=t.cornerLineWidth||function(t,e,n,r){return r%90==0?0:.8*n},n.sVert=null==t.sVert||t.sVert,n.sHor=null==t.sHor||t.sHor,n}return 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&&Vc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=Object.keys(this.color),l=n/2,c=this.offset(void 0,n,o),f=c.dx,s=c.dy,h=Su.buildSides(t,n,this.angle%180!=90&&this.sVert,this.angle%180!=0&&this.sHor);if(0!=h.length){var y=this.angle*Math.PI/180,p=Math.cos(y),v=Math.sin(y),d=Math.abs(this.angle)<90?e.extGeo.xMin:e.extGeo.xMax,b=this.angle<0?e.extGeo.yMax:e.extGeo.yMin;h.sort(function(t,e){return Math.hypot(e.x-d,e.y-b)-Math.hypot(t.x-d,t.y-b)});var m=function(t){if(t){var e=r.cornerLineWidth?r.cornerLineWidth(t,n,o,r.angle):.8*o;if(0!=e){i.strokeStyle=r.cornerLineStrokeColor?r.cornerLineStrokeColor(t,n,o,r.angle):"#333",i.lineWidth=e;var u=r.height(t,n,o,a);i.beginPath(),i.moveTo(t.x+l+f,t.y+l+s),i.lineTo(t.x+l+u*p+f,t.y+l+u*v+s),i.stroke()}}};i.lineCap="round";var g,w=Dc(h);try{for(w.s();!(g=w.n()).done;){var x=g.value,S=x.c1,O=x.c2,j=x.x,P=x.y,_=S?this.height(S,n,o,a):0,T=O?this.height(O,n,o,a):0,k=Yc(S,u),C=Yc(O,u);if(0!=k||0!=C)for(var E=0,A=0,M=0,z=Object.entries(this.color);M<z.length;M++){var R=Nc(z[M],2),I=R[0],F=R[1],B=S?+S[I]:0,L=O?+O[I]:0;if(0!=B||0!=L){var N=_*E/k||0,D=_*(E+B)/k||0,G=T*A/C||0,W=T*(A+L)/C||0;i.beginPath(),"h"==x.or?(i.moveTo(j+N*p+f,P-l+N*v+s),i.lineTo(j+G*p+f,P+l+G*v+s),i.lineTo(j+W*p+f,P+l+W*v+s),i.lineTo(j+D*p+f,P-l+D*v+s)):(i.moveTo(j-l+N*p+f,P+N*v+s),i.lineTo(j+l+G*p+f,P+G*v+s),i.lineTo(j+l+W*p+f,P+W*v+s),i.lineTo(j-l+D*p+f,P+D*v+s)),i.fillStyle=F,i.fill(),E+=B,A+=L,m(S),m(O)}}}}catch(t){w.e(t)}finally{w.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}}],r&&Uc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo),Yc=function(t,e){if(!t)return 0;var n,r=0,o=Dc(e);try{for(o.s();!(n=o.n()).done;){var i=t[n.value];i&&(r+=+i)}}catch(t){o.e(t)}finally{o.f()}return r||0};function Zc(t){return Zc="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},Zc(t)}function Jc(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(Zc(t)+" is not iterable")}function Qc(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return Kc(c,"_invoke",function(n,r,o){var i,u,l,c=0,f=o||[],s=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!s&&c&&!o&&e<f.length;e++){var o,i=f[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw s=!0,r}return function(o,f,p){if(c>1)throw TypeError("Generator is already running");for(s&&1===f&&y(f,p),u=f,l=p;(e=u<2?t:l)||!s;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(s=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:s}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(Kc(e={},r,function(){return this}),e),s=c.prototype=u.prototype=Object.create(f);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Kc(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return l.prototype=c,Kc(s,"constructor",c),Kc(c,"constructor",l),l.displayName="GeneratorFunction",Kc(c,o,"GeneratorFunction"),Kc(s),Kc(s,o,"Generator"),Kc(s,r,function(){return this}),Kc(s,"toString",function(){return"[object Generator]"}),(Qc=function(){return{w:i,m:h}})()}function Kc(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Kc=function(t,e,n,r){function i(e,n){Kc(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Kc(t,e,n,r)}function tf(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 ef(t,e);var n={}.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)?ef(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function ef(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function nf(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function rf(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,of(r.key),r)}}function of(t){var e=function(t){if("object"!=Zc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Zc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zc(e)?e:e+""}function af(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(af=function(){return!!t})()}function uf(t){return uf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uf(t)}function lf(t,e){return lf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},lf(t,e)}var cf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=uf(e),function(t,e){if(e&&("object"==Zc(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)}(t,af()?Reflect.construct(e,n||[],uf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.image=t.image||function(){return""},n.size=t.size||function(t,e){return e},n.cache={},n}return 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&&lf(t,e)}(e,t),n=e,r=[{key:"draw",value:(o=Qc().m(function t(e,n,r){var o,i,a,u,l,c,f,s,h=this;return Qc().w(function(t){for(;;)switch(t.p=t.n){case 0:o=n.view.z,i=r/o,a=this.viewScale?this.viewScale(e,r,o):void 0,n.initCanvasTransform(),u=tf(e),t.p=1,c=Qc().m(function t(){var e,u,c,f,s,y;return Qc().w(function(t){for(;;)switch(t.n){case 0:if(e=l.value,u=h.image(e,r,o,a)){t.n=1;break}return t.a(2,0);case 1:if(c=h.size(e,r,o,a)/o){t.n=2;break}return t.a(2,0);case 2:if("loading"!=(f=h.cache[u])){t.n=3;break}return t.a(2,{v:void 0});case 3:if(f){y=(i-c)/2;try{n.offscreenCtx.drawImage(f,n.geoToPixX(e.x)+y,n.geoToPixY(e.y)+y-i,c,c)}catch(t){console.error(t)}}else h.cache[u]="loading",(s=new Image).onload=function(){h.cache[u]=s,n.redraw()},s.onerror=function(){console.warn("Could not retrieve image from",u)},s.src=u;case 4:return t.a(2)}},t)}),u.s();case 2:if((l=u.n()).done){t.n=6;break}return t.d(Jc(c()),3);case 3:if(0!==(f=t.v)){t.n=4;break}return t.a(3,5);case 4:if(!f){t.n=5;break}return t.a(2,f.v);case 5:t.n=2;break;case 6:t.n=8;break;case 7:t.p=7,s=t.v,u.e(s);case 8:return t.p=8,u.f(),t.f(8);case 9:this.updateLegends({style:this,resolution:r,z:o,viewScale:a});case 10:return t.a(2)}},t,this,[[1,7,8,9]])}),i=function(){var t=this,e=arguments;return new Promise(function(n,r){var i=o.apply(t,e);function a(t){nf(i,n,r,a,u,"next",t)}function u(t){nf(i,n,r,a,u,"throw",t)}a(void 0)})},function(t,e,n){return i.apply(this,arguments)})}],r&&rf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Lo);function ff(t){return ff="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},ff(t)}function sf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hf(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,yf(r.key),r)}}function yf(t){var e=function(t){if("object"!=ff(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ff(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ff(e)?e:e+""}function pf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(pf=function(){return!!t})()}function vf(t){return vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vf(t)}function df(t,e){return df=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},df(t,e)}var bf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=vf(e),function(t,e){if(e&&("object"==ff(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)}(t,pf()?Reflect.construct(e,n||[],vf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.value=t.value,n.targetResolution=t.targetResolution||function(t,e){return t/5},n.interpolatedProperty=t.interpolatedProperty||"value",n.nodataHandling=t.nodataHandling||"zero",n.styles=t.styles||[],n}return 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&&df(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),0!=t.length){var o=e.view.z,i=_a(t,n,function(t){return r.value(t)}),a=i.x0,u=i.y0,l=this.targetResolution(n,o),c=Math.round(n/l);l=n/c,i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"zero";if(1===e)return t;var r=t.length;if(0===r)return[];for(var o=t[0].length,i=r*e,a=o*e,u=Array(i).fill().map(function(){return Array(a).fill(void 0)}),l=e%2==0,c=0;c<i;c++)for(var f=Math.min(Math.floor(c/e),r-2),s=c%e/e,h=f*e+e/2,y=0;y<a;y++){var p=Math.min(Math.floor(y/e),o-2),v=y%e/e,d=p*e+e/2,b=t[f][p],m=t[f][p+1],g=t[f+1][p],w=t[f+1][p+1];if(l){if(void 0===b&&c<=h&&y<=d)continue;if(void 0===m&&c<=h&&y>=d)continue;if(void 0===g&&c>=h&&y<=d)continue;if(void 0===w&&c>=h&&y>=d)continue}else{if(void 0===b&&c<h&&y<d)continue;if(void 0===m&&c<h&&y>d)continue;if(void 0===g&&c>h&&y<d)continue;if(void 0===w&&c>h&&y>d)continue}if("zero"!==n)if(void 0===b||void 0===m||void 0===g||void 0===w)if(void 0!==b||void 0===m||void 0===g||void 0===w)if(void 0===b||void 0!==m||void 0===g||void 0===w)if(void 0===b||void 0===m||void 0!==g||void 0===w)if(void 0===b||void 0===m||void 0===g||void 0!==w)if(void 0===b||void 0===w)if(void 0===m||void 0===g)void 0===b||void 0===g?void 0===m||void 0===w?(void 0!==b&&void 0!==m&&(u[c][y]=m*v+b*(1-v)),void 0===g||void 0===w?void 0===b?void 0===m?void 0===g?void 0!==w&&(u[c][y]=w):u[c][y]=g:u[c][y]=m:u[c][y]=b:u[c][y]=w*v+g*(1-v)):u[c][y]=w*s+m*(1-s):u[c][y]=g*s+b*(1-s);else{var x=(1-v+s)*Math.SQRT1_2;u[c][y]=m*(1-x)+g*x}else{var S=(v+s)*Math.SQRT1_2;u[c][y]=b*(1-S)+w*S}else{var O=m+g;u[c][y]=mf(b,m,g,O/2,v,s)}else{var j=b+w;u[c][y]=mf(b,m,j/2,w,v,s)}else{var P=b+w;u[c][y]=mf(b,P/2,g,w,v,s)}else{var _=m+g;u[c][y]=mf(_/2,m,g,w,v,s)}else u[c][y]=mf(b,m,g,w,v,s);else u[c][y]=mf(b||0,m||0,g||0,w||0,v,s)}return u}(i,c,this.nodataHandling),t=[];for(var f=(n-l)/2,s=0;s<i.length;s++)for(var h=i[s],y=u-s*l+f,p=0;p<h.length;p++){var v=h[p];if(v){var d={x:a+p*l+f,y};d[this.interpolatedProperty]=v,t.push(d)}}var b,m=e.offscreenCtx,g=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 sf(t,e);var n={}.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)?sf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(this.styles);try{for(g.s();!(b=g.n()).done;){var w=b.value;w.visible&&!w.visible(o)||((w.alpha||w.blendOperation)&&(m.save(),w.alpha&&(m.globalAlpha=w.alpha(o)),w.blendOperation&&(m.globalCompositeOperation=w.blendOperation(o))),e.setCanvasTransform(),w.draw(t,e,l),w.filterColor&&w.drawFilter(e),(w.alpha||w.blendOperation)&&m.restore())}}catch(t){g.e(t)}finally{g.f()}}}}],r&&hf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lo),mf=function(t,e,n,r,o,i){var a=t+(e-t)*o;return a+(n+(r-n)*o-a)*i};function gf(t){return gf="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},gf(t)}function wf(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={}.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,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function xf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Sf(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,Of(r.key),r)}}function Of(t){var e=function(t){if("object"!=gf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=gf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gf(e)?e:e+""}function jf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(jf=function(){return!!t})()}function Pf(t){return Pf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pf(t)}function _f(t,e){return _f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_f(t,e)}var Tf=function(t){function e(t,n){var r,o=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,e),r=function(t,e,n){return e=Pf(e),function(t,e){if(e&&("object"==gf(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)}(t,jf()?Reflect.construct(e,n||[],Pf(t).constructor):e.apply(t,n))}(this,e,[o]),o=o||{},r.dataset=t,r.styles=n,r.minPixelsPerCell=o.minPixelsPerCell||3,r.cellInfoHTML=o.cellInfoHTML||e.defaultCellInfoHTML,r}return 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&&_f(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n){var r=t.view.z,o=t.offscreenCtx,i=this.getDataset(r);if(i){i.getData(t.extGeo),i.updateViewCache(t.extGeo),(this.alpha||this.blendOperation)&&(o.save(),this.alpha&&(o.globalAlpha=this.alpha(r)),this.blendOperation&&(o.globalCompositeOperation=this.blendOperation(r)));var a,u=wf(this.styles);try{for(u.s();!(a=u.n()).done;){var l=a.value;l.visible&&!l.visible(r)||((l.alpha||l.blendOperation)&&(o.save(),l.alpha&&(o.globalAlpha=l.alpha(r)),l.blendOperation&&(o.globalCompositeOperation=l.blendOperation(r))),t.setCanvasTransform(),l.draw(i.getViewCache(),t,i.getResolution()),l.filterColor&&l.drawFilter(t),(l.alpha||l.blendOperation)&&o.restore())}}catch(t){u.e(t)}finally{u.f()}if((this.alpha||this.blendOperation)&&o.restore(),n){var c,f=wf(this.styles);try{for(f.s();!(c=f.n()).done;){var s=c.value;if((!s.visible||s.visible(r))&&(e.addLegends(n,s.legends),s.styles)){var h,y=wf(s.styles);try{for(y.s();!(h=y.n()).done;){var p=h.value;p.visible&&!p.visible(r)||e.addLegends(n,p.legends)}}catch(t){y.e(t)}finally{y.f()}}}}catch(t){f.e(t)}finally{f.f()}}}}},{key:"getDataset",value:function(t){return this.dataset.getDataset(t,this.minPixelsPerCell)}},{key:"styles_",value:function(t){return 0===arguments.length?this.styles:(1===arguments.length?Array.isArray(t)?this.styles=t:this.styles=[t]:this.styles=arguments,this)}}],o=[{key:"addLegends",value:function(t,e){if(Array.isArray(e)){var n,r=wf(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;this.addLegends(t,o)}}catch(t){r.e(t)}finally{r.f()}}else t.node().append(e.div.node())}},{key:"defaultCellInfoHTML",value:function(t){for(var e=[],n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];"x"!==o&&"y"!==o&&e.push("<b>",o,"</b>"," : ",t[o],"<br>")}return e.join("")}}],r&&Sf(n.prototype,r),o&&Sf(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Ho);function kf(t){return kf="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},kf(t)}function Cf(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,Ef(r.key),r)}}function Ef(t){var e=function(t){if("object"!=kf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=kf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==kf(e)?e:e+""}function Af(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Af=function(){return!!t})()}function Mf(t){return Mf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mf(t)}function zf(t,e){return zf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zf(t,e)}var Rf=function(t){function e(t){var n;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Mf(e),function(t,e){if(e&&("object"==kf(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)}(t,Af()?Reflect.construct(e,n||[],Mf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.cache={},n.url=t.url,n.urlFun=t.urlFun||function(t,e,r){return n.url+r+"/"+t+"/"+e+".png"},n.resolutions=t.resolutions,!n.resolutions||0==n.resolutions.length)throw new Error("No resolutions provided for background layer");return n.nbPix=t.nbPix||256,n.origin=t.origin||[0,0],n.z0=t.z0||0,n.pixelationCoefficient=t.pixelationCoefficient||1,n}return 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&&zf(t,e)}(e,t),n=e,r=[{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.view.z,r=this.origin[0],o=this.origin[1],i=0;for(i=0;i<this.resolutions.length&&!(this.resolutions[i]<n*this.pixelationCoefficient);i++);i-=1,i=Math.max(0,i),i=Math.min(i,this.resolutions.length-1);var a=this.resolutions[i];i+=this.z0;for(var u=this.nbPix*a,l=u/n,c=function(t){return Math.ceil((t-r)/u)},f=function(t){return Math.ceil(-(t-o)/u)},s=c(t.extGeo.xMin)-1,h=c(t.extGeo.xMax),y=f(t.extGeo.yMin),p=f(t.extGeo.yMax)-1,v=function(n){for(var a=function(a){var c=e.get(i,n,a);if(!c){var f=new Image;return e.put(f,i,n,a),f.onload=function(){t.redraw()},f.onerror=function(){e.put("failed",i,n,a)},f.src=e.urlFun(n,a,i),0}if("failed"===c)return 0;if(!(c instanceof HTMLImageElement))return console.log(c),0;if(0==c.width||0==c.height)return 0;var s=r+n*u,h=o-a*u;try{t.initCanvasTransform(),t.offscreenCtx.drawImage(c,t.geoToPixX(s),t.geoToPixY(h),l,l)}catch(t){console.error(t)}},c=p;c<y;c++)a(c)},d=s;d<h;d++)v(d)}else console.error("No resolutions provided for background layer")}}],r&&Cf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ho);function If(t){return If="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},If(t)}function Ff(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,Bf(r.key),r)}}function Bf(t){var e=function(t){if("object"!=If(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=If(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==If(e)?e:e+""}function Lf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Lf=function(){return!!t})()}function Nf(t){return Nf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nf(t)}function Df(t,e){return Df=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Df(t,e)}var Gf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Nf(e),function(t,e){if(e&&("object"==If(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)}(t,Lf()?Reflect.construct(e,n||[],Nf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.img=void 0,n.xMin=void 0,n.xMax=void 0,n.yMin=void 0,n.yMax=void 0,n}return 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&&Df(t,e)}(e,t),n=e,(r=[{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.initCanvasTransform(),t.offscreenCtx.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}}}])&&Ff(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ho);function Wf(t){return Wf="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},Wf(t)}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,$f(r.key),r)}}function $f(t){var e=function(t){if("object"!=Wf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Wf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wf(e)?e:e+""}function Hf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Hf=function(){return!!t})()}function Xf(t){return Xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xf(t)}function Vf(t,e){return Vf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vf(t,e)}var qf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Xf(e),function(t,e){if(e&&("object"==Wf(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)}(t,Hf()?Reflect.construct(e,n||[],Xf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.xMin=t.xMin||0,n.yMax=t.yMax||0,n.width=t.width||2e4,n.height=t.height||2e4,n.img=void 0,n}return 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&&Vf(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){var e=this;if(this.img){var n=t.geoToPixX(this.xMin),r=t.geoToPixY(this.yMax),o=t.getView().z;t.initCanvasTransform(),t.offscreenCtx.drawImage(this.img,n,r,this.width/o,this.height/o)}else this.img||(this.img=new Image,this.img.onload=function(){t.redraw()},this.img.onerror=function(){console.warn("Could not retrieve background image from",e.url)}),this.img.src=this.url}}])&&Uf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ho);function Yf(t){return Yf="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},Yf(t)}function Zf(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return Jf(c,"_invoke",function(n,r,o){var i,u,l,c=0,f=o||[],s=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!s&&c&&!o&&e<f.length;e++){var o,i=f[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw s=!0,r}return function(o,f,p){if(c>1)throw TypeError("Generator is already running");for(s&&1===f&&y(f,p),u=f,l=p;(e=u<2?t:l)||!s;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(s=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:s}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(Jf(e={},r,function(){return this}),e),s=c.prototype=u.prototype=Object.create(f);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Jf(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return l.prototype=c,Jf(s,"constructor",c),Jf(c,"constructor",l),l.displayName="GeneratorFunction",Jf(c,o,"GeneratorFunction"),Jf(s),Jf(s,o,"Generator"),Jf(s,r,function(){return this}),Jf(s,"toString",function(){return"[object Generator]"}),(Zf=function(){return{w:i,m:h}})()}function Jf(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Jf=function(t,e,n,r){function i(e,n){Jf(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Jf(t,e,n,r)}function Qf(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function Kf(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 ts(t,e);var n={}.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)?ts(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function ts(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function es(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,ns(r.key),r)}}function ns(t){var e=function(t){if("object"!=Yf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yf(e)?e:e+""}function rs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(rs=function(){return!!t})()}function os(t){return os=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},os(t)}function is(t,e){return is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},is(t,e)}var as=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=os(e),function(t,e){if(e&&("object"==Yf(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)}(t,rs()?Reflect.construct(e,n||[],os(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.style=t.style||function(){return"1.2em Arial"},n.color=t.color||(t.dark?function(){return"white"}:function(){return"black"}),n.haloColor=t.haloColor||(t.dark?function(){return"black"}:function(){return"white"}),n.haloWidth=t.haloWidth||function(){return 2.5},n.textAlign=t.textAlign||"start",n.offsetPix=t.offsetPix||[5,5],n.preprocess=t.preprocess,n.labels=void 0,n.loadingStatus="notLoaded",n}return 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&&is(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.labels){var e=t.view.z,n=t.offscreenCtx;n.textAlign=this.textAlign||"start",n.lineJoin="bevel",n.lineCap="butt",t.initCanvasTransform();var r,o=Kf(this.labels);try{for(o.s();!(r=o.n()).done;){var i=r.value,a=this.style(i,e);if(a&&(n.font=a,t.toDraw(i))){var u=t.geoToPixX(i.x)+this.offsetPix[0],l=t.geoToPixY(i.y)-this.offsetPix[1];if(this.haloColor&&this.haloWidth){var c=this.haloColor(i,e),f=this.haloWidth(i,e);c&&f&&f>0&&(n.strokeStyle=c,n.lineWidth=f,n.strokeText(i.name,u,l))}if(this.color){var s=this.color(i,e);s&&(n.fillStyle=s,n.fillText(i.name,u,l))}}}}catch(t){o.e(t)}finally{o.f()}}else this.load(t.redraw)}},{key:"load",value:(o=Zf().m(function t(e){var n,r,o,i,a;return Zf().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.url){t.n=1;break}return console.log("Failed loading labels: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.a(2);case 1:if("notLoaded"==this.loadingStatus){t.n=2;break}return t.a(2);case 2:return this.loadingStatus="loading",t.p=3,t.n=4,Si(this.url);case 4:if(n=t.v,!this.preprocess){t.n=13;break}this.labels=[],r=Kf(n),t.p=5,r.s();case 6:if((o=r.n()).done){t.n=9;break}if(i=o.value,0!=this.preprocess(i)){t.n=7;break}return t.a(3,8);case 7:this.labels.push(i);case 8:t.n=6;break;case 9:t.n=11;break;case 10:t.p=10,a=t.v,r.e(a);case 11:return t.p=11,r.f(),t.f(11);case 12:t.n=14;break;case 13:this.labels=n;case 14:this.loadingStatus="loaded",e&&e(),t.n=16;break;case 15:t.p=15,t.v,console.log("Failed loading labels from "+this.url),this.labels=[],this.loadingStatus="failed";case 16:return t.a(2)}},t,this,[[5,10,11,12],[3,15]])}),i=function(){var t=this,e=arguments;return new Promise(function(n,r){var i=o.apply(t,e);function a(t){Qf(i,n,r,a,u,"next",t)}function u(t){Qf(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&es(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Ho);function us(t){return us="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},us(t)}function ls(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,c=Object.create(l.prototype);return cs(c,"_invoke",function(n,r,o){var i,u,l,c=0,f=o||[],s=!1,h={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,l=t,h.n=n,a}};function y(n,r){for(u=n,l=r,e=0;!s&&c&&!o&&e<f.length;e++){var o,i=f[e],y=h.p,p=i[2];n>3?(o=p===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,h.v=r,h.n=i[1]):y<p&&(o=n<3||i[0]>r||r>p)&&(i[4]=n,i[5]=r,h.n=p,u=0))}if(o||n>1)return a;throw s=!0,r}return function(o,f,p){if(c>1)throw TypeError("Generator is already running");for(s&&1===f&&y(f,p),u=f,l=p;(e=u<2?t:l)||!s;){i||(u?u<3?(u>1&&(h.n=-1),y(u,l)):h.n=l:h.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(s=h.n<0)?l:n.call(r,h))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:s}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(cs(e={},r,function(){return this}),e),s=c.prototype=u.prototype=Object.create(f);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,cs(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return l.prototype=c,cs(s,"constructor",c),cs(c,"constructor",l),l.displayName="GeneratorFunction",cs(c,o,"GeneratorFunction"),cs(s),cs(s,o,"Generator"),cs(s,r,function(){return this}),cs(s,"toString",function(){return"[object Generator]"}),(ls=function(){return{w:i,m:h}})()}function cs(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}cs=function(t,e,n,r){function i(e,n){cs(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},cs(t,e,n,r)}function fs(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function ss(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 hs(t,e);var n={}.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)?hs(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function hs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ys(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,ps(r.key),r)}}function ps(t){var e=function(t){if("object"!=us(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=us(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==us(e)?e:e+""}function vs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vs=function(){return!!t})()}function ds(t){return ds=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ds(t)}function bs(t,e){return bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bs(t,e)}var ms=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ds(e),function(t,e){if(e&&("object"==us(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)}(t,vs()?Reflect.construct(e,n||[],ds(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.preprocess=t.preprocess,n.shape=t.shape||function(t,e){return"circle"},n.size=t.size||function(t,e){return 10},n.strokeStyle=t.strokeStyle||t.color||function(t,e){return"gray"},n.lineWidth=t.lineWidth||t.width||function(t,e){return 2},n.lineDash=t.lineDash||function(t,e){},n.fillStyle=t.fillStyle||function(t,e){return"black"},n.fs=void 0,n.loadingStatus="notLoaded",n}return 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&&bs(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.fs){var e,n=t.view.z,r=t.offscreenCtx,o=ss(this.fs);try{for(o.s();!(e=o.n()).done;){var i=e.value;this.drawGeometry(i,i.geometry,i.geometry.type,n,r)}}catch(t){o.e(t)}finally{o.f()}}else this.load(t.redraw)}},{key:"drawGeometry",value:function(t,e,n,r,o){if("Point"==n||"MultiPoint"==n){var i=this.shape(t,r);if(!i||"none"==i)return;var a=this.size(t,r)*r;if(!a)return;var u=this.strokeStyle(t,r),l=this.fillStyle(t,r),c=this.lineWidth(t,r)*r;o.save(),u&&(o.strokeStyle=u),l&&(o.fillStyle=l),c&&(o.lineWidth=c);var f=e.coordinates;if("Point"==n&&(f=[f]),"circle"==i){var s,h=ss(f);try{for(h.s();!(s=h.n()).done;){var y=s.value;o.beginPath(),o.arc(y[0],y[1],a/2,0,2*Math.PI,!1),l&&o.fill(),u&&c&&o.stroke()}}catch(t){h.e(t)}finally{h.f()}}else if("square"==i){var p,v=ss(f);try{for(v.s();!(p=v.n()).done;){var d=p.value;o.beginPath(),o.rect(d[0]-a/2,d[1]-a/2,a,a),l&&o.fill(),u&&c&&o.stroke()}}catch(t){v.e(t)}finally{v.f()}}else console.error("Unexpected shape for point GeoJSON: "+i);o.restore()}else if("LineString"==n||"MultiLineString"==n){var b=this.strokeStyle(t,r);if(!b||"none"===b)return;var m=this.lineWidth(t,r);if(!m||m<0)return;o.save(),o.strokeStyle=b,o.lineWidth=m*r,o.setLineDash(this.lineDash(t,r)||[]);var g,w=ss("LineString"===n?[e.coordinates]:e.coordinates);try{for(w.s();!(g=w.n()).done;){var x=g.value;if(!(x.length<2)){o.beginPath(),o.moveTo(x[0][0],x[0][1]);for(var S=1;S<x.length;S++)o.lineTo(x[S][0],x[S][1]);o.stroke()}}}catch(t){w.e(t)}finally{w.f()}o.restore()}else if("Polygon"==n||"MultiPolygon"==n){o.save();var O="Polygon"===n?[e.coordinates]:e.coordinates;o.beginPath();var j,P=ss(O);try{for(P.s();!(j=P.n()).done;){var _,T=ss(j.value);try{for(T.s();!(_=T.n()).done;){var k=_.value;if(!(k.length<2)){o.moveTo(k[0][0],k[0][1]);for(var C=1;C<k.length;C++)o.lineTo(k[C][0],k[C][1]);o.closePath()}}}catch(t){T.e(t)}finally{T.f()}}}catch(t){P.e(t)}finally{P.f()}var E=this.fillStyle(t,r);E&&"none"!==E&&(o.fillStyle=E,o.fill("evenodd"));var A=this.lineWidth(t,r);if(A&&A>0){var M,z,R,I=null!==(M=null===(z=this.strokeStyle)||void 0===z?void 0:z.call(this,t,r))&&void 0!==M?M:E;I&&"none"!==I&&(o.strokeStyle=I,o.lineWidth=A*r,o.setLineDash((null===(R=this.lineDash)||void 0===R?void 0:R.call(this,t,r))||[]),o.stroke())}o.restore()}else if("GeometryCollection"==n){var F,B=ss(e.geometries);try{for(B.s();!(F=B.n()).done;){var L=F.value;this.drawGeometry(t,L,L.type,r,o)}}catch(t){B.e(t)}finally{B.f()}}else console.log("Unexpected geometry type in GeoJSONLayer: "+n)}},{key:"load",value:(o=ls().m(function t(e){var n,r,o,i,a,u;return ls().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.url){t.n=1;break}return console.log("Failed loading GeoJSON data: No URL specified. "+this.url),this.loadingStatus="failed",this.labels=[],t.a(2);case 1:if("notLoaded"==this.loadingStatus){t.n=2;break}return t.a(2);case 2:return this.loadingStatus="loading",t.p=3,t.n=4,oi(this.url);case 4:if(n=t.v,r=n.features,!this.preprocess){t.n=13;break}this.fs=[],o=ss(r),t.p=5,o.s();case 6:if((i=o.n()).done){t.n=9;break}if(a=i.value,0!=this.preprocess(a)){t.n=7;break}return t.a(3,8);case 7:this.fs.push(a);case 8:t.n=6;break;case 9:t.n=11;break;case 10:t.p=10,u=t.v,o.e(u);case 11:return t.p=11,o.f(),t.f(11);case 12:t.n=14;break;case 13:this.fs=r;case 14:this.loadingStatus="loaded",e&&e(),t.n=16;break;case 15:t.p=15,t.v,console.log("Failed loading GeoJSON from "+this.url),this.fs=[],this.loadingStatus="failed";case 16:return t.a(2)}},t,this,[[5,10,11,12],[3,15]])}),i=function(){var t=this,e=arguments;return new Promise(function(n,r){var i=o.apply(t,e);function a(t){fs(i,n,r,a,u,"next",t)}function u(t){fs(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&ys(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Ho);function gs(t){return gs="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},gs(t)}function ws(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,xs(r.key),r)}}function xs(t){var e=function(t){if("object"!=gs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=gs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gs(e)?e:e+""}var Ss=function(){return t=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.id&&(this.div=Yt("#"+this.id)),this.div&&!this.div.empty()||(this.div=Yt(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.title=e.title,this.titleFontSize=e.titleFontSize||"0.8em",this.titleFontWeight=e.titleFontWeight||"bold",this.labelFontSize=e.labelFontSize||"0.8em",this.labelUnitText=e.labelUnitText||"",this.labelFormat=e.labelFormat},e=[{key:"makeTitle",value:function(){this.title&&this.div.append("div").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).style("margin-bottom","7px").text(this.title)}},{key:"style",value:function(t,e){return 1==arguments.length?this.div.style(t):(this.div.style(t,e),this)}},{key:"update",value:function(){console.error("Legend update not implemented yet.")}}],e&&ws(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Os(t){return Os="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},Os(t)}function js(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,Ps(r.key),r)}}function Ps(t){var e=function(t){if("object"!=Os(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Os(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Os(e)?e:e+""}function _s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_s=function(){return!!t})()}function Ts(t){return Ts=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ts(t)}function ks(t,e){return ks=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ks(t,e)}var Cs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ts(e),function(t,e){if(e&&("object"==Os(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)}(t,_s()?Reflect.construct(e,n||[],Ts(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colorScale=t.colorScale,n.textScale=t.textScale||function(t){return t},n.margin=t.margin||5,n.tickSize=t.tickSize||6,n.ticks=t.ticks||Math.floor(n.width/50),n.tickFormat=t.tickFormat,n.tickUnit=t.tickUnit,n.fontSize=t.fontSize||"0.8em",n.invert=t.invert,n.width=t.width||300,n.height=t.height||15,n}return 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&&ks(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();for(var e=this.width+2*this.margin,n=this.height+this.margin+this.tickSize+10,r=this.div.append("svg").attr("width",e).attr("height",n).append("g").attr("transform","translate("+this.margin+" 0)"),o=this.width,i=this.height,a=0;a<o;a+=5){var u=a/(o-1);this.invert&&(u=1-u),r.append("rect").attr("x",a).attr("y",0).attr("width",5).attr("height",i).style("fill",this.colorScale(u,t.viewScale))}for(var l=0;l<this.ticks;l++){var c=l/(this.ticks-1);r.append("line").attr("x1",o*c).attr("y1",0).attr("x2",o*c).attr("y2",i+this.tickSize).style("stroke","black"),r.append("text").attr("id","ticklabel_"+l).attr("x",o*c).attr("y",i+this.tickSize+2).style("font-size",this.fontSize).style("text-anchor",0==l?"start":l==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?this.tickFormat:function(t){return t},s=0;s<this.ticks;s++){var h=s/(this.ticks-1),y=this.textScale(h,t.viewScale),p=(y?f(y):"0")+(this.tickUnit?this.tickUnit:"");null!=p&&this.div.select("#ticklabel_"+s).text(p)}}}],r&&js(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ss);function Es(t){return Es="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},Es(t)}function As(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,Ms(r.key),r)}}function Ms(t){var e=function(t){if("object"!=Es(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Es(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Es(e)?e:e+""}function zs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zs=function(){return!!t})()}function Rs(t){return Rs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rs(t)}function Is(t,e){return Is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Is(t,e)}var Fs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Rs(e),function(t,e){if(e&&("object"==Es(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)}(t,zs()?Reflect.construct(e,n||[],Rs(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colors=t.colors,n.breaks=t.breaks,n.width=t.width||300,n.height=t.height||15,n.tickSize=t.tickSize||3,n.invert=t.invert,n}return 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&&Is(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.colors(t.viewScale),n=this.breaks(t.viewScale);if(n){var r=e.length;if(0!=r){for(var o=this.width/r,i=this.div.append("svg").attr("width",this.width).attr("height",this.height+this.tickSize+2+10),a=0;a<r;a++)i.append("rect").attr("x",a*o).attr("y",0).attr("width",o).attr("height",this.height).style("fill",e[a]);for(var u=1;u<r;u++)i.append("line").attr("x1",o*u).attr("y1",0).attr("x2",o*u).attr("y2",this.height+this.tickSize).style("stroke","black");for(var l=1;l<r;l++){var c=n[l-1];isNaN(c)||null==c||(this.labelFormat&&(c=this.labelFormat(c,l)),i.append("text").attr("id","ticklabel_"+l).attr("x",o*l).attr("y",this.height+this.tickSize+2).style("font-size",this.labelFontSize).style("text-anchor","middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(c))}}}}}])&&As(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ss);function Bs(t){return Bs="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},Bs(t)}function Ls(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,Ns(r.key),r)}}function Ns(t){var e=function(t){if("object"!=Bs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Bs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Bs(e)?e:e+""}function Ds(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ds=function(){return!!t})()}function Gs(t){return Gs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gs(t)}function Ws(t,e){return Ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ws(t,e)}var Us=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Gs(e),function(t,e){if(e&&("object"==Bs(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)}(t,Ds()?Reflect.construct(e,n||[],Gs(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colorLabel=t.colorLabel||[["gray","-"]],n.shape=t.shape||"circle",n.dimension=t.dimension||{r:8},n.strokeColor=t.strokeColor||"gray",n.strokeWidth=t.strokeWidth||1,n}return 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&&Ws(t,e)}(e,t),n=e,(r=[{key:"update",value:function(){this.div.selectAll("*").remove(),this.makeTitle();var t=this.colorLabel.length;if(0!=t)for(var e=0;e<t;e++){var n=this.colorLabel[e],r=this.div.append("div"),o=this.strokeWidth;if("square"===this.shape){var i=this.dimension.h||15,a=this.dimension.w||20;r.append("div").style("display","inline").append("svg").attr("width",a+2*o).attr("height",i+2*o).append("rect").attr("x",o).attr("y",o).attr("width",a).attr("height",i).style("fill",n[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,l=2*u+2*o;r.append("div").style("display","inline").append("svg").attr("width",l).attr("height",l).append("circle").attr("cx",u+o).attr("cy",u+o).attr("r",u).style("fill",n[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}r.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(n[1])}}}])&&Ls(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ss);function $s(t){return $s="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},$s(t)}function Hs(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 Xs(t,e);var n={}.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)?Xs(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Xs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Vs(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,qs(r.key),r)}}function qs(t){var e=function(t){if("object"!=$s(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$s(e)?e:e+""}function Ys(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ys=function(){return!!t})()}function Zs(t){return Zs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zs(t)}function Js(t,e){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Js(t,e)}var Qs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Zs(e),function(t,e){if(e&&("object"==$s(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)}(t,Ys()?Reflect.construct(e,n||[],Zs(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.label=t.label||void 0,n.size=t.size||void 0,n.shape=t.shape||"circle",n.fillColor=t.fillColor||"none",n.strokeColor=t.strokeColor||"gray",n.strokeWidth=t.strokeWidth||1,n.color=t.color||"gray",n.length=t.length||function(t,e,n){return t},n}return 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&&Js(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n,r=this.label(t.viewScale,t.cells,t.resolution,t.z);if(n=this.size?this.size(t.viewScale,t.resolution,t.z)/t.z:t.viewScale(+r)/t.z){this.labelFormat&&!isNaN(+r)&&(r=this.labelFormat(r));var o=this.div.append("div"),i=function(){return o.append("svg").attr("width",n+e.strokeWidth+2).attr("height",n+e.strokeWidth+2).style("","inline-block")};if("square"===this.shape)i().append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",n).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth);else if("circle"===this.shape){var a=.5*(n+this.strokeWidth);i().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);else{if("line"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var u=this.length?this.length(t.resolution,t.z,t.viewScale):t.resolution;u/=t.z,o.append("svg").attr("width",u).attr("height",n).style("","inline-block").append("line").attr("x1",0).attr("y1",n/2).attr("x2",u).attr("y2",n/2).style("stroke",this.color).style("stroke-width",n)}o.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(r+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&Vs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ss);function Ks(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=[],i=Hs(t);try{var a=function(){var i=n.value;r.title=i==t[0]?r.title:void 0,r.size=function(){return e(i)},r.label=function(){return i},o.push(new Qs(r))};for(i.s();!(n=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function th(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.k||[.9,.5,.2,.05],o=[],i=Hs(r);try{var a=function(){var i=e.value;n.title=i==r[0]?n.title:void 0,n.label=function(e,n){return Pa(i*Du(n,t))},o.push(new Qs(n))};for(i.s();!(e=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function eh(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.labelFormat||function(t){return t},o=n.labelText||rh(r),i=[],a=function(r){n.title=r==e.length-1?n.title:void 0,n.size=function(){return e[r]},n.label=function(){return o(t[r-1],t[r])},i.push(new Qs(n))},u=e.length-1;u>=0;u--)a(u);return i}function nh(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.labelFormat||function(t){return t},r=e.labelText||rh(n),o=[],i=e.viewScaleFun||function(t){return t},a=function(n){e.title=n==t-1?e.title:void 0,e.size=function(t){return i(t).values[n]},e.label=function(t){return r(i(t).breaks[n-1],i(t).breaks[n])},o.push(new Qs(e))},u=t-1;u>=0;u--)a(u);return o}function rh(t){return function(e,n){return null==e&&null==n?"":null==n?"> "+t(e):null==e?"< "+t(n):t(e)+" - "+t(n)}}function oh(t){return oh="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},oh(t)}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,ah(r.key),r)}}function ah(t){var e=function(t){if("object"!=oh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=oh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oh(e)?e:e+""}function uh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(uh=function(){return!!t})()}function lh(t){return lh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lh(t)}function ch(t,e){return ch=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ch(t,e)}var fh=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=lh(e),function(t,e){if(e&&("object"==oh(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)}(t,uh()?Reflect.construct(e,n||[],lh(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.orientation=t.orientation||0,n.color=t.color||function(t,e,n){return"gray"},n.width=t.width||function(t,e,n){return 3*e},n.length=t.length||function(t,e,n){return t},n.label=t.label||"-",n}return 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&&ch(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.div.append("div"),n=this.color(t.resolution,t.z,t.viewScale),r=this.width(t.resolution,t.z,t.viewScale)/t.z,o=this.length(t.resolution,t.z,t.viewScale)/t.z,i=Math.max(o,r),a=e.append("svg").attr("width",i).attr("height",i).style("","inline-block"),u=Math.cos(-this.orientation*Math.PI/180),l=Math.sin(-this.orientation*Math.PI/180),c=.5*i,f=.5*o;a.append("line").attr("x1",c-u*f).attr("y1",c-l*f).attr("x2",c+u*f).attr("y2",c+l*f).style("stroke",n).style("stroke-width",r),e.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(this.label+(this.labelUnitText?" ":"")+this.labelUnitText)}}],r&&ih(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ss);function sh(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=[],o=0;o<t.length;o++)n.title=0==o?n.title:void 0,n.orientation=t[o],n.label=e[o],r.push(new fh(n));return r}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 yh(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,ph(r.key),r)}}function ph(t){var e=function(t){if("object"!=hh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hh(e)?e:e+""}function vh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vh=function(){return!!t})()}function dh(t){return dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dh(t)}function bh(t,e){return bh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bh(t,e)}var mh=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=dh(e),function(t,e){if(e&&("object"==hh(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)}(t,vh()?Reflect.construct(e,n||[],dh(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.classifier=t.classifier,n.width=t.width||150,n.selectionColor=t.selectionColor||"red",n.tooltip=t.tooltip,n.texts=t.texts,n.leftText=t.leftText||"Category 0",n.topText=t.topText||"Category 1",n.rightText=t.rightText||"Category 2",n.centerCoefficient=t.centerCoefficient||n.classifier.centerCoefficient,n}return 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&&bh(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.width,n=.866025*e,r=this.classifier,o=this.selectionColor,i=this.tooltip,a=this.texts||{},u=this.div.append("svg").attr("width",e+0).attr("height",n+8+24);u.append("text").attr("x",e/2).attr("y",14).text(this.topText).attr("font-size",12).attr("text-anchor","middle"),u.append("text").attr("x",0).attr("y",30+n).text(this.leftText).attr("font-size",12).attr("text-anchor","start"),u.append("text").attr("x",e).attr("y",30+n).text(this.rightText).attr("font-size",12).attr("text-anchor","end");var l=u.append("g").attr("transform","translate(0 16)"),c=function(t,e,n){t.attr("fill",e).on("mouseover",function(t){Yt(this).attr("fill",o),i&&n&&(i.html(n),i.setPosition(t),i.show())}).on("mouseout",function(){Yt(this).attr("fill",e),i&&i.hide()}),i&&n&&t.on("mousemove",function(t){i.setPosition(t)})};c(l.append("polygon").attr("points","0,"+n+" "+e/3+","+n+" "+e/2+","+2*n/3+" "+e/6+","+2*n/3),r.colors[0],a[0]),c(l.append("polygon").attr("points",e/2+",0 "+2*e/3+","+n/3+" "+e/2+","+2*n/3+" "+e/3+","+n/3),r.colors[1],a[1]),c(l.append("polygon").attr("points",e+","+n+" "+5*e/6+","+2*n/3+" "+e/2+","+2*n/3+" "+2*e/3+","+n),r.colors[2],a[2]),c(l.append("polygon").attr("points",e/2+","+2*n/3+" "+5*e/6+","+2*n/3+" "+2*e/3+","+n/3),r.mixColors[0],a.m12),c(l.append("polygon").attr("points",e/2+","+2*n/3+" "+e/3+","+n+" "+2*e/3+","+n),r.mixColors[1],a.m02),c(l.append("polygon").attr("points",e/2+","+2*n/3+" "+e/6+","+2*n/3+" "+e/3+","+n/3),r.mixColors[2],a.m01),this.centerCoefficient&&c(l.append("circle").attr("cx",e/2).attr("cy",2*n/3).attr("r",this.centerCoefficient*n/3),r.centerColor,a.center)}}],r&&yh(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ss),gh=function(t){return t};gh.invert=gh;var wh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return gh;var e=Math.exp(t)-1,n=function(n){return(Math.exp(n*t)-1)/e};return n.invert=function(n){return Math.log(e*n+1)/t},n},xh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return gh;var e=Math.exp(t),n=1-e,r=function(r){return 1-Math.log(e+r*n)/t};return r.invert=function(r){return(Math.exp((1-r)*t)-e)/n},r},Sh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return gh;var e=function(e){return Math.pow(e,t)},n=1/t;return e.invert=function(t){return Math.pow(t,n)},e},Oh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return gh;var e=1/t,n=function(t){return 1-Math.pow(1-t,e)};return n.invert=function(e){return 1-Math.pow(1-e,t)},n},jh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return gh;if(1==t)return function(t){return Math.sqrt(t*(2-t))};var e=t/(1-t);return function(t){return Math.sqrt(1/(e*e)+t*(2/e+2-t))-1/e}},Ph=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return gh;var e=jh(t);return function(t){return 1-e(1-t)}};const _h=Math.PI/180,Th=180/Math.PI,kh=.96422,Ch=.82521,Eh=4/29,Ah=6/29,Mh=3*Ah*Ah,zh=Ah*Ah*Ah;function Rh(t){if(t instanceof Fh)return new Fh(t.l,t.a,t.b,t.opacity);if(t instanceof Gh)return Wh(t);t instanceof jn||(t=Sn(t));var e,n,r=Dh(t.r),o=Dh(t.g),i=Dh(t.b),a=Bh((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?e=n=a:(e=Bh((.4360747*r+.3850649*o+.1430804*i)/kh),n=Bh((.0139322*r+.0971045*o+.7141733*i)/Ch)),new Fh(116*a-16,500*(e-a),200*(a-n),t.opacity)}function Ih(t,e,n,r){return 1===arguments.length?Rh(t):new Fh(t,e,n,null==r?1:r)}function Fh(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Bh(t){return t>zh?Math.pow(t,1/3):t/Mh+Eh}function Lh(t){return t>Ah?t*t*t:Mh*(t-Eh)}function Nh(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Dh(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Gh(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function Wh(t){if(isNaN(t.h))return new Fh(t.l,0,0,t.opacity);var e=t.h*_h;return new Fh(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}function Uh(t,e){var n=Dn((t=Ih(t)).l,(e=Ih(e)).l),r=Dn(t.a,e.a),o=Dn(t.b,e.b),i=Dn(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=o(e),t.opacity=i(e),t+""}}function $h(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Hh(t,e);var n={}.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)?Hh(t,e):void 0}}(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 Hh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}tn(Fh,Ih,en(nn,{brighter(t){return new Fh(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Fh(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new jn(Nh(3.1338561*(e=kh*Lh(e))-1.6168667*(t=1*Lh(t))-.4906146*(n=Ch*Lh(n))),Nh(-.9787684*e+1.9161415*t+.033454*n),Nh(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),tn(Gh,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Gh)return new Gh(t.h,t.c,t.l,t.opacity);if(t instanceof Fh||(t=Rh(t)),0===t.a&&0===t.b)return new Gh(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Th;return new Gh(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Gh(t,e,n,null==r?1:r)},en(nn,{brighter(t){return new Gh(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new Gh(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return Wh(this).rgb()}}));var Xh=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t[0],o=t[1],i=t[2],a=$h(n.center||[1/3,1/3,1/3],3),u=a[0],l=a[1],c=a[2],f=null==n.withMixedClasses||n.withMixedClasses,s=n.centerCoefficient?1-n.centerCoefficient:void 0,h=function(t){var n=e(t);if(n){var a=+t[r]/n,h=+t[o]/n,y=+t[i]/n;return a>=u&&h<=l&&y<=c?null!=s&&(y-c)*(l-s*l)>=(h-s*l)*(s*c-c)?"center":"0":a<=u&&h>=l&&y<=c?null!=s&&(y-c)*(u-s*u)>=(a-s*u)*(s*c-c)?"center":"1":a<=u&&h<=l&&y>=c?null!=s&&(h-l)*(u-s*u)>=(a-s*u)*(s*l-l)?"center":"2":a<=u&&h>=l&&y>=c?null!=s&&a>s*u?"center":f?"m12":h>y?"1":"2":a>=u&&h<=l&&y>=c?null!=s&&h>s*l?"center":f?"m02":a>y?"0":"2":a>=u&&h>=l&&y<=c?null!=s&&y>s*c?"center":f?"m01":h>a?"1":"0":"unknown"}};return h.center=[u,l,c],h.centerCoefficient=n.centerCoefficient,h},Vh=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=$h(n||["red","green","blue"],3),i=o[0],a=o[1],u=o[2],l=r.colorInterpolation||Uh,c=null==r.withMixedClasses||r.withMixedClasses,f=function(t,e){return l(t,e)(.5)},s=$h(r.mixedColors||c?[f(a,u),f(i,u),f(i,a)]:[],3),h=s[0],y=s[1],p=s[2],v=r.centerColor||l(f(i,a),u)(.333),d=Xh(t,e,r),b=function(t){var e=d(t);return"0"==e?i:"1"==e?a:"2"==e?u:"m12"==e?h:"m02"==e?y:"m01"==e?p:"center"==e?v:r.defaultColor||"black"};return b.center=d.center,b.centerCoefficient=r.centerCoefficient,b.colors=[i,a,u],b.mixColors=[h,y,p],b.centerColor=v,b.classifier=d,b};function qh(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Yh(t,e){if(!isFinite(t)||0===t)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Zh(t){return(t=Yh(Math.abs(t)))?t[1]:NaN}function Jh(t,e){return function(n,r){for(var o=n.length,i=[],a=0,u=t[0],l=0;o>0&&u>0&&(l+u+1>r&&(u=Math.max(1,r-l)),i.push(n.substring(o-=u,o+u)),!((l+=u+1)>r));)u=t[a=(a+1)%t.length];return i.reverse().join(e)}}function Qh(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}Object.defineProperty(qh,"name",{value:"default",configurable:!0}),Object.defineProperty(Zh,"name",{value:"default",configurable:!0}),Object.defineProperty(Jh,"name",{value:"default",configurable:!0}),Object.defineProperty(Qh,"name",{value:"default",configurable:!0});var Kh,ty=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ey(t){if(!(e=ty.exec(t)))throw new Error("invalid format: "+t);var e;return new ny({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 ny(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 ry(t){t:for(var e,n=t.length,r=1,o=-1;r<n;++r)switch(t[r]){case".":o=e=r;break;case"0":0===o&&(o=r),e=r;break;default:if(!+t[r])break t;o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}function oy(t,e){var n=Yh(t,e);if(!n)return Kh=void 0,t.toPrecision(e);var r=n[0],o=n[1],i=o-(Kh=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,a=r.length;return i===a?r:i>a?r+new Array(i-a+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Yh(t,Math.max(0,e+i-1))[0]}function iy(t,e){var n=Yh(t,e);if(!n)return t+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}ey.prototype=ny.prototype,ny.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},Object.defineProperty(ry,"name",{value:"default",configurable:!0}),Object.defineProperty(oy,"name",{value:"default",configurable:!0}),Object.defineProperty(iy,"name",{value:"default",configurable:!0});const ay={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:qh,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)=>iy(100*t,e),r:iy,s:oy,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function uy(t){return t}Object.defineProperty(uy,"name",{value:"default",configurable:!0}),Object.defineProperty(sy,"name",{value:"default",configurable:!0});var ly,cy=Array.prototype.map,fy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function sy(t){var e=void 0===t.grouping||void 0===t.thousands?uy:Jh(cy.call(t.grouping,Number),t.thousands+""),n=void 0===t.currency?"":t.currency[0]+"",r=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",i=void 0===t.numerals?uy:Qh(cy.call(t.numerals,String)),a=void 0===t.percent?"%":t.percent+"",u=void 0===t.minus?"−":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function c(t,c){var f=(t=ey(t)).fill,s=t.align,h=t.sign,y=t.symbol,p=t.zero,v=t.width,d=t.comma,b=t.precision,m=t.trim,g=t.type;"n"===g?(d=!0,g="g"):ay[g]||(void 0===b&&(b=12),m=!0,g="g"),(p||"0"===f&&"="===s)&&(p=!0,f="0",s="=");var w=(c&&void 0!==c.prefix?c.prefix:"")+("$"===y?n:"#"===y&&/[boxX]/.test(g)?"0"+g.toLowerCase():""),x=("$"===y?r:/[%p]/.test(g)?a:"")+(c&&void 0!==c.suffix?c.suffix:""),S=ay[g],O=/[defgprs%]/.test(g);function j(t){var n,r,a,c=w,y=x;if("c"===g)y=S(t)+y,t="";else{var j=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:S(Math.abs(t),b),m&&(t=ry(t)),j&&0===+t&&"+"!==h&&(j=!1),c=(j?"("===h?h:u:"-"===h||"("===h?"":h)+c,y=("s"!==g||isNaN(t)||void 0===Kh?"":fy[8+Kh/3])+y+(j&&"("===h?")":""),O)for(n=-1,r=t.length;++n<r;)if(48>(a=t.charCodeAt(n))||a>57){y=(46===a?o+t.slice(n+1):t.slice(n))+y,t=t.slice(0,n);break}}d&&!p&&(t=e(t,1/0));var P=c.length+t.length+y.length,_=P<v?new Array(v-P+1).join(f):"";switch(d&&p&&(t=e(_+t,_.length?v-y.length:1/0),_=""),s){case"<":t=c+t+y+_;break;case"=":t=c+_+t+y;break;case"^":t=_.slice(0,P=_.length>>1)+c+t+y+_.slice(P);break;default:t=_+c+t+y}return i(t)}return b=void 0===b?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),j.toString=function(){return t+""},j}return{format:c,formatPrefix:function(t,e){var n=3*Math.max(-8,Math.min(8,Math.floor(Zh(e)/3))),r=Math.pow(10,-n),o=c(((t=ey(t)).type="f",t),{suffix:fy[8+n/3]});return function(t){return o(r*t)}}}}function hy(t){return(ly=sy(t)).format,ly.formatPrefix,ly}hy({thousands:",",grouping:[3],currency:["$",""]});var yy=Zr.getParameterByName;return hy({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.gridviz=e():t.gridviz=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 o(){return[]}function i(t){return null==t?o:function(){return this.querySelectorAll(t)}}function a(t){return function(){return this.matches(t)}}function u(t){return function(e){return e.matches(t)}}t.r(e),t.d(e,{BackgroundLayer:()=>If,BackgroundLayerImage:()=>Zf,BackgroundLayerWMS:()=>Wf,CSVGrid:()=>$a,ColorCategoryLegend:()=>Wh,ColorDiscreteLegend:()=>Ih,ColorLegend:()=>Th,CompositionStyle:()=>Du,Dataset:()=>Ki,DotDensityStyle:()=>bc,GeoCanvas:()=>Jo,GeoJSONLayer:()=>mh,GridLayer:()=>Tf,ImageStyle:()=>ff,Interpolator:()=>gf,IsoFenceStyle:()=>Qs,JSGrid:()=>tu,JoyPlotStyle:()=>Cu,LabelLayer:()=>uh,Layer:()=>Yi,LegoStyle:()=>rs,Map:()=>ji,MosaicStyle:()=>Os,MultiResolutionDataset:()=>ia,NinjaStarStyle:()=>Ms,OrientationLegend:()=>sy,PillarStyle:()=>fl,SegmentStyle:()=>Vu,ShadingRayStyle:()=>Wl,ShadingStyle:()=>Xl,ShapeColorSizeStyle:()=>lu,SideCategoryStyle:()=>rc,SideStyle:()=>gl,SideTanakaStyle:()=>jc,SizeLegend:()=>Qh,SquareColorCategoryWebGLStyle:()=>Il,SquareColorWebGLStyle:()=>ds,StrokeStyle:()=>du,Style:()=>Ni,TernaryLegend:()=>my,TextStyle:()=>nl,TiledGrid:()=>za,TimeSeriesStyle:()=>Gs,cellsToMatrix:()=>Su,circularInverseScale:()=>jy,circularScale:()=>Oy,classifier:()=>Wc,classifierMinMax:()=>qc,colorClassifier:()=>Yc,discreteColors:()=>$c,exponentialScale:()=>wy,getParameterByName:()=>ip,logarithmicScale:()=>xy,nice:()=>_u,orientationLegend:()=>fy,powerInverseScale:()=>Sy,powerScale:()=>_y,sizeDiscreteLegend:()=>ey,sizeDiscreteViewScaleLegend:()=>ny,sizeLegend:()=>Kh,sizeLegendViewScale:()=>ty,ternaryClassifier:()=>$y,ternaryColorClassifier:()=>Hy,viewScale:()=>Fc,viewScaleColor:()=>Bc,viewScaleColorQuantile:()=>Dc,viewScaleCombination:()=>Uc,viewScaleQuantile:()=>Nc,viewScaleQuantileClassifer:()=>Gc});var l=Array.prototype.find;function c(){return this.firstElementChild}var s=Array.prototype.filter;function f(){return Array.from(this.children)}function h(t){return new Array(t.length)}function y(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,o,i){for(var a,u=0,l=e.length,c=i.length;u<c;++u)(a=e[u])?(a.__data__=i[u],r[u]=a):n[u]=new y(t,i[u]);for(;u<l;++u)(a=e[u])&&(o[u]=a)}function v(t,e,n,r,o,i,a){var u,l,c,s=new Map,f=e.length,h=i.length,p=new Array(f);for(u=0;u<f;++u)(l=e[u])&&(p[u]=c=a.call(l,l.__data__,u,e)+"",s.has(c)?o[u]=l:s.set(c,l));for(u=0;u<h;++u)c=a.call(t,i[u],u,i)+"",(l=s.get(c))?(r[u]=l,l.__data__=i[u],s.delete(c)):n[u]=new y(t,i[u]);for(u=0;u<f;++u)(l=e[u])&&s.get(p[u])===l&&(o[u]=l)}function d(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}y.prototype={constructor:y,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 x(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 _(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 j(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function P(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function E(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 k(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function T(t){return function(){this.style.removeProperty(t)}}function C(t,e,n){return function(){this.style.setProperty(t,e,n)}}function A(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function M(t,e){return t.style.getPropertyValue(e)||k(t).getComputedStyle(t,null).getPropertyValue(e)}function L(t){return function(){delete this[t]}}function z(t,e){return function(){this[t]=e}}function R(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function I(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new N(t)}function N(t){this._node=t,this._names=I(t.getAttribute("class")||"")}function B(t,e){for(var n=F(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function D(t,e){for(var n=F(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function G(t){return function(){B(this,t)}}function U(t){return function(){D(this,t)}}function W(t,e){return function(){(e.apply(this,arguments)?B:D)(this,t)}}function q(){this.textContent=""}function Y(t){return function(){this.textContent=t}}function $(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function H(){this.innerHTML=""}function V(t){return function(){this.innerHTML=t}}function X(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Z(){this.nextSibling&&this.parentNode.appendChild(this)}function J(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Q(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 K(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function tt(t){var e=x(t);return(e.local?K:Q)(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 ot(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function it(t){return function(){var e=this.__on;if(e){for(var n,r=0,o=-1,i=e.length;r<i;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?e.length=o:delete this.__on}}}function at(t,e,n){return function(){var r,o=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=e);this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function ut(t,e,n){var r=k(t),o=r.CustomEvent;"function"==typeof o?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function lt(t,e){return function(){return ut(this,t,e)}}function ct(t,e){return function(){return ut(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 st=[null];function ft(t,e){this._groups=t,this._parents=e}function ht(){return new ft([[document.documentElement]],st)}ft.prototype=ht.prototype={constructor:ft,select:function(t){"function"!=typeof t&&(t=r(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var a,u,l=e[i],c=l.length,s=o[i]=new Array(c),f=0;f<c;++f)(a=l[f])&&(u=t.call(a,a.__data__,f,l))&&("__data__"in a&&(u.__data__=a.__data__),s[f]=u);return new ft(o,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):i(t);for(var e=this._groups,n=e.length,r=[],o=[],a=0;a<n;++a)for(var u,l=e[a],c=l.length,s=0;s<c;++s)(u=l[s])&&(r.push(t.call(u,u.__data__,s,l)),o.push(u));return new ft(r,o)},selectChild:function(t){return this.select(null==t?c:function(t){return function(){return l.call(this.children,t)}}("function"==typeof t?t:u(t)))},selectChildren:function(t){return this.selectAll(null==t?f:function(t){return function(){return s.call(this.children,t)}}("function"==typeof t?t:u(t)))},filter:function(t){"function"!=typeof t&&(t=a(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,u=e[o],l=u.length,c=r[o]=[],s=0;s<l;++s)(i=u[s])&&t.call(i,i.__data__,s,u)&&c.push(i);return new ft(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,d);var n,r=e?v:p,o=this._parents,i=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=i.length,u=new Array(a),l=new Array(a),c=new Array(a),s=0;s<a;++s){var f=o[s],h=i[s],y=h.length,m=b(t.call(f,f&&f.__data__,s,o)),g=m.length,w=l[s]=new Array(g),x=u[s]=new Array(g);r(f,h,w,x,c[s]=new Array(y),m,e);for(var _,S,O=0,j=0;O<g;++O)if(_=w[O]){for(O>=j&&(j=O+1);!(S=x[j])&&++j<g;);_._next=S||null}}return(u=new ft(u,o))._enter=l,u._exit=c,u},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(),o=this,i=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(o=e(o))&&(o=o.selection()),null==n?i.remove():n(i),r&&o?r.merge(o).order():o},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,a=Math.min(o,i),u=new Array(o),l=0;l<a;++l)for(var c,s=n[l],f=r[l],h=s.length,y=u[l]=new Array(h),p=0;p<h;++p)(c=s[p]||f[p])&&(y[p]=c);for(;l<o;++l)u[l]=n[l];return new ft(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,o=t[e],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=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,o=new Array(r),i=0;i<r;++i){for(var a,u=n[i],l=u.length,c=o[i]=new Array(l),s=0;s<l;++s)(a=u[s])&&(c[s]=a);c.sort(e)}return new ft(o,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],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}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 o,i=e[n],a=0,u=i.length;a<u;++a)(o=i[a])&&t.call(o,o.__data__,a,i);return this},attr:function(t,e){var n=x(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:_:"function"==typeof e?n.local?E:P:n.local?j:O)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?T:"function"==typeof e?A:C)(t,e,null==n?"":n)):M(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?L:"function"==typeof e?R:z)(t,e)):this.node()[t]},classed:function(t,e){var n=I(t+"");if(arguments.length<2){for(var r=F(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?W:e?G:U)(n,e))},text:function(t){return arguments.length?this.each(null==t?q:("function"==typeof t?$:Y)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?H:("function"==typeof t?X:V)(t)):this.node().innerHTML},raise:function(){return this.each(Z)},lower:function(){return this.each(J)},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),o=null==e?et:"function"==typeof e?e:r(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))},remove:function(){return this.each(nt)},clone:function(t){return this.select(t?ot:rt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,o,i=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+""),a=i.length;if(!(arguments.length<2)){for(u=e?at:it,r=0;r<a;++r)this.each(u(i[r],e,n));return this}var u=this.node().__on;if(u)for(var l,c=0,s=u.length;c<s;++c)for(r=0,l=u[c];r<a;++r)if((o=i[r]).type===l.type&&o.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?ct:lt)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,o=t[e],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const yt=ht;function pt(t){return"string"==typeof t?new ft([[document.querySelector(t)]],[document.documentElement]):new ft([[t]],st)}var vt={value:function(){}};function dt(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r)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,o=t.length;r<o;++r)if((n=t[r]).name===e)return n.value}function gt(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=vt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}bt.prototype=dt.prototype={constructor:bt,on:function(t,e){var n,r,o=this._,i=(r=o,(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}}))),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<u;)if(n=(t=i[a]).type)o[n]=gt(o[n],t.name,e);else if(null==e)for(n in o)o[n]=gt(o[n],t.name,null);return this}for(;++a<u;)if((n=(t=i[a]).type)&&(n=mt(o[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,o=new Array(n),i=0;i<n;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,n=(r=this._[t]).length;i<n;++i)r[i].value.apply(e,o)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};const wt=dt;function xt(){}function _t(t){return null==t?xt:function(){return this.querySelector(t)}}function St(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ot(){return[]}function jt(t){return function(e){return e.matches(t)}}var Pt=Array.prototype.find;function Et(){return this.firstElementChild}var kt=Array.prototype.filter;function Tt(){return this.children}function Ct(t){return new Array(t.length)}function At(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function Mt(t,e,n,r,o,i){for(var a,u=0,l=e.length,c=i.length;u<c;++u)(a=e[u])?(a.__data__=i[u],r[u]=a):n[u]=new At(t,i[u]);for(;u<l;++u)(a=e[u])&&(o[u]=a)}function Lt(t,e,n,r,o,i,a){var u,l,c,s=new Map,f=e.length,h=i.length,y=new Array(f);for(u=0;u<f;++u)(l=e[u])&&(y[u]=c=a.call(l,l.__data__,u,e)+"",s.has(c)?o[u]=l:s.set(c,l));for(u=0;u<h;++u)c=a.call(t,i[u],u,i)+"",(l=s.get(c))?(r[u]=l,l.__data__=i[u],s.delete(c)):n[u]=new At(t,i[u]);for(u=0;u<f;++u)(l=e[u])&&s.get(y[u])===l&&(o[u]=l)}function zt(t){return t.__data__}function Rt(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}At.prototype={constructor:At,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 It="http://www.w3.org/1999/xhtml";const Ft={svg:"http://www.w3.org/2000/svg",xhtml:It,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Nt(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Ft.hasOwnProperty(e)?{space:Ft[e],local:t}:t}function Bt(t){return function(){this.removeAttribute(t)}}function Dt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Gt(t,e){return function(){this.setAttribute(t,e)}}function Ut(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Wt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function qt(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 Yt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function $t(t){return function(){this.style.removeProperty(t)}}function Ht(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Vt(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Xt(t){return function(){delete this[t]}}function Zt(t,e){return function(){this[t]=e}}function Jt(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Qt(t){return t.trim().split(/^|\s+/)}function Kt(t){return t.classList||new te(t)}function te(t){this._node=t,this._names=Qt(t.getAttribute("class")||"")}function ee(t,e){for(var n=Kt(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function ne(t,e){for(var n=Kt(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function re(t){return function(){ee(this,t)}}function oe(t){return function(){ne(this,t)}}function ie(t,e){return function(){(e.apply(this,arguments)?ee:ne)(this,t)}}function ae(){this.textContent=""}function ue(t){return function(){this.textContent=t}}function le(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function ce(){this.innerHTML=""}function se(t){return function(){this.innerHTML=t}}function fe(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function he(){this.nextSibling&&this.parentNode.appendChild(this)}function ye(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pe(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===It&&e.documentElement.namespaceURI===It?e.createElement(t):e.createElementNS(n,t)}}function ve(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function de(t){var e=Nt(t);return(e.local?ve:pe)(e)}function be(){return null}function me(){var t=this.parentNode;t&&t.removeChild(this)}function ge(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function we(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function xe(t){return function(){var e=this.__on;if(e){for(var n,r=0,o=-1,i=e.length;r<i;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?e.length=o:delete this.__on}}}function _e(t,e,n){return function(){var r,o=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=e);this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Se(t,e,n){var r=Yt(t),o=r.CustomEvent;"function"==typeof o?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function Oe(t,e){return function(){return Se(this,t,e)}}function je(t,e){return function(){return Se(this,t,e.apply(this,arguments))}}te.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 Pe=[null];function Ee(t,e){this._groups=t,this._parents=e}function ke(t){return"string"==typeof t?new Ee([[document.querySelector(t)]],[document.documentElement]):new Ee([[t]],Pe)}function Te(t){t.preventDefault(),t.stopImmediatePropagation()}function Ce(t){return((t=Math.exp(t))+1/t)/2}Ee.prototype=function(){return new Ee([[document.documentElement]],Pe)}.prototype={constructor:Ee,select:function(t){"function"!=typeof t&&(t=_t(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a,u=e[o],l=u.length,c=r[o]=new Array(l),s=0;s<l;++s)(i=u[s])&&(a=t.call(i,i.__data__,s,u))&&("__data__"in i&&(a.__data__=i.__data__),c[s]=a);return new Ee(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:St(e)}}(t):function(t){return null==t?Ot:function(){return this.querySelectorAll(t)}}(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var a,u=e[i],l=u.length,c=0;c<l;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),o.push(a));return new Ee(r,o)},selectChild:function(t){return this.select(null==t?Et:function(t){return function(){return Pt.call(this.children,t)}}("function"==typeof t?t:jt(t)))},selectChildren:function(t){return this.selectAll(null==t?Tt:function(t){return function(){return kt.call(this.children,t)}}("function"==typeof t?t:jt(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a=e[o],u=a.length,l=r[o]=[],c=0;c<u;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&l.push(i);return new Ee(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,zt);var n,r=e?Lt:Mt,o=this._parents,i=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=i.length,u=new Array(a),l=new Array(a),c=new Array(a),s=0;s<a;++s){var f=o[s],h=i[s],y=h.length,p=St(t.call(f,f&&f.__data__,s,o)),v=p.length,d=l[s]=new Array(v),b=u[s]=new Array(v);r(f,h,d,b,c[s]=new Array(y),p,e);for(var m,g,w=0,x=0;w<v;++w)if(m=d[w]){for(w>=x&&(x=w+1);!(g=b[x])&&++x<v;);m._next=g||null}}return(u=new Ee(u,o))._enter=l,u._exit=c,u},enter:function(){return new Ee(this._enter||this._groups.map(Ct),this._parents)},exit:function(){return new Ee(this._exit||this._groups.map(Ct),this._parents)},join:function(t,e,n){var r=this.enter(),o=this,i=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(o=e(o)),null==n?i.remove():n(i),r&&o?r.merge(o).order():o},merge:function(t){if(!(t instanceof Ee))throw new Error("invalid merge");for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var l,c=e[u],s=n[u],f=c.length,h=a[u]=new Array(f),y=0;y<f;++y)(l=c[y]||s[y])&&(h[y]=l);for(;u<r;++u)a[u]=e[u];return new Ee(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,o=t[e],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Rt);for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a,u=n[i],l=u.length,c=o[i]=new Array(l),s=0;s<l;++s)(a=u[s])&&(c[s]=a);c.sort(e)}return new Ee(o,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],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}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 o,i=e[n],a=0,u=i.length;a<u;++a)(o=i[a])&&t.call(o,o.__data__,a,i);return this},attr:function(t,e){var n=Nt(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?Dt:Bt:"function"==typeof e?n.local?qt:Wt:n.local?Ut:Gt)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?$t:"function"==typeof e?Vt:Ht)(t,e,null==n?"":n)):function(t,e){return t.style.getPropertyValue(e)||Yt(t).getComputedStyle(t,null).getPropertyValue(e)}(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Xt:"function"==typeof e?Jt:Zt)(t,e)):this.node()[t]},classed:function(t,e){var n=Qt(t+"");if(arguments.length<2){for(var r=Kt(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?ie:e?re:oe)(n,e))},text:function(t){return arguments.length?this.each(null==t?ae:("function"==typeof t?le:ue)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?ce:("function"==typeof t?fe:se)(t)):this.node().innerHTML},raise:function(){return this.each(he)},lower:function(){return this.each(ye)},append:function(t){var e="function"==typeof t?t:de(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:de(t),r=null==e?be:"function"==typeof e?e:_t(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(me)},clone:function(t){return this.select(t?we:ge)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,o,i=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+""),a=i.length;if(!(arguments.length<2)){for(u=e?_e:xe,r=0;r<a;++r)this.each(u(i[r],e,n));return this}var u=this.node().__on;if(u)for(var l,c=0,s=u.length;c<s;++c)for(r=0,l=u[c];r<a;++r)if((o=i[r]).type===l.type&&o.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?je:Oe)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,o=t[e],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const Ae=function t(e,n,r){function o(t,o){var i,a,u=t[0],l=t[1],c=t[2],s=o[0],f=o[1],h=o[2],y=s-u,p=f-l,v=y*y+p*p;if(v<1e-12)a=Math.log(h/c)/e,i=function(t){return[u+t*y,l+t*p,c*Math.exp(e*t*a)]};else{var d=Math.sqrt(v),b=(h*h-c*c+r*v)/(2*c*n*d),m=(h*h-c*c-r*v)/(2*h*n*d),g=Math.log(Math.sqrt(b*b+1)-b),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-g)/e,i=function(t){var r,o=t*a,i=Ce(g),s=c/(n*d)*(i*(r=e*o+g,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[u+s*y,l+s*p,c*i/Ce(e*o+g)]}}return i.duration=1e3*a*e/Math.SQRT2,i}return o.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},o}(Math.SQRT2,2,4);function Me(){}function Le(t){return null==t?Me:function(){return this.querySelector(t)}}function ze(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Re(){return[]}function Ie(t){return function(e){return e.matches(t)}}var Fe=Array.prototype.find;function Ne(){return this.firstElementChild}var Be=Array.prototype.filter;function De(){return this.children}function Ge(t){return new Array(t.length)}function Ue(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function We(t,e,n,r,o,i){for(var a,u=0,l=e.length,c=i.length;u<c;++u)(a=e[u])?(a.__data__=i[u],r[u]=a):n[u]=new Ue(t,i[u]);for(;u<l;++u)(a=e[u])&&(o[u]=a)}function qe(t,e,n,r,o,i,a){var u,l,c,s=new Map,f=e.length,h=i.length,y=new Array(f);for(u=0;u<f;++u)(l=e[u])&&(y[u]=c=a.call(l,l.__data__,u,e)+"",s.has(c)?o[u]=l:s.set(c,l));for(u=0;u<h;++u)c=a.call(t,i[u],u,i)+"",(l=s.get(c))?(r[u]=l,l.__data__=i[u],s.delete(c)):n[u]=new Ue(t,i[u]);for(u=0;u<f;++u)(l=e[u])&&s.get(y[u])===l&&(o[u]=l)}function Ye(t){return t.__data__}function $e(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}Ue.prototype={constructor:Ue,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 He="http://www.w3.org/1999/xhtml";const Ve={svg:"http://www.w3.org/2000/svg",xhtml:He,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xe(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Ve.hasOwnProperty(e)?{space:Ve[e],local:t}:t}function Ze(t){return function(){this.removeAttribute(t)}}function Je(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Qe(t,e){return function(){this.setAttribute(t,e)}}function Ke(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function tn(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function en(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 nn(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function rn(t){return function(){this.style.removeProperty(t)}}function on(t,e,n){return function(){this.style.setProperty(t,e,n)}}function an(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function un(t){return function(){delete this[t]}}function ln(t,e){return function(){this[t]=e}}function cn(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function sn(t){return t.trim().split(/^|\s+/)}function fn(t){return t.classList||new hn(t)}function hn(t){this._node=t,this._names=sn(t.getAttribute("class")||"")}function yn(t,e){for(var n=fn(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function pn(t,e){for(var n=fn(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function vn(t){return function(){yn(this,t)}}function dn(t){return function(){pn(this,t)}}function bn(t,e){return function(){(e.apply(this,arguments)?yn:pn)(this,t)}}function mn(){this.textContent=""}function gn(t){return function(){this.textContent=t}}function wn(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function xn(){this.innerHTML=""}function _n(t){return function(){this.innerHTML=t}}function Sn(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function On(){this.nextSibling&&this.parentNode.appendChild(this)}function jn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pn(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===He&&e.documentElement.namespaceURI===He?e.createElement(t):e.createElementNS(n,t)}}function En(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function kn(t){var e=Xe(t);return(e.local?En:Pn)(e)}function Tn(){return null}function Cn(){var t=this.parentNode;t&&t.removeChild(this)}function An(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Mn(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ln(t){return function(){var e=this.__on;if(e){for(var n,r=0,o=-1,i=e.length;r<i;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?e.length=o:delete this.__on}}}function zn(t,e,n){return function(){var r,o=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=e);this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Rn(t,e,n){var r=nn(t),o=r.CustomEvent;"function"==typeof o?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function In(t,e){return function(){return Rn(this,t,e)}}function Fn(t,e){return function(){return Rn(this,t,e.apply(this,arguments))}}hn.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 Nn=[null];function Bn(t,e){this._groups=t,this._parents=e}function Dn(t){return"string"==typeof t?new Bn([[document.querySelector(t)]],[document.documentElement]):new Bn([[t]],Nn)}function Gn(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 o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}Bn.prototype=function(){return new Bn([[document.documentElement]],Nn)}.prototype={constructor:Bn,select:function(t){"function"!=typeof t&&(t=Le(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a,u=e[o],l=u.length,c=r[o]=new Array(l),s=0;s<l;++s)(i=u[s])&&(a=t.call(i,i.__data__,s,u))&&("__data__"in i&&(a.__data__=i.__data__),c[s]=a);return new Bn(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:ze(e)}}(t):function(t){return null==t?Re:function(){return this.querySelectorAll(t)}}(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var a,u=e[i],l=u.length,c=0;c<l;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),o.push(a));return new Bn(r,o)},selectChild:function(t){return this.select(null==t?Ne:function(t){return function(){return Fe.call(this.children,t)}}("function"==typeof t?t:Ie(t)))},selectChildren:function(t){return this.selectAll(null==t?De:function(t){return function(){return Be.call(this.children,t)}}("function"==typeof t?t:Ie(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a=e[o],u=a.length,l=r[o]=[],c=0;c<u;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&l.push(i);return new Bn(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Ye);var n,r=e?qe:We,o=this._parents,i=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=i.length,u=new Array(a),l=new Array(a),c=new Array(a),s=0;s<a;++s){var f=o[s],h=i[s],y=h.length,p=ze(t.call(f,f&&f.__data__,s,o)),v=p.length,d=l[s]=new Array(v),b=u[s]=new Array(v);r(f,h,d,b,c[s]=new Array(y),p,e);for(var m,g,w=0,x=0;w<v;++w)if(m=d[w]){for(w>=x&&(x=w+1);!(g=b[x])&&++x<v;);m._next=g||null}}return(u=new Bn(u,o))._enter=l,u._exit=c,u},enter:function(){return new Bn(this._enter||this._groups.map(Ge),this._parents)},exit:function(){return new Bn(this._exit||this._groups.map(Ge),this._parents)},join:function(t,e,n){var r=this.enter(),o=this,i=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(o=e(o)),null==n?i.remove():n(i),r&&o?r.merge(o).order():o},merge:function(t){if(!(t instanceof Bn))throw new Error("invalid merge");for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var l,c=e[u],s=n[u],f=c.length,h=a[u]=new Array(f),y=0;y<f;++y)(l=c[y]||s[y])&&(h[y]=l);for(;u<r;++u)a[u]=e[u];return new Bn(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,o=t[e],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=$e);for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a,u=n[i],l=u.length,c=o[i]=new Array(l),s=0;s<l;++s)(a=u[s])&&(c[s]=a);c.sort(e)}return new Bn(o,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],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}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 o,i=e[n],a=0,u=i.length;a<u;++a)(o=i[a])&&t.call(o,o.__data__,a,i);return this},attr:function(t,e){var n=Xe(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?Je:Ze:"function"==typeof e?n.local?en:tn:n.local?Ke:Qe)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?rn:"function"==typeof e?an:on)(t,e,null==n?"":n)):function(t,e){return t.style.getPropertyValue(e)||nn(t).getComputedStyle(t,null).getPropertyValue(e)}(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?un:"function"==typeof e?cn:ln)(t,e)):this.node()[t]},classed:function(t,e){var n=sn(t+"");if(arguments.length<2){for(var r=fn(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?bn:e?vn:dn)(n,e))},text:function(t){return arguments.length?this.each(null==t?mn:("function"==typeof t?wn:gn)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?xn:("function"==typeof t?Sn:_n)(t)):this.node().innerHTML},raise:function(){return this.each(On)},lower:function(){return this.each(jn)},append:function(t){var e="function"==typeof t?t:kn(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:kn(t),r=null==e?Tn:"function"==typeof e?e:Le(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Cn)},clone:function(t){return this.select(t?Mn:An)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,o,i=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+""),a=i.length;if(!(arguments.length<2)){for(u=e?zn:Ln,r=0;r<a;++r)this.each(u(i[r],e,n));return this}var u=this.node().__on;if(u)for(var l,c=0,s=u.length;c<s;++c)for(r=0,l=u[c];r<a;++r)if((o=i[r]).type===l.type&&o.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Fn:In)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,o=t[e],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};var Un,Wn,qn=0,Yn=0,$n=0,Hn=0,Vn=0,Xn=0,Zn="object"==typeof performance&&performance.now?performance:Date,Jn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Qn(){return Vn||(Jn(Kn),Vn=Zn.now()+Xn)}function Kn(){Vn=0}function tr(){this._call=this._time=this._next=null}function er(t,e,n){var r=new tr;return r.restart(t,e,n),r}function nr(){Vn=(Hn=Zn.now())+Xn,qn=Yn=0;try{!function(){Qn(),++qn;for(var t,e=Un;e;)(t=Vn-e._time)>=0&&e._call.call(null,t),e=e._next;--qn}()}finally{qn=0,function(){for(var t,e,n=Un,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:Un=e);Wn=t,or(r)}(),Vn=0}}function rr(){var t=Zn.now(),e=t-Hn;e>1e3&&(Xn-=e,Hn=t)}function or(t){qn||(Yn&&(Yn=clearTimeout(Yn)),t-Vn>24?(t<1/0&&(Yn=setTimeout(nr,t-Zn.now()-Xn)),$n&&($n=clearInterval($n))):($n||(Hn=Zn.now(),$n=setInterval(rr,1e3)),qn=1,Jn(nr)))}function ir(t,e,n){var r=new tr;return e=null==e?0:+e,r.restart((function(n){r.stop(),t(n+e)}),e,n),r}tr.prototype=er.prototype={constructor:tr,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Qn():+n)+(null==e?0:+e),this._next||Wn===this||(Wn?Wn._next=this:Un=this,Wn=this),this._call=t,this._time=n,or()},stop:function(){this._call&&(this._call=null,this._time=1/0,or())}};var ar=wt("start","end","cancel","interrupt"),ur=[];function lr(t,e,n,r,o,i){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,o=t.__transition;function i(l){var c,s,f,h;if(1!==n.state)return u();for(c in o)if((h=o[c]).name===n.name){if(3===h.state)return ir(i);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[c]):+c<e&&(h.state=6,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete o[c])}if(ir((function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(l))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(f=n.tween.length),c=0,s=-1;c<f;++c)(h=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++s]=h);r.length=s+1}}function a(e){for(var o=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(u),n.state=5,1),i=-1,a=r.length;++i<a;)r[i].call(t,o);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){for(var r in n.state=6,n.timer.stop(),delete o[e],o)return;delete t.__transition}o[e]=n,n.timer=er((function(t){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=t&&i(t-n.delay)}),0,n.time)}(t,n,{name:e,index:r,group:o,on:ar,tween:ur,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function cr(t,e){var n=fr(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function sr(t,e){var n=fr(t,e);if(n.state>3)throw new Error("too late; already running");return n}function fr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function hr(t,e){var n,r,o,i=t.__transition,a=!0;if(i){for(o in e=null==e?null:e+"",i)(n=i[o]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[o]):a=!1;a&&delete t.__transition}}function yr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var pr,vr=180/Math.PI,dr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function br(t,e,n,r,o,i){var a,u,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,l/=u),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*vr,skewX:Math.atan(l)*vr,scaleX:a,scaleY:u}}function mr(t,e,n,r){function o(t){return t.length?t.pop()+" ":""}return function(i,a){var u=[],l=[];return i=t(i),a=t(a),function(t,r,o,i,a,u){if(t!==o||r!==i){var l=a.push("translate(",null,e,null,n);u.push({i:l-4,x:yr(t,o)},{i:l-2,x:yr(r,i)})}else(o||i)&&a.push("translate("+o+e+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,u,l),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(o(n)+"rotate(",null,r)-2,x:yr(t,e)})):e&&n.push(o(n)+"rotate("+e+r)}(i.rotate,a.rotate,u,l),function(t,e,n,i){t!==e?i.push({i:n.push(o(n)+"skewX(",null,r)-2,x:yr(t,e)}):e&&n.push(o(n)+"skewX("+e+r)}(i.skewX,a.skewX,u,l),function(t,e,n,r,i,a){if(t!==n||e!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:yr(t,n)},{i:u-2,x:yr(e,r)})}else 1===n&&1===r||i.push(o(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,l),i=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)u[(e=l[n]).i]=e.x(t);return u.join("")}}}var gr=mr((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?dr:br(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),wr=mr((function(t){return null==t?dr:(pr||(pr=document.createElementNS("http://www.w3.org/2000/svg","g")),pr.setAttribute("transform",t),(t=pr.transform.baseVal.consolidate())?br((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):dr)}),", ",")",")");function xr(t,e){var n,r;return function(){var o=sr(this,t),i=o.tween;if(i!==n)for(var a=0,u=(r=n=i).length;a<u;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}o.tween=r}}function _r(t,e,n){var r,o;if("function"!=typeof n)throw new Error;return function(){var i=sr(this,t),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:e,value:n},l=0,c=o.length;l<c;++l)if(o[l].name===e){o[l]=u;break}l===c&&o.push(u)}i.tween=o}}function Sr(t,e,n){var r=t._id;return t.each((function(){var t=sr(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return fr(t,r).value[e]}}function Or(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function jr(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Pr(){}var Er=.7,kr=1/Er,Tr="\\s*([+-]?\\d+)\\s*",Cr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ar="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Mr=/^#([0-9a-f]{3,8})$/,Lr=new RegExp(`^rgb\\(${Tr},${Tr},${Tr}\\)$`),zr=new RegExp(`^rgb\\(${Ar},${Ar},${Ar}\\)$`),Rr=new RegExp(`^rgba\\(${Tr},${Tr},${Tr},${Cr}\\)$`),Ir=new RegExp(`^rgba\\(${Ar},${Ar},${Ar},${Cr}\\)$`),Fr=new RegExp(`^hsl\\(${Cr},${Ar},${Ar}\\)$`),Nr=new RegExp(`^hsla\\(${Cr},${Ar},${Ar},${Cr}\\)$`),Br={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 Dr(){return this.rgb().formatHex()}function Gr(){return this.rgb().formatRgb()}function Ur(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Mr.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Wr(e):3===n?new Hr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?qr(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?qr(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=Lr.exec(t))?new Hr(e[1],e[2],e[3],1):(e=zr.exec(t))?new Hr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Rr.exec(t))?qr(e[1],e[2],e[3],e[4]):(e=Ir.exec(t))?qr(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Fr.exec(t))?Kr(e[1],e[2]/100,e[3]/100,1):(e=Nr.exec(t))?Kr(e[1],e[2]/100,e[3]/100,e[4]):Br.hasOwnProperty(t)?Wr(Br[t]):"transparent"===t?new Hr(NaN,NaN,NaN,0):null}function Wr(t){return new Hr(t>>16&255,t>>8&255,255&t,1)}function qr(t,e,n,r){return r<=0&&(t=e=n=NaN),new Hr(t,e,n,r)}function Yr(t){return t instanceof Pr||(t=Ur(t)),t?new Hr((t=t.rgb()).r,t.g,t.b,t.opacity):new Hr}function $r(t,e,n,r){return 1===arguments.length?Yr(t):new Hr(t,e,n,null==r?1:r)}function Hr(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Vr(){return`#${Qr(this.r)}${Qr(this.g)}${Qr(this.b)}`}function Xr(){const t=Zr(this.opacity);return`${1===t?"rgb(":"rgba("}${Jr(this.r)}, ${Jr(this.g)}, ${Jr(this.b)}${1===t?")":`, ${t})`}`}function Zr(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Jr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Qr(t){return((t=Jr(t))<16?"0":"")+t.toString(16)}function Kr(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new eo(t,e,n,r)}function to(t){if(t instanceof eo)return new eo(t.h,t.s,t.l,t.opacity);if(t instanceof Pr||(t=Ur(t)),!t)return new eo;if(t instanceof eo)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),a=NaN,u=i-o,l=(i+o)/2;return u?(a=e===i?(n-r)/u+6*(n<r):n===i?(r-e)/u+2:(e-n)/u+4,u/=l<.5?i+o:2-i-o,a*=60):u=l>0&&l<1?0:a,new eo(a,u,l,t.opacity)}function eo(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function no(t){return(t=(t||0)%360)<0?t+360:t}function ro(t){return Math.max(0,Math.min(1,t||0))}function oo(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 io(t,e,n,r,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*n+(1+3*t+3*i-3*a)*r+a*o)/6}Or(Pr,Ur,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Dr,formatHex:Dr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return to(this).formatHsl()},formatRgb:Gr,toString:Gr}),Or(Hr,$r,jr(Pr,{brighter(t){return t=null==t?kr:Math.pow(kr,t),new Hr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Er:Math.pow(Er,t),new Hr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Hr(Jr(this.r),Jr(this.g),Jr(this.b),Zr(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:Vr,formatHex:Vr,formatHex8:function(){return`#${Qr(this.r)}${Qr(this.g)}${Qr(this.b)}${Qr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Xr,toString:Xr})),Or(eo,(function(t,e,n,r){return 1===arguments.length?to(t):new eo(t,e,n,null==r?1:r)}),jr(Pr,{brighter(t){return t=null==t?kr:Math.pow(kr,t),new eo(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Er:Math.pow(Er,t),new eo(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,o=2*n-r;return new Hr(oo(t>=240?t-240:t+120,o,r),oo(t,o,r),oo(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new eo(no(this.h),ro(this.s),ro(this.l),Zr(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=Zr(this.opacity);return`${1===t?"hsl(":"hsla("}${no(this.h)}, ${100*ro(this.s)}%, ${100*ro(this.l)}%${1===t?")":`, ${t})`}`}}));const ao=t=>()=>t;function uo(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):ao(isNaN(t)?e:t)}const lo=function t(e){var n=function(t){return 1==(t=+t)?uo: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):ao(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=$r(t)).r,(e=$r(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=uo(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=o(e),t.b=i(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function co(t){return function(e){var n,r,o=e.length,i=new Array(o),a=new Array(o),u=new Array(o);for(n=0;n<o;++n)r=$r(e[n]),i[n]=r.r||0,a[n]=r.g||0,u[n]=r.b||0;return i=t(i),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=i(t),r.g=a(t),r.b=u(t),r+""}}}co((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),o=t[r],i=t[r+1],a=r>0?t[r-1]:2*o-i,u=r<e-1?t[r+2]:2*i-o;return io((n-r/e)*e,a,o,i,u)}})),co((function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),o=t[(r+e-1)%e],i=t[r%e],a=t[(r+1)%e],u=t[(r+2)%e];return io((n-r/e)*e,o,i,a,u)}}));var so=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fo=new RegExp(so.source,"g");function ho(t,e){var n,r,o,i=so.lastIndex=fo.lastIndex=0,a=-1,u=[],l=[];for(t+="",e+="";(n=so.exec(t))&&(r=fo.exec(e));)(o=r.index)>i&&(o=e.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,l.push({i:a,x:yr(n,r)})),i=fo.lastIndex;return i<e.length&&(o=e.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)u[(n=l[r]).i]=n.x(t);return u.join("")})}function yo(t,e){var n;return("number"==typeof e?yr:e instanceof Ur?lo:(n=Ur(e))?(e=n,lo):ho)(t,e)}function po(t){return function(){this.removeAttribute(t)}}function vo(t){return function(){this.removeAttributeNS(t.space,t.local)}}function bo(t,e,n){var r,o,i=n+"";return function(){var a=this.getAttribute(t);return a===i?null:a===r?o:o=e(r=a,n)}}function mo(t,e,n){var r,o,i=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===r?o:o=e(r=a,n)}}function go(t,e,n){var r,o,i;return function(){var a,u,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(u=l+"")?null:a===r&&u===o?i:(o=u,i=e(r=a,l));this.removeAttribute(t)}}function wo(t,e,n){var r,o,i;return function(){var a,u,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(u=l+"")?null:a===r&&u===o?i:(o=u,i=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function xo(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,o)),n}return o._value=e,o}function _o(t,e){var n,r;function o(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,o)),n}return o._value=e,o}function So(t,e){return function(){cr(this,t).delay=+e.apply(this,arguments)}}function Oo(t,e){return e=+e,function(){cr(this,t).delay=e}}function jo(t,e){return function(){sr(this,t).duration=+e.apply(this,arguments)}}function Po(t,e){return e=+e,function(){sr(this,t).duration=e}}var Eo=yt.prototype.constructor;function ko(t){return function(){this.style.removeProperty(t)}}var To=0;function Co(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Ao(){return++To}var Mo=yt.prototype;Co.prototype=function(t){return yt().transition(t)}.prototype={constructor:Co,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=r(t));for(var o=this._groups,i=o.length,a=new Array(i),u=0;u<i;++u)for(var l,c,s=o[u],f=s.length,h=a[u]=new Array(f),y=0;y<f;++y)(l=s[y])&&(c=t.call(l,l.__data__,y,s))&&("__data__"in l&&(c.__data__=l.__data__),h[y]=c,lr(h[y],e,n,y,h,fr(l,n)));return new Co(a,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=i(t));for(var r=this._groups,o=r.length,a=[],u=[],l=0;l<o;++l)for(var c,s=r[l],f=s.length,h=0;h<f;++h)if(c=s[h]){for(var y,p=t.call(c,c.__data__,h,s),v=fr(c,n),d=0,b=p.length;d<b;++d)(y=p[d])&&lr(y,e,n,d,p,v);a.push(p),u.push(c)}return new Co(a,u,e,n)},selectChild:Mo.selectChild,selectChildren:Mo.selectChildren,filter:function(t){"function"!=typeof t&&(t=a(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,u=e[o],l=u.length,c=r[o]=[],s=0;s<l;++s)(i=u[s])&&t.call(i,i.__data__,s,u)&&c.push(i);return new Co(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,o=n.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var l,c=e[u],s=n[u],f=c.length,h=a[u]=new Array(f),y=0;y<f;++y)(l=c[y]||s[y])&&(h[y]=l);for(;u<r;++u)a[u]=e[u];return new Co(a,this._parents,this._name,this._id)},selection:function(){return new Eo(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Ao(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],l=u.length,c=0;c<l;++c)if(a=u[c]){var s=fr(a,e);lr(a,t,n,c,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Co(r,this._parents,t,n)},call:Mo.call,nodes:Mo.nodes,node:Mo.node,size:Mo.size,empty:Mo.empty,each:Mo.each,on:function(t,e){var n=this._id;return arguments.length<2?fr(this.node(),n).on.on(t):this.each(function(t,e,n){var r,o,i=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)?cr:sr;return function(){var a=i(this,t),u=a.on;u!==r&&(o=(r=u).copy()).on(e,n),a.on=o}}(n,t,e))},attr:function(t,e){var n=x(t),r="transform"===n?wr:yo;return this.attrTween(t,"function"==typeof e?(n.local?wo:go)(n,r,Sr(this,"attr."+t,e)):null==e?(n.local?vo:po)(n):(n.local?mo:bo)(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=x(t);return this.tween(n,(r.local?xo:_o)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?gr:yo;return null==e?this.styleTween(t,function(t,e){var n,r,o;return function(){var i=M(this,t),a=(this.style.removeProperty(t),M(this,t));return i===a?null:i===n&&a===r?o:o=e(n=i,r=a)}}(t,r)).on("end.style."+t,ko(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,o,i;return function(){var a=M(this,t),u=n(this),l=u+"";return null==u&&(this.style.removeProperty(t),l=u=M(this,t)),a===l?null:a===r&&l===o?i:(o=l,i=e(r=a,u))}}(t,r,Sr(this,"style."+t,e))).each(function(t,e){var n,r,o,i,a="style."+e,u="end."+a;return function(){var l=sr(this,t),c=l.on,s=null==l.value[a]?i||(i=ko(e)):void 0;c===n&&o===s||(r=(n=c).copy()).on(u,o=s),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,o,i=n+"";return function(){var a=M(this,t);return a===i?null:a===r?o:o=e(r=a,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,o;function i(){var i=e.apply(this,arguments);return i!==o&&(r=(o=i)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,i,n)),r}return i._value=e,i}(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}}(Sr(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,o=fr(this.node(),n).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===t)return r.value;return null}return this.each((null==e?xr:_r)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?So:Oo)(e,t)):fr(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?jo:Po)(e,t)):fr(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(){sr(this,t).ease=e}}(e,t)):fr(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;sr(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,o=n.size();return new Promise((function(i,a){var u={value:a},l={value:function(){0==--o&&i()}};n.each((function(){var n=sr(this,r),o=n.on;o!==t&&((e=(t=o).copy())._.cancel.push(u),e._.interrupt.push(u),e._.end.push(l)),n.on=e})),0===o&&i()}))},[Symbol.iterator]:Mo[Symbol.iterator]};var Lo={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function zo(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}yt.prototype.interrupt=function(t){return this.each((function(){hr(this,t)}))},yt.prototype.transition=function(t){var e,n;t instanceof Co?(e=t._id,t=t._name):(e=Ao(),(n=Lo).time=Qn(),t=null==t?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],l=u.length,c=0;c<l;++c)(a=u[c])&&lr(a,t,e,c,u,n||zo(a,e));return new Co(r,this._parents,t,e)};const Ro=t=>()=>t;function Io(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){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:o}})}function Fo(t,e,n){this.k=t,this.x=e,this.y=n}Fo.prototype={constructor:Fo,scale:function(t){return 1===t?this:new Fo(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Fo(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 No=new Fo(1,0,0);function Bo(t){t.stopImmediatePropagation()}function Do(t){t.preventDefault(),t.stopImmediatePropagation()}function Go(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Uo(){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 Wo(){return this.__zoom||No}function qo(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Yo(){return navigator.maxTouchPoints||"ontouchstart"in this}function $o(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function Ho(t){return Ho="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},Ho(t)}function Vo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Xo(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,Zo(r.key),r)}}function Zo(t){var e=function(t){if("object"!=Ho(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ho(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ho(e)?e:e+""}Fo.prototype;var Jo=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=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.opts=a||{},this.canvas=e,this.canvas.style.cursor="grab",this.w=this.canvas.offsetWidth,this.h=this.canvas.offsetHeight,this.offscreenCanvas=document.createElement("canvas"),this.offscreenCanvas.width=this.w,this.offscreenCanvas.height=this.h;var u=this.canvas.getContext("2d"),l=this.offscreenCanvas.getContext("2d");if(!u)throw"Impossible to create canvas 2D context";if(!l)throw"Impossible to create canvas 2D context";if(this.ctx=u,this.offscreenCtx=l,this.view={x:r,y:o,z:i},this.backgroundColor=a.backgroundColor||"white",this.onZoomStartFun=a.onZoomStartFun,this.onZoomEndFun=a.onZoomEndFun,this.onZoomFun=a.onZoomFun,this.extGeo={xMin:NaN,xMax:NaN,yMin:NaN,yMax:NaN},this.updateExtentGeo(),!a.disableZoom){var c=No;(function(){var t,e,n,r=Go,o=Uo,i=$o,a=qo,u=Yo,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],s=250,f=Ae,h=wt("start","zoom","end"),y=0,p=10;function v(t){t.property("__zoom",Wo).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",O).filter(u).on("touchstart.zoom",j).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",E).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new Fo(e,t.x,t.y)}function b(t,e,n){var r=e[0]-n[0]*t.k,o=e[1]-n[1]*t.k;return r===t.x&&o===t.y?t:new Fo(t.k,r,o)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function g(t,e,n,r){t.on("start.zoom",(function(){w(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){w(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,i=arguments,a=w(t,i).event(r),u=o.apply(t,i),l=null==n?m(u):"function"==typeof n?n.apply(t,i):n,c=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=t.__zoom,h="function"==typeof e?e.apply(t,i):e,y=f(s.invert(l).concat(c/s.k),h.invert(l).concat(c/h.k));return function(t){if(1===t)t=h;else{var e=y(t),n=c/e[2];t=new Fo(n,l[0]-e[0]*n,l[1]-e[1]*n)}a.zoom(null,t)}}))}function w(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=o.apply(t,e),this.taps=0}function _(t,...e){if(r.apply(this,arguments)){var n=w(this,e).event(t),o=this.__zoom,u=Math.max(l[0],Math.min(l[1],o.k*Math.pow(2,a.apply(this,arguments)))),s=Gn(t);if(n.wheel)n.mouse[0][0]===s[0]&&n.mouse[0][1]===s[1]||(n.mouse[1]=o.invert(n.mouse[0]=s)),clearTimeout(n.wheel);else{if(o.k===u)return;n.mouse=[s,o.invert(s)],hr(this),n.start()}Do(t),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),150),n.zoom("mouse",i(b(d(o,u),n.mouse[0],n.mouse[1]),n.extent,c))}}function S(t,...e){if(!n&&r.apply(this,arguments)){var o=t.currentTarget,a=w(this,e,!0).event(t),u=Dn(t.view).on("mousemove.zoom",(function(t){if(Do(t),!a.moved){var e=t.clientX-s,n=t.clientY-f;a.moved=e*e+n*n>y}a.event(t).zoom("mouse",i(b(a.that.__zoom,a.mouse[0]=Gn(t,o),a.mouse[1]),a.extent,c))}),!0).on("mouseup.zoom",(function(t){u.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=ke(t).on("dragstart.drag",null);e&&(r.on("click.drag",Te,!0),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,a.moved),Do(t),a.event(t).end()}),!0),l=Gn(t,o),s=t.clientX,f=t.clientY;!function(t){var e=t.document.documentElement,n=ke(t).on("dragstart.drag",Te,!0);"onselectstart"in e?n.on("selectstart.drag",Te,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),Bo(t),a.mouse=[l,this.__zoom.invert(l)],hr(this),a.start()}}function O(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=Gn(t.changedTouches?t.changedTouches[0]:t,this),u=n.invert(a),l=n.k*(t.shiftKey?.5:2),f=i(b(d(n,l),a,u),o.apply(this,e),c);Do(t),s>0?Dn(this).transition().duration(s).call(g,f,a,t):Dn(this).call(v.transform,f,a,t)}}function j(n,...o){if(r.apply(this,arguments)){var i,a,u,l,c=n.touches,s=c.length,f=w(this,o,n.changedTouches.length===s).event(n);for(Bo(n),a=0;a<s;++a)l=[l=Gn(u=c[a],this),this.__zoom.invert(l),u.identifier],f.touch0?f.touch1||f.touch0[2]===l[2]||(f.touch1=l,f.taps=0):(f.touch0=l,i=!0,f.taps=1+!!t);t&&(t=clearTimeout(t)),i&&(f.taps<2&&(e=l[0],t=setTimeout((function(){t=null}),500)),hr(this),f.start())}}function P(t,...e){if(this.__zooming){var n,r,o,a,u=w(this,e).event(t),l=t.changedTouches,s=l.length;for(Do(t),n=0;n<s;++n)o=Gn(r=l[n],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var f=u.touch0[0],h=u.touch0[1],y=u.touch1[0],p=u.touch1[1],v=(v=y[0]-f[0])*v+(v=y[1]-f[1])*v,m=(m=p[0]-h[0])*m+(m=p[1]-h[1])*m;r=d(r,Math.sqrt(v/m)),o=[(f[0]+y[0])/2,(f[1]+y[1])/2],a=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(b(r,o,a),u.extent,c))}}function E(t,...r){if(this.__zooming){var o,i,a=w(this,r).event(t),u=t.changedTouches,l=u.length;for(Bo(t),n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),o=0;o<l;++o)i=u[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=Gn(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<p)){var c=Dn(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return v.transform=function(t,e,n,r){var o=t.selection?t.selection():t;o.property("__zoom",Wo),t!==o?g(t,e,n,r):o.interrupt().each((function(){w(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},v.scaleBy=function(t,e,n,r){v.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),n,r)},v.scaleTo=function(t,e,n,r){v.transform(t,(function(){var t=o.apply(this,arguments),r=this.__zoom,a=null==n?m(t):"function"==typeof n?n.apply(this,arguments):n,u=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return i(b(d(r,l),a,u),t,c)}),n,r)},v.translateBy=function(t,e,n,r){v.transform(t,(function(){return i(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),o.apply(this,arguments),c)}),null,r)},v.translateTo=function(t,e,n,r,a){v.transform(t,(function(){var t=o.apply(this,arguments),a=this.__zoom,u=null==r?m(t):"function"==typeof r?r.apply(this,arguments):r;return i(No.translate(u[0],u[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)}),r,a)},x.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=Dn(this.that).datum();h.call(t,this.that,new Io(t,{sourceEvent:this.sourceEvent,target:v,type:t,transform:this.that.__zoom,dispatch:h}),e)}},v.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:Ro(+t),v):a},v.filter=function(t){return arguments.length?(r="function"==typeof t?t:Ro(!!t),v):r},v.touchable=function(t){return arguments.length?(u="function"==typeof t?t:Ro(!!t),v):u},v.extent=function(t){return arguments.length?(o="function"==typeof t?t:Ro([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),v):o},v.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],v):[l[0],l[1]]},v.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],v):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},v.constrain=function(t){return arguments.length?(i=t,v):i},v.duration=function(t){return arguments.length?(s=+t,v):s},v.interpolate=function(t){return arguments.length?(f=t,v):f},v.on=function(){var t=h.on.apply(h,arguments);return t===h?v:t},v.clickDistance=function(t){return arguments.length?(y=(t=+t)*t,v):Math.sqrt(y)},v.tapDistance=function(t){return arguments.length?(p=+t,v):p},v})().wheelDelta((function(t){return-t.deltaY*(1===t.deltaMode?.07:t.deltaMode?1:.004)})).on("zoom",(function(t){n._isZooming=!0;var e=t.transform,r=c.k/e.k;if(1==r){var o=c.x-e.x,i=c.y-e.y;n.applyPan(o*n.view.z,-i*n.view.z)}else s(t,r);c=e,n.onZoomFun&&n.onZoomFun(t)})).on("start",(function(t){var e;try{n.canvas.style.cursor="grabbing"}catch(t){}n._isZooming=!0,n.canvasSave.c=document.createElement("canvas"),n.canvasSave.c.setAttribute("width",""+n.w),n.canvasSave.c.setAttribute("height",""+n.h),null===(e=n.canvasSave.c.getContext("2d"))||void 0===e||e.drawImage(n.canvas,0,0),n.canvasSave.dx=0,n.canvasSave.dy=0,n.canvasSave.f=1,n.onZoomStartFun&&n.onZoomStartFun(t)})).on("end",(function(t){try{n.canvas.style.cursor="grab"}catch(t){}n._isZooming=!1,n.redraw(),n.canvasSave={c:null,dx:0,dy:0,f:1},n.onZoomEndFun&&n.onZoomEndFun(t)}))(pt(this.canvas));var s=function(t,e){n.cancelCurrentRequests();var r=t.sourceEvent;if(r instanceof WheelEvent)n.applyZoom(e,n.pixToGeoX(r.offsetX),n.pixToGeoY(r.offsetY));else if(r instanceof TouchEvent){var o,i=0,a=0,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 Vo(t,e);var n={}.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)?Vo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(r.targetTouches);try{for(u.s();!(o=u.n()).done;){var l=o.value;i+=l.clientX,a+=l.clientY}}catch(t){u.e(t)}finally{u.f()}i/=r.targetTouches.length,a/=r.targetTouches.length,n.applyZoom(e,n.pixToGeoX(i),n.pixToGeoY(a))}}}this.xMin=a.centerExtent?a.centerExtent[0]:void 0,this.yMin=a.centerExtent?a.centerExtent[1]:void 0,this.xMax=a.centerExtent?a.centerExtent[2]:void 0,this.yMax=a.centerExtent?a.centerExtent[3]:void 0,this.zoomExtent=a.zoomExtent||[0,1/0],this.canvasSave={c:null,dx:0,dy:0,f:1}}return e=t,n=[{key:"applyPan",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;if(null!=this.xMin&&this.view.x+t<this.xMin&&(t=this.xMin-this.view.x),null!=this.yMin&&this.view.y+e<this.yMin&&(e=this.yMin-this.view.y),null!=this.xMax&&this.view.x+t>this.xMax&&(t=this.xMax-this.view.x),null!=this.yMax&&this.view.y+e>this.yMax&&(e=this.yMax-this.view.y),this.view.x+=t,this.view.y+=e,this.updateExtentGeo(),this.canvasSave.c){var n=1/this.view.z;this.canvasSave.dx-=t*n,this.canvasSave.dy+=e*n,this.clear(this.backgroundColor),this.offscreenCtx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy),this.ctx.drawImage(this.offscreenCtx.canvas,0,0)}else console.log("no canvas save")}},{key:"applyZoom",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.view.x,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.view.y;if(!(this.zoomExtent[0]==this.view.z&&t<=1||this.zoomExtent[1]==this.view.z&&t>=1)){var r=t*this.view.z;r<this.zoomExtent[0]&&(t=this.zoomExtent[0]/this.view.z),r>this.zoomExtent[1]&&(t=this.zoomExtent[1]/this.view.z),this.view.z*=t;var o=(e-this.view.x)*(1-t),i=(n-this.view.y)*(1-t);null!=this.xMin&&this.view.x+o<this.xMin&&(o=this.xMin-this.view.x),null!=this.yMin&&this.view.y+i<this.yMin&&(i=this.yMin-this.view.y),null!=this.xMax&&this.view.x+o>this.xMax&&(o=this.xMax-this.view.x),null!=this.yMax&&this.view.y+i>this.yMax&&(i=this.yMax-this.view.y),this.view.x+=o,this.view.y+=i,this.updateExtentGeo(),this._drawZoomFrame(t,e,n)}}},{key:"_drawZoomFrame",value:function(t,e,n){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.offscreenCtx.drawImage(this.canvasSave.c,this.canvasSave.dx,this.canvasSave.dy,this.canvasSave.f*this.canvasSave.c.width,this.canvasSave.f*this.canvasSave.c.height),this.ctx.drawImage(this.offscreenCanvas,0,0,this.canvas.width,this.canvas.height))}},{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.offscreenCtx.clearRect(0,0,this.w,this.h)):(this.ctx&&(this.ctx.fillStyle=t),this.offscreenCtx&&(this.offscreenCtx.fillStyle=t),this.ctx.fillRect(0,0,this.w,this.h),this.offscreenCtx.fillRect(0,0,this.w,this.h))}},{key:"getView",value:function(){return this.view}},{key:"setCenterExtent",value:function(t){this.xMin=t[0],this.yMin=t[1],this.xMax=t[2],this.yMax=t[3]}},{key:"getCenterExtent",value:function(){return[this.xMin,this.yMin,this.xMax,this.yMax]}},{key:"setZoomExtent",value:function(t){this.zoomExtent=t}},{key:"getZoomExtent",value:function(){return this.zoomExtent}},{key:"initCanvasTransform",value:function(){this.ctx.setTransform(1,0,0,1,0,0),this.offscreenCtx.setTransform(1,0,0,1,0,0)}},{key:"setCanvasTransform",value:function(){var t=1/this.view.z,e=-this.view.x/this.view.z+.5*this.w,n=this.view.y/this.view.z+.5*this.h;this.ctx.setTransform(t,0,0,-t,e,n),this.offscreenCtx.setTransform(t,0,0,-t,e,n)}},{key:"getWebGLTransform",value:function(){var t=2/(this.w*this.view.z),e=2/(this.h*this.view.z);return[t,0,0,0,e,0,-t*this.view.x,-e*this.view.y,1]}},{key:"redraw",value:function(){throw new Error("Method redraw not implemented.")}},{key:"cancelCurrentRequests",value:function(){throw new Error("Method cancelCurrentRequests not implemented.")}},{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.view.x)/this.view.z+.5*this.w}},{key:"geoToPixY",value:function(t){return-(t-this.view.y)/this.view.z+.5*this.h}},{key:"pixToGeoX",value:function(t){return(t-.5*this.w)*this.view.z+this.view.x}},{key:"pixToGeoY",value:function(t){return-(t-.5*this.h)*this.view.z+this.view.y}},{key:"setViewFromURL",value:function(){var e=t.getParameterByName("x"),n=t.getParameterByName("y"),r=t.getParameterByName("z");null==e||null==e||isNaN(+e)||(this.view.x=+e),null==n||null==n||isNaN(+n)||(this.view.y=+n),null==r||null==r||isNaN(+r)||(this.view.z=+r)}}],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&&Xo(e.prototype,n),r&&Xo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function Qo(t){return Qo="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},Qo(t)}function Ko(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,ti(r.key),r)}}function ti(t){var e=function(t){if("object"!=Qo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Qo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qo(e)?e:e+""}var ei=function(){return t=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.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"]||"0px",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.tooltipElement=e.tooltipElement||null,this.tooltip=e.tooltipElement?pt(e.tooltipElement):pt(this.parentElement).append("div").attr("id","gridviz-tooltip").attr("class","gridviz-tooltip"),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.style("text-wrap","nowrap"),this.tooltip.style("z-index",99999999),this.tooltip.style("left","0"),this.tooltip.style("top","0"),this.tooltip.attr("role","tooltip").attr("aria-live","polite")},e=[{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){var e=this.parentElement.getBoundingClientRect(),n=t.clientX-e.left+this.xOffset,r=t.clientY-e.top-this.yOffset;this.tooltip.style("left",n+"px").style("top",r+"px"),this.ensureTooltipInsideContainer(t,e,this.tooltip.node())}},{key:"ensureTooltipInsideContainer",value:function(t,e,n){var r=n,o=e.width,i=e.height;if(r.offsetLeft+r.clientWidth>o){var a=t.clientX-r.clientWidth-this.xOffset;r.style.left=a+"px"}r.offsetTop+r.clientHeight>i&&(r.style.top=i-r.clientHeight+"px"),r.offsetTop<0&&(r.style.top="0px"),r.offsetLeft<0&&(r.style.left="0px")}},{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)}}],e&&Ko(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ni(t){return ni="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},ni(t)}function ri(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,oi(r.key),r)}}function oi(t){var e=function(t){if("object"!=ni(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ni(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ni(e)?e:e+""}var ii=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=e.map,this.parentNode=e.parentNode||e.map.container,e.id&&(this.div=pt("#"+e.id)),this.div&&!this.div.empty()||(this.div=pt(document.createElement("div")),e.id&&this.div.attr("id",e.id)),e.title&&this.div.attr("title",e.title),e.class&&this.div.attr("class",e.class),e.onClickFunction&&this.div.on("click",e.onClickFunction),this.style("box-shadow","0 7px 8px rgba(0,47,103,.08), 0 0 22px rgba(0,47,103,.04), 0 12px 17px rgba(0,47,103,.04), 0 -4px 4px rgba(0,47,103,.04)"),this.style("background-color","#ffffff"),this.style("position","absolute"),this.style("cursor","pointer"),this.style("display","flex"),this.style("justify-content","center"),this.style("align-items","center"),this.style("width","35px"),this.style("height","30px"),this.parentNode.appendChild(this.div.node())},(e=[{key:"style",value:function(t,e){return this.div.style(t,e),this}}])&&ri(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ai(t){return ai="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},ai(t)}function ui(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,li(r.key),r)}}function li(t){var e=function(t){if("object"!=ai(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ai(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ai(e)?e:e+""}function ci(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ci=function(){return!!t})()}function si(t){return si=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},si(t)}function fi(t,e){return fi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fi(t,e)}var hi=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=si(e),function(t,e){if(e&&("object"==ai(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)}(t,ci()?Reflect.construct(e,n||[],si(t).constructor):e.apply(t,n))}(this,e,[t])).onZoom=t.onZoom,n.delta=t.delta||.2,n.zoomInBtn=document.createElement("a"),n.zoomInBtn.id="zoom-in",n.zoomInBtn.className="gridviz-zoom-button",n.zoomInBtn.title="Zoom in",n.zoomInBtn.textContent="+",n.zoomInBtn.addEventListener("click",(function(t){n.zoomIn(t)})),n.zoomInBtn.addEventListener("mouseover",(function(){n.zoomInBtn.style.backgroundColor="lightgrey"})),n.zoomInBtn.addEventListener("mouseout",(function(){n.zoomInBtn.style.backgroundColor="#ffffff"})),n.zoomOutBtn=document.createElement("a"),n.zoomOutBtn.id="zoom-out",n.zoomOutBtn.className="gridviz-zoom-button",n.zoomOutBtn.title="Zoom out",n.zoomOutBtn.textContent="-",n.zoomOutBtn.addEventListener("click",(function(t){n.zoomOut(t)})),n.zoomOutBtn.addEventListener("mouseover",(function(){n.zoomOutBtn.style.backgroundColor="lightgrey"})),n.zoomOutBtn.addEventListener("mouseout",(function(){n.zoomOutBtn.style.backgroundColor="#ffffff"})),[n.zoomInBtn,n.zoomOutBtn].forEach((function(t,e){t.style.alignItems="center",t.style.justifyContent="center",t.style.display="flex",t.style.border="none",t.style.color="black",t.style.textAlign="center",t.style.textDecoration="none",t.style.padding="4px",t.style.fontSize="24px",t.style.fontWeight="bold",t.style.userSelect="none",t.style.backgroundColor="#ffffff",0===e&&(t.style.borderBottom="1px solid grey")})),n.style("height","unset"),n.style("display","unset"),t.x?n.style("left",t.x+"px"):n.style("right","10px"),t.y?n.style("top",t.y+"px"):n.style("top","10px"),n.div.node().appendChild(n.zoomInBtn),n.div.node().appendChild(n.zoomOutBtn),n}return 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&&fi(t,e)}(e,t),n=e,r=[{key:"zoomIn",value:function(t){this.map.setZoom(this.map.getZoom()*(1-this.delta)).redraw(),this.onZoom&&this.onZoom(t),this.map.geoCanvas.onZoomFun&&this.map.geoCanvas.onZoomFun(t)}},{key:"zoomOut",value:function(t){this.map.setZoom(this.map.getZoom()*(1+this.delta)).redraw(),this.onZoom&&this.onZoom(t),this.map.geoCanvas.onZoomFun&&this.map.geoCanvas.onZoomFun(t)}}],r&&ui(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ii);function yi(t){return yi="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},yi(t)}function pi(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,mi(r.key),r)}}function vi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vi=function(){return!!t})()}function di(t){return di=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},di(t)}function bi(t,e){return bi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bi(t,e)}function mi(t){var e=function(t){if("object"!=yi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yi(e)?e:e+""}var gi=function(t){function e(t){var n,r,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=di(e),function(t,e){if(e&&("object"==yi(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)}(t,vi()?Reflect.construct(e,n||[],di(t).constructor):e.apply(t,n))}(this,e,[t]),r=n,i=!1,(o=mi(o="isFullscreen"))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,n.div.node().innerHTML='\n <svg\n style="height: 1.2rem; width: 1.2rem; fill:black; margin:0;"\n focusable="false"\n aria-hidden="true"\n >\n <svg fill="#000000" viewBox="0 0 96 96" xmlns="http://www.w3.org/2000/svg">\n <title/>\n <g>\n <path d="M30,0H6A5.9966,5.9966,0,0,0,0,6V30a6,6,0,0,0,12,0V12H30A6,6,0,0,0,30,0Z"/>\n <path d="M90,0H66a6,6,0,0,0,0,12H84V30a6,6,0,0,0,12,0V6A5.9966,5.9966,0,0,0,90,0Z"/>\n <path d="M30,84H12V66A6,6,0,0,0,0,66V90a5.9966,5.9966,0,0,0,6,6H30a6,6,0,0,0,0-12Z"/>\n <path d="M90,60a5.9966,5.9966,0,0,0-6,6V84H66a6,6,0,0,0,0,12H90a5.9966,5.9966,0,0,0,6-6V66A5.9966,5.9966,0,0,0,90,60Z"/>\n </g>\n </svg>\n </svg>\n ',n.defaultHeight=n.map.h,n.defaultWidth=n.map.w,n.div.on("click",(function(t){n.onClickFunction(t)})),n.div.on("mouseover",(function(t){n.style("background-color","lightgrey")})),n.div.on("mouseout",(function(t){n.style("background-color","#ffffff")})),t.x?n.style("left",t.x+"px"):n.style("right","10px"),t.y?n.style("top",t.y+"px"):n.style("top","90px"),n}return 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&&bi(t,e)}(e,t),n=e,(r=[{key:"onClickFunction",value:function(t){this.isFullscreen?(this.closeFullscreen(this.map.container),this.map.h=this.defaultHeight,this.map.w=this.defaultWidth,this.map.geoCanvas.h=this.defaultHeight,this.map.geoCanvas.w=this.defaultWidth,this.map.geoCanvas.canvas.setAttribute("width",""+this.defaultWidth),this.map.geoCanvas.canvas.setAttribute("height",""+this.defaultHeight),this.map.redraw(),this.isFullscreen=!1):(this.openFullscreen(this.map.container),this.map.h=window.screen.height,this.map.w=window.screen.width,this.isFullscreen=!0)}},{key:"openFullscreen",value:function(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()}},{key:"closeFullscreen",value:function(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()}}])&&pi(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ii);function wi(t){return wi="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},wi(t)}function xi(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 _i(t,e);var n={}.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)?_i(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function _i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Si(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,Oi(r.key),r)}}function Oi(t){var e=function(t){if("object"!=wi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=wi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==wi(e)?e:e+""}var ji=function(){return t=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=n.layers||[],this.asyncRedraw=!!n.asyncRedraw,this._redrawFrame=null,this.container=e||document.getElementById("gridviz"),this.container){this.container.style.position="relative",this.w=n.w||this.container.offsetWidth,this.h=n.h||this.container.offsetHeight,this._canvas=n.canvas||this.initialiseCanvas(),this.geoCanvas=new Jo(this._canvas,n.x,n.y,n.z,n),this.geoCanvas.redraw=function(){r.redraw()},this.geoCanvas.cancelCurrentRequests=function(){var t,e=xi(r.layers);try{for(e.s();!(t=e.n()).done;){var n,o,i,a=t.value;if(null!==(n=a.dataset)&&void 0!==n&&n.datasets){var u,l,c=xi(null===(u=a.dataset)||void 0===u?void 0:u.datasets);try{for(c.s();!(l=c.n()).done;){var s=l.value;null!=s&&s.cancelCurrentRequests&&s.cancelCurrentRequests()}}catch(t){c.e(t)}finally{c.f()}}null!==(o=a.dataset)&&void 0!==o&&o.cancelCurrentRequests&&(null===(i=a.dataset)||void 0===i||i.cancelCurrentRequests())}}catch(t){e.e(t)}finally{e.f()}},this.legend=n.legendContainer?pt(n.legendContainer):null,this._legendProvidedByUser=!!n.legendContainer,this.legend||this.initialiseLegend(),n.tooltip||(n.tooltip={}),n.tooltip.parentElement||(n.tooltip.parentElement=this.container),this.tooltip=new ei(n.tooltip),this.digForTooltip=n.digForTooltip||!1,this._focusFrame=null,this._focusEvent=null;var o=function(t){r._focusEvent=t,r._focusFrame||(r._focusFrame=requestAnimationFrame((function(){r._focusFrame=null;var t=r._focusEvent;r._focusEvent=null,t&&r.focusCell(t)})))};this.mouseOverHandler=o,this.mouseMoveHandler=o,this.mouseOutHandler=function(t){r._focusFrame&&cancelAnimationFrame(r._focusFrame),r._focusFrame=null,r._focusEvent=null,r.tooltip.hide()},this.geoCanvas.canvas.addEventListener("mouseover",this.mouseOverHandler),this.geoCanvas.canvas.addEventListener("mousemove",this.mouseMoveHandler),this.geoCanvas.canvas.addEventListener("mouseout",this.mouseOutHandler),this.defineResizeObserver(),this.geoCanvas.onZoomStartFun=function(t){n.onZoomStartFun&&n.onZoomStartFun(t),r.tooltip.hide()},this.canvasSave=null,this.selectionRectangleColor=n.selectionRectangleColor||"#FF6347",this.selectionRectangleWidthPix=n.selectionRectangleWidthPix||function(){return 4},this.transparentBackground=n.transparentBackground,this.defaultGlobalCompositeOperation=n.defaultGlobalCompositeOperation||this.geoCanvas.ctx.globalCompositeOperation}else console.error("Cannot find gridviz container element.")},e=[{key:"initialiseCanvas",value:function(){var t=document.createElement("canvas");return t.setAttribute("width",""+this.w),t.setAttribute("height",""+this.h),this.container.appendChild(t),t}},{key:"initialiseLegend",value:function(){this.legend=pt(this.container).append("div").attr("id","gridviz-legend").style("position","absolute").style("width","auto").style("height","auto").style("background","#FFFFFF").style("border","0px").style("box-shadow","3px 3px 3px grey, -3px -3px 3px #ddd").style("font-family","Helvetica, Arial, sans-serif").style("bottom","15px").style("right","15px")}},{key:"layers_",value:function(t){return 0===arguments.length?this.layers:(1===arguments.length?Array.isArray(t)?this.layers=t:this.layers=[t]:this.layers=arguments,this)}},{key:"redraw",value:function(){var t=this;return this.asyncRedraw?(this._redrawFrame||this._destroyed||(this._redrawFrame=requestAnimationFrame((function(){t._redrawFrame=null,t.redrawNow()}))),this):this.redrawNow()}},{key:"redrawNow",value:function(){if(this._redrawFrame&&cancelAnimationFrame(this._redrawFrame),this._redrawFrame=null,this._destroyed)return this;this.legend&&this.legend.selectAll("*").remove(),this.geoCanvas.initCanvasTransform(),this.geoCanvas.clear(this.geoCanvas.backgroundColor);var t=this.geoCanvas.view.z;this.updateExtentGeo();var e,n=this.geoCanvas.offscreenCtx,r=xi(this.layers);try{for(r.s();!(e=r.n()).done;){var o=e.value;o.visible&&!o.visible(t)||((o.alpha||o.blendOperation)&&(n.save(),o.alpha&&(n.globalAlpha=o.alpha(t)),o.blendOperation&&(n.globalCompositeOperation=o.blendOperation(t))),this.geoCanvas.setCanvasTransform(),o.draw(this.geoCanvas,this.legend),o.filterColor&&o.drawFilter(this.geoCanvas),(o.alpha||o.blendOperation)&&n.restore())}}catch(t){r.e(t)}finally{r.f()}return this.geoCanvas.initCanvasTransform(),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0),this.canvasSave=null,this._focusedCell=void 0,this}},{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.geoCanvas.updateExtentGeo(t)}},{key:"focusCell",value:function(t){if(!this.geoCanvas._isZooming){var e={x:this.geoCanvas.pixToGeoX(t.offsetX+this.tooltip.xMouseOffset),y:this.geoCanvas.pixToGeoY(t.offsetY+this.tooltip.yMouseOffset)},n=this.getCellFocusInfo(e),r=n?n.cell:null;if(r!==this._focusedCell)if(this._focusedCell=r,this.transparentBackground)if(this.geoCanvas.initCanvasTransform(),this.geoCanvas.ctx.clearRect(0,0,this.w,this.h),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0),n){this.tooltip.html(n.html),this.tooltip.setPosition(t),this.tooltip.show();var o=this.selectionRectangleWidthPix?this.selectionRectangleWidthPix(n.resolution,this.geoCanvas.view.z):4,i=this.geoCanvas.ctx;i.save(),i.strokeStyle=this.selectionRectangleColor,i.lineWidth=o,i.beginPath();var a=this.geoCanvas.geoToPixX(n.cell.x),u=this.geoCanvas.geoToPixY(n.cell.y),l=n.resolution/this.geoCanvas.view.z,c=-l;i.rect(a-o/2,u+o/2,l+o,c-o),i.stroke(),i.restore()}else this.tooltip.hide();else if(n){var s;this.geoCanvas.canvas.style.cursor="pointer",this.tooltip.html(n.html),this.tooltip.setPosition(t),this.tooltip.show(),this.canvasSave?this.geoCanvas.offscreenCtx.drawImage(this.canvasSave,0,0):(this.canvasSave=document.createElement("canvas"),this.canvasSave.setAttribute("width",""+this.w),this.canvasSave.setAttribute("height",""+this.h),null===(s=this.canvasSave.getContext("2d"))||void 0===s||s.drawImage(this.geoCanvas.offscreenCanvas,0,0));var f=this.selectionRectangleWidthPix?this.selectionRectangleWidthPix(n.resolution,this.geoCanvas.view.z):4;this.geoCanvas.initCanvasTransform();var h=this.geoCanvas.offscreenCtx;h.strokeStyle=this.selectionRectangleColor,h.lineWidth=f,h.beginPath(),h.rect(this.geoCanvas.geoToPixX(n.cell.x)-f/2,this.geoCanvas.geoToPixY(n.cell.y)+f/2,n.resolution/this.geoCanvas.view.z+f,-n.resolution/this.geoCanvas.view.z-f),h.stroke(),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0)}else this.geoCanvas.canvas.style.cursor="default",this.tooltip.hide(),this.canvasSave&&this.geoCanvas.ctx.drawImage(this.canvasSave,0,0);else n?(this.tooltip.setPosition(t),this.tooltip.show()):this.tooltip.hide()}}},{key:"getCellFocusInfo",value:function(t){for(var e=this.geoCanvas.view.z,n=this.layers.length-1;n>=0;n--){var r=this.layers[n];if((!r.visible||r.visible(e))&&"none"!==r.cellInfoHTML&&r.cellInfoHTML&&r.getDataset){var o=r.getDataset(e);if(o){var i=o.getCellFromPosition(t,o.getViewCache());if(!i){if(this.digForTooltip)continue;return}if(o.mixedResolution){var a=+o.mixedResolution(i),u=r.cellInfoHTML(i,a);if(!u)return;return{cell:i,html:u,resolution:a}}var l=r.cellInfoHTML(i,o.getResolution());if(!l)return;return{cell:i,html:l,resolution:o.getResolution()}}}}}},{key:"setView",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.geoCanvas.view.x=t,this.geoCanvas.view.y=e,null!=n&&(this.geoCanvas.view.z=n),this}},{key:"getView",value:function(){return this.geoCanvas.view}},{key:"getZoom",value:function(){return this.geoCanvas.view.z}},{key:"setZoom",value:function(t){return this.geoCanvas.view.z=t,this}},{key:"getCenterExtent",value:function(){return this.geoCanvas.getCenterExtent()}},{key:"setCenterExtent",value:function(t){return this.geoCanvas.setCenterExtent(t),this}},{key:"getZoomExtent",value:function(){return this.geoCanvas.getZoomExtent()}},{key:"setZoomExtent",value:function(t){return this.geoCanvas.setZoomExtent(t),this}},{key:"getBackgroundColor",value:function(){return this.geoCanvas.backgroundColor}},{key:"setBackgroundColor",value:function(t){return this.geoCanvas.backgroundColor=t,this}},{key:"addZoomButtons",value:function(t){return this.zoomButtons=new hi({map:this,id:(null==t?void 0:t.id)||"gridviz-zoom-buttons-"+this.container.id,class:null==t?void 0:t.class,x:null==t?void 0:t.x,y:null==t?void 0:t.y,onZoom:null==t?void 0:t.onZoom,delta:(null==t?void 0:t.delta)||.2}),this}},{key:"addFullscreenButton",value:function(t){return this.fullscreenButton=new gi({map:this,id:(null==t?void 0:t.id)||"gridviz-fullscreen-button",class:null==t?void 0:t.class,x:null==t?void 0:t.x,y:null==t?void 0:t.y}),this}},{key:"setViewFromURL",value:function(){return this.geoCanvas.setViewFromURL(),this}},{key:"defineResizeObserver",value:function(){var t=this,e=!1,n=new ResizeObserver((function(n){if(Array.isArray(n)&&n.length){var r=t.container;r.clientWidth>0&&r.clientHeight>0&&(e||(e=!0,window.requestAnimationFrame((function(){e=!1,t.h===r.clientHeight&&t.w===r.clientWidth||(t.h=r.clientHeight,t.w=r.clientWidth,t.geoCanvas.h=t.h,t.geoCanvas.w=t.w,t.geoCanvas.canvas.setAttribute("width",String(t.w)),t.geoCanvas.canvas.setAttribute("height",String(t.h)),t.geoCanvas.offscreenCanvas.setAttribute("width",String(t.w)),t.geoCanvas.offscreenCanvas.setAttribute("height",String(t.h)),t.redraw())}))))}}));n.observe(this.container),this._resizeObserver=n}},{key:"destroy",value:function(){var t,e;this._destroyed=!0,this.layers=[],this.bgLayers=[],this._redrawFrame&&cancelAnimationFrame(this._redrawFrame),this._redrawFrame=null,this._focusFrame&&cancelAnimationFrame(this._focusFrame),this._focusFrame=null,this._resizeObserver&&this._resizeObserver.disconnect(),this._resizeObserver=null,this.geoCanvas.canvas.removeEventListener("mouseover",this.mouseOverHandler),this.geoCanvas.canvas.removeEventListener("mousemove",this.mouseMoveHandler),this.geoCanvas.canvas.removeEventListener("mouseout",this.mouseOutHandler),this.geoCanvas.canvas.remove(),this._legendProvidedByUser||null===(e=this.legend)||void 0===e||e.remove(),null===(t=this.tooltip.tooltip)||void 0===t||t.remove()}}],e&&Si(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Pi(t){return Pi="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},Pi(t)}function Ei(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,ki(r.key),r)}}function ki(t){var e=function(t){if("object"!=Pi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Pi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Pi(e)?e:e+""}var Ti=function(){return t=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.visible=e.visible,this.alpha=e.alpha,this.blendOperation=e.blendOperation,this.filterColor=e.filterColor,this.filterBlendOperation=e.filterBlendOperation},(e=[{key:"drawFilter",value:function(t){if(this.filterColor){var e=this.filterColor(t.view.z);if(e&&"none"!=e){t.offscreenCtx.fillStyle=e;var n=void 0,r=void 0;this.filterBlendOperation&&(n=t.offscreenCtx.globalCompositeOperation,r=this.filterBlendOperation(t.view.z)),r&&"none"!=r&&(t.offscreenCtx.globalCompositeOperation=r),t.offscreenCtx.fillRect(0,0,t.w,t.h),n&&(t.offscreenCtx.globalCompositeOperation=n)}}}}])&&Ei(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Ci(t){return Ci="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},Ci(t)}function Ai(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 Mi(t,e);var n={}.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)?Mi(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Mi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Li(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,zi(r.key),r)}}function zi(t){var e=function(t){if("object"!=Ci(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ci(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ci(e)?e:e+""}function Ri(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ri=function(){return!!t})()}function Ii(t){return Ii=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ii(t)}function Fi(t,e){return Fi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fi(t,e)}var Ni=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ii(e),function(t,e){if(e&&("object"==Ci(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)}(t,Ri()?Reflect.construct(e,n||[],Ii(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.viewScale=t.viewScale,n.filter=t.filter||void 0,n.offset=t.offset||function(t,e,n){return{dx:0,dy:0}},n.drawFun=t.drawFun,n.legends=[],n}return 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&&Fi(t,e)}(e,t),n=e,o=[{key:"updateLegendsRecursive",value:function(t,e){if(Array.isArray(t)){var n,r=Ai(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;this.updateLegendsRecursive(o,e)}}catch(t){r.e(t)}finally{r.f()}}else t.update(e)}}],(r=[{key:"draw",value:function(t,e,n){if(!this.drawFun)throw new Error("Method draw not implemented.");this.drawFun(t,e,n)}},{key:"getOffset",value:function(){return this.offset}},{key:"setOffset",value:function(t){return this.offset=t,this}},{key:"updateLegends",value:function(t){return e.updateLegendsRecursive(this.legends,t),this}},{key:"addLegends",value:function(t){var e,n=Ai(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.legends.push(r)}}catch(t){n.e(t)}finally{n.f()}return this}}])&&Li(n.prototype,r),o&&Li(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Ti);function Bi(t){return Bi="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},Bi(t)}function Di(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,Gi(r.key),r)}}function Gi(t){var e=function(t){if("object"!=Bi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Bi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Bi(e)?e:e+""}function Ui(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ui=function(){return!!t})()}function Wi(t){return Wi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wi(t)}function qi(t,e){return qi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qi(t,e)}var Yi=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Wi(e),function(t,e){if(e&&("object"==Bi(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)}(t,Ui()?Reflect.construct(e,n||[],Wi(t).constructor):e.apply(t,n))}(this,e,arguments)}return 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&&qi(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){throw new Error("Method draw not implemented.")}}])&&Di(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ti);function $i(t){return $i="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},$i(t)}function Hi(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Xi(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 Vi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Xi(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Xi(t,e){if(t){if("string"==typeof t)return Zi(t,e);var n={}.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)?Zi(t,e):void 0}}function Zi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ji(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,Qi(r.key),r)}}function Qi(t){var e=function(t){if("object"!=$i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$i(e)?e:e+""}var Ki=function(){return t=function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=e,this.url=n,this.resolution=r,this.mixedResolution=o.mixedResolution,this.preprocess=o.preprocess||void 0,this.cellsViewCache=[]},(e=[{key:"getData",value:function(){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){if(this.mixedResolution){var n,r=Vi(e);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=+this.mixedResolution(o);if(!(t.x<o.x||o.x+i<t.x||t.y<o.y||o.y+i<t.y))return o}}catch(t){r.e(t)}finally{r.f()}}else{var a=this.getResolution(),u=this.cellIndex(e,a);if(u)for(var l=(t.x-u.ox)/a,c=(t.y-u.oy)/a,s=Math.floor(l),f=Math.floor(c),h=0,y=[[0,0],[-1,0],[0,-1],[-1,-1]];h<y.length;h++){var p=Hi(y[h],2),v=p[0],d=p[1];if(!(v&&l!==s||d&&c!==f)){var b=u.cells.get(ta(s+v,f+d));if(b)return b}}else{var m,g=Vi(e);try{for(g.s();!(m=g.n()).done;){var w=m.value;if(!(t.x<w.x||w.x+a<t.x||t.y<w.y||w.y+a<t.y))return w}}catch(t){g.e(t)}finally{g.f()}}}}},{key:"cellIndex",value:function(t,e){if(this._index&&this._indexCells===t&&this._indexLength===t.length&&this._indexR===e)return this._index;var n=null;if(t.length&&e>0){var r=+t[0].x,o=+t[0].y,i=new Map;n={cells:i,ox:r,oy:o};var a,u=Vi(t);try{for(u.s();!(a=u.n()).done;){var l=a.value,c=(+l.x-r)/e,s=(+l.y-o)/e,f=Math.round(c),h=Math.round(s);if(Math.abs(c-f)>1e-6||Math.abs(s-h)>1e-6){n=null;break}var y=ta(f,h);i.has(y)||i.set(y,l)}}catch(t){u.e(t)}finally{u.f()}}return this._index=n,this._indexCells=t,this._indexLength=t.length,this._indexR=e,n}},{key:"getResolution",value:function(){return this.resolution}},{key:"getViewCache",value:function(){return this.cellsViewCache}},{key:"getDataset",value:function(t,e){return this}}])&&Ji(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ta(t,e){return 4194304*t+e}function ea(t){return ea="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},ea(t)}function na(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ra(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,oa(r.key),r)}}function oa(t){var e=function(t){if("object"!=ea(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ea(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ea(e)?e:e+""}var ia=function(){return t=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.resolutions=e,this.datasets="function"==typeof n?this.resolutions.map(n):n,this.datasets.length>1&&this.datasets.length!=this.resolutions.length)throw new Error("Uncompatible number of datasets and resolutions: "+this.datasets.length+" "+this.resolutions.length);r.preprocess&&this.setPrepocesses(r.preprocess)},(e=[{key:"getDataset",value:function(t,e){if(1==this.datasets.length)return this.datasets[0];for(var n=this.resolutions,r=0,o=n[r]/e;o<t&&r<n.length;)o=n[++r]/e;return r==n.length?this.datasets[n.length-1]:this.datasets[r]}},{key:"setPrepocesses",value:function(t){var e,n=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 na(t,e);var n={}.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)?na(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(this.datasets);try{for(n.s();!(e=n.n()).done;)e.value.preprocess=t}catch(t){n.e(t)}finally{n.f()}return this}}])&&ra(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function aa(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function ua(t,e){return fetch(t,e).then(aa)}var la={},ca={};function sa(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function fa(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 ha(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function ya(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,o=[],i=t.length,a=0,u=0,l=i<=0,c=!1;function s(){if(l)return ca;if(c)return c=!1,la;var e,r,o=a;if(34===t.charCodeAt(o)){for(;a++<i&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=i?l=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(o+1,e-1).replace(/""/g,'"')}for(;a<i;){if(10===(r=t.charCodeAt(e=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(o,e)}return l=!0,t.slice(o,i)}for(10===t.charCodeAt(i-1)&&--i,13===t.charCodeAt(i-1)&&--i;(r=s())!==ca;){for(var f=[];r!==la&&r!==ca;)f.push(r),r=s();e&&null==(f=e(f,u++))||o.push(f)}return o}function o(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function i(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?(o=(n=t).getUTCHours(),i=n.getUTCMinutes(),a=n.getUTCSeconds(),u=n.getUTCMilliseconds(),isNaN(n)?"Invalid Date":((r=n.getUTCFullYear())<0?"-"+ha(-r,6):r>9999?"+"+ha(r,6):ha(r,4))+"-"+ha(n.getUTCMonth()+1,2)+"-"+ha(n.getUTCDate(),2)+(u?"T"+ha(o,2)+":"+ha(i,2)+":"+ha(a,2)+"."+ha(u,3)+"Z":a?"T"+ha(o,2)+":"+ha(i,2)+":"+ha(a,2)+"Z":i||o?"T"+ha(o,2)+":"+ha(i,2)+"Z":"")):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t;var n,r,o,i,a,u}return{parse:function(t,e){var n,o,i=r(t,(function(t,r){if(n)return n(t,r-1);o=t,n=e?function(t,e){var n=sa(t);return function(r,o){return e(n(r),o,t)}}(t,e):sa(t)}));return i.columns=o||[],i},parseRows:r,format:function(e,n){return null==n&&(n=fa(e)),[n.map(a).join(t)].concat(o(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=fa(t)),o(t,e).join("\n")},formatRows:function(t){return t.map(i).join("\n")},formatRow:i,formatValue:a}}var pa=ya(","),va=pa.parse,da=(pa.parseRows,pa.format,pa.formatBody,pa.formatRows,pa.formatRow,pa.formatValue,ya("\t")),ba=da.parse;function ma(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function ga(t,e){return fetch(t,e).then(ma)}function wa(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),ga(e,n).then((function(e){return t(e,r)}))}}function xa(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var o=ya(t);return ga(e,n).then((function(t){return o.parse(t,r)}))}da.parseRows,da.format,da.formatBody,da.formatRows,da.formatRow,da.formatValue;var _a=wa(va);function Sa(t){return Sa="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},Sa(t)}function Oa(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 ja(t,e);var n={}.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)?ja(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function ja(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Pa(){Pa=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),u=new C(r||[]);return o(a,"_invoke",{value:P(t,n,u)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",y="suspendedYield",p="executing",v="completed",d={};function b(){}function m(){}function g(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(A([])));_&&_!==n&&r.call(_,a)&&(w=_);var S=g.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(o,i,a,u){var l=f(t[o],t,i);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"==Sa(s)&&r.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(s).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,n,r){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var l=E(u,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?v:y,c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function k(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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function A(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Sa(e)+" is not iterable")}return m.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:m,configurable:!0}),m.displayName=c(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},O(j.prototype),c(j.prototype,u,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new j(s(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),c(S,l,"Generator"),c(S,a,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.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}},e.values=A,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return u.type="throw",u.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},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),d},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),T(n),d}},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 o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:A(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),d}},e}function Ea(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function ka(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){Ea(i,r,o,a,u,"next",t)}function u(t){Ea(i,r,o,a,u,"throw",t)}a(void 0)}))}}function Ta(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,Ca(r.key),r)}}function Ca(t){var e=function(t){if("object"!=Sa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Sa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Sa(e)?e:e+""}function Aa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Aa=function(){return!!t})()}function Ma(t){return Ma=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ma(t)}function La(t,e){return La=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},La(t,e)}wa(ba);var za=function(t){function e(t,n){var r,o=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,e),(r=function(t,e,n){return e=Ma(e),function(t,e){if(e&&("object"==Sa(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)}(t,Aa()?Reflect.construct(e,n||[],Ma(t).constructor):e.apply(t,n))}(this,e,[t,n,0,o])).onlyDrawWhenAllTilesReady=o.onlyDrawWhenAllTilesReady||!1,r.info=void 0,r.infoLoadingStatus="notLoaded",r.cache={},r.loadInfo(),r}return 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&&La(t,e)}(e,t),n=e,r=[{key:"loadInfo",value:function(){var t=this;return this.info||"notLoaded"!==this.infoLoadingStatus||(this.infoLoadingStatus="loading",ka(Pa().mark((function e(){var n;return Pa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ua(t.url+"info.json");case 3:n=e.sent,t.info=n,t.resolution=n.resolutionGeo,t.infoLoadingStatus="loaded",t.isShown()&&t.map.redraw(),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),t.infoLoadingStatus="failed";case 13:case"end":return e.stop()}}),e,null,[[0,10]])})))()),this}},{key:"isShown",value:function(){if(!this.map||!this.map.layers)return!1;var t,e=this.map.getZoom(),n=Oa(this.map.layers);try{for(n.s();!(t=n.n()).done;){var r=t.value;if((!r.visible||r.visible(e))&&r.getDataset&&r.getDataset(e)==this)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{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()}},{key:"getData",value:(i=ka(Pa().mark((function t(e){var n,r,o,i,a,u,l,c,s,f,h,y,p,v,d,b,m=this;return Pa().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.info){t.next=2;break}return t.abrupt("return",this);case 2:if(this.abortController=new AbortController,n=this.abortController.signal,r=this.getTilingEnvelope(e)){t.next=7;break}return t.abrupt("return",this);case 7:o=this.info.tilingBounds,i=o.xMin,a=o.xMax,u=o.yMin,l=o.yMax,c=Math.max(r.xMin,i),s=Math.min(r.xMax,a),f=Math.max(r.yMin,u),h=Math.min(r.yMax,l),y=(s-c+1)*(h-f+1),p=0,v=[],d=Pa().mark((function t(e){var r,o;return Pa().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=Pa().mark((function t(r){return Pa().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(m.cache[e]||(m.cache[e]={}),!m.cache[e][r]||"failed"===m.cache[e][r]){t.next=4;break}return++p,t.abrupt("return",1);case 4:m.cache[e][r]="loading",v.push(m.loadTile(e,r,n).then((function(t){m.cache[e][r]=t;var n=++p===y;m.checkAndRedraw(t,n)})).catch((function(){m.cache[e][r]="failed",++p})));case 6:case"end":return t.stop()}}),t)})),o=f;case 2:if(!(o<=h)){t.next=9;break}return t.delegateYield(r(o),"t0",4);case 4:if(!t.t0){t.next=6;break}return t.abrupt("continue",6);case 6:o++,t.next=2;break;case 9:case"end":return t.stop()}}),t)})),b=c;case 17:if(!(b<=s)){t.next=22;break}return t.delegateYield(d(b),"t0",19);case 19:b++,t.next=17;break;case 22:return t.next=24,Promise.allSettled(v);case 24:return t.abrupt("return",this);case 25:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"loadTile",value:(o=ka(Pa().mark((function t(e,n,r){var o,i,a=this;return Pa().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,_a("".concat(this.url).concat(e,"/").concat(n,".csv"),{signal:r});case 3:if(o=t.sent,i=this.preprocess?o.filter((function(t){return!1!==a.preprocess(t)})):o,this.info){t.next=7;break}throw new Error("Tile info unknown");case 7:return t.abrupt("return",Ra(i,e,n,this.info));case 10:throw t.prev=10,t.t0=t.catch(0),"AbortError"===t.t0.name&&console.warn("Tile request for ".concat(e,", ").concat(n," was aborted.")),t.t0;case 14:case"end":return t.stop()}}),t,this,[[0,10]])}))),function(t,e,n){return o.apply(this,arguments)})},{key:"cancelCurrentRequests",value:function(){this.abortController&&this.abortController.abort()}},{key:"checkAndRedraw",value:function(t,e){if(this.isShown()){var n=this.map.updateExtentGeo(),r=t.extGeo,o=r.xMin,i=r.xMax,a=r.yMin,u=r.yMax;n.xMax<=o||n.xMin>=i||n.yMax<=a||n.yMin>=u||(this.onlyDrawWhenAllTilesReady?e&&this.map.redraw():this.map.redraw())}}},{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 o=Math.max(e.yMin,n.yMin);o<=Math.min(e.yMax,n.yMax);o++){var i=this.cache[r][o];if(i&&"string"!=typeof i){var a,u=Oa(i.cells);try{for(u.s();!(a=u.n()).done;){var l=a.value;+l.x+this.resolution<t.xMin||+l.x-this.resolution>t.xMax||+l.y+this.resolution<t.yMin||+l.y-this.resolution>t.yMax||this.cellsViewCache.push(l)}}catch(t){u.e(t)}finally{u.f()}}}}}}],r&&Ta(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Ki);function Ra(t,e,n,r){var o={};o.cells=t,o.x=e,o.y=n;var i=r.resolutionGeo,a=r.tileSizeCell;o.extGeo={xMin:r.originPoint.x+i*a*o.x,xMax:r.originPoint.x+i*a*(o.x+1),yMin:r.originPoint.y+i*a*o.y,yMax:r.originPoint.y+i*a*(o.y+1)};var u,l=Oa(o.cells);try{for(l.s();!(u=l.n()).done;){var c=u.value;c.x=o.extGeo.xMin+c.x*i,c.y=o.extGeo.yMin+c.y*i}}catch(t){l.e(t)}finally{l.f()}return o}function Ia(t){return Ia="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},Ia(t)}function Fa(){Fa=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),u=new C(r||[]);return o(a,"_invoke",{value:P(t,n,u)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",y="suspendedYield",p="executing",v="completed",d={};function b(){}function m(){}function g(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(A([])));_&&_!==n&&r.call(_,a)&&(w=_);var S=g.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(o,i,a,u){var l=f(t[o],t,i);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"==Ia(s)&&r.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(s).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,n,r){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var l=E(u,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?v:y,c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function k(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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function A(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Ia(e)+" is not iterable")}return m.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:m,configurable:!0}),m.displayName=c(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},O(j.prototype),c(j.prototype,u,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new j(s(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),c(S,l,"Generator"),c(S,a,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.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}},e.values=A,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return u.type="throw",u.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},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),d},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),T(n),d}},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 o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:A(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),d}},e}function Na(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 Ba(t,e);var n={}.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)?Ba(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Ba(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Da(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function Ga(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,Ua(r.key),r)}}function Ua(t){var e=function(t){if("object"!=Ia(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ia(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ia(e)?e:e+""}function Wa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Wa=function(){return!!t})()}function qa(t){return qa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qa(t)}function Ya(t,e){return Ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ya(t,e)}var $a=function(t){function e(t,n,r){var o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=function(t,e,n){return e=qa(e),function(t,e){if(e&&("object"==Ia(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)}(t,Wa()?Reflect.construct(e,n||[],qa(t).constructor):e.apply(t,n))}(this,e,[t,n,r,i])).cells=[],o.delimiter=i.delimiter||",",o.infoLoadingStatus="notLoaded",o.getData(void 0),o}return 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&&Ya(t,e)}(e,t),n=e,r=[{key:"getData",value:function(t){var e,n=this;return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",(e=Fa().mark((function t(){var e,r,o,i,a,u,l;return Fa().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,xa(n.delimiter,n.url);case 3:e=t.sent,r=Na(e);try{for(r.s();!(o=r.n()).done;)(i=o.value).x=+i.x,i.y=+i.y}catch(t){r.e(t)}finally{r.f()}if(!n.preprocess){t.next=29;break}n.cells=[],a=Na(e),t.prev=9,a.s();case 11:if((u=a.n()).done){t.next=19;break}if(l=u.value,0!=n.preprocess(l)){t.next=16;break}return t.abrupt("continue",17);case 16:n.cells.push(l);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:n.cells=e;case 30:n.map&&n.map.redraw(),n.infoLoadingStatus="loaded",t.next=38;break;case 34:t.prev=34,t.t1=t.catch(0),n.infoLoadingStatus="failed",n.cells=[];case 38:case"end":return t.stop()}}),t,null,[[0,34],[9,21,24,27]])})),function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(t){Da(i,r,o,a,u,"next",t)}function u(t){Da(i,r,o,a,u,"throw",t)}a(void 0)}))})()),this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=Na(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()}}}}],r&&Ga(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ki);function Ha(t){return Ha="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},Ha(t)}function Va(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Xa(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,Za(r.key),r)}}function Za(t){var e=function(t){if("object"!=Ha(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ha(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ha(e)?e:e+""}function Ja(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ja=function(){return!!t})()}function Qa(t){return Qa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qa(t)}function Ka(t,e){return Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ka(t,e)}var tu=function(t){function e(t,n){var r,o=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,e),(r=function(t,e,n){return e=Qa(e),function(t,e){if(e&&("object"==Ha(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)}(t,Ja()?Reflect.construct(e,n||[],Qa(t).constructor):e.apply(t,n))}(this,e,[void 0,"",t,o])).cells=n||[],r}return 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&&Ka(t,e)}(e,t),n=e,(r=[{key:"getData",value:function(t){return this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=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 Va(t,e);var n={}.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)?Va(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(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()}}}}])&&Xa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ki);function eu(t){return eu="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},eu(t)}function nu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ru(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,ou(r.key),r)}}function ou(t){var e=function(t){if("object"!=eu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=eu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==eu(e)?e:e+""}function iu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(iu=function(){return!!t})()}function au(t){return au=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},au(t)}function uu(t,e){return uu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uu(t,e)}var lu=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=au(e),function(t,e){if(e&&("object"==eu(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)}(t,iu()?Reflect.construct(e,n||[],au(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||"#EA6BAC",n.size=t.size||function(t,e){return e},n.shape=t.shape||"square",n}return 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&&uu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=this.viewScale?this.viewScale(t,n,o):void 0,a=.5*n,u="function"==typeof this.color,l="function"==typeof this.size,c="function"==typeof this.shape,s=this.color||"black",f=this.size||n,h=this.shape||"square",y=u?this.color:null,p=l?this.size:null,v=c?this.shape:null,d=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 nu(t,e);var n={}.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)?nu(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(d.s();!(r=d.n()).done;){var b=r.value,m=y?y(b,n,o,i):s;if(m&&"none"!==m){var g=p?p(b,n,o,i):f;if(g){var w=v?v(b,n,o,i):h;if("none"!==w){var x=this.offset(b,n,o),_=e.offscreenCtx;if(_.fillStyle=m,"square"===w){var S=n*(1-g/n)*.5;_.fillRect(b.x+S+x.dx,b.y+S+x.dy,g,g)}else if("circle"===w)_.beginPath(),_.arc(b.x+a+x.dx,b.y+a+x.dy,.5*g,0,2*Math.PI,!1),_.fill();else if("donut"===w){var O=b.x+a+x.dx,j=b.y+a+x.dy;_.beginPath(),_.moveTo(O,j),_.arc(O,j,a,0,2*Math.PI),_.arc(O,j,(1-g/n)*a,0,2*Math.PI,!0),_.closePath(),_.fill()}else if("diamond"===w){var P=.5*g;_.beginPath(),_.moveTo(b.x+a-P,b.y+a),_.lineTo(b.x+a,b.y+a+P),_.lineTo(b.x+a+P,b.y+a),_.lineTo(b.x+a,b.y+a-P),_.fill()}else if("triangle_up"===w){var E=(g-n)/2;_.beginPath(),_.moveTo(b.x-E,b.y-E),_.lineTo(b.x+a,b.y+n+E),_.lineTo(b.x+n+E,b.y-E),_.fill()}else if("triangle_down"===w){var k=(g-n)/2;_.beginPath(),_.moveTo(b.x-k,b.y+n+k),_.lineTo(b.x+a,b.y-k),_.lineTo(b.x+n+k,b.y+n+k),_.fill()}else if("triangle_left"===w){var T=(g-n)/2;_.beginPath(),_.moveTo(b.x+n+T,b.y+n+T),_.lineTo(b.x-T,b.y+a),_.lineTo(b.x+n+T,b.y-T),_.fill()}else{if("triangle_right"!==w)throw new Error("Unexpected shape:"+w);var C=(g-n)/2;_.beginPath(),_.moveTo(b.x-C,b.y-C),_.lineTo(b.x+n+C,b.y+a),_.lineTo(b.x-C,b.y+n+C),_.fill()}}}}}}catch(t){d.e(t)}finally{d.f()}this.updateLegends({viewScale:i,resolution:n,z:o,cells:t})}}],r&&ru(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function cu(t){return cu="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},cu(t)}function su(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function fu(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,hu(r.key),r)}}function hu(t){var e=function(t){if("object"!=cu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=cu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cu(e)?e:e+""}function yu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yu=function(){return!!t})()}function pu(t){return pu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pu(t)}function vu(t,e){return vu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vu(t,e)}var du=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=pu(e),function(t,e){if(e&&("object"==cu(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)}(t,yu()?Reflect.construct(e,n||[],pu(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.strokeColor=t.strokeColor||function(){return"#666"},n.size=t.size||function(t,e){return e},n.strokeWidth=t.strokeWidth||function(t,e,n){return 1.5*n},n.shape=t.shape||function(){return"square"},n}return 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&&vu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=.5*n,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 su(t,e);var n={}.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)?su(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(l.s();!(r=l.n()).done;){var c=r.value,s=this.strokeColor?this.strokeColor(c,n,o,a):void 0;if(s&&"none"!==s){i.strokeStyle=s;var f=this.size?this.size(c,n,o,a):n,h=this.strokeWidth?this.strokeWidth(c,n,o,a):1*o;if(h&&!(h<=0)){i.lineWidth=h;var y=this.shape?this.shape(c,n,o,a):"square";if("none"!==y){var p=this.offset(c,n,o);if("square"===y){var v=n*(1-f/n)*.5;i.beginPath(),i.rect(c.x+v+p.dx,c.y+v+p.dy,f,f),i.stroke()}else if("circle"===y)i.beginPath(),i.arc(c.x+u+p.dx,c.y+u+p.dy,.5*f,0,2*Math.PI,!1),i.stroke();else if("diamond"===y){var d=.5*f;i.beginPath(),i.moveTo(c.x+u-d,c.y+u),i.lineTo(c.x+u,c.y+u+d),i.lineTo(c.x+u+d,c.y+u),i.lineTo(c.x+u,c.y+u-d),i.lineTo(c.x+u-d,c.y+u),i.stroke()}else if("donut"===y)console.error("Not implemented");else if("triangle_up"===y){var b=(f-n)/2;i.beginPath(),i.moveTo(c.x-b,c.y-b),i.lineTo(c.x+u,c.y+n+b),i.lineTo(c.x+n+b,c.y-b),i.closePath(),i.stroke()}else if("triangle_down"===y){var m=(f-n)/2;i.beginPath(),i.moveTo(c.x-m,c.y+n+m),i.lineTo(c.x+u,c.y-m),i.lineTo(c.x+n+m,c.y+n+m),i.closePath(),i.stroke()}else if("triangle_left"===y){var g=(f-n)/2;i.beginPath(),i.moveTo(c.x+n+g,c.y+n+g),i.lineTo(c.x-g,c.y+u),i.lineTo(c.x+n+g,c.y-g),i.closePath(),i.stroke()}else{if("triangle_right"!==y)throw new Error("Unexpected shape:"+y);var w=(f-n)/2;i.beginPath(),i.moveTo(c.x-w,c.y-w),i.lineTo(c.x+n+w,c.y+u),i.lineTo(c.x-w,c.y+n+w),i.closePath(),i.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&fu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function bu(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let o=-1;for(let i of t)null!=(i=e(i,++o,t))&&(void 0===n?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}return[n,r]}function mu(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||wu(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 gu(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=wu(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function wu(t,e){if(t){if("string"==typeof t)return xu(t,e);var n={}.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)?xu(t,e):void 0}}function xu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function _u(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[8,6,5,4,2.5,2],r=Math.pow(10,Math.floor(Math.log10(t))),o=gu(n);try{for(o.s();!(e=o.n()).done;){var i=e.value;if(r*i<=t)return r*i}}catch(t){o.e(t)}finally{o.f()}return r}function Su(t,e,n){var r=bu(t,(function(t){return t.x})),o=mu(r,2),i=o[0],a=o[1],u=bu(t,(function(t){return t.y})),l=mu(u,2),c=l[0],s=l[1],f=Math.ceil((s-c)/e)+1,h=Math.ceil((a-i)/e)+1,y=Array.from({length:f},(function(){return new Array(h).fill(void 0)}));y.x0=i,y.y0=s,y.resolution=e;var p,v=gu(t);try{for(v.s();!(p=v.n()).done;){var d=p.value,b=Math.floor((s-d.y)/e),m=Math.floor((d.x-i)/e),g=n?n(d):d;y[b][m]=g}}catch(t){v.e(t)}finally{v.f()}return y}function Ou(t){return Ou="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},Ou(t)}function ju(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,Pu(r.key),r)}}function Pu(t){var e=function(t){if("object"!=Ou(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ou(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ou(e)?e:e+""}function Eu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Eu=function(){return!!t})()}function ku(t){return ku=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ku(t)}function Tu(t,e){return Tu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tu(t,e)}var Cu=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ku(e),function(t,e){if(e&&("object"==Ou(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)}(t,Eu()?Reflect.construct(e,n||[],ku(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.height=t.height||function(t,e){return e*Math.random()},n.lineColor=t.lineColor||function(t,e,n,r){return"#BBB"},n.lineWidth=t.lineWidth||function(t,e,n,r){return r},n.fillColor=t.fillColor||function(t,e,n,r){return"#c08c5968"},n}return 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&&Tu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=function(t,e){var n,r={},o=gu(t);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=r[i.y];a||(a={},r[i.y]=a),a[i.x]=e?e(i):i}}catch(t){o.e(t)}finally{o.f()}return r}(t,(function(t){return r.height(t,n,o,a)})),l=e.extGeo;if(l){var c=Math.floor(l.xMin/n)*n,s=Math.floor(l.xMax/n)*n,f=Math.floor(l.yMin/n)*n,h=Math.floor(l.yMax/n)*n,y={min:f,max:h};i.lineJoin="round";for(var p=h;p>=f;p-=n){var v=u[p];if(v){i.beginPath(),i.moveTo(c-n/2,p);for(var d=void 0,b=c;b<=s;b+=n){var m=v[b];m||(m=0),m||d?i.lineTo(b+n/2,p+m):i.moveTo(b+n/2,p),d=m}d&&i.lineTo(s+n/2,p);var g=this.fillColor(p,y,n,o);g&&"none"!=g&&(i.fillStyle=g,i.fill());var w=this.lineColor(p,y,n,o),x=this.lineWidth(p,y,n,o);w&&"none"!=w&&x>0&&(i.strokeStyle=w,i.lineWidth=x,i.stroke())}}}}}],r&&ju(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function Au(t){return Au="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},Au(t)}function Mu(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Lu(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 Lu(t,e){if(t){if("string"==typeof t)return zu(t,e);var n={}.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)?zu(t,e):void 0}}function zu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ru(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,Iu(r.key),r)}}function Iu(t){var e=function(t){if("object"!=Au(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Au(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Au(e)?e:e+""}function Fu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Fu=function(){return!!t})()}function Nu(t){return Nu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nu(t)}function Bu(t,e){return Bu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bu(t,e)}var Du=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Nu(e),function(t,e){if(e&&("object"==Au(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)}(t,Fu()?Reflect.construct(e,n||[],Nu(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color,n.type=t.type||function(){return"flag"},n.size=t.size||function(t,e){return e},n.stripesOrientation=t.stripesOrientation||function(){return 0},n.offsetAngle=t.offsetAngle||function(){return 0},n.agePyramidHeight=t.agePyramidHeight||function(t,e){return e},n.pieChartInternalRadiusFactor=t.pieChartInternalRadiusFactor||0,n}return 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&&Bu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=Object.entries(this.color).length,l=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Lu(t))){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}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,i=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==e.return||e.return()}finally{if(a)throw o}}}}(t);try{for(l.s();!(r=l.n()).done;){var c=r.value,s=this.size?this.size(c,n,o,a):n;if(s){var f=this.offset(c,n,o),h=this.type?this.type(c,n,o,a):"flag",y=c.x+f.dx+("agepyramid"===h?0:.5*n),p=c.y+f.dy+("agepyramid"===h?0:.5*n),v=this.offsetAngle?this.offsetAngle(c,n,o,a)*Math.PI/180:0;if("agepyramid"===h||"radar"===h||"halftone"===h){for(var d=-1/0,b=0,m=Object.keys(this.color);b<m.length;b++){var g=+c[m[b]];g>d&&(d=g)}var w=0;"agepyramid"===h&&this.agePyramidHeight&&(w=(n-this.agePyramidHeight(c,n,o,a))/2),"radar"!==h&&"halftone"!==h||(w=Math.PI/2+v);var x="agepyramid"===h?(this.agePyramidHeight?this.agePyramidHeight(c,n,o,a):n)/u:"radar"===h||"halftone"===h?2*Math.PI/u:void 0;if(void 0===x)throw new Error("Unexpected symbol type:"+h);for(var _=0,S=Object.entries(this.color);_<S.length;_++){var O=Mu(S[_],2),j=O[0],P=O[1];if("agepyramid"===h){i.fillStyle=P;var E=s*c[j]/d;i.fillRect(y+(n-E)/2,p+w,E,x),w+=x}else if("radar"===h){i.fillStyle=P;var k=c[j],T=s/2*Math.sqrt(k/d);i.beginPath(),i.moveTo(y,p),i.arc(y,p,T,w-x,w),i.lineTo(y,p),i.fill(),w+=x}else{if("halftone"!==h)throw new Error("Unexpected symbol type:"+h);i.fillStyle=P;var C=c[j],A=.333*s*Math.sqrt(C/d);i.beginPath(),i.arc(y+.25*n*Math.cos(w),p+.25*n*Math.sin(w),A,0,2*Math.PI),i.fill(),w+=x}}}else{for(var M=0,L=0,z=Object.keys(this.color);L<z.length;L++){var R=+c[z[L]];R&&(M+=R)}if(!M||isNaN(M))continue;for(var I=0,F=n*(1-s/n)*.5,N=this.stripesOrientation(c,n,o,a),B=0,D=Object.entries(this.color);B<D.length;B++){var G=Mu(D[B],2),U=G[0],W=G[1],q=c[U]/M;if(q&&!isNaN(q)){if(i.fillStyle=W,"flag"===h)0==N?i.fillRect(c.x+F+f.dx,c.y+F+I*s+f.dy,s,q*s):i.fillRect(c.x+F+I*s+f.dx,c.y+F+f.dy,q*s,s);else if("piechart"===h){var Y=2*I*Math.PI,$=2*(I+q)*Math.PI;i.beginPath(),i.moveTo(y,p),i.arc(y,p,.5*s,Y+v,$+v),this.pieChartInternalRadiusFactor&&i.arc(y,p,.5*s*this.pieChartInternalRadiusFactor,Y+v,$+v,!0),i.closePath(),i.fill()}else if("ring"===h)i.beginPath(),i.arc(y,p,Math.sqrt(1-I)*s*.5,0,2*Math.PI),i.fill();else{if("segment"!==h)throw new Error("Unexpected symbol type:"+h);var H=s*s/n;0==N?i.fillRect(c.x+f.dx,c.y+(n-H)/2+I*H+f.dy,n,q*H):i.fillRect(c.x+I*n+f.dx,c.y+(n-H)/2+f.dy,q*n,H)}I+=q}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&Ru(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function Gu(t){return Gu="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},Gu(t)}function Uu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Wu(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,qu(r.key),r)}}function qu(t){var e=function(t){if("object"!=Gu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Gu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Gu(e)?e:e+""}function Yu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yu=function(){return!!t})()}function $u(t){return $u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$u(t)}function Hu(t,e){return Hu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Hu(t,e)}var Vu=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=$u(e),function(t,e){if(e&&("object"==Gu(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)}(t,Yu()?Reflect.construct(e,n||[],$u(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.width=t.width||function(t,e){return.1*e},n.length=t.length||function(t,e){return.9*e},n.orientation=t.orientation||function(){return 180*Math.random()},n}return 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&&Hu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;o.lineCap="butt";var a,u=Math.PI/180,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 Uu(t,e);var n={}.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)?Uu(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(l.s();!(a=l.n()).done;){var c=a.value,s=this.color?this.color(c,n,r,i):void 0;if(s){var f=this.width?this.width(c,n,r,i):void 0;if(f&&!(f<0)){var h=this.length?this.length(c,n,r,i):void 0;if(h&&!(h<0)){var y=this.orientation(c,n,r,i)*u;if(void 0!==y&&!isNaN(y)){var p=this.offset(c,n,r);o.strokeStyle=s,o.lineWidth=f;var v=c.x+n/2+p.dx,d=c.y+n/2+p.dy,b=.5*Math.cos(y)*h,m=.5*Math.sin(y)*h;o.beginPath(),o.moveTo(v-b,d-m),o.lineTo(v+b,d+m),o.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({viewScale:i,resolution:n,z:r,cells:t})}}],r&&Wu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function Xu(t){return Xu="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},Xu(t)}function Zu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ju(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,Qu(r.key),r)}}function Qu(t){var e=function(t){if("object"!=Xu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Xu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xu(e)?e:e+""}function Ku(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ku=function(){return!!t})()}function tl(t){return tl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tl(t)}function el(t,e){return el=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},el(t,e)}var nl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=tl(e),function(t,e){if(e&&("object"==Xu(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)}(t,Ku()?Reflect.construct(e,n||[],tl(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.text=t.text||function(){return"X"},n.color=t.color||function(){return"black"},n.fontSize=t.fontSize||function(t,e){return e},n.fontFamily=t.fontFamily||function(){return"Arial"},n.fontWeight=t.fontWeight||function(){return"bold"},n}return 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&&el(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;e.initCanvasTransform();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 Zu(t,e);var n={}.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)?Zu(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(u.s();!(a=u.n()).done;){var l=a.value,c=this.text?this.text(l,n,r,i):void 0;if(null!=c&&null!=c&&c+""!=""){var s=this.color?this.color(l,n,r,i):void 0;if(s){o.fillStyle=s;var f=this.fontSize(l,n,r,i)/r;if(f){var h=this.fontFamily?this.fontFamily(l,n,r,i):"Arial",y=this.fontWeight?this.fontWeight(l,n,r,i):"bold";o.font=y+" "+f+"px "+h;var p=this.offset(l,n,r);o.textAlign="center";var v=e.geoToPixX(l.x+.5*n+p.dx),d=e.geoToPixY(l.y+.5*n+p.dy)+.3*f;o.fillText(c,v,d)}}}}}catch(t){u.e(t)}finally{u.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i})}}],o=[{key:"textScale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=t.length;return function(r){return e&&(r=e(r)),0==r?"":r>=1?t[n-1]:t[Math.floor(r*n)]}}}],r&&Ju(n.prototype,r),o&&Ju(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Ni);function rl(t){return rl="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},rl(t)}function ol(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 il(t,e);var n={}.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)?il(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function il(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}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,ul(r.key),r)}}function ul(t){var e=function(t){if("object"!=rl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=rl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==rl(e)?e:e+""}function ll(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ll=function(){return!!t})()}function cl(t){return cl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cl(t)}function sl(t,e){return sl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sl(t,e)}var fl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=cl(e),function(t,e){if(e&&("object"==rl(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)}(t,ll()?Reflect.construct(e,n||[],cl(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.height=t.height,n.color=t.color||function(){return"#c08c59"},n.width=t.width||function(t,e){return.5*e},n.simple=t.simple||function(){return!1},n.viewHeightFactor=t.viewHeightFactor||1.5,n.viewSX=null==t.viewSX?0:t.viewSX,n.viewSY=null==t.viewSY?-.5:t.viewSY,n.shadowDirection=null==t.shadowDirection?-40.3*Math.PI/180:t.shadowDirection,n.shadowFactor=t.shadowFactor||.3,n.shadowColor=t.shadowColor||"#00000033",n.outlineCol=t.outlineCol||"#FFFFFF",n.outlineWidthPix=null==t.outlineWidthPix?.5:t.outlineWidthPix,n}return 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&&sl(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0,a=e.view.x+this.viewSX*e.w*r,u=e.view.y+this.viewSY*e.h*r,l=this.viewHeightFactor*(e.w+e.h)*.5*r;t.sort((function(t,e){return 1e8*(e.y-t.y)+t.x-e.x}));var c=this.simple(n,r,i);o.lineCap=c?"butt":"round",o.strokeStyle=this.shadowColor,o.fillStyle=this.shadowColor;var s,f=ol(t);try{for(f.s();!(s=f.n()).done;){var h=s.value,y=this.width?this.width(h,n,r,i):void 0;if(y&&!(y<0)){var p=this.height?this.height(h,n,r,i):void 0;if(p&&!(p<0)){o.lineWidth=y;var v=h.x+n/2,d=h.y+n/2,b=p*this.shadowFactor;o.beginPath(),o.moveTo(v,d),o.lineTo(v+b*Math.cos(this.shadowDirection),d+b*Math.sin(this.shadowDirection)),o.stroke()}}}}catch(t){f.e(t)}finally{f.f()}var m,g=ol(t);try{for(g.s();!(m=g.n()).done;){var w=m.value,x=this.color?this.color(w,n,r,i):void 0;if(x){var _=this.width?this.width(w,n,r,i):void 0;if(_&&!(_<0)){var S=this.height?this.height(w,n,r,i):void 0;if(S&&!(S<0)){var O=w.x+n/2,j=w.y+n/2,P=O-a,E=j-u,k=Math.atan2(E,P),T=Math.sqrt(P*P+E*E)*S/(l-S);c?(o.strokeStyle=x,o.lineWidth=_,o.beginPath(),o.moveTo(O,j),o.lineTo(O+T*Math.cos(k),j+T*Math.sin(k)),o.stroke()):(o.strokeStyle=this.outlineCol,o.lineWidth=_+2*this.outlineWidthPix*r,o.beginPath(),o.moveTo(O,j),o.lineTo(O+T*Math.cos(k),j+T*Math.sin(k)),o.stroke(),o.strokeStyle=x,o.lineWidth=_,o.beginPath(),o.moveTo(O,j),o.lineTo(O+T*Math.cos(k),j+T*Math.sin(k)),o.stroke(),o.strokeStyle=this.outlineCol,o.lineWidth=this.outlineWidthPix*r,o.beginPath(),o.arc(O+T*Math.cos(k),j+T*Math.sin(k),.5*_,0,2*Math.PI,!1),o.stroke())}}}}}catch(t){g.e(t)}finally{g.f()}o.lineCap="butt",this.updateLegends({style:this,resolution:n,z:r,viewScale:i})}}],r&&al(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);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 yl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function pl(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,vl(r.key),r)}}function vl(t){var e=function(t){if("object"!=hl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hl(e)?e:e+""}function dl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(dl=function(){return!!t})()}function bl(t){return bl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bl(t)}function ml(t,e){return ml=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ml(t,e)}var gl=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,n){return e=bl(e),function(t,e){if(e&&("object"==hl(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)}(t,dl()?Reflect.construct(e,n||[],bl(t).constructor):e.apply(t,n))}(this,e,[n])).color=n.color||function(t,e,n,r){return"#EA6BAC"},t.width=n.width||function(t,e,n,r){return e/5},t.length=n.length||function(t,e,n,r){return e},t.diamond=n.diamond,t}return 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&&ml(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n,r){this.filter&&(t=t.filter(this.filter));var o=n.view.z,i=n.offscreenCtx,a=e.buildSides(t,r);if(0!=a.length){var u=this.viewScale?this.viewScale(a,r,o):void 0;i.lineCap="butt";var l,c=.5*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 yl(t,e);var n={}.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,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(a);try{for(s.s();!(l=s.n()).done;){var f=l.value,h=this.color?this.color(f,r,o,u):void 0;if(h&&"none"!=h)if(this.diamond){i.fillStyle=h;var y=f.x,p=f.y;i.beginPath(),i.moveTo(y-c,p),i.lineTo(y,p+c),i.lineTo(y+c,p),i.lineTo(y,p-c),i.closePath(),i.fill()}else{var v=this.width?this.width(f,r,o,u):void 0;if(!v||v<=0)continue;var d=this.length?this.length(f,r,o,u):void 0;if(!d||d<=0)continue;var b=.5*d;i.lineWidth=v,i.strokeStyle=h;var m=f.x,g=f.y;i.beginPath(),"v"===f.or?(i.moveTo(m,g-b),i.lineTo(m,g+b)):(i.moveTo(m-b,g),i.lineTo(m+b,g)),i.stroke()}}}catch(t){s.e(t)}finally{s.f()}this.updateLegends({style:this,resolution:r,z:o,viewScale:u})}}}],o=[{key:"buildSides",value:function(t,e){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.01,r=[],o=arguments.length>4&&void 0!==arguments[4]&&!arguments[4]?0:e/2;n*=e;var i=Math.abs;t.sort((function(t,e){return e.x==t.x?t.y-e.y:t.x-e.x}));for(var a=t[0],u=1;u<t.length;u++){var l=t[u];i(a.y+e-l.y)<n&&i(a.x-l.x)<n?r.push({or:"h",x:a.x+o,y:l.y,c1:a,c2:l}):(r.push({or:"h",x:a.x+o,y:a.y+e,c1:a,c2:void 0}),r.push({or:"h",x:l.x+o,y:l.y,c1:void 0,c2:l})),a=l}t.sort((function(t,e){return e.y==t.y?t.x-e.x:t.y-e.y})),a=t[0];for(var c=1;c<t.length;c++){var s=t[c];i(a.x+e-s.x)<n&&i(a.y-s.y)<n?r.push({or:"v",x:a.x+e,y:a.y+o,c1:a,c2:s}):(r.push({or:"v",x:a.x+e,y:a.y+o,c1:a,c2:void 0}),r.push({or:"v",x:s.x,y:s.y+o,c1:void 0,c2:s})),a=s}return r}}],r&&pl(n.prototype,r),o&&pl(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Ni),wl=new Map;function xl(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=JSON.stringify(n||{}),o=wl.get(r);return o&&!o.gl.isContextLost()||(o=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=document.createElement("canvas");r.setAttribute("width",t),r.setAttribute("height",e);var o=n&&2==+n.version?"2":"",i=r.getContext("webgl"+o,n);if(!i)throw new Error("Unable to initialize WebGL"+o+". Your browser or machine may not support it.");return{canvas:r,gl:i,width:t,height:e}}(t+"",e+"",n),o.width=+t,o.height=+e,wl.set(r,o)),o.width==t&&o.height==e||(o.canvas.width=t,o.canvas.height=e,o.width=+t,o.height=+e),o.gl.viewport(0,0,o.width,o.height),o}var _l=new WeakMap;function Sl(t){var e=_l.get(t);return e||(e={programs:new Map,buffers:new Map,owners:new Map},_l.set(t,e)),e}function Ol(t,e,n){var r=Sl(t).programs,o=e+"\0"+n,i=r.get(o);return i||(i=function(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),o=1;o<n;o++)r[o-1]=arguments[o];for(var i=0,a=r;i<a.length;i++){var u=a[i];t.attachShader(e,u)}if(t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS))return e;throw new Error(t.getProgramInfoLog(e)||"Cannot create webGL program (2)")}(t,El(t,t.VERTEX_SHADER,e),El(t,t.FRAGMENT_SHADER,n)),r.set(o,i)),i}function jl(t,e){var n=Sl(t).buffers,r=n.get(e);return r||(r=t.createBuffer(),n.set(e,r)),r}function Pl(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=Sl(t).owners;return void 0!==n&&r.set(e,n),r.get(e)}function El(t,e){var n=t.createShader(e);if(null==n)throw new Error("Cannot create webGL shader");for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];if(t.shaderSource(n,o.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 kl(t){return kl="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},kl(t)}function Tl(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,Cl(r.key),r)}}function Cl(t){var e=function(t){if("object"!=kl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=kl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==kl(e)?e:e+""}function Al(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Al=function(){return!!t})()}function Ml(t){return Ml=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ml(t)}function Ll(t,e){return Ll=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ll(t,e)}var zl="SquareColorCategoryWebGLStyle.pos",Rl="SquareColorCategoryWebGLStyle.i",Il=function(t){function e(t){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Ml(e),function(t,e){if(e&&("object"==kl(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)}(t,Al()?Reflect.construct(e,n||[],Ml(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.code=t.code,t.color=t.color||void 0;var r=Object.keys(t.color);n.catToI={};for(var o=0;o<r.length;o++)n.catToI[r[o]]=o+"";n.colors=[];for(var i=0,a=r;i<a.length;i++){var u=a[i];n.colors.push(t.color[""+u])}return n.size=t.size,n.cvWGL=void 0,n.gl=void 0,n.program=void 0,n.lutTexture=void 0,n.pointsNb=0,n.x=void 0,n.y=void 0,n.z=void 0,n.cellsNb=void 0,n}return 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&&Ll(t,e)}(e,t),n=e,r=[{key:"init",value:function(t,e){this.cvWGL=xl(t,e);var n=this.cvWGL.gl,r=this.gl!==n;return r&&(this.gl=n,this.program=Ol(n,"\n attribute vec2 pos;\n uniform float sizePix;\n uniform mat3 mat;\n attribute float i;\n varying float vi;\n void main() {\n gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);\n gl_PointSize = sizePix;\n vi = i;\n }","\n precision highp float;\n varying float vi;\n uniform sampler2D colorLUT;\n uniform float lutSize;\n void main(void) {\n float idx = floor(vi + 0.5);\n float u = (idx + 0.5) / lutSize;\n gl_FragColor = texture2D(colorLUT, vec2(u, 0.5));\n }"),this.lutTexture=void 0),n.useProgram(this.program),this.bindColors(),r}},{key:"bindColors",value:function(){var t=this.cvWGL.gl,e=this.colors.length;if(!this.lutTexture){for(var n=new Uint8Array(4*e),r=0;r<e;r++){var o=Ur(this.colors[r]);n[4*r]=+o.r,n[4*r+1]=o.g,n[4*r+2]=o.b,n[4*r+3]=255*(null==o?void 0:o.opacity)}this.lutTexture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.lutTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,1,0,t.RGBA,t.UNSIGNED_BYTE,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}t.uniform1i(t.getUniformLocation(this.program,"colorLUT"),0),t.uniform1f(t.getUniformLocation(this.program,"lutSize"),e),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.lutTexture)}},{key:"bindVertices",value:function(t,e,n,r){for(var o,i=this.cvWGL.gl,a=e/2,u=t.length,l=new Float32Array(2*u),c=new Float32Array(u),s=0,f=0;f<u;f++){o=t[f];var h=this.code(o,e,n,r);if(null!=h){var y=this.catToI[h];isNaN(+y)?console.log("Unexpected category index: "+h+" "+y):(l[2*s]=o.x+a,l[2*s+1]=o.y+a,c[s]=+y,s++)}}return i.bindBuffer(i.ARRAY_BUFFER,jl(i,zl)),i.bufferData(i.ARRAY_BUFFER,l.subarray(0,2*s),i.DYNAMIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,jl(i,Rl)),i.bufferData(i.ARRAY_BUFFER,c.subarray(0,s),i.DYNAMIC_DRAW),Pl(i,zl,this),s}},{key:"bindAttributes",value:function(){var t=this.cvWGL.gl,e=t.getAttribLocation(this.program,"pos");t.bindBuffer(t.ARRAY_BUFFER,jl(t,zl)),t.vertexAttribPointer(e,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(e);var n=t.getAttribLocation(this.program,"i");t.bindBuffer(t.ARRAY_BUFFER,jl(t,Rl)),t.vertexAttribPointer(n,1,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n)}},{key:"mapContentChanged",value:function(t,e){return(t.x!=this.x||t.y!=this.y||t.z!=this.z||this.cellsNb!=e)&&(this.x=t.x,this.y=t.y,this.z=t.z,this.cellsNb=e,!0)}},{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=this.init(e.w,e.h),a=this.cvWGL.gl,u=this.cvWGL.canvas,l=this.size?this.size(n,r)/r:n/r+.2;a.uniform1f(a.getUniformLocation(this.program,"sizePix"),1*l),(this.mapContentChanged(e.view,t.length)||i||Pl(a,zl)!==this)&&(this.pointsNb=this.bindVertices(t,n,r,o)),this.bindAttributes(),a.uniformMatrix3fv(a.getUniformLocation(this.program,"mat"),!1,new Float32Array(e.getWebGLTransform())),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),a.drawArrays(a.POINTS,0,this.pointsNb),e.initCanvasTransform(),e.offscreenCtx.drawImage(u,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}}],r&&Tl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function Fl(t){return Fl="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},Fl(t)}function Nl(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,Bl(r.key),r)}}function Bl(t){var e=function(t){if("object"!=Fl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fl(e)?e:e+""}function Dl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dl=function(){return!!t})()}function Gl(t){return Gl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gl(t)}function Ul(t,e){return Ul=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ul(t,e)}var Wl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Gl(e),function(t,e){if(e&&("object"==Fl(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)}(t,Dl()?Reflect.construct(e,n||[],Gl(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.elevation=t.elevation,n.sunAzimuth=t.sunAzimuth||function(){return 2.356},n.sunAltitude=t.sunAltitude||function(){return.2},n.color=t.color||function(){return"black"},n.undefinedValue=t.undefinedValue||0,n}return 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&&Ul(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),0!=t.length){var o=e.view.z,i=this.viewScale?this.viewScale(t,n,o):void 0,a=Su(t,n,(function(t){return r.elevation(t)})),u=a.x0,l=a.y0;a=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2.356,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.15,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,i=t.length,a=t[0].length,u=Math.sin(n),l=-Math.cos(n),c=Math.tan(r),s=Array.from({length:i},(function(){return new Array(a).fill(void 0)})),f=0;f<i;f++)for(var h=0;h<a;h++){var y=t[f][h]||o;if(void 0!==y)for(var p=e;;){var v=h-u*p/e,d=f-l*p/e,b=Math.round(v),m=Math.round(d);if(b<0||m<0||b>=a||m>=i)break;var g=t[m][b]||o;if(void 0===g)break;if(g-y-c*p>0){s[f][h]=1;break}p+=e}}return s}(a,n,this.sunAzimuth(n,o,i),this.sunAltitude(n,o,i),this.undefinedValue),t=[];for(var c=0;c<a.length;c++)for(var s=a[c],f=l-c*n,h=0;h<s.length;h++)if(s[h]){var y={x:u+h*n,y:f};t.push(y)}new Il({code:function(){return"a"},color:{a:this.color(n,o,i)}}).draw(t,e,n),this.updateLegends({style:this,resolution:n,z:o,viewScale:i})}}}],r&&Nl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function ql(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let o of t)null!=(o=e(o,++r,t))&&(n<o||void 0===n&&o>=o)&&(n=o)}return n}function Yl(t){return Yl="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},Yl(t)}function $l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($l=function(){return!!t})()}function Hl(t){return Hl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hl(t)}function Vl(t,e){return Vl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vl(t,e)}var Xl=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=function(t,e,n){return e=Hl(e),function(t,e){if(e&&("object"==Yl(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)}(t,$l()?Reflect.construct(e,n||[],Hl(t).constructor):e.apply(t,n))}(this,e,[n]);var r=n.elevation;t.viewScale=function(t){return ql(t,(function(t){return(e=t).c1&&e.c2&&e.c1[r]&&e.c2[r]?e.v=+e.c2[r]-e.c1[r]:e.v=0,e.v;var e}))};var o=n.colorTopLeft||"255,255,255",i=n.colorBottomRight||"0,0,0";if(null!=n.revert&&n.revert){var a=o;o=i,i=a}var u=n.scale;return t.color=function(t,e,n,r){if(0!=t.v){var a=Math.abs(t.v/r);return u&&(a=u(a)),t.v<0&&"h"===t.or||t.v>0&&"v"===t.or?"rgba("+o+","+a+")":"rgba("+i+","+a+")"}},t.width=function(t,e,r){return n.width|Math.min(2*r,e/3)},t.diamond=n.diamond,t}return 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&&Vl(t,e)}(e,t),n=e,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(gl);function Zl(t){return Zl="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},Zl(t)}function Jl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ql(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,Kl(r.key),r)}}function Kl(t){var e=function(t){if("object"!=Zl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Zl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zl(e)?e:e+""}function tc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(tc=function(){return!!t})()}function ec(t){return ec=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ec(t)}function nc(t,e){return nc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nc(t,e)}var rc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ec(e),function(t,e){if(e&&("object"==Zl(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)}(t,tc()?Reflect.construct(e,n||[],ec(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.code=t.code,n.color=t.color,n}return 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&&nc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=gl.buildSides(t,n);if(0!=i.length){var a=this.viewScale?this.viewScale(i,n,r):void 0;o.lineCap="butt";var u,l=.5*n,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 Jl(t,e);var n={}.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)?Jl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(i);try{for(c.s();!(u=c.n()).done;){var s=u.value,f=s.c1?this.code(s.c1,n,r):void 0,h=s.c2?this.code(s.c2,n,r):void 0;if(f!=h){var y=this.width?this.width(s,n,r,a):void 0;if(y&&!(y<=0)){var p=.5*y;o.lineWidth=y,"h"===s.or?(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(s.x-l,s.y+p),o.lineTo(s.x+l,s.y+p),o.stroke()),f&&(o.beginPath(),o.strokeStyle=this.color[f],o.moveTo(s.x-l,s.y-p),o.lineTo(s.x+l,s.y-p),o.stroke())):(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(s.x+p,s.y-l),o.lineTo(s.x+p,s.y+l),o.stroke()),f&&(o.beginPath(),o.strokeStyle=this.color[f],o.moveTo(s.x-p,s.y-l),o.lineTo(s.x-p,s.y+l),o.stroke()))}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:a})}}}],r&&Ql(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(gl);const oc=function t(e){function n(t,n){var r,o;return t=null==t?0:+t,n=null==n?1:+n,function(){var i;if(null!=r)i=r,r=null;else do{r=2*e()-1,i=2*e()-1,o=r*r+i*i}while(!o||o>1);return t+n*i*Math.sqrt(-2*Math.log(o)/o)}}return n.source=t,n}(Math.random);function ic(t){return ic="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},ic(t)}function ac(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,uc(r.key),r)}}function uc(t){var e=function(t){if("object"!=ic(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ic(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ic(e)?e:e+""}var lc=function(){return t=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=Ol(e,"\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 ","\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=[]},(e=[{key:"addPointData",value:function(t,e,n){var r=Ur(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,o,i){this.verticesBuffer.push(t,e),this.colorsBuffer.push(n,r,o,i)}},{key:"draw",value:function(t){var e=this.gl;e.useProgram(this.program),e.bindBuffer(e.ARRAY_BUFFER,jl(e,"WebGLSquareColoring.pos")),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.verticesBuffer),e.DYNAMIC_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,jl(e,"WebGLSquareColoring.color")),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.colorsBuffer),e.DYNAMIC_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.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.POINTS,0,this.verticesBuffer.length/2)}}])&&ac(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function cc(t){return cc="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},cc(t)}function sc(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 fc(t,e);var n={}.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)?fc(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function fc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hc(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,yc(r.key),r)}}function yc(t){var e=function(t){if("object"!=cc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=cc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cc(e)?e:e+""}function pc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(pc=function(){return!!t})()}function vc(t){return vc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vc(t)}function dc(t,e){return dc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dc(t,e)}var bc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=vc(e),function(t,e){if(e&&("object"==cc(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)}(t,pc()?Reflect.construct(e,n||[],vc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.dotNumber=t.dotNumber||function(t,e){return e/100},n.color=t.color||function(){return"#FF5733"},n.dotSize=t.dotSize||function(t,e){return 1.5*e},n.sigma=t.sigma||function(t,e){return t/2},n}return 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&&dc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=this.dotSize?this.dotSize(n,r,o):r,a=this.sigma?this.sigma(n,r,o):.4*n,u=oc(0,a),l=e.offscreenCtx;if(function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}()){var c=xl(e.w,e.h);if(!c)return void console.error("No webGL");var s,f=new lc(c.gl,i/r),h=n/2,y=sc(t);try{for(y.s();!(s=y.n()).done;){var p=s.value,v=this.color(p,n,r,o);if(v&&"none"!==v){var d=this.dotNumber(p,n,r,o),b=this.offset(p,n,r),m=p.x+b.dx+h,g=p.y+b.dy+h,w=Ur(v);if(!w)return;for(var x=0;x<=d;x++)f.addPointData2(m+u(),g+u(),w.r,w.g,w.b,w.opacity)}}}catch(t){y.e(t)}finally{y.f()}f.draw(e.getWebGLTransform()),e.initCanvasTransform(),l.drawImage(c.canvas,0,0)}else{var _,S=sc(t);try{for(S.s();!(_=S.n()).done;){var O=_.value,j=this.color(O,n,r,o);if(j&&"none"!==j){l.fillStyle=j;for(var P=this.dotNumber(O,n,r,o),E=this.offset(O,n,r),k=O.x+E.dx+n/2,T=O.y+E.dy+n/2,C=0;C<=P;C++)l.fillRect(k+u(),T+u(),i,i)}}}catch(t){S.e(t)}finally{S.f()}}this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}}],r&&hc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function mc(t){return mc="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},mc(t)}function gc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function wc(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,xc(r.key),r)}}function xc(t){var e=function(t){if("object"!=mc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=mc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mc(e)?e:e+""}function _c(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(_c=function(){return!!t})()}function Sc(t){return Sc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sc(t)}function Oc(t,e){return Oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Oc(t,e)}var jc=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,n){return e=Sc(e),function(t,e){if(e&&("object"==mc(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)}(t,_c()?Reflect.construct(e,n||[],Sc(t).constructor):e.apply(t,n))}(this,e,[n])).classifier=n.classifier||function(t,e,n){return function(t){return 1}},t.width=n.width||function(t,e,n,r,o){return Math.abs(e)*r},t.length=n.length||function(t,e,n,r){return e},t.colorDark=n.colorDark||"#111",t.colorBright=n.colorBright||"#ddd",t.revert=null!=n.revert&&n.revert,t.diamond=n.diamond,t.limit=n.limit||"steep",t}return 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&&Oc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.classifier(t,n,o),u=function(t){var e=t.c1?a(t.c1):void 0,n=t.c2?a(t.c2):void 0;if(void 0!==e||void 0!==n)return void 0===e?"none"==r.limit?void 0:"steep"==r.limit?n:Math.sign(n):void 0===n?"none"==r.limit?void 0:"steep"==r.limit?-e:Math.sign(-e):n-e},l=gl.buildSides(t,n);if(0!=l.length){var c=this.viewScale?this.viewScale(l,n,o):void 0;i.lineCap="butt";var s,f=.5*n,h=this.revert?this.colorBright:this.colorDark,y=this.revert?this.colorDark:this.colorBright,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 gc(t,e);var n={}.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)?gc(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(l);try{for(p.s();!(s=p.n()).done;){var v=s.value,d=u(v);if(void 0!==d&&0!==d){var b=d<0&&"h"===v.or||d>0&&"v"===v.or?y:h;if(b&&"none"!=b)if(this.diamond){i.fillStyle=b;var m=v.x,g=v.y;i.beginPath(),i.moveTo(m-f,g),i.lineTo(m,g+f),i.lineTo(m+f,g),i.lineTo(m,g-f),i.closePath(),i.fill()}else{var w=this.width?this.width(v,d,n,o,c):void 0;if(!w||w<=0)continue;var x=this.length?this.length(v,n,o,c):void 0;if(!x||x<=0)continue;var _=.5*x;i.lineWidth=w,i.strokeStyle=b;var S=v.x,O=v.y;i.beginPath(),"v"===v.or?(i.moveTo(S,O-_),i.lineTo(S,O+_)):(i.moveTo(S-_,O),i.lineTo(S+_,O)),i.stroke()}}}}catch(t){p.e(t)}finally{p.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:c})}}}],r&&wc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function Pc(t){return null===t?NaN:+t}function Ec(t,e,n=Pc){if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,i=Math.floor(o),a=+n(t[i],i,t);return a+(+n(t[i+1],i+1,t)-a)*(o-i)}}function kc(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Tc(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Cc(t){let e,n,r;function o(t,r,o=0,i=t.length){if(o<i){if(0!==e(r,r))return i;do{const e=o+i>>>1;n(t[e],r)<0?o=e+1:i=e}while(o<i)}return o}return 2!==t.length?(e=kc,n=(e,n)=>kc(t(e),n),r=(e,n)=>t(e)-n):(e=t===kc||t===Tc?t:Ac,n=t,r=t),{left:o,center:function(t,e,n=0,i=t.length){const a=o(t,e,n,i-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,o=0,i=t.length){if(o<i){if(0!==e(r,r))return i;do{const e=o+i>>>1;n(t[e],r)<=0?o=e+1:i=e}while(o<i)}return o}}}function Ac(){return 0}const Mc=Cc(kc),Lc=Mc.right,zc=(Mc.left,Cc(Pc).center,Lc);function Rc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ic(){var t,e=[],n=[],r=[];function o(){var t=0,o=Math.max(1,n.length);for(r=new Array(o-1);++t<o;)r[t-1]=Ec(e,t/o);return i}function i(e){return null==e||isNaN(e=+e)?t:n[zc(r,e)]}return i.invertExtent=function(t){var o=n.indexOf(t);return o<0?[NaN,NaN]:[o>0?r[o-1]:e[0],o<r.length?r[o]:e[e.length-1]]},i.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(kc),o()},i.range=function(t){return arguments.length?(n=Array.from(t),o()):n.slice()},i.unknown=function(e){return arguments.length?(t=e,i):t},i.quantiles=function(){return r.slice()},i.copy=function(){return Ic().domain(e).range(n).unknown(t)},Rc.apply(i,arguments)}var Fc=function(t){var e=t.valueFunction,n=t.minValue||0,r=t.minSizePix||0,o=t.maxSizeFactor||1,i=t.stretching,a=t.range,u=t.domain,l=t.classNumber;return function(t,c,s){var f=u||[n,ql(t,e)],h=a||[r*s,c*o],y=f[1]-f[0],p=f[0],v=h[1]-h[0],d=h[0];return function(t){return t=(t-p)/y,i&&(t=i(t)),l&&(t=1==t?1:Math.floor(t*l)/(l-1)),d+t*v}}},Nc=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.minSizePix||1,o=t.maxSizeFactor||1,i=Ic();return function(t,a,u){i.domain(t.map(e));var l=r*u,c=a*o;return i.range(Array.from({length:n},(function(t,e){return l+e*(c-l)/(n-1)}))),i.breaks=i.quantiles(),i.values=i.range(),i}},Bc=function(t){var e,n=t.valueFunction,r=t.stretching,o=t.colorScale||function(){return"purple"},i=null===(e=t.colors)||void 0===e?void 0:e.length;return t.colors&&i&&(o=function(e){return t.colors[1==e?i-1:Math.floor(e*i)]}),function(e){if(0!=e.length&&e){var a=bu(e,n);if(null!=a[0]){var u=a[1]-a[0],l=function(t){return t=(t-a[0])/u,r&&(t=r(t)),o(t)};if(l.invert=function(t){return r&&(t=r.invert(t)),a[0]+t*u},t.colors&&i){l.breaks=[];for(var c=1;c<i;c++)l.breaks.push(l.invert(c/i))}return l}}}},Dc=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.colors;t.colorScale&&(r=$c(t.colorScale,n)),r=r||Array.from({length:n},(function(t,e){return"rgb("+Math.floor(255*e/(n-1))+",150,150)"}));var o=Ic().range(r);return function(t){return o.domain(t.map(e)),o.breaks=o.quantiles(),o.colors=r,o}},Gc=function(t){var e=t.valueFunction,n=t.classNumber||12,r=Ic().range(Array.from({length:n},(function(t,e){return e})));return function(t){return r.domain(t.map(e)),r.breaks=r.quantiles(),r}},Uc=function(t){return function(e,n,r){var o={};for(var i in t)o[i]=t[i](e,n,r);return o}};function Wc(t){var e=t.length,n=function(n){for(var r=0;r<e;){if(n<=t[r])return r;r++}return r};return n.breaks=t,n}function qc(t,e,n){for(var r=[],o=(e-t)/n,i=1;i<n;i++)r.push(t+i*o);return Wc(r)}function Yc(t,e){var n=Wc(t),r=function(t){return e[n(t)]};return r.breaks=t,r.colors=e,r}function $c(t,e){if(1==e)return[t(.5)];for(var n=[],r=0;r<e;r++)n.push(t(r/(e-1)));return n}function Hc(t){return Hc="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},Hc(t)}function Vc(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 Xc(t,e);var n={}.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)?Xc(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Xc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Zc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zc=function(){return!!t})()}function Jc(t){return Jc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jc(t)}function Qc(t,e){return Qc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qc(t,e)}function Kc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ts(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,ns(r.key),r)}}function es(t,e,n){return e&&ts(t.prototype,e),n&&ts(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ns(t){var e=function(t){if("object"!=Hc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Hc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hc(e)?e:e+""}var rs=function(){return es((function t(){Kc(this,t)}),null,[{key:"get",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(r=r||{}).colorDark=r.colorDark||"#333",r.colorBright=r.colorBright||"#aaa";for(var o=Wc(e),i=function(e){return o(t(e))},a={},u=0;u<n.length;u++)a[u+""]=n[u];var l=new Il({code:i,color:a}),c=new jc({classifier:function(){return i},colorDark:r.colorDark,colorBright:r.colorBright,diamond:r.diamond});return[l,new du({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n},filter:r.filter}),c,new os({colDark:r.colDark,colBright:r.colBright,filter:r.filter})]}},{key:"getCategory",value:function(t,e,n){return(n=n||{}).colDark=n.colDark||"#333",n.colBright=n.colBright||"#aaa",[new Il({code:t,color:e}),new du({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n}}),new os({colDark:n.colDark,colBright:n.colBright})]}}])}(),os=function(t){function e(t){var n,r,o,i;return Kc(this,e),r=this,i=[t],o=Jc(o=e),n=function(t,e){if(e&&("object"==Hc(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)}(r,Zc()?Reflect.construct(o,i||[],Jc(r).constructor):o.apply(r,i)),t=t||{},n.colDark=t.colDark||"#333",n.colBright=t.colBright||"#aaa",n}return 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&&Qc(t,e)}(e,t),es(e,[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.offscreenCtx;r.lineWidth=.6*e.view.z,r.strokeStyle=this.colDark;var o,i=Vc(t);try{for(i.s();!(o=i.n()).done;){var a=o.value;r.beginPath(),r.arc(a.x+.5*n,a.y+.5*n,.55*n*.5,Math.PI/4,-Math.PI*(3/4),!0),r.stroke()}}catch(t){i.e(t)}finally{i.f()}r.strokeStyle=this.colBright;var u,l=Vc(t);try{for(l.s();!(u=l.n()).done;){var c=u.value;r.beginPath(),r.arc(c.x+.5*n,c.y+.5*n,.55*n*.5,Math.PI/4,-Math.PI*(3/4),!1),r.stroke()}}catch(t){l.e(t)}finally{l.f()}}}])}(Ni);function is(t){return is="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},is(t)}function as(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,us(r.key),r)}}function us(t){var e=function(t){if("object"!=is(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=is(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==is(e)?e:e+""}var ls=function(){return t=function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=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 a=[];a.push("precision mediump float;"),a.push("varying float vt;"),a.push("uniform float alpha;");for(var u=0;u<n.length;u++)a.push("uniform vec4 c"+u+";");if(a.push("void main(void) {"),r?"pow"==r.fun?a.push(" float t = pow(vt, alpha);"):"powInv"==r.fun?a.push(" float t = 1.0-pow(1.0-vt, 1.0/alpha);"):"exp"==r.fun?a.push(0==r.alpha?"float t = vt;":" float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);"):"log"==r.fun?a.push(0==r.alpha?"float t = vt;":" float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);"):"circle"==r.fun?0==r.alpha?a.push(" float t = vt;"):1==r.alpha?a.push(" float t = sqrt(vt * (2.0 - vt));"):(a.push(" float a = alpha / (1.0 - alpha);"),a.push(" float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;")):"circleInv"==r.fun?0==r.alpha?a.push(" float t = vt;"):1==r.alpha?a.push(" float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));"):(a.push(" float a = alpha / (1.0 - alpha);"),a.push(" float t = 1.0 - sqrt(1.0 / (a * a) + (1.0-vt) * ( 2.0/a + 1.0 + vt )) + 1.0 / a;")):(console.error("Unexpected stretching function code: "+r.fun),a.push(" float t = vt;")):a.push(" float t = vt;"),1==n.length)a.push(" vec4 cI=c0;"),a.push(" vec4 cF=c0;");else if(2==n.length)a.push(" vec4 cI=c0;"),a.push(" vec4 cF=c1;");else{var l=n.length-1,c=l+".0";a.push(" vec4 cI;"),a.push(" vec4 cF;"),a.push(" if(t<1.0/"+c+") { cI=c0; cF=c1; t=t*"+c+"; }");for(var s=2;s<l;s++)a.push(" else if(t<"+s+".0/"+c+") { cI=c"+(s-1)+"; cF=c"+s+"; t="+c+"*t-"+(s-1)+".0; }");a.push(" else { cI=c"+(l-1)+"; cF=c"+l+"; t="+c+"*t-"+(l-1)+".0; }")}1==n.length?a.push(" gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}"):a.push(" gl_FragColor = mix(cI, cF, t);}");var f=a.join("");this.program=Ol(e,"\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 ",f),e.useProgram(this.program),e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*o),e.uniform1f(e.getUniformLocation(this.program,"alpha"),r?1*r.alpha:0);for(var h=0;h<n.length;h++){var y=Ur(n[h]),p=y.opacity;1==y.opacity&&null!=i&&(p=i);var v=[+y.r/255,+y.g/255,+y.b/255,+p];e.uniform4fv(e.getUniformLocation(this.program,"c"+h),v)}},e=[{key:"draw",value:function(t,e,n){var r=this.gl,o=this.program;r.useProgram(o),r.bindBuffer(r.ARRAY_BUFFER,jl(r,"WebGLSquareColoringAdvanced.pos")),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t),r.DYNAMIC_DRAW);var i=r.getAttribLocation(o,"pos");r.vertexAttribPointer(i,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i),r.bindBuffer(r.ARRAY_BUFFER,jl(r,"WebGLSquareColoringAdvanced.t")),r.bufferData(r.ARRAY_BUFFER,new Float32Array(e),r.DYNAMIC_DRAW);var a=r.getAttribLocation(o,"t");r.vertexAttribPointer(a,1,r.FLOAT,!1,0,0),r.enableVertexAttribArray(a),r.uniformMatrix3fv(r.getUniformLocation(o,"mat"),!1,new Float32Array(n)),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.POINTS,0,t.length/2)}}],e&&as(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function cs(t){return cs="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},cs(t)}function ss(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function fs(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,hs(r.key),r)}}function hs(t){var e=function(t){if("object"!=cs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=cs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cs(e)?e:e+""}function ys(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ys=function(){return!!t})()}function ps(t){return ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ps(t)}function vs(t,e){return vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vs(t,e)}var ds=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ps(e),function(t,e){if(e&&("object"==cs(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)}(t,ys()?Reflect.construct(e,n||[],ps(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.tFun=t.tFun,n.stretching=t.stretching,n.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&&(n.colors=[t.color(0),t.color(.2),t.color(.4),t.color(.6),t.color(.8),t.color(1)]),n.opacity=t.opacity,n.size=t.size,n}return 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&&vs(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=this.viewScale?this.viewScale(t,n,r):void 0,i=xl(e.w,e.h,null!=this.opacity?{premultipliedAlpha:!1}:void 0);if(i){var a,u=n/2,l=[],c=[],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 ss(t,e);var n={}.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)?ss(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(s.s();!(a=s.n()).done;){var f=a.value,h=this.tFun(f,n,r,o);null!=h&&null!=h&&(l.push(f.x+u,f.y+u),c.push(h>1?1:h<0?0:h))}}catch(t){s.e(t)}finally{s.f()}var y=this.size?this.size(n,r):n+.2*r,p=this.opacity?this.opacity(n,r):void 0;new ls(i.gl,this.colors,this.stretching,y/r,p).draw(l,c,e.getWebGLTransform()),e.initCanvasTransform(),e.offscreenCtx.drawImage(i.canvas,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}else console.error("No webGL")}}],r&&fs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function bs(t){return bs="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},bs(t)}function ms(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function gs(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,ws(r.key),r)}}function ws(t){var e=function(t){if("object"!=bs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=bs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bs(e)?e:e+""}function xs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(xs=function(){return!!t})()}function _s(t){return _s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_s(t)}function Ss(t,e){return Ss=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ss(t,e)}var Os=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=_s(e),function(t,e){if(e&&("object"==bs(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)}(t,xs()?Reflect.construct(e,n||[],_s(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.mosaicFactor=t.mosaicFactor||.15,n.shadowFactor=t.shadowFactor||.2,n.shadowColor=t.shadowColor||"#555",n}return 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&&Ss(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r=e.view.z,o=e.offscreenCtx,i=this.viewScale?this.viewScale(t,n,r):void 0;o.strokeStyle=this.shadowColor,o.lineWidth=this.shadowFactor*n,o.lineJoin="round",o.lineCap="butt";var a,u=n*this.mosaicFactor,l=function(){return{x:Math.random()*u,y:Math.random()*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 ms(t,e);var n={}.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)?ms(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(c.s();!(a=c.n()).done;){var s=a.value,f=this.color?this.color(s,n,r,i):void 0;if(f&&"none"!==f){o.fillStyle=f;var h=this.offset(s,n,r),y=l(),p=l(),v=l(),d=l();this.shadowFactor>0&&(o.beginPath(),o.moveTo(s.x+h.dx+y.x,s.y+h.dy+y.y),o.lineTo(s.x+h.dx+n-v.x,s.y+h.dy+v.y),o.lineTo(s.x+h.dx+n-d.x,s.y+h.dy+n-d.y),o.stroke()),o.beginPath(),o.moveTo(s.x+h.dx+y.x,s.y+h.dy+y.y),o.lineTo(s.x+h.dx+n-v.x,s.y+h.dy+v.y),o.lineTo(s.x+h.dx+n-d.x,s.y+h.dy+n-d.y),o.lineTo(s.x+h.dx+p.x,s.y+h.dy+n-p.y),o.fill()}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i})}}],r&&gs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function js(t){return js="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},js(t)}function Ps(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Es(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,ks(r.key),r)}}function ks(t){var e=function(t){if("object"!=js(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=js(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==js(e)?e:e+""}function Ts(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ts=function(){return!!t})()}function Cs(t){return Cs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cs(t)}function As(t,e){return As=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},As(t,e)}var Ms=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Cs(e),function(t,e){if(e&&("object"==js(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)}(t,Ts()?Reflect.construct(e,n||[],Cs(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color||function(){return"#EA6BAC"},n.size=t.size||function(t,e){return e},n.shape=t.shape||function(){return"o"},n}return 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&&As(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){this.filter&&(t=t.filter(this.filter));var r,o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=.5*n,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 Ps(t,e);var n={}.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)?Ps(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t);try{for(l.s();!(r=l.n()).done;){var c=r.value,s=this.color?this.color(c,n,o,a):void 0;if(s&&"none"!==s){i.fillStyle=s;var f=this.size(c,n,o,a),h=(f=f<0?0:f>1?1:f)*u,y=this.shape?this.shape(c):"o";if("none"!==y){var p=c.x+u,v=c.y+u;if("p"===y)i.beginPath(),i.moveTo(p,v+u),i.lineTo(p+h,v+h),i.lineTo(p+u,v),i.lineTo(p+h,v-h),i.lineTo(p,v-u),i.lineTo(p-h,v-h),i.lineTo(p-u,v),i.lineTo(p-h,v+h),i.fill();else{if("o"!==y)throw new Error("Unexpected shape:"+y);i.beginPath(),i.moveTo(p,v+h),i.lineTo(p+u,v+u),i.lineTo(p+h,v),i.lineTo(p+u,v-u),i.lineTo(p,v-h),i.lineTo(p-u,v-u),i.lineTo(p-h,v),i.lineTo(p-u,v+u),i.fill()}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&Es(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function Ls(t){return Ls="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},Ls(t)}function zs(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 Rs(t,e);var n={}.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)?Rs(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Rs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Is(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,Fs(r.key),r)}}function Fs(t){var e=function(t){if("object"!=Ls(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ls(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ls(e)?e:e+""}function Ns(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ns=function(){return!!t})()}function Bs(t){return Bs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bs(t)}function Ds(t,e){return Ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ds(t,e)}var Gs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Bs(e),function(t,e){if(e&&("object"==Ls(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)}(t,Ns()?Reflect.construct(e,n||[],Bs(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.ts=t.ts,n.noData=t.noData||function(t){return void 0===t||""==t||null===t||isNaN(+t)},n.offsetX=t.offsetX||function(t,e,n){return 0},n.width=t.width||function(t,e,n){return e},n.offsetY=t.offsetY||function(t,e,n){return 0},n.height=t.height||function(t,e,n){return e},n.anchorModeY=t.anchorModeY||function(t,e,n){return"center"},n.lineWidth=t.lineWidth||function(t,e,n,r){return 1.5*r},n.color=t.color||function(){return"black"},n}return 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&&Ds(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o,i,a=e.view.z,u=e.offscreenCtx,l=this.viewScale?this.viewScale(t,n,a):void 0,c=function(t){var e,n,o,i=zs(r.ts);try{for(i.s();!(o=i.n()).done;){var a=t[o.value];null!=a&&((null==e||a<e)&&(e=a),(null==n||a>n)&&(n=a))}}catch(t){i.e(t)}finally{i.f()}if(null!=e)return n-e},s=zs(t);try{for(s.s();!(i=s.n()).done;){var f=c(i.value);null!=f&&(null==o||f>o)&&(o=f)}}catch(t){s.e(t)}finally{s.f()}if(o){var h=this.ts.length;u.lineCap="butt";var y,p=zs(t);try{for(p.s();!(y=p.n()).done;){var v=y.value,d=this.lineWidth?this.lineWidth(v,n,a,l):void 0;if(d&&!(d<0)){var b=this.color?this.color(v,n,a,l):void 0;if(b){var m=this.offsetX?this.offsetX(v,n,a):0;if(null!=m&&!isNaN(m)){var g=this.width?this.width(v,n,a):n;if(null!=g&&!isNaN(g)){var w=this.offsetY?this.offsetY(v,n,a):0;if(null!=w&&!isNaN(w)){var x=this.height?this.height(v,n,a):n;if(null!=x&&!isNaN(x)){var _=this.anchorModeY?this.anchorModeY(v,n,a):"center";if(_){u.lineWidth=d,u.strokeStyle=b;var S=void 0,O=void 0;if("first"===_)S=v[this.ts[0]],O=0;else if("last"===_)S=v[this.ts[this.ts.length-1]],O=0;else if("bottom"===_){var j,P=zs(this.ts);try{for(P.s();!(j=P.n()).done;){var E=+v[j.value];null!=E&&(null==S||E<S)&&(S=E)}}catch(t){P.e(t)}finally{P.f()}O=0}else if("top"===_){var k,T=zs(this.ts);try{for(T.s();!(k=T.n()).done;){var C=+v[k.value];null!=C&&(null==S||C>S)&&(S=C)}}catch(t){T.e(t)}finally{T.f()}O=n}else{if("center"!==_){console.log("Unexpected anchorModeY: "+_);continue}var A,M=void 0,L=void 0,z=zs(this.ts);try{for(z.s();!(A=z.n()).done;){var R=v[A.value];null!=R&&((null==M||R<M)&&(M=R),(null==L||R>L)&&(L=R))}}catch(t){z.e(t)}finally{z.f()}S=.5*(+L+ +M),O=n/2}var I=g/(h-1),F=v[this.ts[0]];this.noData(F)||(u.beginPath(),u.moveTo(v.x+m,v.y+O+(F-S)*x/o+w));for(var N=void 0,B=1;B<h;B++)N=v[this.ts[B]],this.noData(F)&&this.noData(N)||(!this.noData(F)&&this.noData(N)?u.stroke():this.noData(F)&&!this.noData(N)?(u.beginPath(),u.moveTo(v.x+B*I+m,v.y+O+(N-S)*x/o+w)):(u.lineTo(v.x+B*I+m,v.y+O+(N-S)*x/o+w),B==h-1&&u.stroke())),F=N}}}}}}}}}catch(t){p.e(t)}finally{p.f()}this.updateLegends({style:this,resolution:n,z:a,viewScale:l})}}}],r&&Is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni);function Us(t){return Us="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},Us(t)}function Ws(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Ys(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 qs(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ys(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Ys(t,e){if(t){if("string"==typeof t)return $s(t,e);var n={}.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)?$s(t,e):void 0}}function $s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Hs(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,Vs(r.key),r)}}function Vs(t){var e=function(t){if("object"!=Us(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Us(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Us(e)?e:e+""}function Xs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xs=function(){return!!t})()}function Zs(t){return Zs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zs(t)}function Js(t,e){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Js(t,e)}var Qs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Zs(e),function(t,e){if(e&&("object"==Us(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)}(t,Xs()?Reflect.construct(e,n||[],Zs(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.color=t.color,n.height=t.height||function(t,e,n,r){return.4*e},n.angle=null!=t.angle?t.angle:50,n.cornerLineStrokeColor=t.cornerLineStrokeColor||function(t,e,n,r){return"#999"},n.cornerLineWidth=t.cornerLineWidth||function(t,e,n,r){return r%90==0?0:.8*n},n.sVert=null==t.sVert||t.sVert,n.sHor=null==t.sHor||t.sHor,n}return 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&&Js(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;this.filter&&(t=t.filter(this.filter));var o=e.view.z,i=e.offscreenCtx,a=this.viewScale?this.viewScale(t,n,o):void 0,u=Object.keys(this.color),l=n/2,c=this.offset(void 0,n,o),s=c.dx,f=c.dy,h=gl.buildSides(t,n,this.angle%180!=90&&this.sVert,this.angle%180!=0&&this.sHor);if(0!=h.length){var y=this.angle*Math.PI/180,p=Math.cos(y),v=Math.sin(y),d=Math.abs(this.angle)<90?e.extGeo.xMin:e.extGeo.xMax,b=this.angle<0?e.extGeo.yMax:e.extGeo.yMin;h.sort((function(t,e){return Math.hypot(e.x-d,e.y-b)-Math.hypot(t.x-d,t.y-b)}));var m=function(t){if(t){var e=r.cornerLineWidth?r.cornerLineWidth(t,n,o,r.angle):.8*o;if(0!=e){i.strokeStyle=r.cornerLineStrokeColor?r.cornerLineStrokeColor(t,n,o,r.angle):"#333",i.lineWidth=e;var u=r.height(t,n,o,a);i.beginPath(),i.moveTo(t.x+l+s,t.y+l+f),i.lineTo(t.x+l+u*p+s,t.y+l+u*v+f),i.stroke()}}};i.lineCap="round";var g,w=qs(h);try{for(w.s();!(g=w.n()).done;){var x=g.value,_=x.c1,S=x.c2,O=x.x,j=x.y,P=_?this.height(_,n,o,a):0,E=S?this.height(S,n,o,a):0,k=Ks(_,u),T=Ks(S,u);if(0!=k||0!=T)for(var C=0,A=0,M=0,L=Object.entries(this.color);M<L.length;M++){var z=Ws(L[M],2),R=z[0],I=z[1],F=_?+_[R]:0,N=S?+S[R]:0;if(0!=F||0!=N){var B=P*C/k||0,D=P*(C+F)/k||0,G=E*A/T||0,U=E*(A+N)/T||0;i.beginPath(),"h"==x.or?(i.moveTo(O+B*p+s,j-l+B*v+f),i.lineTo(O+G*p+s,j+l+G*v+f),i.lineTo(O+U*p+s,j+l+U*v+f),i.lineTo(O+D*p+s,j-l+D*v+f)):(i.moveTo(O-l+B*p+s,j+B*v+f),i.lineTo(O+l+G*p+s,j+G*v+f),i.lineTo(O+l+U*p+s,j+U*v+f),i.lineTo(O-l+D*p+s,j+D*v+f)),i.fillStyle=I,i.fill(),C+=F,A+=N,m(_),m(S)}}}}catch(t){w.e(t)}finally{w.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}}],r&&Hs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni),Ks=function(t,e){if(!t)return 0;var n,r=0,o=qs(e);try{for(o.s();!(n=o.n()).done;){var i=t[n.value];i&&(r+=+i)}}catch(t){o.e(t)}finally{o.f()}return r||0};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 ef(){ef=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),u=new C(r||[]);return o(a,"_invoke",{value:P(t,n,u)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",y="suspendedYield",p="executing",v="completed",d={};function b(){}function m(){}function g(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(A([])));_&&_!==n&&r.call(_,a)&&(w=_);var S=g.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(o,i,a,u){var l=f(t[o],t,i);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"==tf(s)&&r.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(s).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,n,r){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var l=E(u,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?v:y,c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function k(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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function A(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(tf(e)+" is not iterable")}return m.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:m,configurable:!0}),m.displayName=c(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},O(j.prototype),c(j.prototype,u,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new j(s(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),c(S,l,"Generator"),c(S,a,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.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}},e.values=A,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return u.type="throw",u.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},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),d},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),T(n),d}},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 o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:A(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),d}},e}function nf(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 rf(t,e);var n={}.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)?rf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function rf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function of(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function af(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,uf(r.key),r)}}function uf(t){var e=function(t){if("object"!=tf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=tf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==tf(e)?e:e+""}function lf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(lf=function(){return!!t})()}function cf(t){return cf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cf(t)}function sf(t,e){return sf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sf(t,e)}var ff=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=cf(e),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)}(t,lf()?Reflect.construct(e,n||[],cf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.image=t.image||function(){return""},n.size=t.size||function(t,e){return e},n.cache={},n}return 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)}(e,t),n=e,r=[{key:"draw",value:(o=ef().mark((function t(e,n,r){var o,i,a,u,l,c,s,f=this;return ef().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=n.view.z,i=r/o,a=this.viewScale?this.viewScale(e,r,o):void 0,n.initCanvasTransform(),u=nf(e),t.prev=4,c=ef().mark((function t(){var e,u,c,s,h,y;return ef().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=l.value,u=f.image(e,r,o,a)){t.next=4;break}return t.abrupt("return",0);case 4:if(c=f.size(e,r,o,a)/o){t.next=7;break}return t.abrupt("return",0);case 7:if("loading"!=(s=f.cache[u])){t.next=12;break}return t.abrupt("return",{v:void 0});case 12:if(s){y=(i-c)/2;try{n.offscreenCtx.drawImage(s,n.geoToPixX(e.x)+y,n.geoToPixY(e.y)+y-i,c,c)}catch(t){console.error(t)}}else f.cache[u]="loading",(h=new Image).onload=function(){f.cache[u]=h,n.redraw()},h.onerror=function(){console.warn("Could not retrieve image from",u)},h.src=u;case 13:case"end":return t.stop()}}),t)})),u.s();case 7:if((l=u.n()).done){t.next=16;break}return t.delegateYield(c(),"t0",9);case 9:if(0!==(s=t.t0)){t.next=12;break}return t.abrupt("continue",14);case 12:if(!s){t.next=14;break}return t.abrupt("return",s.v);case 14:t.next=7;break;case 16:t.next=21;break;case 18:t.prev=18,t.t1=t.catch(4),u.e(t.t1);case 21:return t.prev=21,u.f(),t.finish(21);case 24:this.updateLegends({style:this,resolution:r,z:o,viewScale:a});case 25:case"end":return t.stop()}}),t,this,[[4,18,21,24]])})),i=function(){var t=this,e=arguments;return new Promise((function(n,r){var i=o.apply(t,e);function a(t){of(i,n,r,a,u,"next",t)}function u(t){of(i,n,r,a,u,"throw",t)}a(void 0)}))},function(t,e,n){return i.apply(this,arguments)})}],r&&af(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Ni);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 yf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=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,vf(r.key),r)}}function vf(t){var e=function(t){if("object"!=hf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hf(e)?e:e+""}function df(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(df=function(){return!!t})()}function bf(t){return bf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bf(t)}function mf(t,e){return mf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mf(t,e)}var gf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=bf(e),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)}(t,df()?Reflect.construct(e,n||[],bf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.value=t.value,n.targetResolution=t.targetResolution||function(t,e){return t/5},n.interpolatedProperty=t.interpolatedProperty||"value",n.nodataHandling=t.nodataHandling||"zero",n.styles=t.styles||[],n}return 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&&mf(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,e,n){var r=this;if(this.filter&&(t=t.filter(this.filter)),0!=t.length){var o=e.view.z,i=Su(t,n,(function(t){return r.value(t)})),a=i.x0,u=i.y0,l=this.targetResolution(n,o),c=Math.round(n/l);l=n/c,i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"zero";if(1===e)return t;var r=t.length;if(0===r)return[];for(var o=t[0].length,i=r*e,a=o*e,u=Array(i).fill().map((function(){return Array(a).fill(void 0)})),l=e%2==0,c=0;c<i;c++)for(var s=Math.min(Math.floor(c/e),r-2),f=c%e/e,h=s*e+e/2,y=0;y<a;y++){var p=Math.min(Math.floor(y/e),o-2),v=y%e/e,d=p*e+e/2,b=t[s][p],m=t[s][p+1],g=t[s+1][p],w=t[s+1][p+1];if(l){if(void 0===b&&c<=h&&y<=d)continue;if(void 0===m&&c<=h&&y>=d)continue;if(void 0===g&&c>=h&&y<=d)continue;if(void 0===w&&c>=h&&y>=d)continue}else{if(void 0===b&&c<h&&y<d)continue;if(void 0===m&&c<h&&y>d)continue;if(void 0===g&&c>h&&y<d)continue;if(void 0===w&&c>h&&y>d)continue}if("zero"!==n)if(void 0===b||void 0===m||void 0===g||void 0===w)if(void 0!==b||void 0===m||void 0===g||void 0===w)if(void 0===b||void 0!==m||void 0===g||void 0===w)if(void 0===b||void 0===m||void 0!==g||void 0===w)if(void 0===b||void 0===m||void 0===g||void 0!==w)if(void 0===b||void 0===w)if(void 0===m||void 0===g)void 0===b||void 0===g?void 0===m||void 0===w?(void 0!==b&&void 0!==m&&(u[c][y]=m*v+b*(1-v)),void 0===g||void 0===w?void 0===b?void 0===m?void 0===g?void 0!==w&&(u[c][y]=w):u[c][y]=g:u[c][y]=m:u[c][y]=b:u[c][y]=w*v+g*(1-v)):u[c][y]=w*f+m*(1-f):u[c][y]=g*f+b*(1-f);else{var x=(1-v+f)*Math.SQRT1_2;u[c][y]=m*(1-x)+g*x}else{var _=(v+f)*Math.SQRT1_2;u[c][y]=b*(1-_)+w*_}else{var S=m+g;u[c][y]=wf(b,m,g,S/2,v,f)}else{var O=b+w;u[c][y]=wf(b,m,O/2,w,v,f)}else{var j=b+w;u[c][y]=wf(b,j/2,g,w,v,f)}else{var P=m+g;u[c][y]=wf(P/2,m,g,w,v,f)}else u[c][y]=wf(b,m,g,w,v,f);else u[c][y]=wf(b||0,m||0,g||0,w||0,v,f)}return u}(i,c,this.nodataHandling),t=[];for(var s=(n-l)/2,f=0;f<i.length;f++)for(var h=i[f],y=u-f*l+s,p=0;p<h.length;p++){var v=h[p];if(v){var d={x:a+p*l+s,y};d[this.interpolatedProperty]=v,t.push(d)}}var b,m=e.offscreenCtx,g=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 yf(t,e);var n={}.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)?yf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(this.styles);try{for(g.s();!(b=g.n()).done;){var w=b.value;w.visible&&!w.visible(o)||((w.alpha||w.blendOperation)&&(m.save(),w.alpha&&(m.globalAlpha=w.alpha(o)),w.blendOperation&&(m.globalCompositeOperation=w.blendOperation(o))),e.setCanvasTransform(),w.draw(t,e,l),w.filterColor&&w.drawFilter(e),(w.alpha||w.blendOperation)&&m.restore())}}catch(t){g.e(t)}finally{g.f()}}}}],r&&pf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ni),wf=function(t,e,n,r,o,i){var a=t+(e-t)*o;return a+(n+(r-n)*o-a)*i};function xf(t){return xf="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},xf(t)}function _f(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 Sf(t,e);var n={}.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)?Sf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function Sf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Of(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,jf(r.key),r)}}function jf(t){var e=function(t){if("object"!=xf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=xf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xf(e)?e:e+""}function Pf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Pf=function(){return!!t})()}function Ef(t){return Ef=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ef(t)}function kf(t,e){return kf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},kf(t,e)}var Tf=function(t){function e(t,n){var r,o=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,e),r=function(t,e,n){return e=Ef(e),function(t,e){if(e&&("object"==xf(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)}(t,Pf()?Reflect.construct(e,n||[],Ef(t).constructor):e.apply(t,n))}(this,e,[o]),o=o||{},r.dataset=t,r.styles=n,r.minPixelsPerCell=o.minPixelsPerCell||3,r.cellInfoHTML=o.cellInfoHTML||e.defaultCellInfoHTML,r}return 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&&kf(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n){var r=t.view.z,o=t.offscreenCtx,i=this.getDataset(r);if(i){i.getData(t.extGeo),i.updateViewCache(t.extGeo),(this.alpha||this.blendOperation)&&(o.save(),this.alpha&&(o.globalAlpha=this.alpha(r)),this.blendOperation&&(o.globalCompositeOperation=this.blendOperation(r)));var a,u=_f(this.styles);try{for(u.s();!(a=u.n()).done;){var l=a.value;l.visible&&!l.visible(r)||((l.alpha||l.blendOperation)&&(o.save(),l.alpha&&(o.globalAlpha=l.alpha(r)),l.blendOperation&&(o.globalCompositeOperation=l.blendOperation(r))),t.setCanvasTransform(),l.draw(i.getViewCache(),t,i.getResolution()),l.filterColor&&l.drawFilter(t),(l.alpha||l.blendOperation)&&o.restore())}}catch(t){u.e(t)}finally{u.f()}if((this.alpha||this.blendOperation)&&o.restore(),n){var c,s=_f(this.styles);try{for(s.s();!(c=s.n()).done;){var f=c.value;if((!f.visible||f.visible(r))&&(e.addLegends(n,f.legends),f.styles)){var h,y=_f(f.styles);try{for(y.s();!(h=y.n()).done;){var p=h.value;p.visible&&!p.visible(r)||e.addLegends(n,p.legends)}}catch(t){y.e(t)}finally{y.f()}}}}catch(t){s.e(t)}finally{s.f()}}}}},{key:"getDataset",value:function(t){return this.dataset.getDataset(t,this.minPixelsPerCell)}},{key:"styles_",value:function(t){return 0===arguments.length?this.styles:(1===arguments.length?Array.isArray(t)?this.styles=t:this.styles=[t]:this.styles=arguments,this)}}],o=[{key:"addLegends",value:function(t,e){if(Array.isArray(e)){var n,r=_f(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;this.addLegends(t,o)}}catch(t){r.e(t)}finally{r.f()}}else t.node().append(e.div.node())}},{key:"defaultCellInfoHTML",value:function(t){for(var e=[],n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];"x"!==o&&"y"!==o&&e.push("<b>",o,"</b>"," : ",t[o],"<br>")}return e.join("")}}],r&&Of(n.prototype,r),o&&Of(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Yi);function Cf(t){return Cf="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},Cf(t)}function Af(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,Mf(r.key),r)}}function Mf(t){var e=function(t){if("object"!=Cf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Cf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Cf(e)?e:e+""}function Lf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Lf=function(){return!!t})()}function zf(t){return zf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zf(t)}function Rf(t,e){return Rf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rf(t,e)}var If=function(t){function e(t){var n;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=zf(e),function(t,e){if(e&&("object"==Cf(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)}(t,Lf()?Reflect.construct(e,n||[],zf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.cache={},n.url=t.url,n.urlFun=t.urlFun||function(t,e,r){return n.url+r+"/"+t+"/"+e+".png"},n.resolutions=t.resolutions,!n.resolutions||0==n.resolutions.length)throw new Error("No resolutions provided for background layer");return n.nbPix=t.nbPix||256,n.origin=t.origin||[0,0],n.z0=t.z0||0,n.pixelationCoefficient=t.pixelationCoefficient||1,n}return 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&&Rf(t,e)}(e,t),n=e,(r=[{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.view.z,r=this.origin[0],o=this.origin[1],i=0;for(i=0;i<this.resolutions.length&&!(this.resolutions[i]<n*this.pixelationCoefficient);i++);i-=1,i=Math.max(0,i),i=Math.min(i,this.resolutions.length-1);var a=this.resolutions[i];i+=this.z0;for(var u=this.nbPix*a,l=u/n,c=function(t){return Math.ceil((t-r)/u)},s=function(t){return Math.ceil(-(t-o)/u)},f=c(t.extGeo.xMin)-1,h=c(t.extGeo.xMax),y=s(t.extGeo.yMin),p=s(t.extGeo.yMax)-1,v=function(n){for(var a=function(a){var c=e.get(i,n,a);if(!c){var s=new Image;return e.put(s,i,n,a),s.onload=function(){t.redraw()},s.onerror=function(){e.put("failed",i,n,a)},s.src=e.urlFun(n,a,i),0}if("failed"===c)return 0;if(!(c instanceof HTMLImageElement))return console.log(c),0;if(0==c.width||0==c.height)return 0;var f=r+n*u,h=o-a*u;try{t.initCanvasTransform(),t.offscreenCtx.drawImage(c,t.geoToPixX(f),t.geoToPixY(h),l,l)}catch(t){console.error(t)}},c=p;c<y;c++)a(c)},d=f;d<h;d++)v(d)}else console.error("No resolutions provided for background layer")}}])&&Af(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Yi);function Ff(t){return Ff="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},Ff(t)}function Nf(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,Bf(r.key),r)}}function Bf(t){var e=function(t){if("object"!=Ff(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ff(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ff(e)?e:e+""}function Df(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Df=function(){return!!t})()}function Gf(t){return Gf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gf(t)}function Uf(t,e){return Uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Uf(t,e)}var Wf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Gf(e),function(t,e){if(e&&("object"==Ff(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)}(t,Df()?Reflect.construct(e,n||[],Gf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.img=void 0,n.xMin=void 0,n.xMax=void 0,n.yMin=void 0,n.yMax=void 0,n}return 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&&Uf(t,e)}(e,t),n=e,(r=[{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.initCanvasTransform(),t.offscreenCtx.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}}}])&&Nf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Yi);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 Yf(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,$f(r.key),r)}}function $f(t){var e=function(t){if("object"!=qf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=qf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qf(e)?e:e+""}function Hf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Hf=function(){return!!t})()}function Vf(t){return Vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vf(t)}function Xf(t,e){return Xf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xf(t,e)}var Zf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Vf(e),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)}(t,Hf()?Reflect.construct(e,n||[],Vf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.xMin=t.xMin||0,n.yMax=t.yMax||0,n.width=t.width||2e4,n.height=t.height||2e4,n.img=void 0,n}return 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&&Xf(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){var e=this;if(this.img){var n=t.geoToPixX(this.xMin),r=t.geoToPixY(this.yMax),o=t.getView().z;t.initCanvasTransform(),t.offscreenCtx.drawImage(this.img,n,r,this.width/o,this.height/o)}else this.img||(this.img=new Image,this.img.onload=function(){t.redraw()},this.img.onerror=function(){console.warn("Could not retrieve background image from",e.url)}),this.img.src=this.url}}])&&Yf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Yi);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 Qf(){Qf=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),u=new C(r||[]);return o(a,"_invoke",{value:P(t,n,u)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",y="suspendedYield",p="executing",v="completed",d={};function b(){}function m(){}function g(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(A([])));_&&_!==n&&r.call(_,a)&&(w=_);var S=g.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(o,i,a,u){var l=f(t[o],t,i);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"==Jf(s)&&r.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(s).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,n,r){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var l=E(u,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?v:y,c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function k(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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function A(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Jf(e)+" is not iterable")}return m.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:m,configurable:!0}),m.displayName=c(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},O(j.prototype),c(j.prototype,u,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new j(s(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),c(S,l,"Generator"),c(S,a,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.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}},e.values=A,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return u.type="throw",u.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},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),d},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),T(n),d}},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 o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:A(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),d}},e}function Kf(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function th(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 eh(t,e);var n={}.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)?eh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function eh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function nh(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,rh(r.key),r)}}function rh(t){var e=function(t){if("object"!=Jf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Jf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Jf(e)?e:e+""}function oh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(oh=function(){return!!t})()}function ih(t){return ih=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ih(t)}function ah(t,e){return ah=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ah(t,e)}var uh=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ih(e),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)}(t,oh()?Reflect.construct(e,n||[],ih(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.style=t.style||function(){return"1.2em Arial"},n.color=t.color||(t.dark?function(){return"white"}:function(){return"black"}),n.haloColor=t.haloColor||(t.dark?function(){return"black"}:function(){return"white"}),n.haloWidth=t.haloWidth||function(){return 2.5},n.textAlign=t.textAlign||"start",n.offsetPix=t.offsetPix||[5,5],n.preprocess=t.preprocess,n.labels=void 0,n.loadingStatus="notLoaded",n}return 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&&ah(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.labels){var e=t.view.z,n=t.offscreenCtx;n.textAlign=this.textAlign||"start",n.lineJoin="bevel",n.lineCap="butt",t.initCanvasTransform();var r,o=th(this.labels);try{for(o.s();!(r=o.n()).done;){var i=r.value,a=this.style(i,e);if(a&&(n.font=a,t.toDraw(i))){var u=t.geoToPixX(i.x)+this.offsetPix[0],l=t.geoToPixY(i.y)-this.offsetPix[1];if(this.haloColor&&this.haloWidth){var c=this.haloColor(i,e),s=this.haloWidth(i,e);c&&s&&s>0&&(n.strokeStyle=c,n.lineWidth=s,n.strokeText(i.name,u,l))}if(this.color){var f=this.color(i,e);f&&(n.fillStyle=f,n.fillText(i.name,u,l))}}}}catch(t){o.e(t)}finally{o.f()}}else this.load(t.redraw)}},{key:"load",value:(o=Qf().mark((function t(e){var n,r,o,i;return Qf().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,_a(this.url);case 11:if(n=t.sent,!this.preprocess){t.next=35;break}this.labels=[],r=th(n),t.prev=15,r.s();case 17:if((o=r.n()).done){t.next=25;break}if(i=o.value,0!=this.preprocess(i)){t.next=22;break}return t.abrupt("continue",23);case 22:this.labels.push(i);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,r){var i=o.apply(t,e);function a(t){Kf(i,n,r,a,u,"next",t)}function u(t){Kf(i,n,r,a,u,"throw",t)}a(void 0)}))},function(t){return i.apply(this,arguments)})}],r&&nh(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Yi);function lh(t){return lh="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},lh(t)}function ch(){ch=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),u=new C(r||[]);return o(a,"_invoke",{value:P(t,n,u)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",y="suspendedYield",p="executing",v="completed",d={};function b(){}function m(){}function g(){}var w={};c(w,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(A([])));_&&_!==n&&r.call(_,a)&&(w=_);var S=g.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(o,i,a,u){var l=f(t[o],t,i);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"==lh(s)&&r.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(s).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,n,r){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var l=E(u,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?v:y,c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function k(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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function A(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(lh(e)+" is not iterable")}return m.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:m,configurable:!0}),m.displayName=c(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},O(j.prototype),c(j.prototype,u,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new j(s(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),c(S,l,"Generator"),c(S,a,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.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}},e.values=A,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return u.type="throw",u.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},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),d},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),T(n),d}},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 o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:A(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),d}},e}function sh(t,e,n,r,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function fh(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 hh(t,e);var n={}.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)?hh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function hh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function yh(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,ph(r.key),r)}}function ph(t){var e=function(t){if("object"!=lh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=lh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==lh(e)?e:e+""}function vh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vh=function(){return!!t})()}function dh(t){return dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dh(t)}function bh(t,e){return bh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bh(t,e)}var mh=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=dh(e),function(t,e){if(e&&("object"==lh(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)}(t,vh()?Reflect.construct(e,n||[],dh(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.url=t.url,n.preprocess=t.preprocess,n.shape=t.shape||function(t,e){return"circle"},n.size=t.size||function(t,e){return 10},n.strokeStyle=t.strokeStyle||t.color||function(t,e){return"gray"},n.lineWidth=t.lineWidth||t.width||function(t,e){return 2},n.lineDash=t.lineDash||function(t,e){},n.fillStyle=t.fillStyle||function(t,e){return"black"},n.fs=void 0,n.loadingStatus="notLoaded",n}return 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&&bh(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.fs){var e,n=t.view.z,r=t.offscreenCtx,o=fh(this.fs);try{for(o.s();!(e=o.n()).done;){var i=e.value;this.drawGeometry(i,i.geometry,i.geometry.type,n,r)}}catch(t){o.e(t)}finally{o.f()}}else this.load(t.redraw)}},{key:"drawGeometry",value:function(t,e,n,r,o){if("Point"==n||"MultiPoint"==n){var i=this.shape(t,r);if(!i||"none"==i)return;var a=this.size(t,r)*r;if(!a)return;var u=this.strokeStyle(t,r),l=this.fillStyle(t,r),c=this.lineWidth(t,r)*r;o.save(),u&&(o.strokeStyle=u),l&&(o.fillStyle=l),c&&(o.lineWidth=c);var s=e.coordinates;if("Point"==n&&(s=[s]),"circle"==i){var f,h=fh(s);try{for(h.s();!(f=h.n()).done;){var y=f.value;o.beginPath(),o.arc(y[0],y[1],a/2,0,2*Math.PI,!1),l&&o.fill(),u&&c&&o.stroke()}}catch(t){h.e(t)}finally{h.f()}}else if("square"==i){var p,v=fh(s);try{for(v.s();!(p=v.n()).done;){var d=p.value;o.beginPath(),o.rect(d[0]-a/2,d[1]-a/2,a,a),l&&o.fill(),u&&c&&o.stroke()}}catch(t){v.e(t)}finally{v.f()}}else console.error("Unexpected shape for point GeoJSON: "+i);o.restore()}else if("LineString"==n||"MultiLineString"==n){var b=this.strokeStyle(t,r);if(!b||"none"===b)return;var m=this.lineWidth(t,r);if(!m||m<0)return;o.save(),o.strokeStyle=b,o.lineWidth=m*r,o.setLineDash(this.lineDash(t,r)||[]);var g,w=fh("LineString"===n?[e.coordinates]:e.coordinates);try{for(w.s();!(g=w.n()).done;){var x=g.value;if(!(x.length<2)){o.beginPath(),o.moveTo(x[0][0],x[0][1]);for(var _=1;_<x.length;_++)o.lineTo(x[_][0],x[_][1]);o.stroke()}}}catch(t){w.e(t)}finally{w.f()}o.restore()}else if("Polygon"==n||"MultiPolygon"==n){o.save();var S="Polygon"===n?[e.coordinates]:e.coordinates;o.beginPath();var O,j=fh(S);try{for(j.s();!(O=j.n()).done;){var P,E=fh(O.value);try{for(E.s();!(P=E.n()).done;){var k=P.value;if(!(k.length<2)){o.moveTo(k[0][0],k[0][1]);for(var T=1;T<k.length;T++)o.lineTo(k[T][0],k[T][1]);o.closePath()}}}catch(t){E.e(t)}finally{E.f()}}}catch(t){j.e(t)}finally{j.f()}var C=this.fillStyle(t,r);C&&"none"!==C&&(o.fillStyle=C,o.fill("evenodd"));var A=this.lineWidth(t,r);if(A&&A>0){var M,L,z,R=null!==(M=null===(L=this.strokeStyle)||void 0===L?void 0:L.call(this,t,r))&&void 0!==M?M:C;R&&"none"!==R&&(o.strokeStyle=R,o.lineWidth=A*r,o.setLineDash((null===(z=this.lineDash)||void 0===z?void 0:z.call(this,t,r))||[]),o.stroke())}o.restore()}else if("GeometryCollection"==n){var I,F=fh(e.geometries);try{for(F.s();!(I=F.n()).done;){var N=I.value;this.drawGeometry(t,N,N.type,r,o)}}catch(t){F.e(t)}finally{F.f()}}else console.log("Unexpected geometry type in GeoJSONLayer: "+n)}},{key:"load",value:(o=ch().mark((function t(e){var n,r,o,i,a;return ch().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.url){t.next=5;break}return console.log("Failed loading GeoJSON data: 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,ua(this.url);case 11:if(n=t.sent,r=n.features,!this.preprocess){t.next=36;break}this.fs=[],o=fh(r),t.prev=16,o.s();case 18:if((i=o.n()).done){t.next=26;break}if(a=i.value,0!=this.preprocess(a)){t.next=23;break}return t.abrupt("continue",24);case 23:this.fs.push(a);case 24:t.next=18;break;case 26:t.next=31;break;case 28:t.prev=28,t.t0=t.catch(16),o.e(t.t0);case 31:return t.prev=31,o.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 GeoJSON 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,r){var i=o.apply(t,e);function a(t){sh(i,n,r,a,u,"next",t)}function u(t){sh(i,n,r,a,u,"throw",t)}a(void 0)}))},function(t){return i.apply(this,arguments)})}],r&&yh(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Yi);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){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,xh(r.key),r)}}function xh(t){var e=function(t){if("object"!=gh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=gh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gh(e)?e:e+""}var _h=function(){return t=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.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.title=e.title,this.titleFontSize=e.titleFontSize||"0.8em",this.titleFontWeight=e.titleFontWeight||"bold",this.labelFontSize=e.labelFontSize||"0.8em",this.labelUnitText=e.labelUnitText||"",this.labelFormat=e.labelFormat},e=[{key:"makeTitle",value:function(){this.title&&this.div.append("div").style("font-size",this.titleFontSize).style("font-weight",this.titleFontWeight).style("margin-bottom","7px").text(this.title)}},{key:"style",value:function(t,e){return 1==arguments.length?this.div.style(t):(this.div.style(t,e),this)}},{key:"update",value:function(){console.error("Legend update not implemented yet.")}}],e&&wh(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Sh(t){return Sh="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},Sh(t)}function Oh(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,jh(r.key),r)}}function jh(t){var e=function(t){if("object"!=Sh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Sh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Sh(e)?e:e+""}function Ph(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ph=function(){return!!t})()}function Eh(t){return Eh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Eh(t)}function kh(t,e){return kh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},kh(t,e)}var Th=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Eh(e),function(t,e){if(e&&("object"==Sh(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)}(t,Ph()?Reflect.construct(e,n||[],Eh(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colorScale=t.colorScale,n.textScale=t.textScale||function(t){return t},n.margin=t.margin||5,n.tickSize=t.tickSize||6,n.ticks=t.ticks||Math.floor(n.width/50),n.tickFormat=t.tickFormat,n.tickUnit=t.tickUnit,n.fontSize=t.fontSize||"0.8em",n.invert=t.invert,n.width=t.width||300,n.height=t.height||15,n}return 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&&kh(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();for(var e=this.width+2*this.margin,n=this.height+this.margin+this.tickSize+10,r=this.div.append("svg").attr("width",e).attr("height",n).append("g").attr("transform","translate("+this.margin+" 0)"),o=this.width,i=this.height,a=0;a<o;a+=5){var u=a/(o-1);this.invert&&(u=1-u),r.append("rect").attr("x",a).attr("y",0).attr("width",5).attr("height",i).style("fill",this.colorScale(u,t.viewScale))}for(var l=0;l<this.ticks;l++){var c=l/(this.ticks-1);r.append("line").attr("x1",o*c).attr("y1",0).attr("x2",o*c).attr("y2",i+this.tickSize).style("stroke","black"),r.append("text").attr("id","ticklabel_"+l).attr("x",o*c).attr("y",i+this.tickSize+2).style("font-size",this.fontSize).style("text-anchor",0==l?"start":l==this.ticks-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none")}for(var s=this.tickFormat&&"text"!=this.tickFormat?this.tickFormat:function(t){return t},f=0;f<this.ticks;f++){var h=f/(this.ticks-1),y=this.textScale(h,t.viewScale),p=(y?s(y):"0")+(this.tickUnit?this.tickUnit:"");null!=p&&this.div.select("#ticklabel_"+f).text(p)}}}],r&&Oh(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_h);function Ch(t){return Ch="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},Ch(t)}function Ah(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,Mh(r.key),r)}}function Mh(t){var e=function(t){if("object"!=Ch(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ch(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ch(e)?e:e+""}function Lh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Lh=function(){return!!t})()}function zh(t){return zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zh(t)}function Rh(t,e){return Rh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rh(t,e)}var Ih=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=zh(e),function(t,e){if(e&&("object"==Ch(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)}(t,Lh()?Reflect.construct(e,n||[],zh(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colors=t.colors,n.breaks=t.breaks,n.width=t.width||300,n.height=t.height||15,n.tickSize=t.tickSize||3,n.invert=t.invert,n}return 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&&Rh(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.colors(t.viewScale),n=this.breaks(t.viewScale);if(n){var r=e.length;if(0!=r){for(var o=this.width/r,i=this.div.append("svg").attr("width",this.width).attr("height",this.height+this.tickSize+2+10),a=0;a<r;a++)i.append("rect").attr("x",a*o).attr("y",0).attr("width",o).attr("height",this.height).style("fill",e[a]);for(var u=1;u<r;u++)i.append("line").attr("x1",o*u).attr("y1",0).attr("x2",o*u).attr("y2",this.height+this.tickSize).style("stroke","black");for(var l=1;l<r;l++){var c=n[l-1];isNaN(c)||null==c||(this.labelFormat&&(c=this.labelFormat(c,l)),i.append("text").attr("id","ticklabel_"+l).attr("x",o*l).attr("y",this.height+this.tickSize+2).style("font-size",this.labelFontSize).style("text-anchor","middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(c))}}}}}])&&Ah(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_h);function Fh(t){return Fh="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},Fh(t)}function Nh(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,Bh(r.key),r)}}function Bh(t){var e=function(t){if("object"!=Fh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fh(e)?e:e+""}function Dh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dh=function(){return!!t})()}function Gh(t){return Gh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gh(t)}function Uh(t,e){return Uh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Uh(t,e)}var Wh=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Gh(e),function(t,e){if(e&&("object"==Fh(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)}(t,Dh()?Reflect.construct(e,n||[],Gh(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colorLabel=t.colorLabel||[["gray","-"]],n.shape=t.shape||"circle",n.dimension=t.dimension||{r:8},n.strokeColor=t.strokeColor||"gray",n.strokeWidth=t.strokeWidth||1,n}return 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&&Uh(t,e)}(e,t),n=e,(r=[{key:"update",value:function(){this.div.selectAll("*").remove(),this.makeTitle();var t=this.colorLabel.length;if(0!=t)for(var e=0;e<t;e++){var n=this.colorLabel[e],r=this.div.append("div"),o=this.strokeWidth;if("square"===this.shape){var i=this.dimension.h||15,a=this.dimension.w||20;r.append("div").style("display","inline").append("svg").attr("width",a+2*o).attr("height",i+2*o).append("rect").attr("x",o).attr("y",o).attr("width",a).attr("height",i).style("fill",n[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,l=2*u+2*o;r.append("div").style("display","inline").append("svg").attr("width",l).attr("height",l).append("circle").attr("cx",u+o).attr("cy",u+o).attr("r",u).style("fill",n[0]).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth)}r.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(n[1])}}}])&&Nh(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_h);function qh(t){return qh="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},qh(t)}function Yh(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 $h(t,e);var n={}.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)?$h(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function $h(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Hh(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,Vh(r.key),r)}}function Vh(t){var e=function(t){if("object"!=qh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=qh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qh(e)?e:e+""}function Xh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xh=function(){return!!t})()}function Zh(t){return Zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zh(t)}function Jh(t,e){return Jh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jh(t,e)}var Qh=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=Zh(e),function(t,e){if(e&&("object"==qh(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)}(t,Xh()?Reflect.construct(e,n||[],Zh(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.label=t.label||void 0,n.size=t.size||void 0,n.shape=t.shape||"circle",n.fillColor=t.fillColor||"none",n.strokeColor=t.strokeColor||"gray",n.strokeWidth=t.strokeWidth||1,n.color=t.color||"gray",n.length=t.length||function(t,e,n){return t},n}return 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&&Jh(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n,r=this.label(t.viewScale,t.cells,t.resolution,t.z);if(n=this.size?this.size(t.viewScale,t.resolution,t.z)/t.z:t.viewScale(+r)/t.z){this.labelFormat&&!isNaN(+r)&&(r=this.labelFormat(r));var o=this.div.append("div"),i=function(){return o.append("svg").attr("width",n+e.strokeWidth+2).attr("height",n+e.strokeWidth+2).style("","inline-block")};if("square"===this.shape)i().append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",n).style("fill",this.fillColor).style("stroke",this.strokeColor).style("stroke-width",this.strokeWidth);else if("circle"===this.shape){var a=.5*(n+this.strokeWidth);i().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);else{if("line"!==this.shape)throw new Error("Unexpected shape:"+this.shape);var u=this.length?this.length(t.resolution,t.z,t.viewScale):t.resolution;u/=t.z,o.append("svg").attr("width",u).attr("height",n).style("","inline-block").append("line").attr("x1",0).attr("y1",n/2).attr("x2",u).attr("y2",n/2).style("stroke",this.color).style("stroke-width",n)}o.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(r+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&Hh(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_h);function Kh(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=[],i=Yh(t);try{var a=function(){var i=n.value;r.title=i==t[0]?r.title:void 0,r.size=function(){return e(i)},r.label=function(){return i},o.push(new Qh(r))};for(i.s();!(n=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function ty(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.k||[.9,.5,.2,.05],o=[],i=Yh(r);try{var a=function(){var i=e.value;n.title=i==r[0]?n.title:void 0,n.label=function(e,n){return _u(i*ql(n,t))},o.push(new Qh(n))};for(i.s();!(e=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function ey(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.labelFormat||function(t){return t},o=n.labelText||ry(r),i=[],a=function(r){n.title=r==e.length-1?n.title:void 0,n.size=function(){return e[r]},n.label=function(){return o(t[r-1],t[r])},i.push(new Qh(n))},u=e.length-1;u>=0;u--)a(u);return i}function ny(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.labelFormat||function(t){return t},r=e.labelText||ry(n),o=[],i=e.viewScaleFun||function(t){return t},a=function(n){e.title=n==t-1?e.title:void 0,e.size=function(t){return i(t).values[n]},e.label=function(t){return r(i(t).breaks[n-1],i(t).breaks[n])},o.push(new Qh(e))},u=t-1;u>=0;u--)a(u);return o}function ry(t){return function(e,n){return null==e&&null==n?"":null==n?"> "+t(e):null==e?"< "+t(n):t(e)+" - "+t(n)}}function oy(t){return oy="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},oy(t)}function iy(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,ay(r.key),r)}}function ay(t){var e=function(t){if("object"!=oy(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=oy(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oy(e)?e:e+""}function uy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(uy=function(){return!!t})()}function ly(t){return ly=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ly(t)}function cy(t,e){return cy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cy(t,e)}var sy=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=ly(e),function(t,e){if(e&&("object"==oy(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)}(t,uy()?Reflect.construct(e,n||[],ly(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.orientation=t.orientation||0,n.color=t.color||function(t,e,n){return"gray"},n.width=t.width||function(t,e,n){return 3*e},n.length=t.length||function(t,e,n){return t},n.label=t.label||"-",n}return 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&&cy(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.div.append("div"),n=this.color(t.resolution,t.z,t.viewScale),r=this.width(t.resolution,t.z,t.viewScale)/t.z,o=this.length(t.resolution,t.z,t.viewScale)/t.z,i=Math.max(o,r),a=e.append("svg").attr("width",i).attr("height",i).style("","inline-block"),u=Math.cos(-this.orientation*Math.PI/180),l=Math.sin(-this.orientation*Math.PI/180),c=.5*i,s=.5*o;a.append("line").attr("x1",c-u*s).attr("y1",c-l*s).attr("x2",c+u*s).attr("y2",c+l*s).style("stroke",n).style("stroke-width",r),e.append("div").style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSize).text(this.label+(this.labelUnitText?" ":"")+this.labelUnitText)}}],r&&iy(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_h);function fy(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=[],o=0;o<t.length;o++)n.title=0==o?n.title:void 0,n.orientation=t[o],n.label=e[o],r.push(new sy(n));return r}function hy(t){return hy="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},hy(t)}function yy(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,py(r.key),r)}}function py(t){var e=function(t){if("object"!=hy(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hy(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hy(e)?e:e+""}function vy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vy=function(){return!!t})()}function dy(t){return dy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dy(t)}function by(t,e){return by=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},by(t,e)}var my=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=function(t,e,n){return e=dy(e),function(t,e){if(e&&("object"==hy(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)}(t,vy()?Reflect.construct(e,n||[],dy(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.classifier=t.classifier,n.width=t.width||150,n.selectionColor=t.selectionColor||"red",n.tooltip=t.tooltip,n.texts=t.texts,n.leftText=t.leftText||"Category 0",n.topText=t.topText||"Category 1",n.rightText=t.rightText||"Category 2",n.centerCoefficient=t.centerCoefficient||n.classifier.centerCoefficient,n}return 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&&by(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.width,n=.866025*e,r=this.classifier,o=this.selectionColor,i=this.tooltip,a=this.texts||{},u=this.div.append("svg").attr("width",e+0).attr("height",n+8+24);u.append("text").attr("x",e/2).attr("y",14).text(this.topText).attr("font-size",12).attr("text-anchor","middle"),u.append("text").attr("x",0).attr("y",30+n).text(this.leftText).attr("font-size",12).attr("text-anchor","start"),u.append("text").attr("x",e).attr("y",30+n).text(this.rightText).attr("font-size",12).attr("text-anchor","end");var l=u.append("g").attr("transform","translate(0 16)"),c=function(t,e,n){t.attr("fill",e).on("mouseover",(function(t){pt(this).attr("fill",o),i&&n&&(i.html(n),i.setPosition(t),i.show())})).on("mouseout",(function(){pt(this).attr("fill",e),i&&i.hide()})),i&&n&&t.on("mousemove",(function(t){i.setPosition(t)}))};c(l.append("polygon").attr("points","0,"+n+" "+e/3+","+n+" "+e/2+","+2*n/3+" "+e/6+","+2*n/3),r.colors[0],a[0]),c(l.append("polygon").attr("points",e/2+",0 "+2*e/3+","+n/3+" "+e/2+","+2*n/3+" "+e/3+","+n/3),r.colors[1],a[1]),c(l.append("polygon").attr("points",e+","+n+" "+5*e/6+","+2*n/3+" "+e/2+","+2*n/3+" "+2*e/3+","+n),r.colors[2],a[2]),c(l.append("polygon").attr("points",e/2+","+2*n/3+" "+5*e/6+","+2*n/3+" "+2*e/3+","+n/3),r.mixColors[0],a.m12),c(l.append("polygon").attr("points",e/2+","+2*n/3+" "+e/3+","+n+" "+2*e/3+","+n),r.mixColors[1],a.m02),c(l.append("polygon").attr("points",e/2+","+2*n/3+" "+e/6+","+2*n/3+" "+e/3+","+n/3),r.mixColors[2],a.m01),this.centerCoefficient&&c(l.append("circle").attr("cx",e/2).attr("cy",2*n/3).attr("r",this.centerCoefficient*n/3),r.centerColor,a.center)}}],r&&yy(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_h),gy=function(t){return t};gy.invert=gy;var wy=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return gy;var e=Math.exp(t)-1,n=function(n){return(Math.exp(n*t)-1)/e};return n.invert=function(n){return Math.log(e*n+1)/t},n},xy=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return gy;var e=Math.exp(t),n=1-e,r=function(r){return 1-Math.log(e+r*n)/t};return r.invert=function(r){return(Math.exp((1-r)*t)-e)/n},r},_y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return gy;var e=function(e){return Math.pow(e,t)},n=1/t;return e.invert=function(t){return Math.pow(t,n)},e},Sy=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return gy;var e=1/t,n=function(t){return 1-Math.pow(1-t,e)};return n.invert=function(e){return 1-Math.pow(1-e,t)},n},Oy=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return gy;if(1==t)return function(t){return Math.sqrt(t*(2-t))};var e=t/(1-t);return function(t){return Math.sqrt(1/(e*e)+t*(2/e+2-t))-1/e}},jy=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return gy;var e=Oy(t);return function(t){return 1-e(1-t)}};const Py=Math.PI/180,Ey=180/Math.PI,ky=.96422,Ty=.82521,Cy=4/29,Ay=6/29,My=3*Ay*Ay,Ly=Ay*Ay*Ay;function zy(t){if(t instanceof Iy)return new Iy(t.l,t.a,t.b,t.opacity);if(t instanceof Gy)return Uy(t);t instanceof Hr||(t=Yr(t));var e,n,r=Dy(t.r),o=Dy(t.g),i=Dy(t.b),a=Fy((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?e=n=a:(e=Fy((.4360747*r+.3850649*o+.1430804*i)/ky),n=Fy((.0139322*r+.0971045*o+.7141733*i)/Ty)),new Iy(116*a-16,500*(e-a),200*(a-n),t.opacity)}function Ry(t,e,n,r){return 1===arguments.length?zy(t):new Iy(t,e,n,null==r?1:r)}function Iy(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Fy(t){return t>Ly?Math.pow(t,1/3):t/My+Cy}function Ny(t){return t>Ay?t*t*t:My*(t-Cy)}function By(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Dy(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Gy(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function Uy(t){if(isNaN(t.h))return new Iy(t.l,0,0,t.opacity);var e=t.h*Py;return new Iy(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}function Wy(t,e){var n=uo((t=Ry(t)).l,(e=Ry(e)).l),r=uo(t.a,e.a),o=uo(t.b,e.b),i=uo(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=o(e),t.opacity=i(e),t+""}}function qy(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Yy(t,e);var n={}.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)?Yy(t,e):void 0}}(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 Yy(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}Or(Iy,Ry,jr(Pr,{brighter(t){return new Iy(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Iy(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Hr(By(3.1338561*(e=ky*Ny(e))-1.6168667*(t=1*Ny(t))-.4906146*(n=Ty*Ny(n))),By(-.9787684*e+1.9161415*t+.033454*n),By(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),Or(Gy,(function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Gy)return new Gy(t.h,t.c,t.l,t.opacity);if(t instanceof Iy||(t=zy(t)),0===t.a&&0===t.b)return new Gy(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Ey;return new Gy(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Gy(t,e,n,null==r?1:r)}),jr(Pr,{brighter(t){return new Gy(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new Gy(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return Uy(this).rgb()}}));var $y=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t[0],o=t[1],i=t[2],a=qy(n.center||[1/3,1/3,1/3],3),u=a[0],l=a[1],c=a[2],s=null==n.withMixedClasses||n.withMixedClasses,f=n.centerCoefficient?1-n.centerCoefficient:void 0,h=function(t){var n=e(t);if(n){var a=+t[r]/n,h=+t[o]/n,y=+t[i]/n;return a>=u&&h<=l&&y<=c?null!=f&&(y-c)*(l-f*l)>=(h-f*l)*(f*c-c)?"center":"0":a<=u&&h>=l&&y<=c?null!=f&&(y-c)*(u-f*u)>=(a-f*u)*(f*c-c)?"center":"1":a<=u&&h<=l&&y>=c?null!=f&&(h-l)*(u-f*u)>=(a-f*u)*(f*l-l)?"center":"2":a<=u&&h>=l&&y>=c?null!=f&&a>f*u?"center":s?"m12":h>y?"1":"2":a>=u&&h<=l&&y>=c?null!=f&&h>f*l?"center":s?"m02":a>y?"0":"2":a>=u&&h>=l&&y<=c?null!=f&&y>f*c?"center":s?"m01":h>a?"1":"0":"unknown"}};return h.center=[u,l,c],h.centerCoefficient=n.centerCoefficient,h},Hy=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=qy(n||["red","green","blue"],3),i=o[0],a=o[1],u=o[2],l=r.colorInterpolation||Wy,c=null==r.withMixedClasses||r.withMixedClasses,s=function(t,e){return l(t,e)(.5)},f=qy(r.mixedColors||c?[s(a,u),s(i,u),s(i,a)]:[],3),h=f[0],y=f[1],p=f[2],v=r.centerColor||l(s(i,a),u)(.333),d=$y(t,e,r),b=function(t){var e=d(t);return"0"==e?i:"1"==e?a:"2"==e?u:"m12"==e?h:"m02"==e?y:"m01"==e?p:"center"==e?v:r.defaultColor||"black"};return b.center=d.center,b.centerCoefficient=r.centerCoefficient,b.colors=[i,a,u],b.mixColors=[h,y,p],b.centerColor=v,b.classifier=d,b};function Vy(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 Xy,Zy=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Jy(t){return new Qy(t)}function Qy(t){if(!(e=Zy.exec(t)))throw new Error("invalid format: "+t);var e;this.fill=e[1]||" ",this.align=e[2]||">",this.sign=e[3]||"-",this.symbol=e[4]||"",this.zero=!!e[5],this.width=e[6]&&+e[6],this.comma=!!e[7],this.precision=e[8]&&+e[8].slice(1),this.trim=!!e[9],this.type=e[10]||""}function Ky(t,e){var n=Vy(t,e);if(!n)return t+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}Jy.prototype=Qy.prototype,Qy.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const tp={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return Ky(100*t,e)},r:Ky,s:function(t,e){var n=Vy(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(Xy=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,a=r.length;return i===a?r:i>a?r+new Array(i-a+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Vy(t,Math.max(0,e+i-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function ep(t){return t}var np,rp=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function op(t){return np=function(t){var e,n,r=t.grouping&&t.thousands?(e=t.grouping,n=t.thousands,function(t,r){for(var o=t.length,i=[],a=0,u=e[0],l=0;o>0&&u>0&&(l+u+1>r&&(u=Math.max(1,r-l)),i.push(t.substring(o-=u,o+u)),!((l+=u+1)>r));)u=e[a=(a+1)%e.length];return i.reverse().join(n)}):ep,o=t.currency,i=t.decimal,a=t.numerals?function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(t.numerals):ep,u=t.percent||"%";function l(t){var e=(t=Jy(t)).fill,n=t.align,l=t.sign,c=t.symbol,s=t.zero,f=t.width,h=t.comma,y=t.precision,p=t.trim,v=t.type;"n"===v?(h=!0,v="g"):tp[v]||(null==y&&(y=12),p=!0,v="g"),(s||"0"===e&&"="===n)&&(s=!0,e="0",n="=");var d="$"===c?o[0]:"#"===c&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",b="$"===c?o[1]:/[%p]/.test(v)?u:"",m=tp[v],g=/[defgprs%]/.test(v);function w(t){var o,u,c,w=d,x=b;if("c"===v)x=m(t)+x,t="";else{var _=(t=+t)<0;if(t=m(Math.abs(t),y),p&&(t=function(t){t:for(var e,n=t.length,r=1,o=-1;r<n;++r)switch(t[r]){case".":o=e=r;break;case"0":0===o&&(o=r),e=r;break;default:if(o>0){if(!+t[r])break t;o=0}}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),_&&0==+t&&(_=!1),w=(_?"("===l?l:"-":"-"===l||"("===l?"":l)+w,x=("s"===v?rp[8+Xy/3]:"")+x+(_&&"("===l?")":""),g)for(o=-1,u=t.length;++o<u;)if(48>(c=t.charCodeAt(o))||c>57){x=(46===c?i+t.slice(o+1):t.slice(o))+x,t=t.slice(0,o);break}}h&&!s&&(t=r(t,1/0));var S=w.length+t.length+x.length,O=S<f?new Array(f-S+1).join(e):"";switch(h&&s&&(t=r(O+t,O.length?f-x.length:1/0),O=""),n){case"<":t=w+t+x+O;break;case"=":t=w+O+t+x;break;case"^":t=O.slice(0,S=O.length>>1)+w+t+x+O.slice(S);break;default:t=O+w+t+x}return a(t)}return y=null==y?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),w.toString=function(){return t+""},w}return{format:l,formatPrefix:function(t,e){var n,r=l(((t=Jy(t)).type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Vy(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-o),a=rp[8+o/3];return function(t){return r(i*t)+a}}}}(t),np.format,np.formatPrefix,np}op({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var ip=Jo.getParameterByName;return op({decimal:".",thousands:" ",grouping:[3],currency:["","€"]}),e})()));