(this["webpackJsonpstreamlit-browser"]=this["webpackJsonpstreamlit-browser"]||[]).push([[44],{6735:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return f}));var r=n(33),a=n(16),i=n(17),o=n(35),s=n(36),l=n(0),u=n(6681),c=n(227),p=n(156),m=n(157),d=n(80),h=n(5),f=function(e){Object(o.a)(n,e);var t=Object(s.a)(n);function n(){var e;Object(a.a)(this,n);for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return(e=t.call.apply(t,[this].concat(o))).formClearHelper=new c.b,e.state={value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setStringValue(e.props.element,e.state.value,t)},e.onFormCleared=function(){e.setState({value:e.props.element.default},(function(){return e.commitWidgetValue({fromUi:!0})}))},e.handleChange=function(t){var n=e.dateToString(t);e.setState({value:n},(function(){return e.commitWidgetValue({fromUi:!0})}))},e.stringToDate=function(e){var t=e.split(":").map(Number),n=Object(r.a)(t,2),a=n[0],i=n[1],o=new Date;return o.setHours(a),o.setMinutes(i),o},e.dateToString=function(e){var t=e.getHours().toString().padStart(2,"0"),n=e.getMinutes().toString().padStart(2,"0");return"".concat(t,":").concat(n)},e}return Object(i.a)(n,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e=this.props,t=e.disabled,n=e.width,r=e.element,a=e.widgetMgr,i={width:n},o={Select:{props:{disabled:t}}};return this.formClearHelper.manageFormClearListener(a,r.formId,this.onFormCleared),Object(h.jsxs)("div",{className:"stTimeInput",style:i,children:[Object(h.jsx)(p.d,{label:r.label,disabled:t,children:r.help&&Object(h.jsx)(p.b,{children:Object(h.jsx)(m.a,{content:r.help,placement:d.b.TOP_RIGHT})})}),Object(h.jsx)(u.a,{format:"24",value:this.stringToDate(this.state.value),onChange:this.handleChange,overrides:o,creatable:!0})]})}}]),n}(l.PureComponent)}}]);