!function(t){formintorjs.define(["admin/settings/toggle-container","text!tpl/fields.html"],function(e,i){return e.extend({multiple:!1,events:{"click .wpmudev-add-product":"add_option","click .wpmudev-action--kill":"delete_option","change .wpmudev-product-select":"update_value"},className:"wpmudev-option forminator-field-wrap-listproduct",get_field_html:function(){var e=this.get_values_html();return Forminator.Utils.template(t(i).find("#settings-field-product-list-tpl").html())({childs:e})},get_values_html:function(){var t=this.get_saved_value()||[];return _.map(t,this.get_value_html,this).join("")},get_value_html:function(e,a){var l=(this.get_saved_value(),this.layout.get("wrappers")||[]),s=Forminator.Utils.get_products(l);return Forminator.Utils.template(t(i).find("#settings-field-product-list-row-tpl").html())({row:e,index:a,products:s})},on_render:function(){Forminator.Utils.init_select2()},update_value:function(e){var i=t(e.target).closest(".wpmudev-productList--item").data("index"),a=t(e.target).val(),l=this.get_saved_value()||[];l[i].value=a,this.save_value(l),this.trigger("updated",l)},add_option:function(t){var e=this.get_saved_value()||[];e.push({value:""}),this.save_value(e),this.trigger("updated",e),this.render()},delete_option:function(e){var i=t(e.target).closest(".wpmudev-list--item").data("index"),a=this.get_saved_value()||[];a.splice(i,1),this.save_value(a),this.trigger("updated",a),this.render()}})})}(jQuery);