diff --git a/classes/models/FrmApplicationTemplate.php b/classes/models/FrmApplicationTemplate.php index 50941b9a8e..6d11a48ddb 100644 --- a/classes/models/FrmApplicationTemplate.php +++ b/classes/models/FrmApplicationTemplate.php @@ -41,16 +41,40 @@ public static function init() { 'frm_application_data_keys', array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' ) ); - self::$keys_with_images = self::get_template_keys_with_local_images(); + self::$keys_with_images = array_merge( + self::get_template_keys_with_local_png_images(), + self::get_template_keys_with_local_webp_images() + ); self::$categories = array(); } + /** + * Newer templates now use .webp files instead of .png. + * + * @since x.x + * + * @return array + */ + private static function get_template_keys_with_local_webp_images() { + return array( + 'member-directory', + 'link-in-bio-instagram', + 'letter-of-recommendation', + 'invoice-pdf', + 'freelance-invoice-generator', + 'contract-agreement', + 'charity-tracker', + 'certificate', + 'testimonials', + ); + } + /** * Return the template keys that have embedded images. Otherwise, we want to avoid trying to load the URL and use the placeholder instead. * * @return array */ - private static function get_template_keys_with_local_images() { + private static function get_template_keys_with_local_png_images() { return array( 'business-hours', 'faq-template-wordpress', @@ -58,6 +82,7 @@ private static function get_template_keys_with_local_images() { 'team-directory', 'product-review', 'real-estate-listings', + 'business-directory', ); } @@ -153,6 +178,7 @@ function ( $category ) { }//end foreach $application['hasLiteThumbnail'] = in_array( $application['key'], self::$keys_with_images, true ); + $application['isWebp'] = in_array( $application['key'], self::get_template_keys_with_local_webp_images(), true ); if ( ! array_key_exists( 'url', $application ) ) { $purchase_url = $this->is_available_for_purchase(); diff --git a/images/applications/thumbnails/business-directory.png b/images/applications/thumbnails/business-directory.png new file mode 100644 index 0000000000..f6b3d77fef Binary files /dev/null and b/images/applications/thumbnails/business-directory.png differ diff --git a/images/applications/thumbnails/certificate.webp b/images/applications/thumbnails/certificate.webp new file mode 100644 index 0000000000..4d0a782938 Binary files /dev/null and b/images/applications/thumbnails/certificate.webp differ diff --git a/images/applications/thumbnails/charity-tracker.webp b/images/applications/thumbnails/charity-tracker.webp new file mode 100644 index 0000000000..6eb7602a9a Binary files /dev/null and b/images/applications/thumbnails/charity-tracker.webp differ diff --git a/images/applications/thumbnails/contract-agreement.webp b/images/applications/thumbnails/contract-agreement.webp new file mode 100644 index 0000000000..d5c0a7bfbf Binary files /dev/null and b/images/applications/thumbnails/contract-agreement.webp differ diff --git a/images/applications/thumbnails/freelance-invoice-generator.webp b/images/applications/thumbnails/freelance-invoice-generator.webp new file mode 100644 index 0000000000..1a7e62dc28 Binary files /dev/null and b/images/applications/thumbnails/freelance-invoice-generator.webp differ diff --git a/images/applications/thumbnails/invoice-pdf.webp b/images/applications/thumbnails/invoice-pdf.webp new file mode 100644 index 0000000000..0dc47f97dc Binary files /dev/null and b/images/applications/thumbnails/invoice-pdf.webp differ diff --git a/images/applications/thumbnails/letter-of-recommendation.webp b/images/applications/thumbnails/letter-of-recommendation.webp new file mode 100644 index 0000000000..9d119c34d7 Binary files /dev/null and b/images/applications/thumbnails/letter-of-recommendation.webp differ diff --git a/images/applications/thumbnails/link-in-bio-instagram.webp b/images/applications/thumbnails/link-in-bio-instagram.webp new file mode 100644 index 0000000000..5448121e3c Binary files /dev/null and b/images/applications/thumbnails/link-in-bio-instagram.webp differ diff --git a/images/applications/thumbnails/member-directory.webp b/images/applications/thumbnails/member-directory.webp new file mode 100644 index 0000000000..0cee225171 Binary files /dev/null and b/images/applications/thumbnails/member-directory.webp differ diff --git a/images/applications/thumbnails/testimonials.webp b/images/applications/thumbnails/testimonials.webp new file mode 100644 index 0000000000..2a656881ff Binary files /dev/null and b/images/applications/thumbnails/testimonials.webp differ diff --git a/js/admin/applications.js b/js/admin/applications.js index 9d81095a11..7da3614216 100644 --- a/js/admin/applications.js +++ b/js/admin/applications.js @@ -320,7 +320,7 @@ function getCardContent() { const thumbnailFolderUrl = getUrlToApplicationsImages() + 'thumbnails/'; - const filenameToUse = data.hasLiteThumbnail ? data.key + '.png' : 'placeholder.svg'; + const filenameToUse = data.hasLiteThumbnail ? data.key + ( data.isWebp ? '.webp' : '.png' ) : 'placeholder.svg'; return div({ className: 'frm-application-card-image-wrapper', child: img({ src: thumbnailFolderUrl + filenameToUse }) diff --git a/js/form-templates.js b/js/form-templates.js index 68f7c4f1cf..ba423f13e8 100644 --- a/js/form-templates.js +++ b/js/form-templates.js @@ -1,2 +1,2 @@ /*! 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.canAccessApplicationDashboard,n=t.applicationsUrl,o=window.frmFormTemplatesVars,a=o.FEATURED_TEMPLATES_KEYS,i=o.upgradeLink,c="frm-form-templates",l="available-templates",u="free-templates",s="favorites",f="custom",p="search",m="440px",d="550px",h="frm-page-skeleton",y="all-items";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},E=["(","?"],S={")":["("],":":["?","?:"]},_=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var C={"!":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 P={contextDelimiter:"",onMissingKey:null};function F(t,e){var r;for(r in this.data=t,this.pluralForms={},this.options={},P)this.options[r]=void 0!==e&&r in e?e[r]:P[r]}function B(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 N(t){for(var e=1;e=0||x[o]3&&void 0!==arguments[3]?arguments[3]:10,i=t[e];if(G(r)&&q(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.")}},z=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(n,o){var a=t[e];if(G(n)&&(r||q(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}}},Y=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}},H=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]=N(N(N({},D),n.data[e]),t),n.data[e][""]=N(N({},D[""]),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,V)),X=(J.getLocaleData.bind(J),J.setLocaleData.bind(J),J.resetLocaleData.bind(J),J.subscribe.bind(J),J.__.bind(J)),Q=(J._x.bind(J),J._n.bind(J),J._nx.bind(J),J.isRTL.bind(J),J.hasTranslation.bind(J),window.frmGlobal),W=Q.url,tt=Q.nonce,et="frm_hidden",rt="frm-hide-js",nt="frm-current",ot=window.frmDom,at=ot.tag,it=ot.div,ct=ot.a,lt=ot.img;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 st(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 ft(t,e,r){return(e=function(t){var e=function(t){if("object"!=ut(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=ut(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ut(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var pt,mt=document.getElementById("post-body-content"),dt=document.getElementById("".concat(h,"-sidebar")),ht=((pt=ct({className:"button button-primary frm-button-primary"})).setAttribute("role","button"),it({id:"".concat(h,"-empty-state"),className:"frm-flex-col frm-flex-center frm-gap-md ".concat(et),children:[lt({src:"".concat(W,"/images/page-skeleton/empty-state.svg"),alt:X("Empty State","formidable")}),it({className:"frmcenter",children:[at("h2",{className:"".concat(h,"-title frm-mb-0")}),at("p",{className:"".concat(h,"-text frm-mb-0")})]}),pt]}));null==mt||mt.appendChild(ht);var yt=function(){var t=document.querySelector("#".concat(h,"-empty-state"));return{emptyState:t,emptyStateTitle:null==t?void 0:t.querySelector(".".concat(h,"-title")),emptyStateText:null==t?void 0:t.querySelector(".".concat(h,"-text")),emptyStateButton:null==t?void 0:t.querySelector(".button")}}(),vt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==w(t)||null===t)throw new Error("createPageElements: initialElements must be a non-null object");var e=t;return{getElements:function(){return e},addElements:function(t){if("object"!==w(t)||null===t)throw new Error("addElements: newElements must be a non-null object");e=g(g({},e),t)}}}(function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==St(t)||null===t)throw new Error("createPageState: initialState must be a non-null object");var e=t;return{getState:function(){return e},getSingleState:function(t){var r=Reflect.get(e,t);return void 0===r?null:r},setState:function(t){if("object"!==St(t)||null===t)throw new Error("setState: newState must be a non-null object");e=xt(xt({},e),t)},setSingleState:function(t,r){Reflect.has(e,t)&&Reflect.set(e,t,r)}}}({notEmptySearchText:!1,selectedCategory:y,selectedCategoryEl:_t}),Lt=Tt.getState,kt=Tt.getSingleState,Ot=Tt.setState,jt=Tt.setSingleState;function It(t){return It="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},It(t)}function At(t,e){for(var r=0;r1&&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()},e=[{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)},zt=function(t){return t instanceof HTMLElement||console.warn("Invalid argument: Element must be an instance of HTMLElement")||!1},Yt=function(t){var e;return null===(e=Array.from(t))||void 0===e?void 0:e.forEach((function(t){return $t(t)}))},Ht=function(t){var e;return null===(e=Array.from(t))||void 0===e?void 0:e.forEach((function(t){return Ut(t)}))},$t=function(t){return null==t?void 0:t.classList.remove(et)},Ut=function(t){return null==t?void 0:t.classList.add(et)},Zt=function(t){var e=t.currentTarget,r=e.getAttribute("data-category"),n=Lt(),o=n.selectedCategory,a=n.selectedCategoryEl,i=n.notEmptySearchText;if(o!==r){o=wp.hooks.applyFilters("frmPage.selectedCategory",r),a.classList.remove(nt),(a=e).classList.add(nt),Ot({selectedCategory:o,selectedCategoryEl:a}),i&&Vt(),wp.hooks.doAction("frmPage.onCategoryClick",o);var c=gt().bodyContent;new Ft(c).fadeIn()}};function Kt(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Zt(t))}function Vt(){var t=gt().searchInput;t.value="",t.dispatchEvent(new Event("input",{bubbles:!0}))}var Jt=gt().bodyContent,Xt=document.getElementById("".concat(c,"-list")),Qt=document.getElementById("".concat(c,"-custom-list-section")),Wt=document.querySelector(".".concat(h,'-cat[data-category="').concat(s,'"]')),te=document.getElementById("".concat(c,"-modal"));bt({headerCancelButton:null===(Pt=document.getElementById("frm-publishing"))||void 0===Pt?void 0:Pt.querySelector("a"),createFormButton:document.getElementById("".concat(c,"-create-form")),pageTitle:document.getElementById("".concat(c,"-page-title")),pageTitleText:document.getElementById("".concat(c,"-page-title-text")),pageTitleDivider:document.getElementById("".concat(c,"-page-title-divider")),upsellBanner:document.getElementById("".concat(c,"-upsell-banner")),extraTemplateCountElements:document.querySelectorAll(".".concat(c,"-extra-templates-count")),templatesList:Xt,templateItems:Xt.querySelectorAll(".frm-card-item"),availableTemplateItems:Xt.querySelectorAll(".frm-card-item:not(.".concat(c,"-locked-item)")),freeTemplateItems:Xt.querySelectorAll(".frm-card-item.frm-free-template"),twinFeaturedTemplateItems:Xt.querySelectorAll(".".concat(c,"-featured-item")),firstLockedFreeTemplate:Xt.querySelector(".frm-free-template"),featuredTemplatesList:document.getElementById("".concat(c,"-featured-list")),customTemplatesSection:Qt,customTemplateItems:Qt.querySelectorAll(".frm-card-item"),customTemplatesTitle:document.getElementById("".concat(c,"-custom-list-title")),customTemplatesList:document.getElementById("".concat(c,"-custom-list")),favoritesCategory:Wt,favoritesCategoryCountEl:null==Wt?void 0:Wt.querySelector(".".concat(h,"-cat-count")),availableTemplatesCategory:document.querySelector(".".concat(h,'-cat[data-category="').concat(l,'"]')),freeTemplatesCategory:document.querySelector(".".concat(h,'-cat[data-category="').concat(u,'"]')),modal:te,modalItems:null==te?void 0:te.querySelectorAll(".".concat(c,"-modal-item")),showCreateTemplateModalButton:document.getElementById("frm-show-create-template-modal"),createTemplateModal:document.getElementById("frm-create-template-modal"),createTemplateFormsDropdown:document.getElementById("frm-create-template-modal-forms-select"),createTemplateName:document.getElementById("frm_create_template_name"),createTemplateDescription:document.getElementById("frm_create_template_description"),createTemplateButton:document.getElementById("frm-create-template-button"),renewAccountModal:document.getElementById("frm-renew-modal"),leaveEmailModal:document.getElementById("frm-leave-email-modal"),leaveEmailModalInput:document.getElementById("frm_leave_email"),leaveEmailModalApiEmailForm:document.getElementById("frmapi-email-form"),leaveEmailModalGetCodeButton:document.getElementById("frm-get-code-button"),codeFromEmailModal:document.getElementById("frm-code-from-email-modal"),codeFromEmailModalInput:document.getElementById("frm_code_from_email"),upgradeModal:document.getElementById("frm-form-upgrade-modal"),upgradeModalTemplateNames:null==te?void 0:te.querySelectorAll(".frm-upgrade-modal-template-name"),upgradeModalPlansIcons:null==te?void 0:te.querySelectorAll(".frm-upgrade-modal-plan-icon"),upgradeModalLink:document.getElementById("frm-upgrade-modal-link"),newTemplateForm:document.getElementById("frm-new-template"),newTemplateNameInput:document.getElementById("frm_template_name"),newTemplateDescriptionInput:document.getElementById("frm_template_desc"),newTemplateLinkInput:document.getElementById("frm_link"),newTemplateActionInput:document.getElementById("frm_action_type"),bodyContentChildren:null==Jt?void 0:Jt.children});var ee,re=window.frmDom,ne=re.tag,oe=re.div,ae=re.span,ie=re.a,ce=re.img,le="".concat(W,"/images/applications/thumbnails");var ue=window.frmFormTemplatesVars,se=ue.templatesCount,fe=ue.favoritesCount,pe=ue.customCount,me=gt(),de=me.availableTemplateItems,he=me.freeTemplateItems,ye=me.firstLockedFreeTemplate,ve=de.length;Ot({availableTemplatesCount:ve,customCount:Number(pe),extraTemplatesCount:se-ve,favoritesCount:fe,freeTemplatesCount:he.length,selectedTemplate:ye});function ge(t){return ge="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},ge(t)}function be(){be=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 x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==r&&n.call(E,i)&&(w=E);var S=b.prototype=v.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(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"==ge(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 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=k(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 k(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,k(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 j(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 A(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),j(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;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function we(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 xe(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){we(a,n,o,i,c,"next",t)}function c(t){we(a,n,o,i,c,"throw",t)}i(void 0)}))}}var Ee=null;function Se(){return(Se=xe(be().mark((function t(){var e,r,n;return be().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=window.frmAdminBuild,r=e.initModal,n=e.offsetModalY,(Ee=r("#frm-form-templates-modal",m))&&n(Ee,"103px"),Gt("free-templates")&&(gt().leaveEmailModal&&yr()),Te(),wp.hooks.addAction("frmAdmin.beforeOpenConfirmModal","frmFormTemplates",(function(t){var e=t.$info;e.dialog("option","width",d),n(e,"103px")}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function _e(){return Ee}function Te(){return Le.apply(this,arguments)}function Le(){return Le=xe(be().mark((function t(){var e,r,n,o,a,i,c,l,u;return be().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=gt(),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)'),bt({leaveEmailModalHiddenForm:l,leaveEmailModalHiddenInput:u});case 27:case"end":return t.stop()}}),t,null,[[4,13]])}))),Le.apply(this,arguments)}function ke(t){var e=gt().pageTitleText,r=t||kt("selectedCategoryEl").querySelector(".".concat(h,"-cat-text")).textContent;e.textContent=r}var Oe=function(t){return!!zt(t)&&t.classList.contains("".concat(c,"-favorite-item"))},je=function(t){return!!zt(t)&&t.classList.contains("".concat(c,"-custom-item"))},Ie={},Ae=function(){var t=gt(),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)},Ce=".".concat(c,"-item-favorite-button"),Pe="".concat(Ce," use"),Fe="#frm_heart_solid_icon",Be="#frm_heart_icon",Ne=function(t){var e,r=t.currentTarget,n=gt(),o=n.templatesList,i=n.featuredTemplatesList,l=n.favoritesCategoryCountEl,u=n.customTemplatesTitle,f=r.closest(".frm-card-item"),p=f.dataset.id,m=Oe(f),d=je(f),h=function(t){return!!zt(t)&&a.includes(Number(t.dataset.id))}(f),y=null;if(f.classList.toggle("".concat(c,"-favorite-item"),!m),h){var v=f.closest("#".concat(c,"-list"))?i:o;v&&(y=v.querySelector('.frm-card-item[data-id="'.concat(p,'"]'))).classList.toggle("".concat(c,"-favorite-item"),!m)}var g,b=Lt(),w=b.selectedCategory,x=b.favoritesCount,E=m?"remove":"add",S=f.querySelector(Pe),_=null===(e=y)||void 0===e?void 0:e.querySelector(Pe);"add"===E?(++x.total,d?++x.custom:++x.default,S.setAttribute("xlink:href",Fe),null==_||_.setAttribute("xlink:href",Fe)):(--x.total,d?--x.custom:--x.default,S.setAttribute("xlink:href",Be),null==_||_.setAttribute("xlink:href",Be)),l.textContent=x.total,jt("favoritesCount",x),s===w&&(0===x.total&&ir(),Ut(f),0===x.default&&Ut(o),0!==x.custom&&0!==x.default||Ut(u)),g=function(){return t=p,e=E,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(g).catch(g)},De=function(t){var e=t.currentTarget,r=e.closest(".frm-card-item"),n=function(t){return!!zt(t)&&t.classList.contains("".concat(c,"-locked-item"))}(r),o=je(r);if(n||!o)if(t.preventDefault(),jt("selectedTemplate",r),n)!function(t){var e=t.dataset.requiredPlan;switch(e){case"basic":case"plus":case"business":case"elite":dr(e,t);break;case"renew":hr();break;case"free":yr()}}(r);else{var a=gt(),i=a.newTemplateForm,l=a.newTemplateNameInput,u=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";l.value=m,u.value=d,f.value=h,s.value=e.href,p(i,h,e)}},Me=window.frmDom.search.init;function qe(t,e){var r=t.foundSomething,n=t.notEmptySearchText;if(!e||"search"!==e.type||""!==e.target.value){var o=Lt(),a=gt().allItemsCategory;jt("notEmptySearchText",n),o.notEmptySearchText||o.selectedCategory?(o.selectedCategory&&(function(t){var e=gt(),r=e.bodyContent,n=e.bodyContentChildren,o=e.pageTitle,a=e.templatesList,i=e.applicationTemplates,c=new Ft(r);t&&kt("selectedCategoryEl").classList.remove(nt),Ht(n),ke(X("Search Result","formidable")),Yt([o,a,i]),c.fadeIn()}(n),n&&jt("selectedCategory","")),function(t){if(t){var e,r=gt().emptyState;if(e=r,"none"!==window.getComputedStyle(e).getPropertyValue("display")){var n=gt().pageTitle;Ut(r),$t(n)}var o=gt(),a=o.templatesList,i=o.applicationTemplates,c=o.applicationTemplatesTitle,l=o.applicationTemplatesList;Yt([a,i,c]),0===a.offsetHeight&&Ht([a,c]),0===(null==l?void 0:l.offsetHeight)&&Ut(i)}else!function(){var t,e=Lt().notEmptySearchText,r=gt(),n=r.pageTitle,o=r.emptyState,a=r.emptyStateButton,i=r.applicationTemplates;if(p!==(null===(t=o.dataset)||void 0===t?void 0:t.view)){o.setAttribute("data-view",p);var c=gt(),l=c.emptyStateTitle,u=c.emptyStateText;l.textContent=X("No templates found","formidable"),u.textContent=X("Sorry, we didn't find any templates that match your criteria.","formidable"),a.textContent=X("Start from Scratch","formidable"),Ht([n,i]),Yt([o,a])}else e?($t(o),Ht([n,i])):(Ut(o),o.removeAttribute("data-view"))}()}(r)):a.dispatchEvent(new Event("click",{bubbles:!0}))}}var Ge=function(){var t,e=gt().emptyState;p===(null===(t=e.dataset)||void 0===t?void 0:t.view)&&(jt("selectedCategory",""),Vt(),gt().searchInput.focus())},Re=function(){var t=Lt().selectedCategory;f===t&&gr()},ze=function(){var t=gt().createTemplateFormsDropdown,e=t.value;if(e&&"no-forms"!==e){Ye(!1);var r=t.options[t.selectedIndex],n=r.dataset.description.trim(),o=r.dataset.name.trim(),a=" ".concat(X("Template","formidable"));o.endsWith(a)||(o+=a);var i=gt(),c=i.createTemplateName,l=i.createTemplateDescription;c.value=o,l.value=n}else Ye(!0)},Ye=function(t){var e=gt(),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)},He=function(){var t=window.frmAdminBuild.installNewForm,e="frm_create_template",r=gt(),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 $e(t){return $e="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},$e(t)}function Ue(){Ue=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 x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==r&&n.call(E,i)&&(w=E);var S=b.prototype=v.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(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"==$e(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 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=k(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 k(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,k(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 j(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 A(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),j(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;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Ze(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 Ke=function(){var t,e=(t=Ue().mark((function t(){var e,r,n,o,a,i,c,l,u,s,f,p,m;return Ue().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=gt(),n=r.leaveEmailModalInput,o=n.value.trim()){t.next=5;break}return br("empty"),t.abrupt("return");case 5:if(Rt(o)){t.next=8;break}return br("invalid"),t.abrupt("return");case 8:if(a=gt(),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?vr():br("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){Ze(a,n,o,i,c,"next",t)}function c(t){Ze(a,n,o,i,c,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();function Ve(t){return Ve="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},Ve(t)}function Je(){Je=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 x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==r&&n.call(E,i)&&(w=E);var S=b.prototype=v.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(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"==Ve(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 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=k(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 k(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,k(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 j(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 A(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),j(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;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(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 Qe=function(){var t,e=(t=Je().mark((function t(){var e,r,n,o,a,i,l,u,s,f,p,m;return Je().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=gt(),r=e.codeFromEmailModalInput,n=r.value.trim()){t.next=5;break}return wr("empty"),t.abrupt("return");case 5:return o=Lt(),a=o.selectedTemplate,(i=new FormData).append("action","template_api_signup"),i.append("nonce",tt),i.append("code",n),i.append("key",a.dataset.key),t.prev=11,t.next=14,fetch(ajaxurl,{method:"POST",body:i});case 14:return u=t.sent,t.next=17,u.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 f=(null===(s=l)||void 0===s||null===(s=s.data)||void 0===s?void 0:s[0])||{},p=f.message,wr(p?"custom":"invalid",p),$t(document.getElementById("frm_code_from_email_options")),t.abrupt("return");case 30:if(!Gt("free-templates")){t.next=33;break}return window.location.href=(qt.delete("free-templates"),Mt.search=qt.toString(),Mt.toString()),t.abrupt("return");case 33:if(l.data&&l.data.url){t.next=35;break}return t.abrupt("return");case 35:a.classList.remove("".concat(c,"-locked-item")),(m=a.querySelector(".frm-form-templates-use-template-button")).setAttribute("href",l.data.url),m.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){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)}}(),We=function(){var t=gt(),e=t.leaveEmailModal,r=t.codeFromEmailModal;Ut(r),$t(e)},tr=function(){var t=gt(),e=t.codeFromEmailModalInput,r=t.leaveEmailModalGetCodeButton;e.value="",Ht(document.querySelectorAll("#frm_code_from_email_options, #frm_code_from_email_error")),r.dispatchEvent(new Event("click",{bubbles:!0}))},er=function(t){if(!t.target.closest("a")){var e=t.currentTarget;window.location.href=e.dataset.href}};function rr(){var t,e,r,n,o,a,i,p,m;gt().categoryItems.forEach((function(t){Dt(t,Zt),t.addEventListener("keydown",Kt)})),wp.hooks.addAction("frmPage.onCategoryClick","frmFormTemplates",(function(t){!function(t){var e=gt(),r=e.bodyContentChildren,n=e.pageTitle,o=e.showCreateTemplateModalButton,a=e.templatesList,i=e.templateItems;switch(y!==t&&Ht(r),ke(),Ut(o),$t(n),t){case y:!function(){var t=gt(),e=t.bodyContentChildren,r=t.pageTitleDivider,n=t.templateItems,o=t.twinFeaturedTemplateItems,a=t.customTemplatesSection,i=t.emptyState,c=t.applicationTemplates;Yt([].concat(or(e),or(n))),Ht([r].concat(or(o),[a,i,c]))}();break;case l:!function(){if(0!==Lt().availableTemplatesCount){var t=gt(),e=t.templatesList,r=t.templateItems,n=t.availableTemplateItems;Ht(r),Yt([e].concat(or(n)))}else!function(){var t=gt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",l);var o=gt(),a=o.emptyStateTitle,i=o.emptyStateText,c=Lt().extraTemplatesCount;a.textContent=X("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(u).filter((function(t){return!Oe(t)}));Ht(p),s.push(a),s.push(l),0===t.default?Ut(i):s.push(i)}Yt(s)}else ir()}();break;case f:!function(){if(0!==Lt().customCount){var t=gt(),e=t.showCreateTemplateModalButton,r=t.pageTitleDivider,n=t.customTemplatesSection,o=t.customTemplatesList,a=t.customTemplatesTitle,i=t.customTemplateItems;Ut(a),Yt([e,r,n,o].concat(or(i)))}else!function(){var t=gt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",f);var o=gt(),a=o.emptyStateTitle,i=o.emptyStateText;a.textContent=X("You currently have no templates.","formidable"),i.textContent=X("You haven't created any form templates. Begin now to simplify your workflow and save time.","formidable"),n.textContent=X("Create Template","formidable"),Ut(e),Yt([r,n])}()}();break;default:Ht(i),Yt([a].concat(or(Ie[t])))}}(t)})),m=gt().createFormButton,Dt(m,Ae),document.querySelectorAll(Ce).forEach((function(t){return Dt(t,Ne)})),document.querySelectorAll(".".concat(c,"-use-template-button")).forEach((function(t){return t.addEventListener("click",De)})),a=gt(),i=a.searchInput,p=a.emptyStateButton,Me(i,"frm-card-item",{handleSearchResult:qe}),Dt(p,Ge),function(){var t=gt(),e=t.createTemplateFormsDropdown,r=t.createTemplateButton,n=t.showCreateTemplateModalButton,o=t.emptyStateButton;Dt(n,Re),Dt(o,Re),e.addEventListener("change",ze),Dt(r,He)}(),o=gt().leaveEmailModalGetCodeButton,Dt(o,Ke),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"),Dt(t,Qe),Dt(e,We),Dt(r,We),Dt(n,tr)}function nr(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,o=t.hasLiteThumbnail?"".concat(le,"/").concat(r,".png"):"".concat(le,"/placeholder.svg");return ne("li",{className:"frm-card-item",data:{href:"".concat(n,"&triggerViewApplicationModal=1&template=").concat(r),"frm-search-text":e.toLowerCase()},children:[oe({className:"".concat(c,"-item-icon"),child:ce({src:o})}),oe({className:"".concat(c,"-item-body"),children:[ae({text:X("Ready Made Solution","formidable"),className:"frm-meta-tag frm-orange-tag frm-text-xs"}),ne("h3",{text:e,className:"frm-text-sm frm-font-medium frm-m-0"}),ie({text:X("See all applications","formidable"),className:"frm-text-xs frm-font-semibold",href:n})]})]})}(t)}));ee=oe({id:"".concat(c,"-applications"),className:et,children:[ne("h2",{text:X("Application Templates"),className:"frm-text-sm frm-mb-sm"}),ne("ul",{className:"".concat(c,"-list frm-list-grid-layout"),children:e})]})}})(t.templates),(e=gt()).applicationTemplates||void 0===ee||(e.bodyContent.appendChild(ee),bt({applicationTemplates:ee,applicationTemplatesTitle:ee.querySelector("h2"),applicationTemplatesList:ee.querySelector(".".concat(c,"-list")),applicationTemplateItems:ee.querySelectorAll(".frm-card-item")})),void 0!==(r=gt().applicationTemplateItems)&&r.forEach((function(t){t.addEventListener("click",er)}))}function or(t){return function(t){if(Array.isArray(t))return ar(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 ar(t,e);var r={}.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)?ar(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 ar(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=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),j(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;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function ur(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 sr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){ur(a,n,o,i,c,"next",t)}function c(t){ur(a,n,o,i,c,"throw",t)}i(void 0)}))}}var fr,pr=function(t){return sr(lr().mark((function e(){var r,n,o,a,i,c,l=arguments;return lr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=_e()){e.next=3;break}return e.abrupt("return");case 3:for(n=gt(),o=n.modalItems,Ht(o),r.dialog("option","width",m),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):"";l.href=i+u,$t(o)})),hr=pr((function(){var t=gt().renewAccountModal;$t(t)})),yr=pr((function(){var t=gt().leaveEmailModal;$t(t)})),vr=pr((function(){var t=gt().codeFromEmailModal;$t(t)})),gr=pr((function(){_e().dialog("option","width",d);var t=gt().createTemplateModal;$t(t)})),br=function(t){Nt("#frm_leave_email","#frm_leave_email_error",t)},wr=function(t,e){Nt("#frm_code_from_email","#frm_code_from_email_error",t,e)},xr=function(){e&&(0,frmDom.ajax.doJsonFetch)("get_applications_data&view=templates").then(nr),function(){Se.apply(this,arguments)}(),gt().templateItems.forEach((function(t){t.getAttribute("data-categories").split(",").forEach((function(e){Ie[e]||(Ie[e]=[]),Ie[e].push(t)}))})),function(){var t=gt(),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="",Ht(o),a){var l=Lt().availableTemplatesCount;a.querySelector(".".concat(h,"-cat-count")).textContent=l}var u=Lt().freeTemplatesCount;i.querySelector(".".concat(h,"-cat-count")).textContent=u,0===u&&Ut(i);var s,f=gt().extraTemplateCountElements,p=Lt().extraTemplatesCount;f.forEach((function(t){return t.textContent=p})),n.classList.remove(rt),e.classList.remove(rt),c.fadeIn(),$t(e),Gt("return_page")&&(s=gt().headerCancelButton,new Ft(s).fadeIn())}(),rr()};fr=function(){wp.hooks.doAction("frmFormTemplates.beforeInitialize",{getState:Lt,setState:Ot}),xr(),wp.hooks.doAction("frmFormTemplates.afterInitialize",{getState:Lt,setState:Ot}),wp.hooks.doAction("frm_new_form_modal_form",jQuery("#frm-new-template"))},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",fr):fr())}()}(); \ No newline at end of file +!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.canAccessApplicationDashboard,n=t.applicationsUrl,o=window.frmFormTemplatesVars,a=o.FEATURED_TEMPLATES_KEYS,i=o.upgradeLink,c="frm-form-templates",l="available-templates",u="free-templates",s="favorites",f="custom",p="search",m="440px",d="550px",h="frm-page-skeleton",y="all-items";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},E=["(","?"],S={")":["("],":":["?","?:"]},_=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var C={"!":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 P={contextDelimiter:"",onMissingKey:null};function F(t,e){var r;for(r in this.data=t,this.pluralForms={},this.options={},P)this.options[r]=void 0!==e&&r in e?e[r]:P[r]}function B(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 N(t){for(var e=1;e=0||x[o]3&&void 0!==arguments[3]?arguments[3]:10,i=t[e];if(G(r)&&q(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.")}},z=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(n,o){var a=t[e];if(G(n)&&(r||q(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}}},Y=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}},H=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]=N(N(N({},D),n.data[e]),t),n.data[e][""]=N(N({},D[""]),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,V)),X=(J.getLocaleData.bind(J),J.setLocaleData.bind(J),J.resetLocaleData.bind(J),J.subscribe.bind(J),J.__.bind(J)),W=(J._x.bind(J),J._n.bind(J),J._nx.bind(J),J.isRTL.bind(J),J.hasTranslation.bind(J),window.frmGlobal),Q=W.url,tt=W.nonce,et="frm_hidden",rt="frm-hide-js",nt="frm-current",ot=window.frmDom,at=ot.tag,it=ot.div,ct=ot.a,lt=ot.img;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 st(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 ft(t,e,r){return(e=function(t){var e=function(t){if("object"!=ut(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=ut(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ut(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var pt,mt=document.getElementById("post-body-content"),dt=document.getElementById("".concat(h,"-sidebar")),ht=((pt=ct({className:"button button-primary frm-button-primary"})).setAttribute("role","button"),it({id:"".concat(h,"-empty-state"),className:"frm-flex-col frm-flex-center frm-gap-md ".concat(et),children:[lt({src:"".concat(Q,"/images/page-skeleton/empty-state.svg"),alt:X("Empty State","formidable")}),it({className:"frmcenter",children:[at("h2",{className:"".concat(h,"-title frm-mb-0")}),at("p",{className:"".concat(h,"-text frm-mb-0")})]}),pt]}));null==mt||mt.appendChild(ht);var yt=function(){var t=document.querySelector("#".concat(h,"-empty-state"));return{emptyState:t,emptyStateTitle:null==t?void 0:t.querySelector(".".concat(h,"-title")),emptyStateText:null==t?void 0:t.querySelector(".".concat(h,"-text")),emptyStateButton:null==t?void 0:t.querySelector(".button")}}(),vt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==w(t)||null===t)throw new Error("createPageElements: initialElements must be a non-null object");var e=t;return{getElements:function(){return e},addElements:function(t){if("object"!==w(t)||null===t)throw new Error("addElements: newElements must be a non-null object");e=g(g({},e),t)}}}(function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==St(t)||null===t)throw new Error("createPageState: initialState must be a non-null object");var e=t;return{getState:function(){return e},getSingleState:function(t){var r=Reflect.get(e,t);return void 0===r?null:r},setState:function(t){if("object"!==St(t)||null===t)throw new Error("setState: newState must be a non-null object");e=xt(xt({},e),t)},setSingleState:function(t,r){Reflect.has(e,t)&&Reflect.set(e,t,r)}}}({notEmptySearchText:!1,selectedCategory:y,selectedCategoryEl:_t}),Lt=Tt.getState,kt=Tt.getSingleState,Ot=Tt.setState,jt=Tt.setSingleState;function It(t){return It="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},It(t)}function At(t,e){for(var r=0;r1&&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()},e=[{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)},zt=function(t){return t instanceof HTMLElement||console.warn("Invalid argument: Element must be an instance of HTMLElement")||!1},Yt=function(t){var e;return null===(e=Array.from(t))||void 0===e?void 0:e.forEach((function(t){return $t(t)}))},Ht=function(t){var e;return null===(e=Array.from(t))||void 0===e?void 0:e.forEach((function(t){return Ut(t)}))},$t=function(t){return null==t?void 0:t.classList.remove(et)},Ut=function(t){return null==t?void 0:t.classList.add(et)},Zt=function(t){var e=t.currentTarget,r=e.getAttribute("data-category"),n=Lt(),o=n.selectedCategory,a=n.selectedCategoryEl,i=n.notEmptySearchText;if(o!==r){o=wp.hooks.applyFilters("frmPage.selectedCategory",r),a.classList.remove(nt),(a=e).classList.add(nt),Ot({selectedCategory:o,selectedCategoryEl:a}),i&&Vt(),wp.hooks.doAction("frmPage.onCategoryClick",o);var c=gt().bodyContent;new Ft(c).fadeIn()}};function Kt(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Zt(t))}function Vt(){var t=gt().searchInput;t.value="",t.dispatchEvent(new Event("input",{bubbles:!0}))}var Jt=gt().bodyContent,Xt=document.getElementById("".concat(c,"-list")),Wt=document.getElementById("".concat(c,"-custom-list-section")),Qt=document.querySelector(".".concat(h,'-cat[data-category="').concat(s,'"]')),te=document.getElementById("".concat(c,"-modal"));bt({headerCancelButton:null===(Pt=document.getElementById("frm-publishing"))||void 0===Pt?void 0:Pt.querySelector("a"),createFormButton:document.getElementById("".concat(c,"-create-form")),pageTitle:document.getElementById("".concat(c,"-page-title")),pageTitleText:document.getElementById("".concat(c,"-page-title-text")),pageTitleDivider:document.getElementById("".concat(c,"-page-title-divider")),upsellBanner:document.getElementById("".concat(c,"-upsell-banner")),extraTemplateCountElements:document.querySelectorAll(".".concat(c,"-extra-templates-count")),templatesList:Xt,templateItems:Xt.querySelectorAll(".frm-card-item"),availableTemplateItems:Xt.querySelectorAll(".frm-card-item:not(.".concat(c,"-locked-item)")),freeTemplateItems:Xt.querySelectorAll(".frm-card-item.frm-free-template"),twinFeaturedTemplateItems:Xt.querySelectorAll(".".concat(c,"-featured-item")),firstLockedFreeTemplate:Xt.querySelector(".frm-free-template"),featuredTemplatesList:document.getElementById("".concat(c,"-featured-list")),customTemplatesSection:Wt,customTemplateItems:Wt.querySelectorAll(".frm-card-item"),customTemplatesTitle:document.getElementById("".concat(c,"-custom-list-title")),customTemplatesList:document.getElementById("".concat(c,"-custom-list")),favoritesCategory:Qt,favoritesCategoryCountEl:null==Qt?void 0:Qt.querySelector(".".concat(h,"-cat-count")),availableTemplatesCategory:document.querySelector(".".concat(h,'-cat[data-category="').concat(l,'"]')),freeTemplatesCategory:document.querySelector(".".concat(h,'-cat[data-category="').concat(u,'"]')),modal:te,modalItems:null==te?void 0:te.querySelectorAll(".".concat(c,"-modal-item")),showCreateTemplateModalButton:document.getElementById("frm-show-create-template-modal"),createTemplateModal:document.getElementById("frm-create-template-modal"),createTemplateFormsDropdown:document.getElementById("frm-create-template-modal-forms-select"),createTemplateName:document.getElementById("frm_create_template_name"),createTemplateDescription:document.getElementById("frm_create_template_description"),createTemplateButton:document.getElementById("frm-create-template-button"),renewAccountModal:document.getElementById("frm-renew-modal"),leaveEmailModal:document.getElementById("frm-leave-email-modal"),leaveEmailModalInput:document.getElementById("frm_leave_email"),leaveEmailModalApiEmailForm:document.getElementById("frmapi-email-form"),leaveEmailModalGetCodeButton:document.getElementById("frm-get-code-button"),codeFromEmailModal:document.getElementById("frm-code-from-email-modal"),codeFromEmailModalInput:document.getElementById("frm_code_from_email"),upgradeModal:document.getElementById("frm-form-upgrade-modal"),upgradeModalTemplateNames:null==te?void 0:te.querySelectorAll(".frm-upgrade-modal-template-name"),upgradeModalPlansIcons:null==te?void 0:te.querySelectorAll(".frm-upgrade-modal-plan-icon"),upgradeModalLink:document.getElementById("frm-upgrade-modal-link"),newTemplateForm:document.getElementById("frm-new-template"),newTemplateNameInput:document.getElementById("frm_template_name"),newTemplateDescriptionInput:document.getElementById("frm_template_desc"),newTemplateLinkInput:document.getElementById("frm_link"),newTemplateActionInput:document.getElementById("frm_action_type"),bodyContentChildren:null==Jt?void 0:Jt.children});var ee,re=window.frmDom,ne=re.tag,oe=re.div,ae=re.span,ie=re.a,ce=re.img,le="".concat(Q,"/images/applications/thumbnails");var ue=window.frmFormTemplatesVars,se=ue.templatesCount,fe=ue.favoritesCount,pe=ue.customCount,me=gt(),de=me.availableTemplateItems,he=me.freeTemplateItems,ye=me.firstLockedFreeTemplate,ve=de.length;Ot({availableTemplatesCount:ve,customCount:Number(pe),extraTemplatesCount:se-ve,favoritesCount:fe,freeTemplatesCount:he.length,selectedTemplate:ye});function ge(t){return ge="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},ge(t)}function be(){be=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 x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==r&&n.call(E,i)&&(w=E);var S=b.prototype=v.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(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"==ge(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 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=k(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 k(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,k(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 j(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 A(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),j(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;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function we(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 xe(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){we(a,n,o,i,c,"next",t)}function c(t){we(a,n,o,i,c,"throw",t)}i(void 0)}))}}var Ee=null;function Se(){return(Se=xe(be().mark((function t(){var e,r,n;return be().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=window.frmAdminBuild,r=e.initModal,n=e.offsetModalY,(Ee=r("#frm-form-templates-modal",m))&&n(Ee,"103px"),Gt("free-templates")&&(gt().leaveEmailModal&&yr()),Te(),wp.hooks.addAction("frmAdmin.beforeOpenConfirmModal","frmFormTemplates",(function(t){var e=t.$info;e.dialog("option","width",d),n(e,"103px")}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function _e(){return Ee}function Te(){return Le.apply(this,arguments)}function Le(){return Le=xe(be().mark((function t(){var e,r,n,o,a,i,c,l,u;return be().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=gt(),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)'),bt({leaveEmailModalHiddenForm:l,leaveEmailModalHiddenInput:u});case 27:case"end":return t.stop()}}),t,null,[[4,13]])}))),Le.apply(this,arguments)}function ke(t){var e=gt().pageTitleText,r=t||kt("selectedCategoryEl").querySelector(".".concat(h,"-cat-text")).textContent;e.textContent=r}var Oe=function(t){return!!zt(t)&&t.classList.contains("".concat(c,"-favorite-item"))},je=function(t){return!!zt(t)&&t.classList.contains("".concat(c,"-custom-item"))},Ie={},Ae=function(){var t=gt(),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)},Ce=".".concat(c,"-item-favorite-button"),Pe="".concat(Ce," use"),Fe="#frm_heart_solid_icon",Be="#frm_heart_icon",Ne=function(t){var e,r=t.currentTarget,n=gt(),o=n.templatesList,i=n.featuredTemplatesList,l=n.favoritesCategoryCountEl,u=n.customTemplatesTitle,f=r.closest(".frm-card-item"),p=f.dataset.id,m=Oe(f),d=je(f),h=function(t){return!!zt(t)&&a.includes(Number(t.dataset.id))}(f),y=null;if(f.classList.toggle("".concat(c,"-favorite-item"),!m),h){var v=f.closest("#".concat(c,"-list"))?i:o;v&&(y=v.querySelector('.frm-card-item[data-id="'.concat(p,'"]'))).classList.toggle("".concat(c,"-favorite-item"),!m)}var g,b=Lt(),w=b.selectedCategory,x=b.favoritesCount,E=m?"remove":"add",S=f.querySelector(Pe),_=null===(e=y)||void 0===e?void 0:e.querySelector(Pe);"add"===E?(++x.total,d?++x.custom:++x.default,S.setAttribute("xlink:href",Fe),null==_||_.setAttribute("xlink:href",Fe)):(--x.total,d?--x.custom:--x.default,S.setAttribute("xlink:href",Be),null==_||_.setAttribute("xlink:href",Be)),l.textContent=x.total,jt("favoritesCount",x),s===w&&(0===x.total&&ir(),Ut(f),0===x.default&&Ut(o),0!==x.custom&&0!==x.default||Ut(u)),g=function(){return t=p,e=E,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(g).catch(g)},De=function(t){var e=t.currentTarget,r=e.closest(".frm-card-item"),n=function(t){return!!zt(t)&&t.classList.contains("".concat(c,"-locked-item"))}(r),o=je(r);if(n||!o)if(t.preventDefault(),jt("selectedTemplate",r),n)!function(t){var e=t.dataset.requiredPlan;switch(e){case"basic":case"plus":case"business":case"elite":dr(e,t);break;case"renew":hr();break;case"free":yr()}}(r);else{var a=gt(),i=a.newTemplateForm,l=a.newTemplateNameInput,u=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";l.value=m,u.value=d,f.value=h,s.value=e.href,p(i,h,e)}},Me=window.frmDom.search.init;function qe(t,e){var r=t.foundSomething,n=t.notEmptySearchText;if(!e||"search"!==e.type||""!==e.target.value){var o=Lt(),a=gt().allItemsCategory;jt("notEmptySearchText",n),o.notEmptySearchText||o.selectedCategory?(o.selectedCategory&&(function(t){var e=gt(),r=e.bodyContent,n=e.bodyContentChildren,o=e.pageTitle,a=e.templatesList,i=e.applicationTemplates,c=new Ft(r);t&&kt("selectedCategoryEl").classList.remove(nt),Ht(n),ke(X("Search Result","formidable")),Yt([o,a,i]),c.fadeIn()}(n),n&&jt("selectedCategory","")),function(t){if(t){var e,r=gt().emptyState;if(e=r,"none"!==window.getComputedStyle(e).getPropertyValue("display")){var n=gt().pageTitle;Ut(r),$t(n)}var o=gt(),a=o.templatesList,i=o.applicationTemplates,c=o.applicationTemplatesTitle,l=o.applicationTemplatesList;Yt([a,i,c]),0===a.offsetHeight&&Ht([a,c]),0===(null==l?void 0:l.offsetHeight)&&Ut(i)}else!function(){var t,e=Lt().notEmptySearchText,r=gt(),n=r.pageTitle,o=r.emptyState,a=r.emptyStateButton,i=r.applicationTemplates;if(p!==(null===(t=o.dataset)||void 0===t?void 0:t.view)){o.setAttribute("data-view",p);var c=gt(),l=c.emptyStateTitle,u=c.emptyStateText;l.textContent=X("No templates found","formidable"),u.textContent=X("Sorry, we didn't find any templates that match your criteria.","formidable"),a.textContent=X("Start from Scratch","formidable"),Ht([n,i]),Yt([o,a])}else e?($t(o),Ht([n,i])):(Ut(o),o.removeAttribute("data-view"))}()}(r)):a.dispatchEvent(new Event("click",{bubbles:!0}))}}var Ge=function(){var t,e=gt().emptyState;p===(null===(t=e.dataset)||void 0===t?void 0:t.view)&&(jt("selectedCategory",""),Vt(),gt().searchInput.focus())},Re=function(){var t=Lt().selectedCategory;f===t&&gr()},ze=function(){var t=gt().createTemplateFormsDropdown,e=t.value;if(e&&"no-forms"!==e){Ye(!1);var r=t.options[t.selectedIndex],n=r.dataset.description.trim(),o=r.dataset.name.trim(),a=" ".concat(X("Template","formidable"));o.endsWith(a)||(o+=a);var i=gt(),c=i.createTemplateName,l=i.createTemplateDescription;c.value=o,l.value=n}else Ye(!0)},Ye=function(t){var e=gt(),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)},He=function(){var t=window.frmAdminBuild.installNewForm,e="frm_create_template",r=gt(),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 $e(t){return $e="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},$e(t)}function Ue(){Ue=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 x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==r&&n.call(E,i)&&(w=E);var S=b.prototype=v.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(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"==$e(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 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=k(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 k(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,k(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 j(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 A(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),j(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;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Ze(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 Ke=function(){var t,e=(t=Ue().mark((function t(){var e,r,n,o,a,i,c,l,u,s,f,p,m;return Ue().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=gt(),n=r.leaveEmailModalInput,o=n.value.trim()){t.next=5;break}return br("empty"),t.abrupt("return");case 5:if(Rt(o)){t.next=8;break}return br("invalid"),t.abrupt("return");case 8:if(a=gt(),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?vr():br("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){Ze(a,n,o,i,c,"next",t)}function c(t){Ze(a,n,o,i,c,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();function Ve(t){return Ve="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},Ve(t)}function Je(){Je=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 x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==r&&n.call(E,i)&&(w=E);var S=b.prototype=v.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(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"==Ve(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 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=k(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 k(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,k(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 j(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 A(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),j(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;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(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 We=function(){var t,e=(t=Je().mark((function t(){var e,r,n,o,a,i,l,u,s,f,p,m;return Je().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=gt(),r=e.codeFromEmailModalInput,n=r.value.trim()){t.next=5;break}return wr("empty"),t.abrupt("return");case 5:return o=Lt(),a=o.selectedTemplate,(i=new FormData).append("action","template_api_signup"),i.append("nonce",tt),i.append("code",n),i.append("key",a.dataset.key),t.prev=11,t.next=14,fetch(ajaxurl,{method:"POST",body:i});case 14:return u=t.sent,t.next=17,u.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 f=(null===(s=l)||void 0===s||null===(s=s.data)||void 0===s?void 0:s[0])||{},p=f.message,wr(p?"custom":"invalid",p),$t(document.getElementById("frm_code_from_email_options")),t.abrupt("return");case 30:if(!Gt("free-templates")){t.next=33;break}return window.location.href=(qt.delete("free-templates"),Mt.search=qt.toString(),Mt.toString()),t.abrupt("return");case 33:if(l.data&&l.data.url){t.next=35;break}return t.abrupt("return");case 35:a.classList.remove("".concat(c,"-locked-item")),(m=a.querySelector(".frm-form-templates-use-template-button")).setAttribute("href",l.data.url),m.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){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)}}(),Qe=function(){var t=gt(),e=t.leaveEmailModal,r=t.codeFromEmailModal;Ut(r),$t(e)},tr=function(){var t=gt(),e=t.codeFromEmailModalInput,r=t.leaveEmailModalGetCodeButton;e.value="",Ht(document.querySelectorAll("#frm_code_from_email_options, #frm_code_from_email_error")),r.dispatchEvent(new Event("click",{bubbles:!0}))},er=function(t){if(!t.target.closest("a")){var e=t.currentTarget;window.location.href=e.dataset.href}};function rr(){var t,e,r,n,o,a,i,p,m;gt().categoryItems.forEach((function(t){Dt(t,Zt),t.addEventListener("keydown",Kt)})),wp.hooks.addAction("frmPage.onCategoryClick","frmFormTemplates",(function(t){!function(t){var e=gt(),r=e.bodyContentChildren,n=e.pageTitle,o=e.showCreateTemplateModalButton,a=e.templatesList,i=e.templateItems;switch(y!==t&&Ht(r),ke(),Ut(o),$t(n),t){case y:!function(){var t=gt(),e=t.bodyContentChildren,r=t.pageTitleDivider,n=t.templateItems,o=t.twinFeaturedTemplateItems,a=t.customTemplatesSection,i=t.emptyState,c=t.applicationTemplates;Yt([].concat(or(e),or(n))),Ht([r].concat(or(o),[a,i,c]))}();break;case l:!function(){if(0!==Lt().availableTemplatesCount){var t=gt(),e=t.templatesList,r=t.templateItems,n=t.availableTemplateItems;Ht(r),Yt([e].concat(or(n)))}else!function(){var t=gt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",l);var o=gt(),a=o.emptyStateTitle,i=o.emptyStateText,c=Lt().extraTemplatesCount;a.textContent=X("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(u).filter((function(t){return!Oe(t)}));Ht(p),s.push(a),s.push(l),0===t.default?Ut(i):s.push(i)}Yt(s)}else ir()}();break;case f:!function(){if(0!==Lt().customCount){var t=gt(),e=t.showCreateTemplateModalButton,r=t.pageTitleDivider,n=t.customTemplatesSection,o=t.customTemplatesList,a=t.customTemplatesTitle,i=t.customTemplateItems;Ut(a),Yt([e,r,n,o].concat(or(i)))}else!function(){var t=gt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",f);var o=gt(),a=o.emptyStateTitle,i=o.emptyStateText;a.textContent=X("You currently have no templates.","formidable"),i.textContent=X("You haven't created any form templates. Begin now to simplify your workflow and save time.","formidable"),n.textContent=X("Create Template","formidable"),Ut(e),Yt([r,n])}()}();break;default:Ht(i),Yt([a].concat(or(Ie[t])))}}(t)})),m=gt().createFormButton,Dt(m,Ae),document.querySelectorAll(Ce).forEach((function(t){return Dt(t,Ne)})),document.querySelectorAll(".".concat(c,"-use-template-button")).forEach((function(t){return t.addEventListener("click",De)})),a=gt(),i=a.searchInput,p=a.emptyStateButton,Me(i,"frm-card-item",{handleSearchResult:qe}),Dt(p,Ge),function(){var t=gt(),e=t.createTemplateFormsDropdown,r=t.createTemplateButton,n=t.showCreateTemplateModalButton,o=t.emptyStateButton;Dt(n,Re),Dt(o,Re),e.addEventListener("change",ze),Dt(r,He)}(),o=gt().leaveEmailModalGetCodeButton,Dt(o,Ke),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"),Dt(t,We),Dt(e,Qe),Dt(r,Qe),Dt(n,tr)}function nr(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,o=t.hasLiteThumbnail,a=t.isWebp,i=o?a?"".concat(le,"/").concat(r,".webp"):"".concat(le,"/").concat(r,".png"):"".concat(le,"/placeholder.svg");return ne("li",{className:"frm-card-item",data:{href:"".concat(n,"&triggerViewApplicationModal=1&template=").concat(r),"frm-search-text":e.toLowerCase()},children:[oe({className:"".concat(c,"-item-icon"),child:ce({src:i})}),oe({className:"".concat(c,"-item-body"),children:[ae({text:X("Ready Made Solution","formidable"),className:"frm-meta-tag frm-orange-tag frm-text-xs"}),ne("h3",{text:e,className:"frm-text-sm frm-font-medium frm-m-0"}),ie({text:X("See all applications","formidable"),className:"frm-text-xs frm-font-semibold",href:n})]})]})}(t)}));ee=oe({id:"".concat(c,"-applications"),className:et,children:[ne("h2",{text:X("Application Templates"),className:"frm-text-sm frm-mb-sm"}),ne("ul",{className:"".concat(c,"-list frm-list-grid-layout"),children:e})]})}})(t.templates),(e=gt()).applicationTemplates||void 0===ee||(e.bodyContent.appendChild(ee),bt({applicationTemplates:ee,applicationTemplatesTitle:ee.querySelector("h2"),applicationTemplatesList:ee.querySelector(".".concat(c,"-list")),applicationTemplateItems:ee.querySelectorAll(".frm-card-item")})),void 0!==(r=gt().applicationTemplateItems)&&r.forEach((function(t){t.addEventListener("click",er)}))}function or(t){return function(t){if(Array.isArray(t))return ar(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 ar(t,e);var r={}.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)?ar(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 ar(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=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),j(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;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function ur(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 sr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){ur(a,n,o,i,c,"next",t)}function c(t){ur(a,n,o,i,c,"throw",t)}i(void 0)}))}}var fr,pr=function(t){return sr(lr().mark((function e(){var r,n,o,a,i,c,l=arguments;return lr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=_e()){e.next=3;break}return e.abrupt("return");case 3:for(n=gt(),o=n.modalItems,Ht(o),r.dialog("option","width",m),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):"";l.href=i+u,$t(o)})),hr=pr((function(){var t=gt().renewAccountModal;$t(t)})),yr=pr((function(){var t=gt().leaveEmailModal;$t(t)})),vr=pr((function(){var t=gt().codeFromEmailModal;$t(t)})),gr=pr((function(){_e().dialog("option","width",d);var t=gt().createTemplateModal;$t(t)})),br=function(t){Nt("#frm_leave_email","#frm_leave_email_error",t)},wr=function(t,e){Nt("#frm_code_from_email","#frm_code_from_email_error",t,e)},xr=function(){e&&(0,frmDom.ajax.doJsonFetch)("get_applications_data&view=templates").then(nr),function(){Se.apply(this,arguments)}(),gt().templateItems.forEach((function(t){t.getAttribute("data-categories").split(",").forEach((function(e){Ie[e]||(Ie[e]=[]),Ie[e].push(t)}))})),function(){var t=gt(),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="",Ht(o),a){var l=Lt().availableTemplatesCount;a.querySelector(".".concat(h,"-cat-count")).textContent=l}var u=Lt().freeTemplatesCount;i.querySelector(".".concat(h,"-cat-count")).textContent=u,0===u&&Ut(i);var s,f=gt().extraTemplateCountElements,p=Lt().extraTemplatesCount;f.forEach((function(t){return t.textContent=p})),n.classList.remove(rt),e.classList.remove(rt),c.fadeIn(),$t(e),Gt("return_page")&&(s=gt().headerCancelButton,new Ft(s).fadeIn())}(),rr()};fr=function(){wp.hooks.doAction("frmFormTemplates.beforeInitialize",{getState:Lt,setState:Ot}),xr(),wp.hooks.doAction("frmFormTemplates.afterInitialize",{getState:Lt,setState:Ot}),wp.hooks.doAction("frm_new_form_modal_form",jQuery("#frm-new-template"))},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",fr):fr())}()}(); \ No newline at end of file diff --git a/js/src/form-templates/elements/applicationTemplatesElement.js b/js/src/form-templates/elements/applicationTemplatesElement.js index af01e2750f..4ae47c9674 100644 --- a/js/src/form-templates/elements/applicationTemplatesElement.js +++ b/js/src/form-templates/elements/applicationTemplatesElement.js @@ -60,9 +60,9 @@ export function createApplicationTemplates( applications ) { * @return {HTMLElement} Element representing a single application template. */ function createTemplateItem( template ) { - const { name, key, hasLiteThumbnail } = template; + const { name, key, hasLiteThumbnail, isWebp } = template; const thumbnailURL = hasLiteThumbnail ? - `${thumbnailBaseURL}/${key}.png` : + ( isWebp ? `${thumbnailBaseURL}/${key}.webp` : `${thumbnailBaseURL}/${key}.png` ) : `${thumbnailBaseURL}/placeholder.svg`; return tag( 'li', { diff --git a/tests/cypress/e2e/Form Templates/FormTemplates.cy.js b/tests/cypress/e2e/Form Templates/FormTemplates.cy.js index 10b2b4a680..e5c25dfc3d 100644 --- a/tests/cypress/e2e/Form Templates/FormTemplates.cy.js +++ b/tests/cypress/e2e/Form Templates/FormTemplates.cy.js @@ -211,7 +211,7 @@ describe("Form Templates page", () => { .within(() => { cy.get('div.frm-form-templates-item-icon img') .should('have.attr', 'src') - .and('include', 'placeholder.svg'); + .and('include', 'business-directory.png'); cy.get('span.frm-meta-tag.frm-orange-tag') .should('have.text', 'Ready Made Solution');