← Back
Editing: fluentform-advanced.js
/*! For license information please see fluentform-advanced.js.LICENSE.txt */ (()=>{"use strict";const e=function(e,t){var n=t.find(".jss-ff-el-net-promoter");n.length&&e.each(n,function(t,n){e(n).on("click","label",function(t){var n=e(this);n.addClass("active"),n.prevAll().removeClass("active"),n.nextAll().removeClass("active")})})};var t=function(e){!function(e){e.on("click",".js-repeat .repeat-plus",function(e){var t=jQuery(this),n=t.closest(".ff-el-repeat"),r=parseInt(n.data("max_repeat")),i=n.find(".ff-t-cell:first-child .ff-el-input--content > input").length;if(!(r&&r<=i)){r&&r-i==1&&n.find(".repeat-plus").hide();var o=t.closest("div"),a=o.index(),l=t.closest(".ff-el-input--content").find(".ff-t-cell").length;t.closest(".ff-el-input--content").find(".ff-t-cell").each(function(e,t){var n=jQuery(this).find(".ff-el-form-control:last-child"),r=n.attr("tabindex"),i=n.clone(),o={value:"",id:"ffrpt-"+(new Date).getTime()+e};r&&(o.tabIndex=parseInt(r)+l),i.prop(o),i.insertAfter(n)}),o.clone().insertAfter(o),t.closest(".ff-el-input--content").find(".ff-t-cell").eq(0).find("input:eq(".concat(a+1,")")).focus()}}),e.on("click",".js-repeat .repeat-minus",function(e){var t=!1,n=jQuery(this),r=n.closest("div");n.closest(".ff-el-repeat").find(".repeat-plus").show(),n.closest(".ff-el-input--content").find(".ff-t-cell").each(function(){var e=r.index(),n=jQuery(this).find(".ff-el-form-control:eq("+e+")");r.siblings().length&&(t=n.remove().length)}),t&&r.remove()})}(e),function(e){var t=window.localStorage.getItem("ff_window_type");jQuery(".ff_form_preview").length&&jQuery(".ff_flexible_table").addClass(t),e.on("screen-change",function(e,t){jQuery(".ff_form_preview").length&&("375px"===t?jQuery(".ff_flexible_table").addClass("mobile"):jQuery(".ff_flexible_table").removeClass("mobile"))}),e.on("repeater-container-names-update",function(e,t){var n=t.attr("data-root_name"),r=0;t.find(".ff_repeater_cont_row").each(function(e,t){jQuery(this).find(".ff-el-form-control").each(function(t,i){var o=jQuery(i);0==e&&(r=o.attr("tabindex")),o.prop({name:n+"["+e+"][]"}),o.attr("data-name",n+"_"+t+"_"+e),r&&o.attr("tabindex",r)})})}),e.on("click",".js-repeater .repeat-plus",function(e){var t=jQuery(this),n=t.closest("table"),r=t.closest("tr"),i=parseInt(n.attr("data-max_repeat")),o=n.find("tbody tr").length;if(i&&o==i)n.addClass("repeat-maxed");else{var a=r.clone();a.find("td").each(function(e,t){var n=jQuery(this).find(".ff-el-form-control:last-child"),r="ffrpt-"+(new Date).getTime()+e,i={value:n.attr("data-default")||"",id:r};n.prop(i);var o=n.attr("data-mask");o&&n.mask(o)}),a.insertAfter(r);var l=n.attr("data-root_name"),s=0;n.find("tbody tr").each(function(e,t){jQuery(this).find(".ff-el-form-control").each(function(t,n){var r=jQuery(n);0==e&&(s=r.attr("tabindex")),r.prop({name:l+"["+e+"][]"}),r.attr("data-name",l+"_"+t+"_"+e),s&&r.attr("tabindex",s)})}),a.find(".ff-el-form-control")[0].focus(),n.trigger("repeat_change"),i&&o+1==i&&n.addClass("repeat-maxed")}}),e.on("click",".js-repeater .repeat-minus",function(e){var t=jQuery(this),n=t.closest("table");if(1!=n.find("tbody tr").length){t.closest("tr").remove(),n.removeClass("repeat-maxed");var r=n.attr("data-root_name");n.find("tbody tr").each(function(e,t){jQuery(this).find(".ff-el-form-control").each(function(t,n){jQuery(n).prop({name:r+"["+e+"][]"})})}),n.trigger("repeat_change")}}),e.on("click",".js-container-repeat-buttons .repeat-plus",function(t){var n=jQuery(this),r=n.closest(".ff-repeater-container"),i=n.closest(".ff_repeater_cont_row"),o=parseInt(r.attr("data-max_repeat")),a=r.find(".ff_repeater_cont_row").length;if(o&&a==o)r.addClass("repeat-maxed");else{var l=i.clone();l.find(".ff_repeater_cell").each(function(e,t){var n=jQuery(this).find(".ff-el-form-control:last-child"),r="ffrpt-"+(new Date).getTime()+e,i={value:n.attr("data-default")||"",id:r};n.prop(i);var o=n.attr("data-mask");o&&n.mask(o),jQuery(this).find("label").attr("for",r)}),l.insertAfter(i),e.trigger("repeater-container-names-update",[r]),l.find(".ff-el-form-control")[0].focus(),r.trigger("repeat_change"),o&&a+1==o&&r.addClass("repeat-maxed")}}),e.on("click",".js-container-repeat-buttons .repeat-minus",function(t){var n=jQuery(this),r=n.closest(".ff-repeater-container"),i=n.closest(".ff_repeater_cont_row");r.find(".ff_repeater_cont_row").length>1&&(i.remove(),r.removeClass("repeat-maxed"),e.trigger("repeater-container-names-update",[r]),r.trigger("repeat_change"))})}(e),function(e){e.on("keydown",".repeat-plus",function(e){"Enter"===e.key&&(e.preventDefault(),jQuery(this).click())}),e.on("keydown",".repeat-minus",function(e){"Enter"===e.key&&(e.preventDefault(),jQuery(this).click())})}(e)};function n(e,t){var n=t.find(".jss-ff-el-ratings");n.length&&e.each(n,function(t,n){var r=e(n),i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=r.find("label"),n=r.attr("data-base-tabindex")||"0";t.attr("tabindex","-1"),e&&e.length||(e=r.find("input:checked").parent("label")),e.length||(e=t.eq(0)),e.length&&e.attr("tabindex",n)},o=function(e){var t=e?"[data-id="+e+"]":null;r.closest(".ff-el-input--content").find(".ff-el-rating-text").css("display","none"),t&&r.closest(".ff-el-input--content").find(t).css("display","inline-block")},a=function(e){e.addClass("active"),e.prevAll().addClass("active"),e.nextAll().removeClass("active"),o(e.find("input").attr("id"))},l=function(){var t=r.find("input:checked").parent("label");t.length?a(t):(r.find("label").removeClass("active"),o(null)),i(t),r.find("label").each(function(t,n){var r=e(n),i=r.find("input").is(":checked");r.attr("aria-checked",i?"true":"false")})},s=function(e,t){var n=r.find("label"),o=n.index(e),a=Math.max(0,Math.min(n.length-1,o+t)),s=n.eq(a);s.length&&(s.find("input").prop("checked",!0).trigger("change"),i(s),s.trigger("focus"),l())};l(),r.on("mouseenter","label",function(t){a(e(this))}).on("focusin","label",function(){var t=e(this);i(t),a(t)}).on("click","label",function(t){var n=e(this),r=n.find("input"),i=n.find(".jss-ff-svg");r.prop("checked",!0).trigger("change"),l(),i.addClass("scale"),i.addClass("scalling"),setTimeout(function(e){i.removeClass("scalling"),i.removeClass("scale")},150)}).on("keydown","label",function(t){var n=e(this);"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),s(n,1)):"ArrowLeft"===t.key||"ArrowDown"===t.key?(t.preventDefault(),s(n,-1)):" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),n.trigger("click"))}).on("mouseleave",function(e){l()}).on("focusout","label",function(){setTimeout(function(){r.find("label:focus").length||l()},0)}).on("change","input",function(){l()})})}function r(){r=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,o){var a=RegExp(e,r);return t.set(a,o||t.get(e)),i(a,n.prototype)}function a(e,n){var r=t.get(n);return Object.keys(r).reduce(function(t,n){var i=r[n];if("number"==typeof i)t[n]=e[i];else{for(var o=0;void 0===e[i[o]]&&o+1<i.length;)o++;t[n]=e[i[o]]}return t},Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);if(n){n.groups=a(n,this);var r=n.indices;r&&(r.groups=a(r,this))}return n},n.prototype[Symbol.replace]=function(n,r){if("string"==typeof r){var i=t.get(this);return e[Symbol.replace].call(this,n,r.replace(/\$<([^>]+)(>|$)/g,function(e,t,n){if(""===n)return e;var r=i[t];return Array.isArray(r)?"$"+r.join("$"):"number"==typeof r?"$"+r:""}))}if("function"==typeof r){var l=this;return e[Symbol.replace].call(this,n,function(){var e=arguments;return"object"!=o(e[e.length-1])&&(e=[].slice.call(e)).push(a(e,l)),r.apply(this,e)})}return e[Symbol.replace].call(this,n,r)},r.apply(this,arguments)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function o(e){return o="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},o(e)}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}var f=function(){return e=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fields=t,this.formData=n,this.counter=0,this.field_statues={},this.elementCache={}},t=[{key:"setFields",value:function(e){this.fields=e}},{key:"setFormData",value:function(e){this.elementCache={},this.formData=e}},{key:"getCalculatedStatuses",value:function(){this.elementCache={};for(var e=0,t=Object.keys(this.fields);e<t.length;e++){var n=t[e],r=this.fields[n];this.field_statues[n]=this.evaluate(r,n)}return this.field_statues}},{key:"evaluate",value:function(e,t){var n=this;if(e._visited)return console.warn("Circular dependency detected for field: ".concat(t)),!1;var r=!1;if(e.status){var i,o;this.counter++;var a=e.type,l=1;if(e._visited=!0,"group"===a&&null!=e&&e.condition_groups?r=this.evaluateGroups(e.condition_groups):("any"==a&&(l=0),e.conditions.forEach(function(e){var r=n.getItemEvaluateValue(e,n.formData[e.field]);r&&n.fields[e.field]&&e.field!=t&&(r=n.evaluate(n.fields[e.field],e.field)),"any"==a?r&&(l=1):!r&&l&&(l=!1)}),r=1==l),e._visited=!1,(null!==(i=e.conditions)&&void 0!==i&&i.length||null!==(o=e.condition_groups)&&void 0!==o&&o.length)&&!r)return r}return e.container_condition&&(r=this.evaluate(e.container_condition,t)),r}},{key:"evaluateGroups",value:function(e){var t,n=a(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r&&Array.isArray(r.rules)&&0!==r.rules.length)try{if(!0===this.evaluateRuleGroup(r.rules))return!0}catch(e){console.warn("Error evaluating group:",e);continue}}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"evaluateRuleGroup",value:function(e){var t=this;return e.map(function(e){try{var n=t.getItemEvaluateValue(e,t.formData[e.field]);return n&&t.fields[e.field]&&t.fields[e.field].status?t.evaluate(t.fields[e.field],e.field):n}catch(t){return console.warn("Error evaluating rule:",e,t),!1}}).every(function(e){return!0===e})}},{key:"getItemEvaluateValue",value:function(e,t){t=t||null;var n=this.elementCache[e.field];if(n&&n.length||(n=jQuery("[name='".concat(e.field,"']")),this.elementCache[e.field]=n),"list_match"==e.operator||"list_not_match"==e.operator){var r=this.parseRankingConditionValue(e.value),i=Array.isArray(t)?t.map(String):[],a=r.length>0&&i.length===r.length&&i.every(function(e,t){return e===r[t]});return"list_match"==e.operator?a:!a}return"="==e.operator?""===e.value?null===t:"object"==o(t)?null!==t&&-1!=t.indexOf(e.value):n.hasClass("ff_numeric")?this.parseFormattedNumericValue(n,t)==this.parseFormattedNumericValue(n,e.value):t==e.value:"!="==e.operator?"object"==o(t)?null!==t&&-1==t.indexOf(e.value):n.hasClass("ff_numeric")?this.parseFormattedNumericValue(n,t)!=this.parseFormattedNumericValue(n,e.value):t!=e.value:">"==e.operator?t&&this.parseFormattedNumericValue(n,t)>this.parseFormattedNumericValue(n,e.value):"<"==e.operator?t&&this.parseFormattedNumericValue(n,t)<this.parseFormattedNumericValue(n,e.value):">="==e.operator?t&&this.parseFormattedNumericValue(n,t)>=this.parseFormattedNumericValue(n,e.value):"<="==e.operator?t&&this.parseFormattedNumericValue(n,t)<=this.parseFormattedNumericValue(n,e.value):"startsWith"==e.operator?t&&t.startsWith(e.value):"endsWith"==e.operator?t&&t.endsWith(e.value):"contains"==e.operator?null!==t&&-1!=t.indexOf(e.value):"doNotContains"==e.operator?null!==t&&-1==t.indexOf(e.value):"test_regex"==e.operator&&(t=t||"",this.stringToRegex(e.value).test(t))}},{key:"parseRankingConditionValue",value:function(e){if(!e)return[];try{var t=JSON.parse(e);return Array.isArray(t)?t.map(String).filter(Boolean):[]}catch(e){return[]}}},{key:"stringToRegex",value:function(e){var t,n=(null===(t=String(e).match(r(/^\/(.*)\/([gimsuy]*)$/,{body:1,flags:2})))||void 0===t?void 0:t.groups)||{},i=n.body,o=n.flags;return i?(o=o||"g",RegExp(i,o)):new RegExp(e,"g")}},{key:"parseFormattedNumericValue",value:function(e,t){if(e.hasClass("ff_numeric")){var n=JSON.parse(e.attr("data-formatter"));return currency(t,n).value}return Number(t)||0}}],t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();const u=f;const d=function(e,t,n){var r="."+n.form_instance;(function(){var i=this,o={},a={},l=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];clearTimeout(t),t=setTimeout(function(){return e.apply(i,o)},n)}}(function(e){s(e)},n.debounce_time||300),s=function(n){var r;e.each(n,function(e,n){var i=f(e).closest(".has-conditions");n?("0px"==i.css("height")&&i.attr("style",""),i.removeClass("ff_excluded").addClass("ff_cond_v").slideDown(200,function(){i.find('input[type="range"]').length>0&&(r&&clearTimeout(r),r=setTimeout(function(){t.trigger("reInitRangeSliders")},50))})):i.removeClass("ff_cond_v").addClass("ff_excluded").slideUp(200)}),t.trigger("do_calculation"),t.trigger("ff_render_dynamic_smartcodes",t)},c=function(){var n={};return e.each(o,function(r,i){var o=i.prop("type")||i.attr("data-type");if("radio"==o)n[r]="",i.each(function(t,i){e(i).is(":checked")&&(n[r]=e(i).val())});else if("checkbox"==o)r=r.replace("[]",""),n[r]=[],i.each(function(t,i){e(i).is(":checked")&&n[r].push(e(i).val())});else if("select-multiple"==o){r=r.replace("[]","");var a=i.val();n[r]=a||[]}else if("file"==o){var l="";t.find("input[name="+r+"]").closest(".ff-el-input--content").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each(function(t,n){l+=e(this).data("src")}),n[r]=l}else"ranking"==o||i.hasClass("ff-ranking-field")?n[r]=i.find('input[data-ranking-input="1"]:enabled').map(function(t,n){return e(n).val()}).get().filter(Boolean):n[r]=i.val()}),n},f=function(t){var n=e(r),i=e("[data-name='"+t+"']",n);return(i=(i=i.length?i:e("[name='"+t+"']",n)).length?i:e("[data-condition_field_name='"+t+"']",n)).length?i:e("[name='"+t+"[]']",n)};return{init:function(){if(n.conditionals){e.each(n.conditionals,function(t,n){t&&("group"==n.type&&n.condition_groups?e.each(n.condition_groups,function(t,n){e.each(n.rules,function(e,t){var n=f(t.field),r=n.prop("name")||n.attr("data-name");r&&(o[r]=n)})}):e.each(n.conditions,function(e,t){var n=f(t.field),r=n.prop("name")||n.attr("data-name");r&&(o[r]=n)}))}),a=c();var r=new u(n.conditionals,a);e.each(o,function(e,n){n.on("keyup change",function(){t.hasClass("ff_force_hide")||t.hasClass("ff_submitting")||(a=c(),r.setFormData(a),setTimeout(function(){l(r.getCalculatedStatuses())},0))})}),jQuery(document.body).on("fluentform_reset",function(e,n){n&&n.length&&n[0]===t[0]&&!t.hasClass("ff_force_hide")&&setTimeout(function(){a=c(),r.setFormData(a),s(r.getCalculatedStatuses())},0)}),setTimeout(function(){s(r.getCalculatedStatuses())},0)}}}})().init()};function p(e,t){this.v=e,this.k=t}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,l=[],s=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){var t,n;function r(t,n){try{var o=e[t](n),a=o.value,l=a instanceof p;Promise.resolve(l?a.v:a).then(function(n){if(l){var s="return"===t&&a.k?t:"next";if(!a.k||n.done)return r(s,n);n=e[s](n).value}i(!!o.done,n)},function(e){r("throw",e)})}catch(e){i(2,e)}}function i(e,i){2===e?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(o,a){var l={key:e,arg:i,resolve:o,reject:a,next:null};n?n=n.next=l:(t=n=l,r(e,i))})},"function"!=typeof e.return&&(this.return=void 0)}v.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},v.prototype.next=function(e){return this._invoke("next",e)},v.prototype.throw=function(e){return this._invoke("throw",e)},v.prototype.return=function(e){return this._invoke("return",e)};const g=Object.entries,y=Object.setPrototypeOf,_=Object.isFrozen,b=Object.getPrototypeOf,w=Object.getOwnPropertyDescriptor;let x=Object.freeze,S=Object.seal,k=Object.create,T="undefined"!=typeof Reflect&&Reflect,A=T.apply,C=T.construct;x||(x=function(e){return e}),S||(S=function(e){return e}),A||(A=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),C||(C=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const F=K(Array.prototype.forEach);Array.prototype.indexOf;const E=K(Array.prototype.lastIndexOf),N=K(Array.prototype.pop),O=K(Array.prototype.push),j=K(Array.prototype.slice),D=K(Array.prototype.splice),R=Array.isArray,I=Z(Set),$=K(Set.prototype.add),z=K(Set.prototype.has),P=K(String.prototype.toLowerCase),L=K(String.prototype.toString),M=K(String.prototype.match),U=K(String.prototype.replace),H=K(String.prototype.indexOf),V=K(String.prototype.trim),W=K(Number.prototype.toString),B=K(Boolean.prototype.toString),Q="undefined"==typeof BigInt?null:K(BigInt.prototype.toString),q="undefined"==typeof Symbol?null:K(Symbol.prototype.toString),Y=K(Object.prototype.hasOwnProperty),G=K(Object.prototype.toString),X=K(RegExp.prototype.test),J=Z(TypeError);function K(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return A(e,t,r)}}function Z(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return C(e,n)}}function ee(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P;if(y&&y(e,null),!R(t))return e;let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(_(t)||(t[r]=e),i=e)}e[i]=!0}return e}function te(e){for(let t=0;t<e.length;t++)Y(e,t)||(e[t]=null);return e}function ne(e){const t=k(null);for(const r of g(e)){var n=h(r,2);const i=n[0],o=n[1];Y(e,i)&&(R(o)?t[i]=te(o):o&&"object"==typeof o&&o.constructor===Object?t[i]=ne(o):t[i]=o)}return t}function re(e,t){for(;null!==e;){const n=w(e,t);if(n){if(n.get)return K(n.get);if("function"==typeof n.value)return K(n.value)}e=b(e)}return function(){return null}}const ie=x(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),oe=x(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ae=x(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),le=x(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),se=x(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ce=x(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fe=x(["#text"]),ue=x(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),de=x(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),pe=x(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),me=x(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),he=S(/{{[\w\W]*|^[\w\W]*}}/g),ve=S(/<%[\w\W]*|^[\w\W]*%>/g),ge=S(/\${[\w\W]*/g),ye=S(/^data-[\-\w.\u00B7-\uFFFF]+$/),_e=S(/^aria-[\-\w]+$/),be=S(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),we=S(/^(?:\w+script|data):/i),xe=S(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Se=S(/^html$/i),ke=S(/^[a-z][.\w]*(-[.\w]+)+$/i),Te=S(/<[/\w!]/g),Ae=S(/<[/\w]/g),Ce=S(/<\/no(script|embed|frames)/i),Fe=S(/\/>/i),Ee=1,Ne=3,Oe=7,je=8,De=9,Re=11,Ie=x(ee({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),$e=function(){return"undefined"==typeof window?null:window},ze=function(e,t,n,r){return Y(e,t)&&R(e[t])?ee(r.base?ne(r.base):{},e[t],r.transform):n},Pe=function(e,t,n){const r=Y(e,t)?e[t]:void 0;return r&&"object"==typeof r?ne(r):n()};var Le=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$e();const n=t=>e(t);if(n.version="3.4.17",n.removed=[],!t||!t.document||t.document.nodeType!==De||!t.Element)return n.isSupported=!1,n;let r=t.document;const i=r,o=i.currentScript;t.DocumentFragment;const a=t.HTMLTemplateElement,l=t.Node,s=t.Element,c=t.NodeFilter;void 0===t.NamedNodeMap&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const f=t.DOMParser,u=t.trustedTypes,d=s.prototype,p=re(d,"cloneNode"),m=re(d,"remove"),h=re(d,"removeAttributeNode"),v=re(d,"nextSibling"),y=re(d,"childNodes"),_=re(d,"parentNode"),T=re(d,"shadowRoot"),A=re(d,"attributes"),C=l&&l.prototype?re(l.prototype,"nodeType"):null,Z=l&&l.prototype?re(l.prototype,"nodeName"):null,te=l&&l.prototype?re(l.prototype,"ownerDocument"):null,Le=function(e){return C?C(e):e.nodeType},Me=function(e){return Z?Z(e):e.nodeName},Ue=function(e,t){for(;null!==e;){const n=w(e,t);if(n)return n.get?K(n.get):null;e=b(e)}return null}(d,"namespaceURI"),He=function(e){return Ue?Ue(e):e.namespaceURI};if("function"==typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let Ve,We,Be="",Qe=!1,qe=0;const Ye=function(){if(qe>0)throw J('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ge=function(e){Ye(),qe++;try{return Ve.createHTML(e)}finally{qe--}},Xe=function(){return Qe||(We=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(u,o),Qe=!0),We},Je=r,Ke=Je.implementation,Ze=Je.createNodeIterator,et=Je.createDocumentFragment,tt=Je.getElementsByTagName,nt=i.importNode;let rt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof g&&"function"==typeof _&&Ke&&void 0!==Ke.createHTMLDocument;const it=he,ot=ve,at=ge,lt=ye,st=_e,ct=we,ft=xe,ut=ke;let dt=be,pt=null;const mt=ee({},[...ie,...oe,...ae,...se,...fe]);let ht=null;const vt=ee({},[...ue,...de,...pe,...me]);let gt=Object.seal(k(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),yt=null,_t=null;const bt=Object.seal(k(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let wt=!0,xt=!0,St=!1,kt=!0,Tt=!1,At=!0,Ct=!1,Ft=!1,Et=null,Nt=null,Ot=!1,jt=!1,Dt=!1,Rt=!1,It=!0,$t=!1;const zt="user-content-";let Pt=!0,Lt=!1,Mt=null,Ut={},Ht=null;const Vt=ee({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Wt=null;const Bt=ee({},["audio","video","img","source","image","track"]);let Qt=null;const qt=ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Yt="http://www.w3.org/1998/Math/MathML",Gt="http://www.w3.org/2000/svg",Xt="http://www.w3.org/1999/xhtml";let Jt=Xt,Kt=!1,Zt=null;const en=ee({},[Yt,Gt,Xt],L),tn=x(["mi","mo","mn","ms","mtext"]);let nn=ee({},tn);const rn=x(["annotation-xml"]);let on=ee({},rn);const an=ee({},["title","style","font","a","script"]);let ln=null;const sn=["application/xhtml+xml","text/html"];let cn=null,fn=null;const un=r.createElement("form"),dn=function(e){return e instanceof RegExp||e instanceof Function},pn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(fn&&fn===e)return;e&&"object"==typeof e||(e={}),e=ne(e),ln=-1===sn.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,cn="application/xhtml+xml"===ln?L:P,pt=ze(e,"ALLOWED_TAGS",mt,{transform:cn}),ht=ze(e,"ALLOWED_ATTR",vt,{transform:cn}),Zt=ze(e,"ALLOWED_NAMESPACES",en,{transform:L}),Qt=ze(e,"ADD_URI_SAFE_ATTR",qt,{transform:cn,base:qt}),Wt=ze(e,"ADD_DATA_URI_TAGS",Bt,{transform:cn,base:Bt}),Ht=ze(e,"FORBID_CONTENTS",Vt,{transform:cn}),yt=ze(e,"FORBID_TAGS",ne({}),{transform:cn}),_t=ze(e,"FORBID_ATTR",ne({}),{transform:cn}),Ut=!!Y(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?ne(e.USE_PROFILES):e.USE_PROFILES),wt=!1!==e.ALLOW_ARIA_ATTR,xt=!1!==e.ALLOW_DATA_ATTR,St=e.ALLOW_UNKNOWN_PROTOCOLS||!1,kt=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Tt=e.SAFE_FOR_TEMPLATES||!1,At=!1!==e.SAFE_FOR_XML,Ct=e.WHOLE_DOCUMENT||!1,jt=e.RETURN_DOM||!1,Dt=e.RETURN_DOM_FRAGMENT||!1,Rt=e.RETURN_TRUSTED_TYPE||!1,Ot=e.FORCE_BODY||!1,It=!1!==e.SANITIZE_DOM,$t=e.SANITIZE_NAMED_PROPS||!1,Pt=!1!==e.KEEP_CONTENT,Lt=e.IN_PLACE||!1,dt=function(e){try{return X(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:be,Jt="string"==typeof e.NAMESPACE?e.NAMESPACE:Xt,nn=Pe(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>ee({},tn)),on=Pe(e,"HTML_INTEGRATION_POINTS",()=>ee({},rn));const t=Pe(e,"CUSTOM_ELEMENT_HANDLING",()=>k(null));if(gt=k(null),Y(t,"tagNameCheck")&&dn(t.tagNameCheck)&&(gt.tagNameCheck=t.tagNameCheck),Y(t,"attributeNameCheck")&&dn(t.attributeNameCheck)&&(gt.attributeNameCheck=t.attributeNameCheck),Y(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(gt.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),S(gt),Tt&&(xt=!1),Dt&&(jt=!0),Ut&&(pt=ee({},fe),ht=k(null),!0===Ut.html&&(ee(pt,ie),ee(ht,ue)),!0===Ut.svg&&(ee(pt,oe),ee(ht,de),ee(ht,me)),!0===Ut.svgFilters&&(ee(pt,ae),ee(ht,de),ee(ht,me)),!0===Ut.mathMl&&(ee(pt,se),ee(ht,pe),ee(ht,me))),bt.tagCheck=null,bt.attributeCheck=null,Y(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?bt.tagCheck=e.ADD_TAGS:R(e.ADD_TAGS)&&(pt===mt&&(pt=ne(pt)),ee(pt,e.ADD_TAGS,cn))),Y(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?bt.attributeCheck=e.ADD_ATTR:R(e.ADD_ATTR)&&(ht===vt&&(ht=ne(ht)),ee(ht,e.ADD_ATTR,cn))),Y(e,"ADD_FORBID_CONTENTS")&&R(e.ADD_FORBID_CONTENTS)&&(Ht===Vt&&(Ht=ne(Ht)),ee(Ht,e.ADD_FORBID_CONTENTS,cn)),Pt&&(pt["#text"]=!0),Ct&&ee(pt,["html","head","body"]),pt.table&&(ee(pt,["tbody"]),delete yt.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw J('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw J('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=Ve;Ve=e.TRUSTED_TYPES_POLICY;try{Be=Ge("")}catch(e){throw Ve=t,e}}else null===e.TRUSTED_TYPES_POLICY?(Ve=void 0,Be=""):(void 0===Ve&&(Ve=Xe()),Ve&&"string"==typeof Be&&(Be=Ge("")));x&&x(e),fn=e},mn=ee({},[...oe,...ae,...le]),hn=ee({},[...se,...ce]),vn=function(e){const t=He(e),n=P(Me(e)),r=_(e);let i,o;return r&&Le(r)===Ee?(i={namespaceURI:He(r)},o=P(Me(r))):(i={namespaceURI:Jt},o="template"),!!Zt[t]&&(t===Gt?function(e,t,n){return t.namespaceURI===Xt?"svg"===e:t.namespaceURI===Yt?"svg"===e&&("annotation-xml"===n||nn[n]):Boolean(mn[e])}(n,i,o):t===Yt?function(e,t,n){return t.namespaceURI===Xt?"math"===e:t.namespaceURI===Gt?"math"===e&&on[n]:Boolean(hn[e])}(n,i,o):t===Xt?function(e,t,n){return!(t.namespaceURI===Gt&&!on[n])&&!(t.namespaceURI===Yt&&!nn[n])&&!hn[e]&&(an[e]||!mn[e])}(n,i,o):!("application/xhtml+xml"!==ln||!Zt[t]))},gn=function(e){O(n.removed,{element:e});try{_(e).removeChild(e)}catch(t){if(m(e),!_(e))throw J("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},yn=function(e,t,n){try{h(e,t)}catch(t){try{e.removeAttribute(n)}catch(e){}}},_n=function(e){Sn(e);const t=y(e);t&&F(j(t),e=>{try{m(e)}catch(e){}});const n=Le(e)===Ee?A(e):null;if(n)for(let t=n.length-1;t>=0;--t){const r=n[t],i=r&&r.name;"string"==typeof i&&yn(e,r,i)}},bn=function(e,t,r){if(!r)try{r=t.getAttributeNode(e)}catch(e){r=null}O(n.removed,{attribute:r||null,from:t});try{r?h(t,r):t.removeAttribute(e)}catch(n){try{t.removeAttribute(e)}catch(e){}}if("is"===e)if(jt||Dt)try{gn(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},wn=function(e){const t=A(e);if(t)for(let n=t.length-1;n>=0;--n){const r=t[n],i=r&&r.name;"string"!=typeof i||ht[cn(i)]||yn(e,r,i)}},xn=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=[e];for(;r.length>0;){const e=r.pop();if(!1===t(e))continue;if(n&&Le(e)===Ee){const t=T(e);Rn(t)&&r.push(t)}const i=y(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Sn=function(e){xn(e,e=>{Le(e)===Ee&&wn(e)})},kn=function(e){const t=[];return xn(e,e=>{t.push(e)},!0),t},Tn=function(e,t){let r=!1;return F(n.removed,t=>{t.element&&(r=r||t.element===e,Sn(t.element))}),function(e,t){const n=I();F(kn(e),e=>{Le(e)===Ee&&$(n,e)}),F(t,e=>{Le(e)!==Ee||z(n,e)||wn(e)})}(e,t),r},An=function(e,t,n,r){const i=En(e);let o;for(;o=i.nextNode();)z(r,o)&&!z(Mt,o)&&(t&&$n(rt.uponSanitizeShadowNode,o,null),Mn(o,n),qn(o,n),Rn(o.content)&&Yn(o.content))},Cn=function(e,t){return!!At&&("patchsrc"===e||"for"===e&&"label"!==t&&"output"!==t)},Fn=function(e){let t=null,n=null;if(Ot)e="<remove></remove>"+e;else{const t=M(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ln&&Jt===Xt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=Ve?Ge(e):e;if(Jt===Xt)try{t=(new f).parseFromString(i,ln)}catch(e){}if(!t||!t.documentElement){t=Ke.createDocument(Jt,"template",null);try{t.documentElement.innerHTML=Kt?Be:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),Jt===Xt?tt.call(t,Ct?"html":"body")[0]:Ct?t.documentElement:o},En=function(e){const t=te?te(e):e.ownerDocument;return Ze.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Nn=function(e){return e=U(e,it," "),e=U(e,ot," "),e=U(e,at," ")},On=function(e){var t;jn(e);const n=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");n&&F(n,e=>{Rn(e.content)&&On(e.content)})},jn=function(e){e.normalize();const t=te?te(e):e.ownerDocument,n=Ze.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let r=n.nextNode();for(;r;)r.data=Nn(r.data),r=n.nextNode()},Dn=function(e){const t=Z?Z(e):null;return"string"==typeof t&&("form"===cn(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==A(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.removeAttributeNode||"function"!=typeof e.getAttributeNode||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==C(e)||e.childNodes!==y(e)))},Rn=function(e){if(!C||"object"!=typeof e||null===e)return!1;try{return C(e)===Re}catch(e){return!1}},In=function(e){if(!C||"object"!=typeof e||null===e)return!1;try{return"number"==typeof C(e)}catch(e){return!1}};function $n(e,t,r){0!==e.length&&F(e,e=>{e.call(n,t,r,fn)})}const zn=function(e,t){if(e instanceof RegExp)return X(e,t);if(e instanceof Function){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return Boolean(e(t,...r))}return!1},Pn=function(e,t,n,r){return 0===e.length?t:t===n||t===r?ne(t):t},Ln=function(e,t){return e!==t&&null===_(e)&&(Lt&&Sn(e),!0)},Mn=function(e,t){var r;if(r=e,Mt&&$(Mt,r),$n(rt.beforeSanitizeElements,e,null),Ln(e,t))return!0;if(Dn(e))return gn(e),!0;const i=cn(Me(e));if(pt=Pn(rt.uponSanitizeElement,pt,mt,Et),$n(rt.uponSanitizeElement,e,{tagName:i,allowedTags:pt}),Ln(e,t))return!0;if(function(e,t){return!!(At&&e.hasChildNodes()&&!In(e.firstElementChild)&&X(Te,e.textContent)&&X(Te,e.innerHTML))||!!(At&&Ie[t]&&Le(e)===Ee&&He(e)===Xt&&(In(e.firstElementChild)||"string"==typeof e.textContent&&X(Te,e.textContent)))||e.nodeType===Oe||!(!At||e.nodeType!==je||!X(Ae,e.data))}(e,i))return gn(e),!0;if(yt[i]||!(bt.tagCheck instanceof Function&&bt.tagCheck(i))&&!pt[i]){const n=function(e,t,n){if(!yt[t]&&Vn(t)&&zn(gt.tagNameCheck,t))return!1;if(Pt&&!Ht[t]&&!Ht[P(t)]){const t=_(e),r=y(e);if(r&&t)for(let i=r.length-1;i>=0;--i){const o=e===n?p(r[i],!0):r[i];t.insertBefore(o,v(e))}}return gn(e),!0}(e,i,t);return!(!1!==n||($n(rt.afterSanitizeElements,e,null),!Ln(e,t)))||n}if(Le(e)===Ee&&!vn(e))return gn(e),!0;if(("noscript"===i||"noembed"===i||"noframes"===i)&&X(Ce,e.innerHTML))return gn(e),!0;if(Tt&&e.nodeType===Ne){const t=Nn(e.textContent);e.textContent!==t&&(O(n.removed,{element:e.cloneNode()}),e.textContent=t)}return $n(rt.afterSanitizeElements,e,null),Ln(e,t)},Un=function(e,t,n){if(_t[t])return!1;if(Cn(t,e))return!1;if(It&&("id"===t||"name"===t)&&(n in r||n in un))return!1;const i=ht[t]||bt.attributeCheck instanceof Function&&bt.attributeCheck(t,e);return!(!xt||!X(lt,t))||(!(!wt||!X(st,t))||(i?!!Qt[t]||(!!X(dt,U(n,ft,""))||(!("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==H(n,"data:")||!Wt[e])||(!(!St||X(ct,U(n,ft,"")))||!n))):Vn(e)&&zn(gt.tagNameCheck,e)&&zn(gt.attributeNameCheck,t,e)||"is"===t&>.allowCustomizedBuiltInElements&&zn(gt.tagNameCheck,n)))},Hn=ee({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Vn=function(e){return!Hn[P(e)]&&X(ut,e)},Wn=function(e,t,n,r){if(Ve&&"object"==typeof u&&"function"==typeof u.getAttributeType&&!n)switch(u.getAttributeType(e,t)){case"TrustedHTML":return Ge(r);case"TrustedScriptURL":return function(e){Ye(),qe++;try{return Ve.createScriptURL(e)}finally{qe--}}(r)}return r},Bn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Dn(e)||(gn(e),!1)}catch(n){return bn(t,e),!1}},Qn=function(e,t){return!(!At||!X(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t))||"attributename"===P(e)&&null!==M(t,"href")},qn=function(e,t){if($n(rt.beforeSanitizeAttributes,e,null),Ln(e,t))return;const r=e.attributes;if(!r||Dn(e))return;ht=Pn(rt.uponSanitizeAttribute,ht,vt,Nt);const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ht,forceKeepAttr:void 0};let o=r.length;const a=cn(e.nodeName);for(;o--;){const t=r[o],l=t.name,s=t.namespaceURI,c=t.value,f=cn(l),u=c;let d="value"===l?u:V(u),p=!1;i.attrName=f,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,$n(rt.uponSanitizeAttribute,e,i),d=i.attrValue,!$t||"id"!==f&&"name"!==f||0===H(d,zt)||(bn(l,e,t),d=zt+d,p=!0),Qn(l,d)?bn(l,e,t):i.forceKeepAttr||(i.keepAttr&&(kt||!X(Fe,d))?(Tt&&(d=Nn(d)),Un(a,f,d)?(d=Wn(a,f,s,d),d!==u&&Bn(e,l,s,d)&&p&&N(n.removed)):bn(l,e,t)):bn(l,e,t))}$n(rt.afterSanitizeAttributes,e,null),Ln(e,t)},Yn=function(e){let t=null;const n=En(e);for($n(rt.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($n(rt.uponSanitizeShadowNode,t,null),Mn(t,e),qn(t,e),Rn(t.content)&&Yn(t.content),Le(t)===Ee){const e=T(t);Rn(e)&&(Gn(e),Yn(e))}Tt&&jn(e),$n(rt.afterSanitizeShadowDOM,e,null)},Gn=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){Yn(e.shadow);continue}const n=e.node,r=Le(n)===Ee,i=y(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){const e=Z?Z(n):null;if("string"==typeof e&&"template"===cn(e)){const e=n.content;Rn(e)&&t.push({node:e,shadow:null})}}if(r){const e=T(n);Rn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,a=null,l=null;if(Kt=!e,Kt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!In(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return W(e);case"boolean":return B(e);case"bigint":return Q?Q(e):"0";case"symbol":return q?q(e):"Symbol()";case"undefined":default:return G(e);case"function":case"object":{if(null===e)return G(e);const t=e,n=re(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:G(e)}return G(e)}}}(e)))throw J("dirty is not a string, aborting");if(!n.isSupported)return e;Ft?(pt=Et,ht=Nt):pn(t),(rt.uponSanitizeElement.length>0||rt.uponSanitizeAttribute.length>0)&&(pt=ne(pt)),rt.uponSanitizeAttribute.length>0&&(ht=ne(ht)),n.removed=[];const s=Lt&&"string"!=typeof e&&In(e);let c=[];const f=Mt;if(s){u=e,At&&xn(u,e=>{const t=Le(e);if(t===Oe||t===je&&X(Ae,e.data)){try{m(e)}catch(e){}return!1}if(t===Ee){const t=e,n=cn(Me(e));try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&Cn("for",n)&&t.removeAttribute("for")}catch(e){}}return!0});const t=Me(e);if("string"==typeof t){const n=cn(t);if(!pt[n]||yt[n])throw _n(e),J("root node is forbidden and cannot be sanitized in-place")}if(Dn(e))throw _n(e),J("root node is clobbered and cannot be sanitized in-place");c=kn(e),Mt=I()}else if(In(e))r=Fn("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),o.nodeType===Ee&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o),Gn(r);else{if(!jt&&!Tt&&!Ct&&-1===e.indexOf("<"))return Ve&&Rt?Ge(e):e;if(r=Fn(e),!r)return jt?null:Rt?Be:""}var u;r&&Ot&&gn(r.firstChild);const d=s?e:r;try{s&&Gn(e);const t=En(d);for(;a=t.nextNode();)Mn(a,d),qn(a,d),Rn(a.content)&&Yn(a.content);s&&function(e,t){const n=Mt;let r=null;const i=()=>(r||(r=I(),F(t,e=>{$(r,e)})),r);for(let t=0;;t++){const r=kn(e),o=[e];let a=!1;if(F(r,e=>{Le(e)===Re?O(o,e):a||z(n,e)||(a=z(i(),e))}),!a)return;if(t>=8)throw J("the tree kept changing during in-place sanitization; refusing to return it");F(o,(t,n)=>{An(t,n>0,e,i())})}}(e,c)}catch(t){throw s&&(_n(e),Tn(e,c)),t}finally{Mt=f}if(s){if(Tn(e,c))throw J("a node selected for removal could not be safely returned; refusing to sanitize in place");return Tt&&On(e),e}if(jt){if(Tt&&On(r),Dt)for(l=et.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(ht.shadowroot||ht.shadowrootmode)&&(l=nt.call(i,l,!0)),l}let p=Ct?r.outerHTML:r.innerHTML;return Ct&&pt["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&X(Se,r.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+p),Tt&&(p=Nn(p)),Ve&&Rt?Ge(p):p},n.setConfig=function(){pn(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ft=!0,Et=pt,Nt=ht},n.clearConfig=function(){fn=null,Ft=!1,Et=null,Nt=null,Ve=We,Be=""},n.isValidAttribute=function(e,t,n){fn||pn({});const r=cn(e),i=cn(t);return("string"!=typeof n||!(Qn(t,n)||!kt&&X(Fe,n)))&&Un(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&Y(rt,e)&&O(rt[e],t)},n.removeHook=function(e,t){if(Y(rt,e)){if(void 0!==t){const n=E(rt[e],t);return-1===n?void 0:D(rt[e],n,1)[0]}return N(rt[e])}},n.removeHooks=function(e){Y(rt,e)&&(rt[e]=[])},n.removeAllHooks=function(){rt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Me=["_blank","_self","_parent","_top"],Ue=["_self","_top","_parent"],He=/^[A-Za-z][A-Za-z0-9_.-]*$/,Ve=/^[A-Za-z][A-Za-z-]*$/,We=["noopener"];function Be(e){var t=e&&"string"==typeof e.tagName?e.tagName.toUpperCase():"";return"A"===t||"AREA"===t}var Qe=Le(window);function qe(e){return null==e?"":Qe.sanitize(String(e))}function Ye(e){return Ye="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},Ye(e)}function Ge(e,t,n,r,i){var o=function(e,t){var r="fluentform_upload_messages_"+n.id;return window[r]&&window[r][e]?window[r][e]:t},a=function(){jQuery.fn.fileupload&&(t.find('input[type="file"]').each(function(a,f){var u,d,p=e(this),m=p.closest(".ff-el-group");m.closest(".ff-column-container").is(".ff_columns_total_6, .ff_columns_total_5, .ff_columns_total_4")&&m.width()<162&&(d=m.width()),u=e("<div/>",{class:"ff-uploaded-list",style:"font-size:12px; margin-top: 15px;"+(d?"max-width:".concat(d,"px;"):"")}),p.closest("div").append(u);var h=u.width(),v=n.rules[p.prop("name")],g=v.max_file_count.value,y=p.data("name")||p.prop("name");"max_file_count"in v&&(v.max_file_count.remaining=Number(g));var _="";function b(e){var n=p.prop("name");t.trigger("show_element_error",{element:n,message:e})}function w(r,o){if(o&&o.files&&o.files.length){if(t.find(".ff-upload-preview-elem").remove(),"max_file_count"in v){e(i+"_errors").empty(),e(this).closest("div").find(".error").html("");var a=v.max_file_count.remaining;if(!a||o.files.length>a){var l="Maximum 1 file is allowed!";return l=g>1?"Maximum "+g+" files are allowed!":l,v.max_file_count&&v.max_file_count.message&&(l=v.max_file_count.message),b(l),!1}}var s=c(o.files[0],n.rules[p.prop("name")]);return s.length?(b(s.join(", ")),!1):(p.closest("div").find(".error").html(""),!0)}}function x(){return n.file_upload_settings&&n.file_upload_settings[y]?function(e){if(!e)return null;var t=e.mode||e.crop_mode||("yes"===e.enforce_image_dimensions?"dimensions":"ratio"),n=Number(void 0!==e.width?e.width:e.crop_width)||0,r=Number(void 0!==e.height?e.height:e.crop_height)||0;return{enabled:void 0!==e.enabled?e.enabled:"yes"===e.enable_crop,mode:t,crop_ratio:e.crop_ratio||"free",enforce_size:void 0!==e.enforce_size?e.enforce_size:"dimensions"===t,width:n,height:r,button_ui:e.button_ui||e.upload_bttn_ui||""}}(n.file_upload_settings[y]):null}function S(e){if(!e)return NaN;if(e.enforce_size&&Number(e.width)>0&&Number(e.height)>0)return Number(e.width)/Number(e.height);if(!e.crop_ratio||"free"===e.crop_ratio)return NaN;var t=e.crop_ratio.split(":");if(2!==t.length)return NaN;var n=Number(t[0]),r=Number(t[1]);return n&&r?n/r:NaN}function k(e,t){return t&&t.enabled&&e.type.match("image")?new Promise(function(i,o){var a=window.Cropper,l=window.lity;if(a&&l){var s="ff-cropper-modal-".concat(n.id,"-").concat(Date.now()),c=document.createElement("div");c.id=s,c.className="lity-hide ff-cropper-lightbox",c.innerHTML=qe('\n <div class="ff-cropper-lightbox__dialog" role="dialog" aria-modal="true">\n <div class="ff-cropper-lightbox__header">\n <h3 class="ff-cropper-lightbox__title">'.concat(r.crop_image_title||"Crop Image",'</h3>\n <button type="button" class="lity-close ff-cropper-lightbox__close" data-lity-close aria-label="').concat(r.crop_close_txt||"Close",'">×</button>\n </div>\n <div class="ff-cropper-lightbox__body">\n <div class="ff-cropper-lightbox__canvas">\n <img alt="">\n </div>\n <div class="ff-cropper-lightbox__hint"></div>\n <div class="ff-cropper-lightbox__error" aria-live="polite"></div>\n </div>\n <div class="ff-cropper-lightbox__footer">\n <button type="button" class="ff-cropper-lightbox__btn" data-action="reset">').concat(r.crop_reset_txt||"Reset",'</button>\n <button type="button" class="ff-cropper-lightbox__btn" data-action="cancel">').concat(r.crop_cancel_txt||"Cancel",'</button>\n <button type="button" class="ff-cropper-lightbox__btn ff-cropper-lightbox__btn--primary" data-action="confirm">').concat(r.crop_confirm_txt||"Crop & Upload","</button>\n </div>\n </div>\n ")),document.body.appendChild(c);var f=c.querySelector("img");f.alt=e.name;var u,d=c.querySelector(".ff-cropper-lightbox__error"),p=c.querySelector(".ff-cropper-lightbox__hint"),m=Number(t.width)||0,h=Number(t.height)||0,v=!(u=t)||u.enforce_size||u.crop_ratio&&"free"!==u.crop_ratio?[]:[{value:"free",label:r.crop_ratio_free_txt||"Free"},{value:"1:1",label:"1:1"},{value:"4:3",label:"4:3"},{value:"16:9",label:"16:9"},{value:"3:4",label:"3:4"}],g=S(t),y=URL.createObjectURL(e),_=l("#".concat(s),{esc:!0,template:'<div class="lity ff-cropper-lity" role="dialog" aria-label="Dialog Window" tabindex="-1"><div class="lity-wrap" role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div></div></div></div>'}),b=null,w=t.crop_ratio||"free",x=null,k=!1,T=function(e,t,n){return Boolean(e&&e.enforce_size&&Number(t)>0&&Number(n)>0)}(t,m,h);if(m&&h&&t.enforce_size){var A=r.crop_dimension_instruction_txt||"Crop the image to exactly %1$s px x %2$s px.";p.textContent=A.replace("%1$s",m).replace("%2$s",h)}if(v.length){var C=document.createElement("div");C.className="ff-cropper-lightbox__toolbar",C.innerHTML=qe('\n <span class="ff-cropper-lightbox__toolbar-label">'.concat(r.crop_ratio_txt||"Crop ratio",'</span>\n <div class="ff-cropper-lightbox__ratio-list">\n ').concat(v.map(function(e){return'\n <button\n type="button"\n class="ff-cropper-lightbox__ratio-btn'.concat(e.value===w?" is-active":"",'"\n data-ratio-value="').concat(e.value,'"\n >').concat(e.label,"</button>\n ")}).join(""),"\n </div>\n ")),c.querySelector(".ff-cropper-lightbox__body").insertBefore(C,c.querySelector(".ff-cropper-lightbox__canvas"))}_.element().one("lity:remove",function(){k||(k=!0,b&&(b.destroy(),b=null),URL.revokeObjectURL(y),c.remove()),x&&"reject"===x.type?o(x.error):i(x?x.value:null)}),c.querySelectorAll(".ff-cropper-lightbox__ratio-btn").forEach(function(e){e.addEventListener("click",function(){if(w=e.getAttribute("data-ratio-value")||"free",c.querySelectorAll(".ff-cropper-lightbox__ratio-btn").forEach(function(e){e.classList.toggle("is-active",e.getAttribute("data-ratio-value")===w)}),b){var t="free"===w?NaN:S({crop_ratio:w,enforce_size:!1,width:0,height:0});b.setAspectRatio(t)}})}),c.querySelector('[data-action="cancel"]').addEventListener("click",function(){F({type:"resolve",value:null})}),c.querySelector('[data-action="reset"]').addEventListener("click",function(){d.textContent="",b&&(b.reset(),T&&window.setTimeout(function(){E()},0))}),c.querySelector('[data-action="confirm"]').addEventListener("click",function(){if(d.textContent="",b){var n=b.getImageData(),i=b.getData(!0);if(t.enforce_size&&m&&h&&(n.naturalWidth<m||n.naturalHeight<h||i.width<m||i.height<h))d.textContent=r.crop_invalid_dimensions_txt||"The selected image is smaller than the required crop size.";else{var o={fillColor:"#fff",imageSmoothingEnabled:!0,imageSmoothingQuality:"high"};t.enforce_size&&m&&h&&(o.width=m,o.height=h);var a=b.getCroppedCanvas(o);if(a)if(t.enforce_size&&m&&h&&(a.width!==m||a.height!==h))d.textContent=r.crop_exact_dimensions_txt||"The cropped image must match the required width and height.";else{var l=["image/jpeg","image/png","image/webp"].includes(e.type)?e.type:"image/png";a.toBlob(function(t){t?F({type:"resolve",value:new File([t],e.name,{type:l,lastModified:Date.now()})}):F({type:"reject",error:new Error(r.crop_invalid_image_txt||"Could not crop image")})},l,.92)}else F({type:"reject",error:new Error(r.crop_invalid_image_txt||"Could not crop image")})}}else d.textContent=r.crop_loading_txt||"Preparing image..."}),f.onload=function(){b=new a(f,{aspectRatio:g,autoCropArea:1,viewMode:1,dragMode:"move",responsive:!0,restore:!1,background:!1,movable:!0,zoomable:!T,zoomOnTouch:!T,zoomOnWheel:!T,scalable:!1,rotatable:!1,cropBoxResizable:!T,cropBoxMovable:!T,ready:function(){E()}})},f.src=y}else o(new Error(r.crop_invalid_image_txt||"Unable to process the selected image."));function F(e){x||(x=e,_.close())}function E(){if(b&&T){var e=b.getImageData();if(!(!e||e.naturalWidth<m||e.naturalHeight<h)){var t=(e.naturalWidth-m)/2,n=(e.naturalHeight-h)/2;b.setData({x:t,y:n,width:m,height:h})}}}}):Promise.resolve(e)}"allowed_file_types"in v?(_=v.allowed_file_types.value.join("|"),p.prop("accept","."+_.replace(/\|/g,",."))):(_=v.allowed_image_types.value.join("|"))?p.prop("accept","."+_.replace(/\|/g,",.")):p.prop("accept","image/*");var T=e(f);p.fileupload({dataType:"json",dropZone:p.closest(".ff-el-group"),url:r.ajaxUrl,formData:function(e){var t=e.serializeArray();return t.push({name:"action",value:"fluentform_file_upload"}),t.push({name:"formId",value:n.id}),t},change:w,add:function(t,i){w(0,i)&&k(i.files[0],x()).then(function(t){if(t){var o=c(t,n.rules[p.prop("name")]);if(o.length)b(o.join(", "));else{i.files[0]=t;var a=e("<div/>",{class:"ff-upload-preview"+(d?" ff-upload-container-small-column-image":"")});i.context=a;var f=e("<div/>",{class:"ff-upload-thumb"}),m=e("<div/>",{class:"ff-upload-details"}),v=e("<div/>",{class:"ff-upload-preview-img",style:"background-image: url('".concat(l(i.files[0]),"');")}),g=e("<div>",{class:"ff-upload-error",style:"color:red;"}),y=e("<span/>",{html:r.upload_start_txt,class:"ff-upload-progress-inline-text ff-inline-block"}),_=e('\n\t\t\t\t\t\t\t\t\t<div class="ff-upload-progress-inline ff-el-progress">\n\t\t\t\t\t\t\t\t\t\t<div class="ff-el-progress-bar"></div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t'),w=e("<div/>",{class:"ff-upload-filename",text:i.files[0].name}),x=e("<span/>",{"data-href":"#","data-attachment-id":"",html:"×",class:"ff-upload-remove"}),S=e("<div>",{class:"ff-upload-filesize ff-inline-block",html:s(i.files[0].size)});f.append(v),m.append(w,_,y,S,g,x),a.append(f,m),u.append(a),d||(h-=91),w.css({maxWidth:h+"px"}),i.submit(),i.context.addClass("ff_uploading")}}}).catch(function(e){b(e.message||r.crop_invalid_image_txt||"Unable to crop image")})},progress:function(e,t){var n=parseInt(t.loaded/t.total*100,10);t.context.find(".ff-el-progress-bar").css("width",n+"%"),t.context.find(".ff-upload-progress-inline-text").text(r.uploading_txt)},done:function(e,n){if(n.context.removeClass("ff_uploading"),n.result&&"data"in n.result&&"files"in n.result.data)"error"in n.result.data.files[0]?(b("Upload Error: "+n.result.data.files[0].error),n.context.remove()):(n.context.find(".ff-upload-progress-inline-text").text(r.upload_completed_txt),v.max_file_count.remaining-=1,n.context.attr("data-src",n.result.data.files[0].url),n.context.find(".ff-upload-remove").attr({"data-href":n.result.data.files[0].file,"data-attachment-id":n.result.data.files[0].attachment_id}),n.context.addClass("ff_uploading_complete"),t.find("input[name="+T.data("name")+"]").trigger("change"));else{var i=o("upload_failed_text","Sorry! The upload failed for some unknown reason.");if(n.messages){var a=Object.keys(n.messages);a.length&&(i=n.messages[a[0]])}b(i),n.context.remove()}},fail:function(t,n){var r,i,a,l,s=[];null===(r=n.context)||void 0===r||r.remove(),null!==(i=n.jqXHR)&&void 0!==i&&i.responseJSON&&null!==(a=n.jqXHR)&&void 0!==a&&a.responseJSON.errors?e.each(n.jqXHR.responseJSON.errors,function(t,n){"object"==Ye(n)?e.each(n,function(e,t){s.push(t)}):s.push(n)}):null!==(l=n.jqXHR)&&void 0!==l&&l.responseText?s.push(n.jqXHR.responseText):s.push(o("upload_error_text","Something is wrong when uploading the file! Please try again")),b(s.join(", "))}}),T.on("change_remaining",function(e,t){v.max_file_count.remaining+=t})}),t.find(".ff_upload_btn").on("keyup click",function(t){t.preventDefault(),t.stopPropagation(),("click"===t.type||"keyup"===t.type&&32===t.keyCode)&&e(this).siblings("input[type=file]").trigger("click")}))},l=function(e){if(e.type.match("image"))return URL.createObjectURL(e);var t=document.createElement("canvas");t.width=60,t.height=60,t.style.zIndex=8,t.style.position="absolute",t.style.border="1px solid";var n=t.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.name.substr(e.name.lastIndexOf(".")+1),30,30,60),t.toDataURL()},s=function(e){return e<1024?e+"bytes":e>=1024&&e<=1048576?(e/1024).toFixed(1)+"KB":e>1048576?(e/1048576).toFixed(1)+"MB":void 0},c=function(e,t){var n=[],r="",i="";if("allowed_file_types"in t?(r=t.allowed_file_types.value,i=t.allowed_file_types.message):"allowed_image_types"in t&&(r=t.allowed_image_types.value,i=t.allowed_image_types.message),r){var o=new RegExp("("+r.join("|")+")","i"),a=e.name.split(".").pop();a=a.toLowerCase(),o.test(a)||n.push(i)}return"max_file_size"in t&&t.max_file_size.value>0&&e.size>t.max_file_size.value&&n.push(t.max_file_size.message),n};a(),t.find(".ff-uploaded-list").on("click",".ff-upload-remove",function(t){t.preventDefault();var n=e(this),i=n.closest(".ff-uploaded-list"),o=i.closest(".ff-el-input--content").find("input[type=file]"),a=n.attr("data-href"),l=n.attr("data-attachment-id");"#"==a?(n.closest(".ff-el-input--content").find(".error").remove(),n.closest(".ff-upload-preview").remove(),i.find(".ff-upload-preview").length||i.siblings(".ff-upload-progress").addClass("ff-hidden"),o.trigger("change_remaining",1)):e.post(r.ajaxUrl,{path:a,attachment_id:l,action:"fluentform_delete_uploaded_file",_fluentform_file_delete_nonce:r.file_delete_nonce}).then(function(e){n.closest(".ff-el-input--content").find("input"),o.trigger("change_remaining",1),n.closest(".ff-el-input--content").find(".error").remove(),n.closest(".ff-upload-preview").remove(),i.find(".ff-upload-preview").length||i.siblings(".ff-upload-progress").addClass("ff-hidden"),o.trigger("change")})}),e(document.body).on("fluentform_reset",function(){a()})}function Xe(e){return Xe="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},Xe(e)}function Je(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ke(r.key),r)}}function Ke(e){var t=function(e,t){if("object"!=Xe(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Xe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Xe(t)?t:t+""}Qe.addHook("uponSanitizeAttribute",function(e,t){var n,r;"target"===t.attrName&&Be(e)&&(n=t.attrValue,r=String(n||"").trim(),(Me.includes(r.toLowerCase())||He.test(r))&&(t.forceKeepAttr=!0))}),Qe.addHook("afterSanitizeAttributes",function(e){if(Be(e)&&"function"==typeof e.getAttribute&&"function"==typeof e.setAttribute){var t=e.getAttribute("target");if(t&&!Ue.includes(t.trim().toLowerCase())){var n=(e.getAttribute("rel")||"").split(/\s+/).filter(function(e){return Ve.test(e)});We.forEach(function(e){n.includes(e)||n.push(e)}),e.setAttribute("rel",n.join(" "))}}});var Ze=function(){return e=function e(t,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$=t,this.$theForm=n,this.fluentFormVars=r,this.formSelector=i,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"))},t=[{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(e,t){var n=this.$;e&&e.length&&(e.removeClass("ff_active ff_completed").removeAttr("aria-current"),n.each(e,function(e,r){var i=n(r);e<t?i.addClass("ff_completed"):e===t&&i.addClass("ff_active").attr("aria-current","step")}))}},{key:"enhanceClickableStepTitles",value:function(e){var t=this.$;t.each(e,function(e,n){t(n).attr("data-step-number",e),t(n).attr({role:"button",tabindex:"0","aria-label":"Go to step "+(e+1)})})}},{key:"syncTopTabOverflowState",value:function(){var e=this.$;this.$theForm.find(".ff-step-header--tabs-top .ff-step-titles").each(function(){var t=e(this),n=this.scrollWidth>this.clientWidth+1;t.toggleClass("ff-step-titles--overflowing",n)})}},{key:"isTabsIndicator",value:function(e){return"tabs"===e||"steps_with_nav"===e}},{key:"isClickableIndicator",value:function(e){return this.isTabsIndicator(e)||"steps"===e}},{key:"initFormWithSavedState",value:function(){var e=this;if(this.stepPersistency){var t=this.$,n=this;t(document).ready(function(r){var i,o;t.getJSON(e.fluentFormVars.ajaxUrl,{form_id:e.$theForm.data("form_id"),action:"fluentform_step_form_get_data",nonce:null===(i=e.fluentFormVars)||void 0===i?void 0:i.nonce,hash:null===(o=e.fluentFormVars)||void 0===o?void 0:o.hash}).then(function(e){e&&n.populateFormDataAndSetActiveStep(e)})})}}},{key:"populateFormDataAndSetActiveStep",value:function(e){var t=this,n=e.response,r=e.step_completed,i=this.$,o=[];if(this.$theForm.data("ff_restoring_draft_state",!0),this.$theForm.data("ff_restored_draft_state",!0),i.each(n,function(e,n){if(n){var r=Object.prototype.toString.call(n);if("[object Object]"===r){var a=t.$theForm.find("[data-name=".concat(e,"]"));if(a.length&&"tabular-element"===a.attr("data-type"))jQuery.each(n,function(n,r){var o=t.$theForm.find('[name="'.concat(e,"[").concat(n,']\\[\\]"]'));o.length||(o=t.$theForm.find('[name="'.concat(e,"[").concat(n,']"]'))),i.each(o,function(e,t){var n=i(t).val();-1===i.inArray(n,r)&&n!==r||i(t).prop("checked",!0).change()})});else if("chained-select"===a.attr("data-type")){var l={meta_key:a.find("select:first").attr("data-meta_key"),form_id:a.closest("form").attr("data-form_id"),action:"fluentform_get_chained_select_options",filter_options:"all",keys:n};i.getJSON(t.fluentFormVars.ajaxUrl,l).then(function(e){i.each(e,function(e,t){var r=a.find("select[data-key='".concat(e,"']"));0!=r.attr("data-index")&&i.each(t,function(e,t){r.append(i("<option />",{value:t,text:t}))}),r.attr("disabled",!1).val(n[e])})})}else i.each(n,function(n,r){t.$theForm.find('[name="'.concat(e,"[").concat(n,']"]')).val(r).change()})}else if("[object Array]"===r){var s=t.$theForm.find("[name=".concat(e,"]"));if("file"===(s=(s=s.length?s:t.$theForm.find("[data-name=".concat(e,"]"))).length?s:t.$theForm.find("[name=".concat(e,"\\[\\]]"))).attr("type"))t.addFilesToElement(s,n);else if(s.prop("multiple"))if(i.isFunction(window.Choices)){var c=s.data("choicesjs");c&&o.push({handler:c,values:n})}else s.val(n).change();else if("repeater_field"===s.attr("data-type")){var f=s.find("tbody"),u=s.attr("data-name");i.each(n,function(e,t){0!=e?f.find("tr:last").clone().appendTo(f).find(".ff-el-form-control").each(function(n,r){var o="ffrpt-"+(new Date).getTime()+n;i(r).val(t[n]),i(r).attr({id:o,name:"".concat(u,"[").concat(e,"][]"),value:t[n]}).change()}):f.find("tr:first .ff-el-form-control").each(function(e,n){i(n).val(t[e]).change()})})}else"repeater_container"===s.attr("data-type")?(i.each(n,function(e,t){if(0!==e){var n=s.find(".ff_repeater_cont_row:first").clone();n.find(".ff_repeater_cell").each(function(n,r){var o=i(this).find(".ff-el-form-control:last-child"),a="ffrpt-"+(new Date).getTime()+"_"+e+"_"+n,l={value:t[n]||"",id:a};o.prop(l),i(this).find("label").attr("for",a)}),n.insertAfter(s.find(".ff_repeater_cont_row:last"))}else s.find(".ff_repeater_cont_row:first .ff-el-form-control").each(function(e,n){i(n).val(t[e]).change()})}),t.$theForm.trigger("repeater-container-names-update",[s]),s.trigger("repeat_change")):s.each(function(e,t){-1!==i.inArray(i(t).val(),n)&&i(t).prop("checked",!0).change()})}else{var d=t.$theForm.find("[name=".concat(e,"]"));if(d.hasClass("fluentform-post-content")&&window.wp&&window.wp.editor){var p=d.attr("id");window.tinymce.get(p).setContent(n)}if("undefined"!=typeof flatpickr&&d.prop("_flatpickr")){var m=d.prop("_flatpickr");m&&(m.config.altInput?m.setDate(n,!0):d.val(n).trigger("change"))}if("radio"===d.prop("type")||"checkbox"===d.prop("type"))t.$theForm.find("[name=".concat(e,'][value="').concat(n,'"]')).prop("checked",!0).change(),d.closest(".ff-el-group").find(".ff-el-ratings").length&&t.$theForm.find("[name=".concat(e,'][value="').concat(n,'"]')).closest("label").trigger("mouseenter");else{d.hasClass("ff_has_multi_select")&&d.data("choicesjs")&&(d.data("choicesjs").removeActiveItems(n),d.data("choicesjs").setChoiceByValue(n));var h=d.closest(".ff-el-group").find(".fluentform-signature-pad");if(h.length){var v=h[0].getContext("2d"),g=new Image;g.src=n,g.onload=function(){v.drawImage(g,0,0)}}d.val(n).change()}}}}),o.length>0)for(var a=0;a<o.length;a++){var l,s=o[a].handler,c=o[a].values;s.removeActiveItems(c),s.setChoiceByValue(c);var f=null===(l=s.passedElement)||void 0===l?void 0:l.element;f&&i(f).trigger("change")}this.$theForm.data("ff_restoring_draft_state",!1),this.isPopulatingStepData=!0;var u=this.fluentFormVars.stepAnimationDuration;this.stepResume&&this.updateSlider(r,u,!0).then(function(){t.handleFocus(u)}).catch(function(e){console.error("An error occurred during the slider update:",e)}),this.isPopulatingStepData=!1}},{key:"initStepSlider",value:function(){var e=this.$,t=this.$theForm.find(".fluentform-step"),n=t.length,r=this.$theForm.find(".ff-step-titles li"),i=this.$theForm.find(".ff-step-container").first().data("progress_indicator"),o=this.isClickableIndicator(i)&&this.$theForm.find(".ff-step-titles").first().hasClass("ff-step-titles--clickable");if(!window.ff_disable_auto_step){for(var a=this.activeStep,l=0;a<n&&this.isStepAllFieldsHidden(e(t[a]))&&l<n;)a++,l++;a!==this.activeStep&&a<n&&(this.activeStep=a)}t.css("display","none"),e(t[this.activeStep]).css("display","block"),t.attr("role","group"),t.attr("aria-hidden","true"),e(t[this.activeStep]).attr("aria-hidden","false"),e(t[this.activeStep]).addClass("active"),this.syncStepTitleState(r,this.activeStep);var s=t.first();s.hasClass("active")&&s.find('button[data-action="next"]').css("visibility","visible"),t.length&&!t.last().hasClass("active")&&this.$theForm.find('button[type="submit"]').css("visibility","hidden"),this.stepProgressBarHandle({activeStep:this.activeStep,totalSteps:n}),this.registerStepNavigators(this.fluentFormVars.stepAnimationDuration),o&&this.registerClickableStepNav(r,t),this.isTabsIndicator(i)?(this.syncTopTabOverflowState(),e(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))):e(window).off("resize.ff_step_tabs_"+this.$theForm.data("form_id"))}},{key:"registerClickableStepNav",value:function(e,t){var n=this.$,r=this;0!==e.length&&(this.enhanceClickableStepTitles(e),e.on("click keydown",function(e){if("keydown"!==e.type||"Enter"===e.key||" "===e.key||13===e.keyCode||32===e.keyCode){"keydown"===e.type&&e.preventDefault();var i=r.getFormInstance(),o=n(this),a=r.fluentFormVars.stepAnimationDuration,l=t.index(r.$theForm.find(".fluentform-step.active"));try{var s=parseInt(o.data("step-number"),10);if(isNaN(s))return;if(s===l)return;s>l&&n.each(t,function(e,t){if(e<s){var r=n(t).find(":input").not(":button").filter(function(e,t){return!n(t).closest(".has-conditions").hasClass("ff_excluded")});r.length&&i.validate(r)}}),r.updateSlider(s,a,!0).then(function(){r.handleFocus(a)}).catch(function(e){console.error("An error occurred during the slider update:",e)})}catch(e){if(!(e instanceof window.ffValidationError))throw e;r.updateSlider(l,a,!0).then(function(){r.handleFocus(a)}).catch(function(e){console.error("An error occurred during the slider update:",e)}),i.showErrorMessages(e.messages),i.scrollToFirstError(350)}}}))}},{key:"stepProgressBarHandle",value:function(e){var t=this.$;if(this.$theForm.find(".ff-el-progress").length){var n=e.totalSteps,r=e.activeStep,i=100/n*(r+1),o=this.$theForm.find(".ff-el-progress-title li"),a=this.$theForm.find(".ff-step-header .ff-el-progress-bar"),l=a.find("span"),s=this.$theForm.find(".ff-step-container").first(),c=this.isTabsIndicator(s.data("progress_indicator"));a.css({transition:"width 0.3s ease-in-out",width:i+"%"}),i?a.append(l.text(parseInt(i)+"%")):l.empty();var f=this.fluentFormVars.step_text,u=t(o[r]).text();f=c?parseInt(i)+"% "+this.fluentFormVars.step_completed_text:f.replace("%activeStep%",r+1).replace("%totalStep%",n).replace("%stepTitle%",u),this.$theForm.find(".ff-el-progress-status").text(f).attr("aria-live","polite"),o.css("display","none"),t(o[r]).css("display","inline")}}},{key:"isStepAllFieldsHidden",value:function(e){return this.$,e.find(".ff-el-group").not(".ff-custom_html").length,!1}},{key:"animateProgressToStep",value:function(e,t,n){this.$;var r=this.$theForm.find(".ff-step-header .ff-el-progress-bar");if(!r.length||!t)return Promise.resolve();var i=100/t*(e+1);return n&&n>0?r.css({transition:"width ".concat(n,"ms ease-in-out")}):r.css({transition:"none"}),r[0]&&r[0].offsetHeight,r.css("width",i+"%"),new Promise(function(e){var t=!1,i=setTimeout(function(){t||(t=!0,e())},(n||0)+120);r.one("transitionend webkitTransitionEnd oTransitionEnd",function(){t||(t=!0,clearTimeout(i),e())})})}},{key:"registerStepNavigators",value:function(e){var t=this.$,n=this;this.handleFocus(e),t(this.formSelector).on("click",".fluentform-step .step-nav button, .fluentform-step .step-nav img",function(r){var i=t(this).data("action"),o="next",a=t(this).closest(".fluentform-step"),l=n.getFormInstance();if("next"===i){try{var s=a.find(":input").not(":button").filter(function(e,n){return!t(n).closest(".has-conditions").hasClass("ff_excluded")});s.length&&l.validate(s),n.activeStep++}catch(r){if(!(r instanceof window.ffValidationError))throw r;return l.showErrorMessages(r.messages),void l.scrollToFirstError(350)}n.$theForm.trigger("ff_to_next_page",n.activeStep),t(document).trigger("ff_to_next_page",{step:n.activeStep,form:n.$theForm});var c=n.$theForm.find(".fluentform-step");n.$theForm.trigger("ff_render_dynamic_smartcodes",t(c[n.activeStep]))}else n.activeStep--,o="prev",n.$theForm.trigger("ff_to_prev_page",n.activeStep),t(document).trigger("ff_to_prev_page",{step:n.activeStep,form:n.$theForm});var f="yes"!=n.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");n.updateSlider(n.activeStep,e,f,o).then(function(){n.handleFocus(e)}).catch(function(e){console.error("An error occurred during the slider update:",e)})})}},{key:"updateSlider",value:function(e,t){var n=this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"next",o=this.$,a=this;return new Promise(function(l){o("div"+n.formSelector+"_errors").empty(),n.activeStep=e;var s=n.$theForm.find(".ff-step-titles li"),c=n.$theForm.find(".fluentform-step"),f=c.length;if(!window.ff_disable_auto_step&&f){var u=a.$theForm.find(".fluentform-step").index(a.$theForm.find(".fluentform-step.active"));if("prev"===i||u>-1&&n.activeStep<u)for(;n.activeStep>0&&n.isStepAllFieldsHidden(o(c[n.activeStep]));)n.activeStep--;else for(;n.activeStep<f-1&&n.isStepAllFieldsHidden(o(c[n.activeStep]));)n.activeStep++}c.css("display","none").removeClass("active").attr("aria-hidden","true"),o(c[n.activeStep]).css("display","block").addClass("active").attr("aria-hidden","false"),n.syncStepTitleState(s,n.activeStep);var d=o(c[n.activeStep]).closest(".ff-step-container").data("animation_type"),p=o(c[n.activeStep]).closest(".ff-step-container"),m=o(c[n.activeStep]).closest(".ff-step-body"),h=n.isTabsIndicator(p.data("progress_indicator"));h&&m.css("overflow","hidden");var v=o(c[n.activeStep]);v.find(".step-nav button, .step-nav img").css("visibility","hidden");var g,y=f;g="none"===d?0===t?0:t<50?50:t<200?t:window.ffTransitionTimeOut||500:t;var _,b=n.animateProgressToStep(n.activeStep,y,g);switch(d){case"slide":v.css({display:"block",position:"relative",left:n.isRtl?"-100%":"100%",opacity:0,transition:"all ".concat(t,"ms cubic-bezier(0.25, 0.1, 0.25, 1.0)")}),v[0].offsetHeight,v.css({left:"0%",opacity:1}),_=new Promise(function(e){return setTimeout(function(){v.css({position:"",left:"",transition:""}),e()},t+50)});break;case"fade":v.css({display:"block",opacity:0,transition:"opacity ".concat(t,"ms ease-in-out")}),v[0].offsetHeight,v.css("opacity",1),_=new Promise(function(e){return setTimeout(function(){v.css("transition",""),e()},t+50)});break;case"slide_down":v.css({display:"block",opacity:0,maxHeight:"0",overflow:"hidden",transition:"all ".concat(t,"ms cubic-bezier(0.25, 0.1, 0.25, 1.0)")}),v[0].offsetHeight;var w=v[0].scrollHeight;v.css({maxHeight:w+"px",opacity:1}),_=new Promise(function(e){return setTimeout(function(){v.css({maxHeight:"",overflow:"",transition:""}),e()},t+50)});break;default:var x,S=window.ffTransitionTimeOut||500;x=t<50&&t>0?50:t<S?t:S,_=new Promise(function(e){return setTimeout(e,x)})}Promise.all([_,b]).then(function(){r&&function(){if(!window.ff_disable_step_scroll){var e,t,n,r,i,l,s=a.$theForm.find(".ff_step_start");e=window.ff_scroll_top_offset?window.ff_scroll_top_offset:s.offset().top-100,r=(n=(t=s).offset().top)+t.outerHeight(),l=(i=o(window).scrollTop())+o(window).height(),r>i&&n<l&&!window.ff_force_scroll||o("html, body").animate({scrollTop:e},500,"swing")}}(),function(){h&&m.css("overflow","");var t=0===e&&!r,n=a.$theForm.hasClass("ff_submitting");!a.stepPersistency||a.isPopulatingStepData||t||n||a.saveStepData(a.$theForm,a.activeStep).then(function(e){}),a.stepProgressBarHandle({activeStep:a.activeStep,totalSteps:f});var s=a.$theForm.find('button[type="submit"]').not(".ff-btn-save-progress"),u=-1;if(s.length){var d=s[0];c.each(function(e){if(this.contains(d))return u=e,!1})}var p=c.index(a.$theForm.find(".fluentform-step.active")),v=u>=0&&p>=u;if(!v&&h){var g=a.$theForm.find(".ff-step-titles--clickable li").length;g>0&&p>=g-1&&(v=!0)}if(s.css("visibility",v?"visible":"hidden"),!window.ff_disable_auto_step){a.$theForm.find(".fluentform-step.active");var y=a.$theForm.find(".fluentform-step.active > .step-nav").length,_=a.$theForm.find(".fluentform-step.active > div").length-y,b=a.$theForm.find(".fluentform-step.active > .ff_excluded").length;if(a.$theForm.find(".fluentform-step.active > .ff-t-container").length&&(_-=a.$theForm.find(".fluentform-step.active > .ff-t-container").length,_+=a.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > div").length,b+=a.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > .ff_excluded").length,a.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length&&(b-=a.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length,b-=a.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > .ff_excluded").length,b+=a.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > div").length)),_===b){var w="prev"===i?a.activeStep-1:a.activeStep+1;if(w>=0&&w<f){var x="none"===o(c[w]).closest(".ff-step-container").data("animation_type")?50:100;return void a.updateSlider(w,x,r,i).then(function(){l()}).catch(function(e){console.error("An error occurred during step skip:",e),l()})}}}a.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="next"]').css("visibility","visible"),a.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="prev"]').css("visibility","visible"),a.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="next"]').css("visibility","visible"),a.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="prev"]').css("visibility","visible"),l()}()})})}},{key:"handleFocus",value:function(e){var t=this.$,n=this,r=!1,i=function(r){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o="yes"!=n.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");if(!n.isInitialLoad){var a;if(o){if(!window.ff_disable_step_scroll){var l=r.find("input, .ff-custom_html, select, textarea, button, a").filter(":visible");l.length&&i&&setTimeout(function(){l.first().focus()},e+50)}}else null!==(a=window.fluentFormVars)&&void 0!==a&&a.step_change_focus&&!window.ff_disable_step_scroll&&setTimeout(function(){t("".concat(n.formSelector," .fluentform-step.active")).attr("tabindex","-1").focus().removeAttr("tabindex")},e);n.isInitialLoad=!1}};n.$theForm.off("keydown.stepNavigation").on("keydown.stepNavigation",function(e){if(!r&&(" "===e.key||32===e.keyCode)){var i=t("".concat(n.formSelector," .fluentform-step.active .ff-btn-next")),o=t("".concat(n.formSelector," .fluentform-step.active .ff-btn-prev"));return document.activeElement===i[0]?(e.preventDefault(),void i.click()):document.activeElement===o[0]?(e.preventDefault(),void o.click()):void 0}}),this.$theForm.on("ff_to_next_page ff_to_prev_page",function(){r=!0,setTimeout(function(){r=!1,i(n.$theForm.find(".fluentform-step.active"),!0)},e+50)}),"yes"!==this.$theForm.find(".ff-step-container").attr("data-disable_auto_focus")&&0!==n.$theForm.find(".fluentform-step").index(n.$theForm.find(".fluentform-step.active"))&&!this.isInitialLoad&&i(t("".concat(this.formSelector," .fluentform-step.active")),!0),this.isInitialLoad=!1}},{key:"saveStepData",value:function(e,t){var n,r=this.$,i=e.find(":input").filter(function(e,t){return!r(t).closest(".has-conditions").hasClass("ff_excluded")});i.filter(function(e,t){var n=r(t);return n.parents().hasClass("ff_repeater_table")&&"select"==n.attr("type")&&!n.val()}).prepend("<option selected disabled />");var o=i.serialize();r.each(e.find("[type=file]"),function(e,t){var n={},i=t.name+"[]";n[i]=[],r(t).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each(function(e,t){n[i][e]=r(this).data("src")}),r.each(n,function(e,t){if(t.length){var n={};n[e]=t,o+="&"+r.param(n)}})});var a={active_step:t,data:o,form_id:e.data("form_id"),action:"fluentform_step_form_save_data",nonce:null===(n=this.fluentFormVars)||void 0===n?void 0:n.nonce};return r.post(this.fluentFormVars.ajaxUrl,a)}},{key:"maybeAutoSlider",value:function(){var e=this.$;if("yes"==this.$theForm.find(".ff-step-container").attr("data-enable_auto_slider")){var t=function(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||500;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")};this.$theForm.find(".ff-el-form-check-radio,.ff-el-net-label, .ff-el-ratings label").on("click",function(){t(e(this))}),this.$theForm.find("select").on("change",function(){t(e(this))})}}},{key:"addFilesToElement",value:function(e,t){var n=this.$,r=this,i=e.closest(".ff-el-input--content").find(".ff-uploaded-list");n.each(t,function(e,t){t="object"===Xe(t)?t:{url:t,data_src:t};var o=n("<div/>",{class:"ff-upload-preview","data-src":t.data_src,style:"border: 1px solid rgb(111, 117, 125)"}),a=n("<div/>",{class:"ff-upload-thumb"});a.append(n("<div/>",{class:"ff-upload-preview-img",style:"background-image: url('".concat(r.getThumbnail(t.url),"');")}));var l=n("<div/>",{class:"ff-upload-details"}),s=n("<span/>",{html:r.fluentFormVars.upload_completed_txt,class:"ff-upload-progress-inline-text ff-inline-block"}),c=t.url.substring(t.url.lastIndexOf("/")+1);c.includes("-ff-")&&(c=c.substring(c.lastIndexOf("-ff-")+4));var f=n("<div/>",{class:"ff-upload-filename",html:c}),u=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 '),d=n("<span/>",{"data-href":"#",html:"×",class:"ff-upload-remove"}),p=n("<div>",{class:"ff-upload-filesize ff-inline-block",html:""}),m=n("<div>",{class:"ff-upload-error",style:"color:red;"});l.append(f,u,s,p,m,d),o.append(a,l),i.append(o)}),e.trigger("change_remaining",-t.length),e.trigger("change")}},{key:"getThumbnail",value:function(e){if(!e)return"";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()}}],t&&Je(e.prototype,t),n&&Je(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function et(e){return et="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},et(e)}function tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=et(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=et(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==et(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rt,it,ot=[{type:8,token:"round",show:"round",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t||0===t||(t=2),e=parseFloat(e).toFixed(t),parseFloat(e)}},{type:0,token:"ceil",show:"ceil",value:function(e){return Math.ceil(e)}},{type:0,token:"floor",show:"floor",value:function(e){return Math.floor(e)}},{type:0,token:"abs",show:"abs",value:function(e){return Math.abs(e)}},{type:8,token:"max",show:"max",value:function(e,t){return e>t?e:t}},{type:8,token:"min",show:"min",value:function(e,t){return e<t?e:t}}];function at(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tt(Object(n),!0).forEach(function(t){nt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({calculation_error:"Calculation error occurred",invalid_formula:"Invalid formula provided",division_by_zero:"Division by zero error"},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r=t.find(".ff_has_formula");if(r.length){var i={},o={};mexp.addToken(ot);var a=function(){jQuery.each(r,function(r,i){var o=jQuery(i),a=o.data("calculation_formula"),s=function(e,t){for(var n,r=[],i=RegExp(e,"g");n=i.exec(t);)delete n.input,r.push(n);return r}(/{(.*?)}/g,a),p={};jQuery.each(s,function(e,n){var r=n[0];jQuery.each(["{input.","{select.","{checkbox.","{radio.","{repeat.","{payment."],function(e,n){if(function(e,t){return-1!==e.indexOf(t)}(r,n)){var i=(s=r,m=new RegExp(n+"|}","g"),s.replace(m,"")),o=0;if("{select."===n)o=u(i);else if("{checkbox."===n)o=d(i);else if("{radio."===n)o=f(i);else if("{repeat."===n)o=c(i);else if("{payment."===n)o=function(e){var n=0,r=t.find(":input[data-name="+e+"]");if(r.length&&l(r)){var i=r[0].type;"radio"===i?n=f(e,!0):"hidden"===i?n=r.attr("data-payment_value"):"number"===i||"text"===i?n=window.ff_helper.numericVal(r):"checkbox"===i?n=d(e,!0):"select-one"===i&&(n=u(e,!0))}return n}(i);else{var a=t.find("input[name="+i+"]");l(a)&&(o=window.ff_helper.numericVal(a))}return p[r]=o,!1}var s,m})}),jQuery.each(p,function(e,t){t||(t=0),a=a.split(e).join(t)});var m="";try{a=a.replace(/\n/g,""),(m=mexp.eval(a))===1/0||m===-1/0?(console.log(n.division_by_zero,i),m=""):isNaN(m)&&(console.log(n.invalid_formula,i),m="")}catch(e){console.log(n.calculation_error+":",e,i),m=""}if("text"==o[0].type){var h=e(o),v=h.val(),g=window.ff_helper.formatCurrency(h,m);if(h.val(g).prop("defaultValue",g),""==v)return;v!=g&&h.trigger("change")}else o.text(m)})};t.find("input[type=number],input[data-calc_value],select[data-calc_value],.ff_numeric,.ff_payment_item").on("change keyup",a),a(),t.on("do_calculation",function(){a()}),jQuery(document).on("fluentform_reset",function(){r.val("").prop("defaultValue",""),setTimeout(function(){a()},100)})}function l(e){return!e.closest(".ff_excluded.has-conditions").length}function s(n){var r=0,i=t.find(n);return i.closest(".ff_excluded.has-conditions").length||e.each(i,function(t,n){var i=e(n).attr("data-calc_value");i&&!isNaN(i)&&(r+=Number(i))}),r}function c(n){var r=0,s=n.split("."),c=!1;s.length>1&&(n=s[0],c=s[1]);var f=t.find("table[data-root_name="+n+"]");if(i[n]||(i[n]=!0,f.on("repeat_change",function(){a()})),l(f))if(c){var u=f.find("tbody tr td:nth-child("+c+")");e.each(u,function(t,i){var l=e(i).find(":input"),s=n+"_"+c+"_"+l.attr("id");o[s]||(o[s]=!0,l.on("change",function(){a()}));var f=0;f="select"===l.attr("type")?parseFloat(l.find("option:selected").attr("data-calc_value")):parseFloat(l.val()),isNaN(f)||(r+=f)}),r&&(r=r.toFixed(2))}else r=f.find("tbody tr").length;return r}function f(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=0,i=t.find("input[name="+e+"]:checked");return n?i.attr("data-payment_value"):(l(i)&&(r=i.attr("data-calc_value")||0),r)}function u(e){var n;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?t.find("select[name="+e+"] option:selected").data("payment_value"):(n=s("select[data-name="+e+"] option:selected"),t.find("select[data-name="+e+"]").attr("data-calc_value",n),n)}function d(e){if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))return s("input[data-name="+e+"]:checked");var n=t.find(":input[data-name="+e+"]").data("group_id"),r=t.find('input[data-group_id="'+n+'"]:checked'),i=0;return r.each(function(e,t){var n=jQuery(t).data("payment_value");n&&(i+=parseFloat(n))}),i}}(rt=jQuery)(document.body).on("fluentform_init",function(r,i,o){if(i.attr("data-form_instance"),o){o.form_id_selector;var a="."+o.form_instance;Ge(rt,i,o,window.fluentFormVars,a),t(i),function(e,t){var n=t.find(".fluentform .js-repeat");e.each(n,function(t,n){var r=e(n);if(r.find(".ff-t-cell").length>1){var i=r.find(".ff-el-group").height()-r.find(".ff-el-group").find(".ff-el-input--content").height();r.find(".js-repeat-buttons").css("margin-top",i+"px")}var o=r.find(".ff-el-group").find(".ff-el-input--content .ff-el-form-control").outerHeight();r.find(".ff-el-repeat-buttons").height(o)})}(rt,i),d(rt,i,o,window.fluentFormVars);var l=function(e){var t="fluentform_calculation_messages_"+e;return window[t]?window[t]:{calculation_error:"Calculation error occurred",invalid_formula:"Invalid formula provided",division_by_zero:"Division by zero error"}}(o.id);if(at(rt,i,l),n(rt,i),e(rt,i),i.hasClass("ff-form-has-steps")){var s=function(e,t,n,r){return new Ze(e,t,n,r).getPublicAPI()}(rt,i,window.fluentFormVars,a);s.init(),i.on("update_slider",function(e,t){s.updateSlider(t.goBackToStep,t.animDuration,t.isScrollTop,t.actionType)})}i.hasClass("ff_has_dynamic_smartcode")&&(i.on("ff_render_dynamic_smartcodes",function(e,t){c(rt(t))}),i.on("keyup change",":input",function(){c(i)}),c(i))}else console.log("No Fluent form JS vars found!");function c(e){jQuery.each(e.find(".ff_dynamic_value"),function(e,t){var n=rt(t).data("ref");if("payment_summary"!=n){var r=i.find('.ff-el-form-control[name="'+n+'"]'),o=" ";r.length||(r=i.find('.ff-field_container[data-name="'+n+'"]').find("input")),r.length||((r=i.find('*[name="'+n+'"]:checked')).length||(r=i.find('*[name="'+n+'[]"]:checked'),o=", "),r.length||(r=i.find('*[name="'+n+'[]"]').find("option:selected"),o=", "));var a=[];if(!r.length){var l=i.find('.ff-el-repeater[data-name="'+n+'"] tbody tr');l.each(function(e){var t=rt(this).find("input, select"),n=[];t.each(function(e){var t=rt(this).val();if(t){var r=rt(this).closest("td").data("label")||"Column-"+(e+1);n.push(r+": "+t)}}),n.length&&a.push("#"+(e+1)+"- "+n.join(" | "))}),l.length&&(o="<br/>")}rt.each(r,function(){var e=rt(this).val(),t=rt(this).closest(".ff-el-group.has-conditions").hasClass("ff_excluded");e&&!t&&a.push(e)});var s,c="";c=a.length?a.join(o):rt(t).data("fallback"),rt(this).html(null==(s=c)?"":("string"!=typeof s&&(s=String(s)),(s=(s=s.replace(/<script[^]*?>[^]*?<\/script>/gi,"").replace(/<iframe[^]*?>[^]*?<\/iframe>/gi,"").replace(/<.*?\bon\w+=["'][^"']*["']/gi,"").replace(/javascript:/gi,"")).replace(/</g,"<").replace(/>/g,">")).replace(/<br\s*\/?>/gi,"<br/>").replace(/\n/g,"<br/>")))}else i.trigger("calculate_payment_summary",{element:rt(t)})})}}),(it=String.prototype).startsWith||(it.startsWith=function(e,t){return t=!t||t<0?0:+t,this.substring(t,t+e.length)===e}),it.endsWith||(it.endsWith=function(e,t){return(void 0===t||t>this.length)&&(t=this.length),this.substring(t-e.length,t)===e}),it.includes||(it.includes=function(e,t){if(e instanceof RegExp)throw TypeError("first argument must not be a RegExp");return void 0===t&&(t=0),-1!==this.indexOf(e,t)})})();
Save File
Cancel