"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[334],{3334:function(e,t,i){i.r(t),i.d(t,{default:function(){return c}});var o=i(15671),n=i(43144),r=i(60136),l=i(29388),a=i(47313),u=i(46332),s=i(55645),m=i(64243),p=i(46417),f=function(e){(0,r.Z)(i,e);var t=(0,l.Z)(i);function i(){var e;(0,o.Z)(this,i);for(var n=arguments.length,r=new Array(n),l=0;l<n;l++)r[l]=arguments[l];return(e=t.call.apply(t,[this].concat(r))).formClearHelper=new u.Kz,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((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onColorClose=function(t){e.setState({value:t},(function(){return e.commitWidgetValue({fromUi:!0})}))},e}return(0,n.Z)(i,[{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,t=this.props,i=t.element,o=t.width,n=t.disabled,r=t.widgetMgr,l=this.state.value;return this.formClearHelper.manageFormClearListener(r,i.formId,this.onFormCleared),(0,p.jsx)(s.Z,{label:i.label,labelVisibility:(0,m.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),help:i.help,onChange:this.onColorClose,disabled:n,width:o,value:l})}}]),i}(a.PureComponent),c=f}}]);