Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blueprintjs/datetime

Package Overview
Dependencies
Maintainers
1
Versions
257
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blueprintjs/datetime - npm Package Compare versions

Comparing version 2.0.0-rc.3 to 2.0.0-rc.4

2

dist/datetime.bundle.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("classNames"),require("DayPicker")):"function"==typeof define&&define.amd?define(["React","classNames","DayPicker"],t):"object"==typeof exports?exports.Datetime=t(require("React"),require("classNames"),require("DayPicker")):(e.Blueprint=e.Blueprint||{},e.Blueprint.Datetime=t(e.React,e.classNames,e.DayPicker))}("undefined"!=typeof self?self:this,function(e,t,n){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(t,n){t.exports=e},function(e,t){e.exports=Blueprint.Core},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){e.exports=n(5)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={};n.d(a,"DATEPICKER",function(){return s}),n.d(a,"DATEPICKER_CAPTION",function(){return i}),n.d(a,"DATEPICKER_CAPTION_CARET",function(){return l}),n.d(a,"DATEPICKER_CAPTION_SELECT",function(){return u}),n.d(a,"DATEPICKER_DAY",function(){return p}),n.d(a,"DATEPICKER_DAY_DISABLED",function(){return c}),n.d(a,"DATEPICKER_DAY_OUTSIDE",function(){return d}),n.d(a,"DATEPICKER_DAY_SELECTED",function(){return h}),n.d(a,"DATEPICKER_FOOTER",function(){return f}),n.d(a,"DATEPICKER_MONTH_SELECT",function(){return g}),n.d(a,"DATEPICKER_YEAR_SELECT",function(){return v}),n.d(a,"DATERANGEPICKER",function(){return m}),n.d(a,"DATERANGEPICKER_CONTIGUOUS",function(){return D}),n.d(a,"DATERANGEPICKER_SINGLE_MONTH",function(){return y}),n.d(a,"DATERANGEPICKER_DAY_SELECTED_RANGE",function(){return S}),n.d(a,"DATERANGEPICKER_DAY_HOVERED_RANGE",function(){return I}),n.d(a,"DATERANGEPICKER_SHORTCUTS",function(){return M}),n.d(a,"DATETIMEPICKER",function(){return E}),n.d(a,"TIMEPICKER",function(){return C}),n.d(a,"TIMEPICKER_ARROW_BUTTON",function(){return P}),n.d(a,"TIMEPICKER_ARROW_ROW",function(){return R}),n.d(a,"TIMEPICKER_DIVIDER_TEXT",function(){return k}),n.d(a,"TIMEPICKER_HOUR",function(){return T}),n.d(a,"TIMEPICKER_INPUT",function(){return F}),n.d(a,"TIMEPICKER_INPUT_ROW",function(){return w}),n.d(a,"TIMEPICKER_MILLISECOND",function(){return N}),n.d(a,"TIMEPICKER_MINUTE",function(){return A}),n.d(a,"TIMEPICKER_SECOND",function(){return O});var r,o,s="pt-datepicker",i="pt-datepicker-caption",l="pt-datepicker-caption-caret",u="pt-datepicker-caption-select",p="DayPicker-Day",c="DayPicker-Day--disabled",d="DayPicker-Day--outside",h="DayPicker-Day--selected",f="pt-datepicker-footer",g="pt-datepicker-month-select",v="pt-datepicker-year-select",m="pt-daterangepicker",D="pt-daterangepicker-contiguous",y="pt-daterangepicker-single-month",S="DayPicker-Day--selected-range",I="DayPicker-Day--hovered-range",M="pt-daterangepicker-shortcuts",E="pt-datetimepicker",C="pt-timepicker",P="pt-timepicker-arrow-button",R="pt-timepicker-arrow-row",k="pt-timepicker-divider-text",T="pt-timepicker-hour",F="pt-timepicker-input",w="pt-timepicker-input-row",N="pt-timepicker-millisecond",A="pt-timepicker-minute",O="pt-timepicker-second";function b(e){return e instanceof Date&&!isNaN(e.valueOf())}function x(e,t){return null!=e&&null!=t&&e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}function V(e,t){return null!=e&&null!=t&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}function U(e,t){return null!=e&&null!=t&&e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes()&&e.getSeconds()===t.getSeconds()&&e.getMilliseconds()===t.getMilliseconds()}function B(e){return new Date(e.getTime())}function Y(e,t,n){if(void 0===n&&(n=!1),null==e)return!1;var a=B(e),r=B(t[0]),o=B(t[1]);return a.setHours(0,0,0,0),r.setHours(0,0,0,0),o.setHours(0,0,0,0),r<=a&&a<=o&&(!n||!x(r,a)&&!x(a,o))}function H(e,t){return(null==e[0]||Y(e[0],t))&&(null==e[1]||Y(e[1],t))}function K(e,t){if(null==e)return!1;var n=B(e),a=B(t[0]),r=B(t[1]);return n.setDate(1),a.setDate(1),r.setDate(1),n.setHours(0,0,0,0),a.setHours(0,0,0,0),r.setHours(0,0,0,0),a<=n&&n<=r}(o=r||(r={})).START="start",o.END="end";var _=function(e,t){return e.getTime()>=t.getTime()},L=function(e,t){return e.getTime()<=t.getTime()};function W(e,t,n){var a=$(e),r=$(t),o=$(n),s=_(a,r),i=L(a,o);return L(o,r)?s||i:s&&i}function G(e,t,n){return U(t,n)?n:W(e,t,n)?e:(a=n,r=$(e),o=$(a),_(r,o)?n:t);var a,r,o}function j(e){var t=e[0].getTime(),n=e[1].getTime();return new Date(t+.5*(n-t))}function q(e,t){return null===e?null:null===t?new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0):new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}function $(e){return new Date(0,0,0,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function X(e){return 0===e.getMonth()?new Date(e.getFullYear()-1,11):new Date(e.getFullYear(),e.getMonth()-1)}function z(e){return 11===e.getMonth()?new Date(e.getFullYear()+1,0):new Date(e.getFullYear(),e.getMonth()+1)}var J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function Q(e,t){function n(){this.constructor=e}J(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Z=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};var ee=n(2),te=n.n(ee),ne=n(0),ae=n(1);function re(e,t,n){return void 0===n&&(n=!1),null==e?"":b(e)?n||Y(e,[t.minDate,t.maxDate])?t.formatDate(e,t.locale):t.outOfRangeMessage:t.invalidDateMessage}var oe=n(3),se=n.n(oe),ie="[Blueprint]",le=ie+" <DatePicker> defaultValue must be within minDate and maxDate bounds.",ue=ie+" <DatePicker> initialMonth must be within minDate and maxDate bounds.",pe=ie+" <DatePicker> maxDate must be later than minDate.",ce=ie+" <DatePicker> value prop must be within minDate and maxDate bounds.",de=le.replace("DatePicker","DateRangePicker"),he=ue.replace("DatePicker","DateRangePicker"),fe=pe.replace("DatePicker","DateRangePicker"),ge=ce.replace("DatePicker","DateRangePicker");function ve(e,t){return e.length<t?""+(n="0",a=t-e.length,new Array(a+1).join(n))+e:e;var n,a}var me=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={monthWidth:0},t.containerRefHandler=function(e){return t.containerElement=e},t.handleMonthSelectChange=function(e){var n=parseInt(e.target.value,10);ae.Utils.safeInvoke(t.props.onMonthChange,n)},t.handleYearSelectChange=function(e){var n=parseInt(e.target.value,10);ae.Utils.safeInvoke(t.props.onYearChange,n)},t}return Q(t,e),t.prototype.render=function(){for(var e=this.props,t=e.date,n=e.locale,a=e.localeUtils,r=e.minDate,o=e.maxDate,s=r.getFullYear(),p=o.getFullYear(),c=t.getMonth(),d=t.getFullYear(),h=a.getMonths(n),f=d===s?r.getMonth():0,m=d===p?o.getMonth()+1:void 0,D=h.map(function(e,t){return ne.createElement("option",{key:t,value:t.toString()},e)}).slice(f,m),y=[s],S=s+1;S<=p;++S)y.push(S);var I=y.map(function(e,t){return ne.createElement("option",{key:t,value:e.toString()},e)});d>p&&I.push(ne.createElement("option",{key:"next",disabled:!0,value:d.toString()},d)),this.displayedMonthText=h[c];var M=ne.createElement("div",{className:u,key:"month"},ne.createElement("select",{className:g,onChange:this.handleMonthSelectChange,value:c.toString()},D),ne.createElement(ae.Icon,{className:l,icon:"caret-down",style:{left:this.state.monthWidth}})),E=ne.createElement("div",{className:u,key:"year"},ne.createElement("select",{className:v,onChange:this.handleYearSelectChange,value:d.toString()},I),ne.createElement(ae.Icon,{className:l,icon:"caret-down"})),C=this.props.reverseMonthAndYearMenus?[E,M]:[M,E];return ne.createElement("div",{className:i,ref:this.containerRefHandler},C)},t.prototype.componentDidMount=function(){var e=this;requestAnimationFrame(function(){return e.positionArrows()})},t.prototype.componentDidUpdate=function(){this.positionArrows()},t.prototype.positionArrows=function(){var e=function(e,t,n){if(void 0===t&&(t=""),void 0===n&&(n=document.body),null==n)return 0;var a=document.createElement("span");a.classList.add(t),a.textContent=e,n.appendChild(a);var r=a.offsetWidth;return a.remove(),r}(this.displayedMonthText,"pt-datepicker-caption-measure",this.containerElement);this.setState({monthWidth:e})},t}(ne.PureComponent),De="hovered-range",ye="selected-range",Se=["disabled",De,"outside","selected",ye];function Ie(){var e=new Date;return e.setFullYear(e.getFullYear()),e.setMonth(11,31),e}function Me(){var e=new Date;return e.setFullYear(e.getFullYear()-20),e.setMonth(0,1),e}var Ee,Ce,Pe=function(e){function t(t,n){var a=e.call(this,t,n)||this;a.ignoreNextMonthChange=!1,a.disabledDays=function(e){return!Y(e,[a.props.minDate,a.props.maxDate])},a.getDisabledDaysModifier=function(){var e=a.props.dayPickerProps.disabledDays;return Array.isArray(e)?[a.disabledDays].concat(e):[a.disabledDays,e]},a.renderCaption=function(e){return ne.createElement(me,Z({},e,{maxDate:a.props.maxDate,minDate:a.props.minDate,onMonthChange:a.handleMonthSelectChange,onYearChange:a.handleYearSelectChange,reverseMonthAndYearMenus:a.props.reverseMonthAndYearMenus}))},a.handleDayClick=function(e,t,n){ae.Utils.safeInvoke(a.props.dayPickerProps.onDayClick,e,t,n);var r=e;if(a.props.canClearSelection&&t.selected&&(r=null),void 0===a.props.value&&!t.disabled){var o=e.getMonth(),s=e.getFullYear(),i=e.getDate();a.setState({displayMonth:o,displayYear:s,selectedDay:i,value:r})}t.disabled?a.forceUpdate():(ae.Utils.safeInvoke(a.props.onChange,r,!0),null!=a.state.value&&a.state.value.getMonth()!==e.getMonth()&&(a.ignoreNextMonthChange=!0))},a.handleMonthChange=function(e){var t=e.getMonth(),n=e.getFullYear(),r=a.state.value;null!==r&&(r=a.computeValidDateInSpecifiedMonthYear(n,t),a.ignoreNextMonthChange?a.ignoreNextMonthChange=!1:ae.Utils.safeInvoke(a.props.onChange,r,!1)),ae.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,r),a.setStateWithValueIfUncontrolled({displayMonth:t,displayYear:n},r)},a.handleMonthSelectChange=function(e){var t=a.state.value;null!==t&&(t=a.computeValidDateInSpecifiedMonthYear(t.getFullYear(),e),ae.Utils.safeInvoke(a.props.onChange,t,!1)),ae.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t),a.setStateWithValueIfUncontrolled({displayMonth:e},t)},a.handleYearSelectChange=function(e){var t=a.state,n=t.displayMonth,r=t.value;if(null!==r)r=a.computeValidDateInSpecifiedMonthYear(e,n),ae.Utils.safeInvoke(a.props.onChange,r,!1),n=r.getMonth();else{var o=a.props,s=o.minDate,i=o.maxDate,l=s.getFullYear(),u=i.getFullYear(),p=s.getMonth(),c=i.getMonth();e===l&&n<p?n=p:e===u&&n>c&&(n=c)}ae.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,r),a.setStateWithValueIfUncontrolled({displayMonth:n,displayYear:e},r)},a.handleClearClick=function(){void 0===a.props.value&&a.setState({value:null}),ae.Utils.safeInvoke(a.props.onChange,null,!0)},a.handleTodayClick=function(){var e=new Date,t=e.getMonth(),n=e.getFullYear(),r=e.getDate();void 0===a.props.value?a.setState({displayMonth:t,displayYear:n,selectedDay:r,value:e}):a.setState({displayMonth:t,displayYear:n,selectedDay:r}),ae.Utils.safeInvoke(a.props.onChange,e,!0)};var r,o,s=null;void 0!==t.value?s=t.value:null!=t.defaultValue&&(s=t.defaultValue),null!==s&&(r=s.getDate());var i=new Date;return o=null!=t.initialMonth?t.initialMonth:null!=s?s:Y(i,[t.minDate,t.maxDate])?i:j([t.minDate,t.maxDate]),a.state={displayMonth:o.getMonth(),displayYear:o.getFullYear(),selectedDay:r,value:s},a}return Q(t,e),t.prototype.render=function(){var e=this.props,t=e.className,n=e.dayPickerProps,a=e.locale,r=e.localeUtils,o=e.maxDate,i=e.minDate,l=e.modifiers,u=e.showActionsBar,p=this.state,c=p.displayMonth,d=p.displayYear;return ne.createElement("div",{className:te()(s,t)},ne.createElement(se.a,Z({showOutsideDays:!0,locale:a,localeUtils:r,modifiers:l},n,{canChangeMonth:!0,captionElement:this.renderCaption,disabledDays:this.getDisabledDaysModifier(),fromMonth:i,month:new Date(d,c),onDayClick:this.handleDayClick,onMonthChange:this.handleMonthChange,selectedDays:this.state.value,toMonth:o})),u?this.renderOptionsBar():null)},t.prototype.componentWillReceiveProps=function(t){if(t.value!==this.props.value){var n=this.state,a=n.displayMonth,r=n.displayYear,o=n.selectedDay;null!=t.value&&(a=t.value.getMonth(),r=t.value.getFullYear(),o=t.value.getDate()),this.setState({displayMonth:a,displayYear:r,selectedDay:o,value:t.value})}e.prototype.componentWillReceiveProps.call(this,t)},t.prototype.validateProps=function(e){var t=e.defaultValue,n=e.initialMonth,a=e.maxDate,r=e.minDate,o=e.value;if(null!=t&&!Y(t,[r,a]))throw new Error(le);if(null!=n&&!K(n,[r,a]))throw new Error(ue);if(null!=a&&null!=r&&a<r&&!x(a,r))throw new Error(pe);if(null!=o&&!Y(o,[r,a]))throw new Error(ce)},t.prototype.renderOptionsBar=function(){return ne.createElement("div",{className:f},ne.createElement(ae.Button,{className:"pt-minimal pt-datepicker-footer-button",onClick:this.handleTodayClick,text:"Today"}),ne.createElement(ae.Button,{className:"pt-minimal pt-datepicker-footer-button",onClick:this.handleClearClick,text:"Clear"}))},t.prototype.computeValidDateInSpecifiedMonthYear=function(e,t){var n=this.props,a=n.minDate,r=n.maxDate,o=new Date(e,t+1,0).getDate(),s=this.state.selectedDay;s>o&&(s=o);var i=new Date(e,t,s,12);return i<a?i=a:i>r&&(i=r),i},t.prototype.setStateWithValueIfUncontrolled=function(e,t){return void 0===this.props.value&&(e.value=t),this.setState(e)},t.defaultProps={canClearSelection:!0,dayPickerProps:{},maxDate:Ie(),minDate:Me(),reverseMonthAndYearMenus:!1,showActionsBar:!1},t.displayName="Blueprint2.DatePicker",t}(ae.AbstractPureComponent);function Re(e){return Ye[e].max}function ke(e){return Ye[e].min}(Ce=Ee||(Ee={})).HOUR="hour",Ce.MINUTE="minute",Ce.SECOND="second",Ce.MS="ms";var Te,Fe,we,Ne=0,Ae=0,Oe=0,be=0,xe=23,Ve=59,Ue=59,Be=999,Ye=((Te={})[Ee.HOUR]={className:T,max:xe,min:Ne},Te[Ee.MINUTE]={className:A,max:Ve,min:Ae},Te[Ee.SECOND]={className:O,max:Ue,min:Oe},Te[Ee.MS]={className:N,max:Be,min:be},Te);(we=Fe||(Fe={}))[we.MINUTE=0]="MINUTE",we[we.SECOND=1]="SECOND",we[we.MILLISECOND=2]="MILLISECOND";var He=function(e){function t(t,n){var a=e.call(this,t,n)||this;return a.getInputBlurHandler=function(e){return function(t){var n=_e(t);a.updateTime(parseInt(n,10),e)}},a.getInputChangeHandler=function(e){return function(t){var n=_e(t),r=!1;switch(e){case Ee.HOUR:case Ee.MINUTE:case Ee.SECOND:r=/^\d{0,2}$/.test(n);break;case Ee.MS:r=/^\d{0,3}$/.test(n);break;default:throw Error("Invalid TimeUnit")}if(r)switch(e){case Ee.HOUR:a.updateState({hourText:n});break;case Ee.MINUTE:a.updateState({minuteText:n});break;case Ee.SECOND:a.updateState({secondText:n});break;case Ee.MS:a.updateState({millisecondText:n});break;default:throw Error("Invalid TimeUnit")}}},a.getInputKeyDownHandler=function(e){return function(t){var n;!function(e,t,n){void 0===n&&(n=!0);for(var a=0,r=Object.keys(t);a<r.length;a++){var o=r[a],s=Number(o);e.which===s&&(n&&e.preventDefault(),t[s]())}}(t,(n={},n[ae.Keys.ARROW_UP]=function(){return a.incrementTime(e)},n[ae.Keys.ARROW_DOWN]=function(){return a.decrementTime(e)},n[ae.Keys.ENTER]=function(){t.currentTarget.blur()},n))}},a.handleFocus=function(e){a.props.selectAllOnFocus&&e.currentTarget.select()},a.incrementTime=function(e){return a.shiftTime(e,1)},a.decrementTime=function(e){return a.shiftTime(e,-1)},null!=t.value?a.state=a.getFullStateFromValue(t.value):null!=t.defaultValue?a.state=a.getFullStateFromValue(t.defaultValue):a.state=a.getFullStateFromValue(t.minTime),a}return Q(t,e),t.prototype.render=function(){var e,t=this.props.precision>=Fe.SECOND,n=this.props.precision>=Fe.MILLISECOND,a=te()(C,this.props.className,((e={})[ae.Classes.DISABLED]=this.props.disabled,e));return ne.createElement("div",{className:a},ne.createElement("div",{className:R},this.maybeRenderArrowButton(!0,Ee.HOUR),this.maybeRenderArrowButton(!0,Ee.MINUTE),t&&this.maybeRenderArrowButton(!0,Ee.SECOND),n&&this.maybeRenderArrowButton(!0,Ee.MS)),ne.createElement("div",{className:w},this.renderInput(T,Ee.HOUR,this.state.hourText),this.renderDivider(),this.renderInput(A,Ee.MINUTE,this.state.minuteText),t&&this.renderDivider(),t&&this.renderInput(O,Ee.SECOND,this.state.secondText),n&&this.renderDivider("."),n&&this.renderInput(N,Ee.MS,this.state.millisecondText)),ne.createElement("div",{className:R},this.maybeRenderArrowButton(!1,Ee.HOUR),this.maybeRenderArrowButton(!1,Ee.MINUTE),t&&this.maybeRenderArrowButton(!1,Ee.SECOND),n&&this.maybeRenderArrowButton(!1,Ee.MS)))},t.prototype.componentWillReceiveProps=function(e){var t=e.minTime!==this.props.minTime,n=e.maxTime!==this.props.maxTime;if(t||n){var a=G(this.state.value,e.minTime,e.maxTime);this.setState(this.getFullStateFromValue(a))}null==e.value||U(e.value,this.props.value)||this.setState(this.getFullStateFromValue(e.value))},t.prototype.maybeRenderArrowButton=function(e,t){var n=this;if(!this.props.showArrowButtons)return null;var a=te()(P,Ye[t].className);return ne.createElement("span",{className:a,onClick:function(){return(e?n.incrementTime:n.decrementTime)(t)}},ne.createElement(ae.Icon,{icon:e?"chevron-up":"chevron-down"}))},t.prototype.renderDivider=function(e){return void 0===e&&(e=":"),ne.createElement("span",{className:k},e)},t.prototype.renderInput=function(e,t,n){return ne.createElement("input",{className:te()(F,e),onBlur:this.getInputBlurHandler(t),onChange:this.getInputChangeHandler(t),onFocus:this.handleFocus,onKeyDown:this.getInputKeyDownHandler(t),value:n,disabled:this.props.disabled})},t.prototype.getFullStateFromValue=function(e){var t=G(e,this.props.minTime,this.props.maxTime);return{hourText:Ke(t.getHours(),Ee.HOUR),minuteText:Ke(t.getMinutes(),Ee.MINUTE),secondText:Ke(t.getSeconds(),Ee.SECOND),millisecondText:Ke(t.getMilliseconds(),Ee.MS),value:t}},t.prototype.shiftTime=function(e,t){if(!this.props.disabled){var n,a,r,o,s=function(e,t){switch(e){case Ee.HOUR:return t.getHours();case Ee.MINUTE:return t.getMinutes();case Ee.SECOND:return t.getSeconds();case Ee.MS:return t.getMilliseconds();default:throw Error("Invalid TimeUnit")}}(e,this.state.value)+t;this.updateTime((a=s,r=Re(n=e),o=ke(n),a>r?o:a<o?r:a),e)}},t.prototype.updateTime=function(e,t){var n,a,r=B(this.state.value);n=t,null!=(a=e)&&!isNaN(a)&&ke(n)<=a&&a<=Re(n)?(!function(e,t,n){switch(e){case Ee.HOUR:n.setHours(t);break;case Ee.MINUTE:n.setMinutes(t);break;case Ee.SECOND:n.setSeconds(t);break;case Ee.MS:n.setMilliseconds(t);break;default:throw Error("Invalid TimeUnit")}}(t,e,r),W(r,this.props.minTime,this.props.maxTime)?this.updateState({value:r}):U(this.state.value,this.props.minTime)||this.updateState(this.getFullStateFromValue(r))):this.updateState(this.getFullStateFromValue(this.state.value))},t.prototype.updateState=function(e){var t=e,n=null!=t.value&&!U(t.value,this.state.value);null==this.props.value?(n&&(t=this.getFullStateFromValue(t.value)),this.setState(t)):n?this.setState(this.getFullStateFromValue(this.state.value)):this.setState(Z({},t,{value:B(this.state.value)})),n&&ae.Utils.safeInvoke(this.props.onChange,t.value)},t.defaultProps={disabled:!1,maxTime:new Date(0,0,0,xe,Ve,Ue,Be),minTime:new Date(0,0,0,Ne,Ae,Oe,be),precision:Fe.MINUTE,selectAllOnFocus:!1,showArrowButtons:!1},t.displayName="Blueprint2.TimePicker",t}(ne.Component);function Ke(e,t){switch(t){case Ee.HOUR:return e.toString();case Ee.MINUTE:case Ee.SECOND:return ve(e.toString(),2);case Ee.MS:return ve(e.toString(),3);default:throw Error("Invalid TimeUnit")}}function _e(e){return e.currentTarget.value}var Le=function(e){function t(t,n){var a=e.call(this,t,n)||this;a.handleDateChange=function(e,t){void 0===a.props.value&&a.setState({dateValue:e});var n=q(e,a.state.timeValue);ae.Utils.safeInvoke(a.props.onChange,n,t)},a.handleTimeChange=function(e){void 0===a.props.value&&a.setState({timeValue:e});var t=q(a.state.dateValue,e);ae.Utils.safeInvoke(a.props.onChange,t,!0)};var r=void 0!==a.props.value?a.props.value:a.props.defaultValue;return a.state={dateValue:r,timeValue:r},a}return Q(t,e),t.prototype.render=function(){var e=q(this.state.dateValue,this.state.timeValue);return ne.createElement("div",{className:te()(E,this.props.className)},ne.createElement(Pe,Z({},this.props.datePickerProps,{canClearSelection:this.props.canClearSelection,onChange:this.handleDateChange,value:e})),ne.createElement(He,Z({},this.props.timePickerProps,{onChange:this.handleTimeChange,value:e})))},t.prototype.componentWillReceiveProps=function(e){this.props.value!==e.value&&(null!=e.value?this.setState({dateValue:e.value,timeValue:e.value}):this.setState({dateValue:null}))},t.defaultProps={canClearSelection:!0,defaultValue:new Date},t.displayName="Blueprint2.DateTimePicker",t}(ae.AbstractPureComponent),We=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isInputFocused:!1,isOpen:!1,value:void 0!==t.props.value?t.props.value:t.props.defaultValue,valueString:null},t.inputEl=null,t.popoverContentEl=null,t.lastElementInPopover=null,t.refHandlers={input:function(e){t.inputEl=e},popoverContent:function(e){t.popoverContentEl=e}},t.handleClosePopover=function(e){var n=t.props.popoverProps,a=void 0===n?{}:n;ae.Utils.safeInvoke(a.onClose,e),t.setState({isOpen:!1})},t.handleDateChange=function(e,n,a){void 0===a&&(a=!1);var r=t.state.value,o=!n||!t.props.closeOnSelection||null!=r&&(t.hasMonthChanged(r,e)||t.hasTimeChanged(r,e)),s=!!a;if(void 0===t.props.value){var i=re(e,t.props);t.setState({isInputFocused:s,isOpen:o,value:e,valueString:i})}else t.setState({isInputFocused:s,isOpen:o});ae.Utils.safeInvoke(t.props.onChange,e)},t.handleInputFocus=function(e){var n=null==t.state.value?"":t.formatDate(t.state.value);t.setState({isInputFocused:!0,isOpen:!0,valueString:n}),t.safeInvokeInputProp("onFocus",e)},t.handleInputClick=function(e){e.stopPropagation(),t.safeInvokeInputProp("onClick",e)},t.handleInputChange=function(e){var n=e.target.value,a=t.parseDate(n);b(a)&&t.isDateInRange(a)?(void 0===t.props.value?t.setState({value:a,valueString:n}):t.setState({valueString:n}),ae.Utils.safeInvoke(t.props.onChange,a)):(0===n.length&&ae.Utils.safeInvoke(t.props.onChange,null),t.setState({valueString:n})),t.safeInvokeInputProp("onChange",e)},t.handleInputBlur=function(e){var n=t.state.valueString,a=t.parseDate(n);!(n.length>0&&n!==re(t.state.value,t.props))||b(a)&&t.isDateInRange(a)?0===n.length?t.setState({isInputFocused:!1,value:null,valueString:null}):t.setState({isInputFocused:!1}):(void 0===t.props.value?t.setState({isInputFocused:!1,value:a,valueString:null}):t.setState({isInputFocused:!1}),isNaN(a.valueOf())?ae.Utils.safeInvoke(t.props.onError,new Date(void 0)):t.isDateInRange(a)?ae.Utils.safeInvoke(t.props.onChange,a):ae.Utils.safeInvoke(t.props.onError,a)),t.registerPopoverBlurHandler(),t.safeInvokeInputProp("onBlur",e)},t.handleInputKeyDown=function(e){if(e.which===ae.Keys.ENTER){var n=t.parseDate(t.state.valueString);t.handleDateChange(n,!0,!0)}else e.which===ae.Keys.TAB&&e.shiftKey?t.setState({isOpen:!1}):e.which===ae.Keys.ESCAPE&&(t.setState({isOpen:!1}),t.inputEl.blur());t.safeInvokeInputProp("onKeyDown",e)},t.handlePopoverBlur=function(e){var n=e.relatedTarget;null!=n&&t.popoverContentEl.contains(n)?null!=n&&(t.unregisterPopoverBlurHandler(),t.lastElementInPopover=n,t.lastElementInPopover.addEventListener("blur",t.handlePopoverBlur)):t.handleClosePopover()},t.registerPopoverBlurHandler=function(){if(null!=t.popoverContentEl){var e=t.popoverContentEl.contains(document.activeElement)?document.activeElement:void 0;if(null==e){var n=t.popoverContentEl.querySelectorAll("input, [tabindex]:not([tabindex='-1'])"),a=n.length;a>0&&(e=n[a-1])}t.unregisterPopoverBlurHandler(),t.lastElementInPopover=e,t.lastElementInPopover.addEventListener("blur",t.handlePopoverBlur)}},t.unregisterPopoverBlurHandler=function(){null!=t.lastElementInPopover&&t.lastElementInPopover.removeEventListener("blur",t.handlePopoverBlur)},t}return Q(t,e),t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this),this.unregisterPopoverBlurHandler()},t.prototype.render=function(){var e=this,t=this.state,n=t.value,a=t.valueString,r=this.state.isInputFocused?a:re(n,this.props),o=b(n)?n:null,s=Z({},this.props.dayPickerProps,{onMonthChange:function(t){ae.Utils.safeInvoke(e.props.dayPickerProps.onMonthChange,t),e.setTimeout(e.registerPopoverBlurHandler)}}),i=void 0===this.props.timePrecision?ne.createElement(Pe,Z({},this.props,{dayPickerProps:s,onChange:this.handleDateChange,value:o})):ne.createElement(Le,{canClearSelection:this.props.canClearSelection,onChange:this.handleDateChange,value:n,datePickerProps:this.props,timePickerProps:Z({},this.props.timePickerProps,{precision:this.props.timePrecision})}),l=ne.createElement("div",{ref:this.refHandlers.popoverContent},i),u=this.props.popoverProps,p=void 0===u?{}:u,c=this.getInputPropsWithDefaults(),d=!(null==n||b(n)&&this.isDateInRange(n));return ne.createElement(ae.Popover,Z({isOpen:this.state.isOpen&&!this.props.disabled,usePortal:!1},p,{autoFocus:!1,className:te()(p.className,this.props.className),content:l,enforceFocus:!1,onClose:this.handleClosePopover,popoverClassName:te()("pt-dateinput-popover",p.popoverClassName)}),ne.createElement(ae.InputGroup,Z({autoComplete:"off",intent:d?ae.Intent.DANGER:ae.Intent.NONE,placeholder:this.props.placeholder,rightElement:this.props.rightElement},c,{disabled:this.props.disabled,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onClick:this.handleInputClick,onFocus:this.handleInputFocus,onKeyDown:this.handleInputKeyDown,type:"text",value:r})))},t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),t.value!==this.props.value&&this.setState({value:t.value})},t.prototype.getInputPropsWithDefaults=function(){var e=this,t=this.props.inputProps,n=void 0===t?{}:t;return ae.Utils.isFunction(n.inputRef)?Z({},n,{inputRef:function(t){e.refHandlers.input(t),n.inputRef(t)}}):Z({},n,{inputRef:this.refHandlers.input})},t.prototype.isDateInRange=function(e){return Y(e,[this.props.minDate,this.props.maxDate])},t.prototype.hasMonthChanged=function(e,t){return null==e!=(null==t)||t.getMonth()!==e.getMonth()},t.prototype.hasTimeChanged=function(e,t){return null!=this.props.timePrecision&&(null==e!=(null==t)||t.getHours()!==e.getHours()||t.getMinutes()!==e.getMinutes()||t.getSeconds()!==e.getSeconds()||t.getMilliseconds()!==e.getMilliseconds())},t.prototype.safeInvokeInputProp=function(e,t){var n=this.props.inputProps,a=void 0===n?{}:n;ae.Utils.safeInvoke(a[e],t)},t.prototype.parseDate=function(e){if(e===this.props.outOfRangeMessage||e===this.props.invalidDateMessage)return null;var t=this.props,n=t.locale,a=(0,t.parseDate)(e,n);return!1===a?new Date(void 0):a},t.prototype.formatDate=function(e){if(!b(e)||!this.isDateInRange(e))return"";var t=this.props,n=t.locale;return(0,t.formatDate)(e,n)},t.displayName="Blueprint2.DateInput",t.defaultProps={closeOnSelection:!0,dayPickerProps:{},disabled:!1,invalidDateMessage:"Invalid date",maxDate:Ie(),minDate:Me(),outOfRangeMessage:"Out of range",reverseMonthAndYearMenus:!1,timePickerProps:{}},t}(ae.AbstractPureComponent),Ge=function(){function e(e,t){this.date=null!==e&&null!==t?new Date(t,e):new Date}return e.fromDate=function(t){return null==t?void 0:new e(t.getMonth(),t.getFullYear())},e.prototype.clone=function(){return new e(this.getMonth(),this.getYear())},e.prototype.getFullDate=function(){return this.date},e.prototype.getMonth=function(){return this.date.getMonth()},e.prototype.getYear=function(){return this.date.getFullYear()},e.prototype.getPreviousMonth=function(){var t=X(this.date);return new e(t.getMonth(),t.getFullYear())},e.prototype.getNextMonth=function(){var t=z(this.date);return new e(t.getMonth(),t.getFullYear())},e.prototype.isBefore=function(e){return je(this,e)<0},e.prototype.isAfter=function(e){return je(this,e)>0},e.prototype.isSame=function(e){return 0===je(this,e)},e}();function je(e,t){var n=e.getMonth(),a=e.getYear(),r=t.getMonth(),o=t.getYear();return a===o?n-r:a-o}var qe=function(){function e(){}return e.getNextState=function(e,t,n,a){return null!=a?this.getNextStateForBoundary(e,t,n,a):this.getDefaultNextState(e,t,n)},e.getNextStateForBoundary=function(e,t,n,a){var r,o,s=this.getBoundaryDate(a,e),i=this.getOtherBoundary(a),l=this.getBoundaryDate(i,e);if(null==s&&null==l)r=a,o=this.createRangeForBoundary(a,t,null);else if(null!=s&&null==l){var u=x(s,t)?null:t;r=a,o=this.createRangeForBoundary(a,u,null)}else if(null==s&&null!=l)if(x(t,l)){var p=void 0;n?(r=a,p=l):(r=i,p=null),o=this.createRangeForBoundary(a,p,p)}else this.isOverlappingOtherBoundary(a,t,l)?(r=i,o=this.createRangeForBoundary(a,l,t)):(r=a,o=this.createRangeForBoundary(a,t,l));else if(x(s,t)){var c=x(s,l)?null:l;r=a,o=this.createRangeForBoundary(a,null,c)}else if(x(t,l)){var d=n?[l,l]:[s,null];u=d[0],c=d[1];r=n?a:i,o=this.createRangeForBoundary(a,u,c)}else this.isOverlappingOtherBoundary(a,t,l)?(r=a,o=this.createRangeForBoundary(a,t,null)):(r=a,o=this.createRangeForBoundary(a,t,l));return{dateRange:o,boundary:r}},e.getDefaultNextState=function(e,t,n){var a,r=e[0],o=e[1];if(null==r&&null==o)a=[t,null];else if(null!=r&&null==o)a=this.createRange(t,r,n);else if(null==r&&null!=o)a=this.createRange(t,o,n);else{var s=x(r,t),i=x(o,t);a=s&&i?[null,null]:s?[null,o]:i?[r,null]:[t,null]}return{dateRange:a}},e.getOtherBoundary=function(e){return e===r.START?r.END:r.START},e.getBoundaryDate=function(e,t){return e===r.START?t[0]:t[1]},e.isOverlappingOtherBoundary=function(e,t,n){return e===r.START?t>n:t<n},e.createRangeForBoundary=function(e,t,n){return e===r.START?[t,n]:[n,t]},e.createRange=function(e,t,n){return!n&&x(e,t)?[null,null]:e<t?[e,t]:[t,e]},e}(),$e=r,Xe=function(e){function t(t,n){var a=e.call(this,t,n)||this;a.modifiers=((u={})[ye]=function(e){var t=a.state.value;return null!=t[0]&&null!=t[1]&&Y(e,t,!0)},u[ye+"-start"]=function(e){return x(a.state.value[0],e)},u[ye+"-end"]=function(e){return x(a.state.value[1],e)},u[De]=function(e){var t=a.state,n=t.hoverValue,r=t.value,o=r[0],s=r[1];return(null!=o||null!=s)&&(null!=n&&null!=n[0]&&null!=n[1]&&Y(e,n,!0))},u[De+"-start"]=function(e){var t=a.state.hoverValue;return null!=t&&null!=t[0]&&x(t[0],e)},u[De+"-end"]=function(e){var t=a.state.hoverValue;return null!=t&&null!=t[1]&&x(t[1],e)},u),a.disabledDays=function(e){return!Y(e,[a.props.minDate,a.props.maxDate])},a.getDisabledDaysModifier=function(){var e=a.props.dayPickerProps.disabledDays;return e instanceof Array?[a.disabledDays].concat(e):[a.disabledDays,e]},a.renderSingleCaption=function(e){return ne.createElement(me,Z({},e,{maxDate:a.props.maxDate,minDate:a.props.minDate,onMonthChange:a.handleLeftMonthSelectChange,onYearChange:a.handleLeftYearSelectChange,reverseMonthAndYearMenus:a.props.reverseMonthAndYearMenus}))},a.renderLeftCaption=function(e){return ne.createElement(me,Z({},e,{maxDate:X(a.props.maxDate),minDate:a.props.minDate,onMonthChange:a.handleLeftMonthSelectChange,onYearChange:a.handleLeftYearSelectChange,reverseMonthAndYearMenus:a.props.reverseMonthAndYearMenus}))},a.renderRightCaption=function(e){return ne.createElement(me,Z({},e,{maxDate:a.props.maxDate,minDate:z(a.props.minDate),onMonthChange:a.handleRightMonthSelectChange,onYearChange:a.handleRightYearSelectChange,reverseMonthAndYearMenus:a.props.reverseMonthAndYearMenus}))},a.handleDayMouseEnter=function(e,t,n){if(ae.Utils.safeInvoke(a.props.dayPickerProps.onDayMouseEnter,e,t,n),!t.disabled){var r=qe.getNextState(a.state.value,e,a.props.allowSingleDayRange,a.props.boundaryToModify),o=r.dateRange,s=r.boundary;a.setState({hoverValue:o}),ae.Utils.safeInvoke(a.props.onHoverChange,o,e,s)}},a.handleDayMouseLeave=function(e,t,n){ae.Utils.safeInvoke(a.props.dayPickerProps.onDayMouseLeave,e,t,n),t.disabled||(a.setState({hoverValue:void 0}),ae.Utils.safeInvoke(a.props.onHoverChange,void 0,e,void 0))},a.handleDayClick=function(e,t,n){if(ae.Utils.safeInvoke(a.props.dayPickerProps.onDayClick,e,t,n),t.disabled)a.forceUpdate();else{var r=qe.getNextState(a.state.value,e,a.props.allowSingleDayRange,a.props.boundaryToModify).dateRange;a.handleDayMouseEnter(e,t,n),a.handleNextState(r)}},a.handleLeftMonthChange=function(e){var t=new Ge(e.getMonth(),e.getFullYear());ae.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate()),a.updateLeftView(t)},a.handleRightMonthChange=function(e){var t=new Ge(e.getMonth(),e.getFullYear());ae.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate()),a.updateRightView(t)},a.handleLeftMonthSelectChange=function(e){var t=new Ge(e,a.state.leftView.getYear());ae.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate()),a.updateLeftView(t)},a.handleRightMonthSelectChange=function(e){var t=new Ge(e,a.state.rightView.getYear());ae.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate()),a.updateRightView(t)},a.handleLeftYearSelectChange=function(e){var t=new Ge(a.state.leftView.getMonth(),e);ae.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate());var n=a.props,r=n.minDate,o=X(n.maxDate),s=new Ge(r.getMonth(),r.getFullYear()),i=new Ge(o.getMonth(),o.getFullYear());t.isBefore(s)?t=s:t.isAfter(i)&&(t=i);var l=a.state.rightView.clone();t.isBefore(l)||(l=t.getNextMonth()),a.setViews(t,l)},a.handleRightYearSelectChange=function(e){var t=new Ge(a.state.rightView.getMonth(),e);ae.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate());var n=a.props,r=n.minDate,o=n.maxDate,s=z(r),i=new Ge(s.getMonth(),s.getFullYear()),l=new Ge(o.getMonth(),o.getFullYear());t.isBefore(i)?t=i:t.isAfter(l)&&(t=l);var u=a.state.leftView.clone();t.isAfter(u)||(u=t.getPreviousMonth()),a.setViews(u,t)};var r,o=[null,null];null!=t.value?o=t.value:null!=t.defaultValue&&(o=t.defaultValue);var s=new Date;null!=t.initialMonth?r=t.initialMonth:null!=o[0]?r=B(o[0]):null!=o[1]?V(r=B(o[1]),t.minDate)||r.setMonth(r.getMonth()-1):r=Y(s,[t.minDate,t.maxDate])?s:j([t.minDate,t.maxDate]);var i=V(r,t.minDate),l=V(r,t.maxDate);!i&&l&&r.setMonth(r.getMonth()-1);var u,p=Ge.fromDate(r),c=o[1],d=t.contiguousCalendarMonths||null==c||V(r,c)?p.getNextMonth():Ge.fromDate(c);return a.state={leftView:p,rightView:d,value:o,hoverValue:[null,null]},a}return Q(t,e),Object.defineProperty(t.prototype,"isControlled",{get:function(){return null!=this.props.value},enumerable:!0,configurable:!0}),t.prototype.render=function(){var e,t=function(e,t){var n=e;if(null!=t){n={};for(var a=0,r=Object.keys(t);a<r.length;a++){var o=r[a];-1===Se.indexOf(o)&&(n[o]=t[o])}for(var s=0,i=Object.keys(e);s<i.length;s++)n[o=i[s]]=e[o]}return n}(this.modifiers,this.props.modifiers),n=this.props,a=n.className,r=n.contiguousCalendarMonths,o=n.dayPickerProps,i=n.locale,l=n.localeUtils,u=n.maxDate,p=n.minDate,c=V(this.props.minDate,this.props.maxDate),d=this.state,h=d.leftView,f=d.rightView,g=this.getDisabledDaysModifier(),v=Z({locale:i,localeUtils:l,modifiers:t,showOutsideDays:!0},o,{disabledDays:g,onDayClick:this.handleDayClick,onDayMouseEnter:this.handleDayMouseEnter,onDayMouseLeave:this.handleDayMouseLeave,selectedDays:this.state.value});if(r||c){var S=te()(s,m,a,((e={})[D]=r,e[y]=c,e));return ne.createElement("div",{className:S},this.maybeRenderShortcuts(),ne.createElement(se.a,Z({},v,{captionElement:this.renderSingleCaption,fromMonth:p,month:h.getFullDate(),numberOfMonths:c?1:2,onMonthChange:this.handleLeftMonthChange,toMonth:u})))}return ne.createElement("div",{className:te()(s,m,a)},this.maybeRenderShortcuts(),ne.createElement(se.a,Z({},v,{canChangeMonth:!0,captionElement:this.renderLeftCaption,fromMonth:p,month:h.getFullDate(),onMonthChange:this.handleLeftMonthChange,toMonth:X(u)})),ne.createElement(se.a,Z({},v,{canChangeMonth:!0,captionElement:this.renderRightCaption,fromMonth:z(p),month:f.getFullDate(),onMonthChange:this.handleRightMonthChange,toMonth:u})))},t.prototype.componentWillReceiveProps=function(t){if(e.prototype.componentWillReceiveProps.call(this,t),!function(e,t){if(null==e&&null==t)return!0;if(null==e||null==t)return!1;var n=e[0],a=e[1],r=t[0],o=t[1],s=null==n&&null==r||x(n,r),i=null==a&&null==o||x(a,o);return s&&i}(this.props.value,t.value)){var n=ze(this.props.value,t.value,this.state,t.contiguousCalendarMonths);this.setState(n)}},t.prototype.validateProps=function(e){var t=e.defaultValue,n=e.initialMonth,a=e.maxDate,r=e.minDate,o=e.boundaryToModify,s=e.value,i=[r,a];if(null!=t&&!H(t,i))throw new Error(de);if(null!=n&&!K(n,i))throw new Error(he);if(null!=a&&null!=r&&a<r&&!x(a,r))throw new Error(fe);if(null!=s&&!H(s,i))throw new Error(ge);if(null!=o&&o!==$e.START&&o!==$e.END)throw new Error("<DateRangePicker> preferredBoundaryToModify must be a valid DateRangeBoundary if defined.")},t.prototype.maybeRenderShortcuts=function(){var e=this,t=this.props.shortcuts;if(null!=t&&!1!==t){var n,a,r,o,s,i,l,u,p,c,d=("boolean"==typeof t?(n=this.props.allowSingleDayRange,a=new Date,o=(r=function(e){var t=B(a);return e(t),t.setDate(t.getDate()+1),t})(function(e){return e.setDate(e.getDate()-2)}),s=r(function(e){return e.setDate(e.getDate()-7)}),i=r(function(e){return e.setMonth(e.getMonth()-1)}),l=r(function(e){return e.setMonth(e.getMonth()-3)}),u=r(function(e){return e.setMonth(e.getMonth()-6)}),p=r(function(e){return e.setFullYear(e.getFullYear()-1)}),c=r(function(e){return e.setFullYear(e.getFullYear()-2)}),(n?[Je("Today",[a,a]),Je("Yesterday",[o,o])]:[]).concat([Je("Past week",[s,a]),Je("Past month",[i,a]),Je("Past 3 months",[l,a]),Je("Past 6 months",[u,a]),Je("Past year",[p,a]),Je("Past 2 years",[c,a])])):t).map(function(t,n){return ne.createElement(ae.MenuItem,{className:ae.Classes.POPOVER_DISMISS_OVERRIDE,disabled:!e.isShortcutInRange(t.dateRange),key:n,onClick:e.getShorcutClickHandler(t.dateRange),text:t.label})});return ne.createElement(ae.Menu,{className:M},d)}},t.prototype.getShorcutClickHandler=function(e){var t=this;return function(){return t.handleNextState(e)}},t.prototype.handleNextState=function(e){var t=ze(this.state.value,e,this.state,this.props.contiguousCalendarMonths);this.isControlled||this.setState(t),ae.Utils.safeInvoke(this.props.onChange,e)},t.prototype.updateLeftView=function(e){var t=this.state.rightView.clone();e.isBefore(t)||(t=e.getNextMonth()),this.setViews(e,t)},t.prototype.updateRightView=function(e){var t=this.state.leftView.clone();e.isAfter(t)||(t=e.getPreviousMonth()),this.setViews(t,e)},t.prototype.setViews=function(e,t){this.setState({leftView:e,rightView:t})},t.prototype.isShortcutInRange=function(e){return H(e,[this.props.minDate,this.props.maxDate])},t.defaultProps={allowSingleDayRange:!1,contiguousCalendarMonths:!0,dayPickerProps:{},maxDate:Ie(),minDate:Me(),reverseMonthAndYearMenus:!1,shortcuts:!0},t.displayName="Blueprint2.DateRangePicker",t}(ae.AbstractPureComponent);function ze(e,t,n,a){var r;if(null!=e&&null==t)r={value:[null,null]};else if(null!=t){var o=t[0],s=t[1],i=n.leftView.clone(),l=n.rightView.clone();if(null==o&&null!=s)(p=new Ge(s.getMonth(),s.getFullYear())).isSame(i)||p.isSame(l)||(l=p,i.isBefore(l)||(i=l.getPreviousMonth()));else if(null!=o&&null==s){(u=new Ge(o.getMonth(),o.getFullYear())).isSame(i)||u.isSame(l)||(i=u,l.isAfter(i)||(l=i.getNextMonth()))}else if(null!=o&&null!=s){var u=new Ge(o.getMonth(),o.getFullYear()),p=new Ge(s.getMonth(),s.getFullYear());if(V(o,s)){var c=i.isSame(u),d=l.isSame(u);c||d||(i=u,l=u.getNextMonth())}else i.isSame(u)||(i=u,l=u.getNextMonth()),!1!==a||l.isSame(p)||(l=p)}r={leftView:i,rightView:l,value:t}}else r={};return r}function Je(e,t){return{dateRange:t,label:e}}var Qe=function(e){function t(t,n){var a=e.call(this,t,n)||this;return a.refHandlers={endInputRef:function(e){a.endInputRef=e,ae.Utils.safeInvoke(a.props.endInputProps.inputRef,e)},startInputRef:function(e){a.startInputRef=e,ae.Utils.safeInvoke(a.props.startInputProps.inputRef,e)}},a.renderInputGroup=function(e){var t=a.getInputProps(e),n=e===r.START?a.handleStartInputEvent:a.handleEndInputEvent;return ne.createElement(ae.InputGroup,Z({autoComplete:"off"},t,{disabled:a.props.disabled,intent:a.isInputInErrorState(e)?ae.Intent.DANGER:t.intent,inputRef:a.getInputRef(e),onBlur:n,onChange:n,onClick:n,onFocus:n,onKeyDown:n,onMouseDown:n,placeholder:a.getInputPlaceholderString(e),value:a.getInputDisplayString(e)}))},a.handleDateRangePickerChange=function(e,t){if(void 0===t&&(t=!1),a.state.isOpen){var n,o,s,i,l=e[0],u=e[1],p=!0;null==l?(n=!0,o=!1,s=null):null==u?(n=!1,o=!0,i=null):a.props.closeOnSelection?(p=!1,n=!1,o=!!t):a.state.lastFocusedField===r.START?(n=!0,o=!1):(n=!1,o=!0);var c={endHoverString:i,endInputString:a.formatDate(u),isEndInputFocused:o,isOpen:p,isStartInputFocused:n,startHoverString:s,startInputString:a.formatDate(l),wasLastFocusChangeDueToHover:!1};a.isControlled()?a.setState(c):a.setState(Z({},c,{selectedEnd:u,selectedStart:l})),ae.Utils.safeInvoke(a.props.onChange,e)}},a.handleDateRangePickerHoverChange=function(e,t,n){if(a.state.isOpen)if(null==e){var o=a.state.boundaryToModify===r.END;a.setState({endHoverString:null,isEndInputFocused:o,isStartInputFocused:!o,lastFocusedField:a.state.boundaryToModify,startHoverString:null})}else{var s=e[0],i=e[1],l=null!=n?n===r.START:a.state.isStartInputFocused;o=null!=n?n===r.END:a.state.isEndInputFocused;a.setState({endHoverString:a.formatDate(i),isEndInputFocused:o,isStartInputFocused:l,lastFocusedField:l?r.START:r.END,shouldSelectAfterUpdate:a.props.selectAllOnFocus,startHoverString:a.formatDate(s),wasLastFocusChangeDueToHover:!0})}},a.handleStartInputEvent=function(e){a.handleInputEvent(e,r.START)},a.handleEndInputEvent=function(e){a.handleInputEvent(e,r.END)},a.handleInputEvent=function(e,t){switch(e.type){case"blur":a.handleInputBlur(e,t);break;case"change":a.handleInputChange(e,t);break;case"click":a.handleInputClick(e);break;case"focus":a.handleInputFocus(e,t);break;case"keydown":a.handleInputKeyDown(e);break;case"mousedown":a.handleInputMouseDown()}var n=a.getInputProps(t),r=a.getInputGroupCallbackForEvent(e,n);ae.Utils.safeInvoke(r,e)},a.handleInputKeyDown=function(e){var t=e.which===ae.Keys.TAB,n=e.which===ae.Keys.ENTER,o=e.shiftKey,s=a.state,i=s.selectedStart,l=s.selectedEnd,u=a.state.lastFocusedField===r.START,p=a.state.lastFocusedField===r.END;if(t){var c=void 0,d=void 0,h=!0;u&&!o?(d=!1,c=!0,e.preventDefault()):p&&o?(d=!0,c=!1,e.preventDefault()):(d=!1,c=!1,h=!1),a.setState({isEndInputFocused:c,isOpen:h,isStartInputFocused:d,wasLastFocusChangeDueToHover:!1})}else if(u&&n){var f=a.parseDate(a.state.startInputString);a.handleDateRangePickerChange([f,l],!0)}else{if(!p||!n)return;var g=a.parseDate(a.state.endInputString);a.handleDateRangePickerChange([i,g],!0)}},a.handleInputMouseDown=function(){a.setState({wasLastFocusChangeDueToHover:!1})},a.handleInputClick=function(e){e.stopPropagation()},a.handleInputFocus=function(e,t){var n,r=a.getStateKeysAndValuesForBoundary(t),o=r.keys,s=re(r.values.selectedValue,a.props,!0),i=a.state.wasLastFocusChangeDueToHover?a.state.boundaryToModify:t;a.setState(((n={})[o.inputString]=s,n[o.isInputFocused]=!0,n.boundaryToModify=i,n.isOpen=!0,n.lastFocusedField=t,n.shouldSelectAfterUpdate=a.props.selectAllOnFocus,n.wasLastFocusChangeDueToHover=!1,n))},a.handleInputBlur=function(e,t){var n,r,o,s,i=a.getStateKeysAndValuesForBoundary(t),l=i.keys,u=i.values,p=a.parseDate(u.inputString),c=a.isControlled(),d=((n={})[l.isInputFocused]=!1,n.shouldSelectAfterUpdate=!1,n);a.isInputEmpty(u.inputString)?d=Z({},d,c?((r={})[l.inputString]=re(u.controlledValue,a.props),r):((o={})[l.inputString]=null,o[l.selectedValue]=null,o)):a.isNextDateRangeValid(p,t)||(c||(d=Z({},d,((s={})[l.inputString]=null,s[l.selectedValue]=p,s))),ae.Utils.safeInvoke(a.props.onError,a.getDateRangeForCallback(p,t))),a.setState(d)},a.handleInputChange=function(e,t){var n,r,o,s,i,l=e.target.value,u=a.getStateKeysAndValuesForBoundary(t).keys,p=a.parseDate(l),c=a.isControlled(),d={shouldSelectAfterUpdate:!1};if(0===l.length){var h=Z({},d,((n={})[u.inputString]="",n));d=c?h:Z({},h,((r={})[u.selectedValue]=null,r)),ae.Utils.safeInvoke(a.props.onChange,a.getDateRangeForCallback(null,t))}else if(a.isDateValidAndInRange(p)){h=Z({},d,((o={})[u.hoverString]=null,o[u.inputString]=l,o));d=c?h:Z({},h,((s={})[u.selectedValue]=p,s)),a.isNextDateRangeValid(p,t)&&ae.Utils.safeInvoke(a.props.onChange,a.getDateRangeForCallback(p,t))}else d=Z({},d,((i={})[u.inputString]=l,i[u.hoverString]=null,i));a.setState(d)},a.handlePopoverClose=function(){a.setState({isOpen:!1}),ae.Utils.safeInvoke(a.props.popoverProps.onClose)},a.getInitialRange=function(e){void 0===e&&(e=a.props);var t=e.defaultValue,n=e.value;return null!=n?n:null!=t?t:[null,null]},a.getSelectedRange=function(){var e,t,n;return a.isControlled()?(e=(n=a.props.value)[0],t=n[1]):(e=a.state.selectedStart,t=a.state.selectedEnd),[e,a.doBoundaryDatesOverlap(e,r.START)?void 0:t].map(function(e){return a.isDateValidAndInRange(e)?e:void 0})},a.getInputGroupCallbackForEvent=function(e,t){switch(e.type){case"blur":return t.onBlur;case"change":return t.onChange;case"click":return t.onClick;case"focus":return t.onFocus;case"keydown":return t.onKeyDown;case"mousedown":return t.onMouseDown;default:return}},a.getInputDisplayString=function(e){var t=a.getStateKeysAndValuesForBoundary(e).values,n=t.isInputFocused,r=t.inputString,o=t.selectedValue,s=t.hoverString;return null!=s?s:n?null==r?"":r:null==o?"":a.doesEndBoundaryOverlapStartBoundary(o,e)?a.props.overlappingDatesMessage:re(o,a.props)},a.getInputPlaceholderString=function(e){var t=e===r.START,n=e===r.END,o=a.getInputProps(e),s=a.getStateKeysAndValuesForBoundary(e).values.isInputFocused;return null!=o.placeholder?o.placeholder:t?s?a.state.formattedMinDateString:"Start date":n?s?a.state.formattedMaxDateString:"End date":""},a.getInputProps=function(e){return e===r.START?a.props.startInputProps:a.props.endInputProps},a.getInputRef=function(e){return e===r.START?a.refHandlers.startInputRef:a.refHandlers.endInputRef},a.getStateKeysAndValuesForBoundary=function(e){var t=a.props.value;return e===r.START?{keys:{hoverString:"startHoverString",inputString:"startInputString",isInputFocused:"isStartInputFocused",selectedValue:"selectedStart"},values:{controlledValue:null!=t?t[0]:void 0,hoverString:a.state.startHoverString,inputString:a.state.startInputString,isInputFocused:a.state.isStartInputFocused,selectedValue:a.state.selectedStart}}:{keys:{hoverString:"endHoverString",inputString:"endInputString",isInputFocused:"isEndInputFocused",selectedValue:"selectedEnd"},values:{controlledValue:null!=t?t[1]:void 0,hoverString:a.state.endHoverString,inputString:a.state.endInputString,isInputFocused:a.state.isEndInputFocused,selectedValue:a.state.selectedEnd}}},a.getDateRangeForCallback=function(e,t){var n=a.getOtherBoundary(t),o=a.getStateKeysAndValuesForBoundary(n).values.selectedValue;return t===r.START?[e,o]:[o,e]},a.getOtherBoundary=function(e){return e===r.START?r.END:r.START},a.doBoundaryDatesOverlap=function(e,t){var n=a.props.allowSingleDayRange,o=a.getOtherBoundary(t),s=a.getStateKeysAndValuesForBoundary(o).values.selectedValue;return null!=e&&null!=s&&(t===r.START?se.a.DateUtils.isDayAfter(e,s)||!n&&se.a.DateUtils.isSameDay(e,s):se.a.DateUtils.isDayBefore(e,s)||!n&&se.a.DateUtils.isSameDay(e,s))},a.doesEndBoundaryOverlapStartBoundary=function(e,t){return t!==r.START&&a.doBoundaryDatesOverlap(e,t)},a.isControlled=function(){return void 0!==a.props.value},a.isInputEmpty=function(e){return null==e||0===e.length},a.isInputInErrorState=function(e){var t=a.getStateKeysAndValuesForBoundary(e).values,n=t.isInputFocused,r=t.hoverString,o=t.inputString,s=t.selectedValue;if(null!=r||a.isInputEmpty(o))return!1;var i=n?a.parseDate(o):s;return null!=i&&(!a.isDateValidAndInRange(i)||a.doesEndBoundaryOverlapStartBoundary(i,e))},a.isDateValidAndInRange=function(e){return b(e)&&Y(e,[a.props.minDate,a.props.maxDate])},a.reset(t),a}return Q(t,e),t.prototype.reset=function(e){void 0===e&&(e=this.props);var t=this.getInitialRange(),n=t[0],a=t[1];this.state={formattedMaxDateString:this.getFormattedMinMaxDateString(e,"maxDate"),formattedMinDateString:this.getFormattedMinMaxDateString(e,"minDate"),isOpen:!1,selectedEnd:a,selectedStart:n}},t.prototype.componentDidUpdate=function(){var e=this.state,t=e.isStartInputFocused,n=e.isEndInputFocused,a=e.shouldSelectAfterUpdate,r=this.shouldFocusInputRef(t,this.startInputRef),o=this.shouldFocusInputRef(n,this.endInputRef);r?this.startInputRef.focus():o&&this.endInputRef.focus(),t&&a?this.startInputRef.select():n&&a&&this.endInputRef.select()},t.prototype.render=function(){var e=this.props.popoverProps,t=void 0===e?{}:e,n=ne.createElement(Xe,Z({},this.props,{boundaryToModify:this.state.boundaryToModify,onChange:this.handleDateRangePickerChange,onHoverChange:this.handleDateRangePickerHoverChange,value:this.getSelectedRange()})),a=te()(t.className,this.props.className);return ne.createElement(ae.Popover,Z({isOpen:this.state.isOpen,position:ae.Position.BOTTOM_LEFT,usePortal:!1},this.props.popoverProps,{autoFocus:!1,className:a,content:n,enforceFocus:!1,onClose:this.handlePopoverClose}),ne.createElement("div",{className:ae.Classes.CONTROL_GROUP},this.renderInputGroup(r.START),this.renderInputGroup(r.END)))},t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t);var n={};if(t.value!==this.props.value){var a=this.getInitialRange(t),r=a[0],o=a[1];n=Z({},n,{selectedStart:r,selectedEnd:o})}if(t.minDate!==this.props.minDate){var s=this.getFormattedMinMaxDateString(t,"minDate");n=Z({},n,{formattedMinDateString:s})}if(t.maxDate!==this.props.maxDate){var i=this.getFormattedMinMaxDateString(t,"maxDate");n=Z({},n,{formattedMaxDateString:i})}this.setState(n)},t.prototype.validateProps=function(e){if(null===e.value)throw new Error("[Blueprint] <DateRangeInput> value cannot be null. Pass undefined to clear the value and operate in uncontrolled mode, or pass [null, null] to clear the value and continue operating in controlled mode.")},t.prototype.shouldFocusInputRef=function(e,t){return e&&void 0!==t&&document.activeElement!==t},t.prototype.isNextDateRangeValid=function(e,t){return this.isDateValidAndInRange(e)&&!this.doBoundaryDatesOverlap(e,t)},t.prototype.getFormattedMinMaxDateString=function(e,n){var a=e[n],r=t.defaultProps[n];return re(void 0===a?r:a,this.props)},t.prototype.parseDate=function(e){if(e===this.props.outOfRangeMessage||e===this.props.invalidDateMessage)return null;var t=this.props,n=t.locale,a=(0,t.parseDate)(e,n);return!1===a?new Date(void 0):a},t.prototype.formatDate=function(e){if(!this.isDateValidAndInRange(e))return"";var t=this.props,n=t.locale;return(0,t.formatDate)(e,n)},t.defaultProps={allowSingleDayRange:!1,closeOnSelection:!0,contiguousCalendarMonths:!0,dayPickerProps:{},disabled:!1,endInputProps:{},invalidDateMessage:"Invalid date",maxDate:Ie(),minDate:Me(),outOfRangeMessage:"Out of range",overlappingDatesMessage:"Overlapping dates",popoverProps:{},selectAllOnFocus:!1,shortcuts:!0,startInputProps:{}},t.displayName="Blueprint2.DateRangeInput",t}(ae.AbstractPureComponent);n.d(t,"Classes",function(){return Ze}),n.d(t,"DateRangeBoundary",function(){return r}),n.d(t,"DateInput",function(){return We}),n.d(t,"DatePicker",function(){return Pe}),n.d(t,"DateTimePicker",function(){return Le}),n.d(t,"DateRangeInput",function(){return Qe}),n.d(t,"DateRangePicker",function(){return Xe}),n.d(t,"TimePicker",function(){return He}),n.d(t,"TimePickerPrecision",function(){return Fe});var Ze=a}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("classNames"),require("DayPicker")):"function"==typeof define&&define.amd?define(["React","classNames","DayPicker"],t):"object"==typeof exports?exports.Datetime=t(require("React"),require("classNames"),require("DayPicker")):(e.Blueprint=e.Blueprint||{},e.Blueprint.Datetime=t(e.React,e.classNames,e.DayPicker))}("undefined"!=typeof self?self:this,function(e,t,n){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(t,n){t.exports=e},function(e,t){e.exports=Blueprint.Core},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){e.exports=n(5)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={};n.d(a,"DATEPICKER",function(){return s}),n.d(a,"DATEPICKER_CAPTION",function(){return i}),n.d(a,"DATEPICKER_CAPTION_CARET",function(){return l}),n.d(a,"DATEPICKER_CAPTION_SELECT",function(){return u}),n.d(a,"DATEPICKER_DAY",function(){return p}),n.d(a,"DATEPICKER_DAY_DISABLED",function(){return c}),n.d(a,"DATEPICKER_DAY_OUTSIDE",function(){return d}),n.d(a,"DATEPICKER_DAY_SELECTED",function(){return h}),n.d(a,"DATEPICKER_FOOTER",function(){return f}),n.d(a,"DATEPICKER_MONTH_SELECT",function(){return g}),n.d(a,"DATEPICKER_YEAR_SELECT",function(){return v}),n.d(a,"DATERANGEPICKER",function(){return m}),n.d(a,"DATERANGEPICKER_CONTIGUOUS",function(){return D}),n.d(a,"DATERANGEPICKER_SINGLE_MONTH",function(){return y}),n.d(a,"DATERANGEPICKER_DAY_SELECTED_RANGE",function(){return S}),n.d(a,"DATERANGEPICKER_DAY_HOVERED_RANGE",function(){return I}),n.d(a,"DATERANGEPICKER_SHORTCUTS",function(){return M}),n.d(a,"DATETIMEPICKER",function(){return E}),n.d(a,"TIMEPICKER",function(){return C}),n.d(a,"TIMEPICKER_ARROW_BUTTON",function(){return P}),n.d(a,"TIMEPICKER_ARROW_ROW",function(){return R}),n.d(a,"TIMEPICKER_DIVIDER_TEXT",function(){return T}),n.d(a,"TIMEPICKER_HOUR",function(){return k}),n.d(a,"TIMEPICKER_INPUT",function(){return w}),n.d(a,"TIMEPICKER_INPUT_ROW",function(){return F}),n.d(a,"TIMEPICKER_MILLISECOND",function(){return A}),n.d(a,"TIMEPICKER_MINUTE",function(){return N}),n.d(a,"TIMEPICKER_SECOND",function(){return O}),n.d(a,"TIMEPICKER_AMPM_SELECT",function(){return b});var r,o,s="pt-datepicker",i="pt-datepicker-caption",l="pt-datepicker-caption-caret",u="pt-datepicker-caption-select",p="DayPicker-Day",c="DayPicker-Day--disabled",d="DayPicker-Day--outside",h="DayPicker-Day--selected",f="pt-datepicker-footer",g="pt-datepicker-month-select",v="pt-datepicker-year-select",m="pt-daterangepicker",D="pt-daterangepicker-contiguous",y="pt-daterangepicker-single-month",S="DayPicker-Day--selected-range",I="DayPicker-Day--hovered-range",M="pt-daterangepicker-shortcuts",E="pt-datetimepicker",C="pt-timepicker",P="pt-timepicker-arrow-button",R="pt-timepicker-arrow-row",T="pt-timepicker-divider-text",k="pt-timepicker-hour",w="pt-timepicker-input",F="pt-timepicker-input-row",A="pt-timepicker-millisecond",N="pt-timepicker-minute",O="pt-timepicker-second",b="pt-timepicker-ampm-select";function x(e){return e instanceof Date&&!isNaN(e.valueOf())}function U(e,t){return null!=e&&null!=t&&e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}function V(e,t){return null!=e&&null!=t&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}function B(e,t){return null!=e&&null!=t&&e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes()&&e.getSeconds()===t.getSeconds()&&e.getMilliseconds()===t.getMilliseconds()}function Y(e){return new Date(e.getTime())}function H(e,t,n){if(void 0===n&&(n=!1),null==e)return!1;var a=Y(e),r=Y(t[0]),o=Y(t[1]);return a.setHours(0,0,0,0),r.setHours(0,0,0,0),o.setHours(0,0,0,0),r<=a&&a<=o&&(!n||!U(r,a)&&!U(a,o))}function _(e,t){return(null==e[0]||H(e[0],t))&&(null==e[1]||H(e[1],t))}function K(e,t){if(null==e)return!1;var n=Y(e),a=Y(t[0]),r=Y(t[1]);return n.setDate(1),a.setDate(1),r.setDate(1),n.setHours(0,0,0,0),a.setHours(0,0,0,0),r.setHours(0,0,0,0),a<=n&&n<=r}(o=r||(r={})).START="start",o.END="end";var L=function(e,t){return e.getTime()>=t.getTime()},W=function(e,t){return e.getTime()<=t.getTime()};function G(e,t,n){var a=X(e),r=X(t),o=X(n),s=L(a,r),i=W(a,o);return W(o,r)?s||i:s&&i}function j(e,t,n){return B(t,n)?n:G(e,t,n)?e:(a=n,r=X(e),o=X(a),L(r,o)?n:t);var a,r,o}function q(e){var t=e[0].getTime(),n=e[1].getTime();return new Date(t+.5*(n-t))}function $(e,t){return null===e?null:null===t?new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0):new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}function X(e){return new Date(0,0,0,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function z(e){return 0===e.getMonth()?new Date(e.getFullYear()-1,11):new Date(e.getFullYear(),e.getMonth()-1)}function J(e){return 11===e.getMonth()?new Date(e.getFullYear()+1,0):new Date(e.getFullYear(),e.getMonth()+1)}function Q(e){if(e<0||e>23)throw new Error("hour must be between [0,23] inclusive: got "+e);var t=e%12;return 0===t?12:t}var Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function ee(e,t){function n(){this.constructor=e}Z(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var te=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};var ne=n(2),ae=n.n(ne),re=n(0),oe=n(1);function se(e,t,n){return void 0===n&&(n=!1),null==e?"":x(e)?n||H(e,[t.minDate,t.maxDate])?t.formatDate(e,t.locale):t.outOfRangeMessage:t.invalidDateMessage}var ie=n(3),le=n.n(ie),ue="[Blueprint]",pe=ue+" <DatePicker> defaultValue must be within minDate and maxDate bounds.",ce=ue+" <DatePicker> initialMonth must be within minDate and maxDate bounds.",de=ue+" <DatePicker> maxDate must be later than minDate.",he=ue+" <DatePicker> value prop must be within minDate and maxDate bounds.",fe=pe.replace("DatePicker","DateRangePicker"),ge=ce.replace("DatePicker","DateRangePicker"),ve=de.replace("DatePicker","DateRangePicker"),me=he.replace("DatePicker","DateRangePicker");function De(e,t){return e.length<t?""+(n="0",a=t-e.length,new Array(a+1).join(n))+e:e;var n,a}var ye=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={monthWidth:0},t.containerRefHandler=function(e){return t.containerElement=e},t.handleMonthSelectChange=function(e){var n=parseInt(e.target.value,10);oe.Utils.safeInvoke(t.props.onMonthChange,n)},t.handleYearSelectChange=function(e){var n=parseInt(e.target.value,10);oe.Utils.safeInvoke(t.props.onYearChange,n)},t}return ee(t,e),t.prototype.render=function(){for(var e=this.props,t=e.date,n=e.locale,a=e.localeUtils,r=e.minDate,o=e.maxDate,s=r.getFullYear(),p=o.getFullYear(),c=t.getMonth(),d=t.getFullYear(),h=a.getMonths(n),f=d===s?r.getMonth():0,m=d===p?o.getMonth()+1:void 0,D=h.map(function(e,t){return re.createElement("option",{key:t,value:t.toString()},e)}).slice(f,m),y=[s],S=s+1;S<=p;++S)y.push(S);var I=y.map(function(e,t){return re.createElement("option",{key:t,value:e.toString()},e)});d>p&&I.push(re.createElement("option",{key:"next",disabled:!0,value:d.toString()},d)),this.displayedMonthText=h[c];var M=re.createElement("div",{className:u,key:"month"},re.createElement("select",{className:g,onChange:this.handleMonthSelectChange,value:c.toString()},D),re.createElement(oe.Icon,{className:l,icon:"caret-down",style:{left:this.state.monthWidth}})),E=re.createElement("div",{className:u,key:"year"},re.createElement("select",{className:v,onChange:this.handleYearSelectChange,value:d.toString()},I),re.createElement(oe.Icon,{className:l,icon:"caret-down"})),C=this.props.reverseMonthAndYearMenus?[E,M]:[M,E];return re.createElement("div",{className:i,ref:this.containerRefHandler},C)},t.prototype.componentDidMount=function(){var e=this;requestAnimationFrame(function(){return e.positionArrows()})},t.prototype.componentDidUpdate=function(){this.positionArrows()},t.prototype.positionArrows=function(){var e=function(e,t,n){if(void 0===t&&(t=""),void 0===n&&(n=document.body),null==n)return 0;var a=document.createElement("span");a.classList.add(t),a.textContent=e,n.appendChild(a);var r=a.offsetWidth;return a.remove(),r}(this.displayedMonthText,"pt-datepicker-caption-measure",this.containerElement);this.setState({monthWidth:e})},t}(re.PureComponent),Se="hovered-range",Ie="selected-range",Me=["disabled",Se,"outside","selected",Ie];function Ee(){var e=new Date;return e.setFullYear(e.getFullYear()),e.setMonth(11,31),e}function Ce(){var e=new Date;return e.setFullYear(e.getFullYear()-20),e.setMonth(0,1),e}var Pe,Re,Te=function(e){function t(t,n){var a=e.call(this,t,n)||this;a.ignoreNextMonthChange=!1,a.disabledDays=function(e){return!H(e,[a.props.minDate,a.props.maxDate])},a.getDisabledDaysModifier=function(){var e=a.props.dayPickerProps.disabledDays;return Array.isArray(e)?[a.disabledDays].concat(e):[a.disabledDays,e]},a.renderCaption=function(e){return re.createElement(ye,te({},e,{maxDate:a.props.maxDate,minDate:a.props.minDate,onMonthChange:a.handleMonthSelectChange,onYearChange:a.handleYearSelectChange,reverseMonthAndYearMenus:a.props.reverseMonthAndYearMenus}))},a.handleDayClick=function(e,t,n){oe.Utils.safeInvoke(a.props.dayPickerProps.onDayClick,e,t,n);var r=e;if(a.props.canClearSelection&&t.selected&&(r=null),void 0===a.props.value&&!t.disabled){var o=e.getMonth(),s=e.getFullYear(),i=e.getDate();a.setState({displayMonth:o,displayYear:s,selectedDay:i,value:r})}t.disabled?a.forceUpdate():(oe.Utils.safeInvoke(a.props.onChange,r,!0),null!=a.state.value&&a.state.value.getMonth()!==e.getMonth()&&(a.ignoreNextMonthChange=!0))},a.handleMonthChange=function(e){var t=e.getMonth(),n=e.getFullYear(),r=a.state.value;null!==r&&(r=a.computeValidDateInSpecifiedMonthYear(n,t),a.ignoreNextMonthChange?a.ignoreNextMonthChange=!1:oe.Utils.safeInvoke(a.props.onChange,r,!1)),oe.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,r),a.setStateWithValueIfUncontrolled({displayMonth:t,displayYear:n},r)},a.handleMonthSelectChange=function(e){var t=a.state.value;null!==t&&(t=a.computeValidDateInSpecifiedMonthYear(t.getFullYear(),e),oe.Utils.safeInvoke(a.props.onChange,t,!1)),oe.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t),a.setStateWithValueIfUncontrolled({displayMonth:e},t)},a.handleYearSelectChange=function(e){var t=a.state,n=t.displayMonth,r=t.value;if(null!==r)r=a.computeValidDateInSpecifiedMonthYear(e,n),oe.Utils.safeInvoke(a.props.onChange,r,!1),n=r.getMonth();else{var o=a.props,s=o.minDate,i=o.maxDate,l=s.getFullYear(),u=i.getFullYear(),p=s.getMonth(),c=i.getMonth();e===l&&n<p?n=p:e===u&&n>c&&(n=c)}oe.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,r),a.setStateWithValueIfUncontrolled({displayMonth:n,displayYear:e},r)},a.handleClearClick=function(){void 0===a.props.value&&a.setState({value:null}),oe.Utils.safeInvoke(a.props.onChange,null,!0)},a.handleTodayClick=function(){var e=new Date,t=e.getMonth(),n=e.getFullYear(),r=e.getDate();void 0===a.props.value?a.setState({displayMonth:t,displayYear:n,selectedDay:r,value:e}):a.setState({displayMonth:t,displayYear:n,selectedDay:r}),oe.Utils.safeInvoke(a.props.onChange,e,!0)};var r,o,s=null;void 0!==t.value?s=t.value:null!=t.defaultValue&&(s=t.defaultValue),null!==s&&(r=s.getDate());var i=new Date;return o=null!=t.initialMonth?t.initialMonth:null!=s?s:H(i,[t.minDate,t.maxDate])?i:q([t.minDate,t.maxDate]),a.state={displayMonth:o.getMonth(),displayYear:o.getFullYear(),selectedDay:r,value:s},a}return ee(t,e),t.prototype.render=function(){var e=this.props,t=e.className,n=e.dayPickerProps,a=e.locale,r=e.localeUtils,o=e.maxDate,i=e.minDate,l=e.modifiers,u=e.showActionsBar,p=this.state,c=p.displayMonth,d=p.displayYear;return re.createElement("div",{className:ae()(s,t)},re.createElement(le.a,te({showOutsideDays:!0,locale:a,localeUtils:r,modifiers:l},n,{canChangeMonth:!0,captionElement:this.renderCaption,disabledDays:this.getDisabledDaysModifier(),fromMonth:i,month:new Date(d,c),onDayClick:this.handleDayClick,onMonthChange:this.handleMonthChange,selectedDays:this.state.value,toMonth:o})),u?this.renderOptionsBar():null)},t.prototype.componentWillReceiveProps=function(t){if(t.value!==this.props.value){var n=this.state,a=n.displayMonth,r=n.displayYear,o=n.selectedDay;null!=t.value&&(a=t.value.getMonth(),r=t.value.getFullYear(),o=t.value.getDate()),this.setState({displayMonth:a,displayYear:r,selectedDay:o,value:t.value})}e.prototype.componentWillReceiveProps.call(this,t)},t.prototype.validateProps=function(e){var t=e.defaultValue,n=e.initialMonth,a=e.maxDate,r=e.minDate,o=e.value;if(null!=t&&!H(t,[r,a]))throw new Error(pe);if(null!=n&&!K(n,[r,a]))throw new Error(ce);if(null!=a&&null!=r&&a<r&&!U(a,r))throw new Error(de);if(null!=o&&!H(o,[r,a]))throw new Error(he)},t.prototype.renderOptionsBar=function(){return re.createElement("div",{className:f},re.createElement(oe.Button,{className:"pt-minimal pt-datepicker-footer-button",onClick:this.handleTodayClick,text:"Today"}),re.createElement(oe.Button,{className:"pt-minimal pt-datepicker-footer-button",onClick:this.handleClearClick,text:"Clear"}))},t.prototype.computeValidDateInSpecifiedMonthYear=function(e,t){var n=this.props,a=n.minDate,r=n.maxDate,o=new Date(e,t+1,0).getDate(),s=this.state.selectedDay;s>o&&(s=o);var i=new Date(e,t,s,12);return i<a?i=a:i>r&&(i=r),i},t.prototype.setStateWithValueIfUncontrolled=function(e,t){return void 0===this.props.value&&(e.value=t),this.setState(e)},t.defaultProps={canClearSelection:!0,dayPickerProps:{},maxDate:Ee(),minDate:Ce(),reverseMonthAndYearMenus:!1,showActionsBar:!1},t.displayName="Blueprint2.DatePicker",t}(oe.AbstractPureComponent);function ke(e,t,n,a){switch(e){case Pe.HOUR_24:n.setHours(t);break;case Pe.HOUR_12:n.setHours(function(e,t){if(e<1||e>12)throw new Error("hour must be between [1,12] inclusive: got "+e);var n=12===e?0:e;return t?n+12:n}(t,a));break;case Pe.MINUTE:n.setMinutes(t);break;case Pe.SECOND:n.setSeconds(t);break;case Pe.MS:n.setMilliseconds(t);break;default:throw Error("Invalid TimeUnit")}return n}function we(e){return Ke[e].max}function Fe(e){return Ke[e].min}(Re=Pe||(Pe={})).HOUR_24="24hour",Re.HOUR_12="12hour",Re.MINUTE="minute",Re.SECOND="second",Re.MS="ms";var Ae,Ne,Oe,be=0,xe=0,Ue=0,Ve=0,Be=23,Ye=59,He=59,_e=999,Ke=((Ae={})[Pe.HOUR_24]={className:k,max:Be,min:be},Ae[Pe.HOUR_12]={className:k,max:12,min:1},Ae[Pe.MINUTE]={className:N,max:Ye,min:xe},Ae[Pe.SECOND]={className:O,max:He,min:Ue},Ae[Pe.MS]={className:A,max:_e,min:Ve},Ae);(Oe=Ne||(Ne={}))[Oe.MINUTE=0]="MINUTE",Oe[Oe.SECOND=1]="SECOND",Oe[Oe.MILLISECOND=2]="MILLISECOND";var Le=function(e){function t(t,n){var a=e.call(this,t,n)||this;a.getInputBlurHandler=function(e){return function(t){var n=Ge(t);a.updateTime(parseInt(n,10),e)}},a.getInputChangeHandler=function(e){return function(t){var n=Ge(t),r=!1;switch(e){case Pe.HOUR_24:case Pe.HOUR_12:case Pe.MINUTE:case Pe.SECOND:r=/^\d{0,2}$/.test(n);break;case Pe.MS:r=/^\d{0,3}$/.test(n);break;default:throw Error("Invalid TimeUnit")}if(r)switch(e){case Pe.HOUR_24:case Pe.HOUR_12:a.updateState({hourText:n});break;case Pe.MINUTE:a.updateState({minuteText:n});break;case Pe.SECOND:a.updateState({secondText:n});break;case Pe.MS:a.updateState({millisecondText:n});break;default:throw Error("Invalid TimeUnit")}}},a.getInputKeyDownHandler=function(e){return function(t){var n;!function(e,t,n){void 0===n&&(n=!0);for(var a=0,r=Object.keys(t);a<r.length;a++){var o=r[a],s=Number(o);e.which===s&&(n&&e.preventDefault(),t[s]())}}(t,(n={},n[oe.Keys.ARROW_UP]=function(){return a.incrementTime(e)},n[oe.Keys.ARROW_DOWN]=function(){return a.decrementTime(e)},n[oe.Keys.ENTER]=function(){t.currentTarget.blur()},n))}},a.handleFocus=function(e){a.props.selectAllOnFocus&&e.currentTarget.select()},a.handleAmPmChange=function(e){var t="pm"===e.currentTarget.value;if(t!==a.state.isPm){var n=function(e,t){if(e<0||e>23)throw new Error("hour must be between [0,23] inclusive: got "+e);return t?e%12+12:e%12}(a.state.value.getHours(),t);a.setState({isPm:t},function(){return a.updateTime(n,Pe.HOUR_24)})}},a.incrementTime=function(e){return a.shiftTime(e,1)},a.decrementTime=function(e){return a.shiftTime(e,-1)};var r=t.minTime;return null!=t.value?r=t.value:null!=t.defaultValue&&(r=t.defaultValue),a.state=a.getFullStateFromValue(r,t.useAmPm),a}return ee(t,e),t.prototype.render=function(){var e,t=this.props.precision>=Ne.SECOND,n=this.props.precision>=Ne.MILLISECOND,a=this.props.useAmPm?Pe.HOUR_12:Pe.HOUR_24,r=ae()(C,this.props.className,((e={})[oe.Classes.DISABLED]=this.props.disabled,e));return re.createElement("div",{className:r},re.createElement("div",{className:R},this.maybeRenderArrowButton(!0,a),this.maybeRenderArrowButton(!0,Pe.MINUTE),t&&this.maybeRenderArrowButton(!0,Pe.SECOND),n&&this.maybeRenderArrowButton(!0,Pe.MS)),re.createElement("div",{className:F},this.renderInput(k,a,this.state.hourText),this.renderDivider(),this.renderInput(N,Pe.MINUTE,this.state.minuteText),t&&this.renderDivider(),t&&this.renderInput(O,Pe.SECOND,this.state.secondText),n&&this.renderDivider("."),n&&this.renderInput(A,Pe.MS,this.state.millisecondText)),this.maybeRenderAmPm(),re.createElement("div",{className:R},this.maybeRenderArrowButton(!1,a),this.maybeRenderArrowButton(!1,Pe.MINUTE),t&&this.maybeRenderArrowButton(!1,Pe.SECOND),n&&this.maybeRenderArrowButton(!1,Pe.MS)))},t.prototype.componentWillReceiveProps=function(e){var t=e.minTime!==this.props.minTime,n=e.maxTime!==this.props.maxTime,a=t||n,r=this.state.value;a&&(r=j(this.state.value,e.minTime,e.maxTime)),null==e.value||B(e.value,this.props.value)||(r=e.value),this.setState(this.getFullStateFromValue(r,e.useAmPm))},t.prototype.maybeRenderArrowButton=function(e,t){var n=this;if(!this.props.showArrowButtons)return null;var a=ae()(P,Ke[t].className);return re.createElement("span",{className:a,onClick:function(){return(e?n.incrementTime:n.decrementTime)(t)}},re.createElement(oe.Icon,{icon:e?"chevron-up":"chevron-down"}))},t.prototype.renderDivider=function(e){return void 0===e&&(e=":"),re.createElement("span",{className:T},e)},t.prototype.renderInput=function(e,t,n){return re.createElement("input",{className:ae()(w,e),onBlur:this.getInputBlurHandler(t),onChange:this.getInputChangeHandler(t),onFocus:this.handleFocus,onKeyDown:this.getInputKeyDownHandler(t),value:n,disabled:this.props.disabled})},t.prototype.maybeRenderAmPm=function(){return this.props.useAmPm?re.createElement("div",{className:ae()(oe.Classes.SELECT,b)},re.createElement("select",{value:this.state.isPm?"pm":"am",onChange:this.handleAmPmChange,disabled:this.props.disabled},re.createElement("option",{value:"am"},"AM"),re.createElement("option",{value:"pm"},"PM"))):null},t.prototype.getFullStateFromValue=function(e,t){var n=j(e,this.props.minTime,this.props.maxTime),a=t?Pe.HOUR_12:Pe.HOUR_24;return{hourText:We(n.getHours(),a),minuteText:We(n.getMinutes(),Pe.MINUTE),secondText:We(n.getSeconds(),Pe.SECOND),millisecondText:We(n.getMilliseconds(),Pe.MS),value:n,isPm:function(e){if(e<0||e>23)throw new Error("hour must be between [0,23] inclusive: got "+e);return e>=12}(n.getHours())}},t.prototype.shiftTime=function(e,t){if(!this.props.disabled){var n,a,r,o,s=function(e,t){switch(e){case Pe.HOUR_24:return t.getHours();case Pe.HOUR_12:return Q(t.getHours());case Pe.MINUTE:return t.getMinutes();case Pe.SECOND:return t.getSeconds();case Pe.MS:return t.getMilliseconds();default:throw Error("Invalid TimeUnit")}}(e,this.state.value)+t;this.updateTime((a=s,r=we(n=e),o=Fe(n),a>r?o:a<o?r:a),e)}},t.prototype.updateTime=function(e,t){var n,a,r=Y(this.state.value);n=t,null!=(a=e)&&!isNaN(a)&&Fe(n)<=a&&a<=we(n)?(ke(t,e,r,this.state.isPm),G(r,this.props.minTime,this.props.maxTime)?this.updateState({value:r}):B(this.state.value,this.props.minTime)||this.updateState(this.getFullStateFromValue(r,this.props.useAmPm))):this.updateState(this.getFullStateFromValue(this.state.value,this.props.useAmPm))},t.prototype.updateState=function(e){var t=e,n=null!=t.value&&!B(t.value,this.state.value);null==this.props.value?(n&&(t=this.getFullStateFromValue(t.value,this.props.useAmPm)),this.setState(t)):n?this.setState(this.getFullStateFromValue(this.state.value,this.props.useAmPm)):this.setState(te({},t,{value:Y(this.state.value)})),n&&oe.Utils.safeInvoke(this.props.onChange,t.value)},t.defaultProps={disabled:!1,maxTime:new Date(0,0,0,Be,Ye,He,_e),minTime:new Date(0,0,0,be,xe,Ue,Ve),precision:Ne.MINUTE,selectAllOnFocus:!1,showArrowButtons:!1,useAmPm:!1},t.displayName="Blueprint2.TimePicker",t}(re.Component);function We(e,t){switch(t){case Pe.HOUR_24:return e.toString();case Pe.HOUR_12:return Q(e).toString();case Pe.MINUTE:case Pe.SECOND:return De(e.toString(),2);case Pe.MS:return De(e.toString(),3);default:throw Error("Invalid TimeUnit")}}function Ge(e){return e.currentTarget.value}var je=function(e){function t(t,n){var a=e.call(this,t,n)||this;a.handleDateChange=function(e,t){void 0===a.props.value&&a.setState({dateValue:e});var n=$(e,a.state.timeValue);oe.Utils.safeInvoke(a.props.onChange,n,t)},a.handleTimeChange=function(e){void 0===a.props.value&&a.setState({timeValue:e});var t=$(a.state.dateValue,e);oe.Utils.safeInvoke(a.props.onChange,t,!0)};var r=void 0!==a.props.value?a.props.value:a.props.defaultValue;return a.state={dateValue:r,timeValue:r},a}return ee(t,e),t.prototype.render=function(){var e=$(this.state.dateValue,this.state.timeValue);return re.createElement("div",{className:ae()(E,this.props.className)},re.createElement(Te,te({},this.props.datePickerProps,{canClearSelection:this.props.canClearSelection,onChange:this.handleDateChange,value:e})),re.createElement(Le,te({},this.props.timePickerProps,{onChange:this.handleTimeChange,value:e})))},t.prototype.componentWillReceiveProps=function(e){this.props.value!==e.value&&(null!=e.value?this.setState({dateValue:e.value,timeValue:e.value}):this.setState({dateValue:null}))},t.defaultProps={canClearSelection:!0,defaultValue:new Date},t.displayName="Blueprint2.DateTimePicker",t}(oe.AbstractPureComponent),qe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isInputFocused:!1,isOpen:!1,value:void 0!==t.props.value?t.props.value:t.props.defaultValue,valueString:null},t.inputEl=null,t.popoverContentEl=null,t.lastElementInPopover=null,t.refHandlers={input:function(e){t.inputEl=e},popoverContent:function(e){t.popoverContentEl=e}},t.handleClosePopover=function(e){var n=t.props.popoverProps,a=void 0===n?{}:n;oe.Utils.safeInvoke(a.onClose,e),t.setState({isOpen:!1})},t.handleDateChange=function(e,n,a){void 0===a&&(a=!1);var r=t.state.value,o=!n||!t.props.closeOnSelection||null!=r&&(t.hasMonthChanged(r,e)||t.hasTimeChanged(r,e)),s=!!a;if(void 0===t.props.value){var i=se(e,t.props);t.setState({isInputFocused:s,isOpen:o,value:e,valueString:i})}else t.setState({isInputFocused:s,isOpen:o});oe.Utils.safeInvoke(t.props.onChange,e)},t.handleInputFocus=function(e){var n=null==t.state.value?"":t.formatDate(t.state.value);t.setState({isInputFocused:!0,isOpen:!0,valueString:n}),t.safeInvokeInputProp("onFocus",e)},t.handleInputClick=function(e){e.stopPropagation(),t.safeInvokeInputProp("onClick",e)},t.handleInputChange=function(e){var n=e.target.value,a=t.parseDate(n);x(a)&&t.isDateInRange(a)?(void 0===t.props.value?t.setState({value:a,valueString:n}):t.setState({valueString:n}),oe.Utils.safeInvoke(t.props.onChange,a)):(0===n.length&&oe.Utils.safeInvoke(t.props.onChange,null),t.setState({valueString:n})),t.safeInvokeInputProp("onChange",e)},t.handleInputBlur=function(e){var n=t.state.valueString,a=t.parseDate(n);!(n.length>0&&n!==se(t.state.value,t.props))||x(a)&&t.isDateInRange(a)?0===n.length?t.setState({isInputFocused:!1,value:null,valueString:null}):t.setState({isInputFocused:!1}):(void 0===t.props.value?t.setState({isInputFocused:!1,value:a,valueString:null}):t.setState({isInputFocused:!1}),isNaN(a.valueOf())?oe.Utils.safeInvoke(t.props.onError,new Date(void 0)):t.isDateInRange(a)?oe.Utils.safeInvoke(t.props.onChange,a):oe.Utils.safeInvoke(t.props.onError,a)),t.registerPopoverBlurHandler(),t.safeInvokeInputProp("onBlur",e)},t.handleInputKeyDown=function(e){if(e.which===oe.Keys.ENTER){var n=t.parseDate(t.state.valueString);t.handleDateChange(n,!0,!0)}else e.which===oe.Keys.TAB&&e.shiftKey?t.setState({isOpen:!1}):e.which===oe.Keys.ESCAPE&&(t.setState({isOpen:!1}),t.inputEl.blur());t.safeInvokeInputProp("onKeyDown",e)},t.handlePopoverBlur=function(e){var n=e.relatedTarget;null!=n&&t.popoverContentEl.contains(n)?null!=n&&(t.unregisterPopoverBlurHandler(),t.lastElementInPopover=n,t.lastElementInPopover.addEventListener("blur",t.handlePopoverBlur)):t.handleClosePopover()},t.registerPopoverBlurHandler=function(){if(null!=t.popoverContentEl){var e=t.popoverContentEl.contains(document.activeElement)?document.activeElement:void 0;if(null==e){var n=t.popoverContentEl.querySelectorAll("input, [tabindex]:not([tabindex='-1'])"),a=n.length;a>0&&(e=n[a-1])}t.unregisterPopoverBlurHandler(),t.lastElementInPopover=e,t.lastElementInPopover.addEventListener("blur",t.handlePopoverBlur)}},t.unregisterPopoverBlurHandler=function(){null!=t.lastElementInPopover&&t.lastElementInPopover.removeEventListener("blur",t.handlePopoverBlur)},t}return ee(t,e),t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this),this.unregisterPopoverBlurHandler()},t.prototype.render=function(){var e=this,t=this.state,n=t.value,a=t.valueString,r=this.state.isInputFocused?a:se(n,this.props),o=x(n)?n:null,s=te({},this.props.dayPickerProps,{onMonthChange:function(t){oe.Utils.safeInvoke(e.props.dayPickerProps.onMonthChange,t),e.setTimeout(e.registerPopoverBlurHandler)}}),i=void 0===this.props.timePrecision?re.createElement(Te,te({},this.props,{dayPickerProps:s,onChange:this.handleDateChange,value:o})):re.createElement(je,{canClearSelection:this.props.canClearSelection,onChange:this.handleDateChange,value:n,datePickerProps:this.props,timePickerProps:te({},this.props.timePickerProps,{precision:this.props.timePrecision})}),l=re.createElement("div",{ref:this.refHandlers.popoverContent},i),u=this.props.popoverProps,p=void 0===u?{}:u,c=this.getInputPropsWithDefaults(),d=!(null==n||x(n)&&this.isDateInRange(n));return re.createElement(oe.Popover,te({isOpen:this.state.isOpen&&!this.props.disabled,usePortal:!1},p,{autoFocus:!1,className:ae()(p.className,this.props.className),content:l,enforceFocus:!1,onClose:this.handleClosePopover,popoverClassName:ae()("pt-dateinput-popover",p.popoverClassName)}),re.createElement(oe.InputGroup,te({autoComplete:"off",intent:d?oe.Intent.DANGER:oe.Intent.NONE,placeholder:this.props.placeholder,rightElement:this.props.rightElement},c,{disabled:this.props.disabled,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onClick:this.handleInputClick,onFocus:this.handleInputFocus,onKeyDown:this.handleInputKeyDown,type:"text",value:r})))},t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),t.value!==this.props.value&&this.setState({value:t.value})},t.prototype.getInputPropsWithDefaults=function(){var e=this,t=this.props.inputProps,n=void 0===t?{}:t;return oe.Utils.isFunction(n.inputRef)?te({},n,{inputRef:function(t){e.refHandlers.input(t),n.inputRef(t)}}):te({},n,{inputRef:this.refHandlers.input})},t.prototype.isDateInRange=function(e){return H(e,[this.props.minDate,this.props.maxDate])},t.prototype.hasMonthChanged=function(e,t){return null==e!=(null==t)||t.getMonth()!==e.getMonth()},t.prototype.hasTimeChanged=function(e,t){return null!=this.props.timePrecision&&(null==e!=(null==t)||t.getHours()!==e.getHours()||t.getMinutes()!==e.getMinutes()||t.getSeconds()!==e.getSeconds()||t.getMilliseconds()!==e.getMilliseconds())},t.prototype.safeInvokeInputProp=function(e,t){var n=this.props.inputProps,a=void 0===n?{}:n;oe.Utils.safeInvoke(a[e],t)},t.prototype.parseDate=function(e){if(e===this.props.outOfRangeMessage||e===this.props.invalidDateMessage)return null;var t=this.props,n=t.locale,a=(0,t.parseDate)(e,n);return!1===a?new Date(void 0):a},t.prototype.formatDate=function(e){if(!x(e)||!this.isDateInRange(e))return"";var t=this.props,n=t.locale;return(0,t.formatDate)(e,n)},t.displayName="Blueprint2.DateInput",t.defaultProps={closeOnSelection:!0,dayPickerProps:{},disabled:!1,invalidDateMessage:"Invalid date",maxDate:Ee(),minDate:Ce(),outOfRangeMessage:"Out of range",reverseMonthAndYearMenus:!1,timePickerProps:{}},t}(oe.AbstractPureComponent),$e=function(){function e(e,t){this.date=null!==e&&null!==t?new Date(t,e):new Date}return e.fromDate=function(t){return null==t?void 0:new e(t.getMonth(),t.getFullYear())},e.prototype.clone=function(){return new e(this.getMonth(),this.getYear())},e.prototype.getFullDate=function(){return this.date},e.prototype.getMonth=function(){return this.date.getMonth()},e.prototype.getYear=function(){return this.date.getFullYear()},e.prototype.getPreviousMonth=function(){var t=z(this.date);return new e(t.getMonth(),t.getFullYear())},e.prototype.getNextMonth=function(){var t=J(this.date);return new e(t.getMonth(),t.getFullYear())},e.prototype.isBefore=function(e){return Xe(this,e)<0},e.prototype.isAfter=function(e){return Xe(this,e)>0},e.prototype.isSame=function(e){return 0===Xe(this,e)},e}();function Xe(e,t){var n=e.getMonth(),a=e.getYear(),r=t.getMonth(),o=t.getYear();return a===o?n-r:a-o}var ze=function(){function e(){}return e.getNextState=function(e,t,n,a){return null!=a?this.getNextStateForBoundary(e,t,n,a):this.getDefaultNextState(e,t,n)},e.getNextStateForBoundary=function(e,t,n,a){var r,o,s=this.getBoundaryDate(a,e),i=this.getOtherBoundary(a),l=this.getBoundaryDate(i,e);if(null==s&&null==l)r=a,o=this.createRangeForBoundary(a,t,null);else if(null!=s&&null==l){var u=U(s,t)?null:t;r=a,o=this.createRangeForBoundary(a,u,null)}else if(null==s&&null!=l)if(U(t,l)){var p=void 0;n?(r=a,p=l):(r=i,p=null),o=this.createRangeForBoundary(a,p,p)}else this.isOverlappingOtherBoundary(a,t,l)?(r=i,o=this.createRangeForBoundary(a,l,t)):(r=a,o=this.createRangeForBoundary(a,t,l));else if(U(s,t)){var c=U(s,l)?null:l;r=a,o=this.createRangeForBoundary(a,null,c)}else if(U(t,l)){var d=n?[l,l]:[s,null];u=d[0],c=d[1];r=n?a:i,o=this.createRangeForBoundary(a,u,c)}else this.isOverlappingOtherBoundary(a,t,l)?(r=a,o=this.createRangeForBoundary(a,t,null)):(r=a,o=this.createRangeForBoundary(a,t,l));return{dateRange:o,boundary:r}},e.getDefaultNextState=function(e,t,n){var a,r=e[0],o=e[1];if(null==r&&null==o)a=[t,null];else if(null!=r&&null==o)a=this.createRange(t,r,n);else if(null==r&&null!=o)a=this.createRange(t,o,n);else{var s=U(r,t),i=U(o,t);a=s&&i?[null,null]:s?[null,o]:i?[r,null]:[t,null]}return{dateRange:a}},e.getOtherBoundary=function(e){return e===r.START?r.END:r.START},e.getBoundaryDate=function(e,t){return e===r.START?t[0]:t[1]},e.isOverlappingOtherBoundary=function(e,t,n){return e===r.START?t>n:t<n},e.createRangeForBoundary=function(e,t,n){return e===r.START?[t,n]:[n,t]},e.createRange=function(e,t,n){return!n&&U(e,t)?[null,null]:e<t?[e,t]:[t,e]},e}(),Je=r,Qe=function(e){function t(t,n){var a=e.call(this,t,n)||this;a.modifiers=((u={})[Ie]=function(e){var t=a.state.value;return null!=t[0]&&null!=t[1]&&H(e,t,!0)},u[Ie+"-start"]=function(e){return U(a.state.value[0],e)},u[Ie+"-end"]=function(e){return U(a.state.value[1],e)},u[Se]=function(e){var t=a.state,n=t.hoverValue,r=t.value,o=r[0],s=r[1];return(null!=o||null!=s)&&(null!=n&&null!=n[0]&&null!=n[1]&&H(e,n,!0))},u[Se+"-start"]=function(e){var t=a.state.hoverValue;return null!=t&&null!=t[0]&&U(t[0],e)},u[Se+"-end"]=function(e){var t=a.state.hoverValue;return null!=t&&null!=t[1]&&U(t[1],e)},u),a.disabledDays=function(e){return!H(e,[a.props.minDate,a.props.maxDate])},a.getDisabledDaysModifier=function(){var e=a.props.dayPickerProps.disabledDays;return e instanceof Array?[a.disabledDays].concat(e):[a.disabledDays,e]},a.renderSingleCaption=function(e){return re.createElement(ye,te({},e,{maxDate:a.props.maxDate,minDate:a.props.minDate,onMonthChange:a.handleLeftMonthSelectChange,onYearChange:a.handleLeftYearSelectChange,reverseMonthAndYearMenus:a.props.reverseMonthAndYearMenus}))},a.renderLeftCaption=function(e){return re.createElement(ye,te({},e,{maxDate:z(a.props.maxDate),minDate:a.props.minDate,onMonthChange:a.handleLeftMonthSelectChange,onYearChange:a.handleLeftYearSelectChange,reverseMonthAndYearMenus:a.props.reverseMonthAndYearMenus}))},a.renderRightCaption=function(e){return re.createElement(ye,te({},e,{maxDate:a.props.maxDate,minDate:J(a.props.minDate),onMonthChange:a.handleRightMonthSelectChange,onYearChange:a.handleRightYearSelectChange,reverseMonthAndYearMenus:a.props.reverseMonthAndYearMenus}))},a.handleDayMouseEnter=function(e,t,n){if(oe.Utils.safeInvoke(a.props.dayPickerProps.onDayMouseEnter,e,t,n),!t.disabled){var r=ze.getNextState(a.state.value,e,a.props.allowSingleDayRange,a.props.boundaryToModify),o=r.dateRange,s=r.boundary;a.setState({hoverValue:o}),oe.Utils.safeInvoke(a.props.onHoverChange,o,e,s)}},a.handleDayMouseLeave=function(e,t,n){oe.Utils.safeInvoke(a.props.dayPickerProps.onDayMouseLeave,e,t,n),t.disabled||(a.setState({hoverValue:void 0}),oe.Utils.safeInvoke(a.props.onHoverChange,void 0,e,void 0))},a.handleDayClick=function(e,t,n){if(oe.Utils.safeInvoke(a.props.dayPickerProps.onDayClick,e,t,n),t.disabled)a.forceUpdate();else{var r=ze.getNextState(a.state.value,e,a.props.allowSingleDayRange,a.props.boundaryToModify).dateRange;a.handleDayMouseEnter(e,t,n),a.handleNextState(r)}},a.handleLeftMonthChange=function(e){var t=new $e(e.getMonth(),e.getFullYear());oe.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate()),a.updateLeftView(t)},a.handleRightMonthChange=function(e){var t=new $e(e.getMonth(),e.getFullYear());oe.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate()),a.updateRightView(t)},a.handleLeftMonthSelectChange=function(e){var t=new $e(e,a.state.leftView.getYear());oe.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate()),a.updateLeftView(t)},a.handleRightMonthSelectChange=function(e){var t=new $e(e,a.state.rightView.getYear());oe.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate()),a.updateRightView(t)},a.handleLeftYearSelectChange=function(e){var t=new $e(a.state.leftView.getMonth(),e);oe.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate());var n=a.props,r=n.minDate,o=z(n.maxDate),s=new $e(r.getMonth(),r.getFullYear()),i=new $e(o.getMonth(),o.getFullYear());t.isBefore(s)?t=s:t.isAfter(i)&&(t=i);var l=a.state.rightView.clone();t.isBefore(l)||(l=t.getNextMonth()),a.setViews(t,l)},a.handleRightYearSelectChange=function(e){var t=new $e(a.state.rightView.getMonth(),e);oe.Utils.safeInvoke(a.props.dayPickerProps.onMonthChange,t.getFullDate());var n=a.props,r=n.minDate,o=n.maxDate,s=J(r),i=new $e(s.getMonth(),s.getFullYear()),l=new $e(o.getMonth(),o.getFullYear());t.isBefore(i)?t=i:t.isAfter(l)&&(t=l);var u=a.state.leftView.clone();t.isAfter(u)||(u=t.getPreviousMonth()),a.setViews(u,t)};var r,o=[null,null];null!=t.value?o=t.value:null!=t.defaultValue&&(o=t.defaultValue);var s=new Date;null!=t.initialMonth?r=t.initialMonth:null!=o[0]?r=Y(o[0]):null!=o[1]?V(r=Y(o[1]),t.minDate)||r.setMonth(r.getMonth()-1):r=H(s,[t.minDate,t.maxDate])?s:q([t.minDate,t.maxDate]);var i=V(r,t.minDate),l=V(r,t.maxDate);!i&&l&&r.setMonth(r.getMonth()-1);var u,p=$e.fromDate(r),c=o[1],d=t.contiguousCalendarMonths||null==c||V(r,c)?p.getNextMonth():$e.fromDate(c);return a.state={leftView:p,rightView:d,value:o,hoverValue:[null,null]},a}return ee(t,e),Object.defineProperty(t.prototype,"isControlled",{get:function(){return null!=this.props.value},enumerable:!0,configurable:!0}),t.prototype.render=function(){var e,t=function(e,t){var n=e;if(null!=t){n={};for(var a=0,r=Object.keys(t);a<r.length;a++){var o=r[a];-1===Me.indexOf(o)&&(n[o]=t[o])}for(var s=0,i=Object.keys(e);s<i.length;s++)n[o=i[s]]=e[o]}return n}(this.modifiers,this.props.modifiers),n=this.props,a=n.className,r=n.contiguousCalendarMonths,o=n.dayPickerProps,i=n.locale,l=n.localeUtils,u=n.maxDate,p=n.minDate,c=V(this.props.minDate,this.props.maxDate),d=this.state,h=d.leftView,f=d.rightView,g=this.getDisabledDaysModifier(),v=te({locale:i,localeUtils:l,modifiers:t,showOutsideDays:!0},o,{disabledDays:g,onDayClick:this.handleDayClick,onDayMouseEnter:this.handleDayMouseEnter,onDayMouseLeave:this.handleDayMouseLeave,selectedDays:this.state.value});if(r||c){var S=ae()(s,m,a,((e={})[D]=r,e[y]=c,e));return re.createElement("div",{className:S},this.maybeRenderShortcuts(),re.createElement(le.a,te({},v,{captionElement:this.renderSingleCaption,fromMonth:p,month:h.getFullDate(),numberOfMonths:c?1:2,onMonthChange:this.handleLeftMonthChange,toMonth:u})))}return re.createElement("div",{className:ae()(s,m,a)},this.maybeRenderShortcuts(),re.createElement(le.a,te({},v,{canChangeMonth:!0,captionElement:this.renderLeftCaption,fromMonth:p,month:h.getFullDate(),onMonthChange:this.handleLeftMonthChange,toMonth:z(u)})),re.createElement(le.a,te({},v,{canChangeMonth:!0,captionElement:this.renderRightCaption,fromMonth:J(p),month:f.getFullDate(),onMonthChange:this.handleRightMonthChange,toMonth:u})))},t.prototype.componentWillReceiveProps=function(t){if(e.prototype.componentWillReceiveProps.call(this,t),!function(e,t){if(null==e&&null==t)return!0;if(null==e||null==t)return!1;var n=e[0],a=e[1],r=t[0],o=t[1],s=null==n&&null==r||U(n,r),i=null==a&&null==o||U(a,o);return s&&i}(this.props.value,t.value)){var n=Ze(this.props.value,t.value,this.state,t.contiguousCalendarMonths);this.setState(n)}},t.prototype.validateProps=function(e){var t=e.defaultValue,n=e.initialMonth,a=e.maxDate,r=e.minDate,o=e.boundaryToModify,s=e.value,i=[r,a];if(null!=t&&!_(t,i))throw new Error(fe);if(null!=n&&!K(n,i))throw new Error(ge);if(null!=a&&null!=r&&a<r&&!U(a,r))throw new Error(ve);if(null!=s&&!_(s,i))throw new Error(me);if(null!=o&&o!==Je.START&&o!==Je.END)throw new Error("<DateRangePicker> preferredBoundaryToModify must be a valid DateRangeBoundary if defined.")},t.prototype.maybeRenderShortcuts=function(){var e=this,t=this.props.shortcuts;if(null!=t&&!1!==t){var n,a,r,o,s,i,l,u,p,c,d=("boolean"==typeof t?(n=this.props.allowSingleDayRange,a=new Date,o=(r=function(e){var t=Y(a);return e(t),t.setDate(t.getDate()+1),t})(function(e){return e.setDate(e.getDate()-2)}),s=r(function(e){return e.setDate(e.getDate()-7)}),i=r(function(e){return e.setMonth(e.getMonth()-1)}),l=r(function(e){return e.setMonth(e.getMonth()-3)}),u=r(function(e){return e.setMonth(e.getMonth()-6)}),p=r(function(e){return e.setFullYear(e.getFullYear()-1)}),c=r(function(e){return e.setFullYear(e.getFullYear()-2)}),(n?[et("Today",[a,a]),et("Yesterday",[o,o])]:[]).concat([et("Past week",[s,a]),et("Past month",[i,a]),et("Past 3 months",[l,a]),et("Past 6 months",[u,a]),et("Past year",[p,a]),et("Past 2 years",[c,a])])):t).map(function(t,n){return re.createElement(oe.MenuItem,{className:oe.Classes.POPOVER_DISMISS_OVERRIDE,disabled:!e.isShortcutInRange(t.dateRange),key:n,onClick:e.getShorcutClickHandler(t.dateRange),text:t.label})});return re.createElement(oe.Menu,{className:M},d)}},t.prototype.getShorcutClickHandler=function(e){var t=this;return function(){return t.handleNextState(e)}},t.prototype.handleNextState=function(e){var t=Ze(this.state.value,e,this.state,this.props.contiguousCalendarMonths);this.isControlled||this.setState(t),oe.Utils.safeInvoke(this.props.onChange,e)},t.prototype.updateLeftView=function(e){var t=this.state.rightView.clone();e.isBefore(t)||(t=e.getNextMonth()),this.setViews(e,t)},t.prototype.updateRightView=function(e){var t=this.state.leftView.clone();e.isAfter(t)||(t=e.getPreviousMonth()),this.setViews(t,e)},t.prototype.setViews=function(e,t){this.setState({leftView:e,rightView:t})},t.prototype.isShortcutInRange=function(e){return _(e,[this.props.minDate,this.props.maxDate])},t.defaultProps={allowSingleDayRange:!1,contiguousCalendarMonths:!0,dayPickerProps:{},maxDate:Ee(),minDate:Ce(),reverseMonthAndYearMenus:!1,shortcuts:!0},t.displayName="Blueprint2.DateRangePicker",t}(oe.AbstractPureComponent);function Ze(e,t,n,a){var r;if(null!=e&&null==t)r={value:[null,null]};else if(null!=t){var o=t[0],s=t[1],i=n.leftView.clone(),l=n.rightView.clone();if(null==o&&null!=s)(p=new $e(s.getMonth(),s.getFullYear())).isSame(i)||p.isSame(l)||(l=p,i.isBefore(l)||(i=l.getPreviousMonth()));else if(null!=o&&null==s){(u=new $e(o.getMonth(),o.getFullYear())).isSame(i)||u.isSame(l)||(i=u,l.isAfter(i)||(l=i.getNextMonth()))}else if(null!=o&&null!=s){var u=new $e(o.getMonth(),o.getFullYear()),p=new $e(s.getMonth(),s.getFullYear());if(V(o,s)){var c=i.isSame(u),d=l.isSame(u);c||d||(i=u,l=u.getNextMonth())}else i.isSame(u)||(i=u,l=u.getNextMonth()),!1!==a||l.isSame(p)||(l=p)}r={leftView:i,rightView:l,value:t}}else r={};return r}function et(e,t){return{dateRange:t,label:e}}var tt=function(e){function t(t,n){var a=e.call(this,t,n)||this;return a.refHandlers={endInputRef:function(e){a.endInputRef=e,oe.Utils.safeInvoke(a.props.endInputProps.inputRef,e)},startInputRef:function(e){a.startInputRef=e,oe.Utils.safeInvoke(a.props.startInputProps.inputRef,e)}},a.renderInputGroup=function(e){var t=a.getInputProps(e),n=e===r.START?a.handleStartInputEvent:a.handleEndInputEvent;return re.createElement(oe.InputGroup,te({autoComplete:"off"},t,{disabled:a.props.disabled,intent:a.isInputInErrorState(e)?oe.Intent.DANGER:t.intent,inputRef:a.getInputRef(e),onBlur:n,onChange:n,onClick:n,onFocus:n,onKeyDown:n,onMouseDown:n,placeholder:a.getInputPlaceholderString(e),value:a.getInputDisplayString(e)}))},a.handleDateRangePickerChange=function(e,t){if(void 0===t&&(t=!1),a.state.isOpen){var n,o,s,i,l=e[0],u=e[1],p=!0;null==l?(n=!0,o=!1,s=null):null==u?(n=!1,o=!0,i=null):a.props.closeOnSelection?(p=!1,n=!1,o=!!t):a.state.lastFocusedField===r.START?(n=!0,o=!1):(n=!1,o=!0);var c={endHoverString:i,endInputString:a.formatDate(u),isEndInputFocused:o,isOpen:p,isStartInputFocused:n,startHoverString:s,startInputString:a.formatDate(l),wasLastFocusChangeDueToHover:!1};a.isControlled()?a.setState(c):a.setState(te({},c,{selectedEnd:u,selectedStart:l})),oe.Utils.safeInvoke(a.props.onChange,e)}},a.handleDateRangePickerHoverChange=function(e,t,n){if(a.state.isOpen)if(null==e){var o=a.state.boundaryToModify===r.END;a.setState({endHoverString:null,isEndInputFocused:o,isStartInputFocused:!o,lastFocusedField:a.state.boundaryToModify,startHoverString:null})}else{var s=e[0],i=e[1],l=null!=n?n===r.START:a.state.isStartInputFocused;o=null!=n?n===r.END:a.state.isEndInputFocused;a.setState({endHoverString:a.formatDate(i),isEndInputFocused:o,isStartInputFocused:l,lastFocusedField:l?r.START:r.END,shouldSelectAfterUpdate:a.props.selectAllOnFocus,startHoverString:a.formatDate(s),wasLastFocusChangeDueToHover:!0})}},a.handleStartInputEvent=function(e){a.handleInputEvent(e,r.START)},a.handleEndInputEvent=function(e){a.handleInputEvent(e,r.END)},a.handleInputEvent=function(e,t){switch(e.type){case"blur":a.handleInputBlur(e,t);break;case"change":a.handleInputChange(e,t);break;case"click":a.handleInputClick(e);break;case"focus":a.handleInputFocus(e,t);break;case"keydown":a.handleInputKeyDown(e);break;case"mousedown":a.handleInputMouseDown()}var n=a.getInputProps(t),r=a.getInputGroupCallbackForEvent(e,n);oe.Utils.safeInvoke(r,e)},a.handleInputKeyDown=function(e){var t=e.which===oe.Keys.TAB,n=e.which===oe.Keys.ENTER,o=e.shiftKey,s=a.state,i=s.selectedStart,l=s.selectedEnd,u=a.state.lastFocusedField===r.START,p=a.state.lastFocusedField===r.END;if(t){var c=void 0,d=void 0,h=!0;u&&!o?(d=!1,c=!0,e.preventDefault()):p&&o?(d=!0,c=!1,e.preventDefault()):(d=!1,c=!1,h=!1),a.setState({isEndInputFocused:c,isOpen:h,isStartInputFocused:d,wasLastFocusChangeDueToHover:!1})}else if(u&&n){var f=a.parseDate(a.state.startInputString);a.handleDateRangePickerChange([f,l],!0)}else{if(!p||!n)return;var g=a.parseDate(a.state.endInputString);a.handleDateRangePickerChange([i,g],!0)}},a.handleInputMouseDown=function(){a.setState({wasLastFocusChangeDueToHover:!1})},a.handleInputClick=function(e){e.stopPropagation()},a.handleInputFocus=function(e,t){var n,r=a.getStateKeysAndValuesForBoundary(t),o=r.keys,s=se(r.values.selectedValue,a.props,!0),i=a.state.wasLastFocusChangeDueToHover?a.state.boundaryToModify:t;a.setState(((n={})[o.inputString]=s,n[o.isInputFocused]=!0,n.boundaryToModify=i,n.isOpen=!0,n.lastFocusedField=t,n.shouldSelectAfterUpdate=a.props.selectAllOnFocus,n.wasLastFocusChangeDueToHover=!1,n))},a.handleInputBlur=function(e,t){var n,r,o,s,i=a.getStateKeysAndValuesForBoundary(t),l=i.keys,u=i.values,p=a.parseDate(u.inputString),c=a.isControlled(),d=((n={})[l.isInputFocused]=!1,n.shouldSelectAfterUpdate=!1,n);a.isInputEmpty(u.inputString)?d=te({},d,c?((r={})[l.inputString]=se(u.controlledValue,a.props),r):((o={})[l.inputString]=null,o[l.selectedValue]=null,o)):a.isNextDateRangeValid(p,t)||(c||(d=te({},d,((s={})[l.inputString]=null,s[l.selectedValue]=p,s))),oe.Utils.safeInvoke(a.props.onError,a.getDateRangeForCallback(p,t))),a.setState(d)},a.handleInputChange=function(e,t){var n,r,o,s,i,l=e.target.value,u=a.getStateKeysAndValuesForBoundary(t).keys,p=a.parseDate(l),c=a.isControlled(),d={shouldSelectAfterUpdate:!1};if(0===l.length){var h=te({},d,((n={})[u.inputString]="",n));d=c?h:te({},h,((r={})[u.selectedValue]=null,r)),oe.Utils.safeInvoke(a.props.onChange,a.getDateRangeForCallback(null,t))}else if(a.isDateValidAndInRange(p)){h=te({},d,((o={})[u.hoverString]=null,o[u.inputString]=l,o));d=c?h:te({},h,((s={})[u.selectedValue]=p,s)),a.isNextDateRangeValid(p,t)&&oe.Utils.safeInvoke(a.props.onChange,a.getDateRangeForCallback(p,t))}else d=te({},d,((i={})[u.inputString]=l,i[u.hoverString]=null,i));a.setState(d)},a.handlePopoverClose=function(){a.setState({isOpen:!1}),oe.Utils.safeInvoke(a.props.popoverProps.onClose)},a.getInitialRange=function(e){void 0===e&&(e=a.props);var t=e.defaultValue,n=e.value;return null!=n?n:null!=t?t:[null,null]},a.getSelectedRange=function(){var e,t,n;return a.isControlled()?(e=(n=a.props.value)[0],t=n[1]):(e=a.state.selectedStart,t=a.state.selectedEnd),[e,a.doBoundaryDatesOverlap(e,r.START)?void 0:t].map(function(e){return a.isDateValidAndInRange(e)?e:void 0})},a.getInputGroupCallbackForEvent=function(e,t){switch(e.type){case"blur":return t.onBlur;case"change":return t.onChange;case"click":return t.onClick;case"focus":return t.onFocus;case"keydown":return t.onKeyDown;case"mousedown":return t.onMouseDown;default:return}},a.getInputDisplayString=function(e){var t=a.getStateKeysAndValuesForBoundary(e).values,n=t.isInputFocused,r=t.inputString,o=t.selectedValue,s=t.hoverString;return null!=s?s:n?null==r?"":r:null==o?"":a.doesEndBoundaryOverlapStartBoundary(o,e)?a.props.overlappingDatesMessage:se(o,a.props)},a.getInputPlaceholderString=function(e){var t=e===r.START,n=e===r.END,o=a.getInputProps(e),s=a.getStateKeysAndValuesForBoundary(e).values.isInputFocused;return null!=o.placeholder?o.placeholder:t?s?a.state.formattedMinDateString:"Start date":n?s?a.state.formattedMaxDateString:"End date":""},a.getInputProps=function(e){return e===r.START?a.props.startInputProps:a.props.endInputProps},a.getInputRef=function(e){return e===r.START?a.refHandlers.startInputRef:a.refHandlers.endInputRef},a.getStateKeysAndValuesForBoundary=function(e){var t=a.props.value;return e===r.START?{keys:{hoverString:"startHoverString",inputString:"startInputString",isInputFocused:"isStartInputFocused",selectedValue:"selectedStart"},values:{controlledValue:null!=t?t[0]:void 0,hoverString:a.state.startHoverString,inputString:a.state.startInputString,isInputFocused:a.state.isStartInputFocused,selectedValue:a.state.selectedStart}}:{keys:{hoverString:"endHoverString",inputString:"endInputString",isInputFocused:"isEndInputFocused",selectedValue:"selectedEnd"},values:{controlledValue:null!=t?t[1]:void 0,hoverString:a.state.endHoverString,inputString:a.state.endInputString,isInputFocused:a.state.isEndInputFocused,selectedValue:a.state.selectedEnd}}},a.getDateRangeForCallback=function(e,t){var n=a.getOtherBoundary(t),o=a.getStateKeysAndValuesForBoundary(n).values.selectedValue;return t===r.START?[e,o]:[o,e]},a.getOtherBoundary=function(e){return e===r.START?r.END:r.START},a.doBoundaryDatesOverlap=function(e,t){var n=a.props.allowSingleDayRange,o=a.getOtherBoundary(t),s=a.getStateKeysAndValuesForBoundary(o).values.selectedValue;return null!=e&&null!=s&&(t===r.START?le.a.DateUtils.isDayAfter(e,s)||!n&&le.a.DateUtils.isSameDay(e,s):le.a.DateUtils.isDayBefore(e,s)||!n&&le.a.DateUtils.isSameDay(e,s))},a.doesEndBoundaryOverlapStartBoundary=function(e,t){return t!==r.START&&a.doBoundaryDatesOverlap(e,t)},a.isControlled=function(){return void 0!==a.props.value},a.isInputEmpty=function(e){return null==e||0===e.length},a.isInputInErrorState=function(e){var t=a.getStateKeysAndValuesForBoundary(e).values,n=t.isInputFocused,r=t.hoverString,o=t.inputString,s=t.selectedValue;if(null!=r||a.isInputEmpty(o))return!1;var i=n?a.parseDate(o):s;return null!=i&&(!a.isDateValidAndInRange(i)||a.doesEndBoundaryOverlapStartBoundary(i,e))},a.isDateValidAndInRange=function(e){return x(e)&&H(e,[a.props.minDate,a.props.maxDate])},a.reset(t),a}return ee(t,e),t.prototype.reset=function(e){void 0===e&&(e=this.props);var t=this.getInitialRange(),n=t[0],a=t[1];this.state={formattedMaxDateString:this.getFormattedMinMaxDateString(e,"maxDate"),formattedMinDateString:this.getFormattedMinMaxDateString(e,"minDate"),isOpen:!1,selectedEnd:a,selectedStart:n}},t.prototype.componentDidUpdate=function(){var e=this.state,t=e.isStartInputFocused,n=e.isEndInputFocused,a=e.shouldSelectAfterUpdate,r=this.shouldFocusInputRef(t,this.startInputRef),o=this.shouldFocusInputRef(n,this.endInputRef);r?this.startInputRef.focus():o&&this.endInputRef.focus(),t&&a?this.startInputRef.select():n&&a&&this.endInputRef.select()},t.prototype.render=function(){var e=this.props.popoverProps,t=void 0===e?{}:e,n=re.createElement(Qe,te({},this.props,{boundaryToModify:this.state.boundaryToModify,onChange:this.handleDateRangePickerChange,onHoverChange:this.handleDateRangePickerHoverChange,value:this.getSelectedRange()})),a=ae()(t.className,this.props.className);return re.createElement(oe.Popover,te({isOpen:this.state.isOpen,position:oe.Position.BOTTOM_LEFT,usePortal:!1},this.props.popoverProps,{autoFocus:!1,className:a,content:n,enforceFocus:!1,onClose:this.handlePopoverClose}),re.createElement("div",{className:oe.Classes.CONTROL_GROUP},this.renderInputGroup(r.START),this.renderInputGroup(r.END)))},t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t);var n={};if(t.value!==this.props.value){var a=this.getInitialRange(t),r=a[0],o=a[1];n=te({},n,{selectedStart:r,selectedEnd:o})}if(t.minDate!==this.props.minDate){var s=this.getFormattedMinMaxDateString(t,"minDate");n=te({},n,{formattedMinDateString:s})}if(t.maxDate!==this.props.maxDate){var i=this.getFormattedMinMaxDateString(t,"maxDate");n=te({},n,{formattedMaxDateString:i})}this.setState(n)},t.prototype.validateProps=function(e){if(null===e.value)throw new Error("[Blueprint] <DateRangeInput> value cannot be null. Pass undefined to clear the value and operate in uncontrolled mode, or pass [null, null] to clear the value and continue operating in controlled mode.")},t.prototype.shouldFocusInputRef=function(e,t){return e&&void 0!==t&&document.activeElement!==t},t.prototype.isNextDateRangeValid=function(e,t){return this.isDateValidAndInRange(e)&&!this.doBoundaryDatesOverlap(e,t)},t.prototype.getFormattedMinMaxDateString=function(e,n){var a=e[n],r=t.defaultProps[n];return se(void 0===a?r:a,this.props)},t.prototype.parseDate=function(e){if(e===this.props.outOfRangeMessage||e===this.props.invalidDateMessage)return null;var t=this.props,n=t.locale,a=(0,t.parseDate)(e,n);return!1===a?new Date(void 0):a},t.prototype.formatDate=function(e){if(!this.isDateValidAndInRange(e))return"";var t=this.props,n=t.locale;return(0,t.formatDate)(e,n)},t.defaultProps={allowSingleDayRange:!1,closeOnSelection:!0,contiguousCalendarMonths:!0,dayPickerProps:{},disabled:!1,endInputProps:{},invalidDateMessage:"Invalid date",maxDate:Ee(),minDate:Ce(),outOfRangeMessage:"Out of range",overlappingDatesMessage:"Overlapping dates",popoverProps:{},selectAllOnFocus:!1,shortcuts:!0,startInputProps:{}},t.displayName="Blueprint2.DateRangeInput",t}(oe.AbstractPureComponent);n.d(t,"Classes",function(){return nt}),n.d(t,"DateRangeBoundary",function(){return r}),n.d(t,"DateInput",function(){return qe}),n.d(t,"DatePicker",function(){return Te}),n.d(t,"DateTimePicker",function(){return je}),n.d(t,"DateRangeInput",function(){return tt}),n.d(t,"DateRangePicker",function(){return Qe}),n.d(t,"TimePicker",function(){return Le}),n.d(t,"TimePickerPrecision",function(){return Ne});var nt=a}])});

