(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,i(a.key),a)}}function i(e){var i=function(e,i){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,i||"default");if("object"!=t(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}(e,"string");return"symbol"==t(i)?i:i+""}var n,a=function(){return i=function t(e,i,n,a){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$=e,this.$theForm=i,this.fluentFormVars=n,this.formSelector=a,this.activeStep=0,this.isRtl=!!window.fluentFormVars.is_rtl,this.isPopulatingStepData=!1,this.isInitialLoad=!0,this.fluentFormVars.stepAnimationDuration=parseInt(this.fluentFormVars.stepAnimationDuration),this.stepPersistency="yes"===this.$theForm.find(".ff-step-container").attr("data-enable_step_data_persistency"),this.stepResume=!1,this.stepPersistency&&(this.stepResume="yes"===this.$theForm.find(".ff-step-container").attr("data-enable_step_page_resume"))},n=[{key:"getPublicAPI",value:function(){return{init:this.init.bind(this),updateSlider:this.updateSlider.bind(this),populateFormDataAndSetActiveStep:this.populateFormDataAndSetActiveStep.bind(this)}}},{key:"init",value:function(){this.initFormWithSavedState(),this.removePrevFromFirstStep(),this.initStepSlider(),this.maybeAutoSlider()}},{key:"removePrevFromFirstStep",value:function(){this.$theForm.find(".fluentform-step:first").find('.step-nav [data-action="prev"]').remove()}},{key:"getFormInstance",value:function(){return window.fluentFormApp(this.$theForm)}},{key:"syncStepTitleState",value:function(t,e){var i=this.$;t&&t.length&&(t.removeClass("ff_active ff_completed").removeAttr("aria-current"),i.each(t,function(t,n){var a=i(n);t<e?a.addClass("ff_completed"):t===e&&a.addClass("ff_active").attr("aria-current","step")}))}},{key:"enhanceClickableStepTitles",value:function(t){var e=this.$;e.each(t,function(t,i){e(i).attr("data-step-number",t),e(i).attr({role:"button",tabindex:"0","aria-label":"Go to step "+(t+1)})})}},{key:"syncTopTabOverflowState",value:function(){var t=this.$;this.$theForm.find(".ff-step-header--tabs-top .ff-step-titles").each(function(){var e=t(this),i=this.scrollWidth>this.clientWidth+1;e.toggleClass("ff-step-titles--overflowing",i)})}},{key:"isTabsIndicator",value:function(t){return"tabs"===t||"steps_with_nav"===t}},{key:"initFormWithSavedState",value:function(){var t=this;if(this.stepPersistency){var e=this.$,i=this;e(document).ready(function(n){var a,s;e.getJSON(t.fluentFormVars.ajaxUrl,{form_id:t.$theForm.data("form_id"),action:"fluentform_step_form_get_data",nonce:null===(a=t.fluentFormVars)||void 0===a?void 0:a.nonce,hash:null===(s=t.fluentFormVars)||void 0===s?void 0:s.hash}).then(function(t){t&&i.populateFormDataAndSetActiveStep(t)})})}}},{key:"populateFormDataAndSetActiveStep",value:function(t){var e=this,i=t.response,n=t.step_completed,a=this.$,s=[];if(this.$theForm.data("ff_restoring_draft_state",!0),this.$theForm.data("ff_restored_draft_state",!0),a.each(i,function(t,i){if(i){var n=Object.prototype.toString.call(i);if("[object Object]"===n){var r=e.$theForm.find("[data-name=".concat(t,"]"));if(r.length&&"tabular-element"===r.attr("data-type"))jQuery.each(i,function(i,n){var s=e.$theForm.find('[name="'.concat(t,"[").concat(i,']\\[\\]"]'));s.length||(s=e.$theForm.find('[name="'.concat(t,"[").concat(i,']"]'))),a.each(s,function(t,e){var i=a(e).val();-1===a.inArray(i,n)&&i!==n||a(e).prop("checked",!0).change()})});else if("chained-select"===r.attr("data-type")){var o={meta_key:r.find("select:first").attr("data-meta_key"),form_id:r.closest("form").attr("data-form_id"),action:"fluentform_get_chained_select_options",filter_options:"all",keys:i};a.getJSON(e.fluentFormVars.ajaxUrl,o).then(function(t){a.each(t,function(t,e){var n=r.find("select[data-key='".concat(t,"']"));0!=n.attr("data-index")&&a.each(e,function(t,e){n.append(a("<option />",{value:e,text:e}))}),n.attr("disabled",!1).val(i[t])})})}else a.each(i,function(i,n){e.$theForm.find('[name="'.concat(t,"[").concat(i,']"]')).val(n).change()})}else if("[object Array]"===n){var f=e.$theForm.find("[name=".concat(t,"]"));if("file"===(f=(f=f.length?f:e.$theForm.find("[data-name=".concat(t,"]"))).length?f:e.$theForm.find("[name=".concat(t,"\\[\\]]"))).attr("type"))e.addFilesToElement(f,i);else if(f.prop("multiple"))if(a.isFunction(window.Choices)){var l=f.data("choicesjs");l&&s.push({handler:l,values:i})}else f.val(i).change();else if("repeater_field"===f.attr("data-type")){var c=f.find("tbody"),d=f.attr("data-name");a.each(i,function(t,e){0!=t?c.find("tr:last").clone().appendTo(c).find(".ff-el-form-control").each(function(i,n){var s="ffrpt-"+(new Date).getTime()+i;a(n).val(e[i]),a(n).attr({id:s,name:"".concat(d,"[").concat(t,"][]"),value:e[i]}).change()}):c.find("tr:first .ff-el-form-control").each(function(t,i){a(i).val(e[t]).change()})})}else"repeater_container"===f.attr("data-type")?(a.each(i,function(t,e){if(0!==t){var i=f.find(".ff_repeater_cont_row:first").clone();i.find(".ff_repeater_cell").each(function(i,n){var s=a(this).find(".ff-el-form-control:last-child"),r="ffrpt-"+(new Date).getTime()+"_"+t+"_"+i,o={value:e[i]||"",id:r};s.prop(o),a(this).find("label").attr("for",r)}),i.insertAfter(f.find(".ff_repeater_cont_row:last"))}else f.find(".ff_repeater_cont_row:first .ff-el-form-control").each(function(t,i){a(i).val(e[t]).change()})}),e.$theForm.trigger("repeater-container-names-update",[f]),f.trigger("repeat_change")):f.each(function(t,e){-1!==a.inArray(a(e).val(),i)&&a(e).prop("checked",!0).change()})}else{var p=e.$theForm.find("[name=".concat(t,"]"));if(p.hasClass("fluentform-post-content")&&window.wp&&window.wp.editor){var u=p.attr("id");window.tinymce.get(u).setContent(i)}if("undefined"!=typeof flatpickr&&p.prop("_flatpickr")){var h=p.prop("_flatpickr");h&&(h.config.altInput?h.setDate(i,!0):p.val(i).trigger("change"))}if("radio"===p.prop("type")||"checkbox"===p.prop("type"))a("[name=".concat(t,'][value="').concat(i,'"]')).prop("checked",!0).change(),e.$theForm.find("[name=".concat(t,'][value="').concat(i,'"]')).prop("checked",!0).change(),p.closest(".ff-el-group").find(".ff-el-ratings").length&&e.$theForm.find("[name=".concat(t,'][value="').concat(i,'"]')).closest("label").trigger("mouseenter");else{p.hasClass("ff_has_multi_select")&&p.data("choicesjs")&&(p.data("choicesjs").removeActiveItems(i),p.data("choicesjs").setChoiceByValue(i));var v=p.closest(".ff-el-group").find(".fluentform-signature-pad");if(v.length){var m=v[0].getContext("2d"),_=new Image;_.src=i,_.onload=function(){m.drawImage(_,0,0)}}p.val(i).change()}}}}),s.length>0)for(var r=0;r<s.length;r++){var o,f=s[r].handler,l=s[r].values;f.removeActiveItems(l),f.setChoiceByValue(l);var c=null===(o=f.passedElement)||void 0===o?void 0:o.element;c&&a(c).trigger("change")}this.$theForm.data("ff_restoring_draft_state",!1),this.isPopulatingStepData=!0;var d=this.fluentFormVars.stepAnimationDuration;this.stepResume&&this.updateSlider(n,d,!0).then(function(){e.handleFocus(d)}).catch(function(t){console.error("An error occurred during the slider update:",t)}),this.isPopulatingStepData=!1}},{key:"initStepSlider",value:function(){var t=this.$,e=this.$theForm.find(".fluentform-step"),i=e.length,n=this.$theForm.find(".ff-step-titles li"),a=this.$theForm.find(".ff-step-container").first().data("progress_indicator"),s=this.isTabsIndicator(a);if(!window.ff_disable_auto_step){for(var r=this.activeStep,o=0;r<i&&this.isStepAllFieldsHidden(t(e[r]))&&o<i;)r++,o++;r!==this.activeStep&&r<i&&(this.activeStep=r)}e.css("display","none"),t(e[this.activeStep]).css("display","block"),e.attr("role","group"),e.attr("aria-hidden","true"),t(e[this.activeStep]).attr("aria-hidden","false"),t(e[this.activeStep]).addClass("active"),this.syncStepTitleState(n,this.activeStep);var f=e.first();f.hasClass("active")&&f.find('button[data-action="next"]').css("visibility","visible"),e.length&&!e.last().hasClass("active")&&this.$theForm.find('button[type="submit"]').css("visibility","hidden"),this.stepProgressBarHandle({activeStep:this.activeStep,totalSteps:i}),this.registerStepNavigators(this.fluentFormVars.stepAnimationDuration),s?(this.registerClickableStepNav(n,e),this.syncTopTabOverflowState(),t(window).off("resize.ff_step_tabs_"+this.$theForm.data("form_id")).on("resize.ff_step_tabs_"+this.$theForm.data("form_id"),this.syncTopTabOverflowState.bind(this))):t(window).off("resize.ff_step_tabs_"+this.$theForm.data("form_id"))}},{key:"registerClickableStepNav",value:function(t,e){var i=this.$,n=this;0!==t.length&&(this.enhanceClickableStepTitles(t),t.on("click keydown",function(t){if("keydown"!==t.type||"Enter"===t.key||" "===t.key||13===t.keyCode||32===t.keyCode){"keydown"===t.type&&t.preventDefault();var a=n.getFormInstance(),s=i(this),r=n.fluentFormVars.stepAnimationDuration,o=e.index(n.$theForm.find(".fluentform-step.active"));try{var f=parseInt(s.data("step-number"),10);if(isNaN(f))return;if(f===o)return;f>o&&i.each(e,function(t,e){if(t<f){var n=i(e).find(":input").not(":button").filter(function(t,e){return!i(e).closest(".has-conditions").hasClass("ff_excluded")});n.length&&a.validate(n)}}),n.updateSlider(f,r,!0).then(function(){n.handleFocus(r)}).catch(function(t){console.error("An error occurred during the slider update:",t)})}catch(t){if(!(t instanceof window.ffValidationError))throw t;n.updateSlider(o,r,!0).then(function(){n.handleFocus(r)}).catch(function(t){console.error("An error occurred during the slider update:",t)}),a.showErrorMessages(t.messages),a.scrollToFirstError(350)}}}))}},{key:"stepProgressBarHandle",value:function(t){var e=this.$;if(this.$theForm.find(".ff-el-progress").length){var i=t.totalSteps,n=t.activeStep,a=100/i*(n+1),s=this.$theForm.find(".ff-el-progress-title li"),r=this.$theForm.find(".ff-step-header .ff-el-progress-bar"),o=r.find("span"),f=this.$theForm.find(".ff-step-container").first(),l=this.isTabsIndicator(f.data("progress_indicator"));r.css({transition:"width 0.3s ease-in-out",width:a+"%"}),a?r.append(o.text(parseInt(a)+"%")):o.empty();var c=this.fluentFormVars.step_text,d=e(s[n]).text();c=l?parseInt(a)+"% "+this.fluentFormVars.step_completed_text:c.replace("%activeStep%",n+1).replace("%totalStep%",i).replace("%stepTitle%",d),this.$theForm.find(".ff-el-progress-status").html(c).attr("aria-live","polite"),s.css("display","none"),e(s[n]).css("display","inline")}}},{key:"isStepAllFieldsHidden",value:function(t){return this.$,t.find(".ff-el-group").not(".ff-custom_html").length,!1}},{key:"animateProgressToStep",value:function(t,e,i){this.$;var n=this.$theForm.find(".ff-step-header .ff-el-progress-bar");if(!n.length||!e)return Promise.resolve();var a=100/e*(t+1);return i&&i>0?n.css({transition:"width ".concat(i,"ms ease-in-out")}):n.css({transition:"none"}),n[0]&&n[0].offsetHeight,n.css("width",a+"%"),new Promise(function(t){var e=!1,a=setTimeout(function(){e||(e=!0,t())},(i||0)+120);n.one("transitionend webkitTransitionEnd oTransitionEnd",function(){e||(e=!0,clearTimeout(a),t())})})}},{key:"registerStepNavigators",value:function(t){var e=this.$,i=this;this.handleFocus(t),e(this.formSelector).on("click",".fluentform-step .step-nav button, .fluentform-step .step-nav img",function(n){var a=e(this).data("action"),s="next",r=e(this).closest(".fluentform-step"),o=i.getFormInstance();if("next"===a){try{var f=r.find(":input").not(":button").filter(function(t,i){return!e(i).closest(".has-conditions").hasClass("ff_excluded")});f.length&&o.validate(f),i.activeStep++}catch(n){if(!(n instanceof window.ffValidationError))throw n;return o.showErrorMessages(n.messages),void o.scrollToFirstError(350)}i.$theForm.trigger("ff_to_next_page",i.activeStep),e(document).trigger("ff_to_next_page",{step:i.activeStep,form:i.$theForm});var l=i.$theForm.find(".fluentform-step");i.$theForm.trigger("ff_render_dynamic_smartcodes",e(l[i.activeStep]))}else i.activeStep--,s="prev",i.$theForm.trigger("ff_to_prev_page",i.activeStep),e(document).trigger("ff_to_prev_page",{step:i.activeStep,form:i.$theForm});var c="yes"!=i.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");i.updateSlider(i.activeStep,t,c,s).then(function(){i.handleFocus(t)}).catch(function(t){console.error("An error occurred during the slider update:",t)})})}},{key:"updateSlider",value:function(t,e){var i=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"next",s=this.$,r=this;return new Promise(function(o){s("div"+i.formSelector+"_errors").empty(),i.activeStep=t;var f=i.$theForm.find(".ff-step-titles li"),l=i.$theForm.find(".fluentform-step"),c=l.length;if(!window.ff_disable_auto_step&&c){var d=r.$theForm.find(".fluentform-step").index(r.$theForm.find(".fluentform-step.active"));if("prev"===a||d>-1&&i.activeStep<d)for(;i.activeStep>0&&i.isStepAllFieldsHidden(s(l[i.activeStep]));)i.activeStep--;else for(;i.activeStep<c-1&&i.isStepAllFieldsHidden(s(l[i.activeStep]));)i.activeStep++}l.css("display","none").removeClass("active").attr("aria-hidden","true"),s(l[i.activeStep]).css("display","block").addClass("active").attr("aria-hidden","false"),i.syncStepTitleState(f,i.activeStep);var p=s(l[i.activeStep]).closest(".ff-step-container").data("animation_type"),u=s(l[i.activeStep]).closest(".ff-step-container"),h=s(l[i.activeStep]).closest(".ff-step-body"),v=i.isTabsIndicator(u.data("progress_indicator"));v&&h.css("overflow","hidden");var m=s(l[i.activeStep]);m.find(".step-nav button, .step-nav img").css("visibility","hidden");var _,g=c;_="none"===p?0===e?0:e<50?50:e<200?e:window.ffTransitionTimeOut||500:e;var y,b=i.animateProgressToStep(i.activeStep,g,_);switch(p){case"slide":m.css({display:"block",position:"relative",left:i.isRtl?"-100%":"100%",opacity:0,transition:"all ".concat(e,"ms cubic-bezier(0.25, 0.1, 0.25, 1.0)")}),m[0].offsetHeight,m.css({left:"0%",opacity:1}),y=new Promise(function(t){return setTimeout(function(){m.css({position:"",left:"",transition:""}),t()},e+50)});break;case"fade":m.css({display:"block",opacity:0,transition:"opacity ".concat(e,"ms ease-in-out")}),m[0].offsetHeight,m.css("opacity",1),y=new Promise(function(t){return setTimeout(function(){m.css("transition",""),t()},e+50)});break;case"slide_down":m.css({display:"block",opacity:0,maxHeight:"0",overflow:"hidden",transition:"all ".concat(e,"ms cubic-bezier(0.25, 0.1, 0.25, 1.0)")}),m[0].offsetHeight;var w=m[0].scrollHeight;m.css({maxHeight:w+"px",opacity:1}),y=new Promise(function(t){return setTimeout(function(){m.css({maxHeight:"",overflow:"",transition:""}),t()},e+50)});break;default:var F,S=window.ffTransitionTimeOut||500;F=e<50&&e>0?50:e<S?e:S,y=new Promise(function(t){return setTimeout(t,F)})}Promise.all([y,b]).then(function(){n&&function(){if(!window.ff_disable_step_scroll){var t,e,i,n,a,o,f=r.$theForm.find(".ff_step_start");t=window.ff_scroll_top_offset?window.ff_scroll_top_offset:f.offset().top-100,n=(i=(e=f).offset().top)+e.outerHeight(),o=(a=s(window).scrollTop())+s(window).height(),n>a&&i<o&&!window.ff_force_scroll||s("html, body").animate({scrollTop:t},500,"swing")}}(),function(){v&&h.css("overflow","");var e=0===t&&!n,i=r.$theForm.hasClass("ff_submitting");if(!r.stepPersistency||r.isPopulatingStepData||e||i||r.saveStepData(r.$theForm,r.activeStep).then(function(t){}),r.stepProgressBarHandle({activeStep:r.activeStep,totalSteps:c}),l.last().hasClass("active")?r.$theForm.find('button[type="submit"]').css("visibility","visible"):r.$theForm.find('button[type="submit"]').css("visibility","hidden"),!window.ff_disable_auto_step){r.$theForm.find(".fluentform-step.active");var f=r.$theForm.find(".fluentform-step.active > div").length-1,d=r.$theForm.find(".fluentform-step.active > .ff_excluded").length;if(r.$theForm.find(".fluentform-step.active > .ff-t-container").length&&(f-=r.$theForm.find(".fluentform-step.active > .ff-t-container").length,f+=r.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > div").length,d+=r.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > .ff_excluded").length,r.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length&&(d-=r.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length,d-=r.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > .ff_excluded").length,d+=r.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > div").length)),f===d){var p="prev"===a?r.activeStep-1:r.activeStep+1;if(p>=0&&p<c){var u="none"===s(l[p]).closest(".ff-step-container").data("animation_type")?50:100;return void r.updateSlider(p,u,n,a).then(function(){o()}).catch(function(t){console.error("An error occurred during step skip:",t),o()})}}}r.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="next"]').css("visibility","visible"),r.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="prev"]').css("visibility","visible"),r.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="next"]').css("visibility","visible"),r.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="prev"]').css("visibility","visible"),o()}()})})}},{key:"handleFocus",value:function(t){var e=this.$,i=this,n=!1,a=function(n){var a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s="yes"!=i.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");if(!i.isInitialLoad){var r;if(s){if(!window.ff_disable_step_scroll){var o=n.find("input, .ff-custom_html, select, textarea, button, a").filter(":visible");o.length&&a&&setTimeout(function(){o.first().focus()},t+50)}}else null!==(r=window.fluentFormVars)&&void 0!==r&&r.step_change_focus&&!window.ff_disable_step_scroll&&setTimeout(function(){e("".concat(i.formSelector," .fluentform-step.active")).attr("tabindex","-1").focus().removeAttr("tabindex")},t);i.isInitialLoad=!1}};i.$theForm.off("keydown.stepNavigation").on("keydown.stepNavigation",function(t){if(!n&&(" "===t.key||32===t.keyCode)){var a=e("".concat(i.formSelector," .fluentform-step.active .ff-btn-next")),s=e("".concat(i.formSelector," .fluentform-step.active .ff-btn-prev"));return document.activeElement===a[0]?(t.preventDefault(),void a.click()):document.activeElement===s[0]?(t.preventDefault(),void s.click()):void 0}}),this.$theForm.on("ff_to_next_page ff_to_prev_page",function(){n=!0,setTimeout(function(){n=!1,a(i.$theForm.find(".fluentform-step.active"),!0)},t+50)}),"yes"!==this.$theForm.find(".ff-step-container").attr("data-disable_auto_focus")&&0!==i.$theForm.find(".fluentform-step").index(i.$theForm.find(".fluentform-step.active"))&&!this.isInitialLoad&&a(e("".concat(this.formSelector," .fluentform-step.active")),!0),this.isInitialLoad=!1}},{key:"saveStepData",value:function(t,e){var i,n=this.$,a=t.find(":input").filter(function(t,e){return!n(e).closest(".has-conditions").hasClass("ff_excluded")});a.filter(function(t,e){var i=n(e);return i.parents().hasClass("ff_repeater_table")&&"select"==i.attr("type")&&!i.val()}).prepend("<option selected disabled />");var s=a.serialize();n.each(t.find("[type=file]"),function(t,e){var i={},a=e.name+"[]";i[a]=[],n(e).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each(function(t,e){i[a][t]=n(this).data("src")}),n.each(i,function(t,e){if(e.length){var i={};i[t]=e,s+="&"+n.param(i)}})});var r={active_step:e,data:s,form_id:t.data("form_id"),action:"fluentform_step_form_save_data",nonce:null===(i=this.fluentFormVars)||void 0===i?void 0:i.nonce};return n.post(this.fluentFormVars.ajaxUrl,r)}},{key:"maybeAutoSlider",value:function(){var t=this.$;if("yes"==this.$theForm.find(".ff-step-container").attr("data-enable_auto_slider")){var e=function(t){if(1==t.closest(".fluentform-step.active").find(".ff-el-group:not(.ff_excluded):not(.ff-custom_html)").length)if(t.closest(".fluentform-step.active").find(".ff_excluded").length){var e=window.ffTransitionTimeOut||500;setTimeout(function(){t.closest(".fluentform-step.active").find(".ff-btn-next").trigger("click")},e)}else t.closest(".fluentform-step.active").find(".ff-btn-next").trigger("click")};this.$theForm.find(".ff-el-form-check-radio,.ff-el-net-label, .ff-el-ratings label").on("click",function(){e(t(this))}),this.$theForm.find("select").on("change",function(){e(t(this))})}}},{key:"addFilesToElement",value:function(e,i){var n=this.$,a=this,s=e.closest(".ff-el-input--content").find(".ff-uploaded-list");n.each(i,function(e,i){i="object"===t(i)?i:{url:i,data_src:i};var r=n("<div/>",{class:"ff-upload-preview","data-src":i.data_src,style:"border: 1px solid rgb(111, 117, 125)"}),o=n("<div/>",{class:"ff-upload-thumb"});o.append(n("<div/>",{class:"ff-upload-preview-img",style:"background-image: url('".concat(a.getThumbnail(i.url),"');")}));var f=n("<div/>",{class:"ff-upload-details"}),l=n("<span/>",{html:a.fluentFormVars.upload_completed_txt,class:"ff-upload-progress-inline-text ff-inline-block"}),c=i.url.substring(i.url.lastIndexOf("/")+1);c.includes("-ff-")&&(c=c.substring(c.lastIndexOf("-ff-")+4));var d=n("<div/>",{class:"ff-upload-filename",html:c}),p=n('\n            <div class="ff-upload-progress-inline ff-el-progress">\n                <div style="width: 100%;" class="ff-el-progress-bar"></div>\n            </div>\n        '),u=n("<span/>",{"data-href":"#",html:"&times;",class:"ff-upload-remove"}),h=n("<div>",{class:"ff-upload-filesize ff-inline-block",html:""}),v=n("<div>",{class:"ff-upload-error",style:"color:red;"});f.append(d,p,l,h,v,u),r.append(o,f),s.append(r)}),e.trigger("change_remaining",-i.length),e.trigger("change")}},{key:"getThumbnail",value:function(t){if(!t)return"";var e=t.split(/[#?]/)[0].split(".").pop().trim().toLowerCase();if(-1!=["jpg","jpeg","gif","png"].indexOf(e))return t;var i=document.createElement("canvas");i.width=60,i.height=60,i.style.zIndex=8,i.style.position="absolute",i.style.border="1px solid";var n=i.getContext("2d");return n.fillStyle="rgba(0, 0, 0, 0.2)",n.fillRect(0,0,60,60),n.font="13px Arial",n.fillStyle="white",n.textAlign="center",n.fillText(e,30,30,60),i.toDataURL()}}],n&&e(i.prototype,n),a&&e(i,a),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n,a}();(n=jQuery)(document.body).on("fluentform_init",function(t,e,i){var s="."+i.form_instance,r=-1,o="no";function f(t,e){var n="fluentform_save_progress_messages_"+i.id;return window[n]&&window[n][t]?window[n][t]:e}if(n(s).hasClass("ff-form-has-save-progress")){n(s).hasClass("ff-form-has-steps")&&(e.on("ff_to_next_page",function(t,e){o=e}),e.on("ff_to_prev_page",function(t,e){o=e})),n(s).find(".ff-btn-save-progress").each(function(t,i){var a=n(i);a.on("click",function(t){var i,s=this;t.preventDefault(),a.addClass("ff-working");var l=e.find(":input").filter(function(t,e){return!n(e).closest(".has-conditions").hasClass("ff_excluded")});l.filter(function(t,e){var i=n(e);return i.parents().hasClass("ff_repeater_table")&&"select"==i.attr("type")&&!i.val()}).prepend("<option selected disabled />");var c=l.serialize();n.each(e.find("[type=file]"),function(t,e){var i={},a=e.name+"[]";i[a]=[],n(e).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each(function(t,e){i[a][t]=n(this).data("src")}),n.each(i,function(t,e){if(e.length){var i={};i[t]=e,c+="&"+n.param(i)}})}),r=null===(i=window.form_state_save_vars)||void 0===i?void 0:i.key;var d={source_url:window.form_state_save_vars.source_url,action:"fluentform_save_form_progress_with_link",data:c,form_id:e.data("form_id"),hash:r,active_step:o,nonce:window.form_state_save_vars.nonce,save_progress_btn_name:n(a).attr("name")},p=d.form_id+"_save_progress_msg",u="#"+p;jQuery.post(fluentFormVars.ajaxUrl,d).then(function(t){if(t){var i;r=t.data.hash,e.find(".ff-saved-state-link"),""!=(null===(i=t.data)||void 0===i?void 0:i.message)&&(n(u).length&&n(u).slideUp("fast"),n("<div/>",{id:p,class:"ff-message-success ff-el-group"}).html(t.data.message).insertBefore(a.closest(".ff-el-group")));var o=f("copy_button",window.form_state_save_vars.copy_button||"Copy"),l='<div class="ff-el-input--content">\n                                <div class="ff_input-group">\n                                    <input readonly value="'.concat(t.data.saved_url,'" class="ff-el-form-control" >\n                                    <div class="ff_input-group-append">\n                                        <button class="ff-btn ff-btn-md ff_btn_style ff_btn_copy_link ff_input-group-text">').concat(o,"</button>\n                                    </div>\n                                </div>\n                            </div>"),c=n("<div/>",{class:"ff-el-group ff-saved-state-input ff-saved-state-link ff-hide-group",html:l});n(s).closest(".ff-el-group").after(c),c.fadeIn(),c.find("input.ff-el-form-control").on("keypress",function(t){13!==t.which&&13!==t.keyCode||(t.preventDefault(),n(this).siblings(".ff_input-group-append").find(".ff_btn_copy_link").click())});var d=f("email_placeholder",window.form_state_save_vars.email_placeholder_str||"Your Email Here"),h=f("email_button",window.form_state_save_vars.email_button||"Email");if(n(s).hasClass("ff_resume_email_enabled")){var v='<div class="ff-el-input--content">\n                                    <div class="ff_input-group">\n                                        <input type="email" class="ff-el-form-control" placeholder="'.concat(d,'">\n                                        <div class="ff_input-group-append">\n                                            <button class="ff-btn ff-btn-md ff_btn_style ff_btn_is_email ff_input-group-text">').concat(h,"</button>\n                                        </div>\n                                    </div>\n                                </div>"),m=n("<div/>",{class:"ff-el-group ff-saved-state-input  ff-email-address ff-hide-group",html:v});n(c).after(m),m.fadeIn(),m.find("input.ff-el-form-control").on("keypress",function(t){13!==t.which&&13!==t.keyCode||(t.preventDefault(),n(this).siblings(".ff_input-group-append").find(".ff_btn_is_email").click())})}}}).fail(function(t){n(u).length&&n(u).slideUp("fast"),n("<div/>",{id:p,class:"ff-message-success ff-el-group text-danger"}).html(t.responseJSON.data.message).insertBefore(a.closest(".ff-el-group"))}).always(function(){a.parent().hide()})})}),n(s).on("click",".ff_btn_copy_link",function(t){t.preventDefault();var e=n(this).closest(".ff-el-input--content").find(".ff-el-form-control").val();navigator.clipboard.writeText(e);var i=f("copy_success",window.form_state_save_vars.copy_success_button||"Copied");n(this).html("".concat(i))}),n(s).on("click",".ff_btn_is_email",function(t){t.preventDefault();var i=n(this).closest(".ff-el-group"),a=n(this).closest(".ff-email-address").find("input").val();n(".ff-email-address").find("input").val("");var s=n(".ff-saved-state-link").find("input").val(),o={source_url:window.form_state_save_vars.source_url,action:"fluentform_email_progress_link",form_id:e.data("form_id"),to_email:a,link:s,hash:r,nonce:window.form_state_save_vars.nonce},f=o.form_id+"_save_progress_email_response",l="#"+f;jQuery.post(fluentFormVars.ajaxUrl,o).then(function(t){t&&(i.removeClass("ff-el-is-error"),n(l).length&&n(l).slideUp("fast"),n("<div/>",{id:f,class:"ff-message-success ff-el-group"}).html(t.data.response).insertAfter(i))}).fail(function(t){t&&(i.addClass("ff-el-is-error"),n(l).length&&n(l).slideUp("fast"),n("<div/>",{id:f,class:"ff-message-success ff-el-group text-danger"}).html(t.responseJSON.data.Error).insertAfter(i))})});var l=!1;void 0!==window.form_state_save_vars&&(l=window.form_state_save_vars.key),l&&(e.append('<input type="hidden" value="'.concat(l,'" class="__fluent_state_hash" name="__fluent_state_hash"/>')),"yes"==e.find(".ff-step-container").attr("data-enable_step_data_persistency")||jQuery.getJSON(fluentFormVars.ajaxUrl,{form_id:e.data("form_id"),action:"fluentform_get_form_state",hash:l,nonce:window.form_state_save_vars.nonce}).then(function(t){if(t){var i=function(t,e,i,n){return new a(t,e,i,n).getPublicAPI()}(n,e,window.fluentFormVars,s);i.populateFormDataAndSetActiveStep(t)}}))}})})();