jQuery(window).on("load",(function(){var e=window.elementor.modules.controls.BaseData.extend({onReady:function(){var e=this.getControlValue();this.initFieldsData(e)},ui:function(){return{fieldsContainer:"#plan-fields-sorted-container",hiddenInput:'input[data-setting="select_field_sorted_fields"]',checkboxSwitcher:'input[class="display_field"]',customTextInput:'input[data-setting="custom_text_tag_input"]',separatorTextInput:'input[data-setting="select_field_separator_text"]',priceCheckbox:'input[data-setting="display_price"]',currencyCheckbox:'input[data-setting="display_currency"]',frequencyCheckbox:'input[data-setting="display_frequency"]',setupPriceCheckbox:'input[data-setting="display_setup_price"]'}},initFieldsData:function(e){let t=e.customText,i=e.separatorText,n=e.sorted;var r=this;jQuery(this.ui.customTextInput).val(t),jQuery(this.ui.separatorTextInput).val(i),jQuery(this.ui.fieldsContainer).empty(),n.split(",").forEach((function(e){var t={id:"",label:""};switch(e){case"select_field_plan_name":t={id:e,label:"Plan name"};break;case"select_field_plan_price_currency":t={id:e,label:"Currency"},jQuery(r.ui.currencyCheckbox).prop("checked",!0);break;case"select_field_plan_price":t={id:e,label:"Price"},jQuery(r.ui.priceCheckbox).prop("checked",!0);break;case"select_field_frequency":t={id:e,label:"Frequency"},jQuery(r.ui.frequencyCheckbox).prop("checked",!0);break;case"select_field_setup_price":t={id:e,label:"First payment amount"},jQuery(r.ui.setupPriceCheckbox).prop("checked",!0);break;case"select_field_custom_text":t={id:e,label:"Custom text"};break;case"select_field_custom_text_3":t={id:e,label:"Custom text 3"};break;case"select_field_separator_text":t={id:e,label:"Custom text 2"}}r.addElement(t)})),this.prepareSortedField()},prepareSortedField:function(){this.ui.fieldsContainer.sortable(),this.ui.fieldsContainer.disableSelection(),this.ui.hiddenInput.change()},events:function(){return{"sortout @ui.fieldsContainer":"onSortEnd","change @ui.hiddenInput":"onHiddenChange","change @ui.checkboxSwitcher":"onChangeSwitcher","keyup @ui.customTextInput":"onChangeCustomText","keyup @ui.separatorTextInput":"onChangeSeparatorText"}},onChangeSeparatorText:function(e){var t=jQuery(e.currentTarget).val();t.length<=0?this.deleteElement({id:"select_field_separator_text"}):this.addElement({id:"select_field_separator_text",label:"Custom Text 2"}),jQuery(this.ui.fieldsContainer).sortable("refresh");var i=jQuery(this.ui.fieldsContainer).sortable("toArray");this.ui.hiddenInput.val(i.toString());var n={...this.getControlValue(),sorted:i.toString(),separatorText:t};this.setValue(n)},onChangeCustomText:function(e){var t=jQuery(e.currentTarget).val();t.length<=0?this.deleteElement({id:"select_field_custom_text"}):this.addElement({id:"select_field_custom_text",label:"Custom text"}),jQuery(this.ui.fieldsContainer).sortable("refresh");var i=jQuery(this.ui.fieldsContainer).sortable("toArray");this.ui.hiddenInput.val(i.toString());var n={...this.getControlValue(),sorted:i.toString(),customText:t};this.setValue(n)},prepareCheckbox:function(e){jQuery('input[data-setting="'+e+'"]').prop("checked",!0)},onChangeSwitcher:function(e){var t=jQuery(e.currentTarget).prop("checked"),i={id:jQuery(e.currentTarget).attr("data-fieldId"),label:jQuery(e.currentTarget).attr("data-fieldLabel")};t?this.addElement(i):this.deleteElement(i),this.ui.hiddenInput.change()},deleteElement:function(e){jQuery("#"+e.id).remove(),this.ui.hiddenInput.change()},addElement:function(e){var t=jQuery('<div id="'+e.id+'"class="ui-state-default">'+e.label+"</div>");jQuery("#plan-fields-sorted-container").find("#"+e.id).length<=0&&jQuery(this.ui.fieldsContainer).append(t)},onSortEnd:function(e){var t=this.ui.fieldsContainer.sortable("toArray");this.ui.hiddenInput.val(t.toString()),this.ui.hiddenInput.change()},onHiddenChange:function(){var e=this.getControlValue(),t=this.ui.fieldsContainer.sortable("toArray");e={...e,sorted:t.toString()},this.setValue(e)},onBeforeDestroy:function(){}});window.elementor.addControlView("pricing_selector_data",e)}));