@@ -29,1 +29,2 @@ export declare const DATEPICKER = "pt-datepicker";

export declare const TIMEPICKER_SECOND = "pt-timepicker-second";
export declare const TIMEPICKER_AMPM_SELECT = "pt-timepicker-ampm-select";

@@ -36,1 +36,2 @@ "use strict";

exports.TIMEPICKER_SECOND = "pt-timepicker-second";
exports.TIMEPICKER_AMPM_SELECT = "pt-timepicker-ampm-select";

@@ -33,1 +33,5 @@ export declare type DateRange = [Date | undefined, Date | undefined];

export declare function getDateNextMonth(date: Date): Date;
export declare function convert24HourMeridiem(hour: number, toPm: boolean): number;
export declare function getIsPmFrom24Hour(hour: number): boolean;
export declare function get12HourFrom24Hour(hour: number): number;
export declare function get24HourFrom12Hour(hour: number, isPm: boolean): number;

@@ -189,1 +189,31 @@ "use strict";

exports.getDateNextMonth = getDateNextMonth;
function convert24HourMeridiem(hour, toPm) {
if (hour < 0 || hour > 23) {
throw new Error("hour must be between [0,23] inclusive: got " + hour);
}
return toPm ? hour % 12 + 12 : hour % 12;
}
exports.convert24HourMeridiem = convert24HourMeridiem;
function getIsPmFrom24Hour(hour) {
if (hour < 0 || hour > 23) {
throw new Error("hour must be between [0,23] inclusive: got " + hour);
}
return hour >= 12;
}
exports.getIsPmFrom24Hour = getIsPmFrom24Hour;
function get12HourFrom24Hour(hour) {
if (hour < 0 || hour > 23) {
throw new Error("hour must be between [0,23] inclusive: got " + hour);
}
var newHour = hour % 12;
return newHour === 0 ? 12 : newHour;
}
exports.get12HourFrom24Hour = get12HourFrom24Hour;
function get24HourFrom12Hour(hour, isPm) {
if (hour < 1 || hour > 12) {
throw new Error("hour must be between [1,12] inclusive: got " + hour);
}
var newHour = hour === 12 ? 0 : hour;
return isPm ? newHour + 12 : newHour;
}
exports.get24HourFrom12Hour = get24HourFrom12Hour;
/** describes a component of time. `H:MM:SS.MS` */
export declare enum TimeUnit {
HOUR = "hour",
HOUR_24 = "24hour",
HOUR_12 = "12hour",
MINUTE = "minute",

@@ -11,3 +12,3 @@ SECOND = "second",

/** Sets the given time unit to the given time in date object. Modifies given `date` object and returns it. */
export declare function setTimeUnit(unit: TimeUnit, time: number, date: Date): Date;
export declare function setTimeUnit(unit: TimeUnit, time: number, date: Date, isPm: boolean): Date;
/** Returns true if `time` is a valid value */

@@ -14,0 +15,0 @@ export declare function isTimeUnitValid(unit: TimeUnit, time?: number): boolean;

"use strict";
/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
}
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var Classes = tslib_1.__importStar(require("./classes"));
var Classes = __importStar(require("./classes"));
var dateUtils_1 = require("./dateUtils");
/** describes a component of time. `H:MM:SS.MS` */
var TimeUnit;
(function (TimeUnit) {
TimeUnit["HOUR"] = "hour";
TimeUnit["HOUR_24"] = "24hour";
TimeUnit["HOUR_12"] = "12hour";
TimeUnit["MINUTE"] = "minute";

@@ -21,4 +29,6 @@ TimeUnit["SECOND"] = "second";

switch (unit) {
case TimeUnit.HOUR:
case TimeUnit.HOUR_24:
return date.getHours();
case TimeUnit.HOUR_12:
return dateUtils_1.get12HourFrom24Hour(date.getHours());
case TimeUnit.MINUTE:

@@ -36,7 +46,10 @@ return date.getMinutes();

/** Sets the given time unit to the given time in date object. Modifies given `date` object and returns it. */
function setTimeUnit(unit, time, date) {
function setTimeUnit(unit, time, date, isPm) {
switch (unit) {
case TimeUnit.HOUR:
case TimeUnit.HOUR_24:
date.setHours(time);
break;
case TimeUnit.HOUR_12:
date.setHours(dateUtils_1.get24HourFrom12Hour(time, isPm));
break;
case TimeUnit.MINUTE:

@@ -96,2 +109,3 @@ date.setMinutes(time);

var DEFAULT_MIN_HOUR = 0;
var MERIDIEM_MIN_HOUR = 1;
var DEFAULT_MIN_MINUTE = 0;

@@ -101,2 +115,3 @@ var DEFAULT_MIN_SECOND = 0;

var DEFAULT_MAX_HOUR = 23;
var MERIDIEM_MAX_HOUR = 12;
var DEFAULT_MAX_MINUTE = 59;

@@ -110,3 +125,3 @@ var DEFAULT_MAX_SECOND = 59;

var TimeUnitMetadata = (_a = {},
_a[TimeUnit.HOUR] = {
_a[TimeUnit.HOUR_24] = {
className: Classes.TIMEPICKER_HOUR,

@@ -116,2 +131,7 @@ max: DEFAULT_MAX_HOUR,

},
_a[TimeUnit.HOUR_12] = {
className: Classes.TIMEPICKER_HOUR,
max: MERIDIEM_MAX_HOUR,
min: MERIDIEM_MIN_HOUR,
},
_a[TimeUnit.MINUTE] = {

@@ -118,0 +138,0 @@ className: Classes.TIMEPICKER_MINUTE,

@@ -40,2 +40,7 @@ /// <reference types="react" />

/**
* Whether to use a 12 hour format with an AM/PM dropdown.
* @default false
*/
useAmPm?: boolean;
/**
* The latest time the user can select. The year, month, and day parts of the `Date` object are ignored.

@@ -68,2 +73,3 @@ * While the `maxTime` will be later than the `minTime` in the basic case,

value?: Date;
isPm?: boolean;
}

@@ -79,2 +85,3 @@ export declare class TimePicker extends React.Component<ITimePickerProps, ITimePickerState> {

private renderInput(className, unit, value);
private maybeRenderAmPm();
private getInputBlurHandler;

@@ -84,6 +91,7 @@ private getInputChangeHandler;

private handleFocus;
private handleAmPmChange;
/**
* Generates a full ITimePickerState object with all text fields set to formatted strings based on value
*/
private getFullStateFromValue(value);
private getFullStateFromValue(value, useAmPm);
private incrementTime;

@@ -90,0 +98,0 @@ private decrementTime;

@@ -37,3 +37,4 @@ "use strict";

switch (unit) {
case timeUnit_1.TimeUnit.HOUR:
case timeUnit_1.TimeUnit.HOUR_24:
case timeUnit_1.TimeUnit.HOUR_12:
case timeUnit_1.TimeUnit.MINUTE:

@@ -51,3 +52,4 @@ case timeUnit_1.TimeUnit.SECOND:

switch (unit) {
case timeUnit_1.TimeUnit.HOUR:
case timeUnit_1.TimeUnit.HOUR_24:
case timeUnit_1.TimeUnit.HOUR_12:
_this.updateState({ hourText: text });

@@ -84,13 +86,19 @@ break;

};
_this.handleAmPmChange = function (e) {
var isNextPm = e.currentTarget.value === "pm";
if (isNextPm !== _this.state.isPm) {
var hour_1 = DateUtils.convert24HourMeridiem(_this.state.value.getHours(), isNextPm);
_this.setState({ isPm: isNextPm }, function () { return _this.updateTime(hour_1, timeUnit_1.TimeUnit.HOUR_24); });
}
};
_this.incrementTime = function (unit) { return _this.shiftTime(unit, 1); };
_this.decrementTime = function (unit) { return _this.shiftTime(unit, -1); };
var value = props.minTime;
if (props.value != null) {
_this.state = _this.getFullStateFromValue(props.value);
value = props.value;
}
else if (props.defaultValue != null) {
_this.state = _this.getFullStateFromValue(props.defaultValue);
value = props.defaultValue;
}
else {
_this.state = _this.getFullStateFromValue(props.minTime);
}
_this.state = _this.getFullStateFromValue(value, props.useAmPm);
return _this;

@@ -101,2 +109,3 @@ }

var shouldRenderMilliseconds = this.props.precision >= TimePickerPrecision.MILLISECOND;
var hourUnit = this.props.useAmPm ? timeUnit_1.TimeUnit.HOUR_12 : timeUnit_1.TimeUnit.HOUR_24;
var classes = classnames_1.default(Classes.TIMEPICKER, this.props.className, (_a = {},

@@ -108,3 +117,3 @@ _a[core_1.Classes.DISABLED] = this.props.disabled,

React.createElement("div", { className: Classes.TIMEPICKER_ARROW_ROW },
this.maybeRenderArrowButton(true, timeUnit_1.TimeUnit.HOUR),
this.maybeRenderArrowButton(true, hourUnit),
this.maybeRenderArrowButton(true, timeUnit_1.TimeUnit.MINUTE),

@@ -114,3 +123,3 @@ shouldRenderSeconds && this.maybeRenderArrowButton(true, timeUnit_1.TimeUnit.SECOND),

React.createElement("div", { className: Classes.TIMEPICKER_INPUT_ROW },
this.renderInput(Classes.TIMEPICKER_HOUR, timeUnit_1.TimeUnit.HOUR, this.state.hourText),
this.renderInput(Classes.TIMEPICKER_HOUR, hourUnit, this.state.hourText),
this.renderDivider(),

@@ -124,4 +133,5 @@ this.renderInput(Classes.TIMEPICKER_MINUTE, timeUnit_1.TimeUnit.MINUTE, this.state.minuteText),

this.renderInput(Classes.TIMEPICKER_MILLISECOND, timeUnit_1.TimeUnit.MS, this.state.millisecondText)),
this.maybeRenderAmPm(),
React.createElement("div", { className: Classes.TIMEPICKER_ARROW_ROW },
this.maybeRenderArrowButton(false, timeUnit_1.TimeUnit.HOUR),
this.maybeRenderArrowButton(false, hourUnit),
this.maybeRenderArrowButton(false, timeUnit_1.TimeUnit.MINUTE),

@@ -137,9 +147,10 @@ shouldRenderSeconds && this.maybeRenderArrowButton(false, timeUnit_1.TimeUnit.SECOND),

var didBoundsChange = didMinTimeChange || didMaxTimeChange;
var value = this.state.value;
if (didBoundsChange) {
var timeInRange = DateUtils.getTimeInRange(this.state.value, nextProps.minTime, nextProps.maxTime);
this.setState(this.getFullStateFromValue(timeInRange));
value = DateUtils.getTimeInRange(this.state.value, nextProps.minTime, nextProps.maxTime);
}
if (nextProps.value != null && !DateUtils.areSameTime(nextProps.value, this.props.value)) {
this.setState(this.getFullStateFromValue(nextProps.value));
value = nextProps.value;
}
this.setState(this.getFullStateFromValue(value, nextProps.useAmPm));
};

@@ -164,2 +175,11 @@ // begin method definitions: rendering

};
TimePicker.prototype.maybeRenderAmPm = function () {
if (!this.props.useAmPm) {
return null;
}
return (React.createElement("div", { className: classnames_1.default(core_1.Classes.SELECT, Classes.TIMEPICKER_AMPM_SELECT) },
React.createElement("select", { value: this.state.isPm ? "pm" : "am", onChange: this.handleAmPmChange, disabled: this.props.disabled },
React.createElement("option", { value: "am" }, "AM"),
React.createElement("option", { value: "pm" }, "PM"))));
};
// begin method definitions: state modification

@@ -169,7 +189,8 @@ /**

*/
TimePicker.prototype.getFullStateFromValue = function (value) {
TimePicker.prototype.getFullStateFromValue = function (value, useAmPm) {
var timeInRange = DateUtils.getTimeInRange(value, this.props.minTime, this.props.maxTime);
var hourUnit = useAmPm ? timeUnit_1.TimeUnit.HOUR_12 : timeUnit_1.TimeUnit.HOUR_24;
/* tslint:disable:object-literal-sort-keys */
return {
hourText: formatTime(timeInRange.getHours(), timeUnit_1.TimeUnit.HOUR),
hourText: formatTime(timeInRange.getHours(), hourUnit),
minuteText: formatTime(timeInRange.getMinutes(), timeUnit_1.TimeUnit.MINUTE),

@@ -179,2 +200,3 @@ secondText: formatTime(timeInRange.getSeconds(), timeUnit_1.TimeUnit.SECOND),

value: timeInRange,
isPm: DateUtils.getIsPmFrom24Hour(timeInRange.getHours()),
};

@@ -193,3 +215,3 @@ /* tslint:enable:object-literal-sort-keys */

if (timeUnit_1.isTimeUnitValid(unit, time)) {
timeUnit_1.setTimeUnit(unit, time, newValue);
timeUnit_1.setTimeUnit(unit, time, newValue, this.state.isPm);
if (DateUtils.isTimeInRange(newValue, this.props.minTime, this.props.maxTime)) {

@@ -199,3 +221,3 @@ this.updateState({ value: newValue });

else if (!DateUtils.areSameTime(this.state.value, this.props.minTime)) {
this.updateState(this.getFullStateFromValue(newValue));
this.updateState(this.getFullStateFromValue(newValue, this.props.useAmPm));
}

@@ -205,3 +227,3 @@ }

// reset to last known good state
this.updateState(this.getFullStateFromValue(this.state.value));
this.updateState(this.getFullStateFromValue(this.state.value, this.props.useAmPm));
}

@@ -215,3 +237,3 @@ };

if (hasNewValue) {
newState = this.getFullStateFromValue(newState.value);
newState = this.getFullStateFromValue(newState.value, this.props.useAmPm);
}

@@ -224,3 +246,3 @@ this.setState(newState);

if (hasNewValue) {
this.setState(this.getFullStateFromValue(this.state.value));
this.setState(this.getFullStateFromValue(this.state.value, this.props.useAmPm));
}

@@ -245,2 +267,3 @@ else {

showArrowButtons: false,
useAmPm: false,
};

@@ -253,4 +276,6 @@ TimePicker.displayName = "Blueprint2.TimePicker";

switch (unit) {
case timeUnit_1.TimeUnit.HOUR:
case timeUnit_1.TimeUnit.HOUR_24:
return time.toString();
case timeUnit_1.TimeUnit.HOUR_12:
return DateUtils.get12HourFrom24Hour(time).toString();
case timeUnit_1.TimeUnit.MINUTE:

@@ -257,0 +282,0 @@ case timeUnit_1.TimeUnit.SECOND:

@@ -29,1 +29,2 @@ export declare const DATEPICKER = "pt-datepicker";

export declare const TIMEPICKER_SECOND = "pt-timepicker-second";
export declare const TIMEPICKER_AMPM_SELECT = "pt-timepicker-ampm-select";

@@ -34,1 +34,2 @@ /*

export var TIMEPICKER_SECOND = "pt-timepicker-second";
export var TIMEPICKER_AMPM_SELECT = "pt-timepicker-ampm-select";

@@ -33,1 +33,5 @@ export declare type DateRange = [Date | undefined, Date | undefined];

export declare function getDateNextMonth(date: Date): Date;
export declare function convert24HourMeridiem(hour: number, toPm: boolean): number;
export declare function getIsPmFrom24Hour(hour: number): boolean;
export declare function get12HourFrom24Hour(hour: number): number;
export declare function get24HourFrom12Hour(hour: number, isPm: boolean): number;

@@ -169,1 +169,27 @@ /*

}
export function convert24HourMeridiem(hour, toPm) {
if (hour < 0 || hour > 23) {
throw new Error("hour must be between [0,23] inclusive: got " + hour);
}
return toPm ? hour % 12 + 12 : hour % 12;
}
export function getIsPmFrom24Hour(hour) {
if (hour < 0 || hour > 23) {
throw new Error("hour must be between [0,23] inclusive: got " + hour);
}
return hour >= 12;
}
export function get12HourFrom24Hour(hour) {
if (hour < 0 || hour > 23) {
throw new Error("hour must be between [0,23] inclusive: got " + hour);
}
var newHour = hour % 12;
return newHour === 0 ? 12 : newHour;
}
export function get24HourFrom12Hour(hour, isPm) {
if (hour < 1 || hour > 12) {
throw new Error("hour must be between [1,12] inclusive: got " + hour);
}
var newHour = hour === 12 ? 0 : hour;
return isPm ? newHour + 12 : newHour;
}
/** describes a component of time. `H:MM:SS.MS` */
export declare enum TimeUnit {
HOUR = "hour",
HOUR_24 = "24hour",
HOUR_12 = "12hour",
MINUTE = "minute",

@@ -11,3 +12,3 @@ SECOND = "second",

/** Sets the given time unit to the given time in date object. Modifies given `date` object and returns it. */
export declare function setTimeUnit(unit: TimeUnit, time: number, date: Date): Date;
export declare function setTimeUnit(unit: TimeUnit, time: number, date: Date, isPm: boolean): Date;
/** Returns true if `time` is a valid value */

@@ -14,0 +15,0 @@ export declare function isTimeUnitValid(unit: TimeUnit, time?: number): boolean;

/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
import * as Classes from "./classes";
import { get12HourFrom24Hour, get24HourFrom12Hour } from "./dateUtils";
/** describes a component of time. `H:MM:SS.MS` */
export var TimeUnit;
(function (TimeUnit) {
TimeUnit["HOUR"] = "hour";
TimeUnit["HOUR_24"] = "24hour";
TimeUnit["HOUR_12"] = "12hour";
TimeUnit["MINUTE"] = "minute";

@@ -18,4 +20,6 @@ TimeUnit["SECOND"] = "second";

switch (unit) {
case TimeUnit.HOUR:
case TimeUnit.HOUR_24:
return date.getHours();
case TimeUnit.HOUR_12:
return get12HourFrom24Hour(date.getHours());
case TimeUnit.MINUTE:

@@ -32,7 +36,10 @@ return date.getMinutes();

/** Sets the given time unit to the given time in date object. Modifies given `date` object and returns it. */
export function setTimeUnit(unit, time, date) {
export function setTimeUnit(unit, time, date, isPm) {
switch (unit) {
case TimeUnit.HOUR:
case TimeUnit.HOUR_24:
date.setHours(time);
break;
case TimeUnit.HOUR_12:
date.setHours(get24HourFrom12Hour(time, isPm));
break;
case TimeUnit.MINUTE:

@@ -84,2 +91,3 @@ date.setMinutes(time);

var DEFAULT_MIN_HOUR = 0;
var MERIDIEM_MIN_HOUR = 1;
var DEFAULT_MIN_MINUTE = 0;

@@ -89,2 +97,3 @@ var DEFAULT_MIN_SECOND = 0;

var DEFAULT_MAX_HOUR = 23;
var MERIDIEM_MAX_HOUR = 12;
var DEFAULT_MAX_MINUTE = 59;

@@ -98,3 +107,3 @@ var DEFAULT_MAX_SECOND = 59;

var TimeUnitMetadata = (_a = {},
_a[TimeUnit.HOUR] = {
_a[TimeUnit.HOUR_24] = {
className: Classes.TIMEPICKER_HOUR,

@@ -104,2 +113,7 @@ max: DEFAULT_MAX_HOUR,

},
_a[TimeUnit.HOUR_12] = {
className: Classes.TIMEPICKER_HOUR,
max: MERIDIEM_MAX_HOUR,
min: MERIDIEM_MIN_HOUR,
},
_a[TimeUnit.MINUTE] = {

@@ -106,0 +120,0 @@ className: Classes.TIMEPICKER_MINUTE,

@@ -40,2 +40,7 @@ /// <reference types="react" />

/**
* Whether to use a 12 hour format with an AM/PM dropdown.
* @default false
*/
useAmPm?: boolean;
/**
* The latest time the user can select. The year, month, and day parts of the `Date` object are ignored.

@@ -68,2 +73,3 @@ * While the `maxTime` will be later than the `minTime` in the basic case,

value?: Date;
isPm?: boolean;
}

@@ -79,2 +85,3 @@ export declare class TimePicker extends React.Component<ITimePickerProps, ITimePickerState> {

private renderInput(className, unit, value);
private maybeRenderAmPm();
private getInputBlurHandler;

@@ -84,6 +91,7 @@ private getInputChangeHandler;

private handleFocus;
private handleAmPmChange;
/**
* Generates a full ITimePickerState object with all text fields set to formatted strings based on value
*/
private getFullStateFromValue(value);
private getFullStateFromValue(value, useAmPm);
private incrementTime;

@@ -90,0 +98,0 @@ private decrementTime;

@@ -35,3 +35,4 @@ /*

switch (unit) {
case TimeUnit.HOUR:
case TimeUnit.HOUR_24:
case TimeUnit.HOUR_12:
case TimeUnit.MINUTE:

@@ -49,3 +50,4 @@ case TimeUnit.SECOND:

switch (unit) {
case TimeUnit.HOUR:
case TimeUnit.HOUR_24:
case TimeUnit.HOUR_12:
_this.updateState({ hourText: text });

@@ -82,13 +84,19 @@ break;

};
_this.handleAmPmChange = function (e) {
var isNextPm = e.currentTarget.value === "pm";
if (isNextPm !== _this.state.isPm) {
var hour_1 = DateUtils.convert24HourMeridiem(_this.state.value.getHours(), isNextPm);
_this.setState({ isPm: isNextPm }, function () { return _this.updateTime(hour_1, TimeUnit.HOUR_24); });
}
};
_this.incrementTime = function (unit) { return _this.shiftTime(unit, 1); };
_this.decrementTime = function (unit) { return _this.shiftTime(unit, -1); };
var value = props.minTime;
if (props.value != null) {
_this.state = _this.getFullStateFromValue(props.value);
value = props.value;
}
else if (props.defaultValue != null) {
_this.state = _this.getFullStateFromValue(props.defaultValue);
value = props.defaultValue;
}
else {
_this.state = _this.getFullStateFromValue(props.minTime);
}
_this.state = _this.getFullStateFromValue(value, props.useAmPm);
return _this;

@@ -99,2 +107,3 @@ }

var shouldRenderMilliseconds = this.props.precision >= TimePickerPrecision.MILLISECOND;
var hourUnit = this.props.useAmPm ? TimeUnit.HOUR_12 : TimeUnit.HOUR_24;
var classes = classNames(Classes.TIMEPICKER, this.props.className, (_a = {},

@@ -106,3 +115,3 @@ _a[CoreClasses.DISABLED] = this.props.disabled,

React.createElement("div", { className: Classes.TIMEPICKER_ARROW_ROW },
this.maybeRenderArrowButton(true, TimeUnit.HOUR),
this.maybeRenderArrowButton(true, hourUnit),
this.maybeRenderArrowButton(true, TimeUnit.MINUTE),

@@ -112,3 +121,3 @@ shouldRenderSeconds && this.maybeRenderArrowButton(true, TimeUnit.SECOND),

React.createElement("div", { className: Classes.TIMEPICKER_INPUT_ROW },
this.renderInput(Classes.TIMEPICKER_HOUR, TimeUnit.HOUR, this.state.hourText),
this.renderInput(Classes.TIMEPICKER_HOUR, hourUnit, this.state.hourText),
this.renderDivider(),

@@ -122,4 +131,5 @@ this.renderInput(Classes.TIMEPICKER_MINUTE, TimeUnit.MINUTE, this.state.minuteText),

this.renderInput(Classes.TIMEPICKER_MILLISECOND, TimeUnit.MS, this.state.millisecondText)),
this.maybeRenderAmPm(),
React.createElement("div", { className: Classes.TIMEPICKER_ARROW_ROW },
this.maybeRenderArrowButton(false, TimeUnit.HOUR),
this.maybeRenderArrowButton(false, hourUnit),
this.maybeRenderArrowButton(false, TimeUnit.MINUTE),

@@ -135,9 +145,10 @@ shouldRenderSeconds && this.maybeRenderArrowButton(false, TimeUnit.SECOND),

var didBoundsChange = didMinTimeChange || didMaxTimeChange;
var value = this.state.value;
if (didBoundsChange) {
var timeInRange = DateUtils.getTimeInRange(this.state.value, nextProps.minTime, nextProps.maxTime);
this.setState(this.getFullStateFromValue(timeInRange));
value = DateUtils.getTimeInRange(this.state.value, nextProps.minTime, nextProps.maxTime);
}
if (nextProps.value != null && !DateUtils.areSameTime(nextProps.value, this.props.value)) {
this.setState(this.getFullStateFromValue(nextProps.value));
value = nextProps.value;
}
this.setState(this.getFullStateFromValue(value, nextProps.useAmPm));
};

@@ -162,2 +173,11 @@ // begin method definitions: rendering

};
TimePicker.prototype.maybeRenderAmPm = function () {
if (!this.props.useAmPm) {
return null;
}
return (React.createElement("div", { className: classNames(CoreClasses.SELECT, Classes.TIMEPICKER_AMPM_SELECT) },
React.createElement("select", { value: this.state.isPm ? "pm" : "am", onChange: this.handleAmPmChange, disabled: this.props.disabled },
React.createElement("option", { value: "am" }, "AM"),
React.createElement("option", { value: "pm" }, "PM"))));
};
// begin method definitions: state modification

@@ -167,7 +187,8 @@ /**

*/
TimePicker.prototype.getFullStateFromValue = function (value) {
TimePicker.prototype.getFullStateFromValue = function (value, useAmPm) {
var timeInRange = DateUtils.getTimeInRange(value, this.props.minTime, this.props.maxTime);
var hourUnit = useAmPm ? TimeUnit.HOUR_12 : TimeUnit.HOUR_24;
/* tslint:disable:object-literal-sort-keys */
return {
hourText: formatTime(timeInRange.getHours(), TimeUnit.HOUR),
hourText: formatTime(timeInRange.getHours(), hourUnit),
minuteText: formatTime(timeInRange.getMinutes(), TimeUnit.MINUTE),

@@ -177,2 +198,3 @@ secondText: formatTime(timeInRange.getSeconds(), TimeUnit.SECOND),

value: timeInRange,
isPm: DateUtils.getIsPmFrom24Hour(timeInRange.getHours()),
};

@@ -191,3 +213,3 @@ /* tslint:enable:object-literal-sort-keys */

if (isTimeUnitValid(unit, time)) {
setTimeUnit(unit, time, newValue);
setTimeUnit(unit, time, newValue, this.state.isPm);
if (DateUtils.isTimeInRange(newValue, this.props.minTime, this.props.maxTime)) {

@@ -197,3 +219,3 @@ this.updateState({ value: newValue });

else if (!DateUtils.areSameTime(this.state.value, this.props.minTime)) {
this.updateState(this.getFullStateFromValue(newValue));
this.updateState(this.getFullStateFromValue(newValue, this.props.useAmPm));
}

@@ -203,3 +225,3 @@ }

// reset to last known good state
this.updateState(this.getFullStateFromValue(this.state.value));
this.updateState(this.getFullStateFromValue(this.state.value, this.props.useAmPm));
}

@@ -213,3 +235,3 @@ };

if (hasNewValue) {
newState = this.getFullStateFromValue(newState.value);
newState = this.getFullStateFromValue(newState.value, this.props.useAmPm);
}

@@ -222,3 +244,3 @@ this.setState(newState);

if (hasNewValue) {
this.setState(this.getFullStateFromValue(this.state.value));
this.setState(this.getFullStateFromValue(this.state.value, this.props.useAmPm));
}

@@ -243,2 +265,3 @@ else {

showArrowButtons: false,
useAmPm: false,
};

@@ -251,4 +274,6 @@ TimePicker.displayName = "Blueprint2.TimePicker";

switch (unit) {
case TimeUnit.HOUR:
case TimeUnit.HOUR_24:
return time.toString();
case TimeUnit.HOUR_12:
return DateUtils.get12HourFrom24Hour(time).toString();
case TimeUnit.MINUTE:

@@ -255,0 +280,0 @@ case TimeUnit.SECOND:

{
"name": "@blueprintjs/datetime",
"version": "2.0.0-rc.3",
"version": "2.0.0-rc.4",
"description": "Components for interacting with dates and times",

@@ -20,2 +20,3 @@ "main": "lib/cjs/index.js",

"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "css-dist lib/css/*.css",
"dist:verify": "assert-package-layout",

@@ -34,3 +35,3 @@ "lint": "npm-run-all -p lint:stylelint lint:tslint",

"dependencies": {
"@blueprintjs/core": "^2.0.0-rc.3",
"@blueprintjs/core": "^2.0.0-rc.4",
"classnames": "^2.2",

@@ -37,0 +38,0 @@ "react-day-picker": "^7.0.7",

@@ -38,1 +38,2 @@ /*

export const TIMEPICKER_SECOND = "pt-timepicker-second";
export const TIMEPICKER_AMPM_SELECT = "pt-timepicker-ampm-select";

@@ -208,1 +208,31 @@ /*

}
export function convert24HourMeridiem(hour: number, toPm: boolean): number {
if (hour < 0 || hour > 23) {
throw new Error(`hour must be between [0,23] inclusive: got ${hour}`);
}
return toPm ? hour % 12 + 12 : hour % 12;
}
export function getIsPmFrom24Hour(hour: number): boolean {
if (hour < 0 || hour > 23) {
throw new Error(`hour must be between [0,23] inclusive: got ${hour}`);
}
return hour >= 12;
}
export function get12HourFrom24Hour(hour: number): number {
if (hour < 0 || hour > 23) {
throw new Error(`hour must be between [0,23] inclusive: got ${hour}`);
}
const newHour = hour % 12;
return newHour === 0 ? 12 : newHour;
}
export function get24HourFrom12Hour(hour: number, isPm: boolean): number {
if (hour < 1 || hour > 12) {
throw new Error(`hour must be between [1,12] inclusive: got ${hour}`);
}
const newHour = hour === 12 ? 0 : hour;
return isPm ? newHour + 12 : newHour;
}
/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
import * as Classes from "./classes";
import { get12HourFrom24Hour, get24HourFrom12Hour } from "./dateUtils";
/** describes a component of time. `H:MM:SS.MS` */
export enum TimeUnit {
HOUR = "hour",
HOUR_24 = "24hour",
HOUR_12 = "12hour",
MINUTE = "minute",

@@ -20,4 +22,6 @@ SECOND = "second",

switch (unit) {
case TimeUnit.HOUR:
case TimeUnit.HOUR_24:
return date.getHours();
case TimeUnit.HOUR_12:
return get12HourFrom24Hour(date.getHours());
case TimeUnit.MINUTE:

@@ -35,7 +39,10 @@ return date.getMinutes();

/** Sets the given time unit to the given time in date object. Modifies given `date` object and returns it. */
export function setTimeUnit(unit: TimeUnit, time: number, date: Date) {
export function setTimeUnit(unit: TimeUnit, time: number, date: Date, isPm: boolean) {
switch (unit) {
case TimeUnit.HOUR:
case TimeUnit.HOUR_24:
date.setHours(time);
break;
case TimeUnit.HOUR_12:
date.setHours(get24HourFrom12Hour(time, isPm));
break;
case TimeUnit.MINUTE:

@@ -101,2 +108,3 @@ date.setMinutes(time);

const DEFAULT_MIN_HOUR = 0;
const MERIDIEM_MIN_HOUR = 1;
const DEFAULT_MIN_MINUTE = 0;

@@ -107,2 +115,3 @@ const DEFAULT_MIN_SECOND = 0;

const DEFAULT_MAX_HOUR = 23;
const MERIDIEM_MAX_HOUR = 12;
const DEFAULT_MAX_MINUTE = 59;

@@ -117,3 +126,3 @@ const DEFAULT_MAX_SECOND = 59;

const TimeUnitMetadata: Record<TimeUnit, ITimeUnitMetadata> = {
[TimeUnit.HOUR]: {
[TimeUnit.HOUR_24]: {
className: Classes.TIMEPICKER_HOUR,

@@ -123,2 +132,7 @@ max: DEFAULT_MAX_HOUR,

},
[TimeUnit.HOUR_12]: {
className: Classes.TIMEPICKER_HOUR,
max: MERIDIEM_MAX_HOUR,
min: MERIDIEM_MIN_HOUR,
},
[TimeUnit.MINUTE]: {

@@ -125,0 +139,0 @@ className: Classes.TIMEPICKER_MINUTE,

@# Date input
The `DateInput` component is an [input group](#core/components/forms/input-group) that shows a [`DatePicker`](#datetime/datepicker) in a [`Popover`](#core/components/popover) on focus.
The `DateInput` component is an [input group](#core/components/forms/input-group) that shows a [`DatePicker`](#datetime/datepicker) in a [`Popover`](#core/components/popover) on focus. Use it in forms where the user must enter a date.
Use the `onChange` function to listen for changes to the selected date. Use `onError` to listen for
invalid entered dates.
Customize the date format with `formatDate` and `parseDate` callbacks.
Attach an `onChange` handler to listen for changes to the selected date.
Use `onError` to listen for invalid entered dates.
Control the selected date by setting the `value` prop, or use the component in uncontrolled mode and specify an initial date with `defaultValue`.
You can control the selected date by setting the `value` prop, or use the component in uncontrolled
mode and specify an initial date by setting `defaultValue`.
Use this component in forms where the user must enter a date.
@reactExample DateInputExample

@@ -22,2 +19,4 @@

The optional `locale` argument is the value of the `locale` prop.
A simple implementation using built-in browser methods could look like this:

@@ -65,3 +64,9 @@

<DateInput value={this.state.date} onChange={this.handleDateChange} />
<DateInput
formatDate={date => date.toLocaleString()}
onChange={this.handleDateChange}
parseDate={str => new Date(str)}
placeholder={"M/D/YYYY"}
value={this.state.date}
/>
```

@@ -68,0 +73,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc