gridviz 3.1.0 → 3.1.1

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 (46) hide show
  1. package/README.md +18 -15
  2. package/dist/gridviz.js +3829 -2623
  3. package/dist/gridviz.min.js +1 -1
  4. package/package.json +5 -3
  5. package/src/button/Button.js +77 -68
  6. package/src/button/FullscreenButton.js +123 -123
  7. package/src/button/ZoomButtons.js +109 -104
  8. package/src/core/GeoCanvas.js +15 -0
  9. package/src/core/Legend.js +267 -245
  10. package/src/core/Map.js +819 -670
  11. package/src/core/Tooltip.js +191 -185
  12. package/src/index.js +82 -79
  13. package/src/layer/GridLayer.js +4 -3
  14. package/src/layer/LabelLayer.js +7 -4
  15. package/src/legend/ColorCategoryLegend.js +127 -125
  16. package/src/legend/ColorDiscreteLegend.js +116 -114
  17. package/src/legend/ColorLegend.js +33 -11
  18. package/src/legend/OrientationLegend.js +94 -92
  19. package/src/legend/SizeLegend.js +8 -1
  20. package/src/legend/TernaryLegend.js +317 -314
  21. package/src/legend/VennLegend.js +202 -0
  22. package/src/style/CircleColorSizeWebGLStyle.js +249 -0
  23. package/src/style/CompositionStyle.js +1 -1
  24. package/src/style/DotDensityStyle.js +8 -4
  25. package/src/style/ImageStyle.js +1 -1
  26. package/src/style/Interpolator.js +283 -259
  27. package/src/style/IsoFenceStyle.js +1 -1
  28. package/src/style/LegoStyle.js +6 -5
  29. package/src/style/MosaicStyle.js +1 -1
  30. package/src/style/NinjaStarStyle.js +1 -1
  31. package/src/style/PillarStyle.js +1 -1
  32. package/src/style/RandomWalkInterpolator.js +213 -0
  33. package/src/style/ShadingRayStyle.js +16 -2
  34. package/src/style/ShadingStyle.js +80 -72
  35. package/src/style/ShapeColorSizeStyle.js +18 -2
  36. package/src/style/SideCategoryStyle.js +1 -1
  37. package/src/style/SideStyle.js +1 -1
  38. package/src/style/SideTanakaStyle.js +1 -1
  39. package/src/style/SquareColorCategoryWebGLStyle.js +71 -20
  40. package/src/style/SquareColorWebGLStyle.js +7 -4
  41. package/src/style/StrokeStyle.js +1 -1
  42. package/src/style/TextStyle.js +1 -1
  43. package/src/style/TimeSeriesStyle.js +14 -7
  44. package/src/utils/WebGLSquareColoringAdvanced.js +47 -9
  45. package/src/utils/scale.js +20 -0
  46. package/src/utils/webGLUtils.js +52 -0
