Current File : /home/inlingua/www/crm/ninexb_oldddd/wp-content/plugins/fluentform/assets/js/form-save-progress.js
/*! For license information please see form-save-progress.js.LICENSE.txt */
(()=>{"use strict";var e={75251:(e,t,n)=>{var r=n(67294),a=Symbol.for("react.element"),o=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,f=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,n){var r,o={},l=null,c=null;for(r in void 0!==n&&(l=""+n),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,r)&&!s.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:a,type:e,key:l,ref:c,props:o,_owner:f.current}}t.jsx=l},72408:(e,t)=>{var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,_={};function h(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||v}function y(){}function g(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||v}h.prototype.isReactComponent={},h.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},h.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=h.prototype;var b=g.prototype=new y;b.constructor=g,m(b,h.prototype),b.isPureReactComponent=!0;var w=Array.isArray,x=Object.prototype.hasOwnProperty,S={current:null},j={key:!0,ref:!0,__self:!0,__source:!0};function k(e,t,r){var a,o={},i=null,f=null;if(null!=t)for(a in void 0!==t.ref&&(f=t.ref),void 0!==t.key&&(i=""+t.key),t)x.call(t,a)&&!j.hasOwnProperty(a)&&(o[a]=t[a]);var s=arguments.length-2;if(1===s)o.children=r;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(a in s=e.defaultProps)void 0===o[a]&&(o[a]=s[a]);return{$$typeof:n,type:e,key:i,ref:f,props:o,_owner:S.current}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var E=/\/+/g;function A(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function O(e,t,a,o,i){var f=typeof e;"undefined"!==f&&"boolean"!==f||(e=null);var s=!1;if(null===e)s=!0;else switch(f){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case n:case r:s=!0}}if(s)return i=i(s=e),e=""===o?"."+A(s,0):o,w(i)?(a="",null!=e&&(a=e.replace(E,"$&/")+"/"),O(i,t,a,"",(function(e){return e}))):null!=i&&(C(i)&&(i=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,a+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(E,"$&/")+"/")+e)),t.push(i)),1;if(s=0,o=""===o?".":o+":",w(e))for(var l=0;l<e.length;l++){var c=o+A(f=e[l],l);s+=O(f,t,a,c,i)}else if(c=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof c)for(e=c.call(e),l=0;!(f=e.next()).done;)s+=O(f=f.value,t,a,c=o+A(f,l++),i);else if("object"===f)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function Q(e,t,n){if(null==e)return e;var r=[],a=0;return O(e,r,"","",(function(e){return t.call(n,e,a++)})),r}function R(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var D={current:null},$={transition:null},I={ReactCurrentDispatcher:D,ReactCurrentBatchConfig:$,ReactCurrentOwner:S};t.Children={map:Q,forEach:function(e,t,n){Q(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return Q(e,(function(){t++})),t},toArray:function(e){return Q(e,(function(e){return e}))||[]},only:function(e){if(!C(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=h,t.Fragment=a,t.Profiler=i,t.PureComponent=g,t.StrictMode=o,t.Suspense=c,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,t.cloneElement=function(e,t,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var a=m({},e.props),o=e.key,i=e.ref,f=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,f=S.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(l in t)x.call(t,l)&&!j.hasOwnProperty(l)&&(a[l]=void 0===t[l]&&void 0!==s?s[l]:t[l])}var l=arguments.length-2;if(1===l)a.children=r;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];a.children=s}return{$$typeof:n,type:e.type,key:o,ref:i,props:a,_owner:f}},t.createContext=function(e){return(e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:f,_context:e},e.Consumer=e},t.createElement=k,t.createFactory=function(e){var t=k.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=C,t.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:R}},t.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=$.transition;$.transition={};try{e()}finally{$.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return D.current.useCallback(e,t)},t.useContext=function(e){return D.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return D.current.useDeferredValue(e)},t.useEffect=function(e,t){return D.current.useEffect(e,t)},t.useId=function(){return D.current.useId()},t.useImperativeHandle=function(e,t,n){return D.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return D.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return D.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return D.current.useMemo(e,t)},t.useReducer=function(e,t,n){return D.current.useReducer(e,t,n)},t.useRef=function(e){return D.current.useRef(e)},t.useState=function(e){return D.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return D.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return D.current.useTransition()},t.version="18.2.0"},67294:(e,t,n)=>{e.exports=n(72408)},48521:(e,t,n)=>{e.exports=n(75251)}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(()=>{var e,t=n(48521);function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,n,o,i){var f=0,s="";o.stepAnimationDuration=parseInt(o.stepAnimationDuration);var l="yes"==n.find(".ff-step-container").attr("data-enable_step_data_persistency"),c=!1;l&&(c="yes"==n.find(".ff-step-container").attr("data-enable_step_page_resume"));var u=!!window.fluentFormVars.is_rtl,d=!1,p=function(){return window.fluentFormApp(n)},v=function(t){var n=t.response,r=t.step_completed,a=[];if(jQuery.each(n,(function(t,n){if(n){var r=Object.prototype.toString.call(n);if("[object Object]"===r){var i=jQuery("[data-name=".concat(t,"]"));if(i.length&&"tabular-element"===i.attr("data-type"))jQuery.each(n,(function(n,r){var a=jQuery('[name="'.concat(t,"[").concat(n,']\\[\\]"]'));a.length||(a=jQuery('[name="'.concat(t,"[").concat(n,']"]'))),jQuery.each(a,(function(t,n){var a=e(n).val();-1===jQuery.inArray(a,r)&&a!==r||e(n).prop("checked",!0).change()}))}));else if("chained-select"===i.attr("data-type")){var f={meta_key:i.find("select:first").attr("data-meta_key"),form_id:i.closest("form").attr("data-form_id"),action:"fluentform_get_chained_select_options",filter_options:"all",keys:n};jQuery.getJSON(o.ajaxUrl,f).then((function(e){jQuery.each(e,(function(e,t){var r=i.find("select[data-key='".concat(e,"']"));0!=r.attr("data-index")&&jQuery.each(t,(function(e,t){r.append(jQuery("<option />",{value:t,text:t}))})),r.attr("disabled",!1).val(n[e])}))}))}else jQuery.each(n,(function(e,n){jQuery('[name="'.concat(t,"[").concat(e,']"]')).val(n).change()}))}else if("[object Array]"===r){var s=jQuery("[name=".concat(t,"]"));if("file"==(s=(s=s.length?s:jQuery("[data-name=".concat(t,"]"))).length?s:jQuery("[name=".concat(t,"\\[\\]]"))).attr("type"))x(s,n);else if(s.prop("multiple"))if(e.isFunction(window.Choices)){var l=s.data("choicesjs");a.push({handler:l,values:n})}else s.val(n).change();else if("repeater_field"===s.attr("data-type")){var c=s.find("tbody"),u=s.attr("data-name");jQuery.each(n,(function(t,n){0!=t?c.find("tr:last").clone().appendTo(c).find(".ff-el-form-control").each((function(r,a){var o="ffrpt-"+(new Date).getTime()+r;e(a).val(n[r]),e(a).attr({id:o,name:"".concat(u,"[").concat(t,"][]"),value:n[r]}).change()})):c.find("tr:first .ff-el-form-control").each((function(t,r){e(r).val(n[t]).change()}))}))}else s.each((function(t,r){-1!=jQuery.inArray(e(r).val(),n)&&e(r).prop("checked",!0).change()}))}else{var d=jQuery("[name=".concat(t,"]"));if(d.hasClass("fluentform-post-content")&&window.wp&&window.wp.editor){var p=d.attr("id");window.tinymce.get(p).setContent(n)}if("radio"===d.prop("type")||"checkbox"===d.prop("type"))jQuery("[name=".concat(t,'][value="').concat(n,'"]')).prop("checked",!0).change();else{var v=d.closest(".ff-el-group").find(".fluentform-signature-pad");if(v.length){var m=v[0].getContext("2d"),_=new Image;_.src=n,_.onload=function(){m.drawImage(_,0,0)}}d.val(n).change()}}}})),a.length>0)for(var f=0;f<a.length;f++)a[f].handler.setValue(a[f].values).change();d=!0,c&&g(r,o.stepAnimationDuration,!0).then((function(){b(e("".concat(i," .fluentform-step.active"))),y(o.stepAnimationDuration)})).catch((function(e){console.error("An error occurred during the slider update:",e)})),d=!1},m=function(t,n){0!==t.length&&(e.each(t,(function(t,n){e(n).attr("data-step-number",t)})),t.on("click",(function(t){var r=p(),a=e(this),f=0;try{var s=a.data("step-number");if(isNaN(s))return;e.each(n,(function(t,n){if(f=t,t<s){var a=e(n).find(":input").not(":button").filter((function(t,n){return!e(n).closest(".has-conditions").hasClass("ff_excluded")}));a.length&&r.validate(a)}})),g(s,o.stepAnimationDuration,!0).then((function(){b(e("".concat(i," .fluentform-step.active"))),y(o.stepAnimationDuration)})).catch((function(e){console.error("An error occurred during the slider update:",e)}))}catch(t){if(!(t instanceof window.ffValidationError))throw t;g(f,o.stepAnimationDuration,!0).then((function(){b(e("".concat(i," .fluentform-step.active"))),y(o.stepAnimationDuration)})).catch((function(e){console.error("An error occurred during the slider update:",e)})),r.showErrorMessages(t.messages),r.scrollToFirstError(350)}})))},_=function(t){if(n.find(".ff-el-progress").length){var r=t.totalSteps,a=t.activeStep,i=100/r*(a+1),f=n.find(".ff-el-progress-title li"),s=n.find(".ff-step-header .ff-el-progress-bar"),l=s.find("span");s.css({width:i+"%"}),i?s.append(l.text(parseInt(i)+"%")):l.empty();var c=o.step_text,u=e(f[a]).text();c=c.replace("%activeStep%",a+1).replace("%totalStep%",r).replace("%stepTitle%",u),n.find(".ff-el-progress-status").html(c),f.css("display","none"),e(f[a]).css("display","inline")}},h=function(t){b(e("".concat(i," .fluentform-step.active"))),e(i).on("click",".fluentform-step  .step-nav button, .fluentform-step  .step-nav img",(function(r){var a=e(this).data("action"),o="next",s=e(this).closest(".fluentform-step"),l=p();if("next"==a){try{var c=s.find(":input").not(":button").filter((function(t,n){return!e(n).closest(".has-conditions").hasClass("ff_excluded")}));c.length&&l.validate(c),f++}catch(r){if(!(r instanceof window.ffValidationError))throw r;return l.showErrorMessages(r.messages),void l.scrollToFirstError(350)}n.trigger("ff_to_next_page",f),jQuery(document).trigger("ff_to_next_page",{step:f,form:n});var u=n.find(".fluentform-step");n.trigger("ff_render_dynamic_smartcodes",e(u[f]))}else f--,o="prev",n.trigger("ff_to_prev_page",f),jQuery(document).trigger("ff_to_prev_page",{step:f,form:n});var d="yes"!=n.find(".ff-step-container").attr("data-disable_auto_focus");g(f,t,d,o).then((function(){b(e("".concat(i," .fluentform-step.active"))),y(t)})).catch((function(e){console.error("An error occurred during the slider update:",e)}))}))};function y(t){setTimeout((function(){var t=function(){var t=e("".concat(i," .fluentform-step.active")),r=null;return r=n.find(".fluentform-step").last().hasClass("active")&&t.children().not(".ff-inner_submit_container").toArray().every((function(t){return e(t).hasClass("ff_excluded")}))?t.find('button[type="submit"]').first():t.find("input, select, textarea").first(),r}();t&&t.length&&t.focus()}),t)}var g=function(t,r){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"next";return new Promise((function(c){e("div"+i+"_errors").empty(),f=t;var p=n.find(".ff-step-body"),v=n.find(".ff-step-titles li"),m=n.find(".fluentform-step"),h=m.length;m.removeClass("active"),e(m[f]).addClass("active"),v.removeClass("ff_active ff_completed"),e.each(a(Array(f).keys()),(function(t){e(e(v[t])).addClass("ff_completed")})),e(v[f]).addClass("ff_active");var y,g={left:-100*f+"%"};switch(u&&(g={right:-100*f+"%"}),e(m[f]).closest(".ff-step-container").data("animation_type")){case"slide":y=p.animate(g,r).promise();break;case"fade":p.css({opacity:0}),y=p.animate(g,r).animate({opacity:1},r).promise();break;case"slide_down":p.hide(),p.css(g),y=p.slideDown(r).promise();break;default:p.css(g),y=Promise.resolve()}y.then((function(){if(o&&function(){if(!window.ff_disable_step_scroll){var t,a,o,i,f,s,l=n.find(".ff_step_start");t=window.ff_scroll_top_offset?window.ff_scroll_top_offset:l.offset().top-20,i=(o=(a=l).offset().top)+a.outerHeight(),s=(f=e(window).scrollTop())+e(window).height(),i>f&&o<s&&!window.ff_force_scroll||e("html, body").delay(r).animate({scrollTop:t},0)}}(),!l||d||0===f||w(n,f).then((function(e){console.log(e)})),_({activeStep:f,totalSteps:h}),m.last().hasClass("active")?n.find('button[type="submit"]').css("visibility","visible"):n.find('button[type="submit"]').css("visibility","hidden"),!window.ff_disable_auto_step){var t=n.find(".fluentform-step.active"),a=n.find(".fluentform-step.active > div").length-1,i=n.find(".fluentform-step.active > .ff_excluded").length;if(n.find(".fluentform-step.active > .ff-t-container").length&&(a-=n.find(".fluentform-step.active > .ff-t-container").length,a+=n.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > div").length,i+=n.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > .ff_excluded").length,n.find(".fluentform-step.active > .ff-t-container.ff_excluded").length&&(i-=n.find(".fluentform-step.active > .ff-t-container.ff_excluded").length,i-=n.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > .ff_excluded").length,i+=n.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > div").length)),a===i)return t.find(".step-nav button[data-action="+s+"], .step-nav img[data-action="+s+"]").click(),void c()}n.find(".fluentform-step.active").find('.step-nav button[data-action="next"]').css("visibility","visible"),n.find(".fluentform-step.active").find('.step-nav button[data-action="prev"]').css("visibility","visible"),n.find(".fluentform-step.active").find('.step-nav img[data-action="next"]').css("visibility","visible"),n.find(".fluentform-step.active").find('.step-nav img[data-action="prev"]').css("visibility","visible"),c()}))}))};function b(e){var t=e.find("input, select, textarea, button").filter(":visible"),n=t.first(),r=t.last();e.on("keydown",(function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n[0]&&(r.focus(),e.preventDefault()):document.activeElement===r[0]&&(n.focus(),e.preventDefault()))}))}var w=function(t,n){var r=t.find(":input").filter((function(t,n){return!e(n).closest(".has-conditions").hasClass("ff_excluded")}));r.filter((function(t,n){var r=e(n);return r.parents().hasClass("ff_repeater_table")&&"select"==r.attr("type")&&!r.val()})).prepend("<option selected disabled />");var a=r.serialize();e.each(t.find("[type=file]"),(function(t,n){var r={},o=n.name+"[]";r[o]=[],e(n).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each((function(t,n){r[o][t]=e(this).data("src")})),e.each(r,(function(t,n){if(n.length){var r={};r[t]=n,a+="&"+e.param(r),!0}}))}));var i={active_step:n,data:a,form_id:t.data("form_id"),action:"fluentform_step_form_save_data"};return jQuery.post(o.ajaxUrl,i)},x=function(n,a){var i=n.closest(".ff-el-input--content").find(".ff-uploaded-list");e.each(a,(function(n,a){a="object"===r(a)?a:{url:a,data_src:a};var f=e("<div/>",{class:"ff-upload-preview","data-src":a.data_src,style:"border: 1px solid rgb(111, 117, 125)"}),s=e("<div/>",{class:"ff-upload-thumb"});s.append(e("<div/>",{class:"ff-upload-preview-img",style:"background-image: url('".concat(S(a.url),"');")}));var l=e("<div/>",{class:"ff-upload-details"}),c=e("<span/>",{html:o.upload_completed_txt,class:"ff-upload-progress-inline-text ff-inline-block"}),u=a.url.substring(a.url.lastIndexOf("/")+1);u.includes("-ff-")&&(u=u.substring(u.lastIndexOf("-ff-")+4));var d=e("<div/>",{class:"ff-upload-filename",html:u}),p=e((0,t.jsx)("div",{class:"ff-upload-progress-inline ff-el-progress",children:(0,t.jsx)("div",{style:"width: 100%;",class:"ff-el-progress-bar"})})),v=e("<span/>",{"data-href":"#",html:"&times;",class:"ff-upload-remove"}),m=e("<div>",{class:"ff-upload-filesize ff-inline-block",html:""}),_=e("<div>",{class:"ff-upload-error",style:"color:red;"});l.append(d,p,c,m,_,v),f.append(s,l),i.append(f)})),n.trigger("change_remaining",-a.length),n.trigger("change")},S=function(e){var t=e.split(/[#?]/)[0].split(".").pop().trim().toLowerCase();if(-1!=["jpg","jpeg","gif","png"].indexOf(t))return e;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 r=n.getContext("2d");return r.fillStyle="rgba(0, 0, 0, 0.2)",r.fillRect(0,0,60,60),r.font="13px Arial",r.fillStyle="white",r.textAlign="center",r.fillText(t,30,30,60),n.toDataURL()};return{init:function(){l&&jQuery(document).ready((function(e){jQuery.getJSON(o.ajaxUrl,{form_id:n.data("form_id"),action:"fluentform_step_form_get_data"}).then((function(e){e&&v(e)}))})),n.find(".fluentform-step:first").find('.step-nav [data-action="prev"]').remove(),function(){var t=n.find(".ff-step-body"),r=n.find(".fluentform-step"),a=r.length,i=n.find(".ff-step-titles li");s=100*a+"%",t.css({width:s}),r.css({width:100/a+"%"}),e(r[f]).addClass("active"),e(i[f]).addClass("active");var l=r.first();l.hasClass("active")&&l.find('button[data-action="next"]').css("visibility","visible"),r.length&&!r.last().hasClass("active")&&n.find('button[type="submit"]').css("visibility","hidden"),_({activeStep:f,totalSteps:a}),h(o.stepAnimationDuration),m(i,r)}(),function(){function t(e){if(1==e.closest(".fluentform-step.active").find(".ff-el-group:not(.ff_excluded):not(.ff-custom_html)").length)if(e.closest(".fluentform-step.active").find(".ff_excluded").length){var t=window.ffTransitionTimeOut||400;setTimeout((function(){e.closest(".fluentform-step.active").find(".ff-btn-next").trigger("click")}),t)}else e.closest(".fluentform-step.active").find(".ff-btn-next").trigger("click")}"yes"==n.find(".ff-step-container").attr("data-enable_auto_slider")&&(n.find(".ff-el-form-check-radio,.ff-el-net-label, .ff-el-ratings label").on("click",(function(){t(e(this))})),n.find("select").on("change",(function(){t(e(this))})))}()},updateSlider:g,populateFormDataAndSetActiveStep:v}}(e=jQuery)(document.body).on("fluentform_init",(function(t,n,r){var a="."+r.form_instance,o=-1,f="no";if(e(a).hasClass("ff-form-has-save-progress")){e(a).hasClass("ff-form-has-steps")&&(n.on("ff_to_next_page",(function(e,t){f=t})),n.on("ff_to_prev_page",(function(e,t){f=t}))),e(a).find(".ff-btn-save-progress").each((function(t,r){var a=e(r);a.on("click",(function(t){var r,i=this;t.preventDefault(),a.addClass("ff-working");var s=n.find(":input").filter((function(t,n){return!e(n).closest(".has-conditions").hasClass("ff_excluded")}));s.filter((function(t,n){var r=e(n);return r.parents().hasClass("ff_repeater_table")&&"select"==r.attr("type")&&!r.val()})).prepend("<option selected disabled />");var l=s.serialize();e.each(n.find("[type=file]"),(function(t,n){var r={},a=n.name+"[]";r[a]=[],e(n).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each((function(t,n){r[a][t]=e(this).data("src")})),e.each(r,(function(t,n){if(n.length){var r={};r[t]=n,l+="&"+e.param(r)}}))})),o=null===(r=window.form_state_save_vars)||void 0===r?void 0:r.key;var c={source_url:window.form_state_save_vars.source_url,action:"fluentform_save_form_progress_with_link",data:l,form_id:n.data("form_id"),hash:o,active_step:f,nonce:window.form_state_save_vars.nonce,save_progress_btn_name:e(a).attr("name")},u=c.form_id+"_save_progress_msg",d="#"+u;jQuery.post(fluentFormVars.ajaxUrl,c).then((function(t){if(t){var r;o=t.data.hash,n.find(".ff-saved-state-link"),""!=(null===(r=t.data)||void 0===r?void 0:r.message)&&(e(d).length&&e(d).slideUp("fast"),e("<div/>",{id:u,class:"ff-message-success ff-el-group"}).html(t.data.message).insertBefore(a.closest(".ff-el-group")));var f=window.form_state_save_vars.copy_button||"Copy",s='<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(f,"</button>\n                                    </div>\n                                </div>\n                            </div>"),l=e("<div/>",{class:"ff-el-group ff-saved-state-input ff-saved-state-link ff-hide-group",html:s});e(i).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(e(i).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(c,'" 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_is_email ff_input-group-text">').concat(p,"</button>\n                                        </div>\n                                    </div>\n                                </div>"),m=e("<div/>",{class:"ff-el-group ff-saved-state-input  ff-email-address ff-hide-group",html:v});e(l).after(m),m.fadeIn()}}})).fail((function(t){e(d).length&&e(d).slideUp("fast"),e("<div/>",{id:u,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()}))}))})),e(a).on("click",".ff_btn_copy_link",(function(t){t.preventDefault();var n=e(this).closest(".ff-el-input--content").find(".ff-el-form-control").val();navigator.clipboard.writeText(n);var r=window.form_state_save_vars.copy_success_button||"Copied";e(this).html("".concat(r))})),e(a).on("click",".ff_btn_is_email",(function(t){t.preventDefault();var r=e(this).closest(".ff-el-group"),a=e(this).closest(".ff-email-address").find("input").val();e(".ff-email-address").find("input").val("");var i=e(".ff-saved-state-link").find("input").val(),f={source_url:window.form_state_save_vars.source_url,action:"fluentform_email_progress_link",form_id:n.data("form_id"),to_email:a,link:i,hash:o,nonce:window.form_state_save_vars.nonce},s=f.form_id+"_save_progress_email_response",l="#"+s;jQuery.post(fluentFormVars.ajaxUrl,f).then((function(t){t&&(r.removeClass("ff-el-is-error"),e(l).length&&e(l).slideUp("fast"),e("<div/>",{id:s,class:"ff-message-success ff-el-group"}).html(t.data.response).insertAfter(r))})).fail((function(t){t&&(r.addClass("ff-el-is-error"),e(l).length&&e(l).slideUp("fast"),e("<div/>",{id:s,class:"ff-message-success ff-el-group text-danger"}).html(t.responseJSON.data.Error).insertAfter(r))}))}));var s=!1;void 0!==window.form_state_save_vars&&(s=window.form_state_save_vars.key),s&&(n.append('<input type="hidden" value="'.concat(s,'" class="__fluent_state_hash" name="__fluent_state_hash"/>')),jQuery.getJSON(fluentFormVars.ajaxUrl,{form_id:n.data("form_id"),action:"fluentform_get_form_state",hash:s,nonce:window.form_state_save_vars.nonce}).then((function(t){t&&i(e,n,window.fluentFormVars,a).populateFormDataAndSetActiveStep(t)})))}}))})()})();