",{class:"ff-upload-error",style:"color:red;"});o.append(d,u,l,v,m,p),r.append(s,o),f.append(r)})),e.trigger("change_remaining",-a.length),e.trigger("change")},x=function(t){var e=t.split(/[#?]/)[0].split(".").pop().trim().toLowerCase();if(-1!=["jpg","jpeg","gif","png"].indexOf(e))return t;var n=document.createElement("canvas");n.width=60,n.height=60,n.style.zIndex=8,n.style.position="absolute",n.style.border="1px solid";var a=n.getContext("2d");return a.fillStyle="rgba(0, 0, 0, 0.2)",a.fillRect(0,0,60,60),a.font="13px Arial",a.fillStyle="white",a.textAlign="center",a.fillText(e,30,30,60),n.toDataURL()};return{init:function(){o&&jQuery(document).ready((function(t){jQuery.getJSON(i.ajaxUrl,{form_id:a.data("form_id"),action:"fluentform_step_form_get_data",nonce:null==i?void 0:i.nonce,hash:null==i?void 0:i.hash}).then((function(t){t&&p(t)}))})),a.find(".fluentform-step:first").find('.step-nav [data-action="prev"]').remove(),function(){var t=a.find(".ff-step-body"),e=a.find(".fluentform-step"),f=e.length,o=a.find(".ff-step-titles li");s=100*f+"%",t.css({width:s}),e.css({width:100/f+"%"}),n(e[r]).addClass("active"),n(o[r]).addClass("active");var l=e.first();l.hasClass("active")&&l.find('button[data-action="next"]').css("visibility","visible"),e.length&&!e.last().hasClass("active")&&a.find('button[type="submit"]').css("visibility","hidden"),m({activeStep:r,totalSteps:f}),_(i.stepAnimationDuration),v(o,e)}(),function(){function t(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||400;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")}"yes"==a.find(".ff-step-container").attr("data-enable_auto_slider")&&(a.find(".ff-el-form-check-radio,.ff-el-net-label, .ff-el-ratings label").on("click",(function(){t(n(this))})),a.find("select").on("change",(function(){t(n(this))})))}()},updateSlider:g,populateFormDataAndSetActiveStep:p}}var i;(i=jQuery)(document.body).on("fluentform_init",(function(t,e,n){var f="."+n.form_instance,r=-1,s="no";if(i(f).hasClass("ff-form-has-save-progress")){i(f).hasClass("ff-form-has-steps")&&(e.on("ff_to_next_page",(function(t,e){s=e})),e.on("ff_to_prev_page",(function(t,e){s=e}))),i(f).find(".ff-btn-save-progress").each((function(t,n){var a=i(n);a.on("click",(function(t){var n,f=this;t.preventDefault(),a.addClass("ff-working");var o=e.find(":input").filter((function(t,e){return!i(e).closest(".has-conditions").hasClass("ff_excluded")}));o.filter((function(t,e){var n=i(e);return n.parents().hasClass("ff_repeater_table")&&"select"==n.attr("type")&&!n.val()})).prepend("
");var l=o.serialize();i.each(e.find("[type=file]"),(function(t,e){var n={},a=e.name+"[]";n[a]=[],i(e).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each((function(t,e){n[a][t]=i(this).data("src")})),i.each(n,(function(t,e){if(e.length){var n={};n[t]=e,l+="&"+i.param(n)}}))})),r=null===(n=window.form_state_save_vars)||void 0===n?void 0:n.key;var c={source_url:window.form_state_save_vars.source_url,action:"fluentform_save_form_progress_with_link",data:l,form_id:e.data("form_id"),hash:r,active_step:s,nonce:window.form_state_save_vars.nonce,save_progress_btn_name:i(a).attr("name")},d=c.form_id+"_save_progress_msg",u="#"+d;jQuery.post(fluentFormVars.ajaxUrl,c).then((function(t){if(t){var n;r=t.data.hash,e.find(".ff-saved-state-link"),""!=(null===(n=t.data)||void 0===n?void 0:n.message)&&(i(u).length&&i(u).slideUp("fast"),i("
",{id:d,class:"ff-message-success ff-el-group"}).html(t.data.message).insertBefore(a.closest(".ff-el-group")));var s=window.form_state_save_vars.copy_button||"Copy",o='
"),l=i("
",{class:"ff-el-group ff-saved-state-input ff-saved-state-link ff-hide-group",html:o});i(f).closest(".ff-el-group").after(l),l.fadeIn();var c=window.form_state_save_vars.email_placeholder_str||"Your Email Here",p=window.form_state_save_vars.email_button||"Email";if(i(f).hasClass("ff_resume_email_enabled")){var v='
"),m=i("
",{class:"ff-el-group ff-saved-state-input ff-email-address ff-hide-group",html:v});i(l).after(m),m.fadeIn()}}})).fail((function(t){i(u).length&&i(u).slideUp("fast"),i("
",{id:d,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()}))}))})),i(f).on("click",".ff_btn_copy_link",(function(t){t.preventDefault();var e=i(this).closest(".ff-el-input--content").find(".ff-el-form-control").val();navigator.clipboard.writeText(e);var n=window.form_state_save_vars.copy_success_button||"Copied";i(this).html("".concat(n))})),i(f).on("click",".ff_btn_is_email",(function(t){t.preventDefault();var n=i(this).closest(".ff-el-group"),a=i(this).closest(".ff-email-address").find("input").val();i(".ff-email-address").find("input").val("");var f=i(".ff-saved-state-link").find("input").val(),s={source_url:window.form_state_save_vars.source_url,action:"fluentform_email_progress_link",form_id:e.data("form_id"),to_email:a,link:f,hash:r,nonce:window.form_state_save_vars.nonce},o=s.form_id+"_save_progress_email_response",l="#"+o;jQuery.post(fluentFormVars.ajaxUrl,s).then((function(t){t&&(n.removeClass("ff-el-is-error"),i(l).length&&i(l).slideUp("fast"),i("
",{id:o,class:"ff-message-success ff-el-group"}).html(t.data.response).insertAfter(n))})).fail((function(t){t&&(n.addClass("ff-el-is-error"),i(l).length&&i(l).slideUp("fast"),i("
",{id:o,class:"ff-message-success ff-el-group text-danger"}).html(t.responseJSON.data.Error).insertAfter(n))}))}));var o=!1;void 0!==window.form_state_save_vars&&(o=window.form_state_save_vars.key),o&&(e.append('
')),"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:o,nonce:window.form_state_save_vars.nonce}).then((function(t){t&&a(i,e,window.fluentFormVars,f).populateFormDataAndSetActiveStep(t)})))}}))})();