!function($){"use strict";$.WS_Form=function(e){$.WS_Form.this=this,this.is_admin=this.set_is_admin(),this.user_roles=ws_form_settings.user_roles,this.form_interface=!1,this.group_data_cache=[],this.group_index=0,this.section_data_cache=[],this.field_data_cache=[],this.action_data_cache=[],this.validation_message_cache=[],this.invalid_feedback_cache=[],this.object_cache=[],this.object_cache.condition=[],this.object_cache.then=[],this.object_cache.else=[],this.action=!1,this.object_data_scratch=!1,this.form_history=[],this.history_index=0,this.framework_id=!1,this.framework=!1,this.framework_fields=!1,this.column_resize_obj=!1,this.column_size_value=0,this.column_size_value_old=0,this.offset_value=0,this.offset_value_old=0,this.dragged_field=null,this.dragged_field_in_section=null,this.dragged_section=null,this.dragged_section_in_group=null,this.dragging=!1,this.next_sibling_id_old=null,this.section_id_old=null,this.group_id_old=null,this.section_repeatable_dragged=!1,this.section_repeatable_indexes={},this.checksum=!1,this.checksum_setTimeout=!1,this.published_checksum="",this.recaptchas=[],this.recaptchas_v2_default=[],this.recaptchas_v2_invisible=[],this.recaptchas_v3_default=[],this.recaptchas_conditions=[],this.timeout_recaptcha=3e4,this.hcaptchas=[],this.hcaptchas_default=[],this.hcaptchas_invisible=[],this.hcaptchas_conditions=[],this.timeout_hcaptcha=3e4,this.turnstiles=[],this.turnstiles_default=[],this.turnstiles_conditions=[],this.timeout_turnstile=3e4,this.form_events_reset=[],this.keydown=[],this.timeout_interval=100,this.api_call_queue=[],this.api_call_queue_running=!1,this.number_to_word=["nought","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty"],this.label_old="",this.submit=!1,this.action_js=[],this.form_draft=!1,this.submit_auto_populate=!1,this.form_id_prefix="wsf-",this.field_name_prefix=ws_form_settings.field_prefix,this.meta_key_options_cache=[],this.options_action_objects=[],this.options_action_cache=[],this.sidebar_conditions=[],this.sidebar_expanded_obj=!1,this.sidebar_lock_count=0,this.touch_device="ontouchend"in document,this.hash="",this.token="",this.token_validated=!1,this.form_post_locked=!1,this.form_post_lock_start=0,this.form_post_lock_duration_max=1e3,this.form_loader_showing=!1,this.form_loader_show_start=0,this.form_loader_show_duration_max=this.form_post_lock_duration_max,this.form_loader_timeout_id=!1,this.field_required_bypass=[],this.form_valid=!1,this.form_valid_old=null,this.form_validation_real_time_hooks=[],this.form_action_custom=!1,this.form_ajax=!0,this.object_focus=!1,this.field_type_click_drag_check=!1,this.section_id_click_drag_check=!1,this.password_strength_status=0,this.cascade_cache=[],this.select_ajax_cache=[],this.preview_window=void 0,this.file_frame=!1,this.file_frame_input_obj=!1,this.api_call_handle=[],this.visual_builder=!1,this.form_bypass_enabled=!1,this.action_js_process_validation_focus=!0,this.action_ga=!1,this.form_stat_add_lock=!1,this.form_geo_cache=!1,this.form_geo_cache_request=!1,this.form_geo_stack=[]},$.WS_Form.prototype.render=function(e){var t=this;void 0===e&&this.error("error_attributes"),void 0===e.obj&&this.error("error_attributes_obj"),void 0===e.form_id&&this.error("error_attributes_form_id"),this.form_canvas_obj=e.obj instanceof $?e.obj:$(e.obj),this.form_obj_id=this.form_canvas_obj.attr("id"),this.form_id=parseInt(e.form_id,10),0!==this.form_id&&(this.form_instance_id=parseInt(this.form_canvas_obj.attr("data-instance-id"),10),0!==this.form_instance_id&&(this.form_id_prefix=this.is_admin?"wsf-":"wsf-"+this.form_instance_id+"-",this.form_id_prefix_function=this.is_admin?"wsf_":"wsf_"+this.form_instance_id+"_",this.form_obj=this.form_canvas_obj.closest("form"),this.form_obj.length?this.form_obj.attr("novalidate",""):this.form_obj=this.form_canvas_obj,this.form_obj[0]!=this.form_canvas_obj[0]&&(this.form_obj.hasClass("wsf-form")||this.form_obj.addClass("wsf-form"),this.form_canvas_obj.hasClass("wsf-form")&&this.form_canvas_obj.removeClass("wsf-form")),this.form_canvas_obj.html(""),this.get_configuration(function(){t.get_form(function(){t.init()})})))},$.WS_Form.configured=!1,$.WS_Form.css_rendered=!1,$.WS_Form.settings_plugin,$.WS_Form.settings_form=null,$.WS_Form.frameworks,$.WS_Form.parse_variables,$.WS_Form.parse_variable_help,$.WS_Form.parse_variable_repairable,$.WS_Form.actions,$.WS_Form.field_types,$.WS_Form.field_type_cache=[],$.WS_Form.file_types,$.WS_Form.meta_keys,$.WS_Form.meta_keys_required_setting=[],$.WS_Form.breakpoints,$.WS_Form.data_sources,$.WS_Form.templates_section,$.WS_Form.prototype.get_configuration=function(e,t,a){if(void 0===t&&(t=!1),void 0===a&&(a=!1),this.options_action_cache=[],a||this.loader_on(),!$.WS_Form.configured||t)if("undefined"==typeof wsf_form_json_config){var r=this;this.api_call("config","GET",!1,function(t){r.set_configuration(t.data),window.wsf_form_json_config=t.data,"function"==typeof e&&e()},!1,a)}else this.set_configuration(wsf_form_json_config),"function"==typeof e&&e();else"function"==typeof e&&e()},$.WS_Form.prototype.set_configuration=function(e){$.WS_Form.settings_plugin=e.settings_plugin,$.WS_Form.settings_form=e.settings_form,$.WS_Form.frameworks=e.frameworks,$.WS_Form.field_types=e.field_types,$.WS_Form.file_types=e.file_types,$.WS_Form.meta_keys=e.meta_keys,$.WS_Form.parse_variables=e.parse_variables,$.WS_Form.parse_variables_repairable=e.parse_variables_repairable,$.WS_Form.parse_variable_help=e.parse_variable_help,$.WS_Form.actions=e.actions,$.WS_Form.data_sources=e.data_sources,$.WS_Form.templates_section=e.templates_section,this.field_type_cache_build(),$.WS_Form.configured=!0},$.WS_Form.prototype.get_form=function(e){if(0==this.form_id)return this.error("error_form_id"),void this.loader_off();if($("#"+this.form_obj_id).attr("data-id",this.form_id),"undefined"==typeof wsf_form_json||void 0===wsf_form_json[this.form_id]){var t=this;this.api_call("form/"+this.form_id+"/full","GET",!1,function(a){t.form=a.form,void 0===window.wsf_form_json&&(window.wsf_form_json=[]),window.wsf_form_json[t.form_id]=a.form,t.data_cache_build(),"function"==typeof e&&e(),t.loader_off()})}else this.form=wsf_form_json[this.form_id],this.data_cache_build(),"function"==typeof e&&e(),this.loader_off()},$.WS_Form.prototype.form_build=function(){if(this.timer_start=new Date,this.form_canvas_obj.children().not(".wsf-loader").remove(),this.form_canvas_obj.append(this.get_form_html(this.form)),!this.is_admin){var e=this.get_object_meta_value(this.form,"class_form_wrapper","");if(""!=e){var t=this.form_canvas_obj.attr("class");t+=" "+e.trim(),this.form_canvas_obj.attr("class",t)}}this.form_render(),this.timer_duration=new Date-this.timer_start},$.WS_Form.prototype.get_framework=function(){var e=this.is_admin?"ws-form":$.WS_Form.settings_plugin.framework;return $.WS_Form.frameworks.types[e]},$.WS_Form.prototype.get_form_html=function(e){if(void 0===e)return"";if(void 0===e.groups)return"";var t=this.get_framework().form[this.is_admin?"admin":"public"],a=this.esc_html(e.label);if(!this.is_admin&&"on"==this.get_object_meta_value(e,"label_render","on"))var r=this.is_admin?"":this.get_object_meta_value(this.form,"label_mask_form",""),i=""!=r?r:void 0!==t.mask_label?t.mask_label:"",s={label:a},_=this.mask_parse(i,s);else _="";var o=this.get_tabs_html(e);o+=this.get_groups_html(e.groups);i=t.mask_single,s={form:o,id:this.form_id_prefix+"tabs",label:_};return this.comment_html("Form: "+a)+this.mask_parse(i,s)+this.comment_html("Form: "+a,!0)},$.WS_Form.prototype.get_tabs_html=function(e){if(void 0===e.groups)return"";var t=e.groups,a=Object.keys(t).length;if(1==a&&!this.is_admin)return"";var r="",i=this.get_framework().tabs[this.is_admin?"admin":"public"],s=this.get_object_meta_value(this.form,"cookie_tab_index")?this.cookie_get("tab_index",0):0;if(a>1||this.is_admin){for(var _ in t)if(t.hasOwnProperty(_)){var o=t[_];r+=this.get_tab_html(o,_,s==_)}var l="";if(!this.is_admin)this.get_object_meta_value(e,"tabs_hide",!1)&&(l+=' style="display: none;"');var n=["wsf-group-tabs"];if(!this.is_admin){var c=this.get_object_meta_value(e,"class_tabs_wrapper",!1);""!=c&&n.push(c.trim())}var d=i.mask_wrapper,p={attributes:l,class:n.join(" "),tabs:r,id:this.form_id_prefix+"tabs"};return this.comment_html(this.language("comment_group_tabs"))+this.mask_parse(d,p)+this.comment_html(this.language("comment_group_tabs"),!0)}return""},$.WS_Form.prototype.get_tab_html=function(e,t,a){void 0===t&&(t=0),void 0===a&&(a=!1);var r=this.get_framework().tabs[this.is_admin?"admin":"public"],i=this.esc_html(e.label),s="";!this.is_admin&&"on"==this.get_object_meta_value(e,"hidden","")&&(s=' style="display: none;" data-wsf-group-hidden');var _=r.mask_single,o={attributes:s,data_id:e.id,href:"#"+this.form_id_prefix+"group-"+e.id,label:i};return a&&void 0!==r.active?o.active=r.active:o.active="",this.mask_parse(_,o)},$.WS_Form.prototype.get_groups_html=function(e){if(void 0===e)return"";var t=Object.keys(e).length,a=this.get_framework().groups[this.is_admin?"admin":"public"],r=this.get_object_meta_value(this.form,"cookie_tab_index")?this.cookie_get("tab_index",0):0,i="",s=this.is_admin||t>1,_=0;for(var o in e)if(e.hasOwnProperty(o)){var l=e[o];i+=this.get_group_html(l,o==r,s,_++)}var n=s?a.mask_wrapper:"#groups",c={class:["wsf-groups"].join(" "),column_count:$.WS_Form.settings_plugin.framework_column_count,groups:i,id:this.form_id_prefix+"tabs"};return(s?this.comment_html(this.language("comment_groups")):"")+this.mask_parse(n,c)+(s?this.comment_html(this.language("comment_groups"),!0):"")},$.WS_Form.prototype.get_group_html=function(e,t,a,r){void 0===t&&(t=!1),void 0===a&&(a=!0);var i=this.get_framework().groups[this.is_admin?"admin":"public"],s=this.esc_html(e.id),_=this.esc_html(e.label);if(!this.is_admin&&"on"==this.get_object_meta_value(e,"label_render","on"))var o=this.is_admin?"":this.get_object_meta_value(this.form,"label_mask_group",""),l=""!=o?o:void 0!==i.mask_label?i.mask_label:"",n={label:_},c=this.mask_parse(l,n);else c="";var d,p=this.get_sections_html(e),f=[];(void 0!==i.class&&f.push(i.class),this.is_admin)||(""!=(d=this.get_object_meta_value(this.form,"class_group_wrapper",""))&&f.push(d.trim()),""!=(d=this.get_object_meta_value(e,"class_group_wrapper",""))&&f.push(d.trim()));t&&void 0!==i.class_active&&f.push(i.class_active);var u=[];this.is_admin||!this.is_admin&&"on"==this.get_object_meta_value(e,"hidden","")&&u.push("data-wsf-group-hidden");l=a?i.mask_single:"#group",n={attributes:(u.length>0?" ":"")+u.join(" "),class:f.join(" "),column_count:$.WS_Form.settings_plugin.framework_column_count,data_id:e.id,data_group_index:r,group:p,id:this.form_id_prefix+"group-"+s,label:c};return(a?this.comment_html(this.language("comment_group")+": "+_):"")+this.mask_parse(l,n)+(a?this.comment_html(this.language("comment_group")+": "+_,!0):"")},$.WS_Form.prototype.get_sections_html=function(e){var t="",a=this.get_framework().sections[this.is_admin?"admin":"public"],r=(e.id,e.sections),i={};if("object"==typeof this.submit?void 0!==this.submit.section_repeatable&&(i=this.submit.section_repeatable):!1!==this.submit_auto_populate&&void 0!==this.submit_auto_populate.section_repeatable&&(i=this.submit_auto_populate.section_repeatable),void 0===r)return"";for(var s in r)if(r.hasOwnProperty(s)){var _=r[s],o="section_"+_.id,l=!1!==i&&void 0!==i[o]&&void 0!==i[o].index?i[o].index:[!1];for(var n in l)if(l.hasOwnProperty(n)){var c=l[n];t+=this.get_section_html(_,c)}}var d=a.mask_wrapper,p={class:"wsf-sections",column_count:$.WS_Form.settings_plugin.framework_column_count,data_id:e.id,sections:t,id:this.form_id_prefix+"sections-"+e.id};return this.comment_html(this.language("comment_sections"))+this.mask_parse(d,p)+this.comment_html(this.language("comment_sections"),!0)},$.WS_Form.prototype.get_section_html=function(e,t){void 0===t&&(t=!1);var a=!1;if(!this.is_admin&&((a="on"==this.get_object_meta_value(e,"section_repeatable",""))&&!1===t)){t=0;do{t++}while($("#"+this.form_id_prefix+"section-"+e.id+"-repeat-"+t).length)}var r=[],i=this.get_framework().sections[this.is_admin?"admin":"public"],s=this.column_class_array(e);if(a&&!this.is_admin&&(r.push("data-repeatable"),r.push('data-repeatable-index="'+this.esc_attr(t)+'"')),void 0!==i.class_single&&(s=s.concat(i.class_single)),!this.is_admin){var _;""!=(_=this.get_object_meta_value(this.form,"class_section_wrapper",""))&&s.push(_.trim()),""!=(_=this.get_object_meta_value(e,"class_section_wrapper",""))&&s.push(_.trim());var o=this.get_object_meta_value(e,"class_single_vertical_align","");if(o){var l=this.get_field_value_fallback(!1,!1,"class_single_vertical_align");void 0!==l[o]&&s.push(l[o])}var n=this.get_object_meta_value(e,"validate_inline","");if(""!=n){var c=void 0!==this.framework.fields.public.class_form_validated?this.framework.fields.public.class_form_validated:[];switch(n){case"on":this.is_iterable(c)?s.push(...c):s.push(c);break;case"change_blur":r.push('data-wsf-section-validated-class="'+c.join(" ")+'"')}}var d=this.get_object_meta_value(this.form,"conversational",!1),p=this.get_object_meta_value(e,"conversational_full_height_section",!1);d&&p&&s.push("wsf-form-conversational-section-full-height")}var f=this.esc_html(e.label);if(this.is_admin||"on"==this.get_object_meta_value(e,"label_render","on"))var u=this.is_admin?"":this.get_object_meta_value(this.form,"label_mask_section",""),h=""!=u?u:void 0!==i.mask_label?i.mask_label:"",m={label:f},v=this.mask_parse(h,m);else v="";this.is_admin||("on"==this.get_object_meta_value(e,"disabled_section","")&&r.push('disabled aria-disabled="true"'),"on"==this.get_object_meta_value(e,"hidden_section","")&&r.push('style="display: none;" aria-live="polite" aria-hidden="true"'));var b=this.get_fields_html(e,t);h=i.mask_single,m={attributes:(r.length>0?" ":"")+r.join(" "),class:s.join(" "),column_count:$.WS_Form.settings_plugin.framework_column_count,data_id:e.id,id:this.form_id_prefix+"section-"+e.id+(t?"-repeat-"+t:""),label:v,section:b,section_id:$.WS_Form.settings_plugin.helper_section_id?''+this.language("id")+": "+e.id+"":""};return this.comment_html(this.language("comment_section")+": "+f)+this.mask_parse(h,m)+this.comment_html(this.language("comment_section")+": "+f,!0)},$.WS_Form.prototype.get_fields_html=function(e,t){var a="on"==this.get_object_meta_value(e,"section_repeatable","");void 0===t&&(t=!!a&&0);var r="",i=this.get_framework().fields[this.is_admin?"admin":"public"],s=(e.id,e.fields),_=this.esc_html(e.label);if(!this.is_admin&&"on"==this.get_object_meta_value(e,"label_render","on"))var o=this.is_admin?"":this.get_object_meta_value(this.form,"label_mask_section",""),l=""!=o?o:void 0!==i.mask_wrapper_label?i.mask_wrapper_label:"",n={label:_},c=this.mask_parse(l,n);else c="";if(void 0===s)return"";for(var d in s)if(s.hasOwnProperty(d)){var p=s[d];r+=this.get_field_html(p,t)}l=i.mask_wrapper,n={column_count:$.WS_Form.settings_plugin.framework_column_count,data_id:e.id,fields:r,id:this.form_id_prefix+"fields-"+e.id,label:c};return this.comment_html(this.language("comment_fields"))+this.mask_parse(l,n)+this.comment_html(this.language("comment_fields"),!0)},$.WS_Form.prototype.value_populate_process=function(e,t){if(null===e)return"";switch(t.type){case"datetime":return"function"==typeof this.get_date_by_type?this.get_date_by_type(e,t):"";case"select":case"checkbox":case"radio":case"price_select":case"price_checkbox":case"price_radio":return Array.isArray(e)?e.map(function(e){return e?e.toString():""}):e;case"quantity":var a=$.WS_Form.settings_plugin.price_decimal_separator;return"."!==a&&-1!==e.indexOf(a)&&(e=this.get_number(e)),e;default:return this.esc_html(e)}},$.WS_Form.prototype.get_field_html=function(e,t){void 0===t&&(t=!1);var a=[];!1!==t&&a.push('data-repeatable-index="'+this.esc_attr(t)+'"');var r=this.get_framework().fields[this.is_admin?"admin":"public"];this.is_admin||"on"==this.get_object_meta_value(e,"hidden","")&&a.push('style="display: none;" aria-live="polite" aria-hidden="true"');var i=this.column_class_array(e),s=this.get_object_meta_value(e,"sub_type",!1);""==s&&(s=!1);var _=this.get_field_value_fallback(e.type,!1,"class_single",!1,r,s);if(!1!==_&&(i=i.concat(_)),!this.is_admin){var o;""!=(o=this.get_object_meta_value(this.form,"class_field_wrapper",""))&&i.push(o.trim()),""!=(o=this.get_object_meta_value(e,"class_field_wrapper",""))&&i.push(o.trim());var l=this.get_object_meta_value(e,"class_single_vertical_align","");if(l){var n=this.get_field_value_fallback(e.type,!1,"class_single_vertical_align",!1,r,s);void 0!==n[l]&&i.push(n[l])}var c=this.get_object_meta_value(e,"validate_inline","");if(""!=c){var d=void 0!==this.framework.fields.public.class_form_validated?this.framework.fields.public.class_form_validated:[];switch(c){case"on":this.is_iterable(d)?i.push(...d):i.push(d);break;case"change_blur":a.push('data-wsf-field-validated-class="'+d.join(" ")+'"')}}}var p=!1!==t?"_"+t:"",f=ws_form_settings.field_prefix+e.id+p;if("object"==typeof this.submit){if(void 0!==this.submit.meta&&void 0!==this.submit.meta[f]&&void 0!==this.submit.meta[f].value&&null!==this.submit.meta[f].value){var u=this.submit.meta[f].value;u=this.value_populate_process(u,e)}}else if(!1!==this.submit_auto_populate&&void 0!==this.submit_auto_populate.data&&void 0!==this.submit_auto_populate.data[f]&&null!==this.submit_auto_populate.data[f]){u=this.submit_auto_populate.data[f];u=this.value_populate_process(u,e)}var h=this.is_admin?"":this.get_field_html_single(e,u,!1,t),m=this.esc_html(e.label);if(void 0===$.WS_Form.field_type_cache[e.type])return"";var v=$.WS_Form.field_type_cache[e.type];if(void 0!==v.pro_required&&v.pro_required)return"";if(!this.is_admin&&(void 0!==v.mask_wrappers_drop&&v.mask_wrappers_drop))var b="#field";else b=this.get_field_value_fallback(e.type,!1,"mask_single",!1,r,s);switch(e.type){case"checkbox":case"price_checkbox":var g=this.get_object_meta_value(e,"checkbox_min",!1),y=this.get_object_meta_value(e,"checkbox_max",!1),k=this.get_object_meta_value(e,"select_all",!1);if(!1===g&&!1===y)break;!1!==g&&(g=parseInt(g,10))>0&&a.push('data-checkbox-min="'+this.esc_attr(g)+'"'),!1===y||k||(y=parseInt(y,10))>=0&&a.push('data-checkbox-max="'+this.esc_attr(y)+'"');break;case"select":case"price_select":var w=this.get_object_meta_value(e,"select_min",!1),x=this.get_object_meta_value(e,"select_max",!1);if(!1===w&&!1===x)break;!1!==w&&(w=parseInt(w,10))>0&&a.push('data-select-min="'+this.esc_attr(w)+'"'),!1!==x&&(x=parseInt(x,10))>=0&&a.push('data-select-max="'+this.esc_attr(x)+'"')}var j={attributes:(a.length>0?" ":"")+a.join(" "),class:i.join(" "),data_id:e.id,field:h,id:this.get_part_id(e.id,t,"field-wrapper"),type:e.type};return this.comment_html(this.language("comment_field")+": "+m)+this.mask_parse(b,j)+this.comment_html(this.language("comment_field")+": "+m,!0)},$.WS_Form.prototype.field_type_cache_build=function(){if(this.is_admin||($.WS_Form.field_type_cache=$.WS_Form.field_types),$.WS_Form.field_type_cache.length>0)return!0;for(var e in $.WS_Form.field_types){var t=$.WS_Form.field_types[e].types;for(var a in t)$.WS_Form.field_type_cache[a]=t[a]}},$.WS_Form.prototype.esc_html=function(e,t){if("string"!=typeof e)return e;switch(void 0===t&&(t=!1),typeof e){case"string":e=this.esc_html_do(e,t);break;case"object":for(var a in e)e.hasOwnProperty(a)&&"string"==typeof e[a]&&(e[a]=this.esc_html_do(e[a],t))}return e},$.WS_Form.prototype.esc_html_do=function(e,t){void 0===t&&(t=!1);var a=this.replace_all(e,"&","&");return a=this.replace_all(a,"<","<"),a=this.replace_all(a,">",">"),a=this.replace_all(a,'"',"""),t&&(a=this.replace_all(a,"\n","
")),a},$.WS_Form.prototype.esc_attr=function(e,t){if("string"!=typeof e)return e;void 0===t&&(t=!1);var a=this.replace_all(e,"&","&");return a=this.replace_all(a,"<","<"),a=this.replace_all(a,">",">"),a=this.replace_all(a,"'","'"),a=this.replace_all(a,'"',"""),t&&(a=this.replace_all(a,"\n","
")),a},$.WS_Form.prototype.esc_selector=function(e){if("string"!=typeof e)return e;var t=this.replace_all(e,'"','\\"');return t=this.replace_all(t,"'","\\'"),t=this.replace_all(t,"[","\\["),t=this.replace_all(t,"]","\\]"),t=this.replace_all(t,",","\\,"),t=this.replace_all(t,"=","\\=")},$.WS_Form.prototype.html_strip=function(e){switch(typeof e){case"string":e=this.html_strip_do(e);break;case"object":for(var t in e)e.hasOwnProperty(t)&&"string"==typeof e[t]&&(e[t]=this.html_strip_do(e[t]))}return e},$.WS_Form.prototype.html_strip_do=function(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent},$.WS_Form.prototype.js_string_encode=function(e){return"string"!=typeof e?e:this.replace_all(e,"'","\\'")},$.WS_Form.prototype.loader_on=function(){$("#wsf-loader").addClass("wsf-loader-on")},$.WS_Form.prototype.loader_off=function(){$("#wsf-loader").removeClass("wsf-loader-on")},$.WS_Form.prototype.comment_html=function(e,t){return void 0===t&&(t=!1),$.WS_Form.settings_plugin.comments_html?"\x3c!-- "+(t?"/":"")+e+" --\x3e\n"+(t?"\n":""):""},$.WS_Form.prototype.comment_css=function(e){return $.WS_Form.settings_plugin.comments_css?"\t/* "+e+" */\n":""},$.WS_Form.prototype.get_object_value=function(e,t,a){return void 0===a&&(a=!1),void 0===e?a:void 0===e[t]?a:e[t]},$.WS_Form.prototype.get_field_value_fallback=function(e,t,a,r,i,s){if(void 0===r&&(r=!1),i||(i=this.framework_fields),void 0===s&&(s=!1),!1===s)return this.get_field_value_fallback_process(e,t,a,r,i);if((_=this.get_field_value_fallback_process(e,t,a+"_"+s,r,i))===r)var _=this.get_field_value_fallback_process(e,t,a,r,i);return _},$.WS_Form.prototype.get_field_value_fallback_process=function(e,t,a,r,i){var s=i,_=$.WS_Form.field_type_cache[e];if(!1!==t){if(!(void 0===s||void 0===s[t]||void 0===s[t].field_types||void 0===s[t].field_types[e]||void 0===s[t].field_types[e][a]))return s[t].field_types[e][a];if(!(void 0===s||void 0===s[t]||void 0===s[t][a]))return s[t][a]}return void 0===s||void 0===s.field_types||void 0===s.field_types[e]||void 0===s.field_types[e][a]?void 0===s||void 0===s[a]?void 0===_?r:void 0===_[a]?r:_[a]:s[a]:s.field_types[e][a]},$.WS_Form.prototype.get_object_data=function(e,t,a){switch(void 0===a&&(a=!1),e){case"form":return a?this.object_data_scratch:this.form;case"group":return a?this.object_data_scratch:this.group_data_cache[t];case"section":return a?this.object_data_scratch:this.section_data_cache[t];case"field":return a?this.object_data_scratch:this.field_data_cache[t];case"action":return this.action}return!1},$.WS_Form.prototype.get_object_meta=function(e,t){switch(e){case"form":var a=$.WS_Form.settings_form.sidebars.form.meta;break;case"group":a=$.WS_Form.settings_form.sidebars.group.meta;break;case"section":a=$.WS_Form.settings_form.sidebars.section.meta;break;case"field":var r=this.field_data_cache[t];a=$.WS_Form.field_type_cache[r.type]}return a},$.WS_Form.prototype.get_object_meta_value=function(e,t,a,r,i){if(void 0===a&&(a=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===e)return a;if(void 0===e.meta)return a;if(void 0===e.meta[t]){if(!r)return a;this.set_object_meta_value(e,t,a)}return i&&"string"==typeof e.meta[t]?this.parse_variables_process(e.meta[t]).output:e.meta[t]},$.WS_Form.prototype.has_object_meta_key=function(e,t){return void 0!==e&&void 0!==e.meta&&void 0!==e.meta[t]&&""!=e.meta[t]},$.WS_Form.prototype.parse_variables_process=function(e,t,a,r,i,s,_,o,l,n){var c=this;if("string"!=typeof e)return this.parse_variables_process_error(e);if(-1==e.indexOf("#"))return this.parse_variables_process_error(e);void 0===t&&(t=!1),void 0===a&&(a=!1);var d="calc"===a;void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===s&&(s=!0),void 0===_&&(_=!1),void 0===o&&(o=1),void 0===l&&(l=e),void 0===n&&(n=r);var p={},f={},u=[];if(o>100)return this.error("error_parse_variable_syntax_error_depth","","error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_depth"));for(var h in $.WS_Form.parse_variables)if($.WS_Form.parse_variables.hasOwnProperty(h)){var m=$.WS_Form.parse_variables[h];if((m.ignore_prefix,m.ignore_prefix)||-1!==e.indexOf("#"+h))for(var v in m.variables)if(m.variables.hasOwnProperty(v)&&-1!==e.indexOf("#"+v)){var b=m.variables[v],g=void 0!==b.value&&b.value,y="object"==typeof b.attributes&&b.attributes,k=void 0!==b.single_parse&&b.single_parse;if(!1!==y||!1===g){if(("object"==typeof b.attributes?b.attributes.length:0)>0){var w=0;do{var x=e.indexOf("#"+v,w);if(-1!==x){var j=-1,S=-1,F=e.substring(x+v.length+1);if("("===F.substring(0,1)&&(j=x+v.length+1,-1!==(S=this.get_bracket_finish_index(F))&&(S+=j)),-1===j||-1===S){w+=v.length+1,M="#"+v;var W=[]}else{w=S;var O=e.substr(j+1,S-1-j),M=e.substr(x,S+1-x),I=void 0!==b.attribute_separator?b.attribute_separator:",";W=this.string_to_attributes(O,I)}for(var P in y)if(y.hasOwnProperty(P)){var N=y[P],D=N.id,q=void 0!==W[P];if((void 0===N.required||N.required)&&!q)return this.error("error_parse_variable_syntax_error_attribute","#"+v+" (Expected "+D+")","error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_attribute","#"+v+" (Expected "+D+")"));var T=void 0!==N.default&&N.default;if(!1===T||q||(W[P]=T),void 0===N.trim||N.trim){var z=W[P];"string"==typeof z&&(W[P]=z.trim())}var C=void 0!==N.valid&&N.valid;if(!1!==C&&!C.includes(W[P]))return this.error("error_parse_variable_syntax_error_attribute_invalid","#"+v+" (Expected "+C.join(", ")+")","error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_attribute_invalid","#"+v+" (Expected "+C.join(", ")+")"))}var E="",A=!0;switch(v){case"tab_label":if(isNaN(W[0]))return this.error("error_parse_variable_syntax_error_group_id",W[0],"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_group_id",W[0]));var Y=parseInt(W[0],10);if(void 0===this.group_data_cache[Y]||void 0===this.group_data_cache[Y].label)return this.error("error_parse_variable_syntax_error_group_id",Y,"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_group_id",Y));E=this.group_data_cache[Y].label;break;case"section_label":if(isNaN(W[0]))return this.error("error_parse_variable_syntax_error_section_id",W[0],"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_section_id",W[0]));var U=parseInt(W[0],10);if(void 0===this.section_data_cache[U]||void 0===this.section_data_cache[U].label)return this.error("error_parse_variable_syntax_error_section_id",U,"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_section_id",U));E=this.section_data_cache[U].label;break;case"cookie_get":E=this.cookie_get_raw(W[0]);break;case"session_storage_get":E=this.session_storage_get_raw(W[0]);break;case"local_storage_get":E=this.local_storage_get_raw(W[0]);break;case"field_label":if(isNaN(W[0]))return this.error("error_parse_variable_syntax_error_field_id",W[0],"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_field_id",W[0]));var R=parseInt(W[0],10);if(void 0===this.field_data_cache[R]||void 0===this.field_data_cache[R].label)return this.error("error_parse_variable_syntax_error_field_id",R,"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_field_id",R));E=this.field_data_cache[R].label;break;case"field_min_id":case"field_max_id":case"field_min_value":case"field_max_value":case"field_min_label":case"field_max_label":for(var L=0,H=0,J="",G=0,B=0,Z="",Q=0,K=void 0!==r.section_repeatable_section_id&&parseInt(r.section_repeatable_section_id,10);!isNaN(W[Q]);){if(R=parseInt(W[Q],10)){if(u.push(R),"object"==typeof this.field_data_cache[R]){var V=this.field_data_cache[R],X=this.get_field_value(V,oe);X="object"==typeof X&&void 0!==X[0]?this.get_number(X[0],0,!0):0;var ee=V.label;0==Q?(G=L=R,B=H=X,Z=J=ee):(XB&&(G=R,B=X,Z=ee)),Q++}}else Q++}switch(v){case"field_min_id":E=L;break;case"field_max_id":E=G;break;case"field_min_value":E=H;break;case"field_max_value":E=B;break;case"field_min_label":E=J;break;case"field_max_label":E=Z}break;case"field":case"field_float":case"field_date_format":case"field_date_offset":case"field_count_word":case"field_count_char":case"ecommerce_field_price":if(isNaN(W[0]))return this.error("error_parse_variable_syntax_error_field_id",W[0],"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_field_id",W[0]));R=parseInt(W[0],10);if(("field_value"===i||!1===i)&&R===parseInt(n.id,10))return this.error("error_parse_variable_syntax_error_self_ref",M,"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_self_ref",M));if(void 0===this.field_data_cache[R])return this.error("error_parse_variable_syntax_error_field_id",R,"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_field_id",R));r.id===n.id&&u.push(R);var te=this.field_data_cache[R];if(void 0===$.WS_Form.field_type_cache[te.type])break;var ae=$.WS_Form.field_type_cache[te.type];if(!1!==a)if(!(ae[a+"_out"],ae[a+"_out"]))return this.error("error_parse_variable_syntax_error_"+a+"_out",te.label+" (ID: "+te.id+")","error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_"+a+"_out",te.label+" (ID: "+te.id+")"));var re=(ae.static,ae.static);if(re){if(!0===re)var ie=void 0!==ae.mask_field_static?ae.mask_field_static:"";else{ie=this.get_object_meta_value(te,re,"");this.wpautop_parse_variable(te,ae)&&(ie=this.wpautop(ie),A=!1)}"object"==typeof(Ee=this.parse_variables_process(ie,t,a,te,i,s,_,o+1,l,n)).fields&&(u=u.concat(Ee.fields)),E=[Ee.output];break}var se=void 0!==ae.submit_array&&ae.submit_array,_e=void 0!==te.section_repeatable_section_id&&parseInt(te.section_repeatable_section_id,10),oe=(K=void 0!==r.section_repeatable_section_id&&parseInt(r.section_repeatable_section_id,10),t),le=(E=!1,void 0!==W[1]?W[1]:","),ne=void 0!==W[2]&&W[2];if(!1!==oe&&_e===_||!1!==_e&&!1!==K)E=this.get_field_value(te,oe,se,ne);if(!1===E&&!1!==_e&&!1===K)E=this.get_field_value(te,!0,se,ne);if(!1===E&&!1===_e)E=this.get_field_value(te,!1,se,ne);if(!1===E)switch(te.type){case"price_select":case"price_checkbox":case"price_radio":case"select":case"checkbox":case"radio":var ce=this.get_data_source(te);E=!1!==ce.default_value?ce.default_value:[];break;default:var de=this.get_object_meta_value(te,"default_value","");"object"==typeof(Ee=this.parse_variables_process(de,t,a,te,i,s,_,o+1,l,n)).fields&&(u=u.concat(Ee.fields)),E=[Ee.output]}switch(v){case"field":!1!==ne&&(E=this.get_data_grid_column(E,te,ne));break;case"field_count_char":case"field_count_word":var pe="object"==typeof E?E.join(le):"";if(void 0!==W[1]){var fe=/\/(.*)\/(.*)/.exec(W[1]);pe=pe.replace(new RegExp(fe[1],fe[2]),"")}E=["field_count_char"==v?pe.length:this.get_word_count(pe)]}if(d)if(E.length)switch(te.type){case"price_select":case"price_checkbox":case"price_radio":case"price":case"price_subtotal":case"cart_price":case"cart_total":var ue=0;for(var he in E)E.hasOwnProperty(he)&&(ue+=this.get_number(E[he],0,!0));var me=parseInt($.WS_Form.settings_plugin.price_decimals,10);E=this.get_number(ue,0,!1,me);break;case"datetime":if(""===E[0]){E="";break}var ve=this.get_object_meta_value(te,"input_type_datetime","date");(ye=this.get_object_meta_value(te,"format_date",ws_form_settings.date_format))||(ye=ws_form_settings.date_format);var be=this.get_date(E[0],ve,ye);E=this.get_number(be.getTime())/1e3;break;default:ue=0;for(var he in E)E.hasOwnProperty(he)&&(ue+=c.get_number(E[he],0,!1));E=ue}else E=0;else E=(E=$.map(E,function(e){return c.esc_html(e)})).join(le),A=!1;switch(v){case"ecommerce_field_price":E=this.get_price(this.get_number(E));break;case"field_date_format":if("datetime"!==te.type)return this.error("error_parse_variable_syntax_error_field_date_offset",R,"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_field_date_offset",R));var ge=this.parse_variables_process(E,t,a,te,i,s,_,o).output;if((ke=this.get_object_meta_value(te,"format_date",ws_form_settings.date_format))||(ke=ws_form_settings.date_format),this.is_integer(ge))Oe=new Date(1e3*parseInt(ge,10));else{ve=this.get_object_meta_value(te,"input_type_datetime","date");Oe=this.get_date(ge,ve,ke)}if(!1!==Oe&&!isNaN(Oe.getTime())){if(void 0!==W[1]&&""!=W[1])var ye=W[1];else ye=ke;ye||(ye=ws_form_settings.date_format),E="function"==typeof this.date_format?this.date_format(Oe,ye):""}break;case"field_date_offset":if("datetime"!==te.type)return this.error("error_parse_variable_syntax_error_field_date_offset",R,"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_field_date_offset",R));var ke;ge=this.parse_variables_process(E,t,a,te,i,s,_,o).output;if((ke=this.get_object_meta_value(te,"format_date",ws_form_settings.date_format))||(ke=ws_form_settings.date_format),this.is_integer(ge))Oe=new Date(1e3*parseInt(ge,10));else{ve=this.get_object_meta_value(te,"input_type_datetime","date");Oe=this.get_date(ge,ve,ke)}if(!1!==Oe&&!isNaN(Oe.getTime())){if((Me=parseInt(this.parse_variables_process(W[1],t,a,r,i,s,_,o).output,10))&&Oe.setSeconds(Oe.getSeconds()+Me),void 0!==W[2]&&""!=W[2])ye=W[2];else ye=ke;ye||(ye=ws_form_settings.date_format),E="function"==typeof this.date_format?this.date_format(Oe,ye):""}break;case"field_float":E=this.get_number(E)}"field"===v&&this.wpautop_parse_variable(te,ae)&&(E=this.wpautop(E),A=!1);break;case"ecommerce_price":"object"==typeof(Ee=this.parse_variables_process(W[0],t,a,r,i,s,_,o)).fields&&(u=u.concat(Ee.fields));var we=this.eval_process(Ee.output,l,!1,n,i);E=this.get_price(we);break;case"number_format":"object"==typeof(Ee=this.parse_variables_process(W[0],t,a,r,i,s,_,o)).fields&&(u=u.concat(Ee.fields));var xe=this.eval_process(Ee.output,l,!1,n,i),$e=W[1],je=W[2],Se=W[3];E=this.number_format(xe,$e,je,Se);break;case"select_option_text":if(isNaN(W[0]))return this.error("error_parse_variable_syntax_error_field_id",W[0],"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_field_id",W[0]));R=parseInt(W[0],10);void 0===(le=W[1])&&(le=", "),r.id===n.id&&u.push(R);var Fe=ws_form_settings.field_prefix+R.toString()+(t?"["+t+"]":"");if((We=$('[name="'+this.esc_selector(Fe)+'[]"] option:selected',this.form_canvas_obj)).length)E=$.map(We,function(e,t){return $(e).text()}).join(le);break;case"query_var":E=this.get_query_var(W[0]);break;case"checkbox_label":case"radio_label":if(isNaN(W[0]))return this.error("error_parse_variable_syntax_error_field_id",W[0],"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_field_id",W[0]));R=parseInt(W[0],10);void 0===(le=W[1])&&(le=", "),r.id===n.id&&u.push(R);Fe=ws_form_settings.field_prefix+R.toString()+(t?"["+t+"]":"");if((We=$('[name="'+this.esc_selector(Fe)+'[]"]:checked',this.form_canvas_obj)).length)E=$.map(We,function(e,t){return $('label[for="'+$(e).attr("id")+'"]').text()}).join(le);break;case"checkbox_count":case"select_count":if(isNaN(W[0]))return this.error("error_parse_variable_syntax_error_field_id",W[0],"error-parse-variables"),this.parse_variables_process_error(this.language("error_parse_variable_syntax_error_field_id",W[0]));R=parseInt(W[0],10);r.id===n.id&&u.push(R);Fe=ws_form_settings.field_prefix+R.toString()+(t?"["+t+"]":"");switch(v){case"checkbox_count":var We=$('[name="'+this.esc_selector(Fe)+'[]"]:checked',this.form_canvas_obj);break;case"select_count":We=$('select[name="'+this.esc_selector(Fe)+'[]"] option:not([data-placeholder]):selected',this.form_canvas_obj)}E=We?We.length:0;break;case"post_date_custom":case"server_date_custom":case"blog_date_custom":var Oe=this.get_new_date(g);if(void 0!==W[1])(Me=parseInt(this.parse_variables_process(W[1],t,a,r,i,s,_,o).output,10))&&Oe.setSeconds(Oe.getSeconds()+Me);E="function"==typeof this.date_format?this.date_format(Oe,W[0]):"";break;case"client_date_custom":var Me;Oe=new Date;if(void 0!==W[1])(Me=parseInt(this.parse_variables_process(W[1],t,a,r,i,s,_,o).output,10))&&Oe.setSeconds(Oe.getSeconds()+Me);E="function"==typeof this.date_format?this.date_format(Oe,W[0]):"";break;case"random_number":var Ie=parseInt(this.get_number(W[0]),10),Pe=parseInt(this.get_number(W[1]),10);E=Math.floor(Math.random()*(Pe-Ie+1))+Ie;break;case"random_string":var Ne=parseInt(this.get_number(W[0]),10),De=W[1],qe=De.length;E="";for(var Te=0;Te0?"min"==v?Math.min(...Ae):Math.max(...Ae):0;break;case"avg":ue=0;if(1===W.length)"object"==typeof(Ee=this.parse_variables_process(W[0],t,a,r,i,s,_,o)).fields&&(u=u.concat(Ee.fields)),W=this.string_to_attributes(Ee.output);for(var Q in W){if(W.hasOwnProperty(Q))"object"==typeof(Ee=this.parse_variables_process(W[Q],t,a,r,i,s,_,o)).fields&&(u=u.concat(Ee.fields)),ue+=we=this.eval_process(Ee.output,l,!1,n,i)}E=ue/W.length}!1!==E&&(A&&(E=this.esc_html(E)),k?f[M.substring(1)]=E:p[M.substring(1)]=E)}}while(-1!==x);e=this.mask_parse(e,p)}}else p[v]=g}}if(-1!=e.indexOf("form")&&(p.form_id=this.form_id,p.form_instance_id=this.form_instance_id,p.form_obj_id=this.form_obj_id,p.form_label=this.form.label,p.form_checksum=this.form.published_checksum,p.form_framework=this.framework.name),-1!=e.indexOf("section")){p.section_row_index=t;var Ye=1;!1===_&&!1!==r&&void 0!==r.section_id&&parseInt(r.section_id,10)>0&&(_=parseInt(r.section_id,10)),"object"==typeof this.section_repeatable_indexes["section_"+_]&&(Ye=this.section_repeatable_indexes["section_"+_].indexOf(t.toString())+1)<=0&&(Ye=1),p.section_row_number=Ye}if(-1!=e.indexOf("submit")&&(p.submit_hash=this.hash),-1!=e.indexOf("client")){var Ue=new Date;p.client_time="function"==typeof this.date_format?this.date_format(Ue,ws_form_settings.time_format):"",p.client_date="function"==typeof this.date_format?this.date_format(Ue,ws_form_settings.date_format):""}-1!=e.indexOf("seconds_epoch_midnight")&&((Re=new Date).setHours(0,0,0,0),p.seconds_epoch_midnight=Math.round(Re.getTime()/1e3));if(-1!=e.indexOf("seconds_epoch")){var Re=new Date;p.seconds_epoch=Math.round(Re.getTime()/1e3)}var Le=e;(e=this.mask_parse(e,p),(e=this.mask_parse(e,f,!0))!==Le&&-1!==e.indexOf("#"))&&(e=(Ee=this.parse_variables_process(e,t,a,r,i,s,_,o+1,l,n)).output,"object"==typeof Ee.fields&&(u=u.concat(Ee.fields)));return{output:e,fields:u}},$.WS_Form.prototype.get_data_grid_column=function(e,t,a){if(0===e.length)return e;var r=[];switch(i=t.type){case"select":case"checkbox":case"radio":break;case"price_select":var i="select_price";break;case"price_checkbox":i="checkbox_price";break;case"price_radio":i="radio_price";break;default:return e}var s="data_grid_"+i,_=this.get_object_meta_value(t,i+"_field_value","0"),o=this.get_object_meta_value(t,i+"_field_label","0"),l=this.get_object_meta_value(t,i+"_field_price","0"),n=this.get_object_meta_value(t,i+"_field_parse_variable","0"),c=this.get_object_meta_value(t,i+"_field_wc","0"),d=this.get_object_meta_value(t,s,!1);if(!1===d)return e;if("object"!=typeof d.columns||"object"!=typeof d.groups)return e;var p=0,f=0,u=0,h=d.columns,m=parseInt(a,10);for(var v in h)if(h.hasOwnProperty(v)){var b=h[v];void 0!==b.id&&void 0!==b.label&&(b.id==_&&(p=v),b.id==o&&(f=v),b.id==l&&v,b.id==n&&(u=v),b.id==c&&v,b.label===a&&(m=v))}var g=d.groups;for(var y in g)if(g.hasOwnProperty(y)){var k=g[y];if(void 0!==k.rows){var w=k.rows;for(var x in w)if(w.hasOwnProperty(x)){var j=w[x];if(null!==j&&"object"==typeof j.data){var S=j.data,F=$.extend(!0,[],S);if(void 0!==F[p]&&void 0!==F[m]){var W={data_grid_row_value:F[p],data_grid_row_action_variable:"",data_grid_row_label:""};for(var O in!1!==f&&void 0!==F[f]&&(W.data_grid_row_label=F[f]),!1!==u&&void 0!==F[u]&&(W.data_grid_row_action_variable=F[u]),F)F.hasOwnProperty(O)&&("number"==typeof F[O]&&(F[O]=F[O].toString()),F[O]=this.mask_parse(F[O],W));for(var M in e){if(e.hasOwnProperty(M))if(e[M]===F[p].toString()){if(void 0===j.data[m])continue;r.push(j.data[m])}}}}}}}return r},$.WS_Form.prototype.wpautop_parse_variable=function(e,t){if("on"==this.get_object_meta_value(e,"wpautop_do_not_process",""))return!1;var a=void 0!==t.wpautop_parse_variable&&t.wpautop_parse_variable;if("object"==typeof a){var r=!1;for(var i in a)if(a.hasOwnProperty(i)){var s=a[i];this.get_object_meta_value(e,s.meta_key,"")===s.meta_value&&(r=!0)}a=r}return a},$.WS_Form.prototype.wpautop=function(e,t){void 0===t&&(t=!0);var a=new Map;if(""===e.trim())return"";if((e+="\n").indexOf("-1){var r=e.split("
"),i=r.pop();e="",r.forEach(function(t,r){var i=t.indexOf("";a[s]=t.substr(i)+"",e+=t.substr(0,i)+s}else e+=t}),e+=i}var s="(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)";(e=(e=(e=(e=e.replace(/
\s*
/,"\n\n")).replace(new RegExp("(<"+s+"[^>]*>)","gmi"),"\n$1")).replace(new RegExp("("+s+">)","gmi"),"$1\n\n")).replace(/\r\n|\r/,"\n")).indexOf("")),e.indexOf("")>-1&&(e=(e=(e=e.replace(/(")).replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/gim,"$1")),(e.indexOf("
"),Object.keys(a).length&&(e=e.replace(new RegExp(Object.keys(a).join("|"),"gi"),function(e){return a[e]})),e},$.WS_Form.prototype.eval_process=function(eval_input,parse_string_original,decimals,field,field_part){try{var eval_output=eval(eval_input);return eval_output===1/0&&(eval_output=0),this.get_number(eval_output,0,!1,decimals)}catch(e){return"object"==typeof field&&void 0!==field.id&&void 0!==field.label&&this.error("error_parse_variable_syntax_error_eval",field.id+" | "+this.esc_html(field.label)+(field_part?" | "+this.esc_html(field_part):"")+" | "+e.message+": "+this.esc_html(parse_string_original)),0}},$.WS_Form.prototype.closing_string_index=function(e,t,a,r){for(var i=1;i>0;){var s=e.indexOf(a,r),_=e.indexOf(t,r);if(-1!==s&&-1!==_&&s<_)r=s+a.length,i++;else{if(!(-1!==_&&i>1)){if(-1!==_&&1===i)break;break}r=_+t.length,i--}}return _},$.WS_Form.prototype.string_to_attributes=function(e,t){if("string"!=typeof e||""==e)return[];"string"!=typeof t&&(t=",");var a=1,r=0,i=!1,s="",_=[];e.replace("“",'"'),e.replace("”",'"');for(var o=e.length;r0||a0&&c!=_){var d={id:n.id,size_word:void 0===this.number_to_word[c]?c:this.number_to_word[c],size:c};if(void 0!==n.column_class)var p=n.column_class;else p=i;var f=this.mask_parse(p,d);a.push(f),_=c}var u=this.get_object_meta_value(e,t+"_offset_"+l,""),h=!1;if(""!==u&&u!=o){d={id:n.id,offset_word:void 0===this.number_to_word[u]?u:this.number_to_word[u],offset:u};if(void 0!==n.offset_class)var m=n.offset_class;else m=s;f=this.mask_parse(m,d);a.push(f),o=u,h=!0}h&&a.push("wsf-has-offset")}return a},$.WS_Form.prototype.column_classes_render=function(e,t,a){e.closest(".wsf-sections").css("min-height","auto"),e.closest(".wsf-fields").css("min-height","auto"),void 0===a&&(a=!0);for(var r=this.column_class_array(t),i=0;i0;t--){var a=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[a],e[a]=r}return e},$.WS_Form.prototype.get_nice_duration=function(e,t){if(void 0===t&&(t=!0),0==e)return"-";var a=Math.floor(e/3600);if(t)var r=Math.floor(e%3600/60),i=e%60;else r=Math.ceil(e%3600/60);var s=[];return a>0&&s.push(a+" "+(1==a?this.language("hour"):this.language("hours"))),r>0&&s.push(r+" "+(1==r?this.language("minute"):this.language("minutes"))),t&&s.push(i+" "+(1==i?this.language("second"):this.language("seconds"))),s.join(" ")},$.WS_Form.prototype.get_nice_distance=function(e,t){if(0==e)return"-";switch(t){case"IMPERIAL":var a=e/1609;if(a>=1)return Math.floor(a)+" "+(1==a?this.language("mile"):this.language("miles"));var r=3.2808399*e;return Math.floor(r)+" "+(1==r?this.language("feet"):this.language("feets"));default:var i=e/1e3;return i>=1?Math.round(10*i)/10+" "+(1==i?this.language("kilometer"):this.language("kilometers")):Math.round(10*e)/10+" "+(1==e?this.language("meter"):this.language("meters"))}},$.WS_Form.prototype.ucwords=function(e){for(var t=e.split(" "),a=0;a0&&(t=e[0].toUpperCase(),e.length>1&&(t+=e.slice(1))),t},$.WS_Form.prototype.capitalize=function(e){return this.ucwords(e.toLowerCase())},$.WS_Form.prototype.sentence=function(e){return this.ucfirst(e.toLowerCase())},$.WS_Form.prototype.get_label_position=function(e){var t=this.get_object_meta_value(e,"sub_type",!1);""==t&&(t=!1);var a=this.get_object_meta_value(e,"label_position","default");return"default"==(a=this.get_field_value_fallback(e.type,!1,"label_position_force",a,!1,t))&&(a=this.get_object_meta_value(this.form,"label_position_form","top")),a},$.WS_Form.prototype.get_help_position=function(e){var t=this.get_object_meta_value(e,"sub_type",!1);""==t&&(t=!1);var a=this.get_object_meta_value(e,"help_position","default");return"default"==(a=this.get_field_value_fallback(e.type,!1,"help_position_force",a,!1,t))&&(a=this.get_object_meta_value(this.form,"help_position_form","bottom")),a},$.WS_Form.prototype.get_form_invalid_feedback_mask=function(){var e=this.get_object_meta_value(this.form,"invalid_feedback_mask","");if(""==e){var t=$.WS_Form.meta_keys.invalid_feedback_mask;return t.p?t.p:t.mask_placeholder}return e},$.WS_Form.prototype.get_invalid_feedback_mask_parsed=function(e,t){return e=this.replace_all(e,"#label_lowercase",t.toLowerCase()),e=this.replace_all(e,"#label",t)},$.WS_Form.prototype.get_field_html_single=function(e,t,a,r){void 0===a&&(a=!1),void 0===r&&(r=!1);var i=[],s=void 0!==t,_=s&&void 0!==t.indexOf,o=!a,l=!1!==r?"-repeat-"+r:"",n=this.get_part_id(e.id,r),c=this.get_field_name(e.id,r),d=["default","class","input_type_datetime","multiple","min","max","step"],p=["class"];if(void 0===$.WS_Form.field_type_cache[e.type])return"";var f=$.WS_Form.field_type_cache[e.type];if(f.pro_required)return this.language("error_pro_required");if(a)var u=!0;else u=this.get_object_meta_value(e,"label_render",!0);var h=this.get_object_meta_value(e,"sub_type",!1);if(""==h&&(h=!1),this.get_field_value_fallback(e.type,!1,"label_disabled",!1,!1,h)&&(u=!1),void 0!==f.submit_array&&f.submit_array&&(c+="[]"),u&&!a)var m=this.get_label_position(e);else m="top";var v=!1;-1===this.get_framework().label_positions.indexOf(m)&&(m="top");var b=$.extend(!0,[],this.get_field_value_fallback(e.type,m,"mask_field_attributes",[],!1,h)),g=void 0!==f.mask_wrappers_drop&&f.mask_wrappers_drop,y=g?"#field":this.get_field_value_fallback(e.type,m,"mask","#field",!1,h),k=this.get_field_value_fallback(e.type,m,"mask_field","",!1,h);if(a){var w=this.get_field_value_fallback(e.type,m,"mask_field_submit",!1,!1,h);!1!==w&&(k=w)}"left"!=m&&"right"!=m||(k=(k=k.replace("#pre_help","")).replace("#post_help",""));var x=u?this.get_field_value_fallback(e.type,m,"mask_field_label","",!1,h):"",j=this.get_field_value_fallback(e.type,m,"mask_field_label_hide_group",!1,!1,h),S=this.get_field_value_fallback(e.type,m,"mask_help","",!1,h),F=this.get_field_value_fallback(e.type,m,"mask_help_append","",!1,h),W=this.get_field_value_fallback(e.type,m,"mask_help_append_separator","",!1,h),O=this.get_field_value_fallback(e.type,m,"mask_invalid_feedback","",!1,h),M=this.get_object_meta_value(e,"default_value","",!1,!0),I=this.get_object_meta_value(e,"text_editor","",!1,!0),P=this.get_object_meta_value(e,"html_editor","",!1,!0),N=this.get_object_meta_value(e,"dedupe_value_scope","",!1,!0),D=this.get_object_meta_value(e,"hidden_bypass","",!1,!0),q=this.get_object_meta_value(e,"exclude_cart_total","",!1,!0);s||(t="",""!=M&&(t=this.esc_html(M)),""!=I&&(t=I),""!=P&&(t=P));var T=!0,z="";switch(e.type){case"textarea":T=""===this.get_object_meta_value(e,"input_type_textarea","");break;case"select":case"checkbox":case"radio":case"price_select":case"price_checkbox":case"price_radio":t&&(t="string"==typeof t?t.split(",").map(function(e){return e.trim()}):t,s=!0)}var C=T?this.parse_variables_process(this.get_object_meta_value(e,"prepend",""),r,!1,e,"field_prepend",o).output:"";z+=T?this.parse_variables_process(this.get_object_meta_value(e,"append",""),r,!1,e,"field_prepend",o).output:"";var E="";if(!a){var A=[],Y=this.get_object_meta_value(this.form,"class_field","",!1,!0);if(""!=Y&&A.push(Y),""!=(E=this.get_object_meta_value(e,"class_field","",!1,!0))&&A.push(E),!this.get_object_meta_value(e,"class_field_full_button_remove","")){var U=this.get_field_value_fallback(e.type,m,"class_field_full_button","",!1,h);"object"==typeof U&&A.push(U.join(" "))}if(!(R=this.get_object_meta_value(e,"class_field_button_type",!1)))var R=this.get_field_value_fallback(e.type,m,"class_field_button_type_fallback",!1,!1,h);if(R){var L=this.get_field_value_fallback(e.type,m,"class_field_button_type","",!1,h);void 0!==L[R]&&A.push(L[R])}if(""!==C||""!==z){var H=this.get_field_value_fallback(e.type,m,"class_field_input_group","",!1,h);""!==H&&A.push(H)}var J=void 0!==f.label_inside&&f.label_inside;if(J&&"inside"===m){switch(e.type){case"textarea":var G=this.get_object_meta_value(e,"input_type_textarea",!1);v=!("tinymce"===G||"html"===G);break;case"select":case"price_select":v=!this.get_object_meta_value(e,"select2",!1);break;default:v=!0}v||(m="top")}J||"inside"!==m||(m="top"),v&&(e.meta.placeholder=this.parse_variables_process(e.label,r,!1,e,"field_label",o).output),E=A.join(" ")}var B=parseInt($.WS_Form.settings_plugin.framework_column_count,10),Z=parseInt(this.get_object_meta_value(this.form,"label_column_width_form",3),10),Q=this.get_object_meta_value(e,"label_column_width","default");switch(Q){case"default":case"":Q=Z;break;default:Q=parseInt(Q,10)}Q>=B&&(Q=B-1);var K=B-Q,V={id:n,form_id_prefix:this.form_id_prefix,form_id:this.form_id,form_instance_id:this.form_instance_id,field_id:e.id,name:c,label:this.parse_variables_process(e.label,r,!1,e,"field_label",o).output,value:t,required:this.get_object_meta_value(this.form,"label_required")?'':"",column_width_label:Q,column_width_field:K,max_upload_size:ws_form_settings.max_upload_size,locale:ws_form_settings.locale,currency:$.WS_Form.settings_plugin.currency},X=this.get_field_value_fallback(e.type,m,"meta_key_parse_variables",[],!1,h);for(var ee in X)if(X.hasOwnProperty(ee)){var te=X[ee],ae=!1!==(at=void 0!==$.WS_Form.meta_keys[te]&&$.WS_Form.meta_keys[te])?void 0===at.d?"":at.d:"",re=this.get_object_meta_value(e,te,ae);"object"==typeof re&&(re=JSON.stringify(re)),re=this.replace_all(re,"'","'"),V[te]=re}var ie=$.extend(!0,{},V);ie.label_id=this.get_part_id(e.id,r,"label");var se=this.get_part_id(e.id,r,"help"),_e=""!==(le=a?"":this.get_object_meta_value(e,"help","",!1,!1)),oe={value:0,character_count:0,character_count_label:"",character_remaining:0,character_remaining_label:"",character_min:0,character_min_label:"",character_max:0,character_max_label:"",word_count:0,word_count_label:"",word_remaining:0,word_remaining_label:"",word_min:0,word_min_label:"",word_max:0,word_max_label:""};le=this.mask_parse(le,oe);var le=this.parse_variables_process(le,r,!1,e,"field_help",o).output;if(a)switch(e.type){case"range":le="#value"}var ne=this.get_help_position(e),ce=this.get_field_value_fallback(e.type,m,"class_help_"+("bottom"==ne?"post":"pre"),[],!1,h);oe.id=n,oe.help_id=se,oe.help_class=ce.join(" "),oe.help=le,V.help_class=ce.join(" ");var de=!a&&this.get_object_meta_value(e,"invalid_feedback_render",!1,!1,!0),pe=!1;if(de){var fe=$.extend(!0,{},V),ue=this.form_id_prefix+"invalid-feedback-"+e.id+l,he=this.get_field_value_fallback(e.type,m,"class_invalid_feedback",[],!1,h),me=(pe=this.get_field_value_fallback(e.type,m,"invalid_feedback_last_row",!1,!1,h),this.get_object_meta_value(e,"invalid_feedback","",!1,!0));""==me&&(me=this.get_form_invalid_feedback_mask()),me=this.get_invalid_feedback_mask_parsed(me,e.label),fe.invalid_feedback_id=ue,fe.invalid_feedback_class=he.join(" "),fe.invalid_feedback=me,fe.attributes="";var ve=this.mask_parse(O,fe)}else ue=!1,ve="";if(V.invalid_feedback=ve,ie.invalid_feedback=ve,V.attributes="",a)b=d.filter(function(e){return-1!=b.indexOf(e)});if(b.length>0){var be=this.get_attributes(e,b,!1,r);V.attributes+=" "+be.attributes,b=be.mask_attributes,i=be.attribute_values}!1!==r&&(V.attributes+=' data-repeatable-index="'+this.esc_attr(r)+'"');var ge=this.get_object_meta_value(e,"custom_attributes",!1);if(!1!==ge&&"object"==typeof ge&&ge.length>0)for(var ye in ge)if(ge.hasOwnProperty(ye)){var ke=ge[ye];""!=ke.custom_attribute_name&&(ke.custom_attribute_value=this.parse_variables_process(ke.custom_attribute_value,r,!1,e).output,V.attributes=this.attribute_modify(V.attributes,ke.custom_attribute_name,ke.custom_attribute_value,!0))}var we=this.get_object_meta_value(e,"orientation",!1);if("grid"==we)var xe=this.get_field_value_fallback(e.type,m,"class_orientation_wrapper",[],!1,h),$e=this.get_field_value_fallback(e.type,m,"class_orientation_row",[],!1,h),je=xe.join(" "),Se=this.column_class_array(e,"orientation_breakpoint"),Fe=(Se=$e.concat(Se)).join(" ");ie.attributes="";var We=$.extend(!0,[],this.get_field_value_fallback(e.type,m,"mask_field_label_attributes",[],!1,h));if(a)We=p.filter(function(e){return-1!=We.indexOf(e)});if(We.length>0){be=this.get_attributes(e,We,!1,r);ie.attributes+=be.attributes,We=be.mask_attributes}var Oe="",Me=this.get_object_value(f,"data_source",!1),Ie=0,Pe=!1!==Me;if(Pe){if(void 0===Me.type)Pe=!1;else var Ne=Me.type;if(void 0===Me.id)Pe=!1;else var De=Me.id}if(Pe){switch(Ne){case"data_grid":var qe=this.get_object_meta_value(e,De,!1)}if(!1===qe&&(Pe=!1),void 0===qe.columns)Pe=!1;else var Te=qe.columns}if(Pe){var ze=this.get_field_value_fallback(e.type,m,"mask_group","",!1,h),Ce=this.get_field_value_fallback(e.type,m,"mask_group_wrapper","",!1,h),Ee=this.get_field_value_fallback(e.type,m,"mask_group_label","",!1,h),Ae=this.get_field_value_fallback(e.type,m,"mask_group_always",!1,!1,h),Ye=this.get_field_value_fallback(e.type,m,"mask_row","",!1,h),Ue=this.get_field_value_fallback(e.type,m,"mask_row_placeholder","",!1,h),Re=this.get_field_value_fallback(e.type,m,"mask_row_field","",!1,h),Le=this.get_field_value_fallback(e.type,m,"mask_row_label","",!1,h),He=this.get_field_value_fallback(e.type,m,"mask_row_lookups",[],!1,h),Je=this.get_field_value_fallback(e.type,m,"datagrid_column_value",!1,!1,h),Ge=this.get_field_value_fallback(e.type,m,"mask_row_default","",!1,h),Be=this.get_field_value_fallback(e.type,m,"mask_row_required"," required data-required",!1,h),Ze=this.get_field_value_fallback(e.type,m,"mask_row_disabled"," disabled",!1,h),Qe=(this.get_field_value_fallback(e.type,m,"mask_row_visible"," visible",!1,h),this.get_object_meta_value(e,"data_grid_rows_randomize","",!1,!0));if(Qe)this.get_object_meta_value(e,"data_source_term_hierarchy","",!1,!0)&&(Qe=!1);var Ke=this.get_object_meta_value(e,"placeholder_row","",!1,!0),Ve=this.get_object_meta_value(e,"multiple","",!1,!0);if(""!=Ke&&!Ve){var Xe=$.extend(!0,{},V);Xe.value=Ke,Oe+=this.mask_parse(Ue,Xe)}s&&"object"!=typeof t&&("string"!=typeof t&&(t=t.toString()),t=[t]);var et=[];for(var tt in He)if(He.hasOwnProperty(tt)){if(et[vt=He[tt]]=!1,!1===($t=this.get_object_meta_value(e,vt,!1,!1,!0))){if(void 0===$.WS_Form.meta_keys[vt])continue;var at;($t=void 0!==(at=$.WS_Form.meta_keys[vt]).d?at.d:0)>Te.length&&($t=0)}var rt=!1;for(var it in Te){if(Te.hasOwnProperty(it))if(Te[it].id==$t){rt=it;break}}rt&&(et[vt]=rt)}if(void 0===qe.groups)return this.error("error_data_source_groups"),"";var st=qe.groups;Object.keys(st).length;for(var _t in Qe&&(st=this.array_randomize(st)),st)if(st.hasOwnProperty(_t)){var ot=$.extend(!0,{},V);ot.group_id=this.form_id_prefix+"datagrid-"+e.id+"-group-"+_t+l;var lt=st[_t];if(null!=lt&&"object"==typeof lt){if(void 0===lt.label)return this.error("error_data_group_label"),"";switch(e.type){case"select":case"price_select":var nt=!0;break;default:nt=void 0===lt.label_render||lt.label_render}if(nt){var ct=$.extend(!0,{},V);ct.group_label=this.esc_html(lt.label),ct.label_row_id=this.form_id_prefix+"label-"+e.id+"-group-"+_t+l,ot.group_label=this.mask_parse(Ee,ct)}else ot.group_label="";ot.disabled=void 0!==lt.disabled&&"on"==lt.disabled?" disabled":"";var dt=void 0!==lt.mask_group&&"on"==lt.mask_group||Ae;dt&&j&&(x="");var pt="";if(void 0!==lt.rows){var ft=JSON.parse(JSON.stringify(lt.rows)),ut=this.get_object_meta_value(e,"select_all","");if(("checkbox"==e.type||"price_checkbox"==e.type)&&"on"==ut){var ht=!1,mt=!1;for(var vt in et)if(et.hasOwnProperty(vt)){var bt=et[vt];"checkbox_field_value"==vt&&(ht=bt),"checkbox_field_label"==vt&&(mt=bt),"checkbox_price_field_value"==vt&&(ht=bt),"checkbox_price_field_label"==vt&&(mt=bt)}ut={id:0,default:"",required:"",hidden:"",disabled:"",select_all:!0,data:[]};var gt=this.get_object_meta_value(e,"select_all_label","");""==gt&&(gt=this.language("select_all_label")),ut.data[ht]=gt,ut.data[mt]=gt,ft.unshift(ut)}for(var yt in Qe&&(ft=this.array_randomize(ft)),ft)if(ft.hasOwnProperty(yt)){var kt=ft[yt];if(null!==kt&&"object"==typeof kt&&"object"==typeof kt.data){var wt=!pe||yt==ft.length-1,xt=$.extend(!0,{},V);for(var vt in xt.data_grid_row_value="",xt.data_grid_row_action_variable="",xt.data_grid_row_label="",xt.data_grid_row_price="",xt.data_grid_row_price_currency="",xt.data_grid_row_woocommerce_cart="",et){if(et.hasOwnProperty(vt))if(xt[vt]="",!1!==(rt=et[vt])&&void 0!==kt.data[rt]){var $t;switch(null===($t=kt.data[rt])&&($t=""),$t=this.parse_variables_process($t.toString(),r,!1,e,"data_grid_row",o).output,xt[vt+"_html"]=this.esc_html($t),e.type){case"range":case"price_range":var jt=this.get_object_meta_value(e,"min",0);(""==jt||isNaN(jt))&&(jt=0);var St=this.get_object_meta_value(e,"max",100);(""==St||isNaN(St))&&(St=100);var Ft=this.get_number($t,!0),Wt=parseFloat(St)-parseFloat(jt),Ot=Wt>0?(Ft-jt)/Wt*100:0;xt[vt+"_percentage"]=Ot,-1!==vt.indexOf("_field_percentage")&&(xt.data_grid_row_value_percentage=Ot)}xt[vt+"_compare"]=this.esc_html($t);var Mt=!1;if(void 0!==$.WS_Form.meta_keys[vt]){var It=$.WS_Form.meta_keys[vt];void 0!==It.h&&It.h&&($t=this.esc_html($t));Mt=void 0!==It.pr&&It.pr}if(Mt){var Pt=this.get_number($t),Nt=vt+"_currency",Dt=this.get_price(Pt);xt[Nt]=Dt,xt[vt]=Pt,-1!==vt.indexOf("_price_field_price")&&(xt.data_grid_row_price=Pt),-1!==Nt.indexOf("_price_field_price_currency")&&(xt.data_grid_row_price_currency=Dt)}else xt[vt]=$t;-1!==vt.indexOf("_field_value")&&(xt.data_grid_row_value=$t),-1!==vt.indexOf("_field_parse_variable")&&(xt.data_grid_row_action_variable=$t),-1!==vt.indexOf("_field_label")&&(xt.data_grid_row_label=$t),-1!==vt.indexOf("_field_wc")&&(xt.data_grid_row_woocommerce_cart=$t)}}void 0!==f.mask_row_value&&(xt.row_value=this.mask_parse(f.mask_row_value,xt),xt.row_value.indexOf("#")>-1&&(xt.row_value=this.mask_parse(xt.row_value,xt))),void 0!==f.mask_row_price&&(xt.row_price=this.mask_parse(f.mask_row_price,xt)),kt.select_all?xt.row_id=this.form_id_prefix+"field-"+e.id+"-group-"+_t+"-row-"+kt.id+l:xt.row_id=this.form_id_prefix+"field-"+e.id+"-row-"+kt.id+l,xt.data_id=kt.id;var qt=$.extend(!0,{},xt),Tt=$.extend(!0,{},xt);Tt.label_id=this.form_id_prefix+"label-"+e.id+l,Tt.label_row_id=this.form_id_prefix+"label-"+e.id+"-row-"+kt.id+l;var zt=[];(!s&&kt.default||s&&!1!==Je&&_&&t.indexOf(xt[Je+"_compare"])>-1||s&&void 0!==xt.row_value&&_&&t.indexOf(xt.row_value)>-1)&&(zt.default=Ge),kt.disabled&&(zt.disabled=Ze),kt.required&&(zt.required=Be),zt.dedupe_value_scope=N,zt.hidden_bypass=D,zt.exclude_cart_total=q,xt.attributes="",Tt.attributes="",qt.attributes="";var Ct=$.extend(!0,[],zt);if(!a){var Et="horizontal"==we&&this.get_field_value_fallback(e.type,m,"class_inline",!1,!1,h);!1!==Et&&(Ct.class=Et.join(" "));var At=this.get_field_value_fallback(e.type,m,"class_row",!1,!1,h);if(!1!==At&&(Ct.class=!1!==Et?Ct.class+" "+At.join(" "):At.join(" ")),kt.disabled){var Yt=this.get_field_value_fallback(e.type,m,"class_row_disabled",!1,!1,h);!1!==Yt&&(Ct.class+=" "+Yt.join(" "))}}var Ut=$.extend(!0,[],this.get_field_value_fallback(e.type,m,"mask_row_attributes",[],!1,h));if(Ut.length>0){be=this.get_attributes(e,Ut,Ct,r);xt.attributes+=" "+be.attributes}if(void 0!==kt.hidden&&kt.hidden&&!a)switch(e.type){case"select":continue;default:xt.attributes+=' style="display: none;"'}"grid"==we&&""!=Fe&&(xt.attributes=this.attribute_modify(xt.attributes,"class",Fe,!0));Ct=$.extend(!0,[],zt);var Rt=this.get_field_value_fallback(e.type,m,"class_row_field_label",!1,!1,h);!1!==Rt&&(Ct.class=Rt.join(" "));var Lt=$.extend(!0,[],this.get_field_value_fallback(e.type,m,"mask_row_label_attributes",[],!1,h));if(a)Lt=p.filter(function(e){return-1!=Lt.indexOf(e)});if(Lt.length>0){be=this.get_attributes(e,Lt,Ct,r);Tt.attributes+=" "+be.attributes}Ct=$.extend(!0,[],zt);var Ht=this.get_field_value_fallback(e.type,m,"class_row_field",!1,!1,h);!1!==Ht&&(Ct.class=Ht.join(" ")),a||""==E||(Ct.class+=" "+E.trim()),Ct.aria_labelledby=Tt.label_row_id,(!s&&kt.default||s&&!1!==Je&&_&&t.indexOf(xt[Je+"_compare"])>-1)&&(Ct.default=Ge),kt.disabled&&(Ct.disabled=Ze),kt.required&&(Ct.required=Be),Ct.required_row=i.required;var Jt=$.extend(!0,[],this.get_field_value_fallback(e.type,m,"mask_row_field_attributes",[],!1,h));if(a)Jt=d.filter(function(e){return-1!=Jt.indexOf(e)});if(Jt.length>0){be=this.get_attributes(e,Jt,Ct,r);qt.attributes+=" "+be.attributes}if(""!=qt.attributes&&(qt.attributes=" "+qt.attributes),void 0!==kt.select_all&&(qt.attributes+=" data-wsf-select-all"),void 0!==kt.hierarchy&&""==we&&!Qe)switch(e.type){case"checkbox":case"price_checkbox":case"radio":case"price_radio":xt.attributes+=' data-wsf-hierarchy="'+this.esc_attr(kt.hierarchy)+'"';break;case"select":case"price_select":kt.hierarchy>0&&(xt.select_field_label=" ".repeat(kt.hierarchy)+xt.select_field_label)}if(de&&!pe)if(ue=this.form_id_prefix+"invalid-feedback-"+e.id+"-row-"+kt.id+l,fe.invalid_feedback_id=ue,de)ve=this.mask_parse(O,fe);else ve="";qt.invalid_feedback=wt?ve:"",Tt.invalid_feedback=wt?ve:"";var Gt=this.mask_parse(Re,qt);Tt.row_field=Gt,xt.row_field=Gt;var Bt=this.mask_parse(Le,Tt);xt.row_label=Bt,pt+=this.mask_parse(Ye,xt),Ie++}}}if(""!=Ce){var Zt={group:pt};"grid"==we&&""!=je&&(Zt.attributes=' class="'+this.esc_attr(je)+'"'),pt=this.mask_parse(Ce,Zt)}!1!==ze&&dt?(ot.group=pt,Oe+=this.mask_parse(ze,ot)):Oe+=pt}}}if(V.datalist=Ie>0?Oe:"",b.length>0){Ct=[];void 0!==ot&&void 0!==ot.group_id&&Ie>0&&(Ct.list=ot.group_id),""===this.get_object_meta_value(e,"aria_label",!1,!1,!0)&&(u&&-1!==x.indexOf("#attributes")?Ct.aria_labelledby=this.form_id_prefix+"label-"+e.id+l:Ct.aria_label=e.label),_e&&(Ct.aria_describedby=se),!1!==(A=this.get_field_value_fallback(e.type,m,"class_field",!1,!1,h))&&(Ct.class=A.join(" ")),""!=E&&(Ct.class+=" "+E.trim()),""!=(be=this.get_attributes(e,b,Ct,r)).attributes&&(V.attributes+=" "+be.attributes)}if(We.length>0){Ct=[];var Qt=this.get_field_value_fallback(e.type,m,"class_field_label",!1,!1,h);!1!==Qt&&(Ct.class=Qt.join(" ")),""!=(be=this.get_attributes(e,We,Ct,r)).attributes&&(ie.attributes+=" "+be.attributes)}if(oe.help_append_separator=_e?this.mask_parse(W,oe):"",""!=F){oe.text_clear=this.get_object_meta_value(e,"text_clear",""),""==oe.text_clear&&(oe.text_clear=this.language("clear")),oe.text_reset=this.get_object_meta_value(e,"text_reset",""),""==oe.text_reset&&(oe.text_reset=this.language("reset"));var Kt=this.mask_parse(F,oe)}else Kt="";oe.help_append=Kt,oe.attributes="";var Vt=_e||""!=Kt?this.mask_parse(S,oe):"";V.pre_help=ie.pre_help="bottom"==ne?"":Vt,V.post_help=ie.post_help="bottom"==ne?Vt:"",V.help=Vt,ie.help=Vt,""!=V.attributes&&(V.attributes=" "+V.attributes.trim()),""!=ie.attributes&&(ie.attributes=" "+ie.attributes.trim());var Xt=this.mask_parse(x,ie);if(""!=Xt&&!g){var ea=this.get_field_value_fallback(e.type,m,"mask_field_label_wrapper",!1,!1,h);if(!1!==ea){var ta={label:Xt};Xt=this.mask_parse(ea,ta)}}var aa=-1!==x.indexOf("#field");switch(m){case"inside":case"bottom":V.pre_label="",V.post_label=aa?V.label:Xt;break;case"top":V.pre_label=aa?V.label:Xt,V.post_label="";break;default:V.pre_label="",V.post_label="",ie.pre_label="",ie.post_label=""}if(""!==C||""!==z){var ra=$.extend(!0,{},V);ra.invalid_feedback=V.invalid_feedback,ra.pre_help=V.pre_help,ra.post_help=V.post_help,ra.pre_label=V.pre_label,ra.post_label=V.post_label,V.invalid_feedback="",V.pre_help="",V.post_help="",V.pre_label="",V.post_label="",ra.help=V.help,V.help=""}var ia=this.mask_parse(k,V);if(""!==C||""!==z){var sa=this.get_field_value_fallback(e.type,m,"col_small_prepend_factor",!1,!1,h),_a=this.get_field_value_fallback(e.type,m,"col_small_append_factor",!1,!1,h);if(!1!==sa&&!1!==_a){var oa=""!==C?Math.round(B*sa,0):0;ra.col_small_prepend=oa;var la=""!==z?Math.round(B*_a,0):0;ra.col_small_append=la,ra.col_small_field=B-(oa+la)}ra.field=ia;var na=this.get_field_value_fallback(e.type,m,"mask_field_input_group_field","#field",!1,h);if(""!==na&&(ia=this.mask_parse(na,ra)),""!==C){ra.prepend=C;var ca=this.get_field_value_fallback(e.type,m,"mask_field_input_group_prepend","#prepend",!1,h);if(""!==ca)ia=this.mask_parse(ca,ra)+ia}if(""!==z){ra.append=z;var da=this.get_field_value_fallback(e.type,m,"mask_field_input_group_append","#append",!1,h);if(""!==da)ia+=this.mask_parse(da,ra)}var pa=this.get_field_value_fallback(e.type,m,"mask_field_input_group","#field",!1,h),fa=[];""!==C&&fa.push("wsf-input-group-has-prepend"),""!==z&&fa.push("wsf-input-group-has-append");var ua=fa.join(" ");ua&&(ua=" "+ua),ra.css_input_group=ua,ra.field=ia,ia=this.mask_parse(pa,ra)}if(aa&&(ie.field=ia,Xt=this.mask_parse(x,ie),ia="",ie.field=""),-1!==k.indexOf("#label")&&(V.label=Xt,ia=this.mask_parse(k,V),Xt="",V.label=""),""!=ia&&!g){var ha=this.get_field_value_fallback(e.type,m,"mask_field_wrapper",!1,!1,h);if(!1!==ha){var ma={field:ia};ia=this.mask_parse(ha,ma)}}switch(m){case"right":ia+=Xt;break;case"left":ia=Xt+ia;break;default:aa&&(ia=Xt)}return V.field=ia,this.mask_parse(y,V)},$.WS_Form.prototype.attribute_modify=function(e,t,a,r){var i=this,s=!1,_="";return $("").each(function(){$.each(this.attributes,function(){if(this.specified){var e=this.name,o=this.value;e==t&&(r?o+=" "+a:o=a,o.trim(),s=!0),_+=" "+e,""!==o&&(_+='="'+i.esc_attr(o)+'"')}})}),s||(_+=" "+t,""!==a&&(_+='="'+this.esc_attr(a)+'"')),_},$.WS_Form.prototype.get_attributes=function(e,t,a,r){"object"!=typeof a&&(a=!1);var i=[],s=[];if(!1!==t)for(var _ in t)if(t.hasOwnProperty(_)){var o=t[_];if(void 0!==$.WS_Form.meta_keys[o]){var l=$.WS_Form.meta_keys[o];if(this.is_admin)var n=void 0!==l.mask?l.mask:"",c=void 0!==l.mask_disregard_on_empty&&l.mask_disregard_on_empty,d=void 0!==l.mask_disregard_on_zero&&l.mask_disregard_on_zero,p=void 0!==l.default?l.default:"";else n=void 0!==l.m?l.m:"",c=void 0!==l.e&&l.e,d=void 0!==l.z&&l.z,p=void 0!==l.d?l.d:"";if(!1!==a)if(void 0!==a[o])var f=a[o].trim();else f="";else{if(this.is_admin)var u=void 0!==l.key?l.key:o;else u=void 0!==l.k?l.k:o;var h=void 0!==l.c&&l.c;if(!1!==h){f=this.get_object_meta_value(e,u,p,!1,!1);f=this.parse_variables_process(f,r,!1,e,h).output}else f=this.get_object_meta_value(e,u,p,!1,!0);if(""==f&&void 0!==l.g){var m=l.g;void 0!==$.WS_Form.settings_plugin[m]&&$.WS_Form.settings_plugin[m]&&(f=$.WS_Form.settings_plugin[m])}s[u]=f}f=this.esc_html(f);var v=this.mask_parse(n,{value:f});(c&&""!=f||!c)&&(d&&0!=parseInt(f,10)||!d)&&(i.push(v),delete t[_])}}return t=this.array_remove_empty(t),{attributes:i.join(" "),mask_attributes:t,attribute_values:s}},$.WS_Form.prototype.get_number=function(e,t,a,r){if(void 0===t&&(t=0),void 0===a&&(a=!0),void 0===r&&(r=!1),"number"==typeof e&&(e=e.toString()),"string"!=typeof e)return 0;(e=e.trim()).includes(ws_form_settings.currency_symbol)&&(a=!0);var i=$.WS_Form.settings_plugin.price_decimal_separator;if(a){var s=$.WS_Form.settings_plugin.price_thousand_separator,_=ws_form_settings.currency_symbol;e.includes("&")&&(e=this.parse_html_entities(e)),e=e.replace(_,"");var o=new RegExp("[^0-9-"+i+"]","g");if(e=e.replace(o,""),""!==i&&""!==s&&i===s){if(e.substr(-3,1)===i){var l=e.length-3;e=e.substr(0,l)+"[dec]"+e.substr(l+1)}e=(e=e.replace(s,"")).replace("[dec]",".")}else""!==i&&(e=e.replace(i,"."))}else""!==i&&(e=e.replace(i,"."));var n=""===e.trim()?t:isNaN(e)?t:parseFloat(e);return!1!==r&&(n=this.get_number_rounded(parseFloat(n),r)),n},$.WS_Form.prototype.get_number_rounded=function(e,t){return Number(Math.round(e+"e"+t)+"e-"+t)},$.WS_Form.prototype.get_number_to_step=function(e,t){if(isNaN(t))return e;t||(t=1);var a=1/t;return Math.round(e*a)/a},$.WS_Form.prototype.get_float=function(e,t){return void 0===t&&(t=0),"number"==typeof e&&(e=e.toString()),"string"!=typeof e?0:(e=e.trim(),parseFloat(e))},$.WS_Form.prototype.get_currency=function(){var e={},t=parseInt($.WS_Form.settings_plugin.price_decimals,10);switch(e.prefix=ws_form_settings.currency_symbol,e.suffix="",$.WS_Form.settings_plugin.currency_position){case"right":e.prefix="",e.suffix=ws_form_settings.currency_symbol;break;case"left_space":e.prefix=ws_form_settings.currency_symbol+" ";break;case"right_space":e.prefix="",e.suffix=" "+ws_form_settings.currency_symbol}return e.decimals=t<0?0:t,e.decimal_separator=$.WS_Form.settings_plugin.price_decimal_separator,e.thousand_separator=$.WS_Form.settings_plugin.price_thousand_separator,e},$.WS_Form.prototype.get_price=function(e,t,a){return void 0===t&&(t=this.get_currency()),void 0===a&&(a=!0),"number"!=typeof e&&(e=parseFloat(e)),(a?t.prefix:"")+this.replace_all(this.replace_all(e.toFixed(t.decimals).replace(/\B(?=(\d{3})+(?!\d))/g,"[thousand]"),".",t.decimal_separator),"[thousand]",t.thousand_separator)+(a?t.suffix:"")},$.WS_Form.prototype.get_slug=function(e){return e.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-")},$.WS_Form.prototype.parse_html_entities=function(e){return e.replace(/([0-9]{1,3});/gi,function(e,t){var a=parseInt(t,10);return String.fromCharCode(a)})},$.WS_Form.prototype.form_add_hidden_input=function(e,t,a,r,i,s){var _=$('input[name="'+this.esc_selector(e)+'"]',this.form_canvas_obj);_.length&&-1===e.indexOf("[]")?_.val(t):(void 0===t&&(t=""),void 0===a&&(a=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===s&&(s="hidden"),this.form_canvas_obj.append('"))},$.WS_Form.prototype.get_part_id=function(e,t,a){void 0===t&&(t=!1),void 0===a&&(a="field");var r=!1!==t?"-repeat-"+t:"";return this.form_id_prefix+a+"-"+e+r},$.WS_Form.prototype.get_field_name=function(e,t,a){void 0===t&&(t=!1),void 0===a&&(a=!1);return this.field_name_prefix+e+(!1!==t?a?"_"+t:"["+t+"]":"")},$.WS_Form.prototype.is_iterable=function(e){return null!=e&&("object"==typeof e&&"function"==typeof e[Symbol.iterator])},$.WS_Form.prototype.is_integer=function(e){return!isNaN(e)&&/^\d+\.?\d*$/.test(e)},$.WS_Form.prototype.replace_all=function(e,t,a){return void 0===a?e.toString():e.split(t).join(a)},$.WS_Form.prototype.array_remove_empty=function(e){if("object"!=typeof e)return e;var t=[];for(var a in e)e.hasOwnProperty(a)&&null!==e[a]&&t.push(e[a]);return t},$.WS_Form.prototype.attribute_add_item=function(e,t,a){var r=e.attr(t);void 0!==r?-1===r.indexOf(a)&&e.attr(t,this.esc_attr(a)+(r?" ":"")+r):e.attr(t,this.esc_attr(a))},$.WS_Form.prototype.attribute_remove_item=function(e,t,a){var r=e.attr(t);if(void 0!==r&&-1!==r.indexOf(a)){var i=r.split(" "),s=this;(r=(i=i.filter(function(e){return e!==s.esc_attr(a)})).join(" "))?e.attr(t,r):e.removeAttr(t)}},$.WS_Form.prototype.get_date=function(e,t,a){switch(t||(t="date"),a||(a=ws_form_settings.date_format),t){case"time":return new Date("01/01/1970 "+e);case"date":e+=" 00:00:00";break;case"week":case"month":return!1}var r=!1;switch(a){case"d/m/Y":r="/";break;case"d.m.Y":r=".";break;case"d-m-Y":r="-"}if(!1!==r){switch(t){case"datetime-local":var i=e.indexOf(" "),s=e.substring(0,i),_=e.substring(i);break;default:s=e,_=""}var o=s.split(r);if(3===o.length){var l=parseInt(o[0],10);s=parseInt(o[1],10)+"/"+l+"/"+parseInt(o[2],10)}e=s+_}return e=e.replace(/(\d+)(st|nd|rd|th)/g,"$1"),e=this.replace_all(e,"."," "),e=this.replace_all(e," "," "),this.get_new_date(e)},$.WS_Form.prototype.get_new_date=function(e){return"-"!=e.charAt(4)||"-"!=e.charAt(7)||"T"==e.charAt(10)||":"!=e.charAt(13)||this.date_valid(e)||(e=e.replace(/-/g,"/")),"-"!=e.charAt(4)||this.date_valid(e)||-1===e.toLowerCase().indexOf("am")&&-1===e.toLowerCase().indexOf("pm")||(e=e.replace(/-/g,"/")),new Date(e)},$.WS_Form.prototype.date_valid=function(e){return e instanceof Date&&!isNaN(e.valueOf())},$.WS_Form.prototype.is_not_number=function(e){return isNaN(e)||"boolean"==typeof e||""===e},$.WS_Form.prototype.get_object_row_id=function(e){var t=e.object_row_id;return void 0!==t&&""!=t&&("object"==typeof t?(t=t.map(function(e){return parseInt(e,10)})).length||(t=!1):t=""!==t&&[parseInt(t,10)],t)},$.WS_Form.prototype.get_date_by_type=function(e,t){if(!e)return"";var a=this.get_object_meta_value(t,"format_date",ws_form_settings.date_format);a||(a=ws_form_settings.date_format);var r=this.get_object_meta_value(t,"format_time",ws_form_settings.time_format);r||(r=ws_form_settings.time_format);var i=this.get_object_meta_value(t,"input_type_datetime","date");switch(i){case"datetime-local":case"date":switch(a){case"d/m/Y":var s=-1!==e.indexOf(" ")?[e.substring(0,e.indexOf(" ")),e.substring(e.indexOf(" ")+1)]:[e];e=(_=s[0].split("/"))[1]+"/"+_[0]+"/"+_[2]+(void 0!==s[1]?" "+s[1]:"");break;case"d-m-Y":s=-1!==e.indexOf(" ")?[e.substring(0,e.indexOf(" ")),e.substring(e.indexOf(" ")+1)]:[e];e=(_=s.split("-"))[1]+"/"+_[0]+"/"+_[2]+(void 0!==s[1]?" "+s[1]:"");break;case"d.m.Y":var _;s=-1!==e.indexOf(" ")?[e.substring(0,e.indexOf(" ")),e.substring(e.indexOf(" ")+1)]:[e];e=(_=s[0].split("."))[1]+"/"+_[0]+"/"+_[2]+(void 0!==s[1]?" "+s[1]:"")}}switch("time"!==i&&4===e.indexOf("-")&&-1===e.indexOf(":")&&(e+=" 00:00:00"),i){case"date":return e=this.get_new_date(e),this.date_format(e,a);case"month":return e=this.get_new_date(e),this.date_format(e,"F Y");case"time":return e=this.get_new_date("1970-01-01 "+e),this.date_format(e,r);case"week":return e=this.get_new_date(e),this.language("week")+" "+this.date_format(e,"W, Y");default:return e=this.get_new_date(e),this.date_format(e,a+" "+r)}},$.WS_Form.prototype.number_format=function(e,t,a,r){if(void 0===e||null==e||!isFinite(e))return 0;if(!t){var i=e.toString().split(".").length;t=i>1?i:0}void 0===a&&(a="."),void 0===r&&(r=",");var s=(e=(e=parseFloat(e).toFixed(t)).replace(".",a)).split(a);return s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,r),e=s.join(a)},$.WS_Form.prototype.date_format=function(e,t){var a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=["January","February","March","April","May","June","July","August","September","October","November","December"],i=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_={d:function(){var e=this.getDate();return(e<10?"0":"")+e},D:function(){return i[this.getDay()]},j:function(){return this.getDate()},l:function(){return s[this.getDay()]},N:function(){var e=this.getDay();return 0===e?7:e},S:function(){var e=this.getDate();return e%10==1&&11!==e?"st":e%10==2&&12!==e?"nd":e%10==3&&13!==e?"rd":"th"},w:function(){return this.getDay()},z:function(){var e=new Date(this.getFullYear(),0,1);return Math.ceil((this-e)/864e5)},W:function(){var e=new Date(this.valueOf()),t=(this.getDay()+6)%7;e.setDate(e.getDate()-t+3);var a=e.valueOf();e.setMonth(0,1),4!==e.getDay()&&e.setMonth(0,1+(4-e.getDay()+7)%7);var r=1+Math.ceil((a-e)/6048e5);return r<10?"0"+r:r},F:function(){return r[this.getMonth()]},m:function(){var e=this.getMonth();return(e<9?"0":"")+(e+1)},M:function(){return a[this.getMonth()]},n:function(){return this.getMonth()+1},t:function(){var e=this.getFullYear(),t=this.getMonth()+1;return 12===t&&(e=e++,t=0),new Date(e,t,0).getDate()},L:function(){var e=this.getFullYear();return e%400==0||e%100!=0&&e%4==0},o:function(){var e=new Date(this.valueOf());return e.setDate(e.getDate()-(this.getDay()+6)%7+3),e.getFullYear()},Y:function(){return this.getFullYear()},y:function(){return(""+this.getFullYear()).substr(2)},a:function(){return this.getHours()<12?"am":"pm"},A:function(){return this.getHours()<12?"AM":"PM"},B:function(){return Math.floor(1e3*((this.getUTCHours()+1)%24+this.getUTCMinutes()/60+this.getUTCSeconds()/3600)/24)},g:function(){return this.getHours()%12||12},G:function(){return this.getHours()},h:function(){var e=this.getHours();return((e%12||12)<10?"0":"")+(e%12||12)},H:function(){var e=this.getHours();return(e<10?"0":"")+e},i:function(){var e=this.getMinutes();return(e<10?"0":"")+e},s:function(){var e=this.getSeconds();return(e<10?"0":"")+e},v:function(){var e=this.getMilliseconds();return(e<10?"00":e<100?"0":"")+e},e:function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},I:function(){for(var e=null,t=0;t<12;++t){var a=new Date(this.getFullYear(),t,1).getTimezoneOffset();if(null===e)e=a;else{if(ae)break}}return this.getTimezoneOffset()===e|0},O:function(){var e=this.getTimezoneOffset();return(-e<0?"-":"+")+(Math.abs(e/60)<10?"0":"")+Math.floor(Math.abs(e/60))+(0===Math.abs(e%60)?"00":(Math.abs(e%60)<10?"0":"")+Math.abs(e%60))},P:function(){var e=this.getTimezoneOffset();return(-e<0?"-":"+")+(Math.abs(e/60)<10?"0":"")+Math.floor(Math.abs(e/60))+":"+(0===Math.abs(e%60)?"00":(Math.abs(e%60)<10?"0":"")+Math.abs(e%60))},T:function(){var e=this.toLocaleTimeString(navigator.language,{timeZoneName:"short"}).split(" ");return e[e.length-1]},Z:function(){return 60*-this.getTimezoneOffset()},c:function(){return this.format("Y-m-d\\TH:i:sP")},r:function(){return this.toString()},U:function(){return Math.floor(this.getTime()/1e3)}};return t.replace(/(\\?)(.)/g,function(t,a,r){return""===a&&_[r]?_[r].call(e):r})}}(jQuery);