(()=>{"use strict";const{InputData:t,ReactiveHook:e}=JetFormBuilderAbstract;function n(){t.call(this),this.isSupported=function(t){return"switch"===t?.role},this.addListeners=function(){const[t]=this.nodes;t.addEventListener("input",t=>{this.value.current=t.target.checked}),t.addEventListener("blur",t=>{this.reportOnBlur()}),this.enterKey=new e,t.addEventListener("keydown",this.handleEnterKey.bind(this)),this.sanitize(function(e){return Boolean(e)?t.value:""})},this.setValue=function(){const[t]=this.nodes;this.value.current=t.checked?t.value:null},this.setNode=function(e){t.prototype.setNode.call(this,e),this.inputType="switcher"}}n.prototype=Object.create(t.prototype);const i=n,{BaseSignal:s}=JetFormBuilderAbstract;function r(){s.call(this),this.isSupported=function(t,e){return"switch"===t.role},this.runSignal=function(){var t;const[e]=this.input.nodes;this.input.calcValue=0,e.checked=this.input.value.current===e.value,e.checked&&(this.input.calcValue+=parseFloat(null!==(t=e.dataset?.calculate)&&void 0!==t?t:e.value))}}r.prototype=Object.create(s.prototype);const u=r,{addFilter:c}=JetPlugins.hooks;c("jet.fb.inputs","jet-form-builder/switcher",function(t){return[i,...t]}),c("jet.fb.signals","jet-form-builder/switcher",function(t){return[u,...t]})})();