@flourish/sdk 3.15.1 → 3.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/site/script.js CHANGED
@@ -1,2 +1,3 @@
1
- var Flourish=function(e){"use strict";function n(e,t){return e<t?-1:t<e?1:t<=e?0:NaN}1===(t=n).length&&(r=t,t=function(e,t){return n(r(e),t)});var t,r,i={value:function(){}};function b(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r)throw new Error("illegal type: "+e);r[e]=[]}return new a(r)}function a(e){this._=e}function f(e,t){for(var n,r=0,a=e.length;r<a;++r)if((n=e[r]).name===t)return n.value}function u(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=i,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}a.prototype=b.prototype={constructor:a,on:function(e,t){var n,r,a=this._,i=(r=a,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(0<=n&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,c=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o<c;)if(n=(e=i[o]).type)a[n]=u(a[n],e.name,t);else if(null==t)for(n in a)a[n]=u(a[n],e.name,null);return this}for(;++o<c;)if((n=(e=i[o]).type)&&(n=f(a[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new a(e)},call:function(e,t){if(0<(n=arguments.length-2))for(var n,r,a=new Array(n),i=0;i<n;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(r=this._[e]).length;i<n;++i)r[i].value.apply(t,a)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,i=r.length;a<i;++a)r[a].value.apply(t,n)}};var o="http://www.w3.org/1999/xhtml",c={svg:"http://www.w3.org/2000/svg",xhtml:o,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function s(e){var t=e+="",n=t.indexOf(":");return 0<=n&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),c.hasOwnProperty(t)?{space:c[t],local:e}:e}function l(e){var t=s(e);return(t.local?function(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}:function(n){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===o&&e.documentElement.namespaceURI===o?e.createElement(n):e.createElementNS(t,n)}})(t)}function d(){}function h(e){return null==e?d:function(){return this.querySelector(e)}}function p(){return[]}function v(e){return null==e?p:function(){return this.querySelectorAll(e)}}var g=function(e){return function(){return this.matches(e)}};if("undefined"!=typeof document){var m=document.documentElement;if(!m.matches){var y=m.webkitMatchesSelector||m.msMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector;g=function(e){return function(){return y.call(this,e)}}}}var w=g;function _(e){return new Array(e.length)}function x(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}x.prototype={constructor:x,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var C="$";function A(e,t,n,r,a,i){for(var o,c=0,f=t.length,u=i.length;c<u;++c)(o=t[c])?(o.__data__=i[c],r[c]=o):n[c]=new x(e,i[c]);for(;c<f;++c)(o=t[c])&&(a[c]=o)}function T(e,t,n,r,a,i,o){var c,f,u,s={},l=t.length,d=i.length,h=new Array(l);for(c=0;c<l;++c)(f=t[c])&&(h[c]=u=C+o.call(f,f.__data__,c,t),u in s?a[c]=f:s[u]=f);for(c=0;c<d;++c)(f=s[u=C+o.call(e,i[c],c,i)])?((r[c]=f).__data__=i[c],s[u]=null):n[c]=new x(e,i[c]);for(c=0;c<l;++c)(f=t[c])&&s[h[c]]===f&&(a[c]=f)}function M(e,t){return e<t?-1:t<e?1:t<=e?0:NaN}function D(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function E(e,t){return e.style.getPropertyValue(t)||D(e).getComputedStyle(e,null).getPropertyValue(t)}function k(e){return e.trim().split(/^|\s+/)}function F(e){return e.classList||new S(e)}function S(e){this._node=e,this._names=k(e.getAttribute("class")||"")}function N(e,t){for(var n=F(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function U(e,t){for(var n=F(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function L(){this.textContent=""}function B(){this.innerHTML=""}function H(){this.nextSibling&&this.parentNode.appendChild(this)}function O(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function P(){return null}function j(){var e=this.parentNode;e&&e.removeChild(this)}function Y(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function q(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}S.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);0<=t&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return 0<=this._names.indexOf(e)}};var I={},z=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(I={mouseenter:"mouseover",mouseleave:"mouseout"}));function R(n,e,t){return n=W(n,e,t),function(e){var t=e.relatedTarget;t&&(t===this||8&t.compareDocumentPosition(this))||n.call(this,e)}}function W(n,r,a){return function(e){var t=z;z=e;try{n.call(this,this.__data__,r,a)}finally{z=t}}}function X(i){return function(){var e=this.__on;if(e){for(var t,n=0,r=-1,a=e.length;n<a;++n)t=e[n],i.type&&t.type!==i.type||t.name!==i.name?e[++r]=t:this.removeEventListener(t.type,t.listener,t.capture);++r?e.length=r:delete this.__on}}}function V(f,u,s){var l=I.hasOwnProperty(f.type)?R:W;return function(e,t,n){var r,a=this.__on,i=l(u,t,n);if(a)for(var o=0,c=a.length;o<c;++o)if((r=a[o]).type===f.type&&r.name===f.name)return this.removeEventListener(r.type,r.listener,r.capture),this.addEventListener(r.type,r.listener=i,r.capture=s),void(r.value=u);this.addEventListener(f.type,i,s),r={type:f.type,name:f.name,value:u,listener:i,capture:s},a?a.push(r):this.__on=[r]}}function $(e,t,n){var r=D(e),a=r.CustomEvent;"function"==typeof a?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}var Z=[null];function J(e,t){this._groups=e,this._parents=t}function G(){return new J([[document.documentElement]],Z)}function Q(e){return"string"==typeof e?new J([[document.querySelector(e)]],[document.documentElement]):new J([[e]],Z)}function K(e){return"string"==typeof e?new J([document.querySelectorAll(e)],[document.documentElement]):new J([null==e?[]:e],Z)}function ee(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function te(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ne(){}J.prototype=G.prototype={constructor:J,select:function(e){"function"!=typeof e&&(e=h(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o,c=t[a],f=c.length,u=r[a]=new Array(f),s=0;s<f;++s)(i=c[s])&&(o=e.call(i,i.__data__,s,c))&&("__data__"in i&&(o.__data__=i.__data__),u[s]=o);return new J(r,this._parents)},selectAll:function(e){"function"!=typeof e&&(e=v(e));for(var t=this._groups,n=t.length,r=[],a=[],i=0;i<n;++i)for(var o,c=t[i],f=c.length,u=0;u<f;++u)(o=c[u])&&(r.push(e.call(o,o.__data__,u,c)),a.push(o));return new J(r,a)},filter:function(e){"function"!=typeof e&&(e=w(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o=t[a],c=o.length,f=r[a]=[],u=0;u<c;++u)(i=o[u])&&e.call(i,i.__data__,u,o)&&f.push(i);return new J(r,this._parents)},data:function(e,t){if(!e)return p=new Array(this.size()),s=-1,this.each(function(e){p[++s]=e}),p;var n,r=t?T:A,a=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var o=i.length,c=new Array(o),f=new Array(o),u=new Array(o),s=0;s<o;++s){var l=a[s],d=i[s],h=d.length,p=e.call(l,l&&l.__data__,s,a),b=p.length,g=f[s]=new Array(b),v=c[s]=new Array(b);r(l,d,g,v,u[s]=new Array(h),p,t);for(var m,y,w=0,_=0;w<b;++w)if(m=g[w]){for(_<=w&&(_=w+1);!(y=v[_])&&++_<b;);m._next=y||null}}return(c=new J(c,a))._enter=f,c._exit=u,c},enter:function(){return new J(this._enter||this._groups.map(_),this._parents)},exit:function(){return new J(this._exit||this._groups.map(_),this._parents)},merge:function(e){for(var t=this._groups,n=e._groups,r=t.length,a=n.length,i=Math.min(r,a),o=new Array(r),c=0;c<i;++c)for(var f,u=t[c],s=n[c],l=u.length,d=o[c]=new Array(l),h=0;h<l;++h)(f=u[h]||s[h])&&(d[h]=f);for(;c<r;++c)o[c]=t[c];return new J(o,this._parents)},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,a=e[t],i=a.length-1,o=a[i];0<=--i;)(r=a[i])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(n){function e(e,t){return e&&t?n(e.__data__,t.__data__):!e-!t}n||(n=M);for(var t=this._groups,r=t.length,a=new Array(r),i=0;i<r;++i){for(var o,c=t[i],f=c.length,u=a[i]=new Array(f),s=0;s<f;++s)(o=c[s])&&(u[s]=o);u.sort(e)}return new J(a,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){var e=new Array(this.size()),t=-1;return this.each(function(){e[++t]=this}),e},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,i=r.length;a<i;++a){var o=r[a];if(o)return o}return null},size:function(){var e=0;return this.each(function(){++e}),e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a,i=t[n],o=0,c=i.length;o<c;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this},attr:function(e,t){var n=s(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?function(e){return function(){this.removeAttributeNS(e.space,e.local)}}:function(e){return function(){this.removeAttribute(e)}}:"function"==typeof t?n.local?function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}:function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:n.local?function(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}:function(e,t){return function(){this.setAttribute(e,t)}})(n,t))},style:function(e,t,n){return 1<arguments.length?this.each((null==t?function(e){return function(){this.style.removeProperty(e)}}:"function"==typeof t?function(t,n,r){return function(){var e=n.apply(this,arguments);null==e?this.style.removeProperty(t):this.style.setProperty(t,e,r)}}:function(e,t,n){return function(){this.style.setProperty(e,t,n)}})(e,t,null==n?"":n)):E(this.node(),e)},property:function(e,t){return 1<arguments.length?this.each((null==t?function(e){return function(){delete this[e]}}:"function"==typeof t?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(e,t){return function(){this[e]=t}})(e,t)):this.node()[e]},classed:function(e,t){var n=k(e+"");if(arguments.length<2){for(var r=F(this.node()),a=-1,i=n.length;++a<i;)if(!r.contains(n[a]))return!1;return!0}return this.each(("function"==typeof t?function(e,t){return function(){(t.apply(this,arguments)?N:U)(this,e)}}:t?function(e){return function(){N(this,e)}}:function(e){return function(){U(this,e)}})(n,t))},text:function(e){return arguments.length?this.each(null==e?L:("function"==typeof e?function(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}:function(e){return function(){this.textContent=e}})(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?B:("function"==typeof e?function(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}:function(e){return function(){this.innerHTML=e}})(e)):this.node().innerHTML},raise:function(){return this.each(H)},lower:function(){return this.each(O)},append:function(e){var t="function"==typeof e?e:l(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:l(e),r=null==t?P:"function"==typeof t?t:h(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(j)},clone:function(e){return this.select(e?q:Y)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,a,i=(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return 0<=n&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}),o=i.length;if(!(arguments.length<2)){for(c=t?V:X,null==n&&(n=!1),r=0;r<o;++r)this.each(c(i[r],t,n));return this}var c=this.node().__on;if(c)for(var f,u=0,s=c.length;u<s;++u)for(r=0,f=c[u];r<o;++r)if((a=i[r]).type===f.type&&a.name===f.name)return f.value},dispatch:function(e,t){return this.each(("function"==typeof t?function(e,t){return function(){return $(this,e,t.apply(this,arguments))}}:function(e,t){return function(){return $(this,e,t)}})(e,t))}};var re=1/.7,ae="\\s*([+-]?\\d+)\\s*",ie="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",oe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ce=/^#([0-9a-f]{3})$/,fe=/^#([0-9a-f]{6})$/,ue=new RegExp("^rgb\\("+[ae,ae,ae]+"\\)$"),se=new RegExp("^rgb\\("+[oe,oe,oe]+"\\)$"),le=new RegExp("^rgba\\("+[ae,ae,ae,ie]+"\\)$"),de=new RegExp("^rgba\\("+[oe,oe,oe,ie]+"\\)$"),he=new RegExp("^hsl\\("+[ie,oe,oe]+"\\)$"),pe=new RegExp("^hsla\\("+[ie,oe,oe,ie]+"\\)$"),be={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ge(e){var t;return e=(e+"").trim().toLowerCase(),(t=ce.exec(e))?new _e((t=parseInt(t[1],16))>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):(t=fe.exec(e))?ve(parseInt(t[1],16)):(t=ue.exec(e))?new _e(t[1],t[2],t[3],1):(t=se.exec(e))?new _e(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=le.exec(e))?me(t[1],t[2],t[3],t[4]):(t=de.exec(e))?me(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=he.exec(e))?Ce(t[1],t[2]/100,t[3]/100,1):(t=pe.exec(e))?Ce(t[1],t[2]/100,t[3]/100,t[4]):be.hasOwnProperty(e)?ve(be[e]):"transparent"===e?new _e(NaN,NaN,NaN,0):null}function ve(e){return new _e(e>>16&255,e>>8&255,255&e,1)}function me(e,t,n,r){return r<=0&&(e=t=n=NaN),new _e(e,t,n,r)}function ye(e){return e instanceof ne||(e=ge(e)),e?new _e((e=e.rgb()).r,e.g,e.b,e.opacity):new _e}function we(e,t,n,r){return 1===arguments.length?ye(e):new _e(e,t,n,null==r?1:r)}function _e(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function xe(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Ce(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||1<=n?e=t=NaN:t<=0&&(e=NaN),new Ae(e,t,n,r)}function Ae(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Te(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}ee(ne,ge,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),ee(_e,we,te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new _e(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new _e(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+xe(this.r)+xe(this.g)+xe(this.b)},toString:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"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))+(1===e?")":", "+e+")")}})),ee(Ae,function(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Ae)return new Ae(e.h,e.s,e.l,e.opacity);if(e instanceof ne||(e=ge(e)),!e)return new Ae;if(e instanceof Ae)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,c=i-a,f=(i+a)/2;return c?(o=t===i?(n-r)/c+6*(n<r):n===i?(r-t)/c+2:(t-n)/c+4,c/=f<.5?i+a:2-i-a,o*=60):c=0<f&&f<1?0:o,new Ae(o,c,f,e.opacity)}(e):new Ae(e,t,n,null==r?1:r)},te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new Ae(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Ae(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new _e(Te(240<=e?e-240:e+120,a,r),Te(e,a,r),Te(e<120?e+240:e-120,a,r),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}}));var Me=Math.PI/180,De=180/Math.PI,Ee=.96422,ke=1,Fe=.82521,Se=4/29,Ne=6/29,Ue=3*Ne*Ne,Le=Ne*Ne*Ne;function Be(e){if(e instanceof He)return new He(e.l,e.a,e.b,e.opacity);if(e instanceof qe){if(isNaN(e.h))return new He(e.l,0,0,e.opacity);var t=e.h*Me;return new He(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}e instanceof _e||(e=ye(e));var n,r,a=Ye(e.r),i=Ye(e.g),o=Ye(e.b),c=Oe((.2225045*a+.7168786*i+.0606169*o)/ke);return a===i&&i===o?n=r=c:(n=Oe((.4360747*a+.3850649*i+.1430804*o)/Ee),r=Oe((.0139322*a+.0971045*i+.7141733*o)/Fe)),new He(116*c-16,500*(n-c),200*(c-r),e.opacity)}function He(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function Oe(e){return Le<e?Math.pow(e,1/3):e/Ue+Se}function Pe(e){return Ne<e?e*e*e:Ue*(e-Se)}function je(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Ye(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function qe(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}ee(He,function(e,t,n,r){return 1===arguments.length?Be(e):new He(e,t,n,null==r?1:r)},te(ne,{brighter:function(e){return new He(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker:function(e){return new He(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new _e(je(3.1338561*(t=Ee*Pe(t))-1.6168667*(e=ke*Pe(e))-.4906146*(n=Fe*Pe(n))),je(-.9787684*t+1.9161415*e+.033454*n),je(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),ee(qe,function(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof qe)return new qe(e.h,e.c,e.l,e.opacity);if(e instanceof He||(e=Be(e)),0===e.a&&0===e.b)return new qe(NaN,0,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*De;return new qe(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}(e):new qe(e,t,n,null==r?1:r)},te(ne,{brighter:function(e){return new qe(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker:function(e){return new qe(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb:function(){return Be(this).rgb()}}));var Ie=1.78277,ze=-.29227,Re=-.90649,We=1.97294,Xe=We*Re,Ve=We*Ie,$e=Ie*ze- -.14861*Re;function Ze(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Je)return new Je(e.h,e.s,e.l,e.opacity);e instanceof _e||(e=ye(e));var t=e.r/255,n=e.g/255,r=e.b/255,a=($e*r+Xe*t-Ve*n)/($e+Xe-Ve),i=r-a,o=(We*(n-a)-ze*i)/Re,c=Math.sqrt(o*o+i*i)/(We*a*(1-a)),f=c?Math.atan2(o,i)*De-120:NaN;return new Je(f<0?f+360:f,c,a,e.opacity)}(e):new Je(e,t,n,null==r?1:r)}function Je(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Ge(e){return function(){return e}}function Qe(t,n){return function(e){return t+e*n}}function Ke(i){return 1==(i=+i)?et:function(e,t){return t-e?(n=e,r=t,a=i,n=Math.pow(n,a),r=Math.pow(r,a)-n,a=1/a,function(e){return Math.pow(n+e*r,a)}):Ge(isNaN(e)?t:e);var n,r,a}}function et(e,t){var n=t-e;return n?Qe(e,n):Ge(isNaN(e)?t:e)}ee(Je,Ze,te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new Je(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Je(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*Me,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),a=Math.sin(e);return new _e(255*(t+n*(-.14861*r+Ie*a)),255*(t+n*(ze*r+Re*a)),255*(t+n*(We*r)),this.opacity)}}));var tt=function e(t){var o=Ke(t);function n(t,e){var n=o((t=we(t)).r,(e=we(e)).r),r=o(t.g,e.g),a=o(t.b,e.b),i=et(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=r(e),t.b=a(e),t.opacity=i(e),t+""}}return n.gamma=e,n}(1);var nt,rt=(nt=function(u){var s=u.length-1;return function(e){var t,n,r,a=e<=0?e=0:1<=e?s-(e=1):Math.floor(e*s),i=u[a],o=u[a+1],c=0<a?u[a-1]:2*i-o,f=a<s-1?u[a+2]:2*o-i;return((1-3*(t=(e-a/s)*s)+3*(n=t*t)-(r=n*t))*c+(4-6*n+3*r)*i+(1+3*t+3*n-3*r)*o+r*f)/6}},function(e){var t,n,r=e.length,a=new Array(r),i=new Array(r),o=new Array(r);for(t=0;t<r;++t)n=we(e[t]),a[t]=n.r||0,i[t]=n.g||0,o[t]=n.b||0;return a=nt(a),i=nt(i),o=nt(o),n.opacity=1,function(e){return n.r=a(e),n.g=i(e),n.b=o(e),n+""}});function at(t,n){return n-=t=+t,function(e){return t+n*e}}var it=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ot=new RegExp(it.source,"g");var ct,ft,ut,st,lt=180/Math.PI,dt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ht(e,t,n,r,a,i){var o,c,f;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(f=e*n+t*r)&&(n-=e*f,r-=t*f),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,f/=c),e*r<t*n&&(e=-e,t=-t,f=-f,o=-o),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*lt,skewX:Math.atan(f)*lt,scaleX:o,scaleY:c}}function pt(d,h,p,b){function g(e){return e.length?e.pop()+" ":""}return function(e,t){var n,r,a,i,o,c,f,u,s=[],l=[];return e=d(e),t=d(t),function(e,t,n,r,a,i){if(e!==n||t!==r){var o=a.push("translate(",null,h,null,p);i.push({i:o-4,x:at(e,n)},{i:o-2,x:at(t,r)})}else(n||r)&&a.push("translate("+n+h+r+p)}(e.translateX,e.translateY,t.translateX,t.translateY,s,l),n=e.rotate,r=t.rotate,a=s,i=l,n!==r?(180<n-r?r+=360:180<r-n&&(n+=360),i.push({i:a.push(g(a)+"rotate(",null,b)-2,x:at(n,r)})):r&&a.push(g(a)+"rotate("+r+b),o=e.skewX,c=t.skewX,f=s,u=l,o!==c?u.push({i:f.push(g(f)+"skewX(",null,b)-2,x:at(o,c)}):c&&f.push(g(f)+"skewX("+c+b),function(e,t,n,r,a,i){if(e!==n||t!==r){var o=a.push(g(a)+"scale(",null,",",null,")");i.push({i:o-4,x:at(e,n)},{i:o-2,x:at(t,r)})}else 1===n&&1===r||a.push(g(a)+"scale("+n+","+r+")")}(e.scaleX,e.scaleY,t.scaleX,t.scaleY,s,l),e=t=null,function(e){for(var t,n=-1,r=l.length;++n<r;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var bt=pt(function(e){return"none"===e?dt:(ct||(ct=document.createElement("DIV"),ft=document.documentElement,ut=document.defaultView),ct.style.transform=e,e=ut.getComputedStyle(ft.appendChild(ct),null).getPropertyValue("transform"),ft.removeChild(ct),ht(+(e=e.slice(7,-1).split(","))[0],+e[1],+e[2],+e[3],+e[4],+e[5]))},"px, ","px)","deg)"),gt=pt(function(e){return null==e?dt:(st||(st=document.createElementNS("http://www.w3.org/2000/svg","g")),st.setAttribute("transform",e),(e=st.transform.baseVal.consolidate())?ht((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):dt)},", ",")",")");Math.SQRT2;function vt(c){return function e(o){function t(t,e){var n=c((t=Ze(t)).h,(e=Ze(e)).h),r=et(t.s,e.s),a=et(t.l,e.l),i=et(t.opacity,e.opacity);return function(e){return t.h=n(e),t.s=r(e),t.l=a(Math.pow(e,o)),t.opacity=i(e),t+""}}return o=+o,t.gamma=e,t}(1)}vt(function(e,t){var n=t-e;return n?Qe(e,180<n||n<-180?n-360*Math.round(n/360):n):Ge(isNaN(e)?t:e)});var mt,yt,wt=vt(et),_t=0,xt=0,Ct=0,At=1e3,Tt=0,Mt=0,Dt=0,Et="object"==typeof performance&&performance.now?performance:Date,kt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ft(){return Mt||(kt(St),Mt=Et.now()+Dt)}function St(){Mt=0}function Nt(){this._call=this._time=this._next=null}function Ut(e,t,n){var r=new Nt;return r.restart(e,t,n),r}function Lt(){Mt=(Tt=Et.now())+Dt,_t=xt=0;try{!function(){Ft(),++_t;for(var e,t=mt;t;)0<=(e=Mt-t._time)&&t._call.call(null,e),t=t._next;--_t}()}finally{_t=0,function(){var e,t,n=mt,r=1/0;for(;n;)n=n._call?(r>n._time&&(r=n._time),(e=n)._next):(t=n._next,n._next=null,e?e._next=t:mt=t);yt=e,Ht(r)}(),Mt=0}}function Bt(){var e=Et.now(),t=e-Tt;At<t&&(Dt-=t,Tt=e)}function Ht(e){_t||(xt&&(xt=clearTimeout(xt)),24<e-Mt?(e<1/0&&(xt=setTimeout(Lt,e-Et.now()-Dt)),Ct&&(Ct=clearInterval(Ct))):(Ct||(Tt=Et.now(),Ct=setInterval(Bt,At)),_t=1,kt(Lt)))}function Ot(t,n,e){var r=new Nt;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}Nt.prototype=Ut.prototype={constructor:Nt,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Ft():+n)+(null==t?0:+t),this._next||yt===this||(yt?yt._next=this:mt=this,yt=this),this._call=e,this._time=n,Ht()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ht())}};var Pt=b("start","end","interrupt"),jt=[],Yt=0,qt=1,It=2,zt=3,Rt=4,Wt=5,Xt=6;function Vt(e,t,n,r,a,i){var o=e.__transition;if(o){if(n in o)return}else e.__transition={};!function(i,o,c){var f,u=i.__transition;function s(e){var t,n,r,a;if(c.state!==qt)return d();for(t in u)if((a=u[t]).name===c.name){if(a.state===zt)return Ot(s);a.state===Rt?(a.state=Xt,a.timer.stop(),a.on.call("interrupt",i,i.__data__,a.index,a.group),delete u[t]):+t<o&&(a.state=Xt,a.timer.stop(),delete u[t])}if(Ot(function(){c.state===zt&&(c.state=Rt,c.timer.restart(l,c.delay,c.time),l(e))}),c.state=It,c.on.call("start",i,i.__data__,c.index,c.group),c.state===It){for(c.state=zt,f=new Array(r=c.tween.length),t=0,n=-1;t<r;++t)(a=c.tween[t].value.call(i,i.__data__,c.index,c.group))&&(f[++n]=a);f.length=n+1}}function l(e){for(var t=e<c.duration?c.ease.call(null,e/c.duration):(c.timer.restart(d),c.state=Wt,1),n=-1,r=f.length;++n<r;)f[n].call(null,t);c.state===Wt&&(c.on.call("end",i,i.__data__,c.index,c.group),d())}function d(){for(var e in c.state=Xt,c.timer.stop(),delete u[o],u)return;delete i.__transition}(u[o]=c).timer=Ut(function(e){c.state=qt,c.timer.restart(s,c.delay,c.time),c.delay<=e&&s(e-c.delay)},0,c.time)}(e,n,{name:t,index:r,group:a,on:Pt,tween:jt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Yt})}function $t(e,t){var n=Jt(e,t);if(n.state>Yt)throw new Error("too late; already scheduled");return n}function Zt(e,t){var n=Jt(e,t);if(n.state>It)throw new Error("too late; already started");return n}function Jt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Gt(e,t,n){var r=e._id;return e.each(function(){var e=Zt(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Jt(e,r).value[t]}}function Qt(e,t){var n;return("number"==typeof t?at:t instanceof ge?tt:(n=ge(t))?(t=n,tt):function(e,r){var t,n,a,i,o,c=it.lastIndex=ot.lastIndex=0,f=-1,u=[],s=[];for(e+="",r+="";(t=it.exec(e))&&(n=ot.exec(r));)(a=n.index)>c&&(a=r.slice(c,a),u[f]?u[f]+=a:u[++f]=a),(t=t[0])===(n=n[0])?u[f]?u[f]+=n:u[++f]=n:(u[++f]=null,s.push({i:f,x:at(t,n)})),c=ot.lastIndex;return c<r.length&&(a=r.slice(c),u[f]?u[f]+=a:u[++f]=a),u.length<2?s[0]?(o=s[0].x,function(e){return o(e)+""}):(i=r,function(){return i}):(r=s.length,function(e){for(var t,n=0;n<r;++n)u[(t=s[n]).i]=t.x(e);return u.join("")})})(e,t)}var Kt=G.prototype.constructor;var en=0;function tn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function nn(){return++en}var rn=G.prototype;tn.prototype=function(e){return G().transition(e)}.prototype={constructor:tn,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=h(e));for(var r=this._groups,a=r.length,i=new Array(a),o=0;o<a;++o)for(var c,f,u=r[o],s=u.length,l=i[o]=new Array(s),d=0;d<s;++d)(c=u[d])&&(f=e.call(c,c.__data__,d,u))&&("__data__"in c&&(f.__data__=c.__data__),l[d]=f,Vt(l[d],t,n,d,l,Jt(c,n)));return new tn(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=v(e));for(var r=this._groups,a=r.length,i=[],o=[],c=0;c<a;++c)for(var f,u=r[c],s=u.length,l=0;l<s;++l)if(f=u[l]){for(var d,h=e.call(f,f.__data__,l,u),p=Jt(f,n),b=0,g=h.length;b<g;++b)(d=h[b])&&Vt(d,t,n,b,h,p);i.push(h),o.push(f)}return new tn(i,o,t,n)},filter:function(e){"function"!=typeof e&&(e=w(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o=t[a],c=o.length,f=r[a]=[],u=0;u<c;++u)(i=o[u])&&e.call(i,i.__data__,u,o)&&f.push(i);return new tn(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,i=Math.min(r,a),o=new Array(r),c=0;c<i;++c)for(var f,u=t[c],s=n[c],l=u.length,d=o[c]=new Array(l),h=0;h<l;++h)(f=u[h]||s[h])&&(d[h]=f);for(;c<r;++c)o[c]=t[c];return new tn(o,this._parents,this._name,this._id)},selection:function(){return new Kt(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=nn(),r=this._groups,a=r.length,i=0;i<a;++i)for(var o,c=r[i],f=c.length,u=0;u<f;++u)if(o=c[u]){var s=Jt(o,t);Vt(o,e,n,u,c,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new tn(r,this._parents,e,n)},call:rn.call,nodes:rn.nodes,node:rn.node,size:rn.size,empty:rn.empty,each:rn.each,on:function(e,t){var n,r,a,i,o,c,f=this._id;return arguments.length<2?Jt(this.node(),f).on.on(e):this.each((n=f,a=t,c=((r=e)+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return 0<=t&&(e=e.slice(0,t)),!e||"start"===e})?$t:Zt,function(){var e=c(this,n),t=e.on;t!==i&&(o=(i=t).copy()).on(r,a),e.on=o}))},attr:function(e,t){var n=s(e),r="transform"===n?gt:Qt;return this.attrTween(e,"function"==typeof t?(n.local?function(n,r,a){var i,o,c;return function(){var e,t=a(this);if(null!=t)return(e=this.getAttributeNS(n.space,n.local))===t?null:e===i&&t===o?c:c=r(i=e,o=t);this.removeAttributeNS(n.space,n.local)}}:function(n,r,a){var i,o,c;return function(){var e,t=a(this);if(null!=t)return(e=this.getAttribute(n))===t?null:e===i&&t===o?c:c=r(i=e,o=t);this.removeAttribute(n)}})(n,r,Gt(this,"attr."+e,t)):null==t?(n.local?function(e){return function(){this.removeAttributeNS(e.space,e.local)}}:function(e){return function(){this.removeAttribute(e)}})(n):(n.local?function(t,n,r){var a,i;return function(){var e=this.getAttributeNS(t.space,t.local);return e===r?null:e===a?i:i=n(a=e,r)}}:function(t,n,r){var a,i;return function(){var e=this.getAttribute(t);return e===r?null:e===a?i:i=n(a=e,r)}})(n,r,t+""))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=s(e);return this.tween(n,(r.local?function(r,e){function t(){var t=this,n=e.apply(t,arguments);return n&&function(e){t.setAttributeNS(r.space,r.local,n(e))}}return t._value=e,t}:function(r,e){function t(){var t=this,n=e.apply(t,arguments);return n&&function(e){t.setAttribute(r,n(e))}}return t._value=e,t})(r,t))},style:function(e,t,n){var r,a,i,o,c,f,u,s,l,d,h,p,b,g,v,m,y,w="transform"==(e+="")?bt:Qt;return null==t?this.styleTween(e,(b=e,g=w,function(){var e=E(this,b),t=(this.style.removeProperty(b),E(this,b));return e===t?null:e===v&&t===m?y:y=g(v=e,m=t)})).on("end.style."+e,(p=e,function(){this.style.removeProperty(p)})):this.styleTween(e,"function"==typeof t?(u=w,s=Gt(this,"style."+(f=e),t),function(){var e=E(this,f),t=s(this);return null==t&&(this.style.removeProperty(f),t=E(this,f)),e===t?null:e===l&&t===d?h:h=u(l=e,d=t)}):(r=e,a=w,i=t+"",function(){var e=E(this,r);return e===i?null:e===o?c:c=a(o=e,i)}),n)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(r,e,a){function t(){var t=this,n=e.apply(t,arguments);return n&&function(e){t.style.setProperty(r,n(e),a)}}return t._value=e,t}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?(n=Gt(this,"text",e),function(){var e=n(this);this.textContent=null==e?"":e}):(t=null==e?"":e+"",function(){this.textContent=t}));var t,n},remove:function(){return this.on("end.remove",(n=this._id,function(){var e=this.parentNode;for(var t in this.__transition)if(+t!==n)return;e&&e.removeChild(this)}));var n},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,a=Jt(this.node(),n).tween,i=0,o=a.length;i<o;++i)if((r=a[i]).name===e)return r.value;return null}return this.each((null==t?function(a,i){var o,c;return function(){var e=Zt(this,a),t=e.tween;if(t!==o)for(var n=0,r=(c=o=t).length;n<r;++n)if(c[n].name===i){(c=c.slice()).splice(n,1);break}e.tween=c}}:function(i,o,c){var f,u;if("function"!=typeof c)throw new Error;return function(){var e=Zt(this,i),t=e.tween;if(t!==f){u=(f=t).slice();for(var n={name:o,value:c},r=0,a=u.length;r<a;++r)if(u[r].name===o){u[r]=n;break}r===a&&u.push(n)}e.tween=u}})(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?function(e,t){return function(){$t(this,e).delay=+t.apply(this,arguments)}}:function(e,t){return t=+t,function(){$t(this,e).delay=t}})(t,e)):Jt(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?function(e,t){return function(){Zt(this,e).duration=+t.apply(this,arguments)}}:function(e,t){return t=+t,function(){Zt(this,e).duration=t}})(t,e)):Jt(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Zt(this,e).ease=t}}(t,e)):Jt(this.node(),t).ease}};Math.PI,Math.PI;var an={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function on(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))return an.time=Ft(),an;return n}G.prototype.interrupt=function(e){return this.each(function(){!function(e,t){var n,r,a,i=e.__transition,o=!0;if(i){for(a in t=null==t?null:t+"",i)(n=i[a]).name===t?(r=n.state>It&&n.state<Wt,n.state=Xt,n.timer.stop(),r&&n.on.call("interrupt",e,e.__data__,n.index,n.group),delete i[a]):o=!1;o&&delete e.__transition}}(this,e)})},G.prototype.transition=function(e){var t,n;e=e instanceof tn?(t=e._id,e._name):(t=nn(),(n=an).time=Ft(),null==e?null:e+"");for(var r=this._groups,a=r.length,i=0;i<a;++i)for(var o,c=r[i],f=c.length,u=0;u<f;++u)(o=c[u])&&Vt(o,e,t,u,c,n||on(o,t));return new tn(r,this._parents,e,t)};Math.PI,Math.PI;var cn="$";function fn(){}function un(e,t){var n=new fn;if(e instanceof fn)e.each(function(e,t){n.set(t,e)});else if(Array.isArray(e)){var r,a=-1,i=e.length;if(null==t)for(;++a<i;)n.set(a,e[a]);else for(;++a<i;)n.set(t(r=e[a],a,e),r)}else if(e)for(var o in e)n.set(o,e[o]);return n}function sn(){}fn.prototype=un.prototype={constructor:fn,has:function(e){return cn+e in this},get:function(e){return this[cn+e]},set:function(e,t){return this[cn+e]=t,this},remove:function(e){var t=cn+e;return t in this&&delete this[t]},clear:function(){for(var e in this)e[0]===cn&&delete this[e]},keys:function(){var e=[];for(var t in this)t[0]===cn&&e.push(t.slice(1));return e},values:function(){var e=[];for(var t in this)t[0]===cn&&e.push(this[t]);return e},entries:function(){var e=[];for(var t in this)t[0]===cn&&e.push({key:t.slice(1),value:this[t]});return e},size:function(){var e=0;for(var t in this)t[0]===cn&&++e;return e},empty:function(){for(var e in this)if(e[0]===cn)return!1;return!0},each:function(e){for(var t in this)t[0]===cn&&e(this[t],t.slice(1),this)}};var ln=un.prototype;sn.prototype=function(e,t){var n=new sn;if(e instanceof sn)e.each(function(e){n.add(e)});else if(e){var r=-1,a=e.length;if(null==t)for(;++r<a;)n.add(e[r]);else for(;++r<a;)n.add(t(e[r],r,e))}return n}.prototype={constructor:sn,has:ln.has,add:function(e){return this[cn+(e+="")]=e,this},remove:ln.remove,clear:ln.clear,values:ln.keys,size:ln.size,empty:ln.empty,each:ln.each};var dn={},hn={};function pn(e){return new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}")}function bn(i){var t=new RegExp('["'+i+"\n\r]"),l=i.charCodeAt(0);function n(r,e){var t,n=[],a=r.length,i=0,o=0,c=a<=0,f=!1;function u(){if(c)return hn;if(f)return f=!1,dn;var e,t,n=i;if(34===r.charCodeAt(n)){for(;i++<a&&34!==r.charCodeAt(i)||34===r.charCodeAt(++i););return(e=i)>=a?c=!0:10===(t=r.charCodeAt(i++))?f=!0:13===t&&(f=!0,10===r.charCodeAt(i)&&++i),r.slice(n+1,e-1).replace(/""/g,'"')}for(;i<a;){if(10===(t=r.charCodeAt(e=i++)))f=!0;else if(13===t)f=!0,10===r.charCodeAt(i)&&++i;else if(t!==l)continue;return r.slice(n,e)}return c=!0,r.slice(n,a)}for(10===r.charCodeAt(a-1)&&--a,13===r.charCodeAt(a-1)&&--a;(t=u())!==hn;){for(var s=[];t!==dn&&t!==hn;)s.push(t),t=u();e&&null==(s=e(s,o++))||n.push(s)}return n}function r(e){return e.map(o).join(i)}function o(e){return null==e?"":t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,i){var o,c,t=n(e,function(e,t){if(o)return o(e,t-1);var n,r,a;c=e,o=i?(r=i,a=pn(n=e),function(e,t){return r(a(e),t,n)}):pn(e)});return t.columns=c||[],t},parseRows:n,format:function(e,n){var t,r,a;return null==n&&(t=e,r=Object.create(null),a=[],t.forEach(function(e){for(var t in e)t in r||a.push(r[t]=t)}),n=a),[n.map(o).join(i)].concat(e.map(function(t){return n.map(function(e){return o(t[e])}).join(i)})).join("\n")},formatRows:function(e){return e.map(r).join("\n")}}}bn(","),bn("\t");function gn(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var a,i,o,c,f,u,s,l,d,h=e._root,p={data:r},b=e._x0,g=e._y0,v=e._x1,m=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((u=t>=(i=(b+v)/2))?b=i:v=i,(s=n>=(o=(g+m)/2))?g=o:m=o,!(h=(a=h)[l=s<<1|u]))return a[l]=p,e;if(c=+e._x.call(null,h.data),f=+e._y.call(null,h.data),t===c&&n===f)return p.next=h,a?a[l]=p:e._root=p,e;for(;a=a?a[l]=new Array(4):e._root=new Array(4),(u=t>=(i=(b+v)/2))?b=i:v=i,(s=n>=(o=(g+m)/2))?g=o:m=o,(l=s<<1|u)==(d=(o<=f)<<1|i<=c););return a[d]=h,a[l]=p,e}function vn(e,t,n,r,a){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=a}function mn(e){return e[0]}function yn(e){return e[1]}function wn(e,t,n,r,a,i){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=a,this._y1=i,this._root=void 0}function _n(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var xn=function(e,t,n){var r=new wn(null==t?mn:t,null==n?yn:n,NaN,NaN,NaN,NaN);return null==e?r:r.addAll(e)}.prototype=wn.prototype;xn.copy=function(){var e,t,n=new wn(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=_n(r),n;for(e=[{source:r,target:n._root=new Array(4)}];r=e.pop();)for(var a=0;a<4;++a)(t=r.source[a])&&(t.length?e.push({source:t,target:r.target[a]=new Array(4)}):r.target[a]=_n(t));return n},xn.add=function(e){var t=+this._x.call(null,e),n=+this._y.call(null,e);return gn(this.cover(t,n),t,n,e)},xn.addAll=function(e){var t,n,r,a,i=e.length,o=new Array(i),c=new Array(i),f=1/0,u=1/0,s=-1/0,l=-1/0;for(n=0;n<i;++n)isNaN(r=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||((o[n]=r)<f&&(f=r),s<r&&(s=r),(c[n]=a)<u&&(u=a),l<a&&(l=a));for(s<f&&(f=this._x0,s=this._x1),l<u&&(u=this._y0,l=this._y1),this.cover(f,u).cover(s,l),n=0;n<i;++n)gn(this,o[n],c[n],e[n]);return this},xn.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,a=this._x1,i=this._y1;if(isNaN(n))a=(n=Math.floor(e))+1,i=(r=Math.floor(t))+1;else{if(!(e<n||a<e||t<r||i<t))return this;var o,c,f=a-n,u=this._root;switch(c=(t<(r+i)/2)<<1|e<(n+a)/2){case 0:for(;(o=new Array(4))[c]=u,u=o,i=r+(f*=2),(a=n+f)<e||i<t;);break;case 1:for(;(o=new Array(4))[c]=u,u=o,i=r+(f*=2),e<(n=a-f)||i<t;);break;case 2:for(;(o=new Array(4))[c]=u,u=o,r=i-(f*=2),(a=n+f)<e||t<r;);break;case 3:for(;(o=new Array(4))[c]=u,u=o,r=i-(f*=2),e<(n=a-f)||t<r;);}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._x1=a,this._y1=i,this},xn.data=function(){var t=[];return this.visit(function(e){if(!e.length)for(;t.push(e.data),e=e.next;);}),t},xn.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},xn.find=function(e,t,n){var r,a,i,o,c,f,u,s=this._x0,l=this._y0,d=this._x1,h=this._y1,p=[],b=this._root;for(b&&p.push(new vn(b,s,l,d,h)),null==n?n=1/0:(s=e-n,l=t-n,d=e+n,h=t+n,n*=n);f=p.pop();)if(!(!(b=f.node)||(a=f.x0)>d||(i=f.y0)>h||(o=f.x1)<s||(c=f.y1)<l))if(b.length){var g=(a+o)/2,v=(i+c)/2;p.push(new vn(b[3],g,v,o,c),new vn(b[2],a,v,g,c),new vn(b[1],g,i,o,v),new vn(b[0],a,i,g,v)),(u=(v<=t)<<1|g<=e)&&(f=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=f)}else{var m=e-+this._x.call(null,b.data),y=t-+this._y.call(null,b.data),w=m*m+y*y;if(w<n){var _=Math.sqrt(n=w);s=e-_,l=t-_,d=e+_,h=t+_,r=b.data}}return r},xn.remove=function(e){if(isNaN(i=+this._x.call(null,e))||isNaN(o=+this._y.call(null,e)))return this;var t,n,r,a,i,o,c,f,u,s,l,d,h=this._root,p=this._x0,b=this._y0,g=this._x1,v=this._y1;if(!h)return this;if(h.length)for(;;){if((u=i>=(c=(p+g)/2))?p=c:g=c,(s=o>=(f=(b+v)/2))?b=f:v=f,!(h=(t=h)[l=s<<1|u]))return this;if(!h.length)break;(t[l+1&3]||t[l+2&3]||t[l+3&3])&&(n=t,d=l)}for(;h.data!==e;)if(!(h=(r=h).next))return this;return(a=h.next)&&delete h.next,r?a?r.next=a:delete r.next:t?(a?t[l]=a:delete t[l],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[d]=h:this._root=h)):this._root=a,this},xn.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},xn.root=function(){return this._root},xn.size=function(){var t=0;return this.visit(function(e){if(!e.length)for(;++t,e=e.next;);}),t},xn.visit=function(e){var t,n,r,a,i,o,c=[],f=this._root;for(f&&c.push(new vn(f,this._x0,this._y0,this._x1,this._y1));t=c.pop();)if(!e(f=t.node,r=t.x0,a=t.y0,i=t.x1,o=t.y1)&&f.length){var u=(r+i)/2,s=(a+o)/2;(n=f[3])&&c.push(new vn(n,u,s,i,o)),(n=f[2])&&c.push(new vn(n,r,s,u,o)),(n=f[1])&&c.push(new vn(n,u,a,i,s)),(n=f[0])&&c.push(new vn(n,r,a,u,s))}return this},xn.visitAfter=function(e){var t,n=[],r=[];for(this._root&&n.push(new vn(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var a=t.node;if(a.length){var i,o=t.x0,c=t.y0,f=t.x1,u=t.y1,s=(o+f)/2,l=(c+u)/2;(i=a[0])&&n.push(new vn(i,o,c,s,l)),(i=a[1])&&n.push(new vn(i,s,c,f,l)),(i=a[2])&&n.push(new vn(i,o,l,s,u)),(i=a[3])&&n.push(new vn(i,s,l,f,u))}r.push(t)}for(;t=r.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},xn.x=function(e){return arguments.length?(this._x=e,this):this._x},xn.y=function(e){return arguments.length?(this._y=e,this):this._y};Math.PI,Math.sqrt(5);function Cn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[1<r.length?r[0]+r.slice(2):r,+e.slice(n+1)]}var An,Tn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Mn(e){return new Dn(e)}function Dn(e){if(!(t=Tn.exec(e)))throw new Error("invalid format: "+e);var t;this.fill=t[1]||" ",this.align=t[2]||">",this.sign=t[3]||"-",this.symbol=t[4]||"",this.zero=!!t[5],this.width=t[6]&&+t[6],this.comma=!!t[7],this.precision=t[8]&&+t[8].slice(1),this.trim=!!t[9],this.type=t[10]||""}function En(e,t){var n=Cn(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}Mn.prototype=Dn.prototype,Dn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var kn={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return En(100*e,t)},r:En,s:function(e,t){var n=Cn(e,t);if(!n)return e+"";var r=n[0],a=n[1],i=a-(An=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=r.length;return i===o?r:o<i?r+new Array(i-o+1).join("0"):0<i?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Cn(e,Math.max(0,t+i-1))[0]},X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}};function Fn(e){return e}var Sn,Nn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Un(e){var t,c,f,x=e.grouping&&e.thousands?(c=e.grouping,f=e.thousands,function(e,t){for(var n=e.length,r=[],a=0,i=c[0],o=0;0<n&&0<i&&(t<o+i+1&&(i=Math.max(1,t-o)),r.push(e.substring(n-=i,n+i)),!((o+=i+1)>t));)i=c[a=(a+1)%c.length];return r.reverse().join(f)}):Fn,r=e.currency,C=e.decimal,A=e.numerals?(t=e.numerals,function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}):Fn,a=e.percent||"%";function u(e){var u=(e=Mn(e)).fill,s=e.align,l=e.sign,t=e.symbol,d=e.zero,h=e.width,p=e.comma,b=e.precision,g=e.trim,v=e.type;"n"===v?(p=!0,v="g"):kn[v]||(null==b&&(b=12),g=!0,v="g"),(d||"0"===u&&"="===s)&&(d=!0,u="0",s="=");var m="$"===t?r[0]:"#"===t&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===t?r[1]:/[%p]/.test(v)?a:"",w=kn[v],_=/[defgprs%]/.test(v);function n(e){var t,n,r,a=m,i=y;if("c"===v)i=w(e)+i,e="";else{var o=(e=+e)<0;if(e=w(Math.abs(e),b),g&&(e=function(e){e:for(var t,n=e.length,r=1,a=-1;r<n;++r)switch(e[r]){case".":a=t=r;break;case"0":0===a&&(a=r),t=r;break;default:if(0<a){if(!+e[r])break e;a=0}}return 0<a?e.slice(0,a)+e.slice(t+1):e}(e)),o&&0==+e&&(o=!1),a=(o?"("===l?l:"-":"-"===l||"("===l?"":l)+a,i=("s"===v?Nn[8+An/3]:"")+i+(o&&"("===l?")":""),_)for(t=-1,n=e.length;++t<n;)if((r=e.charCodeAt(t))<48||57<r){i=(46===r?C+e.slice(t+1):e.slice(t))+i,e=e.slice(0,t);break}}p&&!d&&(e=x(e,1/0));var c=a.length+e.length+i.length,f=c<h?new Array(h-c+1).join(u):"";switch(p&&d&&(e=x(f+e,f.length?h-i.length:1/0),f=""),s){case"<":e=a+e+i+f;break;case"=":e=a+f+e+i;break;case"^":e=f.slice(0,c=f.length>>1)+a+e+i+f.slice(c);break;default:e=f+a+e+i}return A(e)}return b=null==b?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),n.toString=function(){return e+""},n}return{format:u,formatPrefix:function(e,t){var n,r=u(((e=Mn(e)).type="f",e)),a=3*Math.max(-8,Math.min(8,Math.floor((n=t,((n=Cn(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-a),o=Nn[8+a/3];return function(e){return r(i*e)+o}}}}function Ln(e,t){return e<t?-1:t<e?1:t<=e?0:NaN}Sn=Un({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),Sn.format,Sn.formatPrefix;var Bn,Hn,On;1===(Bn=Ln).length&&(Hn=Bn,Bn=function(e,t){return Ln(Hn(e),t)}),Math.PI,Math.SQRT2;function Pn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[1<r.length?r[0]+r.slice(2):r,+e.slice(n+1)]}function jn(e,t){var n=Pn(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}var Yn={"":function(e,t){e:for(var n,r=(e=e.toPrecision(t)).length,a=1,i=-1;a<r;++a)switch(e[a]){case".":i=n=a;break;case"0":0===i&&(i=a),n=a;break;case"e":break e;default:0<i&&(i=0)}return 0<i?e.slice(0,i)+e.slice(n+1):e},"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return jn(100*e,t)},r:jn,s:function(e,t){var n=Pn(e,t);if(!n)return e+"";var r=n[0],a=n[1],i=a-(On=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=r.length;return i===o?r:o<i?r+new Array(i-o+1).join("0"):0<i?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Pn(e,Math.max(0,t+i-1))[0]},X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}},qn=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;function In(e){return new zn(e)}function zn(e){if(!(t=qn.exec(e)))throw new Error("invalid format: "+e);var t,n=t[1]||" ",r=t[2]||">",a=t[3]||"-",i=t[4]||"",o=!!t[5],c=t[6]&&+t[6],f=!!t[7],u=t[8]&&+t[8].slice(1),s=t[9]||"";"n"===s?(f=!0,s="g"):Yn[s]||(s=""),(o||"0"===n&&"="===r)&&(o=!0,n="0",r="="),this.fill=n,this.align=r,this.sign=a,this.symbol=i,this.zero=o,this.width=c,this.comma=f,this.precision=u,this.type=s}function Rn(e){return e}In.prototype=zn.prototype,zn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var Wn,Xn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Vn(e){var t,c,f,_=e.grouping&&e.thousands?(c=e.grouping,f=e.thousands,function(e,t){for(var n=e.length,r=[],a=0,i=c[0],o=0;0<n&&0<i&&(t<o+i+1&&(i=Math.max(1,t-o)),r.push(e.substring(n-=i,n+i)),!((o+=i+1)>t));)i=c[a=(a+1)%c.length];return r.reverse().join(f)}):Rn,r=e.currency,x=e.decimal,C=e.numerals?(t=e.numerals,function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}):Rn,a=e.percent||"%";function u(e){var u=(e=In(e)).fill,s=e.align,l=e.sign,t=e.symbol,d=e.zero,h=e.width,p=e.comma,b=e.precision,g=e.type,v="$"===t?r[0]:"#"===t&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",m="$"===t?r[1]:/[%p]/.test(g)?a:"",y=Yn[g],w=!g||/[defgprs%]/.test(g);function n(e){var t,n,r,a=v,i=m;if("c"===g)i=y(e)+i,e="";else{var o=(e=+e)<0;if(e=y(Math.abs(e),b),o&&0==+e&&(o=!1),a=(o?"("===l?l:"-":"-"===l||"("===l?"":l)+a,i=i+("s"===g?Xn[8+On/3]:"")+(o&&"("===l?")":""),w)for(t=-1,n=e.length;++t<n;)if((r=e.charCodeAt(t))<48||57<r){i=(46===r?x+e.slice(t+1):e.slice(t))+i,e=e.slice(0,t);break}}p&&!d&&(e=_(e,1/0));var c=a.length+e.length+i.length,f=c<h?new Array(h-c+1).join(u):"";switch(p&&d&&(e=_(f+e,f.length?h-i.length:1/0),f=""),s){case"<":e=a+e+i+f;break;case"=":e=a+f+e+i;break;case"^":e=f.slice(0,c=f.length>>1)+a+e+i+f.slice(c);break;default:e=f+a+e+i}return C(e)}return b=null==b?g?6:12:/[gprs]/.test(g)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),n.toString=function(){return e+""},n}return{format:u,formatPrefix:function(e,t){var n,r=u(((e=In(e)).type="f",e)),a=3*Math.max(-8,Math.min(8,Math.floor((n=t,((n=Pn(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-a),o=Xn[8+a/3];return function(e){return r(i*e)+o}}}}Wn=Vn({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),Wn.format,Wn.formatPrefix;var $n=new Date,Zn=new Date;function Jn(a,i,n,r){function o(e){return a(e=new Date(+e)),e}return(o.floor=o).ceil=function(e){return a(e=new Date(e-1)),i(e,1),a(e),e},o.round=function(e){var t=o(e),n=o.ceil(e);return e-t<n-e?t:n},o.offset=function(e,t){return i(e=new Date(+e),null==t?1:Math.floor(t)),e},o.range=function(e,t,n){var r=[];if(e=o.ceil(e),n=null==n?1:Math.floor(n),!(e<t&&0<n))return r;for(;r.push(new Date(+e)),i(e,n),a(e),e<t;);return r},o.filter=function(n){return Jn(function(e){if(e<=e)for(;a(e),!n(e);)e.setTime(e-1)},function(e,t){if(e<=e)if(t<0)for(;++t<=0;)for(;i(e,-1),!n(e););else for(;0<=--t;)for(;i(e,1),!n(e););})},n&&(o.count=function(e,t){return $n.setTime(+e),Zn.setTime(+t),a($n),a(Zn),Math.floor(n($n,Zn))},o.every=function(t){return t=Math.floor(t),isFinite(t)&&0<t?1<t?o.filter(r?function(e){return r(e)%t==0}:function(e){return o.count(0,e)%t==0}):o:null}),o}var Gn=Jn(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});Gn.every=function(n){return n=Math.floor(n),isFinite(n)&&0<n?1<n?Jn(function(e){e.setTime(Math.floor(e/n)*n)},function(e,t){e.setTime(+e+t*n)},function(e,t){return(t-e)/n}):Gn:null};var Qn=6e4,Kn=36e5,er=(Jn(function(e){e.setTime(1e3*Math.floor(e/1e3))},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3},function(e){return e.getUTCSeconds()}),Jn(function(e){e.setTime(Math.floor(e/Qn)*Qn)},function(e,t){e.setTime(+e+t*Qn)},function(e,t){return(t-e)/Qn},function(e){return e.getMinutes()}),Jn(function(e){var t=e.getTimezoneOffset()*Qn%Kn;t<0&&(t+=Kn),e.setTime(Math.floor((+e-t)/Kn)*Kn+t)},function(e,t){e.setTime(+e+t*Kn)},function(e,t){return(t-e)/Kn},function(e){return e.getHours()}),Jn(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Qn)/864e5},function(e){return e.getDate()-1}));function tr(t){return Jn(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Qn)/6048e5})}var nr=tr(0),rr=tr(1),ar=(tr(2),tr(3),tr(4)),ir=(tr(5),tr(6),Jn(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),Jn(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}));ir.every=function(n){return isFinite(n=Math.floor(n))&&0<n?Jn(function(e){e.setFullYear(Math.floor(e.getFullYear()/n)*n),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t*n)}):null};Jn(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*Qn)},function(e,t){return(t-e)/Qn},function(e){return e.getUTCMinutes()}),Jn(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*Kn)},function(e,t){return(t-e)/Kn},function(e){return e.getUTCHours()});var or=Jn(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1});function cr(t){return Jn(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}var fr=cr(0),ur=cr(1),sr=(cr(2),cr(3),cr(4)),lr=(cr(5),cr(6),Jn(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()}),Jn(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()}));function dr(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function hr(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function pr(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}lr.every=function(n){return isFinite(n=Math.floor(n))&&0<n?Jn(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/n)*n),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t*n)}):null};var br,gr,vr,mr={"-":"",_:" ",0:"0"},yr=/^\s*\d+/,wr=/^%/,_r=/[\\^$*+?|[\]().{}]/g;function xr(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i<n?new Array(n-i+1).join(t)+a:a)}function Cr(e){return e.replace(_r,"\\$&")}function Ar(e){return new RegExp("^(?:"+e.map(Cr).join("|")+")","i")}function Tr(e){for(var t={},n=-1,r=e.length;++n<r;)t[e[n].toLowerCase()]=n;return t}function Mr(e,t,n){var r=yr.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Dr(e,t,n){var r=yr.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Er(e,t,n){var r=yr.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function kr(e,t,n){var r=yr.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Fr(e,t,n){var r=yr.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Sr(e,t,n){var r=yr.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Nr(e,t,n){var r=yr.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(68<+r[0]?1900:2e3),n+r[0].length):-1}function Ur(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Lr(e,t,n){var r=yr.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Br(e,t,n){var r=yr.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Hr(e,t,n){var r=yr.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Or(e,t,n){var r=yr.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Pr(e,t,n){var r=yr.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function jr(e,t,n){var r=yr.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Yr(e,t,n){var r=yr.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function qr(e,t,n){var r=yr.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Ir(e,t,n){var r=wr.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function zr(e,t,n){var r=yr.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Rr(e,t,n){var r=yr.exec(t.slice(n));return r?(e.Q=1e3*+r[0],n+r[0].length):-1}function Wr(e,t){return xr(e.getDate(),t,2)}function Xr(e,t){return xr(e.getHours(),t,2)}function Vr(e,t){return xr(e.getHours()%12||12,t,2)}function $r(e,t){return xr(1+er.count(ir(e),e),t,3)}function Zr(e,t){return xr(e.getMilliseconds(),t,3)}function Jr(e,t){return Zr(e,t)+"000"}function Gr(e,t){return xr(e.getMonth()+1,t,2)}function Qr(e,t){return xr(e.getMinutes(),t,2)}function Kr(e,t){return xr(e.getSeconds(),t,2)}function ea(e){var t=e.getDay();return 0===t?7:t}function ta(e,t){return xr(nr.count(ir(e),e),t,2)}function na(e,t){var n=e.getDay();return e=4<=n||0===n?ar(e):ar.ceil(e),xr(ar.count(ir(e),e)+(4===ir(e).getDay()),t,2)}function ra(e){return e.getDay()}function aa(e,t){return xr(rr.count(ir(e),e),t,2)}function ia(e,t){return xr(e.getFullYear()%100,t,2)}function oa(e,t){return xr(e.getFullYear()%1e4,t,4)}function ca(e){var t=e.getTimezoneOffset();return(0<t?"-":(t*=-1,"+"))+xr(t/60|0,"0",2)+xr(t%60,"0",2)}function fa(e,t){return xr(e.getUTCDate(),t,2)}function ua(e,t){return xr(e.getUTCHours(),t,2)}function sa(e,t){return xr(e.getUTCHours()%12||12,t,2)}function la(e,t){return xr(1+or.count(lr(e),e),t,3)}function da(e,t){return xr(e.getUTCMilliseconds(),t,3)}function ha(e,t){return da(e,t)+"000"}function pa(e,t){return xr(e.getUTCMonth()+1,t,2)}function ba(e,t){return xr(e.getUTCMinutes(),t,2)}function ga(e,t){return xr(e.getUTCSeconds(),t,2)}function va(e){var t=e.getUTCDay();return 0===t?7:t}function ma(e,t){return xr(fr.count(lr(e),e),t,2)}function ya(e,t){var n=e.getUTCDay();return e=4<=n||0===n?sr(e):sr.ceil(e),xr(sr.count(lr(e),e)+(4===lr(e).getUTCDay()),t,2)}function wa(e){return e.getUTCDay()}function _a(e,t){return xr(ur.count(lr(e),e),t,2)}function xa(e,t){return xr(e.getUTCFullYear()%100,t,2)}function Ca(e,t){return xr(e.getUTCFullYear()%1e4,t,4)}function Aa(){return"+0000"}function Ta(){return"%"}function Ma(e){return+e}function Da(e){return Math.floor(+e/1e3)}br=function(e){var r=e.dateTime,a=e.date,i=e.time,t=e.periods,n=e.days,o=e.shortDays,c=e.months,f=e.shortMonths,u=Ar(t),s=Tr(t),l=Ar(n),d=Tr(n),h=Ar(o),p=Tr(o),b=Ar(c),g=Tr(c),v=Ar(f),m=Tr(f),y={a:function(e){return o[e.getDay()]},A:function(e){return n[e.getDay()]},b:function(e){return f[e.getMonth()]},B:function(e){return c[e.getMonth()]},c:null,d:Wr,e:Wr,f:Jr,H:Xr,I:Vr,j:$r,L:Zr,m:Gr,M:Qr,p:function(e){return t[+(12<=e.getHours())]},Q:Ma,s:Da,S:Kr,u:ea,U:ta,V:na,w:ra,W:aa,x:null,X:null,y:ia,Y:oa,Z:ca,"%":Ta},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return n[e.getUTCDay()]},b:function(e){return f[e.getUTCMonth()]},B:function(e){return c[e.getUTCMonth()]},c:null,d:fa,e:fa,f:ha,H:ua,I:sa,j:la,L:da,m:pa,M:ba,p:function(e){return t[+(12<=e.getUTCHours())]},Q:Ma,s:Da,S:ga,u:va,U:ma,V:ya,w:wa,W:_a,x:null,X:null,y:xa,Y:Ca,Z:Aa,"%":Ta},_={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=l.exec(t.slice(n));return r?(e.w=d[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=v.exec(t.slice(n));return r?(e.m=m[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=b.exec(t.slice(n));return r?(e.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,t,n){return A(e,r,t,n)},d:Br,e:Br,f:qr,H:Or,I:Or,j:Hr,L:Yr,m:Lr,M:Pr,p:function(e,t,n){var r=u.exec(t.slice(n));return r?(e.p=s[r[0].toLowerCase()],n+r[0].length):-1},Q:zr,s:Rr,S:jr,u:Dr,U:Er,V:kr,w:Mr,W:Fr,x:function(e,t,n){return A(e,a,t,n)},X:function(e,t,n){return A(e,i,t,n)},y:Nr,Y:Sr,Z:Ur,"%":Ir};function x(f,u){return function(e){var t,n,r,a=[],i=-1,o=0,c=f.length;for(e instanceof Date||(e=new Date(+e));++i<c;)37===f.charCodeAt(i)&&(a.push(f.slice(o,i)),null!=(n=mr[t=f.charAt(++i)])?t=f.charAt(++i):n="e"===t?" ":"0",(r=u[t])&&(t=r(e,n)),a.push(t),o=i+1);return a.push(f.slice(o,i)),a.join("")}}function C(a,i){return function(e){var t,n,r=pr(1900);if(A(r,a,e+="",0)!=e.length)return null;if("Q"in r)return new Date(r.Q);if("p"in r&&(r.H=r.H%12+12*r.p),"V"in r){if(r.V<1||53<r.V)return null;"w"in r||(r.w=1),r.d="Z"in r?(t=4<(n=(t=hr(pr(r.y))).getUTCDay())||0===n?ur.ceil(t):ur(t),t=or.offset(t,7*(r.V-1)),r.y=t.getUTCFullYear(),r.m=t.getUTCMonth(),t.getUTCDate()+(r.w+6)%7):(t=4<(n=(t=i(pr(r.y))).getDay())||0===n?rr.ceil(t):rr(t),t=er.offset(t,7*(r.V-1)),r.y=t.getFullYear(),r.m=t.getMonth(),t.getDate()+(r.w+6)%7)}else("W"in r||"U"in r)&&("w"in r||(r.w="u"in r?r.u%7:"W"in r?1:0),n="Z"in r?hr(pr(r.y)).getUTCDay():i(pr(r.y)).getDay(),r.m=0,r.d="W"in r?(r.w+6)%7+7*r.W-(n+5)%7:r.w+7*r.U-(n+6)%7);return"Z"in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,hr(r)):i(r)}}function A(e,t,n,r){for(var a,i,o=0,c=t.length,f=n.length;o<c;){if(f<=r)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=_[a in mr?t.charAt(o++):a])||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}return y.x=x(a,y),y.X=x(i,y),y.c=x(r,y),w.x=x(a,w),w.X=x(i,w),w.c=x(r,w),{format:function(e){var t=x(e+="",y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+="",dr);return t.toString=function(){return e},t},utcFormat:function(e){var t=x(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e,hr);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),br.format,br.parse,gr=br.utcFormat,vr=br.utcParse;var Ea="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString||gr(Ea);+new Date("2000-01-01T00:00:00.000Z")||vr(Ea);function ka(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(6*r,6*++r);return n}ka("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var Fa=ka("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Sa=ka("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Na=ka("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Ua=ka("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");function La(e){return rt(e[e.length-1])}ka("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),ka("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),ka("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),ka("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),La(new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(ka)),La(new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(ka)),La(new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(ka)),La(new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(ka)),La(new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(ka)),La(new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(ka)),La(new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(ka)),La(new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(ka)),La(new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(ka)),La(new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(ka)),La(new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(ka)),La(new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(ka)),La(new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(ka)),La(new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(ka)),La(new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(ka)),La(new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(ka)),La(new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(ka)),La(new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(ka)),La(new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(ka)),La(new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(ka)),La(new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(ka)),La(new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(ka)),La(new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(ka)),La(new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(ka)),La(new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(ka)),La(new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(ka)),La(new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(ka)),wt(Ze(300,.5,0),Ze(-240,.5,1));wt(Ze(-100,.75,.35),Ze(80,1.5,.8)),wt(Ze(260,.75,.35),Ze(80,1.5,.8)),Ze();function Ba(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}Ba(ka("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));Ba(ka("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Ba(ka("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Ba(ka("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),Math.PI;function Ha(e){return e<0?-1:1}function Oa(e,t,n){var r=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(r||a<0&&-0),o=(n-e._y1)/(a||r<0&&-0),c=(i*a+o*r)/(r+a);return(Ha(i)+Ha(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(c))||0}function Pa(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ja(e,t,n){var r=e._x0,a=e._y0,i=e._x1,o=e._y1,c=(i-r)/3;e._context.bezierCurveTo(r+c,a+c*t,i-c,o-c*n,i,o)}function Ya(e){this._context=e}function qa(e){this._context=e}Ya.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ja(this,this._t0,Pa(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ja(this,Pa(this,n=Oa(this,e,t)),n);break;default:ja(this,this._t0,n=Oa(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(function(e){this._context=new qa(e)}.prototype=Object.create(Ya.prototype)).point=function(e,t){Ya.prototype.point.call(this,t,e)},qa.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,a,i){this._context.bezierCurveTo(t,e,r,n,i,a)}};var Ia=new Date,za=new Date;function Ra(i,o,n,r){function c(e){return i(e=new Date(+e)),e}return(c.floor=c).ceil=function(e){return i(e=new Date(e-1)),o(e,1),i(e),e},c.round=function(e){var t=c(e),n=c.ceil(e);return e-t<n-e?t:n},c.offset=function(e,t){return o(e=new Date(+e),null==t?1:Math.floor(t)),e},c.range=function(e,t,n){var r,a=[];if(e=c.ceil(e),n=null==n?1:Math.floor(n),!(e<t&&0<n))return a;for(;a.push(r=new Date(+e)),o(e,n),i(e),r<e&&e<t;);return a},c.filter=function(n){return Ra(function(e){if(e<=e)for(;i(e),!n(e);)e.setTime(e-1)},function(e,t){if(e<=e)if(t<0)for(;++t<=0;)for(;o(e,-1),!n(e););else for(;0<=--t;)for(;o(e,1),!n(e););})},n&&(c.count=function(e,t){return Ia.setTime(+e),za.setTime(+t),i(Ia),i(za),Math.floor(n(Ia,za))},c.every=function(t){return t=Math.floor(t),isFinite(t)&&0<t?1<t?c.filter(r?function(e){return r(e)%t==0}:function(e){return c.count(0,e)%t==0}):c:null}),c}var Wa=Ra(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});Wa.every=function(n){return n=Math.floor(n),isFinite(n)&&0<n?1<n?Ra(function(e){e.setTime(Math.floor(e/n)*n)},function(e,t){e.setTime(+e+t*n)},function(e,t){return(t-e)/n}):Wa:null};var Xa=6e4,Va=36e5,$a=(Ra(function(e){e.setTime(1e3*Math.floor(e/1e3))},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3},function(e){return e.getUTCSeconds()}),Ra(function(e){e.setTime(Math.floor(e/Xa)*Xa)},function(e,t){e.setTime(+e+t*Xa)},function(e,t){return(t-e)/Xa},function(e){return e.getMinutes()}),Ra(function(e){var t=e.getTimezoneOffset()*Xa%Va;t<0&&(t+=Va),e.setTime(Math.floor((+e-t)/Va)*Va+t)},function(e,t){e.setTime(+e+t*Va)},function(e,t){return(t-e)/Va},function(e){return e.getHours()}),Ra(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Xa)/864e5},function(e){return e.getDate()-1}));function Za(t){return Ra(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Xa)/6048e5})}var Ja=Za(0),Ga=Za(1),Qa=(Za(2),Za(3),Za(4)),Ka=(Za(5),Za(6),Ra(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),Ra(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}));Ka.every=function(n){return isFinite(n=Math.floor(n))&&0<n?Ra(function(e){e.setFullYear(Math.floor(e.getFullYear()/n)*n),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t*n)}):null};Ra(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*Xa)},function(e,t){return(t-e)/Xa},function(e){return e.getUTCMinutes()}),Ra(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*Va)},function(e,t){return(t-e)/Va},function(e){return e.getUTCHours()});var ei=Ra(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1});function ti(t){return Ra(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}var ni=ti(0),ri=ti(1),ai=(ti(2),ti(3),ti(4)),ii=(ti(5),ti(6),Ra(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()}),Ra(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()}));function oi(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function ci(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function fi(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}ii.every=function(n){return isFinite(n=Math.floor(n))&&0<n?Ra(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/n)*n),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t*n)}):null};var ui,si,li,di={"-":"",_:" ",0:"0"},hi=/^\s*\d+/,pi=/^%/,bi=/[\\^$*+?|[\]().{}]/g;function gi(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i<n?new Array(n-i+1).join(t)+a:a)}function vi(e){return e.replace(bi,"\\$&")}function mi(e){return new RegExp("^(?:"+e.map(vi).join("|")+")","i")}function yi(e){for(var t={},n=-1,r=e.length;++n<r;)t[e[n].toLowerCase()]=n;return t}function wi(e,t,n){var r=hi.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function _i(e,t,n){var r=hi.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function xi(e,t,n){var r=hi.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Ci(e,t,n){var r=hi.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Ai(e,t,n){var r=hi.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Ti(e,t,n){var r=hi.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Mi(e,t,n){var r=hi.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(68<+r[0]?1900:2e3),n+r[0].length):-1}function Di(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Ei(e,t,n){var r=hi.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function ki(e,t,n){var r=hi.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Fi(e,t,n){var r=hi.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Si(e,t,n){var r=hi.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Ni(e,t,n){var r=hi.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Ui(e,t,n){var r=hi.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Li(e,t,n){var r=hi.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Bi(e,t,n){var r=hi.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Hi(e,t,n){var r=pi.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Oi(e,t,n){var r=hi.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Pi(e,t,n){var r=hi.exec(t.slice(n));return r?(e.Q=1e3*+r[0],n+r[0].length):-1}function ji(e,t){return gi(e.getDate(),t,2)}function Yi(e,t){return gi(e.getHours(),t,2)}function qi(e,t){return gi(e.getHours()%12||12,t,2)}function Ii(e,t){return gi(1+$a.count(Ka(e),e),t,3)}function zi(e,t){return gi(e.getMilliseconds(),t,3)}function Ri(e,t){return zi(e,t)+"000"}function Wi(e,t){return gi(e.getMonth()+1,t,2)}function Xi(e,t){return gi(e.getMinutes(),t,2)}function Vi(e,t){return gi(e.getSeconds(),t,2)}function $i(e){var t=e.getDay();return 0===t?7:t}function Zi(e,t){return gi(Ja.count(Ka(e),e),t,2)}function Ji(e,t){var n=e.getDay();return e=4<=n||0===n?Qa(e):Qa.ceil(e),gi(Qa.count(Ka(e),e)+(4===Ka(e).getDay()),t,2)}function Gi(e){return e.getDay()}function Qi(e,t){return gi(Ga.count(Ka(e),e),t,2)}function Ki(e,t){return gi(e.getFullYear()%100,t,2)}function eo(e,t){return gi(e.getFullYear()%1e4,t,4)}function to(e){var t=e.getTimezoneOffset();return(0<t?"-":(t*=-1,"+"))+gi(t/60|0,"0",2)+gi(t%60,"0",2)}function no(e,t){return gi(e.getUTCDate(),t,2)}function ro(e,t){return gi(e.getUTCHours(),t,2)}function ao(e,t){return gi(e.getUTCHours()%12||12,t,2)}function io(e,t){return gi(1+ei.count(ii(e),e),t,3)}function oo(e,t){return gi(e.getUTCMilliseconds(),t,3)}function co(e,t){return oo(e,t)+"000"}function fo(e,t){return gi(e.getUTCMonth()+1,t,2)}function uo(e,t){return gi(e.getUTCMinutes(),t,2)}function so(e,t){return gi(e.getUTCSeconds(),t,2)}function lo(e){var t=e.getUTCDay();return 0===t?7:t}function ho(e,t){return gi(ni.count(ii(e),e),t,2)}function po(e,t){var n=e.getUTCDay();return e=4<=n||0===n?ai(e):ai.ceil(e),gi(ai.count(ii(e),e)+(4===ii(e).getUTCDay()),t,2)}function bo(e){return e.getUTCDay()}function go(e,t){return gi(ri.count(ii(e),e),t,2)}function vo(e,t){return gi(e.getUTCFullYear()%100,t,2)}function mo(e,t){return gi(e.getUTCFullYear()%1e4,t,4)}function yo(){return"+0000"}function wo(){return"%"}function _o(e){return+e}function xo(e){return Math.floor(+e/1e3)}ui=function(e){var r=e.dateTime,a=e.date,i=e.time,t=e.periods,n=e.days,o=e.shortDays,c=e.months,f=e.shortMonths,u=mi(t),s=yi(t),l=mi(n),d=yi(n),h=mi(o),p=yi(o),b=mi(c),g=yi(c),v=mi(f),m=yi(f),y={a:function(e){return o[e.getDay()]},A:function(e){return n[e.getDay()]},b:function(e){return f[e.getMonth()]},B:function(e){return c[e.getMonth()]},c:null,d:ji,e:ji,f:Ri,H:Yi,I:qi,j:Ii,L:zi,m:Wi,M:Xi,p:function(e){return t[+(12<=e.getHours())]},Q:_o,s:xo,S:Vi,u:$i,U:Zi,V:Ji,w:Gi,W:Qi,x:null,X:null,y:Ki,Y:eo,Z:to,"%":wo},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return n[e.getUTCDay()]},b:function(e){return f[e.getUTCMonth()]},B:function(e){return c[e.getUTCMonth()]},c:null,d:no,e:no,f:co,H:ro,I:ao,j:io,L:oo,m:fo,M:uo,p:function(e){return t[+(12<=e.getUTCHours())]},Q:_o,s:xo,S:so,u:lo,U:ho,V:po,w:bo,W:go,x:null,X:null,y:vo,Y:mo,Z:yo,"%":wo},_={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=l.exec(t.slice(n));return r?(e.w=d[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=v.exec(t.slice(n));return r?(e.m=m[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=b.exec(t.slice(n));return r?(e.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,t,n){return A(e,r,t,n)},d:ki,e:ki,f:Bi,H:Si,I:Si,j:Fi,L:Li,m:Ei,M:Ni,p:function(e,t,n){var r=u.exec(t.slice(n));return r?(e.p=s[r[0].toLowerCase()],n+r[0].length):-1},Q:Oi,s:Pi,S:Ui,u:_i,U:xi,V:Ci,w:wi,W:Ai,x:function(e,t,n){return A(e,a,t,n)},X:function(e,t,n){return A(e,i,t,n)},y:Mi,Y:Ti,Z:Di,"%":Hi};function x(f,u){return function(e){var t,n,r,a=[],i=-1,o=0,c=f.length;for(e instanceof Date||(e=new Date(+e));++i<c;)37===f.charCodeAt(i)&&(a.push(f.slice(o,i)),null!=(n=di[t=f.charAt(++i)])?t=f.charAt(++i):n="e"===t?" ":"0",(r=u[t])&&(t=r(e,n)),a.push(t),o=i+1);return a.push(f.slice(o,i)),a.join("")}}function C(a,i){return function(e){var t,n,r=fi(1900);if(A(r,a,e+="",0)!=e.length)return null;if("Q"in r)return new Date(r.Q);if("p"in r&&(r.H=r.H%12+12*r.p),"V"in r){if(r.V<1||53<r.V)return null;"w"in r||(r.w=1),r.d="Z"in r?(t=4<(n=(t=ci(fi(r.y))).getUTCDay())||0===n?ri.ceil(t):ri(t),t=ei.offset(t,7*(r.V-1)),r.y=t.getUTCFullYear(),r.m=t.getUTCMonth(),t.getUTCDate()+(r.w+6)%7):(t=4<(n=(t=i(fi(r.y))).getDay())||0===n?Ga.ceil(t):Ga(t),t=$a.offset(t,7*(r.V-1)),r.y=t.getFullYear(),r.m=t.getMonth(),t.getDate()+(r.w+6)%7)}else("W"in r||"U"in r)&&("w"in r||(r.w="u"in r?r.u%7:"W"in r?1:0),n="Z"in r?ci(fi(r.y)).getUTCDay():i(fi(r.y)).getDay(),r.m=0,r.d="W"in r?(r.w+6)%7+7*r.W-(n+5)%7:r.w+7*r.U-(n+6)%7);return"Z"in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,ci(r)):i(r)}}function A(e,t,n,r){for(var a,i,o=0,c=t.length,f=n.length;o<c;){if(f<=r)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=_[a in di?t.charAt(o++):a])||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}return y.x=x(a,y),y.X=x(i,y),y.c=x(r,y),w.x=x(a,w),w.X=x(i,w),w.c=x(r,w),{format:function(e){var t=x(e+="",y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+="",oi);return t.toString=function(){return e},t},utcFormat:function(e){var t=x(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e,ci);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),ui.format,ui.parse,si=ui.utcFormat,li=ui.utcParse;var Co="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString||si(Co);var Ao,To,Mo,Do,Eo;+new Date("2000-01-01T00:00:00.000Z")||li(Co);function ko(){if(!Mo)return null;var e=Mo.nodes()[1].value;if("custom"!==Do||""==e)return null;var t=parseInt(e,10);return isNaN(t)?null:t}function Fo(){Eo&&Eo.preview_pane&&Eo.preview_pane.setFixedHeight&&Eo.preview_pane.setFixedHeight(ko())}function So(e){Do=e,Fo(),"custom"===e?(Q("#editor-custom-inputs").style("opacity",1),Q(".preview-holder").style("width",Mo.nodes()[0].value+"px").select("iframe").style("width",Mo.nodes()[0].value+"px")):(Q("#editor-custom-inputs").style("opacity",0),Q(".preview-holder").attr("style",null).select("iframe").style("width",null)),K("#preview-menu .preview-mode").classed("selected",function(){return this.id=="editor-"+e}),Q("#editor-rotate").classed("active",function(){return"auto"!==e}),Q(".row.editor").classed("mobile",function(){return"mobile"==e}),Q(".row.editor").classed("tablet",function(){return"tablet"==e}),Q(".preview-holder").on("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd transitionend",Uo),Ao=e}function No(e){return Eo=e,Mo=K("#editor-custom-inputs input"),Uo(),K("#preview-menu .preview-mode").on("click",function(){So(this.getAttribute("data-target"))}),Mo.on("change",function(){So(this.getAttribute("data-target"))}),So("auto"),function(){var r,a,t=document.querySelector("#resize-handle"),i=document.querySelector(".preview-holder");function n(e){var t=e.clientX-a,n=r+2*t;i.style.width=n+"px",i.querySelector("iframe").style.width=n-4+"px",Uo(),Eo.preview_pane.resize()}function o(){r=i.getBoundingClientRect().width,Q(".preview-holder").style("transition",null),t.parentElement.parentElement.querySelector("#resize-overlay").classList.remove("dragging"),t.parentElement.classList.remove("dragging"),Uo(),Eo.preview_pane.resize(),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",o)}t.addEventListener("mousedown",function(e){if("editor-custom"===e.target.parentElement.id)return;r=i.getBoundingClientRect().width,t.parentElement.parentElement.querySelector("#resize-overlay").classList.add("dragging"),t.parentElement.classList.add("dragging"),a=e.clientX,Q(".preview-holder").style("transition","none"),So("custom"),document.addEventListener("mousemove",n),document.addEventListener("mouseup",o),e.preventDefault()})}(),window.innerWidth<=768&&(To="auto"),window.addEventListener("resize",function(){Ao&&Uo(),window.innerWidth<=768?To||(To=Ao,So("auto")):To&&(So(To),To=null),Eo.preview_pane.resize()}),{getHeightSetting:ko}}function Uo(){var e=Q(".preview-holder").node().getBoundingClientRect();Mo.nodes()[0].value=Math.round(e.width),""!==Mo.nodes()[1].value&&"custom"===Do&&(Mo.nodes()[1].value=Math.round(e.height))}var Lo=0,Bo=25,Ho=["bottom","top","left","right","topLeft","bottomLeft","topRight","bottomRight","bottomFlexible","topFlexible","leftFlexible","rightFlexible"];function Oo(){this.unique_id=Lo++,this._container=document.body,this._maxWidth="70%",this._point=null,this._html=null,this._directions=Ho,this._fallbackFit="horizontal",this.handlers={click:[]}}function Po(e,t){0<t.length&&"_"==t.charAt(0)&&(e[t.substr(1)]=function(e){return void 0===e?this[t]:(this[t]=e,this)})}for(var jo in new Oo("*"))Po(Oo.prototype,jo);function Yo(e,t,n){var r,a=document.createElementNS("http://www.w3.org/2000/svg",e);if(t)for(r in t)a.setAttribute(r,t[r]);var i=a.style;if(n)for(r in n)i[r]=n[r];return a}Oo.prototype.point=function(e,t){if(void 0===e)return this._point;if(void 0!==t)this._point=[e,t];else if(e instanceof HTMLElement||e instanceof SVGElement){var n=e.getBoundingClientRect();this._point=[Math.floor(n.left+n.width/2),Math.floor(n.top+n.height/2)]}else console.error("Popup: could not understand argument");return this},Oo.prototype.text=function(e){return this._html=e.replace(/[&<>]/g,function(e){return{"&":"&amp;","<":"&lt;",">":"&gt;"}[e]}),this},Oo.prototype.on=function(e,t){if(!(e in this.handlers))throw new Error("Popup.on: No such event: "+e);return this.handlers[e].push(t),this},Oo.prototype.fire=function(e,t){if(!(e in this.handlers))throw new Error("Popup.fire: No such event: "+e);for(var n=this.handlers[e],r=0;r<n.length;r++)n[r].call(this,t);return this},Oo.prototype._getElement=function(){var t=this,e="flourish-popup-"+this.unique_id,n=document.getElementById(e);if(!n){(n=document.createElement("div")).className="flourish-popup",n.id=e;var r=n.style;r.display="none",r.margin=r.padding=0,r.position="absolute",r.width="80px",r.height="40px",r.boxSizing="border-box",n.addEventListener("click",function(e){t.fire("click",e)},!1);var a=Yo("svg",{class:"flourish-popup-svg"},{position:"absolute",top:0,left:0,bottom:0,right:0}),i=Yo("filter",{id:"dropshadow-"+this.unique_id,height:"130%"});i.appendChild(Yo("feGaussianBlur",{in:"SourceAlpha",stdDeviation:5})),i.appendChild(Yo("feOffset",{dx:0,dy:2,result:"offsetblur"}));var o=Yo("feComponentTransfer");o.appendChild(Yo("feFuncA",{type:"linear",slope:.2})),i.appendChild(o);var c=Yo("feMerge");i.appendChild(c),c.appendChild(Yo("feMergeNode")),c.appendChild(Yo("feMergeNode",{in:"SourceGraphic"})),a.appendChild(i);var f=Yo("g",{filter:"url(#dropshadow-"+this.unique_id+")",fill:"white",stroke:"none"});f.appendChild(Yo("rect",{x:Bo,y:Bo,rx:5})),f.appendChild(Yo("path")),a.appendChild(f),n.appendChild(a);var u=document.createElement("div");u.className="flourish-popup-content",(r=u.style).position="absolute",r.top=r.left=Bo+"px",r.padding="10px",n.appendChild(u),document.body.appendChild(n)}return n};var qo,Io={};function zo(e,t,n,r,a,i,o){var c=n-e/2-10,f=n+e/2+10,u=e/2+Math.min(0,c-a.left)+Math.max(0,f-a.right);return{pos:[u,o],shape:u-10<5?[-u,-15*i,Math.max(10,5-u),-10*i]:e-5<u+10?[Math.min(-10,e-u-5),-10*i,Math.min(10,e-u),-15*i]:[-10,-10*i,10,-10*i]}}function Ro(e,t,n,r,a,i,o){var c=r-t/2-10,f=r+t/2+10,u=t/2+Math.min(0,c-a.top)+Math.max(0,f-a.bottom);return{pos:[o,u],shape:u-10<5?[-15*i,-u,-10*i,Math.max(10,5-u)]:t-5<u+10?[-10*i,Math.min(-10,t-u-5),-15*i,Math.min(10,t-u)]:[-10*i,-10,-10*i,10]}}function Wo(){return new Oo}function Xo(){qo=Wo().container(document.body),K(".popup").on("mouseover",Vo).on("mouseout",$o)}function Vo(){if(this.getAttribute("data-popup-head")||this.getAttribute("data-popup-body")){var e=this.getAttribute("data-popup-position"),t=this.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height,a=this.getAttribute("data-popup-head")||null,i=this.getAttribute("data-popup-body")||null,o="",c=["top","topFlexible"];a&&(o+="<h1>"+a+"</h1>"),i&&(o+="<p>"+i+"</p>"),e&&("left"===e?(c=["right","rightFlexible"],n=t.left,r=t.top+t.height/2):"right"===e?(c=["left","leftFlexible"],n=t.right,r=t.top+t.height/2):"top"===e?(c=["bottom","bottomFlexible"],n=t.left+t.width/2,r=t.top):"bottom"===e&&(c=["top","topFlexible"],n=t.left+t.width/2,r=t.top+t.height)),qo.point(n,r).html(o).directions(c).draw()}}function $o(){qo.hide()}function Zo(e){if(e=e.toUpperCase(),!/^[A-Z]+$/.test(e))throw new Error("Invalid column spec: "+e);for(var t=0,n=0;n<e.length;n++)t=26*t+(e.charCodeAt(n)-64);return t-1}function Jo(e){e+=1;for(var t="";0<e;){var n=Math.floor(e/26),r=e%26;0==r&&(n-=1,r+=26),t=String.fromCharCode(64+r)+t,e=n}return t}function Go(e){var t=e.match(/\s*(?:[-–—:]|\.\.)\s*/);if(!t)throw new Error("Failed to parse column range: "+e);for(var n=e.substr(0,t.index),r=e.substr(t.index+t[0].length),a=Zo(n),i=Zo(r),o=[],c=a<=i?1:-1,f=Math.abs(i-a)+1,u=0;u<f;u++)o.push(a+u*c);return o}function Qo(e,t){var n={};if(!(e.type in e)){if(e.optional)return n;throw new Error("Data binding must specify '"+e.type+"': "+JSON.stringify(e))}var r=e[e.type].indexOf("::");if(-1==r)throw new Error("Invalid data binding: "+e[e.type]);var a=e[e.type].substr(0,r);n.data_table_id=t[a];var i=e[e.type].substr(r+2);if("column"==e.type)n.column=Zo(i);else{if("columns"!=e.type)throw new Error("Unknown data binding type: "+e.type);n.columns=function(e){var t=[],n=(e=e.replace(/^\s+|\s+$/g,"")).split(/\s*,\s*/);1==n.length&&""===n[0]&&(n=[]);for(var r=0;r<n.length;r++){var a=n[r];/^[A-Za-z]+$/.test(a)?t.push(Zo(a)):Array.prototype.push.apply(t,Go(a))}return t}(i)}return n}function Ko(e,t,n,r){var a=n?t[e.data_table_id]+"::":"";if("column"in e)return a+Jo(e.column);if("columns"in e)return a+function(e){for(var t,n,r=function(e){for(var t,n,r=[],a=0;a<e.length;a++)0<a&&e[a]==e[a-1]+1?n=e[a]:(void 0!==t&&r.push([t,n]),t=n=e[a]);return void 0!==t&&r.push([t,n]),r}(e),a=[],i=0;i<r.length;i++){var o=r[i];o[0]==o[1]?a.push(Jo(o[0])):a.push((t=o[0],n=o[1],Jo(t)+"-"+Jo(n)))}return a.join(",")}(e.columns);if(r)return"";throw new Error("Data binding must have .column or .columns")}Io.bottom=function(e,t){return{shape:[-10,-10,10,-10],pos:[e/2,t+10]}},Io.top=function(e,t){return{shape:[-10,10,10,10],pos:[e/2,-10]}},Io.left=function(e,t){return{shape:[10,10,10,-10],pos:[-10,t/2]}},Io.right=function(e,t){return{shape:[-10,10,-10,-10],pos:[e+10,t/2]}},Io.topLeft=function(e,t){return{shape:[15,10,10,15],pos:[-10,-10]}},Io.bottomLeft=function(e,t){return{shape:[15,-10,10,-15],pos:[-10,t+10]}},Io.topRight=function(e,t){return{shape:[-15,10,-10,15],pos:[e+10,-10]}},Io.bottomRight=function(e,t){return{shape:[-15,-10,-10,-15],pos:[e+10,t+10]}},Io.bottomFlexible=function(e,t,n,r,a){return zo(e,0,n,0,a,1,t+10)},Io.topFlexible=function(e,t,n,r,a){return zo(e,0,n,0,a,-1,-10)},Io.rightFlexible=function(e,t,n,r,a){return Ro(0,t,0,r,a,1,e+10)},Io.leftFlexible=function(e,t,n,r,a){return Ro(0,t,0,r,a,-1,-10)},Oo.prototype.__maxContentWidth=function(e){return this._maxWidth.match(/^\d+(?:\.\d+)?%$/)?e.width*parseFloat(this._maxWidth)/100:this._maxWidth.match(/^\d+(?:\.\d+)?(?:px)?$/)?parseFloat(this._maxWidth):(null!=this._maxWidth&&console.error("Popup: Unknown value for maxWidth: "+this._maxWidth),e.width)},Oo.prototype.draw=function(){if(this._point){var e=document.documentElement.getBoundingClientRect(),t=this._point[0],n=this._point[1],r=this._container.getBoundingClientRect();t<r.left?t=r.left:t>r.right&&(t=r.right),n<r.top?n=r.top:n>r.bottom&&(n=r.bottom);var a=t-e.left,i=n-e.top,o=this._getElement(),c=o.style,f=o.querySelector(".flourish-popup-svg"),u=f.querySelector("g"),s=u.querySelector("rect"),l=u.querySelector("path"),d=o.querySelector(".flourish-popup-content");c.display="block",d.style.maxWidth=this.__maxContentWidth(r)+"px",d.innerHTML=this._html;for(var h,p,b=d.getBoundingClientRect();h=Math.ceil(b.width),p=Math.ceil(b.height),c.width=h+2*Bo+"px",c.height=p+2*Bo+"px",b=d.getBoundingClientRect(),h!=Math.ceil(b.width)||p!=Math.ceil(b.height););s.setAttribute("width",h),s.setAttribute("height",p),f.setAttribute("width",h+2*Bo),f.setAttribute("height",p+2*Bo);for(var g,v,m,y,w,_,x,C,A,T,M,D,E,k,F,S,N,U,L,B,H=Bo-10,O=null,P=null,j=null,Y=1/0,q=1/0,I=0;I<this._directions.length;I++){var z=this._directions[I],R=(m=h,y=p,w=t,_=n,x=r,void 0,C=Io[z](m,y,w,_,x),A=w-Bo-C.pos[0],T=_-Bo-C.pos[1],{left:A,top:T,right:A+m+2*Bo,bottom:T+y+2*Bo}),W=Math.max(0,Math.floor(r.left)-R.left-H)+Math.max(0,R.right-Math.ceil(r.right)-H),X=Math.max(0,Math.floor(r.top)-R.top-H)+Math.max(0,R.bottom-Math.ceil(r.bottom)-H);if(0==W&&0==X){O=z;break}(W<Y||W==Y&&X<g)&&(Y=W,g=X,P=z),(X<q||X==q&&W<v)&&(q=X,v=W,j=z)}return z=O||("horizontal"==this._fallbackFit?P:"vertical"==this._fallbackFit?j:(console.warn("Popup: failed to point box of size ("+h+", "+p+") at ("+t+", "+n+") within ("+r.left+", "+r.top+", "+r.right+", "+r.bottom+")"),this._directions[0])),M=c,D=l,E=h,k=p,F=a,S=i,N=t,U=n,L=r,B=Io[z](E,k,N,U,L),M.left=F-Bo-B.pos[0]+"px",M.top=S-Bo-B.pos[1]+"px",D.setAttribute("d","M0,0L"+B.shape.join(",")+"Z"),D.setAttribute("transform","translate("+(B.pos[0]+Bo)+","+(B.pos[1]+Bo)+")"),this}console.error("Popup: cannot draw popup till point() has been specified")},Oo.prototype.hide=function(){return this._getElement().style.display="none",this};var ec,tc,nc,rc,ac=[{full:"#F4B1C5",light:"#FFDDE7"},{full:"#967EC6",light:"#D0C5E5"},{full:"#C67EBD",light:"#E5C5E1"},{full:"#7E91C6",light:"#C5CDE5"},{full:"#7EB0C6",light:"#C5DBE5"},{full:"#7EC69B",light:"#C5E5D2"},{full:"#B3C67E",light:"#DDE5C5"},{full:"#C69B7E",light:"#E5D2C5"}],ic={},oc=void 0,cc=0;function fc(){Q(this.parentNode).classed("open",function(){return!Q(this).classed("open")})}function uc(d,h){oc={},cc=0,d.template_id&&d.dataTables(function(e){if(e)return console.error("Failed to get data tables: "+e);var t=d.dataBindingsForCurrentTemplate(),n=d.getDataTableNames();tc.html("");var r,a=null;"string"!=typeof h[0]&&(h=["Data"].concat(h));for(var i=0;i<h.length;i++){var o,c=h[i];if("string"!=typeof c){var f=t[c.dataset]&&t[c.dataset][c.key];!r&&f&&(r=f.data_table_id,o.selectAll("option").property("selected",function(){return this.getAttribute("data-id")==r}));var u=r&&f&&f.data_table_id!==r;oc[c.dataset+"-"+c.key]=c.type,sc(a?a.append("div"):tc.append("div"),c,f,n,u)}else{if((a=tc.append("div").attr("class","data-block open")).append("h2").attr("class","no-select").text(c).on("click",fc),i!==h.length-1){var s=h[i+1];"string"==typeof s&&(a.append("p").text(s),i+=1)}for(var l in a.append("div").attr("class","datatable-selector-container"),(o=a.select(".datatable-selector-container").append("select").attr("class","datatable-selector").attr("data-index",i).attr("disabled",!ec.visualisation.can_edit||null)).on("change",function(){qo.hide();for(var e=+this.dataset.index+1;e<h.length&&"string"!=typeof h[e];e++){var t=h[e];dc(tc.select("input#data-binding-"+t.dataset+"-"+t.key).node(),t)}}),ec.visualisation.getDataTableNames())o.append("option").attr("data-id",l).html(ec.visualisation.getDataTableNames()[l]);r=null}}ec.spreadsheet&&ec.spreadsheet.updateHighlights()})}function sc(e,t,n,r,a){ac[cc]||(cc=0),e.attr("class","settings-option option-type-"+t.type);var i,o=void 0===n?"":Ko(n,r,a,t.optional);ic[t.dataset]||(ic[t.dataset]={}),ic[t.dataset][t.key]=cc,e.append("h3").text(t.name),"column"!=t.type||t.optional||e.append("span").attr("class","required").text("REQUIRED"),e.append("input").attr("id","data-binding-"+t.dataset+"-"+t.key).attr("name",t.dataset+"-"+t.key).attr("disabled",!ec.visualisation.can_edit||null).each(function(){this.value=o}).attr("data-value",o).attr("type","text").call((i=t,function(e){e.on("change",function(){qo.hide(),dc(this,i)}).on("keydown",function(){ec.confirm.blank()}).on("blur",function(){qo.hide()})})).style("background",ac[cc].light).style("border-color",ac[cc].full),e.append("p").html(t.description),cc++}function lc(e,t){ec.confirm.saving(),ec.visualisation.updateDataBindings(e,function(e){if(e)return ec.confirm.error(e.message||e),console.error("Failed to save data binding:",e),void ec.analytics("send","exception",{exDescription:e.message||e,exFatal:!0});ec.analytics("send","event","visualisation","change_data_binding",ec.visualisation.id),ec.confirm.saved(),t&&t()})}function dc(n,e){var t,r=n.parentElement.parentElement.querySelector(".datatable-selector").value,a=-1<n.value.indexOf("::"),i={type:e.type};if("column"==i.type?i.column=a?n.value:r+"::"+n.value:i.columns=a?n.value:r+"::"+n.value,e.optional&&!n.value)t=null;else{try{t=Qo(i,ec.visualisation.getDataTableIds())}catch(e){return console.error("Failed to parse data binding",e),n.value=n.getAttribute("data-value"),void qo.point(n).text("Invalid column specification").draw()}if(!t.data_table_id)return n.value=n.getAttribute("data-value"),void qo.point(n).text("No such data table").draw()}var o={};o[e.dataset]={},o[e.dataset][e.key]=t,lc(o,function(){n.setAttribute("data-value",n.value),ec.preview_pane.updateData(function(e){if(e){var t=n.value&&-1!==n.value.indexOf(/[,-]/)?"these columns":"this column";qo.point(n).text("One or more values in "+t+" are causing an error").draw(),n.value=n.getAttribute("data-value")}}),ec.spreadsheet&&ec.spreadsheet.updateHighlights(),ec.template_settings&&ec.template_settings.populate()})}function hc(e){ec=e,tc=Q(".side-panel .data-bindings"),ec.data_bindings={update:function(e){e&&(ec.template_data_bindings=e),uc(ec.visualisation,ec.template_data_bindings)},modify:function(e){lc(e,function(){uc(ec.visualisation,ec.template_data_bindings)})}},Q(".add-data-binding h2").on("click",fc)}function pc(){if(null==nc){var e=function(){var e=window.location;"about:srcdoc"==e.href&&(e=window.parent.location);var r={};return function(e,t,n){for(;n=t.exec(e);)r[decodeURIComponent(n[1])]=decodeURIComponent(n[2])}(e.search.substring(1).replace(/\+/g,"%20"),/([^&=]+)=?([^&]*)/g),r}();nc="referrer"in e?/^https:\/\/medium.com\//.test(e.referrer):!("auto"in e)}return nc}function bc(e){var t=e||window.innerWidth;return 999<t?650:599<t?575:400}function gc(e,t){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),rc)return e=parseInt(e,10),void n.parent.postMessage({sentinel:"amp",type:"embed-size",height:e},"*");var r={sender:"Flourish",context:"iframe.resize",method:"resize",height:e,src:n.location.toString()};if(t)for(var a in t)r[a]=t[a];n.parent.postMessage(JSON.stringify(r),"*")}}function vc(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function mc(a){window.addEventListener("message",function(t){if(null!=t.source&&(t.origin===document.location.origin||t.origin.match(/\/\/localhost:\d+$|\/\/flourish-api\.com$|\.flourish\.(?:local(:\d+)?|net|rocks|studio)$|\.uri\.sh$/))){var e;try{e=JSON.parse(t.data)}catch(e){return void console.warn("Unexpected non-JSON message: "+JSON.stringify(t.data))}if("Flourish"===e.sender){for(var n=document.querySelectorAll("iframe"),r=0;r<n.length;r++)if(n[r].contentWindow==t.source||n[r].contentWindow==t.source.parent)return void a(e,n[r]);console.warn("could not find frame",e)}}}),vc()&&(window.addEventListener("resize",yc),yc())}function yc(){for(var e=document.querySelectorAll(".flourish-embed"),t=0;t<e.length;t++){var n=e[t];if(!n.getAttribute("data-width")){var r=n.querySelector("iframe"),a=window.getComputedStyle(n),i=n.offsetWidth-parseFloat(a.paddingLeft)-parseFloat(a.paddingRight);r.style.width=i+"px"}}}function wc(e,t,n,r){var a;n&&"number"==typeof n?(a=n,n+="px"):n&&n.match(/^[ \t\r\n\f]*([+-]?\d+|\d*\.\d+(?:[eE][+-]?\d+)?)(?:\\?[Pp]|\\0{0,4}[57]0(?:\r\n|[ \t\r\n\f])?)(?:\\?[Xx]|\\0{0,4}[57]8(?:\r\n|[ \t\r\n\f])?)[ \t\r\n\f]*$/)&&(a=parseFloat(n)),r&&"number"==typeof r&&(r+="px");var i=document.createElement("iframe");return i.setAttribute("scrolling","no"),i.setAttribute("frameborder","0"),t.appendChild(i),n?i.style.width=n:vc()?i.style.width=t.offsetWidth+"px":i.style.width="100%",!!r||(e.match(/\?/)?e+="&auto=1":e+="?auto=1",r=bc(a||i.offsetWidth)+"px"),r&&("%"===r.charAt(r.length-1)&&(r=parseFloat(r)/100*t.parentNode.offsetHeight+"px"),i.style.height=r),i.setAttribute("src",e),i}var _c={start:function(){document.body.classList.add("loading")},clear:function(){document.body.classList.remove("loading")}};function xc(e,t,n,r,a){null==n&&(n=[{text:"Okay",keyCode:13}]);var i,o=Q("body").append("div").attr("class","dialog"),c=o.append("div").attr("class","dialog-inner"),f=c.append("div").classed("text",!0);if(f.append("h1").text(e),"string"==typeof t)i=r?f.append("div").html(t):f.append("p").text(t);else if("object"==typeof t){if(i=f.append(t.type),t.value&&(i.node().value=t.value),t.attributes)for(var u in t.attributes)i.attr(u,t.attributes[u]);i.node().focus()}var s=c;null!=a&&"object"==typeof a&&function(e,t,n,r){r&&e.classed("business",!0);var a=e.append("div").attr("class","text");a.append("p").text(t),a.append("ul").selectAll("li").data(n).enter().append("li").html(function(e){return e}).append("i").attr("class","fa fa-check")}(s=s.append("div").attr("class","upgrade"),a.message,a.list,a.is_business);var l=s.append("div").attr("class","btns"),d={};function h(e){if(e.which in d){var t=d[e.which];document.removeEventListener("keydown",h),t.callback&&t.callback(i.node().value),o.remove(),e.preventDefault()}}return n.forEach(function(e){var t=l.append(e.tag_name||"div").attr("class","btn").style("margin-right","0.75em").text(e.text).on("click",function(){document.removeEventListener("keydown",h),e.callback&&e.callback(i.node().value),o.remove()});e.class&&t.classed(e.class,!0),e.keyCode&&(d[e.keyCode]=e),e.href&&t.attr("href",e.href)}),document.addEventListener("keydown",h),o}var Cc,Ac,Tc,Mc,Dc,Ec,kc,Fc,Sc="⬆︎",Nc="/api/file/upload";function Uc(e){(e||document).querySelectorAll("input[type=url]").forEach(function(e){Lc(e)})}function Lc(e,t){var n=e.ownerDocument.createElement("button");n.type="button",n.className="upload",n.setAttribute("title","Upload a file from your computer"),n.innerHTML=Sc,e.insertAdjacentElement("afterend",n),t||(n.onclick=Bc)}function Bc(){var n=this.previousSibling,e=n.getAttribute("accept");n.disabled=!0,n.classList.toggle("uploading",!0),Hc({accept:e,success:function(e){var t;n.disabled=!1,n.classList.toggle("uploading",!1),n.value=e,"createEvent"in document?(t=document.createEvent("Event")).initEvent("change",!0,!0):t=new Event("change",{bubbles:!0}),n.dispatchEvent(t)},failure:function(){n.disabled=!1,n.classList.toggle("uploading",!1)}})}function Hc(c){var f=document.getElementById("file-uploader");f||((f=document.createElement("input")).type="file",f.setAttribute("id","file-uploader"),f.style.display="none",document.body.appendChild(f)),c.accept?f.setAttribute("accept",c.accept):f.removeAttribute("accept"),f.onchange=function(){var e,r,a,i,t,n,o;_c.start(),e=f.files,r=c.success,a=c.failure,i=e[0],n=function(e,n){if(e)return _c.clear(),xc("Upload error","There was a problem uploading your file: "+e),void console.error(e);var t=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}({file:i},n.fields);Oc(n.upload_url,t,function(e,t){_c.clear(),e?(xc("Upload error","There was a problem uploading your file ("+t.status+")."),console.error(e),a&&a()):r(n.file_url)})},o={filename:(t=i).name,content_type:t.type,size:t.size},Oc(Nc,o,function(e,t){return e?n(e):n(null,JSON.parse(t.responseText))}),f.parentNode.removeChild(f)},f.click()}function Oc(t,e,n){var r=new XMLHttpRequest,a=new FormData;if("object"==typeof e){for(var i in e)e.hasOwnProperty(i)&&"file"!==i&&a.append(i,e[i]);e.hasOwnProperty("file")&&a.append("file",e.file)}r.onload=function(){if(200<=r.status&&r.status<300)n(null,r);else try{var e=JSON.parse(r.responseText).error;n(e,r)}catch(e){n(new Error("POST "+t+" received status code: "+r.status),r)}},r.open("POST",t,!0),r.send(a)}function Pc(){return{setup:Uc,addButton:Lc,startUpload:Hc}}function jc(e){var t={};for(var n in e){for(var r=t,a=n.indexOf("."),i=0;0<=a;a=n.indexOf(".",i=a+1)){var o=n.substring(i,a);o in r||(r[o]={}),r=r[o]}r[n.substring(i)]=e[n]}return t}var Yc,qc,Ic=null;function zc(){return"MessageChannel"in window}function Rc(e,t,n){return kc=!1,Ic=null,(Fc=e)&&e.template_id?Cc.on("load",(r=e,a=t,i=n,o=r.template_id,function(){Fo(),Fc&&Fc.template_id==o&&(Cc.on("load",null),Gc(function(e,n){e?console.error("Failed to get default state"):Fc&&Fc.template_id==o&&Qc(function(e,t){e?console.error("Failed to call hasData"):Fc&&Fc.template_id==o&&(t?Fc.refreshDataBindings(function(e){e?console.error("Failed to refresh data bindings"):Fc&&Fc.template_id==o&&Fc.prepareData(function(e,t){e?console.error("Failed to prepare data for template"):Fc&&Fc.template_id==o&&ff({data:t,state:a,draw:!0},function(e,t){Ic=n,i(e,t)})})}):ff({state:a,draw:!0},function(e,t){Ic=n,i(e,t)}))})}))})).attr("src","/template/"+e.template_id+"/embed/?auto=1&environment="+Tc):Cc.on("load",null).attr("src","about:blank");var r,a,i,o}function Wc(e,t,r,n){var a="about:blank"===Cc.attr("src");if(kc=!1,t){var i=e[t]||"/template/"+t+"/embed";i+="?environment="+Tc,n&&(i+="&auto=1"),a?o():Cc.transition().duration(250).style("opacity",0).on("end",o)}else Cc.transition().duration(250).style("opacity",0).on("end",function(){Cc.on("load",null).attr("src","about:blank")});function o(){var n;Cc.on("load",(n=function(){r(),a||Cc.transition().duration(250).style("opacity",1)},function(){Gc(function(e,t){e?console.error("Failed to get default state"):(Ic=t,n())})})).attr("src",i)}}function Xc(t,n){var r=t.template_id;t.refreshDataBindings(function(e){e?console.error("Failed to fetch data bindings"):t.prepareData(function(e,t){if(Fc&&Fc.template_id==r)return e?(console.error("Failed to prepare data for template"),void n(e)):void n(void 0,t)})})}function Vc(e,n){Xc(e,function(e,t){if(e)return n(e);ff({data:t,update:!0},n)})}function $c(e,n,r){Xc(e,function(e,t){if(e)return r(e);ff({data:t,state:n,overwrite_state:!0,update:!0},r)})}function Zc(e,t,n){if(zc()){var r=new MessageChannel;r.port1.onmessage=function(e){var t=e.data;if("string"==typeof t){if(!n)return;return n(void 0,JSON.parse(t))}if("object"==typeof t){if("result"in t){if(!n)return;return n(void 0,t.result)}if("error"in t){if(!n)return;return n(t.error)}console.error("Unrecognised response to message",t)}else console.error("Unrecognised response to message",t)},Ac.contentWindow.postMessage({sender:"Flourish",method:e,argument:t},"*",[r.port2])}}function Jc(e,t){Zc("setState",jc(e),t)}function Gc(e,t){"function"!=typeof e?Zc("getState",e,t):Zc("getState",void 0,e)}function Qc(e){Zc("hasData",void 0,e)}function Kc(e,t){Zc("setData",e,t)}function ef(e){Zc("getData",void 0,e)}function tf(e){Zc("draw",void 0,e),kc=!0}function nf(e){Ec&&Ec.clear(),kc&&Zc("update",void 0,e)}function rf(e,t){Zc("snapshot",e,t)}function af(){return function e(t){if(null==t)return t;var n,r={};for(var a in t)Array.isArray(t[a])?r[a]=t[a].slice():(n=t[a],Array.isArray(n)||"object"!=typeof n||null==n?r[a]=t[a]:r[a]=e(t[a]));return r}(Ic)}function of(e,t){Zc("setFixedHeight",e,t)}function cf(e){if(Ac.parentNode.offsetWidth){if(void 0!==e)qc=null!=e;else if(qc)return;var t=e||Dc&&Dc.responsive_menu&&Dc.responsive_menu.getHeightSetting()||Mc.getHeightForBreakpoint(Ac.offsetWidth);"number"==typeof t&&(t+="px"),Ac.style.height=t}}function ff(a,i){kc?delete a.draw:a.draw&&(kc=!0),a.state&&(a.state=jc(a.state)),Ec&&Ec.clear(),Zc("sync",a,function(e,t){null!=e||"success"!==t?(a.draw&&(kc=!1),function e(t){var n,r;t?i&&i(t):(r=e,((n=a).data?(Kc(n.data,r),delete n.data,0):n.state?(Jc(n.state,r),delete n.state,0):n.draw?(tf(r),delete n.draw,0):!n.update||(nf(r),delete n.update,0))&&i&&i(void 0))}(e)):i&&i(void 0)})}function uf(e,t,n,r){var a;return Cc=Q(e),Ac=Cc.node(),Tc=t,Dc=n,Ec=r,Yc=Pc(),rc="#amp=1"==window.location.hash,Mc={createEmbedIframe:wc,isFixedHeight:pc,getHeightForBreakpoint:bc,startEventListeners:mc,notifyParentWindow:gc,isSafari:vc},Ac.style.height=Mc.getHeightForBreakpoint(Ac.offsetWidth)+"px",Mc.startEventListeners(function(e){var n,t;"resize"==e.method?cf(e.height):"request-upload"==e.method?(n=e.name,t=e.accept,Yc.startUpload({accept:t||"image/*,video/*",success:function(e){var t={};t[n]=e,ff({state:t,update:!0})},failure:function(e){console.error("Upload failed",e)}})):"warn"==e.method&&(Ec&&Ec.warn(e),console.warn("Warning from template:",e.message,e.explanation))}),zc()||(a=Ac.parentNode)&&Q(a).append("div").attr("class","unsupported-notice").html("<h3>Please update your browser</h3><p>This page only works with newer versions of your browser.</p>"),{loadVisualisation:Rc,loadTemplate:Wc,updateData:Vc,updateDataAndState:$c,setState:Jc,getState:Gc,getDefaultState:af,hasData:Qc,setData:Kc,getData:ef,draw:tf,update:nf,snapshot:rf,setFixedHeight:of,resize:cf,sync:ff}}var sf,lf,df=!(Wo.version="1.1.1"),hf=[],pf=100;function bf(){Q(".flourish-warn-list").classed("visible",!1),df=!1}function gf(){return Q(".flourish-warn-btn").on("click",function(){df?bf():(Q(".flourish-warn-list").classed("visible",!0),df=!0)}),{clear:mf,warn:yf}}function vf(){Q(".flourish-warn-container").classed("visible",hf.length),hf.length>pf&&(hf.length=pf);var e=Q(".flourish-warn-list ul").selectAll("li").data(hf),t=e.enter().append("li");t.append("i").attr("class","fa fa-warning"),t.append("p").attr("class","message"),t.append("p").attr("class","explanation");var n=e.merge(t);n.select(".message").text(function(e){return e.message||""}),n.select(".explanation").text(function(e){return e.explanation||""}),e.exit().remove()}function mf(){hf=[],vf(),bf()}function yf(e){hf.unshift(e),vf()}function wf(){var e=sf.visualisation,t=e.getTemplate(),n=!1,r=!1,a=!1;function i(){var e=sf.template_settings.getSettingsForCurrentTemplate(),t=sf.visualisation.settingsForCurrentTemplate(),n={};for(var r in t)r in e&&(n[r]=t[r]);lf.loadVisualisation(sf.visualisation,n,function(){sf.template_settings.populate(),_c.clear()}),Uo()}t.getSettings(function(e,t){e?console.error("Failed to get template settings: "+e):(sf.template_settings.update(t),n=!0,r&&a&&i())}),t.getDataBindings(function(e,t){e?console.error("Failed to get template data bindings: "+e):(sf.data_bindings.update(t),r=!0,n&&a&&i())}),e.refreshDataBindings(function(e){e?console.error("Failed to get template data bindings: "+e):(a=!0,r&&n&&i())})}function _f(e){lf.updateData(sf.visualisation,e)}var xf="Add new value: ";function Cf(o,e,c,f,t){var n;o.setAttribute("data-autocomplete",e),o.setAttribute("autocomplete","off"),o.insertAdjacentHTML("afterend",'<i class="fa fa-chevron-down clickable"></i><div class="dropdown autocomplete" id="'+e+'"></div>');var r=Q(document.getElementById(e));r.classed("click-to-open",!0);var a=r.append("div").attr("class","dropdown-list");function i(e){if(1===e.length)return"dropdown-category";var t="dropdown-item";return n&&e[0]===n&&(t+=" current"),t}function u(e){a.selectAll("div").remove(),a.selectAll("div").data(e).enter().append("div").attr("class",i).attr("data-value",function(e){return"string"==typeof e?e||null:e[1]}).html(function(e){return t?t(e,this):"string"==typeof e?e:e[0]}),e.length||a.append("div").attr("class","dropdown-item disabled").text("No matches found")}function s(){r.classed("open",!1)}function l(e){var t=e.textContent;return 0===t.indexOf(xf)&&(t=t.substr(xf.length)),t}return r.on("mousedown",function(){var e=z.target;e.hasAttribute("data-value")?(o.value=l(e),o.setAttribute("data-value",e.getAttribute("data-value")),s(),Q(o).dispatch("change")):z.preventDefault()}),Q(o).on("keydown.autocomplete",function(){var e,t;9==z.keyCode||13==z.keyCode?(e=a.select(".selected")).empty()||(o.value=l(e.node()),o.setAttribute("data-value",e.attr("data-value")),s(),Q(o).dispatch("change"),o.blur()):40==z.keyCode?((e=a.select(".selected")).empty()||(t=e.node().nextSibling),t||(t=a.select(".dropdown-item[data-value]").node()),a.selectAll(".selected").classed("selected",!1),Q(t).classed("selected",!0)):38==z.keyCode&&((e=a.select(".selected")).empty()||(t=e.node().previousSibling),t||(t=a.select(".dropdown-item:last-child").node()),a.selectAll(".selected").classed("selected",!1),Q(t).classed("selected",!0))}).on("input.autocomplete",function(){var e,t=o.value,n=t.toLowerCase(),r=!1;if(Q(o).attr("data-value",t),t){e=[];for(var a=0;a<c.length;a++){var i=("string"==typeof c[a]?c[a]:c[a][0]).toLowerCase();i==n&&(r=!0),0==i.indexOf(n)&&e.push(c[a])}f&&!r&&e.unshift([xf+t,t])}else e=c;u(e)}).on("focus.autocomplete",function(){n=o.value,u(c),r.classed("open",!0)}).on("blur.autocomplete",s),{options:function(e){if(!arguments.length)return c;u(c=e)}}}var Af="https://fonts.googleapis.com/css?family=",Tf=["Source Sans Pro","Roboto Condensed","Merriweather","Lora","Playfair Display","Coda","Lobster","Cabin Sketch"],Mf="Same as parent",Df=[],Ef=[],kf={};function Ff(e){return Af+e.replace(/ /g,"+")+":400,700"}function Sf(e){var t=Ef.concat(Df,Tf.map(function(e){return{name:e,url:Ff(e)}}));return e&&t.unshift({name:Mf}),t}function Nf(t){return Sf(!0).find(function(e){return e.name==t})}var Uf=!1;function Lf(e){return e.substr(e.lastIndexOf("=")+1).replace(/\+/g," ")}function Bf(e){var t=e.target,n=t.value;if(n&&(0==n.indexOf(Af)&&(n=t.value=Lf(n)),!Nf(n))){if(/^https?:\/\//.test(n)){Uf||(Hf(n),t.value="");var r=n;return n=t.value=Lf(r),Ef.push({name:n,url:r}),void Of()}var a=Ff(n);try{var i=new XMLHttpRequest;if(i.open("HEAD",a,!1),i.send(),404==i.status)throw"Font not found";Ef.push({name:n,url:a}),Of()}catch(e){Hf(n),t.value=""}}}function Hf(e){xc("Unrecognised font “"+e+"”","Fonts must be chosen from Google Fonts. Visit <a href='https://fonts.google.com'>fonts.google.com</a> to find more",null,!0)}function Of(){var e,t,n=Object.keys(kf);for(e=0;e<n.length;++e)(t=kf[n[e]]).autocomplete.options(Sf(t.can_inherit).map(function(e){return e.name}))}var Pf={initialize:function(e,t,n){var r=!!t.optional;Uf=n,e.classList.add("font-menu"),kf[t.property]={autocomplete:Cf(e,t.property+"-dropdown",Sf(r).map(function(e){return e.name}),!0),can_inherit:r},e.addEventListener("change",Bf)},update:function(e,t){var n=t?t.name:Mf;Nf(e.value=n)||(n!=Mf&&Ef.push({name:n,url:t.url}),Of())},getValue:function(e){if(/^https?:\/\//.test(e.value))return{name:Lf(e.value),url:e.value};var t=e.value;if(t==Mf)return null;var n=Nf(t);return n||{name:t,url:Ff(t)}},replaceThemeFonts:function(e){Df=(e||[]).map(function(e){return{name:e.name,url:e.url}}),Of()}};var jf={};function Yf(e){e.running||(e.running=!0,function e(t,n){t.request=qf(t.items.shift(),function(){t.request=null,0==t.items.length?n():e(t,n)})}(e,function(){e.running=!1}))}function qf(e,n){var t="method"in e?e.method:"POST",r="request_type"in e?e.request_type:"application/json",a="response_type"in e?e.response_type:"application/json",i=e.url,o=e.payload,c=e.callback;if(o){if("function"!=typeof o)throw new Error("Internal error: processRequestThen: payload must be a function, not "+typeof o,o);"string"!=typeof(o=o())&&(o=JSON.stringify(o))}var f=function(a,e){var i,o,c,f,u=b("beforesend","progress","load","error"),s=un(),l=new XMLHttpRequest,d=null,h=null,p=0;function t(e){var t,n,r,a=l.status;if(!a&&((r=(n=l).responseType)&&"text"!==r?n.response:n.responseText)||200<=a&&a<300||304===a){if(c)try{t=c.call(i,l)}catch(e){return void u.call("error",i,e)}else t=l;u.call("load",i,t)}else u.call("error",i,e)}if("undefined"==typeof XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(a)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=t:l.onreadystatechange=function(e){3<l.readyState&&t(e)},l.onprogress=function(e){u.call("progress",i,e)},i={header:function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s.get(e):(null==t?s.remove(e):s.set(e,t+""),i)},mimeType:function(e){return arguments.length?(o=null==e?null:e+"",i):o},responseType:function(e){return arguments.length?(f=e,i):f},timeout:function(e){return arguments.length?(p=+e,i):p},user:function(e){return arguments.length<1?d:(d=null==e?null:e+"",i)},password:function(e){return arguments.length<1?h:(h=null==e?null:e+"",i)},response:function(e){return c=e,i},get:function(e,t){return i.send("GET",e,t)},post:function(e,t){return i.send("POST",e,t)},send:function(e,t,n){var r;return l.open(e,a,!0,d,h),null==o||s.has("accept")||s.set("accept",o+",*/*"),l.setRequestHeader&&s.each(function(e,t){l.setRequestHeader(t,e)}),null!=o&&l.overrideMimeType&&l.overrideMimeType(o),null!=f&&(l.responseType=f),0<p&&(l.timeout=p),null==n&&"function"==typeof t&&(n=t,t=null),null!=n&&1===n.length&&(r=n,n=function(e,t){r(null==e?t:null)}),null!=n&&i.on("error",n).on("load",function(e){n(null,e)}),u.call("beforesend",i,l),l.send(null==t?null:t),i},abort:function(){return l.abort(),i},on:function(){var e=u.on.apply(u,arguments);return e===u?i:e}},null==e)return i;if("function"!=typeof e)throw new Error("invalid callback: "+e);return i.get(e)}(i);return r&&"GET"!==t&&f.header("Content-Type",r),a&&f.mimeType(a),f.on("error",function(t){var e;try{e=JSON.parse(t.target.responseText),c(e.error)}catch(e){c("Internal error: "+t.target.responseText)}n()}),f.on("load",function(e){var t=e.responseText;"application/json"===a&&(t=JSON.parse(t));try{c(void 0,t)}catch(e){console.error(e.stack)}n()}),f.send(t,o),f}function If(e,t){void 0===t&&(t="default"),t in jf||(jf[t]={items:[],running:!1,name:t}),jf[t].items.push(e),Yf(jf[t])}var zf,Rf,Wf={update:function(e,t){If({url:"/api/user",method:"POST",payload:function(){return{fields:e}},callback:t})},isUsernameAvailable:function(e,t){If({url:"/api/user/username?u="+encodeURIComponent(e),method:"GET",callback:t})},getReviewCount:function(e){If({url:"/api/reviews/count",method:"GET",callback:e})},logHistory:function(e){If({url:"/api/history",method:"POST",payload:function(){return e},callback:function(){}})},addApiKey:function(e){If({url:"/api/user/api_keys",method:"PUT",callback:e})},getApiKeys:function(e){If({url:"/api/user/api_keys",method:"GET",callback:e})},deleteApiKey:function(e,t){If({url:"/api/user/api_keys/"+e,method:"DELETE",callback:t})},fetchProjects:function(e,t,n,r,a,i,o,c){var f="";t&&(f+="&folder="+encodeURIComponent(t)),n&&(f+="&sort="+encodeURIComponent(n)),r&&(f+="&filter="+encodeURIComponent(r)),a&&(f+="&offset="+encodeURIComponent(a)),i&&(f+="&limit="+encodeURIComponent(i)),o&&(f+="&search="+encodeURIComponent(o)),c&&(f+="&is_recent=true"),If({url:"/api/user/projects?"+f,method:"GET",callback:e})},addTag:function(e,t){If({url:"/api/user/tag/"+encodeURIComponent(e),method:"PUT",callback:t})},renameTag:function(e,t,n){If({url:"/api/user/tag/"+encodeURIComponent(e)+"/"+encodeURIComponent(t),method:"PUT",callback:n})},removeTag:function(e,t){If({url:"/api/user/tag/"+encodeURIComponent(e),method:"DELETE",callback:t})},fetchFolders:function(e){If({url:"/api/user/folders",method:"GET",callback:e})}};function Xf(e){var t;if(zf=Q(".detailed-settings"),(Rf=zf.append("div").attr("class","settings-block")).append("h2").text("Back to settings").on("click",function(){zf.transition().duration(100).style("opacity",0).on("end",function(){Q(this).html("").style("display","none"),Q(".template-settings").style("display","block").style("opacity",0).transition().duration(500).style("opacity",1)}),zf.node()}),"string"==typeof e)t=Rf.append("div").html(e);else if("object"==typeof e&&(t=Rf.append(e.type),e.value&&(Rf.node().value=e.value),e.attributes))for(var n in e.attributes)t.attr(n,e.attributes[n]);return t.node().focus(),Q(".template-settings").style("display","none"),zf.style("display","block").style("opacity",0).transition().duration(500).style("opacity",1),zf.node()}var Vf,$f,Zf,Jf,Gf={},Qf={},Kf={"Flourish 1":{scheme:"flourish_default_1",colors:["#1D6996","#EDAD08","#73AF48","#94346E","#38A6A5","#E17C05","#5F4690","#0F8554","#6F4070","#CC503E","#994E95","#666666"]},"Flourish 2":{scheme:"flourish_default_2",colors:["#11A579","#CC503E","#3969AC","#F2B701","#7F3C8D","#80BA5A","#E68310","#CF1C90","#008695","#F97B72","#4B4B8F","#A5AA99"]},Rainbow:{colors:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#994E95","#666666"]},Pastel:{colors:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#D3B484","#B3B3B3"]},Antique:{colors:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#467378","#7C7C7C"]},Accent:{scheme:"schemeAccent",colors:Fa},Dark:{scheme:"schemeDark2",colors:Sa},Paired:{scheme:"schemePaired",colors:Na},Pale:{scheme:"schemePastel1",colors:Ua},"Farrow & Ball":{colors:["#EDD8C4","#C4A999","#F9C1C0","#B76A4C","#8F483C","#783027","#8A1D2E","#602A1F","#893838","#BD795A","#DC6130","#AD3B34","#ECE8BD","#F7E28A","#EBEB82","#FAD862","#F1CA61","#F5C03B","#F9E7D4","#F4E4AC","#EFD491","#DAC589","#D2B15E","#CD9344","#EFEFCC","#E8E7CA","#CAD5AD","#B9B495","#73806F","#636F65","#BDAB65","#889A73","#829C7A","#6C7855","#81B693","#BBBEA0","#99A286","#AAC0B3","#427E7F","#769194","#ECF3EC","#EBEBD4","#D0D9C9","#9EAF9F","#7A8E8D","#516365","#DBE5DC","#C4C9C5","#CBD7D7","#AABEBF","#66839A","#A0D2CD","#56AAC5","#535E7D","#2E3548","#48606E","#2C3437"]}},eu={};function tu(){var e,t={};for(e in eu)t[e]=eu[e];for(e in Kf)t[e]=Kf[e];return t}var nu="Edit color palette";function ru(e){e&&e.length?(eu={},e.forEach(function(e){var t=Object.keys(e)[0];eu[t]={colors:e[t]}})):eu={},function(){for(var e in Gf){var t=Gf[e];t.options(iu())}}()}function au(){if(void 0!==Vf)return Vf;var e=document.createElement("input");return e.setAttribute("type","color"),e.setAttribute("value","!"),Vf="color"==e.type&&"!"!==e.value}function iu(){var e=[],t=tu();for(var n in e.push([nu,""]),t)e.push([n,t[n].colors.join("|")]);return e}function ou(e,t){var n=e[0],r=e[1];if(!r)return"<em><i class='fa fa-pencil'></i>"+nu+"</em>";Array.isArray(r)||(r=r.split("|"));var a="";return t&&n&&(a+="<label>"+n+"</label>"),r.forEach(function(e,t){a+="<span data-index="+t+" style='background-color:"+e+"'></span>"}),a}function cu(e,t){var n,r,a=tu(),i=e.parentNode.querySelector(".color-swatches");if(Array.isArray(t))r=t;else if("string"==typeof t){if(a[t])n=t;else for(var o in a)if(a[o].scheme==t){n=o;break}n&&(r=a[n].colors)}if(!r||!r.length)return e.parentNode.classList.remove("custom"),e.removeAttribute("data-value"),e.value="",void(i.innerHTML="");i.innerHTML=ou([null,r]),e.setAttribute("data-value",r.join("|"))}function fu(e){Jf=e.target,e.dataTransfer.setData("text/plain","x"),event.dataTransfer.effectAllowed="move",Q(Jf).classed("dragging",!0),K(".palette p:not(.dragging) input").style("pointer-events","none")}function uu(e){e.preventDefault();var t=Q(".palette").selectAll("[draggable='true']").style("border-color",null),n=Q(e.target);if("true"===n.attr("draggable")){var r="bottom";if(n.node()===t.nodes()[0]){var a=e.target.getBoundingClientRect(),i=a.top+a.height/2;e.clientY<i&&(r="top")}Q(e.target).style("border-"+r,"1px solid black")}}function su(e){if(Jf){for(var t=e.target;t&&("P"!==t.tagName||!t.nextSibling);)t=t.parentNode;if(t){var n=t.nextSibling;if(t===Q(".palette").selectAll("[draggable='true']").style("border-color",null).nodes()[0]){var r=t.getBoundingClientRect(),a=r.top+r.height/2;e.clientY<a&&(n=t)}t.parentNode.insertBefore(Jf,n),Jf=!1,hu()}}}function lu(){Q(Jf).classed("dragging",!1),K(".palette *").style("border-bottom",null).style("border-top",null),K(".palette p input").style("pointer-events",null)}function du(e){for(var t,n,r=e.target;r&&"BUTTON"!==r.tagName;)r=r.parentNode;r&&(r.classList.contains("fa-plus-square")?(t=e.target.parentNode,n=pu("#000000"),t.insertAdjacentHTML("beforebegin",n),hu()):r.classList.contains("fa-times")&&function(e){2<e.parentNode.childNodes.length?e.parentNode.removeChild(e):("INPUT"==e.firstChild.tagName?e.firstChild.value="#000000":e.firstChild.style.backgroundColor="#000000",e.firstChild.nextSibling.value="#000000");hu()}(r.parentNode))}function hu(){for(var e=Zf.getAttribute("data-autocomplete"),t=Gf[e],n=[],r=$f.querySelectorAll(".palette input[type=text]"),a=0;a<r.length;a++)n.push(r[a].value);var i=t.options();Qf[e]?i[0][1]=n.join("|"):i.unshift(["Custom",n.join("|")]),Qf[e]=n,t.options(i),cu(Zf,n),Q(Zf).dispatch("change")}function pu(e){var t="<p draggable=true><span class='swatch-handle'>.. .. ..</span>";return au()?t+="<input type='color' value='"+e+"'>":t+="<span class='swatch-color' style='background-color:"+e+"'></span>",t+="<input type='text' value='"+e+"'><button type='button' class='fa fa-times'></button></p>"}function bu(e){var t=e.target,n=t.value,r=t.parentNode;if(!n)return r.parentNode.removeChild(r),void hu();var a=ge(n);if(!a)return console.warn("bad color",n),void(qo.point(t).text(n+" is not a valid color").draw()._getElement().style.zIndex=115);"color"==e.target.type?t.nextSibling.value=n:au()?t.previousSibling.value=a.hex():t.previousSibling.style.backgroundColor=n,hu()}var gu,vu,mu,yu={initialize:function(t,e){e.choices&&ru(e.choices),t.type="text",t.classList.add("colors");var n=document.createElement("span");n.setAttribute("class","color-swatches"),t.parentNode.insertBefore(n,t);var r=t.getAttribute("name")+"-dropdown";Gf[r]=Cf(t,r,iu(),!1,ou),t.addEventListener("change",function(e){t.value==nu?(e.stopImmediatePropagation(),t.value="",function(e){Zf=e;var t=($f=Xf({type:"div",attributes:{class:"palette"}})).querySelector(".palette"),n=function(e,t){t||(t=e.parentNode.querySelector(".color-swatches"));for(var n=[],r=0;r<t.childNodes.length;r++)t.childNodes[r].classList.contains("fa")||n.push(ge(t.childNodes[r].style.backgroundColor).hex());return n}(e),r="";n.forEach(function(e){r+=pu(e)}),r+="<p><button class='fa fa-plus-square clickable'></button></p>",t.innerHTML=r,t.addEventListener("change",bu),t.addEventListener("dragstart",fu),t.addEventListener("dragover",uu),t.addEventListener("drop",su),t.addEventListener("dragend",lu),t.addEventListener("click",du)}(t)):cu(t,(t.getAttribute("data-value")||"").split("|"))})},update:cu,getValue:function(e){var t=e.getAttribute("data-value");return t?t.split("|"):null},replaceThemeColors:ru},wu=void 0;function _u(e){this&&(e=this),Q(e.parentNode).classed("open",function(){return!Q(this).classed("open")})}function xu(e){if(e){wu={};for(var t=0,n=null,r=null,a=gu&&gu.user?gu.user.template_settings_overrides:{},i=0;i<e.length;i++){var o=e[i];if("string"!=typeof o){if("object"!=typeof o||n||r||(t++,r=mu.append("div").attr("class","toplevel-settings-block")),"hidden"!==o.type){var c=n||r;if(o.new_section&&(c.append("div").classed("settings-divider",!0),"string"==typeof o.new_section&&c.append("h3").classed("settings-subhead",!0).text(o.new_section)),void 0!==o.show_if){if(o.show_condition)throw new Error("BUG: show_if present as well as show_condition");o.show_condition=[{type:"show",condition:o.show_if}],delete o.show_if}else if(void 0!==o.hide_if){if(o.show_condition)throw new Error("BUG: hide_if present as well as show_condition");o.show_condition=[{type:"hide",condition:o.hide_if}],delete o.hide_if}wu[o.property]=o.type,Cu(c.append("div"),o,a)}}else r=null,(n=mu.append("div").attr("class","settings-block")).append("h2").attr("class","no-select").attr("tabindex","0").text(o).on("click",_u).on("keyup",function(){13===z.keyCode&&_u(this)}),n.classed("open",t<1),"State documentation"===o&&n.style("display","none"),t++}K(".upgrade-setting").on("click",function(){!function(e,t,n,r,a){var i=[],o=[];a?(i.push(["Upgrade to a business account so you can:"]),o.push(["Add custom logos, colours and styles to keep projects on-brand","Remove Flourish logo","Manage your team with collaboration and approval features","And <a href='https://flourish.studio/pricing' target='_blank'>many other benefits</a>"])):(i.push(["Upgrade your account to:"]),o.push(["Keep your data and projects private","Download projects","Get priority support"]));var c=Math.floor(Math.random()*i.length),f=Math.floor(Math.random()*o.length),u="title"+c+"-list"+f,s="upgrade-click",l=[];a?l.push({text:"Email us",class:"convert",tag_name:"a",href:"mailto:sales@flourish.studio?subject=Business%20upgrade%20enquiry",keyCode:13,callback:function(){e.analytics("send","event",s,r,u),Wf.logHistory({category:"upgrade",action:"clicked",detail:r})}}):l.push({text:"Upgrade now",class:"convert",keyCode:13,callback:function(){e.analytics("send","event",s,r,u),Wf.logHistory({category:"upgrade",action:"clicked",detail:r}),setTimeout(function(){window.location.href="/choose-subscription"},1e3)}}),l.push({text:"Maybe later",keyCode:27,class:"secondary",callback:function(){e.analytics("send","event","upgrade-close",r,u),Wf.logHistory({category:"upgrade",action:"closed",detail:r})}}),e.analytics("send","event","upgrade-open",r,u),Wf.logHistory({category:"upgrade",action:"viewed",detail:r}),xc(t,n,l,!0,{message:i[c],list:o[f],is_business:a})}(gu,"This is a premium feature","Upgrade your plan to change this setting.","upgrade-settings",!0)}),Xo()}}function Cu(e,i,t){i.upgrade=i.property in t;var n=i.choices&&("buttons"==i.style||"boolean"==i.type);e.attr("class","settings-option option-type-"+i.type+(n?" settings-buttons":"")+(i.upgrade?" upgrade-setting":""));var r=e.append("label").attr("for","setting-"+i.property).classed("hidden",null==i.name).append("h3").text(i.name).classed("no-select",!0);i.upgrade?r.append("i").attr("class","popup fa fa-star setting-tooltip tooltip-upgrade").style("font-family","FontAwesome").style("background-color","#93366e").attr("data-popup-head","This is a premium feature").attr("data-popup-body",i.description?i.description.replace(/\[\[/g,"").replace(/\]\]/g,""):"").attr("data-popup-position","top"):i.description&&r.append("i").attr("class","popup fa fa-question setting-tooltip tooltip-help").style("font-family","FontAwesome").attr("data-popup-body",i.description.replace(/\[\[/g,"").replace(/\]\]/g,"")).attr("data-popup-position","top"),i.width&&e.classed("width-"+i.width.replace(/ /g,"-"),!0);var a="input";if("text"!=i.type&&"code"!=i.type||(a="textarea"),"code"==i.type){var o=!1;e.append("i").attr("class","popup fa fa-reply clickable wrap-control").attr("data-popup-body","Wrap/unwrap text").attr("data-popup-position","top").on("click",function(){o=!o,Q(this.parentNode).select("textarea").attr("wrap",o?null:"off"),Q(this).classed("selected",o)})}var c=e.append(a).attr("id","setting-"+i.property).attr("name",i.property).attr("disabled",!gu.visualisation.can_edit||null),f=c.node();if("colors"==i.type)yu.initialize(f,i);else if("font"==i.type)Pf.initialize(f,i,gu.user&&null!=gu.user.company_id);else if("number"==i.type)f.setAttribute("type","number"),null!=i.min&&f.setAttribute("min",i.min),null!=i.max&&f.setAttribute("max",i.max),i.step&&f.setAttribute("step",i.step);else if("url"==i.type)f.setAttribute("type","url"),vu.addButton(f,i.upgrade);else if(n){c.remove(),c=e.append("div").attr("id","setting-"+i.property).attr("name",i.property).classed("buttons-container",!0).classed("large","large"==i.size),f=c.node();var u=i.choices.length,s=[3,4,5],l=function(){if(u<=2)return{column_count:u,rows:1};var e=s.map(function(e){return{column_count:e,orphans:u%e/e,rows:u/e}}).filter(function(e){return 1<=e.rows}).sort(function(e,t){return e.rows>t.rows?1:e.rows<t.rows?-1:0}),t=e.filter(function(e){return 0===e.orphans});return 1===t.length?t[0]:1<t.length?t[0]:0===t.length?e.sort(function(e,t){return e.orphans>t.orphans?-1:e.orphans<t.orphans?1:0})[0]:void 0}();i.choices.forEach(function(e,r){c.append("input").attr("type","radio").attr("name",i.property).attr("value",e[1]).attr("id",i.property+"_"+r).attr("disabled",!gu.visualisation.can_edit||null).call(Au(i));var t=c.append("label").attr("for",i.property+"_"+r).style("width",100/l.column_count+"%").style("background-image",e[2]?"url("+e[2]+")":null).style("border-radius",function(){var e=l.column_count,t=Math.ceil(l.rows),n=e*t-u;return t<=1?0===r?"3px 0 0 3px":r===e-1?"0 3px 3px 0":null:1<t?0===r?"3px 0 0 0":r===e-1?"0 3px 0 0":r===u-(e-n)?"0 0 0 3px":r===u-1&&0===n?"0 0 3px 0":null:null}),n=e[0].match(/fa-(\S*)/g),a=e[0].match(/^data:image\/(svg|png|jpg);base64,[A-Z-a-z0-9+/=]*$/);n?t.append("i").attr("class","fa "+n[0]):a?t.append("img").attr("src",e[0]):t.text(e[0])})}else"boolean"==i.type?(f.setAttribute("type","checkbox"),e.append("label").attr("class","slider").attr("for","setting-"+i.property)):f.setAttribute("type","text");if("code"==i.type&&(f.setAttribute("wrap","off"),c.on("keydown.tab",function(){var e=z;if(9===e.keyCode&&!(e.altKey||e.metaKey||e.ctrlKey||e.shiftKey)){e.preventDefault();var t=this.selectionStart;this.value=this.value.substring(0,t)+"\t"+this.value.substring(this.selectionEnd),this.selectionEnd=t+1}})),i.choices&&"string"==i.type&&"buttons"!=i.style&&Cf(f,i.property+"-dropdown",i.choices,i.choices_other),"color"==i.type){Q(f).classed("color",!0).style("display","none");var d=Q(f.parentNode).append("div").attr("class","color-picker");i.optional&&d.append("button").attr("class","cancel-setting popup").html("<svg><use xlink:href='#cancel-setting'></use></svg>").attr("data-popup-body","If cleared, the color will be set automatically based on the theme or context").on("click",function(){f.value="",c.dispatch("change"),Q(this.parentNode).classed("is-null",!0)}),d.append("div").attr("class","color-wrapper").append("input").attr("type","color").on("change",function(){f.value=this.value,c.dispatch("change"),Q(this.parentNode.parentNode).classed("is-null",!1)}).on("focus",function(){Q(this.parentNode.parentNode).classed("active",!0)}).on("blur",function(){Q(this.parentNode.parentNode).classed("active",!1)})}i.placeholder&&f.setAttribute("placeholder",i.placeholder),i.size&&f.classList.add("size-"+i.size),c.call(Au(i))}function Au(l){return function(e){var s=!1;e.on("change",function(){var u=this;qo.hide(),s=!0,gu.preview_pane.getState(l.property,function(e,r){return e?(console.error("Failed to get state property "+l.property,e),void(s=!1)):function(e,t){if("number"!==t.type)return!0;if(""===e.value)return!!t.optional||(qo.point(e).text("A value is required").draw(),!1);var n=parseFloat(e.value);return t.hasOwnProperty("min")&&n<t.min?(qo.point(e).text("Value cannot be less than "+t.min).draw(),e.value=t.min):t.hasOwnProperty("max")&&n>t.max&&(qo.point(e).text("Value cannot be greater than "+t.max).draw(),e.value=t.max),!0}(u,l)?(t=u,a=function(e){if(!e)return s=!1,void("SELECT"==u.tagName&&Q(u).dispatch("blur"));var t="radio"==u.type?u.nextSibling:u;qo.point(t).text("Not changed: "+e).draw();var n={};n[l.property]=r,gu.preview_pane.setState(n,function(e){if(e)return console.error("Failed to revert setting "+l.property+" to value: "+r),void(s=!1);gu.preview_pane.update(function(e){if(e)return console.error("Failed to update after reverting setting "+l.property+" to value: "+r),void(s=!1);Du(u,r),s=!1})})},i=(n=l).property,o=100,c=Eu,f=[t,n,a],clearTimeout(Tu[i]),void(Tu[i]=setTimeout(function(){c.apply(window,f),delete Tu[i]},o))):(u.value=r,void(s=!1));var t,n,a,i,o,c,f})}).on("keydown",function(){gu.confirm.blank(),13==z.keyCode&&qo.hide()}).on("blur",function(){if(!s){var n=this;qo.hide(),gu.preview_pane.getState(l.property,function(e,t){e?console.error("Failed to get state property "+l.property,e):Du(n,t)})}})}}var Tu={};function Mu(e,t,n){if(e.classList.contains("colors"))return yu.getValue(e);if(e.classList.contains("font-menu")){var r=Pf.getValue(e);return t&&!r?n?null:"":r}if(e.classList.contains("buttons-container")){for(var a,i=e.querySelectorAll("input[type='radio']"),o=0;o<i.length;o++)if(i[o].checked){a=i[o];break}if(!a)return n?null:"";e=a}switch(e.getAttribute("type")){case"checkbox":return e.checked;case"number":return t&&!e.value.length?n?null:"":+e.value;case"radio":if(e.parentNode.parentNode.classList.contains("option-type-boolean"))return"true"==e.value;default:return t&&e.classList.contains("color")&&!e.value.length?n?null:"":e.hasAttribute("data-value")?e.getAttribute("data-value"):e.value}}function Du(e,t){if(e.classList.contains("colors"))yu.update(e,t);else if(e.classList.contains("font-menu"))Pf.update(e,t);else if("checkbox"==e.getAttribute("type"))e.checked=t;else if(e.classList.contains("color"))e.value=t,Q(e.parentNode).select(".color-picker").classed("is-null",null===t),Q(e.parentNode).select(".color-wrapper input").node().value=t;else if(e.getAttribute("data-autocomplete")){for(var n=function(e){for(var t=0;t<gu.settings.length;t++){var n=gu.settings[t];if(n.property===e)return n}}(e.name),r=0;r<n.choices.length;r++){var a,i,o=n.choices[r];if("string"==typeof o?a=i=o:(a=o[1],i=o[0]),t==a)return e.value=i,void e.setAttribute("data-value",a)}e.value=t,e.setAttribute("data-value",t)}else if(-1<e.className.indexOf("buttons-container")){var c=e.querySelectorAll("input[type='radio']");for(r=0;r<c.length;r++)c[r].value===""+t&&(c[r].checked=!0)}else e.value=t}function Eu(r,e,a){var t={},n=Mu(r,e.optional);if(t[e.property]=n,"choices"in e&&"colors"!==e.type&&(o=n,!(i=e).choices_other&&-1===i.choices.map(function(e){return e instanceof Array?e[1]:e}).indexOf(o)))a&&a("You can only choose values from the list");else{var i,o;gu.confirm.saving();var c=!1,f={};f[e.property]=Mu(r,e.optional,!0),gu.preview_pane.setState(f,function(e){if(e)return u(e);gu.preview_pane.update(function(e){if(e)return u(e);gu.visualisation.updateSettings(t,function(e){if(e)return u(e);gu.analytics("send","event","visualisation","change_setting",gu.visualisation.id),Fu(),gu.confirm.saved(),a&&a()})})})}function u(n){c||(gu.preview_pane.getState(e.property,function(e,t){if(e)return console.error("Failed to get state",e),void gu.confirm.error(e);Du(r,t),Fu(),gu.confirm.blank(),a&&a(n)}),c=!0)}}function ku(e,t){return/^data\./.test(e)?(n=t,r=e.split("."),gu.visualisation.__sdk__?function(e,t){for(var n=null,r=gu.template_data_bindings,a=0;a<r.length;a++){var i=r[a];if("string"!=typeof i&&i.dataset===e[1]&&i.key===e[2]){n=i;break}}if(!n)throw new Error("Bug: data binding not found - these should already have been checked");return"column"===n.type?!!n.column===t:!!n.columns.split("::")[1]===t}(r,n):(a=r,i=n,!!document.getElementById("data-binding-"+a[1]+"-"+a[2]).value===i)):function(e,t){var n=document.getElementById("setting-"+e);if(!n)return console.error("Could not find input for setting",e),!1;var r=Mu(n);if(t instanceof Array)return-1!==t.indexOf(r);return r===t}(e,t);var n,r,a,i}function Fu(){gu.settings.filter(function(e){return"object"==typeof e&&"show_condition"in e}).forEach(function(e){var t=e.show_condition.every(function(e){var t="show"===e.type,n=e.condition;if("boolean"==typeof n)return t===n;if("string"==typeof n)return t===ku(n,!0);for(var r in n)if(!ku(r,n[r]))return!1===t;return t}),n=document.getElementById("setting-"+e.property);if(n){for(var r=n;!r.classList.contains("settings-option");)r=r.parentNode;if(Q(r).classed("hidden",!t),e.new_section)for(var a=r.previousSibling;a&&(Q(a).classed("settings-divider")||Q(a).classed("settings-subhead"));)Q(a).classed("hidden",!t),a=a.previousSibling}else console.error("Could not find input",e.property)});for(var e=document.querySelectorAll(".template-settings .settings-block"),t=0;t<e.length;t++){var n=e[t];n.classList.contains("hidden")?null!==n.querySelector(".settings-option:not(.hidden)")&&n.classList.remove("hidden"):null==n.querySelector(".settings-option:not(.hidden)")&&n.classList.add("hidden")}}function Su(e,t,n){return gu=e,vu=Pc(),(mu=Q(".side-panel .template-settings")).on("submit",function(){z.preventDefault()}),yu.replaceThemeColors(t),Pf.replaceThemeFonts(n),xu(gu.settings),Q(".side-panel-scrollbox").on("scroll",function(){qo.hide()}),{update:function(e){mu.html(""),Q(".current-template").style("opacity","1"),xu(gu.settings=e)},populate:function(){gu.preview_pane.getState(function(e,t){if(e)console.error("Failed to get state",e);else{var n=function e(t,n,r){for(var a in n||(n=[]),r||(r={}),t)n.push(a),"object"==typeof t[a]&&e(t[a],n,r),r[n.join(".")]=t[a],n.pop();return r}(t);for(var r in n){var a=document.getElementById("setting-"+r);a&&Du(a,n[r])}Fu()}})},getSettingsForCurrentTemplate:function(){return wu}}}function Nu(e,t,n){function r(){}this.visualisation=e,this.settings=t,this.template_data_bindings=n,this.template_settings=Su(this),hc(this),this.preview_pane=function(e){sf=e;var t=gf();return{loadTemplate:wf,updateData:_f,sync:(lf=uf("iframe#preview","editor",sf,t)).sync,setState:lf.setState,getState:lf.getState,hasData:lf.hasData,setData:lf.setData,getData:lf.getData,draw:lf.draw,update:lf.update,getDefaultState:lf.getDefaultState,snapshot:lf.snapshot,setFixedHeight:lf.setFixedHeight,resize:lf.resize}}(this),this.responsive_menu=No(this),this.confirm={on:r,blank:r,saved:r,saving:r,error:r},this.analytics=r,this.tour={fireEvent:r}}var Uu={},Lu={};function Bu(e){return new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}")}function Hu(e){var n=Object.create(null),r=[];return e.forEach(function(e){for(var t in e)t in n||r.push(n[t]=t)}),r}function Ou(e,t){var n=e+"",r=n.length;return r<t?new Array(t-r+1).join(0)+n:n}function Pu(e){var t,n=e.getUTCHours(),r=e.getUTCMinutes(),a=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+Ou(-t,6):9999<t?"+"+Ou(t,6):Ou(t,4))+"-"+Ou(e.getUTCMonth()+1,2)+"-"+Ou(e.getUTCDate(),2)+(i?"T"+Ou(n,2)+":"+Ou(r,2)+":"+Ou(a,2)+"."+Ou(i,3)+"Z":a?"T"+Ou(n,2)+":"+Ou(r,2)+":"+Ou(a,2)+"Z":r||n?"T"+Ou(n,2)+":"+Ou(r,2)+"Z":"")}function ju(r){var t=new RegExp('["'+r+"\n\r]"),l=r.charCodeAt(0);function n(r,e){var t,n=[],a=r.length,i=0,o=0,c=a<=0,f=!1;function u(){if(c)return Lu;if(f)return f=!1,Uu;var e,t,n=i;if(34===r.charCodeAt(n)){for(;i++<a&&34!==r.charCodeAt(i)||34===r.charCodeAt(++i););return(e=i)>=a?c=!0:10===(t=r.charCodeAt(i++))?f=!0:13===t&&(f=!0,10===r.charCodeAt(i)&&++i),r.slice(n+1,e-1).replace(/""/g,'"')}for(;i<a;){if(10===(t=r.charCodeAt(e=i++)))f=!0;else if(13===t)f=!0,10===r.charCodeAt(i)&&++i;else if(t!==l)continue;return r.slice(n,e)}return c=!0,r.slice(n,a)}for(10===r.charCodeAt(a-1)&&--a,13===r.charCodeAt(a-1)&&--a;(t=u())!==Lu;){for(var s=[];t!==Uu&&t!==Lu;)s.push(t),t=u();e&&null==(s=e(s,o++))||n.push(s)}return n}function a(e,n){return e.map(function(t){return n.map(function(e){return o(t[e])}).join(r)})}function i(e){return e.map(o).join(r)}function o(e){return null==e?"":e instanceof Date?Pu(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,i){var o,c,t=n(e,function(e,t){if(o)return o(e,t-1);var n,r,a;c=e,o=i?(r=i,a=Bu(n=e),function(e,t){return r(a(e),t,n)}):Bu(e)});return t.columns=c||[],t},parseRows:n,format:function(e,t){return null==t&&(t=Hu(e)),[t.map(o).join(r)].concat(a(e,t)).join("\n")},formatBody:function(e,t){return null==t&&(t=Hu(e)),a(e,t).join("\n")},formatRows:function(e){return e.map(i).join("\n")}}}var Yu=ju(",").parseRows,qu=(ju("\t"),"$");function Iu(){}function zu(e,t){var n=new Iu;if(e instanceof Iu)e.each(function(e,t){n.set(t,e)});else if(Array.isArray(e)){var r,a=-1,i=e.length;if(null==t)for(;++a<i;)n.set(a,e[a]);else for(;++a<i;)n.set(t(r=e[a],a,e),r)}else if(e)for(var o in e)n.set(o,e[o]);return n}function Ru(){}Iu.prototype=zu.prototype={constructor:Iu,has:function(e){return qu+e in this},get:function(e){return this[qu+e]},set:function(e,t){return this[qu+e]=t,this},remove:function(e){var t=qu+e;return t in this&&delete this[t]},clear:function(){for(var e in this)e[0]===qu&&delete this[e]},keys:function(){var e=[];for(var t in this)t[0]===qu&&e.push(t.slice(1));return e},values:function(){var e=[];for(var t in this)t[0]===qu&&e.push(this[t]);return e},entries:function(){var e=[];for(var t in this)t[0]===qu&&e.push({key:t.slice(1),value:this[t]});return e},size:function(){var e=0;for(var t in this)t[0]===qu&&++e;return e},empty:function(){for(var e in this)if(e[0]===qu)return!1;return!0},each:function(e){for(var t in this)t[0]===qu&&e(this[t],t.slice(1),this)}};var Wu=zu.prototype;Ru.prototype=function(e,t){var n=new Ru;if(e instanceof Ru)e.each(function(e){n.add(e)});else if(e){var r=-1,a=e.length;if(null==t)for(;++r<a;)n.add(e[r]);else for(;++r<a;)n.add(t(e[r],r,e))}return n}.prototype={constructor:Ru,has:Wu.has,add:function(e){return this[qu+(e+="")]=e,this},remove:Wu.remove,clear:Wu.clear,values:Wu.keys,size:Wu.size,empty:Wu.empty,each:Wu.each};var Xu,Vu,$u={value:function(){}};function Zu(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r)throw new Error("illegal type: "+e);r[e]=[]}return new Ju(r)}function Ju(e){this._=e}function Gu(e,t){for(var n,r=0,a=e.length;r<a;++r)if((n=e[r]).name===t)return n.value}function Qu(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=$u,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}function Ku(e,t,n){var r;r="object"==typeof t?t.id:t,this.id=r,this.visualisation=e,this.api_prefix="/api/data_table"}function es(e){return e.map(function(e){return null!=e&&"object"==typeof e&&"map"in e?es(e):e})}function ts(e){this.id=e}function ns(e,t){var n=[],r=[],a=0,i=[];for(var o in i.column_names={},e)if(void 0!==e[o].columns||void 0!==e[o].column){var c=e[o];if(c.key=o,c.data_table_id in t){var f=t[c.data_table_id];if(0!=f.length){if("columns"in c&&null!=c.columns){var u=f[0].length;c.columns=c.columns.filter(function(e){return e<u}),i.column_names[o]=c.columns.map(function(e){return t[c.data_table_id][0][e]})}else{if(!("column"in c&&null!=c.column))throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(c));i.column_names[o]=f[0][c.column]}-1==r.indexOf(c.data_table_id)&&(r.push(c.data_table_id),a=Math.max(a,t[c.data_table_id].length-1)),n.push(c)}else console.warn("Empty data table")}else{var s=[];for(var l in t)s.push(l);console.error("Data table id "+c.data_table_id+" not in "+JSON.stringify(s))}}for(var d=0;d<a;d++){for(var h={},p=0;p<n.length;p++){c=n[p];var b=t[c.data_table_id];d+1>=b.length||("columns"in c&&null!=c.columns?h[c.key]=c.columns.filter(function(e){return e<b[d+1].length}).map(function(e){return b[d+1][e]}):"column"in c&&null!=c.column&&(c.column>=b[d+1].length?h[c.key]="":h[c.key]=b[d+1][c.column]))}i.push(h)}return i}function rs(e,t,n){var r=this;r.id=1,r.template_id=1,r.api_prefix="/api/visualisation",r.can_edit=!0,r.__sdk__=!0,n.data_tables&&(this.data_tables=n.data_tables.map(function(e){return new Ku(r,e)})),n.data_bindings&&(this.data_bindings=n.data_bindings)}Ju.prototype=Zu.prototype={constructor:Ju,on:function(e,t){var n,r,a=this._,i=(r=a,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(0<=n&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,c=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o<c;)if(n=(e=i[o]).type)a[n]=Qu(a[n],e.name,t);else if(null==t)for(n in a)a[n]=Qu(a[n],e.name,null);return this}for(;++o<c;)if((n=(e=i[o]).type)&&(n=Gu(a[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Ju(e)},call:function(e,t){if(0<(n=arguments.length-2))for(var n,r,a=new Array(n),i=0;i<n;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(r=this._[e]).length;i<n;++i)r[i].value.apply(t,a)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,i=r.length;a<i;++a)r[a].value.apply(t,n)}},Ku.prototype.csv=function(n){if(this.cached_data)n(void 0,es(this.cached_data));else{var r=this;!function(a,e){var i,o,c,f,u=Zu("beforesend","progress","load","error"),s=zu(),l=new XMLHttpRequest,d=null,h=null,p=0;function t(e){var t,n,r,a=l.status;if(!a&&((r=(n=l).responseType)&&"text"!==r?n.response:n.responseText)||200<=a&&a<300||304===a){if(c)try{t=c.call(i,l)}catch(e){return void u.call("error",i,e)}else t=l;u.call("load",i,t)}else u.call("error",i,e)}if("undefined"==typeof XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(a)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=t:l.onreadystatechange=function(e){3<l.readyState&&t(e)},l.onprogress=function(e){u.call("progress",i,e)},i={header:function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s.get(e):(null==t?s.remove(e):s.set(e,t+""),i)},mimeType:function(e){return arguments.length?(o=null==e?null:e+"",i):o},responseType:function(e){return arguments.length?(f=e,i):f},timeout:function(e){return arguments.length?(p=+e,i):p},user:function(e){return arguments.length<1?d:(d=null==e?null:e+"",i)},password:function(e){return arguments.length<1?h:(h=null==e?null:e+"",i)},response:function(e){return c=e,i},get:function(e,t){return i.send("GET",e,t)},post:function(e,t){return i.send("POST",e,t)},send:function(e,t,n){var r;return l.open(e,a,!0,d,h),null==o||s.has("accept")||s.set("accept",o+",*/*"),l.setRequestHeader&&s.each(function(e,t){l.setRequestHeader(t,e)}),null!=o&&l.overrideMimeType&&l.overrideMimeType(o),null!=f&&(l.responseType=f),0<p&&(l.timeout=p),null==n&&"function"==typeof t&&(n=t,t=null),null!=n&&1===n.length&&(r=n,n=function(e,t){r(null==e?t:null)}),null!=n&&i.on("error",n).on("load",function(e){n(null,e)}),u.call("beforesend",i,l),l.send(null==t?null:t),i},abort:function(){return l.abort(),i},on:function(){var e=u.on.apply(u,arguments);return e===u?i:e}},null==e)return;if("function"!=typeof e)throw new Error("invalid callback: "+e);i.get(e)}(this.api_prefix+"/"+this.id+"/csv",function(e,t){r.cached_data=Yu(t.response),n(void 0,es(r.cached_data))})}},Ku.prototype.saveData=function(e,t){t()},Ku.prototype.save=function(e,t){t()},Ku.prototype.delete=function(e){e()},ts.prototype.getSettings=function(e){e(void 0,window.Flourish.app.settings)},ts.prototype.getDataBindings=function(e){e(void 0,window.Flourish.app.template_data_bindings)},ts.prototype.refreshDataBindings=function(e){e(void 0)},Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e){if(null==this)throw new TypeError("this is null or not defined");var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var r=arguments[1],a=0;a<n;){var i=t[a];if(e.call(r,i,a,t))return a;a++}return-1},configurable:!0,writable:!0}),rs.prototype.save=function(e,t){this.version_number++,t(void 0)},rs.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new ts(this.template_id)),this._template):null},rs.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},rs.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},rs.prototype.refreshDataBindings=function(e){e()},rs.prototype.updateDataBindings=function(e,t){this.version_number++,this.data_bindings||(this.data_bindings={}),this.template_id in this.data_bindings||(this.data_bindings[this.template_id]={});var n=this.data_bindings[this.template_id];for(var r in e)for(var a in e[r]){var i=e[r][a];n[r][a]=i}t(void 0)},rs.prototype.updateSettings=function(e,t){this.version_number++,this.settings||(this.settings={}),this.template_id in this.settings||(this.settings[this.template_id]={});var n=this.settings[this.template_id];for(var r in e){var a=e[r];n[r]=a}t(void 0)},rs.prototype.getDataTables=function(e){e(void 0,window.Flourish.app.data_tables)},rs.prototype.dataTables=function(e){var r=this;r.data_tables?e(void 0,r.data_tables):(r.after_loading_data_tables||(r.after_loading_data_tables=[]),r.after_loading_data_tables.push(e),1<r.after_loading_data_tables.length||r.getDataTables(function(e,t){if(e){for(var n=0;n<r.after_loading_data_tables.length;n++)r.after_loading_data_tables[n](e);r.after_loading_data_tables=[]}else{r.data_tables=t.map(function(e){return new Ku(r,e)});for(n=0;n<r.after_loading_data_tables.length;n++)r.after_loading_data_tables[n](void 0,r.data_tables);r.after_loading_data_tables=[]}}))},rs.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},rs.prototype.prepareData=function(f){var u=this.dataBindingsForCurrentTemplate();this.dataTables(function(e,i){if(e)return f(e);for(var o={},c=0,t=0;t<i.length;t++)!function(a){a.csv(function(e,t){if(e)throw e;if(o[a.id]=t,++c==i.length){var n={};for(var r in u)n[r]=ns(u[r],o);f(void 0,n)}})}(i[t]);0==i.length&&f(void 0,{})})},rs.prototype.createDataTable=function(e,t){t()},rs.prototype.getDataTableNames=function(){return void 0===this.data_table_names&&(this.data_table_names=function(e){for(var t={},n=0;n<e.length;n++){var r=e[n];t[r.id]=r.name}return t}(this.data_tables)),this.data_table_names},rs.prototype.getDataTableIds=function(){return void 0===this.data_table_ids&&(this.data_table_ids=function(e){for(var t={},n=0;n<e.length;n++){var r=e[n];t[r.name]=r.id}return t}(this.data_tables)),this.data_table_ids};var as=!(rs.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0});function is(){Xu&&Xu.classList.remove("shown")}function os(){this.close(),as||(Xu&&setTimeout(function(){Xu.classList.add("shown")},1e3),setTimeout(cs,250))}function cs(){fs().addEventListener("open",function(){window.location.reload()})}function fs(){var e=new window.WebSocket(Vu);return e.addEventListener("open",is),e.addEventListener("close",os),e}return e.Visualisation=rs,e.initSDK=function(e,t,n){Xo(),window.Flourish=window.Flourish||{},window.Flourish.app=new Nu(e,t,n)},e.talkToServer=function(){Xu=document.getElementById("error-server-down"),Vu=window.location.origin.replace(/^http(s?):\/\//,"ws$1://"),window.addEventListener("beforeunload",function(){as=!0}),fs()},e}({});
1
+ var Flourish=function(t){"use strict";function e(t){return parseInt(t).toString()===""+t&&t>=0}function n(t,e,n){return t.map((function(t){var r={};return Object.keys(e).forEach((function(n){r[n]=t[e[n]]})),Object.keys(n).forEach((function(e){var i=n[e];Array.isArray(i)||(i=[i]),r[e]=i.map((function(e){return t[e]}))})),r}))}function r(t,e,r){var i=n(t,e=e||{},r=r||{});return i.column_names={},Object.keys(e).forEach((function(t){i.column_names[t]=e[t]})),Object.keys(r).forEach((function(t){var e=r[t];i.column_names[t]=Array.isArray(e)?e:[e]})),i}function i(t,r,i){!function(t,n){var r;if(!Object.keys(t).every((function(n){return e(t[n])})))throw r="All column_bindings values should be non-negative integers",new TypeError(r);if(!Object.keys(n).every((function(t){var r=n[t];return Array.isArray(r)?r.every(e):e(r)})))throw r="All columns_bindings values should be non-negative integers or arrays thereof",new TypeError(r)}(r=r||{},i=i||{});var a=t[0],o=n(t.slice(1),r,i);return o.column_names={},Object.keys(r).forEach((function(t){o.column_names[t]=a[r[t]]})),Object.keys(i).forEach((function(t){var e=i[t];o.column_names[t]=(Array.isArray(e)?e:[e]).map((function(t){return a[t]}))})),o}function a(t,e,n){return(Array.isArray(t[0])?i:r)(t,e,n)}var o="http://www.w3.org/1999/xhtml",s={svg:"http://www.w3.org/2000/svg",xhtml:o,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function u(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),s.hasOwnProperty(e)?{space:s[e],local:t}:t}function l(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===o&&e.documentElement.namespaceURI===o?e.createElement(t):e.createElementNS(n,t)}}function c(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function d(t){var e=u(t);return(e.local?c:l)(e)}function f(){}function p(t){return null==t?f:function(){return this.querySelector(t)}}function h(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function m(){return[]}function v(t){return null==t?m:function(){return this.querySelectorAll(t)}}function g(t){return function(){return this.matches(t)}}function y(t){return function(e){return e.matches(t)}}var _=Array.prototype.find;function b(){return this.firstElementChild}var w=Array.prototype.filter;function x(){return this.children}function A(t){return new Array(t.length)}function E(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function C(t){return function(){return t}}function T(t,e,n,r,i,a){for(var o,s=0,u=e.length,l=a.length;s<l;++s)(o=e[s])?(o.__data__=a[s],r[s]=o):n[s]=new E(t,a[s]);for(;s<u;++s)(o=e[s])&&(i[s]=o)}function k(t,e,n,r,i,a,o){var s,u,l,c=new Map,d=e.length,f=a.length,p=new Array(d);for(s=0;s<d;++s)(u=e[s])&&(p[s]=l=o.call(u,u.__data__,s,e)+"",c.has(l)?i[s]=u:c.set(l,u));for(s=0;s<f;++s)l=o.call(t,a[s],s,a)+"",(u=c.get(l))?(r[s]=u,u.__data__=a[s],c.delete(l)):n[s]=new E(t,a[s]);for(s=0;s<d;++s)(u=e[s])&&c.get(p[s])===u&&(i[s]=u)}function D(t){return t.__data__}function F(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function S(t){return function(){this.removeAttribute(t)}}function M(t){return function(){this.removeAttributeNS(t.space,t.local)}}function N(t,e){return function(){this.setAttribute(t,e)}}function L(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function O(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function U(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function R(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function B(t){return function(){this.style.removeProperty(t)}}function j(t,e,n){return function(){this.style.setProperty(t,e,n)}}function H(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function I(t,e){return t.style.getPropertyValue(e)||R(t).getComputedStyle(t,null).getPropertyValue(e)}function P(t){return function(){delete this[t]}}function q(t,e){return function(){this[t]=e}}function z(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Y(t){return t.trim().split(/^|\s+/)}function $(t){return t.classList||new V(t)}function V(t){this._node=t,this._names=Y(t.getAttribute("class")||"")}function W(t,e){for(var n=$(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function G(t,e){for(var n=$(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function X(t){return function(){W(this,t)}}function J(t){return function(){G(this,t)}}function Z(t,e){return function(){(e.apply(this,arguments)?W:G)(this,t)}}function K(){this.textContent=""}function Q(t){return function(){this.textContent=t}}function tt(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function et(){this.innerHTML=""}function nt(t){return function(){this.innerHTML=t}}function rt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function it(){this.nextSibling&&this.parentNode.appendChild(this)}function at(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ot(){return null}function st(){var t=this.parentNode;t&&t.removeChild(this)}function ut(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function lt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ct(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function dt(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,a=e.length;r<a;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function ft(t,e,n){return function(){var r,i=this.__on,a=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var o=0,s=i.length;o<s;++o)if((r=i[o]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),void(r.value=e);this.addEventListener(t.type,a,n),r={type:t.type,name:t.name,value:e,listener:a,options:n},i?i.push(r):this.__on=[r]}}function pt(t,e,n){var r=R(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function ht(t,e){return function(){return pt(this,t,e)}}function mt(t,e){return function(){return pt(this,t,e.apply(this,arguments))}}E.prototype={constructor:E,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)}},V.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var vt,gt,yt,_t,bt,wt=[null];function xt(t,e){this._groups=t,this._parents=e}function At(){return new xt([[document.documentElement]],wt)}function Et(t){return"string"==typeof t?new xt([[document.querySelector(t)]],[document.documentElement]):new xt([[t]],wt)}function Ct(t){return Et(d(t).call(document.documentElement))}function Tt(t){return"string"==typeof t?new xt([document.querySelectorAll(t)],[document.documentElement]):new xt([null==t?[]:h(t)],wt)}function kt(){if(!yt)return null;var t=yt.nodes()[1].value;if("custom"===_t&&""!=t){var e=parseInt(t,10);return isNaN(e)?null:e}return null}function Dt(){bt&&bt.preview_pane&&bt.preview_pane.setFixedHeight&&bt.preview_pane.setFixedHeight(kt())}function Ft(t,e=!1){_t=t,Dt(),"custom"===t?(Et("#editor-custom-inputs").style("opacity",1),Et(".preview-holder").style("width",yt.nodes()[0].value+"px").select("iframe").style("width",yt.nodes()[0].value+"px")):(Et("#editor-custom-inputs").style("opacity",0),Et(".preview-holder").attr("style",null).select("iframe").style("width",null)),e||Et(".preview-holder").style("max-width","none"),Tt("#preview-menu .preview-mode").classed("selected",(function(){return this.id=="editor-"+t})),Et("#editor-rotate").classed("active",(function(){return"auto"!==t})),Et(".row.editor").classed("mobile",(function(){return"mobile"==t})),Et(".row.editor").classed("tablet",(function(){return"tablet"==t})),Et(".preview-holder").on("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd transitionend",Mt),vt=t}function St(t){return bt=t,yt=Tt("#editor-custom-inputs input"),Mt(),Tt("#preview-menu .preview-mode").on("click",(function(){Ft(this.getAttribute("data-target"))})),yt.on("change",(function(){Ft(this.getAttribute("data-target"))})),Ft("auto",!0),function(){var t,e,n=document.querySelector("#resize-handle"),r=document.querySelector(".preview-holder");function i(i){"editor-custom"!==i.target.parentElement.id&&(t=r.getBoundingClientRect().width,n.parentElement.parentElement.querySelector("#resize-overlay").classList.add("dragging"),n.parentElement.classList.add("dragging"),e=i.clientX,Et(".preview-holder").style("transition","none"),Ft("custom"),document.addEventListener("mousemove",a),document.addEventListener("mouseup",o),i.preventDefault())}function a(n){var i=n.clientX-e,a=t+2*i;r.style.width=a+"px",r.querySelector("iframe").style.width=a-4+"px",Mt(),bt.preview_pane.resize()}function o(){t=r.getBoundingClientRect().width,Et(".preview-holder").style("transition",null),n.parentElement.parentElement.querySelector("#resize-overlay").classList.remove("dragging"),n.parentElement.classList.remove("dragging"),Mt(),bt.preview_pane.resize(),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",o)}n.addEventListener("mousedown",i)}
2
+ /*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.2.2/LICENSE */(),window.innerWidth<=768&&(gt="auto"),window.addEventListener("resize",(function(){vt&&Mt(),window.innerWidth<=768?gt||(gt=vt,Ft("auto")):gt&&(Ft(gt),gt=null),bt.preview_pane.resize()})),{getHeightSetting:kt}}function Mt(){var t=Et(".preview-holder").node().getBoundingClientRect();yt.nodes()[0].value=Math.round(t.width),""!==yt.nodes()[1].value&&"custom"===_t&&(yt.nodes()[1].value=Math.round(t.height))}xt.prototype=At.prototype={constructor:xt,select:function(t){"function"!=typeof t&&(t=p(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,o,s=e[i],u=s.length,l=r[i]=new Array(u),c=0;c<u;++c)(a=s[c])&&(o=t.call(a,a.__data__,c,s))&&("__data__"in a&&(o.__data__=a.__data__),l[c]=o);return new xt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:h(e)}}(t):v(t);for(var e=this._groups,n=e.length,r=[],i=[],a=0;a<n;++a)for(var o,s=e[a],u=s.length,l=0;l<u;++l)(o=s[l])&&(r.push(t.call(o,o.__data__,l,s)),i.push(o));return new xt(r,i)},selectChild:function(t){return this.select(null==t?b:function(t){return function(){return _.call(this.children,t)}}("function"==typeof t?t:y(t)))},selectChildren:function(t){return this.selectAll(null==t?x:function(t){return function(){return w.call(this.children,t)}}("function"==typeof t?t:y(t)))},filter:function(t){"function"!=typeof t&&(t=g(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,o=e[i],s=o.length,u=r[i]=[],l=0;l<s;++l)(a=o[l])&&t.call(a,a.__data__,l,o)&&u.push(a);return new xt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,D);var n=e?k:T,r=this._parents,i=this._groups;"function"!=typeof t&&(t=C(t));for(var a=i.length,o=new Array(a),s=new Array(a),u=new Array(a),l=0;l<a;++l){var c=r[l],d=i[l],f=d.length,p=h(t.call(c,c&&c.__data__,l,r)),m=p.length,v=s[l]=new Array(m),g=o[l]=new Array(m),y=u[l]=new Array(f);n(c,d,v,g,y,p,e);for(var _,b,w=0,x=0;w<m;++w)if(_=v[w]){for(w>=x&&(x=w+1);!(b=g[x])&&++x<m;);_._next=b||null}}return(o=new xt(o,r))._enter=s,o._exit=u,o},enter:function(){return new xt(this._enter||this._groups.map(A),this._parents)},exit:function(){return new xt(this._exit||this._groups.map(A),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,a=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(i=e(i)),null==n?a.remove():n(a),r&&i?r.merge(i).order():i},merge:function(t){if(!(t instanceof xt))throw new Error("invalid merge");for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),o=new Array(r),s=0;s<a;++s)for(var u,l=e[s],c=n[s],d=l.length,f=o[s]=new Array(d),p=0;p<d;++p)(u=l[p]||c[p])&&(f[p]=u);for(;s<r;++s)o[s]=e[s];return new xt(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],a=i.length-1,o=i[a];--a>=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=F);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var o,s=n[a],u=s.length,l=i[a]=new Array(u),c=0;c<u;++c)(o=s[c])&&(l[c]=o);l.sort(e)}return new xt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,a=e[n],o=0,s=a.length;o<s;++o)(i=a[o])&&t.call(i,i.__data__,o,a);return this},attr:function(t,e){var n=u(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?M:S:"function"==typeof e?n.local?U:O:n.local?L:N)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?B:"function"==typeof e?H:j)(t,e,null==n?"":n)):I(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?P:"function"==typeof e?z:q)(t,e)):this.node()[t]},classed:function(t,e){var n=Y(t+"");if(arguments.length<2){for(var r=$(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?Z:e?X:J)(n,e))},text:function(t){return arguments.length?this.each(null==t?K:("function"==typeof t?tt:Q)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?et:("function"==typeof t?rt:nt)(t)):this.node().innerHTML},raise:function(){return this.each(it)},lower:function(){return this.each(at)},append:function(t){var e="function"==typeof t?t:d(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:d(t),r=null==e?ot:"function"==typeof e?e:p(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(st)},clone:function(t){return this.select(t?lt:ut)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,a=ct(t+""),o=a.length;if(!(arguments.length<2)){for(s=e?ft:dt,r=0;r<o;++r)this.each(s(a[r],e,n));return this}var s=this.node().__on;if(s)for(var u,l=0,c=s.length;l<c;++l)for(r=0,u=s[l];r<o;++r)if((i=a[r]).type===u.type&&i.name===u.name)return u.value},dispatch:function(t,e){return this.each(("function"==typeof e?mt:ht)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],a=0,o=i.length;a<o;++a)(r=i[a])&&(yield r)}};var Nt=Object.hasOwnProperty,Lt=Object.setPrototypeOf,Ot=Object.isFrozen,Ut=Object.getPrototypeOf,Rt=Object.getOwnPropertyDescriptor,Bt=Object.freeze,jt=Object.seal,Ht=Object.create,It="undefined"!=typeof Reflect&&Reflect,Pt=It.apply,qt=It.construct;Pt||(Pt=function(t,e,n){return t.apply(e,n)}),Bt||(Bt=function(t){return t}),jt||(jt=function(t){return t}),qt||(qt=function(t,e){return new(Function.prototype.bind.apply(t,[null].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(e))))});var zt,Yt=te(Array.prototype.forEach),$t=te(Array.prototype.pop),Vt=te(Array.prototype.push),Wt=te(String.prototype.toLowerCase),Gt=te(String.prototype.match),Xt=te(String.prototype.replace),Jt=te(String.prototype.indexOf),Zt=te(String.prototype.trim),Kt=te(RegExp.prototype.test),Qt=(zt=TypeError,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return qt(zt,e)});function te(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Pt(t,e,r)}}function ee(t,e){Lt&&Lt(t,null);for(var n=e.length;n--;){var r=e[n];if("string"==typeof r){var i=Wt(r);i!==r&&(Ot(e)||(e[n]=i),r=i)}t[r]=!0}return t}function ne(t){var e=Ht(null),n=void 0;for(n in t)Pt(Nt,t,[n])&&(e[n]=t[n]);return e}function re(t,e){for(;null!==t;){var n=Rt(t,e);if(n){if(n.get)return te(n.get);if("function"==typeof n.value)return te(n.value)}t=Ut(t)}return function(t){return console.warn("fallback value for",t),null}}var ie=Bt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ae=Bt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),oe=Bt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),se=Bt(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ue=Bt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),le=Bt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ce=Bt(["#text"]),de=Bt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),fe=Bt(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),pe=Bt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),he=Bt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),me=jt(/\{\{[\s\S]*|[\s\S]*\}\}/gm),ve=jt(/<%[\s\S]*|[\s\S]*%>/gm),ge=jt(/^data-[\-\w.\u00B7-\uFFFF]/),ye=jt(/^aria-[\-\w]+$/),_e=jt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),be=jt(/^(?:\w+script|data):/i),we=jt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function Ae(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var Ee=function(){return"undefined"==typeof window?null:window},Ce=function(t,e){if("object"!==(void 0===t?"undefined":xe(t))||"function"!=typeof t.createPolicy)return null;var n=null,r="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(r)&&(n=e.currentScript.getAttribute(r));var i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML:function(t){return t}})}catch(t){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};var Te,ke,De=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ee(),n=function(e){return t(e)};if(n.version="2.2.8",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var r=e.document,i=e.document,a=e.DocumentFragment,o=e.HTMLTemplateElement,s=e.Node,u=e.Element,l=e.NodeFilter,c=e.NamedNodeMap,d=void 0===c?e.NamedNodeMap||e.MozNamedAttrMap:c,f=e.Text,p=e.Comment,h=e.DOMParser,m=e.trustedTypes,v=u.prototype,g=re(v,"cloneNode"),y=re(v,"nextSibling"),_=re(v,"childNodes"),b=re(v,"parentNode");if("function"==typeof o){var w=i.createElement("template");w.content&&w.content.ownerDocument&&(i=w.content.ownerDocument)}var x=Ce(m,r),A=x&&tt?x.createHTML(""):"",E=i,C=E.implementation,T=E.createNodeIterator,k=E.createDocumentFragment,D=r.importNode,F={};try{F=ne(i).documentMode?i.documentMode:{}}catch(t){}var S={};n.isSupported="function"==typeof b&&C&&void 0!==C.createHTMLDocument&&9!==F;var M=me,N=ve,L=ge,O=ye,U=be,R=we,B=_e,j=null,H=ee({},[].concat(Ae(ie),Ae(ae),Ae(oe),Ae(ue),Ae(ce))),I=null,P=ee({},[].concat(Ae(de),Ae(fe),Ae(pe),Ae(he))),q=null,z=null,Y=!0,$=!0,V=!1,W=!1,G=!1,X=!1,J=!1,Z=!1,K=!1,Q=!0,tt=!1,et=!0,nt=!0,rt=!1,it={},at=ee({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ot=null,st=ee({},["audio","video","img","source","image","track"]),ut=null,lt=ee({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),ct="http://www.w3.org/1998/Math/MathML",dt="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml",pt=ft,ht=null,mt=i.createElement("form"),vt=function(t){ht&&ht===t||(t&&"object"===(void 0===t?"undefined":xe(t))||(t={}),t=ne(t),j="ALLOWED_TAGS"in t?ee({},t.ALLOWED_TAGS):H,I="ALLOWED_ATTR"in t?ee({},t.ALLOWED_ATTR):P,ut="ADD_URI_SAFE_ATTR"in t?ee(ne(lt),t.ADD_URI_SAFE_ATTR):lt,ot="ADD_DATA_URI_TAGS"in t?ee(ne(st),t.ADD_DATA_URI_TAGS):st,q="FORBID_TAGS"in t?ee({},t.FORBID_TAGS):{},z="FORBID_ATTR"in t?ee({},t.FORBID_ATTR):{},it="USE_PROFILES"in t&&t.USE_PROFILES,Y=!1!==t.ALLOW_ARIA_ATTR,$=!1!==t.ALLOW_DATA_ATTR,V=t.ALLOW_UNKNOWN_PROTOCOLS||!1,W=t.SAFE_FOR_TEMPLATES||!1,G=t.WHOLE_DOCUMENT||!1,Z=t.RETURN_DOM||!1,K=t.RETURN_DOM_FRAGMENT||!1,Q=!1!==t.RETURN_DOM_IMPORT,tt=t.RETURN_TRUSTED_TYPE||!1,J=t.FORCE_BODY||!1,et=!1!==t.SANITIZE_DOM,nt=!1!==t.KEEP_CONTENT,rt=t.IN_PLACE||!1,B=t.ALLOWED_URI_REGEXP||B,pt=t.NAMESPACE||pt,W&&($=!1),K&&(Z=!0),it&&(j=ee({},[].concat(Ae(ce))),I=[],!0===it.html&&(ee(j,ie),ee(I,de)),!0===it.svg&&(ee(j,ae),ee(I,fe),ee(I,he)),!0===it.svgFilters&&(ee(j,oe),ee(I,fe),ee(I,he)),!0===it.mathMl&&(ee(j,ue),ee(I,pe),ee(I,he))),t.ADD_TAGS&&(j===H&&(j=ne(j)),ee(j,t.ADD_TAGS)),t.ADD_ATTR&&(I===P&&(I=ne(I)),ee(I,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&ee(ut,t.ADD_URI_SAFE_ATTR),nt&&(j["#text"]=!0),G&&ee(j,["html","head","body"]),j.table&&(ee(j,["tbody"]),delete q.tbody),Bt&&Bt(t),ht=t)},gt=ee({},["mi","mo","mn","ms","mtext"]),yt=ee({},["foreignobject","desc","title","annotation-xml"]),_t=ee({},ae);ee(_t,oe),ee(_t,se);var bt=ee({},ue);ee(bt,le);var wt=function(t){var e=b(t);e&&e.tagName||(e={namespaceURI:ft,tagName:"template"});var n=Wt(t.tagName),r=Wt(e.tagName);if(t.namespaceURI===dt)return e.namespaceURI===ft?"svg"===n:e.namespaceURI===ct?"svg"===n&&("annotation-xml"===r||gt[r]):Boolean(_t[n]);if(t.namespaceURI===ct)return e.namespaceURI===ft?"math"===n:e.namespaceURI===dt?"math"===n&&yt[r]:Boolean(bt[n]);if(t.namespaceURI===ft){if(e.namespaceURI===dt&&!yt[r])return!1;if(e.namespaceURI===ct&&!gt[r])return!1;var i=ee({},["title","style","font","a","script"]);return!bt[n]&&(i[n]||!_t[n])}return!1},xt=function(t){Vt(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=A}catch(e){t.remove()}}},At=function(t,e){try{Vt(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Vt(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!I[t])if(Z||K)try{xt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Et=function(t){var e=void 0,n=void 0;if(J)t="<remove></remove>"+t;else{var r=Gt(t,/^[\r\n\t ]+/);n=r&&r[0]}var a=x?x.createHTML(t):t;if(pt===ft)try{e=(new h).parseFromString(a,"text/html")}catch(t){}e&&e.documentElement||((e=C.createDocument(pt,"template",null)).documentElement.innerHTML=a);var o=e.body||e.documentElement;return t&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),G?e.documentElement:o},Ct=function(t){return T.call(t.ownerDocument||t,t,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,(function(){return l.FILTER_ACCEPT}),!1)},Tt=function(t){return!(t instanceof f||t instanceof p)&&!("string"==typeof t.nodeName&&"string"==typeof t.textContent&&"function"==typeof t.removeChild&&t.attributes instanceof d&&"function"==typeof t.removeAttribute&&"function"==typeof t.setAttribute&&"string"==typeof t.namespaceURI&&"function"==typeof t.insertBefore)},kt=function(t){return"object"===(void 0===s?"undefined":xe(s))?t instanceof s:t&&"object"===(void 0===t?"undefined":xe(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},Dt=function(t,e,r){S[t]&&Yt(S[t],(function(t){t.call(n,e,r,ht)}))},Ft=function(t){var e=void 0;if(Dt("beforeSanitizeElements",t,null),Tt(t))return xt(t),!0;if(Gt(t.nodeName,/[\u0080-\uFFFF]/))return xt(t),!0;var r=Wt(t.nodeName);if(Dt("uponSanitizeElement",t,{tagName:r,allowedTags:j}),!kt(t.firstElementChild)&&(!kt(t.content)||!kt(t.content.firstElementChild))&&Kt(/<[/\w]/g,t.innerHTML)&&Kt(/<[/\w]/g,t.textContent))return xt(t),!0;if(!j[r]||q[r]){if(nt&&!at[r]){var i=b(t)||t.parentNode,a=_(t)||t.childNodes;if(a&&i)for(var o=a.length-1;o>=0;--o)i.insertBefore(g(a[o],!0),y(t))}return xt(t),!0}return t instanceof u&&!wt(t)?(xt(t),!0):"noscript"!==r&&"noembed"!==r||!Kt(/<\/no(script|embed)/i,t.innerHTML)?(W&&3===t.nodeType&&(e=t.textContent,e=Xt(e,M," "),e=Xt(e,N," "),t.textContent!==e&&(Vt(n.removed,{element:t.cloneNode()}),t.textContent=e)),Dt("afterSanitizeElements",t,null),!1):(xt(t),!0)},St=function(t,e,n){if(et&&("id"===e||"name"===e)&&(n in i||n in mt))return!1;if($&&Kt(L,e));else if(Y&&Kt(O,e));else{if(!I[e]||z[e])return!1;if(ut[e]);else if(Kt(B,Xt(n,R,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==Jt(n,"data:")||!ot[t]){if(V&&!Kt(U,Xt(n,R,"")));else if(n)return!1}else;}return!0},Mt=function(t){var e=void 0,r=void 0,i=void 0,a=void 0;Dt("beforeSanitizeAttributes",t,null);var o=t.attributes;if(o){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:I};for(a=o.length;a--;){var u=e=o[a],l=u.name,c=u.namespaceURI;if(r=Zt(e.value),i=Wt(l),s.attrName=i,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,Dt("uponSanitizeAttribute",t,s),r=s.attrValue,!s.forceKeepAttr&&(At(l,t),s.keepAttr))if(Kt(/\/>/i,r))At(l,t);else{W&&(r=Xt(r,M," "),r=Xt(r,N," "));var d=t.nodeName.toLowerCase();if(St(d,i,r))try{c?t.setAttributeNS(c,l,r):t.setAttribute(l,r),$t(n.removed)}catch(t){}}}Dt("afterSanitizeAttributes",t,null)}},Nt=function t(e){var n=void 0,r=Ct(e);for(Dt("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)Dt("uponSanitizeShadowNode",n,null),Ft(n)||(n.content instanceof a&&t(n.content),Mt(n));Dt("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(t,i){var o=void 0,u=void 0,l=void 0,c=void 0,d=void 0;if(t||(t="\x3c!--\x3e"),"string"!=typeof t&&!kt(t)){if("function"!=typeof t.toString)throw Qt("toString is not a function");if("string"!=typeof(t=t.toString()))throw Qt("dirty is not a string, aborting")}if(!n.isSupported){if("object"===xe(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof t)return e.toStaticHTML(t);if(kt(t))return e.toStaticHTML(t.outerHTML)}return t}if(X||vt(i),n.removed=[],"string"==typeof t&&(rt=!1),rt);else if(t instanceof s)1===(u=(o=Et("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===u.nodeName||"HTML"===u.nodeName?o=u:o.appendChild(u);else{if(!Z&&!W&&!G&&-1===t.indexOf("<"))return x&&tt?x.createHTML(t):t;if(!(o=Et(t)))return Z?null:A}o&&J&&xt(o.firstChild);for(var f=Ct(rt?t:o);l=f.nextNode();)3===l.nodeType&&l===c||Ft(l)||(l.content instanceof a&&Nt(l.content),Mt(l),c=l);if(c=null,rt)return t;if(Z){if(K)for(d=k.call(o.ownerDocument);o.firstChild;)d.appendChild(o.firstChild);else d=o;return Q&&(d=D.call(r,d,!0)),d}var p=G?o.outerHTML:o.innerHTML;return W&&(p=Xt(p,M," "),p=Xt(p,N," ")),x&&tt?x.createHTML(p):p},n.setConfig=function(t){vt(t),X=!0},n.clearConfig=function(){ht=null,X=!1},n.isValidAttribute=function(t,e,n){ht||vt({});var r=Wt(t),i=Wt(e);return St(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&(S[t]=S[t]||[],Vt(S[t],e))},n.removeHook=function(t){S[t]&&$t(S[t])},n.removeHooks=function(t){S[t]&&(S[t]=[])},n.removeAllHooks=function(){S={}},n}(),Fe=25,Se=10,Me=10,Ne={};function Le(t,e,n,r,i,a,o){var s=n-t/2-Me,u=n+t/2+Me,l=t/2+Math.min(0,s-i.left)+Math.max(0,u-i.right);return{pos:[l,o],shape:l-Se<5?[-l,-15*a,Math.max(Se,5-l),-10*a]:l+Se>t-5?[Math.min(-10,t-l-5),-10*a,Math.min(Se,t-l),-15*a]:[-10,-10*a,Se,-10*a]}}function Oe(t,e,n,r,i,a,o){var s=r-e/2-Me,u=r+e/2+Me,l=e/2+Math.min(0,s-i.top)+Math.max(0,u-i.bottom);return{pos:[o,l],shape:l-Se<5?[-15*a,-l,-10*a,Math.max(Se,5-l)]:l+Se>e-5?[-10*a,Math.min(-10,e-l-5),-15*a,Math.min(Se,e-l)]:[-10*a,-10,-10*a,Se]}}function Ue(t,e,n,r,i,a){var o=Ne[t](e,n,r,i,a),s=r-Fe-o.pos[0],u=i-Fe-o.pos[1];return{left:s,top:u,right:s+e+50,bottom:u+n+50}}function Re(t,e,n){var r,i=document.createElementNS("http://www.w3.org/2000/svg",t);if(e)for(r in e)i.setAttribute(r,e[r]);var a=i.style;if(n)for(r in n)a[r]=n[r];return i}function Be(){return Te||((Te=document.createElement("div")).id="flourish-popup-constrainer",(ke=Te.style).overflow="hidden",ke.pointerEvents="none",ke.position="absolute",ke.left="0",ke.top="0",ke.margin="0",ke.padding="0",document.body.appendChild(Te),this._resizeConstrainer(),Te)}Ne.bottom=function(t,e){return{shape:[-10,-10,Se,-10],pos:[t/2,e+Me]}},Ne.top=function(t,e){return{shape:[-10,Me,Se,Me],pos:[t/2,-10]}},Ne.left=function(t,e){return{shape:[Me,Se,Me,-10],pos:[-10,e/2]}},Ne.right=function(t,e){return{shape:[-10,Se,-10,-10],pos:[t+Me,e/2]}},Ne.topLeft=function(t,e){return{shape:[15,Me,Me,15],pos:[-10,-10]}},Ne.bottomLeft=function(t,e){return{shape:[15,-10,Me,-15],pos:[-10,e+Me]}},Ne.topRight=function(t,e){return{shape:[-15,Me,-10,15],pos:[t+Me,-10]}},Ne.bottomRight=function(t,e){return{shape:[-15,-10,-10,-15],pos:[t+Me,e+Me]}},Ne.bottomFlexible=function(t,e,n,r,i){return Le(t,0,n,0,i,1,e+Me)},Ne.topFlexible=function(t,e,n,r,i){return Le(t,0,n,0,i,-1,-10)},Ne.rightFlexible=function(t,e,n,r,i){return Oe(0,e,0,r,i,1,t+Me)},Ne.leftFlexible=function(t,e,n,r,i){return Oe(0,e,0,r,i,-1,-10)};var je,He=1,Ie={container:document.body,maxWidth:"70%",point:null,html:null,directions:["bottom","top","left","right","topLeft","bottomLeft","topRight","bottomRight","bottomFlexible","topFlexible","leftFlexible","rightFlexible"],fallbackFit:"horizontal"};function Pe(){for(var t in this.unique_id=He++,this.is_visible=!0,Ie)this["_"+t]=Ie[t];this.handlers={click:[]}}function qe(t){Pe.prototype[t]=function(e){return void 0===e?this["_"+t]:(this["_"+t]=e,this)}}for(var ze in Ie)qe(ze);function Ye(){return new Pe}function $e(){je=Ye().container(document.body),function(t){t.on("mouseover",Ve).on("mouseout",We)}(Tt(".popup"))}function Ve(){if(this.getAttribute("data-popup-head")||this.getAttribute("data-popup-body")){var t=this.getAttribute("data-popup-position"),e=this.getBoundingClientRect(),n=e.left+e.width/2,r=e.top+e.height,i=this.getAttribute("data-popup-head")||null,a=this.getAttribute("data-popup-body")||null,o="",s=["top","topFlexible"];i&&(o+=Ct("h1").html(De.sanitize(i)).node().outerHTML),a&&(o+=Ct("p").html(De.sanitize(a)).node().outerHTML),t&&("left"===t?(s=["right","rightFlexible"],n=e.left,r=e.top+e.height/2):"right"===t?(s=["left","leftFlexible"],n=e.right,r=e.top+e.height/2):"top"===t?(s=["bottom","bottomFlexible"],n=e.left+e.width/2,r=e.top):"bottom"===t&&(s=["top","topFlexible"],n=e.left+e.width/2,r=e.top+e.height)),je.point(n,r).html(o).directions(s).draw()}}function We(){je.hide()}Pe.prototype.point=function(t,e){if(void 0===t)return this._point;if(Array.isArray(t))this._point=[t[0],t[1]];else if(void 0!==e)this._point=[t,e];else if(t instanceof HTMLElement||t instanceof SVGElement){var n=t.getBoundingClientRect();this._point=[Math.floor(n.left+n.width/2),Math.floor(n.top+n.height/2)]}else console.error("Popup: could not understand argument");return this},Pe.prototype.directions=function(t){return void 0===t?this._directions:("string"==typeof t&&(t=[t]),this._directions=t.slice(),this)},Pe.prototype.text=function(t){return this._html=function(t){return t.replace(/[&<>]/g,(function(t){return{"&":"&amp;","<":"&lt;",">":"&gt;"}[t]}))}(t),this},Pe.prototype.on=function(t,e){if(!(t in this.handlers))throw new Error("Popup.on: No such event: "+t);return this.handlers[t].push(e),this},Pe.prototype.fire=function(t,e){if(!(t in this.handlers))throw new Error("Popup.fire: No such event: "+t);for(var n=this.handlers[t],r=0;r<n.length;r++)n[r].call(this,e);return this},Pe.prototype._getElement=function(){var t=this,e="flourish-popup-"+t.unique_id,n=document.getElementById(e);if(!n){(n=document.createElement("div")).className="flourish-popup",n.id=e;var r=n.style;r.display="none",r.margin=r.padding=0,r.position="absolute",r.width="80px",r.height="40px",r.boxSizing="border-box",n.addEventListener("click",(function(e){t.fire("click",e)}),!1);var i=Re("svg",{class:"flourish-popup-svg"},{position:"absolute",top:0,left:0,bottom:0,right:0}),a=Re("filter",{id:"dropshadow-"+t.unique_id,height:"130%"});a.appendChild(Re("feGaussianBlur",{in:"SourceAlpha",stdDeviation:5})),a.appendChild(Re("feOffset",{dx:0,dy:2,result:"offsetblur"}));var o=Re("feComponentTransfer");o.appendChild(Re("feFuncA",{type:"linear",slope:.2})),a.appendChild(o);var s=Re("feMerge");a.appendChild(s),s.appendChild(Re("feMergeNode")),s.appendChild(Re("feMergeNode",{in:"SourceGraphic"})),i.appendChild(a);var u=Re("g",{filter:"url(#dropshadow-"+t.unique_id+")",fill:"white",stroke:"none"});u.appendChild(Re("rect",{x:Fe,y:Fe,rx:5})),u.appendChild(Re("path")),i.appendChild(u),n.appendChild(i);var l=document.createElement("div");l.className="flourish-popup-content",(r=l.style).position="absolute",r.top=r.left="25px",r.padding="10px",n.appendChild(l),t._getConstrainer().appendChild(n)}return t._resizeConstrainer(),n},Pe.prototype._getConstrainer=Be,Pe.prototype._resizeConstrainer=function(){Te||Be.call(this);var t=ke.display;ke.display="none",ke.width=document.documentElement.scrollWidth+"px",ke.height=document.documentElement.scrollHeight+"px",ke.display=t},Pe.prototype.draw=function(){var t=this;if(t.is_visible=!0,t._point){var e=document.documentElement.getBoundingClientRect(),n=t._point[0],r=t._point[1],i=t._container.getBoundingClientRect();n<i.left?n=i.left:n>i.right&&(n=i.right),r<i.top?r=i.top:r>i.bottom&&(r=i.bottom);var a=n-e.left,o=r-e.top,s=t._getElement(),u=s.style,l=s.querySelector(".flourish-popup-svg"),c=l.querySelector("g"),d=c.querySelector("rect"),f=c.querySelector("path"),p=s.querySelector(".flourish-popup-content");u.display="block",p.style.maxWidth=function(e){return t._maxWidth.match(/^\d+(?:\.\d+)?%$/)?e.width*parseFloat(t._maxWidth)/100:t._maxWidth.match(/^\d+(?:\.\d+)?(?:px)?$/)?parseFloat(t._maxWidth):(null!=t._maxWidth&&console.error("Popup: Unknown value for maxWidth: "+t._maxWidth),e.width)}(i)+"px",t._inner_html!=t._html&&(p.innerHTML=t._inner_html=t._html);var h,m,v=p.getBoundingClientRect();do{h=Math.ceil(v.width),m=Math.ceil(v.height),u.width=h+50+"px",u.height=m+50+"px",v=p.getBoundingClientRect()}while(h!=Math.ceil(v.width)||m!=Math.ceil(v.height));d.setAttribute("width",h),d.setAttribute("height",m),l.setAttribute("width",h+50),l.setAttribute("height",m+50);for(var g,y,_=null,b=null,w=null,x=1/0,A=1/0,E=0;E<t._directions.length;E++){var C=t._directions[E],T=Ue(C,h,m,n,r,i),k=Math.max(0,Math.floor(i.left)-T.left-15)+Math.max(0,T.right-Math.ceil(i.right)-15),D=Math.max(0,Math.floor(i.top)-T.top-15)+Math.max(0,T.bottom-Math.ceil(i.bottom)-15);if(0==k&&0==D){_=C;break}(k<x||k==x&&D<g)&&(x=k,g=D,b=C),(D<A||D==A&&k<y)&&(A=D,y=k,w=C)}return _?C=_:"horizontal"==t._fallbackFit?C=b:"vertical"==t._fallbackFit?C=w:(console.warn("Popup: failed to point box of size ("+h+", "+m+") at ("+n+", "+r+") within ("+i.left+", "+i.top+", "+i.right+", "+i.bottom+")"),C=t._directions[0]),function(t,e,n,r,i,a,o,s,u,l){var c=Ne[t](r,i,s,u,l);e.left=a-Fe-c.pos[0]+"px",e.top=o-Fe-c.pos[1]+"px",n.setAttribute("d","M0,0L"+c.shape.join(",")+"Z"),n.setAttribute("transform","translate("+(c.pos[0]+Fe)+","+(c.pos[1]+Fe)+")")}(C,u,f,h,m,a,o,n,r,i),t}console.error("Popup: cannot draw popup till point() has been specified")},Pe.prototype.hide=function(){return this.is_visible?(this.is_visible=!1,this._getElement().style.display="none",this):this},Ye.version="2.1.5";const Ge=Math.pow(2,31)-1,Xe=Math.pow(2,15);function Je(t,e){if(t=t.toUpperCase(),!/^[A-Z]+$/.test(t)){if(!t){if(e)return-1;throw new Error("Non-optional data binding must specify column")}throw function(t){try{tn(t)}catch(t){return!1}return!0}(t)?new Error("You can only select one column"):new Error("Invalid column specification: "+t)}for(var n=0,r=0;r<t.length;r++)n=26*n+(t.charCodeAt(r)-64);return n-1>Ge&&console.warn("Column index out of range"),Math.min(n-1,Ge)}function Ze(t){t+=1;for(var e="";t>0;){var n=Math.floor(t/26),r=t%26;0==r&&(n-=1,r+=26),e=String.fromCharCode(64+r)+e,t=n}return e}function Ke(t){var e=t.match(/\s*(?:[-–—:]|\.\.)\s*/);if(!e)throw new Error("Failed to parse column range: "+t);var n=t.substr(0,e.index),r=t.substr(e.index+e[0].length),i=Je(n),a=Je(r),o=[],s=a>=i?1:-1,u=Math.abs(a-i)+1;u>Xe&&(console.warn("Truncating excessively long range"),u=Xe);for(var l=0;l<u;l++)o.push(i+l*s);return o}function Qe(t,e){return Ze(t)+"-"+Ze(e)}function tn(t){var e=[],n=(t=t.replace(/^\s+|\s+$/g,"")).split(/\s*,\s*/);1==n.length&&""===n[0]&&(n=[]);for(var r=0;r<n.length;r++){var i=n[r];/^[A-Za-z]+$/.test(i)?e.push(Je(i)):Array.prototype.push.apply(e,Ke(i))}return e}function en(t){for(var e=function(t){if(!t.length)return[];for(var e=[],n=t[0],r=t[0],i=null,a=0;a<t.length-1;a++){var o=t[a+1]-t[a];null!==i||1!==Math.abs(o)?o!==i?(e.push([n,r]),n=r=t[a+1],i=null):r=t[a+1]:(r=t[a+1],i=o)}return e.push([n,r]),e}(t),n=[],r=0;r<e.length;r++){var i=e[r];i[0]==i[1]?n.push(Ze(i[0])):n.push(Qe(i[0],i[1]))}return n.join(",")}function nn(t,e,n,r){var i=n?e[t.data_table_id]+"::":"";if("column"in t)return i+Ze(t.column);if("columns"in t)return i+en(t.columns);if(r)return"";throw new Error("Data binding must have .column or .columns")}var rn=new Date,an=new Date;function on(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},i.range=function(n,r,a){var o,s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r&&a>0))return s;do{s.push(o=new Date(+n)),e(n,a),t(n)}while(o<n&&n<r);return s},i.filter=function(n){return on((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return rn.setTime(+e),an.setTime(+r),t(rn),t(an),Math.floor(n(rn,an))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var sn=864e5,un=6048e5,ln=on((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/sn}),(function(t){return t.getDate()-1}));function cn(t){return on((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/un}))}var dn=cn(0),fn=cn(1);cn(2),cn(3);var pn=cn(4);cn(5),cn(6);var hn=on((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));hn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?on((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var mn=on((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/sn}),(function(t){return t.getUTCDate()-1}));function vn(t){return on((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/un}))}var gn=vn(0),yn=vn(1);vn(2),vn(3);var _n=vn(4);vn(5),vn(6);var bn=on((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));function wn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function xn(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function An(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}bn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?on((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var En,Cn,Tn,kn={"-":"",_:" ",0:"0"},Dn=/^\s*\d+/,Fn=/^%/,Sn=/[\\^$*+?|[\]().{}]/g;function Mn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function Nn(t){return t.replace(Sn,"\\$&")}function Ln(t){return new RegExp("^(?:"+t.map(Nn).join("|")+")","i")}function On(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function Un(t,e,n){var r=Dn.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Rn(t,e,n){var r=Dn.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Bn(t,e,n){var r=Dn.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function jn(t,e,n){var r=Dn.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hn(t,e,n){var r=Dn.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function In(t,e,n){var r=Dn.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Pn(t,e,n){var r=Dn.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function qn(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function zn(t,e,n){var r=Dn.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Yn(t,e,n){var r=Dn.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function $n(t,e,n){var r=Dn.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Vn(t,e,n){var r=Dn.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Wn(t,e,n){var r=Dn.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Gn(t,e,n){var r=Dn.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Xn(t,e,n){var r=Dn.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Jn(t,e,n){var r=Dn.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zn(t,e,n){var r=Dn.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Kn(t,e,n){var r=Fn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Qn(t,e,n){var r=Dn.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function tr(t,e,n){var r=Dn.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function er(t,e){return Mn(t.getDate(),e,2)}function nr(t,e){return Mn(t.getHours(),e,2)}function rr(t,e){return Mn(t.getHours()%12||12,e,2)}function ir(t,e){return Mn(1+ln.count(hn(t),t),e,3)}function ar(t,e){return Mn(t.getMilliseconds(),e,3)}function or(t,e){return ar(t,e)+"000"}function sr(t,e){return Mn(t.getMonth()+1,e,2)}function ur(t,e){return Mn(t.getMinutes(),e,2)}function lr(t,e){return Mn(t.getSeconds(),e,2)}function cr(t){var e=t.getDay();return 0===e?7:e}function dr(t,e){return Mn(dn.count(hn(t)-1,t),e,2)}function fr(t){var e=t.getDay();return e>=4||0===e?pn(t):pn.ceil(t)}function pr(t,e){return t=fr(t),Mn(pn.count(hn(t),t)+(4===hn(t).getDay()),e,2)}function hr(t){return t.getDay()}function mr(t,e){return Mn(fn.count(hn(t)-1,t),e,2)}function vr(t,e){return Mn(t.getFullYear()%100,e,2)}function gr(t,e){return Mn((t=fr(t)).getFullYear()%100,e,2)}function yr(t,e){return Mn(t.getFullYear()%1e4,e,4)}function _r(t,e){var n=t.getDay();return Mn((t=n>=4||0===n?pn(t):pn.ceil(t)).getFullYear()%1e4,e,4)}function br(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Mn(e/60|0,"0",2)+Mn(e%60,"0",2)}function wr(t,e){return Mn(t.getUTCDate(),e,2)}function xr(t,e){return Mn(t.getUTCHours(),e,2)}function Ar(t,e){return Mn(t.getUTCHours()%12||12,e,2)}function Er(t,e){return Mn(1+mn.count(bn(t),t),e,3)}function Cr(t,e){return Mn(t.getUTCMilliseconds(),e,3)}function Tr(t,e){return Cr(t,e)+"000"}function kr(t,e){return Mn(t.getUTCMonth()+1,e,2)}function Dr(t,e){return Mn(t.getUTCMinutes(),e,2)}function Fr(t,e){return Mn(t.getUTCSeconds(),e,2)}function Sr(t){var e=t.getUTCDay();return 0===e?7:e}function Mr(t,e){return Mn(gn.count(bn(t)-1,t),e,2)}function Nr(t){var e=t.getUTCDay();return e>=4||0===e?_n(t):_n.ceil(t)}function Lr(t,e){return t=Nr(t),Mn(_n.count(bn(t),t)+(4===bn(t).getUTCDay()),e,2)}function Or(t){return t.getUTCDay()}function Ur(t,e){return Mn(yn.count(bn(t)-1,t),e,2)}function Rr(t,e){return Mn(t.getUTCFullYear()%100,e,2)}function Br(t,e){return Mn((t=Nr(t)).getUTCFullYear()%100,e,2)}function jr(t,e){return Mn(t.getUTCFullYear()%1e4,e,4)}function Hr(t,e){var n=t.getUTCDay();return Mn((t=n>=4||0===n?_n(t):_n.ceil(t)).getUTCFullYear()%1e4,e,4)}function Ir(){return"+0000"}function Pr(){return"%"}function qr(t){return+t}function zr(t){return Math.floor(+t/1e3)}function Yr(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function $r(t){return function(e){return"string"!=typeof e&&Yr(e),(e=e.trim())?t(e):null}}En=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,o=t.shortDays,s=t.months,u=t.shortMonths,l=Ln(i),c=On(i),d=Ln(a),f=On(a),p=Ln(o),h=On(o),m=Ln(s),v=On(s),g=Ln(u),y=On(u),_={a:function(t){return o[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:er,e:er,f:or,g:gr,G:_r,H:nr,I:rr,j:ir,L:ar,m:sr,M:ur,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:qr,s:zr,S:lr,u:cr,U:dr,V:pr,w:hr,W:mr,x:null,X:null,y:vr,Y:yr,Z:br,"%":Pr},b={a:function(t){return o[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:wr,e:wr,f:Tr,g:Br,G:Hr,H:xr,I:Ar,j:Er,L:Cr,m:kr,M:Dr,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:qr,s:zr,S:Fr,u:Sr,U:Mr,V:Lr,w:Or,W:Ur,x:null,X:null,y:Rr,Y:jr,Z:Ir,"%":Pr},w={a:function(t,e,n){var r=p.exec(e.slice(n));return r?(t.w=h[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=f[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=v[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return E(t,e,n,r)},d:$n,e:$n,f:Zn,g:Pn,G:In,H:Wn,I:Wn,j:Vn,L:Jn,m:Yn,M:Gn,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=c[r[0].toLowerCase()],n+r[0].length):-1},q:zn,Q:Qn,s:tr,S:Xn,u:Rn,U:Bn,V:jn,w:Un,W:Hn,x:function(t,e,r){return E(t,n,e,r)},X:function(t,e,n){return E(t,r,e,n)},y:Pn,Y:In,Z:qn,"%":Kn};function x(t,e){return function(n){var r,i,a,o=[],s=-1,u=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++s<l;)37===t.charCodeAt(s)&&(o.push(t.slice(u,s)),null!=(i=kn[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(a=e[r])&&(r=a(n,i)),o.push(r),u=s+1);return o.push(t.slice(u,s)),o.join("")}}function A(t,e){return function(n){var r,i,a=An(1900,void 0,1);if(E(a,t,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(e&&!("Z"in a)&&(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=xn(An(a.y,0,1))).getUTCDay(),r=i>4||0===i?yn.ceil(r):yn(r),r=mn.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=wn(An(a.y,0,1))).getDay(),r=i>4||0===i?fn.ceil(r):fn(r),r=ln.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?xn(An(a.y,0,1)).getUTCDay():wn(An(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,xn(a)):wn(a)}}function E(t,e,n,r){for(var i,a,o=0,s=e.length,u=n.length;o<s;){if(r>=u)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=w[i in kn?e.charAt(o++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=x(n,_),_.X=x(r,_),_.c=x(e,_),b.x=x(n,b),b.X=x(r,b),b.c=x(e,b),{format:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=A(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",b);return e.toString=function(){return t},e},utcParse:function(t){var e=A(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Cn=En.format,Tn=En.parse,En.utcFormat,En.utcParse;var Vr=new Date(1972,3,27,19,45,5),Wr={"%b %d":[{regex:/^june\s(30|[12][0-9]|0?[1-9])$/i,toDate:function(t){return new Date(null,5,t.split(/\s/)[1])}},{regex:/^july\s(3[01]|[12][0-9]|0?[1-9])$/i,toDate:function(t){return new Date(null,6,t.split(/\s/)[1])}},{regex:/^sept\s(30|[12][0-9]|0?[1-9])$/i,toDate:function(t){return new Date(null,8,t.split(/\s/)[1])}}],"%d %b":[{regex:/^(0?[1-9]|[1-9][0-9])\sjune$/i,toDate:function(t){return new Date(null,5,t.split(/\s/)[0])}},{regex:/^(0?[1-9]|[1-9][0-9])\sjuly$/i,toDate:function(t){return new Date(null,6,t.split(/\s/)[0])}},{regex:/^(0?[1-9]|[1-9][0-9])\ssept$/i,toDate:function(t){return new Date(null,8,t.split(/\s/)[0])}}]};function Gr(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function Xr(t,e){var n,r=Tn(t),i=Cn(t);return n=$r("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:$r((function(e){return r(e)||(Wr[t]?Gr(Wr[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(Vr)})}var Jr=Object.freeze([Xr("%Y-%m-%dT%H:%M:%S.%LZ"),Xr("%d/%m/%Y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3})),Xr("%d/%m/%y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&!isNaN(n[2])})),Xr("%m/%d/%Y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&n[2]>=1e3})),Xr("%m/%d/%y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&!isNaN(n[2])})),Xr("%Y/%m/%d",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12&&n[2]>0&&n[2]<=31})),Xr("%d-%m-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3})),Xr("%d-%m-%y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&!isNaN(n[2])})),Xr("%m-%d-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&n[2]>=1e3})),Xr("%m-%d-%y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&!isNaN(n[2])})),Xr("%Y-%m-%d",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12&&n[2]>0&&n[2]<=31})),Xr("%d %b %Y",(function(t,e){if(!e)return!1;var n=t.split(" ").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),Xr("%d %B %Y",(function(t,e){if(!e)return!1;var n=t.split(" ").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),Xr("%d %b %y"),Xr("%d %B %y"),Xr("%d-%b-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),Xr("%d-%B-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),Xr("%d-%b-%y"),Xr("%d-%B-%y"),Xr("%m/%Y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>=1e3})),Xr("%m/%y"),Xr("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),Xr("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),Xr("%b %y"),Xr("%B %y"),Xr("%d %b",(function(t,e){return!!e||!!Gr(Wr["%d %b"])(t)})),Xr("%d %B"),Xr("%b %d",(function(t,e){return!!e||!!Gr(Wr["%b %d"])(t)})),Xr("%B %d"),Xr("%d-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12})),Xr("%m-%d"),Xr("%d/%m"),Xr("%m/%d"),Xr("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),Xr("%B"),Xr("%b"),Xr("%X"),Xr("%I:%M %p"),Xr("%H:%M"),Xr("%H:%M:%S"),Xr("%-I%p"),Xr("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),Xr("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length}))]);function Zr(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}var Kr,Qr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ti(t){if(!(e=Qr.exec(t)))throw new Error("invalid format: "+t);var e;return new ei({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function ei(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ni(t,e){var n=Zr(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}ti.prototype=ei.prototype,ei.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var ri={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return ni(100*t,e)},r:ni,s:function(t,e){var n=Zr(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(Kr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Zr(t,Math.max(0,e+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function ii(t){return t}var ai=Array.prototype.map,oi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function si(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?ii:(e=ai.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,a=[],o=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),a.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?ii:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ai.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=ti(t)).fill,n=t.align,d=t.sign,f=t.symbol,p=t.zero,h=t.width,m=t.comma,v=t.precision,g=t.trim,y=t.type;"n"===y?(m=!0,y="g"):ri[y]||(void 0===v&&(v=12),g=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",b="$"===f?a:/[%p]/.test(y)?u:"",w=ri[y],x=/[defgprs%]/.test(y);function A(t){var i,a,u,f=_,A=b;if("c"===y)A=w(t)+A,t="";else{var E=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),v),g&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),E&&0==+t&&"+"!==d&&(E=!1),f=(E?"("===d?d:l:"-"===d||"("===d?"":d)+f,A=("s"===y?oi[8+Kr/3]:"")+A+(E&&"("===d?")":""),x)for(i=-1,a=t.length;++i<a;)if(48>(u=t.charCodeAt(i))||u>57){A=(46===u?o+t.slice(i+1):t.slice(i))+A,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var C=f.length+t.length+A.length,T=C<h?new Array(h-C+1).join(e):"";switch(m&&p&&(t=r(T+t,T.length?h-A.length:1/0),T=""),n){case"<":t=f+t+A+T;break;case"=":t=f+T+t+A;break;case"^":t=T.slice(0,C=T.length>>1)+f+t+A+T.slice(C);break;default:t=T+f+t+A}return s(t)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),A.toString=function(){return t+""},A}return{format:d,formatPrefix:function(t,e){var n,r=d(((t=ti(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Zr(Math.abs(n)))?n[1]:NaN)/3)))),a=Math.pow(10,-i),o=oi[8+i/3];return function(t){return r(a*t)+o}}}}var ui={test:$r((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:$r((function(t){return parseFloat(t.replace(/,/g,""))})),description:"Comma thousand separator, point decimal mark",thousand_separator:",",decimal_mark:".",id:"number$comma_point",example:"12,235.56"},li={test:$r((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:$r((function(t){return parseFloat(t.replace(/\s/g,""))})),description:"Space thousand separator, point decimal mark",thousand_separator:" ",decimal_mark:".",id:"number$space_point",example:"12 235.56"},ci={test:$r((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:$r((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},di={test:$r((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:$r((function(t){return parseFloat(t.replace(/\./g,"").replace(/,/,"."))})),description:"Point thousand separator, comma decimal mark",thousand_separator:".",decimal_mark:",",id:"number$point_comma",example:"12.235,56"},fi={test:$r((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:$r((function(t){return parseFloat(t.replace(/\s/g,"").replace(/,/,"."))})),description:"Space thousand separator, comma decimal mark",thousand_separator:" ",decimal_mark:",",id:"number$space_comma",example:"12 235,56"},pi={test:$r((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:$r((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},hi=Object.freeze([ui,li,di,fi,ci,pi]);hi.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=si({decimal:t.decimal_mark,thousands:t.thousand_separator,grouping:[3],currency:["",""]});return function(t,i){return i||(i=",.2f"),i!==n&&(n=i,e=r.format(n)),e(t)}}(t),Object.freeze(t)}));var mi,vi=Object.freeze({test:function(t){return"string"==typeof t||Yr(t)},parse:function(t){return"string"==typeof t?t:Yr(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),gi=Object.freeze({datetime:Jr,number:hi}),yi=Object.freeze(["datetime","number","string"]),_i=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),bi=Object.freeze(Object.keys(_i));function wi(t,e){return t.index-e.index}function xi(t,e){return e.n_success-t.n_success||wi(t,e)}function Ai(t){return(""+t).trim()}function Ei(t){return void 0===t?function(t){return Ai(t)}:"function"==typeof t?function(e,n){return Ai(t(e,n))}:function(e){return Ai(e[""+t])}}function Ci(t){t?Array.isArray(t)||(t=[t]):t=yi;var e=t.reduce((function(t,e){var n=gi[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=bi.reduce((function(t,e){return t[e]=_i[e],t}),{}),i=function(t,i){i=Ei(i);var a=t.map(i).filter((function(t){return t}));if(!a.length)return n?[vi]:[];var o=Math.min(r.n_max,a.length),s=Math.floor(o*r.failure_fraction),u=r.n_failing_values,l=r.sort?xi:wi,c=e.slice().reduce((function(t,e,n){for(var r=c=0,i=[],l=!1,c=0;c<o;c++){var d=a[c];if(!e.test(d)&&(++r>s?l=!0:-1===i.indexOf(d)&&(i.push(d),i.length>u&&(l=!0)),l))break}return l||t.push({interp:e,n_success:o-r,index:n}),t}),[]).sort(l).map((function(t){return t.interp}));return n&&c.push(vi),c};return bi.forEach((function(t){var e;i[(e=t,e.replace(/_(\w)/g,(function(t,e){return e.toUpperCase()})))]=function(e){return void 0===e?r[t]:(r[t]=e,i)}})),i}function Ti(t,e,n,r){var i=[],a=[],o=0,s=[],u={};function l(t,e){if(!u[t])return{};var n=u[t];return n[e]?n[e]:{}}for(var c in s.column_names={},s.metadata={},n){var d={},f=n[c];if(f){for(let t=0;t<f.length;t++){const e=f[t].type_id,n=f[t].output_format_id,r=n&&"auto"!==n?n:e;d[f[t].index]={type_id:e,output_format_id:r}}u[c]=d}}for(var p in t)if(null!==t[p]&&(void 0!==t[p].columns||void 0!==t[p].column)){var h=t[p];if(h.template_data_binding=r[p],h.key=p,h.data_table_id in e){var m=e[h.data_table_id];if(0!=m.length){if("columns"in h&&null!=h.columns){var v=m[0].length;h.columns=h.columns.filter((function(t){return t<v})),s.column_names[p]=h.columns.map((function(t){return m[0][t]})),s.metadata[p]=h.columns.map((function(t){const{type_id:e,output_format_id:n}=l(h.data_table_id,t);return e?{type:e.split("$")[0],type_id:e,output_format_id:n}:null}))}else{if(!("column"in h)||null==h.column)throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(h));{s.column_names[p]=m[0][h.column];const{type_id:t,output_format_id:e}=l(h.data_table_id,h.column);t&&(s.metadata[p]={type:t.split("$")[0],type_id:t,output_format_id:e})}}-1==a.indexOf(h.data_table_id)&&(a.push(h.data_table_id),o=Math.max(o,m.length-1)),i.push(h)}else console.warn("Empty data table")}else{var g=[];for(var y in e)g.push(y);console.error("Data table id "+h.data_table_id+" not in "+JSON.stringify(g))}}function _(t,e,n){if(!t.template_data_binding.data_type)return n;var r=function(t,e){const{type_id:n}=l(t,e);if(n)return Ci.getInterpretation(n)}(t.data_table_id,e),i=r?r.parse(n):n;return Number.isNaN(i)&&(i=null),i}for(var b=0;b<o;b++){for(var w={},x=0;x<i.length;x++){var A=e[(h=i[x]).data_table_id];b+1>=A.length||("columns"in h&&null!=h.columns?w[h.key]=h.columns.filter((function(t){return t<A[b+1].length})).map((function(t){return _(h,t,A[b+1][t])})):"column"in h&&null!=h.column&&(h.column>=A[b+1].length?w[h.key]=_(h,h.column,""):w[h.key]=_(h,h.column,A[b+1][h.column])))}s.push(w)}return s}function ki(t){return function(t){for(var e=t.length,n=t[0].length,r=[],i=0;i<n;i++){for(var a=[],o=0;o<e;o++)a.push(t[o][i]);r.push(a)}return r}(t).map((function(t,e){const n=(r=t,i=r.filter((function(t){return t&&!Fi.includes(t.trim())})).map(Mi),Si(i))[0].id;var r,i;return{type_id:n,index:e,output_format_id:n}}))}function Di(t){for(var e=t.length;e-- >1&&(!t[e]||!t[e].length||Array.isArray(t[e])&&-1==t[e].findIndex((function(t){return null!==t&&""!==t})));)t.splice(e,1);return t}Ci.DATETIME_IDS=Object.freeze(Jr.map((function(t){return t.id}))),Ci.NUMBER_IDS=Object.freeze(hi.map((function(t){return t.id}))),Ci.STRING_IDS=Object.freeze([vi.id]),Ci.getInterpretation=(mi=Jr.concat(hi,vi).reduce((function(t,e){return t[e.id]=e,t}),{}),function(t){return mi[t]}),Ci._createAccessorFunction=Ei,Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],i=0;i<n;){var a=e[i];if(t.call(r,a,i,e))return i;i++}return-1},configurable:!0,writable:!0});var Fi=["#DIV/0","#N/A","#NAME?","#NULL!","#NUM!","#REF!","#VALUE!","#ERROR!"],Si=Ci().nMax(1/0).nFailingValues(8).failureFraction(.1);function Mi(t){return(t=t||"").replace(/[€£$¥%º]/g,"")}let Ni,Li={};const Oi=t=>{const e=Et(".dialog");if(t.which in Li){var n=Li[t.which];n.callback&&n.callback(Ni.node().value),e.remove(),t.preventDefault()}};function Ui(t,e,{buttons:n=[{text:"Okay",keyCode:13}],is_html:r=!1,upgrade:i=null,is_loading:a=!1}={}){var o=Et("body").append("div").attr("class","dialog").attr("tabindex",0),s=o.append("div").attr("class","dialog-inner"),u=s.append("div").attr("class","text"+(a?" loading":""));if(u.append("h1").html(t),"string"==typeof e)Ni=r?u.append("div").classed("loading-spinner",a).html(e):u.append("p").text(e);else if(e instanceof HTMLElement)Ni=u.append((()=>e));else if("object"==typeof e){if(Ni=u.append(e.type),e.value&&(Ni.node().value=e.value),e.attributes)for(var l in e.attributes)Ni.attr(l,e.attributes[l]);Ni.node().focus()}var c=s;null!=i&&"object"==typeof i&&function(t,e,n,r){r&&t.classed("business",!0);var i=t.append("div").attr("class","text");i.append("p").text(e),i.append("ul").selectAll("li").data(n).enter().append("li").html((function(t){return t})).append("i").attr("class","fa fa-check")}(c=c.append("div").attr("class","upgrade"),i.message,i.list,i.is_business);var d=c.append("div").attr("class","btns"+(a?" loading":""));return Li={},n.forEach((function(t){var e=d.append(t.tag_name||"div").attr("class","btn").attr("data-testid","dialog-button").style("margin-right",a?"0":"0.75em").text(t.text).on("click",(function(){t.callback&&t.callback(Ni.node().value,o),o.remove()}));t.class&&e.classed(t.class,!0),t.keyCode&&(Li[t.keyCode]=t),t.href&&e.attr("href",t.href),t.fa_icon&&e.append("i").lower().attr("class","fa "+t.fa_icon)})),o.node().addEventListener("keydown",Oi),o.node().focus(),o}var Ri="Add new value: ";function Bi(t,e,n,{allow_other_option:r=!1,custom_renderer:i=null,match_anywhere:a=!1}={}){if(t.setAttribute("data-autocomplete",e),t.setAttribute("autocomplete","off"),!document.getElementById(e)){const n=Ct("i").classed("fa fa-chevron-down clickable",!0),r=Ct("div").classed("dropdown autocomplete",!0).attr("id",e);t.insertAdjacentHTML("afterend",n.node().outerHTML+r.node().outerHTML)}var o,s=Et(document.getElementById(e));s.classed("click-to-open",!0);var u=s.append("div").attr("class","dropdown-list");function l(t){if(1===t.length)return"dropdown-category";var e="dropdown-item";return o&&t[0]===o&&(e+=" current"),e}function c(t){u.selectAll("div").remove(),u.selectAll("div").data(t).enter().append("div").attr("class",l).attr("data-value",(function(t){return"string"==typeof t?t||null:t[1]})).each((function(t){const e=Et(this);if(!i){const n=Array.isArray(t)?t[0]:t;return void e.text(n)}let n=i(t,this);if(n){if(Array.isArray(n)||(n=[n]),n.find((t=>"string"!=typeof t&&!(t instanceof HTMLElement))))throw new Error("Autocomplete elements must be strings or HTMLElements");e.node().append(...n)}})),t.length||u.append("div").attr("class","dropdown-item disabled").text("No matches found")}function d(){s.classed("open",!1)}function f(t){var e=t.textContent;return 0===e.indexOf(Ri)&&(e=e.substr(Ri.length)),e}return s.on("mousedown",(function(e){var n=e.target;n.hasAttribute("data-value")?(t.value=f(n),t.setAttribute("data-value",n.getAttribute("data-value")),d(),Et(t).dispatch("change")):e.preventDefault()})),Et(t).on("keydown.autocomplete",(function(e){var n,r;9==e.keyCode||13==e.keyCode?(n=u.select(".selected")).empty()||(t.value=f(n.node()),t.setAttribute("data-value",n.attr("data-value")),d(),Et(t).dispatch("change"),t.blur()):40==e.keyCode?((n=u.select(".selected")).empty()||(r=n.node().nextSibling),r||(r=u.select(".dropdown-item[data-value]").node()),u.selectAll(".selected").classed("selected",!1),Et(r).classed("selected",!0)):38==e.keyCode&&((n=u.select(".selected")).empty()||(r=n.node().previousSibling),r||(r=u.select(".dropdown-item:last-child").node()),u.selectAll(".selected").classed("selected",!1),Et(r).classed("selected",!0))})).on("input.autocomplete",(function(){var e,i,o=t.value,s=o.toLowerCase(),u=!1;if(Et(t).attr("data-value",o),i=a?(t,e)=>t.includes(e):(t,e)=>0===t.indexOf(e),o){e=[];for(var l=0;l<n.length;l++){var d=("string"==typeof n[l]?n[l]:n[l][0]).toLowerCase();d==s&&(u=!0),i(d,s)&&e.push(n[l])}r&&!u&&e.unshift([Ri+o,o])}else e=n;c(e)})).on("focus.autocomplete",(function(){o=t.value,c(n),s.classed("open",!0)})).on("blur.autocomplete",d),{options:function(t){if(!arguments.length)return n;c(n=t)}}}var ji={number:{text:"Number",symbol:"/images/data_type_number.svg"},datetime:{text:"Date/time",symbol:"/images/data_type_date.svg"},string:{text:"Text",symbol:"/images/data_type_string.svg"}};Ci.STRING_IDS[0];var Hi,Ii,Pi,qi=[{full:"#F4B1C5",light:"#FFDDE7"},{full:"#967EC6",light:"#D0C5E5"},{full:"#C67EBD",light:"#E5C5E1"},{full:"#7E91C6",light:"#C5CDE5"},{full:"#7EB0C6",light:"#C5DBE5"},{full:"#7EC69B",light:"#C5E5D2"},{full:"#B3C67E",light:"#DDE5C5"},{full:"#C69B7E",light:"#E5D2C5"}],zi={},Yi={},$i=0;function Vi(t,e){$i=0;var n=!1;t.template_id&&t.dataTables((function(r,i){if(r)return console.error("Failed to get data tables: "+r);Yi={};var a=t.dataBindingsForCurrentTemplate(),o=t.getDataTableNames(),s=Et(".sheet-tab.selected").size()>0?Et(".sheet-tab.selected").datum().id:null;Ii.html("");var u=null;"string"!=typeof e[0]&&(e=["Data"].concat(e));for(var l,c=[],d=0;d<e.length;d++){var f=e[d];if("string"!=typeof f){if(null===l.template_sheet){var p=(f.columns||f.column||"").split("::")[0];if(p)for(var h in o)if(o[h]===p){l.template_sheet=+h;break}}if(null===l.visualisation_sheet){var m=a[f.dataset]&&a[f.dataset][f.key];m&&(l.visualisation_sheet=m.data_table_id)}l.bindings.push(f),d===e.length-1&&c.push(l)}else if(void 0!==l&&c.push(l),l={title:f,description:null,bindings:[],template_sheet:null,visualisation_sheet:null},d<e.length-1){var v=e[d+1];"string"==typeof v&&(l.description=v,d+=1)}}for(d=0;d<c.length;d++){var g=c[d],y=g.bindings,_=g.visualisation_sheet||g.template_sheet||i[0].id,b=(u=Ii.append("div").attr("class","data-block").attr("data-sheet",o[_]).style("display",_===s?null:"none")).append("h2").attr("class","no-select");b.append("i").attr("class","fa fa-table"),b.append("span").text(" "+g.title),g.description&&u.append("p").text(g.description);var w=u.append("div").attr("class","data-bindings-header");w.append("p").attr("class","data-bindings-title").text("Select columns to visualise");for(var x=0;x<y.length;x++){var A=y[x];A.data_type&&(n=!0);var E=a[A.dataset]&&a[A.dataset][A.key],C=E?E.data_table_id:_;Yi[A.dataset]||(Yi[A.dataset]={}),Yi[A.dataset][A.key]=C,C!==_&&C===s&&u.style("display",null),Wi(u.append("div"),A,E,o,C!==s)}n&&w.append("p").attr("class","data-bindings-reset clickable").html("<i class='fa fa-magic'></i> Auto set columns").on("click",(function(){Ui("Automatically choose your columns","<i class='fa fa-magic'></i> Flourish will interpret your data to determine which columns to visualize",{is_html:!0,buttons:[{text:"Continue",keyCode:13,class:"primary",callback:function(){Hi.spreadsheet.inferDataBindings()}},{text:"Cancel",keyCode:27,class:"secondary"}]})}))}Hi.spreadsheet&&(Hi.spreadsheet.updateHighlights(),Hi.spreadsheet.updateTabs())}))}function Wi(t,e,n,r,i){qi[$i]||($i=0),t.attr("class","settings-option option-type-"+e.type).style("display",i?"none":null);var a=null==n?"":nn(n,r,!1,e.optional);zi[e.dataset]||(zi[e.dataset]={}),zi[e.dataset][e.key]=$i;var o="column"===e.type&&!e.optional,s=o&&!n;t.classed("empty-required-binding",s);var u=t.append("div").attr("class","data-binding-title").on("click",(function(){Et(this).select("input").node().focus()}));u.append("h3").text(e.name).append("i").attr("class","fa fa-question setting-tooltip").style("display",e.description||e.data_type?null:"none"),"column"!=e.type||e.optional||u.select("h3").append("span").attr("class","required").text("Required"),u.append("input").attr("id","data-binding-"+e.dataset+"-"+e.key).attr("name",e.dataset+"-"+e.key).attr("disabled",!Hi.visualisation.can_edit||null).attr("autocomplete","off").attr("title",'Type in column IDs here, for example "A" or "A,B,D" or "A-D"').each((function(){this.value=a})).attr("data-value",a).attr("type","text").call(function(t){return function(e){e.on("change",(function(){je.hide(),function(t,e){var n=t.parentElement.parentElement.parentElement.getAttribute("data-sheet"),r=t.value.indexOf("::")>-1,i={type:e.type};"column"==i.type?i.column=r?t.value:n+"::"+t.value:i.columns=r?t.value:n+"::"+t.value;var a,o=t.getBoundingClientRect(),s=[o.left-5,o.top+.5*o.height];if(t.value||"column"!=i.type){try{var u=nn(a=function(t,e){var n={};if(!(t.type in t)){if(t.optional)return n;throw new Error("Data binding must specify '"+t.type+"': "+JSON.stringify(t))}var r=t[t.type].indexOf("::");if(-1==r)throw new Error("Invalid data binding: "+t[t.type]);var i=t[t.type].substr(0,r);n.data_table_id=e[i];var a=t[t.type].substr(r+2);if("column"==t.type)n.column=Je(a,t.optional);else{if("columns"!=t.type)throw new Error("Unknown data binding type: "+t.type);n.columns=tn(a)}return n}(i,Hi.visualisation.getDataTableIds()),Hi.visualisation.getDataTableNames(),!1,e.optional);t.value.toUpperCase()!==u&&(t.value=u)}catch(e){return console.error("Failed to parse data binding",e),je.point(s).text(e.message).draw(),t.value=t.getAttribute("data-value"),void(Pi=!0)}if(Et(t.parentElement.parentElement).classed("empty-required-binding",!1),!a.data_table_id)return t.value=t.getAttribute("data-value"),je.point(s).text("No such data table").draw(),void(Pi=!0);if(e.data_type){const n=Hi.spreadsheet.getTypeAnnotatedColumns();if("column"===i.type){const r=n[a.column];if(!r)return je.point(s).html(`<h1>Column '${t.value}' does not exist</h1><p>Choose a column from the data table</p>`).draw(),t.value=t.getAttribute("data-value"),void(Pi=!0);if(Xi(e,r))return t.value=t.getAttribute("data-value"),je.point(s).html(`\n\t\t\t\t\t\t<h1>This column selection does not accept ${Ji([r.type])} columns</h1>\n\t\t\t\t\t\t<p style="font-size:1em; margin-top:0.75em;">Choose a different column or check/change the column’s type in the header row with the following types:</p>\n\t\t\t\t\t\t<div style="font-size: 1em; margin-top: 0.75em;">${Ji(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(Pi=!0)}else{const r=n.filter((t=>a.columns.includes(t.index))).filter((t=>Xi(e,t)));if(r.length){t.value=t.getAttribute("data-value");var l=r.map((t=>t.type)).reduce(((t,e)=>t.includes(e)?t:[...t,e]),[]).reduce(((t,e,n,r)=>1===r.length?Ji([e]):(n<r.length-1?t+=`${n>0?",":""} ${Ji([e])}`:t+=`or ${Ji([e])}`,t)),"");return je.point(s).html(`\n\t\t\t\t\t\t<h1>This column selection does not accept ${l} columns</h1>\n\t\t\t\t\t\t<p style="font-size:1em; margin-top:0.75em;">Choose a different column or check/change the column’s type in the header row with the following types:</p>\n\t\t\t\t\t\t<div style="font-size: 1em; margin-top: 0.75em;">${Ji(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(Pi=!0)}}}}else if(a=null,!e.optional)return t.value=t.getAttribute("data-value"),je.point(s).text("This column selection is required").draw(),void(Pi=!0);Hi.spreadsheet.updateTabs();var c={};c[e.dataset]={},c[e.dataset][e.key]=a,Gi(c,(function(){t.setAttribute("data-value",t.value);var e=Zi();e?(Et(".publish-btn").classed("disabled",!0),Et(".republish-btn").classed("disabled",!0),Tt(".download-btn").classed("disabled",!0),Et("body").classed("impossible",!0)):(Et(".publish-btn").classed("disabled",!1),Et(".republish-btn").classed("disabled",!1),Tt(".download-btn").classed("disabled",!1),Et("body").classed("impossible",!1),Hi.visualisation.getState((function(t){Hi.visualisation.prepareData((function(e,n){e?console.error("Failed to prepare data for template"):Hi.preview_pane.getDrawCalled()?Hi.preview_pane.sync({data:n,state:t,update:!0}):(Hi.preview_pane.sync({data:n,state:t,draw:!0}),Hi.preview_pane.setDrawCalled(!0))}))}))),Hi.spreadsheet&&Hi.spreadsheet.updateHighlights(),Hi.template_settings&&(e?Hi.template_settings.setReadOnly():Hi.template_settings.unsetReadOnly(),Hi.template_settings.populate()),Hi.theme_chooser.enableOrDisable()}))}(this,t)})).on("keydown",(function(){Hi.confirm.blank()})).on("focus",(function(){Pi||je.hide(),Pi=!1,Tt(".data-bindings .settings-option").classed("open",!1),Et(this.parentElement.parentElement).classed("open",!0)}))}}(e)).style("background",qi[$i].light).style("border-color",qi[$i].full),s&&Hi.template_settings.setReadOnly(),o&&t.append("div").attr("class","data-binding-required").append("p").text("This column selection is required. The visualisation will not update while this field is empty.");var l,c=t.append("div").attr("class","data-binding-description");if(e.description&&c.append("p").text(e.description),e.data_type){var d=c.append("div").attr("class","data-binding-data-types");d.append("p").text("Accepted column types");for(var f=Array.isArray(e.data_type)?e.data_type:[e.data_type],p=0;p<f.length;p++)l="string"==typeof f[p]?f[p]:f[p].type,d.append("span").attr("class","type-symbol data-binding-type-symbol").attr("title",ji[l].text+" column.").style("background-image","url("+ji[l].symbol+")")}$i++}function Gi(t,e){Hi.confirm.saving(),Hi.visualisation.updateDataBindings(t,(function(t){if(t)return Hi.confirm.error(t.message||t),console.error("Failed to save data binding:",t),void Hi.analytics("send","exception",{exDescription:t.message||t,exFatal:!0});Hi.analytics("send","event","visualisation","change_data_binding",Hi.visualisation.id),Hi.confirm.saved(),Ki(),e&&e()}))}function Xi(t,e){return!(Array.isArray(t.data_type)?t.data_type:[t.data_type]).some((t=>"string"==typeof t?t===e.type:t.type===e.type))}function Ji(t){return t.map((t=>`\n\t\t<span class="column-type">\n\t\t<span class="type-symbol" title="${ji[t].text} column" style="background-image: url(${ji[t].symbol});"></span>\n\t\t<h2>${ji[t].text}</h2>\n\t\t</span>\n\t\t`)).join("")}function Zi(){var t=Hi.visualisation.dataBindingsForCurrentTemplate(),e=Hi.template_data_bindings,n={};return e.forEach((function(t){"string"!=typeof t&&(n[t.dataset]||(n[t.dataset]={}),n[t.dataset][t.key]=t)})),e.some((function(e){if("string"!=typeof e&&"column"===e.type&&!n[e.dataset][e.key].optional)return!t[e.dataset]||null==t[e.dataset][e.key]}))}function Ki(t=!0){if(Zi())Et("body").classed("impossible",!0),Et(".empty-label").html("<i class='fa fa-exclamation-triangle'></i> Oops! It looks like one of the required column selections is empty."),Et(".empty-details").html("Head over to the <span class='data-tab-icon'><i class='fa fa-table'></i> Data</span> tab to choose a suitable column.");else if(Et("body").classed("impossible")){const e=Hi.visualisation?Hi.visualisation:Hi.story;e.status&&e.status.requested_by?Hi.confirm_published.awaitingReview(e.status,e.can_review,Hi.user):Hi.visualisation.embed_url&&t?Hi.confirm_published.edited():(Hi.confirm_published.unpublished(),Et("body").classed("impossible",!1),Et(".empty-label").text(""),Et(".empty-details").text(""))}}var Qi,ta,ea,na,ra,ia,aa,oa,sa,ua=!1;function la(t){if(ua&&window.top!==window.self){var e=window;"srcdoc"===e.location.pathname&&(e=e.parent);var n,r=(n={},window._Flourish_template_id&&(n.template_id=window._Flourish_template_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_template_id&&(n.template_id=window.Flourish.app.loaded_template_id),window._Flourish_visualisation_id&&(n.visualisation_id=window._Flourish_visualisation_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_visualisation&&(n.visualisation_id=window.Flourish.app.loaded_visualisation.id),window.Flourish&&window.Flourish.app&&window.Flourish.app.story&&(n.story_id=window.Flourish.app.story.id,n.slide_count=window.Flourish.app.story.slides.length),window.Flourish&&window.Flourish.app&&window.Flourish.app.current_slide&&(n.slide_index=window.Flourish.app.current_slide.index+1),n),i={sender:"Flourish",method:"customerAnalytics"};for(var a in r)r.hasOwnProperty(a)&&(i[a]=r[a]);for(var a in t)t.hasOwnProperty(a)&&(i[a]=t[a]);e.parent.postMessage(JSON.stringify(i),"*")}}function ca(t){if("function"!=typeof t)throw new Error("Analytics callback is not a function");window.Flourish._analytics_listeners.push(t)}function da(){ua=!0;[{event_name:"click",action_name:"click",use_capture:!0},{event_name:"keydown",action_name:"key_down",use_capture:!0},{event_name:"mouseenter",action_name:"mouse_enter",use_capture:!1},{event_name:"mouseleave",action_name:"mouse_leave",use_capture:!1}].forEach((function(t){document.body.addEventListener(t.event_name,(function(){la({action:t.action_name})}),t.use_capture)}))}function fa(){if(null==Qi){var t=function(){var t=window.location;"about:srcdoc"==t.href&&(t=window.parent.location);var e={};return function(t,n,r){for(;r=n.exec(t);)e[decodeURIComponent(r[1])]=decodeURIComponent(r[2])}(t.search.substring(1).replace(/\+/g,"%20"),/([^&=]+)=?([^&]*)/g),e}();Qi="referrer"in t?/^https:\/\/medium.com\//.test(t.referrer):!("auto"in t)}return Qi}function pa(t){var e=t||window.innerWidth;return e>999?650:e>599?575:400}function ha(t,e){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),ta)return t=parseInt(t,10),void n.parent.postMessage({sentinel:"amp",type:"embed-size",height:t},"*");var r={sender:"Flourish",context:"iframe.resize",method:"resize",height:t,src:n.location.toString()};if(e)for(var i in e)r[i]=e[i];n.parent.postMessage(JSON.stringify(r),"*")}}function ma(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function va(t){window.addEventListener("message",(function(e){if(null!=e.source&&(e.origin===document.location.origin||e.origin.match(/\/\/localhost:\d+$|\/\/flourish-api\.com$|\.flourish\.(?:local(:\d+)?|net|rocks|studio)$|\.uri\.sh$/))){var n;try{n=JSON.parse(e.data)}catch(t){return void console.warn("Unexpected non-JSON message: "+JSON.stringify(e.data))}if("Flourish"===n.sender){for(var r=document.querySelectorAll("iframe"),i=0;i<r.length;i++)if(r[i].contentWindow==e.source||r[i].contentWindow==e.source.parent)return void t(n,r[i]);console.warn("could not find frame",n)}}})),ma()&&(window.addEventListener("resize",ga),ga())}function ga(){for(var t=document.querySelectorAll(".flourish-embed"),e=0;e<t.length;e++){var n=t[e];if(!n.getAttribute("data-width")){var r=n.querySelector("iframe");if(r){var i=window.getComputedStyle(n),a=n.offsetWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight);r.style.width=a+"px"}}}}function ya(t,e,n,r,i){var a=document.createElement("iframe");if(a.setAttribute("scrolling","no"),a.setAttribute("frameborder","0"),a.setAttribute("title","Interactive or visual content"),a.setAttribute("sandbox","allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"),e.appendChild(a),a.offsetParent||"fixed"===getComputedStyle(a).position)_a(t,e,a,n,r,i);else{var o={embed_url:t,container:e,iframe:a,width:n,height:r,play_on_load:i};if(window._flourish_poll_items?window._flourish_poll_items.push(o):window._flourish_poll_items=[o],window._flourish_poll_items.length>1)return a;var s=setInterval((function(){window._flourish_poll_items=window._flourish_poll_items.filter((function(t){return!t.iframe.offsetParent||(_a(t.embed_url,t.container,t.iframe,t.width,t.height,t.play_on_load),!1)})),window._flourish_poll_items.length||clearInterval(s)}),500)}return a}function _a(t,e,n,r,i,a){var o;return r&&"number"==typeof r?(o=r,r+="px"):r&&r.match(/^[ \t\r\n\f]*([+-]?\d+|\d*\.\d+(?:[eE][+-]?\d+)?)(?:\\?[Pp]|\\0{0,4}[57]0(?:\r\n|[ \t\r\n\f])?)(?:\\?[Xx]|\\0{0,4}[57]8(?:\r\n|[ \t\r\n\f])?)[ \t\r\n\f]*$/)&&(o=parseFloat(r)),i&&"number"==typeof i&&(i+="px"),r?n.style.width=r:ma()?n.style.width=e.offsetWidth+"px":n.style.width="100%",!!i||(t.match(/\?/)?t+="&auto=1":t+="?auto=1",i=pa(o||n.offsetWidth)+"px"),i&&("%"===i.charAt(i.length-1)&&(i=parseFloat(i)/100*e.parentNode.offsetHeight+"px"),n.style.height=i),n.setAttribute("src",t+(a?"#play-on-load":"")),n}function ba(t,e,n){for(var r in e||(e=[]),n||(n={}),t)e.push(r),"object"==typeof t[r]&&ba(t[r],e,n),n[e.join(".")]=t[r],e.pop();return n}function wa(t){var e={};for(var n in t){for(var r=e,i=n.indexOf("."),a=0;i>=0;i=n.indexOf(".",a=i+1)){var o=n.substring(a,i);o in r||(r[o]={}),r=r[o]}r[n.substring(a)]=t[n]}return e}function xa(t){if(null==t)return t;var e,n={};for(var r in t)Array.isArray(t[r])?n[r]=t[r].slice():(e=t[r],Array.isArray(e)||"object"!=typeof e||null==e?n[r]=t[r]:n[r]=xa(t[r]));return n}var Aa,Ea=null;function Ca(){return"MessageChannel"in window}var Ta=null;function ka(){Ta&&ea.removeEventListener("load",Ta),Ta=null}function Da(t){ka(),ea.addEventListener("load",t),Ta=t}var Fa=null;function Sa(){Fa&&(cancelAnimationFrame(Fa),Fa=null)}function Ma(t,e){Sa();var n=null,r=function(i){null==n&&(n=i);var a=i-n,o=Math.min(1,Math.max(0,a/t));ea.style.opacity=1-o,1==o?(Fa=null,e()):Fa=requestAnimationFrame(r)};Fa=requestAnimationFrame(r)}function Na(t,e,n){return Ka(!1),sa=t?t.visualisation?t.visualisation:t.current_slide.visualisation:null,Ea=null,sa&&sa.template_id?(Da(function(t,e,n){var r=t.visualisation?t.visualisation.template_id:t.current_slide.visualisation.template_id,i=t.current_slide?t.current_slide.id:null;return function(){Dt(),!sa||sa.template_id!=r||t.current_slide&&t.current_slide.id!==i||(ka(),Ia((function(a,o){a?console.error("Failed to get default state"):!sa||sa.template_id!=r||t.current_slide&&t.current_slide.id!==i||Pa((function(a,s){if(a)console.error("Failed to call hasData");else if(sa&&sa.template_id==r&&(!t.current_slide||t.current_slide.id===i)){var u=!1;t.visualisation&&(u=t.data_bindings.requiredBindingsAreUnset()),s?sa.refreshDataBindings((function(a){a?console.error("Failed to refresh data bindings"):!sa||sa.template_id!=r||t.current_slide&&t.current_slide.id!==i||sa.prepareData((function(a,s){a?console.error("Failed to prepare data for template"):!sa||sa.template_id!=r||t.current_slide&&t.current_slide.id!==i||Ja({data:s,state:e,draw:!u},(function(t,e){Ea=o,n(t,e)}))}))})):Ja({state:e,draw:!u},(function(t,e){Ea=o,n(t,e)}))}}))})))}}(t,e,n)),ea.src="/template/"+sa.template_id+"/embed/?auto=1&environment="+na+"&is_read_only="+(t.is_read_only?"1":"0"),ea):(ka(),ea.src="about:blank",ea)}function La(t,e,n,r){var i="about:blank"===ea.src;if(Ka(!1),e){var a=t[e]||"/template/"+e+"/embed";a+="?environment="+na,r&&(a+="&auto=1"),i?o():Ma(250,o)}else Ma(250,(function(){ka(),ea.src="about:blank"}));function o(){Da(function(t){return function(){Ia((function(e,n){e?console.error("Failed to get default state"):(Ea=n,t())}))}}((function(){n(),i||function(t){Sa();var e=null,n=function(r){null==e&&(e=r);var i=r-e,a=Math.min(1,Math.max(0,i/t));ea.style.opacity=a,Fa=1==a?null:requestAnimationFrame(n)};Fa=requestAnimationFrame(n)}(250)}))),ea.src=a}}function Oa(t,e){var n=t.template_id;t.refreshDataBindings((function(r){r?console.error("Failed to fetch data bindings"):t.prepareData((function(t,r){if(sa&&sa.template_id==n)return t?(console.error("Failed to prepare data for template"),void e(t)):void e(void 0,r)}))}))}function Ua(t,e){Oa(t,(function(t,n){if(t)return e(t);Ja({data:n,update:!0},e)}))}function Ra(t,e){Oa(t,(function(t,n){if(t)return e(t);Ja({data:n,update:!1},e)}))}function Ba(t,e,n){Oa(t,(function(t,r){if(t)return n(t);Ja({data:r,state:e,overwrite_state:!0,update:!0},n)}))}function ja(t,e,n){if(Ca()){var r=new MessageChannel;r.port1.onmessage=function(t){var e=t.data;if("string"==typeof e){if(!n)return;return n(void 0,JSON.parse(e))}if("object"==typeof e){if("result"in e){if(!n)return;return n(void 0,e.result)}if("error"in e){if(!n)return;return n(e.error)}console.error("Unrecognised response to message",e)}else console.error("Unrecognised response to message",e)},ea.contentWindow.postMessage({sender:"Flourish",method:t,argument:e},"*",[r.port2])}}function Ha(t,e){ja("setState",wa(t),e)}function Ia(t,e){"function"!=typeof t?ja("getState",t,e):ja("getState",void 0,t)}function Pa(t){ja("hasData",void 0,t)}function qa(t,e){ja("setData",t,e)}function za(t){ja("getData",void 0,t)}function Ya(t){ja("draw",void 0,t),Ka(!0)}function $a(t){aa&&aa.clear(),Za()&&ja("update",void 0,t)}function Va(t,e){ja("snapshot",t,e)}function Wa(){return xa(Ea)}function Ga(t,e){ja("setFixedHeight",t,e)}function Xa(t){if(ea.parentNode.offsetWidth){if(void 0!==t)Aa=null!=t;else if(Aa)return;var e=t||ia&&ia.responsive_menu&&ia.responsive_menu.getHeightSetting()||ra.getHeightForBreakpoint(ea.offsetWidth);"number"==typeof e&&(e+="px"),ea.style.height=e}}function Ja(t,e){Za()?delete t.draw:t.draw&&Ka(!0),t.state&&(t.state=wa(t.state)),aa&&aa.clear(),ja("sync",t,(function(n,r){null!=n||"success"!==r?(t.draw&&Ka(!1),function n(r){r?e&&e(r):function(t,e){return t.data?(qa(t.data,e),delete t.data,!1):t.state?(Ha(t.state,e),delete t.state,!1):t.draw?(Ya(e),delete t.draw,!1):!t.update||($a(e),delete t.update,!1)}(t,n)&&e&&e(void 0)}(n)):e&&e(void 0)}))}function Za(){return oa}function Ka(t){oa=t}function Qa(t,e,n,r,i){return ea=document.querySelector(t),na=e,ia=n,aa=r,i||(i={}),ta="#amp=1"==window.location.hash,ra={createEmbedIframe:ya,isFixedHeight:fa,getHeightForBreakpoint:pa,startEventListeners:va,notifyParentWindow:ha,isSafari:ma,initCustomerAnalytics:da,addAnalyticsListener:ca,sendCustomerAnalyticsMessage:la},ea.style.height=ra.getHeightForBreakpoint(ea.offsetWidth)+"px",ra.startEventListeners((function(t){"resize"==t.method?Xa(t.height):"warn"==t.method?(aa&&aa.warn(t),console.warn("Warning from template:",t.message,t.explanation)):t.method in i&&i[t.method](t)})),Ca()||function(t){if(t){var e=document.createElement("div");e.className="unsupported-notice",e.innerHTML="<h3>Please update your browser</h3><p>This page only works with newer versions of your browser.</p>",t.appendChild(e)}}(ea.parentNode),{loadVisualisation:Na,loadTemplate:La,updateData:Ua,updateDataAndState:Ba,updateDataNotPreview:Ra,setState:Ha,getState:Ia,getDefaultState:Wa,hasData:Pa,setData:qa,getData:za,draw:Ya,update:$a,snapshot:Va,setFixedHeight:Ga,resize:Xa,sync:Ja,getDrawCalled:Za,setDrawCalled:Ka}}var to=function(t=document.body){t.classList.add("loading")},eo=function(t=document.body){t.classList.remove("loading")},no="/api/file/upload";function ro(t){(t||document).querySelectorAll("input[type=url]").forEach((function(t){io(t)}))}function io(t,e){var n=t.ownerDocument.createElement("button");n.type="button",n.className="upload",n.setAttribute("title","Upload a file from your computer"),n.innerHTML="⬆︎",t.insertAdjacentElement("afterend",n),e||(n.onclick=ao)}function ao(){var t=this.previousSibling,e=t.getAttribute("accept");t.disabled=!0,t.classList.toggle("uploading",!0),oo({accept:e,success:function(e){var n;t.disabled=!1,t.classList.toggle("uploading",!1),t.value=e,"createEvent"in document?(n=document.createEvent("Event")).initEvent("change",!0,!0):n=new Event("change",{bubbles:!0}),t.dispatchEvent(n)},failure:function(){t.disabled=!1,t.classList.toggle("uploading",!1)}})}function oo(t){var e=document.getElementById("file-uploader");e||((e=document.createElement("input")).type="file",e.setAttribute("id","file-uploader"),e.style.display="none",document.body.appendChild(e)),t.accept?e.setAttribute("accept",t.accept):e.removeAttribute("accept"),e.onchange=function(){var n,r,i,a;to(),n=e.files,r=t.success,i=t.failure,function(t,e){var n={filename:t.name,content_type:t.type,size:t.size};so(no,n,(function(t,n){return t?e(t):e(null,JSON.parse(n.responseText))}))}(a=n[0],(function(t,e){if(t)return eo(),Ui("Upload error","There was a problem uploading your file: "+t),void console.error(t);var n=function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}({file:a},e.fields);so(e.upload_url,n,(function(t,n){eo(),t?(Ui("Upload error","There was a problem uploading your file ("+n.status+")."),console.error(t),i&&i()):r(e.file_url)}))})),e.parentNode.removeChild(e)},e.click()}function so(t,e,n){var r=new XMLHttpRequest,i=new FormData;if("object"==typeof e){for(var a in e)e.hasOwnProperty(a)&&"file"!==a&&i.append(a,e[a]);e.hasOwnProperty("file")&&i.append("file",e.file)}window.Flourish.csrf_token&&i.append("csrf_token",window.Flourish.csrf_token),r.onload=function(){if(r.status>=200&&r.status<300)n(null,r);else try{var e=JSON.parse(r.responseText).error;n(e,r)}catch(e){n(new Error("POST "+t+" received status code: "+r.status),r)}},r.open("POST",t,!0),r.send(i)}var uo="https://fonts.googleapis.com/css?family=",lo=["Source Sans Pro","Roboto Condensed","Merriweather","Lora","Playfair Display","Coda","Lobster","Cabin Sketch"],co="Same as parent",fo=[],po=[],ho={};function mo(t){return uo+t.replace(/ /g,"+")+":400,700"}function vo(t){var e=po.concat(fo,lo.map((function(t){return{name:t,url:mo(t)}})));return t&&e.unshift({name:co}),e}function go(t){return vo(!0).find((function(e){return e.name==t}))}var yo=!1;function _o(t){return t.substr(t.lastIndexOf("=")+1).replace(/\+/g," ")}function bo(t){var e=t.target,n=e.value;if(n&&(0==n.indexOf(uo)&&(n=e.value=_o(n)),!go(n))){if(/^https?:\/\//.test(n)){yo||(wo(n),e.value="");var r=n;return n=e.value=_o(r),po.push({name:n,url:r}),void xo()}var i=mo(n);try{var a=new XMLHttpRequest;if(a.open("HEAD",i,!1),a.send(),404==a.status)throw"Font not found";po.push({name:n,url:i}),xo()}catch(t){wo(n),e.value=""}}}function wo(t){Ui("Unrecognised font “"+t+"”","Fonts must be chosen from Google Fonts. Visit <a href='https://fonts.google.com'>fonts.google.com</a> to find more",{is_html:!0})}function xo(){var t,e,n=Object.keys(ho);for(t=0;t<n.length;++t)(e=ho[n[t]]).autocomplete.options(vo(e.can_inherit).map((function(t){return t.name})))}var Ao={initialize:function(t,e,n){var r=!!e.optional;yo=n,t.classList.add("font-menu"),ho[e.property]={autocomplete:Bi(t,e.property+"-dropdown",vo(r).map((function(t){return t.name})),{allow_other_option:!0}),can_inherit:r},t.addEventListener("change",bo)},update:function(t,e){var n=e?e.name:co;t.value=n,go(n)||(n!=co&&po.push({name:n,url:e.url}),xo())},getValue:function(t){if(/^https?:\/\//.test(t.value))return{name:_o(t.value),url:t.value};var e=t.value;if(e==co)return null;var n=go(e);return n||{name:e,url:mo(e)}},replaceThemeFonts:function(t){fo=(t||[]).map((function(t){return{name:t.name,url:t.url}})),xo()}},Eo="$";function Co(){}function To(t,e){var n=new Co;if(t instanceof Co)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,a=t.length;if(null==e)for(;++i<a;)n.set(i,t[i]);else for(;++i<a;)n.set(e(r=t[i],i,t),r)}else if(t)for(var o in t)n.set(o,t[o]);return n}function ko(){}Co.prototype=To.prototype={constructor:Co,has:function(t){return Eo+t in this},get:function(t){return this[Eo+t]},set:function(t,e){return this[Eo+t]=e,this},remove:function(t){var e=Eo+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===Eo&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===Eo&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===Eo&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===Eo&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===Eo&&++t;return t},empty:function(){for(var t in this)if(t[0]===Eo)return!1;return!0},each:function(t){for(var e in this)e[0]===Eo&&t(this[e],e.slice(1),this)}};var Do=To.prototype;ko.prototype={constructor:ko,has:Do.has,add:function(t){return this[Eo+(t+="")]=t,this},remove:Do.remove,clear:Do.clear,values:Do.keys,size:Do.size,empty:Do.empty,each:Do.each};var Fo={value:function(){}};function So(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Mo(r)}function Mo(t){this._=t}function No(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Lo(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Oo(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Fo,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function Uo(t,e,n,r,i){for(var a in t.getVersionNumber=function(){return t.version_number},t.setVersionNumber=function(e){t.version_number=e},t.id=e,t.version_number=n||0,r)t[a]=r[a];if(i)for(var a in i)t[a]=i[a]}Mo.prototype=So.prototype={constructor:Mo,on:function(t,e){var n,r=this._,i=No(t+"",r),a=-1,o=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(n=(t=i[a]).type)r[n]=Oo(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Oo(r[n],t.name,null);return this}for(;++a<o;)if((n=(t=i[a]).type)&&(n=Lo(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Mo(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(r=this._[t]).length;a<n;++a)r[a].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};var Ro={};function Bo(t){t.running||(t.running=!0,jo(t,(function(){t.running=!1})))}function jo(t,e){t.request=function(t,e){var n="method"in t?t.method:"POST",r="request_type"in t?t.request_type:"application/json",i="response_type"in t?t.response_type:"application/json",a=t.url,o=t.payload,s=t.callback;!o&&Ho(n)&&(o=function(){return{}});if(o){if("function"!=typeof o)throw new Error("Internal error: processRequestThen: payload must be a function, not "+typeof o,o);"object"==typeof(o=o())&&Ho(n)&&(window.Flourish&&window.Flourish.csrf_token||console.trace("window.Flourish.csrf_token missing"),o.csrf_token=window.Flourish.csrf_token),"string"!=typeof o&&(o=JSON.stringify(o))}var u=function(t,e){var n,r,i,a,o=So("beforesend","progress","load","error"),s=To(),u=new XMLHttpRequest,l=null,c=null,d=0;function f(t){var e,r=u.status;if(!r&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(u)||r>=200&&r<300||304===r){if(i)try{e=i.call(n,u)}catch(t){return void o.call("error",n,t)}else e=u;o.call("load",n,e)}else o.call("error",n,t)}if("undefined"!=typeof XDomainRequest&&!("withCredentials"in u)&&/^(http(s)?:)?\/\//.test(t)&&(u=new XDomainRequest),"onload"in u?u.onload=u.onerror=u.ontimeout=f:u.onreadystatechange=function(t){u.readyState>3&&f(t)},u.onprogress=function(t){o.call("progress",n,t)},n={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s.get(t):(null==e?s.remove(t):s.set(t,e+""),n)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",n):r},responseType:function(t){return arguments.length?(a=t,n):a},timeout:function(t){return arguments.length?(d=+t,n):d},user:function(t){return arguments.length<1?l:(l=null==t?null:t+"",n)},password:function(t){return arguments.length<1?c:(c=null==t?null:t+"",n)},response:function(t){return i=t,n},get:function(t,e){return n.send("GET",t,e)},post:function(t,e){return n.send("POST",t,e)},send:function(e,i,f){return u.open(e,t,!0,l,c),null==r||s.has("accept")||s.set("accept",r+",*/*"),u.setRequestHeader&&s.each((function(t,e){u.setRequestHeader(e,t)})),null!=r&&u.overrideMimeType&&u.overrideMimeType(r),null!=a&&(u.responseType=a),d>0&&(u.timeout=d),null==f&&"function"==typeof i&&(f=i,i=null),null!=f&&1===f.length&&(f=function(t){return function(e,n){t(null==e?n:null)}}(f)),null!=f&&n.on("error",f).on("load",(function(t){f(null,t)})),o.call("beforesend",n,u),u.send(null==i?null:i),n},abort:function(){return u.abort(),n},on:function(){var t=o.on.apply(o,arguments);return t===o?n:t}},null!=e){if("function"!=typeof e)throw new Error("invalid callback: "+e);return n.get(e)}return n}(a);r&&"GET"!==n&&u.header("Content-Type",r);i&&u.mimeType(i);return u.on("error",(function(t){var n;try{n=JSON.parse(t.target.responseText),s(n.error)}catch(e){s("Internal error: "+t.target.responseText)}e()})),u.on("load",(function(t){var n=t.responseText;"application/json"===i&&(n=JSON.parse(n));try{s(void 0,n)}catch(t){console.error(t.stack)}e()})),u.send(n,o),u}(t.items.shift(),(function(){t.request=null,0==t.items.length?e():jo(t,e)}))}function Ho(t){return["POST","PUT","DELETE"].includes(t)}function Io(t,e){void 0===e&&(e="default"),e in Ro||(Ro[e]={items:[],running:!1,name:e}),Ro[e].items.push(t),Bo(Ro[e])}function Po(t,e){for(var n in e)t[n]=e[n];return t}function qo(t,e,n,r){"function"==typeof n&&(r=n,n=!1),n&&Po(t,e),Io({url:t.api_prefix+"/"+t.id,payload:function(){return{version_number:t.getVersionNumber(),fields:e}},callback:function(i,a){if(i)return r(i);n||Po(t,e),t.setVersionNumber(a.version_number),r(void 0)}})}function zo(t,e){t.delete_requested=!0,Io({url:t.api_prefix+"/"+t.id,method:"DELETE",payload:function(){return{version_number:t.getVersionNumber()}},callback:function(n,r){if(n)return e(n);t.setVersionNumber(r.version_number),t.is_deleted=!0,e(void 0,r)}})}var Yo={update:function(t,e){Io({url:"/api/user",method:"POST",payload:function(){return{fields:t}},callback:e})},isUsernameAvailable:function(t,e){Io({url:"/api/user/username?u="+encodeURIComponent(t),method:"GET",callback:e})},getReviewCount:function(t){Io({url:"/api/reviews/count",method:"GET",callback:t})},logHistory:function(t){Io({url:"/api/history",method:"POST",payload:function(){return t},callback:function(){}})},addApiKey:function(t){Io({url:"/api/user/api_keys",method:"PUT",callback:t})},getApiKeys:function(t){Io({url:"/api/user/api_keys",method:"GET",callback:t})},deleteApiKey:function(t,e){Io({url:"/api/user/api_keys/"+t,method:"DELETE",callback:e})},fetchProjects:function(t,e,n,r,i,a,o,s){var u="";e&&(u+="&folder="+encodeURIComponent(e)),n&&(u+="&sort="+encodeURIComponent(n)),r&&(u+="&filter="+encodeURIComponent(r)),i&&(u+="&offset="+encodeURIComponent(i)),a&&(u+="&limit="+encodeURIComponent(a)),o&&(u+="&search="+encodeURIComponent(o)),s&&(u+="&is_recent=true"),Io({url:"/api/user/projects?"+u,method:"GET",callback:t})},addTag:function(t,e){Io({url:"/api/user/tag/"+encodeURIComponent(t),method:"PUT",callback:e})},renameTag:function(t,e,n){Io({url:"/api/user/tag/"+encodeURIComponent(t)+"/"+encodeURIComponent(e),method:"PUT",callback:n})},removeTag:function(t,e){Io({url:"/api/user/tag/"+encodeURIComponent(t),method:"DELETE",callback:e})},fetchFolders:function(t){Io({url:"/api/user/folders",method:"GET",callback:t})},setSamlProviderId:function(t,e,n){Io({url:"/api/user/"+encodeURIComponent(t)+"/change_saml_provider_id",method:"POST",payload:function(){return{saml_provider_id:e}},callback:n})}};function $o(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Vo(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Wo(){}var Go=.7,Xo=1/Go,Jo="\\s*([+-]?\\d+)\\s*",Zo="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ko="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qo=/^#([0-9a-f]{3,8})$/,ts=new RegExp("^rgb\\("+[Jo,Jo,Jo]+"\\)$"),es=new RegExp("^rgb\\("+[Ko,Ko,Ko]+"\\)$"),ns=new RegExp("^rgba\\("+[Jo,Jo,Jo,Zo]+"\\)$"),rs=new RegExp("^rgba\\("+[Ko,Ko,Ko,Zo]+"\\)$"),is=new RegExp("^hsl\\("+[Zo,Ko,Ko]+"\\)$"),as=new RegExp("^hsla\\("+[Zo,Ko,Ko,Zo]+"\\)$"),os={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ss(){return this.rgb().formatHex()}function us(){return this.rgb().formatRgb()}function ls(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Qo.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?cs(e):3===n?new hs(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ds(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ds(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=ts.exec(t))?new hs(e[1],e[2],e[3],1):(e=es.exec(t))?new hs(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ns.exec(t))?ds(e[1],e[2],e[3],e[4]):(e=rs.exec(t))?ds(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=is.exec(t))?ys(e[1],e[2]/100,e[3]/100,1):(e=as.exec(t))?ys(e[1],e[2]/100,e[3]/100,e[4]):os.hasOwnProperty(t)?cs(os[t]):"transparent"===t?new hs(NaN,NaN,NaN,0):null}function cs(t){return new hs(t>>16&255,t>>8&255,255&t,1)}function ds(t,e,n,r){return r<=0&&(t=e=n=NaN),new hs(t,e,n,r)}function fs(t){return t instanceof Wo||(t=ls(t)),t?new hs((t=t.rgb()).r,t.g,t.b,t.opacity):new hs}function ps(t,e,n,r){return 1===arguments.length?fs(t):new hs(t,e,n,null==r?1:r)}function hs(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function ms(){return"#"+gs(this.r)+gs(this.g)+gs(this.b)}function vs(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"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))+(1===t?")":", "+t+")")}function gs(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ys(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new bs(t,e,n,r)}function _s(t){if(t instanceof bs)return new bs(t.h,t.s,t.l,t.opacity);if(t instanceof Wo||(t=ls(t)),!t)return new bs;if(t instanceof bs)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,u=(a+i)/2;return s?(o=e===a?(n-r)/s+6*(n<r):n===a?(r-e)/s+2:(e-n)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new bs(o,s,u,t.opacity)}function bs(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function ws(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function xs(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}$o(Wo,ls,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:ss,formatHex:ss,formatHsl:function(){return _s(this).formatHsl()},formatRgb:us,toString:us}),$o(hs,ps,Vo(Wo,{brighter:function(t){return t=null==t?Xo:Math.pow(Xo,t),new hs(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Go:Math.pow(Go,t),new hs(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:ms,formatHex:ms,formatRgb:vs,toString:vs})),$o(bs,(function(t,e,n,r){return 1===arguments.length?_s(t):new bs(t,e,n,null==r?1:r)}),Vo(Wo,{brighter:function(t){return t=null==t?Xo:Math.pow(Xo,t),new bs(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Go:Math.pow(Go,t),new bs(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new hs(ws(t>=240?t-240:t+120,i,r),ws(t,i,r),ws(t<120?t+240:t-120,i,r),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;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var As=xs("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Es=xs("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Cs=xs("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Ts=xs("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");function ks(t){return function(){return t}}function Ds(t){return 1==(t=+t)?Fs:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):ks(isNaN(e)?n:e)}}function Fs(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):ks(isNaN(t)?e:t)}var Ss=function t(e){var n=Ds(e);function r(t,e){var r=n((t=ps(t)).r,(e=ps(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),o=Fs(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=o(e),t+""}}return r.gamma=t,r}(1);function Ms(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Ns=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ls=new RegExp(Ns.source,"g");function Os(t,e){var n,r,i,a=Ns.lastIndex=Ls.lastIndex=0,o=-1,s=[],u=[];for(t+="",e+="";(n=Ns.exec(t))&&(r=Ls.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,u.push({i:o,x:Ms(n,r)})),a=Ls.lastIndex;return a<e.length&&(i=e.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,r=0;r<e;++r)s[(n=u[r]).i]=n.x(t);return s.join("")})}var Us,Rs,Bs,js,Hs=180/Math.PI,Is={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ps(t,e,n,r,i,a){var o,s,u;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r<e*n&&(t=-t,e=-e,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*Hs,skewX:Math.atan(u)*Hs,scaleX:o,scaleY:s}}function qs(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(a,o){var s=[],u=[];return a=t(a),o=t(o),function(t,r,i,a,o,s){if(t!==i||r!==a){var u=o.push("translate(",null,e,null,n);s.push({i:u-4,x:Ms(t,i)},{i:u-2,x:Ms(r,a)})}else(i||a)&&o.push("translate("+i+e+a+n)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(t,e,n,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ms(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,o.rotate,s,u),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ms(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,o.skewX,s,u),function(t,e,n,r,a,o){if(t!==n||e!==r){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:Ms(t,n)},{i:s-2,x:Ms(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(t){for(var e,n=-1,r=u.length;++n<r;)s[(e=u[n]).i]=e.x(t);return s.join("")}}}var zs,Ys,$s=qs((function(t){return"none"===t?Is:(Us||(Us=document.createElement("DIV"),Rs=document.documentElement,Bs=document.defaultView),Us.style.transform=t,t=Bs.getComputedStyle(Rs.appendChild(Us),null).getPropertyValue("transform"),Rs.removeChild(Us),Ps(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}),"px, ","px)","deg)"),Vs=qs((function(t){return null==t?Is:(js||(js=document.createElementNS("http://www.w3.org/2000/svg","g")),js.setAttribute("transform",t),(t=js.transform.baseVal.consolidate())?Ps((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Is)}),", ",")",")"),Ws=0,Gs=0,Xs=0,Js=0,Zs=0,Ks=0,Qs="object"==typeof performance&&performance.now?performance:Date,tu="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function eu(){return Zs||(tu(nu),Zs=Qs.now()+Ks)}function nu(){Zs=0}function ru(){this._call=this._time=this._next=null}function iu(t,e,n){var r=new ru;return r.restart(t,e,n),r}function au(){Zs=(Js=Qs.now())+Ks,Ws=Gs=0;try{!function(){eu(),++Ws;for(var t,e=zs;e;)(t=Zs-e._time)>=0&&e._call.call(null,t),e=e._next;--Ws}()}finally{Ws=0,function(){var t,e,n=zs,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:zs=e);Ys=t,su(r)}(),Zs=0}}function ou(){var t=Qs.now(),e=t-Js;e>1e3&&(Ks-=e,Js=t)}function su(t){Ws||(Gs&&(Gs=clearTimeout(Gs)),t-Zs>24?(t<1/0&&(Gs=setTimeout(au,t-Qs.now()-Ks)),Xs&&(Xs=clearInterval(Xs))):(Xs||(Js=Qs.now(),Xs=setInterval(ou,1e3)),Ws=1,tu(au)))}function uu(t,e,n){var r=new ru;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}ru.prototype=iu.prototype={constructor:ru,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?eu():+n)+(null==e?0:+e),this._next||Ys===this||(Ys?Ys._next=this:zs=this,Ys=this),this._call=t,this._time=n,su()},stop:function(){this._call&&(this._call=null,this._time=1/0,su())}};var lu=So("start","end","cancel","interrupt"),cu=[];function du(t,e,n,r,i,a){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}function o(a){var l,c,d,f;if(1!==n.state)return u();for(l in i)if((f=i[l]).name===n.name){if(3===f.state)return uu(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[l])}if(uu((function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(d=n.tween.length),l=0,c=-1;l<d;++l)(f=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=f);r.length=c+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(u),n.state=5,1),a=-1,o=r.length;++a<o;)r[a].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=iu(a,0,n.time)}(t,n,{name:e,index:r,group:i,on:lu,tween:cu,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function fu(t,e){var n=hu(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function pu(t,e){var n=hu(t,e);if(n.state>3)throw new Error("too late; already running");return n}function hu(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function mu(t,e){var n,r;return function(){var i=pu(this,t),a=i.tween;if(a!==n)for(var o=0,s=(r=n=a).length;o<s;++o)if(r[o].name===e){(r=r.slice()).splice(o,1);break}i.tween=r}}function vu(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var a=pu(this,t),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:e,value:n},u=0,l=i.length;u<l;++u)if(i[u].name===e){i[u]=s;break}u===l&&i.push(s)}a.tween=i}}function gu(t,e,n){var r=t._id;return t.each((function(){var t=pu(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return hu(t,r).value[e]}}function yu(t,e){var n;return("number"==typeof e?Ms:e instanceof ls?Ss:(n=ls(e))?(e=n,Ss):Os)(t,e)}function _u(t){return function(){this.removeAttribute(t)}}function bu(t){return function(){this.removeAttributeNS(t.space,t.local)}}function wu(t,e,n){var r,i,a=n+"";return function(){var o=this.getAttribute(t);return o===a?null:o===r?i:i=e(r=o,n)}}function xu(t,e,n){var r,i,a=n+"";return function(){var o=this.getAttributeNS(t.space,t.local);return o===a?null:o===r?i:i=e(r=o,n)}}function Au(t,e,n){var r,i,a;return function(){var o,s,u=n(this);if(null!=u)return(o=this.getAttribute(t))===(s=u+"")?null:o===r&&s===i?a:(i=s,a=e(r=o,u));this.removeAttribute(t)}}function Eu(t,e,n){var r,i,a;return function(){var o,s,u=n(this);if(null!=u)return(o=this.getAttributeNS(t.space,t.local))===(s=u+"")?null:o===r&&s===i?a:(i=s,a=e(r=o,u));this.removeAttributeNS(t.space,t.local)}}function Cu(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Tu(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function ku(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Tu(t,i)),n}return i._value=e,i}function Du(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Cu(t,i)),n}return i._value=e,i}function Fu(t,e){return function(){fu(this,t).delay=+e.apply(this,arguments)}}function Su(t,e){return e=+e,function(){fu(this,t).delay=e}}function Mu(t,e){return function(){pu(this,t).duration=+e.apply(this,arguments)}}function Nu(t,e){return e=+e,function(){pu(this,t).duration=e}}function Lu(t,e){if("function"!=typeof e)throw new Error;return function(){pu(this,t).ease=e}}function Ou(t,e,n){var r,i,a=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?fu:pu;return function(){var o=a(this,t),s=o.on;s!==r&&(i=(r=s).copy()).on(e,n),o.on=i}}var Uu=At.prototype.constructor;function Ru(t){return function(){this.style.removeProperty(t)}}function Bu(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function ju(t,e,n){var r,i;function a(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&Bu(t,a,n)),r}return a._value=e,a}function Hu(t){return function(e){this.textContent=t.call(this,e)}}function Iu(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Hu(r)),e}return r._value=t,r}var Pu=0;function qu(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function zu(){return++Pu}var Yu=At.prototype;qu.prototype={constructor:qu,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=p(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o<i;++o)for(var s,u,l=r[o],c=l.length,d=a[o]=new Array(c),f=0;f<c;++f)(s=l[f])&&(u=t.call(s,s.__data__,f,l))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,du(d[f],e,n,f,d,hu(s,n)));return new qu(a,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=v(t));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var u,l=r[s],c=l.length,d=0;d<c;++d)if(u=l[d]){for(var f,p=t.call(u,u.__data__,d,l),h=hu(u,n),m=0,g=p.length;m<g;++m)(f=p[m])&&du(f,e,n,m,p,h);a.push(p),o.push(u)}return new qu(a,o,e,n)},filter:function(t){"function"!=typeof t&&(t=g(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,o=e[i],s=o.length,u=r[i]=[],l=0;l<s;++l)(a=o[l])&&t.call(a,a.__data__,l,o)&&u.push(a);return new qu(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),o=new Array(r),s=0;s<a;++s)for(var u,l=e[s],c=n[s],d=l.length,f=o[s]=new Array(d),p=0;p<d;++p)(u=l[p]||c[p])&&(f[p]=u);for(;s<r;++s)o[s]=e[s];return new qu(o,this._parents,this._name,this._id)},selection:function(){return new Uu(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=zu(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o,s=r[a],u=s.length,l=0;l<u;++l)if(o=s[l]){var c=hu(o,e);du(o,t,n,l,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new qu(r,this._parents,t,n)},call:Yu.call,nodes:Yu.nodes,node:Yu.node,size:Yu.size,empty:Yu.empty,each:Yu.each,on:function(t,e){var n=this._id;return arguments.length<2?hu(this.node(),n).on.on(t):this.each(Ou(n,t,e))},attr:function(t,e){var n=u(t),r="transform"===n?Vs:yu;return this.attrTween(t,"function"==typeof e?(n.local?Eu:Au)(n,r,gu(this,"attr."+t,e)):null==e?(n.local?bu:_u)(n):(n.local?xu:wu)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=u(t);return this.tween(n,(r.local?ku:Du)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?$s:yu;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var a=I(this,t),o=(this.style.removeProperty(t),I(this,t));return a===o?null:a===n&&o===r?i:i=e(n=a,r=o)}}(t,r)).on("end.style."+t,Ru(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,a;return function(){var o=I(this,t),s=n(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=I(this,t)),o===u?null:o===r&&u===i?a:(i=u,a=e(r=o,s))}}(t,r,gu(this,"style."+t,e))).each(function(t,e){var n,r,i,a,o="style."+e,s="end."+o;return function(){var u=pu(this,t),l=u.on,c=null==u.value[o]?a||(a=Ru(e)):void 0;l===n&&i===c||(r=(n=l).copy()).on(s,i=c),u.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,a=n+"";return function(){var o=I(this,t);return o===a?null:o===r?i:i=e(r=o,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,ju(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(gu(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,Iu(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=hu(this.node(),n).tween,a=0,o=i.length;a<o;++a)if((r=i[a]).name===t)return r.value;return null}return this.each((null==e?mu:vu)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Fu:Su)(e,t)):hu(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Mu:Nu)(e,t)):hu(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(Lu(e,t)):hu(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;pu(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};n.each((function(){var n=pu(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(u)),n.on=e})),0===i&&a()}))},[Symbol.iterator]:Yu[Symbol.iterator]};var $u,Vu,Wu={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Gu(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Xu(t){var e;if($u=Et(".detailed-settings"),(Vu=$u.append("div").attr("class","settings-block")).append("h2").text("Back to settings").on("click",(function(){$u.transition().duration(100).style("opacity",0).on("end",(function(){Et(this).html("").style("display","none"),Et(".template-settings").style("display","block").style("opacity",0).transition().duration(500).style("opacity",1)})),$u.node()})),"string"==typeof t)e=Vu.append("div").html(t);else if("object"==typeof t&&(e=Vu.append(t.type),t.value&&(Vu.node().value=t.value),t.attributes))for(var n in t.attributes)e.attr(n,t.attributes[n]);return e.node().focus(),Et(".template-settings").style("display","none"),$u.style("display","block").style("opacity",0).transition().duration(500).style("opacity",1),$u.node()}At.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,r,i,a=t.__transition,o=!0;if(a){for(i in e=null==e?null:e+"",a)(n=a[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete t.__transition}}(this,t)}))},At.prototype.transition=function(t){var e,n;t instanceof qu?(e=t._id,t=t._name):(e=zu(),(n=Wu).time=eu(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o,s=r[a],u=s.length,l=0;l<u;++l)(o=s[l])&&du(o,t,e,l,s,n||Gu(o,e));return new qu(r,this._parents,t,e)};var Ju,Zu,Ku,Qu,tl={},el={},nl={"Flourish 1":{scheme:"flourish_default_1",colors:["#1D6996","#EDAD08","#73AF48","#94346E","#38A6A5","#E17C05","#5F4690","#0F8554","#6F4070","#CC503E","#994E95","#666666"]},"Flourish 2":{scheme:"flourish_default_2",colors:["#11A579","#CC503E","#3969AC","#F2B701","#7F3C8D","#80BA5A","#E68310","#CF1C90","#008695","#F97B72","#4B4B8F","#A5AA99"]},Rainbow:{colors:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#994E95","#666666"]},Pastel:{colors:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#D3B484","#B3B3B3"]},Antique:{colors:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#467378","#7C7C7C"]},Accent:{scheme:"schemeAccent",colors:As},Dark:{scheme:"schemeDark2",colors:Es},Paired:{scheme:"schemePaired",colors:Cs},Pale:{scheme:"schemePastel1",colors:Ts},"Farrow & Ball":{colors:["#EDD8C4","#C4A999","#F9C1C0","#B76A4C","#8F483C","#783027","#8A1D2E","#602A1F","#893838","#BD795A","#DC6130","#AD3B34","#ECE8BD","#F7E28A","#EBEB82","#FAD862","#F1CA61","#F5C03B","#F9E7D4","#F4E4AC","#EFD491","#DAC589","#D2B15E","#CD9344","#EFEFCC","#E8E7CA","#CAD5AD","#B9B495","#73806F","#636F65","#BDAB65","#889A73","#829C7A","#6C7855","#81B693","#BBBEA0","#99A286","#AAC0B3","#427E7F","#769194","#ECF3EC","#EBEBD4","#D0D9C9","#9EAF9F","#7A8E8D","#516365","#DBE5DC","#C4C9C5","#CBD7D7","#AABEBF","#66839A","#A0D2CD","#56AAC5","#535E7D","#2E3548","#48606E","#2C3437"]}},rl={};function il(){var t,e={};for(t in rl)e[t]=rl[t];for(t in nl)e[t]=nl[t];return e}var al="Edit color palette";function ol(t){t&&t.length?(rl={},t.forEach((function(t){var e=Object.keys(t)[0];rl[e]={colors:t[e]}}))):rl={},function(){for(var t in tl){tl[t].options(ul())}}()}function sl(){if(void 0!==Ju)return Ju;var t=document.createElement("input");return t.setAttribute("type","color"),t.setAttribute("value","!"),Ju="color"==t.type&&"!"!==t.value}function ul(){var t=[],e=il();for(var n in t.push([al,""]),e)t.push([n,e[n].colors.join("|")]);return t}function ll(t,e){var n=t[0],r=t[1];if(!r){const t=Ct("em");return t.append("i").classed("fa fa-pencil",!0),t.node().append(al),t.node()}Array.isArray(r)||(r=r.split("|"));const i=[];if(e&&n){const t=Ct("label").text(n);i.push(t.node())}return r.forEach((function(t,e){const n=Ct("span").attr("data-index",e).style("background-color",t);i.push(n.node())})),i}function cl(t,e){var n,r,i=il(),a=t.parentNode.querySelector(".color-swatches");if(Array.isArray(e))r=e;else if("string"==typeof e){if(i[e])n=e;else for(var o in i)if(i[o].scheme==e){n=o;break}n&&(r=i[n].colors)}if(!r||!r.length)return t.parentNode.classList.remove("custom"),t.removeAttribute("data-value"),t.value="",void(a.innerHTML="");a.innerHTML="",a.append(...ll([null,r])),t.setAttribute("data-value",r.join("|"))}function dl(t){Qu=t.target,t.dataTransfer.setData("text/plain","x"),event.dataTransfer.effectAllowed="move",Et(Qu).classed("dragging",!0),Tt(".palette p:not(.dragging) input").style("pointer-events","none")}function fl(t){t.preventDefault();var e=Et(".palette").selectAll("[draggable='true']").style("border-color",null),n=Et(t.target);if("true"===n.attr("draggable")){var r="bottom";if(n.node()===e.nodes()[0]){var i=t.target.getBoundingClientRect(),a=i.top+i.height/2;t.clientY<a&&(r="top")}Et(t.target).style("border-"+r,"1px solid black")}}function pl(t){if(Qu){for(var e=t.target;e&&("P"!==e.tagName||!e.nextSibling);)e=e.parentNode;if(e){var n=e.nextSibling;if(e===Et(".palette").selectAll("[draggable='true']").style("border-color",null).nodes()[0]){var r=e.getBoundingClientRect(),i=r.top+r.height/2;t.clientY<i&&(n=e)}e.parentNode.insertBefore(Qu,n),Qu=!1,vl()}}}function hl(){Et(Qu).classed("dragging",!1),Tt(".palette *").style("border-bottom",null).style("border-top",null),Tt(".palette p input").style("pointer-events",null)}function ml(t){for(var e=t.target;e&&"BUTTON"!==e.tagName;)e=e.parentNode;e&&(e.classList.contains("fa-plus-square")?function(t){var e=t.target.parentNode,n=gl("#000000");e.insertAdjacentHTML("beforebegin",n),vl()}(t):e.classList.contains("fa-times")&&function(t){t.parentNode.childNodes.length>2?t.parentNode.removeChild(t):("INPUT"==t.firstChild.tagName?t.firstChild.value="#000000":t.firstChild.style.backgroundColor="#000000",t.firstChild.nextSibling.value="#000000");vl()}(e.parentNode))}function vl(){for(var t=Ku.getAttribute("data-autocomplete"),e=tl[t],n=[],r=Zu.querySelectorAll(".palette input[type=text]"),i=0;i<r.length;i++)n.push(r[i].value);var a=e.options();el[t]?a[0][1]=n.join("|"):a.unshift(["Custom",n.join("|")]),el[t]=n,e.options(a),cl(Ku,n),Et(Ku).dispatch("change")}function gl(t){const e=Ct("p").attr("draggable",!0);return e.append("span").classed("swatch-handle",!0).text(".. .. .."),sl()?e.append("input").attr("type","color").attr("value",t):e.append("span").classed("swatch-color",!0).style("background-color",t),e.append("input").attr("type","text").attr("value",t),e.append("button").attr("type","button").classed("fa fa-times",!0),e.node().outerHTML}function yl(t){var e=t.target,n=e.value,r=e.parentNode;if(!n)return r.parentNode.removeChild(r),void vl();var i=ls(n);if(!i)return console.warn("bad color",n),"color"==e.type?e.value=e.nextSibling.value:sl()?e.value=e.previousSibling.value:e.value=e.previousSibling.style.backgroundColor,void(je.point(e).text(n+" is not a valid color").draw()._getElement().style.zIndex=115);"color"==e.type?e.nextSibling.value=n:sl()?e.previousSibling.value=i.hex():e.previousSibling.style.backgroundColor=n,vl()}var _l,bl,wl,xl={initialize:function(t,e){e.choices&&ol(e.choices),t.type="text",t.classList.add("colors");var n=document.createElement("span");n.setAttribute("class","color-swatches"),t.parentNode.insertBefore(n,t);var r=t.getAttribute("name")+"-dropdown";tl[r]=Bi(t,r,ul(),{custom_renderer:ll}),t.addEventListener("change",(function(e){t.value==al?(e.stopImmediatePropagation(),t.value="",function(t){Ku=t;var e=(Zu=Xu({type:"div",attributes:{class:"palette"}})).querySelector(".palette"),n=function(t,e){e||(e=t.parentNode.querySelector(".color-swatches"));for(var n=[],r=0;r<e.childNodes.length;r++)if(!e.childNodes[r].classList.contains("fa")){var i=e.childNodes[r].style.backgroundColor,a=ls(i);a?n.push(a.hex()):(console.warn("Bad color",i),n.push("#000000"))}return n}(t),r="";n.forEach((function(t){r+=gl(t)})),r+="<p><button class='fa fa-plus-square clickable'></button></p>",e.innerHTML=r,e.addEventListener("change",yl),e.addEventListener("dragstart",dl),e.addEventListener("dragover",fl),e.addEventListener("drop",pl),e.addEventListener("dragend",hl),e.addEventListener("click",ml)}(t)):cl(t,(t.getAttribute("data-value")||"").split("|"))}))},update:cl,getValue:function(t){var e=t.getAttribute("data-value");return e?e.split("|"):null},replaceThemeColors:ol},Al=void 0,El=/fa-(\S*)/g,Cl=/^data:image\/(svg|svg\+xml|png|jpg);base64,[A-Z-a-z0-9+/=]*$/;function Tl(t){Et(t.parentNode).classed("open",(function(){return!Et(this).classed("open")}))}function kl(t){if(t){Al={};for(var e=0,n=null,r=null,i=_l&&_l.user?_l.user.template_settings_overrides:{},a=0;a<t.length;a++){var o=t[a];if("string"!=typeof o){if("object"!=typeof o||n||r||(e++,r=wl.append("div").attr("class","toplevel-settings-block")),"hidden"!==o.type){var s=n||r;if(o.new_section&&(s.append("div").classed("settings-divider",!0),"string"==typeof o.new_section&&s.append("h3").classed("settings-subhead",!0).text(o.new_section)),void 0!==o.show_if){if(o.show_condition)throw new Error("BUG: show_if present as well as show_condition");o.show_condition=[{type:"show",condition:o.show_if}],delete o.show_if}else if(void 0!==o.hide_if){if(o.show_condition)throw new Error("BUG: hide_if present as well as show_condition");o.show_condition=[{type:"hide",condition:o.hide_if}],delete o.hide_if}Al[o.property]=o.type,Dl(s.append("div"),o,i)}}else r=null,(n=wl.append("div").attr("class","settings-block")).append("h2").attr("class","no-select").attr("tabindex","0").text(o).on("click",(function(){Tl(this)})).on("keyup",(function(t){13===t.keyCode&&Tl(this)})),n.classed("open",e<1),"State documentation"===o&&n.style("display","none"),e++}Tt(".upgrade-setting").on("click",(function(){!function(t,e,n,r,i){var a=[],o=[];i?(a.push(["Upgrade to a business account so you can:"]),o.push(["Add custom logos, colours and styles to keep projects on-brand","Remove Flourish logo","Manage your team with collaboration and approval features","And <a href='https://flourish.studio/pricing' target='_blank'>many other benefits</a>"])):(a.push(["Upgrade your account to:"]),o.push(["Keep your data and projects private","Download projects","Get priority support"]));var s=Math.floor(Math.random()*a.length),u=Math.floor(Math.random()*o.length),l="title"+s+"-list"+u,c="upgrade-click",d=[];i?d.push({text:"Email us",class:"convert",tag_name:"a",href:"mailto:sales@flourish.studio?subject=Business%20upgrade%20enquiry",keyCode:13,callback:function(){t.analytics("send","event",c,r,l),Yo.logHistory({category:"upgrade",action:"clicked",detail:r})}}):d.push({text:"Upgrade now",class:"convert",keyCode:13,callback:function(){t.analytics("send","event",c,r,l),Yo.logHistory({category:"upgrade",action:"clicked",detail:r}),setTimeout((function(){window.location.href="/choose-subscription"}),1e3)}}),d.push({text:"Maybe later",keyCode:27,class:"secondary",callback:function(){t.analytics("send","event","upgrade-close",r,l),Yo.logHistory({category:"upgrade",action:"closed",detail:r})}}),t.analytics("send","event","upgrade-open",r,l),Yo.logHistory({category:"upgrade",action:"viewed",detail:r}),Ui(e,n,{buttons:d,is_html:!0,upgrade:{message:a[s],list:o[u],is_business:i}})}(_l,"This is a premium feature","Upgrade your plan to change this setting.","upgrade-settings",!0)})),$e()}}function Dl(t,e,n){e.upgrade=e.property in n;var r=e.choices&&("buttons"==e.style||"boolean"==e.type);t.attr("class","settings-option option-type-"+e.type+(r?" settings-buttons":"")+(e.upgrade?" upgrade-setting":""));var i=t.append("label").attr("for","setting-"+e.property).classed("hidden",null==e.name).append("h3").text(e.name).classed("no-select",!0);e.upgrade?i.append("i").attr("class","popup fa fa-star setting-tooltip tooltip-upgrade").style("font-family","FontAwesome").style("background-color","#93366e").attr("data-popup-head","This is a premium feature").attr("data-popup-body",e.description?e.description.replace(/\[\[/g,"").replace(/\]\]/g,""):"").attr("data-popup-position","top"):e.description&&i.append("i").attr("class","popup fa fa-question setting-tooltip tooltip-help").style("font-family","FontAwesome").attr("data-popup-body",e.description.replace(/\[\[/g,"").replace(/\]\]/g,"")).attr("data-popup-position","top"),e.width&&t.classed("width-"+e.width.replace(/ /g,"-"),!0);var a="input";if("text"!=e.type&&"code"!=e.type||(a="textarea"),"code"==e.type){var o=!1;t.append("i").attr("class","popup fa fa-reply clickable wrap-control").attr("data-popup-body","Wrap/unwrap text").attr("data-popup-position","top").on("click",(function(){o=!o,Et(this.parentNode).select("textarea").attr("wrap",o?null:"off"),Et(this).classed("selected",o)}))}var s=t.append(a).attr("id","setting-"+e.property).attr("class","setting").attr("name",e.property).attr("disabled",!_l.visualisation.can_edit||null),u=s.node();if("colors"==e.type)xl.initialize(u,e);else if("font"==e.type)Ao.initialize(u,e,_l.user&&null!=_l.user.company_id);else if("number"==e.type)u.setAttribute("type","number"),null!=e.min&&u.setAttribute("min",e.min),null!=e.max&&u.setAttribute("max",e.max),e.step&&u.setAttribute("step",e.step);else if("url"==e.type)u.setAttribute("type","url"),bl.addButton(u,e.upgrade);else if(r){s.remove(),s=t.append("div").attr("id","setting-"+e.property).attr("name",e.property).classed("buttons-container",!0).classed("large","large"==e.size),u=s.node();var l=e.choices.length,c=[3,4,5],d=function(){if(l<=2)return{column_count:l,rows:1};var t=c.map((function(t){return{column_count:t,orphans:l%t/t,rows:l/t}})).filter((function(t){return t.rows>=1})).sort((function(t,e){return t.rows>e.rows?1:t.rows<e.rows?-1:0})),e=t.filter((function(t){return 0===t.orphans}));return 1===e.length||e.length>1?e[0]:0===e.length?t.sort((function(t,e){return t.orphans>e.orphans?-1:t.orphans<e.orphans?1:0}))[0]:void 0}();e.choices.forEach((function(t,n){s.append("input").attr("type","radio").attr("name",e.property).attr("value",t[1]).attr("id",e.property+"_"+n).attr("class","setting").attr("disabled",!_l.visualisation.can_edit||null).call(Fl(e)),Ll(t,s.append("label").attr("for",e.property+"_"+n).style("width",100/d.column_count+"%").style("border-radius",(function(){var t=d.column_count,e=Math.ceil(d.rows),r=t*e-l;return e<=1?0===n?"3px 0 0 3px":n===t-1?"0 3px 3px 0":null:e>1?0===n?"3px 0 0 0":n===t-1?"0 3px 0 0":n===l-(t-r)?"0 0 0 3px":n===l-1&&0===r?"0 0 3px 0":null:null})).node())}))}else"boolean"==e.type?(u.setAttribute("type","checkbox"),t.append("label").attr("class","slider").attr("for","setting-"+e.property)):u.setAttribute("type","text");if("code"==e.type&&(u.setAttribute("wrap","off"),s.on("keydown.tab",(function(t){var e=t;if(9===e.keyCode&&!(e.altKey||e.metaKey||e.ctrlKey||e.shiftKey)){e.preventDefault();var n=this.selectionStart;this.value=this.value.substring(0,n)+"\t"+this.value.substring(this.selectionEnd),this.selectionEnd=n+1}}))),e.choices&&"string"==e.type&&"buttons"!=e.style&&Bi(u,e.property+"-dropdown",e.choices,{allow_other_option:e.choices_other,custom_renderer:Ll}),"color"==e.type){Et(u).classed("color",!0).style("display","none");var f=Et(u.parentNode).append("div").attr("class","color-picker"),p=f.append("div").attr("class","color-wrapper");e.optional&&f.append("button").attr("class","cancel-setting popup").html("<svg><use xlink:href='#cancel-setting'></use></svg>").attr("data-popup-body","If cleared, the color will be set automatically based on the theme or context").on("click",(function(){u.value="",s.dispatch("change"),Et(this.parentNode).classed("is-null",!0)})),p.append("input").attr("type","color").on("change",(function(){u.value=this.value,s.dispatch("change"),Et(this.parentNode.parentNode).classed("is-null",!1)})).on("focus",(function(){Et(this.parentNode.parentNode).classed("active",!0)})).on("blur",(function(){Et(this.parentNode.parentNode).classed("active",!1)}))}e.placeholder&&u.setAttribute("placeholder",e.placeholder),e.size&&u.classList.add("size-"+e.size),s.call(Fl(e))}function Fl(t){return function(e){var n=!1;e.on("change",(function(){var e=this;je.hide(),n=!0,_l.preview_pane.getState(t.property,(function(r,i){return r?(console.error("Failed to get state property "+t.property,r),void(n=!1)):function(t,e){if("number"!==e.type)return!0;if(""===t.value)return!!e.optional||(je.point(t).text("A value is required").draw(),!1);var n=parseFloat(t.value);return e.hasOwnProperty("min")&&n<e.min?(je.point(t).text("Value cannot be less than "+e.min).draw(),t.value=e.min):e.hasOwnProperty("max")&&n>e.max&&(je.point(t).text("Value cannot be greater than "+e.max).draw(),t.value=e.max),!0}(e,t)?void function(t,e,n){r=e.property,i=100,a=Ol,o=[t,e,n],clearTimeout(Sl[r]),Sl[r]=setTimeout((function(){a.apply(window,o),delete Sl[r]}),i);var r,i,a,o}(e,t,(function(r){if(!r)return n=!1,void("SELECT"==e.tagName&&Et(e).dispatch("blur"));var a="radio"==e.type?e.nextSibling:e;je.point(a).text("Not changed: "+r).draw();var o={};o[t.property]=i,_l.preview_pane.setState(o,(function(r){if(r)return console.error("Failed to revert setting "+t.property+" to value: "+i),void(n=!1);_l.preview_pane.update((function(r){if(r)return console.error("Failed to update after reverting setting "+t.property+" to value: "+i),void(n=!1);Nl(e,i),n=!1}))}))})):(e.value=i,void(n=!1))}))})).on("keydown",(function(t){_l.confirm.blank(),13==t.keyCode&&je.hide()})).on("blur",(function(){if(!n){var e=this;je.hide(),_l.preview_pane.getState(t.property,(function(n,r){n?console.error("Failed to get state property "+t.property,n):Nl(e,r)}))}}))}}var Sl={};function Ml(t,e,n){if(t.classList.contains("colors"))return xl.getValue(t);if(t.classList.contains("font-menu")){var r=Ao.getValue(t);return e&&!r?n?null:"":r}if(t.classList.contains("buttons-container")){for(var i,a=t.querySelectorAll("input[type='radio']"),o=0;o<a.length;o++)if(a[o].checked){i=a[o];break}if(!i)return n?null:"";t=i}switch(t.getAttribute("type")){case"checkbox":return t.checked;case"number":return e&&!t.value.length?n?null:"":+t.value;case"radio":if(t.parentNode.parentNode.classList.contains("option-type-boolean"))return"true"==t.value;default:return e&&t.classList.contains("color")&&!t.value.length?n?null:"":t.hasAttribute("data-value")?t.getAttribute("data-value"):t.value}}function Nl(t,e){if(t.classList.contains("colors"))xl.update(t,e);else if(t.classList.contains("font-menu"))Ao.update(t,e);else if("checkbox"==t.getAttribute("type"))t.checked=e;else if(t.classList.contains("color"))t.value=e,Et(t.parentNode).select(".color-picker").classed("is-null",null===e),Et(t.parentNode).select(".color-wrapper input").node().value=e;else if(t.getAttribute("data-autocomplete")){for(var n=function(t){for(var e=0;e<_l.settings.length;e++){var n=_l.settings[e];if(n.property===t)return n}}(t.name),r=0;r<n.choices.length;r++){var i,a,o=n.choices[r];if("string"==typeof o?i=a=o:(i=o[1],a=o[0]),e==i)return t.value=a,void t.setAttribute("data-value",i)}t.value=e,t.setAttribute("data-value",e)}else if(t.className.indexOf("buttons-container")>-1){var s=t.querySelectorAll("input[type='radio']");for(r=0;r<s.length;r++)s[r].value===""+e&&(s[r].checked=!0)}else t.value=e}function Ll(t,e){var n=Et(e);if("string"!=typeof t){var r=t[2];r&&(r.match(El)?n.append("i").attr("class","fa "+r):r.match(Cl)&&n.append("img").attr("src",r));var i=t[0];i.match(El)?n.append("i").attr("class","fa "+i):i.match(Cl)?n.append("img").attr("src",i):n.node().append(i)}else n.text(t)}function Ol(t,e,n){var r={},i=Ml(t,e.optional);if(r[e.property]=i,!("choices"in e)||"colors"===e.type||function(t,e){return!!t.choices_other||-1!==t.choices.map((function(t){return t instanceof Array?t[1]:t})).indexOf(e)}(e,i)){_l.confirm.saving();var a=!1,o={};o[e.property]=Ml(t,e.optional,!0),_l.preview_pane.setState(o,(function(t){if(t)return s(t);_l.preview_pane.update((function(t){if(t)return s(t);_l.visualisation.updateSettings(r,(function(t){if(t)return s(t);_l.analytics("send","event","visualisation","change_setting",_l.visualisation.id),Rl(),_l.confirm.saved(),n&&n()}))}))}))}else n&&n("You can only choose values from the list");function s(r){a||(_l.preview_pane.getState(e.property,(function(e,i){if(e)return console.error("Failed to get state",e),void _l.confirm.error(e);Nl(t,i),Rl(),_l.confirm.blank(),n&&n(r)})),a=!0)}}function Ul(t,e){return/^data\./.test(t)?function(t,e){var n=t.split(".");return _l.visualisation.__sdk__?function(t,e){if(t.length>=4)return;for(var n=null,r=_l.template_data_bindings,i=0;i<r.length;i++){var a=r[i];if("string"!=typeof a&&(a.dataset===t[1]&&a.key===t[2])){n=a;break}}if(!n)throw new Error("Bug: data binding not found - these should already have been checked");return"column"===n.type?!!n.column===e:!!n.columns.split("::")[1]===e}(n,e):function(t,e){if(t.length<4){return!!document.getElementById("data-binding-"+t[1]+"-"+t[2]).value===e}if("type"!==t[3])throw new Error("Fourth part of name must be “type”");var n=_l.visualisation.template_id,r=_l.visualisation.data_bindings[n][t[1]][t[2]];if(null==r)return!1;for(var i,a=_l.visualisation.data_tables,o=r.data_table_id,s=r.columns||[r.column],u=0;u<a.length;u++)if(a[u].id===o){i=a[u].column_types;break}var l=!1;for(u=0;u<s.length;u++){var c=i[s[u]].type_id.split("$")[0];if(l=-1!==(Array.isArray(e)?e:[e]).indexOf(c))break}return l}(n,e)}(t,e):function(t,e){var n=document.getElementById("setting-"+t);if(!n)return console.error("Could not find input for setting",t),!1;var r=Ml(n);if(e instanceof Array)return-1!==e.indexOf(r);return r===e}(t,e)}function Rl(){_l.settings.filter((function(t){return"object"==typeof t&&"show_condition"in t})).forEach((function(t){var e=t.show_condition.every((function(t){var e="show"===t.type,n=t.condition;if("boolean"==typeof n)return e===n;if("string"==typeof n)return e===Ul(n,!0);for(var r in n)if(!Ul(r,n[r]))return!1===e;return e})),n=document.getElementById("setting-"+t.property);if(n){for(var r=n;!r.classList.contains("settings-option");)r=r.parentNode;if(Et(r).classed("hidden",!e),t.new_section)for(var i=r.previousSibling;i&&(Et(i).classed("settings-divider")||Et(i).classed("settings-subhead"));)Et(i).classed("hidden",!e),i=i.previousSibling}else console.error("Could not find input",t.property)}));for(var t=document.querySelectorAll(".template-settings .settings-block"),e=0;e<t.length;e++){var n=t[e];n.classList.contains("hidden")?null!==n.querySelector(".settings-option:not(.hidden)")&&n.classList.remove("hidden"):null==n.querySelector(".settings-option:not(.hidden)")&&n.classList.add("hidden")}}function Bl(t,e,n){return _l=t,bl={setup:ro,addButton:io,startUpload:oo},(wl=Et(".side-panel .template-settings")).on("submit",(function(t){t.preventDefault()})),xl.replaceThemeColors(e),Ao.replaceThemeFonts(n),kl(_l.settings),Et(".side-panel-scrollbox").on("scroll",(function(){je.hide()})),{update:function(t){wl.html(""),Et(".current-template").style("opacity","1"),kl(_l.settings=t)},populate:function(){_l.preview_pane.getState((function(t,e){if(t)console.error("Failed to get state",t);else{var n=ba(e);for(var r in n){var i=document.getElementById("setting-"+r);i&&Nl(i,n[r])}Rl()}}))},getSettingsForCurrentTemplate:function(){return Al},setReadOnly:function(){Tt(".setting").each((function(){Et(this).attr("disabled",!0)}))},unsetReadOnly:function(){Tt(".setting").each((function(){Et(this).attr("disabled",null)}))}}}var jl,Hl,Il=!1,Pl=[];function ql(){Et(".flourish-warn-list").classed("visible",!1),Il=!1}function zl(){return Et(".flourish-warn-btn").on("click",(function(){Il?ql():(Et(".flourish-warn-list").classed("visible",!0),Il=!0)})),{clear:$l,warn:Vl}}function Yl(){Et(".flourish-warn-container").classed("visible",Pl.length),Pl.length>100&&(Pl.length=100);var t=Et(".flourish-warn-list ul").selectAll("li").data(Pl),e=t.enter().append("li");e.append("i").attr("class","fa fa-warning"),e.append("p").attr("class","message"),e.append("p").attr("class","explanation");var n=t.merge(e);n.select(".message").text((function(t){return t.message||""})),n.select(".explanation").text((function(t){return t.explanation||""})),t.exit().remove()}function $l(){Pl=[],Yl(),ql()}function Vl(t){Pl.unshift(t),Yl()}function Wl(t){var e=jl.visualisation,n=e.getTemplate(),r=!1,i=!1,a=!1;function o(){var e=jl.template_settings.getSettingsForCurrentTemplate(),n=jl.visualisation.settingsForCurrentTemplate(),r={};for(var i in n)i in e&&(r[i]=n[i]);Hl.loadVisualisation(jl,r,(function(){jl.template_settings.populate(),jl.data_bindings.updateRequiredBindingsOverlay(!1),eo(),t&&t()})),Mt()}n.getSettings((function(t,e){t?console.error("Failed to get template settings: "+t):(jl.template_settings.update(e),r=!0,i&&a&&o())})),n.getDataBindings((function(t,e){t?console.error("Failed to get template data bindings: "+t):(jl.data_bindings.update(e),i=!0,r&&a&&o())})),e.refreshDataBindings((function(t){t?console.error("Failed to get template data bindings: "+t):(a=!0,i&&r&&o())}))}function Gl(t){Hl.updateData(jl.visualisation,t)}function Xl(t){Hl.updateDataNotPreview(jl.visualisation,t)}function Jl(t){jl=t;var e=zl();return{loadTemplate:Wl,updateData:Gl,updateDataNotPreview:Xl,sync:(Hl=Qa("iframe#preview","editor",jl,e,{setSetting({name:t,value:e}){const n=function(t){return document.getElementById("setting-"+t)}(t);n?(Nl(n,e),n.dispatchEvent(new Event("change"))):console.log(`Could not find setting ${t}`)}})).sync,setState:Hl.setState,getState:Hl.getState,hasData:Hl.hasData,setData:Hl.setData,getData:Hl.getData,draw:Hl.draw,update:Hl.update,getDefaultState:Hl.getDefaultState,snapshot:Hl.snapshot,setFixedHeight:Hl.setFixedHeight,resize:Hl.resize,getDrawCalled:Hl.getDrawCalled,setDrawCalled:Hl.setDrawCalled}}var Zl={},Kl={};function Ql(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function tc(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function ec(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function nc(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+ec(-t,6):t>9999?"+"+ec(t,6):ec(t,4)}(t.getUTCFullYear())+"-"+ec(t.getUTCMonth()+1,2)+"-"+ec(t.getUTCDate(),2)+(i?"T"+ec(e,2)+":"+ec(n,2)+":"+ec(r,2)+"."+ec(i,3)+"Z":r?"T"+ec(e,2)+":"+ec(n,2)+":"+ec(r,2)+"Z":n||e?"T"+ec(e,2)+":"+ec(n,2)+"Z":"")}var rc=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],a=t.length,o=0,s=0,u=a<=0,l=!1;function c(){if(u)return Kl;if(l)return l=!1,Zl;var e,r,i=o;if(34===t.charCodeAt(i)){for(;o++<a&&34!==t.charCodeAt(o)||34===t.charCodeAt(++o););return(e=o)>=a?u=!0:10===(r=t.charCodeAt(o++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(o)&&++o),t.slice(i+1,e-1).replace(/""/g,'"')}for(;o<a;){if(10===(r=t.charCodeAt(e=o++)))l=!0;else if(13===r)l=!0,10===t.charCodeAt(o)&&++o;else if(r!==n)continue;return t.slice(i,e)}return u=!0,t.slice(i,a)}for(10===t.charCodeAt(a-1)&&--a,13===t.charCodeAt(a-1)&&--a;(r=c())!==Kl;){for(var d=[];r!==Zl&&r!==Kl;)d.push(r),r=c();e&&null==(d=e(d,s++))||i.push(d)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return o(e[t])})).join(t)}))}function a(e){return e.map(o).join(t)}function o(t){return null==t?"":t instanceof Date?nc(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,a=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Ql(t);return function(r,i){return e(n(r),i,t)}}(t,e):Ql(t)}));return a.columns=i||[],a},parseRows:r,format:function(e,n){return null==n&&(n=tc(e)),[n.map(o).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=tc(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(a).join("\n")},formatRow:a,formatValue:o}}(","),ic=rc.parseRows,ac=rc.formatRows;function oc(t,e,n){Uo(this,"object"==typeof e?(n=e).id:e,void 0,n,{getVersionNumber:function(){return t.version_number},setVersionNumber:function(e){t.version_number=e}}),this.visualisation=t,this.api_prefix="/api/data_table"}function sc(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?sc(t):t}))}function uc(t){this.id=t}function lc(t,e,n){if(Uo(this,t,e,n),this.api_prefix="/api/visualisation",this.data_tables){var r=this;this.data_tables=this.data_tables.map((function(t){return new oc(r,t)}))}}function cc(t,e,n){Io({url:t.api_prefix+"/"+t.id+"/data_bindings",method:"POST",payload:function(){return{version_number:t.version_number,data_bindings:e}},callback:function(r,i){if(r)return n(r);t.version_number=i.version_number,t.data_bindings||(t.data_bindings={}),t.template_id in t.data_bindings||(t.data_bindings[t.template_id]={});var a=t.data_bindings[t.template_id];for(var o in e)for(var s in e[o]){var u=e[o][s];a[o]||(a[o]={}),null===u?delete a[o][s]:a[o][s]=u}n(void 0)}})}function dc(t,e,n){Io({url:t.api_prefix+"/"+t.id+"/settings",payload:function(){return{version_number:t.version_number,settings:e}},callback:function(r,i){if(r)return n(r);t.version_number=i.version_number,t.settings||(t.settings={}),t.template_id in t.settings||(t.settings[t.template_id]={});var a=t.settings[t.template_id];for(var o in e){var s=e[o];a[o]=s}n(void 0)}})}function fc(t,e,n){Io({url:t.api_prefix+"/"+t.id+"/publish",payload:function(){return{password:n}},callback:function(n,r){if(n)return e(n);t.version_number=r.version_number,t.embed_url=r.embed_url,t.showcase_url=r.showcase_url,t.is_password_protected=r.is_password_protected,e(void 0,r)}})}function pc(t,e){for(var n in e)"object"!=typeof t[n]||null==t[n]||Array.isArray(t[n])||"object"!=typeof e[n]||null==e[n]||Array.isArray(e[n])?t[n]=e[n]:pc(t[n],e[n])}function hc(t,e,n,r){function i(){}this.visualisation=t,this.settings=e,this.template_data_bindings=n,this.public_url_prefix=r,this.is_read_only=!1,this.template_settings=Bl(this),this.data_bindings=(Hi=this,Ii=Et(".data-bindings"),{update:function(t){t&&(Hi.template_data_bindings=t),Vi(Hi.visualisation,Hi.template_data_bindings)},modify:function(t,e=!1){Gi(t,(function(){Vi(Hi.visualisation,Hi.template_data_bindings),e&&Hi.preview_pane.updateData((t=>{if(t)return console.error("Failed to update preview pane: "+t)}))}))},requiredBindingsAreUnset:Zi,updateRequiredBindingsOverlay:Ki}),this.preview_pane=Jl(this),this.responsive_menu=St(this),this.confirm={on:i,blank:i,saved:i,saving:i,error:i},this.analytics=i,this.tour={fireEvent:i},window.addEventListener("hashchange",(()=>{this.loadFromUrlHash()}))}oc.prototype.getColumnTypes=function(t){Io({url:this.api_prefix+"/"+this.id,method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,sc(n.column_types||[]))}},"load-data")},oc.prototype.csv=function(t){this.cached_data?t(void 0,sc(this.cached_data)):this.csvPromise().then((e=>t(null,e)),(e=>t(e)))},oc.prototype.csvPromise=async function(){if(this.cached_data)return sc(this.cached_data);const t=this;return new Promise(((e,n)=>{Io({url:this.api_prefix+"/"+this.id+"/csv",response_type:"text/csv; charset=utf-8",method:"GET",callback(r,i){if(r)return n(r);t.cached_data=ic(i),e(sc(t.cached_data))}},"load-data")}))},oc.prototype.saveData=function(t,e){var n=this,r=Di(sc(t));Io({url:this.api_prefix+"/"+this.id+"/csv",payload:function(){return{version_number:n.getVersionNumber(),data:ac(r)}},callback:function(t,i){if(t)return e(t);n.setVersionNumber(i.version_number),n.cached_data=r,e(void 0)}})},oc.prototype.updateFromUrl=function(t,e){var n=this;Io({url:this.api_prefix+"/"+this.id+"/csv-url",payload:function(){return{live_csv_url:t,version_number:n.getVersionNumber()}},callback:function(r,i){if(r)return e(r);n.setVersionNumber(i.version_number),n.live_csv_url=t,t?n.updateFromLiveCsvUrl((function(t,r){if(t)return n.last_remote_data_error_message=t,e(t);var i,a=((i=Di(ic(r.csv))).forEach((function(t){for(var e=0;e<t.length;e++)t[e]&&"string"==typeof t[e]&&(t[e]=t[e].trim())})),i);n.cached_data=a,n.setVersionNumber(r.version_number),n.t_updated=r.t_updated,n.last_remote_data_error_message=null,e(void 0,a,r.new_column_types)})):(n.t_updated=i.t_updated,n.last_remote_data_error_message=null,e(void 0,null,null))}})},oc.prototype.updateFromLiveCsvUrl=function(t){var e=this;Io({url:this.api_prefix+"/"+this.id+"/update-from-live-csv-url",payload:function(){return{version_number:e.getVersionNumber()}},callback:function(n,r){if(n)return t(n);e.setVersionNumber(r.version_number),t(void 0,r)}})},oc.prototype.save=function(t,e){return qo(this,t,e)},oc.prototype.delete=function(t){return zo(this,t)},uc.prototype.getSettings=function(t){if(this.settings)t(void 0,this.settings);else{var e=this;Io({url:"/api/template/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r.settings,t(void 0,e.settings)}})}},uc.prototype.getDataBindings=function(t){Io({url:"/api/template/"+this.id+"/data_bindings",method:"GET",callback:t})},lc.prototype.save=function(t,e){this.is_listed||(t.is_listed=!0),qo(this,t,e)},lc.prototype.setTemplateId=function(t,e){qo(this,{template_id:t},e)},lc.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new uc(this.template_id)),this._template):null},lc.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},lc.prototype.getState=function(t){this.template_id||t({});var e=this.settingsForCurrentTemplate();this.getTemplate().getSettings((function(n,r){if(n)throw n;for(var i={},a=0;a<r.length;a++){var o=r[a];o.property in e&&(i[o.property]=e[o.property])}t(wa(i))}))},lc.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},lc.prototype.refreshDataBindings=function(t){var e=this;Io({url:this.api_prefix+"/"+this.id+"/data_bindings",method:"GET",callback:function(n,r){if(n)return t(n);e.data_bindings=r,t()}})},lc.prototype.resetToTheme=function(t){var e=this;Io({url:this.api_prefix+"/"+this.id+"/reset_to_theme",method:"POST",payload:function(){return{version_number:e.version_number}},callback:function(n,r){if(n)return t(n);e.version_number=r.version_number,t(void 0)}})},lc.prototype.updateDataBindings=function(t,e){var n=this;if(this.is_listed)return cc(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):cc(n,t,e)}))},lc.prototype.updateSettings=function(t,e){var n=this;if(this.is_listed)return dc(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):dc(n,t,e)}))},lc.prototype.refreshSettings=function(t){var e=this;Io({url:this.api_prefix+"/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r,t()}})},lc.prototype.getThemeFontsAndColors=function(t){Io({url:this.api_prefix+"/"+this.id+"/theme-fonts-and-colors",method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,n.fonts,n.colors)}})},lc.prototype.getDataTables=function(t){Io({url:this.api_prefix+"/"+this.id+"/data",method:"GET",callback:function(e,n){return e?t(e):t(void 0,n.data)}})},lc.prototype.dataTables=function(t){var e=this;e.data_tables?t(void 0,e.data_tables):(e.after_loading_data_tables||(e.after_loading_data_tables=[]),e.after_loading_data_tables.push(t),e.after_loading_data_tables.length>1||e.getDataTables((function(t,n){if(t){for(var r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](t);e.after_loading_data_tables=[]}else{e.data_tables=n.map((function(t){return new oc(e,t)}));for(r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](void 0,e.data_tables);e.after_loading_data_tables=[]}})))},lc.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},lc.prototype.prepareData=function(t){var e=this;if(!e.data_bindings)throw new Error("No data bindings loaded");var n=e.template_id;e.dataTables((function(r,i){if(r)return t(r);if(e.template_id==n){for(var a={},o={},s=0,u=0;u<i.length;u++)!function(r){o[r.id]=r.column_types,r.csv((function(u,l){if(u)throw u;e.template_id==n&&(a[r.id]=l,++s==i.length&&e.getTemplate().getDataBindings((function(n,r){if(n)throw n;var i={};r.forEach((function(t){"string"!=typeof t&&(t.dataset in i||(i[t.dataset]={}),i[t.dataset][t.key]=t)}));var s={},u=e.dataBindingsForCurrentTemplate();for(var l in u)s[l]=Ti(u[l],a,o,i[l]);for(l in i)s[l]||(s[l]=[],s[l].column_names={},s[l].metadata={});t(void 0,s)})))}))}(i[u]);0==i.length&&t(void 0,{})}}))},lc.prototype.delete=function(t){zo(this,t)},lc.prototype.getDataTableNames=function(){return void 0===this.data_table_names&&(this.data_table_names=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.id]=r.name}return e}(this.data_tables)),this.data_table_names},lc.prototype.getDataTableIds=function(){return void 0===this.data_table_ids&&(this.data_table_ids=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.name]=r.id}return e}(this.data_tables)),this.data_table_ids},lc.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0},lc.prototype.duplicate=function(t){Io({url:this.api_prefix+"/"+this.id+"/duplicate",callback:t})},lc.prototype.publish=function(t,e){var n=this;if(this.is_listed)return fc(n,t,e);this.save({is_listed:!0},(function(r){return r?t(r):fc(n,t,e)}))},lc.prototype.unpublish=function(t){var e=this;Io({url:this.api_prefix+"/"+this.id+"/unpublish",callback:function(n,r){if(n)return t(n);e.version_number=r.version_number,e.embed_url=r.embed_url,e.showcase_url=r.showcase_url,t(void 0,r)}})},lc.prototype.published=function(){return!!this.showcase_url},lc.prototype.sendForReview=function(t,e,n){var r=this;Io({url:"/api/reviews",payload:function(){return{project_id:r.id,project_type:"visualisation",reviewers:t,message:e}},callback:function(t,e){r.status=e,n(t,e)}})},lc.prototype.approve=function(t,e){var n=this;Io({url:"/api/review/"+t+"/approve",callback:function(t,r){return n.status=r,e(t,r)}})},lc.prototype.decline=function(t,e,n){var r=this;Io({url:"/api/review/"+t+"/decline",payload:function(){return{message:e}},callback:function(t,e){r.status=e,n(t,e)}})},lc.prototype.cancelReview=function(t,e){var n=this;Io({url:"/api/review/"+t+"/cancel",callback:function(t,r){n.status=r,e(t,r)}})},lc.list=function(t){Io({url:"/api/visualisations",method:"GET",callback:t})},lc.getById=function(t,e){Io({url:"/api/visualisation/"+t,method:"GET",callback:function(n,r){if(n)return e(n);e(void 0,new lc(t,r.version_number,r))}})},lc.getPublishedJson=function(t,e,n){Io({url:`${e}visualisation/${t}/visualisation.json`,method:"GET",callback(t,e){if(t)return n(t);n(void 0,e)}})},lc.createFromTemplate=function(t,e){Io({url:"/api/template/"+t+"/visualisations",method:"PUT",callback:e})},lc.createFromVisualisation=function(t,e){Io({url:"/api/visualisation/"+t+"/duplicate",callback:e})},lc.setAsStaffPick=function(t,e){Io({url:"/api/visualisation/"+t+"/set_staff_pick",method:"POST",callback:e})},lc.unsetAsStaffPick=function(t,e){Io({url:"/api/visualisation/"+t+"/unset_staff_pick",method:"POST",callback:e})},lc.setTag=function(t,e,n){Io({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e),method:"PUT",callback:n})},lc.removeTag=function(t,e,n){Io({url:"/api/visualisation/"+t+"/tag/"+encodeURIComponent(e),method:"DELETE",callback:n})},hc.prototype.loadFromUrlHash=async function(){if(!window.location.hash)return;const t=window.location.hash.slice(1),e=(n=lc.getPublishedJson,function(...t){return new Promise(((e,i)=>{n.call(r,...t,(function(t,n){if(t)return i(t);e(n)}))}))});var n,r;try{const n=await e(t,this.public_url_prefix);this.updateFromJson(n)}catch(t){console.error(t)}},hc.prototype.updateFromJson=function({state:t,bindings:e,data:n}){const r={};for(const[t,i]of Object.entries(e)){const e={},o={};for(const[t,n]of Object.entries(i))Array.isArray(n)?o[t]=n:e[t]=n;const s=a(n[t],e,o);r[t]=s}const i={};pc(i,this.preview_pane.getDefaultState()),pc(i,t),this.preview_pane.sync({state:i,data:r,overwrite_state:!0,update:!0},(()=>this.template_settings.populate()))};var mc={},vc={};function gc(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function yc(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function _c(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function bc(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+_c(-t,6):t>9999?"+"+_c(t,6):_c(t,4)}(t.getUTCFullYear())+"-"+_c(t.getUTCMonth()+1,2)+"-"+_c(t.getUTCDate(),2)+(i?"T"+_c(e,2)+":"+_c(n,2)+":"+_c(r,2)+"."+_c(i,3)+"Z":r?"T"+_c(e,2)+":"+_c(n,2)+":"+_c(r,2)+"Z":n||e?"T"+_c(e,2)+":"+_c(n,2)+"Z":"")}var wc=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],a=t.length,o=0,s=0,u=a<=0,l=!1;function c(){if(u)return vc;if(l)return l=!1,mc;var e,r,i=o;if(34===t.charCodeAt(i)){for(;o++<a&&34!==t.charCodeAt(o)||34===t.charCodeAt(++o););return(e=o)>=a?u=!0:10===(r=t.charCodeAt(o++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(o)&&++o),t.slice(i+1,e-1).replace(/""/g,'"')}for(;o<a;){if(10===(r=t.charCodeAt(e=o++)))l=!0;else if(13===r)l=!0,10===t.charCodeAt(o)&&++o;else if(r!==n)continue;return t.slice(i,e)}return u=!0,t.slice(i,a)}for(10===t.charCodeAt(a-1)&&--a,13===t.charCodeAt(a-1)&&--a;(r=c())!==vc;){for(var d=[];r!==mc&&r!==vc;)d.push(r),r=c();e&&null==(d=e(d,s++))||i.push(d)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return o(e[t])})).join(t)}))}function a(e){return e.map(o).join(t)}function o(t){return null==t?"":t instanceof Date?bc(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,a=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=gc(t);return function(r,i){return e(n(r),i,t)}}(t,e):gc(t)}));return a.columns=i||[],a},parseRows:r,format:function(e,n){return null==n&&(n=yc(e)),[n.map(o).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=yc(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(a).join("\n")},formatRow:a,formatValue:o}}(",").parseRows,xc="$";function Ac(){}function Ec(t,e){var n=new Ac;if(t instanceof Ac)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,a=t.length;if(null==e)for(;++i<a;)n.set(i,t[i]);else for(;++i<a;)n.set(e(r=t[i],i,t),r)}else if(t)for(var o in t)n.set(o,t[o]);return n}function Cc(){}Ac.prototype=Ec.prototype={constructor:Ac,has:function(t){return xc+t in this},get:function(t){return this[xc+t]},set:function(t,e){return this[xc+t]=e,this},remove:function(t){var e=xc+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===xc&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===xc&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===xc&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===xc&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===xc&&++t;return t},empty:function(){for(var t in this)if(t[0]===xc)return!1;return!0},each:function(t){for(var e in this)e[0]===xc&&t(this[e],e.slice(1),this)}};var Tc=Ec.prototype;Cc.prototype={constructor:Cc,has:Tc.has,add:function(t){return this[xc+(t+="")]=t,this},remove:Tc.remove,clear:Tc.clear,values:Tc.keys,size:Tc.size,empty:Tc.empty,each:Tc.each};var kc,Dc,Fc={value:function(){}};function Sc(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Mc(r)}function Mc(t){this._=t}function Nc(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Lc(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Oc(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Fc,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function Uc(t,e,n){var r;r="object"==typeof e?e.id:e,this.id=r,this.visualisation=t,this.api_prefix="/api/data_table"}function Rc(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?Rc(t):t}))}function Bc(t){this.id=t}function jc(t,e,n){var r=this;r.id=1,r.template_id=1,r.api_prefix="/api/visualisation",r.can_edit=!0,r.__sdk__=!0,n.data_tables&&(this.data_tables=n.data_tables.map((function(t){return new Uc(r,t)}))),n.data_bindings&&(this.data_bindings=n.data_bindings)}Mc.prototype=Sc.prototype={constructor:Mc,on:function(t,e){var n,r=this._,i=Nc(t+"",r),a=-1,o=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(n=(t=i[a]).type)r[n]=Oc(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Oc(r[n],t.name,null);return this}for(;++a<o;)if((n=(t=i[a]).type)&&(n=Lc(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Mc(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(r=this._[t]).length;a<n;++a)r[a].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}},Uc.prototype.csv=function(t){if(this.cached_data)t(void 0,Rc(this.cached_data));else{var e=this;!function(t,e){var n,r,i,a,o=Sc("beforesend","progress","load","error"),s=Ec(),u=new XMLHttpRequest,l=null,c=null,d=0;function f(t){var e,r=u.status;if(!r&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(u)||r>=200&&r<300||304===r){if(i)try{e=i.call(n,u)}catch(t){return void o.call("error",n,t)}else e=u;o.call("load",n,e)}else o.call("error",n,t)}if("undefined"!=typeof XDomainRequest&&!("withCredentials"in u)&&/^(http(s)?:)?\/\//.test(t)&&(u=new XDomainRequest),"onload"in u?u.onload=u.onerror=u.ontimeout=f:u.onreadystatechange=function(t){u.readyState>3&&f(t)},u.onprogress=function(t){o.call("progress",n,t)},n={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s.get(t):(null==e?s.remove(t):s.set(t,e+""),n)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",n):r},responseType:function(t){return arguments.length?(a=t,n):a},timeout:function(t){return arguments.length?(d=+t,n):d},user:function(t){return arguments.length<1?l:(l=null==t?null:t+"",n)},password:function(t){return arguments.length<1?c:(c=null==t?null:t+"",n)},response:function(t){return i=t,n},get:function(t,e){return n.send("GET",t,e)},post:function(t,e){return n.send("POST",t,e)},send:function(e,i,f){return u.open(e,t,!0,l,c),null==r||s.has("accept")||s.set("accept",r+",*/*"),u.setRequestHeader&&s.each((function(t,e){u.setRequestHeader(e,t)})),null!=r&&u.overrideMimeType&&u.overrideMimeType(r),null!=a&&(u.responseType=a),d>0&&(u.timeout=d),null==f&&"function"==typeof i&&(f=i,i=null),null!=f&&1===f.length&&(f=function(t){return function(e,n){t(null==e?n:null)}}(f)),null!=f&&n.on("error",f).on("load",(function(t){f(null,t)})),o.call("beforesend",n,u),u.send(null==i?null:i),n},abort:function(){return u.abort(),n},on:function(){var t=o.on.apply(o,arguments);return t===o?n:t}},null!=e){if("function"!=typeof e)throw new Error("invalid callback: "+e);return n.get(e)}}(this.api_prefix+"/"+this.id+"/csv",(function(n,r){e.cached_data=wc(r.response),t(void 0,Rc(e.cached_data))}))}},Uc.prototype.saveData=function(t,e){e()},Uc.prototype.save=function(t,e){e()},Uc.prototype.delete=function(t){t()},Bc.prototype.getSettings=function(t){t(void 0,window.Flourish.app.settings)},Bc.prototype.getDataBindings=function(t){t(void 0,window.Flourish.app.template_data_bindings)},Bc.prototype.refreshDataBindings=function(t){t(void 0)},jc.prototype.save=function(t,e){this.version_number++,e(void 0)},jc.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new Bc(this.template_id)),this._template):null},jc.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},jc.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},jc.prototype.refreshDataBindings=function(t){t()},jc.prototype.updateDataBindings=function(t,e){var n=this;n.version_number++,n.data_bindings||(n.data_bindings={}),n.template_id in n.data_bindings||(n.data_bindings[n.template_id]={});var r=n.data_bindings[n.template_id];for(var i in t)for(var a in t[i]){var o=t[i][a];r[i][a]=o}e(void 0)},jc.prototype.updateSettings=function(t,e){var n=this;n.version_number++,n.settings||(n.settings={}),n.template_id in n.settings||(n.settings[n.template_id]={});var r=n.settings[n.template_id];for(var i in t){var a=t[i];r[i]=a}e(void 0)},jc.prototype.getDataTables=function(t){t(void 0,window.Flourish.app.data_tables)},jc.prototype.dataTables=function(t){var e=this;e.data_tables?t(void 0,e.data_tables):(e.after_loading_data_tables||(e.after_loading_data_tables=[]),e.after_loading_data_tables.push(t),e.after_loading_data_tables.length>1||e.getDataTables((function(t,n){if(t){for(var r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](t);e.after_loading_data_tables=[]}else{e.data_tables=n.map((function(t){return new Uc(e,t)}));for(r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](void 0,e.data_tables);e.after_loading_data_tables=[]}})))},jc.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},jc.prototype.prepareData=function(t){var e=this;if(!e.data_bindings)throw new Error("No data bindings loaded");var n=e.template_id;e.dataTables((function(r,i){if(r)return t(r);if(e.template_id==n){for(var a={},o={},s=0,u=0;u<i.length;u++)!function(r){r.csv((function(u,l){if(u)throw u;e.template_id==n&&(o[r.id]=ki(l),a[r.id]=l,++s==i.length&&e.getTemplate().getDataBindings((function(n,r){if(n)throw n;var i={};r.forEach((function(t){"string"!=typeof t&&(t.dataset in i||(i[t.dataset]={}),i[t.dataset][t.key]=t)}));var s={},u=e.dataBindingsForCurrentTemplate();for(var l in u)s[l]=Ti(u[l],a,o,i[l]);for(l in i)s[l]||(s[l]=[],s[l].column_names={},s[l].metadata={});t(void 0,s)})))}))}(i[u]);0==i.length&&t(void 0,{})}}))},jc.prototype.getDataTableNames=function(){return void 0===this.data_table_names&&(this.data_table_names=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.id]=r.name}return e}(this.data_tables)),this.data_table_names},jc.prototype.getDataTableIds=function(){return void 0===this.data_table_ids&&(this.data_table_ids=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.name]=r.id}return e}(this.data_tables)),this.data_table_ids},jc.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0};var Hc=!1;function Ic(){kc&&kc.classList.remove("shown")}function Pc(){this.close(),Hc||(kc&&setTimeout((function(){kc.classList.add("shown")}),1e3),setTimeout(qc,250))}function qc(){zc().addEventListener("open",(function(){window.location.reload()}))}function zc(){var t=new window.WebSocket(Dc);return t.addEventListener("open",Ic),t.addEventListener("close",Pc),t}return t.Visualisation=jc,t.initSDK=function(t,e,n,r){return $e(),window.Flourish=window.Flourish||{},window.Flourish.app=new hc(t,e,n,r),window.Flourish.app},t.talkToServer=function(){kc=document.getElementById("error-server-down"),Dc=window.location.origin.replace(/^http(s?):\/\//,"ws$1://"),window.addEventListener("beforeunload",(function(){Hc=!0})),zc()},Object.defineProperty(t,"__esModule",{value:!0}),t}({});
2
3
  //# sourceMappingURL=script.js.map