UNPKG

@flourish/sdk

Version:
2 lines 290 kB
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,l,u=!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 l}function p(){f(!1),a.removeItem(s.store_key)}function f(t){u=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());f(!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;l=c(),t=l,a.setItem(s.store_key,JSON.stringify(t))}function b(){u&&_()}function w(t){return s=t,l=h()||c(),window.addEventListener("beforeunload",b),window.addEventListener("keyup",b),window.addEventListener("pointerup",b),{getPreviewSize:y,clearSession:p,prepareSession:m,applySession:g}}var T="http://www.w3.org/1999/xhtml",x={svg:"http://www.w3.org/2000/svg",xhtml:T,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)),x.hasOwnProperty(e)?{space:x[e],local:t}:t}function E(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===T&&e.documentElement.namespaceURI===T?e.createElement(t):e.createElementNS(n,t)}}function C(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function k(t){var e=A(t);return(e.local?C:E)(e)}function S(){}function D(t){return null==t?S:function(){return this.querySelector(t)}}function L(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function M(){return[]}function N(t){return null==t?M:function(){return this.querySelectorAll(t)}}function F(t){return function(){return this.matches(t)}}function O(t){return function(e){return e.matches(t)}}var U=Array.prototype.find;function I(){return this.firstElementChild}var R=Array.prototype.filter;function H(){return this.children}function z(t){return new Array(t.length)}function P(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function B(t,e,n,r,i,o){for(var a,s=0,l=e.length,u=o.length;s<u;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new P(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function j(t,e,n,r,i,o,a){var s,l,u,c=new Map,d=e.length,p=o.length,f=new Array(d);for(s=0;s<d;++s)(l=e[s])&&(f[s]=u=a.call(l,l.__data__,s,e)+"",c.has(u)?i[s]=l:c.set(u,l));for(s=0;s<p;++s)u=a.call(t,o[s],s,o)+"",(l=c.get(u))?(r[s]=l,l.__data__=o[s],c.delete(u)):n[s]=new P(t,o[s]);for(s=0;s<d;++s)(l=e[s])&&c.get(f[s])===l&&(i[s]=l)}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 W(t){return function(){this.removeAttributeNS(t.space,t.local)}}function G(t,e){return function(){this.setAttribute(t,e)}}function V(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 lt(t,e){for(var n=at(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function ut(t,e){for(var n=at(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function ct(t){return function(){lt(this,t)}}function dt(t){return function(){ut(this,t)}}function pt(t,e){return function(){(e.apply(this,arguments)?lt:ut)(this,t)}}function ft(){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 Tt(){var t=this.parentNode;t&&t.removeChild(this)}function xt(){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 Et(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 Ct(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 St(t,e){return function(){return kt(this,t,e)}}function Dt(t,e){return function(){return kt(this,t,e.apply(this,arguments))}}P.prototype={constructor:P,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 Lt,Mt,Nt,Ft,Ot,Ut=[null];function It(t,e){this._groups=t,this._parents=e}function Rt(){return new It([[document.documentElement]],Ut)}function Ht(t){return"string"==typeof t?new It([[document.querySelector(t)]],[document.documentElement]):new It([[t]],Ut)}function zt(t){return Ht(k(t).call(document.documentElement))}function Pt(t){return"string"==typeof t?new It([document.querySelectorAll(t)],[document.documentElement]):new It([null==t?[]:L(t)],Ut)}function Bt(){if(!Nt)return null;var t=Nt.nodes()[1].value;if("custom"===Ft&&""!=t){var e=parseInt(t,10);return isNaN(e)?null:e}return null}function jt(){Ot&&Ot.preview_pane&&Ot.preview_pane.setFixedHeight&&Ot.preview_pane.setFixedHeight(Bt())}function Yt(t,e=!1,n=null){if(Ft=t,!e&&window.sp&&window.sp.trackInteraction&&window.sp.trackInteraction({section:"visualisation_editor",component:"preview_mode",component_id:t,interaction_type:"clicked"}),n||jt(),"custom"===t){let t=parseFloat(n?.width),e=parseFloat(n?.height);t&&(t=Math.round(t),Nt.nodes()[0].value=t,Ht(".preview-holder").style("max-width",t+"px")),e?(e=Math.round(e),Nt.nodes()[1].value=e,Ht("iframe").style("height",e+"px"),Ot.preview_pane.setFixedHeight(e)):jt(),Ht("#editor-custom-inputs").style("opacity",1),Ht(".preview-holder").style("width",Nt.nodes()[0].value+"px").select("iframe").style("width",Nt.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"),Pt("#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),Lt=t}function $t(t,e){return Ot=t,Nt=Pt("#editor-custom-inputs input"),qt(),Pt("#preview-menu .preview-mode").on("click",(function(){Yt(this.getAttribute("data-target"))})),Nt.on("change",(function(){if(window.sp&&window.sp.trackFormInteraction){var t="custom"===this.getAttribute("data-target")?"custom_size":"size_input";window.sp.trackFormInteraction({section:"visualisation_editor",section_group:"preview_controls",field:t,field_value:this.value||"empty",field_type:"number"})}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&&(window.sp&&window.sp.trackInteraction&&window.sp.trackInteraction({section:"visualisation_editor",component:"resize_handle",component_id:"preview_drag",interaction_type:"drag_start"}),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(),Ot.preview_pane.resize()}function a(){t=r.getBoundingClientRect().width,window.sp&&window.sp.trackInteraction&&window.sp.trackInteraction({section:"visualisation_editor",component:"resize_handle",component_id:"preview_drag",interaction_type:"drag_end"}),Ht(".preview-holder").style("transition",null),n.parentElement.parentElement.querySelector("#resize-overlay").classList.remove("dragging"),n.parentElement.classList.remove("dragging"),qt(),Ot.preview_pane.resize(),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)}n.addEventListener("mousedown",i)} /*! @license DOMPurify 3.2.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.2.4/LICENSE */(),window.innerWidth<=768&&(Mt="auto"),window.addEventListener("resize",(function(){Lt&&qt(),window.innerWidth<=768?Mt||(Mt=Lt,Yt("auto")):Mt&&(Yt(Mt),Mt=null),Ot.preview_pane.resize()})),{getHeightSetting:Bt,selectPreviewState:Yt}}function qt(){var t=Ht(".preview-holder").node().getBoundingClientRect();Nt.nodes()[0].value=Math.round(t.width),""!==Nt.nodes()[1].value&&"custom"===Ft&&(Nt.nodes()[1].value=Math.round(t.height))}It.prototype=Rt.prototype={constructor:It,select:function(t){"function"!=typeof t&&(t=D(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],l=s.length,u=r[i]=new Array(l),c=0;c<l;++c)(o=s[c])&&(a=t.call(o,o.__data__,c,s))&&("__data__"in o&&(a.__data__=o.__data__),u[c]=a);return new It(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:L(e)}}(t):N(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,u=0;u<l;++u)(a=s[u])&&(r.push(t.call(a,a.__data__,u,s)),i.push(a));return new It(r,i)},selectChild:function(t){return this.select(null==t?I:function(t){return function(){return U.call(this.children,t)}}("function"==typeof t?t:O(t)))},selectChildren:function(t){return this.selectAll(null==t?H:function(t){return function(){return R.call(this.children,t)}}("function"==typeof t?t:O(t)))},filter:function(t){"function"!=typeof t&&(t=F(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,l=r[i]=[],u=0;u<s;++u)(o=a[u])&&t.call(o,o.__data__,u,a)&&l.push(o);return new It(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Y);var n,r=e?j:B,i=this._parents,o=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=o.length,s=new Array(a),l=new Array(a),u=new Array(a),c=0;c<a;++c){var d=i[c],p=o[c],f=p.length,h=L(t.call(d,d&&d.__data__,c,i)),m=h.length,g=l[c]=new Array(m),v=s[c]=new Array(m);r(d,p,g,v,u[c]=new Array(f),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 It(s,i))._enter=l,s._exit=u,s},enter:function(){return new It(this._enter||this._groups.map(z),this._parents)},exit:function(){return new It(this._exit||this._groups.map(z),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 It))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 l,u=e[s],c=n[s],d=u.length,p=a[s]=new Array(d),f=0;f<d;++f)(l=u[f]||c[f])&&(p[f]=l);for(;s<r;++s)a[s]=e[s];return new It(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],l=s.length,u=i[o]=new Array(l),c=0;c<l;++c)(a=s[c])&&(u[c]=a);u.sort(e)}return new It(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?W:q:"function"==typeof e?n.local?Z:X:n.local?V:G)(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?pt:e?ct:dt)(n,e))},text:function(t){return arguments.length?this.each(null==t?ft:("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:D(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Tt)},clone:function(t){return this.select(t?At:xt)},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?Ct:Et,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,u=0,c=s.length;u<c;++u)for(r=0,l=s[u];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Dt:St)(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)}};const{entries:Wt,setPrototypeOf:Gt,isFrozen:Vt,getPrototypeOf:Xt,getOwnPropertyDescriptor:Zt}=Object;let{freeze:Jt,seal:Kt,create:Qt}=Object,{apply:te,construct:ee}="undefined"!=typeof Reflect&&Reflect;Jt||(Jt=function(t){return t}),Kt||(Kt=function(t){return t}),te||(te=function(t,e,n){return t.apply(e,n)}),ee||(ee=function(t,e){return new t(...e)});const ne=ve(Array.prototype.forEach),re=ve(Array.prototype.lastIndexOf),ie=ve(Array.prototype.pop),oe=ve(Array.prototype.push),ae=ve(Array.prototype.splice),se=ve(String.prototype.toLowerCase),le=ve(String.prototype.toString),ue=ve(String.prototype.match),ce=ve(String.prototype.replace),de=ve(String.prototype.indexOf),pe=ve(String.prototype.trim),fe=ve(Object.prototype.hasOwnProperty),he=ve(RegExp.prototype.test),me=(ge=TypeError,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return ee(ge,e)});var ge;function ve(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 te(t,e,r)}}function ye(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:se;Gt&&Gt(t,null);let r=e.length;for(;r--;){let i=e[r];if("string"==typeof i){const t=n(i);t!==i&&(Vt(e)||(e[r]=t),i=t)}t[i]=!0}return t}function _e(t){for(let e=0;e<t.length;e++){fe(t,e)||(t[e]=null)}return t}function be(t){const e=Qt(null);for(const[n,r]of Wt(t)){fe(t,n)&&(Array.isArray(r)?e[n]=_e(r):r&&"object"==typeof r&&r.constructor===Object?e[n]=be(r):e[n]=r)}return e}function we(t,e){for(;null!==t;){const n=Zt(t,e);if(n){if(n.get)return ve(n.get);if("function"==typeof n.value)return ve(n.value)}t=Xt(t)}return function(){return null}}const Te=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"]),xe=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","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ee=Jt(["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"]),Ce=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","mprescripts"]),ke=Jt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Se=Jt(["#text"]),De=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","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"]),Le=Jt(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","slope","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","tablevalues","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"]),Me=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"]),Ne=Jt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Fe=Kt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Oe=Kt(/<%[\w\W]*|[\w\W]*%>/gm),Ue=Kt(/\$\{[\w\W]*/gm),Ie=Kt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Re=Kt(/^aria-[\-\w]+$/),He=Kt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ze=Kt(/^(?:\w+script|data):/i),Pe=Kt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Be=Kt(/^html$/i),je=Kt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ye=Object.freeze({__proto__:null,ARIA_ATTR:Re,ATTR_WHITESPACE:Pe,CUSTOM_ELEMENT:je,DATA_ATTR:Ie,DOCTYPE_NAME:Be,ERB_EXPR:Oe,IS_ALLOWED_URI:He,IS_SCRIPT_OR_DATA:ze,MUSTACHE_EXPR:Fe,TMPLIT_EXPR:Ue});const $e=1,qe=3,We=7,Ge=8,Ve=9,Xe=function(){return"undefined"==typeof window?null:window};var Ze,Je,Ke=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xe();const n=e=>t(e);if(n.version="3.2.4",n.removed=[],!e||!e.document||e.document.nodeType!==Ve||!e.Element)return n.isSupported=!1,n;let{document:r}=e;const i=r,o=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:h}=e,m=u.prototype,g=we(m,"cloneNode"),v=we(m,"remove"),y=we(m,"nextSibling"),_=we(m,"childNodes"),b=we(m,"parentNode");if("function"==typeof s){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let w,T="";const{implementation:x,createNodeIterator:A,createDocumentFragment:E,getElementsByTagName:C}=r,{importNode:k}=i;let S={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Wt&&"function"==typeof b&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:D,ERB_EXPR:L,TMPLIT_EXPR:M,DATA_ATTR:N,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:U,CUSTOM_ELEMENT:I}=Ye;let{IS_ALLOWED_URI:R}=Ye,H=null;const z=ye({},[...Te,...xe,...Ae,...Ce,...Se]);let P=null;const B=ye({},[...De,...Le,...Me,...Ne]);let j=Object.seal(Qt(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}})),Y=null,$=null,q=!0,W=!0,G=!1,V=!0,X=!1,Z=!0,J=!1,K=!1,Q=!1,tt=!1,et=!1,nt=!1,rt=!0,it=!1,ot=!0,at=!1,st={},lt=null;const ut=ye({},["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 ct=null;const dt=ye({},["audio","video","img","source","image","track"]);let pt=null;const ft=ye({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",mt="http://www.w3.org/2000/svg",gt="http://www.w3.org/1999/xhtml";let vt=gt,yt=!1,_t=null;const bt=ye({},[ht,mt,gt],le);let wt=ye({},["mi","mo","mn","ms","mtext"]),Tt=ye({},["annotation-xml"]);const xt=ye({},["title","style","font","a","script"]);let At=null;const Et=["application/xhtml+xml","text/html"];let Ct=null,kt=null;const St=r.createElement("form"),Dt=function(t){return t instanceof RegExp||t instanceof Function},Lt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!kt||kt!==t){if(t&&"object"==typeof t||(t={}),t=be(t),At=-1===Et.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Ct="application/xhtml+xml"===At?le:se,H=fe(t,"ALLOWED_TAGS")?ye({},t.ALLOWED_TAGS,Ct):z,P=fe(t,"ALLOWED_ATTR")?ye({},t.ALLOWED_ATTR,Ct):B,_t=fe(t,"ALLOWED_NAMESPACES")?ye({},t.ALLOWED_NAMESPACES,le):bt,pt=fe(t,"ADD_URI_SAFE_ATTR")?ye(be(ft),t.ADD_URI_SAFE_ATTR,Ct):ft,ct=fe(t,"ADD_DATA_URI_TAGS")?ye(be(dt),t.ADD_DATA_URI_TAGS,Ct):dt,lt=fe(t,"FORBID_CONTENTS")?ye({},t.FORBID_CONTENTS,Ct):ut,Y=fe(t,"FORBID_TAGS")?ye({},t.FORBID_TAGS,Ct):{},$=fe(t,"FORBID_ATTR")?ye({},t.FORBID_ATTR,Ct):{},st=!!fe(t,"USE_PROFILES")&&t.USE_PROFILES,q=!1!==t.ALLOW_ARIA_ATTR,W=!1!==t.ALLOW_DATA_ATTR,G=t.ALLOW_UNKNOWN_PROTOCOLS||!1,V=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,X=t.SAFE_FOR_TEMPLATES||!1,Z=!1!==t.SAFE_FOR_XML,J=t.WHOLE_DOCUMENT||!1,tt=t.RETURN_DOM||!1,et=t.RETURN_DOM_FRAGMENT||!1,nt=t.RETURN_TRUSTED_TYPE||!1,Q=t.FORCE_BODY||!1,rt=!1!==t.SANITIZE_DOM,it=t.SANITIZE_NAMED_PROPS||!1,ot=!1!==t.KEEP_CONTENT,at=t.IN_PLACE||!1,R=t.ALLOWED_URI_REGEXP||He,vt=t.NAMESPACE||gt,wt=t.MATHML_TEXT_INTEGRATION_POINTS||wt,Tt=t.HTML_INTEGRATION_POINTS||Tt,j=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&Dt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&Dt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(j.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(W=!1),et&&(tt=!0),st&&(H=ye({},Se),P=[],!0===st.html&&(ye(H,Te),ye(P,De)),!0===st.svg&&(ye(H,xe),ye(P,Le),ye(P,Ne)),!0===st.svgFilters&&(ye(H,Ae),ye(P,Le),ye(P,Ne)),!0===st.mathMl&&(ye(H,Ce),ye(P,Me),ye(P,Ne))),t.ADD_TAGS&&(H===z&&(H=be(H)),ye(H,t.ADD_TAGS,Ct)),t.ADD_ATTR&&(P===B&&(P=be(P)),ye(P,t.ADD_ATTR,Ct)),t.ADD_URI_SAFE_ATTR&&ye(pt,t.ADD_URI_SAFE_ATTR,Ct),t.FORBID_CONTENTS&&(lt===ut&&(lt=be(lt)),ye(lt,t.FORBID_CONTENTS,Ct)),ot&&(H["#text"]=!0),J&&ye(H,["html","head","body"]),H.table&&(ye(H,["tbody"]),delete Y.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw me('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw me('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=t.TRUSTED_TYPES_POLICY,T=w.createHTML("")}else void 0===w&&(w=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!==w&&"string"==typeof T&&(T=w.createHTML(""));Jt&&Jt(t),kt=t}},Mt=ye({},[...xe,...Ae,...Ee]),Nt=ye({},[...Ce,...ke]),Ft=function(t){oe(n.removed,{element:t});try{b(t).removeChild(t)}catch(e){v(t)}},Ot=function(t,e){try{oe(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){oe(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(tt||et)try{Ft(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Ut=function(t){let e=null,n=null;if(Q)t="<remove></remove>"+t;else{const e=ue(t,/^[\r\n\t ]+/);n=e&&e[0]}"application/xhtml+xml"===At&&vt===gt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const i=w?w.createHTML(t):t;if(vt===gt)try{e=(new f).parseFromString(i,At)}catch(t){}if(!e||!e.documentElement){e=x.createDocument(vt,"template",null);try{e.documentElement.innerHTML=yt?T:i}catch(t){}}const o=e.body||e.documentElement;return t&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),vt===gt?C.call(e,J?"html":"body")[0]:J?e.documentElement:o},It=function(t){return A.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 p&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof d)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},Ht=function(t){return"function"==typeof l&&t instanceof l};function zt(t,e,r){ne(t,(t=>{t.call(n,e,r,kt)}))}const Pt=function(t){let e=null;if(zt(S.beforeSanitizeElements,t,null),Rt(t))return Ft(t),!0;const r=Ct(t.nodeName);if(zt(S.uponSanitizeElement,t,{tagName:r,allowedTags:H}),t.hasChildNodes()&&!Ht(t.firstElementChild)&&he(/<[/\w]/g,t.innerHTML)&&he(/<[/\w]/g,t.textContent))return Ft(t),!0;if(t.nodeType===We)return Ft(t),!0;if(Z&&t.nodeType===Ge&&he(/<[/\w]/g,t.data))return Ft(t),!0;if(!H[r]||Y[r]){if(!Y[r]&&jt(r)){if(j.tagNameCheck instanceof RegExp&&he(j.tagNameCheck,r))return!1;if(j.tagNameCheck instanceof Function&&j.tagNameCheck(r))return!1}if(ot&&!lt[r]){const e=b(t)||t.parentNode,n=_(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,y(t))}}}return Ft(t),!0}return t instanceof u&&!function(t){let e=b(t);e&&e.tagName||(e={namespaceURI:vt,tagName:"template"});const n=se(t.tagName),r=se(e.tagName);return!!_t[t.namespaceURI]&&(t.namespaceURI===mt?e.namespaceURI===gt?"svg"===n:e.namespaceURI===ht?"svg"===n&&("annotation-xml"===r||wt[r]):Boolean(Mt[n]):t.namespaceURI===ht?e.namespaceURI===gt?"math"===n:e.namespaceURI===mt?"math"===n&&Tt[r]:Boolean(Nt[n]):t.namespaceURI===gt?!(e.namespaceURI===mt&&!Tt[r])&&!(e.namespaceURI===ht&&!wt[r])&&!Nt[n]&&(xt[n]||!Mt[n]):!("application/xhtml+xml"!==At||!_t[t.namespaceURI]))}(t)?(Ft(t),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!he(/<\/no(script|embed|frames)/i,t.innerHTML)?(X&&t.nodeType===qe&&(e=t.textContent,ne([D,L,M],(t=>{e=ce(e,t," ")})),t.textContent!==e&&(oe(n.removed,{element:t.cloneNode()}),t.textContent=e)),zt(S.afterSanitizeElements,t,null),!1):(Ft(t),!0)},Bt=function(t,e,n){if(rt&&("id"===e||"name"===e)&&(n in r||n in St))return!1;if(W&&!$[e]&&he(N,e));else if(q&&he(F,e));else if(!P[e]||$[e]){if(!(jt(t)&&(j.tagNameCheck instanceof RegExp&&he(j.tagNameCheck,t)||j.tagNameCheck instanceof Function&&j.tagNameCheck(t))&&(j.attributeNameCheck instanceof RegExp&&he(j.attributeNameCheck,e)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck(e))||"is"===e&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&he(j.tagNameCheck,n)||j.tagNameCheck instanceof Function&&j.tagNameCheck(n))))return!1}else if(pt[e]);else if(he(R,ce(n,U,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==de(n,"data:")||!ct[t]){if(G&&!he(O,ce(n,U,"")));else if(n)return!1}else;return!0},jt=function(t){return"annotation-xml"!==t&&ue(t,I)},Yt=function(t){zt(S.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||Rt(t))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P,forceKeepAttr:void 0};let i=e.length;for(;i--;){const o=e[i],{name:a,namespaceURI:s,value:l}=o,u=Ct(a);let c="value"===a?l:pe(l);if(r.attrName=u,r.attrValue=c,r.keepAttr=!0,r.forceKeepAttr=void 0,zt(S.uponSanitizeAttribute,t,r),c=r.attrValue,!it||"id"!==u&&"name"!==u||(Ot(a,t),c="user-content-"+c),Z&&he(/((--!?|])>)|<\/(style|title)/i,c)){Ot(a,t);continue}if(r.forceKeepAttr)continue;if(Ot(a,t),!r.keepAttr)continue;if(!V&&he(/\/>/i,c)){Ot(a,t);continue}X&&ne([D,L,M],(t=>{c=ce(c,t," ")}));const d=Ct(t.nodeName);if(Bt(d,u,c)){if(w&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(d,u)){case"TrustedHTML":c=w.createHTML(c);break;case"TrustedScriptURL":c=w.createScriptURL(c)}try{s?t.setAttributeNS(s,a,c):t.setAttribute(a,c),Rt(t)?Ft(t):ie(n.removed)}catch(t){}}}zt(S.afterSanitizeAttributes,t,null)},$t=function t(e){let n=null;const r=It(e);for(zt(S.beforeSanitizeShadowDOM,e,null);n=r.nextNode();)zt(S.uponSanitizeShadowNode,n,null),Pt(n),Yt(n),n.content instanceof a&&t(n.content);zt(S.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,u=null;if(yt=!t,yt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Ht(t)){if("function"!=typeof t.toString)throw me("toString is not a function");if("string"!=typeof(t=t.toString()))throw me("dirty is not a string, aborting")}if(!n.isSupported)return t;if(K||Lt(e),n.removed=[],"string"==typeof t&&(at=!1),at){if(t.nodeName){const e=Ct(t.nodeName);if(!H[e]||Y[e])throw me("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof l)r=Ut("\x3c!----\x3e"),o=r.ownerDocument.importNode(t,!0),o.nodeType===$e&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!tt&&!X&&!J&&-1===t.indexOf("<"))return w&&nt?w.createHTML(t):t;if(r=Ut(t),!r)return tt?null:nt?T:""}r&&Q&&Ft(r.firstChild);const c=It(at?t:r);for(;s=c.nextNode();)Pt(s),Yt(s),s.content instanceof a&&$t(s.content);if(at)return t;if(tt){if(et)for(u=E.call(r.ownerDocument);r.firstChild;)u.appendChild(r.firstChild);else u=r;return(P.shadowroot||P.shadowrootmode)&&(u=k.call(i,u,!0)),u}let d=J?r.outerHTML:r.innerHTML;return J&&H["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&he(Be,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),X&&ne([D,L,M],(t=>{d=ce(d,t," ")})),w&&nt?w.createHTML(d):d},n.setConfig=function(){Lt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),K=!0},n.clearConfig=function(){kt=null,K=!1},n.isValidAttribute=function(t,e,n){kt||Lt({});const r=Ct(t),i=Ct(e);return Bt(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&oe(S[t],e)},n.removeHook=function(t,e){if(void 0!==e){const n=re(S[t],e);return-1===n?void 0:ae(S[t],n,1)[0]}return ie(S[t])},n.removeHooks=function(t){S[t]=[]},n.removeAllHooks=function(){S={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Qe=25,tn=10,en=10,nn={};function rn(t,e,n,r,i,o,a){var s=n-t/2-en,l=n+t/2+en,u=t/2+Math.min(0,s-i.left)+Math.max(0,l-i.right);return{pos:[u,a],shape:u-tn<5?[-u,-15*o,Math.max(tn,5-u),-10*o]:u+tn>t-5?[Math.min(-10,t-u-5),-10*o,Math.min(tn,t-u),-15*o]:[-10,-10*o,tn,-10*o]}}function on(t,e,n,r,i,o,a){var s=r-e/2-en,l=r+e/2+en,u=e/2+Math.min(0,s-i.top)+Math.max(0,l-i.bottom);return{pos:[a,u],shape:u-tn<5?[-15*o,-u,-10*o,Math.max(tn,5-u)]:u+tn>e-5?[-10*o,Math.min(-10,e-u-5),-15*o,Math.min(tn,e-u)]:[-10*o,-10,-10*o,tn]}}function an(t,e,n,r,i,o){var a=nn[t](e,n,r,i,o),s=r-Qe-a.pos[0],l=i-Qe-a.pos[1];return{left:s,top:l,right:s+e+2*Qe,bottom:l+n+2*Qe}}function sn(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 ln(){return Ze||((Ze=document.createElement("div")).id="flourish-popup-constrainer",(Je=Ze.style).overflow="hidden",Je.pointerEvents="none",Je.position="absolute",Je.left="0",Je.top="0",Je.margin="0",Je.padding="0",document.body.appendChild(Ze),this._resizeConstrainer(),Ze)}nn.bottom=function(t,e){return{shape:[-10,-10,tn,-10],pos:[t/2,e+en]}},nn.top=function(t,e){return{shape:[-10,en,tn,en],pos:[t/2,-10]}},nn.left=function(t,e){return{shape:[en,tn,en,-10],pos:[-10,e/2]}},nn.right=function(t,e){return{shape:[-10,tn,-10,-10],pos:[t+en,e/2]}},nn.topLeft=function(t,e){return{shape:[15,en,en,15],pos:[-10,-10]}},nn.bottomLeft=function(t,e){return{shape:[15,-10,en,-15],pos:[-10,e+en]}},nn.topRight=function(t,e){return{shape:[-15,en,-10,15],pos:[t+en,-10]}},nn.bottomRight=function(t,e){return{shape:[-15,-10,-10,-15],pos:[t+en,e+en]}},nn.bottomFlexible=function(t,e,n,r,i){return rn(t,0,n,0,i,1,e+en)},nn.topFlexible=function(t,e,n,r,i){return rn(t,0,n,0,i,-1,-10)},nn.rightFlexible=function(t,e,n,r,i){return on(0,e,0,r,i,1,t+en)},nn.leftFlexible=function(t,e,n,r,i){return on(0,e,0,r,i,-1,-10)};var un,cn=1,dn={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 pn(){for(var t in this.unique_id=cn++,this.is_visible=!0,dn)this["_"+t]=dn[t];this.handlers={click:[]}}function fn(t){pn.prototype[t]=function(e){return void 0===e?this["_"+t]:(this["_"+t]=e,this)}}for(var hn in dn)fn(hn);function mn(){return new pn}function gn(){un=mn().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){vn.call(this,t,!0)})).on("mouseover",vn).on("mouseout focusout",yn)}))}(Pt(".popup"))}function vn(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,l=this.getAttribute("data-popup-body")||null,u="";if(s&&(u+=zt("span").classed("popup-content-header",!0).html(Ke.sanitize(s)).node().outerHTML),l&&(u+=zt("span").classed("popup-content-body",!0).html(Ke.sanitize(l)).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(u);var c=this.getAttribute("data-popup-constrainer")||"body",d=Ht(c).size()?Ht(c).node().getBoundingClientRect():document.body,p=Ht(this).select(".popup-content-inner").node().getBoundingClientRect().width,f=o,h=-p/2,m=f+p/2-(d.right-15),g=d.left+15-(f-p/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)),un.point(o,a).html(u).directions(v).draw()}}}function yn(t){document.activeElement===this||this.contains(t.relatedTarget)||(this.getAttribute("data-popup-allow-interaction")&&Ht(this).select(".popup-content-wrapper").style("display","none"),un.hide())}pn.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},pn.prototype.directions=function(t){return void 0===t?this._directions:("string"==typeof t&&(t=[t]),this._directions=t.slice(),this)},pn.prototype.text=function(t){return this._html=function(t){return t.replace(/[&<>]/g,(function(t){return{"&":"&amp;","<":"&lt;",">":"&gt;"}[t]}))}(t),this},pn.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},pn.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},pn.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=sn("svg",{class:"flourish-popup-svg"},{position:"absolute",top:0,left:0,bottom:0,right:0}),o=sn("filter",{id:"dropshadow-"+t.unique_id,height:"130%"});o.appendChild(sn("feGaussianBlur",{in:"SourceAlpha",stdDeviation:5})),o.appendChild(sn("feOffset",{dx:0,dy:2,result:"offsetblur"}));var a=sn("feComponentTransfer");a.appendChild(sn("feFuncA",{type:"linear",slope:.2})),o.appendChild(a);var s=sn("feMerge");o.appendChild(s),s.appendChild(sn("feMergeNode")),s.appendChild(sn("feMergeNode",{in:"SourceGraphic"})),i.appendChild(o);var l=sn("g",{filter:"url(#dropshadow-"+t.unique_id+")",fill:"white",stroke:"none"});l.appendChild(sn("rect",{x:Qe,y:Qe,rx:5})),l.appendChild(sn("path")),i.appendChild(l),n.appendChild(i);var u=document.createElement("div");u.className="flourish-popup-content",(r=u.style).position="absolute",r.top=r.left=Qe+"px",r.padding="10px",n.appendChild(u),t._getConstrainer().appendChild(n)}return t._resizeConstrainer(),n},pn.prototype._getConstrainer=ln,pn.prototype._resizeConstrainer=function(){Ze||ln.call(this);var t=Je.display;Je.display="none",Je.width=document.documentElement.scrollWidth+"px",Je.height=document.documentElement.scrollHeight+"px",Je.display=t},pn.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(),l=s.style,u=s.querySelector(".flourish-popup-svg"),c=u.querySelector("g"),d=c.querySelector("rect"),p=c.querySelector("path"),f=s.querySelector(".flourish-popup-content");l.display="block",f.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&&(f.innerHTML=t._inner_html=t._html);var h,m,g=f.getBoundingClientRect();do{h=Math.ceil(g.width),m=Math.ceil(g.height),l.width=h+2*Qe+"px",l.height=m+2*Qe+"px",g=f.getBoundingClientRect()}while(h!=Math.ceil(g.width)||m!=Math.ceil(g.height));d.setAttribute("width",h),d.setAttribute("height",m),u.setAttribute("width",h+2*Qe),u.setAttribute("height",m+2*Qe);for(var v,y,_=Qe-en,b=null,w=null,T=null,x=1/0,A=1/0,E=0;E<t._directions.length;E++){var C=t._directions[E],k=an(C,h,m,n,r,i),S=Math.max(0,Math.floor(i.left)-k.left-_)+Math.max(0,k.right-Math.ceil(i.right)-_),D=Math.max(0,Math.floor(i.top)-k.top-_)+Math.max(0,k.bottom-Math.ceil(i.bottom)-_);if(0==S&&0==D){b=C;break}(S<x||S==x&&D<v)&&(x=S,v=D,w=C),(D<A||D==A&&S<y)&&(A=D,y=S,T=C)}return b?C=b:"horizontal"==t._fallbackFit?C=w:"vertical"==t._fallbackFit?C=T:(console.warn("Popup: failed to point bo