!function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:0,i=document.documentElement.offsetWidth-e,n=document.documentElement.scrollTop+e,a=n+document.documentElement.clientHeight-e;return t.left>=e&&t.right<=i&&t.top>=n&&t.bottom<=a}function V(t){var e=document.createElement("div");return e.innerHTML=t,e.children[0]}function R(t){window.setImmediate?window.setImmediate(t):window.setTimeout(t,4)}window.BUI||(window.BUI={});var F=1,W=new(function(){function t(){e(this,t),this.components={},this.instances={}}return n(t,[{key:"register",value:function(t,e,i){if(t in Object.keys(this.components))throw new Error("BUI: ".concat(t," is already registered"));this.components[t]={Component:e,props:i}}},{key:"get",value:function(t){var e=this.components[t];if(e)return e}},{key:"saveInstance",value:function(t,e,i){return F+=1,this.instances[F]={instance:e,name:i},t._buiIds||(t._buiIds=[]),t._buiIds.push(F),F}},{key:"getInstances",value:function(t){var e=this;return t._buiIds?t._buiIds.map(function(t){return e.instances[t]}):[]}}]),t}());window.BUI||(window.BUI={}),window.BUI._version="9.5.5";var z=function(){function t(i,n){e(this,t),this.root=i,this.props=n||{},this.handlers=null,this.selectors={},this.modifiers={},this._removeHandlersMap={}}return n(t,[{key:"setState",value:function(t){var e=this;if(!this.state)throw new Error("\n BUI:\n You are trying to update a state that wasn't initialised yet.\n Create it in the init method of your component first e.g. this.state = { foo: 'bar' };\n ");var i=this.state,n=o({},this.state,t),a=this.handlers;this.state=n,a&&Object.keys(a).forEach(function(t){var o=e._parseHandlers(t),s=o.elName,r=o.subscriptionName;"state"===s&&i[r]!==n[r]&&a[t].call(e,i)})}},{key:"_parseHandlers",value:function(t){var e=t.split("@"),i=e[0],n=e[1];if(!i||!n)throw new Error("BUI: Wrong component handler syntax");return{elName:i,subscriptionName:n}}},{key:"_toggleHandlers",value:function(t){var e=this,i=this.handlers,n=this.selectors;i&&Object.keys(i).forEach(function(a){var o=e._parseHandlers(a),s=o.elName,r=o.subscriptionName,l=i[a].bind(e);if("state"!==s){var u,c=n[s];if("window"===s&&(u=window),"root"===s&&(u=e.root),"root"===s||"scroll"!==r&&"focus"!==r&&"blur"!==r||(u=g(c,e.root)),u)t?(e._removeHandlersMap[a]=l,u.addEventListener(r,l)):u.removeEventListener(r,e._removeHandlersMap[a]);else if(e.root){if(!c)throw new Error("BUI: Selector for element not found");if(t)e._removeHandlersMap[a]=function(t,e,i,n){var a=function(t){var e=A(t.target,i);t.delegateTarget=e,e&&n.call(null,t)};return _(t,e,a),function(){C(t,e,a)}}(e.root,r,c,l);else{var h=e._removeHandlersMap[a];h&&h()}}}})}},{key:"onMount",value:function(){}},{key:"onUnmount",value:function(){}},{key:"mount",value:function(){this._toggleHandlers(!0),this.onMount()}},{key:"update",value:function(){this._toggleHandlers(!1),this._toggleHandlers(!0),this.onMount()}},{key:"unmount",value:function(){this._toggleHandlers(!1),this.onUnmount()}}]),t}();function j(t,e,i){var n=W.get(t),a=n.Component,s=n.props;return new a(e||document.createElement("div"),o({},s,i))}function P(t){var e=t||document.body;y("[".concat("data-bui-component","]"),e).forEach(function(t){var e=t.getAttribute("data-bui-component");e&&e.split(",").forEach(function(e){var i=!1;if((W.getInstances(t)||[]).forEach(function(t){t.name===e&&(i=!0)}),!i){var n=j(e,t);W.saveInstance(t,n,e),n.mount()}})})}window.BUI.createInstance=j,window.BUI.getInstance=function(t){var e=W.getInstances(t);if(e.length)return 1===e.length?e[0].instance:e.map(function(t){return t.instance})},window.BUI.initComponents=P,window.BUI.extendComponent=function(t,e){var i=t.split(".")[0],n=W.get(i).Component;W.register(t,n,e)},R(function(){return P()});var U=function(t){function i(t,n){var a;return e(this,i),(a=h(this,l(i).call(this,t,n))).selectors={button:"[data-bui-ref=accordion-button]"},a.modifiers={activeRow:"bui-is-active"},a.handlers={"button@click":a._handleButtonClick,"button@keydown":a._handleKeyDown},a}return r(i,z),n(i,[{key:"toggle",value:function(t,e){"true"!==t.getAttribute("aria-expanded")?this.open(t,e):this.close(t,e)}},{key:"open",value:function(t,e){var i=this.props,n=i.onAfterItemOpen,a=i.onAfterItemToggle,o=t.parentNode;T(o,this.modifiers.activeRow,!0),t.setAttribute("aria-expanded",!0),n&&n.call(this,{event:e,el:o}),a&&a.call(this,{event:e,el:o})}},{key:"close",value:function(t,e){var i=this.props,n=i.onAfterItemClose,a=i.onAfterItemToggle,o=t.parentNode;T(o,this.modifiers.activeRow,!1),t.setAttribute("aria-expanded",!1),n&&n.call(this,{event:e,el:o}),a&&a.call(this,{event:e,el:o})}},{key:"_handleButtonClick",value:function(t){var e=t.delegateTarget;this.toggle(e,t)}},{key:"_handleKeyDown",value:function(t){32!==t.which&&13!==t.which||(t.preventDefault(),this.toggle(t.delegateTarget,t))}}]),i}();W.register("Accordion",U);var q=function(t){function i(t,n){var a;return e(this,i),(a=h(this,l(i).call(this,t,n))).selectors={close:"[data-bui-ref=badge-close]"},a.handlers={"close@click":a.close},a}return r(i,z),n(i,[{key:"close",value:function(){var t=this.props.onAfterClose;this.root.style.display="none",t&&t.call(this)}}]),i}();W.register("Badge",q);var K=function(t){function i(t,n){var a;return e(this,i),(a=h(this,l(i).call(this,t,n))).selectors={close:"[data-bui-ref=banner-close]"},a.handlers={"close@click":a.close},a}return r(i,z),n(i,[{key:"close",value:function(t){var e=this.props.onAfterClose;this.root.style.display="none",e&&e.call(this,t)}}]),i}();W.register("Banner",K);var Y=function(t){function i(t,n){var a;return e(this,i),(a=h(this,l(i).call(this,t,n))).handlers={"root@keydown":a._handleItemKeyDown},a}return r(i,z),n(i,[{key:"_handleItemKeyDown",value:function(t){32===t.which&&(t.preventDefault(),t.target.click())}}]),i}();W.register("Button",Y);var X=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],G=["january","february","march","april","may","june","july","august","september","october","november","december"],J=function(t){return t<=9?"0".concat(t):t.toString()},Q=function(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)},Z=function(t,e){var i=X.slice(0,e),n=X.slice(e);return[].concat(f(n),f(i)).map(function(e){return t[e]})},$=function(t){var e=t.getFullYear(),i=J(t.getMonth()+1),n=J(t.getDate());return"".concat(e,"-").concat(i,"-").concat(n)},tt=function(t){var e=t.split("-");return new Date(e[0],e[1]-1,e[2])},et=function(t){var e=t.day,i=t.getDayMarkup,n=t.monthName;if(!e)return'';var a=e.date,o=$(a),s=["bui-calendar__date"],r=$(new Date),l=i(a),u=a.getDate(),c="".concat(u," ").concat(n," ").concat(a.getFullYear());return o===r&&s.push("bui-calendar__date--today"),'\n \n \n ').concat(l,"\n \n \n ")},it=function(t){for(var e=t.week,i=t.minDate,n=t.maxDate,a=t.selectedDates,o=t.disabledDates,s=t.getDayMarkup,r=t.monthName,l='',u=0;u<7;u++)l+=et({day:e[u],minDate:i,maxDate:n,selectedDates:a,disabledDates:o,getDayMarkup:s,monthName:r});return l+""},nt=function(t){for(var e=t.date,i=t.dayNames,n=t.monthNames,a=t.minDate,o=t.maxDate,s=t.showDayNames,r=t.firstWeekDay,l=t.selectedDates,u=t.disabledDates,c=t.id,h=t.getDayMarkup,d=function(t,e){for(var i=t.getMonth(),n=t.getFullYear(),a=[],o=new Date(n,i,1),s=null,r=null;i===o.getMonth();){var l=o.getDay(),u=l>=e?l-e:7-e+l;(null===s||s>u)&&(a.push([]),r=null===r?0:r+1),a[r][u]={date:new Date(o)},o.setDate(o.getDate()+1),s=u}return a}(e,r),f=function(t){return G.map(function(e){return t[e]})}(n)[e.getMonth()],v=e.getFullYear(),p=Z(i,r),m="",b=0;b\n
').concat(f," ").concat(v,'
\n \n ').concat(function(t,e){var i=["bui-calendar__row"];return e||i.push("bui-u-sr-only"),'\n \n ').concat(t.map(function(t){return'")}).join(""),"\n \n ")}(p,s),"\n ").concat(m,"\n
'.concat(t,"
\n \n ")},at=2,ot=2*at+1,st=function(){return"bui-calendar-"+Date.now()+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10)},rt=function(t){function i(t,n){var a;e(this,i),(a=h(this,l(i).call(this,t,n))).props=o({},{singleDate:!!t.getAttribute("data-single-date"),vertical:!!t.getAttribute("data-vertical"),monthsToShow:+t.getAttribute("data-months-to-show")||1,minDate:t.getAttribute("data-min-date"),maxDate:t.getAttribute("data-max-date"),startDate:t.getAttribute("data-start-date"),endDate:t.getAttribute("data-end-date"),baseDate:t.getAttribute("data-base-date"),firstWeekDay:t.getAttribute("data-first-week-day")||1,renderOnHover:t.getAttribute("data-render-on-hover"),allowSameDateSelection:t.getAttribute("data-allow-same-date-selection"),disableDateSelection:t.getAttribute("data-disable-date-selection"),renderSelected:null,getDayMarkup:n.getDayMarkup||a._getRenderDay.bind(c(a))},n);var s=new Date,r=a.props.startDate?tt(a.props.startDate):null,u=a.props.endDate?tt(a.props.endDate):null,d=!a.props.startDate||a.props.endDate||a.props.singleDate?"start":"end";a.modifiers={dateDisabled:"bui-calendar__date--disabled",dateSelected:"bui-calendar__date--selected",dateInRange:"bui-calendar__date--in-range",controlHidden:"bui-calendar__control--hidden",vertical:"bui-calendar--vertical"},a.attributes={date:"data-date"},a.selectors={content:"[data-bui-ref=calendar-content]",selectedDisplay:"[data-bui-ref=calendar-selected-display]",prevButton:"[data-bui-ref=calendar-prev]",nextButton:"[data-bui-ref=calendar-next]",date:"[data-bui-ref=calendar-date]",month:"[data-bui-ref=calendar-month]"},a.handlers={"prevButton@click":a._handlePrevClick,"nextButton@click":a._handleNextClick,"date@click":a._handleDateClick,"content@keydown":a._handleKeyboardEvents,"content@scroll":a._handleScroll,"state@baseMonthDate":a._handleMonthChange,"state@startDate":a._handleSelectedDateStateChange,"state@endDate":a._handleSelectedDateStateChange,"state@maxDate":a._updateVisual,"state@minDate":a._updateVisual};var f=a.props.baseDate?tt(a.props.baseDate):new Date(s.getFullYear(),s.getMonth(),1);return a.props.vertical&&(f=Q(f,-at)),a.state={today:s,startDate:r,endDate:u,minDate:a.props.minDate,maxDate:a.props.maxDate,chooseMode:d,baseMonthDate:f,hoveredISODate:null},a.id=st(),a._handleMount(),a}return r(i,z),n(i,[{key:"_handleMount",value:function(){var t=this.root,e=this.props.vertical,i=this.state.baseMonthDate;if(this.elsDate=null,this.elsMonth=null,this.elContent=g(this.selectors.content,t),this.elSelectedDisplay=g(this.selectors.selectedDisplay,t),this.elPrev=g(this.selectors.prevButton,t),this.elNext=g(this.selectors.nextButton,t),T(this.root,this.modifiers.vertical,this.props.vertical),this._renderMonths(i,e&&ot),e&&this.elsMonth){var n=[].slice.call(this.elsMonth,0,Math.max(at-this.movedBy,0));this.elContent.scrollTop=n.reduce(function(t,e){return t+e.clientHeight},0)}this.scrollTop=this.elContent.scrollTop}},{key:"_isDateDisabled",value:function(t){return M(t,this.modifiers.dateDisabled)}},{key:"_isMinMonth",value:function(t){var e=this.props.minDate,i=new Date(t);return i.setDate(i.getDate()-1),e>$(i)}},{key:"_isMaxMonth",value:function(t){var e=this.state.maxDate,i=Q(t,1);return e<$(i)}},{key:"_updateDateElements",value:function(t,e){var i=this,n=y(this.selectors.date,t||this.root);if(t&&this.elsDate){var a=[].slice.call(this.elsDate),o=[].slice.call(n);this.elsDate=e?[].concat(f(o),f(a)):[].concat(f(a),f(o))}else this.elsDate=n;this.elsMonth=y(this.selectors.month,this.root),n.forEach(function(t){t.addEventListener("mouseenter",i._handleDateMouseEnter.bind(i)),t.addEventListener("mouseleave",i._handleDateMouseLeave.bind(i))})}},{key:"_updateClassNames",value:function(){var t,e,i=this,n=this.state,a=n.startDate,o=n.endDate,s=n.hoveredISODate,r=n.chooseMode,l=n.minDate,u=n.maxDate,c=this.props,h=c.selectedDates,d=c.disabledDates;this.props.disableDateSelection||(this.elsDate.forEach(function(n,c){var f=n.getAttribute(i.attributes.date),v=a&&$(a),p=o&&$(o),m=f===v||f===p||!(!h||-1===h.indexOf(f)),b=f>v&&(fu||!!d&&-1!==d.indexOf(f),y=n.querySelector('[role="checkbox"]');y&&y.setAttribute("aria-checked",m),T(n,i.modifiers.dateSelected,m),T(n,i.modifiers.dateInRange,b),T(n,i.modifiers.dateDisabled,g),0===c&&(t=f),c===i.elsDate.length-1&&(e=f)}),T(this.elPrev,this.modifiers.controlHidden,t&&t<=l),T(this.elNext,this.modifiers.controlHidden,e&&e>=u))}},{key:"_updateDisplayRender",value:function(t){if(this.props.renderSelected&&!this.props.disableDateSelection){var e=this.state,i=e.startDate,n=e.endDate,a=e.chooseMode,o=t&&tt(t),s="start"===a&&o&&!i?o:i,r="end"===a&&o&&!n?o:n;this.elSelectedDisplay.innerHTML=this.props.renderSelected({startDate:s,endDate:r})}}},{key:"_getMonthsHTML",value:function(t){var e=this.props,i=e.vertical,n=e.firstWeekDay,a=e.selectedDates,o=e.disabledDates,s=e.dayNames,r=e.monthNames,l=e.getDayMarkup,u=this.state,c=u.minDate,h=u.maxDate;return nt({id:this.id,date:t,dayNames:s,monthNames:r,minDate:c,maxDate:h,firstWeekDay:n,showDayNames:!i,selectedDates:a,disabledDates:o,getDayMarkup:l})}},{key:"_updateVisual",value:function(t,e){this._updateClassNames(),("hover"!==t||this.props.renderOnHover)&&this._updateDisplayRender(e)}},{key:"_renderMonths",value:function(t,e){var i=this.props.vertical,n=e||this.props.monthsToShow,a=Z(this.props.dayNames,this.props.firstWeekDay),o="",s=Q(t,0);this.movedBy=0,i&&(o+=function(t){return'\n
\n \n \n '.concat(t.map(function(t){return'")}).join(""),"\n \n
'.concat(t,"
\n
\n ")}(a));for(var r=0;rn,o=!1;if(this.scrollTop=n,a){var s=this.elsDate[0].getAttribute(this.attributes.date);if(e=tt(s),this._isMinMonth(e))return;o=n<200}else{var r=this.elsDate[this.elsDate.length-1].getAttribute(this.attributes.date);if(e=tt(r),this._isMaxMonth(e))return;var l=n+this.elContent.clientHeight;o=this.elContent.scrollHeight-l<200}if(o)i=Q(e,a?-1:1),t=V(this._getMonthsHTML(i)),a?this.elContent.insertBefore(t,this.elsMonth[0]):this.elContent.appendChild(t),this._updateDateElements(t,a),this._updateClassNames(),a&&(this.elContent.scrollTop=200+this.elsMonth[0].clientHeight)}}},{key:"_handleDateClick",value:function(t){var e=t.delegateTarget;if(t.preventDefault(),!this._isDateDisabled(e)){var i=this.props,n=i.onDateChange,a=i.allowSameDateSelection,o=i.disableDateSelection,s=e.getAttribute(this.attributes.date),r=tt(s);if(!o){var l=this.state,u=l.chooseMode,c=l.startDate,h=c&&$(c),d={};if(s===h&&!a)return;"start"===u?(d.startDate=r,d.endDate=null):"end"===u&&s