var InputColorPicker=api.InputColorPicker=api.extendReactClass('MixinInput',{getInitialState:function(){return{value:this.props.value,chosen:false};},componentWillMount:function(){this.parent();this.loadingSpectrumTimer&&clearTimeout(this.loadingSpectrumTimer);this.loadingSpectrumTimer=setTimeout(function(){api.Ajax.loadStylesheet(api.urls.plugin+'/assets/vendors/spectrum/spectrum.css');api.Ajax.loadScript(api.urls.plugin+'/assets/vendors/spectrum/spectrum.js',this.forceUpdate.bind(this));}.bind(this),500);},render:function(){return React.createElement('div',{key:this.props.id||api.Text.toId(),className:'form-group color-picker '+(this.props.control['class']||this.props.control.className||'')},React.createElement('label',{className:this.props.control.labelClass||''},this.label,this.tooltip),React.createElement('div',{className:'input-group '+(this.props.control.inputClass||'')},React.createElement('input',{type:'text',name:this.props.setting,value:this.state.value!=''?this.state.value:'',onChange:this.change,className:'form-control'}),React.createElement('span',{className:'input-group-append px-0 py-0'},React.createElement('input',{ref:'field',type:'hidden',name:this.props.setting,value:this.state.value!='custom'?this.state.value:'',onChange:this.change,className:'input-group-text'}))));},initActions:function(){this.parent();if(this.refs.field&&jQuery.fn.spectrum!==undefined){if(this.refs.field.nextElementSibling&&this.refs.field.nextElementSibling.classList.contains('sp-replacer')){jQuery(this.refs.field).spectrum('destroy');if(this.refs.field.nextElementSibling&&this.refs.field.nextElementSibling.classList.contains('sp-replacer')){this.refs.field.nextElementSibling.parentNode.removeChild(this.refs.field.nextElementSibling);}}jQuery(this.refs.field).spectrum({color:this.refs.field.value,showInput:true,showInitial:true,allowEmpty:this.props.control.allowempty?this.props.control.allowempty:true,showAlpha:this.props.control.showalpha?this.props.control.showalpha:true,clickoutFiresChange:true,preferredFormat:this.props.control.format?this.props.control.format:'hex',change:function(picker){this.change(this.props.setting,picker?picker.getAlpha()==1?picker.toHexString():picker.toRgbString():'');}.bind(this)});}}});