-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathform-templates.js
More file actions
2 lines (2 loc) · 65.9 KB
/
form-templates.js
File metadata and controls
2 lines (2 loc) · 65.9 KB
1
2
/*! For license information please see form-templates.js.LICENSE.txt */
(()=>{var t={8616: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<l;i++)if(c.args[i]!==arguments[i]){c=c.next;continue t}return c!==r&&(c===n&&(n=c.prev),c.prev.next=c.next,c.next&&(c.next.prev=c.prev),c.next=r,c.prev=null,r.prev=c,r=c),c.val}c=c.next}for(a=new Array(l),i=0;i<l;i++)a[i]=arguments[i];return c={args:a,val:t.apply(null,a)},r?(r.prev=c,c.next=r):n=c,o===e.maxSize?(n=n.prev).next=null:o++,r=c,c.val}return e=e||{},a.clear=function(){r=null,n=null,o=0},a}},7604:(t,e,r)=>{var n;!function(){"use strict";var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function a(t){return function(t,e){var r,n,i,c,l,u,s,f,m,p=1,d=t.length,h="";for(n=0;n<d;n++)if("string"==typeof t[n])h+=t[n];else if("object"==typeof t[n]){if((c=t[n]).keys)for(r=e[p],i=0;i<c.keys.length;i++){if(null==r)throw new Error(a('[sprintf] Cannot access property "%s" of undefined value "%s"',c.keys[i],c.keys[i-1]));r=r[c.keys[i]]}else r=c.param_no?e[c.param_no]:e[p++];if(o.not_type.test(c.type)&&o.not_primitive.test(c.type)&&r instanceof Function&&(r=r()),o.numeric_arg.test(c.type)&&"number"!=typeof r&&isNaN(r))throw new TypeError(a("[sprintf] expecting number but found %T",r));switch(o.number.test(c.type)&&(f=r>=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?m="":(m=f?"+":"-",r=r.toString().replace(o.sign,"")),u=c.pad_char?"0"===c.pad_char?"0":c.pad_char.charAt(1):" ",s=c.width-(m+r).length,l=c.width&&s>0?u.repeat(s):"",h+=c.align?m+r+l:"0"===u?m+l+r:l+m+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=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(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=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=window.frmGlobal,e=t.canAccessApplicationDashboard,n=t.applicationsUrl,o=window.frmFormTemplatesVars,a=o.FEATURED_TEMPLATES_IDS,i=o.FREE_TEMPLATES_IDS,c=o.upgradeLink,l="frm-form-templates",u="available-templates",s="favorites",f="custom",m="search",p="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<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?v(Object(r),!0).forEach((function(e){b(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function b(t,e,r){return(e=function(t){var e=function(t){if("object"!=w(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==w(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function w(t){return w="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},w(t)}var S,x,E,_,T=r(8616),L=r.n(T),O=r(7604),j=r.n(O),k=L()(console.error);function I(t){return I="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},I(t)}function A(t){var e=function(t){if("object"!=I(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==I(e)?e:e+""}S={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},x=["(","?"],E={")":["("],":":["?","?:"]},_=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;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<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){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 D(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?B(Object(r),!0).forEach((function(e){var n,o,a;n=t,o=e,a=r[e],(o=A(o))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):B(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}F.prototype.getPluralForm=function(t,e){var r,n,o,a,i=this.pluralForms[t];return i||("function"!=typeof(o=(r=this.data[t][""])["Plural-Forms"]||r["plural-forms"]||r.plural_forms)&&(n=function(t){var e,r,n;for(e=t.split(";"),r=0;r<e.length;r++)if(0===(n=e[r].trim()).indexOf("plural="))return n.substr(7)}(r["Plural-Forms"]||r["plural-forms"]||r.plural_forms),a=function(t){var e=function(t){for(var e,r,n,o,a=[],i=[];e=t.match(_);){for(r=e[0],(n=t.substr(0,e.index).trim())&&a.push(n);o=i.pop();){if(E[r]){if(E[r][0]===o){r=E[r][1]||r;break}}else if(x.indexOf(o)>=0||S[o]<S[r]){i.push(o);break}a.push(o)}E[r]||i.push(r),t=t.substr(e.index+r.length)}return(t=t.trim())&&a.push(t),a.concat(i.reverse())}(t);return function(t){return function(t,e){var r,n,o,a,i,c,l=[];for(r=0;r<t.length;r++){if(i=t[r],a=C[i]){for(n=a.length,o=Array(n);n--;)o[n]=l.pop();try{c=a.apply(null,o)}catch(t){return t}}else c=e.hasOwnProperty(i)?e[i]:+i;l.push(c)}return l[0]}(e,t)}}(n),o=function(t){return+a({n:t})}),i=this.pluralForms[t]=o),i(e)},F.prototype.dcnpgettext=function(t,e,r,n,o){var a,i,c;return a=void 0===o?0:this.getPluralForm(t,o),i=r,e&&(i=e+this.options.contextDelimiter+r),(c=this.data[t][i])&&c[a]?c[a]:(this.options.onMissingKey&&this.options.onMissingKey(r,t),0===a?r:n)};var N={"":{plural_forms:function(t){return 1===t?0:1}}},M=/^i18n\.(n?gettext|has_translation)(_|$)/;const q=function(t){return"string"!=typeof t||""===t?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(t)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)},G=function(t){return"string"!=typeof t||""===t?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(t)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(t)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)},R=function(t,e){return function(r,n,o){var a=arguments.length>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}},V=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;l<i;l++)c[l-1]=arguments[l];if(!a||!a.length)return r?c[0]:void 0;var u={name:n,currentIndex:0};for(o.__current.push(u);u.currentIndex<a.length;){var s=a[u.currentIndex].callback.apply(null,c);r&&(c[0]=s),u.currentIndex++}return o.__current.pop(),r?c[0]:void 0}},$=function(t,e){return function(){var r,n,o=t[e];return null!==(r=null===(n=o.__current[o.__current.length-1])||void 0===n?void 0:n.name)&&void 0!==r?r:null}},U=function(t,e){return function(r){var n=t[e];return void 0===r?void 0!==n.__current[0]:!!n.__current[0]&&r===n.__current[0].name}},H=function(t,e){return function(r){var n=t[e];if(G(r))return n[r]&&n[r].runs?n[r].runs:0}};var Z=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=R(this,"actions"),this.addFilter=R(this,"filters"),this.removeAction=z(this,"actions"),this.removeFilter=z(this,"filters"),this.hasAction=Y(this,"actions"),this.hasFilter=Y(this,"filters"),this.removeAllActions=z(this,"actions",!0),this.removeAllFilters=z(this,"filters",!0),this.doAction=V(this,"actions"),this.applyFilters=V(this,"filters",!0),this.currentAction=$(this,"actions"),this.currentFilter=$(this,"filters"),this.doingAction=U(this,"actions"),this.doingFilter=U(this,"filters"),this.didAction=H(this,"actions"),this.didFilter=H(this,"filters")},J=new Z,K=(J.addAction,J.addFilter,J.removeAction,J.removeFilter,J.hasAction,J.hasFilter,J.removeAllActions,J.removeAllFilters,J.doAction,J.applyFilters,J.currentAction,J.currentFilter,J.doingAction,J.doingFilter,J.didAction,J.didFilter,J.actions,J.filters,function(t,e,r){var n=new F({}),o=new Set,a=function(){o.forEach((function(t){return t()}))},i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";n.data[e]=D(D(D({},N),n.data[e]),t),n.data[e][""]=D(D({},N[""]),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,J));K.getLocaleData.bind(K),K.setLocaleData.bind(K),K.resetLocaleData.bind(K),K.subscribe.bind(K);var X=K.__.bind(K),W=(K._x.bind(K),K._n.bind(K),K._nx.bind(K),K.isRTL.bind(K),K.hasTranslation.bind(K),window.frmGlobal),Q=W.url,tt=(W.nonce,"frm_hidden"),et="frm-hide-js",rt="frm-current",nt=window.frmDom,ot=nt.tag,at=nt.div,it=nt.a,ct=nt.img;function lt(t){return lt="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},lt(t)}function ut(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 st(t,e,r){return(e=function(t){var e=function(t){if("object"!=lt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=lt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==lt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ft,mt=document.getElementById("post-body-content"),pt=document.getElementById("".concat(h,"-sidebar")),dt=((ft=it({className:"button button-primary frm-button-primary"})).setAttribute("role","button"),at({id:"".concat(h,"-empty-state"),className:"frm-flex-col frm-flex-center frm-gap-md ".concat(tt),children:[ct({src:"".concat(Q,"/images/page-skeleton/empty-state.svg"),alt:X("Empty State","formidable")}),at({className:"frmcenter",children:[ot("h2",{className:"".concat(h,"-title frm-mb-0")}),ot("p",{className:"".concat(h,"-text frm-mb-0")})]}),ft]}));null==mt||mt.appendChild(dt);var ht=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")}}(),yt=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;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ut(Object(r),!0).forEach((function(e){st(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({bodyContent:mt,sidebar:pt,searchInput:pt.querySelector(".frm-search-input"),categoryItems:pt.querySelectorAll(".".concat(h,"-cat")),allItemsCategory:pt.querySelector(".".concat(h,'-cat[data-category="').concat(y,'"]'))},ht)),vt=yt.getElements,gt=yt.addElements;function bt(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 wt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?bt(Object(r),!0).forEach((function(e){St(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function St(t,e,r){return(e=function(t){var e=function(t){if("object"!=xt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=xt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xt(t){return xt="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},xt(t)}var Et=vt().allItemsCategory,_t=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==xt(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"!==xt(t)||null===t)throw new Error("setState: newState must be a non-null object");e=wt(wt({},e),t)},setSingleState:function(t,r){Reflect.has(e,t)&&Reflect.set(e,t,r)}}}({notEmptySearchText:!1,selectedCategory:y,selectedCategoryEl:Et}),Tt=_t.getState,Lt=_t.getSingleState,Ot=_t.setState,jt=_t.setSingleState;function kt(t){return kt="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},kt(t)}function It(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,At(n.key),n)}}function At(t){var e=function(t){if("object"!=kt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=kt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==kt(e)?e:e+""}var Ct=function(){return t=function t(e){var r=arguments.length>1&&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<this.elements.length&&this.elements.forEach((function(e,r){return t(e,r)}))}}],e&&It(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),Pt=Promise.resolve(),Ft=frmDom,Bt=(Ft.div,Ft.span,Ft.tag,Ft.a,Ft.img,Ft.svg,frmDom.modal),Dt=(Bt.maybeCreateModal,Bt.footerButton,frmDom.util),Nt=Dt.onClickPreventDefault;function Mt(t){return Mt="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},Mt(t)}Dt.documentOn,frmDom.ajax.doJsonPost;var qt,Gt,Rt=new URL(window.location.href),zt=Rt.searchParams,Yt=function(t){return zt.delete(t),Rt.search=zt.toString(),Rt.toString()},Vt=function(t,e){var r,n,o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"pushState";if(zt.set(t,e),Rt.search=zt.toString(),["pushState","replaceState"].includes(a)){var i=(r={},o=e,(n=function(t){var e=function(t){if("object"!=Mt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=Mt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mt(e)?e:e+""}(n=t))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,r);window.history[a](i,"",Rt)}return Rt.toString()},$t=function(t){return zt.has(t)},Ut=function(t){return"string"==typeof t&&/^(([^<>()\[\]\\.,;:\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)},Ht=function(t){return t instanceof HTMLElement||console.warn("Invalid argument: Element must be an instance of HTMLElement")||!1},Zt=function(t){var e;return null===(e=Array.from(t))||void 0===e?void 0:e.forEach((function(t){return Kt(t)}))},Jt=function(t){var e;return null===(e=Array.from(t))||void 0===e?void 0:e.forEach((function(t){return Xt(t)}))},Kt=function(t){return null==t?void 0:t.classList.remove(tt)},Xt=function(t){return null==t?void 0:t.classList.add(tt)},Wt=function(t){var e=t.currentTarget,r=e.getAttribute("data-category"),n=Tt(),o=n.selectedCategory,a=n.selectedCategoryEl,i=n.notEmptySearchText;if(o!==r){o=wp.hooks.applyFilters("frmPage.selectedCategory",r),a.classList.remove(rt),(a=e).classList.add(rt),Ot({selectedCategory:o,selectedCategoryEl:a}),i&&te(),wp.hooks.doAction("frmPage.onCategoryClick",o);var c=vt().bodyContent;new Ct(c).fadeIn()}};function Qt(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Wt(t))}function te(){var t=vt().searchInput;t.value="",t.dispatchEvent(new Event("input",{bubbles:!0}))}var ee=vt().bodyContent,re=document.getElementById("".concat(l,"-list")),ne=document.getElementById("".concat(l,"-custom-list-section")),oe=document.querySelector(".".concat(h,'-cat[data-category="').concat(s,'"]')),ae=document.getElementById("".concat(l,"-modal"));gt({headerCancelButton:null===(qt=document.getElementById("frm-publishing"))||void 0===qt?void 0:qt.querySelector("a"),createFormButton:document.getElementById("".concat(l,"-create-form")),pageTitle:document.getElementById("".concat(l,"-page-title")),pageTitleText:document.getElementById("".concat(l,"-page-title-text")),pageTitleDivider:document.getElementById("".concat(l,"-page-title-divider")),upsellBanner:null!==(Gt=document.getElementById("frm-renew-subscription-banner"))&&void 0!==Gt?Gt:document.getElementById("frm-upgrade-banner"),extraTemplateCountElements:document.querySelectorAll(".".concat(l,"-extra-templates-count")),templatesList:re,templateItems:re.querySelectorAll(".frm-card-item"),availableTemplateItems:re.querySelectorAll(".frm-card-item:not(.".concat(l,"-locked-item)")),twinFeaturedTemplateItems:re.querySelectorAll(".".concat(l,"-featured-item")),featuredTemplatesList:document.getElementById("".concat(l,"-featured-list")),customTemplatesSection:ne,customTemplateItems:ne.querySelectorAll(".frm-card-item"),customTemplatesTitle:document.getElementById("".concat(l,"-custom-list-title")),customTemplatesList:document.getElementById("".concat(l,"-custom-list")),favoritesCategory:oe,favoritesCategoryCountEl:null==oe?void 0:oe.querySelector(".".concat(h,"-cat-count")),availableTemplatesCategory:document.querySelector(".".concat(h,'-cat[data-category="').concat(u,'"]')),getFreeTemplatesBannerButton:document.querySelector(".frm-get-free-templates-banner .button"),modal:ae,modalItems:null==ae?void 0:ae.querySelectorAll(".".concat(l,"-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"),leaveEmailModalButton:document.getElementById("frm-get-code-button"),upgradeModal:document.getElementById("frm-form-upgrade-modal"),upgradeModalTemplateNames:null==ae?void 0:ae.querySelectorAll(".frm-upgrade-modal-template-name"),upgradeModalPlansIcons:null==ae?void 0:ae.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==ee?void 0:ee.children});var ie,ce=window.frmDom,le=ce.tag,ue=ce.div,se=ce.span,fe=ce.a,me=ce.img,pe="".concat(Q,"/images/applications/thumbnails");var de=window.frmFormTemplatesVars,he=de.templatesCount,ye=de.favoritesCount,ve=de.customCount,ge=vt().availableTemplateItems.length;Ot({availableTemplatesCount:ge,customCount:Number(ve),extraTemplatesCount:he-ge,favoritesCount:ye}),window.frmDom.span;var be=function(t,e){return t.textContent=String(e),t},we=function(t,e,r,n,o,a,i){e._counterStartTime||(e._counterStartTime=t,e._counterLastTimestamp=t,e._counterFrameDropCount=0,e._counterLastValue=r);var c=t-e._counterLastTimestamp,l=t-e._counterStartTime;if(c>50&&null!==e._counterLastTimestamp&&(e._counterFrameDropCount++,e._counterFrameDropCount>3))return e.style.transition="opacity ".concat(Math.max(o-l,100),"ms ease-out"),e.textContent=String(n),void delete e._counterAnimation;var u=Math.min(l/o,1),s=i(u),f=Math.round(r+a*s);f!==e._counterLastValue&&(e.textContent=String(f),e._counterLastValue=f),e._counterLastTimestamp=t,u<1?e._counterAnimation=requestAnimationFrame((function(t){return we(t,e,r,n,o,a,i)})):(e.textContent=String(n),["_counterAnimation","_counterStartTime","_counterLastTimestamp","_counterFrameDropCount","_counterLastValue"].forEach((function(t){return delete e[t]})),e.style.removeProperty("transition"))},Se=function(t){return 1-Math.pow(1-t,4)};const xe=function(){var t,e=vt(),r=e.sidebar,n=e.searchInput,o=e.bodyContent,a=e.twinFeaturedTemplateItems,c=e.availableTemplatesCategory,l=e.extraTemplateCountElements,u=new Ct(o);n.value="",Jt(a),function(t){if(t){var e,r,n=Lt("availableTemplatesCount");if($t("registered-for-free-templates"))history.replaceState({},"",Yt("registered-for-free-templates")),e=t,r=n,setTimeout((function(){e.dispatchEvent(new Event("click",{bubbles:!0}))}),0),setTimeout((function(){!function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="string"==typeof t?document.querySelector(t):t;if(!(n&&n instanceof HTMLElement))return null;var o="number"==typeof e?e:parseInt(e,10);if(isNaN(o))return console.warn("Counter: Invalid value provided, defaulting to 0"),be(n,"0");if(0===o)return be(n,"0");var a=r.duration,i=void 0===a?3e3:a,c=r.easing,l=void 0===c?Se:c,u=parseInt(n.textContent,10)||0,s=o-u;0===s||(n._counterAnimation&&cancelAnimationFrame(n._counterAnimation),n.classList.add("frm-fadein"),n._counterAnimation=requestAnimationFrame((function(t){return we(t,n,u,o,i,s,l)})))}(e.querySelector(".".concat(h,"-cat-count")),r)}),150),setTimeout((function(){vt().availableTemplateItems.forEach((function(t){i.includes(Number(t.dataset.id))||(t.classList.add("frm-background-highlight"),t.addEventListener("animationend",(function t(e){"backgroundHighlight"===e.animationName&&(this.classList.remove("frm-background-highlight"),this.removeEventListener("animationend",t))})))}))}),750);else t.querySelector(".".concat(h,"-cat-count")).textContent=n}}(c),l.forEach((function(t){return t.textContent=Lt("extraTemplatesCount")})),o.classList.remove(et),r.classList.remove(et),u.fadeIn(),$t("return_page")&&(t=vt().headerCancelButton,new Ct(t).fadeIn())};function Ee(t){return Ee="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},Ee(t)}function _e(){_e=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),c=new I(n||[]);return o(i,"_invoke",{value:L(t,r,c)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var m="suspendedStart",p="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(A([])));x&&x!==r&&n.call(x,i)&&(w=x);var E=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"==Ee(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=m;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=O(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===m)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:p,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function O(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,O(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 j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,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<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(Ee(e)+" is not iterable")}return g.prototype=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},_(T.prototype),u(T.prototype,c,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new T(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},_(E),u(E,l,"Generator"),u(E,i,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=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<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw 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 Te(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 Le=null;function Oe(){var t;return t=_e().mark((function t(){var e,r,n;return _e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=window.frmAdminBuild,r=e.initModal,n=e.offsetModalY,(Le=r("#frm-form-templates-modal",p))&&n(Le,"103px"),$t("free-templates")&&vt().leaveEmailModal&&pr(),wp.hooks.addAction("frmAdmin.beforeOpenConfirmModal","frmFormTemplates",(function(t){var e=t.$info;e.dialog("option","width",d),n(e,"103px")}));case 5:case"end":return t.stop()}}),t)})),Oe=function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){Te(a,n,o,i,c,"next",t)}function c(t){Te(a,n,o,i,c,"throw",t)}i(void 0)}))},Oe.apply(this,arguments)}function je(){return Le}function ke(t){var e=vt().pageTitleText,r=t||Lt("selectedCategoryEl").querySelector(".".concat(h,"-cat-text")).textContent;e.textContent=r}var Ie=function(t){return!!Ht(t)&&t.classList.contains("".concat(l,"-favorite-item"))},Ae=function(t){return!!Ht(t)&&t.classList.contains("".concat(l,"-custom-item"))},Ce={},Pe=function(){var t=vt(),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)};var Fe=".".concat(l,"-item-favorite-button"),Be="".concat(Fe," use"),De="#frm_heart_solid_icon",Ne="#frm_heart_icon",Me=function(t){var e,r=t.currentTarget,n=vt(),o=n.templatesList,i=n.featuredTemplatesList,c=n.favoritesCategoryCountEl,u=n.customTemplatesTitle,f=r.closest(".frm-card-item"),m=f.dataset.id,p=Ie(f),d=Ae(f),h=function(t){return!!Ht(t)&&a.includes(Number(t.dataset.id))}(f),y=null;if(f.classList.toggle("".concat(l,"-favorite-item"),!p),h){var v=f.closest("#".concat(l,"-list"))?i:o;v&&(y=v.querySelector('.frm-card-item[data-id="'.concat(m,'"]'))).classList.toggle("".concat(l,"-favorite-item"),!p)}var g,b=Tt(),w=b.selectedCategory,S=b.favoritesCount,x=p?"remove":"add",E=f.querySelector(Be),_=null===(e=y)||void 0===e?void 0:e.querySelector(Be);"add"===x?(++S.total,d?++S.custom:++S.default,E.setAttribute("xlink:href",De),null==_||_.setAttribute("xlink:href",De)):(--S.total,d?--S.custom:--S.default,E.setAttribute("xlink:href",Ne),null==_||_.setAttribute("xlink:href",Ne)),c.textContent=S.total,jt("favoritesCount",S),s===w&&(0===S.total&&or(),Xt(f),0===S.default&&Xt(o),0!==S.custom&&0!==S.default||Xt(u)),g=function(){return t=m,e=x,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},Pt=Pt.then(g).catch(g)};var qe=function(t){var e=t.currentTarget,r=e.closest(".frm-card-item"),n=function(t){return!!Ht(t)&&t.classList.contains("".concat(l,"-locked-item"))}(r),o=Ae(r);if(n||!o)if(t.preventDefault(),n)!function(t){var e=t.dataset.requiredPlan;switch(e){case"basic":case"plus":case"business":case"elite":fr(e,t);break;case"renew":mr();break;case"free":pr()}}(r);else{var a=vt(),i=a.newTemplateForm,c=a.newTemplateNameInput,u=a.newTemplateDescriptionInput,s=a.newTemplateLinkInput,f=a.newTemplateActionInput,m=window.frmAdminBuild.installNewForm,p=r.querySelector(".frm-form-template-name").textContent.trim(),d=r.querySelector(".frm-form-templates-item-description").textContent.trim(),h="frm_install_template";c.value=p,u.value=d,f.value=h,s.value=e.href,m(i,h,e)}};var Ge=window.frmDom.search.init;function Re(t,e){var r=t.foundSomething,n=t.notEmptySearchText;if(!e||"search"!==e.type||""!==e.target.value){var o=Tt(),a=vt().allItemsCategory;jt("notEmptySearchText",n),o.notEmptySearchText||o.selectedCategory?(o.selectedCategory&&(function(t){var e=vt(),r=e.bodyContent,n=e.bodyContentChildren,o=e.pageTitle,a=e.templatesList,i=e.applicationTemplates,c=new Ct(r);t&&Lt("selectedCategoryEl").classList.remove(rt),Jt(n),ke(X("Search Result","formidable")),Zt([o,a,i]),c.fadeIn()}(n),n&&jt("selectedCategory","")),function(t){if(t){var e,r=vt().emptyState;if(e=r,"none"!==window.getComputedStyle(e).getPropertyValue("display")){var n=vt().pageTitle;Xt(r),Kt(n)}var o=vt(),a=o.templatesList,i=o.applicationTemplates,c=o.applicationTemplatesTitle,l=o.applicationTemplatesList;Zt([a,i,c]),0===a.offsetHeight&&Jt([a,c]),0===(null==l?void 0:l.offsetHeight)&&Xt(i)}else!function(){var t,e=Tt().notEmptySearchText,r=vt(),n=r.pageTitle,o=r.emptyState,a=r.emptyStateButton,i=r.applicationTemplates;if(m!==(null===(t=o.dataset)||void 0===t?void 0:t.view)){o.setAttribute("data-view",m);var c=vt(),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"),Jt([n,i]),Zt([o,a])}else e?(Kt(o),Jt([n,i])):(Xt(o),o.removeAttribute("data-view"))}()}(r)):a.dispatchEvent(new Event("click",{bubbles:!0}))}}var ze=function(){var t,e=vt().emptyState;m===(null===(t=e.dataset)||void 0===t?void 0:t.view)&&(jt("selectedCategory",""),te(),vt().searchInput.focus())};var Ye=function(){var t=Tt().selectedCategory;f===t&&dr()},Ve=function(){var t=vt().createTemplateFormsDropdown,e=t.value;if(e&&"no-forms"!==e){$e(!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=vt(),c=i.createTemplateName,l=i.createTemplateDescription;c.value=o,l.value=n}else $e(!0)},$e=function(t){var e=vt(),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)},Ue=function(){var t=window.frmAdminBuild.installNewForm,e="frm_create_template",r=vt(),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 He(t){return He="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},He(t)}function Ze(){Ze=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 m="suspendedStart",p="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(A([])));x&&x!==r&&n.call(x,i)&&(w=x);var E=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"==He(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=m;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=O(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===m)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:p,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function O(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,O(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 j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,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<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(He(e)+" is not iterable")}return g.prototype=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},_(T.prototype),u(T.prototype,c,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new T(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},_(E),u(E,l,"Generator"),u(E,i,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=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<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw 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 Je(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=window.frmDom.tag,Xe=function(){var t,e=(t=Ze().mark((function t(){var e,r,n,o,a,i,c,l;return Ze().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=vt(),r=e.leaveEmailModalInput,n=r.value.trim()){t.next=5;break}return hr("empty"),t.abrupt("return");case 5:if(Ut(n)){t.next=8;break}return hr("invalid"),t.abrupt("return");case 8:return o=vt(),(a=o.leaveEmailModalButton).style.setProperty("cursor","not-allowed"),a.classList.add("frm_loading_button"),(i=new FormData).append("email",n),l=frmDom.ajax.doJsonPost,t.prev=14,t.next=17,l("get_free_templates",i);case 17:c=t.sent,t.next=25;break;case 20:return t.prev=20,t.t0=t.catch(14),console.error("An error occurred:",t.t0),We(),t.abrupt("return");case 25:if(c.success){t.next=28;break}return We(),t.abrupt("return");case 28:$t("free-templates")&&Yt("free-templates"),Vt("registered-for-free-templates","1"),window.location.reload();case 31:case"end":return t.stop()}}),t,null,[[14,20]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){Je(a,n,o,i,c,"next",t)}function c(t){Je(a,n,o,i,c,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();function We(){var t=vt().leaveEmailModal;t.querySelector(".inside").replaceChildren(Ke("p",X("Failed to get templates, please try again later.","formidable"))),t.querySelector(".frm_modal_footer").classList.add("frm_hidden")}var Qe=function(t){if(!t.target.closest("a")){var e=t.currentTarget;window.location.href=e.dataset.href}};function tr(){var t,e,r,n;vt().categoryItems.forEach((function(t){Nt(t,Wt),t.addEventListener("keydown",Qt)})),wp.hooks.addAction("frmPage.onCategoryClick","frmFormTemplates",(function(t){!function(t){var e=vt(),r=e.bodyContentChildren,n=e.pageTitle,o=e.showCreateTemplateModalButton,a=e.templatesList,i=e.templateItems,c=e.upsellBanner;switch(y!==t&&Jt(r),ke(),Xt(o),Kt(n),t){case y:!function(){var t=vt(),e=t.bodyContentChildren,r=t.pageTitleDivider,n=t.templateItems,o=t.twinFeaturedTemplateItems,a=t.customTemplatesSection,i=t.emptyState,c=t.applicationTemplates;Zt([].concat(rr(e),rr(n))),Jt([r].concat(rr(o),[a,i,c]))}();break;case u:!function(){if(0!==Tt().availableTemplatesCount){var t=vt(),e=t.templatesList,r=t.templateItems,n=t.availableTemplateItems,o=t.upsellBanner;Jt(r),Zt([o,e].concat(rr(n)))}else!function(){var t=vt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",u);var o=vt(),a=o.emptyStateTitle,i=o.emptyStateText,c=Tt().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;n<e;n++)r[n-1]=arguments[n];return j().sprintf.apply(j(),[t].concat(r))}catch(e){return k("sprintf error: \n\n"+e.toString()),t}}(X("Upgrade to PRO for %s+ options or explore Free Templates.","formidable"),c),Jt([e,n]),Kt(r)}()}();break;case s:!function(){var t=Tt().favoritesCount;if(0!==t.total){var e=vt(),r=e.bodyContent,n=e.templatesList,o=e.templateItems,a=e.customTemplatesSection,i=e.customTemplatesTitle,c=e.customTemplatesList,u=e.customTemplateItems;Jt(o);var s=[],f=r.querySelectorAll(".".concat(l,"-favorite-item"));if(s.push.apply(s,rr(f)),t.default>0&&s.push(n),t.custom>0){var m=Array.from(u).filter((function(t){return!Ie(t)}));Jt(m),s.push(a),s.push(c),0===t.default?Xt(i):s.push(i)}Zt(s)}else or()}();break;case f:!function(){if(0!==Tt().customCount){var t=vt(),e=t.showCreateTemplateModalButton,r=t.pageTitleDivider,n=t.customTemplatesSection,o=t.customTemplatesList,a=t.customTemplatesTitle,i=t.customTemplateItems;Xt(a),Zt([e,r,n,o].concat(rr(i)))}else!function(){var t=vt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",f);var o=vt(),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"),Xt(e),Zt([r,n])}()}();break;default:Jt(i),Zt([c,a].concat(rr(Ce[t])))}}(t)})),n=vt().createFormButton,Nt(n,Pe),document.querySelectorAll(Fe).forEach((function(t){return Nt(t,Me)})),document.querySelectorAll(".".concat(l,"-use-template-button")).forEach((function(t){return t.addEventListener("click",qe)})),t=vt(),e=t.searchInput,r=t.emptyStateButton,Ge(e,"frm-card-item",{handleSearchResult:Re}),Nt(r,ze),function(){var t=vt(),e=t.createTemplateFormsDropdown,r=t.createTemplateButton,n=t.showCreateTemplateModalButton,o=t.emptyStateButton;Nt(n,Ye),Nt(o,Ye),e.addEventListener("change",Ve),Nt(r,Ue)}(),function(){var t=vt(),e=t.leaveEmailModalButton,r=t.getFreeTemplatesBannerButton;Nt(e,Xe),Nt(r,pr)}()}function er(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(pe,"/").concat(r,".webp"):"".concat(pe,"/").concat(r,".png"):"".concat(pe,"/placeholder.svg");return le("li",{className:"frm-card-item",data:{href:"".concat(n,"&triggerViewApplicationModal=1&template=").concat(r),"frm-search-text":e.toLowerCase()},children:[ue({className:"".concat(l,"-item-icon"),child:me({src:i})}),ue({className:"".concat(l,"-item-body"),children:[se({text:X("Ready Made Solution","formidable"),className:"frm-meta-tag frm-orange-tag frm-text-xs"}),le("h3",{text:e,className:"frm-text-sm frm-font-medium frm-m-0"}),fe({text:X("See all applications","formidable"),className:"frm-text-xs frm-font-semibold",href:n})]})]})}(t)}));ie=ue({id:"".concat(l,"-applications"),className:tt,children:[le("h2",{text:X("Application Templates"),className:"frm-text-sm frm-mb-sm"}),le("ul",{className:"".concat(l,"-list frm-list-grid-layout"),children:e})]})}})(t.templates),(e=vt()).applicationTemplates||void 0===ie||(e.bodyContent.appendChild(ie),gt({applicationTemplates:ie,applicationTemplatesTitle:ie.querySelector("h2"),applicationTemplatesList:ie.querySelector(".".concat(l,"-list")),applicationTemplateItems:ie.querySelectorAll(".frm-card-item")})),void 0!==(r=vt().applicationTemplateItems)&&r.forEach((function(t){t.addEventListener("click",Qe)}))}function rr(t){return function(t){if(Array.isArray(t))return nr(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 nr(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)?nr(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 nr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function or(){var t=vt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",s);var o=vt(),a=o.emptyStateTitle,i=o.emptyStateText;a.textContent=X("No favorites","formidable"),i.textContent=X("You haven't added any templates to your favorites yet.","formidable"),Jt([e,n]),Kt(r)}function ar(t){return ar="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},ar(t)}function ir(){ir=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 m="suspendedStart",p="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(A([])));x&&x!==r&&n.call(x,i)&&(w=x);var E=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"==ar(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=m;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=O(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===m)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:p,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function O(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,O(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 j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,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<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(ar(e)+" is not iterable")}return g.prototype=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},_(T.prototype),u(T.prototype,c,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new T(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},_(E),u(E,l,"Generator"),u(E,i,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=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<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw 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 cr(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 lr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){cr(a,n,o,i,c,"next",t)}function c(t){cr(a,n,o,i,c,"throw",t)}i(void 0)}))}}var ur=function(t){return lr(ir().mark((function e(){var r,n,o,a,i,c,l=arguments;return ir().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=je()){e.next=3;break}return e.abrupt("return");case 3:for(n=vt(),o=n.modalItems,Jt(o),r.dialog("option","width",p),a=l.length,i=new Array(a),c=0;c<a;c++)i[c]=l[c];return e.next=9,null==t?void 0:t.apply(void 0,i);case 9:r.dialog("open");case 10:case"end":return e.stop()}}),e)})))},sr={basic:["basic","plus","business","elite"],plus:["plus","business","elite"],business:["business","elite"],elite:["elite"]},fr=ur((function(t,e){var r=e.querySelector(".frm-form-template-name").textContent.trim(),n=vt(),o=n.upgradeModal,a=n.upgradeModalTemplateNames,i=n.upgradeModalPlansIcons,l=n.upgradeModalLink;a.forEach((function(t){return t.textContent=r})),i.forEach((function(e){var r=e.dataset.plan,n=sr[t].includes(r);e.classList.toggle("frm_green",n),e.querySelector("svg > use").setAttribute("xlink:href",n?"#frm_checkmark_icon":"#frm_close_icon")}));var u=e.dataset.slug?"-".concat(e.dataset.slug):"";l.href=c+u,Kt(o)})),mr=ur((function(){var t=vt().renewAccountModal;Kt(t)})),pr=ur((function(){var t=vt().leaveEmailModal;Kt(t)})),dr=ur((function(){je().dialog("option","width",d);var t=vt().createTemplateModal;Kt(t)})),hr=function(t){!function(t,e,r){var n=document.querySelector("#frm_leave_email"),o=document.querySelector("#frm_leave_email_error");n&&o?(o.setAttribute("frm-error",r),Kt(o),n.addEventListener("keyup",(function(){Xt(o)}),{once:!0})):console.warn("showFormError: Unable to find input or error element.")}(0,0,t)};var yr;yr=function(){wp.hooks.doAction("frmFormTemplates.beforeInitialize",{getState:Tt,setState:Ot}),e&&(0,frmDom.ajax.doJsonFetch)("get_applications_data&view=templates").then(er),function(){Oe.apply(this,arguments)}(),vt().templateItems.forEach((function(t){t.getAttribute("data-categories").split(",").forEach((function(e){Ce[e]||(Ce[e]=[]),Ce[e].push(t)}))})),xe(),tr(),wp.hooks.doAction("frmFormTemplates.afterInitialize",{getState:Tt,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",yr):yr())})()})();