@flourish/sdk 4.2.2 → 5.1.0

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,3 +1,4 @@
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 o=t[0],a=n(t.slice(1),r,i);return a.column_names={},Object.keys(r).forEach((function(t){a.column_names[t]=o[r[t]]})),Object.keys(i).forEach((function(t){var e=i[t];a.column_names[t]=(Array.isArray(e)?e:[e]).map((function(t){return o[t]}))})),a}function o(t,e,n){return(Array.isArray(t[0])?i:r)(t,e,n)}var a="http://www.w3.org/1999/xhtml",u={svg:"http://www.w3.org/2000/svg",xhtml:a,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function s(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),u.hasOwnProperty(e)?{space:u[e],local:t}:t}function l(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===a&&e.documentElement.namespaceURI===a?e.createElement(t):e.createElementNS(n,t)}}function c(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function f(t){var e=s(t);return(e.local?c:l)(e)}function d(){}function p(t){return null==t?d:function(){return this.querySelector(t)}}function h(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function m(){return[]}function g(t){return null==t?m:function(){return this.querySelectorAll(t)}}function v(t){return function(){return this.matches(t)}}function y(t){return function(e){return e.matches(t)}}var b=Array.prototype.find;function _(){return this.firstElementChild}var w=Array.prototype.filter;function x(){return this.children}function C(t){return new Array(t.length)}function T(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function A(t){return function(){return t}}function D(t,e,n,r,i,o){for(var a,u=0,s=e.length,l=o.length;u<l;++u)(a=e[u])?(a.__data__=o[u],r[u]=a):n[u]=new T(t,o[u]);for(;u<s;++u)(a=e[u])&&(i[u]=a)}function k(t,e,n,r,i,o,a){var u,s,l,c=new Map,f=e.length,d=o.length,p=new Array(f);for(u=0;u<f;++u)(s=e[u])&&(p[u]=l=a.call(s,s.__data__,u,e)+"",c.has(l)?i[u]=s:c.set(l,s));for(u=0;u<d;++u)l=a.call(t,o[u],u,o)+"",(s=c.get(l))?(r[u]=s,s.__data__=o[u],c.delete(l)):n[u]=new T(t,o[u]);for(u=0;u<f;++u)(s=e[u])&&c.get(p[u])===s&&(i[u]=s)}function F(t){return t.__data__}function M(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function E(t){return function(){this.removeAttribute(t)}}function S(t){return function(){this.removeAttributeNS(t.space,t.local)}}function L(t,e){return function(){this.setAttribute(t,e)}}function U(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function N(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function O(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 H(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function j(t){return function(){this.style.removeProperty(t)}}function Y(t,e,n){return function(){this.style.setProperty(t,e,n)}}function B(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function R(t,e){return t.style.getPropertyValue(e)||H(t).getComputedStyle(t,null).getPropertyValue(e)}function I(t){return function(){delete this[t]}}function $(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 P(t){return t.trim().split(/^|\s+/)}function q(t){return t.classList||new V(t)}function V(t){this._node=t,this._names=P(t.getAttribute("class")||"")}function W(t,e){for(var n=q(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Z(t,e){for(var n=q(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function G(t){return function(){W(this,t)}}function X(t){return function(){Z(this,t)}}function J(t,e){return function(){(e.apply(this,arguments)?W:Z)(this,t)}}function Q(){this.textContent=""}function K(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 ot(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function at(){return null}function ut(){var t=this.parentNode;t&&t.removeChild(this)}function st(){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 ft(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function dt(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function pt(t,e,n){var r=H(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))}}T.prototype={constructor:T,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 gt,vt,yt,bt,_t,wt=[null];function xt(t,e){this._groups=t,this._parents=e}function Ct(){return new xt([[document.documentElement]],wt)}function Tt(t){return"string"==typeof t?new xt([[document.querySelector(t)]],[document.documentElement]):new xt([[t]],wt)}function At(t){return Tt(f(t).call(document.documentElement))}function Dt(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"===bt&&""!=t){var e=parseInt(t,10);return isNaN(e)?null:e}return null}function Ft(){_t&&_t.preview_pane&&_t.preview_pane.setFixedHeight&&_t.preview_pane.setFixedHeight(kt())}function Mt(t,e=!1){bt=t,Ft(),"custom"===t?(Tt("#editor-custom-inputs").style("opacity",1),Tt(".preview-holder").style("width",yt.nodes()[0].value+"px").select("iframe").style("width",yt.nodes()[0].value+"px")):(Tt("#editor-custom-inputs").style("opacity",0),Tt(".preview-holder").attr("style",null).select("iframe").style("width",null)),e||Tt(".preview-holder").style("max-width","none"),Dt("#preview-menu .preview-mode").classed("selected",(function(){return this.id=="editor-"+t})),Tt("#editor-rotate").classed("active",(function(){return"auto"!==t})),Tt(".row.editor").classed("mobile",(function(){return"mobile"==t})),Tt(".row.editor").classed("tablet",(function(){return"tablet"==t})),Tt(".preview-holder").on("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd transitionend",St),gt=t}function Et(t){return _t=t,yt=Dt("#editor-custom-inputs input"),St(),Dt("#preview-menu .preview-mode").on("click",(function(){Mt(this.getAttribute("data-target"))})),yt.on("change",(function(){Mt(this.getAttribute("data-target"))})),Mt("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,Tt(".preview-holder").style("transition","none"),Mt("custom"),document.addEventListener("mousemove",o),document.addEventListener("mouseup",a),i.preventDefault())}function o(n){var i=n.clientX-e,o=t+2*i;r.style.width=o+"px",r.querySelector("iframe").style.width=o-4+"px",St(),_t.preview_pane.resize()}function a(){t=r.getBoundingClientRect().width,Tt(".preview-holder").style("transition",null),n.parentElement.parentElement.querySelector("#resize-overlay").classList.remove("dragging"),n.parentElement.classList.remove("dragging"),St(),_t.preview_pane.resize(),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)}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&&(vt="auto"),window.addEventListener("resize",(function(){gt&&St(),window.innerWidth<=768?vt||(vt=gt,Mt("auto")):vt&&(Mt(vt),vt=null),_t.preview_pane.resize()})),{getHeightSetting:kt}}function St(){var t=Tt(".preview-holder").node().getBoundingClientRect();yt.nodes()[0].value=Math.round(t.width),""!==yt.nodes()[1].value&&"custom"===bt&&(yt.nodes()[1].value=Math.round(t.height))}xt.prototype=Ct.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 o,a,u=e[i],s=u.length,l=r[i]=new Array(s),c=0;c<s;++c)(o=u[c])&&(a=t.call(o,o.__data__,c,u))&&("__data__"in o&&(a.__data__=o.__data__),l[c]=a);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):g(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,u=e[o],s=u.length,l=0;l<s;++l)(a=u[l])&&(r.push(t.call(a,a.__data__,l,u)),i.push(a));return new xt(r,i)},selectChild:function(t){return this.select(null==t?_:function(t){return function(){return b.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=v(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,s=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&s.push(o);return new xt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,F);var n=e?k:D,r=this._parents,i=this._groups;"function"!=typeof t&&(t=A(t));for(var o=i.length,a=new Array(o),u=new Array(o),s=new Array(o),l=0;l<o;++l){var c=r[l],f=i[l],d=f.length,p=h(t.call(c,c&&c.__data__,l,r)),m=p.length,g=u[l]=new Array(m),v=a[l]=new Array(m),y=s[l]=new Array(d);n(c,f,g,v,y,p,e);for(var b,_,w=0,x=0;w<m;++w)if(b=g[w]){for(w>=x&&(x=w+1);!(_=v[x])&&++x<m;);b._next=_||null}}return(a=new xt(a,r))._enter=u,a._exit=s,a},enter:function(){return new xt(this._enter||this._groups.map(C),this._parents)},exit:function(){return new xt(this._exit||this._groups.map(C),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(i=e(i)),null==n?o.remove():n(o),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,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var s,l=e[u],c=n[u],f=l.length,d=a[u]=new Array(f),p=0;p<f;++p)(s=l[p]||c[p])&&(d[p]=s);for(;u<r;++u)a[u]=e[u];return new xt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=M);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,u=n[o],s=u.length,l=i[o]=new Array(s),c=0;c<s;++c)(a=u[c])&&(l[c]=a);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,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=s(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?S:E:"function"==typeof e?n.local?O:N:n.local?U:L)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?j:"function"==typeof e?B:Y)(t,e,null==n?"":n)):R(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?I:"function"==typeof e?z:$)(t,e)):this.node()[t]},classed:function(t,e){var n=P(t+"");if(arguments.length<2){for(var r=q(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?J:e?G:X)(n,e))},text:function(t){return arguments.length?this.each(null==t?Q:("function"==typeof t?tt:K)(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(ot)},append:function(t){var e="function"==typeof t?t:f(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:f(t),r=null==e?at:"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(ut)},clone:function(t){return this.select(t?lt:st)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=ct(t+""),a=o.length;if(!(arguments.length<2)){for(u=e?dt:ft,r=0;r<a;++r)this.each(u(o[r],e,n));return this}var u=this.node().__on;if(u)for(var s,l=0,c=u.length;l<c;++l)for(r=0,s=u[l];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.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],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Lt=Object.hasOwnProperty,Ut=Object.setPrototypeOf,Nt=Object.isFrozen,Ot=Object.getPrototypeOf,Ht=Object.getOwnPropertyDescriptor,jt=Object.freeze,Yt=Object.seal,Bt=Object.create,Rt="undefined"!=typeof Reflect&&Reflect,It=Rt.apply,$t=Rt.construct;It||(It=function(t,e,n){return t.apply(e,n)}),jt||(jt=function(t){return t}),Yt||(Yt=function(t){return t}),$t||($t=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,Pt=te(Array.prototype.forEach),qt=te(Array.prototype.pop),Vt=te(Array.prototype.push),Wt=te(String.prototype.toLowerCase),Zt=te(String.prototype.match),Gt=te(String.prototype.replace),Xt=te(String.prototype.indexOf),Jt=te(String.prototype.trim),Qt=te(RegExp.prototype.test),Kt=(zt=TypeError,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return $t(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 It(t,e,r)}}function ee(t,e){Ut&&Ut(t,null);for(var n=e.length;n--;){var r=e[n];if("string"==typeof r){var i=Wt(r);i!==r&&(Nt(e)||(e[n]=i),r=i)}t[r]=!0}return t}function ne(t){var e=Bt(null),n=void 0;for(n in t)It(Lt,t,[n])&&(e[n]=t[n]);return e}function re(t,e){for(;null!==t;){var n=Ht(t,e);if(n){if(n.get)return te(n.get);if("function"==typeof n.value)return te(n.value)}t=Ot(t)}return function(t){return console.warn("fallback value for",t),null}}var ie=jt(["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"]),oe=jt(["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"]),ae=jt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ue=jt(["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"]),se=jt(["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=jt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ce=jt(["#text"]),fe=jt(["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"]),de=jt(["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=jt(["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=jt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),me=Yt(/\{\{[\s\S]*|[\s\S]*\}\}/gm),ge=Yt(/<%[\s\S]*|[\s\S]*%>/gm),ve=Yt(/^data-[\-\w.\u00B7-\uFFFF]/),ye=Yt(/^aria-[\-\w]+$/),be=Yt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_e=Yt(/^(?:\w+script|data):/i),we=Yt(/[\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 Ce(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 Te=function(){return"undefined"==typeof window?null:window},Ae=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 De,ke,Fe=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Te(),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,o=e.DocumentFragment,a=e.HTMLTemplateElement,u=e.Node,s=e.Element,l=e.NodeFilter,c=e.NamedNodeMap,f=void 0===c?e.NamedNodeMap||e.MozNamedAttrMap:c,d=e.Text,p=e.Comment,h=e.DOMParser,m=e.trustedTypes,g=s.prototype,v=re(g,"cloneNode"),y=re(g,"nextSibling"),b=re(g,"childNodes"),_=re(g,"parentNode");if("function"==typeof a){var w=i.createElement("template");w.content&&w.content.ownerDocument&&(i=w.content.ownerDocument)}var x=Ae(m,r),C=x&&tt?x.createHTML(""):"",T=i,A=T.implementation,D=T.createNodeIterator,k=T.createDocumentFragment,F=r.importNode,M={};try{M=ne(i).documentMode?i.documentMode:{}}catch(t){}var E={};n.isSupported="function"==typeof _&&A&&void 0!==A.createHTMLDocument&&9!==M;var S=me,L=ge,U=ve,N=ye,O=_e,H=we,j=be,Y=null,B=ee({},[].concat(Ce(ie),Ce(oe),Ce(ae),Ce(se),Ce(ce))),R=null,I=ee({},[].concat(Ce(fe),Ce(de),Ce(pe),Ce(he))),$=null,z=null,P=!0,q=!0,V=!1,W=!1,Z=!1,G=!1,X=!1,J=!1,Q=!1,K=!0,tt=!1,et=!0,nt=!0,rt=!1,it={},ot=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"]),at=null,ut=ee({},["audio","video","img","source","image","track"]),st=null,lt=ee({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),ct="http://www.w3.org/1998/Math/MathML",ft="http://www.w3.org/2000/svg",dt="http://www.w3.org/1999/xhtml",pt=dt,ht=null,mt=i.createElement("form"),gt=function(t){ht&&ht===t||(t&&"object"===(void 0===t?"undefined":xe(t))||(t={}),t=ne(t),Y="ALLOWED_TAGS"in t?ee({},t.ALLOWED_TAGS):B,R="ALLOWED_ATTR"in t?ee({},t.ALLOWED_ATTR):I,st="ADD_URI_SAFE_ATTR"in t?ee(ne(lt),t.ADD_URI_SAFE_ATTR):lt,at="ADD_DATA_URI_TAGS"in t?ee(ne(ut),t.ADD_DATA_URI_TAGS):ut,$="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,P=!1!==t.ALLOW_ARIA_ATTR,q=!1!==t.ALLOW_DATA_ATTR,V=t.ALLOW_UNKNOWN_PROTOCOLS||!1,W=t.SAFE_FOR_TEMPLATES||!1,Z=t.WHOLE_DOCUMENT||!1,J=t.RETURN_DOM||!1,Q=t.RETURN_DOM_FRAGMENT||!1,K=!1!==t.RETURN_DOM_IMPORT,tt=t.RETURN_TRUSTED_TYPE||!1,X=t.FORCE_BODY||!1,et=!1!==t.SANITIZE_DOM,nt=!1!==t.KEEP_CONTENT,rt=t.IN_PLACE||!1,j=t.ALLOWED_URI_REGEXP||j,pt=t.NAMESPACE||pt,W&&(q=!1),Q&&(J=!0),it&&(Y=ee({},[].concat(Ce(ce))),R=[],!0===it.html&&(ee(Y,ie),ee(R,fe)),!0===it.svg&&(ee(Y,oe),ee(R,de),ee(R,he)),!0===it.svgFilters&&(ee(Y,ae),ee(R,de),ee(R,he)),!0===it.mathMl&&(ee(Y,se),ee(R,pe),ee(R,he))),t.ADD_TAGS&&(Y===B&&(Y=ne(Y)),ee(Y,t.ADD_TAGS)),t.ADD_ATTR&&(R===I&&(R=ne(R)),ee(R,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&ee(st,t.ADD_URI_SAFE_ATTR),nt&&(Y["#text"]=!0),Z&&ee(Y,["html","head","body"]),Y.table&&(ee(Y,["tbody"]),delete $.tbody),jt&&jt(t),ht=t)},vt=ee({},["mi","mo","mn","ms","mtext"]),yt=ee({},["foreignobject","desc","title","annotation-xml"]),bt=ee({},oe);ee(bt,ae),ee(bt,ue);var _t=ee({},se);ee(_t,le);var wt=function(t){var e=_(t);e&&e.tagName||(e={namespaceURI:dt,tagName:"template"});var n=Wt(t.tagName),r=Wt(e.tagName);if(t.namespaceURI===ft)return e.namespaceURI===dt?"svg"===n:e.namespaceURI===ct?"svg"===n&&("annotation-xml"===r||vt[r]):Boolean(bt[n]);if(t.namespaceURI===ct)return e.namespaceURI===dt?"math"===n:e.namespaceURI===ft?"math"===n&&yt[r]:Boolean(_t[n]);if(t.namespaceURI===dt){if(e.namespaceURI===ft&&!yt[r])return!1;if(e.namespaceURI===ct&&!vt[r])return!1;var i=ee({},["title","style","font","a","script"]);return!_t[n]&&(i[n]||!bt[n])}return!1},xt=function(t){Vt(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=C}catch(e){t.remove()}}},Ct=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&&!R[t])if(J||Q)try{xt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Tt=function(t){var e=void 0,n=void 0;if(X)t="<remove></remove>"+t;else{var r=Zt(t,/^[\r\n\t ]+/);n=r&&r[0]}var o=x?x.createHTML(t):t;if(pt===dt)try{e=(new h).parseFromString(o,"text/html")}catch(t){}e&&e.documentElement||((e=A.createDocument(pt,"template",null)).documentElement.innerHTML=o);var a=e.body||e.documentElement;return t&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),Z?e.documentElement:a},At=function(t){return D.call(t.ownerDocument||t,t,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,(function(){return l.FILTER_ACCEPT}),!1)},Dt=function(t){return!(t instanceof d||t instanceof p)&&!("string"==typeof t.nodeName&&"string"==typeof t.textContent&&"function"==typeof t.removeChild&&t.attributes instanceof f&&"function"==typeof t.removeAttribute&&"function"==typeof t.setAttribute&&"string"==typeof t.namespaceURI&&"function"==typeof t.insertBefore)},kt=function(t){return"object"===(void 0===u?"undefined":xe(u))?t instanceof u:t&&"object"===(void 0===t?"undefined":xe(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},Ft=function(t,e,r){E[t]&&Pt(E[t],(function(t){t.call(n,e,r,ht)}))},Mt=function(t){var e=void 0;if(Ft("beforeSanitizeElements",t,null),Dt(t))return xt(t),!0;if(Zt(t.nodeName,/[\u0080-\uFFFF]/))return xt(t),!0;var r=Wt(t.nodeName);if(Ft("uponSanitizeElement",t,{tagName:r,allowedTags:Y}),!kt(t.firstElementChild)&&(!kt(t.content)||!kt(t.content.firstElementChild))&&Qt(/<[/\w]/g,t.innerHTML)&&Qt(/<[/\w]/g,t.textContent))return xt(t),!0;if(!Y[r]||$[r]){if(nt&&!ot[r]){var i=_(t)||t.parentNode,o=b(t)||t.childNodes;if(o&&i)for(var a=o.length-1;a>=0;--a)i.insertBefore(v(o[a],!0),y(t))}return xt(t),!0}return t instanceof s&&!wt(t)?(xt(t),!0):"noscript"!==r&&"noembed"!==r||!Qt(/<\/no(script|embed)/i,t.innerHTML)?(W&&3===t.nodeType&&(e=t.textContent,e=Gt(e,S," "),e=Gt(e,L," "),t.textContent!==e&&(Vt(n.removed,{element:t.cloneNode()}),t.textContent=e)),Ft("afterSanitizeElements",t,null),!1):(xt(t),!0)},Et=function(t,e,n){if(et&&("id"===e||"name"===e)&&(n in i||n in mt))return!1;if(q&&Qt(U,e));else if(P&&Qt(N,e));else{if(!R[e]||z[e])return!1;if(st[e]);else if(Qt(j,Gt(n,H,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==Xt(n,"data:")||!at[t]){if(V&&!Qt(O,Gt(n,H,"")));else if(n)return!1}else;}return!0},St=function(t){var e=void 0,r=void 0,i=void 0,o=void 0;Ft("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var u={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R};for(o=a.length;o--;){var s=e=a[o],l=s.name,c=s.namespaceURI;if(r=Jt(e.value),i=Wt(l),u.attrName=i,u.attrValue=r,u.keepAttr=!0,u.forceKeepAttr=void 0,Ft("uponSanitizeAttribute",t,u),r=u.attrValue,!u.forceKeepAttr&&(Ct(l,t),u.keepAttr))if(Qt(/\/>/i,r))Ct(l,t);else{W&&(r=Gt(r,S," "),r=Gt(r,L," "));var f=t.nodeName.toLowerCase();if(Et(f,i,r))try{c?t.setAttributeNS(c,l,r):t.setAttribute(l,r),qt(n.removed)}catch(t){}}}Ft("afterSanitizeAttributes",t,null)}},Lt=function t(e){var n=void 0,r=At(e);for(Ft("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)Ft("uponSanitizeShadowNode",n,null),Mt(n)||(n.content instanceof o&&t(n.content),St(n));Ft("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(t,i){var a=void 0,s=void 0,l=void 0,c=void 0,f=void 0;if(t||(t="\x3c!--\x3e"),"string"!=typeof t&&!kt(t)){if("function"!=typeof t.toString)throw Kt("toString is not a function");if("string"!=typeof(t=t.toString()))throw Kt("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(G||gt(i),n.removed=[],"string"==typeof t&&(rt=!1),rt);else if(t instanceof u)1===(s=(a=Tt("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?a=s:a.appendChild(s);else{if(!J&&!W&&!Z&&-1===t.indexOf("<"))return x&&tt?x.createHTML(t):t;if(!(a=Tt(t)))return J?null:C}a&&X&&xt(a.firstChild);for(var d=At(rt?t:a);l=d.nextNode();)3===l.nodeType&&l===c||Mt(l)||(l.content instanceof o&&Lt(l.content),St(l),c=l);if(c=null,rt)return t;if(J){if(Q)for(f=k.call(a.ownerDocument);a.firstChild;)f.appendChild(a.firstChild);else f=a;return K&&(f=F.call(r,f,!0)),f}var p=Z?a.outerHTML:a.innerHTML;return W&&(p=Gt(p,S," "),p=Gt(p,L," ")),x&&tt?x.createHTML(p):p},n.setConfig=function(t){gt(t),G=!0},n.clearConfig=function(){ht=null,G=!1},n.isValidAttribute=function(t,e,n){ht||gt({});var r=Wt(t),i=Wt(e);return Et(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&(E[t]=E[t]||[],Vt(E[t],e))},n.removeHook=function(t){E[t]&&qt(E[t])},n.removeHooks=function(t){E[t]&&(E[t]=[])},n.removeAllHooks=function(){E={}},n}(),Me=25,Ee=10,Se=10,Le={};function Ue(t,e,n,r,i,o,a){var u=n-t/2-Se,s=n+t/2+Se,l=t/2+Math.min(0,u-i.left)+Math.max(0,s-i.right);return{pos:[l,a],shape:l-Ee<5?[-l,-15*o,Math.max(Ee,5-l),-10*o]:l+Ee>t-5?[Math.min(-10,t-l-5),-10*o,Math.min(Ee,t-l),-15*o]:[-10,-10*o,Ee,-10*o]}}function Ne(t,e,n,r,i,o,a){var u=r-e/2-Se,s=r+e/2+Se,l=e/2+Math.min(0,u-i.top)+Math.max(0,s-i.bottom);return{pos:[a,l],shape:l-Ee<5?[-15*o,-l,-10*o,Math.max(Ee,5-l)]:l+Ee>e-5?[-10*o,Math.min(-10,e-l-5),-15*o,Math.min(Ee,e-l)]:[-10*o,-10,-10*o,Ee]}}function Oe(t,e,n,r,i,o){var a=Le[t](e,n,r,i,o),u=r-Me-a.pos[0],s=i-Me-a.pos[1];return{left:u,top:s,right:u+e+50,bottom:s+n+50}}function He(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 o=i.style;if(n)for(r in n)o[r]=n[r];return i}function je(){return De||((De=document.createElement("div")).id="flourish-popup-constrainer",(ke=De.style).overflow="hidden",ke.pointerEvents="none",ke.position="absolute",ke.left="0",ke.top="0",ke.margin="0",ke.padding="0",document.body.appendChild(De),this._resizeConstrainer(),De)}Le.bottom=function(t,e){return{shape:[-10,-10,Ee,-10],pos:[t/2,e+Se]}},Le.top=function(t,e){return{shape:[-10,Se,Ee,Se],pos:[t/2,-10]}},Le.left=function(t,e){return{shape:[Se,Ee,Se,-10],pos:[-10,e/2]}},Le.right=function(t,e){return{shape:[-10,Ee,-10,-10],pos:[t+Se,e/2]}},Le.topLeft=function(t,e){return{shape:[15,Se,Se,15],pos:[-10,-10]}},Le.bottomLeft=function(t,e){return{shape:[15,-10,Se,-15],pos:[-10,e+Se]}},Le.topRight=function(t,e){return{shape:[-15,Se,-10,15],pos:[t+Se,-10]}},Le.bottomRight=function(t,e){return{shape:[-15,-10,-10,-15],pos:[t+Se,e+Se]}},Le.bottomFlexible=function(t,e,n,r,i){return Ue(t,0,n,0,i,1,e+Se)},Le.topFlexible=function(t,e,n,r,i){return Ue(t,0,n,0,i,-1,-10)},Le.rightFlexible=function(t,e,n,r,i){return Ne(0,e,0,r,i,1,t+Se)},Le.leftFlexible=function(t,e,n,r,i){return Ne(0,e,0,r,i,-1,-10)};var Ye,Be=1,Re={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 Ie(){for(var t in this.unique_id=Be++,this.is_visible=!0,Re)this["_"+t]=Re[t];this.handlers={click:[]}}function $e(t){Ie.prototype[t]=function(e){return void 0===e?this["_"+t]:(this["_"+t]=e,this)}}for(var ze in Re)$e(ze);function Pe(){return new Ie}function qe(){Ye=Pe().container(document.body),function(t){t.each((function(){var t=Tt(this);if(t.attr("data-popup-allow-interaction")&&!t.select(".popup-content-wrapper").size()){var e=t.append("span").attr("class","popup-content-wrapper").style("display","none").append("span").attr("class","popup-content-outer");e.append("span").attr("class","popup-content-inner"),e.append("span").attr("class","popup-content-arrow")}Tt(this).on("mouseenter focus",(function(t){Ve.call(this,t,!0)})).on("mouseover",Ve).on("mouseout focusout",We)}))}(Dt(".popup"))}function Ve(t,e){if(this.getAttribute("data-popup-head")||this.getAttribute("data-popup-body")){var n=this.getAttribute("data-popup-allow-interaction"),r=this.getAttribute("data-popup-position"),i=this.getBoundingClientRect(),o=i.left+i.width/2,a=i.top+i.height,u=this.getAttribute("data-popup-head")||null,s=this.getAttribute("data-popup-body")||null,l="";if(u&&(l+=At("span").classed("popup-content-header",!0).html(Fe.sanitize(u)).node().outerHTML),s&&(l+=At("span").classed("popup-content-body",!0).html(Fe.sanitize(s)).node().outerHTML),n){r&&["top","bottom"].includes(r)||(r="top");Tt(this).select(".popup-content-outer").style("display","inline-block"),Tt(this).select(".popup-content-inner").style("display","inline-block"),Tt(this).select(".popup-content-wrapper").style("display","block").style("bottom","top"==r?i.height-4+"px":null).style("top","bottom"==r?i.height-4+"px":null),e&&Tt(this).select(".popup-content-inner").html(l);var c=this.getAttribute("data-popup-constrainer")||"body",f=Tt(c).size()?Tt(c).node().getBoundingClientRect():document.body,d=Tt(this).select(".popup-content-inner").node().getBoundingClientRect().width,p=o,h=-d/2,m=p+d/2-(f.right-15),g=f.left+15-(p-d/2);m>0?h-=m:g>0&&(h+=g),Tt(this).select(".popup-content-wrapper").style("left",i.width/2+h+"px");Tt(this).select(".popup-content-arrow").style("left",-5+Math.abs(h)+"px")}else{var v=["top","topFlexible"];r&&("left"===r?(v=["right","rightFlexible"],o=i.left,a=i.top+i.height/2):"right"===r?(v=["left","leftFlexible"],o=i.right,a=i.top+i.height/2):"top"===r?(v=["bottom","bottomFlexible"],o=i.left+i.width/2,a=i.top):"bottom"===r&&(v=["top","topFlexible"],o=i.left+i.width/2,a=i.top+i.height)),Ye.point(o,a).html(l).directions(v).draw()}}}function We(t){document.activeElement===this||this.contains(t.relatedTarget)||(this.getAttribute("data-popup-allow-interaction")&&Tt(this).select(".popup-content-wrapper").style("display","none"),Ye.hide())}Ie.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},Ie.prototype.directions=function(t){return void 0===t?this._directions:("string"==typeof t&&(t=[t]),this._directions=t.slice(),this)},Ie.prototype.text=function(t){return this._html=function(t){return t.replace(/[&<>]/g,(function(t){return{"&":"&amp;","<":"&lt;",">":"&gt;"}[t]}))}(t),this},Ie.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},Ie.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},Ie.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=He("svg",{class:"flourish-popup-svg"},{position:"absolute",top:0,left:0,bottom:0,right:0}),o=He("filter",{id:"dropshadow-"+t.unique_id,height:"130%"});o.appendChild(He("feGaussianBlur",{in:"SourceAlpha",stdDeviation:5})),o.appendChild(He("feOffset",{dx:0,dy:2,result:"offsetblur"}));var a=He("feComponentTransfer");a.appendChild(He("feFuncA",{type:"linear",slope:.2})),o.appendChild(a);var u=He("feMerge");o.appendChild(u),u.appendChild(He("feMergeNode")),u.appendChild(He("feMergeNode",{in:"SourceGraphic"})),i.appendChild(o);var s=He("g",{filter:"url(#dropshadow-"+t.unique_id+")",fill:"white",stroke:"none"});s.appendChild(He("rect",{x:Me,y:Me,rx:5})),s.appendChild(He("path")),i.appendChild(s),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},Ie.prototype._getConstrainer=je,Ie.prototype._resizeConstrainer=function(){De||je.call(this);var t=ke.display;ke.display="none",ke.width=document.documentElement.scrollWidth+"px",ke.height=document.documentElement.scrollHeight+"px",ke.display=t},Ie.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 o=n-e.left,a=r-e.top,u=t._getElement(),s=u.style,l=u.querySelector(".flourish-popup-svg"),c=l.querySelector("g"),f=c.querySelector("rect"),d=c.querySelector("path"),p=u.querySelector(".flourish-popup-content");s.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,g=p.getBoundingClientRect();do{h=Math.ceil(g.width),m=Math.ceil(g.height),s.width=h+50+"px",s.height=m+50+"px",g=p.getBoundingClientRect()}while(h!=Math.ceil(g.width)||m!=Math.ceil(g.height));f.setAttribute("width",h),f.setAttribute("height",m),l.setAttribute("width",h+50),l.setAttribute("height",m+50);for(var v,y,b=null,_=null,w=null,x=1/0,C=1/0,T=0;T<t._directions.length;T++){var A=t._directions[T],D=Oe(A,h,m,n,r,i),k=Math.max(0,Math.floor(i.left)-D.left-15)+Math.max(0,D.right-Math.ceil(i.right)-15),F=Math.max(0,Math.floor(i.top)-D.top-15)+Math.max(0,D.bottom-Math.ceil(i.bottom)-15);if(0==k&&0==F){b=A;break}(k<x||k==x&&F<v)&&(x=k,v=F,_=A),(F<C||F==C&&k<y)&&(C=F,y=k,w=A)}return b?A=b:"horizontal"==t._fallbackFit?A=_:"vertical"==t._fallbackFit?A=w:(console.warn("Popup: failed to point box of size ("+h+", "+m+") at ("+n+", "+r+") within ("+i.left+", "+i.top+", "+i.right+", "+i.bottom+")"),A=t._directions[0]),function(t,e,n,r,i,o,a,u,s,l){var c=Le[t](r,i,u,s,l);e.left=o-Me-c.pos[0]+"px",e.top=a-Me-c.pos[1]+"px",n.setAttribute("d","M0,0L"+c.shape.join(",")+"Z"),n.setAttribute("transform","translate("+(c.pos[0]+Me)+","+(c.pos[1]+Me)+")")}(A,s,d,h,m,o,a,n,r,i),t}console.error("Popup: cannot draw popup till point() has been specified")},Ie.prototype.hide=function(){return this.is_visible?(this.is_visible=!1,this._getElement().style.display="none",this):this},Pe.version="2.1.5";const Ze=Math.pow(2,31)-1,Ge=Math.pow(2,15);function Xe(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>Ze&&console.warn("Column index out of range"),Math.min(n-1,Ze)}function Je(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 Qe(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=Xe(n),o=Xe(r),a=[],u=o>=i?1:-1,s=Math.abs(o-i)+1;s>Ge&&(console.warn("Truncating excessively long range"),s=Ge);for(var l=0;l<s;l++)a.push(i+l*u);return a}function Ke(t,e){return Je(t)+"-"+Je(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(Xe(i)):Array.prototype.push.apply(e,Qe(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,o=0;o<t.length-1;o++){var a=t[o+1]-t[o];null!==i||1!==Math.abs(a)?a!==i?(e.push([n,r]),n=r=t[o+1],i=null):r=t[o+1]:(r=t[o+1],i=a)}return e.push([n,r]),e}(t),n=[],r=0;r<e.length;r++){var i=e[r];i[0]==i[1]?n.push(Je(i[0])):n.push(Ke(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+Je(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,on=new Date;function an(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,o){var a,u=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return u;do{u.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return u},i.filter=function(n){return an((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),on.setTime(+r),t(rn),t(on),Math.floor(n(rn,on))},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 un=864e5,sn=6048e5,ln=an((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()))/un}),(function(t){return t.getDate()-1})),cn=ln;function fn(t){return an((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()))/sn}))}ln.range;var dn=fn(0),pn=fn(1),hn=fn(2),mn=fn(3),gn=fn(4),vn=fn(5),yn=fn(6);dn.range,pn.range,hn.range,mn.range,gn.range,vn.range,yn.range;var bn=an((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()}));bn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((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 _n=bn;bn.range;var wn=an((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/un}),(function(t){return t.getUTCDate()-1})),xn=wn;function Cn(t){return an((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)/sn}))}wn.range;var Tn=Cn(0),An=Cn(1),Dn=Cn(2),kn=Cn(3),Fn=Cn(4),Mn=Cn(5),En=Cn(6);Tn.range,An.range,Dn.range,kn.range,Fn.range,Mn.range,En.range;var Sn=an((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()}));Sn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((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 Ln=Sn;function Un(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 Nn(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 On(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}Sn.range;var Hn,jn,Yn,Bn={"-":"",_:" ",0:"0"},Rn=/^\s*\d+/,In=/^%/,$n=/[\\^$*+?|[\]().{}]/g;function zn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function Pn(t){return t.replace($n,"\\$&")}function qn(t){return new RegExp("^(?:"+t.map(Pn).join("|")+")","i")}function Vn(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function Wn(t,e,n){var r=Rn.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Zn(t,e,n){var r=Rn.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Gn(t,e,n){var r=Rn.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Xn(t,e,n){var r=Rn.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Jn(t,e,n){var r=Rn.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Qn(t,e,n){var r=Rn.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Kn(t,e,n){var r=Rn.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function tr(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 er(t,e,n){var r=Rn.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function nr(t,e,n){var r=Rn.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function rr(t,e,n){var r=Rn.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ir(t,e,n){var r=Rn.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function or(t,e,n){var r=Rn.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ar(t,e,n){var r=Rn.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ur(t,e,n){var r=Rn.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function sr(t,e,n){var r=Rn.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function lr(t,e,n){var r=Rn.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function cr(t,e,n){var r=In.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function fr(t,e,n){var r=Rn.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function dr(t,e,n){var r=Rn.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function pr(t,e){return zn(t.getDate(),e,2)}function hr(t,e){return zn(t.getHours(),e,2)}function mr(t,e){return zn(t.getHours()%12||12,e,2)}function gr(t,e){return zn(1+cn.count(_n(t),t),e,3)}function vr(t,e){return zn(t.getMilliseconds(),e,3)}function yr(t,e){return vr(t,e)+"000"}function br(t,e){return zn(t.getMonth()+1,e,2)}function _r(t,e){return zn(t.getMinutes(),e,2)}function wr(t,e){return zn(t.getSeconds(),e,2)}function xr(t){var e=t.getDay();return 0===e?7:e}function Cr(t,e){return zn(dn.count(_n(t)-1,t),e,2)}function Tr(t){var e=t.getDay();return e>=4||0===e?gn(t):gn.ceil(t)}function Ar(t,e){return t=Tr(t),zn(gn.count(_n(t),t)+(4===_n(t).getDay()),e,2)}function Dr(t){return t.getDay()}function kr(t,e){return zn(pn.count(_n(t)-1,t),e,2)}function Fr(t,e){return zn(t.getFullYear()%100,e,2)}function Mr(t,e){return zn((t=Tr(t)).getFullYear()%100,e,2)}function Er(t,e){return zn(t.getFullYear()%1e4,e,4)}function Sr(t,e){var n=t.getDay();return zn((t=n>=4||0===n?gn(t):gn.ceil(t)).getFullYear()%1e4,e,4)}function Lr(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+zn(e/60|0,"0",2)+zn(e%60,"0",2)}function Ur(t,e){return zn(t.getUTCDate(),e,2)}function Nr(t,e){return zn(t.getUTCHours(),e,2)}function Or(t,e){return zn(t.getUTCHours()%12||12,e,2)}function Hr(t,e){return zn(1+xn.count(Ln(t),t),e,3)}function jr(t,e){return zn(t.getUTCMilliseconds(),e,3)}function Yr(t,e){return jr(t,e)+"000"}function Br(t,e){return zn(t.getUTCMonth()+1,e,2)}function Rr(t,e){return zn(t.getUTCMinutes(),e,2)}function Ir(t,e){return zn(t.getUTCSeconds(),e,2)}function $r(t){var e=t.getUTCDay();return 0===e?7:e}function zr(t,e){return zn(Tn.count(Ln(t)-1,t),e,2)}function Pr(t){var e=t.getUTCDay();return e>=4||0===e?Fn(t):Fn.ceil(t)}function qr(t,e){return t=Pr(t),zn(Fn.count(Ln(t),t)+(4===Ln(t).getUTCDay()),e,2)}function Vr(t){return t.getUTCDay()}function Wr(t,e){return zn(An.count(Ln(t)-1,t),e,2)}function Zr(t,e){return zn(t.getUTCFullYear()%100,e,2)}function Gr(t,e){return zn((t=Pr(t)).getUTCFullYear()%100,e,2)}function Xr(t,e){return zn(t.getUTCFullYear()%1e4,e,4)}function Jr(t,e){var n=t.getUTCDay();return zn((t=n>=4||0===n?Fn(t):Fn.ceil(t)).getUTCFullYear()%1e4,e,4)}function Qr(){return"+0000"}function Kr(){return"%"}function ti(t){return+t}function ei(t){return Math.floor(+t/1e3)}function ni(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function ri(t){return function(e){return"string"!=typeof e&&ni(e),(e=e.trim())?t(e):null}}Hn=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,l=qn(i),c=Vn(i),f=qn(o),d=Vn(o),p=qn(a),h=Vn(a),m=qn(u),g=Vn(u),v=qn(s),y=Vn(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:pr,e:pr,f:yr,g:Mr,G:Sr,H:hr,I:mr,j:gr,L:vr,m:br,M:_r,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:ti,s:ei,S:wr,u:xr,U:Cr,V:Ar,w:Dr,W:kr,x:null,X:null,y:Fr,Y:Er,Z:Lr,"%":Kr},_={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Ur,e:Ur,f:Yr,g:Gr,G:Jr,H:Nr,I:Or,j:Hr,L:jr,m:Br,M:Rr,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:ti,s:ei,S:Ir,u:$r,U:zr,V:qr,w:Vr,W:Wr,x:null,X:null,y:Zr,Y:Xr,Z:Qr,"%":Kr},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=f.exec(e.slice(n));return r?(t.w=d[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=v.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=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return T(t,e,n,r)},d:rr,e:rr,f:lr,g:Kn,G:Qn,H:or,I:or,j:ir,L:sr,m:nr,M:ar,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:er,Q:fr,s:dr,S:ur,u:Zn,U:Gn,V:Xn,w:Wn,W:Jn,x:function(t,e,r){return T(t,n,e,r)},X:function(t,e,n){return T(t,r,e,n)},y:Kn,Y:Qn,Z:tr,"%":cr};function x(t,e){return function(n){var r,i,o,a=[],u=-1,s=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++u<l;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=Bn[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function C(t,e){return function(n){var r,i,o=On(1900,void 0,1);if(T(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Nn(On(o.y,0,1))).getUTCDay(),r=i>4||0===i?An.ceil(r):An(r),r=xn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Un(On(o.y,0,1))).getDay(),r=i>4||0===i?pn.ceil(r):pn(r),r=cn.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Nn(On(o.y,0,1)).getUTCDay():Un(On(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Nn(o)):Un(o)}}function T(t,e,n,r){for(var i,o,a=0,u=e.length,s=n.length;a<u;){if(r>=s)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in Bn?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=x(n,b),b.X=x(r,b),b.c=x(e,b),_.x=x(n,_),_.X=x(r,_),_.c=x(e,_),{format:function(t){var e=x(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=C(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=C(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"]}),Hn.format,Hn.parse,jn=Hn.utcFormat,Yn=Hn.utcParse;var ii=new Date(1972,3,27,19,45,5),oi={"%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 ai(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function ui(t,e){var n,r=Yn(t),i=jn(t);return n=ri("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:ri((function(e){return r(e)||(oi[t]?ai(oi[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(ii)})}var si=Object.freeze([ui("%Y-%m-%dT%H:%M:%S.%LZ"),ui("%Y-%m-%d %H:%M:%S"),ui("%Y-%m-%dT%H:%M:%S"),ui("%Y-%m-%dT%H:%M:%SZ"),ui("%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})),ui("%d/%m/%Y %H:%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&&n[2]>=1e3&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),ui("%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])})),ui("%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})),ui("%m/%d/%Y %H:%M",(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&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),ui("%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])})),ui("%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})),ui("%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})),ui("%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])})),ui("%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})),ui("%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])})),ui("%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})),ui("%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])})),ui("%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})),ui("%Y-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),ui("%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})),ui("%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})),ui("%d %b %y"),ui("%-d %b ’%y"),ui("%d %B %y"),ui("%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})),ui("%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})),ui("%d-%b-%y"),ui("%d-%B-%y"),ui("%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})),ui("%m/%y"),ui("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),ui("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),ui("%b-%y"),ui("%b %y"),ui("%B %y"),ui("%b '%y"),ui("%B %-d %Y"),ui("%d %b",(function(t,e){return!!e||!!ai(oi["%d %b"])(t)})),ui("%d %B"),ui("%b %d",(function(t,e){return!!e||!!ai(oi["%b %d"])(t)})),ui("%B %d"),ui("%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})),ui("%m-%d"),ui("%d/%m"),ui("%m/%d"),ui("%b %d %Y"),ui("%b %d %Y, %-I.%M%p"),ui("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),ui("%B"),ui("%b"),ui("%X"),ui("%I:%M %p"),ui("%-I.%M%p"),ui("%H:%M",(function(t,e){if(!e)return!1;var n=t.split(":").map(parseFloat);return n[0]>=0&&n[0]<24})),ui("%H:%M:%S"),ui("%M:%S"),ui("%-I%p"),ui("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),ui("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length}))]);function li(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 ci,fi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function di(t){if(!(e=fi.exec(t)))throw new Error("invalid format: "+t);var e;return new pi({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 pi(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 hi(t,e){var n=li(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")}di.prototype=pi.prototype,pi.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 mi={"%":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 hi(100*t,e)},r:hi,s:function(t,e){var n=li(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(ci=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+li(t,Math.max(0,e+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function gi(t){return t}var vi=Array.prototype.map,yi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function bi(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?gi:(e=vi.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=e[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?gi:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(vi.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=di(t)).fill,n=t.align,f=t.sign,d=t.symbol,p=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):mi[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===d?o:/[%p]/.test(y)?s:"",w=mi[y],x=/[defgprs%]/.test(y);function C(t){var i,o,s,d=b,C=_;if("c"===y)C=w(t)+C,t="";else{var T=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),g),v&&(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)),T&&0==+t&&"+"!==f&&(T=!1),d=(T?"("===f?f:l:"-"===f||"("===f?"":f)+d,C=("s"===y?yi[8+ci/3]:"")+C+(T&&"("===f?")":""),x)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){C=(46===s?a+t.slice(i+1):t.slice(i))+C,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var A=d.length+t.length+C.length,D=A<h?new Array(h-A+1).join(e):"";switch(m&&p&&(t=r(D+t,D.length?h-C.length:1/0),D=""),n){case"<":t=d+t+C+D;break;case"=":t=d+D+t+C;break;case"^":t=D.slice(0,A=D.length>>1)+d+t+C+D.slice(A);break;default:t=D+d+t+C}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),C.toString=function(){return t+""},C}return{format:f,formatPrefix:function(t,e){var n,r=f(((t=di(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=li(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=yi[8+i/3];return function(t){return r(o*t)+a}}}}var _i={test:ri((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((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"},wi={test:ri((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((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"},xi={test:ri((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},Ci={test:ri((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((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"},Ti={test:ri((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((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"},Ai={test:ri((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},Di=Object.freeze([_i,wi,Ci,Ti,xi,Ai]);Di.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=bi({decimal:t.decimal_mark,thousands:t.thousand_separator,grouping:[3],currency:["",""]});return function(t,i){return null===t?"":(i||(i=",.2f"),i!==n&&(n=i,e=r.format(n)),e(t))}}(t),Object.freeze(t)}));var ki,Fi=Object.freeze({test:function(t){return"string"==typeof t||ni(t)},parse:function(t){return"string"==typeof t?t:ni(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),Mi=Object.freeze({datetime:si,number:Di}),Ei=Object.freeze(["datetime","number","string"]),Si=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),Li=Object.freeze(Object.keys(Si));function Ui(t,e){return t.index-e.index}function Ni(t,e){return e.n_success-t.n_success||Ui(t,e)}function Oi(t){return(""+t).trim()}function Hi(t){return void 0===t?function(t){return Oi(t)}:"function"==typeof t?function(e,n){return Oi(t(e,n))}:function(e){return Oi(e[""+t])}}function ji(t){t?Array.isArray(t)||(t=[t]):t=Ei;var e=t.reduce((function(t,e){var n=Mi[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=Li.reduce((function(t,e){return t[e]=Si[e],t}),{}),i=function(t,i){i=Hi(i);var o=t.map(i).filter((function(t){return t}));if(!o.length)return n?[Fi]:[];var a=Math.min(r.n_max,o.length),u=Math.floor(a*r.failure_fraction),s=r.n_failing_values,l=r.sort?Ni:Ui,c=e.slice().reduce((function(t,e,n){for(var r=c=0,i=[],l=!1,c=0;c<a;c++){var f=o[c];if(!e.test(f)&&(++r>u?l=!0:-1===i.indexOf(f)&&(i.push(f),i.length>s&&(l=!0)),l))break}return l||t.push({interp:e,n_success:a-r,index:n}),t}),[]).sort(l).map((function(t){return t.interp}));return n&&c.push(Fi),c};return Li.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}ji.DATETIME_IDS=Object.freeze(si.map((function(t){return t.id}))),ji.NUMBER_IDS=Object.freeze(Di.map((function(t){return t.id}))),ji.STRING_IDS=Object.freeze([Fi.id]),ji.getInterpretation=(ki=si.concat(Di,Fi).reduce((function(t,e){return t[e.id]=e,t}),{}),function(t){return ki[t]}),ji._createAccessorFunction=Hi;var Yi=new Date,Bi=new Date;function Ri(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,o){var a,u=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return u;do{u.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return u},i.filter=function(n){return Ri((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 Yi.setTime(+e),Bi.setTime(+r),t(Yi),t(Bi),Math.floor(n(Yi,Bi))},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 Ii=864e5,$i=6048e5,zi=Ri((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()))/Ii}),(function(t){return t.getDate()-1})),Pi=zi;function qi(t){return Ri((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()))/$i}))}zi.range;var Vi=qi(0),Wi=qi(1),Zi=qi(2),Gi=qi(3),Xi=qi(4),Ji=qi(5),Qi=qi(6);Vi.range,Wi.range,Zi.range,Gi.range,Xi.range,Ji.range,Qi.range;var Ki=Ri((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()}));Ki.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ri((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 to=Ki;Ki.range;var eo=Ri((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/Ii}),(function(t){return t.getUTCDate()-1})),no=eo;function ro(t){return Ri((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)/$i}))}eo.range;var io=ro(0),oo=ro(1),ao=ro(2),uo=ro(3),so=ro(4),lo=ro(5),co=ro(6);io.range,oo.range,ao.range,uo.range,so.range,lo.range,co.range;var fo=Ri((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()}));fo.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ri((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 po=fo;function ho(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 mo(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 go(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}fo.range;var vo,yo,bo,_o={"-":"",_:" ",0:"0"},wo=/^\s*\d+/,xo=/^%/,Co=/[\\^$*+?|[\]().{}]/g;function To(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function Ao(t){return t.replace(Co,"\\$&")}function Do(t){return new RegExp("^(?:"+t.map(Ao).join("|")+")","i")}function ko(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function Fo(t,e,n){var r=wo.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Mo(t,e,n){var r=wo.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Eo(t,e,n){var r=wo.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function So(t,e,n){var r=wo.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Lo(t,e,n){var r=wo.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Uo(t,e,n){var r=wo.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function No(t,e,n){var r=wo.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Oo(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 Ho(t,e,n){var r=wo.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function jo(t,e,n){var r=wo.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Yo(t,e,n){var r=wo.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Bo(t,e,n){var r=wo.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ro(t,e,n){var r=wo.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Io(t,e,n){var r=wo.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function $o(t,e,n){var r=wo.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function zo(t,e,n){var r=wo.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Po(t,e,n){var r=wo.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function qo(t,e,n){var r=xo.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Vo(t,e,n){var r=wo.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Wo(t,e,n){var r=wo.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Zo(t,e){return To(t.getDate(),e,2)}function Go(t,e){return To(t.getHours(),e,2)}function Xo(t,e){return To(t.getHours()%12||12,e,2)}function Jo(t,e){return To(1+Pi.count(to(t),t),e,3)}function Qo(t,e){return To(t.getMilliseconds(),e,3)}function Ko(t,e){return Qo(t,e)+"000"}function ta(t,e){return To(t.getMonth()+1,e,2)}function ea(t,e){return To(t.getMinutes(),e,2)}function na(t,e){return To(t.getSeconds(),e,2)}function ra(t){var e=t.getDay();return 0===e?7:e}function ia(t,e){return To(Vi.count(to(t)-1,t),e,2)}function oa(t){var e=t.getDay();return e>=4||0===e?Xi(t):Xi.ceil(t)}function aa(t,e){return t=oa(t),To(Xi.count(to(t),t)+(4===to(t).getDay()),e,2)}function ua(t){return t.getDay()}function sa(t,e){return To(Wi.count(to(t)-1,t),e,2)}function la(t,e){return To(t.getFullYear()%100,e,2)}function ca(t,e){return To((t=oa(t)).getFullYear()%100,e,2)}function fa(t,e){return To(t.getFullYear()%1e4,e,4)}function da(t,e){var n=t.getDay();return To((t=n>=4||0===n?Xi(t):Xi.ceil(t)).getFullYear()%1e4,e,4)}function pa(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+To(e/60|0,"0",2)+To(e%60,"0",2)}function ha(t,e){return To(t.getUTCDate(),e,2)}function ma(t,e){return To(t.getUTCHours(),e,2)}function ga(t,e){return To(t.getUTCHours()%12||12,e,2)}function va(t,e){return To(1+no.count(po(t),t),e,3)}function ya(t,e){return To(t.getUTCMilliseconds(),e,3)}function ba(t,e){return ya(t,e)+"000"}function _a(t,e){return To(t.getUTCMonth()+1,e,2)}function wa(t,e){return To(t.getUTCMinutes(),e,2)}function xa(t,e){return To(t.getUTCSeconds(),e,2)}function Ca(t){var e=t.getUTCDay();return 0===e?7:e}function Ta(t,e){return To(io.count(po(t)-1,t),e,2)}function Aa(t){var e=t.getUTCDay();return e>=4||0===e?so(t):so.ceil(t)}function Da(t,e){return t=Aa(t),To(so.count(po(t),t)+(4===po(t).getUTCDay()),e,2)}function ka(t){return t.getUTCDay()}function Fa(t,e){return To(oo.count(po(t)-1,t),e,2)}function Ma(t,e){return To(t.getUTCFullYear()%100,e,2)}function Ea(t,e){return To((t=Aa(t)).getUTCFullYear()%100,e,2)}function Sa(t,e){return To(t.getUTCFullYear()%1e4,e,4)}function La(t,e){var n=t.getUTCDay();return To((t=n>=4||0===n?so(t):so.ceil(t)).getUTCFullYear()%1e4,e,4)}function Ua(){return"+0000"}function Na(){return"%"}function Oa(t){return+t}function Ha(t){return Math.floor(+t/1e3)}function ja(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function Ya(t){return function(e){return"string"!=typeof e&&ja(e),(e=e.trim())?t(e):null}}!function(t){vo=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,l=Do(i),c=ko(i),f=Do(o),d=ko(o),p=Do(a),h=ko(a),m=Do(u),g=ko(u),v=Do(s),y=ko(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:Zo,e:Zo,f:Ko,g:ca,G:da,H:Go,I:Xo,j:Jo,L:Qo,m:ta,M:ea,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Oa,s:Ha,S:na,u:ra,U:ia,V:aa,w:ua,W:sa,x:null,X:null,y:la,Y:fa,Z:pa,"%":Na},_={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:ha,e:ha,f:ba,g:Ea,G:La,H:ma,I:ga,j:va,L:ya,m:_a,M:wa,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Oa,s:Ha,S:xa,u:Ca,U:Ta,V:Da,w:ka,W:Fa,x:null,X:null,y:Ma,Y:Sa,Z:Ua,"%":Na},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=f.exec(e.slice(n));return r?(t.w=d[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=v.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=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return T(t,e,n,r)},d:Yo,e:Yo,f:Po,g:No,G:Uo,H:Ro,I:Ro,j:Bo,L:zo,m:jo,M:Io,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:Ho,Q:Vo,s:Wo,S:$o,u:Mo,U:Eo,V:So,w:Fo,W:Lo,x:function(t,e,r){return T(t,n,e,r)},X:function(t,e,n){return T(t,r,e,n)},y:No,Y:Uo,Z:Oo,"%":qo};function x(t,e){return function(n){var r,i,o,a=[],u=-1,s=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++u<l;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=_o[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function C(t,e){return function(n){var r,i,o=go(1900,void 0,1);if(T(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=mo(go(o.y,0,1))).getUTCDay(),r=i>4||0===i?oo.ceil(r):oo(r),r=no.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=ho(go(o.y,0,1))).getDay(),r=i>4||0===i?Wi.ceil(r):Wi(r),r=Pi.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?mo(go(o.y,0,1)).getUTCDay():ho(go(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,mo(o)):ho(o)}}function T(t,e,n,r){for(var i,o,a=0,u=e.length,s=n.length;a<u;){if(r>=s)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in _o?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=x(n,b),b.X=x(r,b),b.c=x(e,b),_.x=x(n,_),_.X=x(r,_),_.c=x(e,_),{format:function(t){var e=x(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=C(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=C(t+="",!0);return e.toString=function(){return t},e}}}(t),vo.format,vo.parse,yo=vo.utcFormat,bo=vo.utcParse}({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"]});var Ba=new Date(1972,3,27,19,45,5),Ra={"%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 Ia(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function $a(t,e){var n,r=bo(t),i=yo(t);return n=Ya("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:Ya((function(e){return r(e)||(Ra[t]?Ia(Ra[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(Ba)})}var za=Object.freeze([$a("%Y-%m-%dT%H:%M:%S.%LZ"),$a("%Y-%m-%d %H:%M:%S"),$a("%Y-%m-%dT%H:%M:%S"),$a("%Y-%m-%dT%H:%M:%SZ"),$a("%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})),$a("%d/%m/%Y %H:%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&&n[2]>=1e3&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),$a("%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])})),$a("%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})),$a("%m/%d/%Y %H:%M",(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&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),$a("%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])})),$a("%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})),$a("%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})),$a("%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])})),$a("%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})),$a("%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])})),$a("%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})),$a("%Y-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),$a("%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})),$a("%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})),$a("%d %b %y"),$a("%-d %b ’%y"),$a("%d %B %y"),$a("%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})),$a("%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})),$a("%d-%b-%y"),$a("%d-%B-%y"),$a("%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})),$a("%m/%y"),$a("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),$a("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),$a("%b-%y"),$a("%b %y"),$a("%B %y"),$a("%b '%y"),$a("%B %-d %Y"),$a("%d %b",(function(t,e){return!!e||!!Ia(Ra["%d %b"])(t)})),$a("%d %B"),$a("%b %d",(function(t,e){return!!e||!!Ia(Ra["%b %d"])(t)})),$a("%B %d"),$a("%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})),$a("%m-%d"),$a("%d/%m"),$a("%m/%d"),$a("%b %d %Y"),$a("%b %d %Y, %-I.%M%p"),$a("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),$a("%B"),$a("%b"),$a("%X"),$a("%I:%M %p"),$a("%-I.%M%p"),$a("%H:%M"),$a("%H:%M:%S"),$a("%-I%p"),$a("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),$a("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length}))]);function Pa(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 qa,Va=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wa(t){if(!(e=Va.exec(t)))throw new Error("invalid format: "+t);var e;return new Za({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 Za(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 Ga(t,e){var n=Pa(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")}Wa.prototype=Za.prototype,Za.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 Xa={"%":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 Ga(100*t,e)},r:Ga,s:function(t,e){var n=Pa(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(qa=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Pa(t,Math.max(0,e+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Ja(t){return t}var Qa=Array.prototype.map,Ka=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function tu(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ja:(e=Qa.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=e[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Ja:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Qa.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=Wa(t)).fill,n=t.align,f=t.sign,d=t.symbol,p=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):Xa[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===d?o:/[%p]/.test(y)?s:"",w=Xa[y],x=/[defgprs%]/.test(y);function C(t){var i,o,s,d=b,C=_;if("c"===y)C=w(t)+C,t="";else{var T=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),g),v&&(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)),T&&0==+t&&"+"!==f&&(T=!1),d=(T?"("===f?f:l:"-"===f||"("===f?"":f)+d,C=("s"===y?Ka[8+qa/3]:"")+C+(T&&"("===f?")":""),x)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){C=(46===s?a+t.slice(i+1):t.slice(i))+C,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var A=d.length+t.length+C.length,D=A<h?new Array(h-A+1).join(e):"";switch(m&&p&&(t=r(D+t,D.length?h-C.length:1/0),D=""),n){case"<":t=d+t+C+D;break;case"=":t=d+D+t+C;break;case"^":t=D.slice(0,A=D.length>>1)+d+t+C+D.slice(A);break;default:t=D+d+t+C}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),C.toString=function(){return t+""},C}return{format:f,formatPrefix:function(t,e){var n,r=f(((t=Wa(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Pa(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=Ka[8+i/3];return function(t){return r(o*t)+a}}}}var eu={test:Ya((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ya((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"},nu={test:Ya((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ya((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"},ru={test:Ya((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ya((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},iu={test:Ya((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ya((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"},ou={test:Ya((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ya((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"},au={test:Ya((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Ya((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},uu=Object.freeze([eu,nu,iu,ou,ru,au]);uu.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=tu({decimal:t.decimal_mark,thousands:t.thousand_separator,grouping:[3],currency:["",""]});return function(t,i){return null===t?"":(i||(i=",.2f"),i!==n&&(n=i,e=r.format(n)),e(t))}}(t),Object.freeze(t)}));var su=Object.freeze({test:function(t){return"string"==typeof t||ja(t)},parse:function(t){return"string"==typeof t?t:ja(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),lu=Object.freeze({datetime:za,number:uu}),cu=Object.freeze(["datetime","number","string"]),fu=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),du=Object.freeze(Object.keys(fu));function pu(t,e){return t.index-e.index}function hu(t,e){return e.n_success-t.n_success||pu(t,e)}function mu(t){return(""+t).trim()}function gu(t){return void 0===t?function(t){return mu(t)}:"function"==typeof t?function(e,n){return mu(t(e,n))}:function(e){return mu(e[""+t])}}function vu(t){t?Array.isArray(t)||(t=[t]):t=cu;var e=t.reduce((function(t,e){var n=lu[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=du.reduce((function(t,e){return t[e]=fu[e],t}),{}),i=function(t,i){i=gu(i);var o=t.map(i).filter((function(t){return t}));if(!o.length)return n?[su]:[];var a=Math.min(r.n_max,o.length),u=Math.floor(a*r.failure_fraction),s=r.n_failing_values,l=r.sort?hu:pu,c=e.slice().reduce((function(t,e,n){for(var r=c=0,i=[],l=!1,c=0;c<a;c++){var f=o[c];if(!e.test(f)&&(++r>u?l=!0:-1===i.indexOf(f)&&(i.push(f),i.length>s&&(l=!0)),l))break}return l||t.push({interp:e,n_success:a-r,index:n}),t}),[]).sort(l).map((function(t){return t.interp}));return n&&c.push(su),c};return du.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 yu(t,e,n,r){var i=[],o=[],a=0,u=[],s={};function l(t,e){if(!s[t])return{};var n=s[t];return n[e]?n[e]:{}}for(var c in u.column_names={},u.metadata={},n){var f={},d=n[c];if(d){for(let t=0;t<d.length;t++){const e=d[t].type_id,n=d[t].output_format_id,r=n&&"auto"!==n?n:e;f[d[t].index]={type_id:e,output_format_id:r}}s[c]=f}}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 g=m[0].length;h.columns=h.columns.filter((function(t){return t<g})),u.column_names[p]=h.columns.map((function(t){return m[0][t]})),u.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));{u.column_names[p]=m[0][h.column];const{type_id:t,output_format_id:e}=l(h.data_table_id,h.column);t&&(u.metadata[p]={type:t.split("$")[0],type_id:t,output_format_id:e})}}-1==o.indexOf(h.data_table_id)&&(o.push(h.data_table_id),a=Math.max(a,m.length-1)),i.push(h)}else console.warn("Empty data table")}else{var v=[];for(var y in e)v.push(y);console.error("Data table id "+h.data_table_id+" not in "+JSON.stringify(v))}}function b(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 vu.getInterpretation(n)}(t.data_table_id,e);r&&"number"==r.type&&(n=(n||"").replace(/[€£$¥%º]/g,""));var i=r?r.parse(n):n;return Number.isNaN(i)&&(i=null),i}for(var _=0;_<a;_++){for(var w={},x=0;x<i.length;x++){var C=e[(h=i[x]).data_table_id];_+1>=C.length||("columns"in h&&null!=h.columns?w[h.key]=h.columns.filter((function(t){return t<C[_+1].length})).map((function(t){return b(h,t,C[_+1][t])})):"column"in h&&null!=h.column&&(h.column>=C[_+1].length?w[h.key]=b(h,h.column,""):w[h.key]=b(h,h.column,C[_+1][h.column])))}u.push(w)}return u}function bu(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}vu.DATETIME_IDS=Object.freeze(za.map((function(t){return t.id}))),vu.NUMBER_IDS=Object.freeze(uu.map((function(t){return t.id}))),vu.STRING_IDS=Object.freeze([su.id]),vu.getInterpretation=function(){var t=za.concat(uu,su).reduce((function(t,e){return t[e.id]=e,t}),{});return function(e){return t[e]}}(),vu._createAccessorFunction=gu,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 o=e[i];if(t.call(r,o,i,e))return i;i++}return-1},configurable:!0,writable:!0}),vu().nMax(1/0).nFailingValues(8).failureFraction(.1);let _u,wu={};const xu=t=>{const e=Tt(".dialog");if(t.which in wu){var n=wu[t.which];n.callback&&n.callback(_u.node().value),e.remove(),t.preventDefault()}};function Cu(t,e,{buttons:n=[{text:"Okay",keyCode:13}],is_html:r=!1,upgrade:i=null,is_loading:o=!1,width:a="420px",on_close:u=null}={}){var s=Tt("body").append("div").attr("class","dialog").attr("tabindex",0).on("mousedown",(function(t){for(var e=t.target,n=!1;e&&"dialog"!=e.className;)"dialog"==(e=e.parentNode).className&&(n=!0);n||(u&&u(),s.remove())})),l=s.append("div").attr("class","dialog-inner").style("width",a).on("click",(function(t){t.stopPropagation()})),c=l.append("div").attr("class","text"+(o?" loading":""));if("string"==typeof t?c.append("h1").text(t):t instanceof HTMLElement&&c.append("h1").append((()=>t)),"string"==typeof e)_u=r?c.append("div").classed("loading-spinner",o).html(e):c.append("p").text(e);else if(e instanceof HTMLElement)_u=c.append((()=>e));else if("object"==typeof e){if(_u=c.append(e.type),e.value&&(_u.node().value=e.value),e.attributes)for(var f in e.attributes)_u.attr(f,e.attributes[f]);_u.node().focus()}var d=l;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")}(d=d.append("div").attr("class","upgrade"),i.message,i.list,i.is_business);var p=d.append("div").attr("class","btns"+(o?" loading":""));return wu={},n.forEach((function(t){var e=p.append(t.tag_name||"div").attr("class","btn").attr("data-testid","dialog-button").style("margin-right",o?"0":"0.75em").text(t.text).on("click",(function(){t.callback&&t.callback(_u.node().value,s),s.remove()}));t.class&&e.classed(t.class,!0),t.keyCode&&(wu[t.keyCode]=t),t.href&&e.attr("href",t.href),t.target&&e.attr("target",t.target),t.fa_icon&&e.append("i").lower().attr("class","fa "+t.fa_icon)})),s.node().addEventListener("keydown",xu),s.node().focus(),s}const Tu={allow_other_option:!1,match_anywhere:!1,custom_renderer:null,autocomplete:!0};function Au({input:t,id:e,options:n=[],mode:r="single",options_config:i={}}){if(t&&e){this.input=t,this.id=e,this.mode=["single","multi"].includes(r)?r:"single",this.options=(Array.isArray(n)?n:[n]).map(ku),this.selected_options=[],this.options_config={...Tu,...i},this.options_config.allow_other_option&&"multi"===this.mode&&(console.warn("Warning for dropdown "+e+": it's not possible to allow other options in multi mode."),this.options_config.allow_other_option=!1),this.options_config.autocomplete&&"multi"===this.mode&&(console.warn("Warning for dropdown "+e+": autocomplete will be disabled in multi mode."),this.options_config.autocomplete=!1),this.autocomplete=this.initAutocomplete(),this.changeCallback=function(){};var o=this;this.input.type="text",this.input.classList.add("multi"==r?"multi-select":"single-select"),this.input.addEventListener("change",(function(t){o.changeCallback.call(o.input,o.getValue(),t)})),this.setOptions(n),this.options_config.autocomplete||(this.input.setAttribute("readonly",!0),this.input.style.cursor="pointer")}else console.error("Can't initialize a dropdown without input or id")}function Du(t){var e=t.options.filter((e=>t.selected_options.includes(e[1])));return t.selected_options.length&&!e.length&&t.options_config.allow_other_option&&(e=[[t.selected_options[0],t.selected_options[0]]]),e}function ku(t){return Array.isArray(t)?t.map(String):[String(t),String(t)]}Au.prototype.setSelectedOptions=function(t){this.selected_options=Array.isArray(t)?t:[t],this.updateInput()},Au.prototype.setOptions=function(t){this.options=t.map(ku),this.autocomplete.renderOptions()},Au.prototype.select=function(t){"multi"==this.mode?this.selected_options.push(t):this.selected_options=[t],this.updateInput()},Au.prototype.deselect=function(t){if("single"!=this.mode){var e=this.selected_options.indexOf(t);e>-1&&this.selected_options.splice(e,1),this.updateInput()}},Au.prototype.getValue=function(t){var e=Du(this).map((t=>t[1]));return"multi"===this.mode?t?e.join(", "):e:e[0]},Au.prototype.getOptions=function(){return this.options},Au.prototype.getDisplayValue=function(){return Du(this).map((t=>t[0])).join(", ")},Au.prototype.updateInput=function(){this.input.value=this.getDisplayValue(),this.input.setAttribute("data-value",this.getValue(!0))},Au.prototype.isSelected=function(t){return this.selected_options.includes(t)},Au.prototype.onChange=function(t){this.changeCallback=t};Au.prototype.initAutocomplete=function(){var t=this,e=this.options_config,n=this.input;if(n.setAttribute("data-autocomplete",this.id),n.setAttribute("autocomplete","off"),!document.getElementById(this.id)){const t=At("i").classed("fa fa-chevron-down clickable",!0),e=At("div").classed("dropdown autocomplete",!0).attr("id",this.id);n.insertAdjacentHTML("afterend",t.node().outerHTML+e.node().outerHTML)}var r=[],i=Tt(document.getElementById(this.id));i.classed("click-to-open",!0);var o=i.append("div").attr("class","dropdown-list");function a(t){if(1===t.length)return"dropdown-category";var e="dropdown-item";return r.length&&r.includes(t[1])&&(e+=" current"),e}function u(n){var r=n||t.options;o.selectAll("div").remove(),o.selectAll("div").data(r).enter().append("div").attr("class",a).attr("data-value",(function(t){return"string"==typeof t?t||null:t[1]})).each((function(t){const n=Tt(this);if(!e.custom_renderer){const e=Array.isArray(t)?t[0]:t;return void n.text(e)}let r=e.custom_renderer(t,this);if(r){if(Array.isArray(r)||(r=[r]),r.find((t=>"string"!=typeof t&&!(t instanceof HTMLElement))))throw new Error("Autocomplete elements must be strings or HTMLElements");n.node().append(...r)}})),r.length||o.append("div").attr("class","dropdown-item disabled").text("No matches found")}function s(){i.classed("open",!1)}function l(e,r){if(r.hasAttribute("data-value")){var i=r.getAttribute("data-value");Tt(r).classed("current")&&"multi"===t.mode?t.deselect(i):t.select(i),s(),Tt(n).dispatch("change")}else e.preventDefault()}return i.on("mousedown",(function(t){l(t,t.target)})),Tt(n).on("keydown.autocomplete",(function(t){var e,r;9==t.keyCode||13==t.keyCode?(e=o.select(".selected")).empty()||(l(t,e.node()),n.blur()):40==t.keyCode?((e=o.select(".selected")).empty()||(r=e.node().nextSibling),r||(r=o.select(".dropdown-item[data-value]").node()),o.selectAll(".selected").classed("selected",!1),Tt(r).classed("selected",!0)):38==t.keyCode&&((e=o.select(".selected")).empty()||(r=e.node().previousSibling),r||(r=o.select(".dropdown-item:last-child").node()),o.selectAll(".selected").classed("selected",!1),Tt(r).classed("selected",!0))})).on("input.autocomplete",(function(){var r,i,o=n.value,a=o.toLowerCase(),s=!1,l=t.options;if(Tt(n).attr("data-value",o),i=e.match_anywhere?(t,e)=>t.includes(e):(t,e)=>0===t.indexOf(e),o){r=[];for(var c=0;c<l.length;c++){var f=("string"==typeof l[c]?l[c]:l[c][0]).toLowerCase();f==a&&(s=!0),i(f,a)&&r.push(l[c])}e.allow_other_option&&!s&&r.unshift(["Add new value: "+o,o])}else r=l;u(r)})).on("focus.autocomplete",(function(){var e=t.getValue();r=Array.isArray(e)?e:[e],u(t.options),i.classed("open",!0)})).on("blur.autocomplete",s),{renderOptions:u}};var Fu={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"}};ji.STRING_IDS[0];var Mu,Eu,Su,Lu=[{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"}],Uu={},Nu={},Ou=0;function Hu(t,e){Ou=0;var n=!1;t.template_id&&t.dataTables((function(r,i){if(r)return console.error("Failed to get data tables: "+r);Nu={};var o=t.dataBindingsForCurrentTemplate(),a=t.getDataTableNames(),u=Tt(".sheet-tab.selected").size()>0?Tt(".sheet-tab.selected").datum().id:null;Eu.html("");var s=null;"string"!=typeof e[0]&&(e=["Data"].concat(e));for(var l,c=[],f=0;f<e.length;f++){const t=e[f],n=e[f-1],r=!(!n||"string"==typeof n||n.dataset===t.dataset),i=(t.columns||t.column||"").split("::")[0],u="string"==typeof t;if((u||r)&&(void 0!==l&&c.push(l),l={title:u?t:i,description:null,bindings:[],template_sheet:null,visualisation_sheet:null}),u){if(f<e.length-1){var d=e[f+1];"string"==typeof d&&(l.description=d,f+=1)}}else{if(null===l.template_sheet&&i)for(var p in a)if(a[p]===i){l.template_sheet=+p;break}if(null===l.visualisation_sheet){var h=o[t.dataset]&&o[t.dataset][t.key];h&&(l.visualisation_sheet=h.data_table_id)}l.bindings.push(t),f===e.length-1&&c.push(l)}}for(f=0;f<c.length;f++){var m=c[f],g=m.bindings,v=m.visualisation_sheet||m.template_sheet||i[0].id,y=(s=Eu.append("div").attr("class","data-block").attr("data-sheet",a[v]).style("display",v===u?null:"none")).append("h2").attr("class","no-select");y.append("i").attr("class","fa fa-table"),y.append("span").text(" "+m.title),m.description&&s.append("p").text(m.description);var b=s.append("div").attr("class","data-bindings-header");b.append("p").attr("class","data-bindings-title").text("Select columns to visualise");for(var _=0;_<g.length;_++){var w=g[_];w.data_type&&(n=!0);var x=o[w.dataset]&&o[w.dataset][w.key],C=x?x.data_table_id:v;Nu[w.dataset]||(Nu[w.dataset]={}),Nu[w.dataset][w.key]=C,C!==v&&C===u&&s.style("display",null),ju(s.append("div"),w,x,a,C!==u)}n&&b.append("p").attr("class","data-bindings-reset clickable").html("<i class='fa fa-magic'></i> Auto set columns").on("click",(function(){Cu("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(){Mu.spreadsheet.inferDataBindings()}},{text:"Cancel",keyCode:27,class:"secondary"}]})}))}Mu.spreadsheet&&(Mu.spreadsheet.updateHighlights(),Mu.spreadsheet.updateTabs())}))}function ju(t,e,n,r,i){Lu[Ou]||(Ou=0),t.attr("class","settings-option option-type-"+e.type).style("display",i?"none":null);var o=null==n?"":nn(n,r,!1,e.optional);Uu[e.dataset]||(Uu[e.dataset]={}),Uu[e.dataset][e.key]=Ou;var a="column"===e.type&&!e.optional,u=a&&!n;t.classed("empty-required-binding",u);var s=t.append("div").attr("class","data-binding-title").on("click",(function(){Tt(this).select("input").node().focus()}));s.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||s.select("h3").append("span").attr("class","required").text("Required"),s.append("input").attr("id","data-binding-"+e.dataset+"-"+e.key).attr("name",e.dataset+"-"+e.key).attr("disabled",!Mu.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=o})).attr("data-value",o).attr("type","text").call(function(t){return function(e){e.on("change",(function(){Ye.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 o,a=t.getBoundingClientRect(),u=[a.left-5,a.top+.5*a.height];if(t.value||"column"!=i.type){try{o=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 o=t[t.type].substr(r+2);if("column"==t.type)n.column=Xe(o,t.optional);else{if("columns"!=t.type)throw new Error("Unknown data binding type: "+t.type);n.columns=tn(o)}return n}(i,Mu.visualisation.getDataTableIds());var s=nn(o,Mu.visualisation.getDataTableNames(),!1,e.optional);t.value.toUpperCase()!==s&&(t.value=s)}catch(e){return console.error("Failed to parse data binding",e),Ye.point(u).text(e.message).draw(),t.value=t.getAttribute("data-value"),void(Su=!0)}if(Tt(t.parentElement.parentElement).classed("empty-required-binding",!1),!o.data_table_id)return t.value=t.getAttribute("data-value"),Ye.point(u).text("No such data table").draw(),void(Su=!0);if(e.data_type){const n=Mu.spreadsheet.getTypeAnnotatedColumns();if("column"===i.type){const r=n[o.column];if(!r)return Ye.point(u).html(`<span class="popup-content-header">Column '${t.value}' does not exist</span><p>Choose a column from the data table</p>`).draw(),t.value=t.getAttribute("data-value"),void(Su=!0);if(Bu(e,r))return t.value=t.getAttribute("data-value"),Ye.point(u).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${Ru([r.type])} columns</span>\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;">${Ru(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(Su=!0)}else{const r=n.filter((t=>o.columns.includes(t.index))).filter((t=>Bu(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]),[]),c=l.reduce(((t,e,n,r)=>1===r.length?Ru([e]):(n<r.length-1?t+=`${n>0?",":""} ${Ru([e])}`:t+=`or ${Ru([e])}`,t)),"");return Ye.point(u).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${c} columns</span>\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;">${Ru(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(Su=!0)}}}}else if(o=null,!e.optional)return t.value=t.getAttribute("data-value"),Ye.point(u).text("This column selection is required").draw(),void(Su=!0);Mu.spreadsheet.updateTabs();var f={};f[e.dataset]={},f[e.dataset][e.key]=o,Yu(f,(function(){t.setAttribute("data-value",t.value);var e=Iu();e?(Tt(".publish-btn").classed("disabled",!0),Tt(".republish-btn").classed("disabled",!0),Dt(".download-btn").classed("disabled",!0),Tt("body").classed("impossible",!0)):(Tt(".publish-btn").classed("disabled",!1),Tt(".republish-btn").classed("disabled",!1),Dt(".download-btn").classed("disabled",!1),Tt("body").classed("impossible",!1),Mu.visualisation.getState((function(t){Mu.visualisation.prepareData((function(e,n){e?console.error("Failed to prepare data for template"):Mu.preview_pane.getDrawCalled()?Mu.preview_pane.sync({data:n,state:t,update:!0}):(Mu.preview_pane.sync({data:n,state:t,draw:!0}),Mu.preview_pane.setDrawCalled(!0))}))}))),Mu.spreadsheet&&Mu.spreadsheet.updateHighlights(),Mu.template_settings&&(e?Mu.template_settings.setReadOnly():Mu.template_settings.unsetReadOnly(),Mu.template_settings.populate()),Mu.theme_chooser.enableOrDisable()}))}(this,t)})).on("keydown",(function(){Mu.confirm.blank()})).on("focus",(function(){Su||Ye.hide(),Su=!1,Dt(".data-bindings .settings-option").classed("open",!1),Tt(this.parentElement.parentElement).classed("open",!0)}))}}(e)).style("background",Lu[Ou].light).style("border-color",Lu[Ou].full),u&&Mu.template_settings.setReadOnly(),a&&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").html(Fe.sanitize(e.description)),e.data_type){var f=c.append("div").attr("class","data-binding-data-types");f.append("p").text("Accepted column types");for(var d=Array.isArray(e.data_type)?e.data_type:[e.data_type],p=0;p<d.length;p++)l="string"==typeof d[p]?d[p]:d[p].type,f.append("span").attr("class","type-symbol data-binding-type-symbol").attr("title",Fu[l].text+" column.").style("background-image","url("+Fu[l].symbol+")")}Ou++}function Yu(t,e){Mu.confirm.saving(),Mu.visualisation.updateDataBindings(t,(function(t){if(t)return Mu.confirm.error(t),console.error("Failed to save data binding:",t),void Mu.analytics("event","exception",{description:t.message||t,fatal:!0});Mu.analytics("event","visualisation",{change_data_binding:Mu.visualisation.id}),Mu.confirm.saved(),$u(),e&&e()}))}function Bu(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 Ru(t){return t.map((t=>`\n\t\t<span class="column-type">\n\t\t<span class="type-symbol" title="${Fu[t].text} column" style="background-image: url(${Fu[t].symbol});"></span>\n\t\t<h2>${Fu[t].text}</h2>\n\t\t</span>\n\t\t`)).join("")}function Iu(){var t=Mu.visualisation.dataBindingsForCurrentTemplate(),e=Mu.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 $u(t=!0){if(Iu())Tt("body").classed("impossible",!0),Tt(".empty-label").html("<i class='fa fa-exclamation-triangle'></i> Oops! It looks like one of the required column selections is empty."),Tt(".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(Tt("body").classed("impossible")){const e=Mu.visualisation?Mu.visualisation:Mu.story;e.status&&e.status.requested_by?Mu.confirm_published.awaitingReview(e.status,e.can_review,Mu.user):Mu.visualisation.embed_url&&t?Mu.confirm_published.edited():(Mu.confirm_published.unpublished(),Tt("body").classed("impossible",!1),Tt(".empty-label").text(""),Tt(".empty-details").text(""))}}var zu,Pu,qu,Vu,Wu,Zu,Gu,Xu,Ju,Qu=!1;function Ku(t){if(Qu&&window.top!==window.self){var e=window;"srcdoc"===e.location.pathname&&(e=e.parent);var n=function(){var t={};return window._Flourish_template_id&&(t.template_id=window._Flourish_template_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_template_id&&(t.template_id=window.Flourish.app.loaded_template_id),window._Flourish_visualisation_id&&(t.visualisation_id=window._Flourish_visualisation_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_visualisation&&(t.visualisation_id=window.Flourish.app.loaded_visualisation.id),window.Flourish&&window.Flourish.app&&window.Flourish.app.story&&(t.story_id=window.Flourish.app.story.id,t.slide_count=window.Flourish.app.story.slides.length),window.Flourish&&window.Flourish.app&&window.Flourish.app.current_slide&&(t.slide_index=window.Flourish.app.current_slide.index+1),t}(),r={sender:"Flourish",method:"customerAnalytics"};for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);e.parent.postMessage(JSON.stringify(r),"*")}}function ts(t){if("function"!=typeof t)throw new Error("Analytics callback is not a function");window.Flourish._analytics_listeners.push(t)}function es(){Qu=!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(){Ku({action:t.action_name})}),t.use_capture)}))}function ns(){if(null==zu){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}();zu="referrer"in t?/^https:\/\/medium.com\//.test(t.referrer):!("auto"in t)}return zu}function rs(t){var e=t||window.innerWidth;return e>999?650:e>599?575:400}function is(t){if(t&&window.top!==window.self){var e=window;"srcdoc"==e.location.pathname&&(e=e.parent);var n={sender:"Flourish",method:"scrolly"};if(t)for(var r in t)n[r]=t[r];e.parent.postMessage(JSON.stringify(n),"*")}}function os(t,e){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),Pu)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 as(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function us(t){return"string"==typeof t||t instanceof String}function ss(t){return"warn"!==t.method?(console.warn("BUG: validateWarnMessage called for method"+t.method),!1):!(null!=t.message&&!us(t.message))&&!(null!=t.explanation&&!us(t.explanation))}function ls(t){return"resize"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!us(t.src)&&(!!us(t.context)&&!!("number"==typeof(e=t.height)?!isNaN(e)&&e>=0:us(e)&&/\d/.test(e)&&/^[0-9]*(\.[0-9]*)?(cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%)?$/i.test(e)));var e}function cs(t){throw new Error("Validation for setSetting is not implemented yet; see issue #4328")}function fs(t){return"scrolly"!==t.method?(console.warn("BUG: validateScrolly called for method"+t.method),!1):!!Array.isArray(t.slides)}function ds(t){return"customerAnalytics"===t.method||(console.warn("BUG: validateCustomerAnalyticsMessage called for method"+t.method),!1)}function ps(t){return"request-upload"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!us(t.name)&&!(null!=t.accept&&!us(t.accept))}function hs(t,e,n){var r=function(t){for(var e={warn:ss,resize:ls,setSetting:cs,customerAnalytics:ds,"request-upload":ps,scrolly:fs},n={},r=0;r<t.length;r++){var i=t[r];if(!e[i])throw new Error("No validator found for method "+i);n[i]=e[i]}return n}(e);window.addEventListener("message",(function(e){var i=function(){if(e.origin==document.location.origin)return!0;if(n){const t=e.origin.toLowerCase();if(n=n.toLowerCase(),t.endsWith("//"+n))return!0;if(t.endsWith("."+n))return!0}return!!e.origin.match(/\/\/localhost:\d+$|\/\/(?:public|app)\.flourish.devlocal$|\/\/flourish-api\.com$|\.flourish\.(?:local(:\d+)?|net|rocks|studio)$|\.uri\.sh$|\/\/flourish-user-templates\.com$/)}();if(null!=e.source&&i){var o;try{o="object"==typeof e.data?e.data:JSON.parse(e.data)}catch(t){return void console.warn("Unexpected non-JSON message: "+JSON.stringify(e.data))}if("Flourish"===o.sender)if(o.method)if(Object.prototype.hasOwnProperty.call(r,o.method))if(r[o.method](o)){for(var a=document.querySelectorAll("iframe"),u=0;u<a.length;u++)if(a[u].contentWindow==e.source||a[u].contentWindow==e.source.parent)return void t(o,a[u]);console.warn("could not find frame",o)}else console.warn("Validation failed for the message",o);else console.warn("No validator implemented for message",o);else console.warn("The 'method' property was missing from message",o)}})),as()&&(window.addEventListener("resize",ms),ms())}function ms(){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),o=n.offsetWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight);r.style.width=o+"px"}}}}function gs(t,e){var n=t.parentNode;if(n.classList.contains("fl-scrolly-wrapper"))console.warn("createScrolly is being called more than once per story. This should not happen.");else{n.classList.add("fl-scrolly-wrapper"),n.style.position="relative",n.style.paddingBottom="1px",n.style.transform="translate3d(0, 0, 0)",t.style.position="sticky";var r=n.getAttribute("data-height")||null;r||(r="80vh",t.style.height=r),t.style.top="calc(50vh - "+r+"/2)";var i=n.querySelector(".flourish-credit");i&&(i.style.position="sticky",i.style.top="calc(50vh + "+r+"/2)"),e.forEach((function(t,e){var r="string"==typeof t&&""!=t.trim(),i=document.createElement("div");i.setAttribute("data-slide",e),i.classList.add("fl-scrolly-caption"),i.style.position="relative",i.style.transform="translate3d(0,0,0)",i.style.textAlign="center",i.style.maxWidth="500px",i.style.height="auto",i.style.marginTop="0",i.style.marginBottom=r?"100vh":"50vh",i.style.marginLeft="auto",i.style.marginRight="auto";var o=document.createElement("div");o.innerHTML=t,o.style.visibility=r?"":"hidden",o.style.display="inline-block",o.style.paddingTop="1.25em",o.style.paddingRight="1.25em",o.style.paddingBottom="1.25em",o.style.paddingLeft="1.25em",o.style.background="rgba(255,255,255,0.9)",o.style.boxShadow="0px 0px 10px rgba(0,0,0,0.2)",o.style.borderRadius="10px",o.style.textAlign="center",o.style.maxWidth="100%",o.style.margin="0 20px",o.style.overflowX="hidden",i.appendChild(o),n.appendChild(i)})),function(t){for(var e=new IntersectionObserver((function(e){e.forEach((function(e){if(e.isIntersecting){var n=t.querySelector("iframe");n&&(n.src=n.src.replace(/#slide-.*/,"")+"#slide-"+e.target.getAttribute("data-slide"))}}))}),{rootMargin:"0px 0px -0% 0px"}),n=t.querySelectorAll(".fl-scrolly-caption"),r=0;r<n.length;r++)e.observe(n[r]);t.querySelectorAll(".fl-scrolly-caption img").forEach((function(t){t.style.maxWidth="100%"}))}(n)}}function vs(t,e,n,r,i){var o=document.createElement("iframe");if(o.setAttribute("scrolling","no"),o.setAttribute("frameborder","0"),o.setAttribute("title","Interactive or visual content"),o.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(o),o.offsetParent||"fixed"===getComputedStyle(o).position)ys(t,e,o,n,r,i);else{var a={embed_url:t,container:e,iframe:o,width:n,height:r,play_on_load:i};if(window._flourish_poll_items?window._flourish_poll_items.push(a):window._flourish_poll_items=[a],window._flourish_poll_items.length>1)return o;var u=setInterval((function(){window._flourish_poll_items=window._flourish_poll_items.filter((function(t){return!t.iframe.offsetParent||(ys(t.embed_url,t.container,t.iframe,t.width,t.height,t.play_on_load),!1)})),window._flourish_poll_items.length||clearInterval(u)}),500)}return o}function ys(t,e,n,r,i,o){var a;return r&&"number"==typeof r?(a=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]*$/)&&(a=parseFloat(r)),i&&"number"==typeof i&&(i+="px"),r?n.style.width=r:as()?n.style.width=e.offsetWidth+"px":n.style.width="100%",!!i||(t.match(/\?/)?t+="&auto=1":t+="?auto=1",i=rs(a||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+(o?"#play-on-load":"")),n}function bs(t,e,n){for(var r in e||(e=[]),n||(n={}),t)e.push(r),"object"==typeof t[r]&&bs(t[r],e,n),n[e.join(".")]=t[r],e.pop();return n}function _s(t){var e={};for(var n in t){for(var r=e,i=n.indexOf("."),o=0;i>=0;i=n.indexOf(".",o=i+1)){var a=n.substring(o,i);a in r||(r[a]={}),r=r[a]}r[n.substring(o)]=t[n]}return e}function ws(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]=ws(t[r]));return n}var xs,Cs=null;function Ts(){return"MessageChannel"in window}var As=null;function Ds(){As&&qu.removeEventListener("load",As),As=null}function ks(t){Ds(),qu.addEventListener("load",t),As=t}function Fs(t,e,n){return Zs(!1),Ju=t?t.visualisation?t.visualisation:t.current_slide.visualisation:null,Cs=null,Ju&&Ju.template_id?(ks(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(){Ft(),!Ju||Ju.template_id!=r||t.current_slide&&t.current_slide.id!==i||(Ds(),Hs((function(o,a){o?console.error("Failed to get default state"):!Ju||Ju.template_id!=r||t.current_slide&&t.current_slide.id!==i||js((function(o,u){if(o)console.error("Failed to call hasData");else if(Ju&&Ju.template_id==r&&(!t.current_slide||t.current_slide.id===i)){var s=!1;t.visualisation&&(s=t.data_bindings.requiredBindingsAreUnset()),u?Ju.refreshDataBindings((function(o){o?console.error("Failed to refresh data bindings"):!Ju||Ju.template_id!=r||t.current_slide&&t.current_slide.id!==i||Ju.prepareData((function(o,u){o?console.error("Failed to prepare data for template"):!Ju||Ju.template_id!=r||t.current_slide&&t.current_slide.id!==i||Vs({data:u,state:e,draw:!s},(function(t,e){Cs=a,n(t,e)}))}))})):Vs({state:e,draw:!s},(function(t,e){Cs=a,n(t,e)}))}}))})))}}(t,e,n)),qu.src="/template/"+Ju.template_id+"/embed/?auto=1&environment="+Vu+"&is_read_only="+(t.is_read_only?"1":"0"),qu):(Ds(),qu.src="about:blank",qu)}function Ms(t){Hs((function(e,n){e?console.error("Failed to get default state"):(Cs=n,t())}))}function Es(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(Ju&&Ju.template_id==n)return t?(console.error("Failed to prepare data for template"),void e(t)):void e(void 0,r)}))}))}function Ss(t,e){Es(t,(function(t,n){if(t)return e(t);Vs({data:n,update:!0},e)}))}function Ls(t,e){Es(t,(function(t,n){if(t)return e(t);Vs({data:n,update:!1},e)}))}function Us(t,e,n){Es(t,(function(t,r){if(t)return n(t);Vs({data:r,state:e,overwrite_state:!0,update:!0},n)}))}function Ns(t,e,n,r=qu){if(Ts()){var i=new MessageChannel;i.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)},r.contentWindow.postMessage({sender:"Flourish",method:t,argument:e},"*",[i.port2])}}function Os(t,e){Ns("setState",_s(t),e)}function Hs(t,e){"function"!=typeof t?Ns("getState",t,e):Ns("getState",void 0,t)}function js(t){Ns("hasData",void 0,t)}function Ys(t,e){Ns("setData",t,e)}function Bs(t){Ns("getData",void 0,t)}function Rs(t){Ns("draw",void 0,t),Zs(!0)}function Is(t){Gu&&Gu.clear(),Ws()&&Ns("update",void 0,t)}function $s(t,e,n){Ns("snapshot",t,e,n)}function zs(){return ws(Cs)}function Ps(t,e){Ns("setFixedHeight",t,e)}function qs(t){if(qu.parentNode.offsetWidth){if(void 0!==t)xs=null!=t;else if(xs)return;var e=t||Zu&&Zu.responsive_menu&&Zu.responsive_menu.getHeightSetting()||Wu.getHeightForBreakpoint(qu.offsetWidth),n=typeof e;("number"===n||"string"===n&&!isNaN(e))&&(e+="px"),qu.style.height=e}}function Vs(t,e,n=qu){Ws()?delete t.draw:t.draw&&Zs(!0),t.state&&(t.state=_s(t.state)),Gu&&Gu.clear(),Ns("sync",t,(function(n,r){null!=n||"success"!==r?(t.draw&&Zs(!1),function n(r){r?e&&e(r):function(t,e){return t.data?(Ys(t.data,e),delete t.data,!1):t.state?(Os(t.state,e),delete t.state,!1):t.draw?(Rs(e),delete t.draw,!1):!t.update||(Is(e),delete t.update,!1)}(t,n)&&e&&e(void 0)}(n)):e&&e(void 0)}),n)}function Ws(){return Xu}function Zs(t){Xu=t}function Gs(t,e,n,r,i){return qu=document.querySelector(t),Vu=e,Zu=n,Gu=r,i||(i={}),Pu="#amp=1"==window.location.hash,Wu={createEmbedIframe:vs,isFixedHeight:ns,getHeightForBreakpoint:rs,startEventListeners:hs,notifyParentWindow:os,initScrolly:is,createScrolly:gs,isSafari:as,initCustomerAnalytics:es,addAnalyticsListener:ts,sendCustomerAnalyticsMessage:Ku},qu.style.height=Wu.getHeightForBreakpoint(qu.offsetWidth)+"px",Wu.startEventListeners((function(t){"resize"==t.method?qs(t.height):"warn"==t.method?(Gu&&Gu.warn(t),console.warn("Warning from template:",t.message,t.explanation)):t.method in i&&i[t.method](t)}),["resize","warn","customerAnalytics","setSetting","request-upload"]),Ts()||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)}}(qu.parentNode),{loadVisualisation:Fs,updateData:Ss,updateDataAndState:Us,updateDataNotPreview:Ls,setState:Os,getState:Hs,getDefaultState:zs,hasData:js,setData:Ys,getData:Bs,draw:Rs,update:Is,snapshot:$s,setFixedHeight:Ps,resize:qs,sync:Vs,getDrawCalled:Ws,setDrawCalled:Zs,setFrameLoadListener:ks,updateDefaultState:Ms}}var Xs=function(t=document.body){t.classList.add("loading")},Js=function(t=document.body){t.classList.remove("loading")};const Qs=new Set([1,274,282,283,296,34675,40961,42240]);function Ks(t){let e=0;function n(n){if(e>=t.byteLength)return null;void 0===n&&(n=1);const r=new DataView(t,e,n);return e+=n,r}const r=new Uint8Array(t.byteLength+2);let i=0;function o(t){r.set(new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)),i),i+=t.byteLength}const a=(new TextEncoder).encode("Exif\0\0");function*u(t){if(t<32)return;if(!function(t,e){if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.byteLength;n++)if(t.getInt8(n)!==e.getInt8(n))return!1;return!0}(n(6),new DataView(a.buffer)))return void n(t-8);const e=[],r=n(t-8),i=r.getUint16(0);let o;if(18761===i)o=!0;else{if(19789!==i)return;o=!1}function u(t){return r.getUint16(t,o)}function s(t){return r.getUint32(t,o)}if(42!==u(2))return;let l=s(4);for(;0!=l;){const t=u(l);l+=2;for(let n=0;n<t;n++){const t=u(l),n=u(l+2),i=s(l+4),a=s(l+8);if(l+=12,!Qs.has(t))continue;if(n<1||n>12)continue;let c;switch(n){case 1:case 2:case 6:case 7:c=1;break;case 3:case 8:c=2;break;case 4:case 9:case 11:c=4;break;case 5:case 10:case 12:c=8}const f=c*i;let d;if(f<=4)d=new DataView(new ArrayBuffer(4),0,4),d.setUint32(0,a,o);else{d=new DataView(new ArrayBuffer(f));for(let t=0;t<f;t++)d.setInt8(t,r.getInt8(a+t))}e.push({code:t,type:n,num_values:i,data:d})}l=s(l)}let c=10;for(const{data:t}of e)c+=12,t.byteLength>4&&(c+=t.byteLength);c+=4;const f=new Uint8Array(c),d=new DataView(f.buffer);f.set((new TextEncoder).encode("MM\0*\0\0\0\b"),0),d.setUint16(8,e.length);let p=10,h=10+12*e.length+4;for(const{code:t,type:n,num_values:r,data:i}of e){if(d.setUint16(p,t),d.setUint16(p+2,n),d.setUint32(p+4,r),i.byteLength<=4)for(let t=0;t<i.byteLength;t++)d.setInt8(p+8+t,i.getInt8(t));else{d.setUint32(p+8,h);for(let t=0;t<i.byteLength;t++)d.setInt8(h+t,i.getInt8(t));h+=i.byteLength}p+=12}const m=new Uint8Array(10),g=new DataView(m.buffer);g.setUint8(0,255),g.setUint8(1,225),g.setUint16(2,d.byteLength+8),m.set(a,4),yield m,yield d}const s=n(2);if(65496!==s.getUint16(0))throw new Error("Not a valid JPEG");for(o(s);;){const t=n(2),e=t.getUint16(0);if(65498===e){o(t);break}const r=n(2),i=r.getUint16(0);if(65505!==e)o(t),o(r),o(n(i-2));else for(const t of u(i))o(t)}const l=new Uint8Array([255,217]);let c,f=!1,d=!1;for(;null!=(c=n());){if(f&&217===c.getUint8(0)){d=!0,o(new DataView(new Uint8Array([217]).buffer));break}const t=new Uint8Array(c.buffer).indexOf(l);if(!(t<0)){o(c.slice(0,t+2)),d=!0;break}o(c),f=c.byteLength>0&&255===c.getUint8(c.byteLength-1)}return d||o(l),r}function tl(t){let e=0;function n(n){if(e+n>t.byteLength)return null;const r=new DataView(t,e,n);return e+=n,r}const r=new Uint8Array(t.byteLength);let i=0;function o(t){r.set(new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)),i),i+=t.byteLength}const a=n(8);if(80!==a.getUint8(1)||78!==a.getUint8(2)||71!==a.getUint8(3))throw new Error("Not a valid PNG");let u,s;for(o(a);null!=(u=n(4))&&null!=(s=n(4));){const t=u.getUint32(0),e=s.getUint8(0),r=s.getUint8(1);101===e||105===e&&84===r?(n(t),n(4)):(o(u),o(s),o(n(t)),o(n(4)))}return r}var el="/api/file/upload";function nl(t){(t||document).querySelectorAll("input[type=url]").forEach((function(t){rl(t)}))}function rl(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=il)}function il(){var t=this.previousSibling,e=t.getAttribute("accept");t.disabled=!0,t.classList.toggle("uploading",!0),ol({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 ol(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=async function(){Xs(),await async function(t,e,n){const r=await async function(t){try{if("image/png"===t.type)return new File([tl(await t.arrayBuffer())],t.name,{type:t.type});if("image/jpeg"===t.type)return new File([Ks(await t.arrayBuffer())],t.name,{type:t.type})}catch(t){console.error(t)}return t}(t[0]);!function(t,e){var n={filename:t.name,content_type:t.type,size:t.size};al(el,n,(function(t,n){return t?e(t):e(null,JSON.parse(n.responseText))}))}(r,(function(t,i){if(t)return Js(),Cu("Upload error","There was a problem uploading your file: "+t.message),void console.error(t);var o=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:r},i.fields);al(i.upload_url,o,(function(t,r){Js(),t?(Cu("Upload error","There was a problem uploading your file ("+r.status+")."),console.error(t),n&&n()):e(i.file_url)}))}))}(e.files,t.success,t.failure),e.parentNode.removeChild(e)},e.click()}function al(t,e,n){var r=new XMLHttpRequest,i=new FormData;if("object"==typeof e){for(var o in e)e.hasOwnProperty(o)&&"file"!==o&&i.append(o,e[o]);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 ul="https://fonts.googleapis.com/css?family=",sl=["Source Sans Pro","Roboto Condensed","Merriweather","Lora","Playfair Display","Coda","Lobster","Cabin Sketch"],ll="Same as parent",cl=[],fl=[],dl={};function pl(t){return ul+t.replace(/ /g,"+")+":400,700"}function hl(t){var e=fl.concat(cl,sl.map((function(t){return{name:t,url:pl(t)}})));return t&&e.unshift({name:ll}),e}function ml(t){return hl(!0).find((function(e){return e.name==t}))}var gl=!1;function vl(t){return t.substr(t.lastIndexOf("=")+1).replace(/\+/g," ")}function yl(t){var e=t.target,n=e.value;if(n&&(0==n.indexOf(ul)&&(n=e.value=vl(n)),!ml(n))){if(/^https?:\/\//.test(n)){gl||(bl(n),e.value="");var r=n;return n=e.value=vl(r),fl.push({name:n,url:r}),void _l()}var i=pl(n);try{var o=new XMLHttpRequest;if(o.open("HEAD",i,!1),o.send(),404==o.status)throw"Font not found";fl.push({name:n,url:i}),_l()}catch(t){bl(n),e.value=""}}}function bl(t){Cu("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 _l(){var t,e,n=Object.keys(dl);for(t=0;t<n.length;++t)(e=dl[n[t]]).dropdown.setOptions(hl(e.can_inherit).map((function(t){return t.name})))}var wl={initialize:function(t,e,n){var r=!!e.optional;gl=n,t.classList.add("font-menu");var i=new Au({input:t,id:e.property+"-dropdown",options:hl(r).map((t=>t.name)),mode:"single",options_config:{allow_other_option:!0}});t._dropdown=i,dl[e.property]={dropdown:i,can_inherit:r},t.addEventListener("change",yl)},update:function(t,e){var n=e?e.name:ll;t._dropdown.setSelectedOptions(n),ml(n)||(n!=ll&&fl.push({name:n,url:e.url}),_l())},getValue:function(t){if(/^https?:\/\//.test(t.value))return{name:vl(t.value),url:t.value};var e=t.value;if(e==ll)return null;var n=ml(e);return n||{name:e,url:pl(e)}},replaceThemeFonts:function(t){cl=(t||[]).map((function(t){return{name:t.name,url:t.url}})),_l()}},xl="$";function Cl(){}function Tl(t,e){var n=new Cl;if(t instanceof Cl)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var a in t)n.set(a,t[a]);return n}function Al(){}Cl.prototype=Tl.prototype={constructor:Cl,has:function(t){return xl+t in this},get:function(t){return this[xl+t]},set:function(t,e){return this[xl+t]=e,this},remove:function(t){var e=xl+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===xl&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===xl&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===xl&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===xl&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===xl&&++t;return t},empty:function(){for(var t in this)if(t[0]===xl)return!1;return!0},each:function(t){for(var e in this)e[0]===xl&&t(this[e],e.slice(1),this)}};var Dl=Tl.prototype;Al.prototype={constructor:Al,has:Dl.has,add:function(t){return this[xl+(t+="")]=t,this},remove:Dl.remove,clear:Dl.clear,values:Dl.keys,size:Dl.size,empty:Dl.empty,each:Dl.each};var kl={value:function(){}};function Fl(){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 Ml(r)}function Ml(t){this._=t}function El(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 Sl(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Ll(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=kl,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function Ul(t,e,n,r,i){for(var o 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[o]=r[o];if(i)for(var o in i)t[o]=i[o]}Ml.prototype=Fl.prototype={constructor:Ml,on:function(t,e){var n,r=this._,i=El(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=Ll(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Ll(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=Sl(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Ml(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var Nl={};function Ol(t){t.running||(t.running=!0,Hl(t,(function(){t.running=!1})))}function Hl(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",o=t.url,a=t.payload,u=t.callback;!a&&jl(n)&&(a=function(){return{}});if(a){if("function"!=typeof a)throw new Error("Internal error: processRequestThen: payload must be a function, not "+typeof a,a);"object"==typeof(a=a())&&jl(n)&&(window.Flourish&&window.Flourish.csrf_token||console.trace("window.Flourish.csrf_token missing"),a.csrf_token=window.Flourish.csrf_token),"string"!=typeof a&&(a=JSON.stringify(a))}var s=function(t,e){var n,r,i,o,a=Fl("beforesend","progress","load","error"),u=Tl(),s=new XMLHttpRequest,l=null,c=null,f=0;function d(t){var e,r=s.status;if(!r&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(s)||r>=200&&r<300||304===r){if(i)try{e=i.call(n,s)}catch(t){return void a.call("error",n,t)}else e=s;a.call("load",n,e)}else a.call("error",n,t)}if("undefined"!=typeof XDomainRequest&&!("withCredentials"in s)&&/^(http(s)?:)?\/\//.test(t)&&(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=s.ontimeout=d:s.onreadystatechange=function(t){s.readyState>3&&d(t)},s.onprogress=function(t){a.call("progress",n,t)},n={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?u.get(t):(null==e?u.remove(t):u.set(t,e+""),n)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",n):r},responseType:function(t){return arguments.length?(o=t,n):o},timeout:function(t){return arguments.length?(f=+t,n):f},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,d){return s.open(e,t,!0,l,c),null==r||u.has("accept")||u.set("accept",r+",*/*"),s.setRequestHeader&&u.each((function(t,e){s.setRequestHeader(e,t)})),null!=r&&s.overrideMimeType&&s.overrideMimeType(r),null!=o&&(s.responseType=o),f>0&&(s.timeout=f),null==d&&"function"==typeof i&&(d=i,i=null),null!=d&&1===d.length&&(d=function(t){return function(e,n){t(null==e?n:null)}}(d)),null!=d&&n.on("error",d).on("load",(function(t){d(null,t)})),a.call("beforesend",n,s),s.send(null==i?null:i),n},abort:function(){return s.abort(),n},on:function(){var t=a.on.apply(a,arguments);return t===a?n:t}},null!=e){if("function"!=typeof e)throw new Error("invalid callback: "+e);return n.get(e)}return n}(o);r&&"GET"!==n&&s.header("Content-Type",r);i&&s.mimeType(i);return s.on("error",(function(t){var n;try{n=JSON.parse(t.target.responseText),u(n.error)}catch(e){u("Internal error: "+t.target.responseText)}e()})),s.on("load",(function(t){var n=t.responseText;"application/json"===i&&(n=JSON.parse(n));try{u(void 0,n)}catch(t){console.error(t.stack)}e()})),s.send(n,a),s}(t.items.shift(),(function(){t.request=null,0==t.items.length?e():Hl(t,e)}))}function jl(t){return["POST","PUT","DELETE"].includes(t)}function Yl(t,e){void 0===e&&(e="default"),e in Nl||(Nl[e]={items:[],running:!1,name:e}),Nl[e].items.push(t),Ol(Nl[e])}function Bl(t,e){for(var n in e)t[n]=e[n];return t}function Rl(t,e,n,r){"function"==typeof n&&(r=n,n=!1),n&&Bl(t,e),Yl({url:t.api_prefix+"/"+t.id,payload:function(){return{version_number:t.getVersionNumber(),fields:e}},callback:function(i,o){if(i)return r(i);n||Bl(t,e),t.setVersionNumber(o.version_number),r(void 0)}})}function Il(t,e){t.delete_requested=!0,Yl({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)}})}function $l(t){Yl({url:"/api/history",method:"POST",payload:function(){return t},callback:function(){}})}var zl={addApiKey:function(t){Yl({url:"/api/user/api_keys",method:"PUT",callback:t})},addFolder:function(t,e,n,r){Yl({url:`/api/user/folder/${encodeURIComponent(t)}`,method:"PUT",payload:()=>({share:e,parent_id:n}),callback:r})},addTag:function(t,e){Yl({url:"/api/user/tag/"+encodeURIComponent(t),method:"PUT",callback:e})},deleteApiKey:function(t,e){Yl({url:"/api/user/api_keys/"+t,method:"DELETE",callback:e})},fetchFolders:function(t){Yl({url:"/api/user/folder",method:"GET",callback:t})},fetchProjects:function(t,e,n,r,i,o,a,u){let s="/api/user/projects";const l=[];n&&l.push("filter="+encodeURIComponent(n)),r&&l.push("offset="+encodeURIComponent(r)),i&&l.push("limit="+encodeURIComponent(i)),o&&l.push("search="+encodeURIComponent(o)),a&&l.push("is_recent=true"),u&&l.push("shared=true"),e&&(s+="/folder/"+encodeURIComponent(e)),l.length&&(s+="?"+l.join("&")),Yl({url:s,method:"GET",callback:t})},generateSdkToken:function(t){Yl({url:"/api/user/generate_sdk_token",method:"GET",callback:t})},getApiKeys:function(t){Yl({url:"/api/user/api_keys",method:"GET",callback:t})},getReviewCount:function(t){Yl({url:"/api/reviews/count",method:"GET",callback:t})},isUsernameAvailable:function(t,e){Yl({url:"/api/user/username?u="+encodeURIComponent(t),method:"GET",callback:e})},logHistory:$l,removeFolder:function(t,e){Yl({url:"/api/user/folder/"+encodeURIComponent(t)+"?use_id=1",method:"DELETE",callback:e})},removeTag:function(t,e){Yl({url:"/api/user/tag/"+encodeURIComponent(t),method:"DELETE",callback:e})},renameFolder:function(t,e,n){Yl({url:"/api/user/folder/"+encodeURIComponent(t)+"/"+encodeURIComponent(e)+"?use_id=1",method:"PUT",callback:n})},renameTag:function(t,e,n){Yl({url:"/api/user/tag/"+encodeURIComponent(t)+"/"+encodeURIComponent(e),method:"PUT",callback:n})},revokeSdkToken:function(t,e){Yl({url:"/api/user/sdk_token/"+encodeURIComponent(t),method:"DELETE",callback:e})},setSamlProviderId:function(t,e,n){Yl({url:"/api/user/"+encodeURIComponent(t)+"/change_saml_provider_id",method:"POST",payload:function(){return{saml_provider_id:e}},callback:n})},moveFolder:function(t,e=!0,n){return new Promise(((r,i)=>{Yl({url:`/api/folder/${t}/nest`,method:"PUT",payload:()=>({share:e,parent_id:n}),callback:(t,o)=>{if(t)return i(t);$l({category:"folders",action:"nest",detail:{share:e,parent_id:n}}),r(o)}})}))},update:function(t,e){Yl({url:"/api/user",method:"POST",payload:function(){return{fields:t}},callback:e})}};var Pl={};function ql(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Vl(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Wl(){}var Zl=.7,Gl=1/Zl,Xl="\\s*([+-]?\\d+)\\s*",Jl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ql="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kl=/^#([0-9a-f]{3,8})$/,tc=new RegExp(`^rgb\\(${Xl},${Xl},${Xl}\\)$`),ec=new RegExp(`^rgb\\(${Ql},${Ql},${Ql}\\)$`),nc=new RegExp(`^rgba\\(${Xl},${Xl},${Xl},${Jl}\\)$`),rc=new RegExp(`^rgba\\(${Ql},${Ql},${Ql},${Jl}\\)$`),ic=new RegExp(`^hsl\\(${Jl},${Ql},${Ql}\\)$`),oc=new RegExp(`^hsla\\(${Jl},${Ql},${Ql},${Jl}\\)$`),ac={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 uc(){return this.rgb().formatHex()}function sc(){return this.rgb().formatRgb()}function lc(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Kl.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?cc(e):3===n?new hc(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?fc(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?fc(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=tc.exec(t))?new hc(e[1],e[2],e[3],1):(e=ec.exec(t))?new hc(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=nc.exec(t))?fc(e[1],e[2],e[3],e[4]):(e=rc.exec(t))?fc(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ic.exec(t))?_c(e[1],e[2]/100,e[3]/100,1):(e=oc.exec(t))?_c(e[1],e[2]/100,e[3]/100,e[4]):ac.hasOwnProperty(t)?cc(ac[t]):"transparent"===t?new hc(NaN,NaN,NaN,0):null}function cc(t){return new hc(t>>16&255,t>>8&255,255&t,1)}function fc(t,e,n,r){return r<=0&&(t=e=n=NaN),new hc(t,e,n,r)}function dc(t){return t instanceof Wl||(t=lc(t)),t?new hc((t=t.rgb()).r,t.g,t.b,t.opacity):new hc}function pc(t,e,n,r){return 1===arguments.length?dc(t):new hc(t,e,n,null==r?1:r)}function hc(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function mc(){return`#${bc(this.r)}${bc(this.g)}${bc(this.b)}`}function gc(){const t=vc(this.opacity);return`${1===t?"rgb(":"rgba("}${yc(this.r)}, ${yc(this.g)}, ${yc(this.b)}${1===t?")":`, ${t})`}`}function vc(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function yc(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function bc(t){return((t=yc(t))<16?"0":"")+t.toString(16)}function _c(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new xc(t,e,n,r)}function wc(t){if(t instanceof xc)return new xc(t.h,t.s,t.l,t.opacity);if(t instanceof Wl||(t=lc(t)),!t)return new xc;if(t instanceof xc)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=e===o?(n-r)/u+6*(n<r):n===o?(r-e)/u+2:(e-n)/u+4,u/=s<.5?o+i:2-o-i,a*=60):u=s>0&&s<1?0:a,new xc(a,u,s,t.opacity)}function xc(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Cc(t){return(t=(t||0)%360)<0?t+360:t}function Tc(t){return Math.max(0,Math.min(1,t||0))}function Ac(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 Dc(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}ql(Wl,lc,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:uc,formatHex:uc,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return wc(this).formatHsl()},formatRgb:sc,toString:sc}),ql(hc,pc,Vl(Wl,{brighter(t){return t=null==t?Gl:Math.pow(Gl,t),new hc(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Zl:Math.pow(Zl,t),new hc(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new hc(yc(this.r),yc(this.g),yc(this.b),vc(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mc,formatHex:mc,formatHex8:function(){return`#${bc(this.r)}${bc(this.g)}${bc(this.b)}${bc(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:gc,toString:gc})),ql(xc,(function(t,e,n,r){return 1===arguments.length?wc(t):new xc(t,e,n,null==r?1:r)}),Vl(Wl,{brighter(t){return t=null==t?Gl:Math.pow(Gl,t),new xc(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Zl:Math.pow(Zl,t),new xc(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new hc(Ac(t>=240?t-240:t+120,i,r),Ac(t,i,r),Ac(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new xc(Cc(this.h),Tc(this.s),Tc(this.l),vc(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=vc(this.opacity);return`${1===t?"hsl(":"hsla("}${Cc(this.h)}, ${100*Tc(this.s)}%, ${100*Tc(this.l)}%${1===t?")":`, ${t})`}`}}));var kc=Dc("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Fc=Dc("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Mc=Dc("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Ec=Dc("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Sc=t=>()=>t;function Lc(t){return 1==(t=+t)?Uc: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):Sc(isNaN(e)?n:e)}}function Uc(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Sc(isNaN(t)?e:t)}var Nc=function t(e){var n=Lc(e);function r(t,e){var r=n((t=pc(t)).r,(e=pc(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Uc(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Oc(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Hc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jc=new RegExp(Hc.source,"g");function Yc(t,e){var n,r,i,o=Hc.lastIndex=jc.lastIndex=0,a=-1,u=[],s=[];for(t+="",e+="";(n=Hc.exec(t))&&(r=jc.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Oc(n,r)})),o=jc.lastIndex;return o<e.length&&(i=e.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?s[0]?function(t){return function(e){return t(e)+""}}(s[0].x):function(t){return function(){return t}}(e):(e=s.length,function(t){for(var n,r=0;r<e;++r)u[(n=s[r]).i]=n.x(t);return u.join("")})}var Bc,Rc=180/Math.PI,Ic={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $c(t,e,n,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(s=t*n+e*r)&&(n-=t*s,r-=e*s),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,s/=u),t*r<e*n&&(t=-t,e=-e,s=-s,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Rc,skewX:Math.atan(s)*Rc,scaleX:a,scaleY:u}}function zc(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],s=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var s=a.push("translate(",null,e,null,n);u.push({i:s-4,x:Oc(t,i)},{i:s-2,x:Oc(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,u,s),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Oc(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,u,s),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Oc(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,u,s),function(t,e,n,r,o,a){if(t!==n||e!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Oc(t,n)},{i:u-2,x:Oc(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var e,n=-1,r=s.length;++n<r;)u[(e=s[n]).i]=e.x(t);return u.join("")}}}var Pc,qc,Vc=zc((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Ic:$c(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Wc=zc((function(t){return null==t?Ic:(Bc||(Bc=document.createElementNS("http://www.w3.org/2000/svg","g")),Bc.setAttribute("transform",t),(t=Bc.transform.baseVal.consolidate())?$c((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Ic)}),", ",")",")"),Zc=0,Gc=0,Xc=0,Jc=0,Qc=0,Kc=0,tf="object"==typeof performance&&performance.now?performance:Date,ef="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function nf(){return Qc||(ef(rf),Qc=tf.now()+Kc)}function rf(){Qc=0}function of(){this._call=this._time=this._next=null}function af(t,e,n){var r=new of;return r.restart(t,e,n),r}function uf(){Qc=(Jc=tf.now())+Kc,Zc=Gc=0;try{!function(){nf(),++Zc;for(var t,e=Pc;e;)(t=Qc-e._time)>=0&&e._call.call(null,t),e=e._next;--Zc}()}finally{Zc=0,function(){var t,e,n=Pc,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:Pc=e);qc=t,lf(r)}(),Qc=0}}function sf(){var t=tf.now(),e=t-Jc;e>1e3&&(Kc-=e,Jc=t)}function lf(t){Zc||(Gc&&(Gc=clearTimeout(Gc)),t-Qc>24?(t<1/0&&(Gc=setTimeout(uf,t-tf.now()-Kc)),Xc&&(Xc=clearInterval(Xc))):(Xc||(Jc=tf.now(),Xc=setInterval(sf,1e3)),Zc=1,ef(uf)))}function cf(t,e,n){var r=new of;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}of.prototype=af.prototype={constructor:of,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?nf():+n)+(null==e?0:+e),this._next||qc===this||(qc?qc._next=this:Pc=this,qc=this),this._call=t,this._time=n,lf()},stop:function(){this._call&&(this._call=null,this._time=1/0,lf())}};var ff=Fl("start","end","cancel","interrupt"),df=[];function pf(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var l,c,f,d;if(1!==n.state)return s();for(l in i)if((d=i[l]).name===n.name){if(3===d.state)return cf(a);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[l]):+l<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[l])}if(cf((function(){3===n.state&&(n.state=4,n.timer.restart(u,n.delay,n.time),u(o))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(f=n.tween.length),l=0,c=-1;l<f;++l)(d=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=d);r.length=c+1}}function u(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(s),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),s())}function s(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=af(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:ff,tween:df,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function hf(t,e){var n=gf(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function mf(t,e){var n=gf(t,e);if(n.state>3)throw new Error("too late; already running");return n}function gf(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function vf(t,e){var n,r;return function(){var i=mf(this,t),o=i.tween;if(o!==n)for(var a=0,u=(r=n=o).length;a<u;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function yf(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=mf(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:e,value:n},s=0,l=i.length;s<l;++s)if(i[s].name===e){i[s]=u;break}s===l&&i.push(u)}o.tween=i}}function bf(t,e,n){var r=t._id;return t.each((function(){var t=mf(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return gf(t,r).value[e]}}function _f(t,e){var n;return("number"==typeof e?Oc:e instanceof lc?Nc:(n=lc(e))?(e=n,Nc):Yc)(t,e)}function wf(t){return function(){this.removeAttribute(t)}}function xf(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Cf(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function Tf(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function Af(t,e,n){var r,i,o;return function(){var a,u,s=n(this);if(null!=s)return(a=this.getAttribute(t))===(u=s+"")?null:a===r&&u===i?o:(i=u,o=e(r=a,s));this.removeAttribute(t)}}function Df(t,e,n){var r,i,o;return function(){var a,u,s=n(this);if(null!=s)return(a=this.getAttributeNS(t.space,t.local))===(u=s+"")?null:a===r&&u===i?o:(i=u,o=e(r=a,s));this.removeAttributeNS(t.space,t.local)}}function kf(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Ff(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Mf(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Ff(t,i)),n}return i._value=e,i}function Ef(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&kf(t,i)),n}return i._value=e,i}function Sf(t,e){return function(){hf(this,t).delay=+e.apply(this,arguments)}}function Lf(t,e){return e=+e,function(){hf(this,t).delay=e}}function Uf(t,e){return function(){mf(this,t).duration=+e.apply(this,arguments)}}function Nf(t,e){return e=+e,function(){mf(this,t).duration=e}}function Of(t,e){if("function"!=typeof e)throw new Error;return function(){mf(this,t).ease=e}}function Hf(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?hf:mf;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(e,n),a.on=i}}var jf=Ct.prototype.constructor;function Yf(t){return function(){this.style.removeProperty(t)}}function Bf(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Rf(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&Bf(t,o,n)),r}return o._value=e,o}function If(t){return function(e){this.textContent=t.call(this,e)}}function $f(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&If(r)),e}return r._value=t,r}var zf=0;function Pf(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function qf(){return++zf}var Vf=Ct.prototype;Pf.prototype={constructor:Pf,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=p(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var u,s,l=r[a],c=l.length,f=o[a]=new Array(c),d=0;d<c;++d)(u=l[d])&&(s=t.call(u,u.__data__,d,l))&&("__data__"in u&&(s.__data__=u.__data__),f[d]=s,pf(f[d],e,n,d,f,gf(u,n)));return new Pf(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=g(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var s,l=r[u],c=l.length,f=0;f<c;++f)if(s=l[f]){for(var d,p=t.call(s,s.__data__,f,l),h=gf(s,n),m=0,v=p.length;m<v;++m)(d=p[m])&&pf(d,e,n,m,p,h);o.push(p),a.push(s)}return new Pf(o,a,e,n)},selectChild:Vf.selectChild,selectChildren:Vf.selectChildren,filter:function(t){"function"!=typeof t&&(t=v(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,s=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&s.push(o);return new Pf(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var s,l=e[u],c=n[u],f=l.length,d=a[u]=new Array(f),p=0;p<f;++p)(s=l[p]||c[p])&&(d[p]=s);for(;u<r;++u)a[u]=e[u];return new Pf(a,this._parents,this._name,this._id)},selection:function(){return new jf(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=qf(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],s=u.length,l=0;l<s;++l)if(a=u[l]){var c=gf(a,e);pf(a,t,n,l,u,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Pf(r,this._parents,t,n)},call:Vf.call,nodes:Vf.nodes,node:Vf.node,size:Vf.size,empty:Vf.empty,each:Vf.each,on:function(t,e){var n=this._id;return arguments.length<2?gf(this.node(),n).on.on(t):this.each(Hf(n,t,e))},attr:function(t,e){var n=s(t),r="transform"===n?Wc:_f;return this.attrTween(t,"function"==typeof e?(n.local?Df:Af)(n,r,bf(this,"attr."+t,e)):null==e?(n.local?xf:wf)(n):(n.local?Tf:Cf)(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=s(t);return this.tween(n,(r.local?Mf:Ef)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Vc:_f;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=R(this,t),a=(this.style.removeProperty(t),R(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,Yf(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=R(this,t),u=n(this),s=u+"";return null==u&&(this.style.removeProperty(t),s=u=R(this,t)),a===s?null:a===r&&s===i?o:(i=s,o=e(r=a,u))}}(t,r,bf(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,u="end."+a;return function(){var s=mf(this,t),l=s.on,c=null==s.value[a]?o||(o=Yf(e)):void 0;l===n&&i===c||(r=(n=l).copy()).on(u,i=c),s.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=R(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,Rf(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}}(bf(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,$f(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=gf(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?vf:yf)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Sf:Lf)(e,t)):gf(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Uf:Nf)(e,t)):gf(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(Of(e,t)):gf(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;mf(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(o,a){var u={value:a},s={value:function(){0==--i&&o()}};n.each((function(){var n=mf(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(u),e._.interrupt.push(u),e._.end.push(s)),n.on=e})),0===i&&o()}))},[Symbol.iterator]:Vf[Symbol.iterator]};var Wf,Zf,Gf={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Xf(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 Jf(t){var e;if(Wf=Tt(".detailed-settings"),(Zf=Wf.append("div").attr("class","settings-block")).append("h2").text("Back to settings").on("click",(function(){Wf.transition().duration(100).style("opacity",0).on("end",(function(){Tt(this).html("").style("display","none"),Tt(".template-settings").style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),Tt(".template-settings-search").style("display",null).style("opacity",0).transition().duration(200).style("opacity",1)})),Wf.node()})),"string"==typeof t)e=Zf.append("div").html(t);else if("object"==typeof t&&(e=Zf.append(t.type),t.value&&(Zf.node().value=t.value),t.attributes))for(var n in t.attributes)e.attr(n,t.attributes[n]);return e.node().focus(),Tt(".template-settings-search").style("display","none"),Tt(".template-settings").style("display","none"),Wf.style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),Wf.node()}Ct.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[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 o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},Ct.prototype.transition=function(t){var e,n;t instanceof Pf?(e=t._id,t=t._name):(e=qf(),(n=Gf).time=nf(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],s=u.length,l=0;l<s;++l)(a=u[l])&&pf(a,t,e,l,u,n||Xf(a,e));return new Pf(r,this._parents,t,e)};var Qf,Kf,td,ed,nd={},rd={},id={Flourish:{colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#007d8e","#1aa7ee","#29dae4","#88e99a","#019c00","#c11f1f","#730000"]},"Flourish Alternate":{colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#88e99a","#29dae4","#1aa7ee","#019c00","#007d8e","#c11f1f","#730000"]},"Flourish High Fire":{colors:["#730000","#c11f1f","#9654e5","#ff6283","#ff8800","#ffc502"]},"Flourish Low Fire":{colors:["#4328e7","#007d8e","#019c00","#1aa7ee","#29dae4","#88e99a"]},"Flourish Uranium":{colors:["#c11f1f","#ff8800","#ffc502"]},"Flourish Erbium":{colors:["#730000","#9654e5","#ff6283"]},"Flourish Barium":{colors:["#4328e7","#1aa7ee","#29dae4"]},"Flourish Chromium":{colors:["#007d8e","#019c00","#88e99a"]},"Flourish Pale":{colors:["#e667b1","#a193f3","#eb8484","#4bedf3","#d6a4e9","#48ffa7","#ffb1c1","#8cd3f7","#f6c992","#94ecf1","#ffe281","#c4f4cd"]},"Flourish Deep":{colors:["#430b2b","#1d0e7a","#611010","#04393b","#5a1c72","#004826","#b10025","#09557b","#0f7277","#816300","#1d9c34"]},"Flourish Mono":{colors:["#000000","#6a6a6a","#959595","#dddddd"]},"Flourish Legacy":{scheme:"flourish_default_1",colors:["#1D6996","#EDAD08","#73AF48","#94346E","#38A6A5","#E17C05","#5F4690","#0F8554","#6F4070","#CC503E","#994E95","#666666"]},"Flourish Legacy Alternate":{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:kc},Dark:{scheme:"schemeDark2",colors:Fc},Paired:{scheme:"schemePaired",colors:Mc},Pale:{scheme:"schemePastel1",colors:Ec},"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"]}},od={};function ad(){var t,e={};for(t in od)e[t]=od[t];for(t in id)e[t]=id[t];return e}var ud="Edit color palette";function sd(t){t&&t.length?(od={},t.forEach((function(t){var e=Object.keys(t)[0];od[e]={colors:t[e]}}))):od={},function(){for(var t in nd){nd[t].setOptions(cd())}}()}function ld(){if(void 0!==Qf)return Qf;var t=document.createElement("input");return t.setAttribute("type","color"),t.setAttribute("value","!"),Qf="color"==t.type&&"!"!==t.value}function cd(){var t=[],e=ad();for(var n in t.push([ud,""]),e)t.push([n,e[n].colors.join("|")]);return t}function fd(t,e){var n=t[0],r=t[1];if(!r){const t=At("em");return t.append("i").classed("fa fa-pencil",!0),t.node().append(ud),t.node()}Array.isArray(r)||(r=r.split("|"));const i=[];if(e&&n){const t=At("label").text(n);i.push(t.node())}return r.forEach((function(t,e){const n=At("span").attr("data-index",e).style("background-color",t);i.push(n.node())})),i}function dd(t,e){var n,r,i=ad(),o=t.parentNode.querySelector(".color-swatches");if(Array.isArray(e))r=e;else if("string"==typeof e){if(i[e])n=e;else for(var a in i)if(i[a].scheme==e){n=a;break}n&&(r=i[n].colors)}if(!r||!r.length)return t.parentNode.classList.remove("custom"),t.removeAttribute("data-value"),t.value="",void(o.innerHTML="");o.innerHTML="",o.append(...fd([null,r])),t.setAttribute("data-value",r.join("|"))}function pd(t){ed=t.target,t.dataTransfer.setData("text/plain","x"),event.dataTransfer.effectAllowed="move",Tt(ed).classed("dragging",!0),Dt(".palette p:not(.dragging) input").style("pointer-events","none")}function hd(t){t.preventDefault();var e=Tt(".palette").selectAll("[draggable='true']").style("border-color",null),n=Tt(t.target);if("true"===n.attr("draggable")){var r="bottom";if(n.node()===e.nodes()[0]){var i=t.target.getBoundingClientRect(),o=i.top+i.height/2;t.clientY<o&&(r="top")}Tt(t.target).style("border-"+r,"1px solid black")}}function md(t){if(ed){for(var e=t.target;e&&("P"!==e.tagName||!e.nextSibling);)e=e.parentNode;if(e){var n=e.nextSibling;if(e===Tt(".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(ed,n),ed=!1,yd()}}}function gd(){Tt(ed).classed("dragging",!1),Dt(".palette *").style("border-bottom",null).style("border-top",null),Dt(".palette p input").style("pointer-events",null)}function vd(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=bd("#000000");e.insertAdjacentHTML("beforebegin",n),yd()}(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");yd()}(e.parentNode))}function yd(){for(var t=td.getAttribute("data-autocomplete"),e=nd[t],n=[],r=Kf.querySelectorAll(".palette input[type=text]"),i=0;i<r.length;i++)n.push(r[i].value);var o=e.getOptions();rd[t]?o[0][1]=n.join("|"):o.unshift(["Custom",n.join("|")]),rd[t]=n,e.setOptions(o),dd(td,n),Tt(td).dispatch("change")}function bd(t){const e=At("p").attr("draggable",!0);return e.append("span").classed("swatch-handle",!0).text(".. .. .."),ld()?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 _d(t){var e=t.target,n=e.value,r=e.parentNode;if(!n)return r.parentNode.removeChild(r),void yd();var i=lc(n);if(!i)return console.warn("bad color",n),"color"==e.type?e.value=e.nextSibling.value:ld()?e.value=e.previousSibling.value:e.value=e.previousSibling.style.backgroundColor,void(Ye.point(e).text(n+" is not a valid color").draw()._getElement().style.zIndex=115);"color"==e.type?e.nextSibling.value=n:ld()?e.previousSibling.value=i.hex():e.previousSibling.style.backgroundColor=n,yd()}var wd,xd,Cd={initialize:function(t,e){e.choices&&sd(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";nd[r]=new Au({input:t,id:r,mode:"single",options:cd(),options_config:{custom_renderer:fd}}),t.addEventListener("change",(function(e){t.value==ud?(e.stopImmediatePropagation(),t.value="",function(t){td=t;var e=(Kf=Jf({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,o=lc(i);o?n.push(o.hex()):(console.warn("Bad color",i),n.push("#000000"))}return n}(t),r="";n.forEach((function(t){r+=bd(t)})),r+="<p><button class='fa fa-plus-square clickable'></button></p>",e.innerHTML=r,e.addEventListener("change",_d),e.addEventListener("dragstart",pd),e.addEventListener("dragover",hd),e.addEventListener("drop",md),e.addEventListener("dragend",gd),e.addEventListener("click",vd)}(t)):dd(t,(t.getAttribute("data-value")||"").split("|"))}))},update:dd,getValue:function(t){var e=t.getAttribute("data-value");return e?e.split("|"):null},replaceThemeColors:sd},Td={};const Ad={style:!0,url:!0,flourish_embed:!0};var Dd={h1:{path:"M0.00100708 0.524002V9H1.91201V5.464H4.83701V9H6.76101V0.524002H4.83701V3.787H1.91201V0.524002H0.00100708ZM8.91 7.453V9H14.162V7.453H12.615V0.744995H11.211C10.9163 0.918329 10.613 1.06566 10.301 1.187C9.989 1.30833 9.60767 1.41233 9.157 1.499V2.682H10.704V7.453H8.91Z",width:14,height:9},h2:{path:"M0.00100708 0.524002V9H1.91201V5.464H4.83701V9H6.76101V0.524002H4.83701V3.787H1.91201V0.524002H0.00100708ZM8.24078 7.908V9H14.0518V7.388H12.3878C12.1884 7.388 11.9588 7.401 11.6988 7.427C11.4474 7.44434 11.2178 7.466 11.0098 7.492C11.3478 7.14534 11.6728 6.79434 11.9848 6.439C12.3054 6.07501 12.5871 5.71534 12.8298 5.36C13.0811 4.996 13.2804 4.63634 13.4278 4.281C13.5751 3.917 13.6488 3.56167 13.6488 3.215C13.6488 2.81634 13.5838 2.45667 13.4538 2.136C13.3238 1.81534 13.1374 1.54234 12.8948 1.317C12.6521 1.083 12.3618 0.905338 12.0238 0.784004C11.6944 0.654004 11.3261 0.589005 10.9188 0.589005C10.3294 0.589005 9.82245 0.701671 9.39778 0.927004C8.97311 1.14367 8.55711 1.46867 8.14978 1.902L9.18978 2.929C9.39778 2.70367 9.61878 2.50867 9.85278 2.344C10.0868 2.17067 10.3554 2.084 10.6588 2.084C11.0228 2.084 11.3088 2.19234 11.5168 2.409C11.7248 2.617 11.8288 2.92467 11.8288 3.332C11.8288 3.62667 11.7378 3.93867 11.5558 4.268C11.3824 4.58867 11.1354 4.93967 10.8148 5.321C10.5028 5.69367 10.1258 6.09667 9.68378 6.53C9.25045 6.95467 8.76945 7.414 8.24078 7.908Z",width:15,height:9},bold:{path:"M0.00100708 9V0.524002H2.90001C3.34201 0.524002 3.74934 0.558669 4.12201 0.628002C4.50334 0.688669 4.83267 0.801335 5.11001 0.966002C5.39601 1.13067 5.61701 1.34734 5.77301 1.616C5.93767 1.88467 6.02001 2.22267 6.02001 2.63C6.02001 2.82067 5.99401 3.01134 5.94201 3.202C5.89001 3.39267 5.81634 3.57034 5.72101 3.735C5.62567 3.89967 5.50867 4.047 5.37001 4.177C5.24001 4.307 5.08834 4.40234 4.91501 4.463V4.515C5.13167 4.567 5.33101 4.64934 5.51301 4.762C5.69501 4.866 5.85534 5.00034 5.99401 5.165C6.13267 5.32967 6.24101 5.52467 6.31901 5.75C6.39701 5.96667 6.43601 6.218 6.43601 6.504C6.43601 6.93734 6.34934 7.31 6.17601 7.622C6.01134 7.934 5.77734 8.194 5.47401 8.402C5.17934 8.60134 4.83267 8.753 4.43401 8.857C4.03534 8.95234 3.60634 9 3.14701 9H0.00100708ZM1.91201 3.917H2.80901C3.27701 3.917 3.61501 3.826 3.82301 3.644C4.03967 3.462 4.14801 3.21934 4.14801 2.916C4.14801 2.58667 4.03967 2.35267 3.82301 2.214C3.60634 2.07534 3.27267 2.006 2.82201 2.006H1.91201V3.917ZM1.91201 7.518H2.99101C4.03967 7.518 4.56401 7.13667 4.56401 6.374C4.56401 6.00134 4.43401 5.737 4.17401 5.581C3.91401 5.41634 3.51967 5.334 2.99101 5.334H1.91201V7.518Z",width:7,height:9},italic:{path:"M7 1.44444H5.06656L3.6687 8.05556H5.5V9H0.5V8.05556H2.6547L4.05256 1.44444H2V0.5H7V1.44444Z",width:7,height:9},line_break:{description:"Add line break",path:"M14 0V6H3.83L6.41 3.41L5 2L0 7L5 12L6.41 10.59L3.83 8H16V0H14Z",width:16,height:12},url:{description:"Add URL",path:"M8.03571429,6.69642857 C8.03571429,6.5476183 7.98363147,6.42113147 7.87946429,6.31696429 L6.71875,5.15625 C6.61458281,5.05208281 6.48809598,5 6.33928571,5 C6.18303493,5 6.0491077,5.05952321 5.9375,5.17857143 L6.16350446,5.40178571 L6.16350446,5.40178571 L6.21434766,5.4637896 C6.22447497,5.4770171 6.23542901,5.49169139 6.24720982,5.5078125 C6.28255226,5.55617584 6.30673357,5.6036084 6.31975446,5.65011161 C6.33277536,5.69661482 6.33928571,5.74776758 6.33928571,5.80357143 C6.33928571,5.9523817 6.2872029,6.07886853 6.18303571,6.18303571 C6.07886853,6.2872029 5.9523817,6.33928571 5.80357143,6.33928571 C5.74776758,6.33928571 5.69661482,6.33277536 5.65011161,6.31975446 C5.6036084,6.30673357 5.55617584,6.28255226 5.5078125,6.24720982 L5.42844742,6.18644594 L5.42844742,6.18644594 L5.37357392,6.13653276 L5.37357392,6.13653276 L5.17857143,5.9375 L5.17857143,5.9375 C5.05580296,6.05282796 4.99441964,6.18861529 4.99441964,6.34486607 C4.99441964,6.49367634 5.04650246,6.62016317 5.15066964,6.72433036 L6.30022321,7.87946429 C6.40067015,7.97991122 6.52715698,8.03013393 6.6796875,8.03013393 C6.82849777,8.03013393 6.9549846,7.98177132 7.05915179,7.88504464 L7.87946429,7.0703125 C7.98363147,6.96614531 8.03571429,6.84151858 8.03571429,6.69642857 Z M4.11272321,2.76227679 C4.11272321,2.61346652 4.0606404,2.48697969 3.95647321,2.3828125 L2.80691964,1.22767857 C2.70275246,1.12351138 2.57626562,1.07142857 2.42745536,1.07142857 C2.28236535,1.07142857 2.15587852,1.12165128 2.04799107,1.22209821 L1.22767857,2.03683036 C1.12351138,2.14099754 1.07142857,2.26562427 1.07142857,2.41071429 C1.07142857,2.55952455 1.12351138,2.68601138 1.22767857,2.79017857 L2.38839286,3.95089286 C2.48883979,4.05133979 2.61532662,4.1015625 2.76785714,4.1015625 C2.92410792,4.1015625 3.05803516,4.04389939 3.16964286,3.92857143 L2.94363839,3.70535714 L2.94363839,3.70535714 L2.85993304,3.59933036 L2.85993304,3.59933036 C2.8245906,3.55096702 2.80040929,3.50353446 2.78738839,3.45703125 C2.77436749,3.41052804 2.76785714,3.35937528 2.76785714,3.30357143 C2.76785714,3.15476116 2.81993996,3.02827433 2.92410714,2.92410714 C3.02827433,2.81993996 3.15476116,2.76785714 3.30357143,2.76785714 C3.35937528,2.76785714 3.41052804,2.77436749 3.45703125,2.78738839 C3.50353446,2.80040929 3.55096702,2.8245906 3.59933036,2.85993304 L3.70535714,2.94363839 L3.70535714,2.94363839 L3.92857143,3.16964286 L3.92857143,3.16964286 C4.0513399,3.0543149 4.11272321,2.91852757 4.11272321,2.76227679 Z M8.63839286,5.55803571 C8.95089442,5.87053728 9.10714286,6.24999777 9.10714286,6.69642857 C9.10714286,7.14285938 8.94903432,7.52045977 8.6328125,7.82924107 L7.8125,8.64397321 C7.50371869,8.95275452 7.1261183,9.10714286 6.6796875,9.10714286 C6.22953644,9.10714286 5.85007595,8.94903432 5.54129464,8.6328125 L4.39174107,7.47767857 C4.08295977,7.16889727 3.92857143,6.79129688 3.92857143,6.34486607 C3.92857143,5.8872745 4.09226027,5.4985135 4.41964286,5.17857143 L3.92857143,4.6875 C3.60862935,5.01488259 3.22172846,5.17857143 2.76785714,5.17857143 C2.32142634,5.17857143 1.94196585,5.02232299 1.62946429,4.70982143 L0.46875,3.54910714 C0.156248437,3.23660558 -8.52651283e-14,2.85714509 -8.52651283e-14,2.41071429 C-8.52651283e-14,1.96428348 0.158108538,1.58668309 0.474330357,1.27790179 L1.29464286,0.463169643 C1.60342416,0.154388337 1.98102455,1.42108547e-14 2.42745536,1.42108547e-14 C2.87760642,1.42108547e-14 3.25706691,0.158108538 3.56584821,0.474330357 L4.71540179,1.62946429 C5.02418309,1.93824559 5.17857143,2.31584598 5.17857143,2.76227679 C5.17857143,3.21986836 5.01488259,3.60862935 4.6875,3.92857143 L5.17857143,4.41964286 C5.4985135,4.09226027 5.8854144,3.92857143 6.33928571,3.92857143 C6.78571652,3.92857143 7.16517701,4.08481987 7.47767857,4.39732143 L8.63839286,5.55803571 Z",width:9.5,height:9.5},flourish_embed:{description:"Add Flourish embed",path:"M7.57358 5.28931L10.1281 6.04854L10.0432 6.517L7.37515 6.22624L9.44904 7.9224L9.20119 8.29833L6.86556 7.0207L8.11097 9.37696L7.7504 9.62552L6.06604 7.5604L6.34206 10.2078L5.89578 10.2926L5.11055 7.73772L4.36044 10.2926L3.89331 10.2078L4.16934 7.5604L2.50622 9.62552L2.12402 9.37696L3.38372 7.0207L1.04113 8.29833L0.793673 7.9224L2.88146 6.22624L0.213045 6.517L0.128113 6.04854L2.6479 5.28931L0.128113 4.53667L0.213045 4.06859L2.88146 4.35974L0.793673 2.66319L1.04113 2.28687L3.38372 3.56451L2.12402 1.20824L2.50622 0.960069L4.16934 3.02519L3.89331 0.377778L4.36044 0.292603L5.11055 2.84787L5.89578 0.292603L6.34206 0.377778L6.06604 3.02519L7.7504 0.960069L8.11097 1.20824L6.86556 3.56451L9.20119 2.28687L9.44904 2.66319L7.37515 4.35974L10.0432 4.06859L10.1281 4.53667L7.57358 5.28931Z",width:10,height:10}};function kd(t,e){Td=e||Ad;var n=Tt(xd=Jf({type:"div",attributes:{class:"text-editor-container settings-option"}})).select(".text-editor-container").html("");for(var r in n.append("div").attr("class","text-settings"),n.append("textarea").text(t.value).attr("class","text-input").on("blur",(function(){t.value=this.value,Tt(t).dispatch("change")})),Td)Td[r]&&Fd(r);(Td.bindings||Td.bindings_custom)&&(n.append("div").attr("class","text-bindings"),Md()),qe()}function Fd(t){if("bindings"!=t&&"bindings_custom"!=t){var e=Tt(xd).select(".text-settings").append("div").attr("class","editor-section");if("style"==t){["h1","h2","bold","italic","line_break"].forEach((function(t){var n=Dd[t].description?Dd[t].description:"Add "+t+" text";e.append("div").attr("class","editor-button popup").attr("data-action",t).attr("data-popup-body",n).attr("data-popup-position","top").on("click",Ed).append("svg").attr("height",Dd[t].height).attr("width",Dd[t].width).attr("viewBox","0 0 "+Dd[t].width+" "+Dd[t].height).append("path").attr("fill","#333333").attr("d",Dd[t].path)}))}else{var n=Dd[t].description?Dd[t].description:"Add "+t;e.append("div").attr("class","editor-button popup").attr("data-action",t).attr("data-popup-body",n).attr("data-popup-position","top").on("click",Ed).append("svg").attr("height",Dd[t].height).attr("width",Dd[t].width).attr("viewBox","0 0 "+Dd[t].width+" "+Dd[t].height).append("path").attr("fill","#333333").attr("d",Dd[t].path)}}}function Md(){if(Td.bindings||Td.bindings_custom){var t;if(Array.isArray(Td.bindings))t={},Td.bindings.forEach((function(e){var n=e.split("."),r=n[0],i=n.length>1?n[1]:null;i&&(t[r]||(t[r]=[]),t[r].push(i))}));else if(!0===Td.bindings)t=null;else if(!Array.isArray(Td.bindings_custom))return;var e=wd.visualisation.data_bindings[wd.visualisation.template_id],n={},r=[];wd.visualisation.data_tables.forEach((function(t){n[t.id]=t.cached_data[0]}));var i=null!==t;for(var o in e)if(!i||t[o]){var a=e[o];for(var u in a)if(!i||t[o].includes(u)){var s=a[u];if(null!=s.column){var l=n[s.data_table_id][s.column];l&&!r.includes(l)&&r.push(l)}else s.columns&&s.columns.forEach((function(t){var e=n[s.data_table_id][t];e&&!r.includes(e)&&r.push(e)}))}}Td.bindings_custom&&Array.isArray(Td.bindings_custom)&&Td.bindings_custom.forEach((function(t){t[0]&&t[1]&&r.push({name:t[0],binding:t[1],type:"dynamic"})})),Tt(".text-bindings").html("").style("display",r.length?null:"none").append("p").text("Click to add values from your data"),Tt(".text-bindings").selectAll("button.binding").data(r).enter().append("button").attr("data-action","binding").attr("data-binding",(function(t){return"object"==typeof t?t.binding:t})).attr("data-type",(function(t){return"object"==typeof t?t.type:null})).on("click",Ed).text((function(t){return"object"==typeof t?t.name:t}))}}function Ed(){var t,e=Tt(".text-editor-container .text-input"),n=e.node().value,r=e.node().selectionStart,i=e.node().selectionEnd,o=i-r,a=n.substr(r,o),u=Tt(this).attr("data-action"),s="flourish_embed"==u?prompt("Specify the ID of published Flourish project (eg. story/123 or visualisation/124)","visualisation/"):"";if("bold"==u)t=Sd(a,"<b>","</b>");else if("italic"==u)t=Sd(a,"<i>","</i>");else if("h1"==u)t=Sd(a,"<h1>","</h1>");else if("h2"==u)t=Sd(a,"<h2>","</h2>");else if("line_break"==u)t=Sd(a,"<br>","");else if("url"==u)t=Sd(a,'<a href ="">',"</a>",10);else if("flourish_embed"==u)t=Sd(s,'<iframe src="https://flo.uri.sh/','/embed" frameborder="0" scrolling="no" style="width:100%;height:400px;"></iframe>');else if("binding"==u){var l=Tt(this).attr("data-binding");t=Sd(l,"{{","}}",l.length+4)}e.node().setRangeText(t.text,r,i),e.node().focus(),e.node().selectionStart=r+t.cursor,e.node().selectionEnd=r+t.cursor}function Sd(t,e,n,r){return e=e||"",n=n||"",t=t||"",{cursor:r||e.length+t.length,text:e+t+n}}var Ld,Ud,Nd,Od={initialize:function(t,e,n){wd=t,Tt(e.parentElement).append("div").attr("class","text-editor-btn").attr("tabindex","0").on("click",(function(){kd(e,n.editor)})).on("keydown",(function(t){13==t.keyCode&&kd(e,n.editor)})).append("i").attr("class","fa fa-paint-brush")},updateDataBindings:Md},Hd=void 0,jd=/fa-(\S*)/g,Yd=/^data:image\/(svg|svg\+xml|png|jpg);base64,[A-Z-a-z0-9+/=]*$/,Bd=/^gradient:/g;function Rd(t){var e=!Tt(t.parentNode).classed("open");Dt(".template-settings .settings-block").classed("open",!1).attr("aria-expanded",!1),e&&Tt(t.parentNode).classed("open",!0).attr("aria-expanded",!0)}function Id(t){if(t){Hd={};for(var e=0,n=null,r=null,i=Ld&&Ld.user?Ld.user.template_settings_overrides:{},o=0;o<t.length;o++){var a=t[o];if("string"!=typeof a){if("object"!=typeof a||n||r||(e++,r=Nd.append("div").attr("class","toplevel-settings-block")),"hidden"!==a.type){var u=n||r;if(a.new_section&&(u.append("div").classed("settings-divider",!0),"string"==typeof a.new_section&&u.append("h3").classed("settings-subhead",!0).text(a.new_section)),void 0!==a.show_if){if(a.show_condition)throw new Error("BUG: show_if present as well as show_condition");a.show_condition=[{type:"show",condition:a.show_if}],delete a.show_if}else if(void 0!==a.hide_if){if(a.show_condition)throw new Error("BUG: hide_if present as well as show_condition");a.show_condition=[{type:"hide",condition:a.hide_if}],delete a.hide_if}Hd[a.property]=a.type,$d(u.append("div"),a,i)}}else r=null,(n=Nd.append("div").attr("class","settings-block")).append("h2").attr("class","no-select").attr("tabindex","0").text(a).on("click",(function(){Rd(this)})).on("keyup",(function(t){13===t.keyCode&&Rd(this)})),n.classed("open",e<1),n.attr("aria-expanded",e<1),"State documentation"===a&&n.style("display","none"),e++}Dt(".upgrade-setting").on("click",(function(){!function(t,e,n,r){var i=[],o=[];i.push(["Upgrade to a premium account to get:"]),o.push(["<strong>Branding control:</strong> Add custom logos, colors, and styles to keep your projects consistent with your brand identity","<strong>Logo removal:</strong> Embed your projects without the Flourish logo appended","<strong>Team management:</strong> Seamlessly manage your team with our collaboration and approval features"]);var a=Math.floor(Math.random()*i.length),u=Math.floor(Math.random()*o.length),s="title"+a+"-list"+u,l=[{text:"Upgrade now",class:"convert",tag_name:"a",href:"https://flourish.studio/pricing",target:"_blank",keyCode:13,callback:function(){t.analytics("event","upgrade-click",{upgrade_id:s}),zl.logHistory({category:"upgrade",action:"clicked",detail:r})}},{text:"Maybe later",keyCode:27,class:"secondary",callback:function(){t.analytics("event","upgrade-close",{upgrade_id:s}),zl.logHistory({category:"upgrade",action:"closed",detail:r})}}];t.analytics("event","upgrade-open",{upgrade_id:s}),zl.logHistory({category:"upgrade",action:"viewed",detail:r}),Cu(e,n,{buttons:l,is_html:!0,upgrade:{message:i[a],list:o[u],is_business:!0}})}(Ld,"This is a premium feature","Upgrade your plan to change this setting.","upgrade-settings")})),qe()}}function $d(t,e,n){e.upgrade=e.property in n;var r="html"==e.type,i=e.choices&&("buttons"==e.style||"boolean"==e.type);t.attr("class","settings-option option-type-"+e.type+(i?" settings-buttons":"")+(r?" text-editor":"")+(e.upgrade?" upgrade-setting":""));var o=t.append("label").attr("for","setting-"+e.property).classed("hidden",null==e.name).append("h3").text(e.name).classed("no-select",!0);(e.upgrade||e.description)&&o.append("i").style("font-family","FontAwesome").classed("fa setting-tooltip popup",!0).classed("fa-star tooltip-upgrade",e.upgrade).classed("fa-question tooltip-help",!e.upgrade).style("background-color",e.upgrade?"#93366e":null).attr("tabindex","0").attr("data-popup-head",e.upgrade?"This is a premium feature":null).attr("data-popup-body",e.description?e.description.replace(/\[\[/g,"").replace(/\]\]/g,""):null).attr("data-popup-allow-interaction",!0).attr("data-popup-constrainer",".settings-block"),e.width&&t.classed("width-"+e.width.replace(/ /g,"-"),!0);var a="input";if(["text","code","html"].includes(e.type)&&(a="textarea"),"code"==e.type){var u=!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(){u=!u,Tt(this.parentNode).select("textarea").attr("wrap",u?null:"off"),Tt(this).classed("selected",u)}))}var s=t.append(a).attr("id","setting-"+e.property).attr("class","setting").attr("name",e.property).attr("disabled",!Ld.visualisation.can_edit||null),l=s.node();if("colors"==e.type)Cd.initialize(l,e);else if("font"==e.type)wl.initialize(l,e,Ld.user&&null!=Ld.user.company_id);else if("number"==e.type)l.setAttribute("type","number"),null!=e.min&&l.setAttribute("min",e.min),null!=e.max&&l.setAttribute("max",e.max),e.step&&l.setAttribute("step",e.step);else if("url"==e.type)l.setAttribute("type","url"),Ud.addButton(l,e.upgrade);else if(i){s.remove(),s=t.append("div").attr("id","setting-"+e.property).attr("name",e.property).classed("buttons-container",!0).classed("large","large"==e.size),l=s.node();var c=e.choices.length,f=[3,4,5],d=function(){if(c<=2)return{column_count:c,rows:1};var t=f.map((function(t){return{column_count:t,orphans:c%t/t,rows:c/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",!Ld.visualisation.can_edit||null).call(zd(e)),Vd(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-c;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===c-(t-r)?"0 0 0 3px":n===c-1&&0===r?"0 0 3px 0":null:null})).node())}))}else"boolean"==e.type?(l.setAttribute("type","checkbox"),t.classed("slider-container",!0),t.append("label").attr("class","slider").attr("for","setting-"+e.property)):l.setAttribute("type","text");if("code"==e.type&&(l.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}}))),r&&(t.append("div").attr("class","text-editor-setting").node().appendChild(l),Od.initialize(Ld,l,e)),e.choices&&"string"==e.type&&"buttons"!=e.style&&(l._dropdown=new Au({input:l,id:e.property+"-dropdown",options:e.choices,options_config:{allow_other_option:e.choices_other,custom_renderer:Vd},mode:"single"})),"color"==e.type){Tt(l).classed("color",!0).style("display","none");var p=Tt(l.parentNode).append("div").attr("class","color-picker"),h=p.append("div").attr("class","color-wrapper");e.optional&&p.append("div").attr("class","cancel-setting popup").attr("tabindex","0").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 keydown",(function(t){t.keyCode&&13!==t.keyCode||(l.value="",s.dispatch("change"),Tt(this.parentNode).classed("is-null",!0))})),h.append("input").attr("type","color").on("change",(function(){l.value=this.value,s.dispatch("change"),Tt(this.parentNode.parentNode).classed("is-null",!1)})).on("focus",(function(){Tt(this.parentNode.parentNode).classed("active",!0)})).on("blur",(function(){Tt(this.parentNode.parentNode).classed("active",!1)}))}e.placeholder&&l.setAttribute("placeholder",e.placeholder),e.size&&l.classList.add("size-"+e.size),s.call(zd(e))}function zd(t){return function(e){var n=!1;e.on("change",(function(){var e=this;Ye.hide(),n=!0,Ld.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||(Ye.point(t).text("A value is required").draw(),!1);var n=parseFloat(t.value);return e.hasOwnProperty("min")&&n<e.min?(Ye.point(t).text("Value cannot be less than "+e.min).draw(),t.value=e.min):e.hasOwnProperty("max")&&n>e.max&&(Ye.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,o=Wd,a=[t,e,n],clearTimeout(Pl[r]),Pl[r]=setTimeout((function(){o.apply(window,a),delete Pl[r]}),i);var r,i,o,a}(e,t,(function(r){if(!r)return n=!1,void("SELECT"==e.tagName&&Tt(e).dispatch("blur"));var o="radio"==e.type?e.nextSibling:e;Ye.point(o).text("Not changed: "+(r.message||r)).draw();var a={};a[t.property]=i,Ld.preview_pane.setState(a,(function(r){if(r)return console.error("Failed to revert setting "+t.property+" to value: "+i),void(n=!1);Ld.preview_pane.update((function(r){if(r)return console.error("Failed to update after reverting setting "+t.property+" to value: "+i),void(n=!1);qd(e,i),n=!1}))}))})):(e.value=i,void(n=!1))}))})).on("keydown",(function(t){Ld.confirm.blank(),13==t.keyCode&&Ye.hide()})).on("blur",(function(){if(!n){var e=this;Ye.hide(),Ld.preview_pane.getState(t.property,(function(n,r){n?console.error("Failed to get state property "+t.property,n):qd(e,r)}))}}))}}function Pd(t,e,n){if(t.classList.contains("colors"))return Cd.getValue(t);if(t.classList.contains("font-menu")){var r=wl.getValue(t);return e&&!r?n?null:"":r}if(t.classList.contains("buttons-container")){for(var i,o=t.querySelectorAll("input[type='radio']"),a=0;a<o.length;a++)if(o[a].checked){i=o[a];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 qd(t,e){if(t.classList.contains("colors"))Cd.update(t,e);else if(t.classList.contains("font-menu"))wl.update(t,e);else if("checkbox"==t.getAttribute("type"))t.checked=e;else if(t.classList.contains("color"))t.value=e,Tt(t.parentNode).select(".color-picker").classed("is-null",null===e),Tt(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<Ld.settings.length;e++){var n=Ld.settings[e];if(n.property===t)return n}}(t.name),r=0;r<n.choices.length;r++){var i,o,a=n.choices[r];if("string"==typeof a?i=o=a:(i=a[1],o=a[0]),e==i)return t.value=o,t.setAttribute("data-value",i),void(t._dropdown&&t._dropdown.setSelectedOptions(a))}t.value=e,t.setAttribute("data-value",e)}else if(t.className.indexOf("buttons-container")>-1){var u=t.querySelectorAll("input[type='radio']");for(r=0;r<u.length;r++)u[r].value===""+e&&(u[r].checked=!0)}else t.value=e}function Vd(t,e){var n=Tt(e);if("string"!=typeof t){var r=t[2];if(r)if(r.match(jd))n.append("i").attr("class","fa "+r);else if(r.match(Yd))n.append("img").attr("src",r);else if(r.match(Bd)){var i=r.replace("gradient:","");n.append("div").attr("class","gradient-swatch").style("width","15px").style("height","15px").style("margin-right","5px").style("border-radius","15px").style("background","linear-gradient(to right, "+i+")")}var o=t[0];o.match(jd)?n.append("i").attr("class","fa "+o):o.match(Yd)?n.append("img").attr("src",o):n.node().append(o)}else n.text(t)}function Wd(t,e,n){var r={},i=Pd(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)){Ld.confirm.saving();var o=!1,a={};a[e.property]=Pd(t,e.optional,!0),Ld.preview_pane.setState(a,(function(t){if(t)return u(t);Ld.preview_pane.update((function(t){if(t)return u(t);Ld.visualisation.updateSettings(r,(function(t){if(t)return u(t);Ld.analytics("event","visualisation",{change_setting:Ld.visualisation.id}),Xd(),Ld.confirm.saved(),n&&n()}))}))}))}else n&&n("You can only choose values from the list");function u(r){o||(Ld.preview_pane.getState(e.property,(function(e,i){if(e)return console.error("Failed to get state",e),void Ld.confirm.error(e);qd(t,i),Xd(),Ld.confirm.blank(),n&&n(r)})),o=!0)}}function Zd(t,e){return/^data\./.test(t)?function(t,e){var n=t.split(".");return Ld.visualisation.__sdk__?function(t,e){if(t.length>=4)return;for(var n=null,r=Ld.template_data_bindings,i=0;i<r.length;i++){var o=r[i];if("string"!=typeof o&&(o.dataset===t[1]&&o.key===t[2])){n=o;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=Ld.visualisation.template_id,r=Ld.visualisation.data_bindings[n][t[1]][t[2]];if(null==r)return!1;for(var i,o=Ld.visualisation.data_tables,a=r.data_table_id,u=r.columns||[r.column],s=0;s<o.length;s++)if(o[s].id===a){i=o[s].column_types;break}var l=!1;for(s=0;s<u.length;s++){var c=i[u[s]].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=Pd(n);if(e instanceof Array)return-1!==e.indexOf(r);return r===e}(t,e)}function Gd(t){if("boolean"==typeof t)return t;if("string"==typeof t)return Zd(t,!0);if("object"==typeof t){for(var e in t)if(!Zd(e,t[e]))return!1;return!0}}function Xd(){Ld.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;let n=t.condition;Array.isArray(n)||(n=[n]);for(let t=0;t<n.length;t++){if(Gd(n[t]))return e}return!e})),n=document.getElementById("setting-"+t.property);if(n){for(var r=n;!r.classList.contains("settings-option");)r=r.parentNode;if(Tt(r).classed("hidden",!e),t.new_section)for(var i=r.previousSibling;i&&(Tt(i).classed("settings-divider")||Tt(i).classed("settings-subhead"));)Tt(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, .template-settings .toplevel-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 Jd(t,e,n){return Ld=t,Ud={setup:nl,addButton:rl,startUpload:ol},(Nd=Tt(".side-panel .template-settings")).on("submit",(function(t){t.preventDefault()})),Cd.replaceThemeColors(e),wl.replaceThemeFonts(n),Id(Ld.settings),function(){function t(e,n){return!e||e.classList.contains("template-settings")?null:e.classList.contains(n)?e:t(e.parentNode,n)}function e(t){return t.replace(/ /g,"").replace(/-/g,"").toLowerCase().trim()}Tt(".side-panel .template-settings-search").on("input",(function(n){var r=e(n.target.value),i=!r,o=Tt(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden) h3, .settings-subhead:not(.hidden)");Tt(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden), .settings-subhead:not(.hidden), .settings-divider:not(.hidden)").classed("search-filtered-out",!i),i||o.filter((function(){var t=e(this.innerText);return!!t&&t.indexOf(r)>-1})).each((function(){var e=t(this,"settings-block"),n=Tt(this);if("H2"==this.tagName)e&&Tt(e).selectAll("h2, .settings-option, .settings-subhead, .settings-divider").classed("search-filtered-out",!1);else if("H3"==this.tagName)if(e&&Tt(e).select("h2").classed("search-filtered-out",!1),n.classed("settings-subhead")){n.classed("search-filtered-out",!1),this.previousSibling.classList.remove("search-filtered-out");for(var r=this.nextSibling;r&&r.classList.contains("settings-option");)r.classList.remove("search-filtered-out"),r=r.nextSibling}else{var i=t(this,"settings-option");if(i){i.classList.remove("search-filtered-out");for(var o=null,a=i.previousSibling;a&&null==o;)a.classList.contains("settings-subhead")?o=a:a=a.classList.contains("settings-divider")?null:a.previousSibling;o&&(o.classList.remove("search-filtered-out"),o.previousSibling.classList.remove("search-filtered-out"))}}}))}))}(),Tt(".side-panel-scrollbox").on("scroll",(function(){Ye.hide()})),{update:function(t){Nd.html(""),Tt(".current-template").style("opacity","1"),Id(Ld.settings=t)},populate:function(){Ld.preview_pane.getState((function(t,e){if(t)console.error("Failed to get state",t);else{var n=bs(e);for(var r in n){var i=document.getElementById("setting-"+r);i&&qd(i,n[r])}Od.updateDataBindings(),Xd()}}))},getSettingsForCurrentTemplate:function(){return Hd},setReadOnly:function(){Dt(".setting").each((function(){Tt(this).attr("disabled",!0)}))},unsetReadOnly:function(){Dt(".setting").each((function(){Tt(this).attr("disabled",null)}))}}}var Qd,Kd,tp=!1,ep=[];function np(){Tt(".flourish-warn-list").classed("visible",!1),tp=!1}function rp(){return Tt(".flourish-warn-btn").on("click",(function(){tp?np():(Tt(".flourish-warn-list").classed("visible",!0),tp=!0)})),{clear:op,warn:ap}}function ip(){Tt(".flourish-warn-container").classed("visible",ep.length),ep.length>100&&(ep.length=100);var t=Tt(".flourish-warn-list ul").selectAll("li").data(ep),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 op(){ep=[],ip(),np()}function ap(t){ep.unshift(t),ip()}function up(t){var e=Qd.visualisation,n=e.getTemplate(),r=!1,i=!1,o=!1;function a(){var e=Qd.template_settings.getSettingsForCurrentTemplate(),n=Qd.visualisation.settingsForCurrentTemplate(),r={};for(var i in n)i in e&&(r[i]=n[i]);Kd.loadVisualisation(Qd,r,(function(){Qd.template_settings.populate(),Qd.data_bindings.updateRequiredBindingsOverlay(!1),Js(),t&&t()})),St()}n.getSettings((function(t,e){t?console.error("Failed to get template settings: "+t):(Qd.template_settings.update(e),r=!0,i&&o&&a())})),n.getDataBindings((function(t,e){t?console.error("Failed to get template data bindings: "+t):(Qd.data_bindings.update(e),i=!0,r&&o&&a())})),e.refreshDataBindings((function(t){t?console.error("Failed to get template data bindings: "+t):(o=!0,i&&r&&a())}))}function sp(t){Kd.updateData(Qd.visualisation,t)}function lp(t){Kd.updateDataNotPreview(Qd.visualisation,t)}function cp(t){Qd=t;var e=rp();return{loadTemplate:up,updateData:sp,updateDataNotPreview:lp,sync:(Kd=Gs("iframe#preview","editor",Qd,e,{setSetting({name:t,value:e}){const n=function(t){return document.getElementById("setting-"+t)}(t);n?(qd(n,e),n.dispatchEvent(new Event("change"))):console.log(`Could not find setting ${t}`)}})).sync,setState:Kd.setState,getState:Kd.getState,hasData:Kd.hasData,setData:Kd.setData,getData:Kd.getData,draw:Kd.draw,update:Kd.update,getDefaultState:Kd.getDefaultState,snapshot:Kd.snapshot,setFixedHeight:Kd.setFixedHeight,resize:Kd.resize,getDrawCalled:Kd.getDrawCalled,setDrawCalled:Kd.setDrawCalled}}var fp={},dp={};function pp(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function hp(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 mp(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function gp(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+mp(-t,6):t>9999?"+"+mp(t,6):mp(t,4)}(t.getUTCFullYear())+"-"+mp(t.getUTCMonth()+1,2)+"-"+mp(t.getUTCDate(),2)+(i?"T"+mp(e,2)+":"+mp(n,2)+":"+mp(r,2)+"."+mp(i,3)+"Z":r?"T"+mp(e,2)+":"+mp(n,2)+":"+mp(r,2)+"Z":n||e?"T"+mp(e,2)+":"+mp(n,2)+"Z":"")}var vp=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,u=0,s=o<=0,l=!1;function c(){if(s)return dp;if(l)return l=!1,fp;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?s=!0:10===(r=t.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))l=!0;else if(13===r)l=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return s=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==dp;){for(var f=[];r!==fp&&r!==dp;)f.push(r),r=c();e&&null==(f=e(f,u++))||i.push(f)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?gp(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=pp(t);return function(r,i){return e(n(r),i,t)}}(t,e):pp(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=hp(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=hp(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),yp=vp.parseRows,bp=vp.formatRows;function _p(t,e,n){Ul(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 wp(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?wp(t):t}))}function xp(t){this.id=t}function Cp(t,e,n,r=null){if(Ul(this,t,e,n),this.api_prefix="/api/visualisation",this.slide_id=r,this.data_tables){var i=this;this.data_tables=this.data_tables.map((function(t){return new _p(i,t)}))}}function Tp(t,e,n){Yl({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 o=t.data_bindings[t.template_id];for(var a in e)for(var u in e[a]){var s=e[a][u];o[a]||(o[a]={}),null===s?delete o[a][u]:o[a][u]=s}n(void 0)}})}function Ap(t,e,n){Yl({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 o=t.settings[t.template_id];for(var a in e){var u=e[a];o[a]=u}n(void 0)}})}function Dp(t,e,n,r){Yl({url:t.api_prefix+"/"+t.id+"/publish",payload:function(){return{password:n,anyone_can_duplicate:r}},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,t.anyone_can_duplicate=r.anyone_can_duplicate,e(void 0,r)}})}function kp(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]:kp(t[n],e[n])}function Fp(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=Jd(this),this.data_bindings=(Mu=this,Eu=Tt(".data-bindings"),{update:function(t){t&&(Mu.template_data_bindings=t),Hu(Mu.visualisation,Mu.template_data_bindings)},modify:function(t,e=!1){Yu(t,(function(){Hu(Mu.visualisation,Mu.template_data_bindings),e&&Mu.preview_pane.updateData((t=>{if(t)return console.error("Failed to update preview pane: "+t)}))}))},requiredBindingsAreUnset:Iu,updateRequiredBindingsOverlay:$u}),this.preview_pane=cp(this),this.responsive_menu=Et(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()}))}_p.prototype.getColumnTypes=function(t){Yl({url:this.api_prefix+"/"+this.id,method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,wp(n.column_types||[]))}},"load-data")},_p.prototype.csv=function(t,e=null){this.cached_data?t(void 0,wp(this.cached_data)):this.csvPromise(e).then((e=>t(null,e)),(e=>t(e)))},_p.prototype.csvPromise=async function(t=null){if(this.cached_data)return wp(this.cached_data);const e=this;let n=this.api_prefix+"/"+this.id+"/csv";return t&&(n="/api/slide/"+t+"/data_table/"+this.id+"/csv"),new Promise(((t,r)=>{Yl({url:n,response_type:"text/csv; charset=utf-8",method:"GET",callback(n,i){if(n)return r(n);e.cached_data=yp(i),t(wp(e.cached_data))}},"load-data")}))},_p.prototype.saveData=function(t,e){var n=this,r=bu(wp(t));Yl({url:this.api_prefix+"/"+this.id+"/csv",payload:function(){return{version_number:n.getVersionNumber(),data:bp(r)}},callback:function(t,i){if(t)return e(t);n.setVersionNumber(i.version_number),n.cached_data=r,e(void 0)}})},_p.prototype.updateFromUrl=function(t,e){var n=this;Yl({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.message,e(t.message);var i=function(t){bu(t);for(let e of t)for(let t=0;t<e.length;t++){let n=e[t];null==n&&(n=""),"string"!=typeof n&&(n=""+n),e[t]=n.trim()}return t}(yp(r.csv));n.cached_data=i,n.setVersionNumber(r.version_number),n.t_updated=r.t_updated,n.last_remote_data_error_message=null,e(void 0,i,r.new_column_types)})):(n.t_updated=i.t_updated,n.last_remote_data_error_message=null,e(void 0,null,null))}})},_p.prototype.updateFromLiveCsvUrl=function(t){var e=this;Yl({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)}})},_p.prototype.save=function(t,e){return Rl(this,t,e)},_p.prototype.delete=function(t){return Il(this,t)},xp.prototype.getSettings=function(t){if(this.settings)t(void 0,this.settings);else{var e=this;Yl({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)}})}},xp.prototype.getDataBindings=function(t){Yl({url:"/api/template/"+this.id+"/data_bindings",method:"GET",callback:t})},Cp.prototype.save=function(t,e){this.is_listed||(t.is_listed=!0),Rl(this,t,e)},Cp.prototype.setTemplateId=function(t,e){Rl(this,{template_id:t},e)},Cp.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new xp(this.template_id)),this._template):null},Cp.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},Cp.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={},o=0;o<r.length;o++){var a=r[o];a.property in e&&(i[a.property]=e[a.property])}t(_s(i))}))},Cp.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},Cp.prototype.refreshDataBindings=function(t){var e=this;let n=this.api_prefix+"/"+this.id;this.slide_id&&(n="/api/slide/"+this.slide_id+"/visualisation"),Yl({url:n+"/data_bindings",method:"GET",callback:function(n,r){if(n)return t(n);e.data_bindings=r,t()}})},Cp.prototype.resetToTheme=function(t){var e=this;Yl({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)}})},Cp.prototype.updateDataBindings=function(t,e){var n=this;if(this.is_listed)return Tp(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):Tp(n,t,e)}))},Cp.prototype.updateSettings=function(t,e){var n=this;if(this.is_listed)return Ap(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):Ap(n,t,e)}))},Cp.prototype.refreshSettings=function(t){var e=this;Yl({url:this.api_prefix+"/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r,t()}})},Cp.prototype.getThemeFontsAndColors=function(t){Yl({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)}})},Cp.prototype.getDataTables=function(t){let e=this.api_prefix+"/"+this.id;this.slide_id&&(e="/api/slide/"+this.slide_id+"/visualisation"),Yl({url:e+"/data",method:"GET",callback:function(e,n){return e?t(e):t(void 0,n.data)}})},Cp.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 _p(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=[]}})))},Cp.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},Cp.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 o={},a={},u=0,s=0;s<i.length;s++)!function(r){a[r.id]=r.column_types,r.csv((function(s,l){if(s)throw s;e.template_id==n&&(o[r.id]=l,++u==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 u={},s=e.dataBindingsForCurrentTemplate();for(var l in s)u[l]=yu(s[l],o,a,i[l]);for(l in i)u[l]||(u[l]=[],u[l].column_names={},u[l].metadata={});t(void 0,u)})))}),e.slide_id)}(i[s]);0==i.length&&t(void 0,{})}}))},Cp.prototype.delete=function(t){Il(this,t)},Cp.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},Cp.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},Cp.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0},Cp.prototype.duplicate=function(t,e){Yl({url:this.api_prefix+"/"+this.id+"/duplicate",callback:e})},Cp.prototype.deleteCanvaEmbed=function(t){Yl({url:this.api_prefix+"/"+this.id+"/delete_canva_embed",callback:t})},Cp.prototype.publish=function(t,e,n){var r=this;if(this.is_listed)return Dp(r,t,e,n);this.save({is_listed:!0},(function(i){return i?t(i):Dp(r,t,e,n)}))},Cp.prototype.unpublish=function(t){var e=this;Yl({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)}})},Cp.prototype.published=function(){return!!this.showcase_url},Cp.prototype.sendForReview=function(t,e,n){var r=this;Yl({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)}})},Cp.prototype.approve=function(t,e){var n=this;Yl({url:"/api/review/"+t+"/approve",callback:function(t,r){return n.status=r,e(t,r)}})},Cp.prototype.decline=function(t,e,n){var r=this;Yl({url:"/api/review/"+t+"/decline",payload:function(){return{message:e}},callback:function(t,e){r.status=e,n(t,e)}})},Cp.prototype.cancelReview=function(t,e){var n=this;Yl({url:"/api/review/"+t+"/cancel",callback:function(t,r){n.status=r,e(t,r)}})},Cp.list=function(t){Yl({url:"/api/visualisations",method:"GET",callback:t})},Cp.getById=function(t,e){Yl({url:"/api/visualisation/"+t,method:"GET",callback:function(n,r){if(n)return e(n);e(void 0,new Cp(t,r.version_number,r))}})},Cp.getPublishedJson=function(t,e,n){Yl({url:`${e}visualisation/${t}/visualisation.json`,method:"GET",callback(t,e){if(t)return n(t);n(void 0,e)}})},Cp.createFromTemplate=function(t,e){Yl({url:"/api/template/"+t+"/visualisations",method:"PUT",callback:e})},Cp.createFromVisualisation=function(t,e){Yl({url:"/api/visualisation/"+t+"/duplicate",callback:e})},Cp.setAsStaffPick=function(t,e){Yl({url:"/api/visualisation/"+t+"/set_staff_pick",method:"POST",callback:e})},Cp.unsetAsStaffPick=function(t,e){Yl({url:"/api/visualisation/"+t+"/unset_staff_pick",method:"POST",callback:e})},Cp.setFolder=function(t,e,n){Yl({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e)+"?use_id=1",method:"PUT",callback:n})},Cp.removeFolder=function(t,e,n){Yl({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e)+"?use_id=1",method:"DELETE",callback:n})},Cp.removeTag=function(t,e,n){Yl({url:"/api/visualisation/"+t+"/tag/"+encodeURIComponent(e),method:"DELETE",callback:n})},Cp.prototype.updateCompanyAccess=function(t,e,n={}){Yl({url:"/api/visualisation/"+this.id+"/company_access",method:"POST",callback:e,payload:function(){return{company_access:t,options:n}}})},Cp.prototype.getTags=function(t){Yl({url:"/api/visualisation/"+this.id+"/tags",method:"GET",callback:t})},Cp.prototype.setTags=function(t,e){Yl({url:"/api/visualisation/"+this.id+"/tags",method:"PUT",callback:e,payload:function(){return{tags:t}}})},Fp.prototype.loadFromUrlHash=async function(){if(!window.location.hash)return;const t=window.location.hash.slice(1),e=(n=Cp.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)}},Fp.prototype.updateFromJson=function({state:t,bindings:e,data:n}){const r={};for(const[t,i]of Object.entries(e)){const e={},a={};for(const[t,n]of Object.entries(i))Array.isArray(n)?a[t]=n:e[t]=n;const u=o(n[t],e,a);r[t]=u}const i={};kp(i,this.preview_pane.getDefaultState()),kp(i,t),this.preview_pane.sync({state:i,data:r,overwrite_state:!0,update:!0},(()=>this.template_settings.populate()))};var Mp={},Ep={};function Sp(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Lp(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 Up(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Np(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+Up(-t,6):t>9999?"+"+Up(t,6):Up(t,4)}(t.getUTCFullYear())+"-"+Up(t.getUTCMonth()+1,2)+"-"+Up(t.getUTCDate(),2)+(i?"T"+Up(e,2)+":"+Up(n,2)+":"+Up(r,2)+"."+Up(i,3)+"Z":r?"T"+Up(e,2)+":"+Up(n,2)+":"+Up(r,2)+"Z":n||e?"T"+Up(e,2)+":"+Up(n,2)+"Z":"")}var Op=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,u=0,s=o<=0,l=!1;function c(){if(s)return Ep;if(l)return l=!1,Mp;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?s=!0:10===(r=t.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))l=!0;else if(13===r)l=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return s=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==Ep;){for(var f=[];r!==Mp&&r!==Ep;)f.push(r),r=c();e&&null==(f=e(f,u++))||i.push(f)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Np(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Sp(t);return function(r,i){return e(n(r),i,t)}}(t,e):Sp(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Lp(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Lp(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),Hp=Op.parseRows,jp="$";function Yp(){}function Bp(t,e){var n=new Yp;if(t instanceof Yp)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var a in t)n.set(a,t[a]);return n}function Rp(){}Yp.prototype=Bp.prototype={constructor:Yp,has:function(t){return jp+t in this},get:function(t){return this[jp+t]},set:function(t,e){return this[jp+t]=e,this},remove:function(t){var e=jp+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===jp&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===jp&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===jp&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===jp&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===jp&&++t;return t},empty:function(){for(var t in this)if(t[0]===jp)return!1;return!0},each:function(t){for(var e in this)e[0]===jp&&t(this[e],e.slice(1),this)}};var Ip=Bp.prototype;Rp.prototype={constructor:Rp,has:Ip.has,add:function(t){return this[jp+(t+="")]=t,this},remove:Ip.remove,clear:Ip.clear,values:Ip.keys,size:Ip.size,empty:Ip.empty,each:Ip.each};var $p={value:function(){}};function zp(){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 Pp(r)}function Pp(t){this._=t}function qp(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 Vp(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Wp(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=$p,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function Zp(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 Gp(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?Gp(t):t}))}function Xp(t){this.id=t}function Jp(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})})),e}Pp.prototype=zp.prototype={constructor:Pp,on:function(t,e){var n,r=this._,i=qp(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=Wp(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Wp(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=Vp(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Pp(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}},Zp.prototype.csv=function(t){if(this.cached_data)t(void 0,Gp(this.cached_data));else{var e=this;!function(t,e){var n,r,i,o,a=zp("beforesend","progress","load","error"),u=Bp(),s=new XMLHttpRequest,l=null,c=null,f=0;function d(t){var e,r=s.status;if(!r&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(s)||r>=200&&r<300||304===r){if(i)try{e=i.call(n,s)}catch(t){return void a.call("error",n,t)}else e=s;a.call("load",n,e)}else a.call("error",n,t)}if("undefined"!=typeof XDomainRequest&&!("withCredentials"in s)&&/^(http(s)?:)?\/\//.test(t)&&(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=s.ontimeout=d:s.onreadystatechange=function(t){s.readyState>3&&d(t)},s.onprogress=function(t){a.call("progress",n,t)},n={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?u.get(t):(null==e?u.remove(t):u.set(t,e+""),n)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",n):r},responseType:function(t){return arguments.length?(o=t,n):o},timeout:function(t){return arguments.length?(f=+t,n):f},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,d){return s.open(e,t,!0,l,c),null==r||u.has("accept")||u.set("accept",r+",*/*"),s.setRequestHeader&&u.each((function(t,e){s.setRequestHeader(e,t)})),null!=r&&s.overrideMimeType&&s.overrideMimeType(r),null!=o&&(s.responseType=o),f>0&&(s.timeout=f),null==d&&"function"==typeof i&&(d=i,i=null),null!=d&&1===d.length&&(d=function(t){return function(e,n){t(null==e?n:null)}}(d)),null!=d&&n.on("error",d).on("load",(function(t){d(null,t)})),a.call("beforesend",n,s),s.send(null==i?null:i),n},abort:function(){return s.abort(),n},on:function(){var t=a.on.apply(a,arguments);return t===a?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=Hp(r.response),t(void 0,Gp(e.cached_data))}))}},Zp.prototype.saveData=function(t,e){e()},Zp.prototype.save=function(t,e){e()},Zp.prototype.delete=function(t){t()},Xp.prototype.getSettings=function(t){t(void 0,window.Flourish.app.settings)},Xp.prototype.getDataBindings=function(t){t(void 0,window.Flourish.app.template_data_bindings)},Xp.prototype.refreshDataBindings=function(t){t(void 0)};var Qp=new Date,Kp=new Date;function th(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,o){var a,u=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return u;do{u.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return u},i.filter=function(n){return th((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 Qp.setTime(+e),Kp.setTime(+r),t(Qp),t(Kp),Math.floor(n(Qp,Kp))},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 eh=864e5,nh=6048e5,rh=th((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()))/eh}),(function(t){return t.getDate()-1})),ih=rh;function oh(t){return th((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()))/nh}))}rh.range;var ah=oh(0),uh=oh(1),sh=oh(2),lh=oh(3),ch=oh(4),fh=oh(5),dh=oh(6);ah.range,uh.range,sh.range,lh.range,ch.range,fh.range,dh.range;var ph=th((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()}));ph.every=function(t){return isFinite(t=Math.floor(t))&&t>0?th((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 hh=ph;ph.range;var mh=th((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/eh}),(function(t){return t.getUTCDate()-1})),gh=mh;function vh(t){return th((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)/nh}))}mh.range;var yh=vh(0),bh=vh(1),_h=vh(2),wh=vh(3),xh=vh(4),Ch=vh(5),Th=vh(6);yh.range,bh.range,_h.range,wh.range,xh.range,Ch.range,Th.range;var Ah=th((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()}));Ah.every=function(t){return isFinite(t=Math.floor(t))&&t>0?th((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 Dh=Ah;function kh(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 Fh(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 Mh(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}Ah.range;var Eh,Sh,Lh,Uh={"-":"",_:" ",0:"0"},Nh=/^\s*\d+/,Oh=/^%/,Hh=/[\\^$*+?|[\]().{}]/g;function jh(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function Yh(t){return t.replace(Hh,"\\$&")}function Bh(t){return new RegExp("^(?:"+t.map(Yh).join("|")+")","i")}function Rh(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function Ih(t,e,n){var r=Nh.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function $h(t,e,n){var r=Nh.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function zh(t,e,n){var r=Nh.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Ph(t,e,n){var r=Nh.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function qh(t,e,n){var r=Nh.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Vh(t,e,n){var r=Nh.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Wh(t,e,n){var r=Nh.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Zh(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 Gh(t,e,n){var r=Nh.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Xh(t,e,n){var r=Nh.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Jh(t,e,n){var r=Nh.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Qh(t,e,n){var r=Nh.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Kh(t,e,n){var r=Nh.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function tm(t,e,n){var r=Nh.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function em(t,e,n){var r=Nh.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function nm(t,e,n){var r=Nh.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function rm(t,e,n){var r=Nh.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function im(t,e,n){var r=Oh.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function om(t,e,n){var r=Nh.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function am(t,e,n){var r=Nh.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function um(t,e){return jh(t.getDate(),e,2)}function sm(t,e){return jh(t.getHours(),e,2)}function lm(t,e){return jh(t.getHours()%12||12,e,2)}function cm(t,e){return jh(1+ih.count(hh(t),t),e,3)}function fm(t,e){return jh(t.getMilliseconds(),e,3)}function dm(t,e){return fm(t,e)+"000"}function pm(t,e){return jh(t.getMonth()+1,e,2)}function hm(t,e){return jh(t.getMinutes(),e,2)}function mm(t,e){return jh(t.getSeconds(),e,2)}function gm(t){var e=t.getDay();return 0===e?7:e}function vm(t,e){return jh(ah.count(hh(t)-1,t),e,2)}function ym(t){var e=t.getDay();return e>=4||0===e?ch(t):ch.ceil(t)}function bm(t,e){return t=ym(t),jh(ch.count(hh(t),t)+(4===hh(t).getDay()),e,2)}function _m(t){return t.getDay()}function wm(t,e){return jh(uh.count(hh(t)-1,t),e,2)}function xm(t,e){return jh(t.getFullYear()%100,e,2)}function Cm(t,e){return jh((t=ym(t)).getFullYear()%100,e,2)}function Tm(t,e){return jh(t.getFullYear()%1e4,e,4)}function Am(t,e){var n=t.getDay();return jh((t=n>=4||0===n?ch(t):ch.ceil(t)).getFullYear()%1e4,e,4)}function Dm(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+jh(e/60|0,"0",2)+jh(e%60,"0",2)}function km(t,e){return jh(t.getUTCDate(),e,2)}function Fm(t,e){return jh(t.getUTCHours(),e,2)}function Mm(t,e){return jh(t.getUTCHours()%12||12,e,2)}function Em(t,e){return jh(1+gh.count(Dh(t),t),e,3)}function Sm(t,e){return jh(t.getUTCMilliseconds(),e,3)}function Lm(t,e){return Sm(t,e)+"000"}function Um(t,e){return jh(t.getUTCMonth()+1,e,2)}function Nm(t,e){return jh(t.getUTCMinutes(),e,2)}function Om(t,e){return jh(t.getUTCSeconds(),e,2)}function Hm(t){var e=t.getUTCDay();return 0===e?7:e}function jm(t,e){return jh(yh.count(Dh(t)-1,t),e,2)}function Ym(t){var e=t.getUTCDay();return e>=4||0===e?xh(t):xh.ceil(t)}function Bm(t,e){return t=Ym(t),jh(xh.count(Dh(t),t)+(4===Dh(t).getUTCDay()),e,2)}function Rm(t){return t.getUTCDay()}function Im(t,e){return jh(bh.count(Dh(t)-1,t),e,2)}function $m(t,e){return jh(t.getUTCFullYear()%100,e,2)}function zm(t,e){return jh((t=Ym(t)).getUTCFullYear()%100,e,2)}function Pm(t,e){return jh(t.getUTCFullYear()%1e4,e,4)}function qm(t,e){var n=t.getUTCDay();return jh((t=n>=4||0===n?xh(t):xh.ceil(t)).getUTCFullYear()%1e4,e,4)}function Vm(){return"+0000"}function Wm(){return"%"}function Zm(t){return+t}function Gm(t){return Math.floor(+t/1e3)}function Xm(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function Jm(t){return function(e){return"string"!=typeof e&&Xm(e),(e=e.trim())?t(e):null}}!function(t){Eh=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,l=Bh(i),c=Rh(i),f=Bh(o),d=Rh(o),p=Bh(a),h=Rh(a),m=Bh(u),g=Rh(u),v=Bh(s),y=Rh(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:um,e:um,f:dm,g:Cm,G:Am,H:sm,I:lm,j:cm,L:fm,m:pm,M:hm,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Zm,s:Gm,S:mm,u:gm,U:vm,V:bm,w:_m,W:wm,x:null,X:null,y:xm,Y:Tm,Z:Dm,"%":Wm},_={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:km,e:km,f:Lm,g:zm,G:qm,H:Fm,I:Mm,j:Em,L:Sm,m:Um,M:Nm,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Zm,s:Gm,S:Om,u:Hm,U:jm,V:Bm,w:Rm,W:Im,x:null,X:null,y:$m,Y:Pm,Z:Vm,"%":Wm},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=f.exec(e.slice(n));return r?(t.w=d[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=v.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=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return T(t,e,n,r)},d:Jh,e:Jh,f:rm,g:Wh,G:Vh,H:Kh,I:Kh,j:Qh,L:nm,m:Xh,M:tm,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:Gh,Q:om,s:am,S:em,u:$h,U:zh,V:Ph,w:Ih,W:qh,x:function(t,e,r){return T(t,n,e,r)},X:function(t,e,n){return T(t,r,e,n)},y:Wh,Y:Vh,Z:Zh,"%":im};function x(t,e){return function(n){var r,i,o,a=[],u=-1,s=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++u<l;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=Uh[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function C(t,e){return function(n){var r,i,o=Mh(1900,void 0,1);if(T(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Fh(Mh(o.y,0,1))).getUTCDay(),r=i>4||0===i?bh.ceil(r):bh(r),r=gh.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=kh(Mh(o.y,0,1))).getDay(),r=i>4||0===i?uh.ceil(r):uh(r),r=ih.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Fh(Mh(o.y,0,1)).getUTCDay():kh(Mh(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Fh(o)):kh(o)}}function T(t,e,n,r){for(var i,o,a=0,u=e.length,s=n.length;a<u;){if(r>=s)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in Uh?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=x(n,b),b.X=x(r,b),b.c=x(e,b),_.x=x(n,_),_.X=x(r,_),_.c=x(e,_),{format:function(t){var e=x(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=C(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=C(t+="",!0);return e.toString=function(){return t},e}}}(t),Eh.format,Eh.parse,Sh=Eh.utcFormat,Lh=Eh.utcParse}({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"]});var Qm=new Date(1972,3,27,19,45,5),Km={"%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 tg(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function eg(t,e){var n,r=Lh(t),i=Sh(t);return n=Jm("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:Jm((function(e){return r(e)||(Km[t]?tg(Km[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(Qm)})}var ng=Object.freeze([eg("%Y-%m-%dT%H:%M:%S.%LZ"),eg("%Y-%m-%d %H:%M:%S"),eg("%Y-%m-%dT%H:%M:%S"),eg("%Y-%m-%dT%H:%M:%SZ"),eg("%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})),eg("%d/%m/%Y %H:%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&&n[2]>=1e3&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),eg("%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])})),eg("%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})),eg("%m/%d/%Y %H:%M",(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&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),eg("%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])})),eg("%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})),eg("%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})),eg("%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])})),eg("%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})),eg("%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])})),eg("%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})),eg("%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])})),eg("%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})),eg("%Y-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),eg("%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})),eg("%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})),eg("%d %b %y"),eg("%-d %b ’%y"),eg("%d %B %y"),eg("%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})),eg("%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})),eg("%d-%b-%y"),eg("%d-%B-%y"),eg("%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})),eg("%m/%y"),eg("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),eg("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),eg("%b-%y"),eg("%b %y"),eg("%B %y"),eg("%b '%y"),eg("%B %-d %Y"),eg("%d %b",(function(t,e){return!!e||!!tg(Km["%d %b"])(t)})),eg("%d %B"),eg("%b %d",(function(t,e){return!!e||!!tg(Km["%b %d"])(t)})),eg("%B %d"),eg("%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})),eg("%m-%d"),eg("%d/%m"),eg("%m/%d"),eg("%b %d %Y"),eg("%b %d %Y, %-I.%M%p"),eg("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),eg("%B"),eg("%b"),eg("%X"),eg("%I:%M %p"),eg("%-I.%M%p"),eg("%H:%M",(function(t,e){if(!e)return!1;var n=t.split(":").map(parseFloat);return n[0]>=0&&n[0]<24})),eg("%H:%M:%S"),eg("%M:%S"),eg("%-I%p"),eg("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),eg("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length}))]);function rg(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 ig,og=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ag(t){if(!(e=og.exec(t)))throw new Error("invalid format: "+t);var e;return new ug({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 ug(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 sg(t,e){var n=rg(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")}ag.prototype=ug.prototype,ug.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 lg={"%":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 sg(100*t,e)},r:sg,s:function(t,e){var n=rg(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(ig=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+rg(t,Math.max(0,e+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function cg(t){return t}var fg=Array.prototype.map,dg=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function pg(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?cg:(e=fg.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=e[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?cg:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(fg.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=ag(t)).fill,n=t.align,f=t.sign,d=t.symbol,p=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):lg[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===d?o:/[%p]/.test(y)?s:"",w=lg[y],x=/[defgprs%]/.test(y);function C(t){var i,o,s,d=b,C=_;if("c"===y)C=w(t)+C,t="";else{var T=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),g),v&&(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)),T&&0==+t&&"+"!==f&&(T=!1),d=(T?"("===f?f:l:"-"===f||"("===f?"":f)+d,C=("s"===y?dg[8+ig/3]:"")+C+(T&&"("===f?")":""),x)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){C=(46===s?a+t.slice(i+1):t.slice(i))+C,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var A=d.length+t.length+C.length,D=A<h?new Array(h-A+1).join(e):"";switch(m&&p&&(t=r(D+t,D.length?h-C.length:1/0),D=""),n){case"<":t=d+t+C+D;break;case"=":t=d+D+t+C;break;case"^":t=D.slice(0,A=D.length>>1)+d+t+C+D.slice(A);break;default:t=D+d+t+C}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),C.toString=function(){return t+""},C}return{format:f,formatPrefix:function(t,e){var n,r=f(((t=ag(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=rg(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=dg[8+i/3];return function(t){return r(o*t)+a}}}}var hg={test:Jm((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Jm((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"},mg={test:Jm((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Jm((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"},gg={test:Jm((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Jm((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},vg={test:Jm((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Jm((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"},yg={test:Jm((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Jm((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"},bg={test:Jm((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:Jm((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},_g=Object.freeze([hg,mg,vg,yg,gg,bg]);_g.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=pg({decimal:t.decimal_mark,thousands:t.thousand_separator,grouping:[3],currency:["",""]});return function(t,i){return null===t?"":(i||(i=",.2f"),i!==n&&(n=i,e=r.format(n)),e(t))}}(t),Object.freeze(t)}));var wg=Object.freeze({test:function(t){return"string"==typeof t||Xm(t)},parse:function(t){return"string"==typeof t?t:Xm(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),xg=Object.freeze({datetime:ng,number:_g}),Cg=Object.freeze(["datetime","number","string"]),Tg=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),Ag=Object.freeze(Object.keys(Tg));function Dg(t,e){return t.index-e.index}function kg(t,e){return e.n_success-t.n_success||Dg(t,e)}function Fg(t){return(""+t).trim()}function Mg(t){return void 0===t?function(t){return Fg(t)}:"function"==typeof t?function(e,n){return Fg(t(e,n))}:function(e){return Fg(e[""+t])}}function Eg(t){t?Array.isArray(t)||(t=[t]):t=Cg;var e=t.reduce((function(t,e){var n=xg[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=Ag.reduce((function(t,e){return t[e]=Tg[e],t}),{}),i=function(t,i){i=Mg(i);var o=t.map(i).filter((function(t){return t}));if(!o.length)return n?[wg]:[];var a=Math.min(r.n_max,o.length),u=Math.floor(a*r.failure_fraction),s=r.n_failing_values,l=r.sort?kg:Dg,c=e.slice().reduce((function(t,e,n){for(var r=c=0,i=[],l=!1,c=0;c<a;c++){var f=o[c];if(!e.test(f)&&(++r>u?l=!0:-1===i.indexOf(f)&&(i.push(f),i.length>s&&(l=!0)),l))break}return l||t.push({interp:e,n_success:a-r,index:n}),t}),[]).sort(l).map((function(t){return t.interp}));return n&&c.push(wg),c};return Ag.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}Eg.DATETIME_IDS=Object.freeze(ng.map((function(t){return t.id}))),Eg.NUMBER_IDS=Object.freeze(_g.map((function(t){return t.id}))),Eg.STRING_IDS=Object.freeze([wg.id]),Eg.getInterpretation=function(){var t=ng.concat(_g,wg).reduce((function(t,e){return t[e.id]=e,t}),{});return function(e){return t[e]}}(),Eg._createAccessorFunction=Mg;var Sg=xg,Lg=Object.freeze({__proto__:null,createInterpreter:Eg,recognised_formats:Sg});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 o=e[i];if(t.call(r,o,i,e))return i;i++}return-1},configurable:!0,writable:!0});var Ug,Ng,Og,Hg,jg=Jp(Lg),Yg=(Ug=function(t,e){function n(t,e){if(t.length<=2*e)return t;const n=r(t.length);for(;t.length>e;){const e=Math.floor(n()*t.length);t.splice(e,1)}return t}function r(t){let e=t;return function(){e|=0,e=e+1831565813|0;var t=Math.imul(e^e>>>15,1|e);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(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}Object.defineProperty(e,"__esModule",{value:!0}),e.interpretColumn=e.getSlicedData=e.transposeNestedArray=e.stripCommonFixes=e.tidyTable=e.dropReturnCharacters=e.trimTrailingEmptyRows=e.mulberry32=e.getRandomSeededSample=e.getColumnTypesForData=e.extractData=void 0,e.extractData=function(t,e,n,r){var i=[],o=[],a=0,s=[],l={};function c(t,e){if(!l[t])return{};var n=l[t];return n[e]?n[e]:{}}for(var f in s.column_names={},s.metadata={},n){var d={},p=n[f];if(p){for(let t=0;t<p.length;t++){const e=p[t].type_id,n=p[t].output_format_id,r=n&&"auto"!==n?n:e;d[p[t].index]={type_id:e,output_format_id:r}}l[f]=d}}for(var h in t)if(null!==t[h]&&(void 0!==t[h].columns||void 0!==t[h].column)){var m=t[h];if(m.template_data_binding=r[h],m.key=h,m.data_table_id in e){var g=e[m.data_table_id];if(0!=g.length){if("columns"in m&&null!=m.columns){var v=g[0].length;m.columns=m.columns.filter((function(t){return t<v})),s.column_names[h]=m.columns.map((function(t){return g[0][t]})),s.metadata[h]=m.columns.map((function(t){const{type_id:e,output_format_id:n}=c(m.data_table_id,t);return e?{type:e.split("$")[0],type_id:e,output_format_id:n}:null}))}else{if(!("column"in m)||null==m.column)throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(m));{s.column_names[h]=g[0][m.column];const{type_id:t,output_format_id:e}=c(m.data_table_id,m.column);t&&(s.metadata[h]={type:t.split("$")[0],type_id:t,output_format_id:e})}}-1==o.indexOf(m.data_table_id)&&(o.push(m.data_table_id),a=Math.max(a,g.length-1)),i.push(m)}else console.warn("Empty data table")}else{var y=[];for(var b in e)y.push(b);console.error("Data table id "+m.data_table_id+" not in "+JSON.stringify(y))}}function _(t,e,n){if(!t.template_data_binding.data_type)return n;var r=function(t,e){const{type_id:n}=c(t,e);if(n)return jg.createInterpreter.getInterpretation(n)}(t.data_table_id,e);r&&"number"==r.type&&(n=u(n));var i=r?r.parse(n):n;return Number.isNaN(i)&&(i=null),i}for(var w=0;w<a;w++){for(var x={},C=0;C<i.length;C++){var T=e[(m=i[C]).data_table_id];w+1>=T.length||("columns"in m&&null!=m.columns?x[m.key]=m.columns.filter((function(t){return t<T[w+1].length})).map((function(t){return _(m,t,T[w+1][t])})):"column"in m&&null!=m.column&&(m.column>=T[w+1].length?x[m.key]=_(m,m.column,""):x[m.key]=_(m,m.column,T[w+1][m.column])))}s.push(x)}return s},e.getColumnTypesForData=function(t){return s(t).map((function(t,e){const r=l(t);let i;i=r.length>2e3?n(r,1e3):r;const o=c(i)[0].id;return{type_id:o,index:e,output_format_id:o}}))},e.getRandomSeededSample=n,e.mulberry32=r,e.trimTrailingEmptyRows=i,e.dropReturnCharacters=function(t){for(const e of t)for(let t=0;t<e.length;t++)e[t]=e[t].replace(/(\r\n|\n|\r) {2}/g," ");return t},e.tidyTable=function(t){i(t);for(let e of t)for(let t=0;t<e.length;t++){let n=e[t];null==n&&(n=""),"string"!=typeof n&&(n=""+n),e[t]=n.trim()}return t};var o=["#DIV/0","#N/A","#NAME?","#NULL!","#NUM!","#REF!","#VALUE!","#ERROR!"],a=(0,jg.createInterpreter)().nMax(1/0).nFailingValues(8).failureFraction(.1);function u(t){return(t=t||"").replace(/[€£$¥%º]/g,"")}function s(t){for(var e=t.length,n=e>0?t[0].length:0,r=[],i=0;i<n;i++){for(var o=[],a=0;a<e;a++)o.push(t[a][i]);r.push(o)}return r}function l(t){const e=t.length;return e>100?t.slice(10,e-10):e>50?t.slice(5,e-5):e>30?t.slice(4,e-4):e>20?t.slice(3,e-3):e>10?t.slice(2,e-2):e>1?t.slice(1,e):t.slice(0,1)}function c(t){var e=t.filter((function(t){return t&&!o.includes(t.trim())})).map(u);return a(e)}e.stripCommonFixes=u,e.transposeNestedArray=s,e.getSlicedData=l,e.interpretColumn=c},Ug(Ng={exports:{}},Ng.exports),Ng.exports);function Bg(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 Zp(r,t)}))),n.data_bindings&&(this.data_bindings=n.data_bindings)}Bg.prototype.save=function(t,e){this.version_number++,e(void 0)},Bg.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new Xp(this.template_id)),this._template):null},Bg.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},Bg.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},Bg.prototype.refreshDataBindings=function(t){t()},Bg.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 o in t[i]){var a=t[i][o];r[i][o]=a}e(void 0)},Bg.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 o=t[i];r[i]=o}e(void 0)},Bg.prototype.getDataTables=function(t){t(void 0,window.Flourish.app.data_tables)},Bg.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 Zp(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=[]}})))},Bg.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},Bg.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 o={},a={},u=0,s=0;s<i.length;s++)!function(r){r.csv((function(s,l){if(s)throw s;e.template_id==n&&(a[r.id]=Yg.getColumnTypesForData(l),o[r.id]=l,++u==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 u={},s=e.dataBindingsForCurrentTemplate();for(var l in s)u[l]=Yg.extractData(s[l],o,a,i[l]);for(l in i)u[l]||(u[l]=[],u[l].column_names={},u[l].metadata={});t(void 0,u)})))}))}(i[s]);0==i.length&&t(void 0,{})}}))},Bg.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},Bg.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},Bg.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0};var Rg=!1;function Ig(){Og&&Og.classList.remove("shown")}function $g(){this.close(),Rg||(Og&&setTimeout((function(){Og.classList.add("shown")}),1e3),setTimeout(zg,250))}function zg(){Pg().addEventListener("open",(function(){window.location.reload()}))}function Pg(){var t=new window.WebSocket(Hg);return t.addEventListener("open",Ig),t.addEventListener("close",$g),t}return t.Visualisation=Bg,t.initSDK=function(t,e,n,r){return qe(),window.Flourish=window.Flourish||{},window.Flourish.app=new Fp(t,e,n,r),window.Flourish.app},t.talkToServer=function(){Og=document.getElementById("error-server-down"),Hg=window.location.origin.replace(/^http(s?):\/\//,"ws$1://"),window.addEventListener("beforeunload",(function(){Rg=!0})),Pg()},Object.defineProperty(t,"__esModule",{value:!0}),t}({});
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 o=t[0],a=n(t.slice(1),r,i);return a.column_names={},Object.keys(r).forEach((function(t){a.column_names[t]=o[r[t]]})),Object.keys(i).forEach((function(t){var e=i[t];a.column_names[t]=(Array.isArray(e)?e:[e]).map((function(t){return o[t]}))})),a}function o(t,e,n){return(Array.isArray(t[0])?i:r)(t,e,n)}const a=window.sessionStorage;let s,u,l=!1;function c(){const t=document.querySelector(".settings-block[aria-expanded=true] > h2"),e=document.querySelector("#editor-custom"),n=document.querySelector("#editor-custom-width"),r=document.querySelector("#editor-custom-height"),i=e.classList.contains("selected"),o=parseFloat(n.value),a=i?parseFloat(r.value):"auto";return{template_store_key:s.visualisation.template_store_key,setting_expanded:t&&t.innerText,width:o||800,height:a||"auto",settings:s.visualisation.settings}}function d(){return u}function f(){p(!1),a.removeItem(s.store_key)}function p(t){l=t}function h(){const t=s.visualisation.template_store_key,e=a.getItem(s.store_key),n=JSON.parse(e);return n&&n.template_store_key===t?n:null}function m(){const t=d();s.visualisation.settings=t.settings,v()}function g(){const t=Boolean(h());p(!0),function(){const t=document.querySelector("iframe#preview").contentWindow;t.addEventListener("beforeunload",b),t.addEventListener("keyup",b),t.addEventListener("pointerup",b)}(),v(),s.logInfo("Settings restored."),s.showStatusMessage(t?"Settings restored.":"Settings reset to defaults.")}function v(){const t=d(),e=[...document.querySelectorAll(".settings-block[aria-expanded=false] > h2")].find((e=>e.innerText===t.setting_expanded));e&&e.click()}function y(){const t=d();return{width:t.width,height:t.height}}function _(){var t;u=c(),t=u,a.setItem(s.store_key,JSON.stringify(t))}function b(){l&&_()}function w(t){return s=t,u=h()||c(),window.addEventListener("beforeunload",b),window.addEventListener("keyup",b),window.addEventListener("pointerup",b),{getPreviewSize:y,clearSession:f,prepareSession:m,applySession:g}}var x="http://www.w3.org/1999/xhtml",T={svg:"http://www.w3.org/2000/svg",xhtml:x,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function A(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),T.hasOwnProperty(e)?{space:T[e],local:t}:t}function C(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===x&&e.documentElement.namespaceURI===x?e.createElement(t):e.createElementNS(n,t)}}function E(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function k(t){var e=A(t);return(e.local?E:C)(e)}function D(){}function S(t){return null==t?D:function(){return this.querySelector(t)}}function M(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function L(){return[]}function F(t){return null==t?L:function(){return this.querySelectorAll(t)}}function N(t){return function(){return this.matches(t)}}function U(t){return function(e){return e.matches(t)}}var O=Array.prototype.find;function R(){return this.firstElementChild}var I=Array.prototype.filter;function H(){return this.children}function B(t){return new Array(t.length)}function j(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function P(t,e,n,r,i,o){for(var a,s=0,u=e.length,l=o.length;s<l;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new j(t,o[s]);for(;s<u;++s)(a=e[s])&&(i[s]=a)}function z(t,e,n,r,i,o,a){var s,u,l,c=new Map,d=e.length,f=o.length,p=new Array(d);for(s=0;s<d;++s)(u=e[s])&&(p[s]=l=a.call(u,u.__data__,s,e)+"",c.has(l)?i[s]=u:c.set(l,u));for(s=0;s<f;++s)l=a.call(t,o[s],s,o)+"",(u=c.get(l))?(r[s]=u,u.__data__=o[s],c.delete(l)):n[s]=new j(t,o[s]);for(s=0;s<d;++s)(u=e[s])&&c.get(p[s])===u&&(i[s]=u)}function Y(t){return t.__data__}function $(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function q(t){return function(){this.removeAttribute(t)}}function V(t){return function(){this.removeAttributeNS(t.space,t.local)}}function W(t,e){return function(){this.setAttribute(t,e)}}function G(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function X(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function Z(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 J(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function K(t){return function(){this.style.removeProperty(t)}}function Q(t,e,n){return function(){this.style.setProperty(t,e,n)}}function tt(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function et(t,e){return t.style.getPropertyValue(e)||J(t).getComputedStyle(t,null).getPropertyValue(e)}function nt(t){return function(){delete this[t]}}function rt(t,e){return function(){this[t]=e}}function it(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ot(t){return t.trim().split(/^|\s+/)}function at(t){return t.classList||new st(t)}function st(t){this._node=t,this._names=ot(t.getAttribute("class")||"")}function ut(t,e){for(var n=at(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function lt(t,e){for(var n=at(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function ct(t){return function(){ut(this,t)}}function dt(t){return function(){lt(this,t)}}function ft(t,e){return function(){(e.apply(this,arguments)?ut:lt)(this,t)}}function pt(){this.textContent=""}function ht(t){return function(){this.textContent=t}}function mt(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function gt(){this.innerHTML=""}function vt(t){return function(){this.innerHTML=t}}function yt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function _t(){this.nextSibling&&this.parentNode.appendChild(this)}function bt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wt(){return null}function xt(){var t=this.parentNode;t&&t.removeChild(this)}function Tt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function At(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ct(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Et(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function kt(t,e,n){var r=J(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 Dt(t,e){return function(){return kt(this,t,e)}}function St(t,e){return function(){return kt(this,t,e.apply(this,arguments))}}j.prototype={constructor:j,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)}},st.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 Mt,Lt,Ft,Nt,Ut,Ot=[null];function Rt(t,e){this._groups=t,this._parents=e}function It(){return new Rt([[document.documentElement]],Ot)}function Ht(t){return"string"==typeof t?new Rt([[document.querySelector(t)]],[document.documentElement]):new Rt([[t]],Ot)}function Bt(t){return Ht(k(t).call(document.documentElement))}function jt(t){return"string"==typeof t?new Rt([document.querySelectorAll(t)],[document.documentElement]):new Rt([null==t?[]:M(t)],Ot)}function Pt(){if(!Ft)return null;var t=Ft.nodes()[1].value;if("custom"===Nt&&""!=t){var e=parseInt(t,10);return isNaN(e)?null:e}return null}function zt(){Ut&&Ut.preview_pane&&Ut.preview_pane.setFixedHeight&&Ut.preview_pane.setFixedHeight(Pt())}function Yt(t,e=!1,n=null){if(Nt=t,n||zt(),"custom"===t){let t=parseFloat(n?.width),e=parseFloat(n?.height);t&&(t=Math.round(t),Ft.nodes()[0].value=t,Ht(".preview-holder").style("max-width",t+"px")),e?(e=Math.round(e),Ft.nodes()[1].value=e,Ht("iframe").style("height",e+"px"),Ut.preview_pane.setFixedHeight(e)):zt(),Ht("#editor-custom-inputs").style("opacity",1),Ht(".preview-holder").style("width",Ft.nodes()[0].value+"px").select("iframe").style("width",Ft.nodes()[0].value+"px")}else Ht("#editor-custom-inputs").style("opacity",0),Ht(".preview-holder").attr("style",null).select("iframe").style("width",null);e||Ht(".preview-holder").style("max-width","none"),jt("#preview-menu .preview-mode").classed("selected",(function(){return this.id=="editor-"+t})),Ht("#editor-rotate").classed("active",(function(){return"auto"!==t})),Ht(".row.editor").classed("mobile",(function(){return"mobile"==t})),Ht(".row.editor").classed("tablet",(function(){return"tablet"==t})),Ht(".preview-holder").on("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd transitionend",qt),Mt=t}function $t(t,e){return Ut=t,Ft=jt("#editor-custom-inputs input"),qt(),jt("#preview-menu .preview-mode").on("click",(function(){Yt(this.getAttribute("data-target"))})),Ft.on("change",(function(){Yt(this.getAttribute("data-target"))})),e?Yt("custom",!0,e):Yt("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,Ht(".preview-holder").style("transition","none"),Yt("custom"),document.addEventListener("mousemove",o),document.addEventListener("mouseup",a),i.preventDefault())}function o(n){var i=n.clientX-e,o=t+2*i;r.style.width=o+"px",r.querySelector("iframe").style.width=o-4+"px",qt(),Ut.preview_pane.resize()}function a(){t=r.getBoundingClientRect().width,Ht(".preview-holder").style("transition",null),n.parentElement.parentElement.querySelector("#resize-overlay").classList.remove("dragging"),n.parentElement.classList.remove("dragging"),qt(),Ut.preview_pane.resize(),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)}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&&(Lt="auto"),window.addEventListener("resize",(function(){Mt&&qt(),window.innerWidth<=768?Lt||(Lt=Mt,Yt("auto")):Lt&&(Yt(Lt),Lt=null),Ut.preview_pane.resize()})),{getHeightSetting:Pt,selectPreviewState:Yt}}function qt(){var t=Ht(".preview-holder").node().getBoundingClientRect();Ft.nodes()[0].value=Math.round(t.width),""!==Ft.nodes()[1].value&&"custom"===Nt&&(Ft.nodes()[1].value=Math.round(t.height))}Rt.prototype=It.prototype={constructor:Rt,select:function(t){"function"!=typeof t&&(t=S(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],u=s.length,l=r[i]=new Array(u),c=0;c<u;++c)(o=s[c])&&(a=t.call(o,o.__data__,c,s))&&("__data__"in o&&(a.__data__=o.__data__),l[c]=a);return new Rt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:M(e)}}(t):F(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],u=s.length,l=0;l<u;++l)(a=s[l])&&(r.push(t.call(a,a.__data__,l,s)),i.push(a));return new Rt(r,i)},selectChild:function(t){return this.select(null==t?R:function(t){return function(){return O.call(this.children,t)}}("function"==typeof t?t:U(t)))},selectChildren:function(t){return this.selectAll(null==t?H:function(t){return function(){return I.call(this.children,t)}}("function"==typeof t?t:U(t)))},filter:function(t){"function"!=typeof t&&(t=N(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,u=r[i]=[],l=0;l<s;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&u.push(o);return new Rt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Y);var n,r=e?z:P,i=this._parents,o=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=o.length,s=new Array(a),u=new Array(a),l=new Array(a),c=0;c<a;++c){var d=i[c],f=o[c],p=f.length,h=M(t.call(d,d&&d.__data__,c,i)),m=h.length,g=u[c]=new Array(m),v=s[c]=new Array(m);r(d,f,g,v,l[c]=new Array(p),h,e);for(var y,_,b=0,w=0;b<m;++b)if(y=g[b]){for(b>=w&&(w=b+1);!(_=v[w])&&++w<m;);y._next=_||null}}return(s=new Rt(s,i))._enter=u,s._exit=l,s},enter:function(){return new Rt(this._enter||this._groups.map(B),this._parents)},exit:function(){return new Rt(this._exit||this._groups.map(B),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(i=e(i)),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){if(!(t instanceof Rt))throw new Error("invalid merge");for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u,l=e[s],c=n[s],d=l.length,f=a[s]=new Array(d),p=0;p<d;++p)(u=l[p]||c[p])&&(f[p]=u);for(;s<r;++s)a[s]=e[s];return new Rt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=$);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],u=s.length,l=i[o]=new Array(u),c=0;c<u;++c)(a=s[c])&&(l[c]=a);l.sort(e)}return new Rt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=A(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?V:q:"function"==typeof e?n.local?Z:X:n.local?G:W)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?K:"function"==typeof e?tt:Q)(t,e,null==n?"":n)):et(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?nt:"function"==typeof e?it:rt)(t,e)):this.node()[t]},classed:function(t,e){var n=ot(t+"");if(arguments.length<2){for(var r=at(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?ft:e?ct:dt)(n,e))},text:function(t){return arguments.length?this.each(null==t?pt:("function"==typeof t?mt:ht)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?gt:("function"==typeof t?yt:vt)(t)):this.node().innerHTML},raise:function(){return this.each(_t)},lower:function(){return this.each(bt)},append:function(t){var e="function"==typeof t?t:k(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:k(t),r=null==e?wt:"function"==typeof e?e:S(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(xt)},clone:function(t){return this.select(t?At:Tt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?Et:Ct,r=0;r<a;++r)this.each(s(o[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<a;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value},dispatch:function(t,e){return this.each(("function"==typeof e?St:Dt)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Vt=Object.hasOwnProperty,Wt=Object.setPrototypeOf,Gt=Object.isFrozen,Xt=Object.getPrototypeOf,Zt=Object.getOwnPropertyDescriptor,Jt=Object.freeze,Kt=Object.seal,Qt=Object.create,te="undefined"!=typeof Reflect&&Reflect,ee=te.apply,ne=te.construct;ee||(ee=function(t,e,n){return t.apply(e,n)}),Jt||(Jt=function(t){return t}),Kt||(Kt=function(t){return t}),ne||(ne=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 re,ie=he(Array.prototype.forEach),oe=he(Array.prototype.pop),ae=he(Array.prototype.push),se=he(String.prototype.toLowerCase),ue=he(String.prototype.match),le=he(String.prototype.replace),ce=he(String.prototype.indexOf),de=he(String.prototype.trim),fe=he(RegExp.prototype.test),pe=(re=TypeError,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return ne(re,e)});function he(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 ee(t,e,r)}}function me(t,e){Wt&&Wt(t,null);for(var n=e.length;n--;){var r=e[n];if("string"==typeof r){var i=se(r);i!==r&&(Gt(e)||(e[n]=i),r=i)}t[r]=!0}return t}function ge(t){var e=Qt(null),n=void 0;for(n in t)ee(Vt,t,[n])&&(e[n]=t[n]);return e}function ve(t,e){for(;null!==t;){var n=Zt(t,e);if(n){if(n.get)return he(n.get);if("function"==typeof n.value)return he(n.value)}t=Xt(t)}return function(t){return console.warn("fallback value for",t),null}}var ye=Jt(["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"]),_e=Jt(["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"]),be=Jt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),we=Jt(["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"]),xe=Jt(["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"]),Te=Jt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ae=Jt(["#text"]),Ce=Jt(["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"]),Ee=Jt(["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"]),ke=Jt(["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"]),De=Jt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Se=Kt(/\{\{[\s\S]*|[\s\S]*\}\}/gm),Me=Kt(/<%[\s\S]*|[\s\S]*%>/gm),Le=Kt(/^data-[\-\w.\u00B7-\uFFFF]/),Fe=Kt(/^aria-[\-\w]+$/),Ne=Kt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ue=Kt(/^(?:\w+script|data):/i),Oe=Kt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Re="function"==typeof Symbol&&"symbol"==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 Ie(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 He=function(){return"undefined"==typeof window?null:window};var Be,je,Pe=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:He(),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,o=e.DocumentFragment,a=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,g=u.prototype,v=ve(g,"cloneNode"),y=ve(g,"nextSibling"),_=ve(g,"childNodes"),b=ve(g,"parentNode");if("function"==typeof a){var w=i.createElement("template");w.content&&w.content.ownerDocument&&(i=w.content.ownerDocument)}var x=function(t,e){if("object"!==(void 0===t?"undefined":Re(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}}(m,r),T=x&&tt?x.createHTML(""):"",A=i,C=A.implementation,E=A.createNodeIterator,k=A.createDocumentFragment,D=r.importNode,S={};try{S=ge(i).documentMode?i.documentMode:{}}catch(t){}var M={};n.isSupported="function"==typeof b&&C&&void 0!==C.createHTMLDocument&&9!==S;var L=Se,F=Me,N=Le,U=Fe,O=Ue,R=Oe,I=Ne,H=null,B=me({},[].concat(Ie(ye),Ie(_e),Ie(be),Ie(xe),Ie(Ae))),j=null,P=me({},[].concat(Ie(Ce),Ie(Ee),Ie(ke),Ie(De))),z=null,Y=null,$=!0,q=!0,V=!1,W=!1,G=!1,X=!1,Z=!1,J=!1,K=!1,Q=!0,tt=!1,et=!0,nt=!0,rt=!1,it={},ot=me({},["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"]),at=null,st=me({},["audio","video","img","source","image","track"]),ut=null,lt=me({},["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"),gt=function(t){ht&&ht===t||(t&&"object"===(void 0===t?"undefined":Re(t))||(t={}),t=ge(t),H="ALLOWED_TAGS"in t?me({},t.ALLOWED_TAGS):B,j="ALLOWED_ATTR"in t?me({},t.ALLOWED_ATTR):P,ut="ADD_URI_SAFE_ATTR"in t?me(ge(lt),t.ADD_URI_SAFE_ATTR):lt,at="ADD_DATA_URI_TAGS"in t?me(ge(st),t.ADD_DATA_URI_TAGS):st,z="FORBID_TAGS"in t?me({},t.FORBID_TAGS):{},Y="FORBID_ATTR"in t?me({},t.FORBID_ATTR):{},it="USE_PROFILES"in t&&t.USE_PROFILES,$=!1!==t.ALLOW_ARIA_ATTR,q=!1!==t.ALLOW_DATA_ATTR,V=t.ALLOW_UNKNOWN_PROTOCOLS||!1,W=t.SAFE_FOR_TEMPLATES||!1,G=t.WHOLE_DOCUMENT||!1,J=t.RETURN_DOM||!1,K=t.RETURN_DOM_FRAGMENT||!1,Q=!1!==t.RETURN_DOM_IMPORT,tt=t.RETURN_TRUSTED_TYPE||!1,Z=t.FORCE_BODY||!1,et=!1!==t.SANITIZE_DOM,nt=!1!==t.KEEP_CONTENT,rt=t.IN_PLACE||!1,I=t.ALLOWED_URI_REGEXP||I,pt=t.NAMESPACE||pt,W&&(q=!1),K&&(J=!0),it&&(H=me({},[].concat(Ie(Ae))),j=[],!0===it.html&&(me(H,ye),me(j,Ce)),!0===it.svg&&(me(H,_e),me(j,Ee),me(j,De)),!0===it.svgFilters&&(me(H,be),me(j,Ee),me(j,De)),!0===it.mathMl&&(me(H,xe),me(j,ke),me(j,De))),t.ADD_TAGS&&(H===B&&(H=ge(H)),me(H,t.ADD_TAGS)),t.ADD_ATTR&&(j===P&&(j=ge(j)),me(j,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&me(ut,t.ADD_URI_SAFE_ATTR),nt&&(H["#text"]=!0),G&&me(H,["html","head","body"]),H.table&&(me(H,["tbody"]),delete z.tbody),Jt&&Jt(t),ht=t)},vt=me({},["mi","mo","mn","ms","mtext"]),yt=me({},["foreignobject","desc","title","annotation-xml"]),_t=me({},_e);me(_t,be),me(_t,we);var bt=me({},xe);me(bt,Te);var wt=function(t){ae(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=T}catch(e){t.remove()}}},xt=function(t,e){try{ae(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){ae(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!j[t])if(J||K)try{wt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Tt=function(t){var e=void 0,n=void 0;if(Z)t="<remove></remove>"+t;else{var r=ue(t,/^[\r\n\t ]+/);n=r&&r[0]}var o=x?x.createHTML(t):t;if(pt===ft)try{e=(new h).parseFromString(o,"text/html")}catch(t){}e&&e.documentElement||((e=C.createDocument(pt,"template",null)).documentElement.innerHTML=o);var a=e.body||e.documentElement;return t&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),G?e.documentElement:a},At=function(t){return E.call(t.ownerDocument||t,t,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,(function(){return l.FILTER_ACCEPT}),!1)},Ct=function(t){return"object"===(void 0===s?"undefined":Re(s))?t instanceof s:t&&"object"===(void 0===t?"undefined":Re(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},Et=function(t,e,r){M[t]&&ie(M[t],(function(t){t.call(n,e,r,ht)}))},kt=function(t){var e,r=void 0;if(Et("beforeSanitizeElements",t,null),!((e=t)instanceof f||e instanceof p||"string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof d&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore))return wt(t),!0;if(ue(t.nodeName,/[\u0080-\uFFFF]/))return wt(t),!0;var i=se(t.nodeName);if(Et("uponSanitizeElement",t,{tagName:i,allowedTags:H}),!Ct(t.firstElementChild)&&(!Ct(t.content)||!Ct(t.content.firstElementChild))&&fe(/<[/\w]/g,t.innerHTML)&&fe(/<[/\w]/g,t.textContent))return wt(t),!0;if(!H[i]||z[i]){if(nt&&!ot[i]){var o=b(t)||t.parentNode,a=_(t)||t.childNodes;if(a&&o)for(var s=a.length-1;s>=0;--s)o.insertBefore(v(a[s],!0),y(t))}return wt(t),!0}return t instanceof u&&!function(t){var e=b(t);e&&e.tagName||(e={namespaceURI:ft,tagName:"template"});var n=se(t.tagName),r=se(e.tagName);if(t.namespaceURI===dt)return e.namespaceURI===ft?"svg"===n:e.namespaceURI===ct?"svg"===n&&("annotation-xml"===r||vt[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&&!vt[r])return!1;var i=me({},["title","style","font","a","script"]);return!bt[n]&&(i[n]||!_t[n])}return!1}(t)?(wt(t),!0):"noscript"!==i&&"noembed"!==i||!fe(/<\/no(script|embed)/i,t.innerHTML)?(W&&3===t.nodeType&&(r=t.textContent,r=le(r,L," "),r=le(r,F," "),t.textContent!==r&&(ae(n.removed,{element:t.cloneNode()}),t.textContent=r)),Et("afterSanitizeElements",t,null),!1):(wt(t),!0)},Dt=function(t,e,n){if(et&&("id"===e||"name"===e)&&(n in i||n in mt))return!1;if(q&&fe(N,e));else if($&&fe(U,e));else{if(!j[e]||Y[e])return!1;if(ut[e]);else if(fe(I,le(n,R,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==ce(n,"data:")||!at[t]){if(V&&!fe(O,le(n,R,"")));else if(n)return!1}else;}return!0},St=function(t){var e=void 0,r=void 0,i=void 0,o=void 0;Et("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j};for(o=a.length;o--;){var u=e=a[o],l=u.name,c=u.namespaceURI;if(r=de(e.value),i=se(l),s.attrName=i,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,Et("uponSanitizeAttribute",t,s),r=s.attrValue,!s.forceKeepAttr&&(xt(l,t),s.keepAttr))if(fe(/\/>/i,r))xt(l,t);else{W&&(r=le(r,L," "),r=le(r,F," "));var d=t.nodeName.toLowerCase();if(Dt(d,i,r))try{c?t.setAttributeNS(c,l,r):t.setAttribute(l,r),oe(n.removed)}catch(t){}}}Et("afterSanitizeAttributes",t,null)}},Mt=function t(e){var n=void 0,r=At(e);for(Et("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)Et("uponSanitizeShadowNode",n,null),kt(n)||(n.content instanceof o&&t(n.content),St(n));Et("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(t,i){var a=void 0,u=void 0,l=void 0,c=void 0,d=void 0;if(t||(t="\x3c!--\x3e"),"string"!=typeof t&&!Ct(t)){if("function"!=typeof t.toString)throw pe("toString is not a function");if("string"!=typeof(t=t.toString()))throw pe("dirty is not a string, aborting")}if(!n.isSupported){if("object"===Re(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof t)return e.toStaticHTML(t);if(Ct(t))return e.toStaticHTML(t.outerHTML)}return t}if(X||gt(i),n.removed=[],"string"==typeof t&&(rt=!1),rt);else if(t instanceof s)1===(u=(a=Tt("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===u.nodeName||"HTML"===u.nodeName?a=u:a.appendChild(u);else{if(!J&&!W&&!G&&-1===t.indexOf("<"))return x&&tt?x.createHTML(t):t;if(!(a=Tt(t)))return J?null:T}a&&Z&&wt(a.firstChild);for(var f=At(rt?t:a);l=f.nextNode();)3===l.nodeType&&l===c||kt(l)||(l.content instanceof o&&Mt(l.content),St(l),c=l);if(c=null,rt)return t;if(J){if(K)for(d=k.call(a.ownerDocument);a.firstChild;)d.appendChild(a.firstChild);else d=a;return Q&&(d=D.call(r,d,!0)),d}var p=G?a.outerHTML:a.innerHTML;return W&&(p=le(p,L," "),p=le(p,F," ")),x&&tt?x.createHTML(p):p},n.setConfig=function(t){gt(t),X=!0},n.clearConfig=function(){ht=null,X=!1},n.isValidAttribute=function(t,e,n){ht||gt({});var r=se(t),i=se(e);return Dt(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&(M[t]=M[t]||[],ae(M[t],e))},n.removeHook=function(t){M[t]&&oe(M[t])},n.removeHooks=function(t){M[t]&&(M[t]=[])},n.removeAllHooks=function(){M={}},n}(),ze=25,Ye=10,$e=10,qe={};function Ve(t,e,n,r,i,o,a){var s=n-t/2-$e,u=n+t/2+$e,l=t/2+Math.min(0,s-i.left)+Math.max(0,u-i.right);return{pos:[l,a],shape:l-Ye<5?[-l,-15*o,Math.max(Ye,5-l),-10*o]:l+Ye>t-5?[Math.min(-10,t-l-5),-10*o,Math.min(Ye,t-l),-15*o]:[-10,-10*o,Ye,-10*o]}}function We(t,e,n,r,i,o,a){var s=r-e/2-$e,u=r+e/2+$e,l=e/2+Math.min(0,s-i.top)+Math.max(0,u-i.bottom);return{pos:[a,l],shape:l-Ye<5?[-15*o,-l,-10*o,Math.max(Ye,5-l)]:l+Ye>e-5?[-10*o,Math.min(-10,e-l-5),-15*o,Math.min(Ye,e-l)]:[-10*o,-10,-10*o,Ye]}}function Ge(t,e,n,r,i,o){var a=qe[t](e,n,r,i,o),s=r-ze-a.pos[0],u=i-ze-a.pos[1];return{left:s,top:u,right:s+e+2*ze,bottom:u+n+2*ze}}function Xe(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 o=i.style;if(n)for(r in n)o[r]=n[r];return i}function Ze(){return Be||((Be=document.createElement("div")).id="flourish-popup-constrainer",(je=Be.style).overflow="hidden",je.pointerEvents="none",je.position="absolute",je.left="0",je.top="0",je.margin="0",je.padding="0",document.body.appendChild(Be),this._resizeConstrainer(),Be)}qe.bottom=function(t,e){return{shape:[-10,-10,Ye,-10],pos:[t/2,e+$e]}},qe.top=function(t,e){return{shape:[-10,$e,Ye,$e],pos:[t/2,-10]}},qe.left=function(t,e){return{shape:[$e,Ye,$e,-10],pos:[-10,e/2]}},qe.right=function(t,e){return{shape:[-10,Ye,-10,-10],pos:[t+$e,e/2]}},qe.topLeft=function(t,e){return{shape:[15,$e,$e,15],pos:[-10,-10]}},qe.bottomLeft=function(t,e){return{shape:[15,-10,$e,-15],pos:[-10,e+$e]}},qe.topRight=function(t,e){return{shape:[-15,$e,-10,15],pos:[t+$e,-10]}},qe.bottomRight=function(t,e){return{shape:[-15,-10,-10,-15],pos:[t+$e,e+$e]}},qe.bottomFlexible=function(t,e,n,r,i){return Ve(t,0,n,0,i,1,e+$e)},qe.topFlexible=function(t,e,n,r,i){return Ve(t,0,n,0,i,-1,-10)},qe.rightFlexible=function(t,e,n,r,i){return We(0,e,0,r,i,1,t+$e)},qe.leftFlexible=function(t,e,n,r,i){return We(0,e,0,r,i,-1,-10)};var Je,Ke=1,Qe={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 tn(){for(var t in this.unique_id=Ke++,this.is_visible=!0,Qe)this["_"+t]=Qe[t];this.handlers={click:[]}}function en(t){tn.prototype[t]=function(e){return void 0===e?this["_"+t]:(this["_"+t]=e,this)}}for(var nn in Qe)en(nn);function rn(){return new tn}function on(){Je=rn().container(document.body),function(t){t.each((function(){var t=Ht(this);if(t.attr("data-popup-allow-interaction")&&!t.select(".popup-content-wrapper").size()){var e=t.append("span").attr("class","popup-content-wrapper").style("display","none").append("span").attr("class","popup-content-outer");e.append("span").attr("class","popup-content-inner"),e.append("span").attr("class","popup-content-arrow")}Ht(this).on("mouseenter focus",(function(t){an.call(this,t,!0)})).on("mouseover",an).on("mouseout focusout",sn)}))}(jt(".popup"))}function an(t,e){if(this.getAttribute("data-popup-head")||this.getAttribute("data-popup-body")){var n=this.getAttribute("data-popup-allow-interaction"),r=this.getAttribute("data-popup-position"),i=this.getBoundingClientRect(),o=i.left+i.width/2,a=i.top+i.height,s=this.getAttribute("data-popup-head")||null,u=this.getAttribute("data-popup-body")||null,l="";if(s&&(l+=Bt("span").classed("popup-content-header",!0).html(Pe.sanitize(s)).node().outerHTML),u&&(l+=Bt("span").classed("popup-content-body",!0).html(Pe.sanitize(u)).node().outerHTML),n){r&&["top","bottom"].includes(r)||(r="top");Ht(this).select(".popup-content-outer").style("display","inline-block"),Ht(this).select(".popup-content-inner").style("display","inline-block"),Ht(this).select(".popup-content-wrapper").style("display","block").style("bottom","top"==r?i.height-4+"px":null).style("top","bottom"==r?i.height-4+"px":null),e&&Ht(this).select(".popup-content-inner").html(l);var c=this.getAttribute("data-popup-constrainer")||"body",d=Ht(c).size()?Ht(c).node().getBoundingClientRect():document.body,f=Ht(this).select(".popup-content-inner").node().getBoundingClientRect().width,p=o,h=-f/2,m=p+f/2-(d.right-15),g=d.left+15-(p-f/2);m>0?h-=m:g>0&&(h+=g),Ht(this).select(".popup-content-wrapper").style("left",i.width/2+h+"px");Ht(this).select(".popup-content-arrow").style("left",-5+Math.abs(h)+"px")}else{var v=["top","topFlexible"];r&&("left"===r?(v=["right","rightFlexible"],o=i.left,a=i.top+i.height/2):"right"===r?(v=["left","leftFlexible"],o=i.right,a=i.top+i.height/2):"top"===r?(v=["bottom","bottomFlexible"],o=i.left+i.width/2,a=i.top):"bottom"===r&&(v=["top","topFlexible"],o=i.left+i.width/2,a=i.top+i.height)),Je.point(o,a).html(l).directions(v).draw()}}}function sn(t){document.activeElement===this||this.contains(t.relatedTarget)||(this.getAttribute("data-popup-allow-interaction")&&Ht(this).select(".popup-content-wrapper").style("display","none"),Je.hide())}tn.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},tn.prototype.directions=function(t){return void 0===t?this._directions:("string"==typeof t&&(t=[t]),this._directions=t.slice(),this)},tn.prototype.text=function(t){return this._html=function(t){return t.replace(/[&<>]/g,(function(t){return{"&":"&amp;","<":"&lt;",">":"&gt;"}[t]}))}(t),this},tn.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},tn.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},tn.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=Xe("svg",{class:"flourish-popup-svg"},{position:"absolute",top:0,left:0,bottom:0,right:0}),o=Xe("filter",{id:"dropshadow-"+t.unique_id,height:"130%"});o.appendChild(Xe("feGaussianBlur",{in:"SourceAlpha",stdDeviation:5})),o.appendChild(Xe("feOffset",{dx:0,dy:2,result:"offsetblur"}));var a=Xe("feComponentTransfer");a.appendChild(Xe("feFuncA",{type:"linear",slope:.2})),o.appendChild(a);var s=Xe("feMerge");o.appendChild(s),s.appendChild(Xe("feMergeNode")),s.appendChild(Xe("feMergeNode",{in:"SourceGraphic"})),i.appendChild(o);var u=Xe("g",{filter:"url(#dropshadow-"+t.unique_id+")",fill:"white",stroke:"none"});u.appendChild(Xe("rect",{x:ze,y:ze,rx:5})),u.appendChild(Xe("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=ze+"px",r.padding="10px",n.appendChild(l),t._getConstrainer().appendChild(n)}return t._resizeConstrainer(),n},tn.prototype._getConstrainer=Ze,tn.prototype._resizeConstrainer=function(){Be||Ze.call(this);var t=je.display;je.display="none",je.width=document.documentElement.scrollWidth+"px",je.height=document.documentElement.scrollHeight+"px",je.display=t},tn.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 o=n-e.left,a=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,g=p.getBoundingClientRect();do{h=Math.ceil(g.width),m=Math.ceil(g.height),u.width=h+2*ze+"px",u.height=m+2*ze+"px",g=p.getBoundingClientRect()}while(h!=Math.ceil(g.width)||m!=Math.ceil(g.height));d.setAttribute("width",h),d.setAttribute("height",m),l.setAttribute("width",h+2*ze),l.setAttribute("height",m+2*ze);for(var v,y,_=ze-$e,b=null,w=null,x=null,T=1/0,A=1/0,C=0;C<t._directions.length;C++){var E=t._directions[C],k=Ge(E,h,m,n,r,i),D=Math.max(0,Math.floor(i.left)-k.left-_)+Math.max(0,k.right-Math.ceil(i.right)-_),S=Math.max(0,Math.floor(i.top)-k.top-_)+Math.max(0,k.bottom-Math.ceil(i.bottom)-_);if(0==D&&0==S){b=E;break}(D<T||D==T&&S<v)&&(T=D,v=S,w=E),(S<A||S==A&&D<y)&&(A=S,y=D,x=E)}return b?E=b:"horizontal"==t._fallbackFit?E=w:"vertical"==t._fallbackFit?E=x:(console.warn("Popup: failed to point box of size ("+h+", "+m+") at ("+n+", "+r+") within ("+i.left+", "+i.top+", "+i.right+", "+i.bottom+")"),E=t._directions[0]),function(t,e,n,r,i,o,a,s,u,l){var c=qe[t](r,i,s,u,l);e.left=o-ze-c.pos[0]+"px",e.top=a-ze-c.pos[1]+"px",n.setAttribute("d","M0,0L"+c.shape.join(",")+"Z"),n.setAttribute("transform","translate("+(c.pos[0]+ze)+","+(c.pos[1]+ze)+")")}(E,u,f,h,m,o,a,n,r,i),t}console.error("Popup: cannot draw popup till point() has been specified")},tn.prototype.hide=function(){return this.is_visible?(this.is_visible=!1,this._getElement().style.display="none",this):this},rn.version="2.1.5";const un=Math.pow(2,31)-1,ln=Math.pow(2,15);function cn(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{hn(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>un&&console.warn("Column index out of range"),Math.min(n-1,un)}function dn(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 fn(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=cn(n),o=cn(r),a=[],s=o>=i?1:-1,u=Math.abs(o-i)+1;u>ln&&(console.warn("Truncating excessively long range"),u=ln);for(var l=0;l<u;l++)a.push(i+l*s);return a}function pn(t,e){return dn(t)+"-"+dn(e)}function hn(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(cn(i)):Array.prototype.push.apply(e,fn(i))}return e}function mn(t){for(var e=function(t){if(!t.length)return[];for(var e=[],n=t[0],r=t[0],i=null,o=0;o<t.length-1;o++){var a=t[o+1]-t[o];null!==i||1!==Math.abs(a)?a!==i?(e.push([n,r]),n=r=t[o+1],i=null):r=t[o+1]:(r=t[o+1],i=a)}return e.push([n,r]),e}(t),n=[],r=0;r<e.length;r++){var i=e[r];i[0]==i[1]?n.push(dn(i[0])):n.push(pn(i[0],i[1]))}return n.join(",")}function gn(t,e,n,r){if("column"in t)return""+dn(t.column);if("columns"in t)return""+mn(t.columns);if(r)return"";throw new Error("Data binding must have .column or .columns")}var vn=new Date,yn=new Date;function _n(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,o){var a,s=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return s},i.filter=function(n){return _n((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 vn.setTime(+e),yn.setTime(+r),t(vn),t(yn),Math.floor(n(vn,yn))},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 bn=864e5,wn=6048e5,xn=_n((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()))/bn}),(function(t){return t.getDate()-1}));function Tn(t){return _n((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()))/wn}))}xn.range;var An=Tn(0),Cn=Tn(1),En=Tn(2),kn=Tn(3),Dn=Tn(4),Sn=Tn(5),Mn=Tn(6);An.range,Cn.range,En.range,kn.range,Dn.range,Sn.range,Mn.range;var Ln=_n((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()}));Ln.every=function(t){return isFinite(t=Math.floor(t))&&t>0?_n((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},Ln.range;var Fn=_n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/bn}),(function(t){return t.getUTCDate()-1}));function Nn(t){return _n((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)/wn}))}Fn.range;var Un=Nn(0),On=Nn(1),Rn=Nn(2),In=Nn(3),Hn=Nn(4),Bn=Nn(5),jn=Nn(6);Un.range,On.range,Rn.range,In.range,Hn.range,Bn.range,jn.range;var Pn=_n((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 zn(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 Yn(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 $n(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}Pn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?_n((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},Pn.range;var qn,Vn,Wn,Gn={"-":"",_:" ",0:"0"},Xn=/^\s*\d+/,Zn=/^%/,Jn=/[\\^$*+?|[\]().{}]/g;function Kn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function Qn(t){return t.replace(Jn,"\\$&")}function tr(t){return new RegExp("^(?:"+t.map(Qn).join("|")+")","i")}function er(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function nr(t,e,n){var r=Xn.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function rr(t,e,n){var r=Xn.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function ir(t,e,n){var r=Xn.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function or(t,e,n){var r=Xn.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function ar(t,e,n){var r=Xn.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function sr(t,e,n){var r=Xn.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function ur(t,e,n){var r=Xn.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function lr(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 cr(t,e,n){var r=Xn.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function dr(t,e,n){var r=Xn.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function fr(t,e,n){var r=Xn.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function pr(t,e,n){var r=Xn.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function hr(t,e,n){var r=Xn.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function mr(t,e,n){var r=Xn.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function gr(t,e,n){var r=Xn.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function vr(t,e,n){var r=Xn.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function yr(t,e,n){var r=Xn.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function _r(t,e,n){var r=Zn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function br(t,e,n){var r=Xn.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function wr(t,e,n){var r=Xn.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function xr(t,e){return Kn(t.getDate(),e,2)}function Tr(t,e){return Kn(t.getHours(),e,2)}function Ar(t,e){return Kn(t.getHours()%12||12,e,2)}function Cr(t,e){return Kn(1+xn.count(Ln(t),t),e,3)}function Er(t,e){return Kn(t.getMilliseconds(),e,3)}function kr(t,e){return Er(t,e)+"000"}function Dr(t,e){return Kn(t.getMonth()+1,e,2)}function Sr(t,e){return Kn(t.getMinutes(),e,2)}function Mr(t,e){return Kn(t.getSeconds(),e,2)}function Lr(t){var e=t.getDay();return 0===e?7:e}function Fr(t,e){return Kn(An.count(Ln(t)-1,t),e,2)}function Nr(t){var e=t.getDay();return e>=4||0===e?Dn(t):Dn.ceil(t)}function Ur(t,e){return t=Nr(t),Kn(Dn.count(Ln(t),t)+(4===Ln(t).getDay()),e,2)}function Or(t){return t.getDay()}function Rr(t,e){return Kn(Cn.count(Ln(t)-1,t),e,2)}function Ir(t,e){return Kn(t.getFullYear()%100,e,2)}function Hr(t,e){return Kn((t=Nr(t)).getFullYear()%100,e,2)}function Br(t,e){return Kn(t.getFullYear()%1e4,e,4)}function jr(t,e){var n=t.getDay();return Kn((t=n>=4||0===n?Dn(t):Dn.ceil(t)).getFullYear()%1e4,e,4)}function Pr(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Kn(e/60|0,"0",2)+Kn(e%60,"0",2)}function zr(t,e){return Kn(t.getUTCDate(),e,2)}function Yr(t,e){return Kn(t.getUTCHours(),e,2)}function $r(t,e){return Kn(t.getUTCHours()%12||12,e,2)}function qr(t,e){return Kn(1+Fn.count(Pn(t),t),e,3)}function Vr(t,e){return Kn(t.getUTCMilliseconds(),e,3)}function Wr(t,e){return Vr(t,e)+"000"}function Gr(t,e){return Kn(t.getUTCMonth()+1,e,2)}function Xr(t,e){return Kn(t.getUTCMinutes(),e,2)}function Zr(t,e){return Kn(t.getUTCSeconds(),e,2)}function Jr(t){var e=t.getUTCDay();return 0===e?7:e}function Kr(t,e){return Kn(Un.count(Pn(t)-1,t),e,2)}function Qr(t){var e=t.getUTCDay();return e>=4||0===e?Hn(t):Hn.ceil(t)}function ti(t,e){return t=Qr(t),Kn(Hn.count(Pn(t),t)+(4===Pn(t).getUTCDay()),e,2)}function ei(t){return t.getUTCDay()}function ni(t,e){return Kn(On.count(Pn(t)-1,t),e,2)}function ri(t,e){return Kn(t.getUTCFullYear()%100,e,2)}function ii(t,e){return Kn((t=Qr(t)).getUTCFullYear()%100,e,2)}function oi(t,e){return Kn(t.getUTCFullYear()%1e4,e,4)}function ai(t,e){var n=t.getUTCDay();return Kn((t=n>=4||0===n?Hn(t):Hn.ceil(t)).getUTCFullYear()%1e4,e,4)}function si(){return"+0000"}function ui(){return"%"}function li(t){return+t}function ci(t){return Math.floor(+t/1e3)}function di(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function fi(t){return function(e){return"string"!=typeof e&&di(e),(e=e.trim())?t(e):null}}qn=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,u=t.shortMonths,l=tr(i),c=er(i),d=tr(o),f=er(o),p=tr(a),h=er(a),m=tr(s),g=er(s),v=tr(u),y=er(u),_={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:xr,e:xr,f:kr,g:Hr,G:jr,H:Tr,I:Ar,j:Cr,L:Er,m:Dr,M:Sr,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:li,s:ci,S:Mr,u:Lr,U:Fr,V:Ur,w:Or,W:Rr,x:null,X:null,y:Ir,Y:Br,Z:Pr,"%":ui},b={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:zr,e:zr,f:Wr,g:ii,G:ai,H:Yr,I:$r,j:qr,L:Vr,m:Gr,M:Xr,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:li,s:ci,S:Zr,u:Jr,U:Kr,V:ti,w:ei,W:ni,x:null,X:null,y:ri,Y:oi,Z:si,"%":ui},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=v.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=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:fr,e:fr,f:yr,g:ur,G:sr,H:hr,I:hr,j:pr,L:vr,m:dr,M:mr,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:cr,Q:br,s:wr,S:gr,u:rr,U:ir,V:or,w:nr,W:ar,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:ur,Y:sr,Z:lr,"%":_r};function x(t,e){return function(n){var r,i,o,a=[],s=-1,u=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++s<l;)37===t.charCodeAt(s)&&(a.push(t.slice(u,s)),null!=(i=Gn[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),u=s+1);return a.push(t.slice(u,s)),a.join("")}}function T(t,e){return function(n){var r,i,o=$n(1900,void 0,1);if(A(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Yn($n(o.y,0,1))).getUTCDay(),r=i>4||0===i?On.ceil(r):On(r),r=Fn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=zn($n(o.y,0,1))).getDay(),r=i>4||0===i?Cn.ceil(r):Cn(r),r=xn.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Yn($n(o.y,0,1)).getUTCDay():zn($n(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Yn(o)):zn(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,u=n.length;a<s;){if(r>=u)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in Gn?e.charAt(a++):i])||(r=o(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=T(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=T(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"]}),qn.format,qn.parse,Vn=qn.utcFormat,Wn=qn.utcParse;var pi=new Date(1972,3,27,19,45,5),hi={"%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 mi(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function gi(t,e){var n,r=Wn(t),i=Vn(t);return n=fi("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:fi((function(e){return r(e)||(hi[t]?mi(hi[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(pi)})}var vi=Object.freeze([gi("%Y-%m-%dT%H:%M:%S.%LZ"),gi("%Y-%m-%d %H:%M:%S"),gi("%Y-%m-%dT%H:%M:%S"),gi("%Y-%m-%dT%H:%M:%SZ"),gi("%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})),gi("%d/%m/%Y %H:%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&&n[2]>=1e3&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),gi("%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])})),gi("%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})),gi("%m/%d/%Y %H:%M",(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&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),gi("%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])})),gi("%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})),gi("%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})),gi("%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])})),gi("%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})),gi("%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])})),gi("%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})),gi("%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])})),gi("%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})),gi("%Y-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),gi("%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})),gi("%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})),gi("%d %b %y"),gi("%-d %b ’%y"),gi("%d %B %y"),gi("%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})),gi("%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})),gi("%d-%b-%y"),gi("%d-%B-%y"),gi("%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})),gi("%m/%y"),gi("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),gi("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),gi("%b-%y"),gi("%b %y"),gi("%B %y"),gi("%b '%y"),gi("%B %-d %Y"),gi("%d %b",(function(t,e){return!!e||!!mi(hi["%d %b"])(t)})),gi("%d %B"),gi("%b %d",(function(t,e){return!!e||!!mi(hi["%b %d"])(t)})),gi("%B %d"),gi("%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})),gi("%m-%d"),gi("%d/%m"),gi("%m/%d"),gi("%b %d %Y"),gi("%b %d %Y, %-I.%M%p"),gi("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),gi("%B"),gi("%b"),gi("%X"),gi("%I:%M %p"),gi("%-I.%M%p"),gi("%H:%M",(function(t,e){if(!e)return!1;var n=t.split(":").map(parseFloat);return n[0]>=0&&n[0]<24})),gi("%H:%M:%S"),gi("%M:%S"),gi("%-I%p"),gi("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),gi("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length}))]);function yi(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 _i,bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wi(t){if(!(e=bi.exec(t)))throw new Error("invalid format: "+t);var e;return new xi({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 xi(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 Ti(t,e){var n=yi(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")}wi.prototype=xi.prototype,xi.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 Ai={"%":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 Ti(100*t,e)},r:Ti,s:function(t,e){var n=yi(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(_i=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+yi(t,Math.max(0,e+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Ci(t){return t}var Ei=Array.prototype.map,ki=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Di(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ci:(e=Ei.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Ci:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Ei.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=wi(t)).fill,n=t.align,d=t.sign,f=t.symbol,p=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):Ai[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",b="$"===f?o:/[%p]/.test(y)?u:"",w=Ai[y],x=/[defgprs%]/.test(y);function T(t){var i,o,u,f=_,T=b;if("c"===y)T=w(t)+T,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),g),v&&(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)),A&&0==+t&&"+"!==d&&(A=!1),f=(A?"("===d?d:l:"-"===d||"("===d?"":d)+f,T=("s"===y?ki[8+_i/3]:"")+T+(A&&"("===d?")":""),x)for(i=-1,o=t.length;++i<o;)if(48>(u=t.charCodeAt(i))||u>57){T=(46===u?a+t.slice(i+1):t.slice(i))+T,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var C=f.length+t.length+T.length,E=C<h?new Array(h-C+1).join(e):"";switch(m&&p&&(t=r(E+t,E.length?h-T.length:1/0),E=""),n){case"<":t=f+t+T+E;break;case"=":t=f+E+t+T;break;case"^":t=E.slice(0,C=E.length>>1)+f+t+T+E.slice(C);break;default:t=E+f+t+T}return s(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),T.toString=function(){return t+""},T}return{format:d,formatPrefix:function(t,e){var n,r=d(((t=wi(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=yi(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=ki[8+i/3];return function(t){return r(o*t)+a}}}}var Si={test:fi((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:fi((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"},Mi={test:fi((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:fi((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"},Li={test:fi((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:fi((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},Fi={test:fi((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:fi((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"},Ni={test:fi((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:fi((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"},Ui={test:fi((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:fi((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},Oi=Object.freeze([Si,Mi,Fi,Ni,Li,Ui]);Oi.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=Di({decimal:t.decimal_mark,thousands:t.thousand_separator,grouping:[3],currency:["",""]});return function(t,i){return null===t?"":(i||(i=",.2f"),i!==n&&(n=i,e=r.format(n)),e(t))}}(t),Object.freeze(t)}));var Ri,Ii=Object.freeze({test:function(t){return"string"==typeof t||di(t)},parse:function(t){return"string"==typeof t?t:di(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),Hi=Object.freeze({datetime:vi,number:Oi}),Bi=Object.freeze(["datetime","number","string"]),ji=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),Pi=Object.freeze(Object.keys(ji));function zi(t,e){return t.index-e.index}function Yi(t,e){return e.n_success-t.n_success||zi(t,e)}function $i(t){return(""+t).trim()}function qi(t){return void 0===t?function(t){return $i(t)}:"function"==typeof t?function(e,n){return $i(t(e,n))}:function(e){return $i(e[""+t])}}function Vi(t){t?Array.isArray(t)||(t=[t]):t=Bi;var e=t.reduce((function(t,e){var n=Hi[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=Pi.reduce((function(t,e){return t[e]=ji[e],t}),{}),i=function(t,i){i=qi(i);var o=t.map(i).filter((function(t){return t}));if(!o.length)return n?[Ii]:[];var a=Math.min(r.n_max,o.length),s=Math.floor(a*r.failure_fraction),u=r.n_failing_values,l=r.sort?Yi:zi,c=e.slice().reduce((function(t,e,n){for(var r=c=0,i=[],l=!1,c=0;c<a;c++){var d=o[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:a-r,index:n}),t}),[]).sort(l).map((function(t){return t.interp}));return n&&c.push(Ii),c};return Pi.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 Wi(t,e,n,r,i){var o=[],a=[],s=0,u=Object.assign([],{column_names:{},metadata:{},timestamps:{}}),l={};function c(t,e){if(!l[t])return{};var n=l[t];return n[e]?n[e]:{}}for(var d in n){var f={},p=n[d];if(p){for(var h=0;h<p.length;h++){var m=p[h].type_id,g=p[h].output_format_id,v=g&&"auto"!==g?g:m;f[p[h].index]={type_id:m,output_format_id:v}}l[d]=f}}var y,_,b,w=function(){if(null===t[x])return"continue";if(void 0===t[x].columns&&void 0===t[x].column)return"continue";if((y=t[x]).template_data_binding=r[x],y.key=x,!(y.data_table_id in e)){for(var n in _=[],e)_.push(n);return console.error("Data table id "+y.data_table_id+" not in "+JSON.stringify(_)),"continue"}var i=e[y.data_table_id];if(null==i)throw new Error("[BUG] The data from the data table with ID ".concat(y.data_table_id," was missing"));if(0==i.length)return console.warn("Empty data table"),"continue";if("columns"in y&&null!=y.columns)b=i[0].length,y.columns=y.columns.filter((function(t){return t<b})),u.column_names[x]=y.columns.map((function(t){return i[0][t]})),u.metadata[x]=y.columns.map((function(t){var e=c(y.data_table_id,t);if("type_id"in e){var n=e.type_id,r=e.output_format_id;return{type:n.split("$")[0],type_id:n,output_format_id:r}}return null}));else{if(!("column"in y)||null==y.column)throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(y));u.column_names[x]=i[0][y.column];var l=c(y.data_table_id,y.column);if("type_id"in l){var d=l.type_id,f=l.output_format_id;u.metadata[x]={type:d.split("$")[0],type_id:d,output_format_id:f}}}-1==a.indexOf(y.data_table_id)&&(a.push(y.data_table_id),s=Math.max(s,i.length-1)),o.push(y)};for(var x in t)w();function T(t,e,n){var r;if(!(null===(r=t.template_data_binding)||void 0===r?void 0:r.data_type))return n;var i=function(t,e){var n=c(t,e);if("type_id"in n)return Vi.getInterpretation(n.type_id)}(t.data_table_id,e);i&&"number"==i.type&&(n=(n||"").replace(/[€£$¥%º]/g,""));var o=i?i.parse(n):n;return Number.isNaN(o)&&(o=null),o}u.timestamps=function(t){var e={},n=t.map((function(t){var e;return null===(e=t.last_updated)||void 0===e?void 0:e.getTime()})).filter(Boolean);if(n.length){var r=Math.max.apply(Math,n);e.last_updated=new Date(r)}return e}(a.map((function(t){return i.per_data_table[t]})));for(var A=0;A<s;A++){for(var C={},E=function(){y=o[k];var t=e[y.data_table_id];if(null==t)throw new Error("[BUG] The data from the data table with ID ".concat(y.data_table_id," was missing"));if(A+1>=t.length)return"continue";if(null==y.key)throw new Error("BUG: 'key' was ".concat(y.key," in ").concat(y));"columns"in y&&null!=y.columns?C[y.key]=y.columns.filter((function(e){return e<t[A+1].length})).map((function(e){return T(y,e,t[A+1][e])})):"column"in y&&null!=y.column&&(y.column>=t[A+1].length?C[y.key]=T(y,y.column,""):C[y.key]=T(y,y.column,t[A+1][y.column]))},k=0;k<o.length;k++)E();u.push(C)}return u}function Gi(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}Vi.DATETIME_IDS=Object.freeze(vi.map((function(t){return t.id}))),Vi.NUMBER_IDS=Object.freeze(Oi.map((function(t){return t.id}))),Vi.STRING_IDS=Object.freeze([Ii.id]),Vi.getInterpretation=(Ri=vi.concat(Oi,Ii).reduce((function(t,e){return t[e.id]=e,t}),{}),function(t){return Ri[t]}),Vi._createAccessorFunction=qi,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 o=e[i];if(t.call(r,o,i,e))return i;i++}return-1},configurable:!0,writable:!0}),Vi().nMax(1/0).nFailingValues(8).failureFraction(.1);let Xi,Zi={};const Ji=t=>{const e=Ht(".dialog");if(t.which in Zi){var n=Zi[t.which];n.callback&&n.callback(Xi.node().value),e.remove(),t.preventDefault()}};function Ki(t,e,{buttons:n=[{text:"Okay",keyCode:13}],is_html:r=!1,upgrade:i=null,is_loading:o=!1,width:a="420px",on_close:s=null}={}){var u=Ht("body").append("div").attr("class","dialog").attr("tabindex",0).on("mousedown",(function(t){for(var e=t.target,n=!1;e&&"dialog"!=e.className;)"dialog"==(e=e.parentNode).className&&(n=!0);n||(s&&s(),u.remove())})),l=u.append("div").attr("class","dialog-inner").style("width",a).on("click",(function(t){t.stopPropagation()})),c=l.append("div").attr("class","text"+(o?" loading":""));if("string"==typeof t?c.append("h1").text(t):t instanceof HTMLElement&&c.append("h1").append((()=>t)),"string"==typeof e)Xi=r?c.append("div").classed("loading-spinner",o).html(e):c.append("p").text(e);else if(e instanceof HTMLElement)Xi=c.append((()=>e));else if("object"==typeof e){if(Xi=c.append(e.type),e.value&&(Xi.node().value=e.value),e.attributes)for(var d in e.attributes)Xi.attr(d,e.attributes[d]);Xi.node().focus()}var f=l;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")}(f=f.append("div").attr("class","upgrade"),i.message,i.list,i.is_business);var p=f.append("div").attr("class","btns"+(o?" loading":""));return Zi={},n.forEach((function(t){var e=p.append(t.tag_name||"div").attr("class","btn").attr("data-testid","dialog-button").style("margin-right",o?"0":"0.75em").text(t.text).on("click",(function(){t.callback&&t.callback(Xi.node().value,u),u.remove()}));t.class&&e.classed(t.class,!0),t.keyCode&&(Zi[t.keyCode]=t),t.href&&e.attr("href",t.href),t.target&&e.attr("target",t.target),t.fa_icon&&e.append("i").lower().attr("class","fa "+t.fa_icon)})),u.node().addEventListener("keydown",Ji),u.node().focus(),u}const Qi={allow_other_option:!1,match_anywhere:!1,custom_renderer:null,autocomplete:!0};function to({input:t,id:e,options:n=[],mode:r="single",options_config:i={}}){if(t&&e){this.input=t,this.id=e,this.mode=["single","multi"].includes(r)?r:"single",this.options=(Array.isArray(n)?n:[n]).map(no),this.selected_options=[],this.options_config={...Qi,...i},this.options_config.allow_other_option&&"multi"===this.mode&&(console.warn("Warning for dropdown "+e+": it's not possible to allow other options in multi mode."),this.options_config.allow_other_option=!1),this.options_config.autocomplete&&"multi"===this.mode&&(console.warn("Warning for dropdown "+e+": autocomplete will be disabled in multi mode."),this.options_config.autocomplete=!1),this.autocomplete=this.initAutocomplete(),this.changeCallback=function(){};var o=this;this.input.type="text",this.input.classList.add("multi"==r?"multi-select":"single-select"),this.input.addEventListener("change",(function(t){o.changeCallback.call(o.input,o.getValue(),t)})),this.setOptions(n),this.options_config.autocomplete||(this.input.setAttribute("readonly",!0),this.input.style.cursor="pointer")}else console.error("Can't initialize a dropdown without input or id")}function eo(t){var e=t.options.filter((e=>t.selected_options.includes(e[1])));return t.selected_options.length&&!e.length&&t.options_config.allow_other_option&&(e=[[t.selected_options[0],t.selected_options[0]]]),e}function no(t){return Array.isArray(t)?t.map(String):[String(t),String(t)]}to.prototype.setSelectedOptions=function(t){this.selected_options=Array.isArray(t)?t:[t],this.updateInput()},to.prototype.setOptions=function(t){this.options=t.map(no),this.autocomplete.renderOptions()},to.prototype.select=function(t){"multi"==this.mode?this.selected_options.push(t):this.selected_options=[t],this.updateInput()},to.prototype.deselect=function(t){if("single"!=this.mode){var e=this.selected_options.indexOf(t);e>-1&&this.selected_options.splice(e,1),this.updateInput()}},to.prototype.getValue=function(t){var e=eo(this).map((t=>t[1]));return"multi"===this.mode?t?e.join(", "):e:e[0]},to.prototype.getOptions=function(){return this.options},to.prototype.getDisplayValue=function(){return eo(this).map((t=>t[0])).join(", ")},to.prototype.updateInput=function(){this.input.value=this.getDisplayValue(),this.input.setAttribute("data-value",this.getValue(!0))},to.prototype.isSelected=function(t){return this.selected_options.includes(t)},to.prototype.onChange=function(t){this.changeCallback=t};to.prototype.initAutocomplete=function(){var t=this,e=this.options_config,n=this.input;if(n.setAttribute("data-autocomplete",this.id),n.setAttribute("autocomplete","off"),!document.getElementById(this.id)){const t=Bt("i").classed("fa fa-chevron-down clickable",!0),e=Bt("div").classed("dropdown autocomplete",!0).attr("id",this.id);n.insertAdjacentHTML("afterend",t.node().outerHTML+e.node().outerHTML)}var r=[],i=Ht(document.getElementById(this.id));i.classed("click-to-open",!0);var o=i.append("div").attr("class","dropdown-list");function a(t){if(1===t.length)return"dropdown-category";var e="dropdown-item";return r.length&&r.includes(t[1])&&(e+=" current"),e}function s(n){var r=n||t.options;o.selectAll("div").remove(),o.selectAll("div").data(r).enter().append("div").attr("class",a).attr("data-value",(function(t){return"string"==typeof t?t||null:t[1]})).each((function(t){const n=Ht(this);if(!e.custom_renderer){const e=Array.isArray(t)?t[0]:t;return void n.text(e)}let r=e.custom_renderer(t,this);if(r){if(Array.isArray(r)||(r=[r]),r.find((t=>"string"!=typeof t&&!(t instanceof HTMLElement))))throw new Error("Autocomplete elements must be strings or HTMLElements");n.node().append(...r)}})),r.length||o.append("div").attr("class","dropdown-item disabled").text("No matches found")}function u(){i.classed("open",!1)}function l(e,r){if(r.hasAttribute("data-value")){var i=r.getAttribute("data-value");Ht(r).classed("current")&&"multi"===t.mode?t.deselect(i):t.select(i),u(),Ht(n).dispatch("change")}else e.preventDefault()}return i.on("mousedown",(function(t){l(t,t.target)})),Ht(n).on("keydown.autocomplete",(function(t){var e,r;9==t.keyCode||13==t.keyCode?(e=o.select(".selected")).empty()||(l(t,e.node()),n.blur()):40==t.keyCode?((e=o.select(".selected")).empty()||(r=e.node().nextSibling),r||(r=o.select(".dropdown-item[data-value]").node()),o.selectAll(".selected").classed("selected",!1),Ht(r).classed("selected",!0)):38==t.keyCode&&((e=o.select(".selected")).empty()||(r=e.node().previousSibling),r||(r=o.select(".dropdown-item:last-child").node()),o.selectAll(".selected").classed("selected",!1),Ht(r).classed("selected",!0))})).on("input.autocomplete",(function(){var r,i,o=n.value,a=o.toLowerCase(),u=!1,l=t.options;if(Ht(n).attr("data-value",o),i=e.match_anywhere?(t,e)=>t.includes(e):(t,e)=>0===t.indexOf(e),o){r=[];for(var c=0;c<l.length;c++){var d=("string"==typeof l[c]?l[c]:l[c][0]).toLowerCase();d==a&&(u=!0),i(d,a)&&r.push(l[c])}e.allow_other_option&&!u&&r.unshift(["Add new value: "+o,o])}else r=l;s(r)})).on("focus.autocomplete",(function(){var e=t.getValue();r=Array.isArray(e)?e:[e],s(t.options),i.classed("open",!0)})).on("blur.autocomplete",u),{renderOptions:s}};var ro={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"}};Vi.STRING_IDS[0];var io,oo,ao,so=[{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"}],uo={},lo={},co=0;function fo(t,e){co=0;var n=!1;t.template_id&&t.dataTables((function(r,i){if(r)return console.error("Failed to get data tables: "+r);lo={};var o=t.dataBindingsForCurrentTemplate(),a=t.getDataTableNames(),s=Ht(".sheet-tab.selected").size()>0?Ht(".sheet-tab.selected").datum().id:null;oo.html("");var u=null;"string"!=typeof e[0]&&(e=["Data"].concat(e));for(var l,c=[],d=0;d<e.length;d++){const t=e[d],n=e[d-1],r=!(!n||"string"==typeof n||n.dataset===t.dataset),i=(t.columns||t.column||"").split("::")[0],s="string"==typeof t;if((s||r)&&(void 0!==l&&c.push(l),l={title:s?t:i,description:null,bindings:[],template_sheet:null,visualisation_sheet:null}),s){if(d<e.length-1){var f=e[d+1];"string"==typeof f&&(l.description=f,d+=1)}}else{if(null===l.template_sheet&&i)for(var p in a)if(a[p]===i){l.template_sheet=+p;break}if(null===l.visualisation_sheet){var h=o[t.dataset]&&o[t.dataset][t.key];h&&(l.visualisation_sheet=h.data_table_id)}l.bindings.push(t),d===e.length-1&&c.push(l)}}for(d=0;d<c.length;d++){var m=c[d],g=m.bindings,v=m.visualisation_sheet||m.template_sheet||i[0].id,y=(u=oo.append("div").attr("class","data-block").attr("data-sheet",a[v]).style("display",v===s?null:"none")).append("h2").attr("class","no-select");y.append("i").attr("class","fa fa-table"),y.append("span").text(" "+m.title),m.description&&u.append("p").text(m.description);var _=u.append("div").attr("class","data-bindings-header");_.append("p").attr("class","data-bindings-title").text("Select columns to visualise");for(var b=0;b<g.length;b++){var w=g[b];w.data_type&&(n=!0);var x=o[w.dataset]&&o[w.dataset][w.key],T=x?x.data_table_id:v;lo[w.dataset]||(lo[w.dataset]={}),lo[w.dataset][w.key]=T,T!==v&&T===s&&u.style("display",null),po(u.append("div"),w,x,a,T!==s)}n&&_.append("p").attr("class","data-bindings-reset clickable").html("<i class='fa fa-magic'></i> <span style='text-decoration: underline'>Auto set columns</span>").on("click",(function(){Ki("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(){io.spreadsheet.inferDataBindings()}},{text:"Cancel",keyCode:27,class:"secondary"}]})}))}io.spreadsheet&&(io.spreadsheet.updateHighlights(),io.spreadsheet.updateTabs())}))}function po(t,e,n,r,i){so[co]||(co=0),t.attr("class","settings-option option-type-"+e.type).style("display",i?"none":null);var o=null==n?"":gn(n,0,0,e.optional);uo[e.dataset]||(uo[e.dataset]={}),uo[e.dataset][e.key]=co;var a="column"===e.type&&!e.optional,s=a&&!n;t.classed("empty-required-binding",s);var u=t.append("div").attr("class","data-binding-title").on("click",(function(){Ht(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",!io.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=o})).attr("data-value",o).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 o,a=t.getBoundingClientRect(),s=[a.left-5,a.top+.5*a.height];if(t.value||"column"!=i.type){try{o=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 o=t[t.type].substr(r+2);if("column"==t.type)n.column=cn(o,t.optional);else{if("columns"!=t.type)throw new Error("Unknown data binding type: "+t.type);n.columns=hn(o)}return n}(i,io.visualisation.getDataTableIds());var u=gn(o,io.visualisation.getDataTableNames(),0,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(ao=!0)}if(Ht(t.parentElement.parentElement).classed("empty-required-binding",!1),!o.data_table_id)return t.value=t.getAttribute("data-value"),Je.point(s).text("No such data table").draw(),void(ao=!0);if(e.data_type){const n=io.spreadsheet.getTypeAnnotatedColumns();if("column"===i.type){const r=n[o.column];if(!r)return Je.point(s).html(`<span class="popup-content-header">Column '${t.value}' does not exist</span><p>Choose a column from the data table</p>`).draw(),t.value=t.getAttribute("data-value"),void(ao=!0);if(mo(e,r))return t.value=t.getAttribute("data-value"),Je.point(s).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${go([r.type])} columns</span>\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;">${go(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(ao=!0)}else{const r=n.filter((t=>o.columns.includes(t.index))).filter((t=>mo(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]),[]),c=l.reduce(((t,e,n,r)=>1===r.length?go([e]):(n<r.length-1?t+=`${n>0?",":""} ${go([e])}`:t+=`or ${go([e])}`,t)),"");return Je.point(s).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${c} columns</span>\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;">${go(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(ao=!0)}}}}else if(o=null,!e.optional)return t.value=t.getAttribute("data-value"),Je.point(s).text("This column selection is required").draw(),void(ao=!0);io.spreadsheet.updateTabs();var d={};d[e.dataset]={},d[e.dataset][e.key]=o,ho(d,(function(){t.setAttribute("data-value",t.value);var e=vo();e?(Ht(".publish-btn").classed("disabled",!0),Ht(".republish-btn").classed("disabled",!0),jt(".download-btn").classed("disabled",!0),Ht("body").classed("impossible",!0)):(Ht(".publish-btn").classed("disabled",!1),Ht(".republish-btn").classed("disabled",!1),jt(".download-btn").classed("disabled",!1),Ht("body").classed("impossible",!1),io.visualisation.getState((function(t){io.visualisation.prepareData((function(e,n){e?console.error("Failed to prepare data for template"):io.preview_pane.getDrawCalled()?io.preview_pane.sync({data:n,state:t,update:!0}):(io.preview_pane.sync({data:n,state:t,draw:!0}),io.preview_pane.setDrawCalled(!0))}))}))),io.spreadsheet&&io.spreadsheet.updateHighlights(),io.template_settings&&(e?io.template_settings.setReadOnly():io.template_settings.unsetReadOnly(),io.template_settings.populate()),io.theme_chooser.enableOrDisable()}))}(this,t)})).on("keydown",(function(){io.confirm.blank()})).on("focus",(function(){ao||Je.hide(),ao=!1,jt(".data-bindings .settings-option").classed("open",!1),Ht(this.parentElement.parentElement).classed("open",!0)}))}}(e)).style("background",so[co].light).style("border-color",so[co].full),s&&io.template_settings.setReadOnly(),a&&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").html(Pe.sanitize(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",ro[l].text+" column.").style("background-image","url("+ro[l].symbol+")")}co++}function ho(t,e){io.confirm.saving(),io.visualisation.updateDataBindings(t,(function(t){if(t)return io.confirm.error(t),console.error("Failed to save data binding:",t),void io.analytics("event","exception",{description:t.message||t,fatal:!0});io.analytics("event","visualisation",{change_data_binding:io.visualisation.id}),io.confirm.saved(),yo(),e&&e()}))}function mo(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 go(t){return t.map((t=>`\n\t\t<span class="column-type">\n\t\t<span class="type-symbol" title="${ro[t].text} column" style="background-image: url(${ro[t].symbol});"></span>\n\t\t<h2>${ro[t].text}</h2>\n\t\t</span>\n\t\t`)).join("")}function vo(){var t=io.visualisation.dataBindingsForCurrentTemplate(),e=io.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 yo(t=!0){if(vo())Ht("body").classed("impossible",!0),Ht(".empty-label").html("<i class='fa fa-exclamation-triangle'></i> Oops! It looks like one of the required column selections is empty."),Ht(".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(Ht("body").classed("impossible")){const e=io.visualisation?io.visualisation:io.story;e.status&&e.status.requested_by?io.confirm_published.awaitingReview(e.status,e.can_review,io.user):io.visualisation.embed_url&&t?io.confirm_published.edited():(io.confirm_published.unpublished(),Ht("body").classed("impossible",!1),Ht(".empty-label").text(""),Ht(".empty-details").text(""))}}var _o=!1;function bo(t){if(_o&&window.top!==window.self){var e=window;"srcdoc"===e.location.pathname&&(e=e.parent);var n=function(){var t={};return window._Flourish_template_id&&(t.template_id=window._Flourish_template_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_template_id&&(t.template_id=window.Flourish.app.loaded_template_id),window._Flourish_visualisation_id&&(t.visualisation_id=window._Flourish_visualisation_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_visualisation&&(t.visualisation_id=window.Flourish.app.loaded_visualisation.id),window.Flourish&&window.Flourish.app&&window.Flourish.app.story&&(t.story_id=window.Flourish.app.story.id,t.slide_count=window.Flourish.app.story.slides.length),window.Flourish&&window.Flourish.app&&window.Flourish.app.current_slide&&(t.slide_index=window.Flourish.app.current_slide.index+1),t}(),r={sender:"Flourish",method:"customerAnalytics"};for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);e.parent.postMessage(JSON.stringify(r),"*")}}function wo(t){if("function"!=typeof t)throw new Error("Analytics callback is not a function");window.Flourish._analytics_listeners.push(t)}function xo(){_o=!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(){bo({action:t.action_name})}),t.use_capture)}))}
3
+ /*! @license DOMPurify 3.1.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.4/LICENSE */const{entries:To,setPrototypeOf:Ao,isFrozen:Co,getPrototypeOf:Eo,getOwnPropertyDescriptor:ko}=Object;let{freeze:Do,seal:So,create:Mo}=Object,{apply:Lo,construct:Fo}="undefined"!=typeof Reflect&&Reflect;Do||(Do=function(t){return t}),So||(So=function(t){return t}),Lo||(Lo=function(t,e,n){return t.apply(e,n)}),Fo||(Fo=function(t,e){return new t(...e)});const No=Vo(Array.prototype.forEach),Uo=Vo(Array.prototype.pop),Oo=Vo(Array.prototype.push),Ro=Vo(String.prototype.toLowerCase),Io=Vo(String.prototype.toString),Ho=Vo(String.prototype.match),Bo=Vo(String.prototype.replace),jo=Vo(String.prototype.indexOf),Po=Vo(String.prototype.trim),zo=Vo(Object.prototype.hasOwnProperty),Yo=Vo(RegExp.prototype.test),$o=function(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Fo(t,n)}}(TypeError);function qo(t){return"number"==typeof t&&isNaN(t)}function Vo(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Lo(t,e,r)}}function Wo(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ro;Ao&&Ao(t,null);let r=e.length;for(;r--;){let i=e[r];if("string"==typeof i){const t=n(i);t!==i&&(Co(e)||(e[r]=t),i=t)}t[i]=!0}return t}function Go(t){for(let e=0;e<t.length;e++){zo(t,e)||(t[e]=null)}return t}function Xo(t){const e=Mo(null);for(const[n,r]of To(t)){zo(t,n)&&(Array.isArray(r)?e[n]=Go(r):r&&"object"==typeof r&&r.constructor===Object?e[n]=Xo(r):e[n]=r)}return e}function Zo(t,e){for(;null!==t;){const n=ko(t,e);if(n){if(n.get)return Vo(n.get);if("function"==typeof n.value)return Vo(n.value)}t=Eo(t)}return function(){return null}}const Jo=Do(["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"]),Ko=Do(["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"]),Qo=Do(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ta=Do(["animate","color-profile","cursor","discard","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"]),ea=Do(["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","mprescripts"]),na=Do(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ra=Do(["#text"]),ia=Do(["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","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","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","wrap","xmlns","slot"]),oa=Do(["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","transform-origin","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"]),aa=Do(["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"]),sa=Do(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ua=So(/\{\{[\w\W]*|[\w\W]*\}\}/gm),la=So(/<%[\w\W]*|[\w\W]*%>/gm),ca=So(/\${[\w\W]*}/gm),da=So(/^data-[\-\w.\u00B7-\uFFFF]/),fa=So(/^aria-[\-\w]+$/),pa=So(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ha=So(/^(?:\w+script|data):/i),ma=So(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ga=So(/^html$/i),va=So(/^[a-z][.\w]*(-[.\w]+)+$/i);var ya=Object.freeze({__proto__:null,MUSTACHE_EXPR:ua,ERB_EXPR:la,TMPLIT_EXPR:ca,DATA_ATTR:da,ARIA_ATTR:fa,IS_ALLOWED_URI:pa,IS_SCRIPT_OR_DATA:ha,ATTR_WHITESPACE:ma,DOCTYPE_NAME:ga,CUSTOM_ELEMENT:va});const _a=1,ba=3,wa=7,xa=8,Ta=9,Aa=function(){return"undefined"==typeof window?null:window};var Ca,Ea,ka,Da,Sa,Ma,La,Fa,Na,Ua=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Aa();const n=e=>t(e);if(n.version="3.1.4",n.removed=[],!e||!e.document||e.document.nodeType!==Ta)return n.isSupported=!1,n;let{document:r}=e;const i=r,o=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:u,Element:l,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=e,m=l.prototype,g=Zo(m,"cloneNode"),v=Zo(m,"nextSibling"),y=Zo(m,"childNodes"),_=Zo(m,"parentNode");if("function"==typeof s){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let b,w="";const{implementation:x,createNodeIterator:T,createDocumentFragment:A,getElementsByTagName:C}=r,{importNode:E}=i;let k={};n.isSupported="function"==typeof To&&"function"==typeof _&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:D,ERB_EXPR:S,TMPLIT_EXPR:M,DATA_ATTR:L,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:U,CUSTOM_ELEMENT:O}=ya;let{IS_ALLOWED_URI:R}=ya,I=null;const H=Wo({},[...Jo,...Ko,...Qo,...ea,...ra]);let B=null;const j=Wo({},[...ia,...oa,...aa,...sa]);let P=Object.seal(Mo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),z=null,Y=null,$=!0,q=!0,V=!1,W=!0,G=!1,X=!0,Z=!1,J=!1,K=!1,Q=!1,tt=!1,et=!1,nt=!0,rt=!1,it=!0,ot=!1,at={},st=null;const ut=Wo({},["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"]);let lt=null;const ct=Wo({},["audio","video","img","source","image","track"]);let dt=null;const ft=Wo({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",ht="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let gt=mt,vt=!1,yt=null;const _t=Wo({},[pt,ht,mt],Io);let bt=null;const wt=["application/xhtml+xml","text/html"];let xt=null,Tt=null;const At=r.createElement("form"),Ct=function(t){return t instanceof RegExp||t instanceof Function},Et=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Tt||Tt!==t){if(t&&"object"==typeof t||(t={}),t=Xo(t),bt=-1===wt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,xt="application/xhtml+xml"===bt?Io:Ro,I=zo(t,"ALLOWED_TAGS")?Wo({},t.ALLOWED_TAGS,xt):H,B=zo(t,"ALLOWED_ATTR")?Wo({},t.ALLOWED_ATTR,xt):j,yt=zo(t,"ALLOWED_NAMESPACES")?Wo({},t.ALLOWED_NAMESPACES,Io):_t,dt=zo(t,"ADD_URI_SAFE_ATTR")?Wo(Xo(ft),t.ADD_URI_SAFE_ATTR,xt):ft,lt=zo(t,"ADD_DATA_URI_TAGS")?Wo(Xo(ct),t.ADD_DATA_URI_TAGS,xt):ct,st=zo(t,"FORBID_CONTENTS")?Wo({},t.FORBID_CONTENTS,xt):ut,z=zo(t,"FORBID_TAGS")?Wo({},t.FORBID_TAGS,xt):{},Y=zo(t,"FORBID_ATTR")?Wo({},t.FORBID_ATTR,xt):{},at=!!zo(t,"USE_PROFILES")&&t.USE_PROFILES,$=!1!==t.ALLOW_ARIA_ATTR,q=!1!==t.ALLOW_DATA_ATTR,V=t.ALLOW_UNKNOWN_PROTOCOLS||!1,W=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,G=t.SAFE_FOR_TEMPLATES||!1,X=!1!==t.SAFE_FOR_XML,Z=t.WHOLE_DOCUMENT||!1,Q=t.RETURN_DOM||!1,tt=t.RETURN_DOM_FRAGMENT||!1,et=t.RETURN_TRUSTED_TYPE||!1,K=t.FORCE_BODY||!1,nt=!1!==t.SANITIZE_DOM,rt=t.SANITIZE_NAMED_PROPS||!1,it=!1!==t.KEEP_CONTENT,ot=t.IN_PLACE||!1,R=t.ALLOWED_URI_REGEXP||pa,gt=t.NAMESPACE||mt,P=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&Ct(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&Ct(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(P.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),G&&(q=!1),tt&&(Q=!0),at&&(I=Wo({},ra),B=[],!0===at.html&&(Wo(I,Jo),Wo(B,ia)),!0===at.svg&&(Wo(I,Ko),Wo(B,oa),Wo(B,sa)),!0===at.svgFilters&&(Wo(I,Qo),Wo(B,oa),Wo(B,sa)),!0===at.mathMl&&(Wo(I,ea),Wo(B,aa),Wo(B,sa))),t.ADD_TAGS&&(I===H&&(I=Xo(I)),Wo(I,t.ADD_TAGS,xt)),t.ADD_ATTR&&(B===j&&(B=Xo(B)),Wo(B,t.ADD_ATTR,xt)),t.ADD_URI_SAFE_ATTR&&Wo(dt,t.ADD_URI_SAFE_ATTR,xt),t.FORBID_CONTENTS&&(st===ut&&(st=Xo(st)),Wo(st,t.FORBID_CONTENTS,xt)),it&&(I["#text"]=!0),Z&&Wo(I,["html","head","body"]),I.table&&(Wo(I,["tbody"]),delete z.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw $o('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw $o('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=t.TRUSTED_TYPES_POLICY,w=b.createHTML("")}else void 0===b&&(b=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(n=e.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(h,o)),null!==b&&"string"==typeof w&&(w=b.createHTML(""));Do&&Do(t),Tt=t}},kt=Wo({},["mi","mo","mn","ms","mtext"]),Dt=Wo({},["foreignobject","annotation-xml"]),St=Wo({},["title","style","font","a","script"]),Mt=Wo({},[...Ko,...Qo,...ta]),Lt=Wo({},[...ea,...na]),Ft=function(t){Oo(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){t.remove()}},Nt=function(t,e){try{Oo(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Oo(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!B[t])if(Q||tt)try{Ft(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Ut=function(t){let e=null,n=null;if(K)t="<remove></remove>"+t;else{const e=Ho(t,/^[\r\n\t ]+/);n=e&&e[0]}"application/xhtml+xml"===bt&&gt===mt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const i=b?b.createHTML(t):t;if(gt===mt)try{e=(new p).parseFromString(i,bt)}catch(t){}if(!e||!e.documentElement){e=x.createDocument(gt,"template",null);try{e.documentElement.innerHTML=vt?w:i}catch(t){}}const o=e.body||e.documentElement;return t&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),gt===mt?C.call(e,Z?"html":"body")[0]:Z?e.documentElement:o},Ot=function(t){return T.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Rt=function(t){return t instanceof f&&(void 0!==t.__depth&&"number"!=typeof t.__depth||void 0!==t.__removalCount&&"number"!=typeof t.__removalCount||"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||"function"!=typeof t.hasChildNodes)},It=function(t){return"function"==typeof u&&t instanceof u},Ht=function(t,e,r){k[t]&&No(k[t],(t=>{t.call(n,e,r,Tt)}))},Bt=function(t){let e=null;if(Ht("beforeSanitizeElements",t,null),Rt(t))return Ft(t),!0;const r=xt(t.nodeName);if(Ht("uponSanitizeElement",t,{tagName:r,allowedTags:I}),t.hasChildNodes()&&!It(t.firstElementChild)&&Yo(/<[/\w]/g,t.innerHTML)&&Yo(/<[/\w]/g,t.textContent))return Ft(t),!0;if(t.nodeType===wa)return Ft(t),!0;if(X&&t.nodeType===xa&&Yo(/<[/\w]/g,t.data))return Ft(t),!0;if(!I[r]||z[r]){if(!z[r]&&Pt(r)){if(P.tagNameCheck instanceof RegExp&&Yo(P.tagNameCheck,r))return!1;if(P.tagNameCheck instanceof Function&&P.tagNameCheck(r))return!1}if(it&&!st[r]){const e=_(t)||t.parentNode,n=y(t)||t.childNodes;if(n&&e){for(let r=n.length-1;r>=0;--r){const i=g(n[r],!0);i.__removalCount=(t.__removalCount||0)+1,e.insertBefore(i,v(t))}}}return Ft(t),!0}return t instanceof l&&!function(t){let e=_(t);e&&e.tagName||(e={namespaceURI:gt,tagName:"template"});const n=Ro(t.tagName),r=Ro(e.tagName);return!!yt[t.namespaceURI]&&(t.namespaceURI===ht?e.namespaceURI===mt?"svg"===n:e.namespaceURI===pt?"svg"===n&&("annotation-xml"===r||kt[r]):Boolean(Mt[n]):t.namespaceURI===pt?e.namespaceURI===mt?"math"===n:e.namespaceURI===ht?"math"===n&&Dt[r]:Boolean(Lt[n]):t.namespaceURI===mt?!(e.namespaceURI===ht&&!Dt[r])&&!(e.namespaceURI===pt&&!kt[r])&&!Lt[n]&&(St[n]||!Mt[n]):!("application/xhtml+xml"!==bt||!yt[t.namespaceURI]))}(t)?(Ft(t),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!Yo(/<\/no(script|embed|frames)/i,t.innerHTML)?(G&&t.nodeType===ba&&(e=t.textContent,No([D,S,M],(t=>{e=Bo(e,t," ")})),t.textContent!==e&&(Oo(n.removed,{element:t.cloneNode()}),t.textContent=e)),Ht("afterSanitizeElements",t,null),!1):(Ft(t),!0)},jt=function(t,e,n){if(nt&&("id"===e||"name"===e)&&(n in r||n in At||"__depth"===n||"__removalCount"===n))return!1;if(q&&!Y[e]&&Yo(L,e));else if($&&Yo(F,e));else if(!B[e]||Y[e]){if(!(Pt(t)&&(P.tagNameCheck instanceof RegExp&&Yo(P.tagNameCheck,t)||P.tagNameCheck instanceof Function&&P.tagNameCheck(t))&&(P.attributeNameCheck instanceof RegExp&&Yo(P.attributeNameCheck,e)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(e))||"is"===e&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&Yo(P.tagNameCheck,n)||P.tagNameCheck instanceof Function&&P.tagNameCheck(n))))return!1}else if(dt[e]);else if(Yo(R,Bo(n,U,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==jo(n,"data:")||!lt[t]){if(V&&!Yo(N,Bo(n,U,"")));else if(n)return!1}else;return!0},Pt=function(t){return"annotation-xml"!==t&&Ho(t,O)},zt=function(t){Ht("beforeSanitizeAttributes",t,null);const{attributes:e}=t;if(!e)return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B};let i=e.length;for(;i--;){const o=e[i],{name:a,namespaceURI:s,value:u}=o,l=xt(a);let c="value"===a?u:Po(u);if(r.attrName=l,r.attrValue=c,r.keepAttr=!0,r.forceKeepAttr=void 0,Ht("uponSanitizeAttribute",t,r),c=r.attrValue,r.forceKeepAttr)continue;if(Nt(a,t),!r.keepAttr)continue;if(!W&&Yo(/\/>/i,c)){Nt(a,t);continue}if(X&&Yo(/((--!?|])>)|<\/(style|title)/i,c)){Nt(a,t);continue}G&&No([D,S,M],(t=>{c=Bo(c,t," ")}));const d=xt(t.nodeName);if(jt(d,l,c)){if(!rt||"id"!==l&&"name"!==l||(Nt(a,t),c="user-content-"+c),b&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(d,l)){case"TrustedHTML":c=b.createHTML(c);break;case"TrustedScriptURL":c=b.createScriptURL(c)}try{s?t.setAttributeNS(s,a,c):t.setAttribute(a,c),Rt(t)?Ft(t):Uo(n.removed)}catch(t){}}}Ht("afterSanitizeAttributes",t,null)},Yt=function t(e){let n=null;const r=Ot(e);for(Ht("beforeSanitizeShadowDOM",e,null);n=r.nextNode();){if(Ht("uponSanitizeShadowNode",n,null),Bt(n))continue;const e=_(n);n.nodeType===_a&&(e&&e.__depth?n.__depth=(n.__removalCount||0)+e.__depth+1:n.__depth=1),(n.__depth>=255||n.__depth<0||qo(n.__depth))&&Ft(n),n.content instanceof a&&(n.content.__depth=n.__depth,t(n.content)),zt(n)}Ht("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,s=null,l=null;if(vt=!t,vt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!It(t)){if("function"!=typeof t.toString)throw $o("toString is not a function");if("string"!=typeof(t=t.toString()))throw $o("dirty is not a string, aborting")}if(!n.isSupported)return t;if(J||Et(e),n.removed=[],"string"==typeof t&&(ot=!1),ot){if(t.nodeName){const e=xt(t.nodeName);if(!I[e]||z[e])throw $o("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof u)r=Ut("\x3c!----\x3e"),o=r.ownerDocument.importNode(t,!0),o.nodeType===_a&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!Q&&!G&&!Z&&-1===t.indexOf("<"))return b&&et?b.createHTML(t):t;if(r=Ut(t),!r)return Q?null:et?w:""}r&&K&&Ft(r.firstChild);const c=Ot(ot?t:r);for(;s=c.nextNode();){if(Bt(s))continue;const t=_(s);s.nodeType===_a&&(t&&t.__depth?s.__depth=(s.__removalCount||0)+t.__depth+1:s.__depth=1),(s.__depth>=255||s.__depth<0||qo(s.__depth))&&Ft(s),s.content instanceof a&&(s.content.__depth=s.__depth,Yt(s.content)),zt(s)}if(ot)return t;if(Q){if(tt)for(l=A.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(B.shadowroot||B.shadowrootmode)&&(l=E.call(i,l,!0)),l}let d=Z?r.outerHTML:r.innerHTML;return Z&&I["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&Yo(ga,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),G&&No([D,S,M],(t=>{d=Bo(d,t," ")})),b&&et?b.createHTML(d):d},n.setConfig=function(){Et(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),J=!0},n.clearConfig=function(){Tt=null,J=!1},n.isValidAttribute=function(t,e,n){Tt||Et({});const r=xt(t),i=xt(e);return jt(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&(k[t]=k[t]||[],Oo(k[t],e))},n.removeHook=function(t){if(k[t])return Uo(k[t])},n.removeHooks=function(t){k[t]&&(k[t]=[])},n.removeAllHooks=function(){k={}},n}();function Oa(){if(null==Ca){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}();Ca="referrer"in t?/^https:\/\/medium.com\//.test(t.referrer):!("auto"in t)}return Ca}function Ra(t){var e=t||window.innerWidth;return e>999?650:e>599?575:400}function Ia(t){if(t&&window.top!==window.self){var e=window;"srcdoc"==e.location.pathname&&(e=e.parent);var n={sender:"Flourish",method:"scrolly",captions:t.captions};e.parent.postMessage(JSON.stringify(n),"*")}}function Ha(t,e){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),Ea)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 Ba(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function ja(t){return"string"==typeof t||t instanceof String}function Pa(t){return"warn"!==t.method?(console.warn("BUG: validateWarnMessage called for method"+t.method),!1):!(null!=t.message&&!ja(t.message))&&!(null!=t.explanation&&!ja(t.explanation))}function za(t){return"resize"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!ja(t.src)&&(!!ja(t.context)&&!!("number"==typeof(e=t.height)?!isNaN(e)&&e>=0:ja(e)&&/\d/.test(e)&&/^[0-9]*(\.[0-9]*)?(cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%)?$/i.test(e)));var e}function Ya(t){throw new Error("Validation for setSetting is not implemented yet; see issue #4328")}function $a(t){return"scrolly"!==t.method?(console.warn("BUG: validateScrolly called for method"+t.method),!1):!!Array.isArray(t.captions)}function qa(t){return"customerAnalytics"===t.method||(console.warn("BUG: validateCustomerAnalyticsMessage called for method"+t.method),!1)}function Va(t){return"request-upload"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!ja(t.name)&&!(null!=t.accept&&!ja(t.accept))}function Wa(t,e,n){var r=function(t){for(var e={warn:Pa,resize:za,setSetting:Ya,customerAnalytics:qa,"request-upload":Va,scrolly:$a},n={},r=0;r<t.length;r++){var i=t[r];if(!e[i])throw new Error("No validator found for method "+i);n[i]=e[i]}return n}(e);window.addEventListener("message",(function(e){var i=function(){if(e.origin==document.location.origin)return!0;if(n){const t=e.origin.toLowerCase();if(n=n.toLowerCase(),t.endsWith("//"+n))return!0;if(t.endsWith("."+n))return!0}return!!e.origin.match(/\/\/localhost:\d+$|\/\/(?:public|app)\.flourish.devlocal$|\/\/flourish-api\.com$|\.flourish\.(?:local(:\d+)?|net|rocks|studio)$|\.uri\.sh$|\/\/flourish-user-templates\.com$/)}();if(null!=e.source&&i){var o;try{o="object"==typeof e.data?e.data:JSON.parse(e.data)}catch(t){return void console.warn("Unexpected non-JSON message: "+JSON.stringify(e.data))}if("Flourish"===o.sender)if(o.method)if(Object.prototype.hasOwnProperty.call(r,o.method))if(r[o.method](o)){for(var a=document.querySelectorAll("iframe"),s=0;s<a.length;s++)if(a[s].contentWindow==e.source||a[s].contentWindow==e.source.parent)return void t(o,a[s]);console.warn("could not find frame",o)}else console.warn("Validation failed for the message",o);else console.warn("No validator implemented for message",o);else console.warn("The 'method' property was missing from message",o)}})),Ba()&&(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),o=n.offsetWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight);r.style.width=o+"px"}}}}function Xa(t,e){var n=t.parentNode;if(n.classList.contains("fl-scrolly-wrapper"))console.warn("createScrolly is being called more than once per story. This should not happen.");else{n.classList.add("fl-scrolly-wrapper"),n.style.position="relative",n.style.paddingBottom="1px",n.style.transform="translate3d(0, 0, 0)",t.style.position="sticky";var r=n.getAttribute("data-height")||null;r||(r="80vh",t.style.height=r),t.style.top="calc(50vh - "+r+"/2)";var i=n.querySelector(".flourish-credit");i&&(i.style.position="sticky",i.style.top="calc(50vh + "+r+"/2)"),e.forEach((function(t,e){var r="string"==typeof t&&""!=t.trim(),i=document.createElement("div");i.setAttribute("data-slide",e),i.classList.add("fl-scrolly-caption"),i.style.position="relative",i.style.transform="translate3d(0,0,0)",i.style.textAlign="center",i.style.maxWidth="500px",i.style.height="auto",i.style.marginTop="0",i.style.marginBottom=r?"100vh":"50vh",i.style.marginLeft="auto",i.style.marginRight="auto";var o=document.createElement("div");o.innerHTML=Ua.sanitize(t,{ADD_ATTR:["target"]}),o.style.visibility=r?"":"hidden",o.style.display="inline-block",o.style.paddingTop="1.25em",o.style.paddingRight="1.25em",o.style.paddingBottom="1.25em",o.style.paddingLeft="1.25em",o.style.background="rgba(255,255,255,0.9)",o.style.boxShadow="0px 0px 10px rgba(0,0,0,0.2)",o.style.borderRadius="10px",o.style.textAlign="center",o.style.maxWidth="100%",o.style.margin="0 20px",o.style.overflowX="hidden",i.appendChild(o),n.appendChild(i)})),function(t){for(var e=new IntersectionObserver((function(e){e.forEach((function(e){if(e.isIntersecting){var n=t.querySelector("iframe");n&&(n.src=n.src.replace(/#slide-.*/,"")+"#slide-"+e.target.getAttribute("data-slide"))}}))}),{rootMargin:"0px 0px -0% 0px"}),n=t.querySelectorAll(".fl-scrolly-caption"),r=0;r<n.length;r++)e.observe(n[r]);t.querySelectorAll(".fl-scrolly-caption img").forEach((function(t){t.style.maxWidth="100%"}))}(n)}}function Za(t,e,n,r,i){var o=document.createElement("iframe");if(o.setAttribute("scrolling","no"),o.setAttribute("frameborder","0"),o.setAttribute("title","Interactive or visual content"),o.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(o),o.offsetParent||"fixed"===getComputedStyle(o).position)Ja(t,e,o,n,r,i);else{var a={embed_url:t,container:e,iframe:o,width:n,height:r,play_on_load:i};if(window._flourish_poll_items?window._flourish_poll_items.push(a):window._flourish_poll_items=[a],window._flourish_poll_items.length>1)return o;var s=setInterval((function(){window._flourish_poll_items=window._flourish_poll_items.filter((function(t){return!t.iframe.offsetParent||(Ja(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 o}function Ja(t,e,n,r,i,o){var a;return r&&"number"==typeof r?(a=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]*$/)&&(a=parseFloat(r)),i&&"number"==typeof i&&(i+="px"),r?n.style.width=r:Ba()?n.style.width=e.offsetWidth+"px":n.style.width="100%",!!i||(t.match(/\?/)?t+="&auto=1":t+="?auto=1",i=Ra(a||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+(o?"#play-on-load":"")),n}function Ka(t,e,n){for(var r in e||(e=[]),n||(n={}),t)e.push(r),"object"==typeof t[r]&&Ka(t[r],e,n),n[e.join(".")]=t[r],e.pop();return n}function Qa(t){var e={};for(var n in t){for(var r=e,i=n.indexOf("."),o=0;i>=0;i=n.indexOf(".",o=i+1)){var a=n.substring(o,i);a in r||(r[a]={}),r=r[a]}r[n.substring(o)]=t[n]}return e}function ts(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]=ts(t[r]));return n}var es,ns=null;function rs(){return"MessageChannel"in window}var is=null;function os(){is&&ka.removeEventListener("load",is),is=null}function as(t){os(),ka.addEventListener("load",t),is=t}function ss(t,e,n){return ks(!1),Na=t?t.visualisation?t.visualisation:t.current_slide.visualisation:null,ns=null,Na&&Na.template_id?(as(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(){zt(),!Na||Na.template_id!=r||t.current_slide&&t.current_slide.id!==i||(os(),ms((function(o,a){o?console.error("Failed to get default state"):!Na||Na.template_id!=r||t.current_slide&&t.current_slide.id!==i||gs((function(o,s){if(o)console.error("Failed to call hasData");else if(Na&&Na.template_id==r&&(!t.current_slide||t.current_slide.id===i)){var u=!1;t.visualisation&&(u=t.data_bindings.requiredBindingsAreUnset()),s?Na.refreshDataBindings((function(o){o?console.error("Failed to refresh data bindings"):!Na||Na.template_id!=r||t.current_slide&&t.current_slide.id!==i||Na.prepareData((function(o,s){o?console.error("Failed to prepare data for template"):!Na||Na.template_id!=r||t.current_slide&&t.current_slide.id!==i||Cs({data:s,state:e,draw:!u},(function(t,e){ns=a,n(t,e)}))}))})):Cs({state:e,draw:!u},(function(t,e){ns=a,n(t,e)}))}}))})))}}(t,e,n)),ka.src="/template/"+Na.template_id+"/embed/?auto=1&environment="+Da+"&is_read_only="+(t.is_read_only?"1":"0"),ka):(os(),ka.src="about:blank",ka)}function us(t){ms((function(e,n){e?console.error("Failed to get default state"):(ns=n,t())}))}function ls(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(Na&&Na.template_id==n)return t?(console.error("Failed to prepare data for template"),void e(t)):void e(void 0,r)}))}))}function cs(t,e){ls(t,(function(t,n){if(t)return e(t);Cs({data:n,update:!0},e)}))}function ds(t,e){ls(t,(function(t,n){if(t)return e(t);Cs({data:n,update:!1},e)}))}function fs(t,e,n){ls(t,(function(t,r){if(t)return n(t);Cs({data:r,state:e,overwrite_state:!0,update:!0},n)}))}function ps(t,e,n,r=ka){if(rs()){var i=new MessageChannel;i.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)},r.contentWindow.postMessage({sender:"Flourish",method:t,argument:e},"*",[i.port2])}}function hs(t,e){ps("setState",Qa(t),e)}function ms(t,e){"function"!=typeof t?ps("getState",t,e):ps("getState",void 0,t)}function gs(t){ps("hasData",void 0,t)}function vs(t,e){ps("setData",t,e)}function ys(t){ps("getData",void 0,t)}function _s(t){ps("draw",void 0,t),ks(!0)}function bs(t){La&&La.clear(),Es()&&ps("update",void 0,t)}function ws(t,e,n){ps("snapshot",t,e,n)}function xs(){return ts(ns)}function Ts(t,e){ps("setFixedHeight",t,e)}function As(t){if(ka.parentNode.offsetWidth){if(void 0!==t)es=null!=t;else if(es)return;var e=t||Ma&&Ma.responsive_menu&&Ma.responsive_menu.getHeightSetting()||Sa.getHeightForBreakpoint(ka.offsetWidth),n=typeof e;("number"===n||"string"===n&&!isNaN(e))&&(e+="px"),ka.style.height=e}}function Cs(t,e,n=ka){Es()?delete t.draw:t.draw&&ks(!0),t.state&&(t.state=Qa(t.state)),La&&La.clear(),ps("sync",t,(function(n,r){null!=n||"success"!==r?(t.draw&&ks(!1),function n(r){r?e&&e(r):function(t,e){return t.data?(vs(t.data,e),delete t.data,!1):t.state?(hs(t.state,e),delete t.state,!1):t.draw?(_s(e),delete t.draw,!1):!t.update||(bs(e),delete t.update,!1)}(t,n)&&e&&e(void 0)}(n)):e&&e(void 0)}),n)}function Es(){return Fa}function ks(t){Fa=t}function Ds(t,e,n,r,i){return ka=document.querySelector(t),Da=e,Ma=n,La=r,i||(i={}),Ea="#amp=1"==window.location.hash,Sa={createEmbedIframe:Za,isFixedHeight:Oa,getHeightForBreakpoint:Ra,startEventListeners:Wa,notifyParentWindow:Ha,initScrolly:Ia,createScrolly:Xa,isSafari:Ba,initCustomerAnalytics:xo,addAnalyticsListener:wo,sendCustomerAnalyticsMessage:bo},ka.style.height=Sa.getHeightForBreakpoint(ka.offsetWidth)+"px",Sa.startEventListeners((function(t){"resize"==t.method?As(t.height):"warn"==t.method?(La&&La.warn(t),console.warn("Warning from template:",t.message,t.explanation)):t.method in i&&i[t.method](t)}),["resize","warn","customerAnalytics","setSetting","request-upload"]),rs()||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)}}(ka.parentNode),{loadVisualisation:ss,updateData:cs,updateDataAndState:fs,updateDataNotPreview:ds,setState:hs,getState:ms,getDefaultState:xs,hasData:gs,setData:vs,getData:ys,draw:_s,update:bs,snapshot:ws,setFixedHeight:Ts,resize:As,sync:Cs,getDrawCalled:Es,setDrawCalled:ks,setFrameLoadListener:as,updateDefaultState:us}}var Ss={start:function(t=document.body){t.classList.add("loading")},clear:function(t=document.body){t.classList.remove("loading")}};const Ms=new Set([1,274,282,283,296,34675,40961,42240]);function Ls(t){let e=0;function n(n){if(e>=t.byteLength)return null;void 0===n&&(n=1);const r=new DataView(t,e,n);return e+=n,r}const r=new Uint8Array(t.byteLength+2);let i=0;function o(t){r.set(new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)),i),i+=t.byteLength}const a=(new TextEncoder).encode("Exif\0\0");function*s(t){if(t<32)return;if(!function(t,e){if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.byteLength;n++)if(t.getInt8(n)!==e.getInt8(n))return!1;return!0}(n(6),new DataView(a.buffer)))return void n(t-8);const e=[],r=n(t-8),i=r.getUint16(0);let o;if(18761===i)o=!0;else{if(19789!==i)return;o=!1}function s(t){return r.getUint16(t,o)}function u(t){return r.getUint32(t,o)}if(42!==s(2))return;let l=u(4);for(;0!=l;){const t=s(l);l+=2;for(let n=0;n<t;n++){const t=s(l),n=s(l+2),i=u(l+4),a=u(l+8);if(l+=12,!Ms.has(t))continue;if(n<1||n>12)continue;let c;switch(n){case 1:case 2:case 6:case 7:c=1;break;case 3:case 8:c=2;break;case 4:case 9:case 11:c=4;break;case 5:case 10:case 12:c=8}const d=c*i;let f;if(d<=4)f=new DataView(new ArrayBuffer(4),0,4),f.setUint32(0,a,o);else{f=new DataView(new ArrayBuffer(d));for(let t=0;t<d;t++)f.setInt8(t,r.getInt8(a+t))}e.push({code:t,type:n,num_values:i,data:f})}l=u(l)}let c=10;for(const{data:t}of e)c+=12,t.byteLength>4&&(c+=t.byteLength);c+=4;const d=new Uint8Array(c),f=new DataView(d.buffer);d.set((new TextEncoder).encode("MM\0*\0\0\0\b"),0),f.setUint16(8,e.length);let p=10,h=10+12*e.length+4;for(const{code:t,type:n,num_values:r,data:i}of e){if(f.setUint16(p,t),f.setUint16(p+2,n),f.setUint32(p+4,r),i.byteLength<=4)for(let t=0;t<i.byteLength;t++)f.setInt8(p+8+t,i.getInt8(t));else{f.setUint32(p+8,h);for(let t=0;t<i.byteLength;t++)f.setInt8(h+t,i.getInt8(t));h+=i.byteLength}p+=12}const m=new Uint8Array(10),g=new DataView(m.buffer);g.setUint8(0,255),g.setUint8(1,225),g.setUint16(2,f.byteLength+8),m.set(a,4),yield m,yield f}const u=n(2);if(65496!==u.getUint16(0))throw new Error("Not a valid JPEG");for(o(u);;){const t=n(2),e=t.getUint16(0);if(65498===e){o(t);break}const r=n(2),i=r.getUint16(0);if(65505!==e)o(t),o(r),o(n(i-2));else for(const t of s(i))o(t)}const l=new Uint8Array([255,217]);let c,d=!1,f=!1;for(;null!=(c=n());){if(d&&217===c.getUint8(0)){f=!0,o(new DataView(new Uint8Array([217]).buffer));break}const t=new Uint8Array(c.buffer).indexOf(l);if(!(t<0)){o(c.slice(0,t+2)),f=!0;break}o(c),d=c.byteLength>0&&255===c.getUint8(c.byteLength-1)}return f||o(l),r}function Fs(t){let e=0;function n(n){if(e+n>t.byteLength)return null;const r=new DataView(t,e,n);return e+=n,r}const r=new Uint8Array(t.byteLength);let i=0;function o(t){r.set(new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)),i),i+=t.byteLength}const a=n(8);if(80!==a.getUint8(1)||78!==a.getUint8(2)||71!==a.getUint8(3))throw new Error("Not a valid PNG");let s,u;for(o(a);null!=(s=n(4))&&null!=(u=n(4));){const t=s.getUint32(0),e=u.getUint8(0),r=u.getUint8(1);101===e||105===e&&84===r?(n(t),n(4)):(o(s),o(u),o(n(t)),o(n(4)))}return r}var Ns="⬆︎",Us="/api/file/upload";function Os(t){(t||document).querySelectorAll("input[type=url]").forEach((function(t){Rs(t)}))}function Rs(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=Ns,t.insertAdjacentElement("afterend",n),e||(n.onclick=Is)}function Is(){var t=this.previousSibling,e=t.getAttribute("accept");t.disabled=!0,t.classList.toggle("uploading",!0),Hs({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 Hs(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=async function(){Ss.start(),await async function(t,e,n){const r=await async function(t){try{if("image/png"===t.type)return new File([Fs(await t.arrayBuffer())],t.name,{type:t.type});if("image/jpeg"===t.type)return new File([Ls(await t.arrayBuffer())],t.name,{type:t.type})}catch(t){console.error(t)}return t}(t[0]);!function(t,e){var n={filename:t.name,content_type:t.type,size:t.size};Bs(Us,n,(function(t,n){return t?e(t):e(null,JSON.parse(n.responseText))}))}(r,(function(t,i){if(t)return Ss.clear(),Ki("Upload error","There was a problem uploading your file: "+t.message),void console.error(t);var o=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:r},i.fields);Bs(i.upload_url,o,(function(t,r){Ss.clear(),t?(Ki("Upload error","There was a problem uploading your file ("+r.status+")."),console.error(t),n&&n()):e(i.file_url)}))}))}(e.files,t.success,t.failure),e.parentNode.removeChild(e)},e.click()}function Bs(t,e,n){var r=new XMLHttpRequest,i=new FormData;if("object"==typeof e){for(var o in e)e.hasOwnProperty(o)&&"file"!==o&&i.append(o,e[o]);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 js="https://fonts.googleapis.com/css?family=",Ps=["Source Sans Pro","Roboto Condensed","Merriweather","Lora","Playfair Display","Coda","Lobster","Cabin Sketch"],zs="Same as parent",Ys=[],$s=[],qs={};function Vs(t){return js+t.replace(/ /g,"+")+":400,700"}function Ws(t){var e=$s.concat(Ys,Ps.map((function(t){return{name:t,url:Vs(t)}})));return t&&e.unshift({name:zs}),e}function Gs(t){return Ws(!0).find((function(e){return e.name==t}))}var Xs=!1;function Zs(t){return t.substr(t.lastIndexOf("=")+1).replace(/\+/g," ")}function Js(t){var e=t.target,n=e.value;if(n&&(0==n.indexOf(js)&&(n=e.value=Zs(n)),!Gs(n))){if(/^https?:\/\//.test(n)){Xs||(Ks(n),e.value="");var r=n;return n=e.value=Zs(r),$s.push({name:n,url:r}),void Qs()}var i=Vs(n);try{var o=new XMLHttpRequest;if(o.open("HEAD",i,!1),o.send(),404==o.status)throw"Font not found";$s.push({name:n,url:i}),Qs()}catch(t){Ks(n),e.value=""}}}function Ks(t){Ki("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 Qs(){var t,e,n=Object.keys(qs);for(t=0;t<n.length;++t)(e=qs[n[t]]).dropdown.setOptions(Ws(e.can_inherit).map((function(t){return t.name})))}var tu={initialize:function(t,e,n){var r=!!e.optional;Xs=n,t.classList.add("font-menu");var i=new to({input:t,id:e.property+"-dropdown",options:Ws(r).map((t=>t.name)),mode:"single",options_config:{allow_other_option:!0}});t._dropdown=i,qs[e.property]={dropdown:i,can_inherit:r},t.addEventListener("change",Js)},update:function(t,e){var n=e?e.name:zs;t._dropdown.setSelectedOptions(n),Gs(n)||(n!=zs&&$s.push({name:n,url:e.url}),Qs())},getValue:function(t){if(/^https?:\/\//.test(t.value))return{name:Zs(t.value),url:t.value};var e=t.value;if(e==zs)return null;var n=Gs(e);return n||{name:e,url:Vs(e)}},replaceThemeFonts:function(t){Ys=(t||[]).map((function(t){return{name:t.name,url:t.url}})),Qs()}},eu="$";function nu(){}function ru(t,e){var n=new nu;if(t instanceof nu)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var a in t)n.set(a,t[a]);return n}function iu(){}nu.prototype=ru.prototype={constructor:nu,has:function(t){return eu+t in this},get:function(t){return this[eu+t]},set:function(t,e){return this[eu+t]=e,this},remove:function(t){var e=eu+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===eu&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===eu&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===eu&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===eu&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===eu&&++t;return t},empty:function(){for(var t in this)if(t[0]===eu)return!1;return!0},each:function(t){for(var e in this)e[0]===eu&&t(this[e],e.slice(1),this)}};var ou=ru.prototype;iu.prototype={constructor:iu,has:ou.has,add:function(t){return this[eu+(t+="")]=t,this},remove:ou.remove,clear:ou.clear,values:ou.keys,size:ou.size,empty:ou.empty,each:ou.each};var au={value:function(){}};function su(){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 uu(r)}function uu(t){this._=t}function lu(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function cu(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=au,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function du(t,e,n,r,i){for(var o 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[o]=r[o];if(i)for(var o in i)t[o]=i[o]}uu.prototype=su.prototype={constructor:uu,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=cu(i[n],t.name,e);else if(null==e)for(n in i)i[n]=cu(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=lu(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new uu(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var fu={};function pu(t){t.running||(t.running=!0,hu(t,(function(){t.running=!1})))}function hu(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",o=t.url,a=t.payload,s=t.callback;!a&&mu(n)&&(a=function(){return{}});if(a){if("function"!=typeof a)throw new Error("Internal error: processRequestThen: payload must be a function, not "+typeof a,a);"object"==typeof(a=a())&&mu(n)&&(window.Flourish&&window.Flourish.csrf_token||console.trace("window.Flourish.csrf_token missing"),a.csrf_token=window.Flourish.csrf_token),"string"!=typeof a&&(a=JSON.stringify(a))}var u=function(t,e){var n,r,i,o,a=su("beforesend","progress","load","error"),s=ru(),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 a.call("error",n,t)}else e=u;a.call("load",n,e)}else a.call("error",n,t)}return"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){a.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?(o=t,n):o},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!=o&&(u.responseType=o),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)})),a.call("beforesend",n,u),u.send(null==i?null:i),n},abort:function(){return u.abort(),n},on:function(){var t=a.on.apply(a,arguments);return t===a?n:t}},n}(o);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,a),u}(t.items.shift(),(function(){t.request=null,0==t.items.length?e():hu(t,e)}))}function mu(t){return["POST","PUT","DELETE"].includes(t)}function gu(t,e){void 0===e&&(e="default"),e in fu||(fu[e]={items:[],running:!1,name:e}),fu[e].items.push(t),pu(fu[e])}function vu(t,e){for(var n in e)t[n]=e[n];return t}function yu(t,e,n,r){"function"==typeof n&&(r=n,n=!1),n&&vu(t,e),gu({url:t.api_prefix+"/"+t.id,payload:function(){return{version_number:t.getVersionNumber(),fields:e}},callback:function(i,o){if(i)return r(i);n||vu(t,e),t.setVersionNumber(o.version_number),r(void 0)}})}function _u(t,e){t.delete_requested=!0,gu({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)}})}function bu(t){gu({url:"/api/history",method:"POST",payload:function(){return t},callback:function(){}})}var wu={addApiKey:function(t){gu({url:"/api/user/api_keys",method:"PUT",callback:t})},addFolder:function(t,e,n,r){gu({url:`/api/user/folder/${encodeURIComponent(t)}`,method:"PUT",payload:()=>({share:e,parent_id:n}),callback:r})},addTag:function(t,e){gu({url:"/api/user/tag/"+encodeURIComponent(t),method:"PUT",callback:e})},deleteApiKey:function(t,e){gu({url:"/api/user/api_keys/"+t,method:"DELETE",callback:e})},fetchFolders:function(t){gu({url:"/api/user/folder",method:"GET",callback:t})},fetchProjects:function(t,e,n,r,i,o,a,s){let u="/api/user/projects";const l=[];n&&l.push("filter="+encodeURIComponent(n)),r&&l.push("offset="+encodeURIComponent(r)),i&&l.push("limit="+encodeURIComponent(i)),o&&l.push("search="+encodeURIComponent(o)),a&&l.push("is_recent=true"),s&&l.push("shared=true"),e&&(u+="/folder/"+encodeURIComponent(e)),l.length&&(u+="?"+l.join("&")),gu({url:u,method:"GET",callback:t})},generateSdkToken:function(t){gu({url:"/api/user/generate_sdk_token",method:"GET",callback:t})},getApiKeys:function(t){gu({url:"/api/user/api_keys",method:"GET",callback:t})},getReviewCount:function(t){gu({url:"/api/reviews/count",method:"GET",callback:t})},isUsernameAvailable:function(t,e){gu({url:"/api/user/username?u="+encodeURIComponent(t),method:"GET",callback:e})},logHistory:bu,removeFolder:function(t,e){gu({url:"/api/user/folder/"+encodeURIComponent(t)+"?use_id=1",method:"DELETE",callback:e})},removeTag:function(t,e){gu({url:"/api/user/tag/"+encodeURIComponent(t),method:"DELETE",callback:e})},renameFolder:function(t,e,n){gu({url:"/api/user/folder/"+encodeURIComponent(t)+"/"+encodeURIComponent(e)+"?use_id=1",method:"PUT",callback:n})},renameTag:function(t,e,n){gu({url:"/api/user/tag/"+encodeURIComponent(t)+"/"+encodeURIComponent(e),method:"PUT",callback:n})},revokeSdkToken:function(t,e){gu({url:"/api/user/sdk_token/"+encodeURIComponent(t),method:"DELETE",callback:e})},setSamlProviderId:function(t,e,n){gu({url:"/api/user/"+encodeURIComponent(t)+"/change_saml_provider_id",method:"POST",payload:function(){return{saml_provider_id:e}},callback:n})},moveFolder:function(t,e=!0,n){return new Promise(((r,i)=>{gu({url:`/api/folder/${t}/nest`,method:"PUT",payload:()=>({share:e,parent_id:n}),callback:(t,o)=>{if(t)return i(t);bu({category:"folders",action:"nest",detail:{share:e,parent_id:n}}),r(o)}})}))},update:function(t,e){gu({url:"/api/user",method:"POST",payload:function(){return{fields:t}},callback:e})}};var xu={};function Tu(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Au(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Cu(){}var Eu=.7,ku=1/Eu,Du="\\s*([+-]?\\d+)\\s*",Su="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Lu=/^#([0-9a-f]{3,8})$/,Fu=new RegExp(`^rgb\\(${Du},${Du},${Du}\\)$`),Nu=new RegExp(`^rgb\\(${Mu},${Mu},${Mu}\\)$`),Uu=new RegExp(`^rgba\\(${Du},${Du},${Du},${Su}\\)$`),Ou=new RegExp(`^rgba\\(${Mu},${Mu},${Mu},${Su}\\)$`),Ru=new RegExp(`^hsl\\(${Su},${Mu},${Mu}\\)$`),Iu=new RegExp(`^hsla\\(${Su},${Mu},${Mu},${Su}\\)$`),Hu={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 Bu(){return this.rgb().formatHex()}function ju(){return this.rgb().formatRgb()}function Pu(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Lu.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?zu(e):3===n?new qu(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Yu(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Yu(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=Fu.exec(t))?new qu(e[1],e[2],e[3],1):(e=Nu.exec(t))?new qu(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Uu.exec(t))?Yu(e[1],e[2],e[3],e[4]):(e=Ou.exec(t))?Yu(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ru.exec(t))?Ju(e[1],e[2]/100,e[3]/100,1):(e=Iu.exec(t))?Ju(e[1],e[2]/100,e[3]/100,e[4]):Hu.hasOwnProperty(t)?zu(Hu[t]):"transparent"===t?new qu(NaN,NaN,NaN,0):null}function zu(t){return new qu(t>>16&255,t>>8&255,255&t,1)}function Yu(t,e,n,r){return r<=0&&(t=e=n=NaN),new qu(t,e,n,r)}function $u(t,e,n,r){return 1===arguments.length?((i=t)instanceof Cu||(i=Pu(i)),i?new qu((i=i.rgb()).r,i.g,i.b,i.opacity):new qu):new qu(t,e,n,null==r?1:r);var i}function qu(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Vu(){return`#${Zu(this.r)}${Zu(this.g)}${Zu(this.b)}`}function Wu(){const t=Gu(this.opacity);return`${1===t?"rgb(":"rgba("}${Xu(this.r)}, ${Xu(this.g)}, ${Xu(this.b)}${1===t?")":`, ${t})`}`}function Gu(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Xu(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Zu(t){return((t=Xu(t))<16?"0":"")+t.toString(16)}function Ju(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Qu(t,e,n,r)}function Ku(t){if(t instanceof Qu)return new Qu(t.h,t.s,t.l,t.opacity);if(t instanceof Cu||(t=Pu(t)),!t)return new Qu;if(t instanceof Qu)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Qu(a,s,u,t.opacity)}function Qu(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function tl(t){return(t=(t||0)%360)<0?t+360:t}function el(t){return Math.max(0,Math.min(1,t||0))}function nl(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 rl(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}Tu(Cu,Pu,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Bu,formatHex:Bu,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Ku(this).formatHsl()},formatRgb:ju,toString:ju}),Tu(qu,$u,Au(Cu,{brighter(t){return t=null==t?ku:Math.pow(ku,t),new qu(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Eu:Math.pow(Eu,t),new qu(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qu(Xu(this.r),Xu(this.g),Xu(this.b),Gu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Vu,formatHex:Vu,formatHex8:function(){return`#${Zu(this.r)}${Zu(this.g)}${Zu(this.b)}${Zu(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Wu,toString:Wu})),Tu(Qu,(function(t,e,n,r){return 1===arguments.length?Ku(t):new Qu(t,e,n,null==r?1:r)}),Au(Cu,{brighter(t){return t=null==t?ku:Math.pow(ku,t),new Qu(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Eu:Math.pow(Eu,t),new Qu(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new qu(nl(t>=240?t-240:t+120,i,r),nl(t,i,r),nl(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Qu(tl(this.h),el(this.s),el(this.l),Gu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Gu(this.opacity);return`${1===t?"hsl(":"hsla("}${tl(this.h)}, ${100*el(this.s)}%, ${100*el(this.l)}%${1===t?")":`, ${t})`}`}}));var il=rl("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),ol=rl("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),al=rl("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),sl=rl("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),ul=t=>()=>t;function ll(t){return 1==(t=+t)?cl: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):ul(isNaN(e)?n:e)}}function cl(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):ul(isNaN(t)?e:t)}var dl=function t(e){var n=ll(e);function r(t,e){var r=n((t=$u(t)).r,(e=$u(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=cl(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function fl(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var pl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hl=new RegExp(pl.source,"g");function ml(t,e){var n,r,i,o=pl.lastIndex=hl.lastIndex=0,a=-1,s=[],u=[];for(t+="",e+="";(n=pl.exec(t))&&(r=hl.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:fl(n,r)})),o=hl.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=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 gl,vl=180/Math.PI,yl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _l(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(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,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*vl,skewX:Math.atan(u)*vl,scaleX:a,scaleY:s}}function bl(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],u=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var u=a.push("translate(",null,e,null,n);s.push({i:u-4,x:fl(t,i)},{i:u-2,x:fl(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,u),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:fl(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:fl(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:fl(t,n)},{i:s-2,x:fl(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=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 wl,xl,Tl=bl((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?yl:_l(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Al=bl((function(t){return null==t?yl:(gl||(gl=document.createElementNS("http://www.w3.org/2000/svg","g")),gl.setAttribute("transform",t),(t=gl.transform.baseVal.consolidate())?_l((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):yl)}),", ",")",")"),Cl=0,El=0,kl=0,Dl=1e3,Sl=0,Ml=0,Ll=0,Fl="object"==typeof performance&&performance.now?performance:Date,Nl="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ul(){return Ml||(Nl(Ol),Ml=Fl.now()+Ll)}function Ol(){Ml=0}function Rl(){this._call=this._time=this._next=null}function Il(t,e,n){var r=new Rl;return r.restart(t,e,n),r}function Hl(){Ml=(Sl=Fl.now())+Ll,Cl=El=0;try{!function(){Ul(),++Cl;for(var t,e=wl;e;)(t=Ml-e._time)>=0&&e._call.call(null,t),e=e._next;--Cl}()}finally{Cl=0,function(){var t,e,n=wl,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:wl=e);xl=t,jl(r)}(),Ml=0}}function Bl(){var t=Fl.now(),e=t-Sl;e>Dl&&(Ll-=e,Sl=t)}function jl(t){Cl||(El&&(El=clearTimeout(El)),t-Ml>24?(t<1/0&&(El=setTimeout(Hl,t-Fl.now()-Ll)),kl&&(kl=clearInterval(kl))):(kl||(Sl=Fl.now(),kl=setInterval(Bl,Dl)),Cl=1,Nl(Hl)))}function Pl(t,e,n){var r=new Rl;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Rl.prototype=Il.prototype={constructor:Rl,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Ul():+n)+(null==e?0:+e),this._next||xl===this||(xl?xl._next=this:wl=this,xl=this),this._call=t,this._time=n,jl()},stop:function(){this._call&&(this._call=null,this._time=1/0,jl())}};var zl=su("start","end","cancel","interrupt"),Yl=[],$l=0,ql=1,Vl=2,Wl=3,Gl=4,Xl=5,Zl=6;function Jl(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=ql,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var l,c,d,f;if(n.state!==ql)return u();for(l in i)if((f=i[l]).name===n.name){if(f.state===Wl)return Pl(a);f.state===Gl?(f.state=Zl,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l<e&&(f.state=Zl,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[l])}if(Pl((function(){n.state===Wl&&(n.state=Gl,n.timer.restart(s,n.delay,n.time),s(o))})),n.state=Vl,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Vl){for(n.state=Wl,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=Xl,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);n.state===Xl&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){for(var r in n.state=Zl,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Il(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:zl,tween:Yl,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:$l})}function Kl(t,e){var n=tc(t,e);if(n.state>$l)throw new Error("too late; already scheduled");return n}function Ql(t,e){var n=tc(t,e);if(n.state>Wl)throw new Error("too late; already running");return n}function tc(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ec(t,e){var n,r;return function(){var i=Ql(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function nc(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=Ql(this,t),a=o.tween;if(a!==r){i=(r=a).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)}o.tween=i}}function rc(t,e,n){var r=t._id;return t.each((function(){var t=Ql(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return tc(t,r).value[e]}}function ic(t,e){var n;return("number"==typeof e?fl:e instanceof Pu?dl:(n=Pu(e))?(e=n,dl):ml)(t,e)}function oc(t){return function(){this.removeAttribute(t)}}function ac(t){return function(){this.removeAttributeNS(t.space,t.local)}}function sc(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function uc(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function lc(t,e,n){var r,i,o;return function(){var a,s,u=n(this);if(null!=u)return(a=this.getAttribute(t))===(s=u+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,u));this.removeAttribute(t)}}function cc(t,e,n){var r,i,o;return function(){var a,s,u=n(this);if(null!=u)return(a=this.getAttributeNS(t.space,t.local))===(s=u+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,u));this.removeAttributeNS(t.space,t.local)}}function dc(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function fc(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function pc(t,e){return function(){Kl(this,t).delay=+e.apply(this,arguments)}}function hc(t,e){return e=+e,function(){Kl(this,t).delay=e}}function mc(t,e){return function(){Ql(this,t).duration=+e.apply(this,arguments)}}function gc(t,e){return e=+e,function(){Ql(this,t).duration=e}}var vc=It.prototype.constructor;function yc(t){return function(){this.style.removeProperty(t)}}var _c=0;function bc(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function wc(){return++_c}var xc=It.prototype;bc.prototype={constructor:bc,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=S(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,u,l=r[a],c=l.length,d=o[a]=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,Jl(d[f],e,n,f,d,tc(s,n)));return new bc(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=F(t));for(var r=this._groups,i=r.length,o=[],a=[],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=tc(u,n),m=0,g=p.length;m<g;++m)(f=p[m])&&Jl(f,e,n,m,p,h);o.push(p),a.push(u)}return new bc(o,a,e,n)},selectChild:xc.selectChild,selectChildren:xc.selectChildren,filter:function(t){"function"!=typeof t&&(t=N(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,u=r[i]=[],l=0;l<s;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&u.push(o);return new bc(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u,l=e[s],c=n[s],d=l.length,f=a[s]=new Array(d),p=0;p<d;++p)(u=l[p]||c[p])&&(f[p]=u);for(;s<r;++s)a[s]=e[s];return new bc(a,this._parents,this._name,this._id)},selection:function(){return new vc(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=wc(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,l=0;l<u;++l)if(a=s[l]){var c=tc(a,e);Jl(a,t,n,l,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new bc(r,this._parents,t,n)},call:xc.call,nodes:xc.nodes,node:xc.node,size:xc.size,empty:xc.empty,each:xc.each,on:function(t,e){var n=this._id;return arguments.length<2?tc(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Kl:Ql;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=A(t),r="transform"===n?Al:ic;return this.attrTween(t,"function"==typeof e?(n.local?cc:lc)(n,r,rc(this,"attr."+t,e)):null==e?(n.local?ac:oc)(n):(n.local?uc:sc)(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=A(t);return this.tween(n,(r.local?dc:fc)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Tl:ic;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=et(this,t),a=(this.style.removeProperty(t),et(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,yc(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=et(this,t),s=n(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=et(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s))}}(t,r,rc(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var u=Ql(this,t),l=u.on,c=null==u.value[a]?o||(o=yc(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,o=n+"";return function(){var a=et(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(rc(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=tc(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?ec:nc)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?pc:hc)(e,t)):tc(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?mc:gc)(e,t)):tc(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Ql(this,t).ease=e}}(e,t)):tc(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;Ql(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(o,a){var s={value:a},u={value:function(){0==--i&&o()}};n.each((function(){var n=Ql(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&&o()}))},[Symbol.iterator]:xc[Symbol.iterator]};var Tc,Ac,Cc={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Ec(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 kc(t){var e;if(Tc=Ht(".detailed-settings"),(Ac=Tc.append("div").attr("class","settings-block")).append("h2").text("Back to settings").on("click",(function(){Tc.transition().duration(100).style("opacity",0).on("end",(function(){Ht(this).html("").style("display","none"),Ht(".template-settings").style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),Ht(".template-settings-search").style("display",null).style("opacity",0).transition().duration(200).style("opacity",1)})),Tc.node()})),"string"==typeof t)e=Ac.append("div").html(t);else if("object"==typeof t&&(e=Ac.append(t.type),t.value&&(Ac.node().value=t.value),t.attributes))for(var n in t.attributes)e.attr(n,t.attributes[n]);return e.node().focus(),Ht(".template-settings-search").style("display","none"),Ht(".template-settings").style("display","none"),Tc.style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),Tc.node()}It.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>Vl&&n.state<Xl,n.state=Zl,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},It.prototype.transition=function(t){var e,n;t instanceof bc?(e=t._id,t=t._name):(e=wc(),(n=Cc).time=Ul(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,l=0;l<u;++l)(a=s[l])&&Jl(a,t,e,l,s,n||Ec(a,e));return new bc(r,this._parents,t,e)};var Dc,Sc,Mc,Lc,Fc={},Nc={},Uc={Flourish:{colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#007d8e","#1aa7ee","#29dae4","#88e99a","#019c00","#c11f1f","#730000"]},"Flourish Alternate":{colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#88e99a","#29dae4","#1aa7ee","#019c00","#007d8e","#c11f1f","#730000"]},"Flourish High Fire":{colors:["#730000","#c11f1f","#9654e5","#ff6283","#ff8800","#ffc502"]},"Flourish Low Fire":{colors:["#4328e7","#007d8e","#019c00","#1aa7ee","#29dae4","#88e99a"]},"Flourish Uranium":{colors:["#c11f1f","#ff8800","#ffc502"]},"Flourish Erbium":{colors:["#730000","#9654e5","#ff6283"]},"Flourish Barium":{colors:["#4328e7","#1aa7ee","#29dae4"]},"Flourish Chromium":{colors:["#007d8e","#019c00","#88e99a"]},"Flourish Pale":{colors:["#e667b1","#a193f3","#eb8484","#4bedf3","#d6a4e9","#48ffa7","#ffb1c1","#8cd3f7","#f6c992","#94ecf1","#ffe281","#c4f4cd"]},"Flourish Deep":{colors:["#430b2b","#1d0e7a","#611010","#04393b","#5a1c72","#004826","#b10025","#09557b","#0f7277","#816300","#1d9c34"]},"Flourish Mono":{colors:["#000000","#6a6a6a","#959595","#dddddd"]},"Flourish Legacy":{scheme:"flourish_default_1",colors:["#1D6996","#EDAD08","#73AF48","#94346E","#38A6A5","#E17C05","#5F4690","#0F8554","#6F4070","#CC503E","#994E95","#666666"]},"Flourish Legacy Alternate":{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:il},Dark:{scheme:"schemeDark2",colors:ol},Paired:{scheme:"schemePaired",colors:al},Pale:{scheme:"schemePastel1",colors:sl},"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"]}},Oc={};function Rc(){var t,e={};for(t in Oc)e[t]=Oc[t];for(t in Uc)e[t]=Uc[t];return e}var Ic="Edit color palette";function Hc(t){t&&t.length?(Oc={},t.forEach((function(t){var e=Object.keys(t)[0];Oc[e]={colors:t[e]}}))):Oc={},function(){for(var t in Fc){Fc[t].setOptions(jc())}}()}function Bc(){if(void 0!==Dc)return Dc;var t=document.createElement("input");return t.setAttribute("type","color"),t.setAttribute("value","!"),Dc="color"==t.type&&"!"!==t.value}function jc(){var t=[],e=Rc();for(var n in t.push([Ic,""]),e)t.push([n,e[n].colors.join("|")]);return t}function Pc(t,e){var n=t[0],r=t[1];if(!r){const t=Bt("em");return t.append("i").classed("fa fa-pencil",!0),t.node().append(Ic),t.node()}Array.isArray(r)||(r=r.split("|"));const i=[];if(e&&n){const t=Bt("label").text(n);i.push(t.node())}return r.forEach((function(t,e){const n=Bt("span").attr("data-index",e).style("background-color",t);i.push(n.node())})),i}function zc(t,e){var n,r,i=Rc(),o=t.parentNode.querySelector(".color-swatches");if(Array.isArray(e))r=e;else if("string"==typeof e){if(i[e])n=e;else for(var a in i)if(i[a].scheme==e){n=a;break}n&&(r=i[n].colors)}if(!r||!r.length)return t.parentNode.classList.remove("custom"),t.removeAttribute("data-value"),t.value="",void(o.innerHTML="");o.innerHTML="",o.append(...Pc([null,r])),t.setAttribute("data-value",r.join("|"))}function Yc(t){Lc=t.target,t.dataTransfer.setData("text/plain","x"),event.dataTransfer.effectAllowed="move",Ht(Lc).classed("dragging",!0),jt(".palette p:not(.dragging) input").style("pointer-events","none")}function $c(t){t.preventDefault();var e=Ht(".palette").selectAll("[draggable='true']").style("border-color",null),n=Ht(t.target);if("true"===n.attr("draggable")){var r="bottom";if(n.node()===e.nodes()[0]){var i=t.target.getBoundingClientRect(),o=i.top+i.height/2;t.clientY<o&&(r="top")}Ht(t.target).style("border-"+r,"1px solid black")}}function qc(t){if(Lc){for(var e=t.target;e&&("P"!==e.tagName||!e.nextSibling);)e=e.parentNode;if(e){var n=e.nextSibling;if(e===Ht(".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(Lc,n),Lc=!1,Gc()}}}function Vc(){Ht(Lc).classed("dragging",!1),jt(".palette *").style("border-bottom",null).style("border-top",null),jt(".palette p input").style("pointer-events",null)}function Wc(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=Xc("#000000");e.insertAdjacentHTML("beforebegin",n),Gc()}(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");Gc()}(e.parentNode))}function Gc(){for(var t=Mc.getAttribute("data-autocomplete"),e=Fc[t],n=[],r=Sc.querySelectorAll(".palette input[type=text]"),i=0;i<r.length;i++)n.push(r[i].value);var o=e.getOptions();Nc[t]?o[0][1]=n.join("|"):o.unshift(["Custom",n.join("|")]),Nc[t]=n,e.setOptions(o),zc(Mc,n),Ht(Mc).dispatch("change")}function Xc(t){const e=Bt("p").attr("draggable",!0);return e.append("span").classed("swatch-handle",!0).text(".. .. .."),Bc()?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 Zc(t){var e=t.target,n=e.value,r=e.parentNode;if(!n)return r.parentNode.removeChild(r),void Gc();var i=Pu(n);if(!i)return console.warn("bad color",n),"color"==e.type?e.value=e.nextSibling.value:Bc()?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:Bc()?e.previousSibling.value=i.hex():e.previousSibling.style.backgroundColor=n,Gc()}var Jc,Kc,Qc={initialize:function(t,e){e.choices&&Hc(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";Fc[r]=new to({input:t,id:r,mode:"single",options:jc(),options_config:{custom_renderer:Pc}}),t.addEventListener("change",(function(e){t.value==Ic?(e.stopImmediatePropagation(),t.value="",function(t){Mc=t;var e=(Sc=kc({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,o=Pu(i);o?n.push(o.hex()):(console.warn("Bad color",i),n.push("#000000"))}return n}(t),r="";n.forEach((function(t){r+=Xc(t)})),r+="<p><button class='fa fa-plus-square clickable'></button></p>",e.innerHTML=r,e.addEventListener("change",Zc),e.addEventListener("dragstart",Yc),e.addEventListener("dragover",$c),e.addEventListener("drop",qc),e.addEventListener("dragend",Vc),e.addEventListener("click",Wc)}(t)):zc(t,(t.getAttribute("data-value")||"").split("|"))}))},update:zc,getValue:function(t){var e=t.getAttribute("data-value");return e?e.split("|"):null},replaceThemeColors:Hc},td={};const ed={style:!0,url:!0,flourish_embed:!0};var nd={h1:{path:"M0.00100708 0.524002V9H1.91201V5.464H4.83701V9H6.76101V0.524002H4.83701V3.787H1.91201V0.524002H0.00100708ZM8.91 7.453V9H14.162V7.453H12.615V0.744995H11.211C10.9163 0.918329 10.613 1.06566 10.301 1.187C9.989 1.30833 9.60767 1.41233 9.157 1.499V2.682H10.704V7.453H8.91Z",width:14,height:9},h2:{path:"M0.00100708 0.524002V9H1.91201V5.464H4.83701V9H6.76101V0.524002H4.83701V3.787H1.91201V0.524002H0.00100708ZM8.24078 7.908V9H14.0518V7.388H12.3878C12.1884 7.388 11.9588 7.401 11.6988 7.427C11.4474 7.44434 11.2178 7.466 11.0098 7.492C11.3478 7.14534 11.6728 6.79434 11.9848 6.439C12.3054 6.07501 12.5871 5.71534 12.8298 5.36C13.0811 4.996 13.2804 4.63634 13.4278 4.281C13.5751 3.917 13.6488 3.56167 13.6488 3.215C13.6488 2.81634 13.5838 2.45667 13.4538 2.136C13.3238 1.81534 13.1374 1.54234 12.8948 1.317C12.6521 1.083 12.3618 0.905338 12.0238 0.784004C11.6944 0.654004 11.3261 0.589005 10.9188 0.589005C10.3294 0.589005 9.82245 0.701671 9.39778 0.927004C8.97311 1.14367 8.55711 1.46867 8.14978 1.902L9.18978 2.929C9.39778 2.70367 9.61878 2.50867 9.85278 2.344C10.0868 2.17067 10.3554 2.084 10.6588 2.084C11.0228 2.084 11.3088 2.19234 11.5168 2.409C11.7248 2.617 11.8288 2.92467 11.8288 3.332C11.8288 3.62667 11.7378 3.93867 11.5558 4.268C11.3824 4.58867 11.1354 4.93967 10.8148 5.321C10.5028 5.69367 10.1258 6.09667 9.68378 6.53C9.25045 6.95467 8.76945 7.414 8.24078 7.908Z",width:15,height:9},bold:{path:"M0.00100708 9V0.524002H2.90001C3.34201 0.524002 3.74934 0.558669 4.12201 0.628002C4.50334 0.688669 4.83267 0.801335 5.11001 0.966002C5.39601 1.13067 5.61701 1.34734 5.77301 1.616C5.93767 1.88467 6.02001 2.22267 6.02001 2.63C6.02001 2.82067 5.99401 3.01134 5.94201 3.202C5.89001 3.39267 5.81634 3.57034 5.72101 3.735C5.62567 3.89967 5.50867 4.047 5.37001 4.177C5.24001 4.307 5.08834 4.40234 4.91501 4.463V4.515C5.13167 4.567 5.33101 4.64934 5.51301 4.762C5.69501 4.866 5.85534 5.00034 5.99401 5.165C6.13267 5.32967 6.24101 5.52467 6.31901 5.75C6.39701 5.96667 6.43601 6.218 6.43601 6.504C6.43601 6.93734 6.34934 7.31 6.17601 7.622C6.01134 7.934 5.77734 8.194 5.47401 8.402C5.17934 8.60134 4.83267 8.753 4.43401 8.857C4.03534 8.95234 3.60634 9 3.14701 9H0.00100708ZM1.91201 3.917H2.80901C3.27701 3.917 3.61501 3.826 3.82301 3.644C4.03967 3.462 4.14801 3.21934 4.14801 2.916C4.14801 2.58667 4.03967 2.35267 3.82301 2.214C3.60634 2.07534 3.27267 2.006 2.82201 2.006H1.91201V3.917ZM1.91201 7.518H2.99101C4.03967 7.518 4.56401 7.13667 4.56401 6.374C4.56401 6.00134 4.43401 5.737 4.17401 5.581C3.91401 5.41634 3.51967 5.334 2.99101 5.334H1.91201V7.518Z",width:7,height:9},italic:{path:"M7 1.44444H5.06656L3.6687 8.05556H5.5V9H0.5V8.05556H2.6547L4.05256 1.44444H2V0.5H7V1.44444Z",width:7,height:9},line_break:{description:"Add line break",path:"M14 0V6H3.83L6.41 3.41L5 2L0 7L5 12L6.41 10.59L3.83 8H16V0H14Z",width:16,height:12},url:{description:"Add URL",path:"M8.03571429,6.69642857 C8.03571429,6.5476183 7.98363147,6.42113147 7.87946429,6.31696429 L6.71875,5.15625 C6.61458281,5.05208281 6.48809598,5 6.33928571,5 C6.18303493,5 6.0491077,5.05952321 5.9375,5.17857143 L6.16350446,5.40178571 L6.16350446,5.40178571 L6.21434766,5.4637896 C6.22447497,5.4770171 6.23542901,5.49169139 6.24720982,5.5078125 C6.28255226,5.55617584 6.30673357,5.6036084 6.31975446,5.65011161 C6.33277536,5.69661482 6.33928571,5.74776758 6.33928571,5.80357143 C6.33928571,5.9523817 6.2872029,6.07886853 6.18303571,6.18303571 C6.07886853,6.2872029 5.9523817,6.33928571 5.80357143,6.33928571 C5.74776758,6.33928571 5.69661482,6.33277536 5.65011161,6.31975446 C5.6036084,6.30673357 5.55617584,6.28255226 5.5078125,6.24720982 L5.42844742,6.18644594 L5.42844742,6.18644594 L5.37357392,6.13653276 L5.37357392,6.13653276 L5.17857143,5.9375 L5.17857143,5.9375 C5.05580296,6.05282796 4.99441964,6.18861529 4.99441964,6.34486607 C4.99441964,6.49367634 5.04650246,6.62016317 5.15066964,6.72433036 L6.30022321,7.87946429 C6.40067015,7.97991122 6.52715698,8.03013393 6.6796875,8.03013393 C6.82849777,8.03013393 6.9549846,7.98177132 7.05915179,7.88504464 L7.87946429,7.0703125 C7.98363147,6.96614531 8.03571429,6.84151858 8.03571429,6.69642857 Z M4.11272321,2.76227679 C4.11272321,2.61346652 4.0606404,2.48697969 3.95647321,2.3828125 L2.80691964,1.22767857 C2.70275246,1.12351138 2.57626562,1.07142857 2.42745536,1.07142857 C2.28236535,1.07142857 2.15587852,1.12165128 2.04799107,1.22209821 L1.22767857,2.03683036 C1.12351138,2.14099754 1.07142857,2.26562427 1.07142857,2.41071429 C1.07142857,2.55952455 1.12351138,2.68601138 1.22767857,2.79017857 L2.38839286,3.95089286 C2.48883979,4.05133979 2.61532662,4.1015625 2.76785714,4.1015625 C2.92410792,4.1015625 3.05803516,4.04389939 3.16964286,3.92857143 L2.94363839,3.70535714 L2.94363839,3.70535714 L2.85993304,3.59933036 L2.85993304,3.59933036 C2.8245906,3.55096702 2.80040929,3.50353446 2.78738839,3.45703125 C2.77436749,3.41052804 2.76785714,3.35937528 2.76785714,3.30357143 C2.76785714,3.15476116 2.81993996,3.02827433 2.92410714,2.92410714 C3.02827433,2.81993996 3.15476116,2.76785714 3.30357143,2.76785714 C3.35937528,2.76785714 3.41052804,2.77436749 3.45703125,2.78738839 C3.50353446,2.80040929 3.55096702,2.8245906 3.59933036,2.85993304 L3.70535714,2.94363839 L3.70535714,2.94363839 L3.92857143,3.16964286 L3.92857143,3.16964286 C4.0513399,3.0543149 4.11272321,2.91852757 4.11272321,2.76227679 Z M8.63839286,5.55803571 C8.95089442,5.87053728 9.10714286,6.24999777 9.10714286,6.69642857 C9.10714286,7.14285938 8.94903432,7.52045977 8.6328125,7.82924107 L7.8125,8.64397321 C7.50371869,8.95275452 7.1261183,9.10714286 6.6796875,9.10714286 C6.22953644,9.10714286 5.85007595,8.94903432 5.54129464,8.6328125 L4.39174107,7.47767857 C4.08295977,7.16889727 3.92857143,6.79129688 3.92857143,6.34486607 C3.92857143,5.8872745 4.09226027,5.4985135 4.41964286,5.17857143 L3.92857143,4.6875 C3.60862935,5.01488259 3.22172846,5.17857143 2.76785714,5.17857143 C2.32142634,5.17857143 1.94196585,5.02232299 1.62946429,4.70982143 L0.46875,3.54910714 C0.156248437,3.23660558 -8.52651283e-14,2.85714509 -8.52651283e-14,2.41071429 C-8.52651283e-14,1.96428348 0.158108538,1.58668309 0.474330357,1.27790179 L1.29464286,0.463169643 C1.60342416,0.154388337 1.98102455,1.42108547e-14 2.42745536,1.42108547e-14 C2.87760642,1.42108547e-14 3.25706691,0.158108538 3.56584821,0.474330357 L4.71540179,1.62946429 C5.02418309,1.93824559 5.17857143,2.31584598 5.17857143,2.76227679 C5.17857143,3.21986836 5.01488259,3.60862935 4.6875,3.92857143 L5.17857143,4.41964286 C5.4985135,4.09226027 5.8854144,3.92857143 6.33928571,3.92857143 C6.78571652,3.92857143 7.16517701,4.08481987 7.47767857,4.39732143 L8.63839286,5.55803571 Z",width:9.5,height:9.5},flourish_embed:{description:"Add Flourish embed",path:"M7.57358 5.28931L10.1281 6.04854L10.0432 6.517L7.37515 6.22624L9.44904 7.9224L9.20119 8.29833L6.86556 7.0207L8.11097 9.37696L7.7504 9.62552L6.06604 7.5604L6.34206 10.2078L5.89578 10.2926L5.11055 7.73772L4.36044 10.2926L3.89331 10.2078L4.16934 7.5604L2.50622 9.62552L2.12402 9.37696L3.38372 7.0207L1.04113 8.29833L0.793673 7.9224L2.88146 6.22624L0.213045 6.517L0.128113 6.04854L2.6479 5.28931L0.128113 4.53667L0.213045 4.06859L2.88146 4.35974L0.793673 2.66319L1.04113 2.28687L3.38372 3.56451L2.12402 1.20824L2.50622 0.960069L4.16934 3.02519L3.89331 0.377778L4.36044 0.292603L5.11055 2.84787L5.89578 0.292603L6.34206 0.377778L6.06604 3.02519L7.7504 0.960069L8.11097 1.20824L6.86556 3.56451L9.20119 2.28687L9.44904 2.66319L7.37515 4.35974L10.0432 4.06859L10.1281 4.53667L7.57358 5.28931Z",width:10,height:10}};function rd(t,e){td=e||ed;var n=Ht(Kc=kc({type:"div",attributes:{class:"text-editor-container settings-option"}})).select(".text-editor-container").html("");for(var r in n.append("div").attr("class","text-settings"),n.append("textarea").text(t.value).attr("class","text-input").on("blur",(function(){t.value=this.value,Ht(t).dispatch("change")})),td)td[r]&&id(r);(td.bindings||td.bindings_custom)&&(n.append("div").attr("class","text-bindings"),od()),on()}function id(t){if("bindings"!=t&&"bindings_custom"!=t){var e=Ht(Kc).select(".text-settings").append("div").attr("class","editor-section");if("style"==t){["h1","h2","bold","italic","line_break"].forEach((function(t){var n=nd[t].description?nd[t].description:"Add "+t+" text";e.append("div").attr("class","editor-button popup").attr("data-action",t).attr("data-popup-body",n).attr("data-popup-position","top").on("click",ad).append("svg").attr("height",nd[t].height).attr("width",nd[t].width).attr("viewBox","0 0 "+nd[t].width+" "+nd[t].height).append("path").attr("fill","#333333").attr("d",nd[t].path)}))}else{var n=nd[t].description?nd[t].description:"Add "+t;e.append("div").attr("class","editor-button popup").attr("data-action",t).attr("data-popup-body",n).attr("data-popup-position","top").on("click",ad).append("svg").attr("height",nd[t].height).attr("width",nd[t].width).attr("viewBox","0 0 "+nd[t].width+" "+nd[t].height).append("path").attr("fill","#333333").attr("d",nd[t].path)}}}function od(){if(td.bindings||td.bindings_custom){var t;if(Array.isArray(td.bindings))t={},td.bindings.forEach((function(e){var n=e.split("."),r=n[0],i=n.length>1?n[1]:null;i&&(t[r]||(t[r]=[]),t[r].push(i))}));else if(!0===td.bindings)t=null;else if(!Array.isArray(td.bindings_custom))return;var e=Jc.visualisation.data_bindings[Jc.visualisation.template_id],n={},r=[];Jc.visualisation.data_tables.forEach((function(t){n[t.id]=t.cached_data[0]}));var i=null!==t;for(var o in e)if(!i||t[o]){var a=e[o];for(var s in a)if(!i||t[o].includes(s)){var u=a[s];if(null!=u.column){var l=n[u.data_table_id][u.column];l&&!r.includes(l)&&r.push(l)}else u.columns&&u.columns.forEach((function(t){var e=n[u.data_table_id][t];e&&!r.includes(e)&&r.push(e)}))}}td.bindings_custom&&Array.isArray(td.bindings_custom)&&td.bindings_custom.forEach((function(t){t[0]&&t[1]&&r.push({name:t[0],binding:t[1],type:"dynamic"})})),Ht(".text-bindings").html("").style("display",r.length?null:"none").append("p").text("Click to add values from your data"),Ht(".text-bindings").selectAll("button.binding").data(r).enter().append("button").attr("data-action","binding").attr("data-binding",(function(t){return"object"==typeof t?t.binding:t})).attr("data-type",(function(t){return"object"==typeof t?t.type:null})).on("click",ad).text((function(t){return"object"==typeof t?t.name:t}))}}function ad(){var t,e=Ht(".text-editor-container .text-input"),n=e.node().value,r=e.node().selectionStart,i=e.node().selectionEnd,o=i-r,a=n.substr(r,o),s=Ht(this).attr("data-action"),u="flourish_embed"==s?prompt("Specify the ID of published Flourish project (eg. story/123 or visualisation/124)","visualisation/"):"";if("bold"==s)t=sd(a,"<b>","</b>");else if("italic"==s)t=sd(a,"<i>","</i>");else if("h1"==s)t=sd(a,"<h1>","</h1>");else if("h2"==s)t=sd(a,"<h2>","</h2>");else if("line_break"==s)t=sd(a,"<br>","");else if("url"==s)t=sd(a,'<a href ="">',"</a>",10);else if("flourish_embed"==s)t=sd(u,'<iframe src="https://flo.uri.sh/','/embed" frameborder="0" scrolling="no" style="width:100%;height:400px;"></iframe>');else if("binding"==s){var l=Ht(this).attr("data-binding");t=sd(l,"{{","}}",l.length+4)}e.node().setRangeText(t.text,r,i),e.node().focus(),e.node().selectionStart=r+t.cursor,e.node().selectionEnd=r+t.cursor}function sd(t,e,n,r){return e=e||"",n=n||"",t=t||"",{cursor:r||e.length+t.length,text:e+t+n}}var ud,ld,cd,dd={initialize:function(t,e,n){Jc=t,Ht(e.parentElement).append("div").attr("class","text-editor-btn").attr("tabindex","0").on("click",(function(){rd(e,n.editor)})).on("keydown",(function(t){13==t.keyCode&&rd(e,n.editor)})).append("i").attr("class","fa fa-paint-brush")},updateDataBindings:od},fd=void 0,pd=/fa-(\S*)/g,hd=/^data:image\/(svg|svg\+xml|png|jpg);base64,[A-Z-a-z0-9+/=]*$/,md=/^gradient:/g;function gd(t){var e=!Ht(t.parentNode).classed("open");jt(".template-settings .settings-block").classed("open",!1).attr("aria-expanded",!1),e&&Ht(t.parentNode).classed("open",!0).attr("aria-expanded",!0)}function vd(t){if(t){fd={};for(var e=0,n=null,r=null,i=ud&&ud.user?ud.user.template_settings_overrides:{},o=0;o<t.length;o++){var a=t[o];if("string"!=typeof a){if("object"!=typeof a||n||r||(e++,r=cd.append("div").attr("class","toplevel-settings-block")),"hidden"!==a.type){var s=n||r;if(a.new_section&&(s.append("div").classed("settings-divider",!0),"string"==typeof a.new_section&&s.append("h3").classed("settings-subhead",!0).text(a.new_section)),void 0!==a.show_if){if(a.show_condition)throw new Error("BUG: show_if present as well as show_condition");a.show_condition=[{type:"show",condition:a.show_if}],delete a.show_if}else if(void 0!==a.hide_if){if(a.show_condition)throw new Error("BUG: hide_if present as well as show_condition");a.show_condition=[{type:"hide",condition:a.hide_if}],delete a.hide_if}fd[a.property]=a.type,yd(s.append("div"),a,i)}}else r=null,(n=cd.append("div").attr("class","settings-block")).append("h2").attr("class","no-select").attr("tabindex","0").text(a).on("click",(function(){gd(this)})).on("keyup",(function(t){13===t.keyCode&&gd(this)})),n.classed("open",e<1),n.attr("aria-expanded",e<1),"State documentation"===a&&n.style("display","none"),e++}jt(".upgrade-setting").on("click",(function(){!function(t,e,n,r){var i=[],o=[];i.push(["Upgrade to a premium account to get:"]),o.push(["<strong>Branding control:</strong> Add custom logos, colors, and styles to keep your projects consistent with your brand identity","<strong>Logo removal:</strong> Embed your projects without the Flourish logo appended","<strong>Team management:</strong> Seamlessly manage your team with our collaboration and approval features"]);var a=Math.floor(Math.random()*i.length),s=Math.floor(Math.random()*o.length),u="title"+a+"-list"+s,l=[{text:"Upgrade now",class:"convert",tag_name:"a",href:"https://flourish.studio/pricing",target:"_blank",keyCode:13,callback:function(){t.analytics("event","upgrade-click",{upgrade_id:u}),wu.logHistory({category:"upgrade",action:"clicked",detail:r})}},{text:"Maybe later",keyCode:27,class:"secondary",callback:function(){t.analytics("event","upgrade-close",{upgrade_id:u}),wu.logHistory({category:"upgrade",action:"closed",detail:r})}}];t.analytics("event","upgrade-open",{upgrade_id:u}),wu.logHistory({category:"upgrade",action:"viewed",detail:r}),Ki(e,n,{buttons:l,is_html:!0,upgrade:{message:i[a],list:o[s],is_business:!0}})}(ud,"This is a premium feature","Upgrade your plan to change this setting.","upgrade-settings")})),on()}}function yd(t,e,n){e.upgrade=e.property in n;var r="html"==e.type,i=e.choices&&("buttons"==e.style||"boolean"==e.type);t.attr("class","settings-option option-type-"+e.type+(i?" settings-buttons":"")+(r?" text-editor":"")+(e.upgrade?" upgrade-setting":""));var o=t.append("label").attr("for","setting-"+e.property).classed("hidden",null==e.name).append("h3").text(e.name).classed("no-select",!0);(e.upgrade||e.description)&&o.append("i").style("font-family","FontAwesome").classed("fa setting-tooltip popup",!0).classed("fa-star tooltip-upgrade",e.upgrade).classed("fa-question tooltip-help",!e.upgrade).style("background-color",e.upgrade?"#93366e":null).attr("tabindex","0").attr("data-popup-head",e.upgrade?"This is a premium feature":null).attr("data-popup-body",e.description?e.description.replace(/\[\[/g,"").replace(/\]\]/g,""):null).attr("data-popup-allow-interaction",!0).attr("data-popup-constrainer",".settings-block"),e.width&&t.classed("width-"+e.width.replace(/ /g,"-"),!0);var a="input";if(["text","code","html"].includes(e.type)&&(a="textarea"),"code"==e.type){var s=!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(){s=!s,Ht(this.parentNode).select("textarea").attr("wrap",s?null:"off"),Ht(this).classed("selected",s)}))}var u=t.append(a).attr("id","setting-"+e.property).attr("class","setting").attr("name",e.property).attr("disabled",!ud.visualisation.can_edit||null),l=u.node();if("colors"==e.type)Qc.initialize(l,e);else if("font"==e.type)tu.initialize(l,e,ud.user&&null!=ud.user.company_id);else if("number"==e.type)l.setAttribute("type","number"),null!=e.min&&l.setAttribute("min",e.min),null!=e.max&&l.setAttribute("max",e.max),e.step&&l.setAttribute("step",e.step);else if("url"==e.type)l.setAttribute("type","url"),ld.addButton(l,e.upgrade);else if(i){u.remove(),u=t.append("div").attr("id","setting-"+e.property).attr("name",e.property).classed("buttons-container",!0).classed("large","large"==e.size),l=u.node();var c=e.choices.length,d=[3,4,5],f=function(){if(c<=2)return{column_count:c,rows:1};var t=d.map((function(t){return{column_count:t,orphans:c%t/t,rows:c/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){u.append("input").attr("type","radio").attr("name",e.property).attr("value",t[1]).attr("id",e.property+"_"+n).attr("class","setting").attr("disabled",!ud.visualisation.can_edit||null).call(_d(e)),xd(t,u.append("label").attr("for",e.property+"_"+n).style("width",100/f.column_count+"%").style("border-radius",(function(){var t=f.column_count,e=Math.ceil(f.rows),r=t*e-c;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===c-(t-r)?"0 0 0 3px":n===c-1&&0===r?"0 0 3px 0":null:null})).node())}))}else"boolean"==e.type?(l.setAttribute("type","checkbox"),t.classed("slider-container",!0),t.append("label").attr("class","slider").attr("for","setting-"+e.property)):l.setAttribute("type","text");if("code"==e.type&&(l.setAttribute("wrap","off"),u.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}}))),r&&(t.append("div").attr("class","text-editor-setting").node().appendChild(l),dd.initialize(ud,l,e)),e.choices&&"string"==e.type&&"buttons"!=e.style&&(l._dropdown=new to({input:l,id:e.property+"-dropdown",options:e.choices,options_config:{allow_other_option:e.choices_other,custom_renderer:xd},mode:"single"})),"color"==e.type){Ht(l).classed("color",!0).style("display","none");var p=Ht(l.parentNode).append("div").attr("class","color-picker"),h=p.append("div").attr("class","color-wrapper");e.optional&&p.append("div").attr("class","cancel-setting popup").attr("tabindex","0").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 keydown",(function(t){t.keyCode&&13!==t.keyCode||(l.value="",u.dispatch("change"),Ht(this.parentNode).classed("is-null",!0))})),h.append("input").attr("type","color").on("change",(function(){l.value=this.value,u.dispatch("change"),Ht(this.parentNode.parentNode).classed("is-null",!1)})).on("focus",(function(){Ht(this.parentNode.parentNode).classed("active",!0)})).on("blur",(function(){Ht(this.parentNode.parentNode).classed("active",!1)}))}e.placeholder&&l.setAttribute("placeholder",e.placeholder),e.size&&l.classList.add("size-"+e.size),u.call(_d(e))}function _d(t){return function(e){var n=!1;e.on("change",(function(){var e=this;Je.hide(),n=!0,ud.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,o=Td,a=[t,e,n],clearTimeout(xu[r]),xu[r]=setTimeout((function(){o.apply(window,a),delete xu[r]}),i);var r,i,o,a}(e,t,(function(r){if(!r)return n=!1,void("SELECT"==e.tagName&&Ht(e).dispatch("blur"));var o="radio"==e.type?e.nextSibling:e;Je.point(o).text("Not changed: "+(r.message||r)).draw();var a={};a[t.property]=i,ud.preview_pane.setState(a,(function(r){if(r)return console.error("Failed to revert setting "+t.property+" to value: "+i),void(n=!1);ud.preview_pane.update((function(r){if(r)return console.error("Failed to update after reverting setting "+t.property+" to value: "+i),void(n=!1);wd(e,i),n=!1}))}))})):(e.value=i,void(n=!1))}))})).on("keydown",(function(t){ud.confirm.blank(),13==t.keyCode&&Je.hide()})).on("blur",(function(){if(!n){var e=this;Je.hide(),ud.preview_pane.getState(t.property,(function(n,r){n?console.error("Failed to get state property "+t.property,n):wd(e,r)}))}}))}}function bd(t,e,n){if(t.classList.contains("colors"))return Qc.getValue(t);if(t.classList.contains("font-menu")){var r=tu.getValue(t);return e&&!r?n?null:"":r}if(t.classList.contains("buttons-container")){for(var i,o=t.querySelectorAll("input[type='radio']"),a=0;a<o.length;a++)if(o[a].checked){i=o[a];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 wd(t,e){if(t.classList.contains("colors"))Qc.update(t,e);else if(t.classList.contains("font-menu"))tu.update(t,e);else if("checkbox"==t.getAttribute("type"))t.checked=e;else if(t.classList.contains("color"))t.value=e,Ht(t.parentNode).select(".color-picker").classed("is-null",null===e),Ht(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<ud.settings.length;e++){var n=ud.settings[e];if(n.property===t)return n}}(t.name),r=0;r<n.choices.length;r++){var i,o,a=n.choices[r];if("string"==typeof a?i=o=a:(i=a[1],o=a[0]),e==i)return t.value=o,t.setAttribute("data-value",i),void(t._dropdown&&t._dropdown.setSelectedOptions(a))}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 xd(t,e){var n=Ht(e);if("string"!=typeof t){var r=t[2];if(r)if(r.match(pd))n.append("i").attr("class","fa "+r);else if(r.match(hd))n.append("img").attr("src",r);else if(r.match(md)){var i=r.replace("gradient:","");n.append("div").attr("class","gradient-swatch").style("width","15px").style("height","15px").style("margin-right","5px").style("border-radius","15px").style("background","linear-gradient(to right, "+i+")")}var o=t[0];o.match(pd)?n.append("i").attr("class","fa "+o):o.match(hd)?n.append("img").attr("src",o):n.node().append(o)}else n.text(t)}function Td(t,e,n){var r={},i=bd(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)){ud.confirm.saving();var o=!1,a={};a[e.property]=bd(t,e.optional,!0),ud.preview_pane.setState(a,(function(t){if(t)return s(t);ud.preview_pane.update((function(t){if(t)return s(t);ud.visualisation.updateSettings(r,(function(t){if(t)return s(t);ud.analytics("event","visualisation",{change_setting:ud.visualisation.id}),Ed(),ud.confirm.saved(),n&&n()}))}))}))}else n&&n("You can only choose values from the list");function s(r){o||(ud.preview_pane.getState(e.property,(function(e,i){if(e)return console.error("Failed to get state",e),void ud.confirm.error(e);wd(t,i),Ed(),ud.confirm.blank(),n&&n(r)})),o=!0)}}function Ad(t,e){return/^data\./.test(t)?function(t,e){var n=t.split(".");return ud.visualisation.__sdk__?function(t,e){if(t.length>=4)return;for(var n=null,r=ud.template_data_bindings,i=0;i<r.length;i++){var o=r[i];if("string"!=typeof o&&(o.dataset===t[1]&&o.key===t[2])){n=o;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=ud.visualisation.template_id,r=ud.visualisation.data_bindings[n][t[1]][t[2]];if(null==r)return!1;for(var i,o=ud.visualisation.data_tables,a=r.data_table_id,s=r.columns||[r.column],u=0;u<o.length;u++)if(o[u].id===a){i=o[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=bd(n);if(e instanceof Array)return-1!==e.indexOf(r);return r===e}(t,e)}function Cd(t){if("boolean"==typeof t)return t;if("string"==typeof t)return Ad(t,!0);if("object"==typeof t){for(var e in t)if(!Ad(e,t[e]))return!1;return!0}}function Ed(){ud.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;let n=t.condition;Array.isArray(n)||(n=[n]);for(let t=0;t<n.length;t++){if(Cd(n[t]))return e}return!e})),n=document.getElementById("setting-"+t.property);if(n){for(var r=n;!r.classList.contains("settings-option");)r=r.parentNode;if(Ht(r).classed("hidden",!e),t.new_section)for(var i=r.previousSibling;i&&(Ht(i).classed("settings-divider")||Ht(i).classed("settings-subhead"));)Ht(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, .template-settings .toplevel-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 kd(t,e,n){return ud=t,ld={setup:Os,addButton:Rs,startUpload:Hs},(cd=Ht(".side-panel .template-settings")).on("submit",(function(t){t.preventDefault()})),Qc.replaceThemeColors(e),tu.replaceThemeFonts(n),vd(ud.settings),function(){function t(e,n){return!e||e.classList.contains("template-settings")?null:e.classList.contains(n)?e:t(e.parentNode,n)}function e(t){return t.replace(/ /g,"").replace(/-/g,"").toLowerCase().trim()}Ht(".side-panel .template-settings-search").on("input",(function(n){var r=e(n.target.value),i=!r,o=Ht(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden) h3, .settings-subhead:not(.hidden)");Ht(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden), .settings-subhead:not(.hidden), .settings-divider:not(.hidden)").classed("search-filtered-out",!i),i||o.filter((function(){var t=e(this.innerText);return!!t&&t.indexOf(r)>-1})).each((function(){var e=t(this,"settings-block"),n=Ht(this);if("H2"==this.tagName)e&&Ht(e).selectAll("h2, .settings-option, .settings-subhead, .settings-divider").classed("search-filtered-out",!1);else if("H3"==this.tagName)if(e&&Ht(e).select("h2").classed("search-filtered-out",!1),n.classed("settings-subhead")){n.classed("search-filtered-out",!1),this.previousSibling.classList.remove("search-filtered-out");for(var r=this.nextSibling;r&&r.classList.contains("settings-option");)r.classList.remove("search-filtered-out"),r=r.nextSibling}else{var i=t(this,"settings-option");if(i){i.classList.remove("search-filtered-out");for(var o=null,a=i.previousSibling;a&&null==o;)a.classList.contains("settings-subhead")?o=a:a=a.classList.contains("settings-divider")?null:a.previousSibling;o&&(o.classList.remove("search-filtered-out"),o.previousSibling.classList.remove("search-filtered-out"))}}}))}))}(),Ht(".side-panel-scrollbox").on("scroll",(function(){Je.hide()})),{update:function(t){cd.html(""),Ht(".current-template").style("opacity","1"),vd(ud.settings=t)},populate:function(){ud.preview_pane.getState((function(t,e){if(t)console.error("Failed to get state",t);else{var n=Ka(e);for(var r in n){var i=document.getElementById("setting-"+r);i&&wd(i,n[r])}dd.updateDataBindings(),Ed()}}))},getSettingsForCurrentTemplate:function(){return fd},setReadOnly:function(){jt(".setting").each((function(){Ht(this).attr("disabled",!0)}))},unsetReadOnly:function(){jt(".setting").each((function(){Ht(this).attr("disabled",null)}))}}}var Dd,Sd,Md=!1,Ld=[],Fd=100;function Nd(){Ht(".flourish-warn-list").classed("visible",!1),Md=!1}function Ud(){return Ht(".flourish-warn-btn").on("click",(function(){Md?Nd():(Ht(".flourish-warn-list").classed("visible",!0),Md=!0)})),{clear:Rd,warn:Id}}function Od(){Ht(".flourish-warn-container").classed("visible",Ld.length),Ld.length>Fd&&(Ld.length=Fd);var t=Ht(".flourish-warn-list ul").selectAll("li").data(Ld),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 Rd(){Ld=[],Od(),Nd()}function Id(t){Ld.unshift(t),Od()}function Hd(t){var e=Dd.visualisation,n=e.getTemplate(),r=!1,i=!1,o=!1;function a(){var e=Dd.template_settings.getSettingsForCurrentTemplate(),n=Dd.visualisation.settingsForCurrentTemplate(),r={};for(var i in n)i in e&&(r[i]=n[i]);Sd.loadVisualisation(Dd,r,(function(){Dd.template_settings.populate(),Dd.data_bindings.updateRequiredBindingsOverlay(!1),Ss.clear(),t&&t()})),qt()}n.getSettings((function(t,e){t?console.error("Failed to get template settings: "+t):(Dd.template_settings.update(e),r=!0,i&&o&&a())})),n.getDataBindings((function(t,e){t?console.error("Failed to get template data bindings: "+t):(Dd.data_bindings.update(e),i=!0,r&&o&&a())})),e.refreshDataBindings((function(t){t?console.error("Failed to get template data bindings: "+t):(o=!0,i&&r&&a())}))}function Bd(t){Sd.updateData(Dd.visualisation,t)}function jd(t){Sd.updateDataNotPreview(Dd.visualisation,t)}function Pd(t){Dd=t;var e=Ud();return{loadTemplate:Hd,updateData:Bd,updateDataNotPreview:jd,sync:(Sd=Ds("iframe#preview","editor",Dd,e,{setSetting({name:t,value:e}){const n=function(t){return document.getElementById("setting-"+t)}(t);n?(wd(n,e),n.dispatchEvent(new Event("change"))):console.log(`Could not find setting ${t}`)}})).sync,setState:Sd.setState,getState:Sd.getState,hasData:Sd.hasData,setData:Sd.setData,getData:Sd.getData,draw:Sd.draw,update:Sd.update,getDefaultState:Sd.getDefaultState,snapshot:Sd.snapshot,setFixedHeight:Sd.setFixedHeight,resize:Sd.resize,getDrawCalled:Sd.getDrawCalled,setDrawCalled:Sd.setDrawCalled}}var zd={},Yd={};function $d(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function qd(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 Vd(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Wd(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+Vd(-t,6):t>9999?"+"+Vd(t,6):Vd(t,4)}(t.getUTCFullYear())+"-"+Vd(t.getUTCMonth()+1,2)+"-"+Vd(t.getUTCDate(),2)+(i?"T"+Vd(e,2)+":"+Vd(n,2)+":"+Vd(r,2)+"."+Vd(i,3)+"Z":r?"T"+Vd(e,2)+":"+Vd(n,2)+":"+Vd(r,2)+"Z":n||e?"T"+Vd(e,2)+":"+Vd(n,2)+"Z":"")}var Gd=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,u=o<=0,l=!1;function c(){if(u)return Yd;if(l)return l=!1,zd;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?u=!0:10===(r=t.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))l=!0;else if(13===r)l=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return u=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==Yd;){for(var d=[];r!==zd&&r!==Yd;)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 a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Wd(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=$d(t);return function(r,i){return e(n(r),i,t)}}(t,e):$d(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=qd(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=qd(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),Xd=Gd.parseRows,Zd=Gd.formatRows;function Jd(t){return null==t?null:new Date(t)}function Kd(t,e,n){du(this,"object"==typeof e?(n=e).id:e,void 0,n,{getVersionNumber:function(){return t.version_number},setVersionNumber:function(e){t.version_number=e},getTimestamps:function(){var t=Jd(this.t_created);return{last_updated:Jd(this.t_updated)||t}}}),this.visualisation=t,this.api_prefix="/api/data_table"}function Qd(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?Qd(t):t}))}function tf(t){this.id=t}function ef(t,e,n,r=null){if(du(this,t,e,n),this.api_prefix="/api/visualisation",this.slide_id=r,this.data_tables){var i=this;this.data_tables=this.data_tables.map((function(t){return new Kd(i,t)}))}}function nf(t,e,n){gu({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 o=t.data_bindings[t.template_id];for(var a in e)for(var s in e[a]){var u=e[a][s];o[a]||(o[a]={}),null===u?delete o[a][s]:o[a][s]=u}n(void 0)}})}function rf(t,e,n){gu({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 o=t.settings[t.template_id];for(var a in e){var s=e[a];o[a]=s}n(void 0)}})}function of(t,e,n,r){gu({url:t.api_prefix+"/"+t.id+"/publish",payload:function(){return{password:n,anyone_can_duplicate:r}},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,t.anyone_can_duplicate=r.anyone_can_duplicate,e(void 0,r)}})}function af(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]:af(t[n],e[n])}function sf(t,e,n,r){function i(){}this.visualisation=t,this.store_key="flourish_sdk",this.settings=e,this.template_data_bindings=n,this.public_url_prefix=r,this.is_read_only=!1,this.session_manager=w(this),this.template_settings=kd(this),this.data_bindings=(io=this,oo=Ht(".data-bindings"),{update:function(t){t&&(io.template_data_bindings=t),fo(io.visualisation,io.template_data_bindings)},modify:function(t,e=!1){ho(t,(function(){fo(io.visualisation,io.template_data_bindings),e&&io.preview_pane.updateData((t=>{if(t)return console.error("Failed to update preview pane: "+t)}))}))},requiredBindingsAreUnset:vo,updateRequiredBindingsOverlay:yo}),this.preview_pane=Pd(this),this.status_label={status_label:document.querySelector(".sdk-status-label")},this.session_reset_button=function(t){const e=document.querySelector(".sdk-session-reset-button");return e.addEventListener("click",(e=>{t.session_manager.clearSession(),e.preventDefault(),e.stopPropagation(),window.location.reload()})),{session_reset_button:e}}(this),this.responsive_menu=$t(this,this.session_manager.getPreviewSize()),this.confirm={on:i,blank:i,saved:i,saving:i,error:i},this.analytics=i,this.tour={fireEvent:i},window.addEventListener("hashchange",(()=>{this.loadFromUrlHash()}))}let uf;Kd.prototype.getColumnTypes=function(t){gu({url:this.api_prefix+"/"+this.id,method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,Qd(n.column_types||[]))}},"load-data")},Kd.prototype.csv=function(t,e=null){this.cached_data?t(void 0,Qd(this.cached_data)):this.csvPromise(e).then((e=>t(null,e)),(e=>t(e)))},Kd.prototype.csvPromise=async function(t=null){if(this.cached_data)return Qd(this.cached_data);const e=this;let n=this.api_prefix+"/"+this.id+"/csv";return t&&(n="/api/slide/"+t+"/data_table/"+this.id+"/csv"),new Promise(((t,r)=>{gu({url:n,response_type:"text/csv; charset=utf-8",method:"GET",callback(n,i){if(n)return r(n);e.cached_data=Xd(i),t(Qd(e.cached_data))}},"load-data")}))},Kd.prototype.saveData=function(t,e){var n=this,r=Gi(Qd(t));gu({url:this.api_prefix+"/"+this.id+"/csv",payload:function(){return{version_number:n.getVersionNumber(),data:Zd(r)}},callback:function(t,i){if(t)return e(t);n.setVersionNumber(i.version_number),n.cached_data=r,n.t_updated=i.t_updated,n.t_last_checked=i.t_last_checked,e(void 0)}})},Kd.prototype.updateFromUrl=function(t,e){var n=this;gu({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.message,e(t.message);var i=function(t){Gi(t);for(var e=0,n=t;e<n.length;e++)for(var r=n[e],i=0;i<r.length;i++){var o=r[i];if(null==o&&(o=""),"string"!=typeof o&&(o=""+o),"string"!=typeof o)throw new Error("BUG: somehow value was not a string");r[i]=o.trim()}return t}(Xd(r.csv));n.cached_data=i,n.setVersionNumber(r.version_number),n.t_updated=r.t_updated,n.last_remote_data_error_message=null,e(void 0,i,r.new_column_types)})):(n.t_updated=i.t_updated,n.last_remote_data_error_message=null,e(void 0,null,null))}})},Kd.prototype.updateFromLiveCsvUrl=function(t){var e=this;gu({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)}})},Kd.prototype.save=function(t,e){return yu(this,t,e)},Kd.prototype.delete=function(t){return _u(this,t)},tf.prototype.getSettings=function(t){if(this.settings)t(void 0,this.settings);else{var e=this;gu({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)}})}},tf.prototype.getDataBindings=function(t){gu({url:"/api/template/"+this.id+"/data_bindings",method:"GET",callback:t})},ef.prototype.save=function(t,e){this.is_listed||(t.is_listed=!0),yu(this,t,e)},ef.prototype.setTemplateId=function(t,e){yu(this,{template_id:t},e)},ef.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new tf(this.template_id)),this._template):null},ef.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},ef.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={},o=0;o<r.length;o++){var a=r[o];a.property in e&&(i[a.property]=e[a.property])}t(Qa(i))}))},ef.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},ef.prototype.refreshDataBindings=function(t){var e=this;let n=this.api_prefix+"/"+this.id;this.slide_id&&(n="/api/slide/"+this.slide_id+"/visualisation"),gu({url:n+"/data_bindings",method:"GET",callback:function(n,r){if(n)return t(n);e.data_bindings=r,t()}})},ef.prototype.resetToTheme=function(t){var e=this;gu({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)}})},ef.prototype.updateDataBindings=function(t,e){var n=this;if(this.is_listed)return nf(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):nf(n,t,e)}))},ef.prototype.updateSettings=function(t,e){var n=this;if(this.is_listed)return rf(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):rf(n,t,e)}))},ef.prototype.refreshSettings=function(t){var e=this;gu({url:this.api_prefix+"/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r,t()}})},ef.prototype.getThemeFontsAndColors=function(t){gu({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)}})},ef.prototype.getDataTables=function(t){let e=this.api_prefix+"/"+this.id;this.slide_id&&(e="/api/slide/"+this.slide_id+"/visualisation"),gu({url:e+"/data",method:"GET",callback:function(e,n){return e?t(e):t(void 0,n.data)}})},ef.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 Kd(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=[]}})))},ef.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},ef.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 o={},a={},s=0,u=i.reduce(((t,e)=>(t.per_data_table[e.id]=e.getTimestamps(),t)),{per_data_table:{}}),l=0;l<i.length;l++)!function(r){a[r.id]=r.column_types,r.csv((function(l,c){if(l)throw l;e.template_id==n&&(o[r.id]=c,++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={},l=e.dataBindingsForCurrentTemplate();for(var c in l)s[c]=Wi(l[c],o,a,i[c],u);for(c in i)s[c]||(s[c]=[],s[c].column_names={},s[c].metadata={});t(void 0,s)})))}),e.slide_id)}(i[l]);0==i.length&&t(void 0,{})}}))},ef.prototype.delete=function(t){_u(this,t)},ef.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},ef.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},ef.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0},ef.prototype.duplicate=function(t,e){gu({url:this.api_prefix+"/"+this.id+"/duplicate",callback:e})},ef.prototype.deleteCanvaEmbed=function(t){gu({url:this.api_prefix+"/"+this.id+"/delete_canva_embed",callback:t})},ef.prototype.publish=function(t,e,n){var r=this;if(this.is_listed)return of(r,t,e,n);this.save({is_listed:!0},(function(i){return i?t(i):of(r,t,e,n)}))},ef.prototype.unpublish=function(t){var e=this;gu({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)}})},ef.prototype.published=function(){return!!this.showcase_url},ef.prototype.sendForReview=function(t,e,n){var r=this;gu({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)}})},ef.prototype.approve=function(t,e){var n=this;gu({url:"/api/review/"+t+"/approve",callback:function(t,r){return n.status=r,e(t,r)}})},ef.prototype.decline=function(t,e,n){var r=this;gu({url:"/api/review/"+t+"/decline",payload:function(){return{message:e}},callback:function(t,e){r.status=e,n(t,e)}})},ef.prototype.cancelReview=function(t,e){var n=this;gu({url:"/api/review/"+t+"/cancel",callback:function(t,r){n.status=r,e(t,r)}})},ef.list=function(t){gu({url:"/api/visualisations",method:"GET",callback:t})},ef.getById=function(t,e){gu({url:"/api/visualisation/"+t,method:"GET",callback:function(n,r){if(n)return e(n);e(void 0,new ef(t,r.version_number,r))}})},ef.getPublishedJson=function(t,e,n){gu({url:`${e}visualisation/${t}/visualisation.json`,method:"GET",callback(t,e){if(t)return n(t);n(void 0,e)}})},ef.createFromTemplate=function(t,e){gu({url:"/api/template/"+t+"/visualisations",method:"PUT",callback:e})},ef.createFromVisualisation=function(t,e){gu({url:"/api/visualisation/"+t+"/duplicate",callback:e})},ef.setAsStaffPick=function(t,e){gu({url:"/api/visualisation/"+t+"/set_staff_pick",method:"POST",callback:e})},ef.unsetAsStaffPick=function(t,e){gu({url:"/api/visualisation/"+t+"/unset_staff_pick",method:"POST",callback:e})},ef.setFolder=function(t,e,n){gu({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e)+"?use_id=1",method:"PUT",callback:n})},ef.removeFolder=function(t,e,n){gu({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e)+"?use_id=1",method:"DELETE",callback:n})},ef.removeTag=function(t,e,n){gu({url:"/api/visualisation/"+t+"/tag/"+encodeURIComponent(e),method:"DELETE",callback:n})},ef.prototype.updateCompanyAccess=function(t,e,n={}){gu({url:"/api/visualisation/"+this.id+"/company_access",method:"POST",callback:e,payload:function(){return{company_access:t,options:n}}})},ef.prototype.getTags=function(t){gu({url:"/api/visualisation/"+this.id+"/tags",method:"GET",callback:t})},ef.prototype.setTags=function(t,e){gu({url:"/api/visualisation/"+this.id+"/tags",method:"PUT",callback:e,payload:function(){return{tags:t}}})},sf.prototype.initTemplate=function(){window.location.hash?this.preview_pane.loadTemplate((()=>{this.loadFromUrlHash()})):(this.session_manager.prepareSession(),this.preview_pane.loadTemplate((()=>{this.session_manager.applySession()})))},sf.prototype.showStatusMessage=function(t){const e=this.status_label.status_label;e.innerText=t,e.style.opacity=1,e.style.transform="translate(0, 0)",uf&&(clearTimeout(uf),uf=null),uf=setTimeout((()=>{e.style.opacity=0,e.style.transform="translate(0, 20%)",uf=null}),4e3)},sf.prototype.logInfo=function(...t){const e=new Intl.DateTimeFormat("default",{hour:"numeric",minute:"numeric",second:"numeric"}).format(new Date);console.info("🔹 flourish-sdk:",...t,`[${e}]`)},sf.prototype.loadFromUrlHash=async function(){if(!window.location.hash)return;this.session_manager.clearSession();const t=window.location.hash.slice(1),e=(n=ef.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)}},sf.prototype.updateFromJson=function({state:t,bindings:e,data:n}){const r={};for(const[t,i]of Object.entries(e)){const e={},a={};for(const[t,n]of Object.entries(i))Array.isArray(n)?a[t]=n:e[t]=n;const s=o(n[t],e,a);r[t]=s}const i={};af(i,this.preview_pane.getDefaultState()),af(i,t),this.preview_pane.sync({state:i,data:r,overwrite_state:!0,update:!0},(()=>this.template_settings.populate()))};var lf={},cf={};function df(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ff(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 pf(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function hf(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+pf(-t,6):t>9999?"+"+pf(t,6):pf(t,4)}(t.getUTCFullYear())+"-"+pf(t.getUTCMonth()+1,2)+"-"+pf(t.getUTCDate(),2)+(i?"T"+pf(e,2)+":"+pf(n,2)+":"+pf(r,2)+"."+pf(i,3)+"Z":r?"T"+pf(e,2)+":"+pf(n,2)+":"+pf(r,2)+"Z":n||e?"T"+pf(e,2)+":"+pf(n,2)+"Z":"")}var mf=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,u=o<=0,l=!1;function c(){if(u)return cf;if(l)return l=!1,lf;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?u=!0:10===(r=t.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))l=!0;else if(13===r)l=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return u=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==cf;){for(var d=[];r!==lf&&r!==cf;)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 a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?hf(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=df(t);return function(r,i){return e(n(r),i,t)}}(t,e):df(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=ff(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=ff(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),gf=mf.parseRows,vf="$";function yf(){}function _f(t,e){var n=new yf;if(t instanceof yf)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var a in t)n.set(a,t[a]);return n}function bf(){}yf.prototype=_f.prototype={constructor:yf,has:function(t){return vf+t in this},get:function(t){return this[vf+t]},set:function(t,e){return this[vf+t]=e,this},remove:function(t){var e=vf+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===vf&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===vf&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===vf&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===vf&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===vf&&++t;return t},empty:function(){for(var t in this)if(t[0]===vf)return!1;return!0},each:function(t){for(var e in this)e[0]===vf&&t(this[e],e.slice(1),this)}};var wf=_f.prototype;bf.prototype={constructor:bf,has:wf.has,add:function(t){return this[vf+(t+="")]=t,this},remove:wf.remove,clear:wf.clear,values:wf.keys,size:wf.size,empty:wf.empty,each:wf.each};var xf={value:function(){}};function Tf(){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 Af(r)}function Af(t){this._=t}function Cf(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Ef(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=xf,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function kf(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 Df(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?Df(t):t}))}function Sf(t){this.id=t}function Mf(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}Af.prototype=Tf.prototype={constructor:Af,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Ef(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Ef(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Cf(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Af(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}},kf.prototype.csv=function(t){if(this.cached_data)t(void 0,Df(this.cached_data));else{var e=this;!function(t,e){var n,r,i,o,a=Tf("beforesend","progress","load","error"),s=_f(),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 a.call("error",n,t)}else e=u;a.call("load",n,e)}else a.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){a.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?(o=t,n):o},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!=o&&(u.responseType=o),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)})),a.call("beforesend",n,u),u.send(null==i?null:i),n},abort:function(){return u.abort(),n},on:function(){var t=a.on.apply(a,arguments);return t===a?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){const i=r.getResponseHeader("Last-Modified");e.cached_data=gf(r.response),e.timestamps={last_updated:i?new Date(i):new Date},t(void 0,Df(e.cached_data))}))}},kf.prototype.saveData=function(t,e){e()},kf.prototype.save=function(t,e){e()},kf.prototype.delete=function(t){t()},Sf.prototype.getSettings=function(t){t(void 0,window.Flourish.app.settings)},Sf.prototype.getDataBindings=function(t){t(void 0,window.Flourish.app.template_data_bindings)},Sf.prototype.refreshDataBindings=function(t){t(void 0)};var Lf={},Ff=new Date,Nf=new Date;function Uf(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,o){var a,s=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return s},i.filter=function(n){return Uf((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 Ff.setTime(+e),Nf.setTime(+r),t(Ff),t(Nf),Math.floor(n(Ff,Nf))},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 Of=864e5,Rf=6048e5,If=Uf((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()))/Of}),(function(t){return t.getDate()-1}));function Hf(t){return Uf((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()))/Rf}))}If.range;var Bf=Hf(0),jf=Hf(1),Pf=Hf(2),zf=Hf(3),Yf=Hf(4),$f=Hf(5),qf=Hf(6);Bf.range,jf.range,Pf.range,zf.range,Yf.range,$f.range,qf.range;var Vf=Uf((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()}));Vf.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Uf((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},Vf.range;var Wf=Uf((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/Of}),(function(t){return t.getUTCDate()-1}));function Gf(t){return Uf((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)/Rf}))}Wf.range;var Xf=Gf(0),Zf=Gf(1),Jf=Gf(2),Kf=Gf(3),Qf=Gf(4),tp=Gf(5),ep=Gf(6);Xf.range,Zf.range,Jf.range,Kf.range,Qf.range,tp.range,ep.range;var np=Uf((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 rp(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 ip(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 op(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}np.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Uf((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},np.range;var ap,sp,up,lp={"-":"",_:" ",0:"0"},cp=/^\s*\d+/,dp=/^%/,fp=/[\\^$*+?|[\]().{}]/g;function pp(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function hp(t){return t.replace(fp,"\\$&")}function mp(t){return new RegExp("^(?:"+t.map(hp).join("|")+")","i")}function gp(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function vp(t,e,n){var r=cp.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function yp(t,e,n){var r=cp.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function _p(t,e,n){var r=cp.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function bp(t,e,n){var r=cp.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function wp(t,e,n){var r=cp.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function xp(t,e,n){var r=cp.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Tp(t,e,n){var r=cp.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ap(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 Cp(t,e,n){var r=cp.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Ep(t,e,n){var r=cp.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function kp(t,e,n){var r=cp.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Dp(t,e,n){var r=cp.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Sp(t,e,n){var r=cp.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Mp(t,e,n){var r=cp.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Lp(t,e,n){var r=cp.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Fp(t,e,n){var r=cp.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Np(t,e,n){var r=cp.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Up(t,e,n){var r=dp.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Op(t,e,n){var r=cp.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Rp(t,e,n){var r=cp.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ip(t,e){return pp(t.getDate(),e,2)}function Hp(t,e){return pp(t.getHours(),e,2)}function Bp(t,e){return pp(t.getHours()%12||12,e,2)}function jp(t,e){return pp(1+If.count(Vf(t),t),e,3)}function Pp(t,e){return pp(t.getMilliseconds(),e,3)}function zp(t,e){return Pp(t,e)+"000"}function Yp(t,e){return pp(t.getMonth()+1,e,2)}function $p(t,e){return pp(t.getMinutes(),e,2)}function qp(t,e){return pp(t.getSeconds(),e,2)}function Vp(t){var e=t.getDay();return 0===e?7:e}function Wp(t,e){return pp(Bf.count(Vf(t)-1,t),e,2)}function Gp(t){var e=t.getDay();return e>=4||0===e?Yf(t):Yf.ceil(t)}function Xp(t,e){return t=Gp(t),pp(Yf.count(Vf(t),t)+(4===Vf(t).getDay()),e,2)}function Zp(t){return t.getDay()}function Jp(t,e){return pp(jf.count(Vf(t)-1,t),e,2)}function Kp(t,e){return pp(t.getFullYear()%100,e,2)}function Qp(t,e){return pp((t=Gp(t)).getFullYear()%100,e,2)}function th(t,e){return pp(t.getFullYear()%1e4,e,4)}function eh(t,e){var n=t.getDay();return pp((t=n>=4||0===n?Yf(t):Yf.ceil(t)).getFullYear()%1e4,e,4)}function nh(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+pp(e/60|0,"0",2)+pp(e%60,"0",2)}function rh(t,e){return pp(t.getUTCDate(),e,2)}function ih(t,e){return pp(t.getUTCHours(),e,2)}function oh(t,e){return pp(t.getUTCHours()%12||12,e,2)}function ah(t,e){return pp(1+Wf.count(np(t),t),e,3)}function sh(t,e){return pp(t.getUTCMilliseconds(),e,3)}function uh(t,e){return sh(t,e)+"000"}function lh(t,e){return pp(t.getUTCMonth()+1,e,2)}function ch(t,e){return pp(t.getUTCMinutes(),e,2)}function dh(t,e){return pp(t.getUTCSeconds(),e,2)}function fh(t){var e=t.getUTCDay();return 0===e?7:e}function ph(t,e){return pp(Xf.count(np(t)-1,t),e,2)}function hh(t){var e=t.getUTCDay();return e>=4||0===e?Qf(t):Qf.ceil(t)}function mh(t,e){return t=hh(t),pp(Qf.count(np(t),t)+(4===np(t).getUTCDay()),e,2)}function gh(t){return t.getUTCDay()}function vh(t,e){return pp(Zf.count(np(t)-1,t),e,2)}function yh(t,e){return pp(t.getUTCFullYear()%100,e,2)}function _h(t,e){return pp((t=hh(t)).getUTCFullYear()%100,e,2)}function bh(t,e){return pp(t.getUTCFullYear()%1e4,e,4)}function wh(t,e){var n=t.getUTCDay();return pp((t=n>=4||0===n?Qf(t):Qf.ceil(t)).getUTCFullYear()%1e4,e,4)}function xh(){return"+0000"}function Th(){return"%"}function Ah(t){return+t}function Ch(t){return Math.floor(+t/1e3)}function Eh(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function kh(t){return function(e){return"string"!=typeof e&&Eh(e),(e=e.trim())?t(e):null}}!function(t){ap=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,u=t.shortMonths,l=mp(i),c=gp(i),d=mp(o),f=gp(o),p=mp(a),h=gp(a),m=mp(s),g=gp(s),v=mp(u),y=gp(u),_={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Ip,e:Ip,f:zp,g:Qp,G:eh,H:Hp,I:Bp,j:jp,L:Pp,m:Yp,M:$p,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ah,s:Ch,S:qp,u:Vp,U:Wp,V:Xp,w:Zp,W:Jp,x:null,X:null,y:Kp,Y:th,Z:nh,"%":Th},b={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:rh,e:rh,f:uh,g:_h,G:wh,H:ih,I:oh,j:ah,L:sh,m:lh,M:ch,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ah,s:Ch,S:dh,u:fh,U:ph,V:mh,w:gh,W:vh,x:null,X:null,y:yh,Y:bh,Z:xh,"%":Th},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=v.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=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:kp,e:kp,f:Np,g:Tp,G:xp,H:Sp,I:Sp,j:Dp,L:Fp,m:Ep,M:Mp,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:Cp,Q:Op,s:Rp,S:Lp,u:yp,U:_p,V:bp,w:vp,W:wp,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:Tp,Y:xp,Z:Ap,"%":Up};function x(t,e){return function(n){var r,i,o,a=[],s=-1,u=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++s<l;)37===t.charCodeAt(s)&&(a.push(t.slice(u,s)),null!=(i=lp[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),u=s+1);return a.push(t.slice(u,s)),a.join("")}}function T(t,e){return function(n){var r,i,o=op(1900,void 0,1);if(A(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=ip(op(o.y,0,1))).getUTCDay(),r=i>4||0===i?Zf.ceil(r):Zf(r),r=Wf.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=rp(op(o.y,0,1))).getDay(),r=i>4||0===i?jf.ceil(r):jf(r),r=If.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?ip(op(o.y,0,1)).getUTCDay():rp(op(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,ip(o)):rp(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,u=n.length;a<s;){if(r>=u)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in lp?e.charAt(a++):i])||(r=o(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=T(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=T(t+="",!0);return e.toString=function(){return t},e}}}(t),ap.format,ap.parse,sp=ap.utcFormat,up=ap.utcParse}({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"]});var Dh=new Date(1972,3,27,19,45,5),Sh={"%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 Mh(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function Lh(t,e){var n,r=up(t),i=sp(t);return n=kh("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:kh((function(e){return r(e)||(Sh[t]?Mh(Sh[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(Dh)})}var Fh=Object.freeze([Lh("%Y-%m-%dT%H:%M:%S.%LZ"),Lh("%Y-%m-%d %H:%M:%S"),Lh("%Y-%m-%dT%H:%M:%S"),Lh("%Y-%m-%dT%H:%M:%SZ"),Lh("%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})),Lh("%d/%m/%Y %H:%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&&n[2]>=1e3&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),Lh("%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])})),Lh("%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})),Lh("%m/%d/%Y %H:%M",(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&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),Lh("%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])})),Lh("%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})),Lh("%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})),Lh("%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])})),Lh("%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})),Lh("%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])})),Lh("%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})),Lh("%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])})),Lh("%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})),Lh("%Y-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),Lh("%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})),Lh("%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})),Lh("%d %b %y"),Lh("%-d %b ’%y"),Lh("%d %B %y"),Lh("%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})),Lh("%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})),Lh("%d-%b-%y"),Lh("%d-%B-%y"),Lh("%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})),Lh("%m/%y"),Lh("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),Lh("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),Lh("%b-%y"),Lh("%b %y"),Lh("%B %y"),Lh("%b '%y"),Lh("%B %-d %Y"),Lh("%d %b",(function(t,e){return!!e||!!Mh(Sh["%d %b"])(t)})),Lh("%d %B"),Lh("%b %d",(function(t,e){return!!e||!!Mh(Sh["%b %d"])(t)})),Lh("%B %d"),Lh("%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})),Lh("%m-%d"),Lh("%d/%m"),Lh("%m/%d"),Lh("%b %d %Y"),Lh("%b %d %Y, %-I.%M%p"),Lh("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),Lh("%B"),Lh("%b"),Lh("%X"),Lh("%I:%M %p"),Lh("%-I.%M%p"),Lh("%H:%M",(function(t,e){if(!e)return!1;var n=t.split(":").map(parseFloat);return n[0]>=0&&n[0]<24})),Lh("%H:%M:%S"),Lh("%M:%S"),Lh("%-I%p"),Lh("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),Lh("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length}))]);function Nh(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 Uh,Oh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Rh(t){if(!(e=Oh.exec(t)))throw new Error("invalid format: "+t);var e;return new Ih({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 Ih(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 Hh(t,e){var n=Nh(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")}Rh.prototype=Ih.prototype,Ih.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 Bh={"%":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 Hh(100*t,e)},r:Hh,s:function(t,e){var n=Nh(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Uh=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Nh(t,Math.max(0,e+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function jh(t){return t}var Ph=Array.prototype.map,zh=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Yh(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?jh:(e=Ph.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?jh:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Ph.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=Rh(t)).fill,n=t.align,d=t.sign,f=t.symbol,p=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):Bh[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",b="$"===f?o:/[%p]/.test(y)?u:"",w=Bh[y],x=/[defgprs%]/.test(y);function T(t){var i,o,u,f=_,T=b;if("c"===y)T=w(t)+T,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),g),v&&(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)),A&&0==+t&&"+"!==d&&(A=!1),f=(A?"("===d?d:l:"-"===d||"("===d?"":d)+f,T=("s"===y?zh[8+Uh/3]:"")+T+(A&&"("===d?")":""),x)for(i=-1,o=t.length;++i<o;)if(48>(u=t.charCodeAt(i))||u>57){T=(46===u?a+t.slice(i+1):t.slice(i))+T,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var C=f.length+t.length+T.length,E=C<h?new Array(h-C+1).join(e):"";switch(m&&p&&(t=r(E+t,E.length?h-T.length:1/0),E=""),n){case"<":t=f+t+T+E;break;case"=":t=f+E+t+T;break;case"^":t=E.slice(0,C=E.length>>1)+f+t+T+E.slice(C);break;default:t=E+f+t+T}return s(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),T.toString=function(){return t+""},T}return{format:d,formatPrefix:function(t,e){var n,r=d(((t=Rh(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=Nh(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=zh[8+i/3];return function(t){return r(o*t)+a}}}}var $h={test:kh((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:kh((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"},qh={test:kh((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:kh((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"},Vh={test:kh((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:kh((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},Wh={test:kh((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:kh((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"},Gh={test:kh((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:kh((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"},Xh={test:kh((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:kh((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},Zh=Object.freeze([$h,qh,Wh,Gh,Vh,Xh]);Zh.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=Yh({decimal:t.decimal_mark,thousands:t.thousand_separator,grouping:[3],currency:["",""]});return function(t,i){return null===t?"":(i||(i=",.2f"),i!==n&&(n=i,e=r.format(n)),e(t))}}(t),Object.freeze(t)}));var Jh=Object.freeze({test:function(t){return"string"==typeof t||Eh(t)},parse:function(t){return"string"==typeof t?t:Eh(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),Kh=Object.freeze({datetime:Fh,number:Zh}),Qh=Object.freeze(["datetime","number","string"]),tm=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),em=Object.freeze(Object.keys(tm));function nm(t,e){return t.index-e.index}function rm(t,e){return e.n_success-t.n_success||nm(t,e)}function im(t){return(""+t).trim()}function om(t){return void 0===t?function(t){return im(t)}:"function"==typeof t?function(e,n){return im(t(e,n))}:function(e){return im(e[""+t])}}function am(t){t?Array.isArray(t)||(t=[t]):t=Qh;var e=t.reduce((function(t,e){var n=Kh[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=em.reduce((function(t,e){return t[e]=tm[e],t}),{}),i=function(t,i){i=om(i);var o=t.map(i).filter((function(t){return t}));if(!o.length)return n?[Jh]:[];var a=Math.min(r.n_max,o.length),s=Math.floor(a*r.failure_fraction),u=r.n_failing_values,l=r.sort?rm:nm,c=e.slice().reduce((function(t,e,n){for(var r=c=0,i=[],l=!1,c=0;c<a;c++){var d=o[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:a-r,index:n}),t}),[]).sort(l).map((function(t){return t.interp}));return n&&c.push(Jh),c};return em.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}am.DATETIME_IDS=Object.freeze(Fh.map((function(t){return t.id}))),am.NUMBER_IDS=Object.freeze(Zh.map((function(t){return t.id}))),am.STRING_IDS=Object.freeze([Jh.id]),am.getInterpretation=function(){var t=Fh.concat(Zh,Jh).reduce((function(t,e){return t[e.id]=e,t}),{});return function(e){return t[e]}}(),am._createAccessorFunction=om;var sm,um,lm=Kh,cm=Mf(Object.freeze({__proto__:null,createInterpreter:am,recognised_formats:lm}));function dm(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,r.template_store_key=n.template_store_key,n.data_tables&&(this.data_tables=n.data_tables.map((function(t){return new kf(r,t)}))),n.data_bindings&&(this.data_bindings=n.data_bindings)}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 o=e[i];if(t.call(r,o,i,e))return i;i++}return-1},configurable:!0,writable:!0}),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createInterpreter=void 0,t.extractData=function(t,n,r,i,o){var a=[],s=[],l=0,c=Object.assign([],{column_names:{},metadata:{},timestamps:{}}),d={};function f(t,e){if(!d[t])return{};var n=d[t];return n[e]?n[e]:{}}for(var p in r){var h={},m=r[p];if(m){for(let t=0;t<m.length;t++){const e=m[t].type_id,n=m[t].output_format_id,r=n&&"auto"!==n?n:e;h[m[t].index]={type_id:e,output_format_id:r}}d[p]=h}}for(var g in t){if(null===t[g])continue;if(void 0===t[g].columns&&void 0===t[g].column)continue;var v=t[g];if(v.template_data_binding=i[g],v.key=g,!(v.data_table_id in n)){var y=[];for(var _ in n)y.push(_);console.error("Data table id "+v.data_table_id+" not in "+JSON.stringify(y));continue}const e=n[v.data_table_id];if(null==e)throw new Error(`[BUG] The data from the data table with ID ${v.data_table_id} was missing`);if(0!=e.length){if("columns"in v&&null!=v.columns){var b=e[0].length;v.columns=v.columns.filter((function(t){return t<b})),c.column_names[g]=v.columns.map((function(t){return e[0][t]})),c.metadata[g]=v.columns.map((function(t){const e=f(v.data_table_id,t);if("type_id"in e){const{type_id:t,output_format_id:n}=e;return{type:t.split("$")[0],type_id:t,output_format_id:n}}return null}))}else{if(!("column"in v)||null==v.column)throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(v));{c.column_names[g]=e[0][v.column];const t=f(v.data_table_id,v.column);if("type_id"in t){const{type_id:e,output_format_id:n}=t;c.metadata[g]={type:e.split("$")[0],type_id:e,output_format_id:n}}}}-1==s.indexOf(v.data_table_id)&&(s.push(v.data_table_id),l=Math.max(l,e.length-1)),a.push(v)}else console.warn("Empty data table")}function w(t,n,r){if(!t.template_data_binding?.data_type)return r;var i=function(t,n){const r=f(t,n);if("type_id"in r)return e.createInterpreter.getInterpretation(r.type_id)}(t.data_table_id,n);i&&"number"==i.type&&(r=u(r));var o=i?i.parse(r):r;return Number.isNaN(o)&&(o=null),o}c.timestamps=function(t){const e={},n=t.map((t=>t.last_updated?.getTime())).filter(Boolean);if(n.length){const t=Math.max(...n);e.last_updated=new Date(t)}return e}(s.map((t=>o.per_data_table[t])));for(var x=0;x<l;x++){for(var T={},A=0;A<a.length;A++){const t=n[(v=a[A]).data_table_id];if(null==t)throw new Error(`[BUG] The data from the data table with ID ${v.data_table_id} was missing`);if(!(x+1>=t.length)){if(null==v.key)throw new Error(`BUG: 'key' was ${v.key} in ${v}`);"columns"in v&&null!=v.columns?T[v.key]=v.columns.filter((function(e){return e<t[x+1].length})).map((function(e){return w(v,e,t[x+1][e])})):"column"in v&&null!=v.column&&(v.column>=t[x+1].length?T[v.key]=w(v,v.column,""):T[v.key]=w(v,v.column,t[x+1][v.column]))}}c.push(T)}return c},t.getColumnTypesForData=function(t){return l(t).map((function(t,e){const n=c(t);let i;i=n.length>2e3?r(n,1e3):n;const o=d(i)[0].id;return{type_id:o,index:e,output_format_id:o}}))},t.getRandomSeededSample=r,t.mulberry32=i,t.trimTrailingEmptyRows=o,t.dropReturnCharacters=function(t){for(const e of t)for(let t=0;t<e.length;t++)e[t]=e[t].replace(/(\r\n|\n|\r) {2}/g," ");return t},t.tidyTable=function(t){o(t);for(let e of t)for(let t=0;t<e.length;t++){let n=e[t];if(null==n&&(n=""),"string"!=typeof n&&(n=""+n),"string"!=typeof n)throw new Error("BUG: somehow value was not a string");e[t]=n.trim()}return t},t.stripCommonFixes=u,t.transposeNestedArray=l,t.getSlicedData=c,t.interpretColumn=d,t.sortDataTables=function(t,e){if(!e||!e.length)return;if(!t||!t.length)return;var n=[];return e.forEach((function(t){if("string"==typeof t)return;let e;if("column"in t?e=t.column:"columns"in t&&(e=t.columns),e){var r=e.match(/^(?:[^:]|:[^:])*/);r&&-1==n.indexOf(r[0])&&n.push(r[0])}})),t.sort((function(t,e){var r=n.indexOf(t.name),i=n.indexOf(e.name);return(-1==r?1/0:r)<(-1==i?1/0:i)?-1:1}))};const e=cm;var n=cm;function r(t,e){if(t.length<=2*e)return t;const n=i(t.length);for(;t.length>e;){const e=Math.floor(n()*t.length);t.splice(e,1)}return t}function i(t){let e=t;return function(){e|=0,e=e+1831565813|0;var t=Math.imul(e^e>>>15,1|e);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function o(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}Object.defineProperty(t,"createInterpreter",{enumerable:!0,get:function(){return n.createInterpreter}});var a=["#DIV/0","#N/A","#NAME?","#NULL!","#NUM!","#REF!","#VALUE!","#ERROR!"],s=(0,e.createInterpreter)().nMax(1/0).nFailingValues(8).failureFraction(.1);function u(t){return(t=t||"").replace(/[€£$¥%º]/g,"")}function l(t){for(var e=t.length,n=e>0?t[0].length:0,r=[],i=0;i<n;i++){for(var o=[],a=0;a<e;a++)o.push(t[a][i]);r.push(o)}return r}function c(t){const e=t.length;return e>100?t.slice(10,e-10):e>50?t.slice(5,e-5):e>30?t.slice(4,e-4):e>20?t.slice(3,e-3):e>10?t.slice(2,e-2):e>1?t.slice(1,e):t.slice(0,1)}function d(t){var e=t.filter((function(t){return t&&!a.includes(t.trim())})).map(u);return s(e)}}(Lf),dm.prototype.save=function(t,e){this.version_number++,e(void 0)},dm.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new Sf(this.template_id)),this._template):null},dm.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},dm.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},dm.prototype.refreshDataBindings=function(t){t()},dm.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 o in t[i]){var a=t[i][o];r[i][o]=a}e(void 0)},dm.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 o=t[i];r[i]=o}e(void 0)},dm.prototype.getDataTables=function(t){t(void 0,window.Flourish.app.data_tables)},dm.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 kf(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=[]}})))},dm.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},dm.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 o={},a={},s=0,u=0;u<i.length;u++)!function(r){r.csv((function(u,l){if(u)throw u;e.template_id==n&&(a[r.id]=Lf.getColumnTypesForData(l),o[r.id]=l,++s==i.length&&e.getTemplate().getDataBindings((function(n,r){if(n)throw n;var s={};r.forEach((function(t){"string"!=typeof t&&(t.dataset in s||(s[t.dataset]={}),s[t.dataset][t.key]=t)}));var u={per_data_table:{}};for(const t of i)u.per_data_table[t.id]=t.timestamps;var l={},c=e.dataBindingsForCurrentTemplate();for(var d in c)l[d]=Lf.extractData(c[d],o,a,s[d],u);for(d in s)l[d]||(l[d]=[],l[d].column_names={},l[d].metadata={});t(void 0,l)})))}))}(i[u]);0==i.length&&t(void 0,{})}}))},dm.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},dm.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},dm.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0};var fm=!1;function pm(){sm&&sm.classList.remove("shown")}function hm(){this.close(),fm||(sm&&setTimeout((function(){sm.classList.add("shown")}),1e3),setTimeout(mm,250))}function mm(){gm().addEventListener("open",(function(){window.location.reload()}))}function gm(){var t=new window.WebSocket(um);return t.addEventListener("open",pm),t.addEventListener("close",hm),t}return t.Visualisation=dm,t.initSDK=function(t,e,n,r){return on(),window.Flourish=window.Flourish||{},window.Flourish.app=new sf(t,e,n,r),window.Flourish.app},t.talkToServer=function(){sm=document.getElementById("error-server-down"),um=window.location.origin.replace(/^http(s?):\/\//,"ws$1://"),window.addEventListener("beforeunload",(function(){fm=!0})),gm()},t}({});
3
4
  //# sourceMappingURL=script.js.map