(()=>{"use strict";const{InputData:t,ReactiveHook:e}=JetFormBuilderAbstract;function i(){function i(t){return Array.isArray(t)?(1===t.length&&t[0]&&t[0].includes(",")&&(t=t[0].split(",")),t):[t].filter(Boolean)}t.call(this),this.isSupported=function(t){return"select-multiple"===t?.type},this.addListeners=function(){this.sanitize((t=>Array.isArray(t)?t:[t])),this.sanitize(i);const[t]=this.nodes;t.addEventListener("change",(()=>this.setValue())),t.addEventListener("blur",(()=>this.reportOnBlur())),this.enterKey=new e,t.addEventListener("keydown",this.handleEnterKey.bind(this))},this.setValue=function(){this.value.current=this.getActiveValue()},this.getActiveValue=function(){const[t]=this.nodes;return Array.from(t.options).filter((t=>t.selected)).map((t=>t.value))},this.onClear=function(){this.silenceSet([])}}i.prototype=Object.create(t.prototype);const n=i,{BaseSignal:s}=JetFormBuilderAbstract;function r(){s.call(this),this.isSupported=function(t,e){return["select-multiple","select-one"].includes(t?.type)},this.runSignal=function(){const[t]=this.input.nodes,e="select-one"!==t?.type,{value:i}=this.input;for(const s of t.options){var n;s.selected=e?i.current?.includes(s.value):s.value===i.current,s.selected&&(this.input.calcValue=0,this.input.calcValue+=parseFloat(null!==(n=s.dataset?.calculate)&&void 0!==n?n:s.value))}this.triggerJQuery(t)}}r.prototype=Object.create(s.prototype);const l=r,{addFilter:u}=JetPlugins.hooks;window.JetFormBuilderAbstract={...window.JetFormBuilderAbstract,MultiSelectData:n,SignalSelect:l},u("jet.fb.inputs","jet-form-builder/select-field",(function(t){return[n,...t]})),u("jet.fb.signals","jet-form-builder/select-field",(function(t){return[l,...t]}))})();