!function(){var e={};e=React;var t=t=>{let{control:n,customizerSetting:r,choices:a}=t,i="",o=e=>(""!=e&&(e<a.min&&(e=a.min),e>a.max&&(e=a.max)),e),l=e=>{let t=(e="string"!=typeof e?e.toString():e).replace(/\d+/g,""),n=e.replace(t,"");return{number:n=o(n=""!=n?parseFloat(n.trim()):""),unit:t}},c=e=>{let t=l(e);return t.number+t.unit},s=e=>l(e).number;n.updateComponentState=e=>{"slider"===i?v.current.value=c(e):"input"===i?d.current.value=s(e):"reset"===i&&(v.current.value=e,d.current.value=e)};let u=`kirki-control-input-${r.id}`,m=s(t.value),p=c(t.value),d=(0,e.useRef)(null),v=(0,e.useRef)(null);return React.createElement("div",{className:"kirki-control-form",tabIndex:"1"},React.createElement("label",{className:"kirki-control-label",htmlFor:u},React.createElement("span",{className:"customize-control-title"},t.label),React.createElement("span",{className:"customize-control-description description",dangerouslySetInnerHTML:{__html:t.description}})),React.createElement("div",{className:"customize-control-notifications-container",ref:t.setNotificationContainer}),React.createElement("button",{type:"button",className:"kirki-control-reset",onClick:e=>{""!==t.default&&void 0!==t.default?(d.current.value=t.default,v.current.value=t.default):""!==t.value?(d.current.value=t.value,v.current.value=t.value):(d.current.value=a.min,v.current.value=""),i="reset",r.set(d.current.value)}},React.createElement("i",{className:"dashicons dashicons-image-rotate"})),React.createElement("div",{className:"kirki-control-cols"},React.createElement("div",{className:"kirki-control-left-col"},React.createElement("input",{ref:d,type:"range",id:u,defaultValue:m,min:a.min,max:a.max,step:a.step,className:"kirki-control-input-slider kirki-pro-control-input-slider",onChange:e=>{i="slider";let t=parseFloat(e.target.value),n=(t=o(t))+l(v.current.value).unit;r.set(n)}})),React.createElement("div",{className:"kirki-control-right-col"},React.createElement("input",{ref:v,type:"text",defaultValue:p,className:"kirki-control-input",onChange:e=>{i="input",r.set(c(e.target.value))},onKeyDown:e=>{if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t=s(v.current.value),n=a.step||1,c=t;"ArrowUp"===e.key?c=t+n:"ArrowDown"===e.key&&(c=t-n);let u=(c=o(c))+l(v.current.value).unit;v.current.value=u,d.current.value=c,i="input",r.set(u)}}}))))};function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}let r=wp.customize.Control.extend({initialize:function(e,t){let n=this;n.setNotificationContainer=n.setNotificationContainer.bind(n),wp.customize.Control.prototype.initialize.call(n,e,t),wp.customize.control.bind("removed",function e(t){n===t&&(n.destroy(),n.container.remove(),wp.customize.control.unbind("removed",e))})},setNotificationContainer:function(e){this.notifications.container=jQuery(e),this.notifications.render()},renderContent:function(){ReactDOM.render(React.createElement(t,n({},this.params,{control:this,customizerSetting:this.setting,setNotificationContainer:this.setNotificationCotainer,value:this.params.value})),this.container[0]),!1!==this.params.choices.allowCollapse&&this.container.addClass("allowCollapse")},ready:function(){let e=this;e.setting.bind(t=>{e.updateComponentState(t)})},updateComponentState:e=>{},destroy:function(){ReactDOM.unmountComponentAtNode(this.container[0]),wp.customize.Control.prototype.destroy&&wp.customize.Control.prototype.destroy.call(this)}});wp.customize.controlConstructor["kirki-input-slider"]=r}();
//# sourceMappingURL=control.js.map