@@ -1,2 +1,2 @@
1
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(t){return n="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},n(t)}function r(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,o(r.key),r)}}function o(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}function i(t,e){var n=t.visible;return"function"==typeof n?!!n(e):!1!==n}t.r(e),t.d(e,{BackgroundLayer:()=>Ac,BackgroundLayerImage:()=>Hc,BackgroundLayerWMS:()=>Lc,CSVGrid:()=>Do,ColorCategoryLegend:()=>Gs,ColorDiscreteLegend:()=>Rs,ColorLegend:()=>ks,CompositionStyle:()=>Ri,Dataset:()=>Nr,DotDensityStyle:()=>fu,GeoCanvas:()=>Dn,GeoJSONLayer:()=>vs,GridLayer:()=>_c,ImageStyle:()=>ac,Interpolator:()=>pc,IsoFenceStyle:()=>ql,JSGrid:()=>Vo,JoyPlotStyle:()=>_i,LabelLayer:()=>rs,Layer:()=>Ar,LegoStyle:()=>Ju,Map:()=>vr,MosaicStyle:()=>ml,MultiResolutionDataset:()=>Hr,NinjaStarStyle:()=>Pl,OrientationLegend:()=>cf,PillarStyle:()=>ia,SegmentStyle:()=>Wi,ShadingRayStyle:()=>Ba,ShadingStyle:()=>Ua,ShapeColorSizeStyle:()=>ni,SideCategoryStyle:()=>Ja,SideStyle:()=>ya,SideTanakaStyle:()=>gu,SizeLegend:()=>Zs,SquareColorCategoryWebGLStyle:()=>Ea,SquareColorWebGLStyle:()=>sl,StrokeStyle:()=>si,Style:()=>_r,TernaryLegend:()=>bf,TextStyle:()=>Zi,TiledGrid:()=>ko,TimeSeriesStyle:()=>Fl,cellsToMatrix:()=>bi,circularInverseScale:()=>_f,circularScale:()=>Of,classifier:()=>Bu,classifierMinMax:()=>Lu,colorClassifier:()=>Nu,discreteColors:()=>Du,exponentialScale:()=>gf,getParameterByName:()=>ih,logarithmicScale:()=>wf,nice:()=>di,orientationLegend:()=>sf,powerInverseScale:()=>Sf,powerScale:()=>xf,sizeDiscreteLegend:()=>Qs,sizeDiscreteViewScaleLegend:()=>tf,sizeLegend:()=>Js,sizeLegendViewScale:()=>Ks,ternaryClassifier:()=>Hf,ternaryColorClassifier:()=>qf,viewScale:()=>Au,viewScaleColor:()=>zu,viewScaleColorQuantile:()=>Ru,viewScaleCombination:()=>Iu,viewScaleQuantile:()=>Mu,viewScaleQuantileClassifer:()=>Fu});var a=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:"isVisible",value:function(t){return i(this,t)}},{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)}}}}])&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function u(){}function l(t){return null==t?u:function(){return this.querySelector(t)}}function c(){return[]}function s(t){return null==t?c:function(){return this.querySelectorAll(t)}}function f(t){return function(){return this.matches(t)}}function h(t){return function(e){return e.matches(t)}}var y=Array.prototype.find;function p(){return this.firstElementChild}var v=Array.prototype.filter;function d(){return Array.from(this.children)}function b(t){return new Array(t.length)}function m(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function g(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 m(t,i[u]);for(;u<l;++u)(a=e[u])&&(o[u]=a)}function w(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 m(t,i[u]);for(u=0;u<f;++u)(l=e[u])&&s.get(y[u])===l&&(o[u]=l)}function x(t){return t.__data__}function S(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function O(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}m.prototype={constructor:m,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 _="http://www.w3.org/1999/xhtml";const j={svg:"http://www.w3.org/2000/svg",xhtml:_,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function P(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),j.hasOwnProperty(e)?{space:j[e],local:t}:t}function k(t){return function(){this.removeAttribute(t)}}function T(t){return function(){this.removeAttributeNS(t.space,t.local)}}function C(t,e){return function(){this.setAttribute(t,e)}}function E(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function A(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function M(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 z(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function R(t){return function(){this.style.removeProperty(t)}}function F(t,e,n){return function(){this.style.setProperty(t,e,n)}}function I(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function B(t,e){return t.style.getPropertyValue(e)||z(t).getComputedStyle(t,null).getPropertyValue(e)}function L(t){return function(){delete this[t]}}function N(t,e){return function(){this[t]=e}}function D(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function G(t){return t.trim().split(/^|\s+/)}function W(t){return t.classList||new U(t)}function U(t){this._node=t,this._names=G(t.getAttribute("class")||"")}function $(t,e){for(var n=W(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function H(t,e){for(var n=W(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function q(t){return function(){$(this,t)}}function Y(t){return function(){H(this,t)}}function V(t,e){return function(){(e.apply(this,arguments)?$:H)(this,t)}}function X(){this.textContent=""}function Z(t){return function(){this.textContent=t}}function J(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function K(){this.innerHTML=""}function Q(t){return function(){this.innerHTML=t}}function tt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function et(){this.nextSibling&&this.parentNode.appendChild(this)}function nt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===_&&e.documentElement.namespaceURI===_?e.createElement(t):e.createElementNS(n,t)}}function ot(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function it(t){var e=P(t);return(e.local?ot:rt)(e)}function at(){return null}function ut(){var t=this.parentNode;t&&t.removeChild(this)}function lt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ct(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function st(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 ft(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 ht(t,e,n){var r=z(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 yt(t,e){return function(){return ht(this,t,e)}}function pt(t,e){return function(){return ht(this,t,e.apply(this,arguments))}}U.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 vt=[null];function dt(t,e){this._groups=t,this._parents=e}function bt(){return new dt([[document.documentElement]],vt)}dt.prototype=bt.prototype={constructor:dt,select:function(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,u=e[o],c=u.length,s=r[o]=new Array(c),f=0;f<c;++f)(i=u[f])&&(a=t.call(i,i.__data__,f,u))&&("__data__"in i&&(a.__data__=i.__data__),s[f]=a);return new dt(r,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):s(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 dt(r,o)},selectChild:function(t){return this.select(null==t?p:function(t){return function(){return y.call(this.children,t)}}("function"==typeof t?t:h(t)))},selectChildren:function(t){return this.selectAll(null==t?d:function(t){return function(){return v.call(this.children,t)}}("function"==typeof t?t:h(t)))},filter:function(t){"function"!=typeof t&&(t=f(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 dt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,x);var n,r=e?w:g,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=S(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,O,_=0,j=0;_<v;++_)if(m=d[_]){for(_>=j&&(j=_+1);!(O=b[j])&&++j<v;);m._next=O||null}}return(u=new dt(u,o))._enter=l,u._exit=c,u},enter:function(){return new dt(this._enter||this._groups.map(b),this._parents)},exit:function(){return new dt(this._exit||this._groups.map(b),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 dt(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=O);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 dt(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=P(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?T:k:"function"==typeof e?n.local?M:A:n.local?E:C)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?R:"function"==typeof e?I:F)(t,e,null==n?"":n)):B(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?L:"function"==typeof e?D:N)(t,e)):this.node()[t]},classed:function(t,e){var n=G(t+"");if(arguments.length<2){for(var r=W(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?V:e?q:Y)(n,e))},text:function(t){return arguments.length?this.each(null==t?X:("function"==typeof t?J:Z)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?K:("function"==typeof t?tt:Q)(t)):this.node().innerHTML},raise:function(){return this.each(et)},lower:function(){return this.each(nt)},append:function(t){var e="function"==typeof t?t:it(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:it(t),r=null==e?at:"function"==typeof e?e:l(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(ut)},clone:function(t){return this.select(t?ct:lt)},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?ft:st,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?pt:yt)(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 mt=bt;function gt(t){return"string"==typeof t?new dt([[document.querySelector(t)]],[document.documentElement]):new dt([[t]],vt)}var wt={value:()=>{}};function xt(){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 St(r)}function St(t){this._=t}function Ot(t,e){for(var n,r=0,o=t.length;r<o;++r)if((n=t[r]).name===e)return n.value}function _t(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=wt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}St.prototype=xt.prototype={constructor:St,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]=_t(o[n],t.name,e);else if(null==e)for(n in o)o[n]=_t(o[n],t.name,null);return this}for(;++a<u;)if((n=(t=i[a]).type)&&(n=Ot(o[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new St(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 jt=xt,Pt={capture:!0,passive:!1};function kt(t){t.preventDefault(),t.stopImmediatePropagation()}function Tt(t){return((t=Math.exp(t))+1/t)/2}const Ct=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=Tt(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/Tt(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 Et(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]}var At,Mt,zt=0,Rt=0,Ft=0,It=0,Bt=0,Lt=0,Nt="object"==typeof performance&&performance.now?performance:Date,Dt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Gt(){return Bt||(Dt(Wt),Bt=Nt.now()+Lt)}function Wt(){Bt=0}function Ut(){this._call=this._time=this._next=null}function $t(t,e,n){var r=new Ut;return r.restart(t,e,n),r}function Ht(){Bt=(It=Nt.now())+Lt,zt=Rt=0;try{!function(){Gt(),++zt;for(var t,e=At;e;)(t=Bt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--zt}()}finally{zt=0,function(){for(var t,e,n=At,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:At=e);Mt=t,Yt(r)}(),Bt=0}}function qt(){var t=Nt.now(),e=t-It;e>1e3&&(Lt-=e,It=t)}function Yt(t){zt||(Rt&&(Rt=clearTimeout(Rt)),t-Bt>24?(t<1/0&&(Rt=setTimeout(Ht,t-Nt.now()-Lt)),Ft&&(Ft=clearInterval(Ft))):(Ft||(It=Nt.now(),Ft=setInterval(qt,1e3)),zt=1,Dt(Ht)))}function Vt(t,e,n){var r=new Ut;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}Ut.prototype=$t.prototype={constructor:Ut,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Gt():+n)+(null==e?0:+e),this._next||Mt===this||(Mt?Mt._next=this:At=this,Mt=this),this._call=t,this._time=n,Yt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yt())}};var Xt=jt("start","end","cancel","interrupt"),Zt=[];function Jt(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 Vt(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(Vt(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=$t(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:Xt,tween:Zt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Kt(t,e){var n=te(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Qt(t,e){var n=te(t,e);if(n.state>3)throw new Error("too late; already running");return n}function te(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ee(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 ne(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var re,oe=180/Math.PI,ie={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ae(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)*oe,skewX:Math.atan(l)*oe,scaleX:a,scaleY:u}}function ue(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:ne(t,o)},{i:l-2,x:ne(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:ne(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:ne(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:ne(t,n)},{i:u-2,x:ne(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 le=ue(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ie:ae(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),ce=ue(function(t){return null==t?ie:(re||(re=document.createElementNS("http://www.w3.org/2000/svg","g")),re.setAttribute("transform",t),(t=re.transform.baseVal.consolidate())?ae((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ie)},", ",")",")");function se(t,e){var n,r;return function(){var o=Qt(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 fe(t,e,n){var r,o;if("function"!=typeof n)throw new Error;return function(){var i=Qt(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 he(t,e,n){var r=t._id;return t.each(function(){var t=Qt(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return te(t,r).value[e]}}function ye(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function pe(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ve(){}var de=.7,be=1/de,me="\\s*([+-]?\\d+)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xe=/^#([0-9a-f]{3,8})$/,Se=new RegExp(`^rgb\\(${me},${me},${me}\\)$`),Oe=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),_e=new RegExp(`^rgba\\(${me},${me},${me},${ge}\\)$`),je=new RegExp(`^rgba\\(${we},${we},${we},${ge}\\)$`),Pe=new RegExp(`^hsl\\(${ge},${we},${we}\\)$`),ke=new RegExp(`^hsla\\(${ge},${we},${we},${ge}\\)$`),Te={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ce(){return this.rgb().formatHex()}function Ee(){return this.rgb().formatRgb()}function Ae(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=xe.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Me(e):3===n?new Ie(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ze(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ze(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Se.exec(t))?new Ie(e[1],e[2],e[3],1):(e=Oe.exec(t))?new Ie(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=_e.exec(t))?ze(e[1],e[2],e[3],e[4]):(e=je.exec(t))?ze(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Pe.exec(t))?We(e[1],e[2]/100,e[3]/100,1):(e=ke.exec(t))?We(e[1],e[2]/100,e[3]/100,e[4]):Te.hasOwnProperty(t)?Me(Te[t]):"transparent"===t?new Ie(NaN,NaN,NaN,0):null}function Me(t){return new Ie(t>>16&255,t>>8&255,255&t,1)}function ze(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ie(t,e,n,r)}function Re(t){return t instanceof ve||(t=Ae(t)),t?new Ie((t=t.rgb()).r,t.g,t.b,t.opacity):new Ie}function Fe(t,e,n,r){return 1===arguments.length?Re(t):new Ie(t,e,n,null==r?1:r)}function Ie(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Be(){return`#${Ge(this.r)}${Ge(this.g)}${Ge(this.b)}`}function Le(){const t=Ne(this.opacity);return`${1===t?"rgb(":"rgba("}${De(this.r)}, ${De(this.g)}, ${De(this.b)}${1===t?")":`, ${t})`}`}function Ne(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function De(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ge(t){return((t=De(t))<16?"0":"")+t.toString(16)}function We(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new $e(t,e,n,r)}function Ue(t){if(t instanceof $e)return new $e(t.h,t.s,t.l,t.opacity);if(t instanceof ve||(t=Ae(t)),!t)return new $e;if(t instanceof $e)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,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 $e(a,u,l,t.opacity)}function $e(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function He(t){return(t=(t||0)%360)<0?t+360:t}function qe(t){return Math.max(0,Math.min(1,t||0))}function Ye(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 Ve(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}ye(ve,Ae,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ce,formatHex:Ce,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Ue(this).formatHsl()},formatRgb:Ee,toString:Ee}),ye(Ie,Fe,pe(ve,{brighter(t){return t=null==t?be:Math.pow(be,t),new Ie(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?de:Math.pow(de,t),new Ie(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ie(De(this.r),De(this.g),De(this.b),Ne(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:Be,formatHex:Be,formatHex8:function(){return`#${Ge(this.r)}${Ge(this.g)}${Ge(this.b)}${Ge(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Le,toString:Le})),ye($e,function(t,e,n,r){return 1===arguments.length?Ue(t):new $e(t,e,n,null==r?1:r)},pe(ve,{brighter(t){return t=null==t?be:Math.pow(be,t),new $e(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?de:Math.pow(de,t),new $e(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new Ie(Ye(t>=240?t-240:t+120,o,r),Ye(t,o,r),Ye(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new $e(He(this.h),qe(this.s),qe(this.l),Ne(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=Ne(this.opacity);return`${1===t?"hsl(":"hsla("}${He(this.h)}, ${100*qe(this.s)}%, ${100*qe(this.l)}%${1===t?")":`, ${t})`}`}}));const Xe=t=>()=>t;function Ze(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Xe(isNaN(t)?e:t)}const Je=function t(e){var n=function(t){return 1===(t=+t)?Ze: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):Xe(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Fe(t)).r,(e=Fe(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=Ze(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 Ke(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=Fe(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+""}}}Ke(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 Ve((n-r/e)*e,a,o,i,u)}}),Ke(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 Ve((n-r/e)*e,o,i,a,u)}});var Qe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tn=new RegExp(Qe.source,"g");function en(t,e){var n,r,o,i=Qe.lastIndex=tn.lastIndex=0,a=-1,u=[],l=[];for(t+="",e+="";(n=Qe.exec(t))&&(r=tn.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:ne(n,r)})),i=tn.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 nn(t,e){var n;return("number"==typeof e?ne:e instanceof Ae?Je:(n=Ae(e))?(e=n,Je):en)(t,e)}function rn(t){return function(){this.removeAttribute(t)}}function on(t){return function(){this.removeAttributeNS(t.space,t.local)}}function an(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 un(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 ln(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 cn(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 sn(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 fn(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 hn(t,e){return function(){Kt(this,t).delay=+e.apply(this,arguments)}}function yn(t,e){return e=+e,function(){Kt(this,t).delay=e}}function pn(t,e){return function(){Qt(this,t).duration=+e.apply(this,arguments)}}function vn(t,e){return e=+e,function(){Qt(this,t).duration=e}}var dn=mt.prototype.constructor;function bn(t){return function(){this.style.removeProperty(t)}}var mn=0;function gn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function wn(){return++mn}var xn=mt.prototype;gn.prototype=function(t){return mt().transition(t)}.prototype={constructor:gn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=l(t));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,s=r[a],f=s.length,h=i[a]=new Array(f),y=0;y<f;++y)(u=s[y])&&(c=t.call(u,u.__data__,y,s))&&("__data__"in u&&(c.__data__=u.__data__),h[y]=c,Jt(h[y],e,n,y,h,te(u,n)));return new gn(i,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=s(t));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var l,c=r[u],f=c.length,h=0;h<f;++h)if(l=c[h]){for(var y,p=t.call(l,l.__data__,h,c),v=te(l,n),d=0,b=p.length;d<b;++d)(y=p[d])&&Jt(y,e,n,d,p,v);i.push(p),a.push(l)}return new gn(i,a,e,n)},selectChild:xn.selectChild,selectChildren:xn.selectChildren,filter:function(t){"function"!=typeof t&&(t=f(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 gn(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,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 gn(a,this._parents,this._name,this._id)},selection:function(){return new dn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=wn(),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=te(a,e);Jt(a,t,n,c,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new gn(r,this._parents,t,n)},call:xn.call,nodes:xn.nodes,node:xn.node,size:xn.size,empty:xn.empty,each:xn.each,on:function(t,e){var n=this._id;return arguments.length<2?te(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)?Kt:Qt;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=P(t),r="transform"===n?ce:nn;return this.attrTween(t,"function"==typeof e?(n.local?cn:ln)(n,r,he(this,"attr."+t,e)):null==e?(n.local?on:rn)(n):(n.local?un:an)(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=P(t);return this.tween(n,(r.local?sn:fn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?le:nn;return null==e?this.styleTween(t,function(t,e){var n,r,o;return function(){var i=B(this,t),a=(this.style.removeProperty(t),B(this,t));return i===a?null:i===n&&a===r?o:o=e(n=i,r=a)}}(t,r)).on("end.style."+t,bn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,o,i;return function(){var a=B(this,t),u=n(this),l=u+"";return null==u&&(this.style.removeProperty(t),l=u=B(this,t)),a===l?null:a===r&&l===o?i:(o=l,i=e(r=a,u))}}(t,r,he(this,"style."+t,e))).each(function(t,e){var n,r,o,i,a="style."+e,u="end."+a;return function(){var l=Qt(this,t),c=l.on,s=null==l.value[a]?i||(i=bn(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=B(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}}(he(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=te(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?se:fe)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?hn:yn)(e,t)):te(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?pn:vn)(e,t)):te(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(){Qt(this,t).ease=e}}(e,t)):te(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;Qt(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=Qt(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]:xn[Symbol.iterator]};var Sn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function On(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}mt.prototype.interrupt=function(t){return this.each(function(){ee(this,t)})},mt.prototype.transition=function(t){var e,n;t instanceof gn?(e=t._id,t=t._name):(e=wn(),(n=Sn).time=Gt(),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])&&Jt(a,t,e,c,u,n||On(a,e));return new gn(r,this._parents,t,e)};const _n=t=>()=>t;function jn(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 Pn(t,e,n){this.k=t,this.x=e,this.y=n}Pn.prototype={constructor:Pn,scale:function(t){return 1===t?this:new Pn(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Pn(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 kn=new Pn(1,0,0);function Tn(t){t.stopImmediatePropagation()}function Cn(t){t.preventDefault(),t.stopImmediatePropagation()}function En(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function An(){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 Mn(){return this.__zoom||kn}function zn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Rn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fn(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 In(t){return In="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},In(t)}function Bn(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 Ln(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,Nn(r.key),r)}}function Nn(t){var e=function(t){if("object"!=In(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=In(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==In(e)?e:e+""}Pn.prototype;var Dn=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=kn;(function(){var t,e,n,r=En,o=An,i=Fn,a=zn,u=Rn,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],s=250,f=Ct,h=jt("start","zoom","end"),y=0,p=10;function v(t){t.property("__zoom",Mn).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",_).filter(u).on("touchstart.zoom",j).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",k).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 Pn(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 Pn(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 Pn(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)))),s=Et(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)],ee(this),n.start()}Cn(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=gt(t.view).on("mousemove.zoom",function(t){if(Cn(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]=Et(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=gt(t).on("dragstart.drag",null);e&&(r.on("click.drag",kt,Pt),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),Cn(t),a.event(t).end()},!0),l=Et(t,o),s=t.clientX,f=t.clientY;!function(t){var e=t.document.documentElement,n=gt(t).on("dragstart.drag",kt,Pt);"onselectstart"in e?n.on("selectstart.drag",kt,Pt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),Tn(t),a.mouse=[l,this.__zoom.invert(l)],ee(this),a.start()}}function _(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=Et(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);Cn(t),s>0?gt(this).transition().duration(s).call(g,f,a,t):gt(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(Tn(n),a=0;a<s;++a)l=[l=Et(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)),ee(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(Cn(t),n=0;n<s;++n)o=Et(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 k(t,...r){if(this.__zooming){var o,i,a=w(this,r).event(t),u=t.changedTouches,l=u.length;for(Tn(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=Et(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<p)){var c=gt(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",Mn),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(kn.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=gt(this.that).datum();h.call(t,this.that,new jn(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:_n(+t),v):a},v.filter=function(t){return arguments.length?(r="function"==typeof t?t:_n(!!t),v):r},v.touchable=function(t){return arguments.length?(u="function"==typeof t?t:_n(!!t),v):u},v.extent=function(t){return arguments.length?(o="function"==typeof t?t:_n([[+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.canvasSave.view={x:n.view.x,y:n.view.y,z:n.view.z},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)})(gt(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 Bn(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)?Bn(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;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?this._drawSnapshot():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(){this.canvasSave.c&&this._drawSnapshot()}},{key:"_drawSnapshot",value:function(){var t=this.canvasSave.view,e=t?t.z/this.view.z:1,n=t?(t.x-.5*this.w*t.z-this.view.x)/this.view.z+.5*this.w:0,r=t?.5*this.h-(t.y+.5*this.h*t.z-this.view.y)/this.view.z:0;this.canvasSave.f=e,this.canvasSave.dx=n,this.canvasSave.dy=r,this.clear(this.backgroundColor),this.offscreenCtx.drawImage(this.canvasSave.c,n,r,e*this.canvasSave.c.width,e*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&&Ln(e.prototype,n),r&&Ln(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function Gn(t){return Gn="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},Gn(t)}function Wn(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,Un(r.key),r)}}function Un(t){var e=function(t){if("object"!=Gn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Gn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Gn(e)?e:e+""}var $n=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?gt(e.tooltipElement):gt(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.classed("gridviz-tooltip",!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&&Wn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Hn(t){return Hn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hn(t)}function qn(t,e){(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 Yn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vn(r.key),r)}}function Vn(t){var e=function(t){if("object"!=Hn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Hn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hn(e)?e:e+""}var Xn=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(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=gt("#"+e.id)),this.div&&!this.div.empty()||(this.div=gt(document.createElement("div")),e.id&&this.div.attr("id",e.id)),e.title&&this.div.attr("title",e.title),this.div.classed("gridviz-button",!0),e.class){var n,r=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 qn(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)?qn(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}}}}(String(e.class).split(/\s+/));try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&this.div.classed(o,!0)}}catch(t){r.e(t)}finally{r.f()}}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}}])&&Yn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Zn(t){return Zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zn(t)}function Jn(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,Kn(r.key),r)}}function Kn(t){var e=function(t){if("object"!=Zn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Zn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zn(e)?e:e+""}function Qn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qn=function(){return!!t})()}function tr(t){return tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tr(t)}function er(t,e){return er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},er(t,e)}var nr=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=tr(e),function(t,e){if(e&&("object"==Zn(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,Qn()?Reflect.construct(e,n||[],tr(t).constructor):e.apply(t,n))}(this,e,[t])).onZoom=t.onZoom,n.delta=t.delta||.2,n.div.classed("gridviz-zoom-buttons",!0),n.zoomInBtn=document.createElement("a"),n.zoomInBtn.id="zoom-in",n.zoomInBtn.className="gridviz-zoom-button gridviz-zoom-button--in",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 gridviz-zoom-button--out",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&&er(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&&Jn(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Xn);function rr(t){return rr="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},rr(t)}function or(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,lr(r.key),r)}}function ir(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ir=function(){return!!t})()}function ar(t){return ar=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ar(t)}function ur(t,e){return ur=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ur(t,e)}function lr(t){var e=function(t){if("object"!=rr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=rr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==rr(e)?e:e+""}var cr=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=ar(e),function(t,e){if(e&&("object"==rr(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,ir()?Reflect.construct(e,n||[],ar(t).constructor):e.apply(t,n))}(this,e,[t]),r=n,i=!1,(o=lr(o="isFullscreen"))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,n.div.classed("gridviz-fullscreen-button",!0),n.div.node().innerHTML='\n <svg\n class="gridviz-fullscreen-icon"\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&&ur(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()}}])&&or(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Xn);function sr(t){return sr="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},sr(t)}function fr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return hr(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,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 hr(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 yr(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,pr(r.key),r)}}function pr(t){var e=function(t){if("object"!=sr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=sr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sr(e)?e:e+""}var vr=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=!1!==n.asyncRedraw,this._redrawFrame=null,this.container=e||document.getElementById("gridviz"),this.container){this.container.classList.add("gridviz-map"),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 Dn(this._canvas,n.x,n.y,n.z,n),this.geoCanvas.redraw=function(){r.redraw()},this.geoCanvas.cancelCurrentRequests=function(){var t,e=fr(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=fr(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?gt(n.legendContainer):null,this._legendProvidedByUser=!!n.legendContainer,this.onLegendUpdate=n.onLegendUpdate,this.legend||this.initialiseLegend(),n.tooltip||(n.tooltip={}),n.tooltip.parentElement||(n.tooltip.parentElement=this.container),this.tooltip=new $n(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.classList.add("gridviz-canvas"),t.setAttribute("width",""+this.w),t.setAttribute("height",""+this.h),this.container.appendChild(t),t}},{key:"initialiseLegend",value:function(){this.legend=gt(this.container).append("div").attr("id","gridviz-legend").classed("gridviz-legends",!0).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(":scope > *:not([data-gridviz-hovered])").remove(),this.legend.node()._gridvizLegendCursor=null),this.geoCanvas.initCanvasTransform(),this.geoCanvas.clear(this.geoCanvas.backgroundColor);var t=this.geoCanvas.view.z;this.updateExtentGeo();var e,n=this.geoCanvas.offscreenCtx,r=fr(this.layers);try{for(r.s();!(e=r.n()).done;){var o=e.value;i(o,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.onLegendUpdate&&this.legend&&this.onLegendUpdate(this.legend.node()),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(i(r,e)&&"none"!==r.cellInfoHTML&&r.cellInfoHTML&&r.getDataset){var o=r.getDataset(e);if(o){var a=o.getCellFromPosition(t,o.getViewCache());if(!a){if(this.digForTooltip)continue;return}if(o.mixedResolution){var u=+o.mixedResolution(a),l=r.cellInfoHTML(a,u);if(!l)return;return{cell:a,html:l,resolution:u}}var c=r.cellInfoHTML(a,o.getResolution());if(!c)return;return{cell:a,html:c,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 nr({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 cr({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&&yr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function dr(t){return dr="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},dr(t)}function br(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return mr(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,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 mr(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 gr(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,wr(r.key),r)}}function wr(t){var e=function(t){if("object"!=dr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=dr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dr(e)?e:e+""}function xr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(xr=function(){return!!t})()}function Sr(t){return Sr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sr(t)}function Or(t,e){return Or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Or(t,e)}var _r=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=Sr(e),function(t,e){if(e&&("object"==dr(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,xr()?Reflect.construct(e,n||[],Sr(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.highlightColors=null,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&&Or(t,e)}(e,t),n=e,o=[{key:"normalizeColor",value:function(t){var n=e._normalizedColors.get(t);if(void 0===n){var r=Ae(t);n=r?r.formatRgb():String(t),e._normalizedColors.size>1e4&&e._normalizedColors.clear(),e._normalizedColors.set(t,n)}return n}},{key:"updateLegendsRecursive",value:function(t,e){if(Array.isArray(t)){var n,r=br(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:"setHighlight",value:function(t){return this.highlightColors=t&&t.length?t.map(e.normalizeColor):null,this}},{key:"isHighlighted",value:function(t){return!this.highlightColors||this.highlightColors.includes(e.normalizeColor(t))}},{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 this.highlightColors||e.updateLegendsRecursive(this.legends,t),this}},{key:"addLegends",value:function(t){var e,n=br(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}}])&&gr(n.prototype,r),o&&gr(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(a);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 Pr(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+""}function Tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Tr=function(){return!!t})()}function Cr(t){return Cr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cr(t)}function Er(t,e){return Er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Er(t,e)}_r._normalizedColors=new Map;var Ar=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=Cr(e),function(t,e){if(e&&("object"==jr(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,Tr()?Reflect.construct(e,n||[],Cr(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&&Er(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){throw new Error("Method draw not implemented.")}}])&&Pr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(a);function Mr(t){return Mr="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},Mr(t)}function zr(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)||Fr(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 Rr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Fr(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 Fr(t,e){if(t){if("string"==typeof t)return Ir(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)?Ir(t,e):void 0}}function Ir(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 Br(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,Lr(r.key),r)}}function Lr(t){var e=function(t){if("object"!=Mr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Mr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mr(e)?e:e+""}var Nr=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=Rr(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=zr(y[h],2),v=p[0],d=p[1];if(!(v&&l!==s||d&&c!==f)){var b=u.cells.get(Dr(s+v,f+d));if(b)return b}}else{var m,g=Rr(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=Rr(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=Dr(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}}],e&&Br(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Dr(t,e){return 4194304*t+e}function Gr(t){return Gr="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},Gr(t)}function Wr(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 Ur(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,$r(r.key),r)}}function $r(t){var e=function(t){if("object"!=Gr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Gr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Gr(e)?e:e+""}var Hr=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 Wr(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)?Wr(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}}])&&Ur(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function qr(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function Yr(t,e){return fetch(t,e).then(qr)}var Vr={},Xr={};function Zr(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function Jr(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 Kr(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Qr(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 Xr;if(c)return c=!1,Vr;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())!==Xr;){for(var f=[];r!==Vr&&r!==Xr;)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?"-"+Kr(-r,6):r>9999?"+"+Kr(r,6):Kr(r,4))+"-"+Kr(n.getUTCMonth()+1,2)+"-"+Kr(n.getUTCDate(),2)+(u?"T"+Kr(o,2)+":"+Kr(i,2)+":"+Kr(a,2)+"."+Kr(u,3)+"Z":a?"T"+Kr(o,2)+":"+Kr(i,2)+":"+Kr(a,2)+"Z":i||o?"T"+Kr(o,2)+":"+Kr(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=Zr(t);return function(r,o){return e(n(r),o,t)}}(t,e):Zr(t)});return i.columns=o||[],i},parseRows:r,format:function(e,n){return null==n&&(n=Jr(e)),[n.map(a).join(t)].concat(o(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Jr(t)),o(t,e).join("\n")},formatRows:function(t){return t.map(i).join("\n")},formatRow:i,formatValue:a}}var to=Qr(","),eo=to.parse,no=(to.parseRows,to.format,to.formatBody,to.formatRows,to.formatRow,to.formatValue,Qr("\t")),ro=no.parse;function oo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function io(t,e){return fetch(t,e).then(oo)}function ao(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),io(e,n).then(function(e){return t(e,r)})}}function uo(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var o=Qr(t);return io(e,n).then(function(t){return o.parse(t,r)})}no.parseRows,no.format,no.formatBody,no.formatRows,no.formatRow,no.formatValue;var lo=ao(eo);function co(t){return co="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},co(t)}function so(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(co(t)+" is not iterable")}function fo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=ho(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 ho(t,e){if(t){if("string"==typeof t)return yo(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)?yo(t,e):void 0}}function yo(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 po(){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 vo(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[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 f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(vo(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,vo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,vo(f,"constructor",c),vo(c,"constructor",l),l.displayName="GeneratorFunction",vo(c,o,"GeneratorFunction"),vo(f),vo(f,o,"Generator"),vo(f,r,function(){return this}),vo(f,"toString",function(){return"[object Generator]"}),(po=function(){return{w:i,m:h}})()}function vo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}vo=function(t,e,n,r){function i(e,n){vo(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))},vo(t,e,n,r)}function bo(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 mo(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){bo(i,r,o,a,u,"next",t)}function u(t){bo(i,r,o,a,u,"throw",t)}a(void 0)})}}function go(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,wo(r.key),r)}}function wo(t){var e=function(t){if("object"!=co(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=co(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==co(e)?e:e+""}function xo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(xo=function(){return!!t})()}function So(t){return So=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},So(t)}function Oo(t,e){return Oo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Oo(t,e)}ao(ro);var _o=new Set,jo=0,Po=function(){return"undefined"!=typeof performance?performance.now():Date.now()},ko=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=So(e),function(t,e){if(e&&("object"==co(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,xo()?Reflect.construct(e,n||[],So(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&&Oo(t,e)}(e,t),n=e,r=[{key:"loadInfo",value:function(){var t=this;return this.info||"notLoaded"!==this.infoLoadingStatus||(this.infoLoadingStatus="loading",mo(po().m(function e(){var n;return po().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Yr(t.url+"info.json");case 1:n=e.v,t.info=n,t.resolution=n.resolutionGeo,t.infoLoadingStatus="loaded",t.isShown()&&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:"isShown",value:function(){if(!this.map||!this.map.layers)return!1;var t,e=this.map.getZoom(),n=fo(this.map.layers);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(i(r,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:(a=mo(po().m(function t(n){var r,o,i,a,u,l,c,s,f,h,y,p,v,d,b=this;return po().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,r=this.abortController.signal,o=this.getTilingEnvelope(n)){t.n=2;break}return t.a(2,this);case 2:i=this.info.tilingBounds,a=i.xMin,u=i.xMax,l=i.yMin,c=i.yMax,s=Math.max(o.xMin,a),f=Math.min(o.xMax,u),h=Math.max(o.yMin,l),y=Math.min(o.yMax,c),p=[],v=po().m(function t(n){var o,i;return po().w(function(t){for(;;)switch(t.n){case 0:o=po().m(function t(o){var i,a;return po().w(function(t){for(;;)switch(t.n){case 0:if(b.cache[n]||(b.cache[n]={}),i=b.cache[n][o],a=i&&i.failed&&!i.missing&&Po()-i.failed>=e.retryFailedAfterMs,!i||a){t.n=1;break}return i.cells&&(i.lastUsed=Po()),t.a(2,1);case 1:b.cache[n][o]="loading",p.push(b.loadTile(n,o,r).then(function(t){b.cache[n][o]=t,b._keep(t);var e=!b._anyLoading(s,f,h,y);b.checkAndRedraw(t,e)},function(t){t&&"AbortError"===t.name?delete b.cache[n][o]:(b.cache[n][o]={failed:Po(),missing:/^(404|410)\b/.test(t&&t.message)},b.onlyDrawWhenAllTilesReady&&!b._anyLoading(s,f,h,y)&&b.isShown()&&b.map.redraw())}));case 2:return t.a(2)}},t)}),i=h;case 1:if(!(i<=y)){t.n=4;break}return t.d(so(o(i)),2);case 2:if(!t.v){t.n=3;break}return t.a(3,3);case 3:i++,t.n=1;break;case 4:return t.a(2)}},t)}),d=s;case 3:if(!(d<=f)){t.n=5;break}return t.d(so(v(d)),4);case 4:d++,t.n=3;break;case 5:return t.n=6,Promise.allSettled(p);case 6:return t.a(2,this)}},t,this)})),function(t){return a.apply(this,arguments)})},{key:"_anyLoading",value:function(t,e,n,r){for(var o=t;o<=e;o++){var i=this.cache[o];if(i)for(var a=n;a<=r;a++)if("loading"===i[a])return!0}return!1}},{key:"loadTile",value:(o=mo(po().m(function t(e,n,r){var o,i,a,u=this;return po().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,lo("".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,To(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){if(this.isShown())if(this.onlyDrawWhenAllTilesReady)e&&this.map.redraw();else{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.map.redraw()}}},{key:"_keep",value:function(t){if(t&&"object"===co(t)&&t.cells&&(t.lastUsed=Po(),t.owner=this,_o.add(t),!((jo+=t.cells.length)<=e.maxCachedCells))){var n,r=Po()-3e3,o=function(t){return function(t){if(Array.isArray(t))return yo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ho(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(_o).filter(function(t){return t.lastUsed<r}).sort(function(t,e){return t.lastUsed-e.lastUsed}),i=fo(o);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(jo<=e.maxCachedCells)break;a.owner._drop(a)}}catch(t){i.e(t)}finally{i.f()}}}},{key:"_drop",value:function(t){var e=this.cache[t.x];e&&e[t.y]===t&&(delete e[t.y],Object.keys(e).length||delete this.cache[t.x]),_o.delete(t)&&(jo-=t.cells.length),t.owner=void 0,t.cells=[]}},{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&&i.cells){i.lastUsed=Po();var a,u=fo(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&&go(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,a}(Nr);function To(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=fo(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 Co(t){return Co="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},Co(t)}function Eo(){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 Ao(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[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 f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Ao(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Ao(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,Ao(f,"constructor",c),Ao(c,"constructor",l),l.displayName="GeneratorFunction",Ao(c,o,"GeneratorFunction"),Ao(f),Ao(f,o,"Generator"),Ao(f,r,function(){return this}),Ao(f,"toString",function(){return"[object Generator]"}),(Eo=function(){return{w:i,m:h}})()}function Ao(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Ao=function(t,e,n,r){function i(e,n){Ao(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))},Ao(t,e,n,r)}function Mo(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 zo(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)?zo(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 zo(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 Ro(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 Fo(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,Io(r.key),r)}}function Io(t){var e=function(t){if("object"!=Co(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Co(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Co(e)?e:e+""}function Bo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bo=function(){return!!t})()}function Lo(t){return Lo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Lo(t)}function No(t,e){return No=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},No(t,e)}ko.maxCachedCells=15e5,ko.retryFailedAfterMs=3e4;var Do=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=Lo(e),function(t,e){if(e&&("object"==Co(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,Bo()?Reflect.construct(e,n||[],Lo(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&&No(t,e)}(e,t),n=e,r=[{key:"getData",value:function(t){var e,n=this;return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",(e=Eo().m(function t(){var e,r,o,i,a,u,l,c;return Eo().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,uo(n.delimiter,n.url);case 1:e=t.v,r=Mo(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=Mo(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){Ro(i,r,o,a,u,"next",t)}function u(t){Ro(i,r,o,a,u,"throw",t)}a(void 0)})})()),this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=Mo(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&&Fo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Nr);function Go(t){return Go="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},Go(t)}function Wo(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 Uo(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,$o(r.key),r)}}function $o(t){var e=function(t){if("object"!=Go(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Go(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Go(e)?e:e+""}function Ho(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ho=function(){return!!t})()}function qo(t){return qo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qo(t)}function Yo(t,e){return Yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Yo(t,e)}var Vo=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=qo(e),function(t,e){if(e&&("object"==Go(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,Ho()?Reflect.construct(e,n||[],qo(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&&Yo(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 Wo(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)?Wo(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()}}}}])&&Uo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Nr);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 Zo(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 Jo(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"!=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+""}function Qo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qo=function(){return!!t})()}function ti(t){return ti=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ti(t)}function ei(t,e){return ei=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ei(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=ti(e),function(t,e){if(e&&("object"==Xo(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,Qo()?Reflect.construct(e,n||[],ti(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&&ei(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=this.highlightColors,l="function"==typeof this.color,c="function"==typeof this.size,s="function"==typeof this.shape,f=this.color||"black",h=this.size||n,y=this.shape||"square",p=l?this.color:null,v=c?this.size:null,d=s?this.shape:null,b=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 Zo(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)?Zo(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(b.s();!(r=b.n()).done;){var m=r.value,g=p?p(m,n,o,i):f;if(g&&"none"!==g&&(!u||this.isHighlighted(g))){var w=v?v(m,n,o,i):h;if(w){var x=d?d(m,n,o,i):y;if("none"!==x){var S=this.offset(m,n,o),O=e.offscreenCtx;if(O.fillStyle=g,"square"===x){var _=n*(1-w/n)*.5;O.fillRect(m.x+_+S.dx,m.y+_+S.dy,w,w)}else if("circle"===x)O.beginPath(),O.arc(m.x+a+S.dx,m.y+a+S.dy,.5*w,0,2*Math.PI,!1),O.fill();else if("donut"===x){var j=m.x+a+S.dx,P=m.y+a+S.dy;O.beginPath(),O.moveTo(j,P),O.arc(j,P,a,0,2*Math.PI),O.arc(j,P,(1-w/n)*a,0,2*Math.PI,!0),O.closePath(),O.fill()}else if("diamond"===x){var k=.5*w;O.beginPath(),O.moveTo(m.x+a-k,m.y+a),O.lineTo(m.x+a,m.y+a+k),O.lineTo(m.x+a+k,m.y+a),O.lineTo(m.x+a,m.y+a-k),O.fill()}else if("triangle_up"===x){var T=(w-n)/2;O.beginPath(),O.moveTo(m.x-T,m.y-T),O.lineTo(m.x+a,m.y+n+T),O.lineTo(m.x+n+T,m.y-T),O.fill()}else if("triangle_down"===x){var C=(w-n)/2;O.beginPath(),O.moveTo(m.x-C,m.y+n+C),O.lineTo(m.x+a,m.y-C),O.lineTo(m.x+n+C,m.y+n+C),O.fill()}else if("triangle_left"===x){var E=(w-n)/2;O.beginPath(),O.moveTo(m.x+n+E,m.y+n+E),O.lineTo(m.x-E,m.y+a),O.lineTo(m.x+n+E,m.y-E),O.fill()}else{if("triangle_right"!==x)throw new Error("Unexpected shape:"+x);var A=(w-n)/2;O.beginPath(),O.moveTo(m.x-A,m.y-A),O.lineTo(m.x+n+A,m.y+a),O.lineTo(m.x-A,m.y+n+A),O.fill()}}}}}}catch(t){b.e(t)}finally{b.f()}this.updateLegends({viewScale:i,resolution:n,z:o,cells:t})}}],r&&Jo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function ri(t){return ri="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},ri(t)}function oi(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 ii(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,ai(r.key),r)}}function ai(t){var e=function(t){if("object"!=ri(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ri(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ri(e)?e:e+""}function ui(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ui=function(){return!!t})()}function li(t){return li=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},li(t)}function ci(t,e){return ci=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ci(t,e)}var si=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=li(e),function(t,e){if(e&&("object"==ri(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||[],li(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&&ci(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 oi(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)?oi(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&&ii(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function fi(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 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)||pi(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 yi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=pi(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){if(t){if("string"==typeof t)return vi(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)?vi(t,e):void 0}}function vi(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 di(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=yi(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 bi(t,e,n){var r=fi(t,function(t){return t.x}),o=hi(r,2),i=o[0],a=o[1],u=fi(t,function(t){return t.y}),l=hi(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=yi(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 mi(t){return mi="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},mi(t)}function gi(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,wi(r.key),r)}}function wi(t){var e=function(t){if("object"!=mi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=mi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mi(e)?e:e+""}function xi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(xi=function(){return!!t})()}function Si(t){return Si=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Si(t)}function Oi(t,e){return Oi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Oi(t,e)}var _i=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"==mi(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||[],Si(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&&Oi(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=yi(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&&gi(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function ji(t){return ji="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},ji(t)}function Pi(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)||ki(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 ki(t,e){if(t){if("string"==typeof t)return Ti(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)?Ti(t,e):void 0}}function Ti(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 Ci(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"!=ji(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ji(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ji(e)?e:e+""}function Ai(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ai=function(){return!!t})()}function Mi(t){return Mi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mi(t)}function zi(t,e){return zi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zi(t,e)}var Ri=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=Mi(e),function(t,e){if(e&&("object"==ji(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,Ai()?Reflect.construct(e,n||[],Mi(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&&zi(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=ki(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 S=0,O=Object.entries(this.color);S<O.length;S++){var _=Pi(O[S],2),j=_[0],P=_[1];if("agepyramid"===h){i.fillStyle=P;var k=s*c[j]/d;i.fillRect(y+(n-k)/2,p+w,k,x),w+=x}else if("radar"===h){i.fillStyle=P;var T=c[j],C=s/2*Math.sqrt(T/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=P;var E=c[j],A=.333*s*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 F=+c[R[z]];F&&(M+=F)}if(!M||isNaN(M))continue;for(var I=0,B=n*(1-s/n)*.5,L=this.stripesOrientation(c,n,o,a),N=0,D=Object.entries(this.color);N<D.length;N++){var G=Pi(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+f.dx,c.y+B+I*s+f.dy,s,$*s):i.fillRect(c.x+B+I*s+f.dx,c.y+B+f.dy,$*s,s);else if("piechart"===h){var H=2*I*Math.PI,q=2*(I+$)*Math.PI;i.beginPath(),i.moveTo(y,p),i.arc(y,p,.5*s,H+v,q+v),this.pieChartInternalRadiusFactor&&i.arc(y,p,.5*s*this.pieChartInternalRadiusFactor,H+v,q+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 Y=s*s/n;0==L?i.fillRect(c.x+f.dx,c.y+(n-Y)/2+I*Y+f.dy,n,$*Y):i.fillRect(c.x+I*n+f.dx,c.y+(n-Y)/2+f.dy,$*n,Y)}I+=$}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a})}}],r&&Ci(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function Fi(t){return Fi="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},Fi(t)}function Ii(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 Bi(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"!=Fi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fi(e)?e:e+""}function Ni(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ni=function(){return!!t})()}function Di(t){return Di=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Di(t)}function Gi(t,e){return Gi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gi(t,e)}var Wi=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=Di(e),function(t,e){if(e&&("object"==Fi(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,Ni()?Reflect.construct(e,n||[],Di(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&&Gi(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 Ii(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)?Ii(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&&Bi(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function Ui(t){return Ui="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},Ui(t)}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 Hi(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"!=Ui(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ui(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ui(e)?e:e+""}function Yi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Yi=function(){return!!t})()}function Vi(t){return Vi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vi(t)}function Xi(t,e){return Xi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xi(t,e)}var Zi=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=Vi(e),function(t,e){if(e&&("object"==Ui(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,Yi()?Reflect.construct(e,n||[],Vi(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&&Xi(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 $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}}}}(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&&Hi(n.prototype,r),o&&Hi(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(_r);function Ji(t){return Ji="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},Ji(t)}function Ki(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 Qi(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)?Qi(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 Qi(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 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,ea(r.key),r)}}function ea(t){var e=function(t){if("object"!=Ji(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ji(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ji(e)?e:e+""}function na(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(na=function(){return!!t})()}function ra(t){return ra=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ra(t)}function oa(t,e){return oa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oa(t,e)}var ia=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=ra(e),function(t,e){if(e&&("object"==Ji(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,na()?Reflect.construct(e,n||[],ra(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&&oa(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=Ki(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=Ki(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 _=w.x+n/2,j=w.y+n/2,P=_-a,k=j-u,T=Math.atan2(k,P),C=Math.sqrt(P*P+k*k)*O/(l-O);c?(o.strokeStyle=x,o.lineWidth=S,o.beginPath(),o.moveTo(_,j),o.lineTo(_+C*Math.cos(T),j+C*Math.sin(T)),o.stroke()):(o.strokeStyle=this.outlineCol,o.lineWidth=S+2*this.outlineWidthPix*r,o.beginPath(),o.moveTo(_,j),o.lineTo(_+C*Math.cos(T),j+C*Math.sin(T)),o.stroke(),o.strokeStyle=x,o.lineWidth=S,o.beginPath(),o.moveTo(_,j),o.lineTo(_+C*Math.cos(T),j+C*Math.sin(T)),o.stroke(),o.strokeStyle=this.outlineCol,o.lineWidth=this.outlineWidthPix*r,o.beginPath(),o.arc(_+C*Math.cos(T),j+C*Math.sin(T),.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&&ta(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function aa(t){return aa="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},aa(t)}function ua(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,ca(r.key),r)}}function ca(t){var e=function(t){if("object"!=aa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=aa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==aa(e)?e:e+""}function sa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(sa=function(){return!!t})()}function fa(t){return fa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fa(t)}function ha(t,e){return ha=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ha(t,e)}var ya=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=fa(e),function(t,e){if(e&&("object"==aa(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,sa()?Reflect.construct(e,n||[],fa(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&&ha(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 ua(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)?ua(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&&la(n.prototype,r),o&&la(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(_r),pa=new Map;function va(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=JSON.stringify(n||{}),o=pa.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,pa.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 da=new WeakMap;function ba(t){var e=da.get(t);return e||(e={programs:new Map,buffers:new Map,owners:new Map},da.set(t,e)),e}function ma(t,e,n){var r=ba(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,xa(t,t.VERTEX_SHADER,e),xa(t,t.FRAGMENT_SHADER,n)),r.set(o,i)),i}function ga(t,e){var n=ba(t).buffers,r=n.get(e);return r||(r=t.createBuffer(),n.set(e,r)),r}function wa(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=ba(t).owners;return void 0!==n&&r.set(e,n),r.get(e)}function xa(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 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){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,_a(r.key),r)}}function _a(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 ja(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ja=function(){return!!t})()}function Pa(t){return Pa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pa(t)}function ka(t,e){return ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ka(t,e)}var Ta="SquareColorCategoryWebGLStyle.pos",Ca="SquareColorCategoryWebGLStyle.i",Ea=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=Pa(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,ja()?Reflect.construct(e,n||[],Pa(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.highlightKey="",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&&ka(t,e)}(e,t),n=e,r=[{key:"init",value:function(t,e){this.cvWGL=va(t,e);var n=this.cvWGL.gl,r=this.gl!==n;return r&&(this.gl=n,this.program=ma(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=Ae(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,a=this.cvWGL.gl,u=e/2,l=t.length,c=new Float32Array(2*l),s=new Float32Array(l),f=this.highlightColors?this.colors.map(function(t){return i.isHighlighted(t)}):null,h=0,y=0;y<l;y++){o=t[y];var p=this.code(o,e,n,r);if(null!=p){var v=this.catToI[p];isNaN(+v)?console.log("Unexpected category index: "+p+" "+v):f&&!f[+v]||(c[2*h]=o.x+u,c[2*h+1]=o.y+u,s[h]=+v,h++)}}return a.bindBuffer(a.ARRAY_BUFFER,ga(a,Ta)),a.bufferData(a.ARRAY_BUFFER,c.subarray(0,2*h),a.DYNAMIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,ga(a,Ca)),a.bufferData(a.ARRAY_BUFFER,s.subarray(0,h),a.DYNAMIC_DRAW),wa(a,Ta,this),h}},{key:"bindAttributes",value:function(){var t=this.cvWGL.gl,e=t.getAttribLocation(this.program,"pos");t.bindBuffer(t.ARRAY_BUFFER,ga(t,Ta)),t.vertexAttribPointer(e,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(e);var n=t.getAttribLocation(this.program,"i");t.bindBuffer(t.ARRAY_BUFFER,ga(t,Ca)),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);var c=this.highlightColors?this.highlightColors.join("|"):"",s=c!==this.highlightKey;this.highlightKey=c,(this.mapContentChanged(e.view,t.length)||s||i||wa(a,Ta)!==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&&Oa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function Aa(t){return Aa="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},Aa(t)}function Ma(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"!=Aa(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Aa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Aa(e)?e:e+""}function Ra(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ra=function(){return!!t})()}function Fa(t){return Fa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fa(t)}function Ia(t,e){return Ia=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ia(t,e)}var Ba=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=Fa(e),function(t,e){if(e&&("object"==Aa(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,Ra()?Reflect.construct(e,n||[],Fa(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&&Ia(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=bi(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 Ea({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&&Ma(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function La(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 Na(t){return Na="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},Na(t)}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(){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=Ga(e),function(t,e){if(e&&("object"==Na(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,[n]);var r=n.elevation;t.viewScale=function(t){return La(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&&Wa(t,e)}(e,t),n=e,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(ya);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 qa(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,Ya(r.key),r)}}function Ya(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 Va(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Va=function(){return!!t})()}function Xa(t){return Xa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xa(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=Xa(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,Va()?Reflect.construct(e,n||[],Xa(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&&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=ya.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 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}}}}(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&&qa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ya);const Ka=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 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 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+""}var nu=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=ma(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=Ae(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,ga(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,ga(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)}}])&&tu(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ru(t){return ru="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},ru(t)}function ou(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 iu(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)?iu(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 iu(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 au(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,uu(r.key),r)}}function uu(t){var e=function(t){if("object"!=ru(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ru(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ru(e)?e:e+""}function lu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(lu=function(){return!!t})()}function cu(t){return cu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cu(t)}function su(t,e){return su=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},su(t,e)}var fu=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=cu(e),function(t,e){if(e&&("object"==ru(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,lu()?Reflect.construct(e,n||[],cu(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&&su(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=Ka(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=va(e.w,e.h);if(!c)return void console.error("No webGL");var s,f=new nu(c.gl,i/r),h=n/2,y=ou(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=Ae(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,O=ou(t);try{for(O.s();!(S=O.n()).done;){var _=S.value,j=this.color(_,n,r,o);if(j&&"none"!==j){l.fillStyle=j;for(var P=this.dotNumber(_,n,r,o),k=this.offset(_,n,r),T=_.x+k.dx+n/2,C=_.y+k.dy+n/2,E=0;E<=P;E++)l.fillRect(T+u(),C+u(),i,i)}}}catch(t){O.e(t)}finally{O.f()}}this.updateLegends({style:this,resolution:n,z:r,viewScale:o})}}],r&&au(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function hu(t){return hu="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},hu(t)}function yu(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 pu(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,vu(r.key),r)}}function vu(t){var e=function(t){if("object"!=hu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hu(e)?e:e+""}function du(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(du=function(){return!!t})()}function bu(t){return bu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bu(t)}function mu(t,e){return mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mu(t,e)}var gu=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=bu(e),function(t,e){if(e&&("object"==hu(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,du()?Reflect.construct(e,n||[],bu(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&&mu(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=ya.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 yu(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)?yu(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 S=.5*x;i.lineWidth=w,i.strokeStyle=b;var O=v.x,_=v.y;i.beginPath(),"v"===v.or?(i.moveTo(O,_-S),i.lineTo(O,_+S)):(i.moveTo(O-S,_),i.lineTo(O+S,_)),i.stroke()}}}}catch(t){p.e(t)}finally{p.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:c})}}}],r&&pu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function wu(t){return null===t?NaN:+t}function xu(t,e,n=wu){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 Su(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ou(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _u(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=Su,n=(e,n)=>Su(t(e),n),r=(e,n)=>t(e)-n):(e=t===Su||t===Ou?t:ju,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 ju(){return 0}const Pu=_u(Su),ku=Pu.right,Tu=(Pu.left,_u(wu).center,ku);function Cu(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Eu(){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]=xu(e,t/o);return i}function i(e){return null==e||isNaN(e=+e)?t:n[Tu(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(Su),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 Eu().domain(e).range(n).unknown(t)},Cu.apply(i,arguments)}var Au=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,La(t,e)],h=a||[r*s,c*o],y=f[1]-f[0],p=f[0],v=h[1]-h[0],d=h[0],b=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};return b.invert=function(t){return i&&(t=function(t,e){if(t.invert)return t.invert(e);for(var n=0,r=1,o=0;o<50;o++){var i=(n+r)/2;t(i)<e?n=i:r=i}return(n+r)/2}(i,t)),p+t*y},b}},Mu=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.minSizePix||1,o=t.maxSizeFactor||1,i=Eu();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}},zu=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=fi(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}}}},Ru=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.colors;t.colorScale&&(r=Du(t.colorScale,n)),r=r||Array.from({length:n},function(t,e){return"rgb("+Math.floor(255*e/(n-1))+",150,150)"});var o=Eu().range(r);return function(t){return o.domain(t.map(e)),o.breaks=o.quantiles(),o.colors=r,o}},Fu=function(t){var e=t.valueFunction,n=t.classNumber||12,r=Eu().range(Array.from({length:n},function(t,e){return e}));return function(t){return r.domain(t.map(e)),r.breaks=r.quantiles(),r}},Iu=function(t){return function(e,n,r){var o={};for(var i in t)o[i]=t[i](e,n,r);return o}};function Bu(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 Lu(t,e,n){for(var r=[],o=(e-t)/n,i=1;i<n;i++)r.push(t+i*o);return Bu(r)}function Nu(t,e){var n=Bu(t),r=function(t){return e[n(t)]};return r.breaks=t,r.colors=e,r}function Du(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 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(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}}}}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 $u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($u=function(){return!!t})()}function Hu(t){return Hu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hu(t)}function qu(t,e){return qu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qu(t,e)}function Yu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Vu(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,Zu(r.key),r)}}function Xu(t,e,n){return e&&Vu(t.prototype,e),n&&Vu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Zu(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+""}var Ju=function(){return Xu(function t(){Yu(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=Bu(e),i=function(e){return o(t(e))},a={},u=0;u<n.length;u++)a[u+""]=n[u];var l=new Ea({code:i,color:a}),c=new gu({classifier:function(){return i},colorDark:r.colorDark,colorBright:r.colorBright,diamond:r.diamond});return[l,new si({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n},filter:r.filter}),c,new Ku({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 Ea({code:t,color:e}),new si({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n}}),new Ku({colDark:n.colDark,colBright:n.colBright})]}}])}(),Ku=function(t){function e(t){var n,r,o,i;return Yu(this,e),r=this,i=[t],o=Hu(o=e),n=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)}(r,$u()?Reflect.construct(o,i||[],Hu(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&&qu(t,e)}(e,t),Xu(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=Wu(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=Wu(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()}}}])}(_r);function Qu(t){return Qu="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},Qu(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,el(r.key),r)}}function el(t){var e=function(t){if("object"!=Qu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Qu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qu(e)?e:e+""}var nl=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=ma(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=Ae(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,ga(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,ga(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&&tl(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();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){(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 il(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,al(r.key),r)}}function al(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 ul(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ul=function(){return!!t})()}function ll(t){return ll=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ll(t)}function cl(t,e){return cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cl(t,e)}var sl=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=ll(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,ul()?Reflect.construct(e,n||[],ll(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&&cl(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=va(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 ol(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)?ol(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 nl(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&&il(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);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 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 yl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pl(r.key),r)}}function pl(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 vl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vl=function(){return!!t})()}function dl(t){return dl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dl(t)}function bl(t,e){return bl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bl(t,e)}var ml=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=dl(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,vl()?Reflect.construct(e,n||[],dl(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&&bl(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 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}}}}(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&&yl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);function gl(t){return gl="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},gl(t)}function wl(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(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,Sl(r.key),r)}}function Sl(t){var e=function(t){if("object"!=gl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=gl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gl(e)?e:e+""}function Ol(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ol=function(){return!!t})()}function _l(t){return _l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_l(t)}function jl(t,e){return jl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jl(t,e)}var Pl=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=_l(e),function(t,e){if(e&&("object"==gl(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,Ol()?Reflect.construct(e,n||[],_l(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&&jl(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 wl(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)?wl(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&&xl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);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){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 Cl(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)?Cl(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 Cl(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 El(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,Al(r.key),r)}}function Al(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 Ml(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ml=function(){return!!t})()}function zl(t){return zl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zl(t)}function Rl(t,e){return Rl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rl(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=zl(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,Ml()?Reflect.construct(e,n||[],zl(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&&Rl(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=Tl(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=Tl(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=Tl(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,_=void 0;if("first"===S)O=v[this.ts[0]],_=0;else if("last"===S)O=v[this.ts[this.ts.length-1]],_=0;else if("bottom"===S){var j,P=Tl(this.ts);try{for(P.s();!(j=P.n()).done;){var k=+v[j.value];null!=k&&(null==O||k<O)&&(O=k)}}catch(t){P.e(t)}finally{P.f()}_=0}else if("top"===S){var T,C=Tl(this.ts);try{for(C.s();!(T=C.n()).done;){var E=+v[T.value];null!=E&&(null==O||E>O)&&(O=E)}}catch(t){C.e(t)}finally{C.f()}_=n}else{if("center"!==S){console.log("Unexpected anchorModeY: "+S);continue}var A,M=void 0,z=void 0,R=Tl(this.ts);try{for(R.s();!(A=R.n()).done;){var F=v[A.value];null!=F&&((null==M||F<M)&&(M=F),(null==z||F>z)&&(z=F))}}catch(t){R.e(t)}finally{R.f()}O=.5*(+z+ +M),_=n/2}var I=g/(h-1),B=v[this.ts[0]];this.noData(B)||(u.beginPath(),u.moveTo(v.x+m,v.y+_+(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*I+m,v.y+_+(L-O)*x/o+w)):(u.lineTo(v.x+N*I+m,v.y+_+(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&&El(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r);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 Bl(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)||Nl(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 Ll(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Nl(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 Nl(t,e){if(t){if("string"==typeof t)return Dl(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)?Dl(t,e):void 0}}function Dl(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 Gl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Wl(r.key),r)}}function Wl(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 Ul(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ul=function(){return!!t})()}function $l(t){return $l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$l(t)}function Hl(t,e){return Hl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Hl(t,e)}var ql=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=$l(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,Ul()?Reflect.construct(e,n||[],$l(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&&Hl(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=ya.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=Ll(h);try{for(w.s();!(g=w.n()).done;){var x=g.value,S=x.c1,O=x.c2,_=x.x,j=x.y,P=S?this.height(S,n,o,a):0,k=O?this.height(O,n,o,a):0,T=Yl(S,u),C=Yl(O,u);if(0!=T||0!=C)for(var E=0,A=0,M=0,z=Object.entries(this.color);M<z.length;M++){var R=Bl(z[M],2),F=R[0],I=R[1],B=S?+S[F]:0,L=O?+O[F]:0;if(0!=B||0!=L){var N=P*E/T||0,D=P*(E+B)/T||0,G=k*A/C||0,W=k*(A+L)/C||0;i.beginPath(),"h"==x.or?(i.moveTo(_+N*p+s,j-l+N*v+f),i.lineTo(_+G*p+s,j+l+G*v+f),i.lineTo(_+W*p+s,j+l+W*v+f),i.lineTo(_+D*p+s,j-l+D*v+f)):(i.moveTo(_-l+N*p+s,j+N*v+f),i.lineTo(_+l+G*p+s,j+G*v+f),i.lineTo(_+l+W*p+s,j+W*v+f),i.lineTo(_-l+D*p+s,j+D*v+f)),i.fillStyle=I,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&&Gl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r),Yl=function(t,e){if(!t)return 0;var n,r=0,o=Ll(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 Vl(t){return Vl="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},Vl(t)}function Xl(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(Vl(t)+" is not iterable")}function Zl(){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 Jl(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[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 f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Jl(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Jl(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,Jl(f,"constructor",c),Jl(c,"constructor",l),l.displayName="GeneratorFunction",Jl(c,o,"GeneratorFunction"),Jl(f),Jl(f,o,"Generator"),Jl(f,r,function(){return this}),Jl(f,"toString",function(){return"[object Generator]"}),(Zl=function(){return{w:i,m:h}})()}function Jl(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Jl=function(t,e,n,r){function i(e,n){Jl(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))},Jl(t,e,n,r)}function Kl(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 Ql(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)?Ql(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 Ql(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 tc(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 ec(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,nc(r.key),r)}}function nc(t){var e=function(t){if("object"!=Vl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Vl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Vl(e)?e:e+""}function rc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(rc=function(){return!!t})()}function oc(t){return oc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},oc(t)}function ic(t,e){return ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ic(t,e)}var ac=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=oc(e),function(t,e){if(e&&("object"==Vl(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||[],oc(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&&ic(t,e)}(e,t),n=e,r=[{key:"draw",value:(o=Zl().m(function t(e,n,r){var o,i,a,u,l,c,s,f,h=this;return Zl().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=Kl(e),t.p=1,c=Zl().m(function t(){var e,u,c,s,f,y;return Zl().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"!=(s=h.cache[u])){t.n=3;break}return t.a(2,{v:void 0});case 3: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 h.cache[u]="loading",(f=new Image).onload=function(){h.cache[u]=f,n.redraw()},f.onerror=function(){console.warn("Could not retrieve image from",u)},f.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(Xl(c()),3);case 3:if(0!==(s=t.v)){t.n=4;break}return t.a(3,5);case 4:if(!s){t.n=5;break}return t.a(2,s.v);case 5:t.n=2;break;case 6:t.n=8;break;case 7:t.p=7,f=t.v,u.e(f);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){tc(i,n,r,a,u,"next",t)}function u(t){tc(i,n,r,a,u,"throw",t)}a(void 0)})},function(t,e,n){return i.apply(this,arguments)})}],r&&ec(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(_r);function uc(t){return uc="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},uc(t)}function lc(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 cc(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,sc(r.key),r)}}function sc(t){var e=function(t){if("object"!=uc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=uc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==uc(e)?e:e+""}function fc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(fc=function(){return!!t})()}function hc(t){return hc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hc(t)}function yc(t,e){return yc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yc(t,e)}var pc=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=hc(e),function(t,e){if(e&&("object"==uc(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,fc()?Reflect.construct(e,n||[],hc(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&&yc(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,a=bi(t,n,function(t){return r.value(t)}),u=a.x0,l=a.y0,c=this.targetResolution(n,o),s=Math.round(n/c);c=n/s,a=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 S=(v+f)*Math.SQRT1_2;u[c][y]=b*(1-S)+w*S}else{var O=m+g;u[c][y]=vc(b,m,g,O/2,v,f)}else{var _=b+w;u[c][y]=vc(b,m,_/2,w,v,f)}else{var j=b+w;u[c][y]=vc(b,j/2,g,w,v,f)}else{var P=m+g;u[c][y]=vc(P/2,m,g,w,v,f)}else u[c][y]=vc(b,m,g,w,v,f);else u[c][y]=vc(b||0,m||0,g||0,w||0,v,f)}return u}(a,s,this.nodataHandling),t=[];for(var f=(n-c)/2,h=0;h<a.length;h++)for(var y=a[h],p=l-h*c+f,v=0;v<y.length;v++){var d=y[v];if(d){var b={x:u+v*c+f,y:p};b[this.interpolatedProperty]=d,t.push(b)}}var m,g=e.offscreenCtx,w=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 lc(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)?lc(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(w.s();!(m=w.n()).done;){var x=m.value;i(x,o)&&((x.alpha||x.blendOperation)&&(g.save(),x.alpha&&(g.globalAlpha=x.alpha(o)),x.blendOperation&&(g.globalCompositeOperation=x.blendOperation(o))),e.setCanvasTransform(),x.draw(t,e,c),x.filterColor&&x.drawFilter(e),(x.alpha||x.blendOperation)&&g.restore())}}catch(t){w.e(t)}finally{w.f()}}}}],r&&cc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_r),vc=function(t,e,n,r,o,i){var a=t+(e-t)*o;return a+(n+(r-n)*o-a)*i};function dc(t){return dc="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},dc(t)}function bc(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 mc(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)?mc(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 mc(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 gc(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,wc(r.key),r)}}function wc(t){var e=function(t){if("object"!=dc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=dc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dc(e)?e:e+""}function xc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(xc=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 _c=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=Sc(e),function(t,e){if(e&&("object"==dc(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,xc()?Reflect.construct(e,n||[],Sc(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&&Oc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n){var r=t.view.z,o=t.offscreenCtx,a=this.getDataset(r);if(a){if(a.getData(t.extGeo),a.updateViewCache(t.extGeo),(this.alpha||this.blendOperation)&&(o.save(),this.alpha&&(o.globalAlpha=this.alpha(r)),this.blendOperation&&(o.globalCompositeOperation=this.blendOperation(r))),n){var u,l=bc(this.styles);try{for(l.s();!(u=l.n()).done;){var c=u.value;e.setLegendContainer(n.node(),c.legends,c.styles)}}catch(t){l.e(t)}finally{l.f()}}var s,f=bc(this.styles);try{for(f.s();!(s=f.n()).done;){var h=s.value;i(h,r)&&((h.alpha||h.blendOperation)&&(o.save(),h.alpha&&(o.globalAlpha=h.alpha(r)),h.blendOperation&&(o.globalCompositeOperation=h.blendOperation(r))),t.setCanvasTransform(),h.draw(a.getViewCache(),t,a.getResolution()),h.filterColor&&h.drawFilter(t),(h.alpha||h.blendOperation)&&o.restore())}}catch(t){f.e(t)}finally{f.f()}if((this.alpha||this.blendOperation)&&o.restore(),n){var y,p=bc(this.styles);try{for(p.s();!(y=p.n()).done;){var v=y.value;if(i(v,r)&&(e.addLegends(n,v.legends,v,t),v.styles)){var d,b=bc(v.styles);try{for(b.s();!(d=b.n()).done;){var m=d.value;i(m,r)&&e.addLegends(n,m.legends,m,t)}}catch(t){b.e(t)}finally{b.f()}}}}catch(t){p.e(t)}finally{p.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:"setLegendContainer",value:function(t,n,r){var o=function(e){Array.isArray(e)?e.forEach(o):e&&(e.container=t)};o(n);var i,a=bc(r||[]);try{for(a.s();!(i=a.n()).done;){var u=i.value;e.setLegendContainer(t,u.legends,void 0)}}catch(t){a.e(t)}finally{a.f()}}},{key:"addLegends",value:function(t,e,n,r){if(Array.isArray(e)){var o,i=bc(e);try{for(i.s();!(o=i.n()).done;){var a=o.value;this.addLegends(t,a,n,r)}}catch(t){i.e(t)}finally{i.f()}}else{e.style_=n,e.redraw=function(){return r.redraw?r.redraw():void 0};var u=t.node(),l=e.div.node(),c=u._gridvizLegendCursor;c?l.previousSibling!==c&&c.after(l):u.firstChild!==l&&u.prepend(l),u._gridvizLegendCursor=l}}},{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&&gc(n.prototype,r),o&&gc(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Ar);function jc(t){return jc="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},jc(t)}function Pc(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,kc(r.key),r)}}function kc(t){var e=function(t){if("object"!=jc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=jc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==jc(e)?e:e+""}function Tc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Tc=function(){return!!t})()}function Cc(t){return Cc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cc(t)}function Ec(t,e){return Ec=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ec(t,e)}var Ac=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=Cc(e),function(t,e){if(e&&("object"==jc(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||[],Cc(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&&Ec(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")}}])&&Pc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ar);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 zc(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"!=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 Fc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Fc=function(){return!!t})()}function Ic(t){return Ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ic(t)}function Bc(t,e){return Bc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bc(t,e)}var Lc=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"==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,Fc()?Reflect.construct(e,n||[],Ic(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&&Bc(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}}}])&&zc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ar);function Nc(t){return Nc="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},Nc(t)}function Dc(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,Gc(r.key),r)}}function Gc(t){var e=function(t){if("object"!=Nc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Nc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Nc(e)?e:e+""}function Wc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Wc=function(){return!!t})()}function Uc(t){return Uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uc(t)}function $c(t,e){return $c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},$c(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=Uc(e),function(t,e){if(e&&("object"==Nc(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,Wc()?Reflect.construct(e,n||[],Uc(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&&$c(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}}])&&Dc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ar);function qc(t){return qc="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},qc(t)}function Yc(){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 Vc(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[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 f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Vc(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Vc(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,Vc(f,"constructor",c),Vc(c,"constructor",l),l.displayName="GeneratorFunction",Vc(c,o,"GeneratorFunction"),Vc(f),Vc(f,o,"Generator"),Vc(f,r,function(){return this}),Vc(f,"toString",function(){return"[object Generator]"}),(Yc=function(){return{w:i,m:h}})()}function Vc(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Vc=function(t,e,n,r){function i(e,n){Vc(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))},Vc(t,e,n,r)}function Xc(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 Zc(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 Jc(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)?Jc(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 Jc(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 Kc(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,Qc(r.key),r)}}function Qc(t){var e=function(t){if("object"!=qc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=qc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qc(e)?e:e+""}function ts(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ts=function(){return!!t})()}function es(t){return es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},es(t)}function ns(t,e){return ns=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ns(t,e)}var rs=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=es(e),function(t,e){if(e&&("object"==qc(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||[],es(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&&ns(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=Zc(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=Yc().m(function t(e){var n,r,o,i,a;return Yc().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,lo(this.url);case 4:if(n=t.v,!this.preprocess){t.n=13;break}this.labels=[],r=Zc(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){Xc(i,n,r,a,u,"next",t)}function u(t){Xc(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&Kc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Ar);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 is(){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 as(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[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 f=!0,r}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(as(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,as(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,as(f,"constructor",c),as(c,"constructor",l),l.displayName="GeneratorFunction",as(c,o,"GeneratorFunction"),as(f),as(f,o,"Generator"),as(f,r,function(){return this}),as(f,"toString",function(){return"[object Generator]"}),(is=function(){return{w:i,m:h}})()}function as(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}as=function(t,e,n,r){function i(e,n){as(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))},as(t,e,n,r)}function us(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 ls(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 cs(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)?cs(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 cs(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 ss(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"!=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 hs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(hs=function(){return!!t})()}function ys(t){return ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ys(t)}function ps(t,e){return ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ps(t,e)}var vs=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=ys(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,hs()?Reflect.construct(e,n||[],ys(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&&ps(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=ls(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=ls(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=ls(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=ls("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=ls(O);try{for(j.s();!(_=j.n()).done;){var P,k=ls(_.value);try{for(k.s();!(P=k.n()).done;){var T=P.value;if(!(T.length<2)){o.moveTo(T[0][0],T[0][1]);for(var C=1;C<T.length;C++)o.lineTo(T[C][0],T[C][1]);o.closePath()}}}catch(t){k.e(t)}finally{k.f()}}}catch(t){j.e(t)}finally{j.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,F=null!==(M=null===(z=this.strokeStyle)||void 0===z?void 0:z.call(this,t,r))&&void 0!==M?M:E;F&&"none"!==F&&(o.strokeStyle=F,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 I,B=ls(e.geometries);try{for(B.s();!(I=B.n()).done;){var L=I.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=is().m(function t(e){var n,r,o,i,a,u;return is().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,Yr(this.url);case 4:if(n=t.v,r=n.features,!this.preprocess){t.n=13;break}this.fs=[],o=ls(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){us(i,n,r,a,u,"next",t)}function u(t){us(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&ss(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Ar);function ds(t){return ds="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},ds(t)}function bs(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 ms(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,gs(r.key),r)}}function gs(t){var e=function(t){if("object"!=ds(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ds(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ds(e)?e:e+""}var ws=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.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=gt("#"+this.id)),this.div&&!this.div.empty()||(this.div=gt(document.createElement("div")),this.id&&this.div.attr("id",this.id)),this._set={padding:void 0!==e.padding,fontFamily:void 0!==e["font-family"],titleFontSize:void 0!==e.titleFontSize,titleFontWeight:void 0!==e.titleFontWeight,labelFontSize:void 0!==e.labelFontSize},this.div.classed("gridviz-legend",!0),e.className){var n,r=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 bs(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)?bs(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}}}}(String(e.className).split(/\s+/));try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&this.div.classed(o,!0)}}catch(t){r.e(t)}finally{r.f()}}this.div.style("background",this.background),this.div.style("padding",this._css("padding",this.padding,this._set.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._css("font-family",this["font-family"],this._set.fontFamily)),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,this.labelsAsHTML=!0===e.labelsAsHTML,this.interactive=!1!==e.interactive,this.style_=void 0,this.redraw=void 0,this.container=void 0,this.fill="fill"===e.width},e=[{key:"highlight",value:function(t){if(this.interactive&&this.style_){var e=this.style_.highlightColors;this.div&&this.div.attr("data-gridviz-hovered",t&&t.length?"":null),this.style_.setHighlight(t),null===e&&null===this.style_.highlightColors||this.redraw&&this.redraw()}}},{key:"bindHover",value:function(t,e,n){var r=this;this.interactive&&t.style("cursor","pointer").on("mouseenter",function(){n&&n.enter&&n.enter(),r.highlight([e])}).on("mouseleave",function(){n&&n.leave&&n.leave(),r.highlight(null)})}},{key:"_css",value:function(t,e,n){return n?e:"var(--gridviz-legend-".concat(t,", ").concat(e,")")}},{key:"labelFontSizeCSS",value:function(){return this._css("label-font-size",this.labelFontSize,this._set.labelFontSize)}},{key:"setType",value:function(t){this.div.classed("gridviz-legend--"+t,!0)}},{key:"availableWidth",value:function(t){if(!this.fill)return this.width;var e=this.container,n=e&&e.clientWidth;if(!n)return t;var r=parseFloat(this.padding)||0;return Math.max(60,Math.floor(n-2*r))}},{key:"setText",value:function(t,e){return this.labelsAsHTML?t.html(e):t.text(e)}},{key:"makeTitle",value:function(){this.title&&this.setText(this.div.append("div").classed("gridviz-legend-title",!0).style("font-size",this._css("title-font-size",this.titleFontSize,this._set.titleFontSize)).style("font-weight",this._css("title-font-weight",this.titleFontWeight,this._set.titleFontWeight)).style("margin-bottom","7px"),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&&ms(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function xs(t){return xs="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},xs(t)}function Ss(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,Os(r.key),r)}}function Os(t){var e=function(t){if("object"!=xs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=xs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xs(e)?e:e+""}function _s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_s=function(){return!!t})()}function js(t){return js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},js(t)}function Ps(t,e){return Ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ps(t,e)}var ks=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=js(e),function(t,e){if(e&&("object"==xs(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||[],js(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="fill"===t.width?300:t.width||300,n.height=t.height||15,n.setType("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&&Ps(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();for(var e=this.availableWidth(this.width),n=e+2*this.margin,r=this.height+this.margin+this.tickSize+10,o=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n).attr("height",r).append("g").classed("gridviz-legend-bar",!0).attr("transform","translate("+this.margin+" 0)"),i=e,a=this.height,u=0;u<i;u+=5){var l=u/(i-1);this.invert&&(l=1-l),o.append("rect").classed("gridviz-legend-swatch",!0).attr("x",u).attr("y",0).attr("width",5).attr("height",a).style("fill",this.colorScale(l,t.viewScale))}for(var c=0;c<this.ticks;c++){var s=c/(this.ticks-1);o.append("line").classed("gridviz-legend-tick",!0).attr("x1",i*s).attr("y1",0).attr("x2",i*s).attr("y2",a+this.tickSize).style("stroke","black"),o.append("text").classed("gridviz-legend-label",!0).attr("id","ticklabel_"+c).attr("x",i*s).attr("y",a+this.tickSize+2).style("font-size",this.fontSize).style("text-anchor",0==c?"start":c==this.ticks-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none")}for(var f=this.tickFormat&&"text"!=this.tickFormat?this.tickFormat:function(t){return t},h=0;h<this.ticks;h++){var y=h/(this.ticks-1),p=this.textScale(y,t.viewScale),v=(p?f(p):"0")+(this.tickUnit?this.tickUnit:"");null!=v&&this.div.select("#ticklabel_"+h).text(v)}}}],r&&Ss(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ws);function Ts(t){return Ts="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},Ts(t)}function Cs(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,Es(r.key),r)}}function Es(t){var e=function(t){if("object"!=Ts(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ts(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ts(e)?e:e+""}function As(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(As=function(){return!!t})()}function Ms(t){return Ms=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ms(t)}function zs(t,e){return zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zs(t,e)}var Rs=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=Ms(e),function(t,e){if(e&&("object"==Ts(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,As()?Reflect.construct(e,n||[],Ms(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colors=t.colors,n.breaks=t.breaks,n.width="fill"===t.width?300:t.width||300,n.height=t.height||15,n.setType("discrete"),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&&zs(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n=this.colors(t.viewScale),r=this.breaks(t.viewScale);if(r){var o=n.length;if(0!=o){for(var i=this.availableWidth(this.width),a=i/o,u=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",i).attr("height",this.height+this.tickSize+2+10),l=function(){var t=u.append("rect").classed("gridviz-legend-swatch",!0).attr("x",c*a).attr("y",0).attr("width",a).attr("height",e.height).style("fill",n[c]);e.bindHover(t,n[c],{enter:function(){return t.classed("gridviz-legend-swatch--active",!0).attr("stroke","red")},leave:function(){return t.classed("gridviz-legend-swatch--active",!1).attr("stroke",null)}})},c=0;c<o;c++)l();for(var s=1;s<o;s++)u.append("line").classed("gridviz-legend-tick",!0).attr("x1",a*s).attr("y1",0).attr("x2",a*s).attr("y2",this.height+this.tickSize).style("stroke","black");for(var f=1;f<o;f++){var h=r[f-1];isNaN(h)||null==h||(this.labelFormat&&(h=this.labelFormat(h,f)),u.append("text").classed("gridviz-legend-label",!0).attr("id","ticklabel_"+f).attr("x",a*f).attr("y",this.height+this.tickSize+2).style("font-size",this.labelFontSizeCSS()).style("text-anchor","middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(h))}}}}}])&&Cs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ws);function Fs(t){return Fs="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},Fs(t)}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,Bs(r.key),r)}}function Bs(t){var e=function(t){if("object"!=Fs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fs(e)?e:e+""}function Ls(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ls=function(){return!!t})()}function Ns(t){return Ns=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ns(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=Ns(e),function(t,e){if(e&&("object"==Fs(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,Ls()?Reflect.construct(e,n||[],Ns(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.setType("category"),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:"update",value:function(){var t=this;this.div.selectAll("*").remove(),this.makeTitle();var e=this.colorLabel.length;if(0!=e)for(var n=function(){var e=t.colorLabel[r],n=t.div.append("div").classed("gridviz-legend-category",!0);t.bindHover(n,e[0],{enter:function(){return n.classed("gridviz-legend-category--active",!0).select("svg").select("rect, circle").style("stroke","red")},leave:function(){return n.classed("gridviz-legend-category--active",!1).select("svg").select("rect, circle").style("stroke",t.strokeColor)}});var o=t.strokeWidth;if("square"===t.shape){var i=t.dimension.h||15,a=t.dimension.w||20;n.append("div").classed("gridviz-legend-symbol-wrapper",!0).style("display","inline").append("svg").classed("gridviz-legend-graphic",!0).attr("width",a+2*o).attr("height",i+2*o).append("rect").classed("gridviz-legend-swatch",!0).attr("x",o).attr("y",o).attr("width",a).attr("height",i).style("fill",e[0]).style("stroke",t.strokeColor).style("stroke-width",t.strokeWidth)}else{if("circle"!==t.shape)throw new Error("Unexpected shape:"+t.shape);var u=t.dimension.r||8,l=2*u+2*o;n.append("div").classed("gridviz-legend-symbol-wrapper",!0).style("display","inline").append("svg").classed("gridviz-legend-graphic",!0).attr("width",l).attr("height",l).append("circle").classed("gridviz-legend-swatch",!0).attr("cx",u+o).attr("cy",u+o).attr("r",u).style("fill",e[0]).style("stroke",t.strokeColor).style("stroke-width",t.strokeWidth)}t.setText(n.append("div").style("display","inline").classed("gridviz-legend-label",!0).style("padding-left","5px").style("font-size",t.labelFontSizeCSS()),e[1])},r=0;r<e;r++)n()}}])&&Is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ws);function Ws(t){return Ws="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},Ws(t)}function Us(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 $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}}(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 $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,qs(r.key),r)}}function qs(t){var e=function(t){if("object"!=Ws(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ws(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ws(e)?e:e+""}function Ys(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ys=function(){return!!t})()}function Vs(t){return Vs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vs(t)}function Xs(t,e){return Xs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xs(t,e)}var Zs=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=Vs(e),function(t,e){if(e&&("object"==Ws(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||[],Vs(t).constructor):e.apply(t,n))}(this,e,[t])).setType("size"),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&&Xs(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").classed("gridviz-legend-category",!0),i=function(){return o.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n+e.strokeWidth+2).attr("height",n+e.strokeWidth+2).style("","inline-block")};if("square"===this.shape)i().append("rect").classed("gridviz-legend-symbol",!0).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").classed("gridviz-legend-symbol",!0).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").classed("gridviz-legend-graphic",!0).attr("width",u).attr("height",n).style("","inline-block").append("line").classed("gridviz-legend-symbol",!0).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").classed("gridviz-legend-label",!0).style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSizeCSS()).text(r+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&Hs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ws);function Js(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=[],i=Us(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 Zs(r))};for(i.s();!(n=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function Ks(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.k||[.9,.5,.2,.05],o=[],i=Us(r);try{var a=function(){var i=e.value;n.title=i==r[0]?n.title:void 0,n.label=function(e,n){return di(i*La(n,t))},o.push(new Zs(n))};for(i.s();!(e=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function Qs(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.labelFormat||function(t){return t},o=n.labelText||ef(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 Zs(n))},u=e.length-1;u>=0;u--)a(u);return i}function tf(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.labelFormat||function(t){return t},r=e.labelText||ef(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 Zs(e))},u=t-1;u>=0;u--)a(u);return o}function ef(t){return function(e,n){return null==e&&null==n?"":null==n?"> "+t(e):null==e?"< "+t(n):t(e)+" - "+t(n)}}function nf(t){return nf="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},nf(t)}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"!=nf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=nf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==nf(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"==nf(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])).setType("orientation"),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&&lf(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.div.append("div").classed("gridviz-legend-category",!0),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").classed("gridviz-legend-graphic",!0).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").classed("gridviz-legend-symbol",!0).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").classed("gridviz-legend-label",!0).style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSizeCSS()).text(this.label+(this.labelUnitText?" ":"")+this.labelUnitText)}}],r&&rf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ws);function sf(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 cf(n));return r}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 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.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.setType("ternary"),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:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n=this.width,r=.866025*n,o=this.classifier,i=this.selectionColor,a=this.tooltip,u=this.texts||{},l=this,c=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n+0).attr("height",r+8+24);c.append("text").attr("x",n/2).attr("y",14).classed("gridviz-legend-label",!0).text(this.topText).attr("font-size",12).attr("text-anchor","middle"),c.append("text").attr("x",0).attr("y",30+r).classed("gridviz-legend-label",!0).text(this.leftText).attr("font-size",12).attr("text-anchor","start"),c.append("text").attr("x",n).attr("y",30+r).classed("gridviz-legend-label",!0).text(this.rightText).attr("font-size",12).attr("text-anchor","end");var s=c.append("g").classed("gridviz-legend-triangle",!0).attr("transform","translate(0 16)"),f=function(t,n,r){t.attr("fill",n).classed("gridviz-legend-swatch",!0).style("cursor",e.interactive?"pointer":null).on("mouseover",function(t){gt(this).classed("gridviz-legend-swatch--active",!0).attr("fill",i),l.highlight([n]),a&&r&&(a.html(r),a.setPosition(t),a.show())}).on("mouseout",function(){gt(this).classed("gridviz-legend-swatch--active",!1).attr("fill",n),l.highlight(null),a&&a.hide()}),a&&r&&t.on("mousemove",function(t){a.setPosition(t)})};f(s.append("polygon").attr("points","0,"+r+" "+n/3+","+r+" "+n/2+","+2*r/3+" "+n/6+","+2*r/3),o.colors[0],u[0]),f(s.append("polygon").attr("points",n/2+",0 "+2*n/3+","+r/3+" "+n/2+","+2*r/3+" "+n/3+","+r/3),o.colors[1],u[1]),f(s.append("polygon").attr("points",n+","+r+" "+5*n/6+","+2*r/3+" "+n/2+","+2*r/3+" "+2*n/3+","+r),o.colors[2],u[2]),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+5*n/6+","+2*r/3+" "+2*n/3+","+r/3),o.mixColors[0],u.m12),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+n/3+","+r+" "+2*n/3+","+r),o.mixColors[1],u.m02),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+n/6+","+2*r/3+" "+n/3+","+r/3),o.mixColors[2],u.m01),this.centerCoefficient&&f(s.append("circle").attr("cx",n/2).attr("cy",2*r/3).attr("r",this.centerCoefficient*r/3),o.centerColor,u.center)}}],r&&hf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ws),mf=function(t){return t};mf.invert=mf;var gf=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return mf;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},wf=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return mf;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},xf=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return mf;var e=function(e){return Math.pow(e,t)},n=1/t;return e.invert=function(t){return Math.pow(t,n)},e},Sf=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return mf;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},Of=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return mf;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}},_f=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return mf;var e=Of(t);return function(t){return 1-e(1-t)}};const jf=Math.PI/180,Pf=180/Math.PI,kf=.96422,Tf=.82521,Cf=4/29,Ef=6/29,Af=3*Ef*Ef,Mf=Ef*Ef*Ef;function zf(t){if(t instanceof Ff)return new Ff(t.l,t.a,t.b,t.opacity);if(t instanceof Df)return Gf(t);t instanceof Ie||(t=Re(t));var e,n,r=Nf(t.r),o=Nf(t.g),i=Nf(t.b),a=If((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?e=n=a:(e=If((.4360747*r+.3850649*o+.1430804*i)/kf),n=If((.0139322*r+.0971045*o+.7141733*i)/Tf)),new Ff(116*a-16,500*(e-a),200*(a-n),t.opacity)}function Rf(t,e,n,r){return 1===arguments.length?zf(t):new Ff(t,e,n,null==r?1:r)}function Ff(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function If(t){return t>Mf?Math.pow(t,1/3):t/Af+Cf}function Bf(t){return t>Ef?t*t*t:Af*(t-Cf)}function Lf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Nf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Df(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function Gf(t){if(isNaN(t.h))return new Ff(t.l,0,0,t.opacity);var e=t.h*jf;return new Ff(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}function Wf(t,e){var n=Ze((t=Rf(t)).l,(e=Rf(e)).l),r=Ze(t.a,e.a),o=Ze(t.b,e.b),i=Ze(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 Uf(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 $f(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)?$f(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 $f(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}ye(Ff,Rf,pe(ve,{brighter(t){return new Ff(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Ff(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 Ie(Lf(3.1338561*(e=kf*Bf(e))-1.6168667*(t=1*Bf(t))-.4906146*(n=Tf*Bf(n))),Lf(-.9787684*e+1.9161415*t+.033454*n),Lf(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),ye(Df,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Df)return new Df(t.h,t.c,t.l,t.opacity);if(t instanceof Ff||(t=zf(t)),0===t.a&&0===t.b)return new Df(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Pf;return new Df(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Df(t,e,n,null==r?1:r)},pe(ve,{brighter(t){return new Df(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new Df(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return Gf(this).rgb()}}));var Hf=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t[0],o=t[1],i=t[2],a=Uf(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},qf=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=Uf(n||["red","green","blue"],3),i=o[0],a=o[1],u=o[2],l=r.colorInterpolation||Wf,c=null==r.withMixedClasses||r.withMixedClasses,s=function(t,e){return l(t,e)(.5)},f=Uf(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=Hf(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 Yf(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 Vf,Xf=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Zf(t){if(!(e=Xf.exec(t)))throw new Error("invalid format: "+t);var e;return new Jf({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 Jf(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 Kf(t,e){var n=Yf(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")}Zf.prototype=Jf.prototype,Jf.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Qf={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Kf(100*t,e),r:Kf,s:function(t,e){var n=Yf(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(Vf=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")+Yf(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function th(t){return t}var eh,nh=Array.prototype.map,rh=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function oh(t){return eh=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?th:(e=nh.call(t.grouping,Number),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)}),o=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?th:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(nh.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=Zf(t)).fill,n=t.align,f=t.sign,h=t.symbol,y=t.zero,p=t.width,v=t.comma,d=t.precision,b=t.trim,m=t.type;"n"===m?(v=!0,m="g"):Qf[m]||(void 0===d&&(d=12),b=!0,m="g"),(y||"0"===e&&"="===n)&&(y=!0,e="0",n="=");var g="$"===h?o:"#"===h&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===h?i:/[%p]/.test(m)?l:"",x=Qf[m],S=/[defgprs%]/.test(m);function O(t){var o,i,l,h=g,O=w;if("c"===m)O=x(t)+O,t="";else{var _=(t=+t)<0||1/t<0;if(t=isNaN(t)?s:x(Math.abs(t),d),b&&(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(!+t[r])break t;o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),_&&0===+t&&"+"!==f&&(_=!1),h=(_?"("===f?f:c:"-"===f||"("===f?"":f)+h,O=("s"===m?rh[8+Vf/3]:"")+O+(_&&"("===f?")":""),S)for(o=-1,i=t.length;++o<i;)if(48>(l=t.charCodeAt(o))||l>57){O=(46===l?a+t.slice(o+1):t.slice(o))+O,t=t.slice(0,o);break}}v&&!y&&(t=r(t,1/0));var j=h.length+t.length+O.length,P=j<p?new Array(p-j+1).join(e):"";switch(v&&y&&(t=r(P+t,P.length?p-O.length:1/0),P=""),n){case"<":t=h+t+O+P;break;case"=":t=h+P+t+O;break;case"^":t=P.slice(0,j=P.length>>1)+h+t+O+P.slice(j);break;default:t=P+h+t+O}return u(t)}return d=void 0===d?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),O.toString=function(){return t+""},O}return{format:f,formatPrefix:function(t,e){var n,r=f(((t=Zf(t)).type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Yf(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-o),a=rh[8+o/3];return function(t){return r(i*t)+a}}}}(t),eh.format,eh.formatPrefix,eh}oh({thousands:",",grouping:[3],currency:["$",""]});var ih=Dn.getParameterByName;return oh({decimal:".",thousands:" ",grouping:[3],currency:["","€"]}),e})());
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(t){return n="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},n(t)}function r(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,o(r.key),r)}}function o(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}function i(t,e){var n=t.visible;return"function"==typeof n?!!n(e):!1!==n}t.r(e),t.d(e,{BackgroundLayer:()=>rs,BackgroundLayerImage:()=>bs,BackgroundLayerWMS:()=>ss,CSVGrid:()=>Uo,CircleColorSizeWebGLStyle:()=>kl,ColorCategoryLegend:()=>pf,ColorDiscreteLegend:()=>lf,ColorLegend:()=>tf,CompositionStyle:()=>Ii,Dataset:()=>Gr,DotDensityStyle:()=>bu,GeoCanvas:()=>Dn,GeoJSONLayer:()=>Gs,GridLayer:()=>Zc,ImageStyle:()=>Oc,Interpolator:()=>Mc,IsoFenceStyle:()=>sc,JSGrid:()=>Zo,JoyPlotStyle:()=>Pi,LabelLayer:()=>Ts,Layer:()=>zr,LegoStyle:()=>ol,Map:()=>br,MosaicStyle:()=>Il,MultiResolutionDataset:()=>Vr,NinjaStarStyle:()=>Hl,OrientationLegend:()=>If,PillarStyle:()=>ua,RandomWalkInterpolator:()=>Dc,SegmentStyle:()=>Hi,ShadingRayStyle:()=>Wa,ShadingStyle:()=>Xa,ShapeColorSizeStyle:()=>oi,SideCategoryStyle:()=>ru,SideStyle:()=>pa,SideTanakaStyle:()=>ju,SizeLegend:()=>Of,SquareColorCategoryWebGLStyle:()=>Ia,SquareColorWebGLStyle:()=>bl,StrokeStyle:()=>hi,Style:()=>Pr,TernaryLegend:()=>Hf,TextStyle:()=>Ji,TiledGrid:()=>To,TimeSeriesStyle:()=>Ql,VennLegend:()=>Jf,cellsToMatrix:()=>gi,circularInverseScale:()=>ih,circularScale:()=>oh,classifier:()=>Hu,classifierMinMax:()=>Yu,colorClassifier:()=>$u,discreteColors:()=>Vu,exponentialScale:()=>th,getParameterByName:()=>Dh,logarithmicScale:()=>eh,nice:()=>mi,orientationLegend:()=>Bf,powerInverseScale:()=>rh,powerScale:()=>nh,sizeDiscreteLegend:()=>Cf,sizeDiscreteViewScaleLegend:()=>kf,sizeLegend:()=>jf,sizeLegendViewScale:()=>Pf,stretchedBreaks:()=>Wu,ternaryClassifier:()=>Ph,ternaryColorClassifier:()=>Ch,viewScale:()=>Bu,viewScaleColor:()=>Nu,viewScaleColorQuantile:()=>Du,viewScaleCombination:()=>Uu,viewScaleQuantile:()=>Lu,viewScaleQuantileClassifer:()=>Gu});var a=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:"isVisible",value:function(t){return i(this,t)}},{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)}}}}])&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function u(){}function l(t){return null==t?u:function(){return this.querySelector(t)}}function c(){return[]}function s(t){return null==t?c:function(){return this.querySelectorAll(t)}}function f(t){return function(){return this.matches(t)}}function h(t){return function(e){return e.matches(t)}}var y=Array.prototype.find;function v(){return this.firstElementChild}var p=Array.prototype.filter;function d(){return Array.from(this.children)}function b(t){return new Array(t.length)}function m(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function g(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 m(t,i[u]);for(;u<l;++u)(a=e[u])&&(o[u]=a)}function w(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 m(t,i[u]);for(u=0;u<f;++u)(l=e[u])&&s.get(y[u])===l&&(o[u]=l)}function S(t){return t.__data__}function x(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function _(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}m.prototype={constructor:m,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 O="http://www.w3.org/1999/xhtml";const j={svg:"http://www.w3.org/2000/svg",xhtml:O,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function P(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),j.hasOwnProperty(e)?{space:j[e],local:t}:t}function C(t){return function(){this.removeAttribute(t)}}function k(t){return function(){this.removeAttributeNS(t.space,t.local)}}function T(t,e){return function(){this.setAttribute(t,e)}}function A(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function E(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function M(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 z(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function R(t){return function(){this.style.removeProperty(t)}}function F(t,e,n){return function(){this.style.setProperty(t,e,n)}}function I(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function B(t,e){return t.style.getPropertyValue(e)||z(t).getComputedStyle(t,null).getPropertyValue(e)}function L(t){return function(){delete this[t]}}function N(t,e){return function(){this[t]=e}}function D(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function G(t){return t.trim().split(/^|\s+/)}function U(t){return t.classList||new W(t)}function W(t){this._node=t,this._names=G(t.getAttribute("class")||"")}function H(t,e){for(var n=U(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function Y(t,e){for(var n=U(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function $(t){return function(){H(this,t)}}function V(t){return function(){Y(this,t)}}function q(t,e){return function(){(e.apply(this,arguments)?H:Y)(this,t)}}function X(){this.textContent=""}function Z(t){return function(){this.textContent=t}}function K(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function J(){this.innerHTML=""}function Q(t){return function(){this.innerHTML=t}}function tt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function et(){this.nextSibling&&this.parentNode.appendChild(this)}function nt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===O&&e.documentElement.namespaceURI===O?e.createElement(t):e.createElementNS(n,t)}}function ot(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function it(t){var e=P(t);return(e.local?ot:rt)(e)}function at(){return null}function ut(){var t=this.parentNode;t&&t.removeChild(this)}function lt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ct(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function st(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 ft(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 ht(t,e,n){var r=z(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 yt(t,e){return function(){return ht(this,t,e)}}function vt(t,e){return function(){return ht(this,t,e.apply(this,arguments))}}W.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 pt=[null];function dt(t,e){this._groups=t,this._parents=e}function bt(){return new dt([[document.documentElement]],pt)}dt.prototype=bt.prototype={constructor:dt,select:function(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,u=e[o],c=u.length,s=r[o]=new Array(c),f=0;f<c;++f)(i=u[f])&&(a=t.call(i,i.__data__,f,u))&&("__data__"in i&&(a.__data__=i.__data__),s[f]=a);return new dt(r,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):s(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 dt(r,o)},selectChild:function(t){return this.select(null==t?v:function(t){return function(){return y.call(this.children,t)}}("function"==typeof t?t:h(t)))},selectChildren:function(t){return this.selectAll(null==t?d:function(t){return function(){return p.call(this.children,t)}}("function"==typeof t?t:h(t)))},filter:function(t){"function"!=typeof t&&(t=f(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 dt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,S);var n,r=e?w:g,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,v=x(t.call(f,f&&f.__data__,s,o)),p=v.length,d=l[s]=new Array(p),b=u[s]=new Array(p);r(f,h,d,b,c[s]=new Array(y),v,e);for(var m,_,O=0,j=0;O<p;++O)if(m=d[O]){for(O>=j&&(j=O+1);!(_=b[j])&&++j<p;);m._next=_||null}}return(u=new dt(u,o))._enter=l,u._exit=c,u},enter:function(){return new dt(this._enter||this._groups.map(b),this._parents)},exit:function(){return new dt(this._exit||this._groups.map(b),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),v=0;v<h;++v)(c=s[v]||f[v])&&(y[v]=c);for(;l<o;++l)u[l]=n[l];return new dt(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=_);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 dt(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=P(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?k:C:"function"==typeof e?n.local?M:E:n.local?A:T)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?R:"function"==typeof e?I:F)(t,e,null==n?"":n)):B(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?L:"function"==typeof e?D:N)(t,e)):this.node()[t]},classed:function(t,e){var n=G(t+"");if(arguments.length<2){for(var r=U(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?q:e?$:V)(n,e))},text:function(t){return arguments.length?this.each(null==t?X:("function"==typeof t?K:Z)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?J:("function"==typeof t?tt:Q)(t)):this.node().innerHTML},raise:function(){return this.each(et)},lower:function(){return this.each(nt)},append:function(t){var e="function"==typeof t?t:it(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:it(t),r=null==e?at:"function"==typeof e?e:l(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(ut)},clone:function(t){return this.select(t?ct:lt)},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?ft:st,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?vt:yt)(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 mt=bt;function gt(t){return"string"==typeof t?new dt([[document.querySelector(t)]],[document.documentElement]):new dt([[t]],pt)}var wt={value:()=>{}};function St(){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 xt(r)}function xt(t){this._=t}function _t(t,e){for(var n,r=0,o=t.length;r<o;++r)if((n=t[r]).name===e)return n.value}function Ot(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=wt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}xt.prototype=St.prototype={constructor:xt,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]=Ot(o[n],t.name,e);else if(null==e)for(n in o)o[n]=Ot(o[n],t.name,null);return this}for(;++a<u;)if((n=(t=i[a]).type)&&(n=_t(o[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new xt(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 jt=St,Pt={capture:!0,passive:!1};function Ct(t){t.preventDefault(),t.stopImmediatePropagation()}function kt(t){return((t=Math.exp(t))+1/t)/2}const Tt=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,v=f-l,p=y*y+v*v;if(p<1e-12)a=Math.log(h/c)/e,i=function(t){return[u+t*y,l+t*v,c*Math.exp(e*t*a)]};else{var d=Math.sqrt(p),b=(h*h-c*c+r*p)/(2*c*n*d),m=(h*h-c*c-r*p)/(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=kt(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*v,c*i/kt(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 At(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]}var Et,Mt,zt=0,Rt=0,Ft=0,It=0,Bt=0,Lt=0,Nt="object"==typeof performance&&performance.now?performance:Date,Dt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Gt(){return Bt||(Dt(Ut),Bt=Nt.now()+Lt)}function Ut(){Bt=0}function Wt(){this._call=this._time=this._next=null}function Ht(t,e,n){var r=new Wt;return r.restart(t,e,n),r}function Yt(){Bt=(It=Nt.now())+Lt,zt=Rt=0;try{!function(){Gt(),++zt;for(var t,e=Et;e;)(t=Bt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--zt}()}finally{zt=0,function(){for(var t,e,n=Et,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:Et=e);Mt=t,Vt(r)}(),Bt=0}}function $t(){var t=Nt.now(),e=t-It;e>1e3&&(Lt-=e,It=t)}function Vt(t){zt||(Rt&&(Rt=clearTimeout(Rt)),t-Bt>24?(t<1/0&&(Rt=setTimeout(Yt,t-Nt.now()-Lt)),Ft&&(Ft=clearInterval(Ft))):(Ft||(It=Nt.now(),Ft=setInterval($t,1e3)),zt=1,Dt(Yt)))}function qt(t,e,n){var r=new Wt;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}Wt.prototype=Ht.prototype={constructor:Wt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Gt():+n)+(null==e?0:+e),this._next||Mt===this||(Mt?Mt._next=this:Et=this,Mt=this),this._call=t,this._time=n,Vt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vt())}};var Xt=jt("start","end","cancel","interrupt"),Zt=[];function Kt(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 qt(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(qt(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=Ht(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:Xt,tween:Zt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Jt(t,e){var n=te(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Qt(t,e){var n=te(t,e);if(n.state>3)throw new Error("too late; already running");return n}function te(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ee(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 ne(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var re,oe=180/Math.PI,ie={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ae(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)*oe,skewX:Math.atan(l)*oe,scaleX:a,scaleY:u}}function ue(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:ne(t,o)},{i:l-2,x:ne(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:ne(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:ne(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:ne(t,n)},{i:u-2,x:ne(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 le=ue(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ie:ae(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),ce=ue(function(t){return null==t?ie:(re||(re=document.createElementNS("http://www.w3.org/2000/svg","g")),re.setAttribute("transform",t),(t=re.transform.baseVal.consolidate())?ae((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ie)},", ",")",")");function se(t,e){var n,r;return function(){var o=Qt(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 fe(t,e,n){var r,o;if("function"!=typeof n)throw new Error;return function(){var i=Qt(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 he(t,e,n){var r=t._id;return t.each(function(){var t=Qt(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return te(t,r).value[e]}}function ye(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ve(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function pe(){}var de=.7,be=1/de,me="\\s*([+-]?\\d+)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Se=/^#([0-9a-f]{3,8})$/,xe=new RegExp(`^rgb\\(${me},${me},${me}\\)$`),_e=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),Oe=new RegExp(`^rgba\\(${me},${me},${me},${ge}\\)$`),je=new RegExp(`^rgba\\(${we},${we},${we},${ge}\\)$`),Pe=new RegExp(`^hsl\\(${ge},${we},${we}\\)$`),Ce=new RegExp(`^hsla\\(${ge},${we},${we},${ge}\\)$`),ke={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 Te(){return this.rgb().formatHex()}function Ae(){return this.rgb().formatRgb()}function Ee(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Se.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Me(e):3===n?new Ie(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ze(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ze(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=xe.exec(t))?new Ie(e[1],e[2],e[3],1):(e=_e.exec(t))?new Ie(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Oe.exec(t))?ze(e[1],e[2],e[3],e[4]):(e=je.exec(t))?ze(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Pe.exec(t))?Ue(e[1],e[2]/100,e[3]/100,1):(e=Ce.exec(t))?Ue(e[1],e[2]/100,e[3]/100,e[4]):ke.hasOwnProperty(t)?Me(ke[t]):"transparent"===t?new Ie(NaN,NaN,NaN,0):null}function Me(t){return new Ie(t>>16&255,t>>8&255,255&t,1)}function ze(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ie(t,e,n,r)}function Re(t){return t instanceof pe||(t=Ee(t)),t?new Ie((t=t.rgb()).r,t.g,t.b,t.opacity):new Ie}function Fe(t,e,n,r){return 1===arguments.length?Re(t):new Ie(t,e,n,null==r?1:r)}function Ie(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Be(){return`#${Ge(this.r)}${Ge(this.g)}${Ge(this.b)}`}function Le(){const t=Ne(this.opacity);return`${1===t?"rgb(":"rgba("}${De(this.r)}, ${De(this.g)}, ${De(this.b)}${1===t?")":`, ${t})`}`}function Ne(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function De(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ge(t){return((t=De(t))<16?"0":"")+t.toString(16)}function Ue(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new He(t,e,n,r)}function We(t){if(t instanceof He)return new He(t.h,t.s,t.l,t.opacity);if(t instanceof pe||(t=Ee(t)),!t)return new He;if(t instanceof He)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 He(a,u,l,t.opacity)}function He(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ye(t){return(t=(t||0)%360)<0?t+360:t}function $e(t){return Math.max(0,Math.min(1,t||0))}function Ve(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 qe(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}ye(pe,Ee,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Te,formatHex:Te,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return We(this).formatHsl()},formatRgb:Ae,toString:Ae}),ye(Ie,Fe,ve(pe,{brighter(t){return t=null==t?be:Math.pow(be,t),new Ie(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?de:Math.pow(de,t),new Ie(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ie(De(this.r),De(this.g),De(this.b),Ne(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:Be,formatHex:Be,formatHex8:function(){return`#${Ge(this.r)}${Ge(this.g)}${Ge(this.b)}${Ge(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Le,toString:Le})),ye(He,function(t,e,n,r){return 1===arguments.length?We(t):new He(t,e,n,null==r?1:r)},ve(pe,{brighter(t){return t=null==t?be:Math.pow(be,t),new He(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?de:Math.pow(de,t),new He(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 Ie(Ve(t>=240?t-240:t+120,o,r),Ve(t,o,r),Ve(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new He(Ye(this.h),$e(this.s),$e(this.l),Ne(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=Ne(this.opacity);return`${1===t?"hsl(":"hsla("}${Ye(this.h)}, ${100*$e(this.s)}%, ${100*$e(this.l)}%${1===t?")":`, ${t})`}`}}));const Xe=t=>()=>t;function Ze(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Xe(isNaN(t)?e:t)}const Ke=function t(e){var n=function(t){return 1===(t=+t)?Ze: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):Xe(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Fe(t)).r,(e=Fe(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=Ze(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 Je(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=Fe(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+""}}}Je(function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),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 qe((n-r/e)*e,a,o,i,u)}}),Je(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 qe((n-r/e)*e,o,i,a,u)}});var Qe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tn=new RegExp(Qe.source,"g");function en(t,e){var n,r,o,i=Qe.lastIndex=tn.lastIndex=0,a=-1,u=[],l=[];for(t+="",e+="";(n=Qe.exec(t))&&(r=tn.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:ne(n,r)})),i=tn.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 nn(t,e){var n;return("number"==typeof e?ne:e instanceof Ee?Ke:(n=Ee(e))?(e=n,Ke):en)(t,e)}function rn(t){return function(){this.removeAttribute(t)}}function on(t){return function(){this.removeAttributeNS(t.space,t.local)}}function an(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 un(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 ln(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 cn(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 sn(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 fn(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 hn(t,e){return function(){Jt(this,t).delay=+e.apply(this,arguments)}}function yn(t,e){return e=+e,function(){Jt(this,t).delay=e}}function vn(t,e){return function(){Qt(this,t).duration=+e.apply(this,arguments)}}function pn(t,e){return e=+e,function(){Qt(this,t).duration=e}}var dn=mt.prototype.constructor;function bn(t){return function(){this.style.removeProperty(t)}}var mn=0;function gn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function wn(){return++mn}var Sn=mt.prototype;gn.prototype=function(t){return mt().transition(t)}.prototype={constructor:gn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=l(t));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,s=r[a],f=s.length,h=i[a]=new Array(f),y=0;y<f;++y)(u=s[y])&&(c=t.call(u,u.__data__,y,s))&&("__data__"in u&&(c.__data__=u.__data__),h[y]=c,Kt(h[y],e,n,y,h,te(u,n)));return new gn(i,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=s(t));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var l,c=r[u],f=c.length,h=0;h<f;++h)if(l=c[h]){for(var y,v=t.call(l,l.__data__,h,c),p=te(l,n),d=0,b=v.length;d<b;++d)(y=v[d])&&Kt(y,e,n,d,v,p);i.push(v),a.push(l)}return new gn(i,a,e,n)},selectChild:Sn.selectChild,selectChildren:Sn.selectChildren,filter:function(t){"function"!=typeof t&&(t=f(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 gn(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,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 gn(a,this._parents,this._name,this._id)},selection:function(){return new dn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=wn(),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=te(a,e);Kt(a,t,n,c,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new gn(r,this._parents,t,n)},call:Sn.call,nodes:Sn.nodes,node:Sn.node,size:Sn.size,empty:Sn.empty,each:Sn.each,on:function(t,e){var n=this._id;return arguments.length<2?te(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)?Jt:Qt;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=P(t),r="transform"===n?ce:nn;return this.attrTween(t,"function"==typeof e?(n.local?cn:ln)(n,r,he(this,"attr."+t,e)):null==e?(n.local?on:rn)(n):(n.local?un:an)(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=P(t);return this.tween(n,(r.local?sn:fn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?le:nn;return null==e?this.styleTween(t,function(t,e){var n,r,o;return function(){var i=B(this,t),a=(this.style.removeProperty(t),B(this,t));return i===a?null:i===n&&a===r?o:o=e(n=i,r=a)}}(t,r)).on("end.style."+t,bn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,o,i;return function(){var a=B(this,t),u=n(this),l=u+"";return null==u&&(this.style.removeProperty(t),l=u=B(this,t)),a===l?null:a===r&&l===o?i:(o=l,i=e(r=a,u))}}(t,r,he(this,"style."+t,e))).each(function(t,e){var n,r,o,i,a="style."+e,u="end."+a;return function(){var l=Qt(this,t),c=l.on,s=null==l.value[a]?i||(i=bn(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=B(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}}(he(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=te(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?se:fe)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?hn:yn)(e,t)):te(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?vn:pn)(e,t)):te(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(){Qt(this,t).ease=e}}(e,t)):te(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;Qt(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=Qt(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]:Sn[Symbol.iterator]};var xn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function _n(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}mt.prototype.interrupt=function(t){return this.each(function(){ee(this,t)})},mt.prototype.transition=function(t){var e,n;t instanceof gn?(e=t._id,t=t._name):(e=wn(),(n=xn).time=Gt(),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])&&Kt(a,t,e,c,u,n||_n(a,e));return new gn(r,this._parents,t,e)};const On=t=>()=>t;function jn(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 Pn(t,e,n){this.k=t,this.x=e,this.y=n}Pn.prototype={constructor:Pn,scale:function(t){return 1===t?this:new Pn(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Pn(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 Cn=new Pn(1,0,0);function kn(t){t.stopImmediatePropagation()}function Tn(t){t.preventDefault(),t.stopImmediatePropagation()}function An(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function En(){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 Mn(){return this.__zoom||Cn}function zn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Rn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fn(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 In(t){return In="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},In(t)}function Bn(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 Ln(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,Nn(r.key),r)}}function Nn(t){var e=function(t){if("object"!=In(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=In(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==In(e)?e:e+""}Pn.prototype;var Dn=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=Cn;(function(){var t,e,n,r=An,o=En,i=Fn,a=zn,u=Rn,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],s=250,f=Tt,h=jt("start","zoom","end"),y=0,v=10;function p(t){t.property("__zoom",Mn).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",O).filter(u).on("touchstart.zoom",j).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",C).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 Pn(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 Pn(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 Pn(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 S(t,e)}function S(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=o.apply(t,e),this.taps=0}function x(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=At(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)],ee(this),n.start()}Tn(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 _(t,...e){if(!n&&r.apply(this,arguments)){var o=t.currentTarget,a=w(this,e,!0).event(t),u=gt(t.view).on("mousemove.zoom",function(t){if(Tn(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]=At(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=gt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Ct,Pt),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),Tn(t),a.event(t).end()},!0),l=At(t,o),s=t.clientX,f=t.clientY;!function(t){var e=t.document.documentElement,n=gt(t).on("dragstart.drag",Ct,Pt);"onselectstart"in e?n.on("selectstart.drag",Ct,Pt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),kn(t),a.mouse=[l,this.__zoom.invert(l)],ee(this),a.start()}}function O(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=At(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);Tn(t),s>0?gt(this).transition().duration(s).call(g,f,a,t):gt(this).call(p.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(kn(n),a=0;a<s;++a)l=[l=At(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)),ee(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(Tn(t),n=0;n<s;++n)o=At(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],v=u.touch1[1],p=(p=y[0]-f[0])*p+(p=y[1]-f[1])*p,m=(m=v[0]-h[0])*m+(m=v[1]-h[1])*m;r=d(r,Math.sqrt(p/m)),o=[(f[0]+y[0])/2,(f[1]+y[1])/2],a=[(h[0]+v[0])/2,(h[1]+v[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 C(t,...r){if(this.__zooming){var o,i,a=w(this,r).event(t),u=t.changedTouches,l=u.length;for(kn(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=At(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<v)){var c=gt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return p.transform=function(t,e,n,r){var o=t.selection?t.selection():t;o.property("__zoom",Mn),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()})},p.scaleBy=function(t,e,n,r){p.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)},n,r)},p.scaleTo=function(t,e,n,r){p.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)},p.translateBy=function(t,e,n,r){p.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)},p.translateTo=function(t,e,n,r,a){p.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(Cn.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)},S.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=gt(this.that).datum();h.call(t,this.that,new jn(t,{sourceEvent:this.sourceEvent,target:p,type:t,transform:this.that.__zoom,dispatch:h}),e)}},p.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:On(+t),p):a},p.filter=function(t){return arguments.length?(r="function"==typeof t?t:On(!!t),p):r},p.touchable=function(t){return arguments.length?(u="function"==typeof t?t:On(!!t),p):u},p.extent=function(t){return arguments.length?(o="function"==typeof t?t:On([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),p):o},p.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],p):[l[0],l[1]]},p.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],p):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},p.constrain=function(t){return arguments.length?(i=t,p):i},p.duration=function(t){return arguments.length?(s=+t,p):s},p.interpolate=function(t){return arguments.length?(f=t,p):f},p.on=function(){var t=h.on.apply(h,arguments);return t===h?p:t},p.clickDistance=function(t){return arguments.length?(y=(t=+t)*t,p):Math.sqrt(y)},p.tapDistance=function(t){return arguments.length?(v=+t,p):v},p})().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.canvasSave.view={x:n.view.x,y:n.view.y,z:n.view.z},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)})(gt(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 Bn(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)?Bn(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;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?this._drawSnapshot():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(){this.canvasSave.c&&this._drawSnapshot()}},{key:"_drawSnapshot",value:function(){var t=this.canvasSave.view,e=t?t.z/this.view.z:1,n=t?(t.x-.5*this.w*t.z-this.view.x)/this.view.z+.5*this.w:0,r=t?.5*this.h-(t.y+.5*this.h*t.z-this.view.y)/this.view.z:0;this.canvasSave.f=e,this.canvasSave.dx=n,this.canvasSave.dy=r,this.clear(this.backgroundColor),this.offscreenCtx.drawImage(this.canvasSave.c,n,r,e*this.canvasSave.c.width,e*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:"getWebGLTransformCentered",value:function(){return[2/(this.w*this.view.z),0,0,0,2/(this.h*this.view.z),0,0,0,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&&Ln(e.prototype,n),r&&Ln(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function Gn(t){return Gn="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},Gn(t)}function Un(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Wn(r.key),r)}}function Wn(t){var e=function(t){if("object"!=Gn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Gn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Gn(e)?e:e+""}var Hn=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||"1rem",this.color=e.color||"#171a22",this.lineHeight=e.lineHeight||"1.5",this.background=e.background||"white",this.padding=e.padding||"4px",this.border=e.border||"1px solid #d5d5d5",this["border-radius"]=e["border-radius"]||"6px",this["box-shadow"]=e["box-shadow"]||"0px 4px 6px rgba(0, 0, 0, 0.1), 0px 1px 3px rgba(0, 0, 0, 0.08)",this["font-family"]=e["font-family"]||"'Helvetica Neue', Arial, Helvetica, 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?gt(e.tooltipElement):gt(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("color",this.color),this.tooltip.style("line-height",this.lineHeight),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.classed("gridviz-tooltip",!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&&Un(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Yn(t){return Yn="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},Yn(t)}function $n(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 Vn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Xn(r.key),r)}}function qn(t,e,n){return(e=Xn(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xn(t){var e=function(t){if("object"!=Yn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yn(e)?e:e+""}var Zn=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(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=gt("#"+e.id)),this.div&&!this.div.empty()||(this.div=gt(document.createElement("div")),e.id&&this.div.attr("id",e.id)),e.title&&this.div.attr("title",e.title),this.div.classed("gridviz-button",!0),e.class){var n,r=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 $n(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)?$n(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}}}}(String(e.class).split(/\s+/));try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&this.div.classed(o,!0)}}catch(t){r.e(t)}finally{r.f()}}e.onClickFunction&&this.div.on("click",e.onClickFunction),this.style("box-sizing","border-box"),this.style("box-shadow","none"),this.style("background-color",t.BACKGROUND),this.style("border","1px solid var(--gridviz-button-border-color, #0e47cb)"),this.style("border-radius","var(--gridviz-button-radius, 10px)"),this.style("color","var(--gridviz-button-color, #0e47cb)"),this.style("overflow","hidden"),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","var(--gridviz-button-size, 38px)"),this.style("height","var(--gridviz-button-size, 38px)"),this.parentNode.appendChild(this.div.node())},(e=[{key:"style",value:function(t,e){return this.div.style(t,e),this}}])&&Vn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Kn(t){return Kn="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},Kn(t)}function Jn(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,Qn(r.key),r)}}function Qn(t){var e=function(t){if("object"!=Kn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Kn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kn(e)?e:e+""}function tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tr=function(){return!!t})()}function er(t){return er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},er(t)}function nr(t,e){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nr(t,e)}qn(Zn,"BACKGROUND","var(--gridviz-button-background, #ffffff)"),qn(Zn,"HOVER_BACKGROUND","var(--gridviz-button-hover-background, #f4f4f4)");var rr=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=er(e),function(t,e){if(e&&("object"==Kn(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,tr()?Reflect.construct(e,n||[],er(t).constructor):e.apply(t,n))}(this,e,[t])).onZoom=t.onZoom,n.delta=t.delta||.2,n.div.classed("gridviz-zoom-buttons",!0),n.zoomInBtn=document.createElement("a"),n.zoomInBtn.id="zoom-in",n.zoomInBtn.className="gridviz-zoom-button gridviz-zoom-button--in",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=Zn.HOVER_BACKGROUND}),n.zoomInBtn.addEventListener("mouseout",function(){n.zoomInBtn.style.backgroundColor=Zn.BACKGROUND}),n.zoomOutBtn=document.createElement("a"),n.zoomOutBtn.id="zoom-out",n.zoomOutBtn.className="gridviz-zoom-button gridviz-zoom-button--out",n.zoomOutBtn.title="Zoom out",n.zoomOutBtn.textContent=String.fromCharCode(8722),n.zoomOutBtn.addEventListener("click",function(t){n.zoomOut(t)}),n.zoomOutBtn.addEventListener("mouseover",function(){n.zoomOutBtn.style.backgroundColor=Zn.HOVER_BACKGROUND}),n.zoomOutBtn.addEventListener("mouseout",function(){n.zoomOutBtn.style.backgroundColor=Zn.BACKGROUND}),[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="var(--gridviz-button-color, #0e47cb)",t.style.fontFamily="'Helvetica Neue', Arial, Helvetica, sans-serif",t.style.textAlign="center",t.style.textDecoration="none",t.style.padding="0",t.style.boxSizing="border-box",t.style.width="calc(var(--gridviz-button-size, 38px) - 2px)",t.style.height="calc(var(--gridviz-button-size, 38px) - 2px)",t.style.fontSize="22px",t.style.fontWeight="bold",t.style.userSelect="none",t.style.backgroundColor=Zn.BACKGROUND,0===e&&(t.style.borderBottom="1px solid #ccc")}),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&&nr(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&&Jn(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Zn);function or(t){return or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},or(t)}function ir(t,e){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,cr(r.key),r)}}function ar(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ar=function(){return!!t})()}function ur(t){return ur=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ur(t)}function lr(t,e){return lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},lr(t,e)}function cr(t){var e=function(t){if("object"!=or(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=or(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==or(e)?e:e+""}var sr=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=ur(e),function(t,e){if(e&&("object"==or(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,ar()?Reflect.construct(e,n||[],ur(t).constructor):e.apply(t,n))}(this,e,[t]),r=n,i=!1,(o=cr(o="isFullscreen"))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,n.div.classed("gridviz-fullscreen-button",!0),n.div.node().innerHTML='\n <svg\n class="gridviz-fullscreen-icon"\n style="height: 20px; width: 20px; fill: currentColor; margin:0;"\n focusable="false"\n aria-hidden="true"\n >\n <svg fill="currentColor" 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",Zn.HOVER_BACKGROUND)}),n.div.on("mouseout",function(t){n.style("background-color",Zn.BACKGROUND)}),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&&lr(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()}}])&&ir(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Zn);function fr(t){return fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fr(t)}function hr(t,e){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 yr(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)?yr(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 yr(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 vr(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,pr(r.key),r)}}function pr(t){var e=function(t){if("object"!=fr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fr(e)?e:e+""}function dr(t){return t.cell.x+","+t.cell.y+","+t.resolution}var br=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=!1!==n.asyncRedraw,this._redrawFrame=null,this.container=e||document.getElementById("gridviz"),this.container){this.container.classList.add("gridviz-map"),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 Dn(this._canvas,n.x,n.y,n.z,n),this.geoCanvas.redraw=function(){r.redraw()},this.geoCanvas.cancelCurrentRequests=function(){var t,e=hr(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=hr(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?gt(n.legendContainer):null,this._legendProvidedByUser=!!n.legendContainer,this.onLegendUpdate=n.onLegendUpdate,this.legend||this.initialiseLegend(),n.tooltip||(n.tooltip={}),n.tooltip.parentElement||(n.tooltip.parentElement=this.container),this.tooltip=new Hn(n.tooltip),this.digForTooltip=n.digForTooltip||!1,this._focusFrame=null,this._focusEvent=null,this._lastMouseEvent=null,this._hovering=!1,this._hoverKey=null,this._refocusing=!1,this._hoverSource=null,this._triedKey=null,this._triedSource=null,this._pointer=null,this._pointerHandler=function(t){r._pointer={clientX:t.clientX,clientY:t.clientY}},this._pointerLeaveHandler=function(t){t.relatedTarget||(r._pointer=null)};for(var o=0,i=["mousemove","mousedown","wheel"];o<i.length;o++){var a=i[o];window.addEventListener(a,this._pointerHandler,{capture:!0,passive:!0})}window.addEventListener("mouseout",this._pointerLeaveHandler,{capture:!0,passive:!0});var u=function(t){r._lastMouseEvent=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=u,this.mouseMoveHandler=u,this.mouseOutHandler=function(t){r._focusFrame&&cancelAnimationFrame(r._focusFrame),r._focusFrame=null,r._focusEvent=null,r._lastMouseEvent=null,r._hovering=!1,r._hoverKey=null,r._hoverSource=null,r._triedKey=null,r._triedSource=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._hovering=!1,r._hoverKey=null,r._hoverSource=null,r._triedKey=null,r._triedSource=null,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.classList.add("gridviz-canvas"),t.setAttribute("width",""+this.w),t.setAttribute("height",""+this.h),this.container.appendChild(t),t}},{key:"initialiseLegend",value:function(){this.legend=gt(this.container).append("div").attr("id","gridviz-legend").classed("gridviz-legends",!0).style("position","absolute").style("width","auto").style("height","auto").style("background","#FFFFFF").style("border","1px solid #d5d5d5").style("border-radius","6px").style("box-shadow","0px 4px 6px rgba(0, 0, 0, 0.1), 0px 1px 3px rgba(0, 0, 0, 0.08)").style("font-family","'Helvetica Neue', Arial, Helvetica, 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(":scope > *:not([data-gridviz-hovered])").remove(),this.legend.node()._gridvizLegendCursor=null),this.geoCanvas.initCanvasTransform(),this.geoCanvas.clear(this.geoCanvas.backgroundColor);var t=this.geoCanvas.view.z;this.updateExtentGeo();var e,n=this.geoCanvas.offscreenCtx,r=hr(this.layers);try{for(r.s();!(e=r.n()).done;){var o=e.value;i(o,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()}if(this.geoCanvas.initCanvasTransform(),this.geoCanvas.ctx.drawImage(this.geoCanvas.offscreenCanvas,0,0),this.canvasSave=null,this._focusedCell=void 0,!this._refocusing&&!this.geoCanvas._isZooming){var a=this.pointerEvent()||(this._hovering?this._lastMouseEvent:null);if(a){this._refocusing=!0;try{this.refocusCell(a)}finally{this._refocusing=!1}}}return this.onLegendUpdate&&this.legend&&this.onLegendUpdate(this.legend.node()),this}},{key:"updateExtentGeo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.geoCanvas.updateExtentGeo(t)}},{key:"mousePositionGeo",value:function(t){return{x:this.geoCanvas.pixToGeoX(t.offsetX+this.tooltip.xMouseOffset),y:this.geoCanvas.pixToGeoY(t.offsetY+this.tooltip.yMouseOffset)}}},{key:"pointerEvent",value:function(){var t=this._pointer;if(!t)return null;var e=this.geoCanvas.canvas,n=e.getBoundingClientRect();if(t.clientX<n.left||t.clientX>=n.right||t.clientY<n.top||t.clientY>=n.bottom)return null;var r=e.getRootNode?e.getRootNode():document;return(r.elementFromPoint?r:document).elementFromPoint(t.clientX,t.clientY)!==e?null:{offsetX:t.clientX-n.left,offsetY:t.clientY-n.top,clientX:t.clientX,clientY:t.clientY}}},{key:"refocusCell",value:function(t){if(!this.geoCanvas._isZooming){var e=this.getCellFocusInfo(this.mousePositionGeo(t),!1);if(!e)return this._triedKey=null,this._triedSource=null,void(this._hovering&&this.focusCell(t));var n=dr(e),r={layer:e.layer,dataset:e.dataset},o=function(t){return t&&t.layer===r.layer&&t.dataset===r.dataset};n===this._hoverKey&&o(this._hoverSource)?this.focusCell(t,e):n===this._triedKey&&o(this._triedSource)||(this.focusCell(t),this._triedKey=n,this._triedSource=r)}}},{key:"focusCell",value:function(t,e){if(!this.geoCanvas._isZooming){e||this._refocusing||(this._triedKey=null,this._triedSource=null);var n=e||this.getCellFocusInfo(this.mousePositionGeo(t)),r=n?n.cell:null;if(this._hovering=!!n,this._hoverKey=n?dr(n):null,this._hoverSource=n?{layer:n.layer,dataset:n.dataset}:null,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){void 0!==n.html&&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",void 0!==n.html&&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=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.geoCanvas.view.z,r=this.layers.length-1;r>=0;r--){var o=this.layers[r];if(i(o,n)&&"none"!==o.cellInfoHTML&&o.cellInfoHTML&&o.getDataset){var a=o.getDataset(n);if(a){var u=a.getCellFromPosition(t,a.getViewCache());if(!u){if(this.digForTooltip)continue;return}if(a.mixedResolution){var l=+a.mixedResolution(u),c=e?o.cellInfoHTML(u,l):void 0;if(e&&!c)return;return{cell:u,html:c,resolution:l,layer:o,dataset:a}}var s=e?o.cellInfoHTML(u,a.getResolution()):void 0;if(e&&!s)return;return{cell:u,html:s,resolution:a.getResolution(),layer:o,dataset:a}}}}}},{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 rr({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 sr({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;for(var n=0,r=["mousemove","mousedown","wheel"];n<r.length;n++){var o=r[n];window.removeEventListener(o,this._pointerHandler,{capture:!0})}window.removeEventListener("mouseout",this._pointerLeaveHandler,{capture:!0}),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&&vr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function mr(t){return mr="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},mr(t)}function gr(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 wr(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)?wr(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 wr(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 Sr(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,xr(r.key),r)}}function xr(t){var e=function(t){if("object"!=mr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=mr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mr(e)?e:e+""}function _r(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_r=function(){return!!t})()}function Or(t){return Or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Or(t)}function jr(t,e){return jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jr(t,e)}var Pr=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=Or(e),function(t,e){if(e&&("object"==mr(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,_r()?Reflect.construct(e,n||[],Or(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.highlightColors=null,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&&jr(t,e)}(e,t),n=e,o=[{key:"normalizeColor",value:function(t){var n=e._normalizedColors.get(t);if(void 0===n){var r=Ee(t);n=r?r.formatRgb():String(t),e._normalizedColors.size>1e4&&e._normalizedColors.clear(),e._normalizedColors.set(t,n)}return n}},{key:"updateLegendsRecursive",value:function(t,e){if(Array.isArray(t)){var n,r=gr(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:"setHighlight",value:function(t){return this.highlightColors=t&&t.length?t.map(e.normalizeColor):null,this}},{key:"isHighlighted",value:function(t){return!this.highlightColors||this.highlightColors.includes(e.normalizeColor(t))}},{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 this.highlightColors||e.updateLegendsRecursive(this.legends,t),this}},{key:"addLegends",value:function(t){var e,n=gr(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}}])&&Sr(n.prototype,r),o&&Sr(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(a);function Cr(t){return Cr="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},Cr(t)}function kr(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,Tr(r.key),r)}}function Tr(t){var e=function(t){if("object"!=Cr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Cr(e)?e:e+""}function Ar(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ar=function(){return!!t})()}function Er(t){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(t)}function Mr(t,e){return Mr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Mr(t,e)}Pr._normalizedColors=new Map;var zr=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=Er(e),function(t,e){if(e&&("object"==Cr(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,Ar()?Reflect.construct(e,n||[],Er(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&&Mr(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){throw new Error("Method draw not implemented.")}}])&&kr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(a);function Rr(t){return Rr="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},Rr(t)}function Fr(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)||Br(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 Ir(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Br(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 Br(t,e){if(t){if("string"==typeof t)return Lr(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)?Lr(t,e):void 0}}function Lr(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 Nr(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,Dr(r.key),r)}}function Dr(t){var e=function(t){if("object"!=Rr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Rr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rr(e)?e:e+""}var Gr=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=Ir(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 v=Fr(y[h],2),p=v[0],d=v[1];if(!(p&&l!==s||d&&c!==f)){var b=u.cells.get(Ur(s+p,f+d));if(b)return b}}else{var m,g=Ir(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=Ir(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=Ur(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}}],e&&Nr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Ur(t,e){return 4194304*t+e}function Wr(t){return Wr="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},Wr(t)}function Hr(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 Yr(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,$r(r.key),r)}}function $r(t){var e=function(t){if("object"!=Wr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Wr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wr(e)?e:e+""}var Vr=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 Hr(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)?Hr(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}}])&&Yr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function qr(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function Xr(t,e){return fetch(t,e).then(qr)}var Zr={},Kr={};function Jr(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function Qr(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 to(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function eo(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 Kr;if(c)return c=!1,Zr;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())!==Kr;){for(var f=[];r!==Zr&&r!==Kr;)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?"-"+to(-r,6):r>9999?"+"+to(r,6):to(r,4))+"-"+to(n.getUTCMonth()+1,2)+"-"+to(n.getUTCDate(),2)+(u?"T"+to(o,2)+":"+to(i,2)+":"+to(a,2)+"."+to(u,3)+"Z":a?"T"+to(o,2)+":"+to(i,2)+":"+to(a,2)+"Z":i||o?"T"+to(o,2)+":"+to(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=Jr(t);return function(r,o){return e(n(r),o,t)}}(t,e):Jr(t)});return i.columns=o||[],i},parseRows:r,format:function(e,n){return null==n&&(n=Qr(e)),[n.map(a).join(t)].concat(o(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Qr(t)),o(t,e).join("\n")},formatRows:function(t){return t.map(i).join("\n")},formatRow:i,formatValue:a}}var no=eo(","),ro=no.parse,oo=(no.parseRows,no.format,no.formatBody,no.formatRows,no.formatRow,no.formatValue,eo("\t")),io=oo.parse;function ao(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function uo(t,e){return fetch(t,e).then(ao)}function lo(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),uo(e,n).then(function(e){return t(e,r)})}}function co(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var o=eo(t);return uo(e,n).then(function(t){return o.parse(t,r)})}oo.parseRows,oo.format,oo.formatBody,oo.formatRows,oo.formatRow,oo.formatValue;var so=lo(ro);function fo(t){return fo="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},fo(t)}function ho(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(fo(t)+" is not iterable")}function yo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=vo(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 vo(t,e){if(t){if("string"==typeof t)return po(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)?po(t,e):void 0}}function po(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 bo(){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 mo(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===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<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(mo(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,mo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,mo(f,"constructor",c),mo(c,"constructor",l),l.displayName="GeneratorFunction",mo(c,o,"GeneratorFunction"),mo(f),mo(f,o,"Generator"),mo(f,r,function(){return this}),mo(f,"toString",function(){return"[object Generator]"}),(bo=function(){return{w:i,m:h}})()}function mo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}mo=function(t,e,n,r){function i(e,n){mo(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))},mo(t,e,n,r)}function go(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 wo(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){go(i,r,o,a,u,"next",t)}function u(t){go(i,r,o,a,u,"throw",t)}a(void 0)})}}function So(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,xo(r.key),r)}}function xo(t){var e=function(t){if("object"!=fo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fo(e)?e:e+""}function _o(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_o=function(){return!!t})()}function Oo(t){return Oo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oo(t)}function jo(t,e){return jo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jo(t,e)}lo(io);var Po=new Set,Co=0,ko=function(){return"undefined"!=typeof performance?performance.now():Date.now()},To=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=Oo(e),function(t,e){if(e&&("object"==fo(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,_o()?Reflect.construct(e,n||[],Oo(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&&jo(t,e)}(e,t),n=e,r=[{key:"loadInfo",value:function(){var t=this;return this.info||"notLoaded"!==this.infoLoadingStatus||(this.infoLoadingStatus="loading",wo(bo().m(function e(){var n;return bo().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Xr(t.url+"info.json");case 1:n=e.v,t.info=n,t.resolution=n.resolutionGeo,t.infoLoadingStatus="loaded",t.isShown()&&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:"isShown",value:function(){if(!this.map||!this.map.layers)return!1;var t,e=this.map.getZoom(),n=yo(this.map.layers);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(i(r,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:(a=wo(bo().m(function t(n){var r,o,i,a,u,l,c,s,f,h,y,v,p,d,b=this;return bo().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,r=this.abortController.signal,o=this.getTilingEnvelope(n)){t.n=2;break}return t.a(2,this);case 2:i=this.info.tilingBounds,a=i.xMin,u=i.xMax,l=i.yMin,c=i.yMax,s=Math.max(o.xMin,a),f=Math.min(o.xMax,u),h=Math.max(o.yMin,l),y=Math.min(o.yMax,c),v=[],p=bo().m(function t(n){var o,i;return bo().w(function(t){for(;;)switch(t.n){case 0:o=bo().m(function t(o){var i,a;return bo().w(function(t){for(;;)switch(t.n){case 0:if(b.cache[n]||(b.cache[n]={}),i=b.cache[n][o],a=i&&i.failed&&!i.missing&&ko()-i.failed>=e.retryFailedAfterMs,!i||a){t.n=1;break}return i.cells&&(i.lastUsed=ko()),t.a(2,1);case 1:b.cache[n][o]="loading",v.push(b.loadTile(n,o,r).then(function(t){b.cache[n][o]=t,b._keep(t);var e=!b._anyLoading(s,f,h,y);b.checkAndRedraw(t,e)},function(t){t&&"AbortError"===t.name?delete b.cache[n][o]:(b.cache[n][o]={failed:ko(),missing:/^(404|410)\b/.test(t&&t.message)},b.onlyDrawWhenAllTilesReady&&!b._anyLoading(s,f,h,y)&&b.isShown()&&b.map.redraw())}));case 2:return t.a(2)}},t)}),i=h;case 1:if(!(i<=y)){t.n=4;break}return t.d(ho(o(i)),2);case 2:if(!t.v){t.n=3;break}return t.a(3,3);case 3:i++,t.n=1;break;case 4:return t.a(2)}},t)}),d=s;case 3:if(!(d<=f)){t.n=5;break}return t.d(ho(p(d)),4);case 4:d++,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 a.apply(this,arguments)})},{key:"_anyLoading",value:function(t,e,n,r){for(var o=t;o<=e;o++){var i=this.cache[o];if(i)for(var a=n;a<=r;a++)if("loading"===i[a])return!0}return!1}},{key:"loadTile",value:(o=wo(bo().m(function t(e,n,r){var o,i,a,u=this;return bo().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,so("".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,Ao(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){if(this.isShown())if(this.onlyDrawWhenAllTilesReady)e&&this.map.redraw();else{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.map.redraw()}}},{key:"_keep",value:function(t){if(t&&"object"===fo(t)&&t.cells&&(t.lastUsed=ko(),t.owner=this,Po.add(t),!((Co+=t.cells.length)<=e.maxCachedCells))){var n,r=ko()-3e3,o=function(t){return function(t){if(Array.isArray(t))return po(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||vo(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Po).filter(function(t){return t.lastUsed<r}).sort(function(t,e){return t.lastUsed-e.lastUsed}),i=yo(o);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(Co<=e.maxCachedCells)break;a.owner._drop(a)}}catch(t){i.e(t)}finally{i.f()}}}},{key:"_drop",value:function(t){var e=this.cache[t.x];e&&e[t.y]===t&&(delete e[t.y],Object.keys(e).length||delete this.cache[t.x]),Po.delete(t)&&(Co-=t.cells.length),t.owner=void 0,t.cells=[]}},{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&&i.cells){i.lastUsed=ko();var a,u=yo(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&&So(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,a}(Gr);function Ao(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=yo(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 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 Mo(){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 zo(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===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<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(zo(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,zo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,zo(f,"constructor",c),zo(c,"constructor",l),l.displayName="GeneratorFunction",zo(c,o,"GeneratorFunction"),zo(f),zo(f,o,"Generator"),zo(f,r,function(){return this}),zo(f,"toString",function(){return"[object Generator]"}),(Mo=function(){return{w:i,m:h}})()}function zo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}zo=function(t,e,n,r){function i(e,n){zo(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))},zo(t,e,n,r)}function Ro(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 Fo(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)?Fo(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 Fo(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 Io(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 Bo(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,Lo(r.key),r)}}function Lo(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 No(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(No=function(){return!!t})()}function Do(t){return Do=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Do(t)}function Go(t,e){return Go=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Go(t,e)}To.maxCachedCells=15e5,To.retryFailedAfterMs=3e4;var Uo=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=Do(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,No()?Reflect.construct(e,n||[],Do(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&&Go(t,e)}(e,t),n=e,r=[{key:"getData",value:function(t){var e,n=this;return"notLoaded"!=this.infoLoadingStatus||(this.infoLoadingStatus="loading",(e=Mo().m(function t(){var e,r,o,i,a,u,l,c;return Mo().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,co(n.delimiter,n.url);case 1:e=t.v,r=Ro(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=Ro(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){Io(i,r,o,a,u,"next",t)}function u(t){Io(i,r,o,a,u,"throw",t)}a(void 0)})})()),this}},{key:"updateViewCache",value:function(t){if(this.cells){this.cellsViewCache=[];var e,n=Ro(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&&Bo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Gr);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 Ho(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,$o(r.key),r)}}function $o(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+""}function Vo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Vo=function(){return!!t})()}function qo(t){return qo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qo(t)}function Xo(t,e){return Xo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xo(t,e)}var Zo=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=qo(e),function(t,e){if(e&&("object"==Wo(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,Vo()?Reflect.construct(e,n||[],qo(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&&Xo(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 Ho(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)?Ho(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()}}}}])&&Yo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Gr);function Ko(t){return Ko="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},Ko(t)}function Jo(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 Qo(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"!=Ko(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ko(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ko(e)?e:e+""}function ei(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ei=function(){return!!t})()}function ni(t){return ni=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ni(t)}function ri(t,e){return ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ri(t,e)}var oi=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=ni(e),function(t,e){if(e&&("object"==Ko(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,ei()?Reflect.construct(e,n||[],ni(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.donutOuterSize=t.donutOuterSize,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&&ri(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=this.highlightColors,l="function"==typeof this.color,c="function"==typeof this.size,s="function"==typeof this.shape,f=this.color||"black",h=this.size||n,y=this.shape||"square",v=l?this.color:null,p=c?this.size:null,d=s?this.shape:null,b=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 Jo(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)?Jo(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(b.s();!(r=b.n()).done;){var m=r.value,g=v?v(m,n,o,i):f;if(g&&"none"!==g&&(!u||this.isHighlighted(g))){var w=p?p(m,n,o,i):h;if(w){var S=d?d(m,n,o,i):y;if("none"!==S){var x=this.offset(m,n,o),_=e.offscreenCtx;if(_.fillStyle=g,"square"===S){var O=n*(1-w/n)*.5;_.fillRect(m.x+O+x.dx,m.y+O+x.dy,w,w)}else if("circle"===S)_.beginPath(),_.arc(m.x+a+x.dx,m.y+a+x.dy,.5*w,0,2*Math.PI,!1),_.fill();else if("donut"===S){var j=m.x+a+x.dx,P=m.y+a+x.dy,C=void 0===this.donutOuterSize?n:"function"==typeof this.donutOuterSize?this.donutOuterSize(m,n,o,i):this.donutOuterSize;if(!C)continue;var k=.5*C;_.beginPath(),_.moveTo(j,P),_.arc(j,P,k,0,2*Math.PI),_.arc(j,P,Math.max(0,1-w/C)*k,0,2*Math.PI,!0),_.closePath(),_.fill()}else if("diamond"===S){var T=.5*w;_.beginPath(),_.moveTo(m.x+a-T,m.y+a),_.lineTo(m.x+a,m.y+a+T),_.lineTo(m.x+a+T,m.y+a),_.lineTo(m.x+a,m.y+a-T),_.fill()}else if("triangle_up"===S){var A=(w-n)/2;_.beginPath(),_.moveTo(m.x-A,m.y-A),_.lineTo(m.x+a,m.y+n+A),_.lineTo(m.x+n+A,m.y-A),_.fill()}else if("triangle_down"===S){var E=(w-n)/2;_.beginPath(),_.moveTo(m.x-E,m.y+n+E),_.lineTo(m.x+a,m.y-E),_.lineTo(m.x+n+E,m.y+n+E),_.fill()}else if("triangle_left"===S){var M=(w-n)/2;_.beginPath(),_.moveTo(m.x+n+M,m.y+n+M),_.lineTo(m.x-M,m.y+a),_.lineTo(m.x+n+M,m.y-M),_.fill()}else{if("triangle_right"!==S)throw new Error("Unexpected shape:"+S);var z=(w-n)/2;_.beginPath(),_.moveTo(m.x-z,m.y-z),_.lineTo(m.x+n+z,m.y+a),_.lineTo(m.x-z,m.y+n+z),_.fill()}}}}}}catch(t){b.e(t)}finally{b.f()}this.updateLegends({viewScale:i,resolution:n,z:o,cells:t})}}],r&&Qo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function ii(t){return ii="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},ii(t)}function ai(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){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"!=ii(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ii(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ii(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"==ii(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]),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&&fi(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 ai(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)?ai(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 v=this.offset(c,n,o);if("square"===y){var p=n*(1-f/n)*.5;i.beginPath(),i.rect(c.x+p+v.dx,c.y+p+v.dy,f,f),i.stroke()}else if("circle"===y)i.beginPath(),i.arc(c.x+u+v.dx,c.y+u+v.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,cells:t})}}],r&&ui(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function yi(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 vi(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)||di(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 pi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=di(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 di(t,e){if(t){if("string"==typeof t)return bi(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)?bi(t,e):void 0}}function bi(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 mi(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=pi(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 gi(t,e,n){var r=yi(t,function(t){return t.x}),o=vi(r,2),i=o[0],a=o[1],u=yi(t,function(t){return t.y}),l=vi(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 v,p=pi(t);try{for(p.s();!(v=p.n()).done;){var d=v.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){p.e(t)}finally{p.f()}return y}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 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,xi(r.key),r)}}function xi(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+""}function _i(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_i=function(){return!!t})()}function Oi(t){return Oi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oi(t)}function ji(t,e){return ji=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ji(t,e)}var Pi=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=Oi(e),function(t,e){if(e&&("object"==wi(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,_i()?Reflect.construct(e,n||[],Oi(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&&ji(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=pi(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 v=h;v>=f;v-=n){var p=u[v];if(p){i.beginPath(),i.moveTo(c-n/2,v);for(var d=void 0,b=c;b<=s;b+=n){var m=p[b];m||(m=0),m||d?i.lineTo(b+n/2,v+m):i.moveTo(b+n/2,v),d=m}d&&i.lineTo(s+n/2,v);var g=this.fillColor(v,y,n,o);g&&"none"!=g&&(i.fillStyle=g,i.fill());var w=this.lineColor(v,y,n,o),S=this.lineWidth(v,y,n,o);w&&"none"!=w&&S>0&&(i.strokeStyle=w,i.lineWidth=S,i.stroke())}}}}}],r&&Si(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);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 ki(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)||Ti(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 Ti(t,e){if(t){if("string"==typeof t)return Ai(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)?Ai(t,e):void 0}}function Ai(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 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,Mi(r.key),r)}}function Mi(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 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 Fi(t,e){return Fi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fi(t,e)}var Ii=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=Ri(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,zi()?Reflect.construct(e,n||[],Ri(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&&Fi(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=Ti(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),v=c.y+f.dy+("agepyramid"===h?0:.5*n),p=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+p);var S="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===S)throw new Error("Unexpected symbol type:"+h);for(var x=0,_=Object.entries(this.color);x<_.length;x++){var O=ki(_[x],2),j=O[0],P=O[1];if("agepyramid"===h){i.fillStyle=P;var C=s*c[j]/d;i.fillRect(y+(n-C)/2,v+w,C,S),w+=S}else if("radar"===h){i.fillStyle=P;var k=c[j],T=s/2*Math.sqrt(k/d);i.beginPath(),i.moveTo(y,v),i.arc(y,v,T,w-S,w),i.lineTo(y,v),i.fill(),w+=S}else{if("halftone"!==h)throw new Error("Unexpected symbol type:"+h);i.fillStyle=P;var A=c[j],E=.333*s*Math.sqrt(A/d);i.beginPath(),i.arc(y+.25*n*Math.cos(w),v+.25*n*Math.sin(w),E,0,2*Math.PI),i.fill(),w+=S}}}else{for(var M=0,z=0,R=Object.keys(this.color);z<R.length;z++){var F=+c[R[z]];F&&(M+=F)}if(!M||isNaN(M))continue;for(var I=0,B=n*(1-s/n)*.5,L=this.stripesOrientation(c,n,o,a),N=0,D=Object.entries(this.color);N<D.length;N++){var G=ki(D[N],2),U=G[0],W=G[1],H=c[U]/M;if(H&&!isNaN(H)){if(i.fillStyle=W,"flag"===h)0==L?i.fillRect(c.x+B+f.dx,c.y+B+I*s+f.dy,s,H*s):i.fillRect(c.x+B+I*s+f.dx,c.y+B+f.dy,H*s,s);else if("piechart"===h){var Y=2*I*Math.PI,$=2*(I+H)*Math.PI;i.beginPath(),i.moveTo(y,v),i.arc(y,v,.5*s,Y+p,$+p),this.pieChartInternalRadiusFactor&&i.arc(y,v,.5*s*this.pieChartInternalRadiusFactor,Y+p,$+p,!0),i.closePath(),i.fill()}else if("ring"===h)i.beginPath(),i.arc(y,v,Math.sqrt(1-I)*s*.5,0,2*Math.PI),i.fill();else{if("segment"!==h)throw new Error("Unexpected symbol type:"+h);var V=s*s/n;0==L?i.fillRect(c.x+f.dx,c.y+(n-V)/2+I*V+f.dy,n,H*V):i.fillRect(c.x+I*n+f.dx,c.y+(n-V)/2+f.dy,H*n,V)}I+=H}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a,cells:t})}}],r&&Ei(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);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 Li(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 Ni(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,Di(r.key),r)}}function Di(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 Gi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gi=function(){return!!t})()}function Ui(t){return Ui=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ui(t)}function Wi(t,e){return Wi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wi(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=Ui(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,Gi()?Reflect.construct(e,n||[],Ui(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&&Wi(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 Li(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)?Li(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 v=this.offset(c,n,r);o.strokeStyle=s,o.lineWidth=f;var p=c.x+n/2+v.dx,d=c.y+n/2+v.dy,b=.5*Math.cos(y)*h,m=.5*Math.sin(y)*h;o.beginPath(),o.moveTo(p-b,d-m),o.lineTo(p+b,d+m),o.stroke()}}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({viewScale:i,resolution:n,z:r,cells:t})}}],r&&Ni(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);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 $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 Vi(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"!=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+""}function Xi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xi=function(){return!!t})()}function Zi(t){return Zi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zi(t)}function Ki(t,e){return Ki=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ki(t,e)}var Ji=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=Zi(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,Xi()?Reflect.construct(e,n||[],Zi(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&&Ki(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 $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}}}}(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 v=this.offset(l,n,r);o.textAlign="center";var p=e.geoToPixX(l.x+.5*n+v.dx),d=e.geoToPixY(l.y+.5*n+v.dy)+.3*f;o.fillText(c,p,d)}}}}}catch(t){u.e(t)}finally{u.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i,cells:t})}}],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&&Vi(n.prototype,r),o&&Vi(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Pr);function Qi(t){return Qi="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},Qi(t)}function ta(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 ea(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)?ea(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 ea(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 na(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,ra(r.key),r)}}function ra(t){var e=function(t){if("object"!=Qi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Qi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qi(e)?e:e+""}function oa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(oa=function(){return!!t})()}function ia(t){return ia=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ia(t)}function aa(t,e){return aa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},aa(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=ia(e),function(t,e){if(e&&("object"==Qi(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,oa()?Reflect.construct(e,n||[],ia(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&&aa(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=ta(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 v=this.height?this.height(h,n,r,i):void 0;if(v&&!(v<0)){o.lineWidth=y;var p=h.x+n/2,d=h.y+n/2,b=v*this.shadowFactor;o.beginPath(),o.moveTo(p,d),o.lineTo(p+b*Math.cos(this.shadowDirection),d+b*Math.sin(this.shadowDirection)),o.stroke()}}}}catch(t){f.e(t)}finally{f.f()}var m,g=ta(t);try{for(g.s();!(m=g.n()).done;){var w=m.value,S=this.color?this.color(w,n,r,i):void 0;if(S){var x=this.width?this.width(w,n,r,i):void 0;if(x&&!(x<0)){var _=this.height?this.height(w,n,r,i):void 0;if(_&&!(_<0)){var O=w.x+n/2,j=w.y+n/2,P=O-a,C=j-u,k=Math.atan2(C,P),T=Math.sqrt(P*P+C*C)*_/(l-_);c?(o.strokeStyle=S,o.lineWidth=x,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=x+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=S,o.lineWidth=x,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*x,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,cells:t})}}],r&&na(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function la(t){return la="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},la(t)}function ca(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 sa(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,fa(r.key),r)}}function fa(t){var e=function(t){if("object"!=la(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=la(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==la(e)?e:e+""}function ha(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ha=function(){return!!t})()}function ya(t){return ya=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ya(t)}function va(t,e){return va=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},va(t,e)}var pa=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=ya(e),function(t,e){if(e&&("object"==la(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,ha()?Reflect.construct(e,n||[],ya(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&&va(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 ca(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)?ca(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,v=f.y;i.beginPath(),i.moveTo(y-c,v),i.lineTo(y,v+c),i.lineTo(y+c,v),i.lineTo(y,v-c),i.closePath(),i.fill()}else{var p=this.width?this.width(f,r,o,u):void 0;if(!p||p<=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=p,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,cells:t})}}}],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&&sa(n.prototype,r),o&&sa(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Pr),da=new Map;function ba(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=JSON.stringify(n||{}),o=da.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,da.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 ma=new WeakMap;function ga(t){var e=ma.get(t);return e||(e={programs:new Map,buffers:new Map,owners:new Map},ma.set(t,e)),e}function wa(t,e,n){var r=ga(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,_a(t,t.VERTEX_SHADER,e),_a(t,t.FRAGMENT_SHADER,n)),r.set(o,i)),i}function Sa(t,e){var n=ga(t).buffers,r=n.get(e);return r||(r=t.createBuffer(),n.set(e,r)),r}function xa(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=ga(t).owners;return void 0!==n&&r.set(e,n),r.get(e)}function _a(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 Oa(t,e){var n=t.getParameter(t.ALIASED_POINT_SIZE_RANGE),r=n?n[1]:1;return e>Math.min(r,24)}var ja=[-1,-1,1,-1,1,1,-1,-1,1,1,-1,1];function Pa(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=new Float32Array(12*e),o=new Float32Array(12*e),i=n.map(function(){return new Float32Array(6*e)}),a=0;a<e;a++)for(var u=0;u<6;u++){var l=12*a+2*u;r[l]=t[2*a],r[l+1]=t[2*a+1],o[l]=ja[2*u],o[l+1]=ja[2*u+1];for(var c=0;c<n.length;c++)i[c][6*a+u]=n[c][a]}return{positions:r,corners:o,values:i}}function Ca(t){return Ca="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},Ca(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,Ta(r.key),r)}}function Ta(t){var e=function(t){if("object"!=Ca(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ca(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ca(e)?e:e+""}function Aa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Aa=function(){return!!t})()}function Ea(t){return Ea=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ea(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="SquareColorCategoryWebGLStyle.pos",Ra="SquareColorCategoryWebGLStyle.i",Fa="SquareColorCategoryWebGLStyle.corner",Ia=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=Ea(e),function(t,e){if(e&&("object"==Ca(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||[],Ea(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.asTriangles=!1,n.x=void 0,n.y=void 0,n.z=void 0,n.cellsNb=void 0,n.highlightKey="",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:"init",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.cvWGL=ba(t,e);var r=this.cvWGL.gl,o=this.gl!==r;return o&&(this.gl=r,this.lutTexture=void 0),this.program=wa(r,n?"\n attribute vec2 pos;\n attribute vec2 corner;\n uniform float halfSizeGeo;\n uniform mat3 mat;\n attribute float i;\n varying float vi;\n void main() {\n gl_Position = vec4(mat * vec3(pos + corner * halfSizeGeo, 1.0), 1.0);\n vi = i;\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 }"),r.useProgram(this.program),this.bindColors(),o}},{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=Ee(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,o){for(var i,a=this,u=arguments.length>5&&void 0!==arguments[5]&&arguments[5],l=this.cvWGL.gl,c=e/2,s=o.x,f=o.y,h=t.length,y=new Float32Array(2*h),v=new Float32Array(h),p=this.highlightColors?this.colors.map(function(t){return a.isHighlighted(t)}):null,d=0,b=0;b<h;b++){i=t[b];var m=this.code(i,e,n,r);if(null!=m){var g=this.catToI[m];isNaN(+g)?console.log("Unexpected category index: "+m+" "+g):p&&!p[+g]||(y[2*d]=i.x+c-s,y[2*d+1]=i.y+c-f,v[d]=+g,d++)}}var w=y.subarray(0,2*d),S=v.subarray(0,d);if(u){var x=Pa(w,d,[S]);w=x.positions,S=x.values[0],l.bindBuffer(l.ARRAY_BUFFER,Sa(l,Fa)),l.bufferData(l.ARRAY_BUFFER,x.corners,l.DYNAMIC_DRAW)}return l.bindBuffer(l.ARRAY_BUFFER,Sa(l,za)),l.bufferData(l.ARRAY_BUFFER,w,l.DYNAMIC_DRAW),l.bindBuffer(l.ARRAY_BUFFER,Sa(l,Ra)),l.bufferData(l.ARRAY_BUFFER,S,l.DYNAMIC_DRAW),xa(l,za,this),d}},{key:"bindAttributes",value:function(){var t=this.cvWGL.gl,e=t.getAttribLocation(this.program,"pos");t.bindBuffer(t.ARRAY_BUFFER,Sa(t,za)),t.vertexAttribPointer(e,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(e);var n=t.getAttribLocation(this.program,"i");if(t.bindBuffer(t.ARRAY_BUFFER,Sa(t,Ra)),t.vertexAttribPointer(n,1,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n),this.asTriangles){var r=t.getAttribLocation(this.program,"corner");t.bindBuffer(t.ARRAY_BUFFER,Sa(t,Fa)),t.vertexAttribPointer(r,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(r)}}},{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.size?this.size(n,r):n+.2*r,a=i/r,u=Oa(ba(e.w,e.h).gl,a),l=this.init(e.w,e.h,u),c=this.cvWGL.gl,s=this.cvWGL.canvas;u?c.uniform1f(c.getUniformLocation(this.program,"halfSizeGeo"),i/2):c.uniform1f(c.getUniformLocation(this.program,"sizePix"),1*a);var f=this.highlightColors?this.highlightColors.join("|"):"",h=f!==this.highlightKey;this.highlightKey=f;var y=u!==this.asTriangles;this.asTriangles=u,(this.mapContentChanged(e.view,t.length)||h||y||l||xa(c,za)!==this)&&(this.pointsNb=this.bindVertices(t,n,r,o,e.view,u)),this.bindAttributes(),c.uniformMatrix3fv(c.getUniformLocation(this.program,"mat"),!1,new Float32Array(e.getWebGLTransformCentered())),c.clearColor(0,0,0,0),c.clear(c.COLOR_BUFFER_BIT),u?c.drawArrays(c.TRIANGLES,0,6*this.pointsNb):c.drawArrays(c.POINTS,0,this.pointsNb),e.initCanvasTransform(),e.offscreenCtx.drawImage(s,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o,cells:t})}}],r&&ka(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Ba(t){return Ba="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},Ba(t)}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"!=Ba(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ba(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ba(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 Ua(t,e){return Ua=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ua(t,e)}var Wa=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"==Ba(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.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&&Ua(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=t,i=e.view.z,a=this.viewScale?this.viewScale(t,n,i):void 0,u=gi(t,n,function(t){return r.elevation(t)}),l=u.x0,c=u.y0;u=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 v=e;;){var p=h-u*v/e,d=f-l*v/e,b=Math.round(p),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*v>0){s[f][h]=1;break}v+=e}}return s}(u,n,this.sunAzimuth(n,i,a),this.sunAltitude(n,i,a),this.undefinedValue),t=[];for(var s=0;s<u.length;s++)for(var f=u[s],h=c-s*n,y=0;y<f.length;y++)if(f[y]){var v={x:l+y*n,y:h};t.push(v)}new Ia({code:function(){return"a"},color:{a:this.color(n,i,a)}}).draw(t,e,n),this.updateLegends({style:this,resolution:n,z:i,viewScale:a,cells:o})}}}],r&&La(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Ha(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 Ya(t){return Ya="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},Ya(t)}function $a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($a=function(){return!!t})()}function Va(t){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Va(t)}function qa(t,e){return qa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qa(t,e)}var Xa=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=Va(e),function(t,e){if(e&&("object"==Ya(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,$a()?Reflect.construct(e,n||[],Va(t).constructor):e.apply(t,n))}(this,e,[n]);var r=n.elevation;t.viewScale=function(t){return Ha(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&&qa(t,e)}(e,t),n=e,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(pa);function Za(t){return Za="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},Za(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 Ja(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,Qa(r.key),r)}}function Qa(t){var e=function(t){if("object"!=Za(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Za(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Za(e)?e:e+""}function tu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tu=function(){return!!t})()}function eu(t){return eu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},eu(t)}function nu(t,e){return nu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nu(t,e)}var ru=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=eu(e),function(t,e){if(e&&("object"==Za(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,tu()?Reflect.construct(e,n||[],eu(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&&nu(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=pa.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 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}}}}(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 v=.5*y;o.lineWidth=y,"h"===s.or?(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(s.x-l,s.y+v),o.lineTo(s.x+l,s.y+v),o.stroke()),f&&(o.beginPath(),o.strokeStyle=this.color[f],o.moveTo(s.x-l,s.y-v),o.lineTo(s.x+l,s.y-v),o.stroke())):(h&&(o.beginPath(),o.strokeStyle=this.color[h],o.moveTo(s.x+v,s.y-l),o.lineTo(s.x+v,s.y+l),o.stroke()),f&&(o.beginPath(),o.strokeStyle=this.color[f],o.moveTo(s.x-v,s.y-l),o.lineTo(s.x-v,s.y+l),o.stroke()))}}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:a,cells:t})}}}],r&&Ja(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(pa);const ou=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 iu(t){return iu="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},iu(t)}function au(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,uu(r.key),r)}}function uu(t){var e=function(t){if("object"!=iu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=iu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==iu(e)?e:e+""}var lu=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=wa(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=Ee(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,Sa(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,Sa(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)}}])&&au(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();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){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 fu(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)?fu(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 fu(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 hu(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"!=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 vu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vu=function(){return!!t})()}function pu(t){return pu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pu(t)}function du(t,e){return du=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},du(t,e)}var bu=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,vu()?Reflect.construct(e,n||[],pu(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&&du(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=ou(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=ba(e.w,e.h);if(!c)return void console.error("No webGL");var s,f=new lu(c.gl,i/r),h=n/2,y=e.view.x,v=e.view.y,p=su(t);try{for(p.s();!(s=p.n()).done;){var d=s.value,b=this.color(d,n,r,o);if(b&&"none"!==b){var m=this.dotNumber(d,n,r,o),g=this.offset(d,n,r),w=d.x+g.dx+h-y,S=d.y+g.dy+h-v,x=Ee(b);if(!x)return;for(var _=0;_<=m;_++)f.addPointData2(w+u(),S+u(),x.r,x.g,x.b,x.opacity)}}}catch(t){p.e(t)}finally{p.f()}f.draw(e.getWebGLTransformCentered()),e.initCanvasTransform(),l.drawImage(c.canvas,0,0)}else{var O,j=su(t);try{for(j.s();!(O=j.n()).done;){var P=O.value,C=this.color(P,n,r,o);if(C&&"none"!==C){l.fillStyle=C;for(var k=this.dotNumber(P,n,r,o),T=this.offset(P,n,r),A=P.x+T.dx+n/2,E=P.y+T.dy+n/2,M=0;M<=k;M++)l.fillRect(A+u(),E+u(),i,i)}}}catch(t){j.e(t)}finally{j.f()}}this.updateLegends({style:this,resolution:n,z:r,viewScale:o,cells:t})}}],r&&hu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function mu(t){return mu="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},mu(t)}function gu(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,Su(r.key),r)}}function Su(t){var e=function(t){if("object"!=mu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=mu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mu(e)?e:e+""}function xu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(xu=function(){return!!t})()}function _u(t){return _u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_u(t)}function Ou(t,e){return Ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ou(t,e)}var ju=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=_u(e),function(t,e){if(e&&("object"==mu(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,xu()?Reflect.construct(e,n||[],_u(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&&Ou(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=pa.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,v=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return gu(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)?gu(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(v.s();!(s=v.n()).done;){var p=s.value,d=u(p);if(void 0!==d&&0!==d){var b=d<0&&"h"===p.or||d>0&&"v"===p.or?y:h;if(b&&"none"!=b)if(this.diamond){i.fillStyle=b;var m=p.x,g=p.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(p,d,n,o,c):void 0;if(!w||w<=0)continue;var S=this.length?this.length(p,n,o,c):void 0;if(!S||S<=0)continue;var x=.5*S;i.lineWidth=w,i.strokeStyle=b;var _=p.x,O=p.y;i.beginPath(),"v"===p.or?(i.moveTo(_,O-x),i.lineTo(_,O+x)):(i.moveTo(_-x,O),i.lineTo(_+x,O)),i.stroke()}}}}catch(t){v.e(t)}finally{v.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:c,cells:t})}}}],r&&wu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Pu(t){return null===t?NaN:+t}function Cu(t,e,n=Pu){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 ku(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Tu(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Au(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=ku,n=(e,n)=>ku(t(e),n),r=(e,n)=>t(e)-n):(e=t===ku||t===Tu?t:Eu,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 Eu(){return 0}const Mu=Au(ku),zu=Mu.right,Ru=(Mu.left,Au(Pu).center,zu);function Fu(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Iu(){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]=Cu(e,t/o);return i}function i(e){return null==e||isNaN(e=+e)?t:n[Ru(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(ku),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 Iu().domain(e).range(n).unknown(t)},Fu.apply(i,arguments)}var Bu=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,Ha(t,e)],h=a||[r*s,c*o],y=f[1]-f[0],v=f[0],p=h[1]-h[0],d=h[0],b=function(t){return t=(t-v)/y,i&&(t=i(t)),l&&(t=1==t?1:Math.floor(t*l)/(l-1)),d+t*p};return b.invert=function(t){return i&&(t=function(t,e){if(t.invert)return t.invert(e);for(var n=0,r=1,o=0;o<50;o++){var i=(n+r)/2;t(i)<e?n=i:r=i}return(n+r)/2}(i,t)),v+t*y},b}},Lu=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.minSizePix||1,o=t.maxSizeFactor||1,i=Iu();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}},Nu=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=yi(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}}}},Du=function(t){var e=t.valueFunction,n=t.classNumber||12,r=t.colors;t.colorScale&&(r=Vu(t.colorScale,n)),r=r||Array.from({length:n},function(t,e){return"rgb("+Math.floor(255*e/(n-1))+",150,150)"});var o=Iu().range(r);return function(t){return o.domain(t.map(e)),o.breaks=o.quantiles(),o.colors=r,o}},Gu=function(t){var e=t.valueFunction,n=t.classNumber||12,r=Iu().range(Array.from({length:n},function(t,e){return e}));return function(t){return r.domain(t.map(e)),r.breaks=r.quantiles(),r}},Uu=function(t){return function(e,n,r){var o={};for(var i in t)o[i]=t[i](e,n,r);return o}};function Wu(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,o=r?r.invert:function(t){return t};if(!o)throw new Error("The stretching function has no invert function");for(var i=[],a=1;a<n;a++)i.push(t+(e-t)*o(a/n));return i}function Hu(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 Yu(t,e,n){for(var r=[],o=(e-t)/n,i=1;i<n;i++)r.push(t+i*o);return Hu(r)}function $u(t,e){var n=Hu(t),r=function(t){return e[n(t)]};return r.breaks=t,r.colors=e,r}function Vu(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 qu(t){return qu="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},qu(t)}function Xu(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}}}}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 Ku(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ku=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)}function tl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function el(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 nl(t,e,n){return e&&el(t.prototype,e),n&&el(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function rl(t){var e=function(t){if("object"!=qu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=qu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qu(e)?e:e+""}var ol=function(){return nl(function t(){tl(this,t)},null,[{key:"get",value:function(t,e,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=(r=r||{}).colDark||r.colorDark||"#333",i=r.colBright||r.colorBright||"#aaa",a=Hu(e),u=function(e){return a(t(e))},l={},c=0;c<n.length;c++)l[c+""]=n[c];var s=new Ia({code:u,color:l}),f=new ju({classifier:function(){return u},colorDark:o,colorBright:i,diamond:r.diamond});return[s,new hi({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n},filter:r.filter}),f,new il({colDark:o,colBright:i,filter:r.filter})]}},{key:"getCategory",value:function(t,e,n){return(n=n||{}).colDark=n.colDark||"#333",n.colBright=n.colBright||"#aaa",[new Ia({code:t,color:e}),new hi({strokeColor:function(){return"#666"},strokeWidth:function(t,e,n){return.2*n}}),new il({colDark:n.colDark,colBright:n.colBright})]}}])}(),il=function(t){function e(t){var n,r,o,i;return tl(this,e),r=this,i=[t],o=Ju(o=e),n=function(t,e){if(e&&("object"==qu(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,Ku()?Reflect.construct(o,i||[],Ju(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&&Qu(t,e)}(e,t),nl(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=Xu(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=Xu(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()}}}])}(Pr);function al(t){return al="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},al(t)}function ul(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ll(r.key),r)}}function ll(t){var e=function(t){if("object"!=al(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=al(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==al(e)?e:e+""}var cl=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,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e,this.asTriangles=void 0!==a&&Oa(e,o);var 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,s=c+".0";u.push(" vec4 cI;"),u.push(" vec4 cF;"),u.push(" if(t<1.0/"+s+") { cI=c0; cF=c1; t=t*"+s+"; }");for(var f=2;f<c;f++)u.push(" else if(t<"+f+".0/"+s+") { cI=c"+(f-1)+"; cF=c"+f+"; t="+s+"*t-"+(f-1)+".0; }");u.push(" else { cI=c"+(c-1)+"; cF=c"+c+"; t="+s+"*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("");this.program=wa(e,this.asTriangles?"\n attribute vec2 pos;\n attribute vec2 corner;\n uniform float halfSizeGeo;\n uniform mat3 mat;\n\n attribute float t;\n varying float vt;\n\n void main() {\n gl_Position = vec4(mat * vec3(pos + corner * halfSizeGeo, 1.0), 1.0);\n vt = t;\n }\n ":"\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 ",h),e.useProgram(this.program),this.asTriangles?e.uniform1f(e.getUniformLocation(this.program,"halfSizeGeo"),a/2):e.uniform1f(e.getUniformLocation(this.program,"sizePix"),1*o),e.uniform1f(e.getUniformLocation(this.program,"alpha"),r?1*r.alpha:0);for(var y=0;y<n.length;y++){var v=Ee(n[y]),p=v.opacity;1==v.opacity&&null!=i&&(p=i);var d=[+v.r/255,+v.g/255,+v.b/255,+p];e.uniform4fv(e.getUniformLocation(this.program,"c"+y),d)}},e=[{key:"draw",value:function(t,e,n){var r=this.gl,o=this.program;r.useProgram(o);var i=t.length/2,a=new Float32Array(t),u=new Float32Array(e);if(this.asTriangles){var l=Pa(t,i,[e]);a=l.positions,u=l.values[0],r.bindBuffer(r.ARRAY_BUFFER,Sa(r,"WebGLSquareColoringAdvanced.corner")),r.bufferData(r.ARRAY_BUFFER,l.corners,r.DYNAMIC_DRAW);var c=r.getAttribLocation(o,"corner");r.vertexAttribPointer(c,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(c)}r.bindBuffer(r.ARRAY_BUFFER,Sa(r,"WebGLSquareColoringAdvanced.pos")),r.bufferData(r.ARRAY_BUFFER,a,r.DYNAMIC_DRAW);var s=r.getAttribLocation(o,"pos");r.vertexAttribPointer(s,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(s),r.bindBuffer(r.ARRAY_BUFFER,Sa(r,"WebGLSquareColoringAdvanced.t")),r.bufferData(r.ARRAY_BUFFER,u,r.DYNAMIC_DRAW);var f=r.getAttribLocation(o,"t");r.vertexAttribPointer(f,1,r.FLOAT,!1,0,0),r.enableVertexAttribArray(f),r.uniformMatrix3fv(r.getUniformLocation(o,"mat"),!1,new Float32Array(n)),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),this.asTriangles?r.drawArrays(r.TRIANGLES,0,6*i):r.drawArrays(r.POINTS,0,i)}}],e&&ul(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function sl(t){return sl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sl(t)}function fl(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 hl(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,yl(r.key),r)}}function yl(t){var e=function(t){if("object"!=sl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=sl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sl(e)?e:e+""}function vl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vl=function(){return!!t})()}function pl(t){return pl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pl(t)}function dl(t,e){return dl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dl(t,e)}var bl=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=pl(e),function(t,e){if(e&&("object"==sl(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,vl()?Reflect.construct(e,n||[],pl(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&&dl(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=ba(e.w,e.h,null!=this.opacity?{premultipliedAlpha:!1}:void 0);if(i){var a,u=n/2,l=e.view.x,c=e.view.y,s=[],f=[],h=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 fl(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)?fl(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(h.s();!(a=h.n()).done;){var y=a.value,v=this.tFun(y,n,r,o);null!=v&&null!=v&&(s.push(y.x+u-l,y.y+u-c),f.push(v>1?1:v<0?0:v))}}catch(t){h.e(t)}finally{h.f()}var p=this.size?this.size(n,r):n+.2*r,d=this.opacity?this.opacity(n,r):void 0;new cl(i.gl,this.colors,this.stretching,p/r,d,p).draw(s,f,e.getWebGLTransformCentered()),e.initCanvasTransform(),e.offscreenCtx.drawImage(i.canvas,0,0),this.updateLegends({style:this,resolution:n,z:r,viewScale:o,cells:t})}else console.error("No webGL")}}],r&&hl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function ml(t){return ml="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},ml(t)}function gl(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 wl(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,Sl(r.key),r)}}function Sl(t){var e=function(t){if("object"!=ml(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ml(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ml(e)?e:e+""}function xl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(xl=function(){return!!t})()}function _l(t){return _l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_l(t)}function Ol(t,e){return Ol=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ol(t,e)}var jl=new Map,Pl=function(t){var e=jl.get(t);if(void 0===e){var n=Ee(t);e=n?[n.r/255,n.g/255,n.b/255,n.opacity]:null,jl.size>1e4&&jl.clear(),jl.set(t,e)}return e},Cl=new Float32Array(28672),kl=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=_l(e),function(t,e){if(e&&("object"==ml(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,xl()?Reflect.construct(e,n||[],_l(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}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&&Ol(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=.5*n,a=this.highlightColors,u="function"==typeof this.color?this.color:null,l="function"==typeof this.size?this.size:null,c=e.view.x,s=e.view.y;Cl.length<7*t.length&&(Cl=new Float32Array(7*Math.max(t.length,Cl.length/7*2)));var f,h=0,y=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 gl(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)?gl(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(y.s();!(f=y.n()).done;){var v=f.value,p=u?u(v,n,r,o):this.color;if(p&&"none"!==p&&(!a||this.isHighlighted(p))){var d=l?l(v,n,r,o):this.size;if(d){var b=Pl(p);if(b){var m=this.offset(v,n,r),g=7*h;Cl[g]=v.x+i+m.dx-c,Cl[g+1]=v.y+i+m.dy-s,Cl[g+2]=.5*d,Cl[g+3]=b[0],Cl[g+4]=b[1],Cl[g+5]=b[2],Cl[g+6]=b[3],h++}}}}}catch(t){y.e(t)}finally{y.f()}h>0&&(this.drawWebGL(e,h,r)||this.drawCanvas(e,h)),this.updateLegends({viewScale:o,resolution:n,z:r,cells:t})}},{key:"drawWebGL",value:function(t,e,n){var r;try{r=ba(t.w,t.h,{version:2})}catch(t){return!1}var o=r.gl;if(!o.drawArraysInstanced)return!1;var i=wa(o,"#version 300 es\nlayout(location = 0) in vec2 corner;\nlayout(location = 1) in vec3 circle;\nlayout(location = 2) in vec4 col;\nuniform vec2 canvasSize;\nuniform float z;\nout vec4 vCol;\nout vec2 vLocal;\nout float vRadius;\nvoid main() {\n float radius = circle.z / z;\n // the quad is a pixel bigger than the circle, for its anti-aliased edge\n vec2 local = corner * (radius + 1.0);\n vec2 pix = circle.xy / z + local;\n gl_Position = vec4(pix * 2.0 / canvasSize, 0.0, 1.0);\n vCol = col;\n vLocal = local;\n vRadius = radius;\n}\n","#version 300 es\nprecision mediump float;\nin vec4 vCol;\nin vec2 vLocal;\nin float vRadius;\nout vec4 outColor;\nvoid main() {\n float a = clamp(vRadius + 0.5 - length(vLocal), 0.0, 1.0) * vCol.a;\n outColor = vec4(vCol.rgb * a, a);\n}\n");return o.useProgram(i),o.uniform2f(o.getUniformLocation(i,"canvasSize"),t.w,t.h),o.uniform1f(o.getUniformLocation(i,"z"),n),o.bindBuffer(o.ARRAY_BUFFER,Sa(o,"CircleColorSizeWebGLStyle.corner")),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.vertexAttribDivisor(0,0),o.bindBuffer(o.ARRAY_BUFFER,Sa(o,"CircleColorSizeWebGLStyle.circles")),o.bufferData(o.ARRAY_BUFFER,Cl.subarray(0,7*e),o.DYNAMIC_DRAW),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,3,o.FLOAT,!1,28,0),o.vertexAttribDivisor(1,1),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,4,o.FLOAT,!1,28,12),o.vertexAttribDivisor(2,1),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.drawArraysInstanced(o.TRIANGLE_STRIP,0,4,e),o.disable(o.BLEND),o.vertexAttribDivisor(1,0),o.vertexAttribDivisor(2,0),o.disableVertexAttribArray(0),o.disableVertexAttribArray(1),o.disableVertexAttribArray(2),t.initCanvasTransform(),t.offscreenCtx.drawImage(r.canvas,0,0),!0}},{key:"drawCanvas",value:function(t,e){var n=t.offscreenCtx,r=t.view.x,o=t.view.y;t.setCanvasTransform();for(var i=0;i<e;i++){var a=7*i;n.fillStyle="rgba("+[255*Cl[a+3],255*Cl[a+4],255*Cl[a+5],Cl[a+6]].join(",")+")",n.beginPath(),n.arc(Cl[a]+r,Cl[a+1]+o,Cl[a+2],0,2*Math.PI),n.fill()}}}],r&&wl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Tl(t){return Tl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tl(t)}function Al(t,e){(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 El(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,Ml(r.key),r)}}function Ml(t){var e=function(t){if("object"!=Tl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Tl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tl(e)?e:e+""}function zl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zl=function(){return!!t})()}function Rl(t){return Rl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rl(t)}function Fl(t,e){return Fl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fl(t,e)}var Il=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=Rl(e),function(t,e){if(e&&("object"==Tl(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,zl()?Reflect.construct(e,n||[],Rl(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&&Fl(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 Al(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)?Al(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(),v=l(),p=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-p.x,s.y+h.dy+p.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-p.x,s.y+h.dy+p.y),o.lineTo(s.x+h.dx+n-d.x,s.y+h.dy+n-d.y),o.lineTo(s.x+h.dx+v.x,s.y+h.dy+n-v.y),o.fill()}}}catch(t){c.e(t)}finally{c.f()}this.updateLegends({style:this,resolution:n,z:r,viewScale:i,cells:t})}}],r&&El(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function Bl(t){return Bl="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},Bl(t)}function Ll(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 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,Dl(r.key),r)}}function Dl(t){var e=function(t){if("object"!=Bl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Bl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Bl(e)?e:e+""}function Gl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gl=function(){return!!t})()}function Ul(t){return Ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ul(t)}function Wl(t,e){return Wl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wl(t,e)}var Hl=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=Ul(e),function(t,e){if(e&&("object"==Bl(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,Gl()?Reflect.construct(e,n||[],Ul(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&&Wl(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 Ll(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)?Ll(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 v=c.x+u,p=c.y+u;if("p"===y)i.beginPath(),i.moveTo(v,p+u),i.lineTo(v+h,p+h),i.lineTo(v+u,p),i.lineTo(v+h,p-h),i.lineTo(v,p-u),i.lineTo(v-h,p-h),i.lineTo(v-u,p),i.lineTo(v-h,p+h),i.fill();else{if("o"!==y)throw new Error("Unexpected shape:"+y);i.beginPath(),i.moveTo(v,p+h),i.lineTo(v+u,p+u),i.lineTo(v+h,p),i.lineTo(v+u,p-u),i.lineTo(v,p-h),i.lineTo(v-u,p-u),i.lineTo(v-h,p),i.lineTo(v-u,p+u),i.fill()}}}}}catch(t){l.e(t)}finally{l.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a,cells:t})}}],r&&Nl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);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(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}}}}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 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,Xl(r.key),r)}}function Xl(t){var e=function(t){if("object"!=Yl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yl(e)?e:e+""}function Zl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Zl=function(){return!!t})()}function Kl(t){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kl(t)}function Jl(t,e){return Jl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jl(t,e)}var Ql=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=Kl(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,Zl()?Reflect.construct(e,n||[],Kl(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){return 1.5*n},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&&Jl(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,e){var n=t[e];return r.noData(n)?void 0:+n},s=function(t){var e,n,o,i=$l(r.ts);try{for(i.s();!(o=i.n()).done;){var a=o.value,u=c(t,a);null!=u&&((null==e||u<e)&&(e=u),(null==n||u>n)&&(n=u))}}catch(t){i.e(t)}finally{i.f()}if(null!=e)return n-e},f=$l(t);try{for(f.s();!(i=f.n()).done;){var h=s(i.value);null!=h&&(null==o||h>o)&&(o=h)}}catch(t){f.e(t)}finally{f.f()}if(o){var y=this.ts.length;u.lineCap="butt";var v,p=$l(t);try{for(p.s();!(v=p.n()).done;){var d=v.value,b=this.lineWidth?this.lineWidth(d,n,a,l):void 0;if(b&&!(b<0)){var m=this.color?this.color(d,n,a,l):void 0;if(m){var g=this.offsetX?this.offsetX(d,n,a):0;if(null!=g&&!isNaN(g)){var w=this.width?this.width(d,n,a):n;if(null!=w&&!isNaN(w)){var S=this.offsetY?this.offsetY(d,n,a):0;if(null!=S&&!isNaN(S)){var x=this.height?this.height(d,n,a):n;if(null!=x&&!isNaN(x)){var _=this.anchorModeY?this.anchorModeY(d,n,a):"center";if(_){u.lineWidth=b,u.strokeStyle=m;var O=void 0,j=void 0;if("first"===_)O=d[this.ts[0]],j=0;else if("last"===_)O=d[this.ts[this.ts.length-1]],j=0;else if("bottom"===_){var P,C=$l(this.ts);try{for(C.s();!(P=C.n()).done;){var k=P.value,T=c(d,k);null!=T&&(null==O||T<O)&&(O=T)}}catch(t){C.e(t)}finally{C.f()}j=0}else if("top"===_){var A,E=$l(this.ts);try{for(E.s();!(A=E.n()).done;){var M=A.value,z=c(d,M);null!=z&&(null==O||z>O)&&(O=z)}}catch(t){E.e(t)}finally{E.f()}j=n}else{if("center"!==_){console.log("Unexpected anchorModeY: "+_);continue}var R,F=void 0,I=void 0,B=$l(this.ts);try{for(B.s();!(R=B.n()).done;){var L=R.value,N=c(d,L);null!=N&&((null==F||N<F)&&(F=N),(null==I||N>I)&&(I=N))}}catch(t){B.e(t)}finally{B.f()}O=.5*(I+F),j=n/2}var D=w/(y-1),G=d[this.ts[0]];this.noData(G)||(u.beginPath(),u.moveTo(d.x+g,d.y+j+(G-O)*x/o+S));for(var U=void 0,W=1;W<y;W++)U=d[this.ts[W]],this.noData(G)&&this.noData(U)||(!this.noData(G)&&this.noData(U)?u.stroke():this.noData(G)&&!this.noData(U)?(u.beginPath(),u.moveTo(d.x+W*D+g,d.y+j+(U-O)*x/o+S)):(u.lineTo(d.x+W*D+g,d.y+j+(U-O)*x/o+S),W==y-1&&u.stroke())),G=U}}}}}}}}}catch(t){p.e(t)}finally{p.f()}this.updateLegends({style:this,resolution:n,z:a,viewScale:l,cells:t})}}}],r&&ql(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr);function tc(t){return tc="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},tc(t)}function ec(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)||rc(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 nc(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=rc(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 rc(t,e){if(t){if("string"==typeof t)return oc(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)?oc(t,e):void 0}}function oc(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 ic(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,ac(r.key),r)}}function ac(t){var e=function(t){if("object"!=tc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=tc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==tc(e)?e:e+""}function uc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(uc=function(){return!!t})()}function lc(t){return lc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lc(t)}function cc(t,e){return cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cc(t,e)}var sc=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=lc(e),function(t,e){if(e&&("object"==tc(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,uc()?Reflect.construct(e,n||[],lc(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&&cc(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=pa.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,v=Math.cos(y),p=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*v+s,t.y+l+u*p+f),i.stroke()}}};i.lineCap="round";var g,w=nc(h);try{for(w.s();!(g=w.n()).done;){var S=g.value,x=S.c1,_=S.c2,O=S.x,j=S.y,P=x?this.height(x,n,o,a):0,C=_?this.height(_,n,o,a):0,k=fc(x,u),T=fc(_,u);if(0!=k||0!=T)for(var A=0,E=0,M=0,z=Object.entries(this.color);M<z.length;M++){var R=ec(z[M],2),F=R[0],I=R[1],B=x?+x[F]:0,L=_?+_[F]:0;if(0!=B||0!=L){var N=P*A/k||0,D=P*(A+B)/k||0,G=C*E/T||0,U=C*(E+L)/T||0;i.beginPath(),"h"==S.or?(i.moveTo(O+N*v+s,j-l+N*p+f),i.lineTo(O+G*v+s,j+l+G*p+f),i.lineTo(O+U*v+s,j+l+U*p+f),i.lineTo(O+D*v+s,j-l+D*p+f)):(i.moveTo(O-l+N*v+s,j+N*p+f),i.lineTo(O+l+G*v+s,j+G*p+f),i.lineTo(O+l+U*v+s,j+U*p+f),i.lineTo(O-l+D*v+s,j+D*p+f)),i.fillStyle=I,i.fill(),A+=B,E+=L,m(x),m(_)}}}}catch(t){w.e(t)}finally{w.f()}this.updateLegends({style:this,resolution:n,z:o,viewScale:a,cells:t})}}}],r&&ic(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr),fc=function(t,e){if(!t)return 0;var n,r=0,o=nc(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 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 yc(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(hc(t)+" is not iterable")}function vc(){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 pc(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===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<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(pc(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,pc(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,pc(f,"constructor",c),pc(c,"constructor",l),l.displayName="GeneratorFunction",pc(c,o,"GeneratorFunction"),pc(f),pc(f,o,"Generator"),pc(f,r,function(){return this}),pc(f,"toString",function(){return"[object Generator]"}),(vc=function(){return{w:i,m:h}})()}function pc(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}pc=function(t,e,n,r){function i(e,n){pc(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))},pc(t,e,n,r)}function dc(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 bc(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)?bc(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 bc(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,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 gc(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,wc(r.key),r)}}function wc(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+""}function Sc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Sc=function(){return!!t})()}function xc(t){return xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xc(t)}function _c(t,e){return _c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_c(t,e)}var Oc=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"==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)}(t,Sc()?Reflect.construct(e,n||[],xc(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&&_c(t,e)}(e,t),n=e,r=[{key:"draw",value:(o=vc().m(function t(e,n,r){var o,i,a,u,l,c,s,f,h=this;return vc().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=dc(e),t.p=1,c=vc().m(function t(){var e,u,c,s,f,y;return vc().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"!=(s=h.cache[u])){t.n=3;break}return t.a(2,{v:void 0});case 3: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 h.cache[u]="loading",(f=new Image).onload=function(){h.cache[u]=f,n.redraw()},f.onerror=function(){console.warn("Could not retrieve image from",u)},f.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(yc(c()),3);case 3:if(0!==(s=t.v)){t.n=4;break}return t.a(3,5);case 4:if(!s){t.n=5;break}return t.a(2,s.v);case 5:t.n=2;break;case 6:t.n=8;break;case 7:t.p=7,f=t.v,u.e(f);case 8:return t.p=8,u.f(),t.f(8);case 9:this.updateLegends({style:this,resolution:r,z:o,viewScale:a,cells:e});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){mc(i,n,r,a,u,"next",t)}function u(t){mc(i,n,r,a,u,"throw",t)}a(void 0)})},function(t,e,n){return i.apply(this,arguments)})}],r&&gc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(Pr);function jc(t){return jc="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},jc(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 Cc(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,kc(r.key),r)}}function kc(t){var e=function(t){if("object"!=jc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=jc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==jc(e)?e:e+""}function Tc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Tc=function(){return!!t})()}function Ac(t){return Ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ac(t)}function Ec(t,e){return Ec=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ec(t,e)}var Mc=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=Ac(e),function(t,e){if(e&&("object"==jc(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||[],Ac(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&&Ec(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=gi(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 v=Math.min(Math.floor(y/e),o-2),p=y%e/e,d=v*e+e/2,b=t[s][v],m=t[s][v+1],g=t[s+1][v],w=t[s+1][v+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*p+b*(1-p)),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*p+g*(1-p)):u[c][y]=w*f+m*(1-f):u[c][y]=g*f+b*(1-f);else{var S=(1-p+f)*Math.SQRT1_2;u[c][y]=m*(1-S)+g*S}else{var x=(p+f)*Math.SQRT1_2;u[c][y]=b*(1-x)+w*x}else{var _=m+g;u[c][y]=zc(b,m,g,_/2,p,f)}else{var O=b+w;u[c][y]=zc(b,m,O/2,w,p,f)}else{var j=b+w;u[c][y]=zc(b,j/2,g,w,p,f)}else{var P=m+g;u[c][y]=zc(P/2,m,g,w,p,f)}else u[c][y]=zc(b,m,g,w,p,f);else u[c][y]=zc(b||0,m||0,g||0,w||0,p,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,v=0;v<h.length;v++){var p=h[v];if(p){var d={x:a+v*l+s,y};d[this.interpolatedProperty]=p,t.push(d)}}this.drawStyles(t,e,l)}}},{key:"drawStyles",value:function(t,e,n){var r,o=e.view.z,a=e.offscreenCtx,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 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}}}}(this.styles);try{for(u.s();!(r=u.n()).done;){var l=r.value;i(l,o)&&((l.alpha||l.blendOperation)&&(a.save(),l.alpha&&(a.globalAlpha=l.alpha(o)),l.blendOperation&&(a.globalCompositeOperation=l.blendOperation(o))),e.setCanvasTransform(),l.draw(t,e,n),l.filterColor&&l.drawFilter(e),(l.alpha||l.blendOperation)&&a.restore())}}catch(t){u.e(t)}finally{u.f()}}}],r&&Cc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pr),zc=function(t,e,n,r,o,i){var a=t+(e-t)*o;return a+(n+(r-n)*o-a)*i};function Rc(t){return Rc="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},Rc(t)}function Fc(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,Ic(r.key),r)}}function Ic(t){var e=function(t){if("object"!=Rc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Rc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rc(e)?e:e+""}function Bc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bc=function(){return!!t})()}function Lc(t){return Lc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Lc(t)}function Nc(t,e){return Nc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nc(t,e)}var Dc=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=Lc(e),function(t,e){if(e&&("object"==Rc(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||[],Lc(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.value=t.value,n.maxSteps=t.maxSteps||function(t){return 6*t*t},n.seed=t.seed||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&&Nc(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.targetResolution(n,o),a=Math.max(1,Math.round(n/i));i=n/a;for(var u=gi(t,n,function(t){return r.value(t)}),l=u.x0,c=u.y0,s=[],f=new Map,h=u.length,y=h?u[0].length:0,v=new Int32Array(h*y).fill(-1),p=0;p<h;p++)for(var d=0;d<y;d++){var b=u[p][d];if(null!=b){var m=f.get(b);void 0===m&&(m=s.length,s.push(b),f.set(b,m)),v[p*y+d]=m}}for(var g=-Math.round(c/i)-a,w=Math.round(l/i),S=function(t,e,n,r){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=void 0===o.maxSteps?6*r*r:o.maxSteps,a=0|(o.seed||0),u=o.offsetI||0,l=o.offsetJ||0,c=e*r,s=n*r,f=new Int32Array(c*s).fill(-1),h=Math.floor(r/2),y=0;y<c;y++)for(var v=Math.floor(y/r),p=0;p<s;p++){var d=t[v*n+Math.floor(p/r)];if(!(d<0)){for(var b=Gc(y+u,p+l,a),m=y,g=p,w=-1,S=0;;S++){if(m%r===h&&g%r===h){var x=t[Math.floor(m/r)*n+Math.floor(g/r)];if(x>=0){w=x;break}}if(S>=i)break;b^=b<<13,b^=b>>>17;var _=(b^=b<<5)>>>0&3;if(0===_?m--:1===_?m++:2===_?g--:g++,m<0||m>=c||g<0||g>=s)break}f[y*s+p]=w>=0?w:d}}return f}(v,h,y,a,{maxSteps:this.maxSteps(a),seed:this.seed,offsetI:g,offsetJ:w}),x=[],_=y*a,O=i,j=0;j<h*a;j++)for(var P=c+n-(j+1)*O,C=0;C<_;C++){var k=S[j*_+C];if(!(k<0)){var T={x:l+C*O,y:P};T[this.interpolatedProperty]=s[k],x.push(T)}}this.drawStyles(x,e,i)}}}],r&&Fc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Mc);function Gc(t,e,n){var r=Math.imul(0|t,73856093)^Math.imul(0|e,19349663)^Math.imul(n,83492791)|0;return r=Math.imul(r^r>>>16,2246822507),r=Math.imul(r^r>>>13,3266489909),0==(r^=r>>>16)?1:r}function Uc(t){return Uc="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},Uc(t)}function Wc(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 Hc(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)?Hc(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 Hc(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 Yc(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"!=Uc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Uc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Uc(e)?e:e+""}function Vc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Vc=function(){return!!t})()}function qc(t){return qc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qc(t)}function Xc(t,e){return Xc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xc(t,e)}var Zc=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=qc(e),function(t,e){if(e&&("object"==Uc(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,Vc()?Reflect.construct(e,n||[],qc(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&&Xc(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t,n){var r=t.view.z,o=t.offscreenCtx,a=this.getDataset(r);if(a){if(a.getData(t.extGeo),a.updateViewCache(t.extGeo),(this.alpha||this.blendOperation)&&(o.save(),this.alpha&&(o.globalAlpha=this.alpha(r)),this.blendOperation&&(o.globalCompositeOperation=this.blendOperation(r))),n){var u,l=Wc(this.styles);try{for(l.s();!(u=l.n()).done;){var c=u.value;e.setLegendContainer(n.node(),c.legends,c.styles)}}catch(t){l.e(t)}finally{l.f()}}var s,f=Wc(this.styles);try{for(f.s();!(s=f.n()).done;){var h=s.value;i(h,r)&&((h.alpha||h.blendOperation)&&(o.save(),h.alpha&&(o.globalAlpha=h.alpha(r)),h.blendOperation&&(o.globalCompositeOperation=h.blendOperation(r))),t.setCanvasTransform(),h.draw(a.getViewCache(),t,a.getResolution()),h.filterColor&&h.drawFilter(t),(h.alpha||h.blendOperation)&&o.restore())}}catch(t){f.e(t)}finally{f.f()}if((this.alpha||this.blendOperation)&&o.restore(),n){var y,v=Wc(this.styles);try{for(v.s();!(y=v.n()).done;){var p=y.value;if(i(p,r)&&(e.addLegends(n,p.legends,p,t,this.styles),p.styles)){var d,b=Wc(p.styles);try{for(b.s();!(d=b.n()).done;){var m=d.value;i(m,r)&&e.addLegends(n,m.legends,m,t)}}catch(t){b.e(t)}finally{b.f()}}}}catch(t){v.e(t)}finally{v.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:"setLegendContainer",value:function(t,n,r){var o=function(e){Array.isArray(e)?e.forEach(o):e&&(e.container=t)};o(n);var i,a=Wc(r||[]);try{for(a.s();!(i=a.n()).done;){var u=i.value;e.setLegendContainer(t,u.legends,void 0)}}catch(t){a.e(t)}finally{a.f()}}},{key:"addLegends",value:function(t,e,n,r,o){if(Array.isArray(e)){var i,a=Wc(e);try{for(a.s();!(i=a.n()).done;){var u=i.value;this.addLegends(t,u,n,r,o)}}catch(t){a.e(t)}finally{a.f()}}else{e.style_=n,e.layerStyles=o,e.redraw=function(){return r.redraw?r.redraw():void 0};var l=t.node(),c=e.div.node(),s=l._gridvizLegendCursor;s?c.previousSibling!==s&&s.after(c):l.firstChild!==c&&l.prepend(c),l._gridvizLegendCursor=c}}},{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&&Yc(n.prototype,r),o&&Yc(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(zr);function Kc(t){return Kc="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},Kc(t)}function Jc(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,Qc(r.key),r)}}function Qc(t){var e=function(t){if("object"!=Kc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Kc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kc(e)?e:e+""}function ts(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ts=function(){return!!t})()}function es(t){return es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},es(t)}function ns(t,e){return ns=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ns(t,e)}var rs=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=es(e),function(t,e){if(e&&("object"==Kc(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||[],es(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&&ns(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),v=s(t.extGeo.yMax)-1,p=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=v;c<y;c++)a(c)},d=f;d<h;d++)p(d)}else console.error("No resolutions provided for background layer")}}])&&Jc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(zr);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 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,as(r.key),r)}}function as(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 us(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(us=function(){return!!t})()}function ls(t){return ls=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ls(t)}function cs(t,e){return cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cs(t,e)}var ss=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=ls(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,us()?Reflect.construct(e,n||[],ls(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&&cs(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}}}])&&is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(zr);function fs(t){return fs="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},fs(t)}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,ys(r.key),r)}}function ys(t){var e=function(t){if("object"!=fs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fs(e)?e:e+""}function vs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vs=function(){return!!t})()}function ps(t){return ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ps(t)}function ds(t,e){return ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ds(t,e)}var bs=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"==fs(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||[],ps(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&&ds(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}}])&&hs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(zr);function ms(t){return ms="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},ms(t)}function gs(){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 ws(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===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<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(ws(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,ws(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,ws(f,"constructor",c),ws(c,"constructor",l),l.displayName="GeneratorFunction",ws(c,o,"GeneratorFunction"),ws(f),ws(f,o,"Generator"),ws(f,r,function(){return this}),ws(f,"toString",function(){return"[object Generator]"}),(gs=function(){return{w:i,m:h}})()}function ws(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ws=function(t,e,n,r){function i(e,n){ws(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))},ws(t,e,n,r)}function Ss(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 xs(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 _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}}(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 _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 Os(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,js(r.key),r)}}function js(t){var e=function(t){if("object"!=ms(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ms(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ms(e)?e:e+""}function Ps(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ps=function(){return!!t})()}function Cs(t){return Cs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cs(t)}function ks(t,e){return ks=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ks(t,e)}var Ts=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"==ms(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,Ps()?Reflect.construct(e,n||[],Cs(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&&ks(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.labels){var e,n=t.view.z,r=t.offscreenCtx;r.textAlign=this.textAlign||"start",r.lineJoin="bevel",r.lineCap="butt",t.initCanvasTransform();var o,i=xs(this.labels);try{for(i.s();!(o=i.n()).done;){var a=o.value;if(t.toDraw(a)){var u=this.style(a,n);if(u){u!==e&&(r.font=e=u);var l=t.geoToPixX(a.x)+this.offsetPix[0],c=t.geoToPixY(a.y)-this.offsetPix[1];if(this.haloColor&&this.haloWidth){var s=this.haloColor(a,n),f=this.haloWidth(a,n);s&&f&&f>0&&(r.strokeStyle=s,r.lineWidth=f,r.strokeText(a.name,l,c))}if(this.color){var h=this.color(a,n);h&&(r.fillStyle=h,r.fillText(a.name,l,c))}}}}}catch(t){i.e(t)}finally{i.f()}}else this.load(t.redraw)}},{key:"load",value:(o=gs().m(function t(e){var n,r,o,i,a;return gs().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,so(this.url);case 4:if(n=t.v,!this.preprocess){t.n=13;break}this.labels=[],r=xs(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){Ss(i,n,r,a,u,"next",t)}function u(t){Ss(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&Os(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(zr);function As(t){return As="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},As(t)}function Es(){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 Ms(c,"_invoke",function(n,r,o){var i,u,l,c=0,s=o||[],f=!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;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=h.p,v=i[2];n>3?(o=v===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<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,h.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,v),u=s,l=v;(e=u<2?t:l)||!f;){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=(f=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:f}}}(n,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Ms(e={},r,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Ms(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,Ms(f,"constructor",c),Ms(c,"constructor",l),l.displayName="GeneratorFunction",Ms(c,o,"GeneratorFunction"),Ms(f),Ms(f,o,"Generator"),Ms(f,r,function(){return this}),Ms(f,"toString",function(){return"[object Generator]"}),(Es=function(){return{w:i,m:h}})()}function Ms(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Ms=function(t,e,n,r){function i(e,n){Ms(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))},Ms(t,e,n,r)}function zs(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 Rs(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 Fs(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)?Fs(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 Fs(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,Bs(r.key),r)}}function Bs(t){var e=function(t){if("object"!=As(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=As(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==As(e)?e:e+""}function Ls(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ls=function(){return!!t})()}function Ns(t){return Ns=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ns(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=Ns(e),function(t,e){if(e&&("object"==As(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,Ls()?Reflect.construct(e,n||[],Ns(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&&Ds(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=Rs(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=Rs(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 v,p=Rs(s);try{for(p.s();!(v=p.n()).done;){var d=v.value;o.beginPath(),o.rect(d[0]-a/2,d[1]-a/2,a,a),l&&o.fill(),u&&c&&o.stroke()}}catch(t){p.e(t)}finally{p.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=Rs("LineString"===n?[e.coordinates]:e.coordinates);try{for(w.s();!(g=w.n()).done;){var S=g.value;if(!(S.length<2)){o.beginPath(),o.moveTo(S[0][0],S[0][1]);for(var x=1;x<S.length;x++)o.lineTo(S[x][0],S[x][1]);o.stroke()}}}catch(t){w.e(t)}finally{w.f()}o.restore()}else if("Polygon"==n||"MultiPolygon"==n){o.save();var _="Polygon"===n?[e.coordinates]:e.coordinates;o.beginPath();var O,j=Rs(_);try{for(j.s();!(O=j.n()).done;){var P,C=Rs(O.value);try{for(C.s();!(P=C.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){C.e(t)}finally{C.f()}}}catch(t){j.e(t)}finally{j.f()}var A=this.fillStyle(t,r);A&&"none"!==A&&(o.fillStyle=A,o.fill("evenodd"));var E=this.lineWidth(t,r);if(E&&E>0){var M,z,R,F=null!==(M=null===(z=this.strokeStyle)||void 0===z?void 0:z.call(this,t,r))&&void 0!==M?M:A;F&&"none"!==F&&(o.strokeStyle=F,o.lineWidth=E*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 I,B=Rs(e.geometries);try{for(B.s();!(I=B.n()).done;){var L=I.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=Es().m(function t(e){var n,r,o,i,a,u;return Es().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,Xr(this.url);case 4:if(n=t.v,r=n.features,!this.preprocess){t.n=13;break}this.fs=[],o=Rs(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){zs(i,n,r,a,u,"next",t)}function u(t){zs(i,n,r,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})}],r&&Is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i}(zr);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){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,$s(r.key),r)}}function $s(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+""}var Vs=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=e||{},this.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 Neue', Arial, Helvetica, sans-serif",this.id&&(this.div=gt("#"+this.id)),this.div&&!this.div.empty()||(this.div=gt(document.createElement("div")),this.id&&this.div.attr("id",this.id)),this._set={padding:void 0!==e.padding,fontFamily:void 0!==e["font-family"],titleFontSize:void 0!==e.titleFontSize,titleFontWeight:void 0!==e.titleFontWeight,labelFontSize:void 0!==e.labelFontSize},this.div.classed("gridviz-legend",!0),e.className){var n,r=Ws(String(e.className).split(/\s+/));try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&this.div.classed(o,!0)}}catch(t){r.e(t)}finally{r.f()}}this.div.style("background",this.background),this.div.style("padding",this._css("padding",this.padding,this._set.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._css("font-family",this["font-family"],this._set.fontFamily)),this.title=e.title,this.titleFontSize=e.titleFontSize||"15px",this.titleFontWeight=e.titleFontWeight||"500",this.labelFontSize=e.labelFontSize||"14px",this.labelUnitText=e.labelUnitText||"",this.labelFormat=e.labelFormat,this.labelsAsHTML=!0===e.labelsAsHTML,this.interactive=!1!==e.interactive,this.style_=void 0,this.layerStyles=void 0,this.redraw=void 0,this.container=void 0,this.fill="fill"===e.width},e=[{key:"highlight",value:function(t){var e=this.highlightedStyles();if(this.interactive&&e.length){var n=e.some(function(t){return null!==t.highlightColors});this.div&&this.div.attr("data-gridviz-hovered",t&&t.length?"":null);var r,o=Ws(e);try{for(o.s();!(r=o.n()).done;)r.value.setHighlight(t)}catch(t){o.e(t)}finally{o.f()}!n&&e.every(function(t){return null===t.highlightColors})||this.redraw&&this.redraw()}}},{key:"highlightedStyles",value:function(){return this.style_?[this.style_]:[]}},{key:"bindHover",value:function(t,e,n){var r=this;this.interactive&&t.style("cursor","pointer").on("mouseenter",function(){n&&n.enter&&n.enter(),r.highlight([e])}).on("mouseleave",function(){n&&n.leave&&n.leave(),r.highlight(null)})}},{key:"_css",value:function(t,e,n){return n?e:"var(--gridviz-legend-".concat(t,", ").concat(e,")")}},{key:"labelFontSizeCSS",value:function(){return this._css("label-font-size",this.labelFontSize,this._set.labelFontSize)}},{key:"labelColorCSS",value:function(){return"var(--gridviz-legend-label-color, #333)"}},{key:"setType",value:function(t){this.div.classed("gridviz-legend--"+t,!0)}},{key:"availableWidth",value:function(t){if(!this.fill)return this.width;var e=this.container,n=e&&e.clientWidth;if(!n)return t;var r=parseFloat(this.padding)||0;return Math.max(60,Math.floor(n-2*r))}},{key:"setText",value:function(t,e){return this.labelsAsHTML?t.html(e):t.text(e)}},{key:"makeTitle",value:function(){this.title&&this.setText(this.div.append("div").classed("gridviz-legend-title",!0).style("font-size",this._css("title-font-size",this.titleFontSize,this._set.titleFontSize)).style("font-weight",this._css("title-font-weight",this.titleFontWeight,this._set.titleFontWeight)).style("margin-bottom","7px"),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&&Ys(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function qs(t){return qs="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},qs(t)}function Xs(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,Zs(r.key),r)}}function Zs(t){var e=function(t){if("object"!=qs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=qs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qs(e)?e:e+""}function Ks(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ks=function(){return!!t})()}function Js(t){return Js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Js(t)}function Qs(t,e){return Qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qs(t,e)}var tf=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=Js(e),function(t,e){if(e&&("object"==qs(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,Ks()?Reflect.construct(e,n||[],Js(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.width="fill"===t.width?300:t.width||300,n.height=t.height||15,n.tickSize=t.tickSize||6,n.ticks=t.ticks||Math.max(2,Math.floor(n.width/50)),n._defaultTicks=t.ticks?void 0:n.ticks,n.tickFormat=t.tickFormat,n.tickUnit=t.tickUnit,n.fontSize=t.fontSize,n.invert=t.invert,n.setType("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&&Qs(t,e)}(e,t),n=e,r=[{key:"tickCount",value:function(t){return void 0!==this._defaultTicks&&this.ticks===this._defaultTicks?Math.max(2,Math.floor(t/50)):Math.max(2,this.ticks)}},{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();for(var e=this.availableWidth(this.width),n=this.tickCount(e),r=e+2*this.margin,o=this.height+this.margin+this.tickSize+10,i=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",r).attr("height",o).append("g").classed("gridviz-legend-bar",!0).attr("transform","translate("+this.margin+" 0)"),a=e,u=this.height,l=0;l<a;l+=5){var c=l/(a-1);this.invert&&(c=1-c),i.append("rect").classed("gridviz-legend-swatch",!0).attr("x",l).attr("y",0).attr("width",5).attr("height",u).style("fill",this.colorScale(c,t.viewScale))}for(var s=0;s<n;s++){var f=s/(n-1);i.append("line").classed("gridviz-legend-tick",!0).attr("x1",a*f).attr("y1",0).attr("x2",a*f).attr("y2",u+this.tickSize).style("stroke","black"),i.append("text").classed("gridviz-legend-label",!0).attr("id","ticklabel_"+s).attr("x",a*f).attr("y",u+this.tickSize+2).style("font-size",this.fontSize||this.labelFontSizeCSS()).style("fill",this.labelColorCSS()).style("text-anchor",0==s?"start":s==n-1?"end":"middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none")}for(var h=this.tickFormat&&"text"!=this.tickFormat?this.tickFormat:function(t){return t},y=0;y<n;y++){var v=y/(n-1),p=this.textScale(v,t.viewScale),d=(p?h(p):"0")+(this.tickUnit?this.tickUnit:"");null!=d&&this.div.select("#ticklabel_"+y).text(d)}}}],r&&Xs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function ef(t){return ef="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},ef(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,rf(r.key),r)}}function rf(t){var e=function(t){if("object"!=ef(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ef(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ef(e)?e:e+""}function of(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(of=function(){return!!t})()}function af(t){return af=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},af(t)}function uf(t,e){return uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uf(t,e)}var lf=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=af(e),function(t,e){if(e&&("object"==ef(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,of()?Reflect.construct(e,n||[],af(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.colors=t.colors,n.breaks=t.breaks,n.width="fill"===t.width?300:t.width||300,n.height=t.height||15,n.setType("discrete"),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&&uf(t,e)}(e,t),n=e,(r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n=this.colors(t.viewScale),r=this.breaks(t.viewScale);if(r){var o=n.length;if(0!=o){for(var i=this.availableWidth(this.width),a=i/o,u=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",i).attr("height",this.height+this.tickSize+2+10),l=function(){var t=u.append("rect").classed("gridviz-legend-swatch",!0).attr("x",c*a).attr("y",0).attr("width",a).attr("height",e.height).style("fill",n[c]);e.bindHover(t,n[c],{enter:function(){return t.classed("gridviz-legend-swatch--active",!0).attr("stroke","red")},leave:function(){return t.classed("gridviz-legend-swatch--active",!1).attr("stroke",null)}})},c=0;c<o;c++)l();for(var s=1;s<o;s++)u.append("line").classed("gridviz-legend-tick",!0).attr("x1",a*s).attr("y1",0).attr("x2",a*s).attr("y2",this.height+this.tickSize).style("stroke","black");for(var f=1;f<o;f++){var h=r[f-1];isNaN(h)||null==h||(this.labelFormat&&(h=this.labelFormat(h,f)),u.append("text").classed("gridviz-legend-label",!0).attr("id","ticklabel_"+f).attr("x",a*f).attr("y",this.height+this.tickSize+2).style("font-size",this.labelFontSizeCSS()).style("fill",this.labelColorCSS()).style("color",this.labelColorCSS()).style("text-anchor","middle").style("alignment-baseline","top").style("dominant-baseline","hanging").style("pointer-events","none").text(h))}}}}}])&&nf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);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 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,ff(r.key),r)}}function ff(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 hf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(hf=function(){return!!t})()}function yf(t){return yf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yf(t)}function vf(t,e){return vf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vf(t,e)}var pf=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=yf(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,hf()?Reflect.construct(e,n||[],yf(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.setType("category"),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:"update",value:function(){var t=this;this.div.selectAll("*").remove(),this.makeTitle();var e=this.colorLabel.length;if(0!=e)for(var n=function(){var e=t.colorLabel[r],n=t.div.append("div").classed("gridviz-legend-category",!0);t.bindHover(n,e[0],{enter:function(){return n.classed("gridviz-legend-category--active",!0).select("svg").select("rect, circle").style("stroke","red")},leave:function(){return n.classed("gridviz-legend-category--active",!1).select("svg").select("rect, circle").style("stroke",t.strokeColor)}});var o=t.strokeWidth;if("square"===t.shape){var i=t.dimension.h||15,a=t.dimension.w||20;n.append("div").classed("gridviz-legend-symbol-wrapper",!0).style("display","inline").append("svg").classed("gridviz-legend-graphic",!0).attr("width",a+2*o).attr("height",i+2*o).append("rect").classed("gridviz-legend-swatch",!0).attr("x",o).attr("y",o).attr("width",a).attr("height",i).style("fill",e[0]).style("stroke",t.strokeColor).style("stroke-width",t.strokeWidth)}else{if("circle"!==t.shape)throw new Error("Unexpected shape:"+t.shape);var u=t.dimension.r||8,l=2*u+2*o;n.append("div").classed("gridviz-legend-symbol-wrapper",!0).style("display","inline").append("svg").classed("gridviz-legend-graphic",!0).attr("width",l).attr("height",l).append("circle").classed("gridviz-legend-swatch",!0).attr("cx",u+o).attr("cy",u+o).attr("r",u).style("fill",e[0]).style("stroke",t.strokeColor).style("stroke-width",t.strokeWidth)}t.setText(n.append("div").style("display","inline").classed("gridviz-legend-label",!0).style("padding-left","5px").style("font-size",t.labelFontSizeCSS()).style("fill",t.labelColorCSS()).style("color",t.labelColorCSS()),e[1])},r=0;r<e;r++)n()}}])&&sf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function df(t){return df="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},df(t)}function bf(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 mf(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)?mf(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 mf(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 gf(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,wf(r.key),r)}}function wf(t){var e=function(t){if("object"!=df(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=df(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==df(e)?e:e+""}function Sf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Sf=function(){return!!t})()}function xf(t){return xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xf(t)}function _f(t,e){return _f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_f(t,e)}var Of=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"==df(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,Sf()?Reflect.construct(e,n||[],xf(t).constructor):e.apply(t,n))}(this,e,[t])).setType("size"),t=t||{},n.label=t.label||void 0,n.size=t.size||void 0,n.viewScaleFun=t.viewScaleFun||function(t){return t},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&&_f(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:this.viewScaleFun(t.viewScale)(+r)/t.z){this.labelFormat&&!isNaN(+r)&&(r=this.labelFormat(r));var o=this.div.append("div").classed("gridviz-legend-category",!0),i=function(){return o.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n+e.strokeWidth+2).attr("height",n+e.strokeWidth+2).style("","inline-block")};if("square"===this.shape)i().append("rect").classed("gridviz-legend-symbol",!0).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").classed("gridviz-legend-symbol",!0).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").classed("gridviz-legend-graphic",!0).attr("width",u).attr("height",n).style("","inline-block").append("line").classed("gridviz-legend-symbol",!0).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").classed("gridviz-legend-label",!0).style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSizeCSS()).style("fill",this.labelColorCSS()).style("color",this.labelColorCSS()).text(r+(this.labelUnitText?" ":"")+this.labelUnitText)}}}])&&gf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function jf(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=[],i=bf(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 Of(r))};for(i.s();!(n=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function Pf(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.k||[.9,.5,.2,.05],o=[],i=bf(r);try{var a=function(){var i=e.value;n.title=i==r[0]?n.title:void 0,n.label=function(e,n){return mi(i*Ha(n,t))},o.push(new Of(n))};for(i.s();!(e=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}return o}function Cf(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.labelFormat||function(t){return t},o=n.labelText||Tf(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 Of(n))},u=e.length-1;u>=0;u--)a(u);return i}function kf(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.labelFormat||function(t){return t},r=e.labelText||Tf(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 Of(e))},u=t-1;u>=0;u--)a(u);return o}function Tf(t){return function(e,n){return null==e&&null==n?"":null==n?"> "+t(e):null==e?"< "+t(n):t(e)+" - "+t(n)}}function Af(t){return Af="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},Af(t)}function Ef(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mf(r.key),r)}}function Mf(t){var e=function(t){if("object"!=Af(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Af(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Af(e)?e:e+""}function zf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zf=function(){return!!t})()}function Rf(t){return Rf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rf(t)}function Ff(t,e){return Ff=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ff(t,e)}var If=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=Rf(e),function(t,e){if(e&&("object"==Af(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,zf()?Reflect.construct(e,n||[],Rf(t).constructor):e.apply(t,n))}(this,e,[t])).setType("orientation"),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&&Ff(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){this.div.selectAll("*").remove(),this.makeTitle();var e=this.div.append("div").classed("gridviz-legend-category",!0),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").classed("gridviz-legend-graphic",!0).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").classed("gridviz-legend-symbol",!0).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").classed("gridviz-legend-label",!0).style("display","inline").style("padding-left","5px").style("font-size",this.labelFontSizeCSS()).style("fill",this.labelColorCSS()).style("color",this.labelColorCSS()).text(this.label+(this.labelUnitText?" ":"")+this.labelUnitText)}}],r&&Ef(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);function Bf(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 If(n));return r}function Lf(t){return Lf="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},Lf(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,Df(r.key),r)}}function Df(t){var e=function(t){if("object"!=Lf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Lf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Lf(e)?e:e+""}function Gf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gf=function(){return!!t})()}function Uf(t){return Uf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uf(t)}function Wf(t,e){return Wf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wf(t,e)}var Hf=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"==Lf(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,Gf()?Reflect.construct(e,n||[],Uf(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.setType("ternary"),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&&Wf(t,e)}(e,t),n=e,r=[{key:"update",value:function(t){var e=this;this.div.selectAll("*").remove(),this.makeTitle();var n=this.width,r=.866025*n,o=this.classifier,i=this.selectionColor,a=this.tooltip,u=this.texts||{},l=this,c=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",n+0).attr("height",r+8+28);c.append("text").attr("x",n/2).attr("y",16).classed("gridviz-legend-label",!0).text(this.topText).attr("font-size",14).style("fill",this.labelColorCSS()).attr("text-anchor","middle"),c.append("text").attr("x",0).attr("y",34+r).classed("gridviz-legend-label",!0).text(this.leftText).attr("font-size",14).style("fill",this.labelColorCSS()).attr("text-anchor","start"),c.append("text").attr("x",n).attr("y",34+r).classed("gridviz-legend-label",!0).text(this.rightText).attr("font-size",14).style("fill",this.labelColorCSS()).attr("text-anchor","end");var s=c.append("g").classed("gridviz-legend-triangle",!0).attr("transform","translate(0 18)"),f=function(t,n,r){t.attr("fill",n).classed("gridviz-legend-swatch",!0).style("cursor",e.interactive?"pointer":null).on("mouseover",function(t){gt(this).classed("gridviz-legend-swatch--active",!0).attr("fill",i),l.highlight([n]),a&&r&&(a.html(r),a.setPosition(t),a.show())}).on("mouseout",function(){gt(this).classed("gridviz-legend-swatch--active",!1).attr("fill",n),l.highlight(null),a&&a.hide()}),a&&r&&t.on("mousemove",function(t){a.setPosition(t)})};f(s.append("polygon").attr("points","0,"+r+" "+n/3+","+r+" "+n/2+","+2*r/3+" "+n/6+","+2*r/3),o.colors[0],u[0]),f(s.append("polygon").attr("points",n/2+",0 "+2*n/3+","+r/3+" "+n/2+","+2*r/3+" "+n/3+","+r/3),o.colors[1],u[1]),f(s.append("polygon").attr("points",n+","+r+" "+5*n/6+","+2*r/3+" "+n/2+","+2*r/3+" "+2*n/3+","+r),o.colors[2],u[2]),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+5*n/6+","+2*r/3+" "+2*n/3+","+r/3),o.mixColors[0],u.m12),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+n/3+","+r+" "+2*n/3+","+r),o.mixColors[1],u.m02),f(s.append("polygon").attr("points",n/2+","+2*r/3+" "+n/6+","+2*r/3+" "+n/3+","+r/3),o.mixColors[2],u.m01),this.centerCoefficient&&f(s.append("circle").attr("cx",n/2).attr("cy",2*r/3).attr("r",this.centerCoefficient*r/3),o.centerColor,u.center)}}],r&&Nf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs);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 $f(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"!=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 qf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(qf=function(){return!!t})()}function Xf(){return Xf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Zf(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Xf.apply(null,arguments)}function Zf(t){return Zf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zf(t)}function Kf(t,e){return Kf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kf(t,e)}var Jf=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"==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,qf()?Reflect.construct(e,n||[],Zf(t).constructor):e.apply(t,n))}(this,e,[t]),t=t||{},n.items=(t.items||[]).slice(0,3),n.items.length<2)throw new Error("A Venn legend needs two or three items");return n.radius=t.radius||45,n.opacity=void 0===t.opacity?1:t.opacity,n.styles=t.styles,n._hovered=null,n.setType("venn"),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&&Kf(t,e)}(e,t),n=e,r=[{key:"highlightedStyles",value:function(){return this.styles?this.styles:this.layerStyles&&this.layerStyles.length?this.layerStyles:(t=e,n=this,"function"==typeof(r=Xf(Zf(1&3?t.prototype:t),"highlightedStyles",n))?function(t){return r.apply(n,t)}:r)([]);var t,n,r}},{key:"centers",value:function(){var t=2===this.items.length?1.1*this.radius:1.3*this.radius;return 2===this.items.length?[[-t/2,0],[t/2,0]]:[[-t/2,0],[t/2,0],[0,t*Math.sqrt(3)/2]]}},{key:"update",value:function(){var t=this;this.div.selectAll("*").remove(),this.makeTitle();var e=this.radius,n=this.centers(),r=this.items.length,o=(parseFloat(this.labelFontSize)||14)*(/px$/.test(this.labelFontSize)||!isNaN(+this.labelFontSize)?1:16),i=function(t){return t.length*o*.56},a=i(this.items[0].label)+7,u=i(this.items[1].label)+7,l=n[1][0]-n[0][0],c=n.map(function(t){return a+e+(t[0]-n[0][0])}),s=n.map(function(t){return e+t[1]}),f=Math.ceil(a+2*e+l+u),h=Math.ceil(2===r?2*e:n[2][1]+2*e+7+o),y=this.div.append("svg").classed("gridviz-legend-graphic",!0).attr("width",f).attr("height",h).attr("role","img").attr("aria-label",(this.title?this.title+": ":"")+this.items.map(function(t){return t.label}).join(", ")).style("overflow","visible").style("isolation","isolate"),v=this.items.map(function(n,r){return y.append("circle").classed("gridviz-legend-swatch",!0).attr("cx",c[r]).attr("cy",s[r]).attr("r",e).style("fill",n.color).style("fill-opacity",t.opacity).style("mix-blend-mode","multiply").style("transition","opacity 0.1s")}),p=this.items.map(function(n,r){var i=0===r?"end":1===r?"start":"middle",a=0===r?c[0]-e-7:1===r?c[1]+e+7:c[2],u=2===r?s[2]+e+o:s[r],l=y.append("text").classed("gridviz-legend-label",!0).attr("x",a).attr("y",u).attr("text-anchor",i).attr("dominant-baseline",2===r?"auto":"central").style("font-size",t.labelFontSizeCSS()).style("fill",t.labelColorCSS());return t.setText(l,n.label),l});if(this.interactive){var d=function(e){var n=e.join(",");n!==t._hovered&&(t._hovered=n||null,v.forEach(function(t,n){return t.classed("gridviz-legend-swatch--active",e.includes(n)).style("opacity",e.length&&!e.includes(n)?.25:1)}),t.highlight(e.length?e.map(function(e){return t.items[e].color}):null))};y.style("cursor","pointer").on("mousemove",function(t){for(var n=y.node().getBoundingClientRect(),o=t.clientX-n.left,i=t.clientY-n.top,a=[],u=0;u<r;u++)Math.hypot(o-c[u],i-s[u])<=e&&a.push(u);!a.length&&t.target.classList.contains("gridviz-legend-label")||d(a)}).on("mouseleave",function(){return d([])}),p.forEach(function(t,e){return t.style("cursor","pointer").on("mouseenter",function(){return d([e])})})}}}],r&&$f(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Vs),Qf=function(t){return t};Qf.invert=Qf;var th=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return Qf;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},eh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(0==t)return Qf;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},nh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return Qf;var e=function(e){return Math.pow(e,t)},n=1/t;return e.invert=function(t){return Math.pow(t,n)},e},rh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(1==t)return Qf;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},oh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return Qf;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}},ih=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;if(0==t)return Qf;var e=oh(t);return function(t){return 1-e(1-t)}};const ah=Math.PI/180,uh=180/Math.PI,lh=.96422,ch=.82521,sh=4/29,fh=6/29,hh=3*fh*fh,yh=fh*fh*fh;function vh(t){if(t instanceof dh)return new dh(t.l,t.a,t.b,t.opacity);if(t instanceof Sh)return xh(t);t instanceof Ie||(t=Re(t));var e,n,r=wh(t.r),o=wh(t.g),i=wh(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)/lh),n=bh((.0139322*r+.0971045*o+.7141733*i)/ch)),new dh(116*a-16,500*(e-a),200*(a-n),t.opacity)}function ph(t,e,n,r){return 1===arguments.length?vh(t):new dh(t,e,n,null==r?1:r)}function dh(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function bh(t){return t>yh?Math.pow(t,1/3):t/hh+sh}function mh(t){return t>fh?t*t*t:hh*(t-sh)}function gh(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function wh(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Sh(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function xh(t){if(isNaN(t.h))return new dh(t.l,0,0,t.opacity);var e=t.h*ah;return new dh(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}function _h(t,e){var n=Ze((t=ph(t)).l,(e=ph(e)).l),r=Ze(t.a,e.a),o=Ze(t.b,e.b),i=Ze(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 Oh(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 jh(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)?jh(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 jh(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}ye(dh,ph,ve(pe,{brighter(t){return new dh(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new dh(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 Ie(gh(3.1338561*(e=lh*mh(e))-1.6168667*(t=1*mh(t))-.4906146*(n=ch*mh(n))),gh(-.9787684*e+1.9161415*t+.033454*n),gh(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),ye(Sh,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Sh)return new Sh(t.h,t.c,t.l,t.opacity);if(t instanceof dh||(t=vh(t)),0===t.a&&0===t.b)return new Sh(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*uh;return new Sh(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Sh(t,e,n,null==r?1:r)},ve(pe,{brighter(t){return new Sh(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new Sh(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return xh(this).rgb()}}));var Ph=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t[0],o=t[1],i=t[2],a=Oh(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},Ch=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=Oh(n||["red","green","blue"],3),i=o[0],a=o[1],u=o[2],l=r.colorInterpolation||_h,c=null==r.withMixedClasses||r.withMixedClasses,s=function(t,e){return l(t,e)(.5)},f=Oh(r.mixedColors||c?[s(a,u),s(i,u),s(i,a)]:[],3),h=f[0],y=f[1],v=f[2],p=r.centerColor||l(s(i,a),u)(.333),d=Ph(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?v:"center"==e?p:r.defaultColor||"black"};return b.center=d.center,b.centerCoefficient=r.centerCoefficient,b.colors=[i,a,u],b.mixColors=[h,y,v],b.centerColor=p,b.classifier=d,b};function kh(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 Th,Ah=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Eh(t){if(!(e=Ah.exec(t)))throw new Error("invalid format: "+t);var e;return new Mh({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 Mh(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 zh(t,e){var n=kh(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")}Eh.prototype=Mh.prototype,Mh.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Rh={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>zh(100*t,e),r:zh,s:function(t,e){var n=kh(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(Th=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")+kh(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Fh(t){return t}var Ih,Bh=Array.prototype.map,Lh=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Nh(t){return Ih=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Fh:(e=Bh.call(t.grouping,Number),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)}),o=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Fh:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Bh.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=Eh(t)).fill,n=t.align,f=t.sign,h=t.symbol,y=t.zero,v=t.width,p=t.comma,d=t.precision,b=t.trim,m=t.type;"n"===m?(p=!0,m="g"):Rh[m]||(void 0===d&&(d=12),b=!0,m="g"),(y||"0"===e&&"="===n)&&(y=!0,e="0",n="=");var g="$"===h?o:"#"===h&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===h?i:/[%p]/.test(m)?l:"",S=Rh[m],x=/[defgprs%]/.test(m);function _(t){var o,i,l,h=g,_=w;if("c"===m)_=S(t)+_,t="";else{var O=(t=+t)<0||1/t<0;if(t=isNaN(t)?s:S(Math.abs(t),d),b&&(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(!+t[r])break t;o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),O&&0===+t&&"+"!==f&&(O=!1),h=(O?"("===f?f:c:"-"===f||"("===f?"":f)+h,_=("s"===m?Lh[8+Th/3]:"")+_+(O&&"("===f?")":""),x)for(o=-1,i=t.length;++o<i;)if(48>(l=t.charCodeAt(o))||l>57){_=(46===l?a+t.slice(o+1):t.slice(o))+_,t=t.slice(0,o);break}}p&&!y&&(t=r(t,1/0));var j=h.length+t.length+_.length,P=j<v?new Array(v-j+1).join(e):"";switch(p&&y&&(t=r(P+t,P.length?v-_.length:1/0),P=""),n){case"<":t=h+t+_+P;break;case"=":t=h+P+t+_;break;case"^":t=P.slice(0,j=P.length>>1)+h+t+_+P.slice(j);break;default:t=P+h+t+_}return u(t)}return d=void 0===d?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),_.toString=function(){return t+""},_}return{format:f,formatPrefix:function(t,e){var n,r=f(((t=Eh(t)).type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=kh(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-o),a=Lh[8+o/3];return function(t){return r(i*t)+a}}}}(t),Ih.format,Ih.formatPrefix,Ih}Nh({thousands:",",grouping:[3],currency:["$",""]});var Dh=Dn.getParameterByName;return Nh({decimal:".",thousands:" ",grouping:[3],currency:["","€"]}),e})());