/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/hexagon-js@2.7.1/dist/hexagon.commonjs.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var plotColor1="rgb(177,119,190)",plotColor2="rgb(90,155,212)",plotColor3="rgb(241,90,113)",plotColor4="rgb(151,195,102)",plotColor5="rgb(250,169,91)",plotColor6="rgb(226,212,64)",palette={defaultCol:"#FFFFFF",actionCol:"#00ADA8",positiveCol:"#92BF17",warningCol:"#D69B24",negativeCol:"#EC3A65",infoCol:"#B36ABB",complementCol:"#F7F7F9",contrastCol:"#4A4E4E",lightTextCol:"#F3F3F3",darkTextCol:"#3D3D3D",disabledCol:"#FAFAFA",disabledTextCol:"#939393",dividerCol:"#D0D0D0"},currentTheme={plotColor1:plotColor1,plotColor2:plotColor2,plotColor3:plotColor3,plotColor4:plotColor4,plotColor5:plotColor5,plotColor6:plotColor6,plotColors:[plotColor1,plotColor2,plotColor3,plotColor4,plotColor5,plotColor6],palette:palette,plot:{ambientCol:plotColor6,axisLineCol:palette.dividerCol,axisTitleTextCol:palette.darkTextCol,coldCol:plotColor2,colors:[plotColor1,plotColor2,plotColor3,plotColor4,plotColor5,plotColor6],darkTextCol:palette.darkTextCol,lightTextCol:palette.lightTextCol,labelBackgroundCol:palette.complementCol,gridLineCol:palette.disabledCol,labelBorderCol:palette.disabledCol,labelBoxShadow:"1px 1px 1px rgba(0, 0, 0, 0.25)",labelHeaderBackgroundCol:palette.complementCol,labelHeaderBorderCol:palette.dividerCol,labelKeyTextCol:palette.darkTextCol,labelTextCol:palette.darkTextCol,negativeCol:plotColor3,pieSegmentTextCol:palette.lightTextCol,positiveCol:plotColor4,tickLineCol:palette.dividerCol,tickTextCol:palette.darkTextCol,tickTextSize:"10px",warmCol:plotColor5,warningCol:plotColor6},paginator:{arrowButton:"n-a",defaultButton:"hx-complement",selectedButton:"hx-action"}};function deprecated(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];var n="Deprecation Warning: "+e;console.warn.apply(console,[n].concat(t))}function warn(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];console.warn.apply(console,e)}var checkPrefix,prefix,prefixChar,prefixString,logger={deprecated:deprecated,warn:warn},indexOf=[].indexOf;prefixChar=(prefixString="\0").charCodeAt(0),prefix=function(e){return prefixString+e},checkPrefix=function(e){return e&&e.charCodeAt(0)===prefixChar};var checkPrefix$1,prefix$1,prefixChar$1,prefixString$1,Set=function(){function e(e){var t,i,n;if(this.size=0,this.nan=!1,this.items={},e)for(t=0,i=e.length;t<i;t++)n=e[t],this.add(n)}return e.prototype.add=function(e){var t,i,n;return"number"==typeof e&&isNaN(e)?this.nan||(this.size++,this.nan=!0):(i=prefix(e),null==(t=this.items)[i]&&(t[i]=[]),n=this.items[i],indexOf.call(n,e)<0&&(this.size++,n.push(e))),this},e.prototype.clear=function(){this.items={},this.nan=!1,this.size=0},e.prototype.delete=function(e){var t,i,n,r;return"number"==typeof e&&isNaN(e)?this.nan?(this.size--,this.nan=!1):void 0:(n=prefix(e))in this.items&&((i=-1!==(t=(r=this.items[n]).indexOf(e)))&&(this.size--,r.splice(t,1),r.length||delete this.items[n]),i)},e.prototype.entries=function(){var e,t,i,n;for(t in e=[],i=this.items)n=i[t],checkPrefix(t)&&(e=e.concat(n.map((function(e){return[e,e]}))));return this.nan&&e.push([NaN,NaN]),e},e.prototype.forEach=function(e,t){var i,n,r,o;for(void 0===t&&(t=this),i=0,n=(r=this.entries()).length;i<n;i++)o=r[i],e.call(t,o[1])},e.prototype.has=function(e){var t;return"number"==typeof e&&isNaN(e)?this.nan:(t=prefix(e))in this.items&&indexOf.call(this.items[t],e)>=0},e.prototype.keys=function(){return this.values()},e.prototype.values=function(){var e,t,i,n,r;for(n=[],e=0,t=(i=this.entries()).length;e<t;e++)r=i[e],n.push(r[1]);return n},e}();prefixChar$1=(prefixString$1="\0").charCodeAt(0),prefix$1=function(e){return prefixString$1+e},checkPrefix$1=function(e){return e&&e.charCodeAt(0)===prefixChar$1};var extend,supportsDate,supportsTouch,vendorPrefixes,Map=function(){function e(e){var t,i,n;if(this.size=0,this.items={},this.nan=void 0,e)for(t=0,i=e.length;t<i;t++)n=e[t],this.set(n[0],n[1])}return e.prototype.clear=function(){return this.items={},this.nan=void 0,this.size=0},e.prototype.delete=function(e){var t,i,n,r;return"number"==typeof e&&isNaN(e)?void 0!==this.nan&&(this.size--,this.nan=void 0):(i=prefix$1(e),null!=(t=null!=(r=this.items[i])&&null!=(n=r.keys)?n.indexOf(e):void 0)&&-1!==t&&(r.keys.splice(t,1),r.values.splice(t,1),r.keys.length||delete this.items[i],this.size--)),this},e.prototype.entries=function(){var e,t,i,n;for(t in e=[],i=this.items)n=i[t],checkPrefix$1(t)&&(e=e.concat(n.keys.map((function(e,t){return[e,n.values[t]]}))));return void 0!==this.nan&&e.push([NaN,this.nan]),e},e.prototype.forEach=function(e,t){var i,n,r,o;for(void 0===t&&(t=this),i=0,n=(r=this.entries()).length;i<n;i++)o=r[i],e.call(t,o[0],o[1]);return this},e.prototype.get=function(e){var t,i,n,r;return"number"==typeof e&&isNaN(e)?this.nan:(i=prefix$1(e),null!=(t=null!=(r=this.items[i])&&null!=(n=r.keys)?n.indexOf(e):void 0)&&-1!==t?r.values[t]:void 0)},e.prototype.has=function(e){var t,i,n;return"number"==typeof e&&isNaN(e)?void 0!==this.nan:null!=(t=null!=(i=this.items[prefix$1(e)])&&null!=(n=i.keys)?n.indexOf(e):void 0)&&-1!==t},e.prototype.keys=function(){var e,t,i,n,r;for(n=[],e=0,t=(i=this.entries()).length;e<t;e++)r=i[e],n.push(r[0]);return n},e.prototype.set=function(e,t){var i,n,r,o,a;return"number"==typeof e&&isNaN(e)?(void 0===this.nan&&this.size++,this.nan=t):(o=prefix$1(e),n={keys:[],values:[]},-1!==(r=(a=null!=(i=this.items)[o]?i[o]:i[o]=n).keys.indexOf(e))?a.values[r]=t:(this.size++,a.keys.push(e),a.values.push(t))),this},e.prototype.values=function(){var e,t,i,n,r;for(n=[],e=0,t=(i=this.entries()).length;e<t;e++)r=i[e],n.push(r[1]);return n},e}(),List=function(){function e(e){void 0===e&&(e=[]),this.list=e,this.size=this.list.length}return e.prototype.add=function(e){return this.list.push(e),this.size++,this},e.prototype.clear=function(){return this.list=[],this.size=0,this},e.prototype.delete=function(e){return 0<=e&&e<this.list.length&&(this.list.splice(e,1),this.size--,!0)},e.prototype.entries=function(){return this.list},e.prototype.forEach=function(e,t){var i,n,r,o;for(void 0===t&&(t=this),n=0,r=(o=this.list).length;n<r;n++)i=o[n],e.call(t,i)},e.prototype.get=function(e){return 0<=e&&e<this.list.length?this.list[e]:void 0},e.prototype.has=function(e){return-1!==this.list.indexOf(e)},e.prototype.remove=function(e){var t;return-1!==(t=this.list.indexOf(e))&&(this.list.splice(t,1),this.size--,!0)},e.prototype.removeAll=function(e){var t,i;for(i=0;-1!==(t=this.list.indexOf(e));)this.list.splice(t,1),this.size--,i++;return i},e.prototype.values=function(){return this.list},e}();function loopUpdate(e,t){e()||window.requestAnimationFrame(t)}function loop(e){loopUpdate(e,(function t(){loopUpdate(e,t)}))}function transition(e,t,i,n){void 0===i&&(i=exports.identity);var r=Date.now(),o=!1;return e<=0?(t(1,!1),n&&n(!1),exports.identity):(loop((function(){var a=(Date.now()-r)/e;return a>=1||o?(t(1,o),n&&n(o),!0):(t(i(a),!1),!1)})),function(){o=!0})}exports.hash=function(e,t){var i,n,r,o;for(o=0,i=n=0,r=e.length-1;n<=r;i=n+=1)o=31*o+e.charCodeAt(i),o|=0;return t?Math.abs(o)%t:o},exports.transpose=function(e){var t,i,n,r,o,a,s,l,c;if(null!=e.length){if(0===(c=e.length)||null==e[0].length)return e;for(t=e[0].length,l=new Array(t),i=r=0,a=t;r<a;i=r+=1)for(l[i]=new Array(c),n=o=0,s=c;o<s;n=o+=1)l[i][n]=e[n][i];return l}},supportsTouch=void 0,supportsDate=void 0,exports.supports=function(e){var t;switch(e){case"touch":return null!=supportsTouch?supportsTouch:supportsTouch="ontouchstart"in window;case"date":return void 0===supportsDate&&((t=document.createElement("input")).setAttribute("type","date"),supportsDate="text"!==t.type),supportsDate}},exports.debounce=function(e,t){var i;return i=void 0,function(){var n,r;return i&&clearTimeout(i),r=arguments,n=function(){return i=void 0,t.apply(t,r)},i=setTimeout(n,e)}},exports.clamp=function(e,t,i){return Math.min(t,Math.max(e,i))},exports.clampUnit=function(e){return exports.clamp(0,1,e)},exports.randomId=function(e,t){var i,n,r;return void 0===e&&(e=16),void 0===t&&(t="ABCEDEF0123456789"),n=t.split(""),i=n.length,r=function(){var t,r,o;for(o=[],t=0,r=e;t<r;t+=1)o.push(n[Math.floor(Math.random()*i)]);return o}(),r.join("")},exports.min=function(e){return Math.min.apply(null,null!=e?e.filter(exports.defined):void 0)},exports.minBy=function(e,t){var i,n,r,o,a,s,l,c,u;if(null!=e&&0!==e.length){if(t){for(s=t(l=e[0]),n=r=1,c=e.length;r<c;n=r+=1)i=t(u=e[n]),(void 0===s||void 0!==i&&i<s)&&(l=u,s=i);return l}for(l=e[0],a=0,o=e.length;a<o;a++)void 0!==(u=e[a])&&u<l&&(l=u);return l}},exports.argmin=function(e,t){var i,n,r,o,a,s,l,c;if(null!=e&&0!==e.length){if(o=0,a=void 0,t){if(a=t(e[0]),e.length>1)for(i=n=1,s=e.length;n<s;i=n+=1)c=t(e[i]),(void 0===a||void 0!==c&&c<a)&&(a=c,o=i)}else if(a=e[0],e.length>1)for(i=r=1,l=e.length;r<l;i=r+=1)c=e[i],(void 0===a||void 0!==c&&c<a)&&(a=c,o=i);return void 0===a?void 0:o}},exports.max=function(e){return Math.max.apply(null,null!=e?e.filter(exports.defined):void 0)},exports.maxBy=function(e,t){var i,n,r,o,a,s,l,c,u;if(null!=e&&0!==e.length){if(t){for(s=t(l=e[0]),n=r=1,c=e.length;r<c;n=r+=1)i=t(u=e[n]),(void 0===s||void 0!==i&&i>s)&&(l=u,s=i);return l}for(l=e[0],a=0,o=e.length;a<o;a++)void 0!==(u=e[a])&&u>l&&(l=u);return l}},exports.argmax=function(e,t){var i,n,r,o,a,s,l,c;if(null!=e&&0!==e.length){if(o=0,a=void 0,t){if(a=t(e[0]),e.length>1)for(i=n=1,s=e.length;n<s;i=n+=1)c=t(e[i]),(void 0===a||void 0!==c&&c>a)&&(a=c,o=i)}else if(a=e[0],e.length>1)for(i=r=1,l=e.length;r<l;i=r+=1)c=e[i],(void 0===a||void 0!==c&&c>a)&&(a=c,o=i);return void 0===a?void 0:o}},exports.range=function(e){var t,i,n,r;for(n=[],r=t=0,i=e;t<i;r=t+=1)n.push(r);return n},exports.sum=function(e,t){return e.reduce((function(e,t){return e+t}),0)},exports.flatten=function(e){return[].concat.apply([],e)},exports.cycle=function(e,t){return e[t%e.length]},exports.hashList=function(e,t){return e[exports.hash(t,e.length)]},exports.find=function(e,t){var i,n,r;for(n=0,r=e.length;n<r;n++)if(t(i=e[n]))return i},exports.isNumber=function(e){return"number"==typeof e||e instanceof Number},exports.isString=function(e){return"string"==typeof e||e instanceof String},exports.isFunction=function(e){return"function"==typeof e},exports.isArray=Array.isArray,exports.isObject=function(e){return"object"==typeof e&&!exports.isArray(e)&&null!==e},exports.isBoolean=function(e){return!0===e||!1===e||"boolean"==typeof e},exports.isPlainObject=function(e){return"object"==typeof e&&null!==e&&!e.nodeType&&e.constructor&&e.constructor.prototype.hasOwnProperty("isPrototypeOf")},exports.groupBy=function(e,t){var i,n,r,o,a,s;for(o=new Map,n=0,r=e.length;n<r;n++)i=t(s=e[n]),o.has(i)||o.set(i,new List),o.get(i).add(s);return(a=o.entries()).forEach((function(e){return e[1]=e[1].entries()})),a},exports.unique=function(e){return new Set(e).values()},exports.endsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},exports.startsWith=function(e,t){return 0===e.lastIndexOf(t,0)},exports.tween=function(e,t,i){return e+(t-e)*i},exports.defined=function(e){return null!=e},exports.zip=function(e){var t,i,n,r,o;if(e){if(e.length>0){if((n=exports.min(e.map((function(e){return e.length||0}))))>0){for(o=[],t=i=0,r=n;i<r;t=i+=1)o.push(e.map((function(e){return e[t]})));return o}return[]}return[]}return[]},extend=function(e,t,i){var n,r,o;for(n in r=[],t)o=t[n],exports.isPlainObject(o)?(null==e[n]&&(e[n]={}),r.push(extend(e[n],o,i))):void 0!==o||i?r.push(e[n]=exports.clone(o)):r.push(void 0);return r},exports.mergeImpl=function(e,t,i){var n,r,o,a,s,l,c,u;if(e){for(c={},r=0,o=i.length;r<o;r++)l=i[r],exports.isPlainObject(l)&&extend(c,l,t);return c}for(c={},s=0,a=i.length;s<a;s++)if(l=i[s],exports.isPlainObject(l))for(n in l)(void 0!==(u=l[n])||t)&&(c[n]=u);return c},exports.merge=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return exports.mergeImpl(!0,!0,e)},exports.mergeDefined=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return exports.mergeImpl(!0,!1,e)},exports.merge.defined=exports.mergeDefined,exports.shallowMerge=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return exports.mergeImpl(!1,!0,e)},exports.shallowMergeDefined=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return exports.mergeImpl(!1,!1,e)},exports.shallowMerge.defined=exports.shallowMergeDefined,exports.clone=function(e){var t;return exports.isArray(e)?e.map(exports.clone):exports.isPlainObject(e)?exports.merge({},e):e instanceof List?new List(e.entries().map(exports.clone)):e instanceof Map?new Map(e.entries().map((function(e){var t=e[0],i=e[1];return[exports.clone(t),exports.clone(i)]}))):e instanceof Set?new Set(e.keys().map(exports.clone)):e instanceof Date?new Date(e.getTime()):exports.isObject(e)&&null!==e?(logger.warn("Trying to clone "+e+" with constructor "+(null!=e&&null!=(t=e.constructor)?t.name:void 0)+", it isn't really cloneable! Carrying on anyway."),{}):e},exports.shallowClone=function(e){var t;return exports.isArray(e)?e.slice():exports.isPlainObject(e)?exports.shallowMerge({},e):e instanceof List?new List(e.entries()):e instanceof Map?new Map(e.entries()):e instanceof Set?new Set(e.keys()):e instanceof Date?new Date(e.getTime()):exports.isObject(e)&&null!==e?(logger.warn("Trying to shallow clone "+e+" with constructor "+(null!=e&&null!=(t=e.constructor)?t.name:void 0)+", it isn't really cloneable! Carrying on anyway."),{}):e},vendorPrefixes=["webkit","ms","moz","Moz","o","O"],exports.vendor=function(e,t){var i,n,r;if(t in e)return e[t];for(i=0,n=vendorPrefixes.length;i<n;i++)if((r=vendorPrefixes[i]+t.charAt(0).toUpperCase()+t.slice(1))in e)return e[r]},exports.identity=function(e){return e};var BasicEventEmitter,ease={linear:exports.identity,quad:function(e){return e*e},cubic:function(e){return e*e*e}};BasicEventEmitter=function(){function e(){this.callbacks=new Map,this.allCallbacks=new List}return e.prototype.emit=function(e,t){var i,n,r,o,a,s;if(this.callbacks.has(e))for(i=0,r=(a=this.callbacks.get(e).entries()).length;i<r;i++)(0,a[i])(t);for(n=0,o=(s=this.allCallbacks.entries()).length;n<o;n++)(0,s[n])(e,t);return this},e.prototype.isEmpty=function(){return this.callbacks.values().every((function(e){return 0===e.size}))&&0===this.allCallbacks.size},e.prototype.on=function(e,t){return e?(this.callbacks.has(e)||this.callbacks.set(e,new List),this.callbacks.get(e).add(t)):this.allCallbacks.add(t),this},e.prototype.has=function(e){return this.allCallbacks.size>0||this.callbacks.has(e)&&this.callbacks.get(e).size>0},e.prototype.off=function(e,t){var i;return t?e?null!=(i=this.callbacks.get(e))&&i.remove(t):this.allCallbacks.remove(t):e?this.callbacks.set(e,new List):(this.callbacks=new Map,this.allCallbacks=new List),this},e.prototype.pipe=function(e,t,i){var n;return n=i?function(e){return-1!==i.indexOf(e)}:function(e){return!0},t?this.on(null,(function(i,r){if(n(i))return e.emit(t+"."+i,r)})):this.on(null,(function(t,i){if(n(t))return e.emit(t,i)})),this},e}();var Color,componentToHex,fromString,hueToRGB,update,wrapDeprecated,EventEmitter=function(){var e,t,i=function(){this.suppressedMap=new Map,this.emitters=new List,this.emittersMap=new Map,this.global=e(this,"default")};return i.prototype.emit=function(e,t){var i,n,r;if(!this.suppressedMap.get(e))for(i=0,n=(r=this.emitters.entries()).length;i<n;i++)r[i].emit(e,t);return this},i.prototype.suppressed=function(e,t){return arguments.length>1?(this.suppressedMap.set(e,!!t),this):!!this.suppressedMap.get(e)},i.prototype.on=function(t,i,n){var r;if("default"===i)throw new Error('hx.EventEmitter: "default" is a reserved namespace. It can not be used as a namespace name.');return exports.isString(i)?((r=this.emittersMap.get(i))||(r=e(this,i)),r.on(t,n)):this.global.on(t,i),this},i.prototype.has=function(e){var t,i,n;if(this.global.has(e))return!0;for(t=0,i=(n=this.emitters.entries()).length;t<i;t++)if(n[t].has(e))return!0;return!1},i.prototype.off=function(e,i,n){var r,o,a,s=this;return exports.isString(i)?this.emittersMap.has(i)&&((r=this.emittersMap.get(i)).off(e,n),r.isEmpty()&&t(this,r,i)):(n||exports.isString(i)||(n=i),o=this.emitters.entries(),a=[],o.forEach((function(t){if(t.off(e,n),t!==s.global&&t.isEmpty())return a.push(t)})),a.map((function(e){return t(s,e)}))),this},i.prototype.pipe=function(e,t,i){return this.global.pipe(e,t,i),this},e=function(e,t){var i;return i=new BasicEventEmitter,e.emittersMap.set(t,i),e.emitters.add(i),i},t=function(e,t,i){var n,r;return i&&e.emittersMap.has(i)?e.emittersMap.delete(i):(n=null!=(r=e.emittersMap.entries().filter((function(e){e[0];return e[1]===t}))[0])?r[0]:void 0)&&e.emittersMap.delete(n),e.emitters.remove(t)},i}.call(void 0);componentToHex=function(e){var t;return 1===(t=e.toString(16)).length?"0"+t:t},hueToRGB=function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},update=function(e,t){var i,n,r,o,a,s,l,c,u,d,h;if(t)o=e.h/360,h=e.s/100,a=e.l/100,0===h?d=r=i=a:(d=hueToRGB(c=2*a-(u=a<.5?a*(1+h):a+h-a*h),u,o+1/3),r=hueToRGB(c,u,o),i=hueToRGB(c,u,o-1/3)),e.r=255*d,e.g=255*r,e.b=255*i;else{if(d=e.r/255,r=e.g/255,i=e.b/255,a=((s=Math.max(d,r,i))+(l=Math.min(d,r,i)))/2,n=s-l,s===l)o=h=0;else{switch(h=a>.5?n/(2-s-l):n/(s+l),s){case d:o=(r-i)/n+(r<i?6:0);break;case r:o=(i-d)/n+2;break;case i:o=(d-r)/n+4}o/=6}e.h=360*o,e.s=100*h,e.l=100*a}return e},Color=function(){var e,t=function(){this._={r:0,g:0,b:0,h:0,s:0,l:0,a:1}};return t.prototype.hsl=function(t){return arguments.length>0?(null==t&&(t=[]),e("h",!0,!1).call(this,t[0]),e("s",!0,!1).call(this,t[1]),e("l",!0,!1).call(this,t[2]),this.alpha(t[3]),update(this._,!0),this):[this.hue(),this.saturation(),this.lightness(),this.alpha()]},t.prototype.rgb=function(t){return arguments.length>0?(null==t&&(t=[]),e("r",!1,!1).call(this,t[0]),e("g",!1,!1).call(this,t[1]),e("b",!1,!1).call(this,t[2]),this.alpha(t[3]),update(this._,!1),this):[this.red(),this.green(),this.blue(),this.alpha()]},t.prototype.saturate=function(e){return this.saturation(this._.s+this._.s*e)},t.prototype.lighten=function(e){return this.lightness(this._.l+this._.l*e)},t.prototype.fade=function(e){return this.alpha(this._.a+this._.a*e)},t.prototype.mix=function(e,t){var i,n,r,o,a;return void 0===t&&(t=.5),r=isColor(e)?e:color(e),a=this._.r*(1-t)+r._.r*t,o=this._.g*(1-t)+r._.g*t,n=this._.b*(1-t)+r._.b*t,i=this._.a*(1-t)+r._.a*t,this.rgb([a,o,n,i])},t.prototype.textCol=function(){return(299*this.red()+587*this.green()+114*this.blue())/1e3>=128?"black":"white"},t.prototype.toString=function(e){var t,i,n,r,o,a,s;switch(r=this.hue(),s=this.saturation(),o=this.lightness(),a=this.red(),n=this.green(),i=this.blue(),t=this.alpha(),e){case"hsla":return"hsla("+r+","+s+"%,"+o+"%,"+t+")";case"rgba":return"rgba("+a+","+n+","+i+","+t+")";case"hsl":return"hsl("+r+","+s+"%,"+o+"%)";case"rgb":return"rgb("+a+","+n+","+i+")";default:return 1!==t?"rgba("+a+","+n+","+i+","+t+")":"#"+componentToHex(a)+componentToHex(n)+componentToHex(i)}},t.prototype.range=function(e,t,i,n){var r,o,a,s,l;return void 0===e&&(e=3),void 0===t&&(t=3),void 0===i&&(i=.5),l=i/Math.max(e,t,1),s=this,o=exports.range(e+1).map((function(e){return s.clone().lighten(l*e)})),r=exports.range(t).reverse().map((function(e){return s.clone().lighten(-l*(e+1))})),a=r.concat(o),n?"array"===n?a.map((function(e){return e.rgb()})):a.map((function(e){return e.toString(n)})):a},t.prototype.clone=function(){return(new t).rgb(this.rgb())},e=function(e,t,i){var n;return n=function(){switch(e){case"h":return 360;case"s":case"l":return 100;case"r":case"g":case"b":return 255;case"a":return 1}}(),function(r){return arguments.length>0?(null==r||isNaN(r)||(this._[e]=exports.clamp(0,n,r),i||update(this._,t)),this):i?Math.round(100*this._[e])/100:Math.round(this._[e])}},t.prototype.red=e("r",!1),t.prototype.green=e("g",!1),t.prototype.blue=e("b",!1),t.prototype.hue=e("h",!0),t.prototype.saturation=e("s",!0),t.prototype.lightness=e("l",!0),t.prototype.alpha=e("a",null,!0),t}.call(void 0),fromString=function(e){var t,i,n,r;if(exports.isString(e)){if(-1!==e.indexOf("#"))i=3===(e=e.substring(1)).length?1:2,r=[e.substring(0,i),e.substring(i,2*i),e.substring(2*i,3*i)],1===i&&(r[0]+=""+r[0],r[1]+=""+r[1],r[2]+=""+r[2]),n=[parseInt(r[0],16),parseInt(r[1],16),parseInt(r[2],16),1];else{if(-1===e.indexOf("rgb")){if(-1!==e.indexOf("hsl")){if((t=e.replace("hsl(","").replace("hsla(","").replace(")","").replace("%","").replace("%","").replace("%","").split(",")).some((function(e){return isNaN(Number(e))})))return;return null==t[3]&&(t[3]=1),(new Color).hsl(t)}return}n=e.replace("rgb(","").replace("rgba(","").replace(")","").split(",")}if(null==n[3]&&(n[3]=1),!n.some((function(e){return isNaN(Number(e))})))return(new Color).rgb(n)}};var interpolateNumber,splitString,color=function(){return arguments.length>=3?(new Color).rgb([arguments[0],arguments[1],arguments[2],arguments[3]]):1===arguments.length?Array.isArray(arguments[0])?(new Color).rgb(arguments[0]):isColor(arguments[0])?arguments[0]:fromString(arguments[0]):new Color},isColorString=function(e){return void 0!==fromString(e)},isColor=function(e){return e instanceof Color};wrapDeprecated=function(e,t){return function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return logger.deprecated(e,"Replaced by hx."+e),t.apply(void 0,i)}},color.isColorString=wrapDeprecated("isColorString",isColorString),color.isColor=wrapDeprecated("isColor",isColor),splitString=function(e){var t,i,n;for(n=new RegExp(/[-+]?(?:\d+\.?\d*|\.?\d+)|((?:[^-+\d])+|\D+)/g),i=[];null!==(t=n.exec(e));)i.push(isNaN(parseInt(t[0]))?t[0]:Number(t[0]));return i},interpolateNumber=function(e,t){return e=+e,t=+t,function(i){return e*(1-i)+t*i}};var augmenters,bareSelect,classed,closestParent,domSelectAll,domSelectSingle,flattenNodes,getMatches,getMethod,matchPolyfill,namespaces,reformed,shallowSelectAll,shallowSelectSingle,interpolate=function(e,t){var i,n,r;return"number"==typeof e?interpolateNumber(e,t):(i=color(e),n=color(t),void 0!==i&&void 0!==n?function(e){return i.clone().mix(n,e).toString("rgba")}:(e=splitString(e),t=splitString(t),e.length===t.length?function(i){var n,r,o,a;for(n=[],r=o=0,a=e.length;o<=a;r=o+=1)isNaN(parseInt(e[r]))||isNaN(parseInt(t[r]))?e[r]===t[r]?n[r]=e[r]:n[r]=t[r]:n[r]=interpolateNumber(e[r],t[r])(i);return n.join("")}:(r=t.join(""),function(e){return r})))},ElementSet=function(){function e(){this.elements=new List,this.ids=new Set}return e.prototype.add=function(e){var t,i;if(null==(t=getHexagonElementDataObject(e)).id&&(t.id=exports.randomId()),i=t.id,!this.ids.has(i))return this.ids.add(i),this.elements.add(e)},e.prototype.remove=function(e){var t;if((t=getHexagonElementDataObject(e,!1))&&t.id&&this.ids.has(t.id))return this.elements.remove(e),this.ids.delete(t.id)},e.prototype.entries=function(){return this.elements.entries()},e.prototype.has=function(e){var t;return(t=getHexagonElementDataObject(e))&&t.id&&this.ids.has(t.id)||!1},e}(),getHexagonElementDataObject=function(e,t){return void 0===t&&(t=!0),t?(null==e.__hx__&&(e.__hx__={}),e.__hx__):e.__hx__?e.__hx__:void 0};namespaces={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},getMethod=function(e,t){return e===window?window[t]:e instanceof Document?Document.prototype[t]:Element.prototype[t]||Node.prototype[t]||HTMLBodyElement.prototype[t]},matchPolyfill=function(e){var t,i;return t=((i=this).document||i.ownerDocument).querySelectorAll(e),[].slice.call(t).indexOf(i)>-1},getMatches=function(e){return e.matches||exports.vendor(e,"matchesSelector")||matchPolyfill},domSelectSingle=function(e,t){return getMethod(t,"querySelector").call(t,e)},domSelectAll=function(e,t){return getMethod(t,"querySelectorAll").call(t,e)},shallowSelectSingle=function(e,t){var i,n,r,o,a;if(o=getMatches(t),t.children)for(n=0,r=(a=t.children).length;n<r;n++)if(i=a[n],o.call(i,e))return i},shallowSelectAll=function(e,t){var i,n,r,o,a,s;if(o=getMatches(t),a=[],t.children)for(n=0,r=(s=t.children).length;n<r;n++)i=s[n],o.call(i,e)&&a.push(i);return a},closestParent=function(e,t){for(t=t.parentNode;t&&t!==document;){if(getMatches(t).call(t,e))return t;t=t.parentNode}},flattenNodes=function(e){var t,i,n,r,o,a,s;for(s=new ElementSet,t=0,n=e.length;t<n;t++)for(i=0,r=(a=e[t]).length;i<r;i++)o=a[i],s.add(o);return s.entries()},classed=function(e,t,i){var n,r,o,a,s,l,c,u;if(n=(u=select(e)).attr("class"),c=t.split(" ").filter((function(e){return""!==e})),n)for(o=n.split(" "),s=0,l=c.length;s<l;s++)""!==(r=c[s])&&(a=o.indexOf(r),i&&-1===a?o.push(r):i||-1===a||o.splice(a,1),u.attr("class",o.join(" ")));else i&&u.attr("class",c.join(" "))},reformed=function(e,t){return e?0===t.length?void 0:1===t.length?t[0]:t:t},augmenters=[];var Selection=function(){var e,t,i=function(e){this.nodes=e,this.nodes=this.nodes.filter((function(e){return null!=e})),this.singleSelection=!1};return i.prototype.select=function(e){var t;return exports.isString(e)?((t=new i(this.nodes.map((function(t){return domSelectSingle(e,t)})))).singleSelection=this.singleSelection,t):(logger.warn("Selection.select was passed the wrong argument type","Selection.select only accepts a string argument, you supplied:",e),new i([]))},i.prototype.selectAll=function(e){return exports.isString(e)?new i(flattenNodes(this.nodes.map((function(t){return domSelectAll(e,t)})))):(logger.warn("Selection.selectAll was passed the wrong argument type","Selection.selectAll only accepts a string argument, you supplied:",e),new i([]))},i.prototype.shallowSelect=function(e){var t;return exports.isString(e)?((t=new i(this.nodes.map((function(t){return shallowSelectSingle(e,t)})))).singleSelection=this.singleSelection,t):(logger.warn("Selection.selectAll was passed the wrong argument type","Selection.selectAll only accepts a string argument, you supplied:",e),new i([]))},i.prototype.shallowSelectAll=function(e){return exports.isString(e)?new i(flattenNodes(this.nodes.map((function(t){return shallowSelectAll(e,t)})))):(logger.warn("Selection.selectAll was passed the wrong argument type","Selection.selectAll only accepts a string argument, you supplied:",e),new i([]))},i.prototype.closest=function(e){var t;return exports.isString(e)?((t=new i(this.nodes.map((function(t){return closestParent(e,t)})))).singleSelection=this.singleSelection,t):(logger.warn("Selection.closest was passed the wrong argument type","Selection.closest only accepts a string argument, you supplied:",e),new i([]))},i.prototype.parent=function(){if(this.singleSelection)return select(this.node().parentNode);throw new Error("Selection::parent can only be used on a single selection")},i.prototype.prepend=function(t){return e(this,t,(function(e,t){return e.insertBefore(t,e.firstChild)}),!0)},i.prototype.append=function(t){return e(this,t,(function(e,t){return e.appendChild(t)}))},i.prototype.add=function(e){return this.append(e),this},i.prototype.insertBefore=function(t){return e(this,t,(function(e,t){return e.parentNode.insertBefore(t,e)}))},i.prototype.insertAfter=function(t){return e(this,t,(function(e,t){return e.parentNode.insertBefore(t,e.nextSibling)}),!0)},i.prototype.remove=function(){var e,t,i,n,r,o;for(o=[],e=0,t=(n=this.nodes).length;e<t;e++)i=n[e],o.push(null!=(r=i.parentNode)?r.removeChild(i):void 0);return o},i.prototype.clear=function(){var e,t,i,n,r;for(e=0,t=(n=this.nodes).length;e<t;e++)for(i=n[e],r=getMethod(i,"removeChild");i.firstChild;)r.call(i,i.firstChild);return this},i.prototype.set=function(e){var t=this;return e.then?Promise.resolve(e).then((function(e){return t.clear().add(e)})):this.clear().add(e),this},i.prototype.replace=function(e){var t=this;return e.then?Promise.resolve(e).then((function(e){return t.insertAfter(e),t.remove()})):(this.insertAfter(e),this.remove()),this},i.prototype.node=function(e){return void 0===e&&(e=0),this.nodes[e]},i.prototype.clone=function(e){var t,n,r;return void 0===e&&(e=!0),t=function(){var t,i,r,o;for(o=[],t=0,i=(r=this.nodes).length;t<i;t++)n=r[t],o.push(getMethod(n,"cloneNode").call(n,e));return o}.call(this),(r=new i(t)).singleSelection=this.singleSelection,r},i.prototype.prop=function(e,t){var i;return 2===arguments.length?(null!=t&&function(){var n,r,o,a;for(a=[],n=0,r=(o=this.nodes).length;n<r;n++)i=o[n],a.push(i[e]=t);return a}.call(this),this):reformed(this.singleSelection,function(){var t,n,r,o;for(o=[],t=0,n=(r=this.nodes).length;t<n;t++)i=r[t],o.push(i[e]);return o}.call(this))},i.prototype.attr=function(e,t){var i,n,r,o,a,s,l,c,u;if(e.indexOf(":")>=0?(l=e.split(":"),a=namespaces[l[0]],i=l[1]):i=e,2===arguments.length){for(r=0,o=(c=this.nodes).length;r<o;r++)s=c[r],a?void 0!==t?getMethod(s,"setAttributeNS").call(s,a,i,t):getMethod(s,"removeAttributeNS").call(s,a,i):void 0!==t?getMethod(s,"setAttribute").call(s,i,t):getMethod(s,"removeAttribute").call(s,i);return this}return n=a?function(e){return getMethod(e,"getAttributeNS").call(e,a,i)}:function(e){return getMethod(e,"getAttribute").call(e,i)},reformed(this.singleSelection,function(){var e,t,i,r;for(r=[],e=0,t=(i=this.nodes).length;e<t;e++)s=i[e],r.push(null!==(u=n(s))?u:void 0);return r}.call(this))},i.prototype.style=function(e,t){var i,n,r,o;if(2===arguments.length){for(i=0,n=(o=this.nodes).length;i<n;i++)r=o[i],void 0!==t?r.style.setProperty(e,t):r.style.removeProperty(e);return this}return reformed(this.singleSelection,function(){var t,i,n,o;for(o=[],t=0,i=(n=this.nodes).length;t<i;t++)r=n[t],o.push(window.getComputedStyle(r,null).getPropertyValue(e));return o}.call(this))},i.prototype.text=function(e){var t,i,n,r;if(1===arguments.length){for(t=0,i=(r=this.nodes).length;t<i;t++)(n=r[t]).textContent=null!=e?e:"";return this}return reformed(this.singleSelection,function(){var e,t,i,r;for(r=[],e=0,t=(i=this.nodes).length;e<t;e++)n=i[e],r.push(n.textContent||"");return r}.call(this))},i.prototype.html=function(e){var t,i,n,r;if(logger.deprecated("Selection::html","N/A - This method has been removed for security reasons"),1===arguments.length){for(t=0,i=(r=this.nodes).length;t<i;t++)(n=r[t]).innerHTML=null!=e?e:"";return this}return reformed(this.singleSelection,function(){var e,t,i,r;for(r=[],e=0,t=(i=this.nodes).length;e<t;e++)n=i[e],r.push(n.innerHTML||"");return r}.call(this))},i.prototype.class=function(e){var t,i,n,r;if(1===arguments.length){for(t=0,i=(r=this.nodes).length;t<i;t++)n=r[t],getMethod(n,"setAttribute").call(n,"class",e||"");return this}return reformed(this.singleSelection,function(){var e,t,i,r;for(r=[],e=0,t=(i=this.nodes).length;e<t;e++)n=i[e],r.push(getMethod(n,"getAttribute").call(n,"class")||"");return r}.call(this))},i.prototype.classed=function(e,t){var i,n,r,o,a,s;if(1===arguments.length)return i=function(){var e,t,i,n;for(n=[],e=0,t=(i=this.nodes).length;e<t;e++)a=i[e],n.push(getMethod(a,"getAttribute").call(a,"class")||"");return n}.call(this),reformed(this.singleSelection,function(){var t,r,o;for(o=[],t=0,r=i.length;t<r;t++)n=i[t],o.push(e.split(" ").every((function(e){return-1!==n.split(" ").indexOf(e)})));return o}());for(r=0,o=(s=this.nodes).length;r<o;r++)a=s[r],classed(a,e,t);return this},i.prototype.value=function(e){return 1===arguments.length?this.prop("value",e):this.prop("value")},i.prototype.on=function(e,t,i){var n,r,o,a,s,l,c,u,d,h,p;for(exports.isString(t)||(i=t,t="selection"),"default"===t&&(t="selection"),l=0,u=(p=this.nodes).length;l<u;l++){if(h=p[l],r=getHexagonElementDataObject(h),o=r.eventEmitter?r.eventEmitter:r.eventEmitter=new EventEmitter,null==r.eventAugmenters&&(r.eventAugmenters=new Map),null==r.listenerNamesRegistered&&(r.listenerNamesRegistered=new Set),0===e.indexOf("pointer")||r.listenerNamesRegistered.has(e)||(a=function(t){return o.emit(e,t)},r.listenerNamesRegistered.add(e),getMethod(h,"addEventListener").call(h,e,a)),o.off(e,t),!r.eventAugmenters.has(e)){for(s=[],c=0,d=augmenters.length;c<d;c++)(n=augmenters[c]).name===e&&s.push(n.setup(h,o));r.eventAugmenters.set(e,s)}t?o.on(e,t,i):o.on(e,i)}return this},i.prototype.off=function(e,t,i){var n,r,o,a,s,l,c,u,d,h;for(exports.isString(t)||(i=t,t=void 0),"default"===t&&(t="selection"),r=0,a=(c=this.nodes).length;r<a;r++){if(l=c[r],null!=(u=(n=getHexagonElementDataObject(l)).eventAugmenters)?u.has(e):void 0){for(o=0,s=(d=n.eventAugmenters.get(e)).length;o<s;o++)(0,d[o])();n.eventAugmenters.delete(e)}null!=(h=n.eventEmitter)&&h.off(e,t,i)}return this},i.prototype.data=function(e,t){var i,n,r;return 1===arguments.length?(r=function(){var t,r,o,a;for(a=[],t=0,r=(o=this.nodes).length;t<r;t++)n=o[t],i=getHexagonElementDataObject(n),i.data?a.push(i.data.get(e)):a.push(void 0);return a}.call(this),reformed(this.singleSelection,r)):(r=function(){var r,o,a,s;for(s=[],r=0,o=(a=this.nodes).length;r<o;r++)n=a[r],i=getHexagonElementDataObject(n),null==i.data&&(i.data=new Map),s.push(i.data.set(e,t));return s}.call(this),this)},i.prototype.forEach=function(e){return this.nodes.map((function(e){return select(e)})).forEach(e),this},i.prototype.map=function(e){return reformed(this.singleSelection,this.nodes.map((function(e){return select(e)})).map(e))},i.prototype.filter=function(e){var t;return(t=new i(this.nodes.filter((function(t){return e(select(t))})))).singleSelection=this.singleSelection,t},i.prototype.box=function(){var e;return reformed(this.singleSelection,function(){var t,i,n,r;for(r=[],t=0,i=(n=this.nodes).length;t<i;t++)e=n[t],r.push(getMethod(e,"getBoundingClientRect").call(e));return r}.call(this))},i.prototype.width=function(){var e;return reformed(this.singleSelection,function(){var t,i,n,r;for(r=[],t=0,i=(n=this.nodes).length;t<i;t++)e=n[t],r.push(getMethod(e,"getBoundingClientRect").call(e).width);return r}.call(this))},i.prototype.height=function(){var e;return reformed(this.singleSelection,function(){var t,i,n,r;for(r=[],t=0,i=(n=this.nodes).length;t<i;t++)e=n[t],r.push(getMethod(e,"getBoundingClientRect").call(e).height);return r}.call(this))},i.prototype.size=function(){return this.nodes.length},i.prototype.empty=function(){return 0===this.nodes.length},i.prototype.contains=function(e){var t,i,n,r;for(t=0,i=(r=this.nodes).length;t<i;t++)if(n=r[t],getMethod(n,"contains").call(n,e))return!0;return!1},i.prototype.component=function(){return this.singleSelection?this.nodes[0]?component(this.nodes[0]):void 0:this.nodes.map(component)},i.prototype.components=function(){return this.singleSelection?this.nodes[0]?components(this.nodes[0]):void 0:this.nodes.map(components)},i.prototype.api=function(e,t){var i,n;if(!this.singleSelection)throw new Error("Selection::api - can only be used for a single selection");if(null==(i=getHexagonElementDataObject(this.nodes[0])).components&&(i.components=[]),0===arguments.length)return i.defaultApi;if(1===arguments.length){if(exports.isString(e))return null!=(n=i.api)?n[e]:void 0;if(exports.isObject(e))return i.defaultApi=arguments[0],i.components.push(arguments[0]),this;throw new Error("Selection::api - the api passed in should be an object")}if(2===arguments.length){if(!exports.isString(e))throw new Error("Selection::api - name should be a string");if(!exports.isObject(t))throw new Error("Selection::api - the api passed in should be an object");return i.api=i.api||{},i.api[e]=t,-1===!i.components.indexOf(t)&&i.components.push(t),this}},t=function(e,t,n){var r,o,a,s,l,c,u,d,h,p;if(void 0===t)return[];if(!(exports.isString(t)||t instanceof i||t instanceof Element))return logger.warn("Selection Api error when attaching element","Expecting an Element, Selection or string argument, you supplied:",t),[];if(!e.singleSelection&&(t instanceof Element||t instanceof i))return logger.warn("Selection Api error when attaching element","You can not attach an existing element to a selection with multiple elements"),[];if(e.empty())return logger.warn("Selection Api error when attaching element","You can not attach an element to an empty selection"),[];if(t instanceof Element)return n(e.nodes[0],t),[t];if(t instanceof i){for(r=0,a=(d=t.nodes).length;r<a;r++)u=d[r],n(e.nodes[0],u);return t.nodes}for(p=[],o=0,s=(h=e.nodes).length;o<s;o++)u=h[o],l=namespaces.hasOwnProperty(t)?namespaces[t]:u.namespaceURI,c=u.ownerDocument.createElementNS(l,t),n(u,c),p.push(c);return p},e=function(e,n,r,o){var a,s,l,c,u,d;return void 0===o&&(o=!1),d=e.singleSelection,l=exports.isArray(n)?(d=!1,a=o?-1:1,c=function(){var i,o,l,c;for(c=[],(l=a)>0?(i=0,o=n.length):i=n.length-1;l>0?i<o:i>=0;i+=l)s=n[i],c.push(t(e,s,r));return c}(),exports.flatten(o?c.reverse():c)):t(e,n,r),(u=new i(l)).singleSelection=d,u},i}.call(void 0);bareSelect=function(e,t){var i,n;return i=t?e:"string"==typeof e?[domSelectSingle(e,document)]:[e],(n=new Selection(i)).singleSelection=!t,n};var select=function(e){return e instanceof Selection?e:e instanceof HTMLElement||e instanceof SVGElement||exports.isString(e)||e===document||e===window?bareSelect(e):(logger.warn("hx.select was passed the wrong argument type","hx.select only accepts a HTMLElement, SVGElement or string argument, you supplied:",e),new Selection([]))},component=function(e){return logger.deprecated("component","Deprecated in favour of Selection::api()"),getHexagonElementDataObject(select(e).node()).components[0]},components=function(e){return logger.deprecated("components","Deprecated in favour of Selection::api('name')"),(getHexagonElementDataObject(select(e).node()).components||[]).slice()};components.clear=function(e){logger.deprecated("components.clear","Removed, clearing the components from an element is not recommended. Components are attached to nodes so removing them from the DOM will remove associated components"),getHexagonElementDataObject(select(e).node()).components=[]},component.register=function(e,t){logger.deprecated("component.register","Deprecated in favour of Selection::api(component) and Selection::api('name', component)"),select(e).api(t)};var context,contexts,paletteContexts,addEventAugmenter=function(e){return augmenters.push(e)},selectAll=function(e){return exports.isString(e)||exports.isArray(e)?exports.isArray(e)?bareSelect(e,!0):bareSelect(document).selectAll(e):(logger.warn("hx.selectAll was passed the wrong argument type","hx.selectAll only accepts a string argument, you supplied:",e),new Selection([]))},detached=function(e,t){return t=namespaces.hasOwnProperty(e)?namespaces[e]:namespaces.xhtml,bareSelect(document.createElementNS(t,e))},isSelection=function(e){return e instanceof Selection};paletteContexts=["default","action","positive","negative","warning","info","complement","contrast","disabled"],context=function(e,t){var i;return i=e.map((function(e){return t+"-"+e})).join(" "),function(n,r){var o,a,s;if(s=select(n),arguments.length>1)return s.classed(i,!1),-1!==e.indexOf(r)?s.classed(t+"-"+r,!0):r&&logger.warn(r+" is not a known context. Accepted values are "+e.join(", ")),s;for(o=0,a=paletteContexts.length;o<a;o++)if(r=paletteContexts[o],s.classed(t+"-"+r))return r}};var Animation,Morph,animateState,initAnimate,registerMorph,palette$1={context:context(contexts=["action","positive","negative","warning","info","complement","contrast","disabled"],"hx"),textContext:context(paletteContexts,"hx-text"),backgroundContext:context(paletteContexts,"hx-background"),borderContext:context(paletteContexts,"hx-border")},div=function(e){return detached("div").class(e)},span=function(e){return detached("span").class(e)},input=function(e){return detached("input").class(e)},checkbox=function(e){return detached("input").attr("type","checkbox").class(e)},i=function(e){return detached("i").class(e)},icon=function(e){return logger.deprecated("icon","The icon fluid API has been replaced by: i('class')"),detached("i").class(null!=e?e.class:void 0)},button=function(e){var t;return e&&!exports.isString(e)?(logger.deprecated("button","The button fluid API has been updated to take a single class string, you passed: "+e,"button('class')"),t=detached("button").attr("type","button").class("hx-btn"),palette$1.context(t,e.context)):detached("button").class(e)};animateState={morphs:new Map},Animation=function(){var e,t=function(t){function i(e,i){var n=this;void 0===i&&(i=ease.linear),t.call(this),this.node=e,this.ease=i,this.cancelers=[],this.remaining=0,this.finished=!1,this.endCallback=function(e){if(n.remaining--,n.remaining<=0&&!n.finished&&!e)return n.finished=!0,n.emit("end")}}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.style=function(t,i,n){var r,o,a=this;return this.node?4===arguments.length?(r=interpolate(arguments[1],arguments[2]),o=function(e,i){if(!i)return a.node.style.setProperty(t,r(e))},e.call(this,o,arguments[3]||200)):(r=interpolate(window.getComputedStyle(this.node,null).getPropertyValue(t),i),o=function(e,i){if(!i)return a.node.style.setProperty(t,r(e))},e.call(this,o,n||200)):this.endCallback(),this},i.prototype.attr=function(t,i,n){var r,o,a=this;return this.node?4===arguments.length?(r=interpolate(arguments[1],arguments[2]),o=function(e,i){if(!i)return a.node.setAttribute(t,r(e))},e.call(this,o,arguments[3]||200)):(r=interpolate(this.node.getAttribute(t),i),o=function(e,i){if(!i)return a.node.setAttribute(t,r(e))},e.call(this,o,n||200)):this.endCallback(),this},i.prototype.cancel=function(){var e,t,i;for(this.emit("cancelled"),e=0,t=(i=this.cancelers).length;e<t;e++)(0,i[e])();return this},i}(EventEmitter);return e=function(e,t){return this.remaining++,this.cancelers.push(transition(t,e,this.ease,this.endCallback)),this},t}.call(void 0),exports.animate=function(e,t){return new Animation(e,t)},Morph=function(){var e,t,i,n=function(n){function r(e,t,r,o){var a=this;n.call(this),this.node=e,this.trigger=t,this.actions=[],this.start=r||function(){return i.call(a)},this.cancelers=o||[],this.cancelled=!1,this.finished=!1,this.trigger&&this.trigger.on("end","hx.animate",(function(){if(a.finished=!0,!a.cancelled)return i.call(a)}))}return n&&(r.__proto__=n),r.prototype=Object.create(n&&n.prototype),r.prototype.constructor=r,r.prototype.and=function(e,t){var i,n=this;return void 0===t&&(t=200),exports.isFunction(e)?this.actions.push(e):this.node&&((i=animateState.morphs.get(e))?this.actions.push((function(){return i(n.node,t)})):logger.warn(e+" is not a registered morph","The available morphs are",animateState.morphs.entries())),this},r.prototype.then=function(e,t){return void 0===t&&(t=200),this.actions.length>0?new r(this.node,this,this.start,this.cancelers).and(e,t):this.and(e,t)},r.prototype.with=function(e,t){return this.then(e,t)},r.prototype.andStyle=function(e,i,n){return this.and(t(this.node,arguments))},r.prototype.thenStyle=function(e,i,n){return this.then(t(this.node,arguments))},r.prototype.withStyle=function(e,i,n){return this.then(t(this.node,arguments))},r.prototype.andAttr=function(t,i,n){return this.and(e(this.node,arguments))},r.prototype.thenAttr=function(t,i,n){return this.then(e(this.node,arguments))},r.prototype.withAttr=function(t,i,n){return this.then(e(this.node,arguments))},r.prototype.cancel=function(){var e,t,i,n;if(!this.cancelled)for(this.emit("cancelled"),this.cancelled=!0,t=0,i=(n=this.cancelers).length;t<i;t++)e=n[t],exports.isFunction(e.cancel)&&e.cancel();return this},r.prototype.go=function(e){var t;return!0===e&&this.cancelOngoing(),this.start(),this.node&&(null==(t=getHexagonElementDataObject(this.node,!0)).morphs&&(t.morphs=[]),t.morphs=t.morphs.filter((function(e){return!e.cancelled&&!e.finished})),t.morphs.push(this)),this},r.prototype.cancelOngoing=function(){var e,t,i,n,r;if(this.node&&(n=getHexagonElementDataObject(this.node,!1))&&n.morphs){for(e=0,t=(r=n.morphs).length;e<t;e++)(i=r[e]).finished||i.cancelled||i.cancel();n.morphs=[]}return this},r}(EventEmitter);return t=function(e,t){return function(){var i;return(i=exports.animate(e)).style.apply(i,t)}},e=function(e,t){return function(){var i;return(i=exports.animate(e)).attr.apply(i,t)}},i=function(){var e,t,i,n,r,o,a,s,l=this;if(this.actions.length>0){for(t=this.actions.length,r=function(){if(0===--t)return l.emit("end")},s=[],i=0,n=(o=this.actions).length;i<n;i++)void 0!==(a=(e=o[i])(r))&&a.cancel&&this.cancelers.push(a),a instanceof EventEmitter?s.push(a.on("end","hx.animate",r)):0===e.length?s.push(r()):s.push(void 0);return s}return this.emit("end")},n}.call(void 0),exports.morph=function(e){return new Morph(e)},registerMorph=function(e,t){return animateState.morphs.set(e,t)},initAnimate=function(){return Selection.prototype.animate=function(e){return exports.animate(this.nodes[0],e)},Selection.prototype.morph=function(){return new Morph(this.nodes[0])}};var View,initPointerEvents=function(){var e,t,i;return e=function(e,t,i,n,r,o,a){return addEventAugmenter({name:e,setup:function(n,r){var s,l,c,u,d,h;if(c=function(t){return r.emit(e,o(t))},n.addEventListener(t,c),u=exports.supports("touch"))for(d=function(t){return r.emit(e,a(t))},s=0,l=i.length;s<l;s++)h=i[s],n.addEventListener(h,d);return function(){var e,r,o;if(n.removeEventListener(t,c),u){for(o=[],e=0,r=i.length;e<r;e++)h=i[e],o.push(n.removeEventListener(h,d));return o}}}})},i=function(t,i,n,r,o){var a;return e(t,i,n,0,0,a=function(e){return{event:e}},a)},(t=function(t,i,n,r,o){return e(t,i,n,0,0,(function(e){return{x:e.clientX,y:e.clientY,event:e}}),(function(e){return{x:e.targetTouches[0].clientX,y:e.targetTouches[0].clientY,event:e}}))})("pointerdown","mousedown",["touchstart"]),t("pointermove","mousemove",["touchmove"]),i("pointerup","mouseup",["touchend","touchcancel"]),i("pointerleave","mouseleave",["touchleave"]),i("pointerenter","mouseenter",["touchenter"])};View=function(){function e(e,t,i){var n,r,o;this.rootSelection=e,this.selector=t,this.defaultType=i,r=(o=this).selector.split(".")[0],n=o.selector.split(".").slice(1).join(" "),this.new=function(e){return this.append(r||o.defaultType).class(n).node()},this.each=function(e,t){},this.old=function(e,t){return this.remove()}}return e.prototype.enter=function(e){return this.new=e,this},e.prototype.exit=function(e){return this.old=e,this},e.prototype.update=function(e){return this.each=e,this},e.prototype.apply=function(e,t){var i,n,r,o,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S,k,T,A,C,_,M,P,E,D,z=this;if(this.rootSelection.size()){if(e=Array.isArray(e)?e:[e],s=[],E=[],l=[],k=this.rootSelection.shallowSelectAll(this.selector).nodes,t){for(w=new Map,o=new Map(e.map((function(e){return[t(e),e]}))),h=0,p=k.length;h<p;h++)b=k[h],(S=getHexagonElementDataObject(b)).datum?(r=S.datum,d=t(r),w.has(d)?l.push({element:b,datum:r}):(w.set(d,b),o.has(d)?(a=o.get(d),o.delete(d),E.push({element:b,datum:a})):l.push({element:b,datum:r}))):l.push({element:b,datum:void 0});s=function(){var e,t,i,n;for(n=[],t=0,e=(i=o.entries()).length;t<e;t++)r=i[t],n.push({datum:r[1]});return n}()}else{for(c=0,m=0,f=k.length;m<f;m++)b=k[m],c<e.length?((S=getHexagonElementDataObject(b)).datum=e[c],E.push({element:b,datum:e[c]})):(S=getHexagonElementDataObject(b,!1),l.push({element:b,datum:S.datum})),c++;if(c<e.length)for(u=v=C=c,_=e.length-1;C<=_?v<=_:v>=_;u=C<=_?++v:--v)s.push({datum:e[u]})}for(D=function(e,t){return logger.warn("view enter function returned",e,". It didn't match selector",t,", so you may encounter odd behavior")},n=this.selector.split("."),P=n.length>1,i=n.slice(1).join(" "),y=s.map((function(t,n){var r;return a=t.datum,r=z.new.call(z.rootSelection,a,n,e.indexOf(a)),z.rootSelection.contains(r)?P&&(select(r).classed(i)||D(r,z.selector)):D(r,z.selector),getHexagonElementDataObject(r).datum=a,{element:r,datum:t.datum}})),c=T=0,g=l.length;T<g;c=++T)r=l[c],this.old.call(select(r.element),r.datum,r.element,c);for(c=A=0,x=(M=E.concat(y)).length;A<x;c=++A)r=M[c],this.each.call(select(r.element),r.datum,r.element,c);return this}},e}();var initView=function(){return Selection.prototype.view=function(e,t){return void 0===t&&(t="div"),0===this.size()&&logger.warn(".view() called on an empty selection"),new View(this,e,t)}},boundMethodCheck=function(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")},initMorphs=function(){var e,t,i,n,r;return registerMorph("fadeout",(function(e,t){return void 0===t&&(t=100),exports.animate(e).style("opacity",0,t)})),registerMorph("fadein",(function(e,t){return void 0===t&&(t=100),exports.animate(e).style("opacity",1,t)})),n=function(e,t){var i,n,r,o,a,s,l;if("none"!==e.style("display")){for(s=[],i=0,r=t.length;i<r;i++)a=t[i],s.push({name:a,value:e.style(a)});return s}for(l=[],n=0,o=t.length;n<o;n++)a=t[n],l.push({name:a,value:"0px"});return l},i=function(e,t){var i,n,r,o;for(o=[],i=0,n=t.length;i<n;i++)r=t[i],o.push({name:r,value:e.style(r,"").style(r)});return o},r=function(e,t){var i,n,r;for(i=0,r=t.length;i<r;i++)n=t[i],e.style(n.name,n.value)},t=function(e,t,i){var n,r,o,a;for(n=e.animate(),r=0,a=t.length;r<a;r++)o=t[r],n.style(o.name,o.value,i);return n},registerMorph("expand",(function(e,o){var a,s,l,c;return void 0===o&&(o=100),s=["height","padding-top","padding-bottom","margin-top","margin-bottom","width","padding-left","padding-right","margin-left","margin-right"],l=select(e),c=n(l,s),l.style("display",""),a=i(l,s),r(l,c),l.classed("hx-morph-hidden",!0),t(l,a,o).on("end","hx.morphs",(function(e){return i(l,s),l.classed("hx-morph-hidden",!1)}))})),registerMorph("expandv",(function(e,o){var a,s,l,c;return void 0===o&&(o=100),s=["height","padding-top","padding-bottom","margin-top","margin-bottom"],l=select(e),c=n(l,s),l.style("display",""),a=i(l,s),r(l,c),l.classed("hx-morph-hidden",!0),t(l,a,o).on("end","hx.morphs",(function(e){return i(l,s),l.classed("hx-morph-hidden",!1)}))})),registerMorph("expandh",(function(e,o){var a,s,l,c;return void 0===o&&(o=100),s=["width","padding-left","padding-right","margin-left","margin-right"],l=select(e),c=n(l,s),l.style("display",""),a=i(l,s),r(l,c),l.classed("hx-morph-hidden",!0),t(l,a,o).on("end","hx.morphs",(function(e){return i(l,s),l.classed("hx-morph-hidden",!1)}))})),registerMorph("collapse",(function(e,t){var i;return void 0===t&&(t=100),i=select(e).classed("hx-morph-hidden",!0),exports.animate(e).style("height","0px",t).style("padding-top","0px",t).style("padding-bottom","0px",t).style("margin-top","0px",t).style("margin-bottom","0px",t).style("width","0px",t).style("padding-left","0px",t).style("padding-right","0px",t).style("margin-left","0px",t).style("margin-right","0px",t).on("end","hx.morphs",(function(e){return i.style("display","none").style("height","").style("padding-top","").style("padding-bottom","").style("margin-top","").style("margin-bottom","").style("width","").style("padding-left","").style("padding-right","").style("margin-left","").style("margin-right","").classed("hx-morph-hidden",!1)}))})),registerMorph("collapsev",(function(e,t){var i;return void 0===t&&(t=100),i=select(e).classed("hx-morph-hidden",!0),exports.animate(e).style("height","0px",t).style("padding-top","0px",t).style("padding-bottom","0px",t).style("margin-top","0px",t).style("margin-bottom","0px",t).on("end","hx.morphs",(function(e){return i.style("display","none").style("height","").style("padding-top","").style("padding-bottom","").style("margin-top","").style("margin-bottom","").classed("hx-morph-hidden",!1)}))})),registerMorph("collapseh",(function(e,t){var i;return void 0===t&&(t=100),i=select(e).classed("hx-morph-hidden",!0),exports.animate(e).style("width","0px",t).style("padding-left","0px",t).style("padding-right","0px",t).style("margin-left","0px",t).style("margin-right","0px",t).on("end","hx.morphs",(function(e){return i.style("display","none").style("width","").style("padding-left","").style("padding-right","").style("margin-left","").style("margin-right","").classed("hx-morph-hidden",!1)}))})),registerMorph("rotate-90",(function(e,t){return void 0===t&&(t=100),exports.animate(e).style("-webkit-transform","matrix(1, 0, 0, 1, 0, 0)","matrix(0, 1, -1, 0, 0, 0)",t).style("transform","matrix(1, 0, 0, 1, 0, 0)","matrix(0, 1, -1, 0, 0, 0)",t).on("end","hx.morphs",(function(){return select(e).style("transform","").style("-webkit-transform","")})).on("cancel","hx.morphs",(function(){return select(e).style("transform","").style("-webkit-transform","")}))})),registerMorph("rotate-0",(function(e,t){return void 0===t&&(t=100),exports.animate(e).style("-webkit-transform","matrix(0, 1, -1, 0, 0, 0)","matrix(1, 0, 0, 1, 0, 0)",t).style("transform","matrix(0, 1, -1, 0, 0, 0)","matrix(1, 0, 0, 1, 0, 0)",t).on("end","hx.morphs",(function(){return select(e).style("transform","").style("-webkit-transform","")})).on("cancel","hx.morphs",(function(){return select(e).style("transform","").style("-webkit-transform","")}))})),e=function(e){function t(t){var i=this;e.call(this),this.cancel=this.cancel.bind(this),this.timeout=setTimeout((function(){return i.emit("end")}),t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.cancel=function(){return boundMethodCheck(this,t),clearTimeout(this.timeout)},t}(EventEmitter),registerMorph("delay",(function(t,i){return void 0===i&&(i=100),new e(i)}))};function initializeResizeListeners(){var e,t,i,n,r,o,a,s,l,c,u,d,h,p,f,g,x,m,v,y;if(o=document.attachEvent,m=!1,f=function(e){var t,i,n,r;i=(r=e.__resizeTriggers__).firstElementChild,t=r.lastElementChild,n=i.firstElementChild,t.scrollLeft=t.scrollWidth,t.scrollTop=t.scrollHeight,n.style.width=i.offsetWidth+1+"px",n.style.height=i.offsetHeight+1+"px",i.scrollLeft=i.scrollWidth,i.scrollTop=i.scrollHeight},s=function(e){return e.offsetWidth!==e.__resizeLast__.width||e.offsetHeight!==e.__resizeLast__.height},g=function(e){var t;t=this,f(this),this.__resizeRAF__&&a(this.__resizeRAF__),this.__resizeRAF__=p((function(){s(t)&&(t.__resizeLast__.width=t.offsetWidth,t.__resizeLast__.height=t.offsetHeight,t.__resizeListeners__.forEach((function(i){i.call(t,e)})))}))},l=function(){var e,i,r;m||(e=(t||"")+".resize-triggers { "+(n||"")+'visibility: hidden; opacity: 0; z-index: -1;} .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',i=document.head||document.getElementsByTagName("head")[0],(r=document.createElement("style")).type="text/css",r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e)),i.appendChild(r),m=!0)},!o){for(y=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)},p=function(e){return y(e)},v=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,a=function(e){return v(e)},e=!1,h="",r="animationstart",c="Webkit Moz O ms".split(" "),x="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),void 0!==(u=document.createElement("fakeelement")).style.animationName&&(e=!0),!1===e&&(d=0);d<c.length;){if(void 0!==u.style[c[d]+"AnimationName"]){h="-"+c[d].toLowerCase()+"-",r=x[d],e=!0;break}d++}t="@"+h+"keyframes "+(i="resizeanim")+" { from { opacity: 0; } to { opacity: 0; } } ",n=h+"animation: 1ms "+i+"; "}return{addResizeListener:function(e,t){o?e.attachEvent("onresize",t):(e.__resizeTriggers__||("static"===getComputedStyle(e).position&&(e.style.position="relative"),l(),e.__resizeLast__={},e.__resizeListeners__=[],(e.__resizeTriggers__=document.createElement("div")).className="resize-triggers",e.__resizeTriggers__.innerHTML='<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>',e.appendChild(e.__resizeTriggers__),f(e),e.addEventListener("scroll",g,!0),r&&e.__resizeTriggers__.addEventListener(r,(function(t){t.animationName===i&&f(e)}))),e.__resizeListeners__.push(t))},removeResizeListener:function(e,t){o?e.detachEvent("onresize",t):(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||(e.removeEventListener("scroll",g),e.__resizeTriggers__=!e.removeChild(e.__resizeTriggers__)))}}}var initLogos,replaceWithDiv,cachedParseHtml,cachedScrollbarSize,initResizeEvents=function(){var e,t;return e=void 0,t=void 0,addEventAugmenter({name:"resize",setup:function(i,n){var r,o;return void 0===e&&(o=initializeResizeListeners(),e=o.addResizeListener,t=o.removeResizeListener),e(i,r=function(e){var t;return t=select(i).box(),n.emit("resize",{clientRect:t,event:e})}),function(){return t(i,r)}}})};function actionRenderer(e){var t=e.text,i=e.onClick,n=e.disabled;if(!i)throw new Error("Action items require an onClick function or url");if(exports.isString(i)){var r=detached("a").text(t);return n||r.attr("href",i),r}var o=div().text(t);return n||o.on("click",i),o}function actionRenderWrapper(e,t){var i=select(e),n=i.class(),r=actionRenderer(t);return r.classed(n,!0),i.insertBefore(r),i.remove(),r}replaceWithDiv=function(e){return e.replace(div("hx-logo"))},initLogos=function(){var e;if((e=selectAll("img.hx-logo")).size())return logger.warn("Logo:","The .hx-logo class should only be applied to <div> elements.","You supplied: ",e.nodes),e.forEach(replaceWithDiv)},cachedParseHtml=null;var parseHTML=function(e){if(!cachedParseHtml)try{document.createRange().createContextualFragment(""),cachedParseHtml=function(e){return document.createRange().createContextualFragment(e)}}catch(e){cachedParseHtml=function(e){var t,i,n;for(i=document.createDocumentFragment(),(n=document.createElement("div")).innerHTML=e;t=n.firstChild;)i.appendChild(t);return i}}return cachedParseHtml(e)},cleanNode=function(e,t){var i,n;for(void 0===t&&(t=!0),n=e.childNodes.length-1;n>=0;)3===(i=e.childNodes[n]).nodeType&&/\s/.test(i.nodeValue)?e.removeChild(i):1===i.nodeType&&t&&cleanNode(i),n-=1;return e};cachedScrollbarSize=void 0;var setVisibility,titlebar,scrollbarSize=function(){var e,t,i,n;return null==cachedScrollbarSize&&((e=document.createElement("p")).style.width="100%",e.style.height="200px",t=document.createElement("div"),e=detached("p").style("width","100%").style("height","200px"),(t=detached("div").style("position","absolute").style("top","0").style("left","0").style("visiblity","hidden").style("width","200px").style("height","150px").style("overflow","hidden")).append(e),select("body").append(t),i=e.node().offsetWidth,t.style("overflow","scroll"),i===(n=e.node().offsetWidth)&&(n=t.node().clientWidth),t.remove(),cachedScrollbarSize=i-n),cachedScrollbarSize},parentZIndex=function(e,t){var i,n;return i=function(e){var t;if(t=Number(select(e).style("z-index")),!isNaN(t)&&t>0)return t},n=checkParents(e,i,t),t?exports.max(n):n},checkParents=function(e,t,i){var n,r,o;if(null!=e){for(n=e,o=[];9!==n.nodeType;){if(r=t(n),i)null!=r&&o.push(r);else if(null!=r)return r;if(null==(n=n.parentNode))break;if(i&&9===n.nodeType)return o}return!!i&&[]}},isElement=function(e){return!(!e||1!==e.nodeType)};setVisibility=function(e,t){var i;if(void 0===t&&(t=!0),this.isMobileFriendly&&e!==this.visible)return this.visible=e,(i=function(i){return e?(i.classed("hx-titlebar-mobile-hide",!1),t?i.style("height","0px").morph().with("expandv",150).go():void 0):t?i.morph().with("collapsev",50).then((function(){return i.classed("hx-titlebar-mobile-hide",!0)})).thenStyle("display","").go():i.classed("hx-titlebar-mobile-hide",!0)})(select(this.selector).selectAll(".hx-titlebar-menu-icons")),i(select(this.selector).selectAll(".hx-titlebar-linkbar"))};var TitleBar=function(){function e(e){var t,i,n,r,o=this;this.selector=e,this._={},r=select(this.selector).api("titlebar",this).api(this),this.isMobileFriendly=r.select(".hx-titlebar-menu-icon-mobile").size()>0,t=r.select(".hx-titlebar-linkbar").selectAll(".hx-titlebar-link").size()>0,i=select("body").classed("hx-heading-fixed"),n=select("body").classed("hx-full-screen"),this.isMobileFriendly&&(r.select(".hx-titlebar-menu-icon-mobile").on("click","hx.titlebar",(function(){return setVisibility.call(o,!o.visible,!0)})),this.visible=!0,setVisibility.call(this,!1,!1)),t&&(i||n)&&select("body").classed("hx-titlebar-link-padding",!0)}return e.prototype.show=function(e){return setVisibility.call(this,!0,e)},e.prototype.hide=function(e){return setVisibility.call(this,!1,e)},e.prototype.contextClass=function(e){var t,i,n,r;if(arguments.length>0){if(null!=e)for(this._.cls=void 0,i=0,n=(r=["hx-action","hx-positive","hx-negative","hx-warning","hx-info"]).length;i<n;i++)e===(t=r[i])&&(this._.cls=t),select(this.selector).select(".hx-titlebar").classed(t,e===t);return this}return this._.cls},e.prototype.active=function(e){var t,i;return arguments.length>0?(i=selectAll(".hx-titlebar-link").classed("hx-selected",!1),null!=e?(this._.active=exports.isString(e)||isElement(e)||isSelection(e)?select(e).classed("hx-selected",!0):null!=(t=i.node(e))?select(t).classed("hx-selected",!0):void 0,this):void 0):this._.active},e}(),initTitleBar=function(){var e;if(select(".hx-heading").size()>0)return e=new TitleBar(".hx-heading"),window.hx&&(window.hx.titlebar=e),e},titleBar=function(e){var t,i,n,r,o,a,s,l;return void 0===e&&(e={}),l=void 0===(l=(t=e).title)?"Title":l,s=void 0===(s=t.subtitle)?"":s,a=void 0===(a=t.showIcon)||a,r=void 0===(r=t.iconLink)?"#":r,n=void 0===(n=t.iconClass)?"hx-logo":n,i=a?detached("a").class("hx-titlebar-icon").attr("href",r).add(detached("img").class(n)):void 0,o=div("hx-heading").add(div("hx-titlebar").add(div("hx-titlebar-container").add(div("hx-titlebar-header").add(i).add(l?div("hx-titlebar-title").text(l):void 0).add(s?div("hx-titlebar-subtitle").text(s):void 0)))),new TitleBar(o),o};select(".hx-heading").size()>0&&(titlebar=new TitleBar(".hx-heading"));var collatorFn,defaultCollator,hasCollator,localeCollatorFn,nullsLastCollator,state,buildFilter,filterCaseModifier,filterMatch,version="2.7.1",currentTheme$1={},themeSet=!1;function theme(e){return arguments.length>0&&(themeSet=!0,currentTheme$1=e),themeSet||logger.warn("No JS theme has been set, use hx.theme(obj) to initialise theme variables"),currentTheme$1}function getThemeVariable(e){return getComputedStyle(document.body).getPropertyValue(e)}hasCollator=function(){return null!=("undefined"!=typeof Intl&&null!==Intl?Intl.Collator:void 0)},state={},collatorFn=function(){return hasCollator()?new Intl.Collator(void 0,{numeric:!0}).compare:function(e,t){return e===t?0:String(e)<String(t)?-1:1}},nullsLastCollator=function(e){return function(t,i){return t===i?0:void 0===t?1:void 0===i?-1:null===t?1:null===i?-1:isNaN(Number(t))||isNaN(Number(i))?e(t,i):t-i}},defaultCollator=function(e){return function(t,i){return null==t||null==i||isNaN(Number(t))||isNaN(Number(i))?e(t,i):t-i}},exports.compare=function(e,t){return null==state.collator&&(state.collator=collatorFn()),defaultCollator(state.collator)(e,t)},exports.compareNullsLast=function(e,t){return null==state.collator&&(state.collator=collatorFn()),nullsLastCollator(state.collator)(e,t)},localeCollatorFn=function(e,t){return hasCollator()?new Intl.Collator(e,t).compare:function(i,n){return String(i).localeCompare(String(n),e,t)}},exports.localeCompare=function(e,t){var i;return t=exports.mergeDefined({numeric:!0},t),i=localeCollatorFn(e,t),t.nullsLast?nullsLastCollator(i):defaultCollator(i)},exports.sortBy=function(e,t){var i;return(i=[].concat(e)).sort((function(e,i){var n,r;return n=t(e),r=t(i),exports.compare(n,r)})),i},exports.sort=function(e){return exports.sortBy(e,(function(e){return e}))},exports.sort.compare=exports.compare,exports.sort.compareNullsLast=exports.compareNullsLast,exports.sort.localeCompare=exports.localeCompare,exports.ClickDetector=function(e){function t(){var t,i=this;e.call(this),this.eventId=exports.randomId(),this.exceptions=new List,t=void 0,this.downAction=function(e){var n,r,o,a;for(e=e.event,t=e.target,n=!0,r=0,o=(a=i.exceptions.entries()).length;r<o;r++)a[r].contains(e.target)&&(n=!1);if(n)return i.emit("click")},this.upAction=function(e){var n,r,o,a,s;for(e=e.event,n=!0,o=document.documentElement.contains(e.target),!(t&&!t.contains(e.target))&&o||(n=!1),t=void 0,r=0,a=(s=i.exceptions.entries()).length;r<a;r++)s[r].contains(e.target)&&(n=!1);if(n)return i.emit("click")},select(document).on("pointerdown","hx.click-detector."+this.eventId,this.downAction),select(document).on("pointerup","hx.click-detector."+this.eventId,this.upAction)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.addException=function(e){return this.exceptions.add(e),this},t.prototype.removeException=function(e){return this.exceptions.remove(e),this},t.prototype.removeAllExceptions=function(){return this.exceptions.clear(),this},t.prototype.cleanUp=function(){return select(document).off("pointerdown","hx.click-detector."+this.eventId,this.downAction),select(document).off("pointerup","hx.click-detector."+this.eventId,this.upAction),this},t}(EventEmitter),filterCaseModifier=function(e){return e?function(e){return e}:function(e){return e.toLowerCase()}},filterMatch=function(e,t,i){var n,r,o,a,s,l;if(l=0,r=!1,null!=i.searchValues)for(o=0,a=(s=i.searchValues(e)).length;o<a;o++)n=s[o],(l+=i.lookup(i.caseModifier(n.toString())))>-1&&(r=!0);else l+=i.lookup(i.caseModifier(e.toString()));return!0===t?l:!!(r||l>-1)},buildFilter=function(e){return function(t,i,n){var r;return void 0===n&&(n={}),(r=exports.mergeDefined({caseSensitive:!1,searchValues:void 0,sort:!0},n)).caseModifier=filterCaseModifier(r.caseSensitive),"string"==typeof i&&(i=r.caseModifier(i)),r.lookup=e(i),t=t.filter((function(e){return filterMatch(e,!1,r)})),!0===r.sort&&(t=t.sort((function(e,t){var i,n,o,a,s,l,c,u;if((n=filterMatch(e,!0,r))>(a=filterMatch(t,!0,r)))return 1;if(n<a)return-1;if(null!=r.searchValues){for(c=0,i=r.searchValues(e),o=r.searchValues(t),s=l=0,u=i.length;l<u&&0===(c=exports.compare(i[s],o[s]));s=l+=1);return c}return exports.compare(e,t)}))),t}},exports.filterExact=buildFilter((function(e){return function(t){return t===e?e.length:-1}})),exports.filterStartsWith=buildFilter((function(e){return function(t){return exports.startsWith(t,e)?e.length:-1}})),exports.filterContains=buildFilter((function(e){return function(t){var i;return(i=t.indexOf(e))>-1?i+e.length:-1}})),exports.filterExcludes=buildFilter((function(e){return function(t){return-1===t.indexOf(e)?e.length:-1}})),exports.filterGreater=buildFilter((function(e){return function(t){var i;return-1!==(i=exports.compare(t,e))?i:-1}})),exports.filterLess=buildFilter((function(e){return function(t){var i;return-1!==(i=exports.compare(e,t))?i:-1}})),exports.filterFuzzy=buildFilter((function(e){var t,i,n;return t=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},n="("+e.split("").map(t).join(").*?(")+").*?",i=new RegExp(n),function(e){var t;return null!=(t=e.match(i))?t.index+t[0].length:-1}})),exports.filterRegex=buildFilter((function(e){return function(t){var i;return null!=(i=t.match(e))?i.index+i[0].length:-1}})),exports.filterStringTypes=function(){return["contains","exact","excludes","startsWith","regex","fuzzy"]},exports.filterNumberTypes=function(){return["exact","greater","less"]},exports.filterTypes=function(){return["contains","exact","greater","less","excludes","startsWith","regex","fuzzy"]},exports.filter={exact:exports.filterExact,startsWith:exports.filterStartsWith,contains:exports.filterContains,excludes:exports.filterExcludes,greater:exports.filterGreater,less:exports.filterLess,fuzzy:exports.filterFuzzy,regex:exports.filterRegex,stringTypes:exports.filterStringTypes,numberTypes:exports.filterNumberTypes,types:exports.filterTypes};var defaultReplacer,format,getValue,isCorrectlyFormattedArray,isNullOrNumber,isStringWithLength,lookupPlural,paramRegex,setValue,setWholeObject,toMultilineSelection,userFacingTextDefaults,deprecatedWarning,formatExp,formatFixed,formatRound,formatSI,formatZeroPad,precision,roundPrecision,siSuffixes,strictCheck,filter=Object.freeze({__proto__:null,get filterExact(){return exports.filterExact},get filterStartsWith(){return exports.filterStartsWith},get filterContains(){return exports.filterContains},get filterExcludes(){return exports.filterExcludes},get filterGreater(){return exports.filterGreater},get filterLess(){return exports.filterLess},get filterFuzzy(){return exports.filterFuzzy},get filterRegex(){return exports.filterRegex},get filterStringTypes(){return exports.filterStringTypes},get filterNumberTypes(){return exports.filterNumberTypes},get filterTypes(){return exports.filterTypes},get filter(){return exports.filter}}),state$1={initialValues:{},localisedText:{}};function objectWithoutProperties(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&(i[n]=e[n]);return i}setWholeObject=function(e){var t,i;if(exports.isPlainObject(e))for(i in e)for(t in e[i])setValue(i,t,e[i][t]);else logger.warn("userFacingText: Expected a plain object but was instead passed: "+e)},isStringWithLength=function(e){return exports.isString(e)&&e.length},defaultReplacer=function(e,t,i){return e.replace(new RegExp("\\$"+t,"g"),i[t])},format=function(e,t,i){var n;return void 0===i&&(i=defaultReplacer),n=function(e,n){return i(e,n,t)},Object.keys(t).sort().reverse().reduce(n,e)},toMultilineSelection=function(e,t,i){var n;return void 0===t&&(t="span"),n=e.split("\n").reduce((function(e,n,r){return e.concat([!i&&r>0?detached("br").node():null],[detached(t).text(n).node()])}),[]),new Selection(n)},lookupPlural=function(e,t){var i,n;return n=e.filter((function(e){var i=e[0],n=e[1];return t>=i&&(t<=n||null===n)})),(i=n[0])[0],i[1],i[2]},paramRegex=/\$\D/g,getValue=function(e,t,i,n){var r,o,a,s;if(s=null!=(o=state$1.localisedText[e])?o[t]:void 0){if(a=exports.isArray(s)?(r=!n||isNaN(n.n)?1:n.n,lookupPlural(s,r)):s,!0!==i&&a.match(paramRegex)){if(n)return format(a,n);logger.warn("userFacingText: Parameterised string was returned without parsing parameters: "+a+".\nCall userFacingText(module, key, parameters) to replace the parameters or userFacingText(module, key, true) if you are handling this externally.")}return a}logger.warn("userFacingText: No text was found for key: "+t+" in module: "+e)},isNullOrNumber=function(e){return null===e||!isNaN(e)},isCorrectlyFormattedArray=function(e){return exports.isArray(e)&&e.every((function(e){return exports.isArray(e)&&3===e.length}))&&e.every((function(e){var t=e[0],i=e[1],n=e[2];return isNullOrNumber(t)&&isNullOrNumber(i)&&isStringWithLength(n)}))||!1},setValue=function(e,t,i){var n,r,o;isCorrectlyFormattedArray(i)||isStringWithLength(i)?(null==(n=state$1.localisedText)[e]&&(n[e]={}),state$1.localisedText[e][t]=i,null==(r=state$1.initialValues)[e]&&(r[e]={}),null==(o=state$1.initialValues[e])[t]&&(o[t]=i)):logger.warn("userFacingText: The value provided must be a string but was passed value: "+i)},exports.userFacingText=function(){var e,t;return arguments.length?1===arguments.length?setWholeObject(arguments[0]):(e=arguments[1],isStringWithLength(t=arguments[0])&&isStringWithLength(e)?2===arguments.length?getValue(t,e,!1):!0===arguments[2]?getValue(t,e,arguments[2]):exports.isPlainObject(arguments[2])?getValue(t,e,!1,arguments[2]):setValue(t,e,arguments[2]):void logger.warn("userFacingText: A module and key are expected as strings but was passed module: "+t+" and key: "+e)):exports.clone(state$1.localisedText)},userFacingTextDefaults=function(){return exports.clone(state$1.initialValues)},exports.userFacingText.format=format,exports.userFacingText.defaults=userFacingTextDefaults,exports.userFacingText.toMultilineSelection=toMultilineSelection,siSuffixes=["y","z","a","f","p","n","µ","","","K","M","G","T","P","E","Z","Y"],formatZeroPad=function(e,t){var i,n;return null==t.length&&(t.length=2),(i=e.toString()).length<t.length?(n=t.length-i.length,function(){var e,t,i;for(i=[],e=0,t=n-1;0<=t?e<=t:e>=t;0<=t?++e:--e)i.push("0");return i}().join("")+i):i},precision=function(e){return e?Math.floor(Math.log(Math.abs(e))/Math.LN10):0},roundPrecision=function(e,t,i){return i>=0?Math.round(e/Math.pow(t,i))*Math.pow(t,i):Math.round(e*Math.pow(t,-i))/Math.pow(t,-i)},formatRound=function(e,t){var i;return null==t.sf&&(t.sf=2),i=precision(e)-t.sf+1,roundPrecision(e,10,i).toString()},formatSI=function(e,t){var i,n,r,o;return i=Math.min(precision(e),26),r=siSuffixes[Math.min(Math.max(0,Math.floor(8+i/3)),16)],o=Math.abs(e)<1&&i%3&&!(-3<i&&i<0)?1e3:1,-3===i&&(o=1e3,r=siSuffixes[6]),n=Math.pow(10,i-i%3)/o,formatRound(e/n,t)+r},formatExp=function(e,t){var i,n;return i=(n=precision(e))>=0?"+":"",formatRound(e/Math.pow(10,n),t)+"e"+i+n},formatFixed=function(e,t){return null==t.digits&&(t.digits=2),e.toFixed(t.digits)},strictCheck=function(e,t,i){return void 0===i&&(i={}),i.strict?isNaN(e)?"NaN":t(e,i):exports.isString(e)?e:t(e,i)},exports.round=function(e,t){return strictCheck(e,formatRound,t)},exports.si=function(e,t){return strictCheck(e,formatSI,t)},exports.exp=function(e,t){return strictCheck(e,formatExp,t)},exports.fixed=function(e,t){return strictCheck(e,formatFixed,t)},exports.zeroPad=function(e,t){return strictCheck(e,formatZeroPad,t)},deprecatedWarning=function(e){return logger.deprecated("hx.format."+e+": The formatter factory pattern is deprecated and will be removed in the next major release, please use hx."+e+"(number, options)")},exports.format={round:function(e,t){return deprecatedWarning("round"),function(i){return exports.round(i,{strict:t,sf:e})}},si:function(e,t){return deprecatedWarning("si"),function(i){return exports.si(i,{strict:t,sf:e})}},exp:function(e,t){return deprecatedWarning("exp"),function(i){return exports.exp(i,{strict:t,sf:e}).replace("+","")}},fixed:function(e,t){return deprecatedWarning("fixed"),function(i){return exports.fixed(i,{digits:e,strict:t})}},zeroPad:function(e,t){return deprecatedWarning("zeroPad"),function(i){return exports.zeroPad(i,{length:e,strict:t})}}};var ModalBase,getHeaderRender,getTitleRender,makeButtons,Notification,inbuiltNotificationManager,nextId,notifyInfoPlain,notifyLoadingPlain,notifyNegativePlain,notifyPlain,notifyPositivePlain,notifyWarningPlain,redraw,removeNotification,setupNotification,startTimeout,togglePin,updatePinnedStatus,wrapDeprecated$1,errors={missingTitle:"Modal: options.title - A title is required when creating a Modal",missingBody:"Modal: options.renderBody/renderFooter - A body or footer renderer is required when creating a Modal",noCloseButton:"Modal: options.onClose was passed in but no close button is visible for this type of modal"},config={attachToSelector:"body",backdropAnimationDuration:200},Modal=function(e){function t(t,i){var n=this;void 0===i&&(i={}),e.call(this),this.options=exports.mergeDefined({title:"",isOpen:!0,animate:!0,onClose:void 0,renderBody:void 0,renderFooter:void 0},i);var r=this.options,o=r.isOpen,a=r.onClose,s=r.title,l=r.renderBody,c=r.renderFooter,u=t.showClose;void 0===u&&(u=!1);var d=t.type;void 0===d&&(d="center");var h=t.extraClass,p=t.modalAnimateFn;if(a&&!u)throw new Error(errors.noCloseButton);if(!s)throw new Error(errors.missingTitle);if(!l&&!c)throw new Error(errors.missingBody);var f=select(config.attachToSelector),g=div("hx-modal hx-flag-modal hx-flag-button").classed("hx-modal-"+d,!0).classed("hx-modal-"+h,h),x=div("hx-modal-backdrop"),m=div("hx-modal-container"),v=div("hx-modal-content"),y=div("hx-modal-header"),b=div("hx-modal-body-container"),w=div("hx-modal-body"),S=div("hx-modal-footer"),k=detached("h1").class("hx-modal-title"),T=u?div("hx-modal-close").add(detached("i").class("hx-icon hx-icon-close")).on("click","hx-modal",(function(){return n.close()})):void 0;this._={parent:f,modal:g,content:v,backdrop:x,body:w,footer:S,title:k,eventId:"hx-modal-"+exports.randomId(),showClose:u,modalAnimateFn:p},g.add(x).add(m.add(v.add(y.add(k).add(T)).add(b.add(w).add(S)))),o&&this.isOpen(!0)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(){var e=this._,t=e.body,i=e.footer,n=e.title,r=this.options,o=r.title,a=r.renderBody,s=r.renderFooter;n.text(o),t.set(a?a(this):[]),i.set(s?s(this):[])},t.prototype.isOpen=function(e,t){var i=this;if(e===this._.isOpen)return this;if(!arguments.length)return this._.isOpen;this._.isOpen=e;var n=t||function(){},r=this._,o=r.modal,a=r.content,s=r.backdrop,l=r.parent,c=r.eventId,u=r.modalAnimateFn,d=r.showClose,h=this.options.animate;if(l.classed("hx-modal-open",e),e){try{document.activeElement.blur()}catch(e){}d&&l.on("keydown",c,(function(e){(e.key&&("Esc"===e.key||"Escape"===e.key)||27===e.which)&&i.close()})),this.emit("showstart"),this.emit("show"),this.render(),l.add(o),s.style("opacity",0).morph().with("fadein",config.backdropAnimationDuration).go();var p=function(){i.emit("showend"),n()};h?u(a,p,!0):p()}else{l.off("keydown",c),this.emit("hidestart"),this.emit("hide"),s.style("opacity",1).morph().with("fadeout",config.backdropAnimationDuration).go();var f=function(){i.emit("hideend"),o.remove(),n()};h?u(a,f,!1):f()}return this},t.prototype.show=function(e){return this.isOpen(!0,e)},t.prototype.hide=function(e){return this.isOpen(!1,e)},t.prototype.close=function(e){var t=this.options.onClose;return t?t(this,e):this.hide(e)},t}(EventEmitter);function getModalAnimationFn(e,t,i){return function(n,r,o){o?n.style("opacity",0).style(e,"-"+i+"px").morph().and("fadein",t).andStyle(e,"0px",t).then((function(){n.style("opacity",void 0).style(e,void 0),r()})).go():n.style("opacity",1).style(e,"0px").morph().andStyle(e,"-"+i+"px",t).and("fadeout",t).then((function(){n.style("opacity",void 0).style(e,void 0),r()})).go()}}function modalCenter(e){return new Modal({type:"center",modalAnimateFn:getModalAnimationFn("top",150,100)},e)}function modalFullScreen(e){return new Modal({showClose:!0,type:"full-screen",modalAnimateFn:getModalAnimationFn("top",300,300)},e)}function modalRight(e){void 0===e&&(e={});var t=e.wide,i=objectWithoutProperties(e,["wide"]);return new Modal({showClose:!0,type:"right",extraClass:t?"right-wide":void 0,modalAnimateFn:getModalAnimationFn("right",300,300)},i)}ModalBase=function(){var e,t=function(t){function i(e,i,n){t.call(this),this.title=e,this.setup=i,this.options=exports.merge({closeWithShadeEnabled:!0,closeButtonEnabled:!0,titlebarRenderer:function(e){return select(e).text(this.title)},headerRenderer:function(e,t,i){return select(e).add(t).add(i)}},n),this.contentContainer=null}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.show=function(t){var i,n,r,o,a,s,l,c,u=this;return null!=(a=document.activeElement)&&a.blur(),(i=select("body").classed("hx-modal-open",!0)).select(".hx-modal-shade").empty()&&i.append("div").attr("class","hx-modal-shade").style("opacity",0).morph().with("fadein",150).go(),i.select(".hx-modal-container").remove(),o=i.append("div").attr("class","hx-modal-container"),c=(r=o.append("div").attr("class","hx-modal")).append("div").class("hx-modal-title-container hx-header"),l=detached("div").class("hx-modal-title"),this.options.closeButtonEnabled?n=detached("div").add(detached("i").class("hx-icon hx-icon-close")).class("hx-modal-close hx-fixed").on("click","hx.modal",(function(){return e(u,{cause:"button"})})):null!=this.title&&0!==this.title.length||c.classed("hx-modal-title-empty",!0),this.options.closeWithShadeEnabled&&o.on("click","hx.modal",(function(t){if(!r.contains(t.target)&&select("body").contains(t.target))return e(u,{cause:"shade"})})),this.options.titlebarRenderer.call(this,l.node(),this),this.options.headerRenderer.call(this,c.node(),l.node(),null!=n?n.node():void 0,this),this.contentContainer=r.append("div").attr("class","hx-modal-content"),this.setup&&this.setup(this.contentContainer.node(),this),this.emit("show",this.contentContainer.node()),this.emit("showstart"),s=this,r.style("opacity",0).style("top","-30px").morph().with("fadein",150).and((function(){return r.animate().style("top","0px",100)})).then((function(){return s.emit("showend"),"function"==typeof t?t():void 0})).go(),this},i.prototype.hide=function(){return e(this,{cause:"api"}),this},i}(EventEmitter);return e=function(e,t){var i;return(i=select("body").classed("hx-modal-open",!1)).select(".hx-modal-container").remove(),i.select(".hx-modal-shade").remove(),e.emit("hidestart"),e.emit("hide",t),e.emit("hideend")},t}.call(void 0),makeButtons=function(e,t,i,n){t.forEach((function(t){return e.append("button").attr("type","button").class(t.classes).add(detached("i").class(t.icon)).add(detached("span").text(" "+t.text)).on("click","hx.modal",(function(){return"function"==typeof n&&n(t.value),i.hide()}))}))},getTitleRender=function(e){return function(t,i){return t=select(t),null!=e&&t.append("i").class(e),t.append("span").text(this.title)}},getHeaderRender=function(e){return function(t,i,n,r){return select(t).classed("hx-background-"+e,!0).add(i).add(n)}},exports.modalDialog=function(e,t,i,n){var r,o;return n=exports.mergeDefined({callback:void 0,buttons:[{text:"Cancel",icon:"hx-icon hx-icon-close",value:!1,classes:"hx-btn hx-negative"},{text:"Confirm",icon:"hx-icon hx-icon-check",value:!0,classes:"hx-btn hx-positive"}],titleClass:void 0,icon:void 0},n),o=function(e){var r,o;return o=select(e),t=o.append("div").class("hx-modal-message").text(t),r=o.append("div").class("hx-modal-buttons"),makeButtons(r,n.buttons,this,i)},r=new exports.Modal(e,o,{closeWithShadeEnabled:n.closeWithShadeEnabled,closeButtonEnabled:n.closeButtonEnabled}),null!=n.titleClass&&(r.options.headerRenderer=getHeaderRender(n.titleClass),r.options.titlebarRenderer=getTitleRender(n.icon)),r.on("hide","hx.modal",(function(e){if("api"!==e.cause)return i()})),r.show()},exports.modalInput=function(e,t,i,n){var r,o;return n=exports.mergeDefined({value:""},n),o=function(e){var n,r,o,a;return r=[{text:"Cancel",icon:"hx-icon hx-icon-close",value:!1,classes:"hx-btn hx-negative"},{text:"Confirm",icon:"hx-icon hx-icon-check",value:!0,classes:"hx-btn hx-positive"}],o=select(e),t=o.append("span").class("hx-modal-message").text(t),a=o.append("input").class("hx-modal-input").text(this.options.value),n=o.append("div").class("hx-modal-buttons"),makeButtons(n,r,this,(function(e){return i(e?a.value():e)}))},(r=new exports.Modal(e,o,{closeWithShadeEnabled:n.closeWithShadeEnabled,closeButtonEnabled:n.closeButtonEnabled})).on("close","hx.modal",(function(e){if("api"!==e.cause)return i()})),r.show()},exports.Modal=function(e){function t(t,i,n){logger.deprecated("Modal","The Modal (and associated fluid methods modalDialog, modalInput etc.) has been replaced by the modalCenter, modalRight and modalFullScreen functions."),e.call(this,t,i,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ModalBase),exports.modal={input:exports.modalInput,dialog:exports.modalDialog},setupNotification=function(e,t){var n,r,o,a,s,l,c,u,d;return o=null!=e.options.icon&&e.options.icon.length>0?div("hx-notification-icon-container").add(detached("i").class("hx-notification-icon "+e.options.icon)):void 0,r=div("hx-notification-content"),a=e.message,s=(l=!(u=exports.isString(a)||exports.isNumber(a))&&(a instanceof Selection||a instanceof HTMLElement))||exports.isArray(a)&&a.every((function(e){return e instanceof Selection||e instanceof HTMLElement})),c=!u&&!l&&!s&&exports.isObject(a),u?r.text(a):l||s?r.add(a):c&&e.options.renderer?e.options.renderer(r.node(),a):(c?logger.warn("Notification created using an object with invalid arguments\n","An object was passed to the notification without a renderer being defined\n","message:",a,"\nrenderer:",e.options.renderer):logger.warn("Notification created using an object with invalid arguments\n","The notification expected a String, Selection, HTMLElement or an Object with matching renderer but was passed:\n","message:",a),r.text("ERROR CONSTRUCTING NOTIFICATION")),e.options.pinnable&&(d=div("hx-notification-icon-container hx-notification-pin").on("click","hx.notify",(function(){return togglePin(e)})).add(i("hx-icon hx-icon-thumb-tack")),e.domPin=d,updatePinnedStatus(e)),n=div("hx-notification-icon-container hx-notification-close").on("click","hx.notify",(function(){return e.close()})).add(detached("i").class("hx-icon hx-icon-close")),t.add(o).add(r).add(d).add(n)},nextId=function(e){return e.currentId++},redraw=function(e){var t,i,n;return(t=(i=select(e.selector)).select("#"+e.uniqueId)).empty()&&(t=i.append("div").class("hx-notification-container").attr("id",e.uniqueId)),(n=t.view(".hx-notification")).enter((function(e){var t;return i=this.append("div"),t=e.options.cssclass?" "+e.options.cssclass:"",i.class("hx-notification"+t).forEach((function(t){return setupNotification(e,i),e.trueHeight=i.style("height")})).style("opacity",0).style("height",0).style("padding-top",0).style("padding-bottom",0).style("margin-top",0).style("margin-bottom",0).morph().with("expandv").and("fadein").then((function(){return i.style("height","")})).go(),i.node()})),n.exit((function(){var e=this;return this.style("overflow","hidden").morph().with("fadeout",100).then("collapsev",100).then((function(){return e.remove()})).go()})),n.apply(e.notifications,(function(e){return e.id}))},removeNotification=function(e,t){var i;return(i=e.notifications.indexOf(t))>=0&&e.notifications.splice(i,1),redraw(e)},startTimeout=function(e,t){return e.timeoutId=window.setTimeout((function(){return e.close()}),1e3*t)},togglePin=function(e){return e.pinned?e.unpin():e.pin()},updatePinnedStatus=function(e){return e.domPin.classed("hx-notification-pin-pinned",e.pinned)},Notification=function(){function e(e,t,i){this.manager=e,this.message=t,this.options=exports.merge({icon:void 0,cssclass:void 0,timeout:this.manager._.defaultTimeout,pinnable:!0,renderer:void 0},i),this.id=nextId(this.manager),this.options.timeout?(startTimeout(this,this.options.timeout),this.pinned=!1):this.pinned=!0}return e.prototype.close=function(){return removeNotification(this.manager,this),this},e.prototype.pin=function(){return this.pinned=!0,window.clearTimeout(this.timeoutId),updatePinnedStatus(this),this},e.prototype.unpin=function(){return this.pinned=!1,startTimeout(this,1),updatePinnedStatus(this),this},e}();var NotificationManager=function(){function e(e){void 0===e&&(e="body"),this.selector=e,this.currentId=0,this.notifications=[],this.uniqueId="hx-notify-"+exports.randomId(),this._={defaultTimeout:5}}return e.prototype.notify=function(e,t){var i;return i=new Notification(this,e,t),this.notifications.push(i),redraw(this),i},e.prototype.info=function(e,t){return void 0===t&&(t={}),this.notify(e,exports.merge({icon:"hx-icon hx-icon-info",cssclass:"hx-info"},t))},e.prototype.warning=function(e,t){return void 0===t&&(t={}),this.notify(e,exports.merge({icon:"hx-icon hx-icon-warning",cssclass:"hx-warning"},t))},e.prototype.negative=function(e,t){return void 0===t&&(t={}),this.notify(e,exports.merge({icon:"hx-icon hx-icon-error",cssclass:"hx-negative"},t))},e.prototype.positive=function(e,t){return void 0===t&&(t={}),this.notify(e,exports.merge({icon:"hx-icon hx-icon-check",cssclass:"hx-positive"},t))},e.prototype.loading=function(e){return this.notify(e,{icon:"hx-spinner",cssclass:"hx-loading",timeout:void 0,pinnable:!1})},e.prototype.defaultTimeout=function(e){return arguments.length>0?(this._.defaultTimeout=e||5,this):this._.defaultTimeout},e}();inbuiltNotificationManager=new NotificationManager,wrapDeprecated$1=function(e,t){return function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return logger.deprecated(e,"Replaced by hx.alert/hx.message."),t.apply(void 0,i)}},notifyInfoPlain=function(e,t){return inbuiltNotificationManager.info(e,t)},notifyPositivePlain=function(e,t){return inbuiltNotificationManager.positive(e,t)},notifyWarningPlain=function(e,t){return inbuiltNotificationManager.warning(e,t)},notifyNegativePlain=function(e,t){return inbuiltNotificationManager.negative(e,t)},notifyLoadingPlain=function(e){return inbuiltNotificationManager.loading(e)},notifyPlain=function(e,t){return inbuiltNotificationManager.notify(e,t)},exports.notifyDefaultTimeout=function(e){return logger.deprecated("notifyDefaultTimeout","NotificationManager is replaced by AlertManager which does not require this method"),inbuiltNotificationManager.defaultTimeout.apply(inbuiltNotificationManager,arguments)},exports.notify=wrapDeprecated$1("notify",notifyPlain),exports.notifyInfo=wrapDeprecated$1("notifyInfo",notifyInfoPlain),exports.notifyPositive=wrapDeprecated$1("notifyPositive",notifyPositivePlain),exports.notifyWarning=wrapDeprecated$1("notifyWarning",notifyWarningPlain),exports.notifyNegative=wrapDeprecated$1("notifyNegative",notifyNegativePlain),exports.notifyLoading=wrapDeprecated$1("notifyLoading",notifyLoadingPlain),exports.notify.info=wrapDeprecated$1("hx.notify.info",notifyInfoPlain),exports.notify.positive=wrapDeprecated$1("hx.notify.positive",notifyPositivePlain),exports.notify.warning=wrapDeprecated$1("hx.notify.warning",notifyWarningPlain),exports.notify.negative=wrapDeprecated$1("hx.notify.negative",notifyNegativePlain),exports.notify.loading=wrapDeprecated$1("hx.notify.loading",notifyLoadingPlain),exports.notify.defaultTimeout=exports.notifyDefaultTimeout;var checkFixedPos,dropdownContentToSetupDropdown,positionDropdown,Collapsible=function(e){function t(t,i){var n,r,o=this;e.call(this),this.options=exports.mergeDefined({lazyContent:void 0,visible:!1,addIcon:!0,animate:!0},i),this.lazyContentCreated=!1,this.selection=select(t).classed("hx-openable",!0).classed("hx-collapsible",!0).api(this),(r=(n=this.selection.select(".hx-collapsible-heading")).select(".hx-collapsible-toggle")).empty()?n.on("click","hx.collapsible",(function(){return o.toggle()})):(n.classed("hx-collapsible-heading-no-hover",!0),r.on("click","hx.collapsible",(function(){return o.toggle()}))),this.selection.select(".hx-collapsible-content").style("height",0).style("opacity",0),this.options.addIcon&&(r.empty()?(n.select("i").remove(),n.prepend("i").class("hx-icon hx-icon-chevron-right hx-collapsible-icon")):(r.select("i").remove(),r.prepend("i").class("hx-icon hx-icon-chevron-right hx-collapsible-icon"))),this.visible=void 0,this.options.visible?this.show(!1):this.hide(!1)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toggle=function(e,t){return e=null!=e?e:this.options.animate,this.isOpen()?this.hide(e,t):this.show(e,t)},t.prototype.show=function(e,t){var i,n;return e=null!=e?e:this.options.animate,this.lazyContentCreated||(this.lazyContentCreated=!0,this.options.lazyContent&&this.options.lazyContent(this.selection.select(".hx-collapsible-content").node())),!0!==this.visible&&(this.selection.classed("hx-collapsible-expanded",!0).classed("hx-opened",!0),i=this.selection.select(".hx-collapsible-content"),e?(n=this,i.morph().with("expandv",100).and("fadein",100).then((function(){return n.emit("showend"),"function"==typeof t?t():void 0})).go(!0),this.selection.select(".hx-collapsible-heading").select(".hx-collapsible-icon").morph().with("rotate-90",200).go(!0)):(i.style("display","").style("height","").style("opacity",""),this.emit("showend")),this.visible=!0,this.emit("showstart"),this.emit("change",!0)),this},t.prototype.hide=function(e,t){var i;return e=null!=e?e:this.options.animate,!1!==this.visible&&(this.selection.classed("hx-collapsible-expanded",!1).classed("hx-opened",!1),e?(i=this,this.selection.select(".hx-collapsible-content").morph().with("fadeout",100).and("collapsev",100).then((function(){return i.emit("hideend"),"function"==typeof t?t():void 0})).go(!0),this.selection.select(".hx-collapsible-heading").select(".hx-collapsible-icon").morph().with("rotate-0",200).go(!0)):(this.selection.select(".hx-collapsible-content").style("display","none"),this.emit("hideend")),this.visible=!1,this.emit("hidestart"),this.emit("change",!1)),this},t.prototype.isOpen=function(){return this.visible},t}(EventEmitter),initializeCollapsibles=function(e,t){return selectAll(e).nodes.map((function(e){return new Collapsible(e,t)}))},calculateDropdownPosition=function(e,t,i,n,r,o){var a,s,l,c;return s=(a=function(){switch(e){case"up":return"ltlb";case"down":return"lblt";case"left":return"ltrt";case"right":return"rtlt";default:return e}}().split(""))[1]===a[3]&&a[0]!==a[2]?"l"===a[0]?"left":"right":"t"===a[3]?"down":"up",l=t.x,c=t.y,"r"===a[0]&&(l+=t.width),"b"===a[1]&&(c+=t.height),"r"===a[2]&&(l-=i.width),"b"===a[3]&&(c-=i.height),"down"===s||"up"===s?l=exports.clamp(0,n.width-i.width,l):c=exports.clamp(0,n.height-i.height,c),"down"===s&&c>n.height-i.height&&t.y-i.height>0?(s="up",c=t.y-i.height,a[1]===a[3]&&(c+=t.height)):"up"===s&&c<0&&t.y+t.height+i.height<n.height?(s="down",c=t.y+t.height,a[1]===a[3]&&(c-=t.height)):"right"===s&&l>n.width-i.width&&t.x-i.width>0?(s="left",l=t.x-i.width):"left"===s&&l<0&&t.x+t.width+i.width<n.width&&(s="right",l=t.x+t.width),{x:l,y:c,direction:s}},config$1={attachToSelector:"body",dropdownAnimateSlideDistance:8};checkFixedPos=function(e){if("fixed"===select(e).style("position"))return!0},positionDropdown=function(e,t){var i,n,r,o,a,s,l,c,u,d=e.selection,h=e.dropdown,p=e.useScroll,f=t.align,g=t.matchWidth;return h.style("display","block"),s=d.box(),o=h.box(),n=h.style("max-height").replace("px",""),a=checkParents(d.node(),checkFixedPos),u=parentZIndex(d.node(),!0),l=(i=calculateDropdownPosition(h.attr("data-direction")||f,{x:s.left,y:s.top,width:s.width,height:s.height},{width:o.width,height:o.height},{width:window.innerWidth,height:window.innerHeight},n,scrollbarSize())).x,c=i.y,r=i.direction,a||(l+=window.scrollX||window.pageXOffset,c+=window.scrollY||window.pageYOffset),u>0&&h.style("z-index",u+1),a&&h.style("position","fixed"),g&&h.style("min-width",s.width+"px"),p&&null!=h&&h.style("overflow-y","auto"),h.classed("hx-dropdown-up","up"===r).classed("hx-dropdown-down","down"===r).classed("hx-dropdown-left","left"===r).classed("hx-dropdown-right","right"===r).attr("data-direction",r).style("top","auto").style("bottom",void 0).style("top",c+"px").style("left",l+"px")},dropdownContentToSetupDropdown=function(e){switch(!1){case!isSelection(e):return function(t){return select(t).set(e)};case!exports.isString(e):return function(t){return select(t).html(e)};case!exports.isFunction(e):return function(t){return e(t)};default:return logger.warn("dropdown: dropdownContent is not a valid type. dropdownContent: ",e),function(){}}};var MenuBase,MenuItem,addItem,checkEvent,dealWithEvent,emitItem,getAllItems,moveSelectionDown,moveSelectionUp,populateNode,setActive,setupInner,toggleCollapsible,buildAutocomplete,findTerm,showAutocomplete,sortActive,Dropdown=function(e){function t(t,i,n){var r,o,a,s,l,c,u=this;e.call(this),this.options=exports.mergeDefined({mode:"click",align:"lblt",matchWidth:!0,ddClass:""},n),c=dropdownContentToSetupDropdown(i),(r=new exports.ClickDetector).on("click","hx.dropdown",(function(){return u.hide()})),o=function(){return u.toggle()},s=function(){return u.show()},a=function(){return u.hide()},l=select(t).api("dropdown",this).api(this),this._={setupDropdown:c,clickDetector:r,onclick:o,onmouseover:s,onmouseout:a,visible:!1,dropdown:void 0,selection:l,useScroll:!1},"click"!==this.options.mode&&"hover"!==this.options.mode||l.on("click","hx.dropdown",o),"hover"===this.options.mode&&(l.on("mouseover","hx.dropdown",s),l.on("mouseout","hx.dropdown",a))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.dropdownContent=function(e){var t;return arguments.length?(t=dropdownContentToSetupDropdown(e),this._=exports.shallowMerge(this._,{setupDropdown:t,dropdownContent:e}),this.render(),this):this._.dropdownContent},t.prototype.addException=function(e){return this._.clickDetector.addException(e),this},t.prototype.removeException=function(e){return this._.clickDetector.removeException(e),this},t.prototype.toggle=function(e){return this.isOpen()?this.hide(e):this.show(e),this},t.prototype.render=function(){return this._.dropdown&&this._.setupDropdown(this._.dropdown.node()),this.emit("render"),this},t.prototype.show=function(e){var t,i,n,r=this;return(t=this._).visible?(this.render(),"function"==typeof e&&e()):(t.visible=!0,t.dropdown=select(config$1.attachToSelector).append("div").attr("class","hx-dropdown"),this.options.ddClass.length>0&&t.dropdown.classed(this.options.ddClass,!0),this.render(),t.clickDetector.removeAllExceptions(),t.clickDetector.addException(t.dropdown.node()),t.clickDetector.addException(t.selection.node()),(n=function(){return positionDropdown(t,r.options)})(),MutationObserver&&((i=new MutationObserver((function(e,t){return n()}))).observe(t.dropdown.node(),{attributes:!1,childList:!0,subtree:!0}),t.contentChangeObserver=i),this.emit("showstart"),this.emit("change",!0),this.emit("showend"),"function"==typeof e&&e()),this},t.prototype.hide=function(e){var t,i;return(t=this._).visible&&(t.visible=!1,null!=(i=t.contentChangeObserver)&&i.disconnect(),this.emit("hidestart"),this.emit("change",!1),this.emit("hideend"),"function"==typeof e&&e(),t.dropdown.remove(),t.dropdown=void 0),this},t.prototype.isOpen=function(){return this._.visible},t.prototype.cleanUp=function(){var e;return(e=this._).clickDetector.cleanUp(),"click"!==this.options.mode&&"hover"!==this.options.mode||e.selection.off(e.onclick),"hover"===this.options.mode&&(e.selection.off("mouseover","hx.dropdown",e.onmouseover),e.selection.off("mouseout","hx.dropdown",e.onmouseout)),this},t}(EventEmitter);function objectWithoutProperties$1(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&(i[n]=e[n]);return i}addItem=function(e,t,i){var n;return n=new MenuItem(e,t,i),t._.menuItems.push(n),n},setupInner=function(e,t,i){var n,r,o,a,s;for(i._.menuItems=[],s=[],o=0,a=t.length;o<a;o++)n=t[o],r=addItem(n,i,e),n.children?s.push(setupInner(e,n.children,r)):s.push(void 0);return s},populateNode=function(e,t){return select(e).view(".hx-menu-item").update((function(e,t){return e.build(t)})).apply(t)},getAllItems=function(e){var t,i;return t=[],i=function(e,n){return e.forEach((function(e,r){if(e.parentIndex=n,t.push(e),e._.menuItems)return i(e._.menuItems,r)}))},i(e._.menuItems),t},setActive=function(e,t,i,n){var r,o,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S;if(null!=(x=e.dropdown._.dropdown)&&x.selectAll(".hx-menu-item").classed("hx-menu-active",!1),t>=0){for(f=(r=getAllItems(e))[t].node,select(f).classed("hx-menu-active",!0),a=null!=(m=r[t])?m.content:void 0,d=(null!=(v=e.options.featureFlags)?v.useUpdatedStructure:void 0)&&(null!=a?a.children:void 0),u=!(null!=a?a.disabled:void 0)&&!(null!=a?a.unselectable:void 0)&&!d;!(null!==f.offsetParent&&u||n);){if(i?t-=1:t+=1,u=!(null!=(a=null!=(y=r[t])?y.content:void 0)?a.disabled:void 0)&&!(null!=a?a.unselectable:void 0),null==r[t]){c=!0;break}f=r[t].node}if(c&&!i)return void setActive(e,t-1,!0);e.cursorPos=t,null==(s=null!=(b=e.dropdown._.dropdown)?b.node():void 0)||n||(l=(S=(h=(p=select(f).classed("hx-menu-active",!0)).node()).offsetTop+((o=p.select(".hx-menu-collapsible")).size()>0?o.node().clientHeight:h.clientHeight)+((g=select(h.parentNode)).classed("hx-collapsible-content")?g.node().offsetTop:0))>s.clientHeight?S-s.clientHeight:0,s.scrollTop=l)}if(null!=(w=null!=r?r[e.cursorPos]:void 0)&&(emitItem(e,w,"highlight",n?"click":"arrow"),n))return emitItem(e,w,"change","click")},moveSelectionUp=function(e){var t;return(t=e.cursorPos)>0?t-=1:0===t&&(t=-1),e.cursorPos=t,setActive(e,t,!0)},moveSelectionDown=function(e){var t;return(t=e.cursorPos)<getAllItems(e).length-1&&(t+=1),e.cursorPos=t,setActive(e,t,!1)},toggleCollapsible=function(e,t,i){switch(t){case!0:return e.show(!0,i);case!1:return e.hide(!0,i);default:return e.toggle(!0,i)}},dealWithEvent=function(e,t,i){var n,r,o,a;return void 0===i&&(i="enter"),r="tab"===i?Math.max(e.cursorPos,0):e.cursorPos,n=getAllItems(e),a=n[r],null==t||t||null==(null!=a&&null!=(o=a.parent)?o.collapsible:void 0)?null!=(null!=a?a.collapsible:void 0)?toggleCollapsible(a.collapsible,t):null!=t&&t||null==t?emitItem(e,a,"change",i):void 0:toggleCollapsible(a.parent.collapsible,t,(function(){if(!a._.menuItems)return moveSelectionUp(e)}))},emitItem=function(e,t,i,n){if(e.has(i))return e.emit(i,{eventType:n,content:null!=t?t.content:void 0,menu:e})},checkEvent=function(e,t){switch(e.which){case 9:dealWithEvent(t,void 0,"tab");break;case 13:e.preventDefault(),dealWithEvent(t,void 0);break;case 37:dealWithEvent(t,!1);break;case 38:e.preventDefault(),moveSelectionUp(t);break;case 39:dealWithEvent(t,!0);break;case 40:e.preventDefault(),moveSelectionDown(t)}return t.emit("input",e)},MenuItem=function(){function e(e,t,i){this.content=e,this.parent=t,this.menu=i,this._={}}return e.prototype.build=function(e){var t,i,n,r,o,a,s;return this.node=e,n=select(e),(null!=(a=this._.menuItems)?a.length:void 0)>0?(null!=(s=this.menu.options.featureFlags)?s.useUpdatedStructure:void 0)?(o=div("hx-menu-item hx-menu-unselectable"),t=div("hx-menu-item-children"),n.class("hx-menu-item").set([o,t]),this.menu.options.renderer(o,this.content),void populateNode(t,this._.menuItems)):(n.view(".hx-collapsible").apply(this),(i=n.select(".hx-collapsible")).view(".hx-collapsible-heading").apply(this),i.view(".hx-collapsible-content").update((function(){return this.style("display","none")})).apply(this),o=i.select(".hx-collapsible-heading").classed("hx-menu-collapsible",!0).node(),this.menu.options.renderer(o,this.content),r=n.select(".hx-collapsible-content").node(),this.collapsible=new Collapsible(i),populateNode(r,this._.menuItems)):(n.classed("hx-menu-link",!this.content.unselectable&&!this.content.disabled).classed("hx-menu-active",!1).classed("hx-menu-item-disabled",this.content.disabled).classed("hx-menu-unselectable",this.content.unselectable),this.menu.options.renderer(n.node(),this.content))},e}(),MenuBase=function(e){function t(t,i){var n,r,o,a,s,l,c,u,d,h,p,f,g,x=this;void 0===i&&(i={}),e.call(this),this.selector=t,a=(n=i).extraContent,d=objectWithoutProperties$1(n,["extraContent"]),this.options=exports.mergeDefined({dropdownOptions:{align:void 0,mode:"click",ddClass:"",disabled:!1,featureFlags:{useUpdatedStructure:!1}},renderer:function(e,t){return select(e).text(t.text||t)},items:[]},d),this.options.extraContent=a,p=this,this._={items:this.options.items,itemsChanged:!0},select(this.selector).api("menu",this).api(this),null!=this.options.dropdownOptions.ddClass&&0===this.options.dropdownOptions.ddClass.length&&(r=palette$1.context(this.selector)),this.options.dropdownOptions.ddClass=(null!=(c=this.options.featureFlags)?c.useUpdatedStructure:void 0)?"hx-menu hx-flag-menu":"hx-menu "+(null!=r?"hx-"+r:this.options.dropdownOptions.ddClass),o=div("hx-menu-items"),l=p._.items,f=function(e){return p._.itemsChanged&&(p._.itemsChanged=!1,setupInner(p,e,p)),populateNode(o.node(),p._.menuItems)},p._.setup=f,exports.isFunction(l)?(p._.itemsChanged=!0,l((function(e){return f(e)}))):f(l),this.dropdown=new Dropdown(this.selector,o,this.options.dropdownOptions),this.dropdown.on("hideend","hx.menu",(function(){return p.cursorPos=-1,o.selectAll(".hx-menu-item").classed("hx-menu-active",!1)})),(null!=(u=this.options.featureFlags)?u.useUpdatedStructure:void 0)?this.dropdown.on("showstart","hx.menu",(function(){return o.insertBefore(i.extraContent)})):o.add(i.extraContent),this.dropdown.on("showend","hx.menu",(function(){var e,t;if(null!=x.dropdown._.dropdown&&(t=x.dropdown._.dropdown.node(),e=select(t),t.scrollTop<t.scrollHeight-t.clientHeight&&(e.style("width",e.width()+scrollbarSize()+"px"),"r"===x.dropdown._.alignments[2])))return e.style("left",Math.max(0,e.box().left-scrollbarSize())+"px")})),(h=select(this.selector)).off("click","hx.dropdown"),h.on("click","hx.menu",(function(){var e;if(!x.options.disabled){if(x.dropdown.isOpen())return x.dropdown.hide();if(!x.loading)return null!=x.data&&exports.isFunction(x.data)&&(x.loading=!0,(e=h.prepend("span")).append("i").class("hx-menu-loading hx-icon hx-icon-spin hx-icon-spinner"),x.data((function(t){return p.loading=!1,e.remove(),f(t)}))),x.dropdown.show()}})),"input"===h.node().nodeName.toLowerCase()&&(s=!0,g=h),this.dropdown.on("showstart","hx.menu",(function(){var e;return p.cursorPos=-1,s||((g=p.dropdown._.dropdown).attr("tabindex","-1"),g.node().focus()),g.on("keydown","hx.menu",(function(e){return p.dropdown.isOpen()&&checkEvent(e,p),p.emit("keydown",e)})),null!=(e=p.dropdown._.dropdown)?e.on("click","hx.menu",(function(e){var t,i,n,r;if(r=select(e.target).classed("hx-menu-link")?e.target:select(e.target).closest(".hx-menu-item").node()){if(n=-1,select(r).classed("hx-menu-link")){for(t=getAllItems(p),i=0;n<0&&i<t.length;){if(t[i].node===r){n=i;break}i+=1}setActive(p,n,void 0,!0)}return g.node().focus()}})):void 0})),this.dropdown.pipe(this,"dropdown"),this.options.disabled&&this.disabled(this.options.disabled)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(){return this._.setup(this.items())},t.prototype.renderer=function(e){return arguments.length>0?(this.options.renderer=e,this.render(),this):this.options.renderer},t.prototype.addException=function(e){return this.dropdown.clickDetector.addException(e),this},t.prototype.hide=function(){return this.dropdown.hide(),this},t.prototype.items=function(e){return arguments.length>0?(null==e&&(e=[]),this._.itemsChanged=!0,this._.items=e,this.render(),this):this._.items},t.prototype.disabled=function(e){return null!=e?(this.options.disabled=e,select(this.selector).attr("disabled",!!e||void 0).classed("hx-disabled",e),this.dropdown.isOpen()&&!0===e&&this.hide(),this):!!this.options.disabled},t}(EventEmitter),exports.Menu=function(e){function t(t,i){logger.deprecated("hx.Menu","Replaced by DropdownButton / MoreButton"),e.call(this,t,i)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(MenuBase),exports.userFacingText({autocomplete:{loading:"Loading...",noResultsFound:"No results found",otherResults:"Other Results",pleaseEnterMinCharacters:"Please enter $minLength or more characters",minCharacters:"Min length $minLength characters"}}),sortActive=function(e){var t;return t=new Map(exports.groupBy(e,(function(e){return!e.disabled}))),{active:t.get(!0)||[],inactive:t.get(!1)||[]}},findTerm=function(e,t){var i,n,r,o,a,s,l,c,u,d,h,p;return p=this,null==(n=this._).prevTerm&&(n.prevTerm=""),o=n.data.get(e),e.length>=n.prevTerm.length&&null==o&&(o=n.data.get(n.prevTerm)),null==o&&(o=n.data.get("")),n.prevTerm=e,l="external"===this.options.matchType?o:0!==e.length||this.options.showAll?this.options.filter(o,e):[],s=o.length===l.length&&o.length>0,!this.options.showOtherResults||t||s||(d=l.length>0?l:[{unselectable:!0,text:p.options.noResultsMessage}],c={unselectable:!0,heading:!0,text:p.options.otherResultsMessage},h=0===l.length?o:(a=o.filter((function(e){return!l.some((function(t){return t===e}))})),(null==this.options.filterOptions.sort||this.options.filterOptions.sort)&&(null!=this.options.inputMap?a.sort((function(e,t){return exports.sort.compare(p.options.inputMap(e),p.options.inputMap(t))})):a.sort(exports.sort.compare)),a),r=(i=sortActive(h)).active,u=i.inactive,l=d.concat([c],r,u)),l},buildAutocomplete=function(e,t,i){var n,r,o,a,s,l;s=this,null==(n=this._).callback||t?(n.menu.cursorPos=-1,r=i?void 0:"external"===this.options.matchType?n.data.get(e):findTerm.call(s,e),a={unselectable:!0,text:""},n.menu.items([]),o=[],l=!1,null==r?a.text=this.options.loadingMessage:e.length<this.options.minLength?a.text=exports.userFacingText.format(this.options.pleaseEnterMinCharactersMessage,{minLength:this.options.minLength}):(e.length>0||this.options.showAll)&&0===r.length?this.options.trimTrailingSpaces&&n.input.value().lastIndexOf(" ")===n.input.value().length-1?l=!0:this.options.noResultsMessage.length>0&&null!=this.options.noResultsMessage&&(a.text=this.options.noResultsMessage):e.length>=this.options.minLength&&r.length>0&&(o=o.concat(r)),a.text.length&&(o=[a].concat(o)),o.length>0?(n.menu.items(o),n.menu.dropdown.isOpen()?n.menu.dropdown._.setupDropdown(n.menu.dropdown._.dropdown.node()):n.menu.dropdown.show()):n.menu.hide(),l&&(n.input.value(n.input.value().substring(0,n.input.value().length-1)),buildAutocomplete.call(s,n.input.value(),t,i))):e.length<this.options.minLength||!this.options.showAll&&0===e.length?(n.data.set(e,[]),buildAutocomplete.call(s,e,!0)):(buildAutocomplete.call(s,e,!0,!0),n.currentSearch=e,n.data.get(e)?buildAutocomplete.call(s,e,!0):(n.data.set(e,!0),n.callback.call(s,e,(function(t){if(!n.cleanUp&&(n.data.set(e,t),n.currentSearch===e))return buildAutocomplete.call(s,e,!0)}))))},showAutocomplete=function(){return this._.cleanUp=!1,buildAutocomplete.call(this,this._.input.value()||"")},exports.Autocomplete=function(e){function t(t,i,n){var r,o,a,s,l,c,u,d,h;void 0===n&&(n={}),e.call(this),this.selector=t,this.data=i,exports.isArray(this.data)||exports.isFunction(this.data)?(this.options=exports.merge({minLength:0,showAll:!0,trimTrailingSpaces:!1,mustMatch:!1,inputMap:void 0,renderer:void 0,matchType:"contains",placeholder:void 0,filter:void 0,filterOptions:void 0,showOtherResults:!1,allowTabCompletion:!0,value:void 0,loadingMessage:exports.userFacingText("autocomplete","loading"),noResultsMessage:exports.userFacingText("autocomplete","noResultsFound"),otherResultsMessage:exports.userFacingText("autocomplete","otherResults"),pleaseEnterMinCharactersMessage:exports.userFacingText("autocomplete","pleaseEnterMinCharacters",!0),minCharactersMessage:exports.userFacingText("autocomplete","minCharacters",!0)},n),this._=r={},r.ignoreMatch=!1,r.ignoreNextFocus=!1,d=this,r.data=new Map,exports.isFunction(this.data)?r.callback=this.data:r.data.set("",this.data),null!=this.options.inputMap&&(o={searchValues:function(e){return[d.options.inputMap(e)]}}),this.options.filterOptions=exports.merge({},o,n.filterOptions),null==(a=this.options).filter&&(a.filter=function(e,t){var i,n,r,o,a;return r="filter"+d.options.matchType[0].toUpperCase()+d.options.matchType.slice(1),o=filter[r](e,t,d.options.filterOptions),n=(i=sortActive(o)).active,a=i.inactive,n.concat(a)}),null==(s=this.options).renderer&&(s.renderer=null!=this.options.inputMap?function(e,t){return select(e).text(d.options.inputMap(t))}:function(e,t){return select(e).text(t)}),null==(l=this.options).placeholder&&(l.placeholder=this.options.minLength>0?exports.userFacingText.format(this.options.minCharactersMessage,{minLength:this.options.minLength}):void 0),c=select(this.selector).api("autocomplete",this).api(this),(u=new MenuBase(this.selector,{dropdownOptions:{ddClass:"hx-autocomplete-dropdown"}})).pipe(this,"",["highlight"]),u.dropdown.pipe(this,"dropdown"),select(this.selector).off("click","hx.menu"),u.on("input","hx.autocomplete",(function(e){if(d.options.allowTabCompletion&&9===(e.which||e.keyCode))return e.preventDefault()})),r.setInputValue=null!=this.options.inputMap?function(e){return void 0===e&&(e=""),c.value(d.options.inputMap(e)),d.emit("change",e)}:function(e){return void 0===e&&(e=""),c.value(e),d.emit("change",e)},null!=this.options.placeholder&&c.attr("placeholder",this.options.placeholder),c.on("focus","hx.autocomplete",(function(e){if(!r.ignoreNextFocus)return r.cleanUp=!1,d.show()})),c.on("blur","hx.autocomplete",(function(e){return null!=e.relatedTarget&&d.hide(),r.ignoreNextFocus=!1})),h=void 0,c.on("input","hx.autocomplete",(function(){return r.cleanUp=!1,clearTimeout(h),r.initialValue=c.value(),h=setTimeout((function(){if(c.value()!==r.prevTerm)return buildAutocomplete.call(d,c.value()||"")}),200)})),u.renderer((function(e,t){var i;return(i=select(e)).style("font-weight",""),t.unselectable||t.heading?(i.text(t.text).off(),t.heading?i.style("font-weight","600"):void 0):d.options.renderer(e,t)})),u.on("change","hx.autocomplete",(function(e){var t;if(null!=(t=null!=e?e.content:void 0)){if(!(null!=t?t.unselectable:void 0)&&!(null!=t?t.heading:void 0)&&!(null!=t?t.disabled:void 0))if("tab"===e.eventType){if(d.options.allowTabCompletion)return r.setInputValue(t),r.ignoreMatch=!0,d.hide()}else{if(-1===u.cursorPos&&null!=r.initialValue)return c.value(r.initialValue);if(r.setInputValue(t),"click"===e.eventType||"enter"===e.eventType)return r.ignoreMatch=!0,d.hide(),r.ignoreNextFocus=!0}}else if("enter"===e.eventType)return r.ignoreMatch=!1,d.hide(),r.ignoreNextFocus=!0})),r.checkValidity=function(){var e;return r.cleanUp=!0,r.ignoreMatch||d.options.mustMatch&&c.value().length>0&&(!0!==(e="external"===d.options.matchType?r.data.get(c.value()):!0===r.data.get(c.value())?setTimeout(r.checkValidity,5):findTerm.call(d,c.value(),!0))&&(null!=e?e.length:void 0)>0&&(null!=(e=null!=e?e.filter((function(e){return(e=null!=d.options.inputMap?d.options.inputMap(e):e).toLowerCase()===c.value().toLowerCase()})):void 0)?e.length:void 0)>0?r.setInputValue(e[0]):c.value("")),r.ignoreMatch=!1,d.clearCache(),d.emit("hide",c.value())},u.on("dropdown.change","hx.autocomplete",(function(e){if(e)return r.initialValue=c.value(),u.dropdown._.useScroll=!0;r.checkValidity()})),u.on("click","hx.autocomplete",(function(){return r.ignoreMatch=!0})),r.menu=u,r.input=c,this.options.value&&this.value(this.options.value)):logger.warn("Autocomplete - ",this.selector,": data set incorrectly - you supplied: ",this.data," but should have been an array of items or a function")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.clearCache=function(){return this._.data=new Map,null==this.data||exports.isFunction(this.data)||this._.data.set("",this.data),this},t.prototype.show=function(){return this._.ignoreNextFocus=!1,showAutocomplete.call(this),this},t.prototype.value=function(e){return arguments.length>0?(this._.setInputValue(e),this._.checkValidity(),this):this._.input.value()},t.prototype.hide=function(){var e;return(e=this._).ignoreNextFocus=!1,e.menu.dropdown.isOpen()&&(e.menu.hide(),e.prevTerm=void 0,e.cleanUp=!0),this},t}(EventEmitter),exports.autocomplete=function(e,t){var i;return i=detached("input"),new exports.Autocomplete(i,e,t),i};var supportedTypes=["success","danger","warning"];function badge(e){void 0===e&&(e={});var t=e.type,i=e.inverse,n=!t||supportedTypes.includes(t);return n||logger.warn("badge: Badge was called with an invalid type: '"+t+"'. Supported types: "+supportedTypes.join(", ")),span("hx-badge").classed("hx-badge-inverse",i).classed("hx-"+t,t&&n)}var defaultLocaleObjects=[{value:"af",full:"Afrikaans"},{value:"sq",full:"Albanian"},{value:"ar",full:"Arabic"},{value:"ar-MA",full:"Arabic (Morocco)"},{value:"ar-SA",full:"Arabic (Saudi Arabia)"},{value:"ar-TN",full:"Arabic (Tunisia)"},{value:"hy-AM",full:"Armenian"},{value:"az",full:"Azerbaijani"},{value:"id",full:"Bahasa Indonesia"},{value:"ms-MY",full:"Bahasa Malayu"},{value:"eu",full:"Basque"},{value:"be",full:"Belarusian"},{value:"bn",full:"Bengali"},{value:"bs",full:"Bosnian"},{value:"br",full:"Breton"},{value:"bg",full:"Bulgarian"},{value:"my",full:"Burmese"},{value:"ca",full:"Catalan"},{value:"zh-CN",full:"Chinese"},{value:"zh-TW",full:"Chinese (Traditional)"},{value:"cv",full:"Chuvash"},{value:"hr",full:"Croatian"},{value:"cs",full:"Czech"},{value:"da",full:"Danish"},{value:"nl",full:"Dutch"},{value:"en",full:"English"},{value:"en-US",full:"English (US)"},{value:"en-AU",full:"English (Australia)"},{value:"en-CA",full:"English (Canada)"},{value:"en-GB",full:"English (UK) "},{value:"eo",full:"Esperanto"},{value:"et",full:"Estonian"},{value:"fo",full:"Farose"},{value:"fi",full:"Finnish"},{value:"fr",full:"French"},{value:"fr-CA",full:"French (Canada)"},{value:"fy",full:"Frisian"},{value:"gl",full:"Galician"},{value:"ka",full:"Georgian"},{value:"de",full:"German"},{value:"de-AT",full:"German (Austria)"},{value:"el",full:"Greek"},{value:"he",full:"Hebrew"},{value:"hi",full:"Hindi"},{value:"hu",full:"Hungarian"},{value:"is",full:"Icelandic"},{value:"it",full:"Italian"},{value:"ja",full:"Japanese"},{value:"km",full:"Khmer (Cambodia)"},{value:"ko",full:"Korean"},{value:"lv",full:"Latvian"},{value:"lt",full:"Lithuanian"},{value:"lb",full:"Luxembourgish"},{value:"mk",full:"Macedonian"},{value:"ml",full:"Malayalam"},{value:"mr",full:"Marathi"},{value:"ne",full:"Nepalese"},{value:"nb",full:"Norwegian"},{value:"nn",full:"Norwegian Nynorsk"},{value:"fa",full:"Persian"},{value:"pl",full:"Polish"},{value:"pt",full:"Portuguese"},{value:"pt-BR",full:"Portuguese (Brazil)"},{value:"ro",full:"Romanian"},{value:"ru",full:"Russian"},{value:"sr",full:"Serbian"},{value:"sr-CYRL",full:"Serbian Cyrillic"},{value:"sk",full:"Slovak"},{value:"sl",full:"Slovenian"},{value:"es",full:"Spanish"},{value:"sv",full:"Swedish"},{value:"tl-PH",full:"Tagalog (Filipino)"},{value:"tzm",full:"Tamaziɣt"},{value:"tzm-LATN",full:"Tamaziɣt Latin"},{value:"ta",full:"Tamil"},{value:"th",full:"Thai"},{value:"bo",full:"Tibetan"},{value:"tr",full:"Turkish"},{value:"uk",full:"Ukrainian"},{value:"uz",full:"Uzbek"},{value:"vi",full:"Vietnamese"},{value:"cy",full:"Welsh"}],defaultTimezoneList=["UTC-12:00","UTC-11:00","UTC-10:00","UTC-09:30","UTC-09:00","UTC-08:00","UTC-07:00","UTC-06:00","UTC-05:00","UTC-04:30","UTC-04:00","UTC-03:30","UTC-03:00","UTC-02:00","UTC-01:00","UTC+00:00","UTC+01:00","UTC+02:00","UTC+03:00","UTC+03:30","UTC+04:00","UTC+04:30","UTC+05:00","UTC+05:30","UTC+05:45","UTC+06:00","UTC+06:30","UTC+07:00","UTC+08:00","UTC+08:30","UTC+08:45","UTC+09:00","UTC+09:30","UTC+10:00","UTC+10:30","UTC+11:00","UTC+12:00","UTC+12:45","UTC+13:00","UTC+14:00"],defaultLocaleList=defaultLocaleObjects.map((function(e){return e.value})),RFC5646_LANGUAGE_TAGS={af:"Afrikaans","af-ZA":"Afrikaans (South Africa)",ar:"Arabic","ar-AE":"Arabic (U.A.E.)","ar-BH":"Arabic (Bahrain)","ar-DZ":"Arabic (Algeria)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-YE":"Arabic (Yemen)",az:"Azeri (Latin)","az-AZ":"Azeri (Latin) (Azerbaijan)","az-Cyrl-AZ":"Azeri (Cyrillic) (Azerbaijan)",be:"Belarusian","be-BY":"Belarusian (Belarus)",bg:"Bulgarian","bg-BG":"Bulgarian (Bulgaria)","bs-BA":"Bosnian (Bosnia and Herzegovina)",ca:"Catalan","ca-ES":"Catalan (Spain)",cs:"Czech","cs-CZ":"Czech (Czech Republic)",cy:"Welsh","cy-GB":"Welsh (United Kingdom)",da:"Danish","da-DK":"Danish (Denmark)",de:"German","de-AT":"German (Austria)","de-CH":"German (Switzerland)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)",dv:"Divehi","dv-MV":"Divehi (Maldives)",el:"Greek","el-GR":"Greek (Greece)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-CB":"English (Caribbean)","en-GB":"English (United Kingdom)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Republic of the Philippines)","en-TT":"English (Trinidad and Tobago)","en-US":"English (United States)","en-ZA":"English (South Africa)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-ES":"Spanish (Spain)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-PY":"Spanish (Paraguay)","es-SV":"Spanish (El Salvador)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",et:"Estonian","et-EE":"Estonian (Estonia)",eu:"Basque","eu-ES":"Basque (Spain)",fa:"Farsi","fa-IR":"Farsi (Iran)",fi:"Finnish","fi-FI":"Finnish (Finland)",fo:"Faroese","fo-FO":"Faroese (Faroe Islands)",fr:"French","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-CH":"French (Switzerland)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Principality of Monaco)",gl:"Galician","gl-ES":"Galician (Spain)",gu:"Gujarati","gu-IN":"Gujarati (India)",he:"Hebrew","he-IL":"Hebrew (Israel)",hi:"Hindi","hi-IN":"Hindi (India)",hr:"Croatian","hr-BA":"Croatian (Bosnia and Herzegovina)","hr-HR":"Croatian (Croatia)",hu:"Hungarian","hu-HU":"Hungarian (Hungary)",hy:"Armenian","hy-AM":"Armenian (Armenia)",id:"Indonesian","id-ID":"Indonesian (Indonesia)",is:"Icelandic","is-IS":"Icelandic (Iceland)",it:"Italian","it-CH":"Italian (Switzerland)","it-IT":"Italian (Italy)",ja:"Japanese","ja-JP":"Japanese (Japan)",ka:"Georgian","ka-GE":"Georgian (Georgia)",kk:"Kazakh","kk-KZ":"Kazakh (Kazakhstan)",kn:"Kannada","kn-IN":"Kannada (India)",ko:"Korean","ko-KR":"Korean (Korea)",kok:"Konkani","kok-IN":"Konkani (India)",ky:"Kyrgyz","ky-KG":"Kyrgyz (Kyrgyzstan)",lt:"Lithuanian","lt-LT":"Lithuanian (Lithuania)",lv:"Latvian","lv-LV":"Latvian (Latvia)",mi:"Maori","mi-NZ":"Maori (New Zealand)",mk:"FYRO Macedonian","mk-MK":"FYRO Macedonian (Former Yugoslav Republic of Macedonia)",mn:"Mongolian","mn-MN":"Mongolian (Mongolia)",mr:"Marathi","mr-IN":"Marathi (India)",ms:"Malay","ms-BN":"Malay (Brunei Darussalam)","ms-MY":"Malay (Malaysia)",mt:"Maltese","mt-MT":"Maltese (Malta)",nb:"Norwegian (Bokm?l)","nb-NO":"Norwegian (Bokm?l) (Norway)",nl:"Dutch","nl-BE":"Dutch (Belgium)","nl-NL":"Dutch (Netherlands)","nn-NO":"Norwegian (Nynorsk) (Norway)",ns:"Northern Sotho","ns-ZA":"Northern Sotho (South Africa)",pa:"Punjabi","pa-IN":"Punjabi (India)",pl:"Polish","pl-PL":"Polish (Poland)",ps:"Pashto","ps-AR":"Pashto (Afghanistan)",pt:"Portuguese","pt-BR":"Portuguese (Brazil)","pt-PT":"Portuguese (Portugal)",qu:"Quechua","qu-BO":"Quechua (Bolivia)","qu-EC":"Quechua (Ecuador)","qu-PE":"Quechua (Peru)",ro:"Romanian","ro-RO":"Romanian (Romania)",ru:"Russian","ru-RU":"Russian (Russia)",sa:"Sanskrit","sa-IN":"Sanskrit (India)",se:"Sami","se-FI":"Sami (Finland)","se-NO":"Sami (Norway)","se-SE":"Sami (Sweden)",sk:"Slovak","sk-SK":"Slovak (Slovakia)",sl:"Slovenian","sl-SI":"Slovenian (Slovenia)",sq:"Albanian","sq-AL":"Albanian (Albania)","sr-BA":"Serbian (Latin) (Bosnia and Herzegovina)","sr-Cyrl-BA":"Serbian (Cyrillic) (Bosnia and Herzegovina)","sr-SP":"Serbian (Latin) (Serbia and Montenegro)","sr-Cyrl-SP":"Serbian (Cyrillic) (Serbia and Montenegro)",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SE":"Swedish (Sweden)",sw:"Swahili","sw-KE":"Swahili (Kenya)",syr:"Syriac","syr-SY":"Syriac (Syria)",ta:"Tamil","ta-IN":"Tamil (India)",te:"Telugu","te-IN":"Telugu (India)",th:"Thai","th-TH":"Thai (Thailand)",tl:"Tagalog","tl-PH":"Tagalog (Philippines)",tn:"Tswana","tn-ZA":"Tswana (South Africa)",tr:"Turkish","tr-TR":"Turkish (Turkey)",tt:"Tatar","tt-RU":"Tatar (Russia)",ts:"Tsonga",uk:"Ukrainian","uk-UA":"Ukrainian (Ukraine)",ur:"Urdu","ur-PK":"Urdu (Islamic Republic of Pakistan)",uz:"Uzbek (Latin)","uz-UZ":"Uzbek (Latin) (Uzbekistan)","uz-Cyrl-UZ":"Uzbek (Cyrillic) (Uzbekistan)",vi:"Vietnamese","vi-VN":"Vietnamese (Viet Nam)",xh:"Xhosa","xh-ZA":"Xhosa (South Africa)",zh:"Chinese","zh-CN":"Chinese (S)","zh-HK":"Chinese (Hong Kong)","zh-MO":"Chinese (Macau)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (T)",zu:"Zulu","zu-ZA":"Zulu (South Africa)"},RFC5456LocaleList=Object.keys(RFC5646_LANGUAGE_TAGS),RFC5456LocaleObjects=RFC5456LocaleList.map((function(e){return{value:e,full:RFC5646_LANGUAGE_TAGS[e]}})),IANATimezoneList=["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Pacific-New","US/Samoa","UTC","Universal","W-SU","WET","Zulu"],moment$1=window.moment;exports.userFacingText({preferences:{locale:"Locale",preferences:"Preferences",preferencesSaved:"Preferences Saved",save:"Save",timezone:"Timezone"}});var localStorageKey="hx_preferences",LocalStoragePreferencesStore={save:function(e,t){return localStorage.setItem(localStorageKey,e),t()},load:function(e){return e(void 0,localStorage.getItem(localStorageKey))}};function defaultTimezoneLookup(e){var t=e>0?"-":"+",i=Math.abs(e),n=i%60,r=(i-n)/60;return"UTC"+t+exports.zeroPad(r)+":"+exports.zeroPad(n)}function getLocaleObject(e,t){return t.find((function(t){return t.full.toLowerCase()===e.toLowerCase()||t.value.toLowerCase()===e.toLowerCase()}))}function validateLocales(e,t){return e.filter((function(e){return!getLocaleObject(e,t)}))}function validateTimezones(e,t){return e.filter((function(e){return!t.find((function(t){return t.toLowerCase()===e.toLowerCase()}))}))}function defaultTZOffsetLookup(e){var t=e.replace("UTC","").replace("+","").replace("-0","-").split(":").map(Number);return t[0]+(t[0]>=0?t[1]/60:-t[1]/60)}function IntlTZOffsetLookup(e,t){var i=new Intl.DateTimeFormat("en-GB",{timeZone:"UTC",hour12:!1,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}),n=new Intl.DateTimeFormat("en-GB",{timeZone:e,hour12:!1,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}),r=new Date(t||Date.now()),o=n.formatToParts(r),a=o[0].value,s=o[2].value,l=o[4].value,c=o[6].value,u=o[8].value,d=i.formatToParts(r),h=d[0].value,p=d[2].value,f=d[4].value,g=d[6].value,x=d[8].value,m=Date.UTC(f,p,h,g,x);return(Date.UTC(l,s,a,c,u)-m)/36e5}var Preferences=function(e){function t(){e.call(this),this.setup()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.setup=function(e){var t,i=this;void 0===e&&(e={}),e.featureFlags&&e.featureFlags.useIntlFormat&&("undefined"==typeof Intl||null===Intl)&&(logger.warn("preferences",'Intl is not supported in this browser, use a polyfill to enable this feature. Setting "options.featureFlags.useIntlFormat" to false'),t={featureFlags:{useIntlFormat:!1}});var n={backingStore:LocalStoragePreferencesStore,supportedLocales:[],supportedTimezones:[],timezone:void 0,locale:void 0,featureFlags:{useIntlFormat:!1}};this.options=exports.merge(n,e,t);var r=this.options.featureFlags.useIntlFormat,o=r?IANATimezoneList:defaultTimezoneList,a=r?RFC5456LocaleObjects:defaultLocaleObjects,s=r?RFC5456LocaleList:defaultLocaleList,l=validateLocales(this.options.supportedLocales,a),c=validateTimezones(this.options.supportedTimezones,o);l.length&&(logger.warn("preferences.setup: supportedLocales","The provided locale(s) are not supported: "+l.join(", ")),this.options.supportedLocales=s),this.options.supportedLocales.length||(this.options.supportedLocales=s),c.length&&(logger.warn("preferences.setup: supportedTimezones","The provided timezone(s) are not supported: "+c.join(", ")),this.options.supportedTimezones=o),this.options.supportedTimezones.length||(this.options.supportedTimezones=o);var u=new ModalBase(exports.userFacingText("preferences","preferences"),(function(e,t){var n=detached("input").class("hx-preferences-locale"),r=i.options.supportedLocales.map((function(e){return getLocaleObject(e,a)})),o=new exports.Autocomplete(n.node(),r,{renderer:function(e,t){return select(e).add(div("hx-compact-group").add(div("hx-section").add(span().text(t.full))).add(div("hx-section hx-fixed").add(badge({inverse:!0}).classed("hx-margin-left",!0).text(t.value))))},inputMap:function(e){return e.full},showOtherResults:!0,mustMatch:!0,value:getLocaleObject(i.locale(),a)}),s=div().add(detached("label").text(exports.userFacingText("preferences","locale"))).add(n),l=detached("input").class("hx-preferences-timezone"),c=new exports.Autocomplete(l.node(),i.options.supportedTimezones,{showOtherResults:!0,mustMatch:!0,value:i.timezone()}),u=div().add(detached("label").text(exports.userFacingText("preferences","timezone"))).add(l),d=detached("button").class("hx-preferences-save hx-btn hx-positive").add(detached("i").class("hx-icon hx-icon-check")).add(detached("span").text(" "+exports.userFacingText("preferences","save"))).on("click",(function(){return i.locale(o.value()),i.timezone(c.value()),i.save((function(e){return e?exports.notifyNegative(e):(exports.notifyPositive(exports.userFacingText("preferences","preferencesSaved")),t.hide())}))}));return select(e).append("div").class("hx-form").add(s).add(u).add(d)}));if(this._={timezoneOffsetLookup:r?IntlTZOffsetLookup:defaultTZOffsetLookup,preferences:{},modal:u,localeListToUse:s,allLocaleObjects:a,timezoneListToUse:o,useIntl:r},r){var d=(new Intl.DateTimeFormat).resolvedOptions(),h=d.locale,p=d.timeZone;return this.locale(this.options.locale||h),void this.timezone(this.options.timezone||p)}var f=navigator.languages&&navigator.languages[0]||navigator.language;exports.isString(f)&&getLocaleObject(f,a)||(f="en"),this.locale(f);var g=moment$1&&moment$1.tz&&moment$1.tz.guess();if(null!=g)return this.supportedTimezones(moment$1.tz.names()),this.timezoneOffsetLookup((function(e,t){return-moment$1.tz.zone(e).offset(t)/60})),void this.timezone(g);this.timezone(defaultTimezoneLookup((new Date).getTimezoneOffset()))},t.prototype.timezone=function(e){return arguments.length>0?(this.isTimezoneSupported(e)?this.options.timezone!==e&&(this.options.timezone=e,this.emit("timezonechange",e)):logger.warn("preferences.timezone:",e+" is not a valid timezone"),this):this.options.timezone},t.prototype.locale=function(e){if(arguments.length>0){if(this.isLocaleSupported(e)){var t=getLocaleObject(e,this._.allLocaleObjects);this.options.locale!==t.value&&(this.options.locale=t.value,null!=moment$1&&moment$1.locale(t.value),this.emit("localechange",t.value))}else logger.warn("preferences.locale",e+" is not a valid locale. If you think the locale should be added to the list contact the maintainers of hexagon");return this}return this.options.locale},t.prototype.isTimezoneSupported=function(e){return exports.isString(e)&&this.options.supportedTimezones.find((function(t){return t.toLowerCase()===e.toLowerCase()}))},t.prototype.isLocaleSupported=function(e){return exports.isString(e)&&this.options.supportedLocales.find((function(t){return t.toLowerCase()===e.toLowerCase()}))},t.prototype.getTimezoneOffset=function(e,t){var i=Number(t);return t&&Number.isNaN(i)?this._.timezoneOffsetLookup(t,e.getTime()):Number.isNaN(i)?this._.timezoneOffsetLookup(this.timezone(),e.getTime()):i},t.prototype.applyTimezoneOffset=function(e,t,i){var n=60*this.getTimezoneOffset(e,t)*60*1e3*(i?-1:1),r=60*e.getTimezoneOffset()*1e3;return new Date(e.getTime()+n+r)},t.prototype.backingStore=function(e){return null!=e&&(this.options.backingStore=e),this},t.prototype.save=function(e){try{var t=this.options,i={locale:t.locale,timezone:t.timezone};return this.options.backingStore.save(JSON.stringify(i),(function(t){return"function"==typeof e?e(t):void 0}))}catch(t){return"function"==typeof e?e(t):void 0}},t.prototype.load=function(e){var t=this;try{return this.options.backingStore.load((function(i,n){if(null!=n){var r=JSON.parse(n),o=r.locale,a=r.timezone;t.timezone(a),t.locale(o)}return"function"==typeof e?e(i):void 0}))}catch(t){return"function"==typeof e?e(t):void 0}},t.prototype.show=function(){return this._.modal.show(),this},t.prototype.timezoneOffsetLookup=function(e){return arguments.length>0?(this._.timezoneOffsetLookup=e,this):this._.timezoneOffsetLookup},t}(EventEmitter);function option(e){return function(t){return arguments.length>0?(this.options[e]=t,this):this.options[e]}}Preferences.prototype.supportedLocales=option("supportedLocales"),Preferences.prototype.supportedTimezones=option("supportedTimezones");var preferences=new Preferences;function isNumeric(e){return!Number.isNaN(Number(e))}preferences.localStorageStore=LocalStoragePreferencesStore,exports.userFacingText({"date-localizer":{today:"Today"}});var PreferencesHandler=function(e){function t(){var t=this;e.call(this),this._={uniqueId:exports.randomId()},preferences.on("localechange","hx.date-time-localizer"+this._.uniqueId,(function(){t._.instanceLocale||t.emit("localechange",{cause:"api",value:preferences.locale()})})),preferences.on("timezonechange","hx.date-time-localizer"+this._.uniqueId,(function(){t._.instanceTimezone||t.emit("timezonechange",{cause:"api",value:preferences.timezone()})}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.locale=function(e){return arguments.length?(null==e||preferences.isLocaleSupported(e)?(this._.instanceLocale=!!e,this._.locale=e,this.emit("localechange",{cause:"api",value:e||preferences.locale()})):logger.warn(e+" is not a valid locale. If you think the locale should be added to the list contact the maintainers of hexagon"),this):this._.locale||preferences.locale()},t.prototype.timezone=function(e){return arguments.length?(null==e||preferences.isTimezoneSupported(e)?(this._.instanceTimezone=!!e,this._.timezone=e,this.emit("timezonechange",{cause:"api",value:e||preferences.timezone()})):logger.warn(e+" is not a valid timezone"),this):this._.timezone||preferences.timezone()},t}(EventEmitter),DateTimeLocalizer=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.dateOrder=function(){return["DD","MM","YYYY"]},t.prototype.weekStart=function(){return 1},t.prototype.weekDays=function(){return["Mo","Tu","We","Th","Fr","Sa","Su"]},t.prototype.todayText=function(){return exports.userFacingText("date-localizer","today")},t.prototype.day=function(e,t){return t?exports.zeroPad(e):e},t.prototype.month=function(e,t){return t?exports.zeroPad(e+1):["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e]},t.prototype.fullMonth=function(e){return["January","February","March","April","May","June","July","August","September","October","November","December"][e]},t.prototype.year=function(e){return e},t.prototype.date=function(e,t){return t?e.getFullYear()+"-"+exports.zeroPad(e.getMonth()+1)+"-"+exports.zeroPad(e.getDate()):exports.zeroPad(e.getDate())+"/"+exports.zeroPad(e.getMonth()+1)+"/"+e.getFullYear()},t.prototype.time=function(e,t){var i,n=preferences.applyTimezoneOffset(e,this.timezone());return i=n.getHours()+":"+exports.zeroPad(n.getMinutes()),t&&(i+=":"+exports.zeroPad(n.getSeconds())),i},t.prototype.checkTime=function(e){return isNumeric(e[0])&&isNumeric(e[1])&&isNumeric(e[2])},t.prototype.stringToDate=function(e,t){var i,n,r,o,a,s,l,c,u,d,h,p;if(t?(a=["YYYY","MM","DD"],p=e.split("-")):(a=this.dateOrder(),p=e.split("/")),3===p.length&&!p.some((function(e){return""===e||"0"===e}))){for(n=0,r=a.length;n<r;n+=1)switch(l=a[n],s=p[n],l){case"DD":u=s.length<3&&""!==s,i=Number(p[n]);break;case"MM":d=s.length<3&&""!==s,o=Number(p[n]);break;case"YYYY":h=s.length<5&&""!==s,2===(c=Number(p[n])).toString().length&&(c+=2e3)}return u&&d&&h?new Date(Date.UTC(c,o-1,i)):new Date("Invalid Date")}return new Date("Invalid Date")},t}(PreferencesHandler),IntlDateTimeLocalizer=function(e){function t(){var t=this;e.call(this),this.on("localechange",(function(){return t.setupFormatters()})),this.on("timezonechange",(function(){return t.setupFormatters()})),this.setupFormatters()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.setupFormatters=function(){var e=this,t=this.locale(),i=this.timezone(),n=new Intl.DateTimeFormat(t,{timeZone:"UTC",weekday:"narrow"}),r=new Intl.DateTimeFormat(t,{timeZone:"UTC",month:"short"}),o=new Intl.DateTimeFormat(t,{timeZone:"UTC",month:"long"}),a=new Intl.DateTimeFormat(t,{timeZone:"UTC",year:"numeric"}),s=new Intl.DateTimeFormat(t,{timeZone:i,day:"2-digit",month:"2-digit",year:"numeric"}),l=new Intl.DateTimeFormat("en-GB",{timeZone:i,day:"2-digit",month:"2-digit",year:"numeric"}),c=new Intl.DateTimeFormat(t,{timeZone:i,hour12:!1,hour:"2-digit",minute:"2-digit"}),u=new Intl.DateTimeFormat(t,{timeZone:i,hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),d="2019";var h=new Date(Date.UTC(Number(d),Number("05")-1,Number("08"),12)),p=function(e){for(var t=e.indexOf(d),i=e.indexOf("05"),n=e.indexOf("08"),r=[],o=0;o<e.length;o+=1)switch(o){case t:r.push("YYYY");break;case i:r.push("MM");break;case n:r.push("DD")}return 0===r.length&&(r=["DD","MM","YYYY"]),r}(s.format(h)),f=s.formatToParts(h)[1].value,g=exports.range(7).map((function(t,i){return n.format(new Date(Date.UTC(2019,4,19+e.weekStart()+i,12)))})),x=exports.range(12).map((function(e,t){return r.format(new Date(Date.UTC(2019,t,1)))})),m=exports.range(12).map((function(e,t){return o.format(new Date(Date.UTC(2019,t,1)))}));return this._.formatters={year:a,date:s,time:c,timeWithSeconds:u,gbDate:l},this._.constants={weekDays:g,months:x,fullMonths:m,dateOrder:p,dateSeparator:f},this},t.prototype.dateOrder=function(){return this._.constants.dateOrder},t.prototype.weekStart=function(){return 1},t.prototype.weekDays=function(){return this._.constants.weekDays},t.prototype.todayText=function(){return exports.userFacingText("date-localizer","today")},t.prototype.day=function(e,t){return t?exports.zeroPad(e):e},t.prototype.month=function(e,t){return t?exports.zeroPad(e+1):this._.constants.months[e]},t.prototype.fullMonth=function(e){return this._.constants.fullMonths[e]},t.prototype.year=function(e){return this._.formatters.year.format(new Date(Date.UTC(e,0,1,12)))},t.prototype.date=function(e,t){if(t){var i=this._.formatters.gbDate.formatToParts(e),n=i[0].value,r=i[2].value;return i[4].value+"-"+r+"-"+n}return this._.formatters.date.format(e)},t.prototype.time=function(e,t){return t?this._.formatters.timeWithSeconds.format(e):this._.formatters.time.format(e)},t.prototype.checkTime=function(e){return isNumeric(e[0])&&isNumeric(e[1])&&isNumeric(e[2])},t.prototype.stringToDate=function(e,t){var i,n,r,o,a,s,l,c;if(t?(l=["YYYY","MM","DD"],c=e.split("-")):(l=this.dateOrder(),c=e.split(this._.constants.dateSeparator)),3===c.length&&!c.some((function(e){return""===e||"0"===e}))){for(var u=0,d=l.length;u<d;u+=1){var h=l[u],p=c[u];switch(h){case"DD":i=p.length<3&&""!==p,s=Number(c[u]);break;case"MM":n=p.length<3&&""!==p,a=Number(c[u]);break;case"YYYY":r=p.length<5&&""!==p,2===(o=Number(c[u])).toString().length&&(o+=2e3)}}if(i&&n&&r){var f=new Date(Date.UTC(o,a-1,s)),g=preferences.getTimezoneOffset(f,this.timezone());return new Date(f.getTime()-1e3*g*60*60)}return new Date("Invalid Date")}return new Date("Invalid Date")},t}(PreferencesHandler),DateTimeLocalizerMoment=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.dateOrder=function(){for(var e=moment({year:2003,month:11,day:22}).locale(this.locale()),t=e.format("L"),i=t.indexOf(e.format("YYYY")),n=t.indexOf(e.format("MM")),r=t.indexOf(e.format("DD")),o=[],a=0;a<t.length;a+=1)switch(a){case i:o.push("YYYY");break;case n:o.push("MM");break;case r:o.push("DD")}return 0===o.length&&(o=["DD","MM","YYYY"]),o},t.prototype.weekStart=function(){return moment().locale(this.locale()).weekday(0).toDate().getDay()},t.prototype.weekDays=function(){var e=moment().weekday(0);e.locale(this.locale());for(var t=[e.format("dd")],i=0;i<6;i+=1)t.push(e.add(1,"d").format("dd"));return t},t.prototype.todayText=function(){var e,t=moment({hour:12,minute:0,second:0}).locale(this.locale()),i=t.clone().add(1,"day"),n=t.calendar().split("").reverse(),r=i.calendar().split("").reverse();for(e=0;e<n.length&&n[e]===r[e];e+=1);return n.splice(0,e),n.reverse().join("")},t.prototype.day=function(e,t){return moment({day:e,month:0}).locale(this.locale()).format(t?"DD":"D")},t.prototype.month=function(e,t){return moment({month:e}).locale(this.locale()).format(t?"MM":"MMM")},t.prototype.fullMonth=function(e){return moment({month:e}).locale(this.locale()).format("MMMM")},t.prototype.year=function(e){return moment({year:e}).locale(this.locale()).format("YYYY")},t.prototype.decade=function(e,t){return this.year(e)+" - "+this.year(t)},t.prototype.date=function(e){return moment(e).locale(this.locale()).format("L")},t.prototype.time=function(e,t){var i=preferences.applyTimezoneOffset(e,this.timezone()),n=t?"H:mm:ss":"H:mm";return moment(i).locale(this.locale()).format(n)},t.prototype.checkTime=function(e){return moment({hours:e[0],minutes:e[1],seconds:e[2]}).locale(this.locale()).isValid()},t.prototype.stringToDate=function(e){var t,i,n,r="",o=this.dateOrder(),a=e.split("/");if(3===a.length&&!a.some((function(e){return""===e||"0"===e}))){for(var s=0,l=o.length;s<l;s+=1){var c=o[s],u=a[s];switch(c){case"DD":t=u.length<3&&""!==u,r+="DD";break;case"MM":i=u.length<3&&""!==u,r+="MM";break;case"YYYY":n=u.length<5&&""!==u,r+="YYYY"}}return t&&i&&n?moment(e,r,this.locale()).toDate():new Date("Invalid Date")}return new Date("Invalid Date")},t}(PreferencesHandler);function dateTimeLocalizer(){return"undefined"!=typeof moment&&null!==moment?new DateTimeLocalizerMoment:new DateTimeLocalizer}function spinner(){return span("hx-spinner")}function spinnerWide(){return div("hx-spinner-wide")}exports.ColorScale=function(){var e,t=function(t,i,n){void 0===t&&(t=0),void 0===i&&(i=10),this.domainMin=t,this.domainMax=i,this.rangeArr=n,this.rangeArr=this.rangeArr.sort((function(e,t){return e.val-t.val})),this.rangeMin=this.rangeArr[0].val,this.rangeMax=this.rangeArr[this.rangeArr.length-1].val,this.factor=e(this.domainMin,this.domainMax,this.rangeMin,this.rangeMax)};return t.prototype.apply=function(e){var t,i,n,r,o,a,s,l,c;switch(r=this.rangeMin+(e-this.domainMin)*this.factor,!1){case!(r<this.rangeMin):t=this.rangeArr[0].color;break;case!(r>this.rangeMax):t=this.rangeArr[this.rangeArr.length-1].color;break;default:for(i=n=0,c=this.rangeArr.length-1;n<c;i=n+=1)if(r>=this.rangeArr[i].val&&r<=this.rangeArr[i+1].val){s=i+1;break}o=r-this.rangeArr[s-1].val,l=this.rangeArr[s].val-this.rangeArr[s-1].val,a=exports.clamp(0,1,o/l),t=color(this.rangeArr[s-1].color).mix(color(this.rangeArr[s].color),a)}return t.toString()},t.prototype.domain=function(t,i){return this.domainMin=t,this.domainMax=i,this.factor=e(this.domainMin,this.domainMax,this.rangeMin,this.rangeMax),this},t.prototype.range=function(t){return this.rangeArr=t,this.factor=e(this.domainMin,this.domainMax,this.rangeMin,this.rangeMax),this},e=function(e,t,i,n){var r;return 0!==(r=t-e)?(n-i)/r:1},t}.call(void 0),spinner.wide=spinnerWide;var supportedTypes$1=["primary","secondary"],supportedSizes=["small","micro"];function dropdownButton(e){var t=e.text,i=e.type,n=e.size,r={renderer:actionRenderWrapper},o=exports.merge({items:[]},e,r);if(!o.items.length)throw new Error("dropdownButton: Items are required when creating a dropdown button");var a=supportedTypes$1.includes(i),s=supportedSizes.includes(n);i&&!a&&logger.warn("dropdownButton: Called with an invalid type: '"+i+"'. Supported types: "+supportedTypes$1.join(", ")),n&&!s&&logger.warn("dropdownButton: Called with an invalid size: '"+n+"'. Supported sizes: "+supportedSizes.join(", "));var l=button("hx-btn hx-dropdown-button hx-flag-button").classed("hx-"+i,a).classed("hx-btn-"+n,s);return t&&l.text(t),new MenuBase(l,o),l}var filterNested,sortActive$1,sortItems,trimTrailingSpaces,addHoldHandler,checkValue,getDisabled,supportedSizes$1=["small","micro"];function moreButton(e){var t=e.text,i=e.size,n={renderer:actionRenderWrapper},r=exports.merge({items:[],dropdownOptions:{align:"rbrt"}},e,n);if(!r.items.length)throw new Error("moreButton: Items are required when creating a more button");var o=supportedSizes$1.includes(i);i&&!o&&logger.warn("moreButton: Called with an invalid size: '"+i+"'. Supported sizes: "+supportedSizes$1.join(", "));var a=button("hx-btn hx-more-button hx-flag-button").classed("hx-btn-"+i,o);return t&&a.text(t),new MenuBase(a,r),a}function tooltip(e){void 0===e&&(e={});var t=e.icon,n=e.label,r=e.text;if(!r)throw new Error("tooltip: No text provided for the tooltip");if(t&&n)throw new Error("tooltip: You can only use an icon or a label when creating a tooltip");var o=span(n?"hx-tooltip-label":"hx-tooltip-icon"),a=t?i(t):void 0;o.text(n),o.add(a);var s=div().text(r);return new Dropdown(o,s,{ddClass:t?"hx-tooltip hx-tooltip-from-icon":"hx-tooltip hx-tooltip-from-label",align:"up",mode:"hover",matchWidth:!1}),o}sortItems=function(e){return void 0===e&&(e=exports.identity),function(t,i){return exports.compare(e(t),e(i))}},trimTrailingSpaces=function(e){var t;for(t=e;t.lastIndexOf(" ")===t.length-1;)t=t.slice(0,t.length-1);return t},sortActive$1=function(e){var t;return t=new Map(exports.groupBy(e,(function(e){return!e.disabled}))),{active:t.get(!0)||[],inactive:t.get(!1)||[]}},filterNested=function(e,t,i,n){return e.some((function(e){var t;return null!=(t=e.children)?t.length:void 0}))?e.reduce((function(e,r){var o,a;return r.children&&(o=filterNested(r.children,t,i,n)).length?e.concat([Object.assign({},r,{children:o})]):(a=filter[i]([r],t,n),e.concat(a))}),[]):filter[i](e,t,n)},exports.AutocompleteFeed=function(){function e(e){var t,i,n;void 0===e&&(e={}),n=this,t={filter:void 0,filterOptions:void 0,matchType:"contains",useCache:!0,showOtherResults:!1,trimTrailingSpaces:!1,valueLookup:void 0},null!=e.valueLookup&&(t.filterOptions={searchValues:function(e){return[n._.options.valueLookup(e)]}}),null==(i=exports.mergeDefined(t,e)).filter&&(i.filter=function(e,t){var n,r,o,a,s;return o="filter"+i.matchType[0].toUpperCase()+i.matchType.slice(1),a=filterNested(e,t,o,i.filterOptions),r=(n=sortActive$1(a)).active,s=n.inactive,r.concat(s)}),this._={options:i,resultsCache:new Map}}return e.prototype.clearCache=function(){return this._.resultsCache=new Map,this},e.prototype.filter=function(e,t){var i,n,r,o,a,s=this;return i=this._,void 0===e?t([]):(null==e&&(e=""),a=e+exports.randomId(),i.lastFilter=a,n=function(n,r){return void 0===r&&(r=[]),i.options.trimTrailingSpaces&&0===n.length&&e.lastIndexOf(" ")===e.length-1?s.filter(trimTrailingSpaces(e),t):(i.options.useCache&&i.resultsCache.set(e,{results:n,otherResults:r}),a===i.lastFilter?t(n,r):void 0)},i.options.useCache&&i.resultsCache.has(e)?(r=i.resultsCache.get(e),t(r.results,r.otherResults)):"external"===i.options.matchType&&exports.isFunction(i.items)?i.items(e,n):(o=function(t){var r,o,a,s,l,c;return a=i.options.filter(t,e),i.options.showOtherResults&&(c=t.filter((function(e){return-1===a.indexOf(e)})).sort(sortItems(i.options.valueLookup)),o=(r=sortActive$1(c)).active,s=r.inactive,l=o.concat(s)),n(a,l)},exports.isFunction(i.items)?i.items(e,o):e.length?o(i.items):n(i.items)))},e.prototype.validateItems=function(e){return Array.isArray(e)||exports.isFunction(e)},e.prototype.items=function(e){return arguments.length?(this._.items=e,this):this._.items},e}(),checkValue=function(e,t,i){return void 0!==i&&(e=Math.min(e,i)),void 0!==t&&(e=Math.max(e,t)),e},getDisabled=function(e,t,i){return e||t===i?"disabled":void 0},addHoldHandler=function(e,t,i,n){var r,o,a;return e?(o=void 0,a=void 0,r=function(){return clearTimeout(a),a=void 0},i.on("pointerdown","hx.number-picker",(function(e){var i,r;return o=Date.now(),null!=(r=document.activeElement)&&r.blur(),e.event.preventDefault(),i=function(){return n(),a=setTimeout(i,t)},a=setTimeout(i,200)})),i.on("pointerup","hx.number-picker",(function(){if(r(),Date.now()-o<200)return n()})),i.on("pointerleave","hx.number-picker",r)):i.on("click","hx.number-picker",n)};var PickerBase,pickerBase,setValue$1,NumberPicker=function(e){function t(t,i){var n,r,o,a=this;e.call(this),this.selector=t,this.options=exports.mergeDefined({buttonClass:"",min:void 0,max:void 0,disabled:!1,value:0,incrementOnHold:!0,incrementDelay:50,step:void 0},i),this._={},(r=(o=select(this.selector).class("hx-number-picker").api("number-picker",this).api(this)).append("button").attr("type","button").class("hx-number-picker-increment hx-btn "+this.options.buttonClass)).append("i").class("hx-icon hx-icon-chevron-up"),addHoldHandler(this.options.incrementOnHold,this.options.incrementDelay,r,(function(){return a.increment()})),this.selectInput=o.append("input").class("hx-number-picker-input"),this.selectInput.attr("type","number"),this.selectInput.on("blur","hx.number-picker",(function(){if(void 0===a.selectInput.attr("readonly"))return a.value(void 0,a.selectInput.value()),a.emit("input-change",{value:a.value()})})),(n=o.append("button").attr("type","button").class("hx-number-picker-decrement hx-btn "+this.options.buttonClass)).append("i").class("hx-icon hx-icon-chevron-down"),addHoldHandler(this.options.incrementOnHold,this.options.incrementDelay,n,(function(){return a.decrement()})),void 0!==this.options.max&&this.max(this.options.max),void 0!==this.options.min&&this.min(this.options.min),void 0!==this.options.step&&this.step(this.options.step),this.options.disabled&&this.disabled(this.options.disabled),this.value(this.options.value)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.value=function(e,t){var i,n,r,o;return arguments.length>0?(n=this.value(),o=null==e&&t?Number(t):e,i=checkValue(o,this.min(),this.max()),this.selectInput.attr("type","text").attr("data-value",i).attr("readonly",t&&isNaN(t)?"readonly":void 0).value(null!=e&&null!=t?t:i),(r=select(this.selector)).select(".hx-number-picker-decrement").attr("disabled",getDisabled(this.options.disabled,i,this.min())),r.select(".hx-number-picker-increment").attr("disabled",getDisabled(this.options.disabled,i,this.max())),n!==i&&this.emit("change",{value:i}),this):Number(this.selectInput.attr("data-value"))},t.prototype.min=function(e){return arguments.length>0?(this._.min=e,this.selectInput.attr("min",e),this.value(this.value()),this):this._.min},t.prototype.max=function(e){return arguments.length>0?(this._.max=e,this.selectInput.attr("max",e),this.value(this.value()),this):this._.max},t.prototype.increment=function(){var e,t;return this.options.disabled||(e=this.value(),t=this.options.step||1,this.value(this.value()+t),e!==this.value()&&this.emit("increment")),this},t.prototype.decrement=function(){var e,t;return this.options.disabled||(e=this.value(),t=this.options.step||1,this.value(this.value()-t),e!==this.value()&&this.emit("decrement")),this},t.prototype.disabled=function(e){var t;return null!=e?(this.options.disabled=e,t=e?"disabled":void 0,select(this.selector).selectAll("button").forEach((function(e){return e.attr("disabled",t)})),this.selectInput.attr("disabled",t),this):this.options.disabled},t.prototype.step=function(e){return null!=e?(this.options.step=e,this.selectInput.attr("step",e),this.value(this.value()),this):this.options.step},t}(EventEmitter),numberPicker=function(e){var t;return t=div(),new NumberPicker(t,e),t};function inputGroup(){return div("hx-input-group")}function group(e){void 0===e&&(e={});var t=e.vertical;void 0===t&&(t=!1);var i=e.fixed;void 0===i&&(i=!1);var n=e.compact;return void 0===n&&(n=!1),div(n?"hx-compact-group":"hx-group").classed("hx-horizontal",!t).classed("hx-vertical",t).classed("hx-fixed",i)}exports.ButtonGroup=function(e){function t(t,i){var n,r;e.call(this),r=this,this.options=exports.mergeDefined({buttonClass:"hx-complement",activeClass:"hx-action",fullWidth:!1,renderer:function(e,t,i){select(e).text(null!=t.value?t.value:t)},items:[],disabled:!1},i),this.current=void 0,n=select(t).api("button-group",this).api(this).classed("hx-button-group",!0).append("div").class("hx-input-group").classed("hx-input-group-full-width",this.options.fullWidth),this.view=n.view("button").enter((function(){return this.append("button").class("hx-btn").classed("hx-section hx-no-margin",r.options.fullWidth).classed(r.options.buttonClass,!0).node()})).update((function(e,t){var i;i=null!=e.activeClass&&e===r.current?e.activeClass:e===r.current?r.options.activeClass:r.options.buttonClass,this.class("hx-btn").classed("hx-section hx-no-margin",r.options.fullWidth).classed(i,!0).attr("disabled",!!r.options.disabled||void 0).on("click","hx.button-group",(function(){return r.value(e,!0)})),r.options.renderer(t,e,e===r.current)})),null!=this.options.items&&this.options.items.length>0&&this.items(this.options.items)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.renderer=function(e){return null!=e?(this.options.renderer=e,this):this.options.renderer},t.prototype.items=function(e){return null!=e?(this.options.items=e,this.view.apply(this.options.items),this):this.options.items},t.prototype.value=function(e){var t,i,n,r,o=arguments;if(arguments.length>0){for(t=0,n=(r=this.options.items).length;t<n;t++)if((i=r[t])===e||i.value===e){this.current=i,this.view.apply(this.options.items),this.emit("change",{value:i,cause:o[1]?"user":"api"});break}return this}return this.current},t.prototype.disabled=function(e){return arguments.length>0?(this.options.disabled=e,this.items(this.items()),this):this.options.disabled},t}(EventEmitter),exports.buttonGroup=function(e){var t;return t=div(),new exports.ButtonGroup(t.node(),e),t},exports.userFacingText({picker:{chooseValue:"Choose a value..."}}),setValue$1=function(e,t,i,n){var r,o,a,s;for(void 0===n&&(n="api"),s=void 0,o=0,a=i.length;o<a;o++)if((r=i[o])===t||exports.isObject(r)&&(r.value===t||r.value===(null!=t?t.value:void 0))){s=r;break}if(null!=s?e._.renderer(e._.selectedText.node(),s):e._.selectedText.text(e._.options.noValueText),e._.current!==s)return e._.current=s,e.emit("change",{value:s,cause:n})},PickerBase=function(e){function t(t,n){var r,o,a,s=this;void 0===n&&(n={}),e.call(this),o=exports.mergeDefined({dropdownOptions:{},items:[],noValueText:exports.userFacingText("picker","chooseValue"),renderer:void 0,value:void 0,disabled:!1,fullWidth:!1},n),a=span("hx-picker-text"),this.selection=select(t).classed("hx-picker hx-btn",!0).classed("hx-picker-full-width",o.fullWidth).add(span("hx-picker-inner").attr("type","button").add(a).add(span("hx-picker-icon").add(i("hx-icon hx-icon-caret-down")))).api("picker",this).api(this),(r=new MenuBase(t,{dropdownOptions:o.dropdownOptions,items:o.items,disabled:o.disabled})).pipe(this,"",["highlight"]),r.dropdown.pipe(this,"dropdown"),r.on("change","hx.picker",(function(e){if(null!=(null!=e?e.content:void 0))return setValue$1(s,e.content,s.items(),"user"),r.hide()})),this._={menu:r,options:o,renderer:o.renderer,selectedText:a,current:void 0},null==o.renderer&&this.renderer(r.renderer()),r.renderer((function(e,t){return s._.renderer(e,t)})),null!=o.items&&this.items(o.items),null!=o.value&&this.value(o.value),null==this._.current&&null!=o.noValueText&&a.text(o.noValueText)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.renderer=function(e){return null!=e?(this._.renderer=e,this):this._.renderer},t.prototype.items=function(e){return null!=e?(this._.items=e,this._.menu.items(e),this.value(this._.current),this):this._.items},t.prototype.value=function(e){var t,i=this;return arguments.length>0?(exports.isFunction(this.items())?((t=this.selection.prepend("span")).append("i").class("hx-menu-loading hx-icon hx-icon-spin hx-icon-spinner"),this.items()((function(n){return t.remove(),setValue$1(i,e,n)}))):setValue$1(this,e,this.items()),this):this._.current},t.prototype.disabled=function(e){var t;return t=this._.menu.disabled(e),null!=e?this:t},t}(EventEmitter),exports.Picker=function(e){function t(t,i){logger.deprecated("Picker","Deprecated in favour of the SingleSelect component"),e.call(this,t,i)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(PickerBase),pickerBase=function(e){var t;return t=button(e.class),new PickerBase(t,e),t},exports.picker=function(e){var t;return t=button(e.class),new exports.Picker(t,e),t};var containerChildren,drag,endDrag,getGrid,startDrag,ProgressBar,sectionSizes=["small","medium","large"];function section(e){void 0===e&&(e={});var t=e.fixed;void 0===t&&(t=!1);var i=e.size;void 0===i&&(i=void 0);var n=div("hx-section").classed("hx-fixed",t);return i&&sectionSizes.includes(i)&&n.classed("hx-"+i,!0),n}group.vertical=function(){return group({vertical:!0})},group.vertical.fixed=function(){return group({vertical:!0,fixed:!0})},group.fixed=function(){return group({fixed:!0})},section.fixed=function(){return section({fixed:!0})},getGrid=function(e,t){var i,n;return n=[],i=-1,containerChildren(e).forEach((function(e){var t;return t=(e=select(e)).box(),n.push({index:i+=1,x1:t.left,x2:t.left+t.width,y1:t.top,y2:t.top+t.height,width:e.style("width").replace("px",""),height:e.style("height").replace("px",""),elem:e})})),n},startDrag=function(e,t,i,n){var r;return r=e._,n.event.preventDefault(),r.dragging?endDrag(e,t):n.event.which<2?(select(document).on("pointermove","hx.drag-container",(function(n){return drag(e,t,i,n)})).on("pointerup","hx.drag-container",(function(i){return endDrag(e,t,i)})),r.origPageYOffset=window.pageYOffset,r.origPageXOffset=window.pageXOffset,r.dragging=!0,r.grid=getGrid(e),r.origWidth=t.style("width").replace("px",""),r.origHeight=t.style("height").replace("px",""),r.placeholder=t.insertAfter(t.clone(!0).clear()).classed("hx-drag-placeholder",!0),r.placeholder.style("height",r.origHeight+"px").style("width",r.origWidth+"px").style("max-height",r.origHeight+"px").style("max-width",r.origWidth+"px").style("min-height",r.origHeight+"px").style("min-width",r.origWidth+"px").append("div"),t.classed("hx-drag-current",!0).style("width",r.origWidth+"px"),r.selectionBox=t.box(),r.controlBox=i.box(),r.containerBox=e.selection.box(),drag(e,t,i,n),r.currentPos=-1,e.emit("dragstart",t.node())):void 0},drag=function(e,t,i,n,r){var o,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S,k;if((o=e._).dragging&&(n.event.preventDefault(),l=o.controlBox.left+o.controlBox.width/2,c=o.controlBox.top+o.controlBox.height/2,v=o.containerBox.left-o.selectionBox.left,y=o.containerBox.top-o.selectionBox.top,x=window.pageXOffset-o.origPageXOffset,m=window.pageYOffset-o.origPageYOffset,w=n.x-v-l+x,k=n.y-y-c+m,t.style("left",w+"px"),t.style("top",k+"px"),!r)){for(b=n.x+x,S=n.y+m,a=!0,g=[],h=0,p=(f=o.grid).length;h<p;h++){if(u=b>=(s=f[h]).x1&&b<=s.x2,d=S>=s.y1&&S<=s.y2,s.elem.node()===t.node()&&(a=!1),u&&d){o.currentPos!==s.index&&o.currentPos>-1&&(a?s.elem.insertBefore(o.placeholder):s.elem.insertAfter(o.placeholder),o.options.resizeOnDrag&&(o.placeholder.style("height",s.height+"px").style("width",s.width+"px").style("max-height",s.height+"px").style("max-width",s.width+"px").style("min-height",s.height+"px").style("min-width",s.width+"px"),t.style("width",o.placeholder.style("width")),o.selectionBox=t.box(),o.controlBox=i.box(),drag(e,t,i,n,!0)),e.emit("drag",t.node())),o.currentPos=s.index;break}g.push(void 0)}return g}},endDrag=function(e,t){var i;if((i=e._).dragging)return i.dragging=!1,select(document).off("pointermove","hx.drag-container").off("pointerup","hx.drag-container"),i.placeholder.insertAfter(t),i.placeholder.remove(),t.style("top","").style("left","").style("width","").classed("hx-drag-current",!1),e.emit("dragend",t.node())},containerChildren=function(e){var t,i,n;return t=e.selection.node().children,n=function(){var e,n,r;for(r=[],i=e=0,n=t.length;e<=n;i=e+=1)null!=t[i]?r.push(t[i]):r.push(void 0);return r}(),n.filter(exports.defined)},exports.DragContainer=function(e){function t(t,i){e.call(this),this.selection=select(t).classed("hx-drag-container",!0).api(this),i=exports.merge({lookup:function(e){return select(e).attr("data-id")},resizeOnDrag:!1,order:void 0},i),this._={},this._.options=i,this._.initialOrder=this.order(),i.order&&this.order(i.order),this.setup()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.setup=function(){var e=this;return this.selection.selectAll(".hx-drag-control").off("pointerdown","hx.drag-container"),containerChildren(this).forEach((function(t){var i;if((t=select(t)).classed("hx-drag-element"))return(i=select(t.select(".hx-drag-control").node()||t.node())).classed("hx-drag-control",!0).on("pointerdown","hx.drag-container",(function(n){if(!i.classed("hx-drag-disabled"))return startDrag(e,t,i,n)}))})),this},t.prototype.order=function(e){var t,i,n,r,o,a,s,l,c;if(arguments.length>0){for(a={},i=0,r=(l=containerChildren(this)).length;i<r;i++)s=l[i],a[this.lookup()(s)]=s;for(n=0,o=(c=e||this._.initialOrder).length;n<o;n++)t=c[n],this.selection.append(a[t]);return this}return containerChildren(this).map(this.lookup()).filter(exports.defined)},t.prototype.lookup=function(e){return null!=e?(this._.options.lookup=e,this):this._.options.lookup},t}(EventEmitter),exports.dragContainer=function(e){var t;return t=div(),new exports.DragContainer(t.node(),e),t},ProgressBar=function(){function e(e,t){this.selector=e,logger.deprecated('ProgressBar: This version of progress bar is deprecated. Please add "featureFlags: { useUpdatedClass: true }" to the options when creating your progress bar'),t=exports.mergeDefined({segments:void 0,value:0,animate:!1},t),this.selection=select(this.selector).classed("hx-progress-bar",!0).api("progress-bar",this).api(this),this.innerBars=this.selection.append("div").attr("class","hx-progress-bar-inner"),this.value(t.value),null!=t.segments&&this.segments(t.segments,!0),t.animate&&this.selection.classed("hx-animate",!0)}return e.prototype.value=function(e){return arguments.length>0?(isNaN(e)||(this.progress=Math.max(0,Math.min(1,e)),this.innerBars.style("width",100*this.progress+"%")),this):this.progress},e.prototype.segments=function(e,t){var i,n,r=this;return arguments.length>0?(null!=e?(this.progressSegments=e.filter((function(e){return null!=e.value||null!=e.ratio||null!=e.class})),this.progressSegments.length>0&&(this.selection.selectAll(".hx-progress-bar-inner").remove(),this.progressSegments.some((function(e){return null!=e.value}))?this.progressSegments=this.progressSegments.sort((function(e,t){return(e.value||1)-(t.value||1)})):(i=0,n=this.progressSegments.map((function(e){return e.ratio||1})).reduce((function(e,t){return e+t}))),this.progressSegments.forEach((function(e,t){var o,a;return o=r.selection.append("div").attr("class","hx-progress-bar-inner"),null!=e.class&&o.classed(e.class,!0),a=null==i?100*(e.value||1):(i+=e.ratio||1)/n*100,o.style("max-width",a+"%").style("z-index",r.progressSegments.length-t)})))):(this.progressSegments=void 0,this.selection.selectAll(".hx-progress-bar-inner").remove(),this.selection.append("div").attr("class","hx-progress-bar-inner")),this.innerBars=this.selection.selectAll(".hx-progress-bar-inner"),t?this.value(this.progress):this.progress=0,this):this.progressSegments},e}();var toMultilineSelection$1=exports.userFacingText.toMultilineSelection,segmentTypes=["default","light","medium","dark","danger","warning","done","in-progress","todo"];function optionSetterGetter(e,t,i,n){return void 0===t&&(t=exports.identity),function(r){return arguments.length?(this.options[e]=r||n,t(),i?i[e](r):this.render(),this):this.options[e]}}var StatusBar=function(e,t){var i=this;void 0===t&&(t={}),this.options=exports.mergeDefined({segments:[],title:void 0,breakdown:void 0,plan:void 0,compact:!1,disabled:!1},t),this._={},this.segments=optionSetterGetter("segments",(function(){i._.segmentTotal=i.options.segments.reduce((function(e,t){return e+t.count}),0)}),void 0,[]).bind(this),this.title=optionSetterGetter("title").bind(this),this.breakdown=optionSetterGetter("breakdown").bind(this),this.plan=optionSetterGetter("plan").bind(this),this.compact=optionSetterGetter("compact").bind(this),this.disabled=optionSetterGetter("disabled").bind(this),this.selection=select(e).classed("hx-status-bar",!0),this._.titleGroupSel=group({compact:!0}).classed("hx-status-bar-title-section",!0),this._.titleSel=div("hx-status-bar-title"),this._.planSel=div("hx-status-bar-plan"),this._.segmentsSel=div("hx-status-bar-segments"),this._.breakdownSel=div("hx-status-bar-breakdown"),this.selection.add(this._.titleGroupSel.add(section().add(this._.titleSel)).add(section({fixed:!0}).add(this._.planSel))).add(this._.segmentsSel).add(this._.breakdownSel),this.createView(),this.segments(this.options.segments,!1)};StatusBar.prototype.render=function(){var e=this._,t=e.view,i=e.titleGroupSel,n=e.titleSel,r=e.planSel,o=e.breakdownSel,a=e.segmentsSel,s=this.options,l=s.segments,c=s.title,u=s.breakdown,d=s.plan,h=s.compact,p=s.disabled;this.selection.classed("hx-status-bar-compact",h).classed("hx-status-bar-disabled",p),i.classed("hx-header-small",!h),n.text(c),r.text(d),o.set(u?toMultilineSelection$1(u,"p",!0):[]),h?a.insertAfter(r):i.append(r),t.apply(l)},StatusBar.prototype.createView=function(){var e=this;this._.view=this._.segmentsSel.view(".hx-status-bar-section").enter((function(){var e=div("hx-status-bar-section").add(div("hx-status-bar-section-bar")).add(div("hx-status-bar-section-text").add(div("hx-status-bar-section-label")).add(div("hx-status-bar-section-percent")));return this.append(e).node()})).update((function(t,i){var n=t.id,r=t.count,o=t.type,a=t.label;if(!n)throw new Error('StatusBar: an "id" is required for each segment');if(void 0===r)throw new Error("StatusBar: a count must be defined for each segment");var s=e._.segmentTotal,l=e.options.compact,c=0===s?0:Math.round(r/s*100),u=select(i);u.style("flex-grow",c||1);var d=u.select(".hx-status-bar-section-bar").class("hx-status-bar-section-bar").text(l?void 0:r);o&&segmentTypes.includes(o)&&d.classed("hx-status-bar-"+o,!0),o&&!segmentTypes.includes(o)&&logger.warn('StatusBar: invalid segment type provided "'+o+'", expected one of ['+segmentTypes.join(", ")+"]"),u.select(".hx-status-bar-section-text").classed("hx-status-bar-section-hidden",!a),u.select(".hx-status-bar-section-label").text(a),u.select(".hx-status-bar-section-percent").text("("+c+"%)")}))};var ProgressBar$1=function(e,t){this.options=exports.mergeDefined({title:void 0,breakdown:void 0,plan:0,inProgress:0,done:0,hidePlan:!1,compact:!1,disabled:!1},t);var i=this.options,n=i.compact,r=i.disabled,o=i.title,a=i.breakdown;this.selection=select(e).classed("hx-progress-bar hx-flag-progress-bar",!0).api("progress-bar",this).api(this),this.selection=select(e),this._={},this._.segments={done:{id:"done",count:0,type:"done"},inProgress:{id:"inProgress",count:0,type:"in-progress"},todo:{id:"todo",count:0,type:"todo"}},this._.bar=new StatusBar(this.selection,{title:o,breakdown:a,compact:n,disabled:r}),this.title=optionSetterGetter("title",void 0,this._.bar).bind(this),this.breakdown=optionSetterGetter("breakdown",void 0,this._.bar).bind(this),this.disabled=optionSetterGetter("disabled",void 0,this._.bar).bind(this),this.compact=optionSetterGetter("compact",void 0,this._.bar).bind(this),this.render()};function ProgressBar$2(e,t){return void 0===t&&(t={}),t.featureFlags&&t.featureFlags.useUpdatedClass?new ProgressBar$1(e,t):new ProgressBar(e,t)}function progressBar(e){void 0===e&&(e={});var t=div();return e.featureFlags&&e.featureFlags.useUpdatedClass?new ProgressBar$1(t,e):new ProgressBar(t,e),t}ProgressBar$1.prototype.render=function(){var e=this._,t=e.bar,i=e.segments,n=this.options,r=n.plan;void 0===r&&(r=0);var o=n.done;void 0===o&&(o=0);var a=n.inProgress;void 0===a&&(a=0);var s=n.disabled,l=n.hidePlan,c=o+a,u=Math.max(0,r-c);t.options.plan=l?s?void 0:o:s?void 0:o+" / "+(r||"-"),i.done.count=o,i.inProgress.count=a,i.todo.count=u,t.segments([i.done,i.inProgress,i.todo].filter((function(e){return e.count})))},ProgressBar$1.prototype.hidePlan=function(e){return arguments.length&&(this.options.hidePlan=e,this.render()),this.options.hidePlan},ProgressBar$1.prototype.done=function(e){return arguments.length&&(this.options.done=e,this.render()),this.options.done},ProgressBar$1.prototype.inProgress=function(e){return arguments.length&&(this.options.inProgress=e,this.render()),this.options.inProgress},ProgressBar$1.prototype.plan=function(e){return arguments.length&&(this.options.plan=e,this.render()),this.options.plan};var AutocompletePickerBase,debounceDuration,enterKeyCode,setPickerValue,validateItems,cloneEvents,cloneTableAndNodeEvents,createStickyHeaderNodes,getChildren,getChildrenFromTable,updateHeaderPositions,updateScrollIndicators,VisualizationBar=function(e,t){if(this.options=exports.mergeDefined({title:void 0,breakdown:void 0,segments:[]},t),this.selection=select(e).classed("hx-visualization-bar",!0).api("visualization-bar",this).api(this),this._={},!this.options.segments.length)throw new Error("VisualizationBar: Expected at least one segment to display");this._.bar=new StatusBar(this.selection,{title:this.options.title,breakdown:this.options.breakdown,segments:this.options.segments}),this.title=optionSetterGetter("title",void 0,this._.bar).bind(this),this.breakdown=optionSetterGetter("breakdown",void 0,this._.bar).bind(this),this.segments=optionSetterGetter("segments",void 0,this._.bar).bind(this)};function visualizationBar(e){var t=div();return new VisualizationBar(t,e),t}function notice(){return div("hx-notice")}function noticeHead(){return div("hx-notice-head")}function noticeBody(){return div("hx-notice-body")}exports.Toggle=function(e){function t(t,i){var n=this;e.call(this),this.options=exports.mergeDefined({value:!1,disabled:!1},i),this.selection=select(t).classed("hx-toggle",!0).api("toggle",this).api(this),this.toggle=this.selection.append("div").class("hx-toggle-box"),this.value(this.options.value),this.disabled(this.options.disabled),this.selection.on("click","hx.toggle",(function(e){if(!n.disabled())return n.value(!n.value()),n.emit("change",n.value())}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.value=function(e){return null!=e?(this.options.value=e,this.toggle.classed("hx-toggle-box-on",e),this):this.options.value},t.prototype.disabled=function(e){return null!=e?(this.options.disabled=e,this.toggle.classed("hx-toggle-disabled",e),this):this.options.disabled},t}(EventEmitter),exports.toggle=function(e){var t;return t=div(),new exports.Toggle(t.node(),e),t},exports.Crumbtrail=function(){function e(e,t){var i,n,r;this.selector=e,n=this,(i=select(this.selector).api(this)).classed("hx-crumbtrail",!0),this.options=exports.mergeDefined({renderer:function(e,t){return select(e).text(t)},items:[],separator:"/"},t),r=function(e,t,i){return i%2==0?(this.class("hx-crumbtrail-node"),n.options.renderer(t,e)):this.class("hx-crumbtrail-separator").text(n.options.separator).node()},this.view=i.view("span","span").update(r),null!=this.options.items&&this.options.items.length>0&&this.items(this.options.items)}return e.prototype.renderer=function(e){return null!=e?(this.options.renderer=e,this):this.options.renderer},e.prototype.items=function(e){return null!=e?(this.options.items=e,this.view.apply(exports.flatten(e.map((function(e){return[e,0]}))).slice(0,-1)),this):this.options.items},e}(),exports.crumbtrail=function(e){var t;return t=div(),new exports.Crumbtrail(t.node(),e),t},notice.head=noticeHead,notice.body=noticeBody,exports.userFacingText({autocompletePicker:{chooseValue:"Choose a value...",loading:"Loading...",noResults:"No Results Found",otherResults:"Other Results"}}),enterKeyCode=13,debounceDuration=200,validateItems=function(e,t){return!!e.validateItems(t)||(logger.warn("hx.AutocompletePicker: the items was expected to be an array of items or a function, you supplied: "+t),!1)},setPickerValue=function(e,t,i){var n;return(n=e._).valueText.clear(),t.length?(n.current=t[0],e.emit("change",{cause:i,value:t[0]}),n.renderer(n.valueText.node(),t[0])):(n.current=void 0,n.valueText.text(n.options.chooseValueText))},AutocompletePickerBase=function(e){function t(t,n,r){var o,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w=this;void 0===r&&(r={}),e.call(this),a={filter:void 0,filterOptions:void 0,matchType:void 0,useCache:void 0,showOtherResults:void 0,trimTrailingSpaces:void 0,valueLookup:void 0,buttonClass:void 0,disabled:!1,renderer:void 0,value:void 0,chooseValueText:exports.userFacingText("autocompletePicker","chooseValue"),loadingText:exports.userFacingText("autocompletePicker","loading"),noResultsText:exports.userFacingText("autocompletePicker","noResults"),otherResultsText:exports.userFacingText("autocompletePicker","otherResults")},r.valueLookup&&(a.renderer=function(e,t){return select(e).text(r.valueLookup(t))}),m=exports.merge(a,r),v=select(t).classed("hx-autocomplete-picker hx-btn",!0),m.buttonClass&&v.classed(m.buttonClass,!0),b=div("hx-autocomplete-picker-text"),v.add(b).add(span("hx-autocomplete-picker-icon").add(i("hx-icon hx-icon-caret-down"))),l={filter:m.filter,filterOptions:m.filterOptions,matchType:m.matchType,showOtherResults:m.showOtherResults,trimTrailingSpaces:m.trimTrailingSpaces,valueLookup:m.valueLookup,useCache:m.useCache},s=new exports.AutocompleteFeed(l),this._={selection:v,options:m,valueText:b,feed:s,valueLookup:m.valueLookup||exports.identity},validateItems(s,n)&&(s.items(n),x=function(e,t){return v=select(e).clear().classed("hx-autocomplete-picker-heading",t.heading),t.unselectable||t.heading?v.text(t.text).off():w._.renderer(e,t)},c=detached("input").class("hx-autocomplete-picker-input").on("input",(function(e){return g([u]),o(e.target.value)})).on("keydown",(function(e){var t;if(c.value().length&&(e.which||e.keyCode)===enterKeyCode&&-1===d.cursorPos&&!(t=d.items()[0]).unselectable)return y(t)})),d=new MenuBase(t,{dropdownOptions:{ddClass:"hx-autocomplete-picker-dropdown"},extraContent:c}),this._.renderer=m.renderer||d.renderer(),this._.menu=d,d.renderer(x),h={text:m.noResultsText,unselectable:!0},u={text:m.loadingText,unselectable:!0},p={text:m.otherResultsText,unselectable:!0,heading:!0},g=function(e){return d.items(e),d.render()},f=function(e){return s.filter(e,(function(e,t){return 0===e.length&&e.push(h),t.length>0&&(t=[p].concat(t)),g(e.concat(t))}))},o=exports.debounce(debounceDuration,f),y=function(e){return setPickerValue(w,[e],"user"),d.hide()},d.dropdown.on("showstart",(function(){return c.value(""),g([u]),f(c.value()),c.node().focus()})),d.dropdown.on("showend",(function(){return c.node().focus()})),d.on("change",(function(e){if(null!=e&&null!=e.content)return y(e.content)})),d.pipe(this,"",["highlight"]),d.dropdown.pipe(this,"dropdown"),m.value?this.value(m.value):b.text(m.chooseValueText),m.disabled&&this.disabled(m.disabled),v.api("autocomplete-picker",this).api(this))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.clearCache=function(){return this._.feed.clearCache(),this},t.prototype.hide=function(){return this._.menu.hide(),this},t.prototype.disabled=function(e){var t;return t=this._.menu.disabled(e),null!=e?this:t},t.prototype.items=function(e){return arguments.length?(validateItems(this._.feed,e)&&(this._.feed.items(e),this.value(this._.current)),this):this._.feed.items()},t.prototype.value=function(e,t){var i,n=this;return i=this._,arguments.length?(i.valueText.text(i.options.loadingText),i.feed.filter(i.valueLookup(e),(function(e){return setPickerValue(n,e,"api"),"function"==typeof t?t(e[0]):void 0})),this):i.current},t.prototype.renderer=function(e){return null!=e?(this._.renderer=e,this):this._.renderer},t}(EventEmitter),exports.AutocompletePicker=function(e){function t(t,i){logger.deprecated("AutocompletePicker","Deprecated in favour of the SingleSelect component"),e.call(this,t,i)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(AutocompletePickerBase),exports.autocompletePicker=function(e,t){var i;return i=div(),new exports.AutocompletePicker(i,e,t),i},updateScrollIndicators=function(e,t,i,n,r){var o,a,s,l,c;return l=(c=e.node()).scrollTop>0,o=c.scrollTop<c.scrollHeight-c.clientHeight,a=c.scrollLeft>0,s=c.scrollLeft<c.scrollWidth-c.clientWidth,t.style("display",l?"block":""),i.style("display",s?"block":""),n.style("display",o?"block":""),r.style("display",a?"block":"")},updateHeaderPositions=function(e,t){var i,n,r,o;if(n=-t.scrollLeft,o=-t.scrollTop,null!=(r=e.shallowSelect(".hx-sticky-table-header-top"))&&r.select(".hx-table").style("left",n+"px"),null!=(i=e.shallowSelect(".hx-sticky-table-header-left")))return i.select(".hx-table").style("top",o+"px")},cloneEvents=function(e,t){var i,n,r,o,a,s,l,c,u,d,h,p,f,g;if(null!=e&&null!=t){if((d=null!=(p=(o=getHexagonElementDataObject(e)).listenerNamesRegistered)?p.values():void 0)&&d.length>0){for(h=o.eventEmitter,n=select(t),s=0,c=d.length;s<c;s++)u=d[s],n.on(u,(function(){}));getHexagonElementDataObject(t).eventEmitter.pipe(h)}if(r=e.childNodes){for(i=t.childNodes,g=[],a=l=0,f=r.length;0<=f?l<=f:l>=f;a=0<=f?++l:--l)g.push(cloneEvents(r[a],i[a]));return g}}},getChildrenFromTable=function(e,t,i){var n;return n=getChildren(e.select(t?"tbody":"thead"),"tr"),exports.flatten(n.map((function(e){return getChildren(select(e),"th, td",i)})))},getChildren=function(e,t,i){return(i?e.select(t):e.selectAll(t)).filter((function(t){return t.node().parentNode===e.node()})).nodes},createStickyHeaderNodes=function(e,t){var i,n,r,o;for(o=[],i=n=0,r=e.length;0<=r?n<r:n>r;i=0<=r?++n:--n)cloneEvents(e[i],t[i]),select(e[i]).classed("hx-sticky-table-invisible",!0),o.push(select(t[i]).classed("hx-sticky-table-invisible",!1));return o},cloneTableAndNodeEvents=function(e,t,i,n,r){var o,a,s;return(a=e.append(i.clone(!0))).selectAll("th, td").classed("hx-sticky-table-invisible",!0),s=getChildrenFromTable(t,n,r),o=getChildrenFromTable(a,n,r),createStickyHeaderNodes(s,o),a},exports.StickyTableHeaders=function(){function e(e,t){var i,n,r,o,a,s,l,c,u,d,h,p;o=exports.mergeDefined({stickTableHead:!0,stickFirstColumn:!1,useResponsive:!0,fullWidth:void 0,containerClass:void 0},t),(u=(s=select(e).api("sticky-table-headers",this).api(this)).classed("hx-table")||"table"===s.node().nodeName.toLowerCase()?(d=!0,s):(d=!1,s.select(".hx-table"))).classed("hx-table-full")&&null==t.fullWidth&&(t.fullWidth=!0),o.stickTableHead&&u.select("thead").selectAll("tr").empty()&&(logger.warn("hx.StickyTableHeaders - "+e,"Sticky table headers initialized with stickTableHead of true without a thead element present"),o.stickTableHead=!1),o.stickFirstColumn&&u.select("tbody").select("tr").selectAll("th, td").empty()&&(logger.warn("hx.StickyTableHeaders - "+e,"Sticky table headers initialized with stickFirstColumn of true without any columns to stick"),o.stickFirstColumn=!1),n=d?u.insertAfter("div").class("hx-sticky-table-headers"):s.classed("hx-sticky-table-headers",!0),o.containerClass&&n.classed(o.containerClass,!0),(p=n.append("div").class("hx-sticky-table-wrapper")).append(u),(c=0===scrollbarSize())&&(h=n.append("div").class("hx-sticky-table-scroll-top"),a=n.append("div").class("hx-sticky-table-scroll-right"),i=n.append("div").class("hx-sticky-table-scroll-bottom"),r=n.append("div").class("hx-sticky-table-scroll-left")),p.on("scroll","hx.sticky-table-headers",(function(){return c&&updateScrollIndicators(p,h,a,i,r),updateHeaderPositions(n,p.node())})),this._={options:o,container:n,wrapper:p,table:u,selection:s,showScrollIndicators:c},this.render(),o.useResponsive&&(l=this,n.on("resize","hx.sticky-table-headers",(function(){return l.render(),setTimeout((function(){return l.render()}),100)})))}return e.prototype.render=function(){var e,t,i,n,r,o,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S,k,T,A,C,_,M;return n=(e=this._).container,M=(C=e.wrapper).node(),x=e.table,d=e.options,h=M.scrollTop,n.style("height",void 0).style("width",void 0),C.style("height",void 0).style("width",void 0).style("margin-top",void 0).style("margin-left",void 0).style("max-width",void 0).style("max-height",void 0),x.style("margin-top",void 0).style("margin-left",void 0).style("min-width",void 0).style("min-height",void 0),c=0,u=0,d.fullWidth&&x.style("width","100%"),d.stickTableHead&&(c=x.select("thead").height()),d.stickFirstColumn&&(u=select(x.select("tbody").select("tr").select("th, td").nodes[0]).width()),k=n.style("height").replace("px","")-c,T=n.style("width").replace("px","")-u,C.style("width",T+"px").style("height",k+"px").style("margin-top",c+"px").style("margin-left",u+"px"),x.style("margin-top",-c+"px").style("margin-left",-u+"px"),m=x.box(),r=M.scrollHeight>M.clientHeight+scrollbarSize(),o=M.scrollWidth>M.clientWidth+scrollbarSize()?scrollbarSize():0,A=r?scrollbarSize():0,_=C.box(),d.fullWidth?x.style("width",void 0).style("min-width",_.width+u-A-1+"px"):C.style("max-width",m.width-u+A+"px").style("max-height",m.height-c+o+"px"),v=x.clone(!0).style("height",x.style("height")).style("width",x.style("width")),d.stickTableHead&&((y=n.shallowSelect(".hx-sticky-table-header-top")).empty()&&(y=n.prepend("div").class("hx-sticky-table-header-top"),!e.showScrollIndicators&&d.fullWidth&&(t=x.select("th").style("background-color"),y.style("background-color",t))),y.clear(),S=cloneTableAndNodeEvents(y,x,v)),d.stickFirstColumn&&((a=n.shallowSelect(".hx-sticky-table-header-left")).empty()&&(a=n.prepend("div").class("hx-sticky-table-header-left"),!e.showScrollIndicators&&d.fullWidth&&(t=x.select("th").style("background-color"),a.style("background-color",t))),a.clear(),l=cloneTableAndNodeEvents(a,x,v,!0,!0)),d.stickTableHead&&d.stickFirstColumn&&((w=n.shallowSelect(".hx-sticky-table-header-top-left")).empty()&&(w=n.prepend("div").class("hx-sticky-table-header-top-left")),w.clear(),cloneTableAndNodeEvents(w,x,v,!1,!0)),null!=y&&y.style("height",c+"px").style("width",_.width+"px").style("left",u+"px"),null!=S&&S.style("margin-left",-u+"px"),null!=a&&a.style("height",_.height+"px").style("width",u+"px").style("top",c+"px"),null!=l&&l.style("margin-top",-c+"px"),null!=w&&w.style("width",(null!=a?a.style("width"):void 0)||u+"px").style("height",(null!=y?y.style("height"):void 0)||c+"px"),M.scrollTop=h,e.showScrollIndicators&&(g=u-1,f=c-1,b=n.shallowSelect(".hx-sticky-table-scroll-top").style("top",f+"px").style("left",g+"px").style("width",_.width+"px"),p=n.shallowSelect(".hx-sticky-table-scroll-right").style("top",f+"px").style("height",_.height+"px"),i=n.shallowSelect(".hx-sticky-table-scroll-bottom").style("left",g+"px").style("width",_.width+"px"),s=n.shallowSelect(".hx-sticky-table-scroll-left").style("top",f+"px").style("left",g+"px").style("height",_.height+"px"),updateScrollIndicators(C,b,p,i,s)),updateHeaderPositions(n,C.node())},e}();var defaultCalculateMessageDurationOptions={minMessageDuration:2e3,maxMessageDuration:7e3};function calculateMessageDuration(e,t,i){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=defaultCalculateMessageDurationOptions);var n=i.minMessageDuration;void 0===n&&(n=2e3);var r=i.maxMessageDuration;void 0===r&&(r=7e3);var o=50*(e.length+t.length);return Math.min(Math.max(o,n),r)}var Alert=function(e,t,i){var n=this;void 0===i&&(i={}),this.id=e,this.closeAction=t,this.options=i,this.options.duration&&(this.activeTimeout=window.setTimeout((function(){return n.close()}),this.options.duration))};Alert.prototype.render=function(){var e=this,t=this.options,n=t.title,r=t.body,o=t.type,a=t.duration,s=n?span("hx-alert-title").text(n+" "):void 0,l=r?span("hx-alert-body").text(r):void 0,c=a?void 0:div("hx-alert-close").add(i("hx-alert-icon fas fa-times")).on("click",(function(){return e.close()}));return div("hx-alert").classed("hx-alert-"+o,o).add(div("hx-alert-content").add(s).add(l)).add(c)},Alert.prototype.close=function(){return window.clearTimeout(this.activeTimeout),delete this.activeTimeout,this.closeAction(this.id),this};var AlertManager=function(e,t){void 0===e&&(e="body"),void 0===t&&(t={}),this.options=exports.merge({animationInDuration:200,animationOutDuration:200},defaultCalculateMessageDurationOptions,t),this._={container:void 0,currentId:0,alerts:[]},this.selection=select(e)};AlertManager.prototype.message=function(e){if(!e)throw new Error("AlertManager::message - No options were provided. An object with title or body should be provided");var t=e.title,i=e.body,n=e.type,r=e.duration,o=["success"];if(n&&!o.includes(n))throw new Error("AlertManager::message - Invalid message type provided: '"+n+"'.\nAccepted types: ['"+o.join("', '")+"']");return this.addAlert({title:t,body:i,duration:r||calculateMessageDuration(t,i,this.options),type:n})},AlertManager.prototype.alert=function(e){if(!e)throw new Error("AlertManager::alert - No options were provided. An object with title or body should be provided");var t=e.title,i=e.body,n=e.type,r=e.duration,o=["success","warning","danger"];if(n&&!o.includes(n))throw new Error("AlertManager::alert - Invalid alert type provided: '"+n+"'.\nAccepted types: ['"+o.join("', '")+"']");return r&&logger.warn('AlertManager::alert called with "duration" but can only be closed by user interaction. Ignoring passed in duration'),this.addAlert({title:t,body:i,duration:void 0,type:n})},AlertManager.prototype.render=function(){return this.createOrGetContainer().api("_alerts-view").apply(this._.alerts,(function(e){return e.id})),this},AlertManager.prototype.addAlert=function(e){var t=this,i="alert-"+exports.randomId(),n=new Alert(i,(function(e){return t.closeAlert(e)}),e);return this._.alerts.unshift(n),this.render(),n},AlertManager.prototype.closeAlert=function(e){var t=this._.alerts.find((function(t){return t.id===e})),i=this._.alerts.indexOf(t);i>=0&&(this._.alerts.splice(i,1),this.render())},AlertManager.prototype.createOrGetContainer=function(){var e=this;if(!e._.container){var t=e.selection.append(div("hx-alert-container")),i=t.view(".hx-alert").enter((function(t){var i=t.render();return this.prepend(i),i.style("opacity",0).style("height",0).style("padding-top",0).style("padding-bottom",0).morph().with("fadein",e.options.animationInDuration).and("expandv",e.options.animationInDuration).then((function(){return i.style("padding-top",void 0).style("padding-bottom",void 0).style("height",void 0).style("opacity",void 0)})).go(),i.node()})).exit((function(){var t=this;this.style("opacity","1").morph().with("collapsev",e.options.animationOutDuration).and("fadeout",e.options.animationOutDuration).then((function(){return t.remove()})).go()}));t.api("_alerts-view",i),e._.container=t}return e._.container};var LTTBFeather,arcCurve,arcCurveMinimumRadius,boundLabel,createLabelPoint,createLinearGradient,dataAverage,doCollisionDetection,extent,findLabel,inefficientSearch,makeLabelDetails,maxTriangle,optionSetterGetter$1,populateLegendSeries,search,splitAndFeather,splitData,svgCurve,Series,updatePath,LinearScale,DiscreteScale,DateScale,inbuiltAlertManager=new AlertManager;function message(e){return inbuiltAlertManager.message(e)}function alert(e){return inbuiltAlertManager.alert(e)}doCollisionDetection=function(e){var t,i,n;return i=e.map((function(e,t){return{node:e,index:t,box:e.getBoundingClientRect()}})),n=function(e,t){var n,r,o=t.index,a=t.box;return n=i.slice(0,o-e+1),r=exports.find(n,(function(e){e.index;var t=e.box;return a.left<t.right})),r?o-r.index:e},t=i.reduce(n,1),i.forEach((function(e){var i=e.node;if(e.index%(t+1))return select(i).text("")}))},svgCurve=function(e,t){var i,n,r,o;if(e.length>1){for((o=new Array(e.length))[0]="M"+e[0].x+","+e[0].y,i=n=1,r=e.length-1;1<=r?n<=r:n>=r;i=1<=r?++n:--n)o[i]="L"+e[i].x+","+e[i].y;return t?o.join("")+"z":o.join("")}return""},arcCurveMinimumRadius=function(e,t,i){var n,r;return 0===i?0:(r=(n=t-e)<Math.PI?n/2:Math.PI-n/2,Math.abs(Math.sin(r))<1e-4?0:i/2/Math.sin(r))},arcCurve=function(e,t,i,n,r,o,a,s){var l,c,u,d,h;return h=o-r,l=function(e,t){return e/t},d=function(i,n,s){var u,d,p,f,g,x,m,v,y;for(g=l(a,s),p=Math.abs(n-i),v=[],u=d=x=i,m=n;x<=m?d<=m:d>=m;u=x<=m?++d:--d)y=(f=h-g)>0?r+g/2+u/p*f:o-g/2-u/p*f,y=exports.clamp(r,o,y),v.push(c.push({x:e+s*Math.cos(y),y:t+s*Math.sin(y)}));return v},u=Math.min(100,Math.max(3,Math.floor(h*Math.sqrt(n))-1)),c=[],0===i||s?c.push({x:e+i*Math.cos((r+o)/2),y:t+i*Math.sin((r+o)/2)}):d(0,u,i),d(u,0,n),svgCurve(c,!0)},extent=function(e,t){var i,n,r,o,a;if(e.length>0){for(r=t(e[0]),n=t(e[0]),o=0,a=e.length;o<a;o++)i=e[o],r=exports.min([r,t(i)]),n=exports.max([n,t(i)]);return[r,n]}},splitData=function(e,t){var i,n,r,o,a,s;for(void 0===t&&(t=function(){}),e.length,o=[],n=void 0,i=!0,a=0,s=e.length;a<s;a++)t(r=e[a])?(i&&(n=[],o.push(n),i=!1),n.push(r)):i=!0;return o.filter((function(e){return e.length>0}))},splitAndFeather=function(e,t,i){var n,r,o,a,s,l;if(void 0===i&&(i=function(){}),t){for(r=t/e.length,l=[],o=0,a=(s=splitData(e,i)).length;o<a;o++)n=s[o],l.push(LTTBFeather(n,Math.floor(n.length*r)));return l}return splitData(e,i)},LTTBFeather=function(e,t){var i,n,r,o,a,s,l,c,u;if(void 0===t&&(t=200),t>1){if((c=e.length)>t){for((l=new Array(t))[0]=e[0],l[t-1]=e[c-1],n=(c-2)/(t-2),a=s=1,u=t-1;s<u;a=s+=1)r=l[a-1],i=e.slice(Math.floor((a-1)*n)+1,Math.floor(a*n)+1),o=dataAverage(e.slice(Math.floor(a*n)+1,Math.floor((a+1)*n)+1)),l[a]=maxTriangle(r,i,o);return l}return e.slice(0)}return 1===t&&e.length>0?[e[Math.floor(e.length/2)]]:[]},dataAverage=function(e){var t,i;return t=e.length,void 0!==e[0].y?{x:(i=e.reduce((function(e,t){return{x:e.x+t.x,y:e.y+t.y}}))).x/t,y:i.y/t}:{x:(i=e.reduce((function(e,t){return{x:e.x+t.x,y1:e.y1+t.y1,y2:e.y2+t.y2}}))).x/t,y1:i.y1/t,y2:i.y2/t}},maxTriangle=function(e,t,i){var n,r,o,a,s,l;for(l=-1,a=0,s=t.length;a<s;a++)(n=void 0!==(r=t[a]).y?Math.abs((e.x-i.x)*(r.y-e.y)-(i.y-e.y)*(e.x-r.x)):Math.abs((e.x-i.x)*(Math.abs(r.y1-r.y2)-Math.abs(e.y2-e.y1))-(Math.abs(i.y2-i.y1)-Math.abs(e.y2-e.y1))*(e.x-r.x)))>l&&(l=n,o=r);return o},inefficientSearch=function(e,t,i,n){var r,o,a;for(r=o=0,a=e.length-1;o<a;r=o+=1)if(n(e[r])<=t&&t<=n(e[r+1]))return i?Math.abs(n(e[r])-t)<Math.abs(n(e[r+1])-t)?r:r+1:r;return-1},search=function(e,t,i){var n,r,o,a;if(e.length<2)return e.length-1;for(a=0,r=e.length-1,n=a;a<=r;){if(i(e[o=Math.floor((r+a)/2)])<t)a=o+1;else{if(!(i(e[o])>t))return o;r=o-1}Math.abs(i(e[o])-t)<Math.abs(i(e[n])-t)&&(n=o)}return n},findLabel=function(e,t,i,n){var r,o,a,s,l,c,u;if((a=search(e,t,(function(e){return e.x})))>-1)return i?(r=e[a],s=(o=t-r.x)<0&&a>0,l=o>0&&a<e.length-1,s||l?(u=e[s?a-1:a+1],null!=(c=n(t,r,u,(function(e,t){return e+(e-t)*o/(r.x-u.x)})))?c:e[a]):e[a]):e[a]},createLabelPoint=function(e,t,i,n){var r,o,a,s,l,c,u,d;if(e.labelsEnabled()){for(o=void 0,r=-1,d=e.axis.xScale.inverse(t),s=0,l=(u=e._.featheredData).length;s<l;s++)u[s],(c=findLabel(e.data(),d,e.labelInterpolated(),n))&&((a=Math.abs(c.x-d))<r||null==o)&&(r=a,o=c);return o}},makeLabelDetails=function(e,t,i,n,r){return void 0===n&&(n="x"),void 0===r&&(r="y"),{series:e,title:e.title(),x:e.axis.xScale.apply(t.x),y:e.axis.yScale.apply(i(t)),color:e.legendColor(),values:e.labelValuesExtractor()(e,t,void 0,i,n,r)}},boundLabel=function(e,t){return e.bounding=t.plotArea,e},createLinearGradient=function(e,t,i){var n,r;return n=exports.randomId(),select(e).select(".hx-linear-gradient").remove(),r=select(e).append("linearGradient").attr("class","hx-linear-gradient").attr("id",n).attr("gradientUnits","userSpaceOnUse").attr("x1",0).attr("x2",0).attr("y1",i.axis.yScale.rangeMin).attr("y2",i.axis.yScale.rangeMax),t.forEach((function(e){return r.append("stop").attr("offset",(e.yValue-i.axis.yScale.domainMin)/(i.axis.yScale.domainMax-i.axis.yScale.domainMin)*100+"%").attr("stop-color",color(e.color).alpha(1).toString()).attr("stop-opacity",color(e.color).alpha())})),n},populateLegendSeries=function(e,t){var i,n;return 0===(i=e.select(".hx-legend-box")).size()&&(i=e.append("rect").class("hx-legend-box")),e.view(".hx-legend-entry","g").enter((function(){return(e=this.append("g").class("hx-legend-entry")).append("text"),e.append("rect"),e.node()})).update((function(e,t,i){return this.select("text").text(exports.isFunction(e.title)?e.title():e.name).attr("y",20*i+10).attr("x",15),this.select("rect").text(exports.isFunction(e.title)?e.title():e.name).attr("y",20*i).attr("x",0).attr("width",10).attr("height",10).attr("fill",e.legendColor?e.legendColor():e.fillColor)})).apply(t),n=exports.max(e.selectAll("text").nodes.map((function(e){return e.getComputedTextLength()}))),i.attr("width",n+6+20),i.attr("x",-5),i.attr("height",20*t.length),i.attr("y",-5),e},optionSetterGetter$1=function(e){return function(t){return arguments.length>0?(this._.options[e]=t,this):this._.options[e]}},exports.plotLabelStandard=function(e,t){var i,n,r,o,a;return i=function(e){return div("hx-plot-label-details-entry").add(span("hx-plot-label-details-entry-key").text(e.name)).add(span("hx-plot-label-details-entry-value").text(e.formatter(e.value)))},r=div("hx-plot-label-marker").style("background",t.color),n=div("hx-plot-label-details").add(div("hx-plot-label-details-header").text(t.title)).add(t.values.map(i)),o=(t.bounding.x1+t.bounding.x2)/2,a=(t.bounding.y1+t.bounding.y2)/2,n.classed("hx-plot-label-details-left",t.x>=o),n.classed("hx-plot-label-details-bottom",t.y>=a),select(e).clear().add(r).add(n)},exports.plotLabelBasic=function(e,t){var i,n,r,o,a;return n=div("hx-plot-label-marker").style("background",t.color),a=t.values[1],r=(t.bounding.x1+t.bounding.x2)/2,o=(t.bounding.y1+t.bounding.y2)/2,i=div("hx-plot-label-details-basic").classed("hx-plot-label-details-left",t.x>=r).classed("hx-plot-label-details-bottom",t.y>=o).text(a.formatter(a.value)),select(e).clear().add(n).add(i)},Series=function(){var e,t=function(t){function i(i){var n;t.call(this),this._={options:exports.merge({title:void 0,data:void 0,labelsEnabled:!0,labelRenderer:exports.plotLabelStandard,labelInterpolated:!1,labelFormatters:{},class:"",type:void 0,labelValuesExtractor:e},i),featheredData:[],axis:void 0,seriesId:void 0},null==(n=this._.options).data&&(n.data=[])}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.labelFormatter=function(e,t){return arguments.length>1?(this._.options.labelFormatters[e]=t,this):this._.options.labelFormatters[e]},i.prototype.getX=function(e){var t,i,n;return i=this.data(),exports.isString(e)?(t=exports.find(i,(function(t){return t.y===e})),exports.defined(t)?t.x:void 0):(n=inefficientSearch(i,e,!0,(function(e){return e.y})),i[n].x)},i.prototype.getY=function(e,t){var i,n,r,o,a,s;return n=this.data(),exports.isString(e)?(i=exports.find(n,(function(t){return t.x===e})),exports.defined(i)?i.y:void 0):(r=inefficientSearch(n,e,!1,(function(e){return e.x})),0<=r&&r<n.length-1?(o=n[r].x,a=n[r+1].x,(s=n[r].y)+(n[r+1].y-s)*(e-o)/(a-o)):e>n[n.length-1].x?t?void 0:n[n.length-1].y:n[0].y)},i.prototype.getLabelDetails=function(e,t){},i.prototype.updateSvg=function(e){},i.prototype.legendColor=function(){},i}(EventEmitter);return e=function(e,t,i,n,r,o){return void 0===r&&(r="x"),void 0===o&&(o="y"),[{name:e.axis.x.title(),value:t[r+"Label"]||(i?i(t):t.x),formatter:e.labelFormatter(r)||e.axis.x.formatter()},{name:e.axis.y.title(),value:t[o+"Label"]||(n?n(t):t.y),formatter:e.labelFormatter(o)||e.axis.y.formatter()}]},t.prototype.title=optionSetterGetter$1("title"),t.prototype.data=optionSetterGetter$1("data"),t.prototype.labelsEnabled=optionSetterGetter$1("labelsEnabled"),t.prototype.labelRenderer=optionSetterGetter$1("labelRenderer"),t.prototype.labelInterpolated=optionSetterGetter$1("labelInterpolated"),t.prototype.labelValuesExtractor=optionSetterGetter$1("labelValuesExtractor"),t.prototype.class=optionSetterGetter$1("class"),t}.call(void 0),updatePath=function(e,t,i,n,r,o){return select(t).view(".hx-series-data","g").update((function(t){return this.class("hx-series-data hx-series-line "+e.class()).view(i,r).update(o).apply(t)})).apply(n)},exports.LineSeries=function(){var e,t,i=function(i){function n(e){i.call(this,exports.merge({strokeEnabled:!0,strokeColor:theme().plotColor1,fillEnabled:!1,fillColor:void 0,markersEnabled:!1,markerRadius:2,markerFillColor:void 0,sampleThreshold:200,group:void 0},e)),this._.type="line"}return i&&(n.__proto__=i),n.prototype=Object.create(i&&i.prototype),n.prototype.constructor=n,n.prototype.legendColor=function(){return this._.options.strokeColor},n.prototype.updateSvg=function(e,i){var n,r,o,a,s,l,c,u,d,h,p,f,g;if(f=this,o=this.axis,l=splitAndFeather(this.data(),this.sampleThreshold(),(function(e){return void 0!==e.y})),this._.featheredData=l,n=function(e,t){var i,n,r,a;for(a=[],n=0,r=e.length;n<r;n++)i=e[n],a.push({x:i.x,y:o.getYStack(f._.type,f.group(),i.x,f._.seriesId)+(t?0:i.y)});return a},this.fillEnabled()&&(Array.isArray(f.fillColor()||f.strokeColor())?(d=f.fillColor()||f.strokeColor().map((function(e){return{value:e.value,color:color(e.color).alpha(.1).toString("rgba")}})),h=createLinearGradient(e,d,f),c="url(#"+h+")"):c=f.fillColor()||color(f.strokeColor()).alpha(.1).toString(),Math.max(Math.min(this.axis.yScale.domainMax,0),this.axis.yScale.domainMin),u=function(){var e,t,i;for(i=[],e=0,t=l.length;e<t;e++)s=l[e],i.push(n(s).concat(n(s.slice(0).reverse(),!0)));return i}(),r=function(){var e,i,n;for(n=[],e=0,i=u.length;e<i;e++)s=u[e],n.push(svgCurve(t(s,this.axis),!0));return n}.call(this),updatePath(this,e,".hx-series-line-fill",r,"path",(function(e){return this.attr("d",e).attr("fill",c)}))),this.strokeEnabled()&&(a="discrete"!==this.axis.y.scaleType()?function(){var e,i,r;for(r=[],e=0,i=l.length;e<i;e++)s=l[e],r.push(svgCurve(t(n(s),this.axis)));return r}.call(this):function(){var e,i,n;for(n=[],e=0,i=l.length;e<i;e++)s=l[e],n.push(svgCurve(t(s,this.axis)));return n}.call(this),Array.isArray(this.strokeColor())?(h=createLinearGradient(i,this.strokeColor(),f),g="url(#"+h+")"):g=f.strokeColor(),updatePath(this,i,".hx-series-line-stroke",a,"path",(function(e){return this.attr("d",e).attr("stroke",g)}))),this.markersEnabled())return p="discrete"!==this.axis.y.scaleType()?n(exports.flatten(l)):exports.flatten(l),updatePath(this,i,".hx-series-line-markers",t(p,this.axis),"circle",(function(e){return this.attr("cx",e.x).attr("cy",e.y).attr("r",f.markerRadius()).attr("fill",f.markerFillColor()||f.strokeColor())}))},n.prototype.getLabelDetails=function(t,i){var n,r=this;return(n=createLabelPoint(this,t,i,e))?[makeLabelDetails(this,n,(function(e){return r.axis.getYStack(r._.type,r.group(),e.x,r._.seriesId)+e.y}))]:[]},n}(Series);return t=function(e,t){var i,n,r,o;for(o=[],n=0,r=e.length;n<r;n++)i=e[n],o.push({x:t.xScale.apply(i.x),y:t.yScale.apply(i.y)});return o},i.prototype.strokeEnabled=optionSetterGetter$1("strokeEnabled"),i.prototype.strokeColor=optionSetterGetter$1("strokeColor"),i.prototype.fillEnabled=optionSetterGetter$1("fillEnabled"),i.prototype.fillColor=optionSetterGetter$1("fillColor"),i.prototype.markersEnabled=optionSetterGetter$1("markersEnabled"),i.prototype.markerRadius=optionSetterGetter$1("markerRadius"),i.prototype.markerFillColor=optionSetterGetter$1("markerFillColor"),i.prototype.sampleThreshold=optionSetterGetter$1("sampleThreshold"),i.prototype.group=optionSetterGetter$1("group"),e=function(e,t,i,n){if(null!=t.y&&null!=i.y)return{x:e,y:n(t.y,i.y)}},i}.call(void 0),exports.BandSeries=function(){var e,t,i=function(i){function n(e){i.call(this,exports.merge({fillColor:color(theme().plotColor3).alpha(.2).toString(),sampleThreshold:200},e)),this._.type="band"}return i&&(n.__proto__=i),n.prototype=Object.create(i&&i.prototype),n.prototype.constructor=n,n.prototype.legendColor=function(){return this._.options.fillColor},n.prototype.updateSvg=function(e){var i,n,r,o,a,s,l;return l=this,this._.featheredData=splitAndFeather(this.data(),this.sampleThreshold(),(function(e){return void 0!==e.y1&&void 0!==e.y2})),i=function(){var e,i,r,o;for(o=[],e=0,i=(r=this._.featheredData).length;e<i;e++)n=r[e],s=n.map((function(e){return{x:e.x,y:e.y1}})).concat(n.slice(0).reverse().map((function(e){return{x:e.x,y:e.y2}}))),o.push(svgCurve(t(s,this.axis),!0));return o}.call(this),Array.isArray(l.fillColor())?(o=l.fillColor().map((function(e){return{value:e.value,color:e.color}})),a=createLinearGradient(e,o,this),r="url(#"+a+")"):r=l.fillColor(),select(e).view(".hx-series-data","path","hx-series-area").update((function(e){return this.attr("d",e).class("hx-series-data "+l.class()).attr("fill",r)})).apply(i)},n.prototype.getLabelDetails=function(t,i){var n;return(n=createLabelPoint(this,t,i,e))?[makeLabelDetails(this,n,(function(e){return e.y1}),"x","y1"),makeLabelDetails(this,n,(function(e){return e.y2}),"x","y2")]:[]},n}(Series);return t=function(e,t){var i,n,r,o;for(o=[],n=0,r=e.length;n<r;n++)i=e[n],o.push({x:t.xScale.apply(i.x),y:t.yScale.apply(i.y)});return o},i.prototype.fillColor=optionSetterGetter$1("fillColor"),i.prototype.sampleThreshold=optionSetterGetter$1("sampleThreshold"),e=function(e,t,i,n){if(null!=t.y1&&null!=i.y1&&null!=t.y2&&null!=i.y2)return{x:e,y1:n(t.y1,i.y1),y2:n(t.y2,i.y2)}},i}.call(void 0),exports.ScatterSeries=function(){var e,t,i=function(i){function n(e){i.call(this,exports.merge({fillColor:"",radius:2},e)),this._.type="scatter"}return i&&(n.__proto__=i),n.prototype=Object.create(i&&i.prototype),n.prototype.constructor=n,n.prototype.legendColor=function(){return this._.options.fillColor},n.prototype.updateSvg=function(i,n){var r;return r=this,select(n).view(".hx-series-data","circle").update((function(e){return this.class("hx-series-data hx-series-scatter "+r.class()).attr("cx",e.x).attr("cy",e.y).attr("r",Math.max(e.radius||r.radius(),0)).style("fill",e.fillColor||r.fillColor())})).apply(t(e(this.data()),this.axis))},n.prototype.getLabelDetails=function(t,i){var n,r,o,a,s,l,c;if(!this.labelsEnabled())return[];for(n=void 0,r=0,a=0,s=(l=e(this.data())).length;a<s;a++)o=l[a],c=(this.axis.xScale.apply(o.x)-t)*(this.axis.xScale.apply(o.x)-t)+(this.axis.yScale.apply(o.y)-i)*(this.axis.yScale.apply(o.y)-i),(void 0===n||c<r)&&(n=o,r=c);return n?[{series:this,title:this.title(),x:this.axis.xScale.apply(n.x),y:this.axis.yScale.apply(n.y),color:n.color||this.fillColor(),values:this.labelValuesExtractor()(this,n)}]:void 0},n}(Series);return e=function(e){return e.filter((function(e){return void 0!==e.x&&void 0!==e.y}))},t=function(e,t){var i,n,r,o;for(o=[],n=0,r=e.length;n<r;n++)i=e[n],o.push({x:t.xScale.apply(i.x),y:t.yScale.apply(i.y),radius:i.radius,fillColor:i.fillColor,color:i.color,size:i.size});return o},i.prototype.fillColor=optionSetterGetter$1("fillColor"),i.prototype.radius=optionSetterGetter$1("radius"),i}.call(void 0),exports.BarSeries=function(){var e=function(e){function t(t){e.call(this,exports.merge({fillColor:theme().plotColor2,group:void 0},t)),this._.type="bar"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.legendColor=function(){return this._.options.fillColor},t.prototype.updateSvg=function(e){var t,i;return i=this,t=this.axis,select(e).view(".hx-series-data","rect").update((function(e){var n,r,o,a;return"discrete"===t.x.scaleType()?(r=t.xScale.tickWidth()/i._.typeSize,o=t.xScale.apply(e.x)-r*i._.typeSize/2+i.groupId*r,n=Math.abs(t.yScale.apply(e.y)-t.yScale.apply(0)),a=t.yScale.apply(t.getYStack(i._.type,i.group(),e.x,i._.seriesId)),e.y>0&&(a-=n)):(r=Math.abs(t.xScale.apply(e.x)-t.xScale.apply(0)),o=t.xScale.apply(t.getXStack(i._.type,i.group(),e.y,i._.seriesId)),n=Math.abs(t.yScale.tickWidth()/i._.typeSize),a=t.yScale.apply(e.y)-n*i._.typeSize/2+i.groupId*n,e.y>0&&(a-=n)),this.class("hx-series-data hx-series-bar "+i.class()).attr("y",a).attr("x",o).attr("height",Math.max(n,0)).attr("width",Math.max(r,0)).style("fill",e.color||i.fillColor())})).apply(this.data())},t.prototype.getLabelDetails=function(e,t){var i,n,r,o,a,s,l,c,u;return this.labelsEnabled()?(c=this.axis.xScale.inverse(e),u=this.axis.yScale.inverse(t),(i=exports.find(this.data(),(function(e){return e.x===c})))?(l=this.axis.xScale.tickWidth()/this._.typeSize,n=this.axis.xScale.apply(i.x)-l*this._.typeSize/2+this.groupId*l,o=Math.abs(this.axis.yScale.apply(i.y)-this.axis.yScale.apply(0)),r=this.axis.yScale.apply(this.axis.getYStack(this._.type,this.group(),i.x,this._.seriesId)),i.y>0&&(r-=o),null!=c&&null!=u&&null!=i?(s=Math.min(r,this.axis.yScale.apply(0)),a=Math.max(r,r+o),u=exports.clamp(s,a,this.axis.yScale.apply(u)),[{series:this,title:this.title(),x:n+l/2,y:u,color:i.color||this.fillColor(),values:this.labelValuesExtractor()(this,i)}]):[]):[]):[]},t}(Series);return e.prototype.fillColor=optionSetterGetter$1("fillColor"),e.prototype.group=optionSetterGetter$1("group"),e}.call(void 0),exports.StraightLineSeries=function(){var e,t=function(t){function i(e){t.call(this,exports.merge({strokeColor:theme().plotColor5,data:{}},e)),this._.type="straight-line"}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.legendColor=function(){return this._.options.strokeColor},i.prototype.updateSvg=function(t,i){var n,r;if(n=e.call(this))return r=this,select(i).view(".hx-series-data","line").update((function(e){return this.class("hx-series-data hx-series-constant "+r.class()).attr("x1",r.axis.xScale.apply(e[0].x)).attr("y1",r.axis.yScale.apply(e[0].y)).attr("x2",r.axis.xScale.apply(e[1].x)).attr("y2",r.axis.yScale.apply(e[1].y)).attr("d",e).attr("stroke",r.strokeColor())})).apply([n])},i.prototype.getLabelDetails=function(e,t){var i,n,r,o,a;return i=this.data(),this.labelsEnabled()?(n=i.dx||0,r=i.dy||0,o=this.axis.xScale.inverse(e),a=this.axis.yScale.inverse(t),0!==n&&0!==r&&null!=i.x&&null!=i.y?a=i.y+(o-i.x)*r/n:null!=i.x?o=i.x:null!=i.y&&(a=i.y),this.axis.xScale.domainMin<o&&o<this.axis.xScale.domainMax&&this.axis.yScale.domainMin<a&&a<this.axis.yScale.domainMax?[{series:this,title:this.title(),x:this.axis.xScale.apply(o),y:this.axis.yScale.apply(a),color:this.strokeColor(),values:this.labelValuesExtractor()(this,{x:o,y:a})}]:[]):[]},i}(Series);return t.prototype.strokeColor=optionSetterGetter$1("strokeColor"),e=function(){var e,t,i,n,r,o,a,s,l,c,u,d,h,p,f,g,x,m,v;if(e=this.data(),o=e.dx||0,a=e.dy||0,0!==o&&0!==a&&null!=e.x&&null!=e.y)return m=e.x||0,v=e.y||0,t=this.axis.xScale.domainMin,i=this.axis.xScale.domainMax,n=this.axis.yScale.domainMin,r=this.axis.yScale.domainMax,h=(v-n)*o-a*(m-t),d=function(){switch(!1){case!(h>0):return{x:t,y:v+(t-m)/o*a};case 0!==h:return{x:t,y:n};case!(h<0):return{x:m+(n-v)/a*o,y:n}}}(),h=(v-r)*o-a*(m-i),[d,function(){switch(!1){case!(h<0):return{x:i,y:v+(i-m)/o*a};case 0!==h:return{x:i,y:r};case!(h>0):return{x:m+(r-v)/a*o,y:r}}}()];if(null!=e.x){for(g=[],s=0,c=(p=[this.axis.yScale.domainMin,this.axis.yScale.domainMax]).length;s<c;s++)v=p[s],g.push({x:e.x,y:v});return g}if(null!=e.y){for(x=[],l=0,u=(f=[this.axis.xScale.domainMin,this.axis.xScale.domainMax]).length;l<u;l++)m=f[l],x.push({x:m,y:e.y});return x}},t}.call(void 0),LinearScale=function(){function e(e,t,i,n){var r;void 0===e&&(e=0),void 0===t&&(t=10),void 0===i&&(i=0),void 0===n&&(n=10),this.domainMin=e,this.domainMax=t,this.rangeMin=i,this.rangeMax=n,r=this.domainMax-this.domainMin,this.factor=0!==r?(this.rangeMax-this.rangeMin)/r:1}return e.prototype.apply=function(e){return this.rangeMin+(e-this.domainMin)*this.factor},e.prototype.inverse=function(e){return this.domainMin+(e-this.rangeMin)/this.factor},e.prototype.domain=function(e,t){var i;return this.domainMin=e,this.domainMax=t,i=this.domainMax-this.domainMin,this.factor=0!==i?(this.rangeMax-this.rangeMin)/i:1,this},e.prototype.range=function(e,t){var i;return this.rangeMin=e,this.rangeMax=t,i=this.domainMax-this.domainMin,this.factor=0!==i?(this.rangeMax-this.rangeMin)/i:1,this},e.prototype.ticks=function(e){var t,i,n,r,o,a,s,l,c,u;switch(r=(i=this.domainMax-this.domainMin)/((u=Math.abs(this.rangeMax-this.rangeMin)/e)*(s=Math.pow(10,Math.floor(Math.log(i/u)/Math.LN10)))),!1){case!(r>=7.5):s*=10;break;case!(r>=3):s*=5;break;case!(r>=1.25):s*=2}for(n=Math.ceil(this.domainMin/s)*s,c=[],o=a=0,l=((Math.floor(this.domainMax/s)+.5)*s-n)/s;0<=l?a<l:a>l;o=0<=l?++a:--a)t=n+o*s,c.push([t,this.apply(t)]);return c},e}(),DiscreteScale=function(){function e(e){void 0===e&&(e=.1),this.bandPadding=e,this.domainCategories=[],this.rangeMin=0,this.rangeMax=10}return e.prototype.apply=function(e){var t;return-1!==(t=this.domainCategories.indexOf(e))?this.rangeMin+t/this.domainCategories.length*(this.rangeMax-this.rangeMin)+this.tickOffset()+this.tickWidth()/2:void 0},e.prototype.inverse=function(e){var t;return 0<=(t=Math.floor((e-this.tickOffset()-this.rangeMin)/(this.rangeMax-this.rangeMin)*this.domainCategories.length))&&t<this.domainCategories.length?this.domainCategories[t]:void 0},e.prototype.domain=function(e){return this.domainCategories=e,this},e.prototype.range=function(e,t){return this.rangeMin=e,this.rangeMax=t,this},e.prototype.ticks=function(e){var t,i,n,r,o;for(o=[],i=0,n=(r=this.domainCategories).length;i<n;i++)t=r[i],o.push([t,this.apply(t)]);return o},e.prototype.tickWidth=function(){return(this.rangeMax-this.rangeMin)/this.domainCategories.length*(1-this.bandPadding)},e.prototype.tickOffset=function(){return(this.rangeMax-this.rangeMin)/this.domainCategories.length*this.bandPadding/2},e}(),DateScale=function(e){function t(t,i,n,r){e.call(this),this.domainMin=t,this.domainMax=i,this.rangeMin=n,this.rangeMax=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ticks=function(e){var t,i,n,r,o,a,s,l,c,u,d,h,p,f,g;for(g=[1,2,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],r=this.domainMax-this.domainMin,t=function(e){var t,i,n;for(t=0,i=g.length;t<i;t++)if(e<=(n=g[t]))return n;return 1},p=Math.abs(this.rangeMax-this.rangeMin)/e,c=Math.pow(10,Math.floor(Math.log(r/p)/Math.LN10)),c*=(a=r/(p*c))>=7.5?10:a>=3?5:a>=2?3:a>=1.25?2:a>=1.025?1.5:1,o=Math.ceil(this.domainMin/c)*c,n=Math.floor(this.domainMax/c)*c,h=function(e,t){return t?Math.ceil(e/f)*f:Math.floor(e/f)*f},f=t(c),c=h(c,!0),(o=h(o))<this.domainMin&&(o+=c),d=[],s=l=0,u=(n-o)/c;0<=u?l<=u:l>=u;s=0<=u?++l:--l)i=o+s*c,d.push([i,this.apply(i)]);return d},t}(LinearScale);var dimension,supportsGroup,discreteToPos,posToDiscrete,posToValue,renderValues,slide,slideEnd,backgroundContext,defineComponent,directions,fixes,getComponentParent,headers,i$1,joints,len,ref,size,sizes,textContext,textLikeComponent,getPageItems,getRange,makeItem,makeRange,buildCalendar,buildDatepicker,calendarGridRowUpdate,calendarGridUpdate,getCalendarDecade,getCalendarMonth,getCalendarYear,isBetweenDates,isSelectable,isSelected,isToday,setupInput,toggleInputValidity,updateDatepicker,validateDates,createTableView,setupInput$1,setupTimepicker,updateTimePicker,onTabSelected,createChildren,createNodeView,createTreeNode,format$1,formatChildren,formatIcon,recurseUpTree,deprecatedWarning$1,hx_xhr,parsers,performRequest,respondToRequest,sendRequest,standardRequest,tickSize=6,labelOffset=10,axisPadding=4;function label(e){void 0===e&&(e={}),logger.deprecated("label","The label module has been replaced by the badge module");var t=e.context;return palette$1.context(span("hx-label"),t)}for(supportsGroup=function(e){return e instanceof exports.BarSeries||e instanceof exports.LineSeries},dimension=function(e,t){var i,n;return n=exports.merge({scaleType:"linear",visible:!0,formatter:exports.si,tickRotation:0,doCollisionDetection:!0,min:"auto",max:"auto",discretePadding:.1,discreteLabels:void 0,tickSpacing:50,title:null,scalePaddingMin:0,scalePaddingMax:0,ticksAll:!1,gridLines:!0,nthTickVisible:1,axisTickLabelPosition:"bottom",showTicks:!0},t),i=function(t){return function(i){return arguments.length>0?(n[t]=i,e):n[t]}},{doCollisionDetection:i("doCollisionDetection"),scaleType:i("scaleType"),visible:i("visible"),formatter:i("formatter"),tickRotation:i("tickRotation"),min:i("min"),max:i("max"),discretePadding:i("discretePadding"),discreteLabels:i("discreteLabels"),tickSpacing:i("tickSpacing"),title:i("title"),scalePaddingMin:i("scalePaddingMin"),scalePaddingMax:i("scalePaddingMax"),ticksAll:i("ticksAll"),gridLines:i("gridLines"),nthTickVisible:i("nthTickVisible"),axisTickLabelPosition:i("axisTickLabelPosition"),showTicks:i("showTicks"),axisSize:i("axisSize"),titleHeight:i("titleHeight")}},exports.Axis=function(){var e,t=function(e){var t,i=this;exports.merge({x:{axisTickLabelPosition:"bottom"},y:{axisTickLabelPosition:"left"}},e),this._={series:new List},this.x=dimension(this,exports.merge({axisTickLabelPosition:"bottom"},null!=e?e.x:void 0)),this.y=dimension(this,exports.merge({axisTickLabelPosition:"left"},null!=e?e.y:void 0)),this.xScale=new LinearScale(0,1,0,1),this.yScale=new LinearScale(0,1,0,1),this.graph=null,this.xAxisSize=50,this.xTitleHeight=0,this.yAxisSize=50,this.yTitleHeight=0,null!=e&&null!=(t=e.series)&&t.forEach((function(e){return i.addSeries(e.type,e.options)}))};return t.prototype.addSeries=function(e,t){return exports.isString(e)?(e=function(){switch(e){case"line":return new exports.LineSeries(t);case"band":return new exports.BandSeries(t);case"bar":return new exports.BarSeries(t);case"scatter":return new exports.ScatterSeries(t);case"straight-line":return new exports.StraightLineSeries(t);default:return void logger.warn(e+" is not a valid series type")}}(),this._.series.add(e),e.axis=this,e):e instanceof Series?(this._.series.add(e),e.axis=this,e):0===arguments.length?(e=new exports.LineSeries,this._.series.add(e),e.axis=this,e):void logger.warn(e+" is not a valid series type")},t.prototype.series=function(e){var t,i;if(arguments.length>0){for(this._.series=new List(e),t=0,i=e.length;t<i;t++)e[t].axis=this;return this}return this._.series.values()},t.prototype.removeSeries=function(e){if(this._.series.remove(e))return e.axis=void 0,e},t.prototype.setupAxisSvg=function(e){return select(e).append("g").class("hx-axis-grid"),select(e).append("g").class("hx-x-axis").append("g").class("hx-axis-scale"),select(e).append("g").class("hx-y-axis").append("g").class("hx-axis-scale")},t.prototype.tagSeries=function(){var e,t,i,n,r,o,a,s,l,c,u;for(e=function(e){var t,i,n,r,o,a,s,l,c,u,d,h,p,f,g,x,m,v;for(n=new Map,a=0,l=e.length;a<l;a++)m=e[a],i=supportsGroup(m)?m.group():void 0,n.has(i)||n.set(i,new List),n.get(i).add(m);for(o=0,v=n.size,v+=n.has(void 0)?n.get(void 0).size-1:0,s=0,c=(f=n.entries()).length;s<c;s++)if(void 0===(i=(t=f[s])[0]))for(r=h=0,u=(g=t[1].entries()).length;h<u;r=++h)(m=g[r]).groupId=o,o++,m._.seriesId=0,m.groupSize=1,m._.typeSize=v;else{for(r=p=0,d=(x=t[1].entries()).length;p<d;r=++p)(m=x[r]).groupId=o,m._.seriesId=r,m.groupSize=t[1].size,m._.typeSize=v;o++}return o},u=new Map,t=0,n=(o=this.series()).length;t<n;t++)l=o[t],u.has(l._.type)||u.set(l._.type,new List),u.get(l._.type).add(l);for(s=[],i=0,r=(a=u.entries()).length;i<r;i++)c=a[i],s.push(e(c[1].entries()));return s},t.prototype.preupdateXAxisSvg=function(t){var i,n,r,o,a,s,l,c,u,d,h,p,f,g,x,m,v=this;switch(d=this,this.x.scaleType()){case"linear":this.xScale=(new LinearScale).range(0,this.graph.width);break;case"discrete":this.xScale=new DiscreteScale(this.x.discretePadding()).range(0,this.graph.width);break;case"date":this.xScale=(new DateScale).range(0,this.graph.width)}return"discrete"===this.x.scaleType()?(s=function(){var e,t,i,n,r,a;if(this.x.discreteLabels())return this.x.discreteLabels();for(h=new Set,e=0,i=(r=this.series()).length;e<i;e++)for(t=0,n=(a=r[e].data()).length;t<n;t++)o=a[t],h.add(o.x);return h.values()}.call(this),this.xScale.domain(s)):(m=function(){var e,t,i,n;for(n=[],e=0,t=(i=this.series()).length;e<t;e++)(u=i[e])instanceof exports.StraightLineSeries?(a=u.data()).dx||a.dy||!a.x?n.push(void 0):n.push([a.x,a.x]):n.push(extent(u.data(),(function(e){return e.x})));return n}.call(this),m=m.filter(exports.identity),x=exports.min(m.map((function(e){return e[0]}))),g=exports.max(m.map((function(e){return e[1]}))),x="auto"===this.x.min()?x:this.x.min(),g="auto"===this.x.max()?g:this.x.max(),"auto"===this.x.min()&&(x=e(x,g-x,-this.x.scalePaddingMin())),"auto"===this.x.max()&&(g=e(g,g-x,this.x.scalePaddingMax())),p=x+(g-x)*this.graph.zoomRangeStart(),l=x+(g-x)*this.graph.zoomRangeEnd(),this.xScale.domain(p,l)),f=0,this.x.visible()?(r=select(t).select(".hx-x-axis"),n=this.x.tickRotation(),i=n/180*Math.PI,c=function(e){var t,i,n,r,a,s;if(d.x.ticksAll()){for(h=new Set,t=0,n=(a=v.series()).length;t<n;t++)for(i=0,r=(s=a[t].data()).length;i<r;i++)o=s[i],h.add(o.x);return h.values().map((function(t){return[t,e.apply(t)]}))}return e.ticks(d.x.tickSpacing())},r.select(".hx-axis-scale").view(".hx-axis-view","g").update((function(e){return this.view(".hx-tick","g").update((function(e){return this.view(".hx-tick-text-x","text").update((function(e){var t,r;return this.text(d.x.formatter()(e)),r=(t=this.node().getBBox()).height*Math.cos(i)+t.width*Math.sin(i),f=Math.max(f,r),0===i?this.attr("transform","translate("+-t.width/2+","+labelOffset+")").style("dominant-baseline","hanging"):this.attr("transform","translate(0,"+labelOffset+") rotate("+n+")")})).apply(e[0])})).apply(c(e))})).apply(this.xScale),this.x.title()&&(r.view(".hx-axis-title","text").update((function(e){return e.xTitleHeight=this.text(e.x.title()).height()})).apply(this),f+=this.xTitleHeight),f+=labelOffset+axisPadding):select(t).select(".hx-x-axis").remove(),this.xAxisSize=f},t.prototype.preupdateYAxisSvg=function(e,t){var i,n,r,o,a,s,l,c,u,d,h,p;switch(s=this,a=this.graph.height-t,this.y.scaleType()){case"linear":this.yScale=(new LinearScale).range(a,0);break;case"discrete":this.yScale=new DiscreteScale(this.y.discretePadding()).range(a,0);break;case"date":this.yScale=(new DateScale).range(a,0)}return"discrete"===this.y.scaleType()?(o=function(){var e,t,i,n,o,a;if(this.yDiscreteLabels)return this.yDiscreteLabels;for(l=new Set,e=0,i=(o=this.series()).length;e<i;e++)for(t=0,n=(a=o[e].data()).length;t<n;t++)r=a[t],l.add(r.y);return l.values()}.call(this),this.yScale.domain(o)):(d=this.y.min(),u=this.y.max(),p=(i=this.calculateYBounds(d,u)).ymin,h=i.ymax,this.yScale.domain(p,h)),c=0,this.y.visible()?((n=select(e).select(".hx-y-axis")).select(".hx-axis-scale").view(".hx-axis-view","g").update((function(e){return this.view(".hx-tick","g").update((function(e){return this.view(".hx-tick-text-y","text").update((function(e){var t;if((t=this.text(s.y.formatter()(e)).attr("x",-labelOffset).width())>c)return c=t})).apply(e[0])})).apply(e.ticks(s.y.tickSpacing()))})).apply(this.yScale),this.y.title()&&(n.view(".hx-axis-title","text").update((function(e){return e.yTitleHeight=this.text(e.y.title()).attr("transform","rotate(90)").width()})).apply(this),c+=this.yTitleHeight),c+=labelOffset+axisPadding):select(e).select(".hx-y-axis").remove(),this.yAxisSize=c},t.prototype.updateAxisSvg=function(e,t,i,n,r){var o,a,s,l,c,u,d,h,p,f,g,x;switch(p=this,f=this.graph.width,u=this.graph.height,this.x.scaleType()){case"linear":case"date":case"discrete":this.xScale.range(n,f)}switch(this.y.scaleType()){case"linear":case"date":case"discrete":this.yScale.range(u-r,0)}return c=select(e).select(".hx-axis-grid"),this.x.visible()?(this.x.gridLines()&&c.view(".hx-vertical-grid-line","line").update((function(e){return this.attr("x1",e[1]).attr("x2",e[1]).attr("y1",p.yScale.rangeMax).attr("y2",p.yScale.rangeMin)})).apply(this.xScale.ticks(p.x.tickSpacing())),o=select(e).select(".hx-x-axis"),x=this.yScale.apply(0),isNaN(x)||"discrete"===this.y.scaleType()?(l=u-i-this.xAxisSize,h=u-i-this.xAxisSize):(l=Math.min(u-i-this.xAxisSize,x),h="axis"===this.x.axisTickLabelPosition()?Math.min(u-i-this.xAxisSize,x):u-i-this.xAxisSize),a=function(e){var t;if(this.view(".hx-axis-line","line").update((function(e){return this.attr("x1",e.rangeMin).attr("x2",e.rangeMax),this.attr("y1",l).attr("y2",l)})).apply(e),this.view(".hx-tick","g").update((function(e,t,i){return this.attr("transform","translate("+e[1]+","+h+")"),this.view(".hx-tick-line","line").update((function(e){return this.attr("y1",0).attr("y2",tickSize)})).apply(this),this.view(".hx-tick-text-x","text").update((function(e){return this.text(i%p.x.nthTickVisible()==0?p.x.formatter()(e):"")})).apply(e[0])})).apply(p.x.showTicks()?e.ticks(p.x.tickSpacing()):[]),p.x.showTicks()&&p.x.doCollisionDetection()&&(t=this.selectAll(".hx-tick-text-x").filter((function(e){return e.text()})).nodes).length)return doCollisionDetection(t)},o.select(".hx-axis-scale").view(".hx-axis-view","g").update(a).apply(this.xScale),this.x.title()&&o.view(".hx-axis-title","text").update((function(e){var t,i;return t=(f+n)/2,i=h+e.xAxisSize-e.xTitleHeight/2-axisPadding/2,this.attr("transform","translate("+t+", "+i+")").text(p.x.title())})).apply(this)):select(e).select(".hx-x-axis").remove(),this.y.visible()?(this.y.gridLines()&&c.view(".hx-horizontal-grid-line","line").update((function(e){return this.attr("y1",e[1]).attr("y2",e[1]).attr("x1",p.xScale.rangeMax).attr("x2",p.xScale.rangeMin)})).apply(this.yScale.ticks(p.y.tickSpacing())),o=select(e).select(".hx-y-axis"),g=this.xScale.apply(0),isNaN(g)||"discrete"===this.x.scaleType()?(s=t+this.yAxisSize,d=t+this.yAxisSize):(s=Math.max(t+this.yAxisSize,g),d="axis"===this.y.axisTickLabelPosition()?Math.max(t+this.yAxisSize,g):t+this.yAxisSize),o.select(".hx-axis-scale").view(".hx-axis-view","g").update((function(e){return this.view(".hx-axis-line","line").update((function(e){return this.attr("y1",e.rangeMin).attr("y2",e.rangeMax).attr("x1",s).attr("x2",s)})).apply(e),this.view(".hx-tick","g").update((function(e,t,i){return this.attr("transform","translate("+d+","+e[1]+")"),this.view(".hx-tick-line","line").update((function(e){return this.attr("x1",-tickSize).attr("x2",0)})).apply(this),this.view(".hx-tick-text-y","text").update((function(e){return this.attr("x",-labelOffset).text(i%p.y.nthTickVisible()==0?p.y.formatter()(e):"")})).apply(e[0])})).apply(p.y.showTicks()?e.ticks(p.y.tickSpacing()):[])})).apply(this.yScale),this.y.title()?o.view(".hx-axis-title","text").update((function(e){var t,i;return t=d-e.yAxisSize+e.yTitleHeight/2+axisPadding/2,i=(u-r)/2,this.attr("transform","translate("+t+", "+i+") rotate(-90)").text(p.y.title())})).apply(this):void 0):select(e).select(".hx-y-axis").remove()},t.prototype.updateDataSvg=function(e,t){var i,n,r,o,a,s,l,c;for(i=[],c=[],select(e).view(".hx-series","g").update((function(e,t){return i.push(t)})).apply(this.series()),select(t).view(".hx-series","g").update((function(e,t){return c.push(t)})).apply(this.series()),s=[],n=r=0,o=(a=this.series()).length;r<o;n=++r)l=a[n],s.push(l.updateSvg(i[n],c[n]));return s},t.prototype.getLabelDetails=function(e,t){return exports.flatten(this.series().map((function(i){return i.getLabelDetails(e,t)}))).filter((function(e){return e}))},t.prototype.getXStack=function(e,t,i,n,r){var o,a,s,l,c,u,d;if(void 0===r&&(r=0),t){for(u=Math.max(this.xScale.domainMin,0),o=a=0,s=(l=this.series()).length;a<s;o=++a)(c=l[o])._.seriesId<n&&c.group()===t&&c._.type===e&&(d=c.getX(i),exports.defined(d)&&(u+=d));return u}return Math.max(r,0)},t.prototype.getYStack=function(e,t,i,n,r){var o,a,s,l,c;return void 0===r&&(r=0),o=this.series(),s=this.x.scaleType(),l=this.yScale.domainMin,t?(c=Math.max(l,0),a=o.map((function(r){if(r._.seriesId<n&&r.group()===t&&r._.type===e)return r.getY(i,"discrete"===s)})),c+exports.sum(a.filter(exports.identity))):Math.max(r,0)},t.prototype.calculateYBounds=function(t,i){var n,r,o,a,s,l,c,u,d;return"auto"===i||"auto"===t?(r=this.series(),c=this.x.scaleType(),o={ymin:0,ymax:0},s=exports.groupBy(r,(function(e){return e._.type})).map((function(e){var t=e[0],i=e[1];return{type:t,group:exports.groupBy(i,(function(e){return supportsGroup(e)?e.group():void 0}))}})),l=function(e){return function(e,t){var i,n,o,a,s,l,u,d=e.ymin,h=e.ymax,p=t[0],f=t[1];return i=void 0===p?(s=(o=r.map((function(e){var t;return t=e.data(),e instanceof exports.StraightLineSeries?t.dx||t.dy||!t.y?void 0:[t.y,t.y]:e instanceof exports.BandSeries?extent(t,(function(e){return e.y1}),(function(e){return e.y2})):extent(t,(function(e){return e.y}))}))).filter((function(e){return null!=e})),{yymin:exports.min(s.map((function(e){return e[0]}))),yymax:exports.max(s.map((function(e){return e[1]})))}):(n=exports.unique(exports.flatten(f.map((function(e){return e.data().map((function(e){return e.x}))})))),a=n.map((function(e){return o=f.map((function(t){return t.getY(e,"discrete"===c)})),exports.sum(o.filter(exports.identity))})),{yymin:exports.min(a),yymax:exports.max(a)}),u=i.yymin,l=i.yymax,{ymin:Math.min(d,u),ymax:Math.max(h,l)}}},a=function(e,t){t.type;var i,n=t.group;return i=l(),n.reduce(i,e)},d=(n=s.reduce(a,o)).ymin,u=n.ymax,{ymin:"auto"===t?e(d,u-d,-this.y.scalePaddingMin()):t,ymax:"auto"===i?e(u,u-d,this.y.scalePaddingMax()):i}):{ymin:t,ymax:i}},e=function(e,t,i){return e+(t||1)*i},t}.call(void 0),exports.userFacingText({plot:{noData:"No Data"}}),exports.Graph=function(){var e,t,i,n=function(n){function r(r,o){var a,s,l,c,u,d,h,p,f,g,x=this;n.call(this),this.selector=r,this._={options:exports.shallowMerge({zoomRangeStart:0,zoomRangeEnd:1,labelsEnabled:!0,legendsEnabled:!1,legendLocation:"auto",noDataText:exports.userFacingText("plot","noData"),redrawOnResize:!0},o),axes:new List},l=exports.randomId(),(h=select(this.selector).api("graph",this).api(this)).on("resize","hx.plot",(function(){if(x._.options.redrawOnResize)return x.render()})),this.svgTarget=h.append("svg").attr("class","hx-graph"),s=this.svgTarget.append("defs"),this.axesTarget=this.svgTarget.append("g").attr("class","hx-axes"),this.plotTarget=this.svgTarget.append("g").attr("class","hx-plot"),a=s.append("clipPath").attr("id","clip-series-"+l),this.clipRect=a.append("rect"),this.plotTarget.attr("clip-path","url(#clip-series-"+l+")"),f=0,g=0,d=0,u=1,this.svgTarget.on("pointerdown","hx.plot",(function(e){var t,n;if(t=Math.round(e.x-x.svgTarget.box().left),n=Math.round(e.y-x.svgTarget.box().top),i(x,t,n),e.event.targetTouches&&e.event.targetTouches.length>1)return e.event.preventDefault(),e.event.stopPropagation(),f=e.event.targetTouches[0].clientX-x.svgTarget.box().left-x.plotArea.x1,g=e.event.targetTouches[1].clientX-x.svgTarget.box().left-x.plotArea.x1,d=x.zoomRangeStart(),u=x.zoomRangeEnd()})),p=.01,this.svgTarget.on("touchmove","hx.plot",(function(e){var t,i,n,r,o,a,s;if(e.targetTouches.length>1&&x.zoomEnabled())return e.preventDefault(),e.stopPropagation(),n=x.plotArea.x2-x.plotArea.x1,r=e.targetTouches[0].clientX-x.svgTarget.box().left-x.plotArea.x1,o=e.targetTouches[1].clientX-x.svgTarget.box().left-x.plotArea.x1,a=d+(u-d)*((f+g)/(2*n)),s=Math.abs(f-g)/Math.abs(r-o),i=d-a,t=u-a,1===x.zoomRangeEnd&&i>-p&&(i=-p),0===x.zoomRangeStart()&&t<p&&(t=p),x.zoomRangeStart(exports.clampUnit(a+s*i)),x.zoomRangeEnd(exports.clampUnit(a+s*t)),x.emit("zoom",{start:x.zoomRangeStart(),end:x.zoomRangeEnd()}),x.render()})),this.svgTarget.on("mousemove","hx.plot",(function(e){var t,n,r;if(n=Math.round(e.clientX-x.svgTarget.box().left),r=Math.round(e.clientY-x.svgTarget.box().top),x.labelsEnabled()&&i(x,n,r),x.legendEnabled()&&(t=x.svgTarget.select(".hx-legend-container"),"hover"===x.legendLocation()&&t.style("display",""),"auto"===x.legendLocation()||"hover"===x.legendLocation()))return n-x.plotArea.x1<(x.plotArea.x1+x.plotArea.x2)/2?t.attr("transform","translate("+(x.plotArea.x2-10-t.width())+","+(x.plotArea.y1+10)+")"):t.attr("transform","translate("+(x.plotArea.x1+10)+","+(x.plotArea.y1+10)+")")})),this.svgTarget.on("mouseleave","hx.plot",(function(){if(x.legendEnabled()&&"hover"===x.legendLocation())return x.svgTarget.select(".hx-legend-container").style("display","none")})),this.svgTarget.on("pointerleave","hx.plot",(function(t){return e()})),this.svgTarget.on("click","hx.plot",(function(e){var i,n,r,o;if(r=Math.round(e.x-x.svgTarget.box().left),o=Math.round(e.y-x.svgTarget.box().top),n=t(x,r,o))return i={event:e,data:n.values,series:n.series},x.emit("click",i),n.series.emit("click",i)})),this.svgTarget.on("wheel","hx.plot",(function(e){var t,i,n,r,o,a,s,l,c;if(x.zoomEnabled())return e.preventDefault(),e.stopPropagation(),p=.01,t=-e.deltaY,1===e.deltaMode&&(t*=20),c=x.zoomRangeStart(),l=x.zoomRangeEnd(),o=e.clientX-x.svgTarget.box().left-x.plotArea.x1,r=x.plotArea.x2-x.plotArea.x1,s=1-t/600,n=c-(a=c+(l-c)*exports.clampUnit(o/r)),i=l-a,1===l&&n>-p&&(n=-p),0===c&&i<p&&(i=p),x.zoomRangeStart(exports.clampUnit(a+s*n)),x.zoomRangeEnd(exports.clampUnit(a+s*i)),x.emit("zoom",{start:x.zoomRangeStart(),end:x.zoomRangeEnd()}),x.render()})),null!=o&&null!=(c=o.axes)&&c.forEach((function(e){return x.addAxis(e)}))}return n&&(r.__proto__=n),r.prototype=Object.create(n&&n.prototype),r.prototype.constructor=r,r.prototype.axes=function(e){return arguments.length>0?(this._.axes=new List(e),this.axes().forEach((function(e){return e.graph=this})),this):this._.axes.values()},r.prototype.addAxis=function(e){var t;return(t=e instanceof exports.Axis?e:new exports.Axis(e)).graph=this,this._.axes.add(t),t},r.prototype.removeAxis=function(e){if(this._.axes.remove(e))return e.graph=null,e},r.prototype.render=function(){var e,t,i,n,r,o,a,s,l,c,u;if(o=select(this.selector),this.width=Number(o.width()),this.height=Number(o.height()),t=this.axes().some((function(e){return e.series().some((function(e){var t;return t=e.data(),exports.isObject(t)||t.length>0}))})),a=this,this.svgTarget.view(".hx-plot-no-data","text").update((function(){return this.text(a._.options.noDataText).attr("x",a.width/2).attr("y",a.height/2)})).apply(t?[]:[!0]),this.axes().forEach((function(e){return e.tagSeries()})),e=function(e){var t;return t=this.append("g").class("hx-axis").node(),e.setupAxisSvg(t),t},s=0,this.axesTarget.view(".hx-axis","g").enter(e).update((function(e,t){return e.preupdateXAxisSvg(t),s+=e.xAxisSize})).apply(this.axes()),l=0,this.axesTarget.view(".hx-axis","g").enter(e).update((function(e,t){return e.preupdateYAxisSvg(t,s),l+=e.yAxisSize})).apply(this.axes()),c=0,u=0,this.axesTarget.view(".hx-axis","g").enter(e).update((function(e,t){return e.updateAxisSvg(t,u,c,l,s),c+=e.xAxisSize,u+=e.yAxisSize})).apply(this.axes()),this.plotArea={x1:u,y1:0,x2:this.width,y2:this.height-c},!(this.plotArea.x2-this.plotArea.x1<=0||this.plotArea.y2-this.plotArea.y1<=0)){if(this.plotTarget.view(".hx-axis-data","g").enter((function(){var e;return(e=this.append("g").class("hx-axis-data")).append("g").class("hx-graph-fill-layer"),e.append("g").class("hx-graph-sparse-layer"),e.node()})).update((function(e,t){return e.updateDataSvg(this.select(".hx-graph-fill-layer").node(),this.select(".hx-graph-sparse-layer").node())})).apply(this.axes()),this.legendEnabled())switch(0===(i=this.svgTarget.select(".hx-legend-container")).size()&&(i=this.svgTarget.append("g").class("hx-legend-container")),populateLegendSeries(i,exports.flatten(this.axes().map((function(e){return e.series()})))),this.legendLocation()){case"top-left":i.attr("transform","translate("+(this.plotArea.x1+10)+","+(this.plotArea.y1+10)+")");break;case"bottom-right":n=this.plotArea.x2-10-i.width(),r=this.plotArea.y2-5-i.height(),i.attr("transform","translate("+n+","+r+")");break;case"bottom-left":i.attr("transform","translate("+(this.plotArea.x1+10)+","+(this.plotArea.y2-5-i.height())+")");break;case"hover":i.style("display","none");break;default:i.attr("transform","translate("+(this.plotArea.x2-10-i.width())+","+(this.plotArea.y1+10)+")")}else this.svgTarget.select(".hx-legend-container").remove();return this.clipRect.attr("x",this.plotArea.x1).attr("y",this.plotArea.y1).attr("width",this.plotArea.x2-this.plotArea.x1).attr("height",this.plotArea.y2-this.plotArea.y1),this.emit("render"),this}},r}(EventEmitter);return n.prototype.zoomRangeStart=optionSetterGetter$1("zoomRangeStart"),n.prototype.zoomRangeEnd=optionSetterGetter$1("zoomRangeEnd"),n.prototype.zoomEnabled=optionSetterGetter$1("zoomEnabled"),n.prototype.labelsEnabled=optionSetterGetter$1("labelsEnabled"),n.prototype.legendEnabled=optionSetterGetter$1("legendEnabled"),n.prototype.legendLocation=optionSetterGetter$1("legendLocation"),n.prototype.redrawOnResize=optionSetterGetter$1("redrawOnResize"),t=function(e,t,i){var n,r,o,a,s,l,c,u,d;for(t=exports.clamp(e.plotArea.x1,e.plotArea.x2,t),i=exports.clamp(e.plotArea.y1,e.plotArea.y2,i),l=(l=exports.flatten(e.axes().map((function(e){return e.getLabelDetails(t,i)})))).filter((function(t){var i,n;return e.plotArea.x1<=(i=t.x)&&i<=e.plotArea.x2&&e.plotArea.y1<=(n=t.y)&&n<=e.plotArea.y2})),r=void 0,n=void 0,a=0,c=l.length;a<c;a++)o=(u=(s=l[a]).x-t)*u+(d=s.y-i)*d,(void 0===n||o<n)&&(r=s,n=o);return r},e=function(){return select("body").select(".hx-plot-label-container").clear()},i=function(e,i,n){var r,o;return o=function(t,i){return select(i).style("left",Math.round(window.pageXOffset+e.svgTarget.box().left+t.x)+"px").style("top",Math.round(window.pageYOffset+e.svgTarget.box().top+t.y)+"px"),t.series.labelRenderer()(i,t)},r=t(e,i,n),select("body").select(".hx-plot-label-container").empty()&&select("body").append("div").class("hx-plot-label-container"),select("body").select(".hx-plot-label-container").view(".hx-plot-label","div").update(o).apply(r?boundLabel(r,e):[])},n}.call(void 0),exports.graph=function(e){var t;return t=div(),exports.graph=new exports.Graph(t,e),t},exports.PieChart=function(){var e,t,i,n,r,o,a,s=function(r){function s(e,o){var a=this;r.call(this),this.selector=e,select(this.selector).classed("hx-pie-chart",!0).on("resize","hx.plot",(function(){return a.render()})).api("pie-chart",this).api(this),this._={options:exports.merge({segmentPadding:0,innerPadding:0,ringPadding:.1,totalAngle:2*Math.PI,startAngle:0,fillColor:theme().plotColor1,labelsEnabled:!0,labelRenderer:exports.plotLabelStandard,labelValuesExtractor:i,labelFormatter:t,segmentTextEnabled:!1,segmentTextFormatter:n,legendEnabled:!1,legendLocation:"auto"},o)}}return r&&(s.__proto__=r),s.prototype=Object.create(r&&r.prototype),s.prototype.constructor=s,s.prototype.render=function(){var t,i,n,r,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S,k,T,A;for(v=this,m=select(this.selector),A=m.width(),c=m.height(),p=Math.min(A,c)/2,this.circle={x:A/2,y:c/2,r:p},y=this.startAngle(),b=this.totalAngle(),t=Math.PI;y<0;)y+=2*t;if(!1==!(b===t&&y%(t/2)==0)){switch(!1){case!(0===y||y%(2*t)==0||y%t==0):p=exports.clamp(0,c/2,2*p);break;case!(y%(1.5*t)==0||y%(t/2)==0):p=exports.clamp(0,A/2,2*p)}switch(!1){case!(0===y||y%(2*t)==0):r=-p/2,s=0;break;case y%(1.5*t)!=0:r=0,s=p/2;break;case y%t!=0:r=p/2,s=0;break;case y%(t/2)!=0:r=0,s=-p/2;break;default:r=0,s=0}this.circle.x+=r,this.circle.y+=s,this.circle.r=p}if(n=this.data(),Array.isArray(n)||(n=[n]),i=p*(1-this.innerPadding())/n.length+p*(1-this.innerPadding())/n.length*this.ringPadding()/n.length,x=i*this.segmentPadding(),u=p*this.innerPadding(),g=(f=p-u)/n.length+f/n.length*this.ringPadding()/n.length,k=function(e,t,i,n,r,o,a){var s,l,c,d,h,p;return d=(h=v.startAngle()+1.5*Math.PI)+n/r*v.totalAngle(),c=h+(n+t)/r*v.totalAngle(),s=(p=0===o&&0===u)?Math.max(u+g*o,arcCurveMinimumRadius(d,c,x)):Math.max(u+g*o,a),l=arcCurve(v.circle.x,v.circle.y,s,u+g*(o+1-v.ringPadding()),d,c,x,p),e.attr("d",l).attr("fill",i)},S=function(t,i,n){var r,a,s,l,c,u,d,h,p,f,g,m,y,b;for(f=t.segments,r=e(f),b=r.total,s=r.allZero,h=0,d=0,c=0,u=f.length;c<u;c++)p=f[c],g=o(p,b,s),m=(y=v.startAngle()+1.5*Math.PI)+h/b*v.totalAngle(),l=y+(h+g)/b*v.totalAngle(),d=Math.max(arcCurveMinimumRadius(m,l,x),d);return a=e(f),b=a.total,s=a.allZero,h=0,this.view(".hx-pie-segment","path").update((function(e){return g=o(e,b,s),k(this,g,e.fillColor,h,b,n,d),h+=g})).apply(f)},h=function(e,t,i,n,r){var o,a,s;return a=(s=v.startAngle()+1.5*Math.PI)+t/i*v.totalAngle(),o=s+(t+e)/i*v.totalAngle(),{x:v.circle.x+Math.cos((a+o)/2)*(u+(n+.5)*g),y:v.circle.y+Math.sin((a+o)/2)*(u+(n+.5)*g)}},T=function(t,i,n){var r,a,s,l,c;return l=t.segments,s=0,r=e(l),c=r.total,a=r.allZero,this.view(".hx-pie-segment-text","text").update((function(e){var t,i,r,u;return i=o(e,c,a),r=(t=h(i,s,c,n,l.length)).x,u=t.y,this.text(v.segmentTextFormatter()(e,l)).attr("x",r).attr("y",u),s+=i})).apply(l)},l=function(e){return v.svgTarget=this.append("svg").class("hx-graph"),v.plotTarget=v.svgTarget.append("g").class("hx-plot"),v.svgTarget.append("g").class("hx-label"),v.svgTarget.on("pointermove","hx.plot",(function(e){var t,i,n;if(i=Math.round(e.x-m.box().left),n=Math.round(e.y-m.box().top),v.labelsEnabled()&&a(v,i,n),v.legendEnabled()&&(t=v.svgTarget.select(".hx-legend-container"),"hover"===v.legendLocation()&&t.style("display",""),"auto"===v.legendLocation()||"hover"===v.legendLocation()))return A=v.svgTarget.width(),c=v.svgTarget.height(),i<A/2?t.attr("transform","translate("+(A-10-t.width())+", 10)"):t.attr("transform","translate(10, 10)")})),v.svgTarget.on("pointerleave","hx.plot",(function(){if(v.legendEnabled()&&"hover"===v.legendLocation())return v.svgTarget.select(".hx-legend-container").style("display","none")})),v.svgTarget.on("click","hx.plot",(function(e){if(null!=v.closestMeta)return v.emit("click",{event:e,data:v.closestMeta.values,series:v.closestMeta.series})})),v.svgTarget.node()},w=function(e){return n=e.data(),Array.isArray(n)||(n=[n]),this.select(".hx-plot").view(".hx-pie-ring","g").update(S).apply(n),this.select(".hx-plot").view(".hx-pie-text","g").update(T).apply(v.segmentTextEnabled()?n:[])},m.view(".hx-graph","svg").enter(l).update(w).apply(this),Number(this.svgTarget.style("width").slice(0,-2)),Number(this.svgTarget.style("height").slice(0,-2)),!this.legendEnabled())return this.svgTarget.select(".hx-legend-container").remove();switch(0===(d=this.svgTarget.select(".hx-legend-container")).size()&&(d=this.svgTarget.append("g").class("hx-legend-container")),n=this.data(),Array.isArray(n)||(n=[n]),populateLegendSeries(d,exports.flatten(n.map((function(e){return e.segments})))),this.legendLocation()){case"top-left":return d.attr("transform","translate(10, 10)");case"bottom-right":return d.attr("transform","translate("+(A-10-d.width())+","+(c-5-d.height())+")");case"bottom-left":return d.attr("transform","translate(10, "+(c-5-d.height())+")");case"hover":return d.style("display","none");default:return d.attr("transform","translate("+(A-10-d.width())+", 10)")}},s}(EventEmitter);return i=function(e,t,i){return[{name:e.name,value:e.size,formatter:i.labelFormatter()}]},n=function(e,t){return e.size/exports.sum(t.map((function(e){return e.size})))>.05?e.size:""},t=exports.si,s.prototype.labelsEnabled=optionSetterGetter$1("labelsEnabled"),s.prototype.legendEnabled=optionSetterGetter$1("legendEnabled"),s.prototype.legendLocation=optionSetterGetter$1("legendLocation"),s.prototype.fillColor=optionSetterGetter$1("fillColor"),s.prototype.segmentTextEnabled=optionSetterGetter$1("segmentTextEnabled"),s.prototype.segmentTextFormatter=optionSetterGetter$1("segmentTextFormatter"),s.prototype.labelValuesExtractor=optionSetterGetter$1("labelValuesExtractor"),s.prototype.labelFormatter=optionSetterGetter$1("labelFormatter"),s.prototype.labelRenderer=optionSetterGetter$1("labelRenderer"),s.prototype.segmentPadding=optionSetterGetter$1("segmentPadding"),s.prototype.innerPadding=optionSetterGetter$1("innerPadding"),s.prototype.ringPadding=optionSetterGetter$1("ringPadding"),s.prototype.totalAngle=optionSetterGetter$1("totalAngle"),s.prototype.startAngle=optionSetterGetter$1("startAngle"),s.prototype.data=optionSetterGetter$1("data"),e=function(e){var t,i;return t=!1,{total:0===(i=exports.sum(e.map((function(e){return e.size}))))?(t=!0,e.length):exports.sum(e.map((function(e){return o(e,i)}))),allZero:t}},o=function(e,t,i){return i?1:e.size>0?e.size:t/100},r=function(t,i,n){var r,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S,k,T,A,C,_,M,P,E,D,z,L,F,I,O;if(f=t.data(),Array.isArray(f)||(f=[f]),O=(D=select(t.selector)).width(),x=D.height(),((T=t.circle.r)*(1-t.innerPadding())/t.data.length+T*(1-t.innerPadding())/f.length*t.ringPadding()/f.length)*t.segmentPadding(),k=T,M=(A=T-(m=T*t.innerPadding()))/f.length+A/f.length*t.ringPadding()/f.length,h=t.circle.x,p=t.circle.y,!((T=Math.sqrt((i-h)*(i-h)+(n-p)*(n-p)))<m||T>k)){for(_=f[I=exports.clamp(0,f.length-1,Math.floor((T+t.ringPadding()*M/2-m)/M))],(c=Math.atan2(n-p,i-h)+.5*Math.PI-t.startAngle())<0&&(c+=2*Math.PI),u=void 0,P=0,F=(r=e(_.segments)).total,l=r.allZero,v=0,S=(C=_.segments).length;v<S;v++){if(E=C[v],z=o(E,F,l),a=P/F*t.totalAngle(),s=(P+z)/F*t.totalAngle(),L=Math.min(a,s),g=Math.max(a,s),L<c&&c<g){u=E,d=(g-L)/2+L-Math.PI/2+t.startAngle();break}P+=z}return u?(b=h+(y=M*I+A/f.length/2+m)*Math.cos(d),w=p+y*Math.sin(d),{series:_,title:_.title,color:u.fillColor||t.fillColor(),x:b,y:w,bounding:{x1:0,x2:O,y1:0,y2:x},values:t.labelValuesExtractor()(u,_,t)}):void 0}},a=function(e,t,i){var n,o;return o=function(t,i){return select(i).style("left",Math.round(window.pageXOffset+e.svgTarget.box().left+t.x)+"px").style("top",Math.round(window.pageYOffset+e.svgTarget.box().top+t.y)+"px"),e.labelRenderer()(i,t)},n=r(e,t,i),select("body").select(".hx-plot-label-container").empty()&&select("body").append("div").class("hx-plot-label-container"),select("body").select(".hx-plot-label-container").view(".hx-plot-label","div").update(o).apply(n||[])},s}.call(void 0),exports.pieChart=function(e){var t;return t=div(),new exports.PieChart(t.node(),e),t},exports.Sparkline=function(){var e=function(e,t){var i,n,r,o,a;if(o=exports.mergeDefined({strokeColor:theme().plotColor1,data:[],type:"line",min:void 0,max:void 0,labelRenderer:function(e,t){return select(e).text(t.y+" ("+t.x+")")},redrawOnResize:!0},t),r=function(e,t){var i,n,r,a,s,l,c;return r=div("hx-plot-label-marker").style("background",t.color),l=t.values[0],c=t.values[1],a=(t.bounding.x1+t.bounding.x2)/2,s=(t.bounding.y1+t.bounding.y2)/2,n=div().node(),o.labelRenderer(n,{x:l.value,y:c.value}),i=div("hx-plot-label-details-basic").classed("hx-plot-label-details-left",t.x>=a).classed("hx-plot-label-details-bottom",t.y>=s).add(span("hx-plot-label-sparkline-x").add(n)),select(e).clear().add(r).add(i)},select(e).classed("hx-sparkline",!0).api(this),n=new exports.Graph(e,{redrawOnResize:o.redrawOnResize}),"bar"!==o.type&&"line"!==o.type)return logger.warn('options.type can only be "line" or "bar", you supplied "'+o.type+'"'),void(this.render=function(){return n.render()});i={x:{scaleType:"bar"===o.type?"discrete":"linear",visible:!1},y:{visible:!1,scalePaddingMin:.1,scalePaddingMax:.1}},null!=o.min&&(i.y.min=o.min),null!=o.max&&(i.y.max=o.max),a=n.addAxis(i).addSeries(o.type,{fillEnabled:!0,labelRenderer:r}),this._={options:o,graph:n,series:a}};return e.prototype.redrawOnResize=function(e){return this._.graph.redrawOnResize(e),optionSetterGetter$1("redrawOnResize").apply(this,arguments)},e.prototype.render=function(){return this._.series.data(this.data()),null!=this.fillColor()&&this._.series.fillColor(this.fillColor()),"line"===this._.options.type&&this._.series.strokeColor(this.strokeColor()),this._.graph.render()},e.prototype.data=optionSetterGetter$1("data"),e.prototype.fillColor=optionSetterGetter$1("fillColor"),e.prototype.strokeColor=optionSetterGetter$1("strokeColor"),e.prototype.labelRenderer=optionSetterGetter$1("labelRenderer"),e}.call(void 0),exports.sparkline=function(e){var t;return t=div(),new exports.Sparkline(t,e).render(),t},exports.plot={label:{basic:exports.plotLabelBasic,standard:exports.plotLabelStandard},arcCurve:arcCurve,svgCurve:svgCurve},posToValue=function(e){return this._.isDiscrete?posToDiscrete.call(this,e):e*(this.options.max-this.options.min)+this.options.min},discreteToPos=function(e){return this._.discreteValues.get(e)},posToDiscrete=function(e){var t,i,n,r,o,a,s,l;for(s=(i=this._).discreteSpacing/2,n=0,o=(a=i.discreteValues.entries()).length;n<o;n++)if(r=(t=a[n])[0],e>=(l=t[1])-s&&e<l+s)return r;return e},slide=function(e){var t,i,n,r,o,a,s,l,c,u=this;(t=this._).mouseDown=!0,t.pointerMoveHandler=function(e){return slide.call(u,e)},t.pointerUpHandler=function(e){return slideEnd.call(u,e)},select(document).on("pointermove","hx.slider",t.pointerMoveHandler),select(document).on("pointerup","hx.slider",t.pointerUpHandler),t.slidableWidth="range"===this.options.type?t.container.width()-t.controlWidth:t.container.width(),e.event.preventDefault(),a=exports.clamp(0,t.container.width(),e.x-t.container.box().left)/t.slidableWidth,c={},"range"===this.options.type?(l=t.isDiscrete?discreteToPos.call(this,this.values.start):this.values.start,n=t.isDiscrete?discreteToPos.call(this,this.values.end):this.values.end,l=(l-this.options.min)/(this.options.max-this.options.min),i=((n=(n-this.options.min)/(this.options.max-this.options.min))-l)/2,r=a-(o=t.controlWidth/t.slidableWidth)/2>=n-i,"end"===t.dragging||r&&"start"!==t.dragging?(t.dragging="end",a-=o,a=exports.clamp(l,1,a),c.end=posToValue.call(this,a)):(t.dragging="start",a=exports.clamp(0,n,a),c.start=posToValue.call(this,a))):(t.dragging="value",c.value=posToValue.call(this,a)),s=this.value(),this.value(c),s!==this.value()&&this.emit("change",this.value())},slideEnd=function(e){var t,i;return(t=this._).mouseDown&&(select(document).off("pointermove","hx.slider",t.pointerMoveHandler),select(document).off("pointerup","hx.slider",t.pointerUpHandler),t.mouseDown=!1,t.dragging=void 0,(i=t.range.select(".hx-slider-active")).morph().with("delay",100).then("fadeout",200).then((function(){return i.classed("hx-slider-active",!1),t.valueVis=!1})).go(!0)),this.emit("slideend",this.value())},renderValues=function(){var e,t,i,n,r,o,a,s;(o=(e=this._).container.selectAll(".hx-slider-point")).empty()||(n=o.nodes[0].offsetHeight,o.forEach((function(e){return e.style("width",n+"px").style("margin-left",-n/2+"px")}))),"range"===this.options.type?(a=e.isDiscrete?discreteToPos.call(this,this.values.start):this.values.start,i=e.isDiscrete?discreteToPos.call(this,this.values.end):this.values.end):(a=this.options.min,i=e.isDiscrete?discreteToPos.call(this,this.values.value):this.values.value),e.isDiscrete||(a=(a-this.options.min)/(this.options.max-this.options.min),i=(i-this.options.min)/(this.options.max-this.options.min)),e.range.style("left",100*a+"%").style("width",100*(i-a)+"%"),"start"===e.dragging?(r=e.valueL,s=this.values.start):null!=e.dragging&&(r=e.valueR,s="end"===e.dragging?this.values.end:this.values.value),null!=r&&null!=s&&(e.valueVis||(e.valueVis=!0,r.classed("hx-slider-active",!0).classed("hx-slider-under",!1),this.options.renderer(this,r.node(),s),t=r.box(),r.classed("hx-slider-under",t.top-t.height<0),r.morph().with("fadein",30).go(!0)),this.options.renderer(this,r.node(),s))},exports.Slider=function(e){function t(t,i){var n,r,o,a,s,l,c,u,d,h,p,f=this;if(void 0===i&&(i={}),e.call(this),this.selector=t,this.options=exports.merge({type:"slider",discreteValues:void 0,renderer:function(e,t,i){return select(t).text(exports.fixed(i))},min:0,max:1,step:void 0,disabled:!1},i),this._=n={},n.isDiscrete=(null!=(u=this.options.discreteValues)?u.length:void 0)>0||null!=this.options.step,n.container=select(this.selector).classed("hx-slider",!0).api("slider",this).api(this).append("div").classed("hx-slider-inner",!0).classed("hx-slider-double","range"===this.options.type).classed("hx-slider-discrete",n.isDiscrete).on("pointerdown","hx.slider",(function(e){if(!n.disabled)return f.emit("slidestart",f.value()),slide.call(f,e)})),n.range=n.container.append("div").class("hx-slider-range"),null==n.controlWidth&&(n.controlWidth=Number(window.getComputedStyle(n.range.node(),":after").width.replace("px",""))),n.valueL=n.range.append("div").class("hx-slider-value").style("left",0),n.valueR=n.range.append("div").class("hx-slider-value").style("left","100%"),n.slidableWidth="range"===this.options.type?n.container.width()-n.controlWidth:n.container.width(),null!=this.options.step){for(h=[],r=this.options.min;r<=this.options.max;)h.push(r),r+=this.options.step;this.options.max=1,this.options.min=0,this.discreteValues(h,!1)}else n.isDiscrete&&this.discreteValues(this.options.discreteValues,!1);c=.25*(a=this.options.max-this.options.min)+this.options.min,l=.5*a+this.options.min,s=.75*a+this.options.min,"range"===this.options.type?(d=null!=this.options.start?this.options.start:n.isDiscrete?posToDiscrete.call(this,c):c,o=null!=this.options.end?this.options.end:n.isDiscrete?posToDiscrete.call(this,s):s,this.values={start:d,end:o}):(p=null!=this.options.end?this.options.end:n.isDiscrete?posToDiscrete.call(this,l):l,this.values={value:p}),this.values.value?this.value(this.values.value):this.value({start:this.values.start,end:this.values.end}),this.options.disabled&&this.disabled(this.options.disabled)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.discreteValues=function(e,t){var i,n,r,o,a,s;if(void 0===t&&(t=!0),null!=e){for(this.options.discreteValues=e,(i=this._).isDiscrete=(null!=(a=this.options.discreteValues)?a.length:void 0)>0||null!=this.options.step,i.discreteValues=new Map,i.discreteSpacing=1/(e.length-1),i.container.selectAll(".hx-slider-point").remove(),n=r=0,s=e.length;0<=s?r<s:r>s;n=0<=s?++r:--r)o=n*i.discreteSpacing,i.discreteValues.set(e[n],o),("range"===this.options.type||n>0)&&i.range.insertBefore("div").class("hx-slider-point").style("left",100*o+"%");return t&&renderValues.call(this),this}return this.options.discreteValues},t.prototype.max=function(e){return arguments.length>0?(this.options.max=e,renderValues.call(this),this):this.options.max},t.prototype.step=function(e){return arguments.length>0?(this.options.step=e,renderValues.call(this),this):this.options.step},t.prototype.min=function(e){return arguments.length>0?(this.options.min=e,renderValues.call(this),this):this.options.min},t.prototype.value=function(e){var t,i=this;return arguments.length>0?(t=function(e){return i._.isDiscrete?e:exports.clamp(i.options.min,i.options.max,e)},"range"===this.options.type?(null!=e.start&&(this.values.start=t(e.start)),null!=e.end&&(this.values.end=t(e.end))):exports.isObject(e)?null!=e.value&&(this.values.value=t(e.value)):null!=e&&(this.values.value=t(e)),renderValues.call(this),this):"range"===this.options.type?{start:this.values.start,end:this.values.end}:this.values.value},t.prototype.renderer=function(e){return null!=e?(this.options.renderer=e,this):this.options.renderer},t.prototype.disabled=function(e){return null!=e?(this._.disabled=e,select(this.selector).classed("hx-disabled",e)):!!this._.disabled},t}(EventEmitter),exports.slider=function(e){var t;return t=div(),new exports.Slider(t.node(),e),t},exports.TimeSlider=function(){var e,t=function(t){function i(i,n){var r,o,a,s;void 0===n&&(n={}),o=null!=n.min?e(n.min):((s=new Date).setMilliseconds(0),s.setSeconds(0),s.setMinutes(0),s.setHours(0),new Date(s.getTime()).getTime()),r=null!=n.max?e(n.max):o+864e5-1,(a=exports.merge({renderer:function(e,t,i){return select(t).text(e.options.formatter(new Date(i)))}},n)).min=o,a.max=r,"undefined"!=typeof moment&&null!==moment?null==a.formatter&&(a.formatter=function(e){return moment(e).format("HH:mm")}):null==a.formatter&&(a.formatter=function(e){return exports.zeroPad(e.getHours())+":"+exports.zeroPad(e.getMinutes())}),t.call(this,i,a)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.value=function(i){var n,r;return arguments.length>0?("range"===this.options.type?(r=null!=i.start?e(i.start):void 0,n=null!=i.end?e(i.end):void 0,t.prototype.value.call(this,{start:r,end:n})):t.prototype.value.call(this,e(i)),this):"range"===this.options.type?{start:new Date(this.values.start),end:new Date(this.values.end)}:new Date(this.values.value)},i.prototype.min=function(i){return arguments.length>0?t.prototype.min.call(this,e(i)):new Date(t.prototype.min.call(this))},i.prototype.max=function(i){return arguments.length>0?t.prototype.max.call(this,e(i)):new Date(t.prototype.max.call(this))},i}(exports.Slider);return e=function(e){return e instanceof Date?e.getTime():e},t}.call(void 0),exports.timeSlider=function(e){var t;return t=div(),new exports.TimeSlider(t.node(),e),t},textContext=function(e,t){return t?e.classed("hx-text-"+t,!0):e},backgroundContext=function(e,t){return t?e.classed("hx-background-"+t,!0):e},exports.card=function(){return div("hx-card")},exports.card.small=function(){return div("hx-card-small hx-card")},fixes=[void 0,"fixed"],joints=[void 0,"joint"],directions=[void 0,"vertical"],headers=[void 0,"header"],(sizes=[void 0,"small","normal"]).forEach((function(e){return fixes.forEach((function(t){return joints.forEach((function(i){return directions.forEach((function(n){return headers.forEach((function(r){var o,a;return a=[e,t,i,n,r].filter(exports.defined),o=exports.card,a.forEach((function(e){return null==o[e]&&(o[e]={}),o=o[e]}))}))}))}))}))})),getComponentParent=function(e){var t;return t=exports.card,e.forEach((function(e){return null==t[e]&&(t[e]={}),t=t[e]})),t},defineComponent=function(e,t){var i,n;return n=(i=e.split(".")).pop(),getComponentParent(i)[n]=function(i){var n;return n=div(e.split(".").map((function(e){return"hx-card-"+e})).join(" ")).api({context:function(e){return backgroundContext(n,e)}}),backgroundContext(n,null!=i?i.context:void 0),"function"==typeof t&&t(n,i),n}},defineComponent("section"),defineComponent("group"),defineComponent("vertical.group"),defineComponent("header.section"),defineComponent("header.group"),defineComponent("vertical.header.group"),defineComponent("joint.section"),defineComponent("joint.group"),defineComponent("joint.vertical.group"),defineComponent("joint.header.section"),defineComponent("joint.header.group"),defineComponent("joint.vertical.header.group"),defineComponent("fixed.section"),defineComponent("fixed.group"),defineComponent("fixed.vertical.group"),defineComponent("fixed.header.section"),defineComponent("fixed.header.group"),defineComponent("fixed.vertical.header.group"),defineComponent("fixed.joint.section"),defineComponent("fixed.joint.group"),defineComponent("fixed.joint.vertical.group"),defineComponent("fixed.joint.header.section"),defineComponent("fixed.joint.header.group"),defineComponent("fixed.joint.vertical.header.group"),i$1=0,len=(ref=["small","normal","slim"]).length;i$1<len;i$1++)defineComponent((size=ref[i$1])+".section"),defineComponent(size+".group"),defineComponent(size+".vertical.group"),defineComponent(size+".header.section"),defineComponent(size+".header.group"),defineComponent(size+".vertical.header.group"),defineComponent(size+".joint.section"),defineComponent(size+".joint.group"),defineComponent(size+".joint.vertical.group"),defineComponent(size+".joint.header.section"),defineComponent(size+".joint.header.group"),defineComponent(size+".joint.vertical.header.group"),defineComponent(size+".fixed.section"),defineComponent(size+".fixed.group"),defineComponent(size+".fixed.vertical.group"),defineComponent(size+".fixed.header.section"),defineComponent(size+".fixed.header.group"),defineComponent(size+".fixed.vertical.header.group"),defineComponent(size+".fixed.joint.section"),defineComponent(size+".fixed.joint.group"),defineComponent(size+".fixed.joint.vertical.group"),defineComponent(size+".fixed.joint.header.section"),defineComponent(size+".fixed.joint.header.group"),defineComponent(size+".fixed.joint.vertical.header.group");exports.card.aligned=function(){return div("hx-card-aligned")},exports.card.large={},textLikeComponent=function(e,t){return function(i){var n,r;return n=null!=i?i.context:void 0,r=detached(e).class(t).text(i.text).api({text:function(e){return arguments.length>0?(r.text(e),this):r.text()},context:function(e){return arguments.length>0?(textContext(r,n=e),this):n}}),textContext(r,n),r}},exports.card.text=textLikeComponent("span","hx-card-text"),exports.card.small.text=function(e){return exports.card.text(e).classed("hx-card-small",!0)},exports.card.large.text=function(e){return exports.card.text(e).classed("hx-card-large",!0)},exports.card.title=textLikeComponent("span","hx-card-title hx-header"),exports.card.small.title=function(e){return exports.card.title(e).classed("hx-card-small",!0)},exports.card.large.title=function(e){return exports.card.title(e).classed("hx-card-large",!0)},exports.card.icon=function(e){var t;return t=detached("i").class("hx-card-icon "+(e.icon||"")).api({icon:function(e){return t.class("hx-card-icon "+(e||"")),this},context:function(e){return textContext(t,e),this}}),textContext(t,null!=e?e.context:void 0),t},exports.card.small.icon=function(e){return exports.card.icon(e).classed("hx-card-small",!0)},exports.card.large.icon=function(e){return exports.card.icon(e).classed("hx-card-large",!0)},exports.card.action={icon:{}},exports.card.icon.action={},exports.card.action.section=function(e){return exports.card.section(e).add(detached("a").attr("href",e.link).class("hx-card-action").add(exports.card.text(e)))},exports.card.action.icon.section=function(e){return exports.card.section(e).add(detached("a").attr("href",e.link).class("hx-card-action").add(exports.card.text(e)).add(exports.card.icon(e)))},exports.card.icon.action.section=function(e){return exports.card.section(e).add(detached("a").attr("href",e.link).class("hx-card-action").add(exports.card.icon(e)).add(exports.card.text(e)))},exports.card.notice=function(e){return void 0===e&&(e={}),exports.card().classed("hx-card-small",!0).add(exports.card.header.section({sectionContext:e.context||"info"}).add(exports.card.title({titleText:e.title||"Note"}))).add(exports.card.section().add(exports.card.text({text:e.message})))},exports.userFacingText({paginator:{paginatorAria:"Pagination navigation",currentPageAria:"Current page, page $page",gotoPageAria:"Goto page $page",prevPageAria:"Goto previous page, page $page",nextPageAria:"Goto next page, page $page",prev:"Prev",next:"Next"}}),getRange=function(e){var t,i;return i=Math.max(1,e.page-Math.floor(e.visibleCount/2)),t=Math.min(i+e.visibleCount,e.pageCount+1),{start:i=Math.max(1,t-e.visibleCount),end:t}},makeItem=function(e,t){return e+(t===e?"~":"")},makeRange=function(e,t){return exports.range(t-e+1).map((function(t,i){return i+e}))},getPageItems=function(e,t,i){var n,r,o,a,s,l;return void 0===e&&(e=1),(t?(s=(s=(n=(r=-(e+(a=2*i+1)-t))>=(o=e-a)&&o<=0?[1,Math.min(a,t)]:r<0?[Math.max(t-a+1,1),t]:[Math.max(e-i,1),Math.min(e+i,t)])[1])>=t-2?t:s,[1!==e&&"prev",(l=(l=n[0])<=3?1:l)>1&&makeItem(1,e),l>2&&"..."].concat(makeRange(l,s).map((function(t){return makeItem(t,e)})),[s<t-1&&"..."],[s<t&&makeItem(t,e)],[e!==t&&"next"])):[1!==e&&"prev",makeItem(e,e),"next"]).filter((function(e){return e}))},exports.Paginator=function(){var e,t,i=function(t){function i(i,n){var r,o,a,s,l,c,u=this;t.call(this),this.container=select(i).classed("hx-paginator",!0).api("paginator",this).api(this),this._=exports.merge({page:1,pageCount:10,visibleCount:10,updatePageOnSelect:!0,paginatorAria:exports.userFacingText("paginator","paginatorAria"),currentPageAria:exports.userFacingText("paginator","currentPageAria",!0),gotoPageAria:exports.userFacingText("paginator","gotoPageAria",!0),prevPageAria:exports.userFacingText("paginator","prevPageAria",!0),nextPageAria:exports.userFacingText("paginator","nextPageAria",!0),prevText:exports.userFacingText("paginator","prev"),nextText:exports.userFacingText("paginator","next"),v2Features:{showCentered:!1,padding:2,useAccessibleRendering:!1}},n),this._.selector=i,this._.v2Features.useAccessibleRendering?(this.container.classed("hx-paginator-center",this._.v2Features.showCentered),a=function(){var e;return e=detached("li").class("hx-paginator-button-container").add(detached("a").class("hx-paginator-button")),this.append(e).node()},s=function(e,t){var i,n=e.text,r=e.aria,o=e.selected,a=(e.disabled,e.isEllipsis),s=e.onClick,l=e.isPrevNextButton;if((i=select(t).classed("hx-paginator-selected-container",o).classed("hx-paginator-ellipsis-container",a).classed("hx-paginator-prev-next-container",l).select("a").classed("hx-paginator-selected",o).attr("aria-current",!!o||void 0).classed("hx-paginator-ellipsis",a).attr("aria-hidden",!!a||void 0)).text(n),i.attr("aria-label",r),i.off(),s)return i.on("click","paginator",s)},r=detached("ul"),this.view=r.view("li").enter(a).update(s),o=detached("nav").class("hx-paginator-nav").attr("role","navigation").attr("aria-label",this._.paginatorAria).add(r).attr("tabindex","0").on("keydown",(function(t){var i,n;switch(i=u.page(),n=u.pageCount(),t.which){case 37:if(1!==i)return e.call(u,"user",i-1);break;case 39:if(i!==n)return e.call(u,"user",i+1)}})),this.container.add(o)):(c=this,this.container.append("button").attr("type","button").class("hx-btn "+theme().paginator.arrowButton).add(detached("i").class("hx-icon hx-icon-step-backward")).on("click","paginator",(function(){return void 0===c._.pageCount?e.call(c,"user",c._.page-1):e.call(c,"user",0)})),l=this.container.append("span").class("hx-input-group"),this.view=l.view(".hx-btn","button").update((function(t,i,n){return this.text(t.value).attr("type","button").classed("hx-paginator-three-digits",3===t.dataLength).classed("hx-paginator-more-digits",t.dataLength>3).classed(theme().paginator.defaultButton,!t.selected).classed(theme().paginator.selectedButton,t.selected).classed("hx-no-border",!0).on("click","paginator",(function(){return e.call(c,"user",t.value)}))})),this.container.append("button").attr("type","button").class("hx-btn "+theme().paginator.arrowButton).add(detached("i").class("hx-icon hx-icon-step-forward")).on("click","paginator",(function(){return void 0===c._.pageCount?e.call(c,"user",c._.page+1):e.call(c,"user",c._.pageCount)})),this.container.on("resize","paginator",(function(){return u.render()}))),this.render()}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.page=function(t){return arguments.length>0?(e.call(this,"api",t,!0),this):this._.page},i.prototype.render=function(){var t,i,n,r,o,a,s,l,c,u,d,h,p=this;return o=this.page(),a=this.pageCount(),s=this._.v2Features.useAccessibleRendering?getPageItems(o,a,this._.v2Features.padding).map((function(t){var i,n,r;return"prev"===t?{isPrevNextButton:!0,text:p.prevText(),aria:exports.userFacingText.format(p.prevPageAria(),{page:o-1}),onClick:function(){return e.call(p,"user",o-1)}}:"next"===t?{isPrevNextButton:!0,text:p.nextText(),aria:exports.userFacingText.format(p.nextPageAria(),{page:o+1}),onClick:function(){return e.call(p,"user",o+1)}}:"..."===t?{isEllipsis:!0}:(r=t.indexOf("~")>-1,n=parseInt(t),i=r?p.currentPageAria():p.gotoPageAria(),{text:n,aria:exports.userFacingText.format(i,{page:n}),selected:r,onClick:function(){return e.call(p,"user",n)}})})):void 0===a?[{value:o,selected:!0,dataLength:o.toString().length}]:(t=getRange(this._),d=t.start,l=t.end,u=Math.max(d.toString().length,(l-1).toString().length),n=30+5*Math.max(0,u-2),r=this.container.width()-81,c=Math.floor(r/n),h=Math.min(c,this._.visibleCount),h=Math.max(h,1),i=getRange(this._),d=i.start,l=i.end,exports.range(l-d).map((function(e){return{value:d+e,selected:p._.page===d+e,dataLength:u}}))),this.view.apply(s)},i}(EventEmitter);return t=function(e,t){return function(t){return arguments.length>0?(this._[e]=t,this.render(),this):this._[e]}},i.prototype.pageCount=t("pageCount"),i.prototype.visibleCount=t("visibleCount"),i.prototype.updatePageOnSelect=t("updatePageOnSelect"),i.prototype.paginatorAria=t("paginatorAria"),i.prototype.currentPageAria=t("currentPageAria"),i.prototype.gotoPageAria=t("gotoPageAria"),i.prototype.prevPageAria=t("prevPageAria"),i.prototype.nextPageAria=t("nextPageAria"),i.prototype.prevText=t("prevText"),i.prototype.nextText=t("nextText"),e=function(e,t){var i,n,r;if(void 0===t&&(t=1),n=this.pageCount(),i=this.page(),(r=void 0===n?Math.max(t,1):exports.clamp(1,n,t))!==i)return("api"===e||this.updatePageOnSelect())&&(this._.page=r,this.render()),this.emit("change",{cause:e,value:t,selected:t})},i}.call(void 0),exports.paginator=function(e){var t;return t=div(),new exports.Paginator(t.node(),e),t},exports.SideCollapsible=function(e){function t(t,i){var n,r,o,a,s,l=this;e.call(this),this.options=exports.mergeDefined({position:"left",animate:!0,visible:!1,rotateHeading:!0},i),this.selection=select(t).classed("hx-side-collapsible",!0).api("side-collapsible",this).api(this),this.openHeading=this.selection.select(".hx-side-collapsible-heading-open").classed("hx-side-collapsible-heading",!0),this.closedHeading=this.selection.select(".hx-side-collapsible-heading-closed").classed("hx-side-collapsible-heading",!0).classed("hx-side-collapsible-heading-"+this.options.position,!0).classed("hx-side-collapsible-heading-no-rotate",!this.options.rotateHeading),this.content=this.selection.select(".hx-side-collapsible-content"),o=Number(this.closedHeading.style("padding").replace("px","")),s=this.options.rotateHeading?"height":"width",a=this.options.rotateHeading?"width":"height",this.closedSize=Number(this.closedHeading.style(s).replace("px",""))+2+2*o,this.selection.style("min-height",this.closedSize+"px"),this.closedHeading.style("min-"+a,Math.ceil(this.selection.style("height").replace("px","")-2*o)+"px"),(n=this.closedHeading.select(".hx-side-collapsible-toggle")).empty()?this.closedHeading.on("click","hx.side-collapsible",(function(){return l.show()})):(this.closedHeading.classed("hx-side-collapsible-heading-no-hover",!0),n.on("click","hx.side-collapsible",(function(){return l.show()}))),(r=this.openHeading.select(".hx-side-collapsible-toggle")).empty()?this.openHeading.on("click","hx.side-collapsible",(function(){return l.hide()})):(this.openHeading.classed("hx-side-collapsible-heading-no-hover",!0),r.on("click","hx.side-collapsible",(function(){return l.hide()}))),this.visible=!this.options.visible,this.options.visible?this.show(!1):this.hide(!1)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.show=function(e,t){var i,n=this;return e=null!=e?e:this.options.animate,this.visible||(this.visible=!0,e?(this.selection.style("width",this.closedSize+"px"),this.openHeading.style("width",this.closedSize+"px"),this.content.style("width",this.closedSize+"px"),this.openHeading.style("opacity",0).style("display","block"),this.content.style("opacity",0).style("display","block"),i=function(){return n.closedHeading.style("display","none"),n.selection.style("width",""),n.content.morph().with("expandh",100).and("fadein",100).and((function(){return n.openHeading.morph().with("expandh",100).and("fadein",100).go(!0)})).go(!0),n.emit("showend"),"function"==typeof t?t():void 0},this.closedHeading.morph().with("fadeout",100).then(i).go(!0)):(this.selection.style("width",""),this.closedHeading.style("display","none"),this.openHeading.style("display","block"),this.content.style("display","block"),this.emit("showend"))),this.emit("showstart"),this.emit("change",!0),this},t.prototype.hide=function(e,t){var i=this;return e=null!=e?e:this.options.animate,this.visible&&(this.visible=!1,e?(this.closedHeading.style("opacity",0).style("display","block"),this.content.morph().with("collapseh",100).and("fadeout",100).and((function(){return i.openHeading.morph().with("collapseh",100).and("fadeout",100).go(!0)})).then((function(){return i.selection.style("width",i.closedSize+"px"),i.openHeading.style("width",i.closedSize+"px"),i.content.style("width",i.closedSize+"px"),i.closedHeading.morph().with("fadein",100).go(!0),i.emit("hideend"),"function"==typeof t?t():void 0})).go(!0)):(this.selection.style("width",this.closedSize+"px"),this.closedHeading.style("display","block"),this.openHeading.style("display","none"),this.content.style("display","none"),this.emit("hideend"))),this.emit("hidestart"),this.emit("change",!1),this},t.prototype.toggle=function(e){return e=null!=e?e:this.options.animate,this.visible?this.show(e):this.hide(e),this},t}(EventEmitter),getCalendarMonth=function(e,t,i){var n,r,o,a,s;for((s=new Date(e,t).getDay()-i)<0&&(s+=7),r=new Date(e,t+1,0).getDate(),(a=[]).push(s>0?function(){var e,t,i;for(i=[],e=0,t=s-1;0<=t?e<=t:e>=t;0<=t?++e:--e)i.push(void 0);return i}().concat(function(){for(var e=[],t=1,i=7-s;1<=i?t<=i:t>=i;1<=i?t++:t--)e.push(t);return e}.apply(this)):[1,2,3,4,5,6,7]),o=1-s;o<r;)o+=7,n=Math.min(o+6,r),o<=n&&a.push(function(){for(var e=[],t=o;o<=n?t<=n:t>=n;o<=n?t++:t--)e.push(t);return e}.apply(this));return a[a.length-1].length<7&&(a[a.length-1].length=7),a},getCalendarYear=function(){return[[0,1,2],[3,4,5],[6,7,8],[9,10,11]]},getCalendarDecade=function(e){for(var t,i,n,r;e%10!=0;)e-=1;for(n=[],r=[],t=i=0;i<=11;t=++i)t>0&&t%3==0&&(n.push(r),r=[]),r.push(e-1+t);return n.push(r),n},isSelectable=function(e,t,i,n){var r,o,a,s,l;return null!=(a=e.validRange()).start&&(s=new Date(a.start.getTime())),null!=a.end&&(o=new Date(a.end.getTime())),null!=t&&null==i&&null==n&&(i=6,n=15,null!=s&&s.setDate(0),null!=o&&o.setDate(28),null!=s&&s.setMonth(0),null!=o&&o.setMonth(11)),null!=i&&null==n&&(n=15,null!=s&&s.setDate(0),null!=o&&o.setDate(28)),l=e.visibleMonth(),null==t&&(t=l.year),null==i&&(i=l.month),r=new Date(t,i,n),(null==s||r>=s)&&(null==o||r<=o)},isSelected=function(e,t,i,n){var r,o,a,s;return s=(r=e.split("-").map(Number))[0],a=r[1],o=r[2],!(s!==t||null!=i&&a-1!==i||null!=n&&o!==n)},isBetweenDates=function(e,t,i,n){var r;return(r=new Date(t,i,n))>e.start&&r<e.end},isToday=function(e,t,i){var n,r;return r=new Date,(n=new Date(e,t,i)).setHours(0,0,0,0),r.setHours(0,0,0,0),n.getTime()===r.getTime()},toggleInputValidity=function(e,t,i,n){if(null!=e)return t?t(i,n):e.classed("hx-date-error",!i)},validateDates=function(e){var t,i,n,r,o,a,s,l,c,u;t=e._,i=e.options.selectRange,e.options.v2Features.dontModifyDateOnError?(u=t.inputOnlyMode&&e.options.v2Features.dateValidityCallback,toggleInputValidity(t.input,u,!0),null!=(n=t.inputStart)&&n.classed("hx-date-error",!1),null!=(r=t.inputEnd)&&r.classed("hx-date-error",!1),null!=t.validRange&&(null!=t.validRange.start&&(t.startDate<t.validRange.start&&(toggleInputValidity(t.input,u,!1,"DATE_OUTSIDE_RANGE_START"),null!=(o=t.inputStart)&&o.classed("hx-date-error",!0)),i&&t.endDate<t.validRange.start&&null!=(a=t.inputEnd)&&a.classed("hx-date-error",!0)),null!=t.validRange.end&&(t.startDate>t.validRange.end&&(toggleInputValidity(t.input,u,!1,"DATE_OUTSIDE_RANGE_END"),null!=(s=t.inputStart)&&s.classed("hx-date-error",!0)),i&&t.endDate>t.validRange.end&&null!=(l=t.inputEnd)&&l.classed("hx-date-error",!0)))):(null!=t.validRange&&(null!=t.validRange.start&&(t.startDate<t.validRange.start&&(t.startDate=new Date(t.validRange.start.getTime())),i&&t.endDate<t.validRange.start&&(t.endDate=new Date(t.validRange.start.getTime()))),null!=t.validRange.end&&(t.startDate>t.validRange.end&&(t.startDate=new Date(t.validRange.end.getTime())),i&&t.endDate>t.validRange.end&&(t.endDate=new Date(t.validRange.end.getTime())))),i?t.endDate<t.startDate&&(c=t.endDate,t.endDate=t.startDate,t.startDate=c):t.endDate=t.startDate)},buildCalendar=function(e,t){var i,n,r,o,a,s,l;switch((i=e._).calendarGrid.selectAll(".hx-grid-row").remove(),i.calendarView=i.calendarGrid.view(".hx-grid-row","div").update((function(i,n,r){return calendarGridUpdate(e,i,n,r,t)})),null==t&&(t=i.mode),i.mode=t,o=e.localizer,l=e.visibleMonth(),t){case"d":r=getCalendarDecade(l.year),n="hx-calendar-decade",s=o.year(r[0][1])+" - "+o.year(r[3][1]);break;case"y":r=getCalendarYear(),n="hx-calendar-year",s=o.year(l.year);break;default:(r=getCalendarMonth(l.year,l.month-1,o.weekStart())).unshift("days"),n="hx-calendar-month",s=e.options.v2Features.displayLongMonthInCalendar?o.fullMonth(l.month-1)+" "+o.year(l.year):o.month(l.month-1)+" / "+o.year(l.year)}return i.calendarGrid.class("hx-calendar-grid "+n),i.calendarHeadBtn.text(s),null!=(a=i.calendarTodayButton)&&a.text(o.todayText()),i.calendarView.apply(r)},calendarGridUpdate=function(e,t,i,n,r){var o;return e._,o=select(i),"days"===t?o.classed("hx-grid-row-heading",!0).view(".hx-grid").update((function(e){return this.text(e).node()})).apply(e.localizer.weekDays()):o.view(".hx-grid").enter((function(t){var i;return i=this.append("div").class("hx-grid"),e.options.selectRange&&i.append("div").class("hx-grid-range-bg"),i.append("div").class("hx-grid-text"),i.node()})).update((function(t,i,o){return calendarGridRowUpdate(e,t,i,o,n,r)})).apply(t)},calendarGridRowUpdate=function(e,t,i,n,r,o){var a,s,l,c,u,d,h,p,f,g,x,m,v,y,b;if(a=e._,c=select(i),null==t)return c.classed("hx-grid-out-of-range",!0).classed("hx-grid-selected",!1).classed("hx-grid-selected-start",!1).classed("hx-grid-selected-end",!1).classed("hx-grid-selected-range",!1).classed("hx-grid-today",!1);switch(b=null,d=null,l=null,y=e.visibleMonth(),f=!0,o){case"d":b=t,p=e.localizer.year(t),f=0===r?0!==n:3!==r||2!==n;break;case"y":d=t,b=y.year,p=e.localizer.month(t);break;default:l=t,d=y.month-1,b=y.year,p=e.localizer.day(t)}return u=isSelectable(e,b,d,l)&&f,e.options.selectRange?(h=e.range(),m=isSelected(e.localizer.date(h.start,!0),b,d,l),x=isSelected(e.localizer.date(h.end,!0),b,d,l),s=isBetweenDates(h,b,d,l),g=m||x):g=isSelected(e.localizer.date(a.startDate,!0),b,d,l),v=l&&isToday(b,d,l),c.classed("hx-grid-out-of-range",!u).classed("hx-grid-selected",g).classed("hx-grid-selected-start",m).classed("hx-grid-selected-end",x).classed("hx-grid-selected-range",s).classed("hx-grid-today",v),c.select(".hx-grid-text").text(p),u?c.on("click","hx-date-picker",(function(){var i,n,r,s;return a.userEvent=!0,"d"!==o&&"y"!==o?null!=l&&(i=a.startDate,r=a.startDate.getDate()-e.localizer.date(a.startDate,!0).split("-").map(Number)[2],n=new Date(y.year,y.month-1,l+r,i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds()),e.options.selectRange?(null==a.clickStart&&(a.clickStart=!0),a.clickStart?(a.clickStart=!1,e.range({start:n,end:n})):(a.clickStart=!0,e.range({start:a.startDate,end:n}),e.options.closeOnSelect&&e.hide())):(e.date(n),e.options.closeOnSelect&&e.hide())):"d"===o?(s="y",e.visibleMonth(6,t)):(s="m",e.visibleMonth(t+1,y.year)),setupInput(e),buildCalendar(e,s)})):c.on("click",(function(){}))},buildDatepicker=function(e){var t,i,n,r,o;return t=e._,i=e.day(),r=e.month(),o=e.year(),n=e.localizer,t.dayPicker.suppressed("change",!0),t.monthPicker.suppressed("change",!0),t.yearPicker.suppressed("change",!0),t.dayPicker.value(i,n.day(i,!0)),t.monthPicker.value(r,n.month(r-1,!0)),t.yearPicker.value(o,n.year(o)),t.dayPicker.suppressed("change",!1),t.monthPicker.suppressed("change",!1),t.yearPicker.suppressed("change",!1)},setupInput=function(e,t){var i,n;return i=e._,e.options.selectRange?(n=e.range(),i.inputStart.value(e.localizer.date(n.start,i.useInbuilt)),i.inputEnd.value(e.localizer.date(n.end||n.start,i.useInbuilt))):e.options.v2Features.dontSetInitialInputValue&&t?void 0:i.input.value(e.localizer.date(i.startDate,i.useInbuilt))},updateDatepicker=function(e,t,i){var n,r;if(n=e._,validateDates(e),!n.preventFeedback)return n.preventFeedback=!0,e.options.selectRange?(n.inputStart.classed("hx-date-error",!1),n.inputEnd.classed("hx-date-error",!1)):n.inputOnlyMode?"function"==typeof(r=e.options).dateValidationChange&&r.dateValidationChange(!0):n.input.classed("hx-date-error",!1),setupInput(e,i),t||e.emit("change",{type:n.userEvent?"user":"api"}),n.userEvent=!1,n.preventFeedback=!1,"calendar"===e.options.type?buildCalendar(e):buildDatepicker(e)},exports.DatePicker=function(e){function t(t,i){var n,r,o,a,s,l,c,u,d,h,p,f,g=this;e.call(this),this.selector=t,d=this,this.options=exports.mergeDefined({type:"calendar",defaultView:"m",allowViewChange:!0,closeOnSelect:!0,selectRange:!1,validRange:void 0,range:void 0,showTodayButton:!0,allowInbuiltPicker:!0,disabled:!1,date:void 0,v2Features:{outputFullDate:!1,dontModifyDateOnError:!1,displayLongMonthInCalendar:!1,dontSetInitialInputValue:!1,updateVisibleMonthOnDateChange:!1,dateValidityCallback:void 0}},i),n=this._={disabled:this.options.disabled,mode:this.options.defaultView,startDate:new Date(this.options.date||Date.now()),endDate:new Date(this.options.date||Date.now())},this.localizer=preferences._.useIntl?new IntlDateTimeLocalizer:dateTimeLocalizer(),this.localizer.on("localechange","hx.date-picker",(function(){return updateDatepicker(g,!0)})),this.localizer.on("timezonechange","hx.date-picker",(function(){return updateDatepicker(g,!0)})),this.selection=select(this.selector).api("date-picker",this).api(this),n.inputOnlyMode="input"===this.selection.node().tagName.toLowerCase(),this.options.allowViewChange||(this.options.defaultView="m"),n.inputOnlyMode?this.options.selectRange&&(logger.warn("DatePicker: options.selectRange is not supported when using an input"),this.options.selectRange=!1):(this.selection.classed("hx-date-picker",!0),(l=this.selection.append("div").class("hx-date-input-container")).append("i").class("hx-icon hx-icon-calendar")),p=void 0,this.options.selectRange?(this.options.type="calendar",this.options.showTodayButton=!1,n.preventFeedback=!0,this.range(this.options.range||{}),n.preventFeedback=!1,c=function(e){return d.hide(),clearTimeout(p),p=setTimeout((function(){var t,i,r,o;return t=d.localizer.stringToDate(n.inputStart.value(),n.useInbuilt),i=d.localizer.stringToDate(n.inputEnd.value(),n.useInbuilt),e&&i<t?(t=i,n.inputStart.value(n.inputEnd.value())):!e&&t>i&&(i=t,n.inputEnd.value(n.inputStart.value())),o=t.getTime(),r=i.getTime(),o&&r&&(d.range({start:t,end:i}),d.visibleMonth(t.getMonth()+1,t.getFullYear())),n.inputStart.classed("hx-date-error",!o),n.inputEnd.classed("hx-date-error",!r)}),500)},n.inputStart=l.append("input").class("hx-date-input").on("input","hx.date-picker",(function(){return c(!1)})),l.append("i").class("hx-date-to-icon hx-icon hx-icon-angle-double-right"),n.inputEnd=l.append("input").class("hx-date-input").on("input","hx.date-picker",(function(){return c(!0)}))):(n.useInbuilt=!!this.options.allowInbuiltPicker&&(("undefined"==typeof moment||null===moment)&&exports.supports("date")&&exports.supports("touch")),n.input=n.inputOnlyMode?this.selection:l.append("input").class("hx-date-input"),n.input.on(n.useInbuilt?"blur":"input","hx.date-picker",(function(){return d.hide(),clearTimeout(p),p=setTimeout((function(){var e;if(!d.options.v2Features.dontSetInitialInputValue||""!==n.input.value())return(e=d.localizer.stringToDate(n.input.value(),n.useInbuilt)).getTime()?e.getTime()===n.startDate.getTime()||(d.date(e),d.options.v2Features.updateVisibleMonthOnDateChange||"calendar"!==d.options.type)?void 0:d.visibleMonth(e.getMonth()+1,e.getFullYear()):d.options.v2Features.dateValidityCallback?d.options.v2Features.dateValidityCallback(!1,"INVALID_DATE"):n.input.classed("hx-date-error",!0);d.options.v2Features.dateValidityCallback?d.options.v2Features.dateValidityCallback(!0):n.input.classed("hx-date-error",!1)}),500)})),n.useInbuilt&&n.input.attr("type","date").on("focus","hx.date-picker",(function(){return d.emit("show")}))),"calendar"===this.options.type?(this.visibleMonth(void 0),a=function(e){var t,i,r;switch(void 0===e&&(e=1),i=d.visibleMonth(),n.mode){case"d":t=i.month,r=i.year+10*e;break;case"y":t=i.month,r=i.year+1*e;break;default:t=i.month+1*e,r=i.year}return d.visibleMonth(t,r),buildCalendar(d)},(o=(r=div("hx-date-picker-calendar")).append("div").class("hx-calendar-header")).append("button").class("hx-btn hx-btn-outline hx-calendar-back").on("click","hx.date-picker",(function(){return a(-1)})).append("i").class("hx-icon hx-icon-chevron-left"),this.options.allowViewChange?(o.classed("hx-input-group",!0),n.calendarHeadBtn=o.append("button").class("hx-btn hx-btn-invert").on("click","hx.date-picker",(function(){switch(n.mode){case"d":break;case"y":return buildCalendar(d,"d");default:return buildCalendar(d,"y")}}))):(o.classed("hx-compact-group",!0),n.calendarHeadBtn=o.append("div")),n.calendarHeadBtn.classed("hx-calendar-header-title",!0),o.append("button").class("hx-btn hx-btn-outline hx-calendar-forward").on("click","hx.date-picker",(function(){return a()})).append("i").class("hx-icon hx-icon-chevron-right"),n.calendarGrid=r.append("div").class("hx-calendar-grid"),this.options.showTodayButton&&(n.calendarTodayButton=r.append("div").class("hx-calendar-today-btn").append("button").class("hx-btn hx-btn-outline").on("click","hx.date-picker",(function(){var e;if(e=new Date,d.date(e),buildCalendar(d,"m"),d.options.closeOnSelect)return d.hide()}))),h=function(e){if(!n.disabled)return n.clickStart=!0,select(e).append(r),buildCalendar(d,d.options.defaultView);d.hide()}):(s=div().node(),u=div().node(),f=div().node(),n.dayPicker=new NumberPicker(s,{buttonClass:"hx-btn-outline"}).on("change","hx.date-picker",(function(e){return n.userEvent=!0,d.day(e.value)})),n.monthPicker=new NumberPicker(u,{buttonClass:"hx-btn-outline"}).on("change","hx.date-picker",(function(e){return n.userEvent=!0,d.month(e.value)})),n.yearPicker=new NumberPicker(f,{buttonClass:"hx-btn-outline"}).on("change","hx.date-picker",(function(e){return n.userEvent=!0,d.year(e.value)})),n.dayPicker.selectInput.attr("tabindex",1),n.monthPicker.selectInput.attr("tabindex",2),n.yearPicker.selectInput.attr("tabindex",3),h=function(e){var t,i,r,o;if(!n.disabled){for(o=select(e),t=0,i=(r=d.localizer.dateOrder()).length;t<i;t++)switch(r[t]){case"DD":o.append(s);break;case"MM":o.append(u);break;case"YYYY":o.append(f)}return buildDatepicker(d)}d.dropdown.hide()}),n.useInbuilt||(this.dropdown=new Dropdown(this.selector,h,{matchWidth:!1}),this.dropdown.on("hidestart",(function(){return g.emit("hide")})),this.dropdown.on("showstart",(function(){return g.emit("show")}))),setupInput(this,!0),n.disable&&this.disabled(n.disabled),this.options.validRange&&this.validRange(this.options.validRange,!0)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.disabled=function(e){var t,i;return t=this._,null!=e?(null!=this.dropdown&&this.dropdown.isOpen()&&this.dropdown.hide(),i=e?"":void 0,t.disabled=e,this.options.selectRange?(t.inputStart.attr("disabled",i),t.inputEnd.attr("disabled",i)):t.input.attr("disabled",i),this):!!t.disabled},t.prototype.show=function(){return this._.useInbuilt?this._.input.node().focus():this.dropdown.show(),this},t.prototype.hide=function(){return this._.useInbuilt?this.emit("hide"):this.dropdown.hide(),this},t.prototype.getScreenDate=function(e){return this.localizer.date(e?this._.endDate:this._.startDate)},t.prototype.visibleMonth=function(e,t){var i;return i=this._,"calendar"===this.options.type?arguments.length>0?(null==t&&(t=i.visibleYear||this.year()),null==e&&(e=i.visibleMonth||this.month()),e<1&&(e+=12,t-=1),e>12&&(e%=12,t+=1),i.visibleMonth=e-1,i.visibleYear=t,this):{month:i.visibleMonth+1,year:i.visibleYear}:(logger.warn("Setting the visible month only applies to date pickers of type 'calendar'"),this)},t.prototype.date=function(e){var t,i;return t=this._,null!=e?(e=new Date(e.getTime()),this.options.v2Features.updateVisibleMonthOnDateChange&&"calendar"===this.options.type&&this.visibleMonth(e.getMonth()+1,e.getFullYear()),t.startDate=e,updateDatepicker(this),this):(i=new Date(t.startDate.getTime()),this.options.outputFullDate||i.setHours(0,0,0,0),i)},t.prototype.day=function(e){var t;return t=this._,null!=e?(t.startDate.setDate(e),updateDatepicker(this),this):t.startDate.getDate()},t.prototype.month=function(e){var t;return t=this._,null!=e?(t.startDate.setMonth(e-1),updateDatepicker(this),this):t.startDate.getMonth()+1},t.prototype.year=function(e){var t;return t=this._,null!=e?(t.startDate.setFullYear(e),updateDatepicker(this),this):t.startDate.getFullYear()},t.prototype.range=function(e){var t,i,n;return t=this._,this.options.selectRange?arguments.length>0?(null!=e.start&&(t.startDate=e.start),null!=e.end&&(t.endDate=e.end),updateDatepicker(this),this):(n=new Date(t.startDate.getTime()),i=new Date(t.endDate.getTime()),this.options.outputFullDate||(n.setHours(0,0,0,0),i.setHours(0,0,0,0)),{start:n,end:i}):(logger.warn("datePicker.range can only be used for datepickers with 'selectRange' of true"),this)},t.prototype.validRange=function(e,t){var i;return null==(i=this._).validRange&&(i.validRange={start:void 0,end:void 0}),arguments.length>0?("start"in e&&(i.validRange.start=e.start),"end"in e&&(i.validRange.end=e.end),updateDatepicker(this,!1,t),this):i.validRange},t.prototype.locale=function(e){return arguments.length>0?(this.localizer.locale(e),this):this.localizer.locale()},t}(EventEmitter),exports.datePicker=function(e){var t,i;return i=(null!=e&&null!=(t=e.v2Features)?t.useInput:void 0)?detached("input"):div(),new exports.DatePicker(i,e),i},createTableView=function(e,t,i){var n,r,o,a;return n=function(t,i,n){var r,o,a,s,l;return s=e._.leftShifted&&0===i,a=n&&s,l=(o=n||s)||exports.isFunction(t)?"th":"td",r=this.append(l).class("hx-pivot-table-cell"),o&&r.classed("hx-pivot-table-head-cell",!0),a&&r.classed("hx-table-head-no-border",!0),r.node()},r=function(t,i,n,r){var o,a,s;return a=e._.leftShifted&&0===n,o=r||a,s=select(i),exports.isFunction(t)?t(i):null==t?s.text(""):e.options.cellRender(t,i,o,n)},o=function(e,t){var i,o;return i=this.append("tr"),o=select(i).view(".hx-pivot-table-cell").enter((function(i){var r;return r=e.indexOf(i),n.call(this,i,r,t)})).update((function(e,i,n){return r(e,i,n,t)})),i.api({view:o}),i.node()},a=function(e,t,i,n){return select(t).api().view.apply(e)},[t.view("tr").enter((function(e){return o.call(this,e,!0)})).update((function(e,t){return a(e,t)})),i.view("tr").enter((function(e){return o.call(this,e,!1)})).update((function(e,t){return a(e,t)}))]},exports.PivotTable=function(e){function t(t,i){var n;e.call(this),this.selector=t,this.options=exports.mergeDefined({stickyHeaders:!0,topLeftCellRender:void 0,cellRender:function(e,t,i,n){return select(t).text(e)},useResponsive:!0,data:void 0,fullWidth:void 0,highlightOnHover:!0},i),this._={},this.selection=select(this.selector).classed("hx-pivot-table",!0).api("pivot-table",this).api(this),this.table=this.selection.append("table").class("hx-table").classed("hx-table-no-hover",!this.options.highlightOnHover),this.tableHead=this.table.append("thead"),this.tableBody=this.table.append("tbody"),n=createTableView(this,this.tableHead,this.tableBody),this.tableHeadView=n[0],this.tableBodyView=n[1],null!=this.options.data&&this.data(this.options.data)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.data=function(e){var t,i,n,r,o,a,s,l;return null!=e?((t=this._).data=e,t.leftShifted=!1,l=(null!=(o=(n=exports.clone(e)).topHead)?o.length:void 0)>0?n.topHead:[],r=(null!=(a=n.leftHead)?a.length:void 0)>0?n.leftHead:[],i=(null!=(s=n.body)?s.length:void 0)>0?n.body:[],l.length>0&&i.length>0&&l.length!==i[0].length&&logger.warn("hx.PivotTable - "+this.selector,"The number of columns in the dataset is not equal to the number of headers provided in data.topHead"),r.length>0&&(r.length!==i.length&&logger.warn("hx.PivotTable - "+this.selector,"The number of rows in the dataset is not equal to the number of headers provided in data.leftHead"),i=i.map((function(e,t){return e.unshift(r[t]),e})),t.leftShifted=!0),l.length>0&&t.leftShifted&&null!=l&&l.unshift(this.options.topLeftCellRender||void 0),(null!=l?l.length:void 0)>0&&this.tableHeadView.apply([l]),this.tableBodyView.apply(i),this.table.classed("hx-table-full",!1),this.options.stickyHeaders?this.stickyTableHeaders?this.stickyTableHeaders.render():this.stickyTableHeaders=new exports.StickyTableHeaders(this.selector,{stickTableHead:l.length>0,stickFirstColumn:r.length>0,useResponsive:this.options.useResponsive,fullWidth:this.options.fullWidth}):this.options.fullWidth&&this.table.classed("hx-table-full",this.options.fullWidth),this):this._.data},t}(EventEmitter),exports.pivotTable=function(e){var t;return t=div(),new exports.PivotTable(t,e),t},setupTimepicker=function(e){var t;return t=e.getScreenTime().split(":"),e.hourPicker.suppressed("change",!0),e.minutePicker.suppressed("change",!0),e.secondPicker.suppressed("change",!0),e.hourPicker.value(e.hour(),t[0]),e.minutePicker.value(e.minute(),t[1]),e.secondPicker.value(e.second(),t[2]),e.hourPicker.suppressed("change",!1),e.minutePicker.suppressed("change",!1),e.secondPicker.suppressed("change",!1)},setupInput$1=function(e){return e.input.classed("hx-short-time",!e.options.showSeconds),e.input.value(e.getScreenTime(e.options.showSeconds))},updateTimePicker=function(e,t){var i;if(!e.preventFeedback)return i=e._,e.preventFeedback=!0,e.input.classed("hx-time-error",!1),setupInput$1(e),t||e.emit("change",{type:i.userEvent?"user":"api"}),i.userEvent=!1,e.preventFeedback=!1,setupTimepicker(e)},exports.TimePicker=function(e){function t(t,i){var n,r,o,a,s,l,c,u=this;e.call(this),this.selector=t,this.options=exports.merge({date:void 0,showSeconds:!1,buttonClass:"hx-btn-outline",disabled:!1},i),n=this._={disabled:this.options.disabled},this.localizer=preferences._.useIntl?new IntlDateTimeLocalizer:dateTimeLocalizer(),this.localizer.on("localechange","hx.time-picker",(function(){return updateTimePicker(u,!0)})),this.localizer.on("timezonechange","hx.time-picker",(function(){return updateTimePicker(u,!0)})),n.selectedDate=new Date(this.options.date||Date.now()),n.selectedDate.setMilliseconds(0),this.showSeconds||n.selectedDate.setSeconds(0),this.selection=select(this.selector).classed("hx-time-picker",!0).api("time-picker",this).api(this),(o=this.selection.append("div").class("hx-time-input-container")).append("i").class("hx-icon hx-icon-clock-o"),this.input=o.append("input").class("hx-time-input"),c=void 0,exports.supports("date")&&exports.supports("touch")?(this.input.attr("readonly",!0),this.input.on("click","hx.time-picker",(function(e){return e.preventDefault()}))):this.input.on("input","hx.time-picker",(function(e){return clearTimeout(c),c=setTimeout((function(){var t;return null==(t=e.target.value.split(":"))[2]&&(t[2]=0),u.localizer.checkTime(t)?(u.hour(t[0]),u.minute(t[1]),u.second(t[2]||0)):u.input.classed("hx-time-error",!0)}),200)})),setupInput$1(this),r=div().node(),a=div().node(),s=div().node(),this.hourPicker=new NumberPicker(r,{buttonClass:this.options.buttonClass}).on("change","hx.time-picker",(function(e){return n.userEvent=!0,u.hour(e.value)})),this.hourPicker.selectInput.attr("tabindex",1).attr("maxlength","2"),this.minutePicker=new NumberPicker(a,{buttonClass:this.options.buttonClass}).on("change","hx.time-picker",(function(e){return n.userEvent=!0,u.minute(e.value)})),this.minutePicker.selectInput.attr("tabindex",2).attr("maxlength","2"),this.secondPicker=new NumberPicker(s,{buttonClass:this.options.buttonClass}).on("change","hx.time-picker",(function(e){return n.userEvent=!0,u.second(e.value)})),this.secondPicker.selectInput.attr("tabindex",3).attr("maxlength","2"),l=function(e){var t;if(!n.disabled)return void 0===u.input.attr("disabled")?(t=div().add(r).add(a),u.options.showSeconds&&t.add(s),setupTimepicker(u),select(e).add(t)):u.dropdown.hide()},this.dropdown=new Dropdown(this.selector,l,{matchWidth:!1,ddClass:"hx-time-picker-dropdown"}),this.dropdown.on("hidestart",(function(){return u.emit("hide")})),this.dropdown.on("showstart",(function(){return u.emit("show")})),n.disabled&&this.disabled(n.disabled)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.date=function(e,t){var i;return i=this._,arguments.length>0&&null!=e?(e=new Date(e.getTime()),t&&e.setHours(this.hour(),this.minute(),this.second(),0),i.selectedDate=e,updateTimePicker(this),this):new Date(i.selectedDate.getTime())},t.prototype.hour=function(e){var t;return t=this._,arguments.length>0&&null!=e?(t.selectedDate.setHours(e),updateTimePicker(this),this):t.selectedDate.getHours()},t.prototype.minute=function(e){var t;return t=this._,arguments.length>0&&null!=e?(t.selectedDate.setMinutes(e),updateTimePicker(this),this):t.selectedDate.getMinutes()},t.prototype.second=function(e){var t;return t=this._,arguments.length>0&&null!=e?(t.selectedDate.setSeconds(e),updateTimePicker(this),this):t.selectedDate.getSeconds()},t.prototype.getScreenTime=function(){return this.localizer.time(this.date(),this.options.showSeconds)},t.prototype.locale=function(e){return arguments.length>0?(this.localizer.locale(e),this):this.localizer.locale()},t.prototype.timezone=function(e){return arguments.length>0?(this.localizer.timezone(e),this):this.localizer.timezone()},t.prototype.disabled=function(e){var t,i;return t=this._,null!=e?(null!=this.dropdown&&this.dropdown.isOpen()&&this.dropdown.hide(),t.disabled=e,i=e?"":void 0,this.input.attr("disabled",i),this):!!t.disabled},t}(EventEmitter),exports.timePicker=function(e){var t;return t=div(),new exports.TimePicker(t,e),t},onTabSelected=function(e,t,i,n){var r,o,a,s;return e.selected=i,e.selection.selectAll(".hx-tab").classed("hx-tab-active",!1),t.classed("hx-tab-active",!0),e.selection.classed("hx-flag-tabs")||(r=palette$1.context(t),s=e.selection.select(".hx-tabs-content"),palette$1.borderContext(s,r)),e.selection.selectAll(".hx-tab-content").classed("hx-tab-content-hidden",!0),null!=(o=e.items()[i])?(s.clear(),e._.options.contentRenderer(s.node(),o.content)):(a="#"+t.attr("data-content"),e.selection.select(a).classed("hx-tab-content-hidden",!1)),e.emit("change",{id:i,value:i,cause:n})},exports.Tabs=function(e){function t(t,i){var n,r,o;e.call(this),this.selector=t,n=function(e,t){return select(e).text(t)},r=exports.merge({items:[],titleRenderer:n,contentRenderer:n},i),this._={},this._.options=r,this.selection=select(this.selector).classed("hx-tabs",!0).api("tabs",this).api(this),this.selection.select(".hx-tabs-content").empty()&&this.selection.append("div").class("hx-tabs-content"),this.selected=-1,o=this,r.items.length?this.items(r.items):this.selection.selectAll(".hx-tab").forEach((function(e,t){return e.on("click","hx.tabs",(function(){return onTabSelected(o,e,t,"user")}))})),this.select(0)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.items=function(e){var t,i,n=this;return arguments.length?(0===e.length?logger.warn("hx.Tabs::items","Setting items to empty array"):(t=this.selection.select(".hx-tabs-content"),this.selection.selectAll(".hx-tab").remove(),t.clear(),i=e.map((function(e,t){var i,r=e.title,o=e.context;e.content;return i=detached("div").class("hx-tab"),n._.options.titleRenderer(i.node(),r),palette$1.context(i.node(),o),i.on("click","hx.tabs",(function(){return onTabSelected(n,i,t,"user")})),i})),t.insertBefore(i),this.select(0,!0)),this._.options.items=e,this):this._.options.items},t.prototype.value=function(e){return arguments.length?this.select(e,!1):this.selected},t.prototype.select=function(e,t){var i;if(this.selected!==e||t)return i=select(this.selection.selectAll(".hx-tab").node(e)),onTabSelected(this,i,e,"api")},t}(EventEmitter),exports.tabs=function(e){var t;return t=detached("div"),new exports.Tabs(t,e),t},createNodeView=function(e,t,i){return e.view(".hx-tree-node").enter((function(e){return this.append(createTreeNode(e,t,i)).node()}))},createChildren=function(e,t,i){return e.map((function(e){return createTreeNode(e,t,i)}))},createTreeNode=function(e,t,i){var n,r,o,a;return a=div("hx-tree-node"),t((o=div("hx-tree-node-content")).node(),e),null!=e.children&&e.children.length>0?(n=div("hx-tree-node-children").style("display","none"),i?(r=createNodeView(n,t,i),a.api({renderChildren:function(){return r.apply(e.children)}})):n.append(createChildren(e.children,t,i)),a.add(div("hx-tree-node-parent").add(o)).add(n)):a.add(o)},formatChildren=function(e,t,i){return t.forEach((function(t){return format$1(e,t.node(),i)}))},formatIcon=function(e,t,i){var n,r;if(!(n=select(e).shallowSelect(".hx-tree-node-children")).selectAll(".hx-tree-node").empty()&&(r="block"===n.style("display"),select(e).classed("hx-tree-node-open",r),i))return select(t).select("i").morph().then(r?"rotate-90":"rotate-0").go(!0)},format$1=function(e,t,n){var r,o,a,s,l,c,u,d,h,p,f,g,x;if(x=(g=select(t)).api(),u=function(t,i){if(null!=t.api()&&t.selectAll(".hx-tree-node").empty()&&(t.api().renderChildren(),formatChildren(e,t.selectAll(".hx-tree-node"),n)),i)return t.selectAll(".hx-tree-node").map((function(e){return u(e,i)}))},f=function(i){var n,r;return r=g.select(".hx-tree-node-children"),u(g),n="none"===r.style("display")?"block":"none",r.style("display",n),formatIcon(t,i,e.options.animate)},l=function(t){return u(g,!0),g.selectAll(".hx-tree-node-children").style("display","block"),"block"===g.shallowSelect(".hx-tree-node-children").style("display")?formatChildren(e,g.selectAll(".hx-tree-node"),n):f(t)},p=(h=select(t.parentNode).shallowSelectAll(".hx-tree-node")).shallowSelect(".hx-tree-node-children").shallowSelectAll(".hx-tree-node").size()>0||h.nodes.map((function(e){return null!=select(e).api()})).some(exports.identity),d=!e.options.hideDisabledButtons&&p,r=g.select(".hx-tree-node-children"),null!=x||r.selectAll(".hx-tree-node").size()>0||d)return(a=select(t).select(".hx-tree-node-parent")).size()>0?a.view(".hx-tree-node-parent-icon").enter((function(){var e;return e=div("hx-tree-node-parent-icon").add(i("hx-icon hx-icon-chevron-right hx-tree-node-state-icon")),this.append(e).node()})).update((function(e,t){var i,r;return r=!1,i=function(){return r=!1},this.on("click",(function(){return r?l(t):f(t),setTimeout(i,250),r=!0})),formatIcon(t.parentNode.parentNode,t,n)})).apply(this):(o=(c=select(t)).select(".hx-tree-node-content").node(),(s=c.append("div").attr("class","hx-tree-node-parent").node()).appendChild(o),select(s).append("div").attr("class","hx-tree-node-parent-icon hx-tree-node-parent-icon-disabled").append("i").attr("class","hx-icon hx-icon-chevron-right"))},recurseUpTree=function(e){var t,i;if((i=select(e)).classed("hx-tree-node")&&(e=e.parentNode,i.select(":scope > .hx-tree-node-children").style("display","block")),null!=(t=e.parentNode)&&this.selection.node().contains(e))return recurseUpTree.call(this,t)},exports.Tree=function(){function e(e,t){this.selector=e,this.options=exports.mergeDefined({hideDisabledButtons:!1,animate:!0,renderer:function(e,t){return select(e).node().innerHTML=t.name||t},items:[],lazy:!1},t),this.selection=select(this.selector).classed("hx-tree hx-openable",!0).api("tree",this).api(this),null!=this.options.items&&this.options.items.length>0&&this.items(this.options.items),this.refresh(!1)}return e.prototype.refresh=function(e){return e=null!=e?e:this.options.animate,formatChildren(this,this.selection.selectAll(".hx-tree-node"),e),this},e.prototype.renderer=function(e){return null!=e?(this.options.renderer=e,this):this.options.renderer},e.prototype.items=function(e){return null!=e?(this.options.items=e,this.selection.clear(),createNodeView(this.selection,this.renderer(),this.options.lazy).apply(e),this.refresh(!1),this):this.options.items},e.prototype.show=function(e,t){return e=null!=e?e:this.options.animate,null!=t?recurseUpTree.call(this,t):this.selection.selectAll(".hx-tree-node-children").style("display","block"),this.selection.classed("hx-opened",!0),this.refresh(e),this},e.prototype.hide=function(e,t){var i;return null!=t?((i=select(t)).classed("hx-tree-node")||(i=i.closest(".hx-tree-node")),i.select(":scope > .hx-tree-node-children").style("display","none"),this.selection.selectAll(".hx-tree-node-children").style("display").some((function(e){return"block"===e}))||this.selection.classed("hx-opened",!1)):(this.selection.classed("hx-opened",!1),this.selection.selectAll(".hx-tree-node-children").style("display","none")),e=null!=e?e:this.options.animate,this.refresh(e),this},e}(),exports.tree=function(e){var t;return t=div(),new exports.Tree(t.node(),e),t},exports.initializeTrees=function(e){return selectAll(e).nodes.map((function(e){return new exports.Tree(e)}))},deprecatedWarning$1=function(e){return logger.deprecated(e,"fetch (native browser function) - https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API")},respondToRequest=function(e,t,i,n,r,o){var a,s,l;if(s=null!=i?{url:t,data:i}:t,(l=e.status)>=200&&l<300||304===l){try{a=r.formatter(e)}catch(e){return void n(e,void 0,s,o)}n(void 0,a,s,o)}else n(e,void 0,s,o)},sendRequest=function(e,t,i,n){var r,o,a,s;for(r in e.open(n.requestType,t,!0),o=n.headers)s=o[r],e.setRequestHeader(r,s);return n.responseType&&(e.responseType=n.responseType),n.contentType&&e.overrideMimeType(n.contentType),a=null!=i&&"string"!=typeof i?JSON.stringify(i):i,e.send(a)},performRequest=function(e,t,i,n,r){var o,a,s,l,c;return void 0===t&&(t=null),void 0===n&&(n={}),s={requestType:"GET",formatter:exports.identity,headers:{}},(n=exports.merge(s,n)).contentType&&(null==(o=n.headers)["Content-Type"]&&(o["Content-Type"]=n.contentType),null==(a=n.headers).accept&&(a.accept=n.contentType+",*/*")),"GET"===n.requestType&&t&&(n.requestType="POST"),c=function(){return respondToRequest(l,e,t,i,n,r)},(l=new XMLHttpRequest).onload=l.onerror=c,sendRequest(l,e,t,n)},hx_xhr=function(e,t,i,n,r){var o,a,s,l,c,u,d;if("array"===e){for(c=[],o=function(e,i,r,o){var a,s;if(c[o]={data:i,source:r},n(e,i,r,o),c.filter((function(e){return void 0!==e})).length===t.length)return s=c.map((function(e){return e.source})),a=c.map((function(e){return e.data})),n(e,a,s,-1)},u=[],a=s=0,l=t.length;s<l;a=++s)d=t[a],exports.isObject(d)&&(i=d.data||i,d=d.url),u.push(performRequest(d,i,o,r,a));return u}return"object"===e?(i=t.data||i,d=t.url):d=t,performRequest(d,i,n,r)},standardRequest=function(){var e,t,i,n,r;if(r=arguments[0],(n=function(){switch(!1){case!exports.isArray(r):return"array";case!exports.isObject(r):return"object";case!exports.isString(r):return"string"}}())&&("array"!==n||0!==r.length))return exports.isFunction(arguments[1])?(e=arguments[1],i=arguments[2]):(t=arguments[1],e=arguments[2],i=arguments[3]),hx_xhr(n,r,t||null,e,i);console.error("Incorrect URL passed into request: ",r)};var request=function(){return deprecatedWarning$1("request"),standardRequest.apply(null,arguments)};parsers={"application/json":function(e){if(e)return JSON.parse(e)},"text/html":function(e){return parseHTML.call(request,e)},"text/plain":function(e){return e}},exports.reshapedRequest=function(e){var t;return t=function(){switch(e){case"application/json":return"hx.json";case"text/html":return"hx.html";case"text/plain":return"hx.text";case void 0:return"hx.reshapedRequest"}}(),function(i,n,r,o){var a,s;return deprecatedWarning$1(t),exports.isFunction(n)&&(n=(a=[void 0,n,r])[0],r=a[1],o=a[2]),s=e?{contentType:e,formatter:function(t){return parsers[e](t.responseText)}}:{formatter:function(e){var t,i;return t=e.getResponseHeader("content-type").split(";")[0],(i=parsers[t])?i(e.responseText):(logger.warn("Unknown parser for mime type "+t+", carrying on anyway"),e)}},o=exports.merge(s,o),standardRequest(i,n,r,o)}};var json=exports.reshapedRequest("application/json"),html=exports.reshapedRequest("text/html"),text=exports.reshapedRequest("text/plain");exports.reshapedRequest=exports.reshapedRequest();var advancedSearchCriteriaValidate,capitalize,collapseBreakPoint,columnOptionLookup,createAdvancedSearchView,createPageSizeBlock,createPaginationBlock,defaultTermLookup,fullWidthColSpan,getFiltered,getRowSearchTerm,spacer,splitArray,stripLeadingAndTrailingWhitespaceRegex,toCriteriaItems,urlFeed,whitespaceSplitRegex,splice=[].splice;exports.userFacingText({dataTable:{addFilter:"Add Filter",advancedSearch:"Advanced Search",and:"and",anyColumn:"Any column",clearFilters:"Clear Filters",clearSelection:"clear selection",loading:"Loading",noData:"No Data",noSort:"No Sort",or:"or",rowsPerPage:"Rows Per Page",search:"Search",selectedRows:"$selected of $total selected.",sortBy:"Sort By",contains:"contains",excludes:"does not contain",startsWith:"starts with",fuzzy:"fuzzy matches",regex:"matches regex",exact:"is exactly",greater:"is greater than",less:"is less than"}}),fullWidthColSpan=999,collapseBreakPoint=480,columnOptionLookup=function(e,t,i){return void 0!==e.columns&&void 0!==e.columns[i]&&void 0!==e.columns[i][t]?e.columns[i][t]:e[t]},toCriteriaItems=function(e){return exports.unique(e).map((function(e){return{value:e,text:exports.userFacingText("dataTable",e)}}))},advancedSearchCriteriaValidate=function(e){var t,i;return t=exports.filterTypes(),exports.isArray(e)&&e.every((function(e){return~t.indexOf(e)}))||void 0===e?e||[]:exports.isArray(e)?(i=e.filter((function(e){return!~t.indexOf(e)})),logger.warn("Invalid Filter Criteria Specified:",i,"\nPlease select a value from filterStringTypes()",t),[]):(logger.warn("Expected an array of filter criteria but was passed:",e),[])},splitArray=function(e,t){var i,n;return i=0===t?[]:e.slice(0,t),n=t===e.length-1?[]:e.slice(t+1,e.length),[i,e[t],n]},createPaginationBlock=function(e){var t,i,n,r,o;return o=(i=div("hx-data-table-paginator")).append("button").class("hx-data-table-paginator-picker hx-btn hx-btn-invisible").node(),n=new PickerBase(o,{dropdownOptions:{align:"rbrt"}}).on("change","hx.data-table",(function(t){if("user"===t.cause)return e.page(t.value.value,void 0,t.cause)})),i.append("span").class("hx-data-table-paginator-total-rows"),(t=i.append("button").class("hx-data-table-paginator-back hx-btn hx-btn-invisible")).append("i").class("hx-icon hx-icon-chevron-left"),t.on("click","hx.data-table",(function(){if(!t.classed("hx-data-table-btn-disabled"))return e.page(e.page()-1)})),(r=i.append("button").class("hx-data-table-paginator-forward hx-btn hx-btn-invisible")).append("i").class("hx-icon hx-icon-chevron-right"),r.on("click","hx.data-table",(function(){if(!r.classed("hx-data-table-btn-disabled"))return e.page(e.page()+1)})),[i,n]},createPageSizeBlock=function(e,t){var i,n;return(i=div("hx-data-table-page-size")).append("span").text(t.rowsPerPageText+": "),n=i.append("button").class("hx-data-table-page-size-picker hx-btn hx-btn-invisible").node(),[i,new PickerBase(n,{dropdownOptions:{align:"rbrt"}}).on("change","hx.data-table",(function(t){if("user"===t.cause)return e.pageSize(t.value.value,void 0,"user"),e.page(1,void 0,"user")}))]},spacer=function(){return div("hx-data-table-spacer")},createAdvancedSearchView=function(e,t,n){var r,o,a,s;return a=function(e,r){return function(o,a,s){var l,c,u,d,h,p,f,g,x,m,v,y,b;return y={items:[{text:exports.userFacingText("dataTable","and"),value:"and"},{text:exports.userFacingText("dataTable","or"),value:"or"}],fullWidth:!0},(b=pickerBase(y).classed("hx-btn-outline hx-data-table-advanced-search-type hx-section hx-fixed",!0)).api("picker").on("change",(function(i){var n,o,a,l,c,u,d,h,p,f,g;if("user"===i.cause)return p=t.advancedSearch(),c=(n=splitArray(p,r))[0],e=n[1],f=n[2],h="or"===i.value.value?(u=(o=splitArray(e,s))[0],a=o[1],g=o[2],c.concat([u],[[a].concat(g)],f)):(l=c.slice(0),d=splice.call(l,-1)[0],l.concat([d.concat(e)],f)),t.advancedSearch(h)})),l={text:n.anyColumnText,value:"any",anyColumn:!0},c=o.headers.map((function(e){return{value:e.id,orig:e}})),h=function(e,t){return t.anyColumn?select(e).text(t.text):columnOptionLookup(n,"headerCellRenderer",t.orig.id)(e,t.orig,o.headers)},u={items:[l].concat(c),renderer:h,fullWidth:!0},(d=pickerBase(u).classed("hx-btn-outline hx-data-table-advanced-search-column hx-section hx-fixed",!0)).api("picker").on("change",(function(i){var o,a,l,c,u,d,h,p,f,x,m;if("user"===i.cause)return f=t.advancedSearch(),d=(o=splitArray(f,r))[0],e=o[1],x=o[2],h=(a=splitArray(e,s))[0],u=a[1],m=a[2],delete(p=exports.merge(u,{column:i.value.value})).criteria,l=columnOptionLookup(n,"advancedSearchCriteria",i.value.value)||[],c=["contains"].concat(advancedSearchCriteriaValidate(l)),g.api("picker").items(toCriteriaItems(c)),t.advancedSearch(d.concat([h.concat([p],m)],x))})),f={items:toCriteriaItems(["contains"].concat(advancedSearchCriteriaValidate(n.advancedSearchCriteria))),fullWidth:!0},(g=pickerBase(f).classed("hx-btn-outline hx-data-table-advanced-search-criteria hx-section hx-fixed",!0)).api("picker").on("change",(function(i){var n,o,a,l,c,u,d,h,p;if("user"===i.cause)return d=t.advancedSearch(),l=(n=splitArray(d,r))[0],e=n[1],h=n[2],c=(o=splitArray(e,s))[0],a=o[1],p=o[2],u=exports.merge(a,{criteria:i.value.value}),t.advancedSearch(l.concat([c.concat([u],p)],h))})),p=div("hx-data-table-advanced-search-criteria-placeholder hx-text-disabled hx-background-disabled").text(exports.userFacingText("dataTable","contains")),x=exports.debounce(200,(function(i){var n,o,a,l,c,u,d,h,p;return d=t.advancedSearch(),l=(n=splitArray(d,r))[0],e=n[1],h=n[2],c=(o=splitArray(e,s))[0],a=o[1],p=o[2],u=exports.merge(a,{term:i.target.value}),t.advancedSearch(l.concat([c.concat([u],p)],h))})),v=detached("input").attr("placeholder",n.advancedSearchPlaceholder).class("hx-data-table-advanced-search-input hx-section").attr("required","required").on("input",x),m=button("hx-btn hx-negative hx-btn-outline hx-data-table-advanced-search-remove").add(i("hx-icon hx-icon-close")).on("click",(function(){var i,n,o,a,l,c,u,d,h,p,f,g;return p=t.advancedSearch(),d=(i=splitArray(p,r))[0],e=i[1],f=i[2],h=(n=splitArray(e,s))[0],n[1],g=n[2],a=(0===s&&0===r?[g].concat(f):0===s?(c=d.slice(0),u=splice.call(c,-1)[0],(o=e)[0],l=o.slice(1),c.concat([u.concat(l)],f)):d.concat([h.concat(g)],f)).filter((function(e){return e.length})),t.advancedSearch(a.length?a:void 0)})),this.append("div").class("hx-data-table-advanced-search-filter hx-section hx-input-group hx-input-group-full-width").add(b).add(d).add(p).add(g).add(div("hx-data-table-advanced-search-filter-input-container hx-input-group hx-no-pad hx-no-border").add(v).add(m)).node()}},s=function(e,t,i){var r,o,a,s,l=e.term,c=e.column,u=e.criteria;return(a=select(t)).select(".hx-data-table-advanced-search-type").api("picker").value(0===i?"or":"and"),s=c||"any",a.select(".hx-data-table-advanced-search-column").api("picker").value(s),r=columnOptionLookup(n,"advancedSearchCriteria",c)||[],o="any"===s?["contains"]:["contains"].concat(advancedSearchCriteriaValidate(r)),a.select(".hx-data-table-advanced-search-criteria").style("display",1===o.length?"none":"block").api("picker").items(toCriteriaItems(o)).value(u||"contains"),a.select(".hx-data-table-advanced-search-criteria-placeholder").style("display",1===o.length?"block":"none"),a.select(".hx-data-table-advanced-search-input").value(l||"")},r=function(e,t,i){var n,r;return r=(n=div("hx-data-table-advanced-search-filter-group")).view(".hx-data-table-advanced-search-filter").enter(a(e,i)).update(s),n.api("data-table.group",{filterGroupView:r}),this.append(n).node()},o=function(e,t,i){return select(t).api("data-table.group").filterGroupView.apply(e)},e.view(".hx-data-table-advanced-search-filter-group").enter(r).update(o)},exports.DataTable=function(){var e,t,n,r=function(e){function t(t,n){var r,o,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S,k,T,A,C,_,M,P,E,D,z,L,F,I,O,R,B,N,V,j,H,G,U,W,$,Y=this;e.call(this),(j=exports.merge({allowHeaderWrap:!1,compact:"auto",displayMode:"paginate",feed:void 0,showSearchAboveTable:!1,filter:void 0,filterEnabled:!0,showAdvancedSearch:!1,advancedSearchEnabled:!1,advancedSearchCriteria:void 0,advancedSearch:void 0,pageSize:15,pageSizeOptions:void 0,retainHorizontalScrollOnRender:!0,retainVerticalScrollOnRender:!1,selectEnabled:!1,singleSelection:!1,sort:void 0,sortEnabled:!0,highlightOnHover:!0,useStickyHeaders:!0,selectedRows:[],expandedRows:[],rowIDLookup:function(e){return e.id},rowEnabledLookup:function(e){return!e.disabled},rowSelectableLookup:function(e){return!0},rowCollapsibleLookup:function(e){return!1},collapsibleRenderer:void 0,cellRenderer:function(e,t,i){return select(e).text(t)},headerCellRenderer:function(e,t,i){return select(e).text(t.name)},columns:{},clearSelectionText:exports.userFacingText("dataTable","clearSelection"),loadingText:exports.userFacingText("dataTable","loading"),noDataMessage:exports.userFacingText("dataTable","noData"),noSortText:exports.userFacingText("dataTable","noSort"),rowsPerPageText:exports.userFacingText("dataTable","rowsPerPage"),searchPlaceholder:exports.userFacingText("dataTable","search"),selectedRowsText:exports.userFacingText("dataTable","selectedRows",!0),sortByText:exports.userFacingText("dataTable","sortBy"),addFilterText:exports.userFacingText("dataTable","addFilter"),clearFiltersText:exports.userFacingText("dataTable","clearFilters"),anyColumnText:exports.userFacingText("dataTable","anyColumn"),advancedSearchText:exports.userFacingText("dataTable","advancedSearch"),advancedSearchPlaceholder:exports.userFacingText("dataTable","search")},n)).pageSize=Math.min(j.pageSize,1e3),j.advancedSearch&&(j.advancedSearchEnabled=!0),j.advancedSearchEnabled&&(j.showAdvancedSearch=!0),H=select(t).classed("hx-data-table",!0).api("data-table",this).api(this),b=div("hx-data-table-content"),P=div("hx-data-table-loading").add(div("hx-data-table-loading-inner").add(div("hx-spinner")).add(span().text(" "+j.loadingText))),U=div("hx-data-table-status-bar"),$=span("hx-data-table-status-bar-text"),W=span("hx-data-table-status-bar-clear").text(" ("+j.clearSelectionText+")").on("click","hx.data-table",(function(){return Y._.selectedRows.clear(),H.select(".hx-data-table-content").selectAll(".hx-data-table-row-selected").classed("hx-data-table-row-selected",!1),Y.updateSelected(),Y.emit("selectedrowsclear")})),k=div("hx-data-table-control-panel-compact"),T=button("hx-data-table-control-panel-compact-toggle hx-btn hx-btn-invisible").add(i("hx-icon hx-icon-bars")).on("click",(function(){var e;return(e=w).classed("hx-data-table-compact-hide")?e.classed("hx-data-table-compact-hide",!1).style("height","0px").morph().with("expandv",150).then((function(){return k.classed("hx-data-table-control-panel-compact-open",!0)})).go():e.morph().with("collapsev",50).then((function(){return e.classed("hx-data-table-compact-hide",!0),k.classed("hx-data-table-control-panel-compact-open",!1)})).thenStyle("display","").go()})),w=div("hx-data-table-control-panel hx-data-table-compact-hide"),A=div("hx-data-table-control-panel-inner"),y=div("hx-data-table-sort").classed("hx-data-table-sort-visible",j.sortEnabled).add(span().text(j.sortByText+": ")),(G=new PickerBase(y.append("button").class("hx-btn hx-btn-invisible").node())).on("change","hx.data-table",(function(e){if("user"===e.cause)return Y.sort({column:G.value().column,direction:G.value().direction})})),_=div("hx-data-table-filter-container"),E=exports.debounce(200,(function(){return Y.filter(M.value(),void 0,"user")})),M=detached("input").class("hx-data-table-filter").attr("placeholder",j.searchPlaceholder).classed("hx-data-table-filter-visible",j.filterEnabled).on("input","hx.data-table",E),f=div("hx-data-table-advanced-search-container"),g=button("hx-data-table-advanced-search-toggle hx-btn hx-btn-invisible").text(j.advancedSearchText),(x=new exports.Toggle(g.node())).on("change",(function(e){return Y.advancedSearchEnabled(e)})),u=div("hx-data-table-advanced-search"),m=createAdvancedSearchView(u,this,j),h=div("hx-data-table-advanced-search-buttons"),c=function(){var e,t;return t=(Y.advancedSearch()||[[]]).slice(0),e=splice.call(t,-1)[0].concat([{column:"any",term:""}]),Y.advancedSearch(t.concat([e]))},v=function(){return Y.advancedSearch(void 0)},d=button("hx-btn hx-positive hx-data-table-advanced-search-add-filter hx-data-table-advanced-search-button hx-btn-outline").add(i("hx-data-table-advanced-search-icon hx-icon hx-icon-plus hx-text-positive")).add(span().text(j.addFilterText)).on("click",c),p=button("hx-btn hx-negative hx-data-table-advanced-search-clear-filters hx-data-table-advanced-search-button hx-btn-outline").add(i("hx-data-table-advanced-search-icon hx-icon hx-icon-close hx-text-negative")).add(span().text(j.clearFiltersText)).on("click",v),F=(r=createPageSizeBlock(this,j))[0],O=r[1],I=(o=createPageSizeBlock(this,j))[0],R=o[1],B=(a=createPaginationBlock(this))[0],D=a[1],N=(s=createPaginationBlock(this))[0],z=s[1],V=(l=createPaginationBlock(this))[0],L=l[1],B.classed("hx-data-table-compact-hide",!0),S=div("hx-data-table-control-panel-bottom"),H.add(b).add(U.add($).add(W)).add(k.add(V).add(spacer()).add(T)).add(w.add(A.add(y).add(B).add(F).add(spacer()).add(_.add(g).add(M))).add(f.add(u).add(h.add(d).add(p)))).add(S.add(spacer()).add(I).add(N)).add(P),this._={selection:H,options:j,page:1,pagePickers:[D,L,z],pageSizePickers:[O,R],statusBar:U,sortColPicker:G,selectedRows:new Set(j.selectedRows),expandedRows:new Set(j.expandedRows),renderedCollapsibles:{},compactState:"auto"===j.compact&&H.width()<collapseBreakPoint||!0===j.compact,advancedSearchView:m,advancedSearchToggleButton:x},H.on("resize","hx.data-table",(function(){var e;if(H.selectAll(".hx-data-table-collapsible-content-container").map((function(e){return e.style("max-width",parseInt(H.style("width"))-Y._.collapsibleSizeDiff+"px")})),e="auto"===Y.compact()&&H.width()<collapseBreakPoint||!0===Y.compact(),H.classed("hx-data-table-compact",e),Y._.compactState!==e)return Y._.compactState=e,Y.emit("compactchange",{value:Y.compact(),state:e,cause:"user"})})),C=exports.randomId(),select("body").on("keydown","hx.data-table.shift."+C,(function(e){if(e.shiftKey&&Y.selectEnabled())return H.classed("hx-data-table-disable-text-selection",!0)})),select("body").on("keyup","hx.data-table.shift."+C,(function(e){if(!e.shiftKey&&Y.selectEnabled())return H.classed("hx-data-table-disable-text-selection",!1)}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.page=function(e,t,i){return arguments.length>0?(this._.page=Math.max(1,e),null!=this._.numPages&&(this._.page=Math.min(this._.page,this._.numPages)),this.emit("pagechange",{value:this._.page,cause:i||"api"}),this.render(t),this):this._.page},t.prototype.selectedRows=function(e,t){var i;return arguments.length>0&&!exports.isFunction(e)?(this.singleSelection()&&exports.isArray(e)&&e.length&&(e=[e[0]]),this._.selectedRows=new Set(e),i=this._.selectedRows.values(),this.emit("selectedrowschange",{value:i,cause:"api"}),this._.userLastSelectedIndex=void 0,this.render(t),this):this._.selectedRows.values()},t.prototype.expandedRows=function(e,t){return arguments.length>0&&!exports.isFunction(e)?(this._.expandedRows=new Set(e),this.render(t),this.emit("expandedrowschange",{value:this._.expandedRows.values(),cause:"api"}),this):this._.expandedRows.values()},t.prototype.rowsForIds=function(e,t){return null!=t&&this.feed().rowsForIds(e,this.rowIDLookup(),t),this},t.prototype.renderSuppressed=function(e){return arguments.length>0?(this._.renderSuppressed=e,this):this._.renderSuppressed},t.prototype.render=function(e){var t,i,n,r,o,a,s,l,c,u,d,h,p,f,g,x=this;if(!this._.renderSuppressed){if(void 0!==(n=this.feed())&&void 0!==n.headers&&void 0!==n.totalCount&&void 0!==n.rows)return d=this._.selection,l=this._.options,o=function(e,t){return columnOptionLookup(l,e,t)},u=function(e,t){return e.map((function(e){return t.cells[e.id]}))},g=(p=(i=div("hx-data-table-content")).append("table").class("hx-data-table-table hx-table").classed("hx-table-no-hover",!l.highlightOnHover)).append("thead").class("hx-data-table-head"),f=p.append("tbody").class("hx-data-table-body"),a=g.append("tr").class("hx-data-table-row"),d.select(".hx-data-table-loading").style("display",""),t=(!l.filterEnabled||l.showAdvancedSearch)&&l.advancedSearchEnabled,r=d.select(".hx-data-table-filter").classed("hx-data-table-filter-visible",l.filterEnabled&&!t),(s=this.filter())!==r.value()&&r.value(s),this._.advancedSearchToggleButton.value(l.advancedSearchEnabled),d.select(".hx-data-table-advanced-search-toggle").classed("hx-data-table-advanced-search-visible",l.filterEnabled&&l.showAdvancedSearch),d.select(".hx-data-table-advanced-search-container").classed("hx-data-table-advanced-search-visible",t),d.select(".hx-data-table-control-panel").classed("hx-data-table-filter-enabled",l.filterEnabled),h=l.filterEnabled||l.sortEnabled||l.advancedSearchEnabled||(null!=(c=l.pageSizeOptions)?c.length:void 0),d.select(".hx-data-table-control-panel-compact-toggle").classed("hx-data-table-control-panel-compact-toggle-visible",h),n.headers((function(r){var s;return t&&(s=x.advancedSearch()||[],x._.advancedSearchView.apply(s.filter((function(e){return e.length})).map((function(e){return e.map((function(e){return exports.merge(e,{headers:r,getColumnOption:o})}))})))),d.select(".hx-data-table-sort").classed("hx-data-table-sort-visible",l.sortEnabled||r.some((function(e){return o("sortEnabled",e.id)}))),n.totalCount((function(t){var s,c,p;return"paginate"===l.displayMode?(p=(x.page()-1)*l.pageSize,s=x.page()*l.pageSize-1):(p=void 0,s=void 0),c={start:p,end:s,sort:x.sort(),filter:x.filter(),advancedSearch:x.advancedSearch(),useAdvancedSearch:l.showAdvancedSearch&&l.advancedSearchEnabled},n.rows(c,(function(n){var c,g,m,v,y,b,w,S,k,T,A,C,_,M,P,E,D,z,L,F,I,O,R,B,N,V,j,H,G,U,W,$,Y,q,Z=n.rows,K=n.filteredCount;if("paginate"===l.displayMode&&(P=!1,d.classed("hx-data-table-infinite",void 0===K),void 0===K?(x._.numPages=void 0,D=p+1+" - "+(s+1),P=!0):(x._.numPages=Math.max(1,Math.ceil(K/l.pageSize)),x.page()>x._.numPages&&x.page(x._.numPages),P=x._.numPages>1,K>0&&x._.numPages>1&&(D="of "+K,A=function(){var e,t,i;for(i=[],T=e=1,t=this._.numPages;e<=t;T=e+=1)E=T*l.pageSize,i.push({text:E+1-l.pageSize+" - "+Math.min(E,K),value:T});return i}.call(x),x._.pagePickers.forEach((function(e){return e.items(A).value(x.page())})))),d.selectAll(".hx-data-table-paginator").classed("hx-data-table-paginator-visible",P),d.selectAll(".hx-data-table-paginator-total-rows").text(D||""),d.selectAll(".hx-data-table-paginator-back").classed("hx-data-table-btn-disabled",1===x.page()),d.selectAll(".hx-data-table-paginator-forward").classed("hx-data-table-btn-disabled",x.page()===x._.numPages)),d.select(".hx-data-table-control-panel-compact").classed("hx-data-table-control-panel-compact-visible",P||h),d.select(".hx-data-table-control-panel-bottom").classed("hx-data-table-control-panel-bottom-visible",P||(null!=(O=l.pageSizeOptions)?O.length:void 0)),d.select(".hx-data-table-control-panel").classed("hx-data-table-control-panel-visible",P||h),r.some((function(e){return o("sortEnabled",e.id)}))&&(y=x.sort()||{},W=exports.flatten(r.map((function(e){if(o("sortEnabled",e.id))return[{text:e.name,value:e.id+"asc",column:e.id,direction:"asc",cell:e},{text:e.name,value:e.id+"desc",column:e.id,direction:"desc",cell:e}]})).filter(exports.defined)),x._.sortColPicker.renderer((function(e,t){return t.value?(o("headerCellRenderer",t.cell.id)(e,t.cell,r),select(e).append("i").class("hx-data-table-compact-sort-arrow hx-icon hx-icon-chevron-"+("asc"===t.direction?"up":"down"))):select(e).text(t.text)})).items([{text:l.noSortText,value:void 0}].concat(W)),y.column&&x._.sortColPicker.value().value!==y.column+y.direction&&x._.sortColPicker.value({value:y.column+y.direction})),G=null!=l.pageSizeOptions&&l.pageSizeOptions.length>0,d.selectAll(".hx-data-table-page-size").classed("hx-data-table-page-size-visible",G),G&&(-1===l.pageSizeOptions.indexOf(l.pageSize)&&l.pageSizeOptions.push(l.pageSize),z=l.pageSizeOptions.sort(exports.compare).map((function(e){return{text:e,value:e}})),x._.pageSizePickers.forEach((function(e){return e.items(z).value(l.pageSize)}))),r.some((function(e){return null!=e.groups})))for(B=r.filter((function(e){return null!=e.groups})).map((function(e){return e.groups.length})),M=Math.max.apply(null,B),k=r.map((function(e){var t;for(t=e.groups||[];t.length<M;)t.push("");return t})),N=C=M-1;C>=0;N=C+=-1)for(b=a.insertBefore("tr"),(l.selectEnabled||null!=l.collapsibleRenderer)&&b.append("th").class("hx-data-table-control"),v=1,m=_=1,R=k.length;_<=R;m=_+=1)g=k[m],F=k[m-1],null!=g&&null!=F&&(L=g.slice(N,M).toString(),I=F.slice(N,M).toString()),m!==k.length&&g[N]===F[N]&&L===I||(b.append("th").attr("colspan",v).class("hx-data-table-cell-grouped").text(F[N]),v=0),v++;return(l.selectEnabled||null!=l.collapsibleRenderer)&&(S=a.append("th").class("hx-data-table-control hx-table-head-no-border")),l.selectEnabled&&!l.singleSelection&&(w=S.append("div").class("hx-data-table-checkbox").on("click","hx.data-table",(function(){var e;if(Z.length>0)return e=Z.filter((function(e){return l.rowEnabledLookup(e)})),H(0,Z.length-1,!e.every((function(e){return x._.selectedRows.has(l.rowIDLookup(e))})))})),w.append("i").class("hx-icon hx-icon-check")),r.forEach((function(e,t){var i,n,s;if(n=(i=a.append("th").class("hx-data-table-cell").classed("hx-table-header-allow-wrap",o("allowHeaderWrap",e.id))).append("div").class("hx-data-table-cell-inner"),o("headerCellRenderer",e.id)(n.append("span").class("hx-data-table-title").node(),e,r),o("sortEnabled",e.id))return i.classed("hx-data-table-cell-sort-enabled",!0),s=(y=x.sort())&&y.column===e.id?"hx-icon-sort-"+y.direction+" hx-data-table-sort-on":"hx-icon-sort",n.append("i").class("hx-icon "+s+" hx-data-table-sort-icon"),i.on("click","hx.data-table",(function(){var t;return t=(y=x.sort()||{}).column===e.id?"asc"===y.direction?"desc":void 0:"asc",m=void 0!==t?e.id:void 0,x.sort({column:m,direction:t},void 0,"user")}))})),x.updateSelected=function(){var e,n,r,o,a,s,c,u;if(s=function(e){return function(t){return t.node().parentNode===e.node()}},n=function(e){return e.selectAll(".hx-data-table-row").filter(s(e)).classed("hx-data-table-row-selected",!1)},c=n(f),e=n(i.select(".hx-sticky-table-header-left").select("tbody")),x._.selectedRows.size>0)for(u=o=0,r=Z.length;o<r;u=++o)N=Z[u],x._.selectedRows.has(l.rowIDLookup(N))&&(select(c.nodes[u]).classed("hx-data-table-row-selected",!0),null!=e.nodes[u]&&select(e.nodes[u]).classed("hx-data-table-row-selected",!0));if(a=f.selectAll(".hx-data-table-row-selected").size()>0,d.classed("hx-data-table-has-page-selection",a&&!l.singleSelection),d.classed("hx-data-table-has-selection",x._.selectedRows.size>0&&!l.singleSelection),void 0!==t)return x._.statusBar.select(".hx-data-table-status-bar-text").text(exports.userFacingText.format(l.selectedRowsText,{selected:x._.selectedRows.size,total:t}))},H=function(e,t,i){var n,r,o,a,s,c;for(s=[],T=o=e,c=t;o<=c;T=o+=1)s.push(Z[T]);for(a=0,r=s.length;a<r;a++)N=s[a],l.rowEnabledLookup(N)&&l.rowSelectableLookup(N)&&(n=l.rowIDLookup(N),x._.selectedRows[i?"add":"delete"](n),x.emit("selectedrowschange",{row:N,rowValue:x._.selectedRows.has(n),value:x.selectedRows(),cause:"user"}));return x.updateSelected()},U=function(e,t,i){var n,r,o;if(null!=x._.userLastSelectedIndex)if(l.singleSelection&&t!==x._.userLastSelectedIndex)x._.selectedRows.clear();else if(i&&t!==x._.userLastSelectedIndex)return r=x._.selectedRows.has(l.rowIDLookup(Z[x._.userLastSelectedIndex])),void(t>x._.userLastSelectedIndex?H(x._.userLastSelectedIndex+1,t,r):H(t,x._.userLastSelectedIndex,r));return x._.userLastSelectedIndex=t,l.rowSelectableLookup(e)&&(o=l.rowIDLookup(e),n=x._.selectedRows.has(o)?"delete":"add",x._.selectedRows[n](o),x.emit("selectedrowschange",{row:e,rowValue:x._.selectedRows.has(o),value:x.selectedRows(),cause:"user"})),x.updateSelected()},c=function(){var e,t,i;return t=detached("tr").class("hx-data-table-collapsible-content-row"),i=detached("tr").class("hx-data-table-collapsible-row-spacer"),t.append("td").class("hx-data-table-collapsible-cell hx-data-table-collapsible-cell-empty"),e=t.append("td").class("hx-data-table-collapsible-cell").attr("colspan",fullWidthColSpan).append("div").class("hx-data-table-collapsible-content-container").append("div").class("hx-data-table-collapsible-content"),{contentRow:t,hiddenRow:i,contentDiv:e}},Y=function(e,t,i){var n,r,o,a;return a=l.rowIDLookup(t),n=x._.renderedCollapsibles[a]||c(),x._.renderedCollapsibles[a]=n,e.insertAfter(n.hiddenRow).insertAfter(n.contentRow),r=null!=i?i:!n.contentRow.classed("hx-data-table-collapsible-row-visible"),n.contentRow.classed("hx-data-table-collapsible-row-visible",r),e.classed("hx-data-table-collapsible-row-visible",r),e.select(".hx-data-table-collapsible-toggle").select("i").class(r?"hx-icon hx-icon-minus":"hx-icon hx-icon-plus"),r?l.collapsibleRenderer(n.contentDiv.node(),t):(x._.renderedCollapsibles[a].contentRow.remove(),x._.renderedCollapsibles[a].hiddenRow.remove(),delete x._.renderedCollapsibles[a]),x._.expandedRows[r?"add":"delete"](a),null!=(o=x._.stickyHeaders)&&o.render(),x._.collapsibleSizeDiff=parseInt(d.style("width"))-parseInt(select(n.contentDiv.node().parentNode).style("width")),r},void 0===K||K>0?Z.forEach((function(e,t){var i,n,a,s,c,d,h,p,g,m,v,y,b,w,S;for((S=f.append("tr").class("hx-data-table-row").classed("hx-data-table-row-selected",x._.selectedRows.has(l.rowIDLookup(e))).classed("hx-data-table-row-disabled",!l.rowEnabledLookup(e))).on("click","hx.data-table",(function(t){return x.emit("rowclick",{data:e,node:S.node()})})),w=l.rowCollapsibleLookup(e),S.classed("hx-data-table-row-select-enabled",l.selectEnabled),(l.selectEnabled||null!=l.collapsibleRenderer)&&(p=S.append("th").class("hx-data-table-control"),l.selectEnabled&&((s=p.append("div").class("hx-data-table-checkbox")).append("i").class("hx-icon hx-icon-check"),l.rowEnabledLookup(e)&&s.on("click","hx.data-table",(function(i){return i.stopPropagation(),U(e,t,i.shiftKey)}))),null!=l.collapsibleRenderer&&(c=p.append("div").class("hx-data-table-collapsible-toggle").classed("hx-data-table-collapsible-disabled",!w)).append("i").class("hx-icon hx-icon-plus"),w&&(x._.expandedRows.has(l.rowIDLookup(e))&&Y(S,e,!0),c.on("click","hx.data-table.collapse-row",(function(t){var i;return i=Y(S,e),x.emit("expandedrowschange",{value:x._.expandedRows.values(),row:e,rowValue:i,cause:"user"})})))),b=[],d=v=0,m=(y=u(r,e)).length;v<m;d=++v)i=y[d],g=div("hx-data-table-cell-key"),o("headerCellRenderer",r[d].id)(g.node(),r[d],r),a=S.append("td").class("hx-data-table-cell"),null!=(h=o("maxWidth",r[d].id))&&(h=parseInt(h)+"px",a.style("max-width",h).style("width",h).style("min-width",h)),n=a.add(g).append("div").class("hx-data-table-cell-value").node(),b.push(o("cellRenderer",r[d].id)(n,i,e));return b})):f.append("tr").class("hx-data-table-row-no-data").append("td").attr("colspan",fullWidthColSpan).text(l.noDataMessage),x.updateSelected(),l.useStickyHeaders&&x.page()===x._.oldPage&&(q=d.select(".hx-data-table-content > .hx-sticky-table-wrapper").node(),l.retainHorizontalScrollOnRender&&(V=q.scrollLeft),l.retainVerticalScrollOnRender&&(j=q.scrollTop)),x._.oldPage=x.page(),d.select(".hx-data-table-content").insertAfter(i),d.select(".hx-data-table-content").remove(),d.classed("hx-data-table-compact","auto"===l.compact&&d.width()<collapseBreakPoint||!0===l.compact).classed("hx-data-table-show-search-above-content",l.showSearchAboveTable),l.useStickyHeaders&&($={stickFirstColumn:(l.selectEnabled||null!=l.collapsibleRenderer)&&(void 0===K||K>0),fullWidth:!0},x._.stickyHeaders=new exports.StickyTableHeaders(i.node(),$)),null!=V&&(d.select(".hx-data-table-content > .hx-sticky-table-wrapper").node().scrollLeft=V),null!=j&&(d.select(".hx-data-table-content > .hx-sticky-table-wrapper").node().scrollTop=j),d.shallowSelect(".hx-data-table-loading").style("display","none"),x.emit("render"),"function"==typeof e?e():void 0}))}))})),this;logger.warn("No feed specified when rendering data table")}},t}(EventEmitter);return n=function(e){return function(t,i,n){var r;return r=this._.options,arguments.length>0?(r[e]=t,this.emit(e.toLowerCase()+"change",{value:t,cause:n||"api"}),this.render(i),this):r[e]}},r.prototype.collapsibleRenderer=n("collapsibleRenderer"),r.prototype.compact=n("compact"),r.prototype.displayMode=n("displayMode"),r.prototype.feed=n("feed"),r.prototype.filter=n("filter"),r.prototype.advancedSearch=n("advancedSearch"),r.prototype.showAdvancedSearch=n("showAdvancedSearch"),r.prototype.advancedSearchEnabled=n("advancedSearchEnabled"),r.prototype.showSearchAboveTable=n("showSearchAboveTable"),r.prototype.filterEnabled=n("filterEnabled"),r.prototype.noDataMessage=n("noDataMessage"),r.prototype.pageSize=n("pageSize"),r.prototype.pageSizeOptions=n("pageSizeOptions"),r.prototype.retainHorizontalScrollOnRender=n("retainHorizontalScrollOnRender"),r.prototype.retainVerticalScrollOnRender=n("retainVerticalScrollOnRender"),r.prototype.rowCollapsibleLookup=n("rowCollapsibleLookup"),r.prototype.rowEnabledLookup=n("rowEnabledLookup"),r.prototype.rowIDLookup=n("rowIDLookup"),r.prototype.rowSelectableLookup=n("rowSelectableLookup"),r.prototype.selectEnabled=n("selectEnabled"),r.prototype.highlightOnHover=n("highlightOnHover"),r.prototype.singleSelection=n("singleSelection"),r.prototype.useStickyHeaders=n("useStickyHeaders"),r.prototype.sort=n("sort"),t=function(e){return function(t,i,n){var r,o;return o=this._.options,arguments.length>1&&exports.isString(t)?(null==(r=o.columns)[t]&&(r[t]={}),o.columns[t][e]=i,this.emit(e.toLowerCase()+"change",{column:t,value:i,cause:"api"}),this.render(n),this):arguments.length>0?exports.isString(t)&&o.columns[t]?o.columns[t][e]:(o[e]=arguments[0],this.emit(e.toLowerCase()+"change",{value:i,cause:"api"}),this.render(arguments[1]),this):o[e]}},r.prototype.advancedSearchCriteria=t("advancedSearchCriteria"),r.prototype.allowHeaderWrap=t("allowHeaderWrap"),r.prototype.cellRenderer=t("cellRenderer"),r.prototype.headerCellRenderer=t("headerCellRenderer"),r.prototype.sortEnabled=t("sortEnabled"),e=function(e){return function(t,i,n){var r,o;if(o=this._.options,exports.isString(t)){if(arguments.length>1)return null==(r=o.columns)[t]&&(r[t]={}),o.columns[t][e]=i,this.emit(e.toLowerCase()+"change",{column:t,value:i,cause:"api"}),this.render(n),this;if(o.columns[t])return o.columns[t][e]}}},r.prototype.maxWidth=e("maxWidth"),r}.call(void 0),whitespaceSplitRegex=/\s+/,stripLeadingAndTrailingWhitespaceRegex=/^\s+|\s+$/g,getRowSearchTerm=function(e,t){var i,n;return function(){var e,r;for(i in r=[],e=t.cells)n=e[i],r.push(n);return r}().map(e).join(" ").toLowerCase()},capitalize=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},defaultTermLookup=function(e,t,i){var n,r,o;return void 0===i&&(i="contains"),r=exports.isString(t)?[t]:t,n=e.replace(stripLeadingAndTrailingWhitespaceRegex,"").split(whitespaceSplitRegex),o=exports.find(n,(function(e){return filter["filter"+capitalize(i)](r,e.toLowerCase()).length})),exports.defined(o)},exports.getAdvancedSearchFilter=function(e,t){return void 0===e&&(e=exports.identity),void 0===t&&(t=defaultTermLookup),function(i,n){var r,o,a,s;return o=function(){var e,t;for(r in t=[],e=n.cells)a=e[r],t.push(a);return t}().map(e).join(" ").toLowerCase(),s=exports.find(i,(function(i){var r;return r=exports.find(i,(function(i){var r;return r="any"===i.column?o:(e(n.cells[i.column])+"").toLowerCase(),i.term&&!t(i.term.toLowerCase(),r,i.criteria)})),!exports.defined(r)})),exports.defined(s)}},getFiltered=function(e,t,i,n,r){return!(null!=t?t.length:void 0)||void 0!==i&&n===t?void 0!==i&&(null!=t?t.length:void 0)?i:e.slice():e.filter(r)},exports.objectFeed=function(e,t){var i,n,r,o,a;return null==(t=exports.merge({cellValueLookup:exports.identity,termLookup:defaultTermLookup,compare:exports.compare},t)).filter&&(t.filter=function(e,i){return t.termLookup(e.toLowerCase(),getRowSearchTerm(t.cellValueLookup,i))}),null==t.advancedSearch&&(t.advancedSearch=exports.getAdvancedSearchFilter(t.cellValueLookup,t.termLookup)),i=void 0,n=void 0,a=void 0,o={},r=void 0,{data:e,headers:function(t){return t(e.headers)},totalCount:function(t){return t(e.rows.length)},rows:function(r,s){var l,c,u,d,h,p,f,g,x;return(null!=(h=r.sort)?h.column:void 0)!==o.column&&(i=void 0),r.useAdvancedSearch?(l=function(e){return t.advancedSearch(r.advancedSearch,e)},i=getFiltered(e.rows,r.advancedSearch,i,n,l),n=r.advancedSearch,a=void 0):(d=function(e){return t.filter(r.filter,e)},i=getFiltered(e.rows,r.filter,i,n,d),n=r.filter,a=void 0),void 0!==a&&o.column===(null!=(p=r.sort)?p.column:void 0)&&o.direction===(null!=(f=r.sort)?f.direction:void 0)||(a=r.sort&&r.sort.column?(u="asc"===r.sort.direction?1:-1,c=r.sort.column,i.sort((function(e,i){return u*t.compare(e.cells[c],i.cells[c])})),i):i,o.column=null!=(g=r.sort)?g.column:void 0,o.direction=null!=(x=r.sort)?x.direction:void 0),s({rows:a.slice(r.start,+r.end+1||9e9),filteredCount:a.length})},rowsForIds:function(t,i,n){var o,a,s,l,c;if(void 0===r)for(r={},a=0,s=(l=e.rows).length;a<s;a++)c=l[a],r[i(c)]=c;return n(function(){var e,i,n;for(n=[],e=0,i=t.length;e<i;e++)o=t[e],n.push(r[o]);return n}())}}},urlFeed=function(e,t){var i,n;return t=exports.merge({extra:void 0,cache:!1},t),i=function(e){return function(t,i){return t&&logger.warn(t),e(i)}},{url:e,headers:(n=function(e){var i;return t.cache?(i=void 0,function(t){return i?t(i):e((function(e){return t(i=e)}))}):function(t){return e(t)}})((function(n){return json(e,{type:"headers",extra:t.extra},i(n))})),totalCount:n((function(n){return json(e,{type:"totalCount",extra:t.extra},(function(e,t){return i(n)(e,t.count)}))})),rows:function(n,r){return json(e,{type:"rows",range:n,extra:t.extra},i(r))},rowsForIds:function(n,r,o){return json(e,{type:"rowsForIds",ids:n,extra:t.extra},i(o))}}},exports.dataTable=function(e){var t,i;return i=div(),t=new exports.DataTable(i,e),e&&e.feed&&t.render(),i},exports.dataTable.objectFeed=exports.objectFeed,exports.dataTable.urlFeed=urlFeed;var getValidationMessage,Sidebar=function(e){function t(t,n){var r,o,a=this;e.call(this),(o=exports.mergeDefined({autoAddSidebarClass:!0},n)).headerSelector=n.headerSelector||".hx-titlebar",o.contentSelector=n.contentSelector||".hx-content",this.selection=select(t).api("sidebar",this).api(this),r=select("body").width()>560,this.selection.classed("hx-sidebar",!0).classed("hx-openable",!0).classed("hx-opened",r),select("body").classed("hx-sidebar-opened",r).node().offsetHeight,o.autoAddSidebarClass&&select("body").classed("hx-sidebar-page",!0),this.selection.classed("hx-animate",!0),select(o.contentSelector).classed("hx-animate",!0),select(o.headerSelector).prepend("button").attr("type","button").class("hx-titlebar-sidebar-button").add(i("hx-icon hx-icon-bars")).on("click","hx.sidebar",(function(){return a.toggle()}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toggle=function(){return this.selection.classed("hx-opened")?this.hide():this.show(),this},t.prototype.hide=function(){return this.selection.classed("hx-opened",!1),select("body").classed("hx-sidebar-opened",!1),this.emit("hide"),this},t.prototype.show=function(){return this.selection.classed("hx-opened",!0),select("body").classed("hx-sidebar-opened",!0),this.emit("show"),this},t}(EventEmitter);getValidationMessage=function(e,t){switch(e.toLowerCase()){case"value missing":return"radio"===t?exports.userFacingText("form","missingRadioValue"):exports.userFacingText("form","missingValue");case"type mismatch":return exports.userFacingText("form","typeMismatch");default:return e}};var createFilteredData,validateForm=function(e,t){var i,n,r,o,a,s,l,c,u,d,h,p,f;for(a=(p=select(e)).classed("hx-flag-form"),l=select(e).node(),i={showMessage:!0},t=exports.mergeDefined(i,t),select(e).selectAll(".hx-form-error").remove(),o=[],s=document.activeElement,u=c=0,h=l.children.length;0<=h?c<h:c>h;u=0<=h?++c:--c)"div"===l.children[u].nodeName.toLowerCase()&&(n=l.children[u].children[1])&&null!==n.offsetParent&&("input"===n.nodeName.toLowerCase()||"textarea"===n.nodeName.toLowerCase()?n.checkValidity()||(f=select(n).attr("type"),o.push({message:getValidationMessage(n.validationMessage,f),node:n,validity:n.validity,focused:s===n})):(d=select(n).select("input").node(),f=select(n).select("input").attr("type"),d&&!d.checkValidity()&&o.push({message:getValidationMessage(d.validationMessage,f),node:n,validity:d.validity,focused:s===d})));return t.showMessage&&o.length>0&&(a?(p.selectAll(".hx-form-message").remove(),o.forEach((function(e){return select(e.node).insertAfter(div("hx-form-message hx-form-message-wrap").text(e.message)),select(e.node).on("click","hx.form-error",(function(t){var i;return(i=select(e.node.nextElementSibling)).classed("hx-form-message")&&i.remove(),select(e.node).off("click","hx.form-error")}))}))):(r=o.filter((function(e){return e.focused}))[0]||o[0],select(r.node.parentNode).insertAfter("div").class("hx-form-error").append("div").insertAfter("div").class("hx-form-error-text-container").append("div").class("hx-form-error-text").text(r.message),select(r.node).on("click","hx.form",(function(e){var t;return(t=select(r.node.parentNode.nextElementSibling)).classed("hx-form-error")&&t.remove(),select(r.node).off("click","hx.form")})))),{valid:0===o.length,errors:o}};exports.userFacingText({tagInput:{placeholder:"add tag..."}}),createFilteredData=function(e,t){return exports.isFunction(t)?function(i,n){return t(i,(function(t){return n(t.filter(e))}))}:exports.isArray(t)?function(i,n){return n(t.filter(e))}:t},exports.TagInput=function(){var e,t=function(t){function i(e,i){var n,r,o,a,s,l,c,u,d,h,p,f=this;t.call(this),this.selector=e,n=this._={},this.options=exports.mergeDefined({classifier:void 0,validator:void 0,draggable:!0,items:[],placeholder:exports.userFacingText("tagInput","placeholder"),autocompleteData:void 0,autocompleteOptions:{},excludeTags:!0,mustMatchAutocomplete:!0,isInsideForm:!1,featureFlags:{useInputClass:!1}},i),this.options.mustMatchAutocomplete&&(this.options.autocompleteOptions.mustMatch=!0),this.selection=select(this.selector).classed("hx-tag-input",!0).classed("hx-flag-tag-input",this.options.featureFlags.useInputClass).api("tag-input",this).api(this),this.tagContainer=this.selection.append("span").class("hx-tags-container"),this.options.draggable&&(n.dragContainer=new exports.DragContainer(this.tagContainer.node())),u=this.options.isInsideForm||!this.selection.closest("form").empty(),l=this.selection.append(u?"div":"form").class("hx-tag-input-container"),this.input=l.append("input").attr("placeholder",this.options.placeholder).classed("hx-input",this.options.featureFlags.useInputClass),null!=this.options.autocompleteData&&(d=null!=this.options.validator?function(e){return!f.options.validator(e)}:exports.identity,a=this.options.excludeTags?function(e){return d(e)&&!~f.items().indexOf(e.toString())}:d,r=createFilteredData(a,this.options.autocompleteData),this._.autocomplete=new exports.Autocomplete(this.input.node(),r,this.options.autocompleteOptions),c=(null!=(h=this._.autocomplete.options)?h.inputMap:void 0)||exports.identity,this._.autocomplete.on("change","hx.taginput",(function(e){return f.add(c(e)),setTimeout((function(){return f._.autocomplete.show()}),0)}))),o=!1,s=function(){var e,t;return t=f.input.value(),f.input.node().setCustomValidity(""),p(!0),!(""===t||!f.options.validator)&&(e=f.options.validator(t)||"",f.input.node().setCustomValidity(e),e.length>0)},p=function(e){var t;return t=u?f.selection.closest(".hx-form"):l,u?e?t.selectAll(".hx-form-error").remove():validateForm(t.node()).valid:t.node().checkValidity()},this.input.on("keypress","hx.tag-input",(function(e){var t;if(13===e.keyCode&&(p(),f.input.node().checkValidity()&&(e.preventDefault(),!f._.autocomplete&&(t=f.input.value()))))return n.userEvent=!0,f.add(t)})),this.input.on("input","hx.tag-input",s),this.input.on("keydown","hx.tag-input",(function(e){var t,i,n,r,a;if(8===(e.keyCode||e.charCode)&&!o&&(o=!0,f.input.node().setCustomValidity(""),p(!0),""===f.input.value()&&(r=f.tagContainer.selectAll(".hx-tag")).size()>0))return null!=(i=f._.autocomplete)&&i.hide(),a=(t=select(r.node(r.size()-1))).text(),t.remove(),null!=(n=f._.autocomplete)&&n.show(),f.emit("remove",{value:a,type:"user"})})),this.input.on("keyup","hx.tag-input",(function(e){if(8===(e.keyCode||e.charCode))return o=!1,!0})),this._.autocomplete||this.input.on("blur","hx.tag-input",(function(e){if(f.input.value().length>0&&!s())return n.userEvent=!0,f.add(f.input.value(),void 0)})),this.input.on("focus","hx.tag-input",(function(e){if(!u&&s())return p()})),this.options.disabled&&this.disabled(this.options.disabled),this.options.items&&this.items(this.options.items)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.add=function(t,i){var n,r,o;if(exports.isArray(t))for(n=0,r=t.length;n<r;n++)o=t[n],e(this,o,i);else t?e(this,t,i):logger.warn("TagInput::add","Expected an array or string argument, you supplied:",t);return this.input.value(""),this.options.draggable&&this._.dragContainer.setup(),this},i.prototype.remove=function(e){var t,i,n=this;return null!=e?(t=(i=this.tagContainer.selectAll(".hx-tag").filter((function(t){return t.text()===e}))).size(),i.remove(),i.forEach((function(e){return n.emit("remove",{value:e.text(),type:"api"})}))):(t=(i=this.tagContainer.selectAll(".hx-tag")).text(),i.remove(),i.forEach((function(e){return n.emit("remove",{value:e.text(),type:"api"})}))),this.options.draggable&&this._.dragContainer.setup(),t},i.prototype.items=function(e,t){return arguments.length>0?(this.remove(),exports.isArray(e)?this.add(e,t):e&&logger.warn("TagInput::items","Expected an array of items, you supplied:",e),this):this.tagContainer.selectAll(".hx-tag").select(".hx-tag-text").text()},i.prototype.disabled=function(e){return null!=e?(this._.disabled=e,this.input.attr("disabled",!!e||void 0),this.tagContainer.selectAll(".hx-tag").classed("hx-disabled",e).classed("hx-drag-element",this.options.draggable&&!e),this.options.draggable&&this._.dragContainer.setup(),this):!!this._.disabled},i}(EventEmitter);return e=function(e,t,n){var r,o;return o=e.tagContainer.append("div").class("hx-tag").add(span("hx-tag-text").text(t)).add(span("hx-tag-remove").add(i("hx-icon hx-icon-close"))),e.options.draggable&&o.classed("hx-drag-element",!0).select(".hx-tag-text").classed("hx-drag-control",!0),n&&o.classed(n,!0),o.classed("hx-disabled",e._.disabled),e.options.classifier&&(r=e.options.classifier(t))&&o.classed(r,!0),o.select(".hx-tag-remove").on("click","hx.tag-input",(function(){var t;if(!e._.disabled&&!o.classed("hx-disabled"))return t=o.text(),o.remove(),e.emit("remove",{value:t,type:"user"})})),e.emit("add",{value:t,type:e._.userEvent?"user":"api"}),e._.userEvent=!1},t}.call(void 0),exports.tagInput=function(e){var t;return t=div(),new exports.TagInput(t,e),t};var fileListToMap,fileValidator,getFileUID,DateTimePicker=function(e){function t(t,i){var n,r,o,a,s,l=this;e.call(this),this.selector=t,this.options=exports.merge({datePickerOptions:{},timePickerOptions:{}},i),delete this.options.datePickerOptions.selectRange,this.options.date&&(this.options.datePickerOptions.date=this.options.date,this.options.timePickerOptions.date=this.options.date),null==(n=this.options.datePickerOptions).v2Features&&(n.v2Features={}),this.options.datePickerOptions.v2Features.outputFullDate=!0,this.suppressCallback=!1,this.selection=select(this.selector).classed("hx-date-time-picker",!0).api("date-time-picker",this).api(this),r=this.selection.append("div"),o=this.selection.append("div"),this.options.timePickerOptions.disabled=this.options.datePickerOptions.disabled,this.datePicker=new exports.DatePicker(r,this.options.datePickerOptions),this.timePicker=new exports.TimePicker(o,this.options.timePickerOptions),this.localizer=this.timePicker.localizer,this.datePicker.localizer=this.localizer,this.localizer.on("localechange","hx.date-time-picker",(function(){return s(),a()})),this.localizer.on("timezonechange","hx.date-time-picker",(function(){return s(),a()})),this.datePicker.pipe(this,"date",["show","hide"]),this.timePicker.pipe(this,"time",["show","hide"]),s=function(e){if(l.timePicker.suppressed("change",!0),l.timePicker.date(l.datePicker.date(),!0),l.timePicker.suppressed("change",!1),null!=e)return l.emit("date.change",e),l.emit("change",l.date())},a=function(e){if(l.datePicker.suppressed("change",!0),l.datePicker.date(l.date()),l.datePicker.suppressed("change",!1),null!=e)return l.emit("time.change",e),l.emit("change",l.date())},this.datePicker.on("change","hx.date-time-picker",s),this.timePicker.on("change","hx.date-time-picker",a)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.date=function(e,t){return arguments.length>0?(this.timePicker.date(e,t),this):this.timePicker.date()},t.prototype.year=function(e){return arguments.length>0?(this.datePicker.year(e),this):this.datePicker.year()},t.prototype.month=function(e){return arguments.length>0?(this.datePicker.month(e),this):this.datePicker.month()},t.prototype.day=function(e){return arguments.length>0?(this.datePicker.day(e),this):this.datePicker.day()},t.prototype.hour=function(e){return arguments.length>0?(this.timePicker.hour(e),this):this.timePicker.hour()},t.prototype.minute=function(e){return arguments.length>0?(this.timePicker.minute(e),this):this.timePicker.minute()},t.prototype.second=function(e){return arguments.length>0?(this.timePicker.second(e),this):this.timePicker.second()},t.prototype.getScreenDate=function(){return this.datePicker.getScreenDate()},t.prototype.getScreenTime=function(){return this.timePicker.getScreenTime()},t.prototype.locale=function(e){return arguments.length>0?(this.localizer.locale(e),this):this.datePicker.localizer.locale()},t.prototype.timezone=function(e){return arguments.length>0?(this.localizer.timezone(e),this):this.localizer.timezone()},t.prototype.disabled=function(e){var t;return t=this.datePicker.disabled(e),this.timePicker.disabled(e),null!=e?this:t},t}(EventEmitter),dateTimePicker=function(e){var t;return t=div(),new DateTimePicker(t,e),t};exports.userFacingText({fileInput:{chooseFile:"Choose File",chooseFiles:"Choose Files",filesSelected:"Files Selected: $numFiles",noFile:"No File Chosen"}}),getFileUID=function(e){return e.name+e.size+e.lastModified+e.type},fileValidator=function(e,t){var i;return!(null!=t?t.length:void 0)||(i=e.name.substr(e.name.lastIndexOf(".")+1),t.indexOf(i)>-1)},fileListToMap=function(e,t,i,n){var r,o,a,s,l;for(l=new Map,a=0,s=e.length;a<s;a++)if(r=e[a],fileValidator(r,t)){if(o=getFileUID(r),l.set(o,r),!n.multiple)break}else i.emit("fileextensionerror",{cause:"user",value:{accepted:t,filename:r.name}});return l};var FileInput=function(e){function t(t,n){var r,o,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S=this;e.call(this),this.selector=t,w=this,(v=exports.merge({disabled:!1,fullWidth:!1,acceptedExtensions:void 0,multiple:!1,dragEnabled:!0,buttonClass:"hx-action",buttonText:exports.userFacingText("fileInput","chooseFile"),filesSelectedText:exports.userFacingText("fileInput","filesSelected",!0),noFilesText:exports.userFacingText("fileInput","noFile")},n)).multiple&&!n.buttonText&&(v.buttonText=exports.userFacingText("fileInput","chooseFiles")),b=select(this.selector).classed("hx-file-input",!0).classed("hx-file-input-full-width",v.fullWidth).api("file-input",this).api(this),(null!=(m=v.acceptedExtensions)?m.length:void 0)>0&&(r=v.acceptedExtensions,o=v.acceptedExtensions.map((function(e){return"."+e})).join(",")),(d=input("hx-file-input-hidden").attr("type","file").attr("accept",o).attr("multiple",v.multiple?"multiple":void 0)).on("change",(function(e){if(e.target.files.length)return p(fileListToMap(e.target.files,r,S,v)),d.value("")})),u=div("hx-input-group hx-input-group-full-width hx-no-margin"),c=button("hx-file-input-button hx-btn hx-no-margin "+v.buttonClass).attr("type","button").on("click",(function(){return d.node().click()})).add(i("hx-file-input-icon hx-icon hx-icon-upload")).add(span().text(v.buttonText)),g=section().text(v.noFilesText),y=section().classed("hx-file-input-selected",!0).add(g),f=/^image\//,h=function(e){var t,n,r,o,a,s;return f.test(e.type)&&((r=detached("img").node()).file=e,(o=new FileReader).onloadend=function(e){return r.src=e.target.result},o.readAsDataURL(e),n=section({fixed:!0}).classed("hx-file-input-preview-image",!0).add(r)),t=group().classed("hx-file-input-preview",!0),s=section().classed("hx-file-input-preview-text",!0).text(e.name),a=section({fixed:!0}).classed("hx-file-input-preview-remove hx-text-negative",!0).add(i("hx-icon hx-icon-close")).on("click",(function(){return w._.fileMap.delete(getFileUID(e)),t.remove(),p(w._.fileMap)})),t.add(s).add(n).add(a)},p=function(e){var t,n,r;return y.clear().classed("hx-btn",!1).off("click","hx.file-input"),(n=e.size)?1===n?(s.isOpen()&&s.hide(),y.append(h(e.values()[0]))):(r=n.toLocaleString(preferences.locale()),t=v.filesSelectedText.replace("$numFiles",r),y.classed("hx-btn",!0).add(section().text(t)).add(i("hx-file-input-dropdown-icon hx-icon hx-icon-chevron-down")).on("click","hx.file-input",(function(){return s.show()}))):y.append(g),S._.fileMap=e,S.emit("change",{cause:"user",data:S._.fileMap.values()})},l=div(),s=new Dropdown(l,(function(e){var t;return t=select(e),w._.fileMap.values().map((function(e){return t.append(h(e))}))}),{ddClass:"hx-file-input-dropdown"}),this._={options:v,fiInput:d,fiButton:c,selectedFiles:y,noFilesTextDiv:g,fileMap:new Map},v.dragEnabled&&(x=function(e){return e.preventDefault(),e.stopPropagation()},a=function(e){var t;if(x(e),!w._.disabled)return t=e.dataTransfer.files,p(fileListToMap(t,r,this,v))},b.on("dragenter",x).on("dragover",x).on("drop",a)),v.disabled&&this.disabled(v.disabled),b.add(d).add(u.add(c).add(y)).add(l)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.disabled=function(e){var t;return arguments.length?(t=e?"disabled":void 0,this._.fiInput.attr("disabled",t),this._.fiButton.attr("disabled",t),this._.selectedFiles.classed("hx-text-disabled hx-background-disabled",e),this._.disabled=e,e&&this.value(void 0),this):this._.disabled||!1},t.prototype.value=function(e){return arguments.length?(null!=e?logger.warn("FileInput::value",'It is not possible to set the value of a file input for security reasons. The value can only be cleared by passing in "undefined"'):(this._.fiInput.value(""),this._.selectedFiles.clear().classed("hx-btn",!1).off("click","hx.file-input"),this._.selectedFiles.append(this._.noFilesTextDiv),this._.fileMap=new Map),this):this._.fileMap.values()},t}(EventEmitter),fileInput=function(e){var t;return t=div(),new FileInput(t,e),t};exports.userFacingText({singleSelect:{chooseValue:"Choose a value...",search:"Search...",loading:"Loading...",noResults:"No Results Found",otherResults:"Other Results",pleaseSelectAValueText:"Please select a value from the list"}});var enterKeyCode$1=13,debounceDuration$1=200;function validateItems$1(e,t){return!!e.validateItems(t)||(logger.warn("SingleSelect: the items was expected to be an array of items or a function, you supplied: "+t),!1)}function setValue$2(e,t,i){var n,r=e._;r.valueInput.value(""),r.current=void 0,t&&(t.children?(n=t.children,r.current=n[0]):r.current=t),r.valueInput.value(r.current?r.valueLookup(r.current):""),e.emit("change",{cause:i,value:r.current})}var SingleSelect=function(e){function t(t,n,r){var o=this;void 0===r&&(r={}),e.call(this);var a={filter:void 0,filterOptions:void 0,matchType:void 0,useCache:void 0,trimTrailingSpaces:void 0,disabled:!1,valueLookup:function(e){return e?e.value||e:void 0},renderer:function(e,t){var i=select(e);t&&t.children?i.text(t.text):i.text(o._.options.valueLookup(t))},value:void 0,showSearch:!1,required:!1,chooseValueText:exports.userFacingText("singleSelect","chooseValue"),searchText:exports.userFacingText("singleSelect","search"),loadingText:exports.userFacingText("singleSelect","loading"),noResultsText:exports.userFacingText("singleSelect","noResults"),pleaseSelectAValueText:exports.userFacingText("singleSelect","pleaseSelectAValueText")},s=exports.merge({},a,r),l=s.filter,c=s.filterOptions,u=s.matchType,d=s.showOtherResults,h=s.trimTrailingSpaces,p=s.valueLookup,f=s.useCache,g=s.chooseValueText,x=s.required,m=s.pleaseSelectAValueText,v=s.noResultsText,y=s.showSearch,b=s.searchText,w=s.loadingText,S=s.renderer,k=s.value,T=s.disabled,A=select(t),C=input("hx-input hx-single-select-value").attr("placeholder",g).attr("tabindex",-1).attr("required",!!x||void 0),_=function(e){var t=C.node();void 0===e?t.setCustomValidity(m):t.setCustomValidity("")},M=exports.isFunction(n),P=new exports.AutocompleteFeed({filter:l,filterOptions:c,matchType:u,showOtherResults:d,trimTrailingSpaces:h,valueLookup:p,useCache:f}),E={text:v,unselectable:!0},D={text:w,unselectable:!0};if(this._={selection:A,options:s,valueInput:C,feed:P,valueLookup:p},validateItems$1(P,n)){P.items(n);var z=detached("input").class("hx-input hx-single-select-input").attr("placeholder",b),L=new MenuBase(A,{dropdownOptions:{ddClass:"hx-single-select-dropdown"},featureFlags:{useUpdatedStructure:!0},extraContent:y?div("hx-single-select-input-container").add(z):void 0}),F=function(e){L.items(e),L.render()},I=function(e){return P.filter(e,(function(e){0===e.length&&e.push(E),F(e)}))},O=exports.debounce(debounceDuration$1,I),R=function(e){setValue$2(o,e,"user"),L.hide()};z.on("input",(function(e){if(M)return F([D]),void O(e.target.value);I(e.target.value)})).on("keydown",(function(e){if(z.value().length&&(e.which||e.keyCode)===enterKeyCode$1&&-1===L.cursorPos){var t=L.items()[0];t.unselectable||R(t)}})),this._.renderer=S||L.renderer(),this._.menu=L,L.renderer((function(e,t){var i=select(e);i.classed("hx-single-select-heading",t.heading),t.unselectable||t.heading?i.text(t.text):o._.renderer(e,t)})).on("change",(function(e){null!=e&&null!=e.content&&R(e.content)})).on("highlight","hx.single-select",(function(e){var t=e.content,i=e.eventType;return o.emit("highlight",{cause:"user",value:{item:t,eventType:i}})})),L.dropdown.on("showstart",(function(){z.value(""),F([D]),I(z.value()),z.node().focus()})).on("showend",(function(){return z.node().focus()})),L.dropdown.pipe(this,"dropdown"),k&&this.value(k),T&&this.disabled(T),x&&(_(),this.on("change","hx.single-select",(function(e){return _(e.value)}))),A.add(C).add(span("hx-single-select-icon").add(i("hx-icon hx-icon-caret-down"))).classed("hx-single-select",!0).api("single-select",this).api(this)}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.clearCache=function(){return this._.feed.clearCache(),this},t.prototype.hide=function(){return this._.menu.hide(),this},t.prototype.disabled=function(e){var t=this._.menu.disabled(e);return null!=e?(this._.valueInput.attr("disabled",e?"disabled":void 0),this):t},t.prototype.items=function(e){return arguments.length?(validateItems$1(this._.feed,e)&&(this._.feed.items(e),this.value(this._.current)),this):this._.feed.items()},t.prototype.value=function(e,t){var i=this,n=this._;return arguments.length?(e?(n.valueInput.value(n.options.loadingText),n.feed.filter(n.valueLookup(e),(function(e){var n=e[0];return setValue$2(i,n,"api"),"function"==typeof t?t(n):void 0}))):setValue$2(this,void 0,"api"),this):n.current},t.prototype.renderer=function(e){return null!=e?(this._.renderer=e,this):this._.renderer},t}(EventEmitter);function singleSelect(e,t){var i=div();return new SingleSelect(i,e,t),i}var getButtons,hasProp={}.hasOwnProperty,boundMethodCheck$1=function(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")};getButtons=function(e,t){var i,n;return void 0===t&&(t=!0),i=(n=select(e.selector)).select(".hx-form-buttons"),t&&i.empty()?n.append("div").class("hx-form-buttons"):i};var Form=function(e){function t(t,i){e.call(this),this.addButton=this.addButton.bind(this),this.selector=t,this.options=exports.merge({featureFlags:{useUpdatedStructure:!1,displayVertical:!1}},i),this.options.featureFlags.displayVertical&&(this.options.featureFlags.useUpdatedStructure=!0),this.formId="form-"+exports.randomId()+"-",this.properties=new Map,select(this.selector).classed("hx-form",!0).classed("hx-flag-form hx-flag-button",this.options.featureFlags.useUpdatedStructure).classed("hx-form-vertical",this.options.featureFlags.useUpdatedStructure&&this.options.featureFlags.displayVertical).api("form-builder",this).api(this).on("keypress","hx.form-builder",(function(e){var t;if(t=select(e.target||e.srcElement),13===e.keyCode&&"submit"!==t.attr("type")&&"textarea"!==t.attr("type"))return e.preventDefault()}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.submit=function(){var e,t;return t=(e=validateForm(this.selector)).valid,e.errors,t&&this.emit("submit",this.data()),this},t.prototype.data=function(e){var t,i,n,r=this;if(arguments.length>0){for(t in e)hasProp.call(e,t)&&(n=e[t],this.value(t,n));return this}return i={},this.properties.forEach((function(e,t){if(!t.options.hidden&&"button"!==t.type)return i[e]=r.value(e)})),i},t.prototype.option=function(e,t,i,n){var r,o,a=this;return exports.isArray(i)?(o=i.map((function(t){return a[e](t,n)})),null!=n?this:o):this.properties.has(i)?(r=this.properties.get(i),null!=n?(r.options[e]=n,r[t](n),this.properties.set(i,r),this):!!r.options[e]):void 0},t.prototype.hidden=function(e,t){return this.option("hidden","hide",e,t)},t.prototype.disabled=function(e,t){return this.option("disabled","disable",e,t)},t.prototype.errorMessage=function(e,t){var i;return i=this.node(e),arguments.length>1?(null==t&&(t=""),i&&(i.setCustomValidity?i.setCustomValidity(t):select(i).selectAll("input").nodes.map((function(e){return e.setCustomValidity(t)}))),this):i?i.setCustomValidity?i.validationMessage:select(i).select("input").node.validationMessage:void 0},t.prototype.value=function(e,t){var i;if(this.properties.has(e)){if(i=this.properties.get(e),arguments.length>1)return i.setValue(t);if(!i.options.hidden)return i.getValue()}},t.prototype.component=function(e){var t;if(null!=(t=this.properties.get(e)))return t.component||select(t.elem).api(t.type)},t.prototype.node=function(e){var t;if(null!=(t=this.properties.get(e)))return t.elem.node()},t.prototype.add=function(e,t,i){var n,r,o,a,s,l;return o=this.formId+e.split(" ").join("-"),r=select(this.selector),n=r.append("div").classed("hx-form-group",this.options.featureFlags.useUpdatedStructure),r.append(getButtons(this,!1)),n.append("label").classed("hx-form-label",this.options.featureFlags.useUpdatedStructure).attr("for",o).text(e),a=(s=i.call(this)||{}).key||e,l=n.append(s.elem).attr("id",o),null==s.disable&&(s.disable=function(e){return s.component?s.component.disabled(e):l.attr("disabled",e?"disabled":void 0)}),s.hide=function(e){return n.style("display",e?"none":"")},null==s.setValue&&(s.setValue=function(e){return s.component?s.component.value(e):s.elem.value(e)}),null==s.getValue&&(s.getValue=function(){var e;return s.component?"function"==typeof(e=s.component).value?e.value():void 0:s.elem.value()}),this.properties.set(a,{type:t,elem:s.elem,component:s.component,getValue:s.getValue,setValue:s.setValue,disable:s.disable,hide:s.hide,options:s.options}),s.options.hidden&&this.hidden(a,!0),s.options.disabled&&this.disabled(a,!0),this},t.prototype.addButton=function(e,n,r){var o,a,s,l,c=this;return void 0===r&&(r={}),boundMethodCheck$1(this,t),s=this.formId+e.split(" ").join("-"),l=exports.merge({key:e,context:"action",buttonType:"button",icon:void 0,hidden:!1,disabled:!1},r),a=button("hx-btn hx-"+l.context).attr("type",l.buttonType).attr("id",s).add(!this.options.featureFlags.useUpdatedStructure&&l.icon?i(l.icon):void 0).add(span().text(" "+e)).on("click","hx.form-builder",(function(e){return e.preventDefault(),"function"==typeof n?n(c.data()):void 0})),o=this.options.featureFlags.useUpdatedStructure?a:div().add(a),getButtons(this).add(o),this.properties.set(l.key,{type:"button",elem:o,options:{hidden:l.hidden,disabled:l.disabled},disable:function(e){return a.attr("disabled",e?"disabled":void 0)},hide:function(e){return o.style("display",e?"none":"")}}),l.hidden&&this.hidden(l.key,l.hidden),l.disabled&&this.disabled(l.key,l.disabled),this},t.prototype.addSubmit=function(e,t,i,n){var r,o=this;return void 0===n&&(n={}),r=function(){return o.submit()},this.addButton(e,i||r,{key:e||n.key,context:n.context||"action",buttonType:"submit",icon:t,hidden:n.hidden,disabled:n.disabled})},t.prototype.addText=function(e,t){return void 0===t&&(t={}),null==t.type&&(t.type="text"),null==t.attrs&&(t.attrs=[]),this.add(e,"text",(function(){var e,i,n,r,o,a;for(n=detached("input").attr("type",t.type).classed("hx-input",this.options.featureFlags.useUpdatedStructure),(t.autoCompleteData||t.autoCompleteOptions)&&(logger.deprecated("Form::addText autoCompleteData/Options","Deprecated in favour of using the correct casing (autocompleteData and autocompleteOptions)"),t.autocompleteData=t.autocompleteData||t.autoCompleteData,t.autocompleteOptions=t.autocompleteOptions||t.autoCompleteOptions),null!=t.autocompleteData&&"password"!==t.type&&"number"!==t.type&&(i=new exports.Autocomplete(n,t.autocompleteData,null!=t.autocompleteOptions?t.autocompleteOptions:t.autocompleteOptions=void 0)),null!=t.placeholder&&n.attr("placeholder",t.placeholder),t.required&&n.attr("required",t.required),r=0,o=(a=t.attrs).length;r<o;r++)e=a[r],n.attr(e.type,e.value);return null!=t.validator&&(n.node().oninput=function(e){return e.target.setCustomValidity(t.validator(e)||"")}),t.value&&(n.node().value=t.value),{key:t.key,elem:n,component:i,options:{hidden:t.hidden,disabled:t.disabled}}}))},t.prototype.addEmail=function(e,t){return void 0===t&&(t={}),t.type="email",this.addText(e,t)},t.prototype.addUrl=function(e,t){return void 0===t&&(t={}),t.type="url",this.addText(e,t)},t.prototype.addPassword=function(e,t){return void 0===t&&(t={}),t.type="password",this.addText(e,t)},t.prototype.addNumber=function(e,t){return void 0===t&&(t={}),t.type="number",t.attrs=[{type:"step",value:t.step}],null!=t.min&&t.attrs.push({type:"min",value:t.min}),null!=t.max&&t.attrs.push({type:"max",value:t.max}),this.addText(e,t)},t.prototype.addTextArea=function(e,t){return void 0===t&&(t={}),null==t.attrs&&(t.attrs=[]),this.add(e,"textarea",(function(){var e,i,n,r,o;for(i=detached("textarea").classed("hx-input-textarea",this.options.featureFlags.useUpdatedStructure),null!=t.placeholder&&i.attr("placeholder",t.placeholder),t.required&&i.attr("required",t.required),n=0,r=(o=t.attrs).length;n<r;n++)e=o[n],i.attr(e.type,e.value);return null!=t.validator&&(i.node().oninput=function(e){return e.target.setCustomValidity(t.validator(e)||"")}),t.value&&(i.node().value=t.value),{key:t.key,elem:i,options:{hidden:t.hidden,disabled:t.disabled}}}))},t.prototype.addCheckbox=function(e,t){return void 0===t&&(t={}),this.add(e,"checkbox",(function(){var e,i,n,r;return n=detached("input").attr("type","checkbox").classed("hx-input-checkbox",this.options.featureFlags.useUpdatedStructure),e=this.options.featureFlags.useUpdatedStructure?div("hx-form-items").add(div("hx-form-item").add(n)):n,null!=t.required&&n.attr("required",t.required),t.value&&n.prop("checked",!0),r=function(e){return n.prop("checked",e)},i=function(){return n.prop("checked")},{key:t.key,elem:e,getValue:i,setValue:r,options:{hidden:t.hidden,disabled:t.disabled}}}))},t.prototype.addRadio=function(e,t,i){var n;return void 0===i&&(i={}),n=this,this.add(e,"radio",(function(){var r,o,a,s,l,c,u,d,h,p;for(o=div().classed("hx-form-items",this.options.featureFlags.useUpdatedStructure),s=n.formId+e.split(" ").join("-"),r=0,u=0,d=t.length;u<d;u++)p=t[u],l=(c=div("hx-radio-container").classed("hx-form-item",this.options.featureFlags.useUpdatedStructure)).append("input").classed("hx-input-radio",this.options.featureFlags.useUpdatedStructure).attr("type","radio").attr("name",s).attr("id",s+"-"+r).value(p),null!=i.required&&l.attr("required",i.required),i.value===p&&l.prop("checked",!0),c.append("label").classed("hx-form-label",this.options.featureFlags.useUpdatedStructure).attr("for",s+"-"+r).text(p),o.add(c),r+=1;return a=function(){return o.select("input:checked").value()},h=function(e){return o.selectAll("input").filter((function(t){return t.value()===e})).prop("checked",!0)},{key:i.key,elem:o,getValue:a,setValue:h,disable:function(e){return o.selectAll("input").attr("disabled",!!e||void 0)},options:{hidden:i.hidden,disabled:i.disabled}}}))},t.prototype.addToggle=function(e,t){return void 0===t&&(t={}),this.add(e,"toggle",(function(){var e,i;return i=div("hx-btn hx-btn-invisible hx-no-pad-left"),e=new exports.Toggle(i,t.toggleOptions),{key:t.key,elem:div().add(i),component:e,options:{hidden:t.hidden,disabled:t.disabled}}}))},t.prototype.addPicker=function(e,t,i){return void 0===i&&(i={}),this.add(e,"picker",(function(){var e,n,r,o,a;return n=button(i.buttonClass).attr("type","button").style("position","relative"),o=exports.merge({},i.pickerOptions),t.length>0&&(o.items=t),e=new exports.Picker(n,o),r=detached("input").class("hx-form-builder-hidden-form-input").attr("size",0),"boolean"!=typeof i.required&&e.value(t[0]),a=function(){return r.node().setCustomValidity(exports.userFacingText("form","pleaseSelectAValue"))},i.required&&(a(),e.on("change","hx.form-builder",(function(e){var t=e.value;e.cause;return void 0===t?a():r.node().setCustomValidity("")}))),{key:i.key,elem:div().add(n).add(r),component:e,options:{hidden:i.hidden,disabled:i.disabled}}}))},t.prototype.addDatePicker=function(e,t){return void 0===t&&(t={}),this.add(e,"date-picker",(function(){var e,i,n,r,o;return i=this.options.featureFlags.useUpdatedStructure?detached("input").class("hx-input"):div(),n=this.options.featureFlags.useUpdatedStructure?exports.merge({},t.datePickerOptions,{v2Features:{dontModifyDateOnError:!0,displayLongMonthInCalendar:!0,dontSetInitialInputValue:!0,updateVisibleMonthOnDateChange:!0}}):t.datePickerOptions,e=new exports.DatePicker(i,n),null==t.validStart&&null==t.validEnd||e.validRange(t.validStart,t.validEnd),null!=t.selectRange?(r=function(){return e.range()},o=function(t){return e.range(t.startDate,t.endDate,!1,!0)},null!=t.startDate&&null!=t.endDate&&e.range(t.startDate,t.endDate,!1,!0)):(r=function(){return e.date()},o=function(t){return e.date(t)}),{key:t.key,elem:div().add(i),component:e,getValue:r,setValue:o,options:{hidden:t.hidden,disabled:t.disabled}}}))},t.prototype.addTimePicker=function(e,t){return void 0===t&&(t={}),this.add(e,"time-picker",(function(){var e,i,n,r;return i=div(),e=new exports.TimePicker(i,t.timePickerOptions),n=function(){return e.date()},r=function(t){return e.date(t)},{key:t.key,elem:div().add(i),component:e,getValue:n,setValue:r,options:{hidden:t.hidden,disabled:t.disabled}}}))},t.prototype.addDateTimePicker=function(e,t){return void 0===t&&(t={}),this.add(e,"date-time-picker",(function(){var e,i,n,r;return i=div(),e=new DateTimePicker(i,t.dateTimePickerOptions),n=function(){return e.date()},r=function(t){return e.date(t)},{key:t.key,elem:div().add(i),component:e,getValue:n,setValue:r,options:{hidden:t.hidden,disabled:t.disabled}}}))},t.prototype.addTagInput=function(e,t){return void 0===t&&(t={}),this.add(e,"tag-input",(function(){var e,i,n,r,o,a,s,l,c;return r=div(),c=this.options.featureFlags.useUpdatedStructure?exports.merge({},t.tagInputOptions,{featureFlags:{useInputClass:!0}}):t.tagInputOptions,t.placeholder&&(null==t.tagInputOptions&&(t.tagInputOptions={}),null==(e=t.tagInputOptions).placeholder&&(e.placeholder=t.placeholder)),null==t.tagInputOptions&&(t.tagInputOptions={}),t.tagInputOptions.isInsideForm=!0,n=new exports.TagInput(r,c),o=function(){return n.items()},l=function(e){return n.items(e)},t.required&&(a=r.select("input"),i=function(){var e;return void 0!==(e=n.items())&&e.length?a.node().setCustomValidity(""):s()},(s=function(){return a.node().setCustomValidity(exports.userFacingText("form","pleaseAddAValue"))})(),n.on("add","hx.form-builder",i),n.on("remove","hx.form-builder",i)),{key:t.key,elem:div().add(r),component:n,getValue:o,setValue:l,options:{hidden:t.hidden,disabled:t.disabled}}}))},t.prototype.addFileInput=function(e,t){return void 0===t&&(t={}),this.add(e,"file-input",(function(){var e,i;return i=div(),e=new FileInput(i,t.fileInputOptions),{key:t.key,elem:div().add(i),component:e,options:{hidden:t.hidden,disabled:t.disabled}}}))},t.prototype.addAutocompletePicker=function(e,t,i){return void 0===i&&(i={}),this.add(e,"select",(function(){var e,n,r,o,a;return r=button().attr("type","button").class(i.buttonClass),e=exports.merge({buttonClass:i.buttonClass},i.autocompletePickerOptions),t.length>0&&(e.items=t),n=new exports.AutocompletePicker(r,t,e),o=r.append("input").class("hx-form-builder-hidden-form-input").attr("size",0),r.style("position","relative"),"boolean"!=typeof i.required&&n.value(t[0]),a=function(){return o.node().setCustomValidity(exports.userFacingText("form","pleaseSelectAValue"))},i.required&&(a(),n.on("change","hx.form-builder",(function(e){var t=e.value;e.cause;return void 0===t?a():o.node().setCustomValidity("")}))),{key:i.key,elem:div().add(r),component:n,disable:function(e){return n.disabled(e)},options:{hidden:i.hidden,disabled:i.disabled}}}))},t.prototype.addSingleSelect=function(e,t,i){return void 0===i&&(i={}),this.add(e,"select",(function(){var e,n,r,o;return n=div(),r=i.required,o=exports.merge({required:r},i.singleSelectOptions),e=new SingleSelect(n,t,o),{key:i.key,elem:n,component:e,disable:function(t){return e.disabled(t)},options:{hidden:i.hidden,disabled:i.disabled}}}))},t}(EventEmitter);exports.userFacingText({form:{pleaseSelectAValue:"Please select a value from the list",pleaseAddAValue:"Please add at least one item",missingRadioValue:"Please select one of these options",missingValue:"Please fill in this field",typeMismatch:"Please enter a valid value for this field"}}),exports.userFacingText({meter:{of:"of"}});var Camera,Circle,ColorProperty,Composite,DiscreteProperty,DrawingColor,DrawingObject,Grid,Layer,Line,NumberProperty,PerformanceGauge,Point,Rectangle,Shape,Sidebar$1,StringProperty,Text,horizontalLineIntersection,pointRectangleIntersection,verticalLineIntersection,Meter=function(e){function t(t,i){var n,r,o,a,s,l,c=this;e.call(this),logger.deprecated("Meter is deprecated and will be removed from Hexagon in the next major release."),this._=n={},n.data={total:0,completed:0},this.options=exports.merge({useMarker:!0,useTracker:!0,trackerWidth:.03,progressWidth:.175,markerSize:.01,markerInnerExtend:.01,markerOuterExtend:-.01,arcPadding:.02,markerPadding:.1,progressBackgroundCol:color(theme().palette.contrastCol).alpha(.05).toString(),progressCol:theme().palette.positiveCol,trackerCol:color(theme().palette.positiveCol).alpha(.5).toString(),trackerBackgroundCol:color(theme().palette.contrastCol).alpha(.05).toString(),markerCol:theme().palette.contrastCol,valueFormatter:function(e,t){return t?exports.userFacingText("meter","of")+" "+e:e},redrawOnResize:!0},i),a=exports.randomId(),n.selection=s=select(t).api("meter",this).api(this).classed("hx-meter",!0).on("resize",(function(){if(c.options.redrawOnResize)return c.render("user")})),n.container=r=s.append("div").class("hx-meter-container"),n.svg=l=r.append("svg").style("width","100%").style("height","100%"),n.progressBackgroundArc=l.append("path"),n.progressArc=l.append("path"),n.trackerBackgroundArc=l.append("path"),n.trackerArc=l.append("path"),n.markerArc=l.append("path"),n.markerTextCurve=l.append("defs").append("path").attr("id",a),n.markerText=l.append("g").append("text").class("hx-meter-marker-text").append("textPath").attr("xlink:href","#"+a),o=r.append("div").class("hx-meter-inner-text"),n.completedText=o.append("div").class("hx-meter-completed"),n.totalText=o.append("div").class("hx-meter-total"),n.typeText=o.append("div").class("hx-meter-type")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.value=function(e){return arguments.length>0?(this._.data=exports.merge(this._.data,e),this.render(),this):this._.data},t.prototype.render=function(e){var t,i,n,r,o,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S,k;return void 0===e&&(e="api"),t=this._,l=this.options,n=t.data,g=t.selection,i=t.container,t.svg,d=Math.max(0,Math.min(1,n.completed/n.total||0)),v=Math.max(0,Math.min(1,n.tracker/n.total||0)),o=Math.max(0,Math.min(1,n.marker/n.total||0)),t.completedText.text(l.valueFormatter(n.completed,!1)),t.totalText.text(l.valueFormatter(n.total,!0)),t.typeText.text(n.unitText),(x=Math.min(g.width(),2*g.height()))>0&&(i.style("font-size",Math.round(14/150*(x/2))+"px"),m=x/2*10/150,S=x/2,k=x/2,s=1+l.markerOuterExtend,y=(b=l.useMarker?1-l.markerPadding:1)-l.trackerWidth,a=(h=(p=l.useTracker?y-l.arcPadding:l.useMarker?1-l.markerPadding:1)-l.progressWidth)-l.markerInnerExtend,l.markerWidth,w=function(e,t,i,n,r,o){var a,s,l,c,u;return s=x/2*n,l=x/2*r,u=Math.PI+Math.PI*t,a=Math.PI+Math.PI*i,c=arcCurve(S,k,s,l,u,a,0),e.attr("d",c).attr("fill",o).style("visibility",void 0)},i.style("width",x+"px"),i.style("height",x/2+"px"),w(t.progressArc,0,d,h,p,l.progressCol),w(t.progressBackgroundArc,d,1,h,p,l.progressBackgroundCol),l.useTracker?(w(t.trackerArc,0,v,y,b,l.trackerCol),w(t.trackerBackgroundArc,v,1,y,b,l.trackerBackgroundCol)):(t.trackerArc.style("visibility","hidden"),t.trackerBackgroundArc.style("visibility","hidden")),l.useMarker?(f=x/2-m,u=function(){var e,t;for(t=[],r=e=0;e<=100;r=++e)t.push({x:S+f*Math.cos((r/100+1)*Math.PI),y:k+f*Math.sin((r/100+1)*Math.PI)});return t}(),c=svgCurve(u,!1),t.markerTextCurve.attr("d",c),o<.5?t.markerText.attr("startOffset",100*o+1+"%").attr("text-anchor","start"):t.markerText.attr("startOffset",100*o-1+"%").attr("text-anchor","end"),t.markerText.style("visibility",void 0).text(n.markerText),w(t.markerArc,o-l.markerSize/2,o+l.markerSize/2,a,s,this.options.markerCol)):(t.markerArc.style("visibility","hidden"),t.markerText.style("visibility","hidden")),this.emit("render",{cause:e,data:n})),this},t}(EventEmitter),meter=function(e){var t;return t=detached("div"),new Meter(t.node(),e),t};pointRectangleIntersection=function(e,t,i,n,r,o){return i<=e&&e<=r&&n<=t&&t<=o},horizontalLineIntersection=function(e,t,i,n,r,o,a){var s;return t===n?a===t&&(r<=e&&e<=o||r<=i&&i<=o||e<r&&i>o):r<=(s=e+(a-t)*(i-e)/(n-t))&&s<=o},verticalLineIntersection=function(e,t,i,n,r,o,a){var s;return e===i?a===e&&(r<=t&&t<=o||r<=n&&n<=o||t<r&&n>o):r<=(s=t+(a-e)*(n-t)/(i-e))&&s<=o},Point=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.x=e,this.y=t}return e.prototype.set=function(e){return this.x=e.x,this.y=e.y},e.prototype.tweenTo=function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t},e.prototype.distanceTo=function(e){return Math.sqrt((this.x-e.x)*(this.x-e.x)+(this.y-e.y)*(this.y-e.y))},e.prototype.distanceToSquared=function(e){return(this.x-e.x)*(this.x-e.x)+(this.y-e.y)*(this.y-e.y)},e}(),ColorProperty=function(){function e(e){this.value=color(),exports.defined(e)&&this.set(e)}return e.prototype.set=function(e,t,i){var n,r,o,a,s,l,c,u,d,h,p,f=this;return exports.defined(this.stop)&&(this.stop(),this.stop=void 0),exports.defined(t)?(h=this.value.red(),d=this.value.green(),u=this.value.blue(),c=this.value.alpha(),n=color(e),l=n.red(),s=n.green(),a=n.blue(),o=n.alpha(),r=i?function(e){return f.stop=void 0,i(!e,f.value)}:void 0,p=function(e,t){if(!t)return f.value.red(h+(l-h)*e),f.value.green(d+(s-d)*e),f.value.blue(u+(a-u)*e),f.value.alpha(c+(o-c)*e)},this.stop=transition(t,p,ease.linear,r)):this.value=color(e)},e}(),NumberProperty=function(){function e(e){this.value=e,this.stop=void 0}return e.prototype.set=function(e,t,i){var n,r,o,a=this;return exports.defined(this.stop)&&(this.stop(),this.stop=void 0),exports.defined(t)?(r=this.value,n=i?function(e){return a.stop=void 0,i(!e,a.value)}:void 0,o=function(t,i){if(!i)return a.value=r+(e-r)*t},this.stop=transition(t,o,ease.linear,n)):this.value=e},e}(),StringProperty=function(){function e(e){this.value=e,this.stop=void 0}return e.prototype.set=function(e,t,i){var n,r,o=this;return exports.defined(this.stop)&&(this.stop(),this.stop=void 0),exports.defined(t)?(n=interpolate(this.value,e),r=function(e,t){if(!t)return o.value=n(e)},this.stop=transition(t,r,ease.linear)):this.value=e},e}(),DiscreteProperty=function(){function e(e){this.value=e}return e.prototype.set=function(e){return this.value=e},e}(),DrawingObject=function(){function e(e){void 0===e&&(e=exports.randomId()),this.id=e,this.attr=new Map,this.properties=new Map,this.selectable=this.addDiscreteProperty("selectable"),this.selected=!1}return e.prototype.addDiscreteProperty=function(e,t){var i;return void 0===t&&(t=!1),i=new DiscreteProperty(t),this.properties.set(e,i),i},e.prototype.addNumberProperty=function(e,t){var i;return void 0===t&&(t=0),i=new NumberProperty(t),this.properties.set(e,i),i},e.prototype.addColorProperty=function(e,t){var i;return void 0===t&&(t="#FFF"),i=new ColorProperty(t),this.properties.set(e,i),i},e.prototype.addStringProperty=function(e,t){var i;return void 0===t&&(t=""),i=new StringProperty(t),this.properties.set(e,i),i},e.prototype.set=function(e,t,i,n){return this.properties.has(e)?this.properties.get(e).set(t,i,n):exports.startsWith(e,"attr.")?this.attr.set(e.substring(5),t):console.warn("unknown property: ",e,Error().stack),this},e.prototype.get=function(e){return this.properties.has(e)?this.properties.get(e).value:exports.startsWith(e,"attr.")?this.attr.get(e.substring(5)):void 0},e.prototype.drawBoundingBox=function(e,t){var i;if(i=this.getBoundingBox(e))return t.setStrokeColor(color("rgba(64, 64, 64, 1)")),t.setStrokeWidth(Math.min(1,.95/t.camera.actualZoom)),e.strokeRect(i[0]-2,i[1]-2,i[2]-i[0]+4,i[3]-i[1]+4),t.setFillColor(color("rgba(128, 128, 128, 0.1)")),e.fillRect(i[0]-2,i[1]-2,i[2]-i[0]+4,i[3]-i[1]+4)},e.prototype.pointInBoundingBox=function(e,t){var i;return i=this.getBoundingBox(t),pointRectangleIntersection(e.x,e.y,i[0],i[1],i[2],i[3])},e}(),DrawingColor=function(){function e(){this.c=color()}return e.prototype.set=function(e,t){switch(e){case"color":return this.c=color(t);case"color.red":return this.c.red(exports.clamp(0,255,t));case"color.green":return this.c.green(exports.clamp(0,255,t));case"color.blue":return this.c.blue(exports.clamp(0,255,t));case"color.alpha":return this.c.alpha(exports.clampUnit(t))}},e}(),Text=function(e){function t(){e.call(this),this.position={x:this.addNumberProperty("position.x"),y:this.addNumberProperty("position.y")},this.color=this.addColorProperty("color"),this.size=this.addNumberProperty("size",12),this.align={x:this.addDiscreteProperty("align.x","start"),y:this.addDiscreteProperty("align.y","top")},this.font=this.addDiscreteProperty("font","Helvetica,Arial"),this.text=this.addStringProperty("text")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(e,t,i,n){var r,o;if(r=this.getBoundingBox(e),(o=t.camera.getWorldRect())[0]-=i,o[1]-=n,o[2]-=i,o[3]-=n,r[2]>o[0]&&r[0]<o[2]&&r[3]>o[1]&&r[1]<o[3]&&(e.font="12px "+this.font.value,t.setFillColor(this.color.value),e.save(),e.scale(this.size.value/12,this.size.value/12),e.textAlign=this.align.x.value,e.textBaseline=this.align.y.value,e.fillText(this.text.value,this.position.x.value/(this.size.value/12),this.position.y.value/(this.size.value/12)),e.restore(),this.selected))return this.drawBoundingBox(e,t)},t.prototype.getWidth=function(e){return void 0===this.textWidth&&(e.font="12px "+this.font.value,e.save(),e.setTransform(1,0,0,1,0,0),this.textWidth=e.measureText(this.text.value).width,e.restore()),this.textWidth},t.prototype.getBoundingBox=function(e){var t,i,n,r;switch(i=this.getWidth(e)*(this.size.value/12),t=this.size.value,this.align.x.value){case"start":default:n=0;break;case"end":n=i;break;case"center":n=i/2}switch(this.align.y.value){case"top":default:r=0;break;case"end":r=t;break;case"middle":r=t/2}return[this.position.x.value-n,this.position.y.value-r,this.position.x.value+i-n,this.position.y.value+t-r]},t}(DrawingObject),Shape=function(e){function t(){e.call(this),this.position={x:this.addNumberProperty("position.x"),y:this.addNumberProperty("position.y")},this.fill={enabled:this.addDiscreteProperty("fill.enabled",!0),color:this.addColorProperty("fill.color")},this.outline={enabled:this.addDiscreteProperty("outline.enabled",!1),width:this.addNumberProperty("outline.width"),color:this.addColorProperty("outline.color")},this.curve=this.addDiscreteProperty("curve",[]),this.type=""}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.set=function(t,i,n,r){return"curve"===t&&(this.type="curve"),"polygon"===t&&(this.type="polygon",t="curve"),e.prototype.set.call(this,t,i,n,r)},t.prototype.get=function(t){return"polygon"===t&&(t="curve"),e.prototype.get.call(this,t)},t.prototype.render=function(e,t,i,n){var r,o,a,s,l,c,u,d,h,p,f;if(r=this.getBoundingBox(e),(o=t.camera.getWorldRect())[0]-=i,o[1]-=n,o[2]-=i,o[3]-=n,r&&r[2]>o[0]&&r[0]<o[2]&&r[3]>o[1]&&r[1]<o[3]){if(e.beginPath(),"polygon"===this.type)for(a=s=0,c=(p=this.curve.value).length;s<c;a=++s)h=p[a],0===a?e.moveTo(this.position.x.value+h[0],this.position.y.value+h[1]):e.lineTo(this.position.x.value+h[0],this.position.y.value+h[1]);if("curve"===this.type)for(a=l=0,u=(f=this.curve.value).length;l<u;a=++l)d=f[a],0===a?e.moveTo(this.position.x.value+d[0],this.position.y.value+d[1]):e.quadraticCurveTo(this.position.x.value+this.curve.value[a-1][2],this.position.y.value+this.curve.value[a-1][3],this.position.x.value+d[0],this.position.y.value+d[1]);if(e.closePath(),this.outline.enabled.value&&(t.setStrokeColor(this.outline.color.value),t.setStrokeWidth(this.outline.width.value),e.stroke()),this.fill.enabled.value&&(t.setFillColor(this.fill.color.value),e.fill()),this.selected)return this.drawBoundingBox(e,t)}},t.prototype.getBoundingBox=function(){var e,t,i,n,r,o,a,s,l,c,u,d;if("polygon"===this.type){for(l=c=this.curve.value[0][0],u=d=this.curve.value[0][1],e=t=0,n=(a=this.curve.value).length;t<n;e=++t)(o=a[e])[0]<l&&(l=o[0]),o[1]<u&&(u=o[1]),o[0]>c&&(c=o[0]),o[1]>d&&(d=o[1]);return[this.position.x.value+l,this.position.y.value+u,this.position.x.value+c,this.position.y.value+d]}if("curve"===this.type){for(l=c=this.curve.value[0][0],u=d=this.curve.value[0][1],e=i=0,r=(s=this.curve.value).length;i<r;e=++i)(o=s[e])[0]<l&&(l=o[0]),o[1]<u&&(u=o[1]),o[0]>c&&(c=o[0]),o[1]>d&&(d=o[1]),o[2]<l&&(l=o[2]),o[3]<u&&(u=o[3]),o[2]>c&&(c=o[2]),o[3]>d&&(d=o[3]);return[this.position.x.value+l,this.position.y.value+u,this.position.x.value+c,this.position.y.value+d]}},t}(DrawingObject),Rectangle=function(e){function t(){e.call(this),this.position={x:this.addNumberProperty("position.x"),y:this.addNumberProperty("position.y")},this.fill={enabled:this.addDiscreteProperty("fill.enabled",!0),color:this.addColorProperty("fill.color")},this.outline={enabled:this.addDiscreteProperty("outline.enabled",!1),width:this.addNumberProperty("outline.width"),color:this.addColorProperty("outline.color")},this.width=this.addNumberProperty("width",10),this.height=this.addNumberProperty("height",10)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(e,t,i,n){var r;if((r=t.camera.getWorldRect())[0]-=i,r[1]-=n,r[2]-=i,r[3]-=n,this.position.x.value+this.width.value>r[0]&&this.position.x.value<r[2]&&this.position.y.value+this.height.value>r[1]&&this.position.y.value<r[3]&&(this.fill.enabled.value&&(t.setFillColor(this.fill.color.value),e.fillRect(this.position.x.value,this.position.y.value,this.width.value,this.height.value)),this.outline.enabled.value&&(t.setStrokeColor(this.outline.color.value),t.setStrokeWidth(this.outline.width.value),e.strokeRect(this.position.x.value,this.position.y.value,this.width.value,this.height.value)),this.selected))return this.drawBoundingBox(e,t)},t.prototype.getBoundingBox=function(){return[this.position.x.value,this.position.y.value,this.position.x.value+this.width.value,this.position.y.value+this.height.value]},t}(DrawingObject),Line=function(e){function t(){e.call(this),this.start={x:this.addNumberProperty("start.x"),y:this.addNumberProperty("start.y")},this.end={x:this.addNumberProperty("end.x"),y:this.addNumberProperty("end.y")},this.color=this.addColorProperty("color"),this.width=this.addNumberProperty("width")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(e,t,i,n){var r,o;if((r=t.camera.getWorldRect())[0]-=i,r[1]-=n,r[2]-=i,r[3]-=n,o=0===this.width.value?Math.min(1,.95/t.camera.actualZoom):this.width.value,(pointRectangleIntersection(this.start.x.value,this.start.y.value,r[0]-o,r[1]-o,r[2]+o,r[3]+o)||pointRectangleIntersection(this.end.x.value,this.end.y.value,r[0]-o,r[1]-o,r[2]+o,r[3]+o)||horizontalLineIntersection(this.start.x.value,this.start.y.value,this.end.x.value,this.end.y.value,r[0]-o,r[2]+o,r[1]-o)||horizontalLineIntersection(this.start.x.value,this.start.y.value,this.end.x.value,this.end.y.value,r[0]-o,r[2]+o,r[3]+o)||verticalLineIntersection(this.start.x.value,this.start.y.value,this.end.x.value,this.end.y.value,r[1]-o,r[3]+o,r[0]-o)||verticalLineIntersection(this.start.x.value,this.start.y.value,this.end.x.value,this.end.y.value,r[1]-o,r[3]+o,r[2]+o))&&(e.beginPath(),t.setStrokeColor(this.color.value),t.setStrokeWidth(o),e.moveTo(this.start.x.value,this.start.y.value),e.lineTo(this.end.x.value,this.end.y.value),e.closePath(),e.stroke(),this.selected))return this.drawBoundingBox(e,t)},t.prototype.getBoundingBox=function(){return[Math.min(this.start.x.value,this.end.x.value),Math.min(this.start.y.value,this.end.y.value),Math.max(this.start.x.value,this.end.x.value),Math.max(this.start.y.value,this.end.y.value)]},t}(DrawingObject),Grid=function(e){function t(){var t;e.call(this),this.position={x:this.addNumberProperty("position.x"),y:this.addNumberProperty("position.y")},this.cellSize={x:this.addNumberProperty("cellSize.x"),y:this.addNumberProperty("cellSize.y")},this.gridSize={x:this.addNumberProperty("gridSize.x"),y:this.addNumberProperty("gridSize.y")},this.gridLines={color:this.addColorProperty("gridLines.color"),width:this.addNumberProperty("gridLines.width"),enabled:this.addDiscreteProperty("gridLines.enabled",!1)},t=function(){var e,t;for(t=[],e=0;e<=15;e+=1)t.push(new DrawingColor(Math.random(),Math.random()/2,0,.5));return t}(),this.cells={enabled:this.addDiscreteProperty("cells.enabled",!1),states:this.addDiscreteProperty("cells.states",void 0),palette:this.addDiscreteProperty("cells.palette",t)}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(e,t,i,n){var r,o,a,s,l,c,u,d,h,p,f,g,x,m,v,y,b,w,S,k,T,A,C;if((o=t.camera.getWorldRect())[0]-=i,o[1]-=n,o[2]-=i,o[3]-=n,k=Math.max(0,Math.floor((o[0]-this.position.x.value)/this.cellSize.x.value)),T=Math.max(0,Math.floor((o[1]-this.position.y.value)/this.cellSize.y.value)),l=Math.min(this.gridSize.x.value-1,Math.ceil((o[2]-this.position.x.value)/this.cellSize.x.value)),c=Math.min(this.gridSize.y.value-1,Math.ceil((o[3]-this.position.y.value)/this.cellSize.y.value)),k<=l&&T<=c){if(this.cells.enabled.value)for(C=h=T,v=c;h<=v;C=h+=1)for(S=this.cells.states.value[C],A=p=k,y=l;p<=y;A=p+=1)r=S[A],t.setFillColor(this.cells.palette.value[r]),e.fillRect(this.position.x.value+A*this.cellSize.x.value+1,this.position.y.value+C*this.cellSize.y.value+1,this.cellSize.x.value-1,this.cellSize.y.value-1);if(this.gridLines.enabled){for(e.beginPath(),t.setStrokeColor(this.gridLines.color.value),t.setStrokeWidth(this.gridLines.width.value),t.setStrokeCap("square"),x=this.position.x.value,m=this.position.y.value,a=this.cellSize.x.value,s=this.cellSize.y.value,u=this.gridSize.x.value,d=this.gridSize.y.value,A=f=k,b=l+1;f<=b;A=f+=1)e.moveTo(x+A*a+.5,m+.5),e.lineTo(x+A*a+.5,m+s*d+.5);for(C=g=T,w=c+1;g<=w;C=g+=1)e.moveTo(x+.5,m+C*s+.5),e.lineTo(x+a*u+.5,m+C*s+.5);e.closePath(),e.stroke()}if(this.selected)return this.drawBoundingBox(e,t)}},t.prototype.getBoundingBox=function(){return[this.position.x.value,this.position.y.value,this.position.x.value+this.gridSize.x.value*this.cellSize.x.value,this.position.y.value+this.gridSize.y.value*this.cellSize.y.value]},t}(DrawingObject),Composite=function(e){function t(){e.call(this),this.position={x:this.addNumberProperty("position.x"),y:this.addNumberProperty("position.y")},this.angle=this.addNumberProperty("angle"),this.scale=this.addNumberProperty("scale",1),this.objectList=new List,this.objectMap=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.set=function(t,i,n,r){var o,a,s,l;return this.properties.has(t)||exports.startsWith(t,"attr.")?e.prototype.set.call(this,t,i,n,r):(o=t.split(".")).length>1?(s=o[0],l=o.slice(1).join("."),(a=this.objectMap.get(s))?a.set(l,i):console.warn("unknown property: ",t,Error().stack)):console.warn("unknown property: ",t,Error().stack),this},t.prototype.get=function(t){var i,n,r,o;return this.properties.has(t)||exports.startsWith(t,"attr.")?e.prototype.get.call(this,t):(i=t.split(".")).length>1&&(r=i[0],o=i.slice(1).join("."),n=this.objectMap.get(r))?n.get(o):void 0},t.prototype.create=function(e,i){var n;return(n=function(){switch(e){case"circle":return new Circle;case"rectangle":return new Rectangle;case"line":return new Line;case"grid":return new Grid;case"text":return new Text;case"shape":return new Shape;case"composite":return new t}}())&&(this.objectList.add(n),this.objectMap.set(i,n)),this},t.prototype.delete=function(e){var t;return t=this.objectMap.get(e),this.objectList.delete(t),this.objectMap.delete(e)},t.prototype.render=function(e,t,i,n){var r,o,a,s,l,c;if(this.objectList.size>0&&(r=this.getBoundingBox(e),(o=t.camera.getWorldRect())[0]-=i,o[1]-=n,o[2]-=i,o[3]-=n,!r||r[2]>o[0]&&r[0]<o[2]&&r[3]>o[1]&&r[1]<o[3]))for(a=0,s=(c=this.objectList.values()).length;a<s;a++)l=c[a],e.save(),e.translate(this.position.x.value,this.position.y.value),e.scale(this.scale.value,this.scale.value),e.rotate(this.angle.value),l.render(e,t,this.position.x.value+i,this.position.y.value+n),e.restore();if(this.selected)return this.drawBoundingBox(e,t)},t.prototype.getBoundingBox=function(e){var t,i,n,r,o;if(this.objectList.size>0){if(o=this.objectList.get(0).getBoundingBox(e),this.objectList.size>1)for(i=n=1,r=this.objectList.size-1;n<=r;i=n+=1)(t=this.objectList.get(i).getBoundingBox(e))&&(o?(t[0]<o[0]&&(o[0]=t[0]),t[1]<o[1]&&(o[1]=t[1]),t[2]>o[2]&&(o[2]=t[2]),t[3]>o[3]&&(o[3]=t[3])):o=t);return o[0]+=this.position.x.value,o[1]+=this.position.y.value,o[2]+=this.position.x.value,o[3]+=this.position.y.value,o}},t}(DrawingObject),Circle=function(e){function t(){e.call(this),this.position={x:this.addNumberProperty("position.x"),y:this.addNumberProperty("position.y")},this.fill={enabled:this.addDiscreteProperty("fill.enabled",!0),color:this.addColorProperty("fill.color")},this.outline={enabled:this.addDiscreteProperty("outline.enabled",!1),width:this.addNumberProperty("outline.width"),color:this.addColorProperty("outline.color")},this.radius=this.addNumberProperty("radius",10)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(e,t,i,n){var r;if((r=t.camera.getWorldRect())[0]-=i,r[1]-=n,r[2]-=i,r[3]-=n,this.position.x.value+this.radius.value>r[0]&&this.position.x.value-this.radius.value<r[2]&&this.position.y.value+this.radius.value>r[1]&&this.position.y.value-this.radius.value<r[3]&&(e.beginPath(),e.arc(this.position.x.value,this.position.y.value,this.radius.value,0,2*Math.PI,!0),e.closePath(),this.fill.enabled.value&&(t.setFillColor(this.fill.color.value),e.fill()),this.outline.enabled.value&&(t.setStrokeColor(this.outline.color.value),t.setStrokeWidth(this.outline.width.value),e.stroke()),this.selected))return this.drawBoundingBox(e,t)},t.prototype.getBoundingBox=function(){return[this.position.x.value-this.radius.value,this.position.y.value-this.radius.value,this.position.x.value+this.radius.value,this.position.y.value+this.radius.value]},t}(DrawingObject),Sidebar$1=function(e){function t(t,i,n,r){var o=this;switch(void 0===i&&(i="l"),e.call(this),this.visible=!1,this.selection=t.append("div").class("hx-drawing-sidebar hx-drawing-sidebar-"+i),i){case"t":case"b":this.selection.style("height","0px"),this.expandEvt="expandv",this.collapseEvt="collapsev";break;default:this.selection.style("width","0px"),this.expandEvt="expandh",this.collapseEvt="collapseh"}n&&(n.split(""),this.toggleBtn=t.append("div").class("hx-btn hx-drawing-sidebar-toggle").classed("hx-drawing-sidebar-toggle-"+n[0],!0).classed("hx-drawing-sidebar-toggle-"+n[1],!0).on("click",(function(){return o.toggle()})).append("i").class("hx-icon hx-icon-bars")),"function"==typeof r&&r(this.selection.node())}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toggle=function(){return this.visible?this.hide():this.show()},t.prototype.show=function(){return this.visible||(this.visible=!0,this.selection.morph().with(this.expandEvt,100).and("fadein",100).go(!0)),this},t.prototype.hide=function(){return this.visible&&(this.visible=!1,this.selection.morph().with("fadeout",100).and(this.collapseEvt,100).go(!0)),this},t}(EventEmitter),PerformanceGauge=function(){function e(e){this.drawing=e,this.position=new Point(3,3),this.fps=void 0,this.ms=void 0,this.lastEnd=void 0,this.frameStart=void 0,this.frameEnd=void 0}return e.prototype.start=function(){return this.frameStart=(new Date).getTime()},e.prototype.end=function(){return this.lastEnd=this.frameEnd,this.frameEnd=(new Date).getTime()},e.prototype.update=function(){var e,t;return e=1e3/(this.frameEnd-this.lastEnd),isNaN(e)||(this.fps?this.fps=exports.tween(this.fps,e,.05):this.fps=e),t=this.frameEnd-this.frameStart,this.ms?this.ms=exports.tween(this.ms,t,.05):this.ms=t},e.prototype.render=function(){return this.drawing.ctx.fillStyle="rgba(0, 0, 40, 1)",this.drawing.ctx.strokeStyle="#ffffff",this.drawing.ctx.lineCap="square",this.drawing.ctx.lineWidth=1,this.drawing.ctx.fillRect(this.position.x,this.position.y,70,42),this.drawing.ctx.strokeRect(this.position.x,this.position.y,70,42),this.drawing.ctx.font="10pt Helvetica,Arial",this.drawing.ctx.fillStyle="#ffffff",this.drawing.ctx.fillText("FPS: "+Math.round(this.fps),8+this.position.x,18+this.position.y),this.ms<17?this.drawing.ctx.fillStyle="#ffffff":this.drawing.ctx.fillStyle="#ff5555",this.drawing.ctx.fillText("MS: "+Math.round(this.ms),8+this.position.x,33+this.position.y)},e}(),Layer=function(){var e,t,i=function(e){this.drawing=e,this.objects=[],this.visible=!0,this.alpha=1,this.alphaCurveFunction=null};return i.prototype.render=function(){var e,t,i,n,r;if(this.alphaCurveFunction&&(this.alpha=exports.clampUnit(this.alphaCurveFunction(this.drawing.camera.actualZoom)),this.visible=this.alpha>.01),this.visible){for(this.drawing.setGlobalAlpha(this.alpha),r=[],e=0,t=(n=this.objects).length;e<t;e++)i=n[e],r.push(i.render(this.drawing.ctx,this.drawing,0,0));return r}},i.prototype.create=function(e,t){var i;return(i=function(){switch(e){case"circle":return new Circle(t);case"rectangle":return new Rectangle(t);case"line":return new Line(t);case"grid":return new Grid(t);case"text":return new Text(t);case"shape":return new Shape(t);case"composite":return new Composite(t)}}())&&this.objects.push(i),i},i.prototype.delete=function(e){var t;if(-1!==(t=this.objects.indexOf(e)))return this.objects.splice(t,1)},i.prototype.deleteAll=function(){this.objects=[]},i.prototype.find=function(e){var t,i,n,r;for(t=0,i=(r=this.objects).length;t<i;t++)if((n=r[t]).id===e)return n},i.prototype.findBy=function(e){var t,i,n,r;for(t=0,i=(r=this.objects).length;t<i;t++)if(e(n=r[t]))return n},i.prototype.getBoundingBox=function(){var e,t,i,n,r;if(this.objects.length>0){if(r=this.objects[0].getBoundingBox(this.drawing.ctx),this.objects.length>1)for(t=i=1,n=this.objects.length-1;i<=n;t=i+=1)(e=this.objects[t].getBoundingBox(this.drawing.ctx))&&(r?(e[0]<r[0]&&(r[0]=e[0]),e[1]<r[1]&&(r[1]=e[1]),e[2]>r[2]&&(r[2]=e[2]),e[3]>r[3]&&(r[3]=e[3])):r=e);return r}return null},i.prototype.setAlphaCurve=function(i,n,r){return this.alphaCurveFunction=function(){switch(i){case"triangle":return t(n,r);case"ramp":return e(n,r)}}()},t=function(e,t){return function(i){return 1-Math.abs(2*(Math.log(i)-e)/(t-e)-1)}},e=function(e,t){return function(i){return 1+Math.min(2*(Math.log(i)-e)/(t-e)-1,0)}},i}.call(void 0),Camera=function(){var e,t,i,n,r,o,a,s,l,c,u,d=function(e){function t(t){var c,u,d,h,p=this;e.call(this),this.drawing=t,this.position=new Point,this.zoom=1,this.actualPosition=new Point,this.actualZoom=1,this.smoothPosition=!1,this.positionSmoothingFactor=.15,this.smoothZoom=!0,this.zoomSmoothingFactor=.15,this.zoomMax=null,this.zoomMin=null,this.xMin=null,this.yMin=null,this.xMax=null,this.yMax=null,this.mode=null,this.followContinualZoom=!1,this.smoothToNextTargetPosition=!1,this.lastx1=0,this.lasty1=0,this.lastx2=0,this.lasty2=0,this.lastZoom=1,this.isZoomTouch=!1,this.moving=!1,this.panEnabled=!1,this.zoomEnabled=!1,this.selectionEnabled=!1,c={selection:select(this.drawing.canvasNode),positionLast:new Point,touchStart:new Point,mouseDown:!1,moveThreshold:5*this.drawing.dpr,longPressTime:1e3,longPressTimer:null,didLongPress:!1},u=function(e){return r.call(p,e,c)},h=function(e){return a.call(p,e,c)},d="drawing-"+exports.randomId(),select(document).on("mouseup",d,u),select(document).on("touchend",d,h),select(this.drawing.canvasNode).on("mousemove","hx.drawing",(function(e){return n.call(p,e,c)})),c.selection.on("mousedown","hx.drawing",(function(e){return i.call(p,e,c)})),c.selection.on("wheel","hx.drawing",(function(e){return o.call(p,e,c)})),select(this.drawing.canvasNode).on("touchstart","hx.drawing",(function(e){return l.call(p,e,c)})),c.selection.on("touchmove","hx.drawing",(function(e){return s.call(p,e,c)})),c.selection.on("touchcancel","hx.drawing",(function(e){return a.call(p,e,c)}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.setupBounds=function(e,t,i,n,r,o){return this.zoomMin=e,this.zoomMax=t,this.xMin=i,this.yMin=n,this.xMax=r,this.yMax=o},t.prototype.clearTransform=function(e){return e.setTransform(1,0,0,1,0,0)},t.prototype.applyTransform=function(e){return e.translate(this.drawing.width/2,this.drawing.height/2),e.scale(this.actualZoom,this.actualZoom),e.translate(-this.actualPosition.x,-this.actualPosition.y)},t.prototype.update=function(){var e;if("follow"===this.mode)(e=this.followObject.getBoundingBox(this.drawing.ctx))&&(this.followContinualZoom&&(this.zoom=this.calculateZoomForBoundingBox(e,this.followZoomOut)),this.position.x=(e[0]+e[2])/2,this.position.y=(e[1]+e[3])/2);return this.zoomMin&&this.zoom<this.zoomMin&&(this.zoom=this.zoomMin),this.zoomMax&&this.zoom>this.zoomMax&&(this.zoom=this.zoomMax),this.xMin&&this.position.x<this.xMin&&(this.position.x=this.xMin),this.yMin&&this.position.y<this.yMin&&(this.position.y=this.yMin),this.xMax&&this.position.x>this.xMax&&(this.position.x=this.xMax),this.yMax&&this.position.y>this.yMax&&(this.position.y=this.yMax),this.smoothPosition||this.smoothToNextTargetPosition?(this.actualPosition.tweenTo(this.position,this.positionSmoothingFactor),this.actualPosition.distanceTo(this.position)<1&&(this.smoothToNextTargetPosition=!1)):this.actualPosition.set(this.position),this.smoothZoom?this.actualZoom=exports.tween(this.actualZoom,this.zoom,this.zoomSmoothingFactor):this.actualZoom=this.zoom},t.prototype.getWorldRect=function(){return[this.actualPosition.x-this.drawing.width/(2*this.actualZoom),this.actualPosition.y-this.drawing.height/(2*this.actualZoom),this.actualPosition.x+this.drawing.width/(2*this.actualZoom),this.actualPosition.y+this.drawing.height/(2*this.actualZoom)]},t.prototype.getWorldX=function(e){return(e*this.drawing.dpr-this.drawing.width/2)/this.actualZoom+this.actualPosition.x},t.prototype.getWorldY=function(e){return(e*this.drawing.dpr-this.drawing.height/2)/this.actualZoom+this.actualPosition.y},t.prototype.screenPointToWorldPoint=function(e){return{x:(e.x*this.drawing.dpr-this.drawing.width/2)/this.actualZoom+this.actualPosition.x,y:(e.y*this.drawing.dpr-this.drawing.height/2)/this.actualZoom+this.actualPosition.y}},t.prototype.worldPointToScreenPoint=function(e){return{x:(e.x*this.drawing.dpr-this.actualPosition.x)*this.actualZoom+this.drawing.width/2,y:(e.y*this.drawing.dpr-this.actualPosition.y)*this.actualZoom+this.drawing.height/2}},t.prototype.calculateZoomForBoundingBox=function(e,t){return Math.min(this.drawing.width/((e[2]-e[0])*t),this.drawing.height/((e[3]-e[1])*t))},t.prototype.follow=function(e,t,i){var n;if(this.smoothToNextTargetPosition=!0,e&&(this.mode="follow",this.followObject=e,this.followZoomOut=t,this.followContinualZoom=i,n=this.followObject.getBoundingBox(this.drawing.ctx)))return this.zoom=this.calculateZoomForBoundingBox(n,t)},t.prototype.stopFollowing=function(){return this.mode=null,this.followObject=null},t.prototype.show=function(e,t){var i;if(this.smoothToNextTargetPosition=!0,e&&(i=e.getBoundingBox(this.drawing.ctx)))return this.zoom=this.calculateZoomForBoundingBox(i,t),this.position.x=(i[0]+i[2])/2,this.position.y=(i[1]+i[3])/2},t}(EventEmitter);return u=function(e){return this.zoom=e,this.emit("zoom",{zoom:e})},i=function(e,t){var i,n;return e.preventDefault(),this.mouseDown=!0,i=e.clientX,n=e.clientY,t.touchStart.x=i,t.touchStart.y=n,this.emit("pointerdown",{x:i,y:n})},n=function(e,t){var i,n,r,o;if(this.panEnabled&&this.mouseDown&&e.preventDefault(),r=e.clientX,o=e.clientY,this.mouseDown&&(!this.moving&&(t.touchStart.x-r)*(t.touchStart.x-r)+(t.touchStart.y-o)*(t.touchStart.y-o)>t.moveThreshold*t.moveThreshold&&(this.moving=!0,t.positionLast.set(t.touchStart),this.panEnabled&&t.selection.style("cursor","move")),this.moving))return i=r-t.positionLast.x,n=o-t.positionLast.y,t.positionLast.x=e.clientX,t.positionLast.y=e.clientY,c.call(this,i,n)},r=function(t,i){if(this.mouseDown)return t.preventDefault(),this.mouseDown=!1,this.moving?this.moving=!1:e.call(this,i.touchStart.x-i.selection.box().left,i.touchStart.y-i.selection.box().top),i.selection.style("cursor","default"),this.emit("pointerup",{x:i.touchStart.x,y:i.touchStart.y})},c=function(e,t,i){if(this.panEnabled)return this.mode=void 0,this.smoothToNextTargetPosition=!1,this.position.x-=e*this.drawing.dpr/this.actualZoom,this.position.y-=t*this.drawing.dpr/this.actualZoom,this.emit("move",{dx:e,dy:t})},o=function(e,t){var i,n,r,o;if(this.zoomEnabled)return e.preventDefault(),e.stopPropagation(),i=-e.deltaY,1===e.deltaMode&&(i*=20),n=Math.min(.99,Math.abs(i/120*.2)),r=e.clientX,o=e.clientY,this.getWorldX(r),this.getWorldY(o),u.call(this,i>0?this.zoom/(1-n):this.zoom*(1-n))},l=function(e,i){var n,r,o,a,s,l,c=this;if(e.preventDefault(),this.mouseDown=!0,(n=e.changedTouches).length>0)for(r=o=0,a=n.length-1;o<=a;r=o+=1)s=n[r].clientX,l=n[r].clientY,this.emit("pointerdown",{x:s,y:l});return 1===e.targetTouches.length?(s=e.targetTouches[0].clientX,l=e.targetTouches[0].clientY,i.touchStart.x=s,i.touchStart.y=l,i.longPressTimer=setTimeout((function(){return t.call(c,i.touchStart.x-i.selection.box().left,i.touchStart.y-i.selection.box().top),!0}),i.longPressTime)):2===e.targetTouches.length?(i.longPressTimer&&(clearTimeout(i.longPressTimer),i.longPressTimer=null),this.isZoomTouch=!0,this.lastx1=e.targetTouches[0].clientX,this.lasty1=e.targetTouches[0].clientY,this.lastx2=e.targetTouches[1].clientX,this.lasty2=e.targetTouches[1].clientY,this.startPinchDistance=Math.sqrt((this.lastx1-this.lastx2)*(this.lastx1-this.lastx2)+(this.lasty1-this.lasty2)*(this.lasty1-this.lasty2)),this.lastZoom=this.zoom):void 0},s=function(e,t){var i,n,r,o,a,s,l,d,h;if(e.preventDefault(),1!==e.targetTouches.length||this.isZoomTouch){if(2===e.targetTouches.length&&this.zoomEnabled)return a=e.targetTouches[0].clientX,d=e.targetTouches[0].clientY,s=e.targetTouches[1].clientX,h=e.targetTouches[1].clientY,i=Math.sqrt((a-s)*(a-s)+(d-h)*(d-h)),u.call(this,this.lastZoom*i/this.startPinchDistance)}else if(o=e.targetTouches[0].clientX,l=e.targetTouches[0].clientY,!this.moving&&(t.touchStart.x-o)*(t.touchStart.x-o)+(t.touchStart.y-l)*(t.touchStart.y-l)>t.moveThreshold*t.moveThreshold&&(this.moving=!0,t.positionLast.set(t.touchStart),t.longPressTimer&&(clearTimeout(t.longPressTimer),t.longPressTimer=null)),this.moving&&(n=o-t.positionLast.x,r=l-t.positionLast.y,t.positionLast.x=o,t.positionLast.y=l,this.mouseDown))return c.call(this,n,r)},a=function(t,i){var n,r,o,a,s,l,c;if(this.mouseDown){if(t.preventDefault(),(n=t.changedTouches).length>0)for(o=a=0,s=n.length-1;a<=s;o=a+=1)l=n[o].clientX,c=n[o].clientY,this.emit("pointerup",{x:l,y:c});return 0===t.targetTouches.length?(this.isZoomTouch=!1,i.longPressTimer&&(clearTimeout(i.longPressTimer),i.longPressTimer=null),this.moving?this.moving=!1:r||e.call(this,i.touchStart.x-i.selection.box().left,i.touchStart.y-i.selection.box().top),!1):void 0}},e=function(e,t){var i,n,r;return r=this.screenPointToWorldPoint(new Point(e,t)),this.selectionEnabled&&(i=this.drawing.ctx,(n=this.drawing.findBy((function(e){return e.selectable.value&&e.pointInBoundingBox(r,i)})))?this.drawing.select(n):this.drawing.unselectAll()),this.emit("click",{x:e,y:t,wx:r.x,wy:r.y})},t=function(e,t){return this.emit("longpress",{x:e,y:t})},d}.call(void 0),exports.Drawing=function(){var e,t,i=function(i){function n(e,n){var r,o,a=this;void 0===n&&(n=!0),i.call(this),logger.deprecated("hx.Drawing","N/A - This module will be removed in the next major release"),r=select(e).classed("hx-drawing",!0).api("drawing",this).api(this),this.canvas=r.append("canvas"),this.overlay=r.append("div").class("hx-drawing-overlay"),o=r.node(),t.call(this,o),r.on("resize",(function(){return t.call(a,o)})),this.canvasNode=this.canvas.node(),this.ctx=this.canvasNode.getContext("2d"),this.defaultLayer=new Layer(this),this.layers=[this.defaultLayer],this.camera=new Camera(this),this.camera.pipe(this),this.globalAlpha=1,this.stats=null,this.selectedObjects=new List,this.frame=0,n&&this.resume()}return i&&(n.__proto__=i),n.prototype=Object.create(i&&i.prototype),n.prototype.constructor=n,n.prototype.resume=function(){if(!this.stopFunc)return this.stopFunc=e.call(this)},n.prototype.stop=function(){if(this.stopFunc)return this.stopFunc(),this.stopFunc=void 0},n.prototype.find=function(e){var t,i,n,r;for(t=0,i=(n=this.layers).length;t<i;t++)if(r=n[t].find(e))return r},n.prototype.findBy=function(e){var t,i,n,r;for(t=0,i=(n=this.layers).length;t<i;t++)if(r=n[t].findBy(e))return r},n.prototype.createLayer=function(){var e;return e=new Layer(this),this.layers.push(e),e},n.prototype.showLayer=function(e){var t,i,n,r,o;for(o=[],t=0,n=(r=this.layers).length;t<n;t++)i=r[t],o.push(i.visible=i===e);return o},n.prototype.follow=function(e,t,i){return void 0===t&&(t=1),void 0===i&&(i=!1),this.camera.follow(e,t,i)},n.prototype.stopFollowing=function(){return this.camera.stopFollowing},n.prototype.show=function(e,t){return void 0===t&&(t=1),this.camera.show(e,t)},n.prototype.enablePan=function(){return this.camera.panEnabled=!0},n.prototype.enableZoom=function(){return this.camera.zoomEnabled=!0},n.prototype.enableSelection=function(){return this.camera.selectionEnabled=!0},n.prototype.enablePerformanceGauge=function(){return this.stats=new PerformanceGauge(this)},n.prototype.enableSearchbox=function(){var e,t=this;return this.searchbox=this.overlay.append("div").classed("hx-drawing-searchbox",!0),(e=this.searchbox.append("input").attr("placeholder","Search")).on("keypress",(function(i){if(13===i.which)return t.emit("search",e.prop("value"))}))},n.prototype.enableSidebar=function(e,t,i){var n=this;return 2===arguments.length&&(i=t,t=null),this.sidebar=new Sidebar$1(this.overlay,e,t,i),this.showSidebar=function(){return n.sidebar.show()},this.hideSidebar=function(){return n.sidebar.hide()},this.toggleSidebar=function(){return n.sidebar.toggle()}},n.prototype.create=function(e,t){return this.defaultLayer.create(e,t)},n.prototype.delete=function(e){var t,i,n,r,o;for(o=[],t=0,n=(r=this.layers).length;t<n;t++)i=r[t],o.push(i.delete(e));return o},n.prototype.deleteAll=function(){var e,t,i;for(e=0,t=(i=this.layers).length;e<t;e++)i[e].deleteAll()},n.prototype.setGlobalAlpha=function(e){return this.globalAlpha=e},n.prototype.setFillColor=function(e){var t,i,n,r;return r=e.red(),n=e.green(),i=e.blue(),t=e.alpha()*this.globalAlpha,this.ctx.fillStyle="rgba("+Math.floor(r)+","+Math.floor(n)+","+Math.floor(i)+","+t+")"},n.prototype.setStrokeColor=function(e){var t,i,n,r;return r=e.red(),n=e.green(),i=e.blue(),t=e.alpha()*this.globalAlpha,this.ctx.strokeStyle="rgba("+Math.floor(r)+","+Math.floor(n)+","+Math.floor(i)+","+t+")"},n.prototype.setStrokeWidth=function(e){return this.ctx.lineWidth=e},n.prototype.setStrokeCap=function(e){return this.ctx.lineCap=e},n.prototype.getBoundingBox=function(){var e,t,i,n,r;if(this.layers.length>0){if(r=this.layers[0].getBoundingBox(this.ctx),this.layers.length>1)for(t=i=1,n=this.layers.length-1;i<=n;t=i+=1)(e=this.layers[t].getBoundingBox(this.ctx))&&(r?(e[0]<r[0]&&(r[0]=e[0]),e[1]<r[1]&&(r[1]=e[1]),e[2]>r[2]&&(r[2]=e[2]),e[3]>r[3]&&(r[3]=e[3])):r=e);return r}return null},n.prototype.select=function(e,t){var i,n,r,o;if(void 0===t&&(t=!1),t)this.selectedObjects.add(e);else{for(i=0,n=(o=this.selectedObjects.values()).length;i<n;i++)(r=o[i])!==e&&(r.selected=!1,this.emit("unselect",r));this.selectedObjects=new List([e])}return e.selected=!0,this.emit("select",e)},n.prototype.unselect=function(e){if(this.selectedObjects.remove(e))return e.selected=!1,this.emit("unselect",e)},n.prototype.unselectAll=function(){var e,t,i,n;for(e=0,t=(n=this.selectedObjects.values()).length;e<t;e++)(i=n[e]).selected=!1,this.emit("unselect",i);return this.selectedObjects.clear()},n.prototype.selected=function(){return this.selectedObjects.values()},n}(EventEmitter);return e=function(){var e,t=this;return e=!1,loop((function(){var i,n,r;for(t.stats&&t.stats.start(),t.camera.clearTransform(t.ctx),t.ctx.clearRect(0,0,t.width,t.height),t.camera.update(),t.camera.applyTransform(t.ctx),i=0,n=(r=t.layers).length;i<n;i++)r[i].render(t.ctx);return t.stats&&(t.camera.clearTransform(t.ctx),t.stats.end(),t.stats.update(),t.stats.render()),t.emit("update",t.frame),t.frame++,e})),function(){return e=!0}},t=function(e){var t,i;return i=e.clientWidth,t=e.clientHeight,this.dpr=null!=window.devicePixelRatio?window.devicePixelRatio:1,this.canvas.prop("width",i*this.dpr),this.canvas.prop("height",t*this.dpr),this.canvas.style("width",i+"px"),this.canvas.style("height",t+"px"),this.canvas.style("position","relative"),this.width=i*this.dpr,this.height=t*this.dpr,this.overlay.style("width",i+"px"),this.overlay.style("height",t+"px"),this.state={height:i,width:t}},i}.call(void 0),exports.drawing=function(e){var t;return t=div(),new exports.Drawing(t.node(),e),t};var MorphSection=function(e){function t(t,i){var n,r=this;e.call(this),this.selector=t,this.options=exports.mergeDefined({animate:!0},i),this.expanded=!1,(n=select(this.selector).classed("hx-openable",!0).classed("hx-morph-section",!0).api("morph-section",this).api(this)).select(".hx-morph-toggle").on("click","hx.morph-section",(function(){return r.toggle()})),n.select(".hx-morph-content").style("display","none")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.visible=function(e){var t,i,n;if(void 0===e)return this.expanded;n=(i=select(this.selector).classed("hx-opened",e)).select(".hx-morph-toggle"),t=i.select(".hx-morph-content"),this.options.animate?t.morph().cancelOngoing().with(e?"expand":"fadeout",100).and(e?"fadein":"collapse",100).go():t.style("display",e?"":"none"),this.expanded=e,this.emit(e?"show":"hide",{toggle:n.node(),content:t.node()})},t.prototype.toggle=function(){return this.visible(!this.expanded)},t.prototype.show=function(){return this.visible(!0)},t.prototype.hide=function(){return this.visible(!1)},t}(EventEmitter),InlineMorphSection=function(e){function t(t,i,n,r){var o;r=exports.mergeDefined({animate:!1},r),e.call(this,t,r),o=this,this.on("show","hx.morph-section",(function(e){return o.detector=new exports.ClickDetector(e.content),i.call(o,e.toggle,e.content),select(e.toggle).style("display","none"),o.detector.addException(e.content),o.detector.on("click","hx.morph-section",(function(){return o.detector.cleanUp(),o.detector=void 0,o.hide()}))})),this.on("hide","hx.morph-section",(function(e){return null!=n&&n.call(o,e.toggle,e.content),select(e.toggle).style("display","")}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(MorphSection);exports.userFacingText({inlineEditable:{enterValue:"Enter Value"}});var InlineEditable=function(){var e,t=function(t){function i(i,n){var r,o,a,s,l,c,u,d=this;l=select(i).classed("hx-inline-editable",!0),o={enterValueText:exports.userFacingText("inlineEditable","enterValue"),value:l.text()},s=exports.merge(o,n),l.text(""),u=l.append("a").class("hx-morph-toggle").text(s.value||s.enterValueText),a=detached("input").class("hx-name").attr("placeholder",s.enterValueText),r=detached("button").class("hx-btn hx-positive hx-confirm").add(detached("i").class("hx-icon hx-icon-check")),l.append("div").class("hx-morph-content hx-input-group").add(a).add(r),t.call(this,i,e(s)),this.textSelection=u,c=function(){var e;return e=a.value(),d.textSelection.text(e||s.enterValueText).classed("hx-inline-editable-no-value",!e.length),d.emit("change",{cause:"user",value:e}),d.hide()},r.on("click","hx.inline-editable",c),a.on("keydown","hx.inline-editable",(function(e){if("Enter"===e.key||13===e.keyCode||13===e.which)return c()}))}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.value=function(e){return void 0!==e?(this.textSelection.text(e),this.emit("change",{cause:"api",value:e})):this.textSelection.text()},i}(InlineMorphSection);return e=function(e){return function(t,i){var n,r;return r=select(t).text(),n=select(i).select(".hx-name"),r!==e.enterValueText&&n.value(r),n.node().focus()}},t}.call(void 0),inlineEditable=function(e){var t;return t=detached("div"),new InlineEditable(t.node(),e),t},InlinePicker=function(){var e,t,i=function(i){function n(n,r){var o,a,s,l,c,u=this;s=exports.merge({renderer:void 0,items:[],contextClass:"hx-complement",ddClass:void 0,noValueText:void 0,value:void 0},r),c=select(n).classed("hx-inline-picker",!0),a=detached("button").class("hx-btn "+s.contextClass).node(),l=c.append("a").class("hx-morph-toggle"),c.append("div").class("hx-morph-content hx-input-group").add(a).add(detached("button").class("hx-btn hx-positive hx-confirm").add(detached("i").class("hx-icon hx-icon-check"))),o=new PickerBase(a,{renderer:s.renderer,items:s.items,ddClass:s.ddClass,noValueText:s.noValueText}),i.call(this,n,e,t,s),o._.menu.dropdown.on("showstart","hx.inline-picker",(function(){return u.detector.addException(o._.menu.dropdown._.dropdown.node())})),this._={current:void 0,renderer:s.renderer,options:s,picker:o,selector:n,selectedText:l},null==this.renderer()&&this.renderer(o.renderer()),null!=s.value&&this.value(s.value)}return i&&(n.__proto__=i),n.prototype=Object.create(i&&i.prototype),n.prototype.constructor=n,n.prototype.renderer=function(e){return null!=e?(this._.renderer=e,this._.picker.renderer(e),this):this._.renderer},n.prototype.items=function(e){return null!=e?(this._.items=e,this._.picker.items(e),this):this._.items},n.prototype.value=function(e){return arguments.length>0?(this._.picker.value(e),this._.current=this._.picker.value(),this._.selectedText.text(this._.current.text||this._.current),this.emit("change",{api:!0,value:this._.current}),this):this._.current},n}(InlineMorphSection);return e=function(e,t){var i,n,r=this;return(i=this._).picker.value((null!=(n=i.current)?n.value:void 0)||i.current),select(t).select(".hx-confirm").on("click","hx.inline-picker",(function(){return i.current=i.picker.value(),i.selectedText.text(i.current.text||i.current),r.emit("change",{api:!1,value:i.current}),r.hide()}))},t=function(e,t){},i}.call(void 0),inlinePicker=function(e){var t;return t=detached("div"),new InlinePicker(t.node(),e),t},Stepper=function(e,t,i){void 0===i&&(i={}),this.selection=select(e).classed("hx-stepper",!0).api("stepper",this).api(this),this._={steps:[],suppressed:!0,view:void 0},this.options=i,this.steps(t),this.selectedStep(i.selectedStep||1),this.showTitles(i.showTitles||!0),this.showError(i.showError||!1),this._.suppressed=!1,this.render()};Stepper.prototype.steps=function(e){if(arguments.length){if(e.length<2)throw new Error("Stepper: Expected at least two steps to display");return this._.steps=e,this.options.selectedStep=1,this.render(),this}return this._.steps},Stepper.prototype.selectedStep=function(e){if(arguments.length){var t=this.steps().length;return e&&e>0&&e<=t?(this.options.selectedStep=e,this.options.showError=!1,this.render()):logger.warn("Stepper: Provided expected a number between 1 and "+t+". You provided: "+e),this}return this.options.selectedStep},Stepper.prototype.showTitles=function(e){return arguments.length?(e!==this.showTitles()&&(this.options.showTitles=e,this.render()),this):this.options.showTitles},Stepper.prototype.prevStep=function(){return this.selectedStep()>1?this.selectedStep(this.selectedStep()-1):logger.warn("Stepper: There is no previous step"),this},Stepper.prototype.nextStep=function(){return this.selectedStep()<this.steps().length?this.selectedStep(this.selectedStep()+1):logger.warn("Stepper: There is no next step"),this},Stepper.prototype.showError=function(e){return arguments.length?(this.options.showError!==e&&(this.options.showError=e,this.render()),this):this.options.showError},Stepper.prototype.render=function(){var e=this;return this._.suppressed||(this._.view||(this._.view=this.selection.view(".hx-stepper-step").enter((function(){var e=div("hx-stepper-step").add(div("hx-stepper-progress-row").add(div("hx-stepper-progress-before")).add(div("hx-stepper-number")).add(div("hx-stepper-progress-after"))).add(div("hx-stepper-title"));return this.append(e).node()})).update((function(t,n,r){var o=r+1,a=select(n),s=e.steps().length,l=e.selectedStep(),c=e.showError(),u=e.showTitles(),d=a.select(".hx-stepper-number").classed("hx-stepper-number-selected",o===l&&!c).classed("hx-stepper-number-error",o===l&&c).classed("hx-stepper-number-complete",o<l);o<l?d.set([i("hx-icon hx-icon-check")]):d.text(o),a.select(".hx-stepper-progress-before").classed("hx-stepper-progress-incomplete",o>1&&o>l).classed("hx-stepper-progress-complete",o>1&&o<=l),a.select(".hx-stepper-progress-after").classed("hx-stepper-progress-incomplete",o<s&&o>=l).classed("hx-stepper-progress-complete",o<s&&o<l),a.select(".hx-stepper-title").classed("hx-stepper-title-hidden",!u).classed("hx-stepper-title-error",o===l&&u&&c).text(t)}))),this._.view.apply(this.steps())),this};var validTypes=["primary","secondary"];function makeAction(e){var t=e.text,i=e.url,n=e.onClick,r=e.buttonType,o=r&&validTypes.includes(r);r&&!o&&logger.warn("errorPage: Invalid button type selected '"+r+"'. Available types: ["+validTypes.join(", ")+"]");var a="hx-btn"+(o?" hx-"+r:"");if(n)return button(a).text(t).on("click",n);if(!i)throw new Error("errorPage: Button created with no 'onClick' or 'url': "+JSON.stringify(e));return detached("a").class(a).text(t).attr("href",i)}function errorPage(e){void 0===e&&(e={});var t=e.title,i=e.message,n=e.buttons;if(!t)throw new Error("errorPage: Cannot create an error page with no title.");var r=(n||[]).map(makeAction);return div("hx-error-message hx-flag-button hx-flag-typography").add(div("hx-error-message-heading").text(t)).add(div("hx-error-message-body").add(toMultilineSelection(i||"","p",!0))).add(div("hx-error-message-buttons").add(r))}initAnimate(),initMorphs(),initView(),initPointerEvents(),initResizeEvents(),initLogos(),initTitleBar();var doctypeIsValid=document.doctype&&"html"===document.doctype.name&&!(document.doctype.publicId||document.doctype.systemId);doctypeIsValid||logger.warn("Missing <!DOCTYPE html> tag - you may have CSS problems without this tag. To fix this add <!DOCTYPE html> to the top of your html file. Detected doctype:",document.doctype),theme(currentTheme),exports.AlertManager=AlertManager,exports.AutoComplete=exports.Autocomplete,exports.Collapsible=Collapsible,exports.DateTimePicker=DateTimePicker,exports.Dropdown=Dropdown,exports.EventEmitter=EventEmitter,exports.FileInput=FileInput,exports.Form=Form,exports.InlineEditable=InlineEditable,exports.InlineMorphSection=InlineMorphSection,exports.InlinePicker=InlinePicker,exports.List=List,exports.Map=Map,exports.Meter=Meter,exports.MorphSection=MorphSection,exports.NotificationManager=NotificationManager,exports.NumberPicker=NumberPicker,exports.ProgressBar=ProgressBar$2,exports.Selection=Selection,exports.Set=Set,exports.Sidebar=Sidebar,exports.SingleSelect=SingleSelect,exports.Stepper=Stepper,exports.TitleBar=TitleBar,exports.VisualizationBar=VisualizationBar,exports.alert=alert,exports.autoComplete=exports.autocomplete,exports.badge=badge,exports.button=button,exports.checkParents=checkParents,exports.checkbox=checkbox,exports.cleanNode=cleanNode,exports.color=color,exports.component=component,exports.components=components,exports.dateTimeLocalizer=dateTimeLocalizer,exports.dateTimePicker=dateTimePicker,exports.detached=detached,exports.div=div,exports.dropdownButton=dropdownButton,exports.ease=ease,exports.errorPage=errorPage,exports.fileInput=fileInput,exports.getThemeVariable=getThemeVariable,exports.group=group,exports.html=html,exports.i=i,exports.icon=icon,exports.initializeCollapsibles=initializeCollapsibles,exports.inlineEditable=inlineEditable,exports.inlinePicker=inlinePicker,exports.input=input,exports.inputGroup=inputGroup,exports.interpolate=interpolate,exports.isColor=isColor,exports.isColorString=isColorString,exports.isElement=isElement,exports.isSelection=isSelection,exports.json=json,exports.label=label,exports.logger=logger,exports.loop=loop,exports.message=message,exports.meter=meter,exports.modalCenter=modalCenter,exports.modalFullScreen=modalFullScreen,exports.modalRight=modalRight,exports.moreButton=moreButton,exports.notice=notice,exports.noticeBody=noticeBody,exports.noticeHead=noticeHead,exports.numberPicker=numberPicker,exports.palette=palette$1,exports.parentZIndex=parentZIndex,exports.parseHTML=parseHTML,exports.preferences=preferences,exports.progressBar=progressBar,exports.request=request,exports.scrollbarSize=scrollbarSize,exports.section=section,exports.select=select,exports.selectAll=selectAll,exports.singleSelect=singleSelect,exports.span=span,exports.spinner=spinner,exports.spinnerWide=spinnerWide,exports.text=text,exports.theme=theme,exports.titleBar=titleBar,exports.tooltip=tooltip,exports.transition=transition,exports.validateForm=validateForm,exports.version=version,exports.visualizationBar=visualizationBar;
//# sourceMappingURL=/sm/f28e571d1443349e0d6152b3be4f08ea2f53317e32f647d4ca43ed0942b3d46a.map