!function(t,n,e){"use strict";var i,o={};var r=function(){if(i)return o;i=1;var t=n;return o.createRoot=t.createRoot,o.hydrateRoot=t.hydrateRoot,o}();function s(t){return!!("string"!=typeof t&&"number"!=typeof t||"string"==typeof t&&isNaN(parseFloat(t)))}function a(t,n,e){if(""===t)return"";if(s(t))return"";let i="string"==typeof t?parseFloat(t):t;return"number"==typeof n&&i<n&&(i=n),"number"==typeof e&&i>e&&(i=e),i}function c(t){if(""===t||null===t)return{number:"",unit:""};if(s(t))return{number:"",unit:""};let n=String(t).trim();const e=-1<n.indexOf("-")?"-":"";n=n.replace(e,"");const i=function(t){if(!t)return"";const n=String(t).match(/[a-z%]+$/i);return n?n[0]:""}(n);let o=i?n.replace(i,""):n;if(o=o.trim(),""===o)return{number:"",unit:i};const r=o.endsWith(".");o=e+o;const a=parseFloat(o);return isNaN(a)?{number:"",unit:i}:{number:a,unit:i,hasTrailingDotBeforeUnit:!(!i||!r)}}function u(t,n,e){const i=c(t);if(""===i.number)return i;return{number:a(i.number,n,e),unit:i.unit,hasTrailingDotBeforeUnit:i.hasTrailingDotBeforeUnit}}function l(t,n,e){let i=String(t).trim();if("-"===i)return"-";const o=i.endsWith(".");i=o?i.replace(".",""):i;const r=u(t,n,e);if(""===r.number)return o?"0.":"";let s=String(r.number);return o?s+".":r.unit?s+(r.hasTrailingDotBeforeUnit?".":"")+r.unit:s}function m(t,n,e){const i=u(t,n,e);return""===i.number?n:i.number}function f(t){return"string"==typeof t?t:t.toString()}function p(n){let i="";n.control.updateComponentState=t=>{"slider"===i?s(l(t,n.min,n.max)):"input"===i?c(m(t,n.min,n.max)):"reset"===i&&(c(""===t?n.min:t),s(t))};const o=e.useRef(null),r=e.useRef(null);function s(t){r&&r.current&&(r.current.value=f(t))}function c(t){o&&o.current&&(o.current.value=f(t))}const p=`wpbf-control-input-${n.customizerSetting?.id}`,d=m(n.value,n.min,n.max),b=l(n.value,n.min,n.max);return t.jsxs("div",{className:"wpbf-control-form",tabIndex:1,children:[n.label||n.description?t.jsxs("label",{className:"wpbf-control-label",htmlFor:p,children:[n.label&&t.jsx("span",{className:"customize-control-title",children:n.label}),n.description&&t.jsx("span",{className:"customize-control-description description",dangerouslySetInnerHTML:{__html:n.description}})]}):null,t.jsx("div",{className:"customize-control-notifications-container",ref:n.setNotificationContainer}),t.jsx("button",{type:"button",className:"wpbf-control-reset",onClick:function(t){let e="";e=""!==n.default&&void 0!==n.default?n.default:""!==n.value?n.value:"",i="reset",n.customizerSetting?.set(e)},children:t.jsx("i",{className:"dashicons dashicons-image-rotate"})}),t.jsxs("div",{className:"wpbf-control-cols",children:[t.jsx("div",{className:"wpbf-control-left-col",children:t.jsx("input",{ref:o,type:"range",id:p,defaultValue:d,min:n.min,max:n.max,step:n.step,className:"wpbf-control-input-slider wpbf-pro-control-input-slider",onChange:function(t){i="slider";const e=a(parseFloat(t.target.value),n.min,n.max);if(!r||!r.current)return;const o=u(r.current.value,n.min,n.max),s=String(e)+o.unit;n.customizerSetting?.set(s)}})}),t.jsx("div",{className:"wpbf-control-right-col",children:t.jsx("input",{ref:r,type:"text",defaultValue:b,className:"wpbf-control-input",onChange:function(t){i="input",n.customizerSetting?.set(l(t.target.value,n.min,n.max))}})})]})]})}const d=wp.customize.Control.extend({initialize:function(t,n){const e=this;e.setNotificationContainer=e.setNotificationContainer?.bind(e),wp.customize.Control.prototype.initialize.call(e,t,n),wp.customize.control.bind("removed",function t(n){e===n&&(e.destroy&&e.destroy(),e.container.remove(),wp.customize.control.unbind("removed",t))})},setNotificationContainer:function(t){this.notifications.container=jQuery(t),this.notifications.render()},renderContent:function(){const n=this,e=n.params;!this.root&&this.container&&(this.root=r.createRoot(this.container[0])),this.root?.render(t.jsx(p,{control:n,customizerSetting:n.setting??void 0,setNotificationContainer:n.setNotificationContainer,label:e.label,description:e.description,min:e.min,max:e.max,step:e.step,default:e.default,value:e.value})),n.params.allowCollapse&&n.container.addClass("allowCollapse")},ready:function(){const t=this;t.setting&&t.setting.bind(n=>{t.updateComponentState?.(n)})},updateComponentState:t=>{},destroy:function(){const t=this;this.root?.unmount(),this.root=void 0,wp.customize.Control.prototype.destroy&&wp.customize.Control.prototype.destroy.call(t)}});wp.customize.controlConstructor["wpbf-input-slider"]=d}(ReactJSXRuntime,ReactDOM,React);
