/*! For license information please see form-templates.js.LICENSE.txt */ !function(){var t={616:function(t){t.exports=function(t,e){var r,n,o=0;function a(){var a,i,c=r,l=arguments.length;t:for(;c;){if(c.args.length===arguments.length){for(i=0;i=0),c.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,c.width?parseInt(c.width):0);break;case"e":r=c.precision?parseFloat(r).toExponential(c.precision):parseFloat(r).toExponential();break;case"f":r=c.precision?parseFloat(r).toFixed(c.precision):parseFloat(r);break;case"g":r=c.precision?String(Number(r.toPrecision(c.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=c.precision?r.substring(0,c.precision):r;break;case"t":r=String(!!r),r=c.precision?r.substring(0,c.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=c.precision?r.substring(0,c.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=c.precision?r.substring(0,c.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}o.json.test(c.type)?h+=r:(!o.number.test(c.type)||f&&!c.sign?p="":(p=f?"+":"-",r=r.toString().replace(o.sign,"")),u=c.pad_char?"0"===c.pad_char?"0":c.pad_char.charAt(1):" ",s=c.width-(p+r).length,l=c.width&&s>0?u.repeat(s):"",h+=c.align?p+r+l:"0"===u?p+l+r:l+p+r)}return h}(function(t){if(c[t])return c[t];for(var e,r=t,n=[],a=0;r;){if(null!==(e=o.text.exec(r)))n.push(e[0]);else if(null!==(e=o.modulo.exec(r)))n.push("%");else{if(null===(e=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){a|=1;var i=[],l=e[2],u=[];if(null===(u=o.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(i.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=o.key_access.exec(l)))i.push(u[1]);else{if(null===(u=o.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");i.push(u[1])}e[2]=i}else a|=2;if(3===a)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:e[0],param_no:e[1],keys:e[2],sign:e[3],pad_char:e[4],align:e[5],width:e[6],precision:e[7],type:e[8]})}r=r.substring(e[0].length)}return c[t]=n}(t),arguments)}function i(t,e){return a.apply(null,[t].concat(e||[]))}var c=Object.create(null);e.sprintf=a,e.vsprintf=i,"undefined"!=typeof window&&(window.sprintf=a,window.vsprintf=i,void 0===(n=function(){return{sprintf:a,vsprintf:i}}.call(e,r,e,t))||(t.exports=n))}()}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){"use strict";var t=window.frmGlobal,e=t.url,n=t.nonce,o=t.canAccessApplicationDashboard,a=t.applicationsUrl,i=window.frmFormTemplatesVars,c=i.FEATURED_TEMPLATES_KEYS,l=i.upgradeLink,u="frm-form-templates",s="frm_hidden",f="frm-hide-js",p="frm-current",m={ALL_TEMPLATES:"all-templates",AVAILABLE_TEMPLATES:"available-templates",FREE_TEMPLATES:"free-templates",FAVORITES:"favorites",CUSTOM:"custom",SEARCH:"search"},d="440px",h="550px";function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function g(t){for(var e=1;e":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},w=["(","?"],E={")":["("],":":["?","?:"]},x=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var I={"!":function(t){return!t},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e},"+":function(t,e){return t+e},"-":function(t,e){return t-e},"<":function(t,e){return t":function(t,e){return t>e},">=":function(t,e){return t>=e},"==":function(t,e){return t===e},"!=":function(t,e){return t!==e},"&&":function(t,e){return t&&e},"||":function(t,e){return t||e},"?:":function(t,e,r){if(t)throw e;return r}};var j={contextDelimiter:"",onMissingKey:null};function P(t,e){var r;for(r in this.data=t,this.pluralForms={},this.options={},j)this.options[r]=void 0!==e&&r in e?e[r]:j[r]}function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function F(t){for(var e=1;e=0||b[o]3&&void 0!==arguments[3]?arguments[3]:10,i=t[e];if(D(r)&&N(n))if("function"==typeof o)if("number"==typeof a){var c={callback:o,priority:a,namespace:n};if(i[r]){var l,u=i[r].handlers;for(l=u.length;l>0&&!(a>=u[l-1].priority);l--);l===u.length?u[l]=c:u.splice(l,0,c),i.__current.forEach((function(t){t.name===r&&t.currentIndex>=l&&t.currentIndex++}))}else i[r]={handlers:[c],runs:0};"hookAdded"!==r&&t.doAction("hookAdded",r,n,o,a)}else console.error("If specified, the hook priority must be a number.");else console.error("The hook callback must be a function.")}},G=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(n,o){var a=t[e];if(D(n)&&(r||N(o))){if(!a[n])return 0;var i=0;if(r)i=a[n].handlers.length,a[n]={runs:a[n].runs,handlers:[]};else for(var c=a[n].handlers,l=function(t){c[t].namespace===o&&(c.splice(t,1),i++,a.__current.forEach((function(e){e.name===n&&e.currentIndex>=t&&e.currentIndex--})))},u=c.length-1;u>=0;u--)l(u);return"hookRemoved"!==n&&t.doAction("hookRemoved",n,o),i}}},R=function(t,e){return function(r,n){var o=t[e];return void 0!==n?r in o&&o[r].handlers.some((function(t){return t.namespace===n})):r in o}},z=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(n){var o=t[e];o[n]||(o[n]={handlers:[],runs:0}),o[n].runs++;for(var a=o[n].handlers,i=arguments.length,c=new Array(i>1?i-1:0),l=1;l1&&void 0!==arguments[1]?arguments[1]:"default";n.data[e]=F(F(F({},B),n.data[e]),t),n.data[e][""]=F(F({},B[""]),n.data[e][""])},c=function(t,e){i(t,e),a()},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return n.data[t]||i(void 0,t),n.dcnpgettext(t,e,r,o,a)},u=function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default"},s=function(t,e,n){var o=l(n,e,t);return r?(o=r.applyFilters("i18n.gettext_with_context",o,t,e,n),r.applyFilters("i18n.gettext_with_context_"+u(n),o,t,e,n)):o};if(r){var f=function(t){M.test(t)&&a()};r.addAction("hookAdded","core/i18n",f),r.addAction("hookRemoved","core/i18n",f)}return{getLocaleData:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return n.data[t]},setLocaleData:c,resetLocaleData:function(t,e){n.data={},n.pluralForms={},c(t,e)},subscribe:function(t){return o.add(t),function(){return o.delete(t)}},__:function(t,e){var n=l(e,void 0,t);return r?(n=r.applyFilters("i18n.gettext",n,t,e),r.applyFilters("i18n.gettext_"+u(e),n,t,e)):n},_x:s,_n:function(t,e,n,o){var a=l(o,void 0,t,e,n);return r?(a=r.applyFilters("i18n.ngettext",a,t,e,n,o),r.applyFilters("i18n.ngettext_"+u(o),a,t,e,n,o)):a},_nx:function(t,e,n,o,a){var i=l(a,o,t,e,n);return r?(i=r.applyFilters("i18n.ngettext_with_context",i,t,e,n,o,a),r.applyFilters("i18n.ngettext_with_context_"+u(a),i,t,e,n,o,a)):i},isRTL:function(){return"rtl"===s("ltr","text direction")},hasTranslation:function(t,e,o){var a,i,c=e?e+""+t:t,l=!(null===(a=n.data)||void 0===a||null===(i=a[null!=o?o:"default"])||void 0===i||!i[c]);return r&&(l=r.applyFilters("i18n.has_translation",l,t,e,o),l=r.applyFilters("i18n.has_translation_"+u(o),l,t,e,o)),l}}}(0,0,U)),Z=($.getLocaleData.bind($),$.setLocaleData.bind($),$.resetLocaleData.bind($),$.subscribe.bind($),$.__.bind($)),K=($._x.bind($),$._n.bind($),$._nx.bind($),$.isRTL.bind($),$.hasTranslation.bind($),window.frmDom),J=K.tag,X=K.div,Q=K.a,W=K.img;function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function rt(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:"default";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.elements=e,this.type=r,this.prepareElements()}var e,r;return e=t,r=[{key:"fadeIn",value:function(){var t=this;this.applyStyleToElements((function(e){e.classList.add("frm-fadein-up"),e.addEventListener("animationend",(function(){t.resetOpacity(),e.classList.remove("frm-fadein-up")}),{once:!0})}))}},{key:"cascadeFadeIn",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.03;setTimeout((function(){t.applyStyleToElements((function(t,r){t.classList.remove("frm-animate"),t.style.transitionDelay=(r+1)*e+"s"}))}),200)}},{key:"prepareElements",value:function(){var t=this;this.applyStyleToElements((function(e){"default"===t.type&&(e.style.opacity="0.0"),"cascade"===t.type&&e.classList.add("frm-init-cascade-animation"),"cascade-3d"===t.type&&e.classList.add("frm-init-fadein-3d"),e.classList.add("frm-animate")}))}},{key:"resetOpacity",value:function(){this.applyStyleToElements((function(t){return t.style.opacity="1.0"}))}},{key:"applyStyleToElements",value:function(t){this.elements instanceof Element?t(this.elements,0):0()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(t)},Nt=function(t){return t instanceof HTMLElement||console.warn("Invalid argument: Element must be an instance of HTMLElement")||!1},Dt=function(t,e,r,n){var o=document.querySelector(t),a=document.querySelector(e);if(o&&a){if(n){var i=a.querySelector('span[frm-error="'.concat(r,'"]'));i&&(i.textContent=n)}a.setAttribute("frm-error",r),kt(a),o.addEventListener("keyup",(function(){It(a)}),{once:!0})}else console.warn("showFormError: Unable to find input or error element.")},qt=new URL(window.location.href),Gt=qt.searchParams,Rt=function(t){return Gt.has(t)},zt=window.frmDom.util.onClickPreventDefault,Ht=function(t){return m.CUSTOM===t},Vt=function(t){return!!Nt(t)&&t.classList.contains("".concat(u,"-favorite-item"))},Yt=function(t){return!!Nt(t)&&t.classList.contains("".concat(u,"-custom-item"))};function Ut(t){return Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ut(t)}function $t(){$t=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),c=new I(n||[]);return o(i,"_invoke",{value:L(t,r,c)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",m="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(j([])));x&&x!==r&&n.call(x,i)&&(w=x);var S=b.prototype=v.prototype=Object.create(w);function T(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,i,c){var l=f(t[o],t,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Ut(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function L(e,r,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=A(c,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?h:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function A(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,A(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function j(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(l&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Zt(t,e,r,n,o,a,i){try{var c=t[a](i),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}function Kt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){Zt(a,n,o,i,c,"next",t)}function c(t){Zt(a,n,o,i,c,"throw",t)}i(void 0)}))}}var Jt=null;function Xt(){return(Xt=Kt($t().mark((function t(){var e,r,n;return $t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=window.frmAdminBuild,r=e.initModal,n=e.offsetModalY,(Jt=r("#frm-form-templates-modal",d))&&n(Jt,"103px"),Rt("free-templates")&&(lt().leaveEmailModal&&Ve()),Wt(),wp.hooks.addAction("frmAdmin.beforeOpenConfirmModal","frmFormTemplates",(function(t){var e=t.$info;e.dialog("option","width",h),n(e,"103px")}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Qt(){return Jt}function Wt(){return te.apply(this,arguments)}function te(){return te=Kt($t().mark((function t(){var e,r,n,o,a,i,c,l,u;return $t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=lt(),r=e.leaveEmailModalApiEmailForm){t.next=3;break}return t.abrupt("return");case 3:return n=r.getAttribute("data-url"),t.prev=4,t.next=7,fetch(n);case 7:return a=t.sent,t.next=10,a.json();case 10:o=t.sent,t.next=17;break;case 13:return t.prev=13,t.t0=t.catch(4),console.error("An error occurred:",t.t0),t.abrupt("return");case 17:if(o.renderedHtml){t.next=20;break}return console.warn("renderedHtml is not available."),t.abrupt("return");case 20:i=o.renderedHtml,c=/]*(formidableforms.css|action=frmpro_css)[^>]*>/gi,i=i.replace(c,""),r.innerHTML=i,l=r.querySelector("form"),u=l.querySelector('[type="email"]:not(.frm_verify)'),ut({leaveEmailModalHiddenForm:l,leaveEmailModalHiddenInput:u});case 27:case"end":return t.stop()}}),t,null,[[4,13]])}))),te.apply(this,arguments)}function ee(t){var e=lt().pageTitleText,r=t||Tt("selectedCategoryEl").querySelector(".frm-form-templates-cat-text").textContent;e.textContent=r}var re={},ne=function(t){var e=t.currentTarget,r=e.getAttribute("data-category"),n=xt(),o=n.selectedCategory,a=n.selectedCategoryEl,i=n.notEmptySearchText;if(o!==r){o=wp.hooks.applyFilters("frmFormTemplates.selectedCategory",r),a.classList.remove(p),(a=e).classList.add(p),St({selectedCategory:o,selectedCategoryEl:a}),i&&de(),function(t){var e=lt(),r=e.bodyContentChildren,n=e.pageTitle,o=e.showCreateTemplateModalButton,a=e.templatesList,i=e.templateItems;switch(m.ALL_TEMPLATES!==t&&Ot(r),ee(),It(o),kt(n),t){case m.ALL_TEMPLATES:!function(){var t=lt(),e=t.bodyContentChildren,r=t.pageTitleDivider,n=t.templateItems,o=t.twinFeaturedTemplateItems,a=t.customTemplatesSection,i=t.emptyState,c=t.applicationTemplates;At([].concat(Pe(e),Pe(n))),Ot([r].concat(Pe(o),[a,i,c]))}();break;case m.AVAILABLE_TEMPLATES:!function(){if(0!==xt().availableTemplatesCount){var t=lt(),e=t.templatesList,r=t.templateItems,n=t.availableTemplateItems;Ot(r),At([e].concat(Pe(n)))}else!function(){var t=lt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",m.AVAILABLE_TEMPLATES);var o=lt(),a=o.emptyStateTitle,i=o.emptyStateText,c=xt().extraTemplatesCount;a.textContent=Z("No Templates Available","formidable"),i.textContent=function(t){try{for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n0&&s.push(n),t.custom>0){var p=Array.from(l).filter((function(t){return!Vt(t)}));Ot(p),s.push(a),s.push(c),0===t.default?It(i):s.push(i)}At(s)}else Fe()}();break;case m.CUSTOM:!function(){if(0!==xt().customCount){var t=lt(),e=t.showCreateTemplateModalButton,r=t.pageTitleDivider,n=t.customTemplatesSection,o=t.customTemplatesList,a=t.customTemplatesTitle,i=t.customTemplateItems;It(a),At([e,r,n,o].concat(Pe(i)))}else!function(){var t=lt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",m.CUSTOM);var o=lt(),a=o.emptyStateTitle,i=o.emptyStateText;a.textContent=Z("You currently have no templates.","formidable"),i.textContent=Z("You haven't created any form templates. Begin now to simplify your workflow and save time.","formidable"),n.textContent=Z("Create Template","formidable"),It(e),At([r,n])}()}();break;default:Ot(i),At([a].concat(Pe(re[t])))}}(o);var c=lt().bodyContent;new Ft(c).fadeIn()}};function oe(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),ne(t))}var ae=function(){var t=lt(),e=t.createFormButton,r=t.newTemplateForm,n=t.newTemplateNameInput,o=t.newTemplateActionInput,a=window.frmAdminBuild.installNewForm;n.value="",o.value="frm_install_form",a(r,"frm_install_form",e)},ie=".".concat(u,"-item-favorite-button"),ce="".concat(ie," use"),le="#frm_heart_solid_icon",ue="#frm_heart_icon",se=function(t){var e,r=t.currentTarget,n=lt(),o=n.templatesList,a=n.featuredTemplatesList,i=n.favoritesCategoryCountEl,l=n.customTemplatesTitle,s=r.closest(".frm-card-item"),f=s.dataset.id,p=Vt(s),d=Yt(s),h=function(t){return!!Nt(t)&&c.includes(Number(t.dataset.id))}(s),y=null;if(s.classList.toggle("".concat(u,"-favorite-item"),!p),h){var v=s.closest("#".concat(u,"-list"))?a:o;v&&(y=v.querySelector('.frm-card-item[data-id="'.concat(f,'"]'))).classList.toggle("".concat(u,"-favorite-item"),!p)}var g,b,w=xt(),E=w.selectedCategory,x=w.favoritesCount,S=p?"remove":"add",T=s.querySelector(ce),_=null===(e=y)||void 0===e?void 0:e.querySelector(ce);"add"===S?(++x.total,d?++x.custom:++x.default,T.setAttribute("xlink:href",le),null==_||_.setAttribute("xlink:href",le)):(--x.total,d?--x.custom:--x.default,T.setAttribute("xlink:href",ue),null==_||_.setAttribute("xlink:href",ue)),i.textContent=x.total,_t("favoritesCount",x),g=E,m.FAVORITES===g&&(0===x.total&&Fe(),It(s),0===x.default&&It(o),0!==x.custom&&0!==x.default||It(l)),b=function(){return t=f,e=S,r=d,n=new FormData,o=frmDom.ajax.doJsonPost,n.append("template_id",t),n.append("operation",e),n.append("is_custom_template",r),o("add_or_remove_favorite_template",n);var t,e,r,n,o},Bt=Bt.then(b).catch(b)},fe=function(t){var e=t.currentTarget,r=e.closest(".frm-card-item"),n=function(t){return!!Nt(t)&&t.classList.contains("".concat(u,"-locked-item"))}(r),o=Yt(r);if(n||!o)if(t.preventDefault(),_t("selectedTemplate",r),n)!function(t){var e=t.dataset.requiredPlan;switch(e){case"basic":case"plus":case"business":case"elite":ze(e,t);break;case"renew":He();break;case"free":Ve()}}(r);else{var a=lt(),i=a.newTemplateForm,c=a.newTemplateNameInput,l=a.newTemplateDescriptionInput,s=a.newTemplateLinkInput,f=a.newTemplateActionInput,p=window.frmAdminBuild.installNewForm,m=r.querySelector(".frm-form-template-name").textContent.trim(),d=r.querySelector(".frm-form-templates-item-description").textContent.trim(),h="frm_install_template";c.value=m,l.value=d,f.value=h,s.value=e.href,p(i,h,e)}},pe=window.frmDom.search.init;function me(t,e){var r=t.foundSomething,n=t.notEmptySearchText;if(!e||"search"!==e.type||""!==e.target.value){var o=xt(),a=lt().allTemplatesCategory;_t("notEmptySearchText",n),o.notEmptySearchText||o.selectedCategory?(o.selectedCategory&&(function(t){var e=lt(),r=e.bodyContent,n=e.bodyContentChildren,o=e.pageTitle,a=e.templatesList,i=e.applicationTemplates,c=new Ft(r);t&&Tt("selectedCategoryEl").classList.remove(p),Ot(n),ee(Z("Search Result","formidable")),At([o,a,i]),c.fadeIn()}(n),n&&_t("selectedCategory","")),function(t){if(t){var e,r=lt().emptyState;if(e=r,"none"!==window.getComputedStyle(e).getPropertyValue("display")){var n=lt().pageTitle;It(r),kt(n)}var o=lt(),a=o.templatesList,i=o.applicationTemplates,c=o.applicationTemplatesTitle,l=o.applicationTemplatesList;At([a,i,c]),0===a.offsetHeight&&Ot([a,c]),0===(null==l?void 0:l.offsetHeight)&&It(i)}else!function(){var t,e=xt().notEmptySearchText,r=lt(),n=r.pageTitle,o=r.emptyState,a=r.emptyStateButton,i=r.applicationTemplates;if(m.SEARCH!==(null===(t=o.dataset)||void 0===t?void 0:t.view)){o.setAttribute("data-view",m.SEARCH);var c=lt(),l=c.emptyStateTitle,u=c.emptyStateText;l.textContent=Z("No templates found","formidable"),u.textContent=Z("Sorry, we didn't find any templates that match your criteria.","formidable"),a.textContent=Z("Start from Scratch","formidable"),Ot([n,i]),At([o,a])}else e?(kt(o),Ot([n,i])):(It(o),o.removeAttribute("data-view"))}()}(r)):a.dispatchEvent(new Event("click",{bubbles:!0}))}}function de(){var t=lt().searchInput;t.value="",t.dispatchEvent(new Event("input",{bubbles:!0}))}var he=function(){var t=xt().selectedCategory;Ht(t)||(_t("selectedCategory",""),de(),lt().searchInput.focus())},ye=function(){var t=xt().selectedCategory;Ht(t)&&Ue()},ve=function(){var t=lt().createTemplateFormsDropdown,e=t.value;if(e&&"no-forms"!==e){ge(!1);var r=t.options[t.selectedIndex],n=r.dataset.description.trim(),o=r.dataset.name.trim(),a=" ".concat(Z("Template","formidable"));o.endsWith(a)||(o+=a);var i=lt(),c=i.createTemplateName,l=i.createTemplateDescription;c.value=o,l.value=n}else ge(!0)},ge=function(t){var e=lt(),r=e.createTemplateName,n=e.createTemplateDescription,o=e.createTemplateButton;[r,n].forEach((function(e){e.disabled=t,t&&(e.value="")})),o.classList.toggle("disabled",t)},be=function(){var t=window.frmAdminBuild.installNewForm,e="frm_create_template",r=lt(),n=r.newTemplateForm,o=r.newTemplateActionInput,a=r.newTemplateNameInput,i=r.newTemplateDescriptionInput,c=r.newTemplateLinkInput,l=r.createTemplateName,u=r.createTemplateDescription,s=r.createTemplateFormsDropdown,f=r.createTemplateButton;o.value=e,a.value=l.value.trim(),i.value=u.value.trim(),c.value=s.value,t(n,e,f)};function we(t){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},we(t)}function Ee(){Ee=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),c=new I(n||[]);return o(i,"_invoke",{value:L(t,r,c)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",m="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(j([])));x&&x!==r&&n.call(x,i)&&(w=x);var S=b.prototype=v.prototype=Object.create(w);function T(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,i,c){var l=f(t[o],t,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==we(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function L(e,r,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=A(c,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?h:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function A(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,A(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function j(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(l&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function xe(t,e,r,n,o,a,i){try{var c=t[a](i),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}var Se=function(){var t,e=(t=Ee().mark((function t(){var e,r,n,o,a,i,c,l,u,s,f,p,m;return Ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=lt(),n=r.leaveEmailModalInput,o=n.value.trim()){t.next=5;break}return $e("empty"),t.abrupt("return");case 5:if(Mt(o)){t.next=8;break}return $e("invalid"),t.abrupt("return");case 8:if(a=lt(),i=a.leaveEmailModalHiddenForm,c=a.leaveEmailModalHiddenInput,i){t.next=11;break}return t.abrupt("return");case 11:return c.value=o,(l=new FormData(i)).append("action","frm_forms_preview"),t.prev=14,t.next=17,fetch(i.getAttribute("action"),{method:"POST",body:l});case 17:return s=t.sent,t.next=20,s.text();case 20:f=t.sent,p=new DOMParser,u=p.parseFromString(f,"text/html"),t.next=29;break;case 25:return t.prev=25,t.t0=t.catch(14),console.error("An error occurred:",t.t0),t.abrupt("return");case 29:(m=null===(e=u.querySelector(".frm_message"))||void 0===e?void 0:e.textContent.trim())&&m.indexOf("Thanks!")>=0?Ye():$e("invalid");case 31:case"end":return t.stop()}}),t,null,[[14,25]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){xe(a,n,o,i,c,"next",t)}function c(t){xe(a,n,o,i,c,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();function Te(t){return Te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Te(t)}function _e(){_e=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),c=new I(n||[]);return o(i,"_invoke",{value:L(t,r,c)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",m="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(j([])));x&&x!==r&&n.call(x,i)&&(w=x);var S=b.prototype=v.prototype=Object.create(w);function T(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,i,c){var l=f(t[o],t,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Te(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function L(e,r,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=A(c,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?h:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function A(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,A(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function j(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(l&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Le(t,e,r,n,o,a,i){try{var c=t[a](i),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}var Ae=function(){var t,e=(t=_e().mark((function t(){var e,r,o,a,i,c,l,s,f,p,m,d;return _e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=lt(),r=e.codeFromEmailModalInput,o=r.value.trim()){t.next=5;break}return Ze("empty"),t.abrupt("return");case 5:return a=xt(),i=a.selectedTemplate,(c=new FormData).append("action","template_api_signup"),c.append("nonce",n),c.append("code",o),c.append("key",i.dataset.key),t.prev=11,t.next=14,fetch(ajaxurl,{method:"POST",body:c});case 14:return s=t.sent,t.next=17,s.json();case 17:l=t.sent,t.next=24;break;case 20:return t.prev=20,t.t0=t.catch(11),console.error("An error occurred:",t.t0),t.abrupt("return");case 24:if(l.success){t.next=30;break}return p=(null===(f=l)||void 0===f||null===(f=f.data)||void 0===f?void 0:f[0])||{},m=p.message,Ze(m?"custom":"invalid",m),kt(document.getElementById("frm_code_from_email_options")),t.abrupt("return");case 30:if(!Rt("free-templates")){t.next=33;break}return window.location.href=("free-templates",Gt.delete("free-templates"),qt.search=Gt.toString(),qt.toString()),t.abrupt("return");case 33:if(l.data&&l.data.url){t.next=35;break}return t.abrupt("return");case 35:i.classList.remove("".concat(u,"-locked-item")),(d=i.querySelector(".frm-form-templates-use-template-button")).setAttribute("href",l.data.url),d.dispatchEvent(new Event("click",{bubbles:!0}));case 39:case"end":return t.stop()}}),t,null,[[11,20]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){Le(a,n,o,i,c,"next",t)}function c(t){Le(a,n,o,i,c,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}(),Oe=function(){var t=lt(),e=t.leaveEmailModal,r=t.codeFromEmailModal;It(r),kt(e)},ke=function(){var t=lt(),e=t.codeFromEmailModalInput,r=t.leaveEmailModalGetCodeButton;e.value="",Ot(document.querySelectorAll("#frm_code_from_email_options, #frm_code_from_email_error")),r.dispatchEvent(new Event("click",{bubbles:!0}))},Ie=function(t){if(!t.target.closest("a")){var e=t.currentTarget;window.location.href=e.dataset.href}};function je(t){var e,r;(function(t){if(t&&t.length){var e=t.map((function(t){return function(t){var e=t.name,r=t.key,n=t.hasLiteThumbnail?"".concat(vt,"/").concat(r,".png"):"".concat(vt,"/placeholder.svg");return pt("li",{className:"frm-card-item",data:{href:"".concat(a,"&triggerViewApplicationModal=1&template=").concat(r),"frm-search-text":e.toLowerCase()},children:[mt({className:"".concat(u,"-item-icon"),child:yt({src:n})}),mt({className:"".concat(u,"-item-body"),children:[dt({text:Z("Ready Made Solution","formidable"),className:"frm-meta-tag frm-orange-tag frm-text-xs"}),pt("h3",{text:e,className:"frm-text-sm frm-font-medium frm-m-0"}),ht({text:Z("See all applications","formidable"),className:"frm-text-xs frm-font-semibold",href:a})]})]})}(t)}));st=mt({id:"".concat(u,"-applications"),className:s,children:[pt("h2",{text:Z("Application Templates"),className:"frm-text-sm frm-mb-sm"}),pt("ul",{className:"".concat(u,"-list ").concat(u,"-grid-layout"),children:e})]})}})(t.templates),(e=lt()).applicationTemplates||void 0===st||(e.bodyContent.appendChild(st),ut({applicationTemplates:st,applicationTemplatesTitle:st.querySelector("h2"),applicationTemplatesList:st.querySelector(".".concat(u,"-list")),applicationTemplateItems:st.querySelectorAll(".frm-card-item")})),void 0!==(r=lt().applicationTemplateItems)&&r.forEach((function(t){t.addEventListener("click",Ie)}))}function Pe(t){return function(t){if(Array.isArray(t))return Ce(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ce(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ce(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(l&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Ne(t,e,r,n,o,a,i){try{var c=t[a](i),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}function De(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){Ne(a,n,o,i,c,"next",t)}function c(t){Ne(a,n,o,i,c,"throw",t)}i(void 0)}))}}var qe,Ge=function(t){return De(Me().mark((function e(){var r,n,o,a,i,c,l=arguments;return Me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Qt()){e.next=3;break}return e.abrupt("return");case 3:for(n=lt(),o=n.modalItems,Ot(o),r.dialog("option","width",d),a=l.length,i=new Array(a),c=0;c use").setAttribute("xlink:href",n?"#frm_checkmark_icon":"#frm_close_icon")}));var u=e.dataset.slug?"-".concat(e.dataset.slug):"";c.href=l+u,kt(o)})),He=Ge((function(){var t=lt().renewAccountModal;kt(t)})),Ve=Ge((function(){var t=lt().leaveEmailModal;kt(t)})),Ye=Ge((function(){var t=lt().codeFromEmailModal;kt(t)})),Ue=Ge((function(){Qt().dialog("option","width",h);var t=lt().createTemplateModal;kt(t)})),$e=function(t){Dt("#frm_leave_email","#frm_leave_email_error",t)},Ze=function(t,e){Dt("#frm_code_from_email","#frm_code_from_email_error",t,e)},Ke=function(){var t,e,r,n,a,i,c,l;ct(),Et(),o&&(0,frmDom.ajax.doJsonFetch)("get_applications_data&view=templates").then(je),function(){var t=lt(),e=t.sidebar,r=t.searchInput,n=t.bodyContent,o=t.twinFeaturedTemplateItems,a=t.availableTemplatesCategory,i=t.freeTemplatesCategory,c=new Ft(n);if(r.value="",Ot(o),a){var l=xt().availableTemplatesCount;a.querySelector(".frm-form-templates-cat-count").textContent=l}var u=xt().freeTemplatesCount;i.querySelector(".frm-form-templates-cat-count").textContent=u,0===u&&It(i);var s,p=lt().extraTemplateCountElements,m=xt().extraTemplatesCount;p.forEach((function(t){return t.textContent=m})),n.classList.remove(f),e.classList.remove(f),c.fadeIn(),kt(e),Rt("return_page")&&(s=lt().headerCancelButton,new Ft(s).fadeIn())}(),function(){Xt.apply(this,arguments)}(),lt().templateItems.forEach((function(t){t.getAttribute("data-categories").split(",").forEach((function(e){re[e]||(re[e]=[]),re[e].push(t)}))})),document.querySelectorAll(".".concat(u,"-cat-item")).forEach((function(t){zt(t,ne),t.addEventListener("keydown",oe)})),l=lt().createFormButton,zt(l,ae),document.querySelectorAll(ie).forEach((function(t){return zt(t,se)})),document.querySelectorAll(".".concat(u,"-use-template-button")).forEach((function(t){return t.addEventListener("click",fe)})),c=lt().searchInput,pe(c,"frm-card-item",{handleSearchResult:me}),i=lt().emptyStateButton,zt(i,he),function(){var t=lt(),e=t.createTemplateFormsDropdown,r=t.createTemplateButton,n=t.showCreateTemplateModalButton,o=t.emptyStateButton;zt(n,ye),zt(o,ye),e.addEventListener("change",ve),zt(r,be)}(),a=lt().leaveEmailModalGetCodeButton,zt(a,Se),t=document.getElementById("frm-confirm-email-address"),e=document.getElementById("frm-code-modal-back-button"),r=document.getElementById("frm-change-email-address"),n=document.getElementById("frm-resend-code"),zt(t,Ae),zt(e,Oe),zt(r,Oe),zt(n,ke)};qe=function(){wp.hooks.doAction("frmFormTemplates.beforeInitialize",{getAppState:xt,setAppState:St}),Ke(),wp.hooks.doAction("frmFormTemplates.afterInitialize",{getAppState:xt,setAppState:St}),wp.hooks.doAction("frm_new_form_modal_form",jQuery("#frm-new-template"))},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",qe):qe())}()}();