New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@flourish/legend

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flourish/legend - npm Package Compare versions

Comparing version 8.0.2 to 8.0.3

@@ -1,1 +0,1 @@

(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports):typeof define==="function"&&define.amd?define(["exports"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,e(t.legend={}))})(this,(function(t){"use strict";var e="$";function n(){}n.prototype=i.prototype={constructor:n,has:function(t){return e+t in this},get:function(t){return this[e+t]},set:function(t,n){this[e+t]=n;return this},remove:function(t){var n=e+t;return n in this&&delete this[n]},clear:function(){for(var t in this)if(t[0]===e)delete this[t]},keys:function(){var t=[];for(var n in this)if(n[0]===e)t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)if(n[0]===e)t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)if(n[0]===e)t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)if(n[0]===e)++t;return t},empty:function(){for(var t in this)if(t[0]===e)return false;return true},each:function(t){for(var n in this)if(n[0]===e)t(this[n],n.slice(1),this)}};function i(t,e){var i=new n;if(t instanceof n)t.each((function(t,e){i.set(e,t)}));else if(Array.isArray(t)){var r=-1,o=t.length,a;if(e==null)while(++r<o)i.set(r,t[r]);else while(++r<o)i.set(e(a=t[r],r,t),a)}else if(t)for(var s in t)i.set(s,t[s]);return i}function r(){}var o=i.prototype;r.prototype={constructor:r,has:o.has,add:function(t){t+="";this[e+t]=t;return this},remove:o.remove,clear:o.clear,values:o.keys,size:o.size,empty:o.empty,each:o.each};function a(t,e){if(typeof t=="string")t=document.querySelector(t);if(!t){console.error("No valid target in createScreenshotSVG");return null}const{width:n,height:i,x:r,y:o}=t.getBoundingClientRect();const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.id=e;a.classList.add("flourish-screenshot-svg-container");a.style.left=r+"px";a.style.top=o+"px";a.style.width=n+"px";a.style.height=i+"px";a.style.position="absolute";t.appendChild(a);function s(e){if(typeof e=="string")e=t.querySelectorAll(e);if(!e){console.error("No valid els inside addTextElements");return null}for(const t of e){const{x:e,y:n,width:i}=t.getBoundingClientRect();const r=document.createElementNS("http://www.w3.org/2000/svg","text");const{color:o,"font-family":s,"font-size":l,"font-weight":c,"line-height":h,"padding-left":f,"padding-top":d}=window.getComputedStyle(t);const p=`${c} ${l} ${s}`;const g=u(t.innerText,p,null,Math.ceil(i));const _=isNaN(parseFloat(h))?parseFloat(l)*1.2+"px":h;const m=window.getComputedStyle(t.closest("[style*='opacity']")||t).opacity;g.forEach(((t,n)=>{const i=document.createElementNS("http://www.w3.org/2000/svg","tspan");i.innerHTML=t;i.setAttribute("dy",n===0?parseFloat(d):_);i.setAttribute("dx",parseFloat(f));i.setAttribute("x",e);i.setAttribute("opacity",m);r.appendChild(i)}));r.style.dominantBaseline="text-before-edge";r.setAttribute("x",e+"px");r.setAttribute("y",n+"px");r.setAttribute("font-family",s);r.setAttribute("font-size",l);r.setAttribute("font-weight",c);r.setAttribute("fill",o);a.appendChild(r)}return this}function l(e){if(typeof e=="string")e=t.querySelectorAll(e);if(!e){console.error("No valid els inside addCircleElements");return null}for(const t of e){const e=document.createElementNS("http://www.w3.org/2000/svg","circle");const{x:n,y:i,width:r}=t.getBoundingClientRect();const o=window.getComputedStyle(t)["background-color"];const s=window.getComputedStyle(t.closest("[style*='opacity']")||t).opacity;const l=r/2;e.setAttribute("cx",n+l+"px");e.setAttribute("cy",i+l+"px");e.setAttribute("r",l+"px");e.setAttribute("opacity",s);e.setAttribute("fill",o);if(o==="rgba(0, 0, 0, 0)")e.setAttribute("stroke","#CCC");a.appendChild(e)}return this}function c(e,n,i){if(typeof e=="string")e=t.querySelector(e);if(!e){console.error("No valid els inside addCircleElements");return null}const r=document.createElementNS("http://www.w3.org/2000/svg","g");const{x:o,y:s,width:l,height:u}=e.getBoundingClientRect();const{max:c,min:h}=i;const f=c-h;for(let t=0;t<=l;t++){const e=document.createElementNS("http://www.w3.org/2000/svg","line");e.setAttribute("stroke",n(h+t*f/l));e.setAttribute("x1",t+o);e.setAttribute("y1",s);e.setAttribute("x2",t+o);e.setAttribute("y2",u+s);r.appendChild(e)}a.appendChild(r);return this}function h(){a.remove()}return{addTextElements:s,addCircleElements:l,addGradient:c,remove:h}}const s=document.createElement("canvas");const l=s.getContext("2d");function u(t,e,n,i,r=true){if(typeof t!=="string")t=String(t);const o=t=>l.measureText(t).width>i;const a=(t,e)=>{let n=l.measureText(t).width;if(n<=e){return t}let i=1;let r=t;do{r=t.substring(0,t.length-i)+"…";n=l.measureText(r).width}while(n>e&&++i<t.length);if(r.length<1)r=t.substring(0,1)+"…";return r};l.font=e;let s=[];Object.defineProperty(s,"widest_line",{value:0,enumerable:true,writable:true});Object.defineProperty(s,"has_truncated",{value:false,enumerable:true,writable:true});if(typeof t==="undefined"||Number.isInteger(n)&&n<=0)return s;if(t.length===0){s.push("");return s}if(i<=0){if(t.length>0){s.push(t.slice(0,1)+"…");s.widest_line=l.measureText(s[0]).width}return s}if(!t||t.length===0||n===0||i<=0)return s;const u=t.split(/\s+/g);if(!o(t)){s.push(t);s.widest_line=l.measureText(t).width;s.has_truncated=false;return s}let c=new String(u[0]);if(c&&o(c)){if(r){c=a(c,i)}else if(u.length>1){c+="…"}s.push(c);s.widest_line=l.measureText(c).width;s.has_truncated=true;return s}let h="";let f=false;u.forEach((t=>{if(f)return;if(o(h+(h?" ":"")+t)){if(h){const t=l.measureText(h).width;if(t>i){h=a(h,i);f=true}s.push(h);h=""}h=t}else{h+=(h?" ":"")+t}}));if(h&&!f){s.push(a(h,i))}if(s.length>n){const t=s.length>n;if(t&&Number.isInteger(n)){s.splice(n,s.length-n);let t=s[s.length-1];if(o(t+"…")){t=a(t,i-l.measureText("…").width)}if(t.slice(-1)!=="…"){t+="…"}s[s.length-1]=t;f=true}}s.widest_line=Math.max(...s.map((t=>l.measureText(t).width)));s.has_truncated=f;return s}var c="http://www.w3.org/1999/xhtml";var h={svg:"http://www.w3.org/2000/svg",xhtml:c,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function f(t){var e=t+="",n=e.indexOf(":");if(n>=0&&(e=t.slice(0,n))!=="xmlns")t=t.slice(n+1);return h.hasOwnProperty(e)?{space:h[e],local:t}:t}function d(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===c&&e.documentElement.namespaceURI===c?e.createElement(t):e.createElementNS(n,t)}}function p(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function g(t){var e=f(t);return(e.local?p:d)(e)}function _(){}function m(t){return t==null?_:function(){return this.querySelector(t)}}function y(t){if(typeof t!=="function")t=m(t);for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r){for(var o=e[r],a=o.length,s=i[r]=new Array(a),l,u,c=0;c<a;++c){if((l=o[c])&&(u=t.call(l,l.__data__,c,o))){if("__data__"in l)u.__data__=l.__data__;s[c]=u}}}return new Jt(i,this._parents)}function v(){return[]}function w(t){return t==null?v:function(){return this.querySelectorAll(t)}}function b(t){if(typeof t!=="function")t=w(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o){for(var a=e[o],s=a.length,l,u=0;u<s;++u){if(l=a[u]){i.push(t.call(l,l.__data__,u,a));r.push(l)}}}return new Jt(i,r)}function x(t){return function(){return this.matches(t)}}function M(t){if(typeof t!=="function")t=x(t);for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r){for(var o=e[r],a=o.length,s=i[r]=[],l,u=0;u<a;++u){if((l=o[u])&&t.call(l,l.__data__,u,o)){s.push(l)}}}return new Jt(i,this._parents)}function k(t){return new Array(t.length)}function A(){return new Jt(this._enter||this._groups.map(k),this._parents)}function N(t,e){this.ownerDocument=t.ownerDocument;this.namespaceURI=t.namespaceURI;this._next=null;this._parent=t;this.__data__=e}N.prototype={constructor:N,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)}};function S(t){return function(){return t}}var E="$";function C(t,e,n,i,r,o){var a=0,s,l=e.length,u=o.length;for(;a<u;++a){if(s=e[a]){s.__data__=o[a];i[a]=s}else{n[a]=new N(t,o[a])}}for(;a<l;++a){if(s=e[a]){r[a]=s}}}function T(t,e,n,i,r,o,a){var s,l,u={},c=e.length,h=o.length,f=new Array(c),d;for(s=0;s<c;++s){if(l=e[s]){f[s]=d=E+a.call(l,l.__data__,s,e);if(d in u){r[s]=l}else{u[d]=l}}}for(s=0;s<h;++s){d=E+a.call(t,o[s],s,o);if(l=u[d]){i[s]=l;l.__data__=o[s];u[d]=null}else{n[s]=new N(t,o[s])}}for(s=0;s<c;++s){if((l=e[s])&&u[f[s]]===l){r[s]=l}}}function z(t,e){if(!t){d=new Array(this.size()),u=-1;this.each((function(t){d[++u]=t}));return d}var n=e?T:C,i=this._parents,r=this._groups;if(typeof t!=="function")t=S(t);for(var o=r.length,a=new Array(o),s=new Array(o),l=new Array(o),u=0;u<o;++u){var c=i[u],h=r[u],f=h.length,d=t.call(c,c&&c.__data__,u,i),p=d.length,g=s[u]=new Array(p),_=a[u]=new Array(p),m=l[u]=new Array(f);n(c,h,g,_,m,d,e);for(var y=0,v=0,w,b;y<p;++y){if(w=g[y]){if(y>=v)v=y+1;while(!(b=_[v])&&++v<p);w._next=b||null}}}a=new Jt(a,i);a._enter=s;a._exit=l;return a}function L(){return new Jt(this._exit||this._groups.map(k),this._parents)}function F(t,e,n){var i=this.enter(),r=this,o=this.exit();i=typeof t==="function"?t(i):i.append(t+"");if(e!=null)r=e(r);if(n==null)o.remove();else n(o);return i&&r?i.merge(r).order():r}function P(t){for(var e=this._groups,n=t._groups,i=e.length,r=n.length,o=Math.min(i,r),a=new Array(i),s=0;s<o;++s){for(var l=e[s],u=n[s],c=l.length,h=a[s]=new Array(c),f,d=0;d<c;++d){if(f=l[d]||u[d]){h[d]=f}}}for(;s<i;++s){a[s]=e[s]}return new Jt(a,this._parents)}function j(){for(var t=this._groups,e=-1,n=t.length;++e<n;){for(var i=t[e],r=i.length-1,o=i[r],a;--r>=0;){if(a=i[r]){if(o&&a.compareDocumentPosition(o)^4)o.parentNode.insertBefore(a,o);o=a}}}return this}function R(t){if(!t)t=q;function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var a=n[o],s=a.length,l=r[o]=new Array(s),u,c=0;c<s;++c){if(u=a[c]){l[c]=u}}l.sort(e)}return new Jt(r,this._parents).order()}function q(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function B(){var t=arguments[0];arguments[0]=this;t.apply(null,arguments);return this}function O(){var t=new Array(this.size()),e=-1;this.each((function(){t[++e]=this}));return t}function $(){for(var t=this._groups,e=0,n=t.length;e<n;++e){for(var i=t[e],r=0,o=i.length;r<o;++r){var a=i[r];if(a)return a}}return null}function I(){var t=0;this.each((function(){++t}));return t}function D(){return!this.node()}function V(t){for(var e=this._groups,n=0,i=e.length;n<i;++n){for(var r=e[n],o=0,a=r.length,s;o<a;++o){if(s=r[o])t.call(s,s.__data__,o,r)}}return this}function H(t){return function(){this.removeAttribute(t)}}function G(t){return function(){this.removeAttributeNS(t.space,t.local)}}function U(t,e){return function(){this.setAttribute(t,e)}}function W(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function X(t,e){return function(){var n=e.apply(this,arguments);if(n==null)this.removeAttribute(t);else this.setAttribute(t,n)}}function Y(t,e){return function(){var n=e.apply(this,arguments);if(n==null)this.removeAttributeNS(t.space,t.local);else this.setAttributeNS(t.space,t.local,n)}}function Z(t,e){var n=f(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?G:H:typeof e==="function"?n.local?Y:X:n.local?W:U)(n,e))}function J(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function K(t){return function(){this.style.removeProperty(t)}}function Q(t,e,n){return function(){this.style.setProperty(t,e,n)}}function tt(t,e,n){return function(){var i=e.apply(this,arguments);if(i==null)this.style.removeProperty(t);else this.style.setProperty(t,i,n)}}function et(t,e,n){return arguments.length>1?this.each((e==null?K:typeof e==="function"?tt:Q)(t,e,n==null?"":n)):nt(this.node(),t)}function nt(t,e){return t.style.getPropertyValue(e)||J(t).getComputedStyle(t,null).getPropertyValue(e)}function it(t){return function(){delete this[t]}}function rt(t,e){return function(){this[t]=e}}function ot(t,e){return function(){var n=e.apply(this,arguments);if(n==null)delete this[t];else this[t]=n}}function at(t,e){return arguments.length>1?this.each((e==null?it:typeof e==="function"?ot:rt)(t,e)):this.node()[t]}function st(t){return t.trim().split(/^|\s+/)}function lt(t){return t.classList||new ut(t)}function ut(t){this._node=t;this._names=st(t.getAttribute("class")||"")}ut.prototype={add:function(t){var e=this._names.indexOf(t);if(e<0){this._names.push(t);this._node.setAttribute("class",this._names.join(" "))}},remove:function(t){var e=this._names.indexOf(t);if(e>=0){this._names.splice(e,1);this._node.setAttribute("class",this._names.join(" "))}},contains:function(t){return this._names.indexOf(t)>=0}};function ct(t,e){var n=lt(t),i=-1,r=e.length;while(++i<r)n.add(e[i])}function ht(t,e){var n=lt(t),i=-1,r=e.length;while(++i<r)n.remove(e[i])}function ft(t){return function(){ct(this,t)}}function dt(t){return function(){ht(this,t)}}function pt(t,e){return function(){(e.apply(this,arguments)?ct:ht)(this,t)}}function gt(t,e){var n=st(t+"");if(arguments.length<2){var i=lt(this.node()),r=-1,o=n.length;while(++r<o)if(!i.contains(n[r]))return false;return true}return this.each((typeof e==="function"?pt:e?ft:dt)(n,e))}function _t(){this.textContent=""}function mt(t){return function(){this.textContent=t}}function yt(t){return function(){var e=t.apply(this,arguments);this.textContent=e==null?"":e}}function vt(t){return arguments.length?this.each(t==null?_t:(typeof t==="function"?yt:mt)(t)):this.node().textContent}function wt(){this.innerHTML=""}function bt(t){return function(){this.innerHTML=t}}function xt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e==null?"":e}}function Mt(t){return arguments.length?this.each(t==null?wt:(typeof t==="function"?xt:bt)(t)):this.node().innerHTML}function kt(){if(this.nextSibling)this.parentNode.appendChild(this)}function At(){return this.each(kt)}function Nt(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function St(){return this.each(Nt)}function Et(t){var e=typeof t==="function"?t:g(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))}function Ct(){return null}function Tt(t,e){var n=typeof t==="function"?t:g(t),i=e==null?Ct:typeof e==="function"?e:m(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))}function zt(){var t=this.parentNode;if(t)t.removeChild(this)}function Lt(){return this.each(zt)}function Ft(){var t=this.cloneNode(false),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Pt(){var t=this.cloneNode(true),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function jt(t){return this.select(t?Pt:Ft)}function Rt(t){return arguments.length?this.property("__data__",t):this.node().__data__}var qt={};var Bt=null;if(typeof document!=="undefined"){var Ot=document.documentElement;if(!("onmouseenter"in Ot)){qt={mouseenter:"mouseover",mouseleave:"mouseout"}}}function $t(t,e,n){t=It(t,e,n);return function(e){var n=e.relatedTarget;if(!n||n!==this&&!(n.compareDocumentPosition(this)&8)){t.call(this,e)}}}function It(t,e,n){return function(i){var r=Bt;Bt=i;try{t.call(this,this.__data__,e,n)}finally{Bt=r}}}function Dt(t){return 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);return{type:t,name:e}}))}function Vt(t){return function(){var e=this.__on;if(!e)return;for(var n=0,i=-1,r=e.length,o;n<r;++n){if(o=e[n],(!t.type||o.type===t.type)&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.capture)}else{e[++i]=o}}if(++i)e.length=i;else delete this.__on}}function Ht(t,e,n){var i=qt.hasOwnProperty(t.type)?$t:It;return function(r,o,a){var s=this.__on,l,u=i(e,o,a);if(s)for(var c=0,h=s.length;c<h;++c){if((l=s[c]).type===t.type&&l.name===t.name){this.removeEventListener(l.type,l.listener,l.capture);this.addEventListener(l.type,l.listener=u,l.capture=n);l.value=e;return}}this.addEventListener(t.type,u,n);l={type:t.type,name:t.name,value:e,listener:u,capture:n};if(!s)this.__on=[l];else s.push(l)}}function Gt(t,e,n){var i=Dt(t+""),r,o=i.length,a;if(arguments.length<2){var s=this.node().__on;if(s)for(var l=0,u=s.length,c;l<u;++l){for(r=0,c=s[l];r<o;++r){if((a=i[r]).type===c.type&&a.name===c.name){return c.value}}}return}s=e?Ht:Vt;if(n==null)n=false;for(r=0;r<o;++r)this.each(s(i[r],e,n));return this}function Ut(t,e,n){var i=J(t),r=i.CustomEvent;if(typeof r==="function"){r=new r(e,n)}else{r=i.document.createEvent("Event");if(n)r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail;else r.initEvent(e,false,false)}t.dispatchEvent(r)}function Wt(t,e){return function(){return Ut(this,t,e)}}function Xt(t,e){return function(){return Ut(this,t,e.apply(this,arguments))}}function Yt(t,e){return this.each((typeof e==="function"?Xt:Wt)(t,e))}var Zt=[null];function Jt(t,e){this._groups=t;this._parents=e}Jt.prototype={constructor:Jt,select:y,selectAll:b,filter:M,data:z,enter:A,exit:L,join:F,merge:P,order:j,sort:R,call:B,nodes:O,node:$,size:I,empty:D,each:V,attr:Z,style:et,property:at,classed:gt,text:vt,html:Mt,raise:At,lower:St,append:Et,insert:Tt,remove:Lt,clone:jt,datum:Rt,on:Gt,dispatch:Yt};function Kt(t){return typeof t==="string"?new Jt([[document.querySelector(t)]],[document.documentElement]):new Jt([[t]],Zt)}function Qt(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function te(t){if(t.length===1)t=ee(t);return{left:function(e,n,i,r){if(i==null)i=0;if(r==null)r=e.length;while(i<r){var o=i+r>>>1;if(t(e[o],n)<0)i=o+1;else r=o}return i},right:function(e,n,i,r){if(i==null)i=0;if(r==null)r=e.length;while(i<r){var o=i+r>>>1;if(t(e[o],n)>0)r=o;else i=o+1}return i}}}function ee(t){return function(e,n){return Qt(t(e),n)}}var ne=te(Qt);var ie=ne.right;var re=Math.sqrt(50),oe=Math.sqrt(10),ae=Math.sqrt(2);function se(t,e,n){var i,r=-1,o,a,s;e=+e,t=+t,n=+n;if(t===e&&n>0)return[t];if(i=e<t)o=t,t=e,e=o;if((s=le(t,e,n))===0||!isFinite(s))return[];if(s>0){t=Math.ceil(t/s);e=Math.floor(e/s);a=new Array(o=Math.ceil(e-t+1));while(++r<o)a[r]=(t+r)*s}else{t=Math.floor(t*s);e=Math.ceil(e*s);a=new Array(o=Math.ceil(t-e+1));while(++r<o)a[r]=(t-r)/s}if(i)a.reverse();return a}function le(t,e,n){var i=(e-t)/Math.max(0,n),r=Math.floor(Math.log(i)/Math.LN10),o=i/Math.pow(10,r);return r>=0?(o>=re?10:o>=oe?5:o>=ae?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=re?10:o>=oe?5:o>=ae?2:1)}function ue(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;if(o>=re)r*=10;else if(o>=oe)r*=5;else if(o>=ae)r*=2;return e<t?-r:r}function ce(){this.declarations=[];return this}ce.prototype.select=function(t){if(!t)return this;var e=new he(t);e.parent=this;this.addDeclaration(e);return e};ce.prototype.addDeclaration=function(t){this.declarations.push(t);return this};ce.prototype.print=function(){var t="";this.declarations.forEach((function(e){t+=e.selector+" {\n";e.styles.forEach((function(e){t+="\t"+e[0]+": "+e[1]+";\n"}));t+="}\n\n"}));return t};ce.prototype.clear=function(){this.declarations=[];return this};function he(t){this.selector=t;this.styles=[];return this}he.prototype.style=function(t,e){var n=typeof value_=="function"?e():e;if(n!==""&&n!==null&&n!==undefined)this.styles.push([t,n]);return this};he.prototype.select=function(t){return this.parent.select(this.selector+" "+t)};var fe="0.2em";function de(t){t.appendChild(this._container.node());if(!document.querySelector("#legend-styles")){var e=document.createElement("style");var n=new ce;n.select(".fl-legend-container.interactive .fl-legend-item:hover").style("opacity",.75).style("cursor","pointer");e.id="legend-styles";e.type="text/css";e.innerHTML=n.print();document.head.appendChild(e)}return this}function pe(t){this._formatFunction=t;return this}function ge(){return this._container}function _e(t){if(t===undefined)return this._visible;this._visible=t;return this}function me(t){if(t===undefined)return this._allow_single_entry;this._allow_single_entry=t;return this}function ye(t){if(t===undefined)return this._auto_title;this._auto_title=t;return this}function ve(){var t=this;var e=t._state.title_mode=="auto"?t.autoTitle():t._state.title;this._container.select(".fl-legend-title").text(e).style("display",(function(){if(!e.trim())return"none";else if(t._state.orientation===undefined)return"inline-block";else return t._state.orientation=="horizontal"?"inline-block":"block"})).style("padding-inline-start",0).style("padding-inline-end",fe)}function we(t,e){var n=t.sort(Qt);var i=n[0];var r=n[n.length-1];var o=n.length>2?n[1]:null;if(e.legend_min!==null||e.legend_max!==null){if(e.legend_min!==null&&e.legend_max!==null){if(e.legend_min<e.legend_max){i=e.legend_min;r=e.legend_max}}else if(e.legend_min!==null){i=e.legend_min;if(r<i)r=i+2}else{r=e.legend_max;if(i>r)i=r-2}}if(o!==null&&(i>o||r<o))o=null;var a=[i];if(o!==null)a.push(o);a.push(r);a.min=i;a.max=r;a.mid=o;return a}function be(t){return t*parseFloat(getComputedStyle(document.documentElement).fontSize)}function xe(t){return Math.log(t)/Math.LN10}function Me(t){if(t===0)return 0;var e=Math.floor(xe(t));var n=t/Math.pow(10,e);var i=Math.floor(n);var r=i*Math.pow(10,e);if(e<0){var o=-e;r=o<=100?parseFloat(r.toFixed(o)):0}return r}var ke=0;var Ae=Object.freeze({show_legend:true,title_mode:"auto",title:"",max_width:100,swatch_width:.75,swatch_height:1,swatch_radius:3,swatch_outline:false,swatch_outline_color:null,legend_items_padding:.5,icon_height:1,icon_color:"#777777",icon_fill_opacity:1,icon_stroke_opacity:1,order_override:"",orientation:"horizontal"});function Ne(t){this._state=t;for(var e in Ae){if(this._state[e]===undefined)this._state[e]=Ae[e]}this._colorFunction=undefined;this._formatFunction=undefined;this._legend_items=[];this._filtered_items=[];this._eventListeners=[];this._id="fl-legend-discrete-color-"+ke;this._visible=true;this._auto_title="";this._container=Kt(document.createElement("div")).attr("class","fl-legend-container").attr("id",this._id);this._container.append("p").attr("class","fl-legend-title");ke++;return this}Ne.prototype.appendTo=de;Ne.prototype.format=pe;Ne.prototype.getContainer=ge;Ne.prototype.visible=_e;Ne.prototype.allowSingleEntry=me;Ne.prototype.autoTitle=ye;Ne.prototype._updateTitle=ve;Ne.prototype.data=function(t,e){this._colorFunction=e;if(!t&&!e)return this._legend_items.slice();if(!e)this._legend_items=Array.isArray(t)?t.slice():[];else if(!Array.isArray(t))this._legend_items=[];else{this._legend_items=t.slice().map((function(t,n){var i=typeof t=="object"?t?.label||"":t;return!i?null:{label:i,color:e(i),index:n}})).filter((function(t){return t!==null}))}return this};Ne.prototype.filtered=function(t){if(!t)return this._filtered_items.slice();this._filtered_items=Array.isArray(t)?t.slice():[];return this};Ne.prototype.on=function(t,e){if(!this._container)return this;if(e&&this._eventListeners.indexOf(t)<0)this._eventListeners.push(t);else if(!e)this._eventListeners.splice(this._eventListeners.indexOf[t],1);this._container.classed("interactive",this._eventListeners.length>0);if(!e){this._container.on(t,null);if(t=="click")this._container.on("keydown",null)}else{this._container.on(t,(function(){var t=Bt.target,n=t.parentNode;var i=t.classList.contains("fl-legend-item")?t:n.classList.contains("fl-legend-item")?n:null;if(i){var r=Kt(i).datum();e.call(i,r,r.index)}}));if(t=="click"){this._container.on("keydown",(function(){if(Bt.key!="Enter")return;var t=Bt.target,n=t.parentNode;var i=t.classList.contains("fl-legend-item")?t:n.classList.contains("fl-legend-item")?n:null;if(i){var r=Kt(i).datum();e.call(i,r,r.index)}}))}}return this};Ne.prototype.update=function(){const t=this._allow_single_entry?1:2;const e=this._state.show_legend&&this._visible&&this._legend_items.length>=t;this._container.style("display",e?"":"none");if(!e)return this;this._updateTitle();this._updateLegend();return this};function Se(t,e){var n={};var i=e.split(/\s*\n\s*/);for(var r=0;r<i.length;r++){var o=i[r];n[o]=r}var a=[];for(var s=0;s<t.length;s++){var l=t[s];var u=n[l.label];if(u===undefined)continue;a[u]=l}return a.filter((function(t){return t!==undefined}))}Ne.prototype._updateLegend=function(){var t=this;var e=this._formatFunction;this._container.style("max-width",be(this._state.max_width)+"px").style("display","inline-flex").style("flex-wrap","wrap").style("align-items",this._state.orientation=="horizontal"?"center":"start").style("align-content",this._state.orientation=="horizontal"?"center":null).style("flex-direction",this._state.orientation=="horizontal"?null:"column").style("max-height",`${window.innerHeight*.5}px`).style("overflow-y","auto");var n;if(this._state.order_override.trim()){n=Se(this._legend_items,this._state.order_override)}else{n=this._legend_items}var i=this._container.selectAll(".fl-legend-item").data(n);var r=i.enter().append("div").attr("class","fl-legend-item");r.append("div").attr("class","fl-legend-swatch");let o=r.append("div").attr("class","fl-legend-icon-container");o.append("svg").attr("class","fl-legend-icon fl-ignore-svg-download").append("path");o.append("img").attr("class","fl-legend-icon");o.append("div").attr("class","fl-legend-icon");r.append("p").attr("class","fl-legend-label");var a=i.merge(r);var s=this._eventListeners.length>0;a.style("display",this._state.orientation=="horizontal"?"inline-flex":"flex").style("flex-direction",(function(t){return t.reverse?"row-reverse":"row"})).style("opacity",(function(e){return t._filtered_items.indexOf(e.label)>-1?.2:""})).style("align-items","center").style("padding-inline-end",this._state.orientation=="horizontal"?this._state.legend_items_padding+"rem":0).style("padding-inline-start",0).attr("tabindex",s?"0":null).attr("role",s?"button":null);a.select(".fl-legend-swatch").style("height",this._state.swatch_height+"rem").style("width",this._state.swatch_width+"rem").style("border-radius",this._state.swatch_radius+"px").style("background-color",(function(t){return t.color})).style("border",(()=>{if(!this._state.swatch_outline)return"none";else if(!this._state.swatch_outline_color)return"1px solid";else return`1px solid ${this._state.swatch_outline_color}`})).style("box-sizing",this._state.swatch_outline?"border-box":"content-box").style("flex-shrink","0").style("display",(function(t){return t.icon?"none":null}));const l=a.filter((t=>t.icon));l.each((function(e){let n=Math.ceil(be(t._state.icon_height));let i="auto";if(e.icon.width){let n=e.icon.width;let r=e.icon.height;let o=e.outline?r*e.stroke_thickness:0;n+=o;r+=o;let a=n/r;let s=be(t._state.icon_height*a);i=Math.ceil(s)}let r=t._state.text_size*.25+"rem";Kt(this).selectAll(".fl-legend-icon").attr("height",n).attr("width",i).style("margin-right",r)}));a.select(".fl-legend-icon-container").style("display",(function(t){return t.icon?null:"none"}));l.each((function(t){Kt(this).select("svg.fl-legend-icon").style("display",t.icon.path_string?"inline":"none");Kt(this).select("img.fl-legend-icon").style("display",t.icon.url?"inline":"none");Kt(this).select("div.fl-legend-icon").style("display",t.icon.html?"inline-block":"none")}));l.filter((t=>t.icon.url)).select("img.fl-legend-icon").attr("src",(t=>t.icon.url));l.filter((t=>t.icon.html)).select("div.fl-legend-icon").html((t=>t.icon.html)).style("font-size",`${Math.ceil(be(this._state.icon_height))}px`).style("color",(function(e){if(e.outline)return"none";return e.fill||e.color||t._state.icon_color}));l.filter((t=>t.icon.path_string)).select("svg.fl-legend-icon path").attr("d",(function(t){return t.icon?t.icon.path_string:null})).attr("transform",(function(e){if(!e.icon)return null;var n=e.icon.height;var i=e.outline?n*e.stroke_thickness:0;n+=i;var r=be(t._state.icon_height);var o=r/n;var a="scale("+o+")";a+="translate("+.5*i+","+.5*i+")";return a})).style("fill",(function(e){if(e.outline)return"none";return e.fill||e.color||t._state.icon_color})).style("fill-opacity",(function(e){if(e.outline)return 0;return e.fill_opacity||t._state.icon_fill_opacity})).style("stroke",(function(e){if(!e.outline&&!e.stroke)return"none";return e.stroke||e.color||t._state.icon_color})).style("stroke-width",(function(t){if(!t.outline&&!t.stroke_width)return 0;var e=t.icon.height*t.stroke_thickness;return t.stroke_width||e})).style("stroke-opacity",(function(e){if(!e.outline&&!e.stroke_opacity)return 0;return e.stroke_opacity||t._state.icon_stroke_opacity}));a.select(".fl-legend-label").text((function(t){return e?e(t.label):t.label})).style("margin",0).style("user-select","none").style("padding-inline-end",0).style("padding-inline-start",fe);i.exit().remove();this._legend_item_els=a;return this};Ne.prototype.prepareScreenshotSVG=function(){if(!this._state.show_legend||!this._visible||!this._legend_items.length)return;a("#fl-layout-wrapper",this._id+"-svg-screenshot-container").addTextElements(".fl-legend-title").addCircleElements(".fl-legend-swatch").addTextElements(".fl-legend-label")};Ne.prototype.clearScreenshotSVG=function(){const t=document.getElementById(this._id+"-svg-screenshot-container");if(t)t.remove()};function Ee(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}var Ce=Array.prototype;var Te=Ce.map;var ze=Ce.slice;function Le(t,e,n){t.prototype=e.prototype=n;n.constructor=t}function Fe(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Pe(){}var je=.7;var Re=1/je;var qe="\\s*([+-]?\\d+)\\s*",Be="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Oe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$e=/^#([0-9a-f]{3,8})$/,Ie=new RegExp("^rgb\\("+[qe,qe,qe]+"\\)$"),De=new RegExp("^rgb\\("+[Oe,Oe,Oe]+"\\)$"),Ve=new RegExp("^rgba\\("+[qe,qe,qe,Be]+"\\)$"),He=new RegExp("^rgba\\("+[Oe,Oe,Oe,Be]+"\\)$"),Ge=new RegExp("^hsl\\("+[Be,Oe,Oe]+"\\)$"),Ue=new RegExp("^hsla\\("+[Be,Oe,Oe,Be]+"\\)$");var We={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};Le(Pe,Je,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Xe,formatHex:Xe,formatHsl:Ye,formatRgb:Ze,toString:Ze});function Xe(){return this.rgb().formatHex()}function Ye(){return ln(this).formatHsl()}function Ze(){return this.rgb().formatRgb()}function Je(t){var e,n;t=(t+"").trim().toLowerCase();return(e=$e.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Ke(e):n===3?new nn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Qe(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Qe(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ie.exec(t))?new nn(e[1],e[2],e[3],1):(e=De.exec(t))?new nn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Ve.exec(t))?Qe(e[1],e[2],e[3],e[4]):(e=He.exec(t))?Qe(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Ge.exec(t))?sn(e[1],e[2]/100,e[3]/100,1):(e=Ue.exec(t))?sn(e[1],e[2]/100,e[3]/100,e[4]):We.hasOwnProperty(t)?Ke(We[t]):t==="transparent"?new nn(NaN,NaN,NaN,0):null}function Ke(t){return new nn(t>>16&255,t>>8&255,t&255,1)}function Qe(t,e,n,i){if(i<=0)t=e=n=NaN;return new nn(t,e,n,i)}function tn(t){if(!(t instanceof Pe))t=Je(t);if(!t)return new nn;t=t.rgb();return new nn(t.r,t.g,t.b,t.opacity)}function en(t,e,n,i){return arguments.length===1?tn(t):new nn(t,e,n,i==null?1:i)}function nn(t,e,n,i){this.r=+t;this.g=+e;this.b=+n;this.opacity=+i}Le(nn,en,Fe(Pe,{brighter:function(t){t=t==null?Re:Math.pow(Re,t);return new nn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){t=t==null?je:Math.pow(je,t);return new nn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:rn,formatHex:rn,formatRgb:on,toString:on}));function rn(){return"#"+an(this.r)+an(this.g)+an(this.b)}function on(){var t=this.opacity;t=isNaN(t)?1:Math.max(0,Math.min(1,t));return(t===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(t===1?")":", "+t+")")}function an(t){t=Math.max(0,Math.min(255,Math.round(t)||0));return(t<16?"0":"")+t.toString(16)}function sn(t,e,n,i){if(i<=0)t=e=n=NaN;else if(n<=0||n>=1)t=e=NaN;else if(e<=0)t=NaN;return new cn(t,e,n,i)}function ln(t){if(t instanceof cn)return new cn(t.h,t.s,t.l,t.opacity);if(!(t instanceof Pe))t=Je(t);if(!t)return new cn;if(t instanceof cn)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;if(s){if(e===o)a=(n-i)/s+(n<i)*6;else if(n===o)a=(i-e)/s+2;else a=(e-n)/s+4;s/=l<.5?o+r:2-o-r;a*=60}else{s=l>0&&l<1?0:a}return new cn(a,s,l,t.opacity)}function un(t,e,n,i){return arguments.length===1?ln(t):new cn(t,e,n,i==null?1:i)}function cn(t,e,n,i){this.h=+t;this.s=+e;this.l=+n;this.opacity=+i}Le(cn,un,Fe(Pe,{brighter:function(t){t=t==null?Re:Math.pow(Re,t);return new cn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){t=t==null?je:Math.pow(je,t);return new cn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new nn(hn(t>=240?t-240:t+120,r,i),hn(t,r,i),hn(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl:function(){var t=this.opacity;t=isNaN(t)?1:Math.max(0,Math.min(1,t));return(t===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(t===1?")":", "+t+")")}}));function hn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}function fn(t){return function(){return t}}function dn(t,e){return function(n){return t+n*e}}function pn(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function gn(t){return(t=+t)===1?_n:function(e,n){return n-e?pn(e,n,t):fn(isNaN(e)?n:e)}}function _n(t,e){var n=e-t;return n?dn(t,n):fn(isNaN(t)?e:t)}var mn=function t(e){var n=gn(e);function i(t,e){var i=n((t=en(t)).r,(e=en(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),a=_n(t.opacity,e.opacity);return function(e){t.r=i(e);t.g=r(e);t.b=o(e);t.opacity=a(e);return t+""}}i.gamma=t;return i}(1);function yn(t,e){if(!e)e=[];var n=t?Math.min(e.length,t.length):0,i=e.slice(),r;return function(o){for(r=0;r<n;++r)i[r]=t[r]*(1-o)+e[r]*o;return i}}function vn(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function wn(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,r=new Array(i),o=new Array(n),a;for(a=0;a<i;++a)r[a]=Cn(t[a],e[a]);for(;a<n;++a)o[a]=e[a];return function(t){for(a=0;a<i;++a)o[a]=r[a](t);return o}}function bn(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function xn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Mn(t,e){var n={},i={},r;if(t===null||typeof t!=="object")t={};if(e===null||typeof e!=="object")e={};for(r in e){if(r in t){n[r]=Cn(t[r],e[r])}else{i[r]=e[r]}}return function(t){for(r in n)i[r]=n[r](t);return i}}var kn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,An=new RegExp(kn.source,"g");function Nn(t){return function(){return t}}function Sn(t){return function(e){return t(e)+""}}function En(t,e){var n=kn.lastIndex=An.lastIndex=0,i,r,o,a=-1,s=[],l=[];t=t+"",e=e+"";while((i=kn.exec(t))&&(r=An.exec(e))){if((o=r.index)>n){o=e.slice(n,o);if(s[a])s[a]+=o;else s[++a]=o}if((i=i[0])===(r=r[0])){if(s[a])s[a]+=r;else s[++a]=r}else{s[++a]=null;l.push({i:a,x:xn(i,r)})}n=An.lastIndex}if(n<e.length){o=e.slice(n);if(s[a])s[a]+=o;else s[++a]=o}return s.length<2?l[0]?Sn(l[0].x):Nn(e):(e=l.length,function(t){for(var n=0,i;n<e;++n)s[(i=l[n]).i]=i.x(t);return s.join("")})}function Cn(t,e){var n=typeof e,i;return e==null||n==="boolean"?fn(e):(n==="number"?xn:n==="string"?(i=Je(e))?(e=i,mn):En:e instanceof Je?mn:e instanceof Date?bn:vn(e)?yn:Array.isArray(e)?wn:typeof e.valueOf!=="function"&&typeof e.toString!=="function"||isNaN(e)?Mn:xn)(t,e)}function Tn(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function zn(t){return function(){return t}}function Ln(t){return+t}var Fn=[0,1];function Pn(t){return t}function jn(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:zn(isNaN(e)?NaN:.5)}function Rn(t){var e=t[0],n=t[t.length-1],i;if(e>n)i=e,e=n,n=i;return function(t){return Math.max(e,Math.min(n,t))}}function qn(t,e,n){var i=t[0],r=t[1],o=e[0],a=e[1];if(r<i)i=jn(r,i),o=n(a,o);else i=jn(i,r),o=n(o,a);return function(t){return o(i(t))}}function Bn(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),a=-1;if(t[i]<t[0]){t=t.slice().reverse();e=e.slice().reverse()}while(++a<i){r[a]=jn(t[a],t[a+1]);o[a]=n(e[a],e[a+1])}return function(e){var n=ie(t,e,1,i)-1;return o[n](r[n](e))}}function On(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function $n(){var t=Fn,e=Fn,n=Cn,i,r,o,a=Pn,s,l,u;function c(){s=Math.min(t.length,e.length)>2?Bn:qn;l=u=null;return h}function h(r){return isNaN(r=+r)?o:(l||(l=s(t.map(i),e,n)))(i(a(r)))}h.invert=function(n){return a(r((u||(u=s(e,t.map(i),xn)))(n)))};h.domain=function(e){return arguments.length?(t=Te.call(e,Ln),a===Pn||(a=Rn(t)),c()):t.slice()};h.range=function(t){return arguments.length?(e=ze.call(t),c()):e.slice()};h.rangeRound=function(t){return e=ze.call(t),n=Tn,c()};h.clamp=function(e){return arguments.length?(a=e?Rn(t):Pn,h):a!==Pn};h.interpolate=function(t){return arguments.length?(n=t,c()):n};h.unknown=function(t){return arguments.length?(o=t,h):o};return function(t,e){i=t,r=e;return c()}}function In(t,e){return $n()(t,e)}function Dn(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Vn(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Hn(t){return t=Vn(Math.abs(t)),t?t[1]:NaN}function Gn(t,e){return function(n,i){var r=n.length,o=[],a=0,s=t[0],l=0;while(r>0&&s>0){if(l+s+1>i)s=Math.max(1,i-l);o.push(n.substring(r-=s,r+s));if((l+=s+1)>i)break;s=t[a=(a+1)%t.length]}return o.reverse().join(e)}}function Un(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}var Wn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xn(t){if(!(e=Wn.exec(t)))throw new Error("invalid format: "+t);var e;return new Yn({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]})}Xn.prototype=Yn.prototype;function Yn(t){this.fill=t.fill===undefined?" ":t.fill+"";this.align=t.align===undefined?">":t.align+"";this.sign=t.sign===undefined?"-":t.sign+"";this.symbol=t.symbol===undefined?"":t.symbol+"";this.zero=!!t.zero;this.width=t.width===undefined?undefined:+t.width;this.comma=!!t.comma;this.precision=t.precision===undefined?undefined:+t.precision;this.trim=!!t.trim;this.type=t.type===undefined?"":t.type+""}Yn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===undefined?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===undefined?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Zn(t){t:for(var e=t.length,n=1,i=-1,r;n<e;++n){switch(t[n]){case".":i=r=n;break;case"0":if(i===0)i=n;r=n;break;default:if(!+t[n])break t;if(i>0)i=0;break}}return i>0?t.slice(0,i)+t.slice(r+1):t}var Jn;function Kn(t,e){var n=Vn(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(Jn=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+Vn(t,Math.max(0,e+o-1))[0]}function Qn(t,e){var n=Vn(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}var ti={"%":function(t,e){return(t*100).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:Dn,e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return Qn(t*100,e)},r:Qn,s:Kn,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function ei(t){return t}var ni=Array.prototype.map,ii=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ri(t){var e=t.grouping===undefined||t.thousands===undefined?ei:Gn(ni.call(t.grouping,Number),t.thousands+""),n=t.currency===undefined?"":t.currency[0]+"",i=t.currency===undefined?"":t.currency[1]+"",r=t.decimal===undefined?".":t.decimal+"",o=t.numerals===undefined?ei:Un(ni.call(t.numerals,String)),a=t.percent===undefined?"%":t.percent+"",s=t.minus===undefined?"-":t.minus+"",l=t.nan===undefined?"NaN":t.nan+"";function u(t){t=Xn(t);var u=t.fill,c=t.align,h=t.sign,f=t.symbol,d=t.zero,p=t.width,g=t.comma,_=t.precision,m=t.trim,y=t.type;if(y==="n")g=true,y="g";else if(!ti[y])_===undefined&&(_=12),m=true,y="g";if(d||u==="0"&&c==="=")d=true,u="0",c="=";var v=f==="$"?n:f==="#"&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w=f==="$"?i:/[%p]/.test(y)?a:"";var b=ti[y],x=/[defgprs%]/.test(y);_=_===undefined?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function M(t){var n=v,i=w,a,f,M;if(y==="c"){i=b(t)+i;t=""}else{t=+t;var k=t<0||1/t<0;t=isNaN(t)?l:b(Math.abs(t),_);if(m)t=Zn(t);if(k&&+t===0&&h!=="+")k=false;n=(k?h==="("?h:s:h==="-"||h==="("?"":h)+n;i=(y==="s"?ii[8+Jn/3]:"")+i+(k&&h==="("?")":"");if(x){a=-1,f=t.length;while(++a<f){if(M=t.charCodeAt(a),48>M||M>57){i=(M===46?r+t.slice(a+1):t.slice(a))+i;t=t.slice(0,a);break}}}}if(g&&!d)t=e(t,Infinity);var A=n.length+t.length+i.length,N=A<p?new Array(p-A+1).join(u):"";if(g&&d)t=e(N+t,N.length?p-i.length:Infinity),N="";switch(c){case"<":t=n+t+i+N;break;case"=":t=n+N+t+i;break;case"^":t=N.slice(0,A=N.length>>1)+n+t+i+N.slice(A);break;default:t=N+n+t+i;break}return o(t)}M.toString=function(){return t+""};return M}function c(t,e){var n=u((t=Xn(t),t.type="f",t)),i=Math.max(-8,Math.min(8,Math.floor(Hn(e)/3)))*3,r=Math.pow(10,-i),o=ii[8+i/3];return function(t){return n(r*t)+o}}return{format:u,formatPrefix:c}}var oi;var ai;var si;li({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function li(t){oi=ri(t);ai=oi.format;si=oi.formatPrefix;return oi}function ui(t){return Math.max(0,-Hn(Math.abs(t)))}function ci(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Hn(e)/3)))*3-Hn(Math.abs(t)))}function hi(t,e){t=Math.abs(t),e=Math.abs(e)-t;return Math.max(0,Hn(e)-Hn(t))+1}function fi(t,e,n,i){var r=ue(t,e,n),o;i=Xn(i==null?",f":i);switch(i.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));if(i.precision==null&&!isNaN(o=ci(r,a)))i.precision=o;return si(i,a)}case"":case"e":case"g":case"p":case"r":{if(i.precision==null&&!isNaN(o=hi(r,Math.max(Math.abs(t),Math.abs(e)))))i.precision=o-(i.type==="e");break}case"f":case"%":{if(i.precision==null&&!isNaN(o=ui(r)))i.precision=o-(i.type==="%")*2;break}}return ai(i)}function di(t){var e=t.domain;t.ticks=function(t){var n=e();return se(n[0],n[n.length-1],t==null?10:t)};t.tickFormat=function(t,n){var i=e();return fi(i[0],i[i.length-1],t==null?10:t,n)};t.nice=function(n){if(n==null)n=10;var i=e(),r=0,o=i.length-1,a=i[r],s=i[o],l;if(s<a){l=a,a=s,s=l;l=r,r=o,o=l}l=le(a,s,n);if(l>0){a=Math.floor(a/l)*l;s=Math.ceil(s/l)*l;l=le(a,s,n)}else if(l<0){a=Math.ceil(a*l)/l;s=Math.floor(s*l)/l;l=le(a,s,n)}if(l>0){i[r]=Math.floor(a/l)*l;i[o]=Math.ceil(s/l)*l;e(i)}else if(l<0){i[r]=Math.ceil(a*l)/l;i[o]=Math.floor(s*l)/l;e(i)}return t};return t}function pi(){var t=In(Pn,Pn);t.copy=function(){return On(t,pi())};Ee.apply(t,arguments);return di(t)}var gi=0;var _i=window.devicePixelRatio||1;var mi;var yi=Object.freeze({show_legend:true,title_mode:"auto",title:"",color_band_width:8,color_band_height:1,color_band_radius:3,binned_label_mode:"thresholds",binned_label_custom:"",legend_min:null,legend_max:null,additional_min_label:"",additional_max_label:""});function vi(t){this._state=t;for(var e in yi){if(this._state[e]===undefined)this._state[e]=yi[e]}this._colorFunction=undefined;this._formatFunction=undefined;this._legend_domain=[];this._id="fl-legend-continuous-color-"+gi;this._visible=true;this._marker_value=null;this._auto_title="";this._container=Kt(document.createElement("div")).attr("class","fl-legend-container").attr("id",this._id).style("display","none");this._container.append("p").classed("fl-legend-title",true);var n=this._container.append("div").classed("min label",true);n.append("tspan").classed("custom-label",true);n.append("tspan").classed("number",true);this._container.append("div").classed("color-range-container",true);this._container.select(".color-range-container").append("canvas").classed("color-range",true);this._container.select(".color-range-container").append("canvas").classed("color-range-labels",true);var i=this._container.append("div").classed("max label",true);i.append("tspan").classed("number",true);i.append("tspan").classed("custom-label",true);gi++;return this}vi.prototype.appendTo=de;vi.prototype.format=pe;vi.prototype.getContainer=ge;vi.prototype.visible=_e;vi.prototype.autoTitle=ye;vi.prototype._updateTitle=ve;vi.prototype.data=function(t,e){if(!t&&!e)return this._legend_domain.slice();var n=Array.isArray(t)?t.slice():[];this._legend_domain=we(n,this._state);this._colorFunction=e;return this};vi.prototype.markerValue=function(t){if(t===undefined)return this._marker_value;this._marker_value=t;return this};vi.prototype.update=function(t){var e=this._state.show_legend&&this._visible&&this._legend_domain.length>0;this._container.style("display",e?"":"none");if(!e)return this;this._updateTitle();this._updateLegend(t);return this};vi.prototype._updateLegend=function(t){var e=this._legend_domain;mi=document.body.getAttribute("dir");this._scale_type="continuous";if(this._colorFunction.thresholds)this._scale_type="binned";else if(e.length>2)this._scale_type="diverging";var n=this._state;var i=be(n.color_band_width);var r=be(n.color_band_height);var o=i;this._container.style("display","inline-flex").style("align-items",this._scale_type=="continuous"?"center":"flex-start");this._container.select(".color-range-container").style("display","inline-block");var a=this._container.select(".color-range").attr("width",i*_i).attr("height",r*_i).style("border-radius",n.color_band_radius+"px").style("width",i+"px").style("height",r+"px").style("display","block");this._container.select(".color-range-labels").attr("width",o*_i).style("width",o+"px").style("display",this._scale_type=="continuous"?"none":"block").node().getContext("2d").scale(_i,_i);var s=a.node().getContext("2d");s.scale(_i,_i);function l(t){var n=e.max-e.min;var r=t/i;if(mi=="rtl")return e.max-r*n;return e.min+r*n}for(var u=0;u<i;u++){var c=this._colorFunction(l(u));s.fillStyle=c;s.strokeStyle=c;s.fillRect(u,0,1,r);s.strokeRect(u,0,1,r)}if(this._marker_value!==null){var h=pi().domain([e.min,e.max]).range([0,i]);var f=h(this.markerValue());var d=0;var p=r;s.save();s.strokeStyle="#FFFFFF";s.lineWidth=3;s.beginPath();s.moveTo(f,d);s.lineTo(f,p);s.stroke();s.strokeStyle="#000000";s.lineWidth=1;s.beginPath();s.moveTo(f,d);s.lineTo(f,p);s.stroke();s.restore()}this._updateLegendLabels(t)};vi.prototype._updateLegendLabels=function(t={}){var e=this._container.select(".color-range-labels");var n=this._formatFunction;var i=this._legend_domain;var r=this._state;var o=this._container.select(".min.label").style("display","inline-flex").style("align-items","center").style("vertical-align","middle").style("user-select","none").style("line-height","1.25em").style("padding-inline-start",0).style("padding-inline-end",fe);o.select(".number").style("display",this._scale_type=="continuous"?null:"none").text((function(){return n?n(i.min):i.min}));o.select(".custom-label").text((function(){return r.additional_min_label+" "})).style("text-align","center").style("padding-inline-end",fe);var a=this._container.select(".max.label").style("display","inline-flex").style("align-items","center").style("vertical-align","middle").style("user-select","none").style("line-height","1.25em").style("padding-inline-start",fe).style("padding-inline-end",0);a.select(".number").style("display",this._scale_type=="continuous"?null:"none").text((function(){return n?n(i.max):i.max}));a.select(".custom-label").text((function(){return" "+r.additional_max_label})).style("text-align","center").style("padding-inline-start",fe);var s=[];var l=0;var u=0;if(this._scale_type==="diverging")s=this._getDivergingLabels();else if(this._scale_type==="binned")s=this._getBinnedLabels();if(s.length){var c=e.node().getContext("2d");c.textAlign="center";c.textBaseline="top";c.font=t.weight+" "+be(t.size)+"px "+t.family;var h=function(){var t=[];var e=be(r.color_band_width);var o=wi([0,e]);var a=mi=="rtl"?[i.max,i.min]:[i.min,i.max];var s=pi().domain(a).range([0,e]);return function(i){var r=s(i);if(!o(r))return;var a=n?n(i):i;var h=c.measureText(a).width/2+1;var f=r-h;var d=r+h;var p=0;var g=t.length;for(var _=0;_<g;_++){if(r>t[_].center)p++;else break}var m=p===0;var y=p===g;if(!m&&t[p-1].right>f)return;if(!y&&t[p].left<d)return;if(m)l=Math.abs(Math.min(0,f));if(y)u=Math.max(0,d-e);t.splice(p,0,{left:f,center:r,right:d});return{text:a,position:r}}}();var f=s.map((function(t){return h(t)}));var d=be(r.color_band_width)+l+u;var p=Math.ceil(be(t.size)*.95);var g=window.devicePixelRatio||1;e.attr("width",d*g).style("width",d+"px").attr("height",p*g).style("height",p+"px").style("margin-top",fe);Kt(".color-range").style("margin-left",l+"px");c.scale(g,g);c.textAlign="center";c.textBaseline="top";c.font=t.weight+" "+be(t.size)+"px "+t.family;c.fillStyle=t.color;f.forEach((function(t){if(t)c.fillText(t.text,t.position+l,0)}))}};vi.prototype._getDivergingLabels=function(){var t=this._legend_domain;var e=wi(t);var n=[];if(e(t.min))n.push(t.min);if(e(t.mid))n.push(t.mid);if(e(t.max))n.push(t.max);return n};vi.prototype._getBinnedLabels=function(){var t=this._state;var e=this._legend_domain;var n=wi(e);var i;if(t.binned_label_mode==="thresholds"){i=this._colorFunction.thresholds.slice().filter(n);if(e.min<i[0])i.unshift(e.min);if(e.max>i[i.length-e.length-1])i.unshift(e.max)}else if(t.binned_label_mode==="centers"){i=this._colorFunction.centers.slice().filter(n);if(i.length){var r=this._colorFunction.thresholds;var o=r[0];var a=r[r.length-1];if(o>e.min)i.unshift((e.min+o)/2);if(a<e.max)i.unshift((a+e.max)/2)}else i.push((e.min+e.max)/2)}else i=t.binned_label_custom.split(";").map(parseFloat);return i};function wi(t){var e=-Infinity;var n=Infinity;for(var i in t){e=Math.max(e,t[i]);n=Math.min(n,t[i])}return function(t){return t>=n&&t<=e}}vi.prototype.prepareScreenshotSVG=function(){if(!this._state.show_legend||!this._visible||!this._legend_domain.length)return;a("#fl-layout-wrapper",this._id+"-svg-screenshot-container").addTextElements(".fl-legend-title").addGradient(".color-range",this._colorFunction,this._legend_domain).addTextElements(".min.label").addTextElements(".max.label")};vi.prototype.clearScreenshotSVG=function(){const t=document.getElementById(this._id+"-svg-screenshot-container");if(t)t.remove()};var bi=0;var xi=Object.freeze({show_legend:true,title_mode:"auto",title:"",clip_height:1,small_symbol_size:.5,shape_fill:"#eeeeee",shape_stroke:"#555555"});function Mi(t){this._state=t;for(var e in xi){if(this._state[e]===undefined)this._state[e]=xi[e]}this._scaleFunction=undefined;this._formatFunction=undefined;this._id="fl-legend-continuous-size-"+bi;this._visible=true;this._auto_title="";this._symbol_type="circle";this._spike_width=10;this._container=Kt(document.createElement("div")).attr("class","fl-legend-container").attr("id",this._id).style("display","none").style("align-items","center");this._container.append("p").attr("class","fl-legend-title");this._container.append("div").classed("min label",true);var n=this._container.append("div").classed("symbols",true);n.append("canvas").classed("min symbol",true);n.append("canvas").classed("max symbol",true);this._container.append("div").classed("max label",true);bi++;return this}Mi.prototype.appendTo=de;Mi.prototype.format=pe;Mi.prototype.autoTitle=ye;Mi.prototype._updateTitle=ve;Mi.prototype.getContainer=ge;Mi.prototype.visible=_e;Mi.prototype.scale=function(t){if(t===undefined)return this._scaleFunction;this._scaleFunction=t;return this};Mi.prototype.symbolType=function(t){if(t===undefined)return this._symbol_type;this._symbol_type=t;return this};Mi.prototype.spikeWidth=function(t){if(t===undefined)return this._spike_width;this._spike_width=t;return this};Mi.prototype.update=function(){var t=this._state.show_legend&&this._visible;var e=Math.ceil(be(this._state.clip_height));this._container.style("display",t?"inline-flex":"none").style("align-items",this._symbol_type==="circle"?"center":"baseline").style("min-height",e+"px");if(!t||!this._scaleFunction)return this;if(this._scaleFunction.domain()[0]!==0){console.warn("Non zero domain[0] in ContinuousSizeLegend")}if(this._scaleFunction.range()[0]!==0){console.warn("Non zero range[0] in ContinuousSizeLegend")}this._updateTitle();this._updateLegend();return this};Mi.prototype._updateSymbolCanvas=function(t,e,n,i){var r=this._container.select(t).style("width",e+"px").style("height",n+"px").attr("width",e*i).attr("height",n*i);var o=r.node().getContext("2d");o.scale(i,i);o.clearRect(0,0,e,n);return o};Mi.prototype._updateCircle=function(t,e,n,i,r,o){var a=this._scaleFunction(e);var s=Math.ceil(2*a);var l=this._updateSymbolCanvas(t,s,n,i);l.beginPath();l.fillStyle=o;l.arc(.5*s,.5*n,a,0,2*Math.PI);l.fill();l.beginPath();l.fillStyle=r;l.arc(.5*s,.5*n,Math.max(a-1,0),0,2*Math.PI);l.fill()};Mi.prototype._updateSpike=function(t,e,n,i,r,o){var a=this._scaleFunction(e);var s=Math.ceil(this._spike_width);var l=this._updateSymbolCanvas(t,s,n,i);var u=Math.atan(.5*s/a);var c=1/Math.cos(u);var h=1/Math.sin(u);l.beginPath();l.fillStyle=o;l.moveTo(0,n);l.lineTo(.5*s,n-a);l.lineTo(s,n);l.fill();l.beginPath();l.fillStyle=r;l.moveTo(c,n);l.lineTo(.5*s,n-a+h);l.lineTo(s-c,n);l.fill()};Mi.prototype._updateLegend=function(){var t=this._scaleFunction.domain();var e=this._scaleFunction.range();var n=this._formatFunction;var i=this._state;var r=i.shape_fill;var o=i.shape_stroke;var a=window.devicePixelRatio||1;var s=be(i.clip_height);s=Math.ceil(Math.min(s,e[1]*2));var l=this._symbol_type;var u=this._scaleFunction.invert(l==="circle"?s/2:s);u=Math.min(u,t[1]);var c=Me(u)||0;var h=c*i.small_symbol_size;this._container.style("min-height",s+"px");this._container.select(".symbols").style("display","flex").style("flex-wrap","nowrap");this._container.select(".min.symbol").style("margin-right","0.25rem");this._container.select(".min.label").style("user-select","none").style("line-height","1.25em").text((function(){return n?n(h):h})).style("padding-inline-start",0).style("padding-inline-end",fe);if(l==="circle"){this._updateCircle(".min.symbol",h,s,a,r,o)}else if(l==="spike"){this._updateSpike(".min.symbol",h,s,a,r,o)}if(l==="circle"){this._updateCircle(".max.symbol",c,s,a,r,o)}else if(l==="spike"){this._updateSpike(".max.symbol",c,s,a,r,o)}this._container.select(".max.label").style("user-select","none").style("line-height","1.25em").text((function(){return n?n(c):c})).style("padding-inline-start",fe).style("padding-inline-end",0)};Mi.prototype.prepareScreenshotSVG=function(){if(!this._state.show_legend||!this._visible)return;a("#fl-layout-wrapper",this._id+"-svg-screenshot-container").addTextElements(".min.label").addCircleElements(".min.symbol").addCircleElements(".max.symbol").addTextElements(".max.label")};Mi.prototype.clearScreenshotSVG=function(){const t=document.getElementById(this._id+"-svg-screenshot-container");if(t)t.remove()};var ki,Ai,Ni,Si,Ei=1;var Ci=Object.freeze({alignment:"start",orientation:"horizontal",text_color:null,title_weight:"bold",text_weight:"normal",text_size:Ei});function Ti(t){this._state=t;for(var e in Ci){if(this._state[e]===undefined)this._state[e]=Ci[e]}return this}Ti.prototype.appendTo=function(t){this._container=Kt(t).append("div").node();return this};Ti.prototype.add=function(t){this._legends=Array.isArray(t)?t:[t];var e=this;this._legends.forEach((function(t){if(t&&typeof t.appendTo=="function")t.appendTo(e._container);else console.warn("Please pass in valid legend instances into .add()")}));return this};Ti.prototype.update=function(){var t=window.template||undefined;var e=t?t.state.layout:undefined;Ai=this._state.text_color||t&&e&&e.font_color||"#333333";Ni=e?e.body_font.name:window.getComputedStyle(document.body).fontFamily;ki=this._state.text_size;Si=this._state.text_weight;var n={family:Ni,weight:Si,size:ki,color:Ai};this._legends.forEach((function(t){if(t&&typeof t.update=="function")t.update(n)}));var i=this._state.orientation==="horizontal";var r=this._state.alignment;var o=r=="center"?r:"flex-"+r;Kt(this._container).style("justify-content",i?o:null).style("align-items",i?null:o).style("display","flex").style("flex-direction",i?"row":"column");var a=Kt(this._container).selectAll(".fl-legend-container");a.style("padding-inline-end",(function(){if(!i)return 0;return"0.5rem"})).style("padding-bottom",(function(){if(i)return 0;return"0.25rem"})).style("justify-content",o);Kt(this._container).selectAll(".fl-legend-title").style("color",this._state.text_color).style("font-weight",this._state.title_weight).style("font-size",ki+"rem").style("margin-right",ki*.25+"rem").style("line-height","1.25em").style("margin-top",0).style("margin-bottom",0).style("text-align",r);Kt(this._container).selectAll(".fl-legend-item").style("display","inline-flex").style("text-align",r);Kt(this._container).selectAll(".fl-legend-label").style("color",this._state.text_color).style("font-weight",this._state.text_weight).style("font-size",ki+"rem");Kt(this._container).selectAll(".label").style("color",this._state.text_color).style("font-weight",this._state.text_weight).style("font-size",ki+"rem");return this};function zi(t){return new Ti(t)}function Li(t){return new Ne(t)}function Fi(t){return new vi(t)}function Pi(t){return new Mi(t)}t.createContinuousColorLegend=Fi;t.createContinuousSizeLegend=Pi;t.createDiscreteColorLegend=Li;t.createLegendContainer=zi}));
(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports):typeof define==="function"&&define.amd?define(["exports"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,e(t.legend={}))})(this,(function(t){"use strict";var e="$";function n(){}n.prototype=i.prototype={constructor:n,has:function(t){return e+t in this},get:function(t){return this[e+t]},set:function(t,n){this[e+t]=n;return this},remove:function(t){var n=e+t;return n in this&&delete this[n]},clear:function(){for(var t in this)if(t[0]===e)delete this[t]},keys:function(){var t=[];for(var n in this)if(n[0]===e)t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)if(n[0]===e)t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)if(n[0]===e)t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)if(n[0]===e)++t;return t},empty:function(){for(var t in this)if(t[0]===e)return false;return true},each:function(t){for(var n in this)if(n[0]===e)t(this[n],n.slice(1),this)}};function i(t,e){var i=new n;if(t instanceof n)t.each((function(t,e){i.set(e,t)}));else if(Array.isArray(t)){var r=-1,o=t.length,s;if(e==null)while(++r<o)i.set(r,t[r]);else while(++r<o)i.set(e(s=t[r],r,t),s)}else if(t)for(var a in t)i.set(a,t[a]);return i}function r(){}var o=i.prototype;r.prototype={constructor:r,has:o.has,add:function(t){t+="";this[e+t]=t;return this},remove:o.remove,clear:o.clear,values:o.keys,size:o.size,empty:o.empty,each:o.each};function s(t,e){if(typeof t=="string")t=document.querySelector(t);if(!t){console.error("No valid target in createScreenshotSVG");return null}const{width:n,height:i,x:r,y:o}=t.getBoundingClientRect();const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.id=e;s.classList.add("flourish-screenshot-svg-container");s.style.left=r+"px";s.style.top=o+"px";s.style.width=n+"px";s.style.height=i+"px";s.style.position="absolute";t.appendChild(s);function a(e){if(typeof e=="string")e=t.querySelectorAll(e);if(!e){console.error("No valid els inside addTextElements");return null}for(const t of e){const{x:e,y:n,width:i}=t.getBoundingClientRect();const r=document.createElementNS("http://www.w3.org/2000/svg","text");const{color:o,"font-family":a,"font-size":l,"font-weight":c,"line-height":h,"padding-left":f,"padding-top":d}=window.getComputedStyle(t);const p=`${c} ${l} ${a}`;const g=u(t.innerText,p,null,Math.ceil(i));const y=isNaN(parseFloat(h))?parseFloat(l)*1.2+"px":h;const _=window.getComputedStyle(t.closest("[style*='opacity']")||t).opacity;g.forEach(((t,n)=>{const i=document.createElementNS("http://www.w3.org/2000/svg","tspan");i.innerHTML=t;i.setAttribute("dy",n===0?parseFloat(d):y);i.setAttribute("dx",parseFloat(f));i.setAttribute("x",e);i.setAttribute("opacity",_);r.appendChild(i)}));r.style.dominantBaseline="text-before-edge";r.setAttribute("x",e+"px");r.setAttribute("y",n+"px");r.setAttribute("font-family",a);r.setAttribute("font-size",l);r.setAttribute("font-weight",c);r.setAttribute("fill",o);s.appendChild(r)}return this}function l(e){if(typeof e=="string")e=t.querySelectorAll(e);if(!e){console.error("No valid els inside addCircleElements");return null}for(const t of e){const e=document.createElementNS("http://www.w3.org/2000/svg","circle");const{x:n,y:i,width:r}=t.getBoundingClientRect();const o=window.getComputedStyle(t)["background-color"];const a=window.getComputedStyle(t.closest("[style*='opacity']")||t).opacity;const l=r/2;e.setAttribute("cx",n+l+"px");e.setAttribute("cy",i+l+"px");e.setAttribute("r",l+"px");e.setAttribute("opacity",a);e.setAttribute("fill",o);if(o==="rgba(0, 0, 0, 0)")e.setAttribute("stroke","#CCC");s.appendChild(e)}return this}function c(e,n){if(typeof e=="string")e=t.querySelectorAll(e);if(!e){console.error("No valid els inside addSwatchElements");return null}if(typeof n=="string")n=t.querySelectorAll(n);for(const[t,i]of e.entries()){const e=document.createElementNS("http://www.w3.org/2000/svg","rect");const{x:r,y:o,width:a,height:l}=i.getBoundingClientRect();const u=n[t]?.getBoundingClientRect()?.y;const c=window.getComputedStyle(i)["background-color"];const h=window.getComputedStyle(i).border;const[,f,d,p,g]=h.replace(/\s/g,"").match(/rgba?\((\d+(?:\.\d+)?),(\d+(?:\.\d+)?),(\d+(?:\.\d+)?)(?:,(\d+(?:\.\d+)?))?\)/i);const y=g?`rgba(${f},${d},${p},${g})`:`rgb(${f},${d},${p})`||"#000";const _=h.split(" ")[0]||0;let m=window.getComputedStyle(i)["border-radius"]||0;m=parseFloat(m);const v=window.getComputedStyle(i.closest("[style*='opacity']")||i).opacity;e.setAttribute("x",r);e.setAttribute("y",u||o);e.setAttribute("width",`${a}px`);e.setAttribute("height",`${l}px`);e.setAttribute("rx",m);e.setAttribute("ry",m);e.setAttribute("opacity",v);e.setAttribute("fill",c);e.setAttribute("stroke",y);e.setAttribute("stroke-width",_);if(c==="rgba(0, 0, 0, 0)")e.setAttribute("stroke","#CCC");s.appendChild(e)}return this}function h(e,n,i){if(typeof e=="string")e=t.querySelector(e);if(!e){console.error("No valid els inside addCircleElements");return null}const r=document.createElementNS("http://www.w3.org/2000/svg","g");const{x:o,y:a,width:l,height:u}=e.getBoundingClientRect();const{max:c,min:h}=i;const f=c-h;for(let t=0;t<=l;t++){const e=document.createElementNS("http://www.w3.org/2000/svg","line");e.setAttribute("stroke",n(h+t*f/l));e.setAttribute("x1",t+o);e.setAttribute("y1",a);e.setAttribute("x2",t+o);e.setAttribute("y2",u+a);r.appendChild(e)}s.appendChild(r);return this}function f(){s.remove()}return{addTextElements:a,addCircleElements:l,addSwatchElements:c,addGradient:h,remove:f}}const a=document.createElement("canvas");const l=a.getContext("2d");function u(t,e,n,i,r=true){if(typeof t!=="string")t=String(t);const o=t=>l.measureText(t).width>i;const s=(t,e)=>{let n=l.measureText(t).width;if(n<=e){return t}let i=1;let r=t;do{r=t.substring(0,t.length-i)+"…";n=l.measureText(r).width}while(n>e&&++i<t.length);if(r.length<1)r=t.substring(0,1)+"…";return r};l.font=e;let a=[];Object.defineProperty(a,"widest_line",{value:0,enumerable:true,writable:true});Object.defineProperty(a,"has_truncated",{value:false,enumerable:true,writable:true});if(typeof t==="undefined"||Number.isInteger(n)&&n<=0)return a;if(t.length===0){a.push("");return a}if(i<=0){if(t.length>0){a.push(t.slice(0,1)+"…");a.widest_line=l.measureText(a[0]).width}return a}if(!t||t.length===0||n===0||i<=0)return a;const u=t.split(/\s+/g);if(!o(t)){a.push(t);a.widest_line=l.measureText(t).width;a.has_truncated=false;return a}let c=new String(u[0]);if(c&&o(c)){if(r){c=s(c,i)}else if(u.length>1){c+="…"}a.push(c);a.widest_line=l.measureText(c).width;a.has_truncated=true;return a}let h="";let f=false;u.forEach((t=>{if(f)return;if(o(h+(h?" ":"")+t)){if(h){const t=l.measureText(h).width;if(t>i){h=s(h,i);f=true}a.push(h);h=""}h=t}else{h+=(h?" ":"")+t}}));if(h&&!f){a.push(s(h,i))}if(a.length>n){const t=a.length>n;if(t&&Number.isInteger(n)){a.splice(n,a.length-n);let t=a[a.length-1];if(o(t+"…")){t=s(t,i-l.measureText("…").width)}if(t.slice(-1)!=="…"){t+="…"}a[a.length-1]=t;f=true}}a.widest_line=Math.max(...a.map((t=>l.measureText(t).width)));a.has_truncated=f;return a}var c="http://www.w3.org/1999/xhtml";var h={svg:"http://www.w3.org/2000/svg",xhtml:c,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function f(t){var e=t+="",n=e.indexOf(":");if(n>=0&&(e=t.slice(0,n))!=="xmlns")t=t.slice(n+1);return h.hasOwnProperty(e)?{space:h[e],local:t}:t}function d(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===c&&e.documentElement.namespaceURI===c?e.createElement(t):e.createElementNS(n,t)}}function p(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function g(t){var e=f(t);return(e.local?p:d)(e)}function y(){}function _(t){return t==null?y:function(){return this.querySelector(t)}}function m(t){if(typeof t!=="function")t=_(t);for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r){for(var o=e[r],s=o.length,a=i[r]=new Array(s),l,u,c=0;c<s;++c){if((l=o[c])&&(u=t.call(l,l.__data__,c,o))){if("__data__"in l)u.__data__=l.__data__;a[c]=u}}}return new Jt(i,this._parents)}function v(){return[]}function w(t){return t==null?v:function(){return this.querySelectorAll(t)}}function b(t){if(typeof t!=="function")t=w(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o){for(var s=e[o],a=s.length,l,u=0;u<a;++u){if(l=s[u]){i.push(t.call(l,l.__data__,u,s));r.push(l)}}}return new Jt(i,r)}function x(t){return function(){return this.matches(t)}}function M(t){if(typeof t!=="function")t=x(t);for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r){for(var o=e[r],s=o.length,a=i[r]=[],l,u=0;u<s;++u){if((l=o[u])&&t.call(l,l.__data__,u,o)){a.push(l)}}}return new Jt(i,this._parents)}function k(t){return new Array(t.length)}function A(){return new Jt(this._enter||this._groups.map(k),this._parents)}function S(t,e){this.ownerDocument=t.ownerDocument;this.namespaceURI=t.namespaceURI;this._next=null;this._parent=t;this.__data__=e}S.prototype={constructor:S,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)}};function N(t){return function(){return t}}var E="$";function C(t,e,n,i,r,o){var s=0,a,l=e.length,u=o.length;for(;s<u;++s){if(a=e[s]){a.__data__=o[s];i[s]=a}else{n[s]=new S(t,o[s])}}for(;s<l;++s){if(a=e[s]){r[s]=a}}}function T(t,e,n,i,r,o,s){var a,l,u={},c=e.length,h=o.length,f=new Array(c),d;for(a=0;a<c;++a){if(l=e[a]){f[a]=d=E+s.call(l,l.__data__,a,e);if(d in u){r[a]=l}else{u[d]=l}}}for(a=0;a<h;++a){d=E+s.call(t,o[a],a,o);if(l=u[d]){i[a]=l;l.__data__=o[a];u[d]=null}else{n[a]=new S(t,o[a])}}for(a=0;a<c;++a){if((l=e[a])&&u[f[a]]===l){r[a]=l}}}function z(t,e){if(!t){d=new Array(this.size()),u=-1;this.each((function(t){d[++u]=t}));return d}var n=e?T:C,i=this._parents,r=this._groups;if(typeof t!=="function")t=N(t);for(var o=r.length,s=new Array(o),a=new Array(o),l=new Array(o),u=0;u<o;++u){var c=i[u],h=r[u],f=h.length,d=t.call(c,c&&c.__data__,u,i),p=d.length,g=a[u]=new Array(p),y=s[u]=new Array(p),_=l[u]=new Array(f);n(c,h,g,y,_,d,e);for(var m=0,v=0,w,b;m<p;++m){if(w=g[m]){if(m>=v)v=m+1;while(!(b=y[v])&&++v<p);w._next=b||null}}}s=new Jt(s,i);s._enter=a;s._exit=l;return s}function L(){return new Jt(this._exit||this._groups.map(k),this._parents)}function F(t,e,n){var i=this.enter(),r=this,o=this.exit();i=typeof t==="function"?t(i):i.append(t+"");if(e!=null)r=e(r);if(n==null)o.remove();else n(o);return i&&r?i.merge(r).order():r}function P(t){for(var e=this._groups,n=t._groups,i=e.length,r=n.length,o=Math.min(i,r),s=new Array(i),a=0;a<o;++a){for(var l=e[a],u=n[a],c=l.length,h=s[a]=new Array(c),f,d=0;d<c;++d){if(f=l[d]||u[d]){h[d]=f}}}for(;a<i;++a){s[a]=e[a]}return new Jt(s,this._parents)}function $(){for(var t=this._groups,e=-1,n=t.length;++e<n;){for(var i=t[e],r=i.length-1,o=i[r],s;--r>=0;){if(s=i[r]){if(o&&s.compareDocumentPosition(o)^4)o.parentNode.insertBefore(s,o);o=s}}}return this}function R(t){if(!t)t=q;function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var s=n[o],a=s.length,l=r[o]=new Array(a),u,c=0;c<a;++c){if(u=s[c]){l[c]=u}}l.sort(e)}return new Jt(r,this._parents).order()}function q(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function j(){var t=arguments[0];arguments[0]=this;t.apply(null,arguments);return this}function B(){var t=new Array(this.size()),e=-1;this.each((function(){t[++e]=this}));return t}function O(){for(var t=this._groups,e=0,n=t.length;e<n;++e){for(var i=t[e],r=0,o=i.length;r<o;++r){var s=i[r];if(s)return s}}return null}function I(){var t=0;this.each((function(){++t}));return t}function D(){return!this.node()}function V(t){for(var e=this._groups,n=0,i=e.length;n<i;++n){for(var r=e[n],o=0,s=r.length,a;o<s;++o){if(a=r[o])t.call(a,a.__data__,o,r)}}return this}function H(t){return function(){this.removeAttribute(t)}}function G(t){return function(){this.removeAttributeNS(t.space,t.local)}}function U(t,e){return function(){this.setAttribute(t,e)}}function W(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function X(t,e){return function(){var n=e.apply(this,arguments);if(n==null)this.removeAttribute(t);else this.setAttribute(t,n)}}function Y(t,e){return function(){var n=e.apply(this,arguments);if(n==null)this.removeAttributeNS(t.space,t.local);else this.setAttributeNS(t.space,t.local,n)}}function Z(t,e){var n=f(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?G:H:typeof e==="function"?n.local?Y:X:n.local?W:U)(n,e))}function J(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function K(t){return function(){this.style.removeProperty(t)}}function Q(t,e,n){return function(){this.style.setProperty(t,e,n)}}function tt(t,e,n){return function(){var i=e.apply(this,arguments);if(i==null)this.style.removeProperty(t);else this.style.setProperty(t,i,n)}}function et(t,e,n){return arguments.length>1?this.each((e==null?K:typeof e==="function"?tt:Q)(t,e,n==null?"":n)):nt(this.node(),t)}function nt(t,e){return t.style.getPropertyValue(e)||J(t).getComputedStyle(t,null).getPropertyValue(e)}function it(t){return function(){delete this[t]}}function rt(t,e){return function(){this[t]=e}}function ot(t,e){return function(){var n=e.apply(this,arguments);if(n==null)delete this[t];else this[t]=n}}function st(t,e){return arguments.length>1?this.each((e==null?it:typeof e==="function"?ot:rt)(t,e)):this.node()[t]}function at(t){return t.trim().split(/^|\s+/)}function lt(t){return t.classList||new ut(t)}function ut(t){this._node=t;this._names=at(t.getAttribute("class")||"")}ut.prototype={add:function(t){var e=this._names.indexOf(t);if(e<0){this._names.push(t);this._node.setAttribute("class",this._names.join(" "))}},remove:function(t){var e=this._names.indexOf(t);if(e>=0){this._names.splice(e,1);this._node.setAttribute("class",this._names.join(" "))}},contains:function(t){return this._names.indexOf(t)>=0}};function ct(t,e){var n=lt(t),i=-1,r=e.length;while(++i<r)n.add(e[i])}function ht(t,e){var n=lt(t),i=-1,r=e.length;while(++i<r)n.remove(e[i])}function ft(t){return function(){ct(this,t)}}function dt(t){return function(){ht(this,t)}}function pt(t,e){return function(){(e.apply(this,arguments)?ct:ht)(this,t)}}function gt(t,e){var n=at(t+"");if(arguments.length<2){var i=lt(this.node()),r=-1,o=n.length;while(++r<o)if(!i.contains(n[r]))return false;return true}return this.each((typeof e==="function"?pt:e?ft:dt)(n,e))}function yt(){this.textContent=""}function _t(t){return function(){this.textContent=t}}function mt(t){return function(){var e=t.apply(this,arguments);this.textContent=e==null?"":e}}function vt(t){return arguments.length?this.each(t==null?yt:(typeof t==="function"?mt:_t)(t)):this.node().textContent}function wt(){this.innerHTML=""}function bt(t){return function(){this.innerHTML=t}}function xt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e==null?"":e}}function Mt(t){return arguments.length?this.each(t==null?wt:(typeof t==="function"?xt:bt)(t)):this.node().innerHTML}function kt(){if(this.nextSibling)this.parentNode.appendChild(this)}function At(){return this.each(kt)}function St(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Nt(){return this.each(St)}function Et(t){var e=typeof t==="function"?t:g(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))}function Ct(){return null}function Tt(t,e){var n=typeof t==="function"?t:g(t),i=e==null?Ct:typeof e==="function"?e:_(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))}function zt(){var t=this.parentNode;if(t)t.removeChild(this)}function Lt(){return this.each(zt)}function Ft(){var t=this.cloneNode(false),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Pt(){var t=this.cloneNode(true),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function $t(t){return this.select(t?Pt:Ft)}function Rt(t){return arguments.length?this.property("__data__",t):this.node().__data__}var qt={};var jt=null;if(typeof document!=="undefined"){var Bt=document.documentElement;if(!("onmouseenter"in Bt)){qt={mouseenter:"mouseover",mouseleave:"mouseout"}}}function Ot(t,e,n){t=It(t,e,n);return function(e){var n=e.relatedTarget;if(!n||n!==this&&!(n.compareDocumentPosition(this)&8)){t.call(this,e)}}}function It(t,e,n){return function(i){var r=jt;jt=i;try{t.call(this,this.__data__,e,n)}finally{jt=r}}}function Dt(t){return 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);return{type:t,name:e}}))}function Vt(t){return function(){var e=this.__on;if(!e)return;for(var n=0,i=-1,r=e.length,o;n<r;++n){if(o=e[n],(!t.type||o.type===t.type)&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.capture)}else{e[++i]=o}}if(++i)e.length=i;else delete this.__on}}function Ht(t,e,n){var i=qt.hasOwnProperty(t.type)?Ot:It;return function(r,o,s){var a=this.__on,l,u=i(e,o,s);if(a)for(var c=0,h=a.length;c<h;++c){if((l=a[c]).type===t.type&&l.name===t.name){this.removeEventListener(l.type,l.listener,l.capture);this.addEventListener(l.type,l.listener=u,l.capture=n);l.value=e;return}}this.addEventListener(t.type,u,n);l={type:t.type,name:t.name,value:e,listener:u,capture:n};if(!a)this.__on=[l];else a.push(l)}}function Gt(t,e,n){var i=Dt(t+""),r,o=i.length,s;if(arguments.length<2){var a=this.node().__on;if(a)for(var l=0,u=a.length,c;l<u;++l){for(r=0,c=a[l];r<o;++r){if((s=i[r]).type===c.type&&s.name===c.name){return c.value}}}return}a=e?Ht:Vt;if(n==null)n=false;for(r=0;r<o;++r)this.each(a(i[r],e,n));return this}function Ut(t,e,n){var i=J(t),r=i.CustomEvent;if(typeof r==="function"){r=new r(e,n)}else{r=i.document.createEvent("Event");if(n)r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail;else r.initEvent(e,false,false)}t.dispatchEvent(r)}function Wt(t,e){return function(){return Ut(this,t,e)}}function Xt(t,e){return function(){return Ut(this,t,e.apply(this,arguments))}}function Yt(t,e){return this.each((typeof e==="function"?Xt:Wt)(t,e))}var Zt=[null];function Jt(t,e){this._groups=t;this._parents=e}Jt.prototype={constructor:Jt,select:m,selectAll:b,filter:M,data:z,enter:A,exit:L,join:F,merge:P,order:$,sort:R,call:j,nodes:B,node:O,size:I,empty:D,each:V,attr:Z,style:et,property:st,classed:gt,text:vt,html:Mt,raise:At,lower:Nt,append:Et,insert:Tt,remove:Lt,clone:$t,datum:Rt,on:Gt,dispatch:Yt};function Kt(t){return typeof t==="string"?new Jt([[document.querySelector(t)]],[document.documentElement]):new Jt([[t]],Zt)}function Qt(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function te(t){if(t.length===1)t=ee(t);return{left:function(e,n,i,r){if(i==null)i=0;if(r==null)r=e.length;while(i<r){var o=i+r>>>1;if(t(e[o],n)<0)i=o+1;else r=o}return i},right:function(e,n,i,r){if(i==null)i=0;if(r==null)r=e.length;while(i<r){var o=i+r>>>1;if(t(e[o],n)>0)r=o;else i=o+1}return i}}}function ee(t){return function(e,n){return Qt(t(e),n)}}var ne=te(Qt);var ie=ne.right;var re=Math.sqrt(50),oe=Math.sqrt(10),se=Math.sqrt(2);function ae(t,e,n){var i,r=-1,o,s,a;e=+e,t=+t,n=+n;if(t===e&&n>0)return[t];if(i=e<t)o=t,t=e,e=o;if((a=le(t,e,n))===0||!isFinite(a))return[];if(a>0){t=Math.ceil(t/a);e=Math.floor(e/a);s=new Array(o=Math.ceil(e-t+1));while(++r<o)s[r]=(t+r)*a}else{t=Math.floor(t*a);e=Math.ceil(e*a);s=new Array(o=Math.ceil(t-e+1));while(++r<o)s[r]=(t-r)/a}if(i)s.reverse();return s}function le(t,e,n){var i=(e-t)/Math.max(0,n),r=Math.floor(Math.log(i)/Math.LN10),o=i/Math.pow(10,r);return r>=0?(o>=re?10:o>=oe?5:o>=se?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=re?10:o>=oe?5:o>=se?2:1)}function ue(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;if(o>=re)r*=10;else if(o>=oe)r*=5;else if(o>=se)r*=2;return e<t?-r:r}function ce(){this.declarations=[];return this}ce.prototype.select=function(t){if(!t)return this;var e=new he(t);e.parent=this;this.addDeclaration(e);return e};ce.prototype.addDeclaration=function(t){this.declarations.push(t);return this};ce.prototype.print=function(){var t="";this.declarations.forEach((function(e){t+=e.selector+" {\n";e.styles.forEach((function(e){t+="\t"+e[0]+": "+e[1]+";\n"}));t+="}\n\n"}));return t};ce.prototype.clear=function(){this.declarations=[];return this};function he(t){this.selector=t;this.styles=[];return this}he.prototype.style=function(t,e){var n=typeof value_=="function"?e():e;if(n!==""&&n!==null&&n!==undefined)this.styles.push([t,n]);return this};he.prototype.select=function(t){return this.parent.select(this.selector+" "+t)};var fe="0.2em";function de(t){t.appendChild(this._container.node());if(!document.querySelector("#legend-styles")){var e=document.createElement("style");var n=new ce;n.select(".fl-legend-container.interactive .fl-legend-item:hover").style("opacity",.75).style("cursor","pointer");e.id="legend-styles";e.type="text/css";e.innerHTML=n.print();document.head.appendChild(e)}return this}function pe(t){this._formatFunction=t;return this}function ge(){return this._container}function ye(t){if(t===undefined)return this._visible;this._visible=t;return this}function _e(t){if(t===undefined)return this._allow_single_entry;this._allow_single_entry=t;return this}function me(t){if(t===undefined)return this._auto_title;this._auto_title=t;return this}function ve(){var t=this;var e=t._state.title_mode=="auto"?t.autoTitle():t._state.title;this._container.select(".fl-legend-title").text(e).style("display",(function(){if(!e.trim())return"none";else if(t._state.orientation===undefined)return"inline-block";else return t._state.orientation=="horizontal"?"inline-block":"block"})).style("padding-inline-start",0).style("padding-inline-end",fe)}function we(t,e){var n=t.sort(Qt);var i=n[0];var r=n[n.length-1];var o=n.length>2?n[1]:null;if(e.legend_min!==null||e.legend_max!==null){if(e.legend_min!==null&&e.legend_max!==null){if(e.legend_min<e.legend_max){i=e.legend_min;r=e.legend_max}}else if(e.legend_min!==null){i=e.legend_min;if(r<i)r=i+2}else{r=e.legend_max;if(i>r)i=r-2}}if(o!==null&&(i>o||r<o))o=null;var s=[i];if(o!==null)s.push(o);s.push(r);s.min=i;s.max=r;s.mid=o;return s}function be(t){return t*parseFloat(getComputedStyle(document.documentElement).fontSize)}function xe(t){return Math.log(t)/Math.LN10}function Me(t){if(t===0)return 0;var e=Math.floor(xe(t));var n=t/Math.pow(10,e);var i=Math.floor(n);var r=i*Math.pow(10,e);if(e<0){var o=-e;r=o<=100?parseFloat(r.toFixed(o)):0}return r}var ke=0;var Ae=Object.freeze({show_legend:true,title_mode:"auto",title:"",max_width:100,swatch_width:.75,swatch_height:1,swatch_radius:3,swatch_outline:false,swatch_outline_color:null,legend_items_padding:.5,icon_height:1,icon_color:"#777777",icon_fill_opacity:1,icon_stroke_opacity:1,order_override:"",orientation:"horizontal"});function Se(t){this._state=t;for(var e in Ae){if(this._state[e]===undefined)this._state[e]=Ae[e]}this._colorFunction=undefined;this._formatFunction=undefined;this._legend_items=[];this._filtered_items=[];this._eventListeners=[];this._id="fl-legend-discrete-color-"+ke;this._visible=true;this._auto_title="";this._container=Kt(document.createElement("div")).attr("class","fl-legend-container").attr("id",this._id);this._container.append("p").attr("class","fl-legend-title");ke++;return this}Se.prototype.appendTo=de;Se.prototype.format=pe;Se.prototype.getContainer=ge;Se.prototype.visible=ye;Se.prototype.allowSingleEntry=_e;Se.prototype.autoTitle=me;Se.prototype._updateTitle=ve;Se.prototype.data=function(t,e){this._colorFunction=e;if(!t&&!e)return this._legend_items.slice();if(!e)this._legend_items=Array.isArray(t)?t.slice():[];else if(!Array.isArray(t))this._legend_items=[];else{this._legend_items=t.slice().map((function(t,n){var i=typeof t=="object"?t?.label||"":t;return!i?null:{label:i,color:e(i),index:n}})).filter((function(t){return t!==null}))}return this};Se.prototype.filtered=function(t){if(!t)return this._filtered_items.slice();this._filtered_items=Array.isArray(t)?t.slice():[];return this};Se.prototype.on=function(t,e){if(!this._container)return this;if(e&&this._eventListeners.indexOf(t)<0)this._eventListeners.push(t);else if(!e)this._eventListeners.splice(this._eventListeners.indexOf[t],1);this._container.classed("interactive",this._eventListeners.length>0);if(!e){this._container.on(t,null);if(t=="click")this._container.on("keydown",null)}else{this._container.on(t,(function(){var t=jt.target,n=t.parentNode;var i=t.classList.contains("fl-legend-item")?t:n.classList.contains("fl-legend-item")?n:null;if(i){var r=Kt(i).datum();e.call(i,r,r.index)}}));if(t=="click"){this._container.on("keydown",(function(){if(jt.key!="Enter")return;var t=jt.target,n=t.parentNode;var i=t.classList.contains("fl-legend-item")?t:n.classList.contains("fl-legend-item")?n:null;if(i){var r=Kt(i).datum();e.call(i,r,r.index)}}))}}return this};Se.prototype.update=function(){const t=this._allow_single_entry?1:2;const e=this._state.show_legend&&this._visible&&this._legend_items.length>=t;this._container.style("display",e?"":"none");if(!e)return this;this._updateTitle();this._updateLegend();return this};function Ne(t,e){var n={};var i=e.split(/\s*\n\s*/);for(var r=0;r<i.length;r++){var o=i[r];n[o]=r}var s=[];for(var a=0;a<t.length;a++){var l=t[a];var u=n[l.label];if(u===undefined)continue;s[u]=l}return s.filter((function(t){return t!==undefined}))}Se.prototype._updateLegend=function(){var t=this;var e=this._formatFunction;this._container.style("max-width",be(this._state.max_width)+"px").style("display","inline-flex").style("flex-wrap","wrap").style("align-items",this._state.orientation=="horizontal"?"center":"start").style("align-content",this._state.orientation=="horizontal"?"center":null).style("flex-direction",this._state.orientation=="horizontal"?null:"column").style("max-height",`${window.innerHeight*.5}px`).style("overflow-y","auto");var n;if(this._state.order_override.trim()){n=Ne(this._legend_items,this._state.order_override)}else{n=this._legend_items}var i=this._container.selectAll(".fl-legend-item").data(n);var r=i.enter().append("div").attr("class","fl-legend-item");r.append("div").attr("class","fl-legend-swatch");let o=r.append("div").attr("class","fl-legend-icon-container");o.append("svg").attr("class","fl-legend-icon fl-ignore-svg-download").append("path");o.append("img").attr("class","fl-legend-icon");o.append("div").attr("class","fl-legend-icon");r.append("p").attr("class","fl-legend-label");var s=i.merge(r);var a=this._eventListeners.length>0;s.style("display",this._state.orientation=="horizontal"?"inline-flex":"flex").style("flex-direction",(function(t){return t.reverse?"row-reverse":"row"})).style("opacity",(function(e){return t._filtered_items.indexOf(e.label)>-1?.2:""})).style("align-items","center").style("padding-inline-end",this._state.orientation=="horizontal"?this._state.legend_items_padding+"rem":0).style("padding-inline-start",0).attr("tabindex",a?"0":null).attr("role",a?"button":null);s.select(".fl-legend-swatch").style("height",this._state.swatch_height+"rem").style("width",this._state.swatch_width+"rem").style("border-radius",this._state.swatch_radius+"px").style("background-color",(function(t){return t.color})).style("border",(()=>{if(!this._state.swatch_outline)return"none";else if(!this._state.swatch_outline_color)return"1px solid";else return`1px solid ${this._state.swatch_outline_color}`})).style("box-sizing",this._state.swatch_outline?"border-box":"content-box").style("flex-shrink","0").style("display",(function(t){return t.icon?"none":null}));const l=s.filter((t=>t.icon));l.each((function(e){let n=Math.ceil(be(t._state.icon_height));let i="auto";if(e.icon.width){let n=e.icon.width;let r=e.icon.height;let o=e.outline?r*e.stroke_thickness:0;n+=o;r+=o;let s=n/r;let a=be(t._state.icon_height*s);i=Math.ceil(a)}let r=t._state.text_size*.25+"rem";Kt(this).selectAll(".fl-legend-icon").attr("height",n).attr("width",i).style("margin-right",r)}));s.select(".fl-legend-icon-container").style("display",(function(t){return t.icon?null:"none"}));l.each((function(t){Kt(this).select("svg.fl-legend-icon").style("display",t.icon.path_string?"inline":"none");Kt(this).select("img.fl-legend-icon").style("display",t.icon.url?"inline":"none");Kt(this).select("div.fl-legend-icon").style("display",t.icon.html?"inline-block":"none")}));l.filter((t=>t.icon.url)).select("img.fl-legend-icon").attr("src",(t=>t.icon.url));l.filter((t=>t.icon.html)).select("div.fl-legend-icon").html((t=>t.icon.html)).style("font-size",`${Math.ceil(be(this._state.icon_height))}px`).style("color",(function(e){if(e.outline)return"none";return e.fill||e.color||t._state.icon_color}));l.filter((t=>t.icon.path_string)).select("svg.fl-legend-icon path").attr("d",(function(t){return t.icon?t.icon.path_string:null})).attr("transform",(function(e){if(!e.icon)return null;var n=e.icon.height;var i=e.outline?n*e.stroke_thickness:0;n+=i;var r=be(t._state.icon_height);var o=r/n;var s="scale("+o+")";s+="translate("+.5*i+","+.5*i+")";return s})).style("fill",(function(e){if(e.outline)return"none";return e.fill||e.color||t._state.icon_color})).style("fill-opacity",(function(e){if(e.outline)return 0;return e.fill_opacity||t._state.icon_fill_opacity})).style("stroke",(function(e){if(!e.outline&&!e.stroke)return"none";return e.stroke||e.color||t._state.icon_color})).style("stroke-width",(function(t){if(!t.outline&&!t.stroke_width)return 0;var e=t.icon.height*t.stroke_thickness;return t.stroke_width||e})).style("stroke-opacity",(function(e){if(!e.outline&&!e.stroke_opacity)return 0;return e.stroke_opacity||t._state.icon_stroke_opacity}));s.select(".fl-legend-label").text((function(t){return e?e(t.label):t.label})).style("margin",0).style("user-select","none").style("padding-inline-end",0).style("padding-inline-start",fe);i.exit().remove();this._legend_item_els=s;return this};Se.prototype.prepareScreenshotSVG=function(){if(!this._state.show_legend||!this._visible||!this._legend_items.length)return;s("#fl-layout-wrapper",this._id+"-svg-screenshot-container").addTextElements(".fl-legend-title").addSwatchElements(".fl-legend-swatch",".fl-legend-label").addTextElements(".fl-legend-label")};Se.prototype.clearScreenshotSVG=function(){const t=document.getElementById(this._id+"-svg-screenshot-container");if(t)t.remove()};function Ee(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}var Ce=Array.prototype;var Te=Ce.map;var ze=Ce.slice;function Le(t,e,n){t.prototype=e.prototype=n;n.constructor=t}function Fe(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Pe(){}var $e=.7;var Re=1/$e;var qe="\\s*([+-]?\\d+)\\s*",je="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Be="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Oe=/^#([0-9a-f]{3,8})$/,Ie=new RegExp("^rgb\\("+[qe,qe,qe]+"\\)$"),De=new RegExp("^rgb\\("+[Be,Be,Be]+"\\)$"),Ve=new RegExp("^rgba\\("+[qe,qe,qe,je]+"\\)$"),He=new RegExp("^rgba\\("+[Be,Be,Be,je]+"\\)$"),Ge=new RegExp("^hsl\\("+[je,Be,Be]+"\\)$"),Ue=new RegExp("^hsla\\("+[je,Be,Be,je]+"\\)$");var We={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};Le(Pe,Je,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Xe,formatHex:Xe,formatHsl:Ye,formatRgb:Ze,toString:Ze});function Xe(){return this.rgb().formatHex()}function Ye(){return ln(this).formatHsl()}function Ze(){return this.rgb().formatRgb()}function Je(t){var e,n;t=(t+"").trim().toLowerCase();return(e=Oe.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Ke(e):n===3?new nn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Qe(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Qe(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ie.exec(t))?new nn(e[1],e[2],e[3],1):(e=De.exec(t))?new nn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Ve.exec(t))?Qe(e[1],e[2],e[3],e[4]):(e=He.exec(t))?Qe(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Ge.exec(t))?an(e[1],e[2]/100,e[3]/100,1):(e=Ue.exec(t))?an(e[1],e[2]/100,e[3]/100,e[4]):We.hasOwnProperty(t)?Ke(We[t]):t==="transparent"?new nn(NaN,NaN,NaN,0):null}function Ke(t){return new nn(t>>16&255,t>>8&255,t&255,1)}function Qe(t,e,n,i){if(i<=0)t=e=n=NaN;return new nn(t,e,n,i)}function tn(t){if(!(t instanceof Pe))t=Je(t);if(!t)return new nn;t=t.rgb();return new nn(t.r,t.g,t.b,t.opacity)}function en(t,e,n,i){return arguments.length===1?tn(t):new nn(t,e,n,i==null?1:i)}function nn(t,e,n,i){this.r=+t;this.g=+e;this.b=+n;this.opacity=+i}Le(nn,en,Fe(Pe,{brighter:function(t){t=t==null?Re:Math.pow(Re,t);return new nn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){t=t==null?$e:Math.pow($e,t);return new nn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:rn,formatHex:rn,formatRgb:on,toString:on}));function rn(){return"#"+sn(this.r)+sn(this.g)+sn(this.b)}function on(){var t=this.opacity;t=isNaN(t)?1:Math.max(0,Math.min(1,t));return(t===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(t===1?")":", "+t+")")}function sn(t){t=Math.max(0,Math.min(255,Math.round(t)||0));return(t<16?"0":"")+t.toString(16)}function an(t,e,n,i){if(i<=0)t=e=n=NaN;else if(n<=0||n>=1)t=e=NaN;else if(e<=0)t=NaN;return new cn(t,e,n,i)}function ln(t){if(t instanceof cn)return new cn(t.h,t.s,t.l,t.opacity);if(!(t instanceof Pe))t=Je(t);if(!t)return new cn;if(t instanceof cn)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=NaN,a=o-r,l=(o+r)/2;if(a){if(e===o)s=(n-i)/a+(n<i)*6;else if(n===o)s=(i-e)/a+2;else s=(e-n)/a+4;a/=l<.5?o+r:2-o-r;s*=60}else{a=l>0&&l<1?0:s}return new cn(s,a,l,t.opacity)}function un(t,e,n,i){return arguments.length===1?ln(t):new cn(t,e,n,i==null?1:i)}function cn(t,e,n,i){this.h=+t;this.s=+e;this.l=+n;this.opacity=+i}Le(cn,un,Fe(Pe,{brighter:function(t){t=t==null?Re:Math.pow(Re,t);return new cn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){t=t==null?$e:Math.pow($e,t);return new cn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new nn(hn(t>=240?t-240:t+120,r,i),hn(t,r,i),hn(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl:function(){var t=this.opacity;t=isNaN(t)?1:Math.max(0,Math.min(1,t));return(t===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(t===1?")":", "+t+")")}}));function hn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}function fn(t){return function(){return t}}function dn(t,e){return function(n){return t+n*e}}function pn(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function gn(t){return(t=+t)===1?yn:function(e,n){return n-e?pn(e,n,t):fn(isNaN(e)?n:e)}}function yn(t,e){var n=e-t;return n?dn(t,n):fn(isNaN(t)?e:t)}var _n=function t(e){var n=gn(e);function i(t,e){var i=n((t=en(t)).r,(e=en(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),s=yn(t.opacity,e.opacity);return function(e){t.r=i(e);t.g=r(e);t.b=o(e);t.opacity=s(e);return t+""}}i.gamma=t;return i}(1);function mn(t,e){if(!e)e=[];var n=t?Math.min(e.length,t.length):0,i=e.slice(),r;return function(o){for(r=0;r<n;++r)i[r]=t[r]*(1-o)+e[r]*o;return i}}function vn(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function wn(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,r=new Array(i),o=new Array(n),s;for(s=0;s<i;++s)r[s]=Cn(t[s],e[s]);for(;s<n;++s)o[s]=e[s];return function(t){for(s=0;s<i;++s)o[s]=r[s](t);return o}}function bn(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function xn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Mn(t,e){var n={},i={},r;if(t===null||typeof t!=="object")t={};if(e===null||typeof e!=="object")e={};for(r in e){if(r in t){n[r]=Cn(t[r],e[r])}else{i[r]=e[r]}}return function(t){for(r in n)i[r]=n[r](t);return i}}var kn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,An=new RegExp(kn.source,"g");function Sn(t){return function(){return t}}function Nn(t){return function(e){return t(e)+""}}function En(t,e){var n=kn.lastIndex=An.lastIndex=0,i,r,o,s=-1,a=[],l=[];t=t+"",e=e+"";while((i=kn.exec(t))&&(r=An.exec(e))){if((o=r.index)>n){o=e.slice(n,o);if(a[s])a[s]+=o;else a[++s]=o}if((i=i[0])===(r=r[0])){if(a[s])a[s]+=r;else a[++s]=r}else{a[++s]=null;l.push({i:s,x:xn(i,r)})}n=An.lastIndex}if(n<e.length){o=e.slice(n);if(a[s])a[s]+=o;else a[++s]=o}return a.length<2?l[0]?Nn(l[0].x):Sn(e):(e=l.length,function(t){for(var n=0,i;n<e;++n)a[(i=l[n]).i]=i.x(t);return a.join("")})}function Cn(t,e){var n=typeof e,i;return e==null||n==="boolean"?fn(e):(n==="number"?xn:n==="string"?(i=Je(e))?(e=i,_n):En:e instanceof Je?_n:e instanceof Date?bn:vn(e)?mn:Array.isArray(e)?wn:typeof e.valueOf!=="function"&&typeof e.toString!=="function"||isNaN(e)?Mn:xn)(t,e)}function Tn(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function zn(t){return function(){return t}}function Ln(t){return+t}var Fn=[0,1];function Pn(t){return t}function $n(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:zn(isNaN(e)?NaN:.5)}function Rn(t){var e=t[0],n=t[t.length-1],i;if(e>n)i=e,e=n,n=i;return function(t){return Math.max(e,Math.min(n,t))}}function qn(t,e,n){var i=t[0],r=t[1],o=e[0],s=e[1];if(r<i)i=$n(r,i),o=n(s,o);else i=$n(i,r),o=n(o,s);return function(t){return o(i(t))}}function jn(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),s=-1;if(t[i]<t[0]){t=t.slice().reverse();e=e.slice().reverse()}while(++s<i){r[s]=$n(t[s],t[s+1]);o[s]=n(e[s],e[s+1])}return function(e){var n=ie(t,e,1,i)-1;return o[n](r[n](e))}}function Bn(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function On(){var t=Fn,e=Fn,n=Cn,i,r,o,s=Pn,a,l,u;function c(){a=Math.min(t.length,e.length)>2?jn:qn;l=u=null;return h}function h(r){return isNaN(r=+r)?o:(l||(l=a(t.map(i),e,n)))(i(s(r)))}h.invert=function(n){return s(r((u||(u=a(e,t.map(i),xn)))(n)))};h.domain=function(e){return arguments.length?(t=Te.call(e,Ln),s===Pn||(s=Rn(t)),c()):t.slice()};h.range=function(t){return arguments.length?(e=ze.call(t),c()):e.slice()};h.rangeRound=function(t){return e=ze.call(t),n=Tn,c()};h.clamp=function(e){return arguments.length?(s=e?Rn(t):Pn,h):s!==Pn};h.interpolate=function(t){return arguments.length?(n=t,c()):n};h.unknown=function(t){return arguments.length?(o=t,h):o};return function(t,e){i=t,r=e;return c()}}function In(t,e){return On()(t,e)}function Dn(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Vn(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Hn(t){return t=Vn(Math.abs(t)),t?t[1]:NaN}function Gn(t,e){return function(n,i){var r=n.length,o=[],s=0,a=t[0],l=0;while(r>0&&a>0){if(l+a+1>i)a=Math.max(1,i-l);o.push(n.substring(r-=a,r+a));if((l+=a+1)>i)break;a=t[s=(s+1)%t.length]}return o.reverse().join(e)}}function Un(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}var Wn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xn(t){if(!(e=Wn.exec(t)))throw new Error("invalid format: "+t);var e;return new Yn({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]})}Xn.prototype=Yn.prototype;function Yn(t){this.fill=t.fill===undefined?" ":t.fill+"";this.align=t.align===undefined?">":t.align+"";this.sign=t.sign===undefined?"-":t.sign+"";this.symbol=t.symbol===undefined?"":t.symbol+"";this.zero=!!t.zero;this.width=t.width===undefined?undefined:+t.width;this.comma=!!t.comma;this.precision=t.precision===undefined?undefined:+t.precision;this.trim=!!t.trim;this.type=t.type===undefined?"":t.type+""}Yn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===undefined?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===undefined?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Zn(t){t:for(var e=t.length,n=1,i=-1,r;n<e;++n){switch(t[n]){case".":i=r=n;break;case"0":if(i===0)i=n;r=n;break;default:if(!+t[n])break t;if(i>0)i=0;break}}return i>0?t.slice(0,i)+t.slice(r+1):t}var Jn;function Kn(t,e){var n=Vn(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(Jn=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,s=i.length;return o===s?i:o>s?i+new Array(o-s+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+Vn(t,Math.max(0,e+o-1))[0]}function Qn(t,e){var n=Vn(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}var ti={"%":function(t,e){return(t*100).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:Dn,e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return Qn(t*100,e)},r:Qn,s:Kn,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function ei(t){return t}var ni=Array.prototype.map,ii=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ri(t){var e=t.grouping===undefined||t.thousands===undefined?ei:Gn(ni.call(t.grouping,Number),t.thousands+""),n=t.currency===undefined?"":t.currency[0]+"",i=t.currency===undefined?"":t.currency[1]+"",r=t.decimal===undefined?".":t.decimal+"",o=t.numerals===undefined?ei:Un(ni.call(t.numerals,String)),s=t.percent===undefined?"%":t.percent+"",a=t.minus===undefined?"-":t.minus+"",l=t.nan===undefined?"NaN":t.nan+"";function u(t){t=Xn(t);var u=t.fill,c=t.align,h=t.sign,f=t.symbol,d=t.zero,p=t.width,g=t.comma,y=t.precision,_=t.trim,m=t.type;if(m==="n")g=true,m="g";else if(!ti[m])y===undefined&&(y=12),_=true,m="g";if(d||u==="0"&&c==="=")d=true,u="0",c="=";var v=f==="$"?n:f==="#"&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w=f==="$"?i:/[%p]/.test(m)?s:"";var b=ti[m],x=/[defgprs%]/.test(m);y=y===undefined?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function M(t){var n=v,i=w,s,f,M;if(m==="c"){i=b(t)+i;t=""}else{t=+t;var k=t<0||1/t<0;t=isNaN(t)?l:b(Math.abs(t),y);if(_)t=Zn(t);if(k&&+t===0&&h!=="+")k=false;n=(k?h==="("?h:a:h==="-"||h==="("?"":h)+n;i=(m==="s"?ii[8+Jn/3]:"")+i+(k&&h==="("?")":"");if(x){s=-1,f=t.length;while(++s<f){if(M=t.charCodeAt(s),48>M||M>57){i=(M===46?r+t.slice(s+1):t.slice(s))+i;t=t.slice(0,s);break}}}}if(g&&!d)t=e(t,Infinity);var A=n.length+t.length+i.length,S=A<p?new Array(p-A+1).join(u):"";if(g&&d)t=e(S+t,S.length?p-i.length:Infinity),S="";switch(c){case"<":t=n+t+i+S;break;case"=":t=n+S+t+i;break;case"^":t=S.slice(0,A=S.length>>1)+n+t+i+S.slice(A);break;default:t=S+n+t+i;break}return o(t)}M.toString=function(){return t+""};return M}function c(t,e){var n=u((t=Xn(t),t.type="f",t)),i=Math.max(-8,Math.min(8,Math.floor(Hn(e)/3)))*3,r=Math.pow(10,-i),o=ii[8+i/3];return function(t){return n(r*t)+o}}return{format:u,formatPrefix:c}}var oi;var si;var ai;li({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function li(t){oi=ri(t);si=oi.format;ai=oi.formatPrefix;return oi}function ui(t){return Math.max(0,-Hn(Math.abs(t)))}function ci(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Hn(e)/3)))*3-Hn(Math.abs(t)))}function hi(t,e){t=Math.abs(t),e=Math.abs(e)-t;return Math.max(0,Hn(e)-Hn(t))+1}function fi(t,e,n,i){var r=ue(t,e,n),o;i=Xn(i==null?",f":i);switch(i.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));if(i.precision==null&&!isNaN(o=ci(r,s)))i.precision=o;return ai(i,s)}case"":case"e":case"g":case"p":case"r":{if(i.precision==null&&!isNaN(o=hi(r,Math.max(Math.abs(t),Math.abs(e)))))i.precision=o-(i.type==="e");break}case"f":case"%":{if(i.precision==null&&!isNaN(o=ui(r)))i.precision=o-(i.type==="%")*2;break}}return si(i)}function di(t){var e=t.domain;t.ticks=function(t){var n=e();return ae(n[0],n[n.length-1],t==null?10:t)};t.tickFormat=function(t,n){var i=e();return fi(i[0],i[i.length-1],t==null?10:t,n)};t.nice=function(n){if(n==null)n=10;var i=e(),r=0,o=i.length-1,s=i[r],a=i[o],l;if(a<s){l=s,s=a,a=l;l=r,r=o,o=l}l=le(s,a,n);if(l>0){s=Math.floor(s/l)*l;a=Math.ceil(a/l)*l;l=le(s,a,n)}else if(l<0){s=Math.ceil(s*l)/l;a=Math.floor(a*l)/l;l=le(s,a,n)}if(l>0){i[r]=Math.floor(s/l)*l;i[o]=Math.ceil(a/l)*l;e(i)}else if(l<0){i[r]=Math.ceil(s*l)/l;i[o]=Math.floor(a*l)/l;e(i)}return t};return t}function pi(){var t=In(Pn,Pn);t.copy=function(){return Bn(t,pi())};Ee.apply(t,arguments);return di(t)}var gi=0;var yi=window.devicePixelRatio||1;var _i;var mi=Object.freeze({show_legend:true,title_mode:"auto",title:"",color_band_width:8,color_band_height:1,color_band_radius:3,binned_label_mode:"thresholds",binned_label_custom:"",legend_min:null,legend_max:null,additional_min_label:"",additional_max_label:""});function vi(t){this._state=t;for(var e in mi){if(this._state[e]===undefined)this._state[e]=mi[e]}this._colorFunction=undefined;this._formatFunction=undefined;this._legend_domain=[];this._id="fl-legend-continuous-color-"+gi;this._visible=true;this._marker_value=null;this._auto_title="";this._container=Kt(document.createElement("div")).attr("class","fl-legend-container").attr("id",this._id).style("display","none");this._container.append("p").classed("fl-legend-title",true);var n=this._container.append("div").classed("min label",true);n.append("tspan").classed("custom-label",true);n.append("tspan").classed("number",true);this._container.append("div").classed("color-range-container",true);this._container.select(".color-range-container").append("canvas").classed("color-range",true);this._container.select(".color-range-container").append("canvas").classed("color-range-labels",true);var i=this._container.append("div").classed("max label",true);i.append("tspan").classed("number",true);i.append("tspan").classed("custom-label",true);gi++;return this}vi.prototype.appendTo=de;vi.prototype.format=pe;vi.prototype.getContainer=ge;vi.prototype.visible=ye;vi.prototype.autoTitle=me;vi.prototype._updateTitle=ve;vi.prototype.data=function(t,e){if(!t&&!e)return this._legend_domain.slice();var n=Array.isArray(t)?t.slice():[];this._legend_domain=we(n,this._state);this._colorFunction=e;return this};vi.prototype.markerValue=function(t){if(t===undefined)return this._marker_value;this._marker_value=t;return this};vi.prototype.update=function(t){var e=this._state.show_legend&&this._visible&&this._legend_domain.length>0;this._container.style("display",e?"":"none");if(!e)return this;this._updateTitle();this._updateLegend(t);return this};vi.prototype._updateLegend=function(t){var e=this._legend_domain;_i=document.body.getAttribute("dir");this._scale_type="continuous";if(this._colorFunction.thresholds)this._scale_type="binned";else if(e.length>2)this._scale_type="diverging";var n=this._state;var i=be(n.color_band_width);var r=be(n.color_band_height);var o=i;this._container.style("display","inline-flex").style("align-items",this._scale_type=="continuous"?"center":"flex-start");this._container.select(".color-range-container").style("display","inline-block");var s=this._container.select(".color-range").attr("width",i*yi).attr("height",r*yi).style("border-radius",n.color_band_radius+"px").style("width",i+"px").style("height",r+"px").style("display","block");this._container.select(".color-range-labels").attr("width",o*yi).style("width",o+"px").style("display",this._scale_type=="continuous"?"none":"block").node().getContext("2d").scale(yi,yi);var a=s.node().getContext("2d");a.scale(yi,yi);function l(t){var n=e.max-e.min;var r=t/i;if(_i=="rtl")return e.max-r*n;return e.min+r*n}for(var u=0;u<i;u++){var c=this._colorFunction(l(u));a.fillStyle=c;a.strokeStyle=c;a.fillRect(u,0,1,r);a.strokeRect(u,0,1,r)}if(this._marker_value!==null){var h=pi().domain([e.min,e.max]).range([0,i]);var f=h(this.markerValue());var d=0;var p=r;a.save();a.strokeStyle="#FFFFFF";a.lineWidth=3;a.beginPath();a.moveTo(f,d);a.lineTo(f,p);a.stroke();a.strokeStyle="#000000";a.lineWidth=1;a.beginPath();a.moveTo(f,d);a.lineTo(f,p);a.stroke();a.restore()}this._updateLegendLabels(t)};vi.prototype._updateLegendLabels=function(t={}){var e=this._container.select(".color-range-labels");var n=this._formatFunction;var i=this._legend_domain;var r=this._state;var o=this._container.select(".min.label").style("display","inline-flex").style("align-items","center").style("vertical-align","middle").style("user-select","none").style("line-height","1.25em").style("padding-inline-start",0).style("padding-inline-end",fe);o.select(".number").style("display",this._scale_type=="continuous"?null:"none").text((function(){return n?n(i.min):i.min}));o.select(".custom-label").text((function(){return r.additional_min_label+" "})).style("text-align","center").style("padding-inline-end",fe);var s=this._container.select(".max.label").style("display","inline-flex").style("align-items","center").style("vertical-align","middle").style("user-select","none").style("line-height","1.25em").style("padding-inline-start",fe).style("padding-inline-end",0);s.select(".number").style("display",this._scale_type=="continuous"?null:"none").text((function(){return n?n(i.max):i.max}));s.select(".custom-label").text((function(){return" "+r.additional_max_label})).style("text-align","center").style("padding-inline-start",fe);var a=[];var l=0;var u=0;if(this._scale_type==="diverging")a=this._getDivergingLabels();else if(this._scale_type==="binned")a=this._getBinnedLabels();if(a.length){var c=e.node().getContext("2d");c.textAlign="center";c.textBaseline="top";c.font=t.weight+" "+be(t.size)+"px "+t.family;var h=function(){var t=[];var e=be(r.color_band_width);var o=wi([0,e]);var s=_i=="rtl"?[i.max,i.min]:[i.min,i.max];var a=pi().domain(s).range([0,e]);return function(i){var r=a(i);if(!o(r))return;var s=n?n(i):i;var h=c.measureText(s).width/2+1;var f=r-h;var d=r+h;var p=0;var g=t.length;for(var y=0;y<g;y++){if(r>t[y].center)p++;else break}var _=p===0;var m=p===g;if(!_&&t[p-1].right>f)return;if(!m&&t[p].left<d)return;if(_)l=Math.abs(Math.min(0,f));if(m)u=Math.max(0,d-e);t.splice(p,0,{left:f,center:r,right:d});return{text:s,position:r}}}();var f=a.map((function(t){return h(t)}));var d=be(r.color_band_width)+l+u;var p=Math.ceil(be(t.size)*.95);var g=window.devicePixelRatio||1;e.attr("width",d*g).style("width",d+"px").attr("height",p*g).style("height",p+"px").style("margin-top",fe);Kt(".color-range").style("margin-left",l+"px");c.scale(g,g);c.textAlign="center";c.textBaseline="top";c.font=t.weight+" "+be(t.size)+"px "+t.family;c.fillStyle=t.color;f.forEach((function(t){if(t)c.fillText(t.text,t.position+l,0)}))}};vi.prototype._getDivergingLabels=function(){var t=this._legend_domain;var e=wi(t);var n=[];if(e(t.min))n.push(t.min);if(e(t.mid))n.push(t.mid);if(e(t.max))n.push(t.max);return n};vi.prototype._getBinnedLabels=function(){var t=this._state;var e=this._legend_domain;var n=wi(e);var i;if(t.binned_label_mode==="thresholds"){i=this._colorFunction.thresholds.slice().filter(n);if(e.min<i[0])i.unshift(e.min);if(e.max>i[i.length-e.length-1])i.unshift(e.max)}else if(t.binned_label_mode==="centers"){i=this._colorFunction.centers.slice().filter(n);if(i.length){var r=this._colorFunction.thresholds;var o=r[0];var s=r[r.length-1];if(o>e.min)i.unshift((e.min+o)/2);if(s<e.max)i.unshift((s+e.max)/2)}else i.push((e.min+e.max)/2)}else i=t.binned_label_custom.split(";").map(parseFloat);return i};function wi(t){var e=-Infinity;var n=Infinity;for(var i in t){e=Math.max(e,t[i]);n=Math.min(n,t[i])}return function(t){return t>=n&&t<=e}}vi.prototype.prepareScreenshotSVG=function(){if(!this._state.show_legend||!this._visible||!this._legend_domain.length)return;s("#fl-layout-wrapper",this._id+"-svg-screenshot-container").addTextElements(".fl-legend-title").addGradient(".color-range",this._colorFunction,this._legend_domain).addTextElements(".min.label").addTextElements(".max.label")};vi.prototype.clearScreenshotSVG=function(){const t=document.getElementById(this._id+"-svg-screenshot-container");if(t)t.remove()};var bi=0;var xi=Object.freeze({show_legend:true,title_mode:"auto",title:"",clip_height:1,small_symbol_size:.5,shape_fill:"#eeeeee",shape_stroke:"#555555"});function Mi(t){this._state=t;for(var e in xi){if(this._state[e]===undefined)this._state[e]=xi[e]}this._scaleFunction=undefined;this._formatFunction=undefined;this._id="fl-legend-continuous-size-"+bi;this._visible=true;this._auto_title="";this._symbol_type="circle";this._spike_width=10;this._container=Kt(document.createElement("div")).attr("class","fl-legend-container").attr("id",this._id).style("display","none").style("align-items","center");this._container.append("p").attr("class","fl-legend-title");this._container.append("div").classed("min label",true);var n=this._container.append("div").classed("symbols",true);n.append("canvas").classed("min symbol",true);n.append("canvas").classed("max symbol",true);this._container.append("div").classed("max label",true);bi++;return this}Mi.prototype.appendTo=de;Mi.prototype.format=pe;Mi.prototype.autoTitle=me;Mi.prototype._updateTitle=ve;Mi.prototype.getContainer=ge;Mi.prototype.visible=ye;Mi.prototype.scale=function(t){if(t===undefined)return this._scaleFunction;this._scaleFunction=t;return this};Mi.prototype.symbolType=function(t){if(t===undefined)return this._symbol_type;this._symbol_type=t;return this};Mi.prototype.spikeWidth=function(t){if(t===undefined)return this._spike_width;this._spike_width=t;return this};Mi.prototype.update=function(){var t=this._state.show_legend&&this._visible;var e=Math.ceil(be(this._state.clip_height));this._container.style("display",t?"inline-flex":"none").style("align-items",this._symbol_type==="circle"?"center":"baseline").style("min-height",e+"px");if(!t||!this._scaleFunction)return this;if(this._scaleFunction.domain()[0]!==0){console.warn("Non zero domain[0] in ContinuousSizeLegend")}if(this._scaleFunction.range()[0]!==0){console.warn("Non zero range[0] in ContinuousSizeLegend")}this._updateTitle();this._updateLegend();return this};Mi.prototype._updateSymbolCanvas=function(t,e,n,i){var r=this._container.select(t).style("width",e+"px").style("height",n+"px").attr("width",e*i).attr("height",n*i);var o=r.node().getContext("2d");o.scale(i,i);o.clearRect(0,0,e,n);return o};Mi.prototype._updateCircle=function(t,e,n,i,r,o){var s=this._scaleFunction(e);var a=Math.ceil(2*s);var l=this._updateSymbolCanvas(t,a,n,i);l.beginPath();l.fillStyle=o;l.arc(.5*a,.5*n,s,0,2*Math.PI);l.fill();l.beginPath();l.fillStyle=r;l.arc(.5*a,.5*n,Math.max(s-1,0),0,2*Math.PI);l.fill()};Mi.prototype._updateSpike=function(t,e,n,i,r,o){var s=this._scaleFunction(e);var a=Math.ceil(this._spike_width);var l=this._updateSymbolCanvas(t,a,n,i);var u=Math.atan(.5*a/s);var c=1/Math.cos(u);var h=1/Math.sin(u);l.beginPath();l.fillStyle=o;l.moveTo(0,n);l.lineTo(.5*a,n-s);l.lineTo(a,n);l.fill();l.beginPath();l.fillStyle=r;l.moveTo(c,n);l.lineTo(.5*a,n-s+h);l.lineTo(a-c,n);l.fill()};Mi.prototype._updateLegend=function(){var t=this._scaleFunction.domain();var e=this._scaleFunction.range();var n=this._formatFunction;var i=this._state;var r=i.shape_fill;var o=i.shape_stroke;var s=window.devicePixelRatio||1;var a=be(i.clip_height);a=Math.ceil(Math.min(a,e[1]*2));var l=this._symbol_type;var u=this._scaleFunction.invert(l==="circle"?a/2:a);u=Math.min(u,t[1]);var c=Me(u)||0;var h=c*i.small_symbol_size;this._container.style("min-height",a+"px");this._container.select(".symbols").style("display","flex").style("flex-wrap","nowrap");this._container.select(".min.symbol").style("margin-right","0.25rem");this._container.select(".min.label").style("user-select","none").style("line-height","1.25em").text((function(){return n?n(h):h})).style("padding-inline-start",0).style("padding-inline-end",fe);if(l==="circle"){this._updateCircle(".min.symbol",h,a,s,r,o)}else if(l==="spike"){this._updateSpike(".min.symbol",h,a,s,r,o)}if(l==="circle"){this._updateCircle(".max.symbol",c,a,s,r,o)}else if(l==="spike"){this._updateSpike(".max.symbol",c,a,s,r,o)}this._container.select(".max.label").style("user-select","none").style("line-height","1.25em").text((function(){return n?n(c):c})).style("padding-inline-start",fe).style("padding-inline-end",0)};Mi.prototype.prepareScreenshotSVG=function(){if(!this._state.show_legend||!this._visible)return;s("#fl-layout-wrapper",this._id+"-svg-screenshot-container").addTextElements(".min.label").addCircleElements(".min.symbol").addCircleElements(".max.symbol").addTextElements(".max.label")};Mi.prototype.clearScreenshotSVG=function(){const t=document.getElementById(this._id+"-svg-screenshot-container");if(t)t.remove()};var ki,Ai,Si,Ni,Ei=1;var Ci=Object.freeze({alignment:"start",orientation:"horizontal",text_color:null,title_weight:"bold",text_weight:"normal",text_size:Ei});function Ti(t){this._state=t;for(var e in Ci){if(this._state[e]===undefined)this._state[e]=Ci[e]}return this}Ti.prototype.appendTo=function(t){this._container=Kt(t).append("div").node();return this};Ti.prototype.add=function(t){this._legends=Array.isArray(t)?t:[t];var e=this;this._legends.forEach((function(t){if(t&&typeof t.appendTo=="function")t.appendTo(e._container);else console.warn("Please pass in valid legend instances into .add()")}));return this};Ti.prototype.update=function(){var t=window.template||undefined;var e=t?t.state.layout:undefined;Ai=this._state.text_color||t&&e&&e.font_color||"#333333";Si=e?e.body_font.name:window.getComputedStyle(document.body).fontFamily;ki=this._state.text_size;Ni=this._state.text_weight;var n={family:Si,weight:Ni,size:ki,color:Ai};this._legends.forEach((function(t){if(t&&typeof t.update=="function")t.update(n)}));var i=this._state.orientation==="horizontal";var r=this._state.alignment;var o=r=="center"?r:"flex-"+r;Kt(this._container).style("justify-content",i?o:null).style("align-items",i?null:o).style("display","flex").style("flex-direction",i?"row":"column");var s=Kt(this._container).selectAll(".fl-legend-container");s.style("padding-inline-end",(function(){if(!i)return 0;return"0.5rem"})).style("padding-bottom",(function(){if(i)return 0;return"0.25rem"})).style("justify-content",o);Kt(this._container).selectAll(".fl-legend-title").style("color",this._state.text_color).style("font-weight",this._state.title_weight).style("font-size",ki+"rem").style("margin-right",ki*.25+"rem").style("line-height","1.25em").style("margin-top",0).style("margin-bottom",0).style("text-align",r);Kt(this._container).selectAll(".fl-legend-item").style("display","inline-flex").style("text-align",r);Kt(this._container).selectAll(".fl-legend-label").style("color",this._state.text_color).style("font-weight",this._state.text_weight).style("font-size",ki+"rem");Kt(this._container).selectAll(".label").style("color",this._state.text_color).style("font-weight",this._state.text_weight).style("font-size",ki+"rem");return this};function zi(t){return new Ti(t)}function Li(t){return new Se(t)}function Fi(t){return new vi(t)}function Pi(t){return new Mi(t)}t.createContinuousColorLegend=Fi;t.createContinuousSizeLegend=Pi;t.createDiscreteColorLegend=Li;t.createLegendContainer=zi}));
{
"name": "@flourish/legend",
"version": "8.0.2",
"version": "8.0.3",
"private": false,

@@ -15,3 +15,3 @@ "description": "Flourish module for making legend",

"d3-selection": "^1.4.0",
"@flourish/pocket-knife": "^2.0.0"
"@flourish/pocket-knife": "^2.1.0"
},

@@ -30,3 +30,3 @@ "devDependencies": {

"mocha": "^10.2.0",
"@flourish/cypress": "^9.0.0",
"@flourish/cypress": "^9.1.0",
"@flourish/mocha-env": "^1.0.0"

@@ -33,0 +33,0 @@ },

@@ -0,1 +1,4 @@

# 8.0.3
* Fix legend swatches always being circlular and not having borders when downloading as SVG
# 8.0.2

@@ -2,0 +5,0 @@ * Fix an issue with null labels discovered during fuzzer testing

@@ -451,3 +451,3 @@ import { createScreenshotSVG } from "@flourish/pocket-knife";

.addTextElements(".fl-legend-title")
.addCircleElements(".fl-legend-swatch")
.addSwatchElements(".fl-legend-swatch", ".fl-legend-label")
.addTextElements(".fl-legend-label");

@@ -454,0 +454,0 @@ };

Sorry, the diff of this file is too big to display