!function(){var e,t,n;!function(i){var r,a,l,s,o={},c={},d={},h={},u=Object.prototype.hasOwnProperty,p=[].slice,g=/\.js$/;function f(e,t){return u.call(e,t)}function m(e,t){var n,i,r,a,l,s,o,c,h,u,p,f=t&&t.split("/"),m=d.map,y=m&&m["*"]||{};if(e){for(l=(e=e.split("/")).length-1,d.nodeIdCompat&&g.test(e[l])&&(e[l]=e[l].replace(g,"")),"."===e[0].charAt(0)&&f&&(e=f.slice(0,f.length-1).concat(e)),h=0;h0&&(e.splice(h-1,2),h-=2)}e=e.join("/")}if((f||y)&&m){for(h=(n=e.split("/")).length;h>0;h-=1){if(i=n.slice(0,h).join("/"),f)for(u=f.length;u>0;u-=1)if((r=m[f.slice(0,u).join("/")])&&(r=r[i])){a=r,s=h;break}if(a)break;!o&&y&&y[i]&&(o=y[i],c=h)}!a&&o&&(a=o,s=c),a&&(n.splice(0,s,a),e=n.join("/"))}return e}function y(e,t){return function(){var n=p.call(arguments,0);return"string"!=typeof n[0]&&1===n.length&&n.push(null),a.apply(i,n.concat([e,t]))}}function v(e){return function(t){o[e]=t}}function w(e){if(f(c,e)){var t=c[e];delete c[e],h[e]=!0,r.apply(i,t)}if(!f(o,e)&&!f(h,e))throw new Error("No "+e);return o[e]}function b(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function C(e){return e?b(e):[]}function j(e){return function(){return d&&d.config&&d.config[e]||{}}}l=function(e,t){var n,i,r=b(e),a=r[0],l=t[1];return e=r[1],a&&(n=w(a=m(a,l))),a?e=n&&n.normalize?n.normalize(e,(i=l,function(e){return m(e,i)})):m(e,l):(a=(r=b(e=m(e,l)))[0],e=r[1],a&&(n=w(a))),{f:a?a+"!"+e:e,n:e,pr:a,p:n}},s={require:function(e){return y(e)},exports:function(e){var t=o[e];return void 0!==t?t:o[e]={}},module:function(e){return{id:e,uri:"",exports:o[e],config:j(e)}}},r=function(e,t,n,r){var a,d,u,p,g,m,b,j=[],k=typeof n;if(m=C(r=r||e),"undefined"===k||"function"===k){for(t=!t.length&&n.length?["require","exports","module"]:t,g=0;g0},renderNicename:function(){return e.collection.nicename},renderClasses:function(){return e.collection.slug}}},attachHtml:function(e,t){jQuery(e.el).find(".action-types").append(t.el)}})})),n("models/app/settingModel",[],(function(){return Backbone.Model.extend({defaults:{settings:!1,hide_merge_tags:!1,error:!1},initialize:function(){i.channel("app").trigger("init:settingModel",this),i.channel(this.get("type")).trigger("init:settingModel",this),i.channel("setting-name-"+this.get("name")).trigger("init:settingModel",this),this.on("change:error",this.maybePreventUI,this),void 0!==this.collection&&this.get("use_merge_tags")&&void 0!==this.collection.options.objectType&&this.listenTo(i.channel("app"),"update:fieldKey",this.updateKey)},updateKey:function(e){i.channel("app").trigger("fire:updateFieldKey",e,this)},maybePreventUI:function(){this.get("error")?(i.channel("drawer").request("prevent:close","setting-"+this.get("name")+"-error"),i.channel("app").request("prevent:changeDomain","setting-"+this.get("name")+"-error")):(i.channel("drawer").request("enable:close","setting-"+this.get("name")+"-error"),i.channel("app").request("enable:changeDomain","setting-"+this.get("name")+"-error"))}})})),n("models/app/settingCollection",["models/app/settingModel"],(function(e){return Backbone.Collection.extend({model:e,initialize:function(e,t){this.options=t||{}}})})),n("models/app/settingGroupModel",["models/app/settingCollection"],(function(e){return Backbone.Model.extend({defaults:{display:!1},initialize:function(t){0==this.get("settings")instanceof Backbone.Collection&&this.set("settings",new e(this.get("settings")))}})})),n("models/app/settingGroupCollection",["models/app/settingGroupModel"],(function(e){return Backbone.Collection.extend({model:e})})),n("models/app/typeModel",["models/app/settingGroupCollection"],(function(e){return Backbone.Model.extend({initialize:function(){!1==this.get("settingGroups")instanceof Backbone.Collection&&this.set("settingGroups",new e(this.get("settingGroups"))),i.channel("fields").trigger("init:typeModel",this)}})})),n("models/app/typeCollection",["models/app/typeModel"],(function(e){return Backbone.Collection.extend({model:e,type:!1,initialize:function(e,t){_.each(t,(function(e,t){this[t]=e}),this)}})})),n("views/actions/drawer/addAction",["views/actions/drawer/typeCollection","models/app/typeCollection"],(function(e,t){return Marionette.LayoutView.extend({template:"#tmpl-nf-drawer-content-add-action",regions:{primary:"#nf-drawer-primary",payments:"#nf-drawer-secondary-payments",marketing:"#nf-drawer-secondary-marketing",management:"#nf-drawer-secondary-management",workflow:"#nf-drawer-secondary-workflow",notifications:"#nf-drawer-secondary-notifications",misc:"#nf-drawer-secondary-misc"},initialize:function(){this.listenTo(i.channel("drawer"),"filter:actionTypes",this.filteractionTypes),this.listenTo(i.channel("drawer"),"clear:filter",this.removeactionTypeFilter),this.installedActions=i.channel("actions").request("get:installedActions"),this.primaryCollection=this.installedActions,this.availableActions=i.channel("actions").request("get:availableActions"),this.updateAvailableActionGroups()},onShow:function(){this.primary.show(new e({collection:this.primaryCollection})),this.payments.show(new e({collection:this.paymentsCollection})),this.marketing.show(new e({collection:this.marketingCollection})),this.management.show(new e({collection:this.managementCollection})),this.workflow.show(new e({collection:this.workflowCollection})),this.notifications.show(new e({collection:this.notificationsCollection})),this.misc.show(new e({collection:this.miscCollection}))},getEl:function(){return jQuery(this.el).parent()},filteractionTypes:function(t,n){this.primary.reset().show(new e({collection:t})),this.availableActions=n,this.updateAvailableActionGroups(),this.payments.reset().show(new e({collection:this.paymentsCollection})),this.marketing.reset().show(new e({collection:this.marketingCollection})),this.management.reset().show(new e({collection:this.managementCollection})),this.workflow.reset().show(new e({collection:this.workflowCollection})),this.notifications.reset().show(new e({collection:this.notificationsCollection})),this.misc.reset().show(new e({collection:this.miscCollection}))},removeactionTypeFilter:function(){this.primary.show(new e({collection:this.primaryCollection})),this.availableActions=i.channel("actions").request("get:availableActions"),this.updateAvailableActionGroups(),this.payments.show(new e({collection:this.paymentsCollection})),this.marketing.show(new e({collection:this.marketingCollection})),this.management.show(new e({collection:this.managementCollection})),this.workflow.show(new e({collection:this.workflowCollection})),this.notifications.show(new e({collection:this.notificationsCollection})),this.misc.show(new e({collection:this.miscCollection}))},updateAvailableActionGroups:function(){this.paymentsCollection=new t(this.availableActions.where({group:"payments"}),{slug:"payments",nicename:nfi18n.paymentsActionNicename}),this.marketingCollection=new t(this.availableActions.where({group:"marketing"}),{slug:"marketing",nicename:nfi18n.marketingActionNicename}),this.managementCollection=new t(this.availableActions.where({group:"management"}),{slug:"management",nicename:nfi18n.managementActionNicename}),this.workflowCollection=new t(this.availableActions.where({group:"workflow"}),{slug:"workflow",nicename:nfi18n.workflowActionNicename}),this.notificationsCollection=new t(this.availableActions.where({group:"notifications"}),{slug:"notifications",nicename:nfi18n.notificationsActionNicename}),this.miscCollection=new t(this.availableActions.where({group:"misc"}),{slug:"misc",nicename:nfi18n.miscActionNicename})}})})),n("views/app/drawer/contentViewChangesItem",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-drawer-content-view-changes-item",initialize:function(){this.model.on("change:disabled",this.render,this)},onBeforeDestroy:function(){this.model.off("change:disabled",this.render)},onRender:function(){this.$el=this.$el.children(),this.$el.unwrap(),this.setElement(this.$el)},events:{"click .undoSingle":"undoSingle"},undoSingle:function(e){i.channel("drawer").trigger("click:undoSingle",this.model)}})})),n("views/app/drawer/contentViewChanges",["views/app/drawer/contentViewChangesItem"],(function(e){return Marionette.CollectionView.extend({tagName:"table",className:"nf-changes",childView:e})})),n("views/app/drawer/headerViewChanges",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-drawer-header-view-changes",events:{"click .undoChanges":"clickUndoChanges"},clickUndoChanges:function(e){i.channel("drawer").trigger("click:undoChanges")}})})),n("views/app/drawer/settingError",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-edit-setting-error"})})),n("views/app/drawer/itemSetting",["views/app/drawer/mergeTagsContent","views/app/drawer/settingError"],(function(e,t){return Marionette.LayoutView.extend({tagName:"div",template:"#tmpl-nf-edit-setting-wrap",regions:{error:".nf-setting-error"},initialize:function(e){this.dataModel=e.dataModel,void 0!==i.channel("setting-type-"+this.model.get("type")).request("renderOnChange")&&i.channel("setting-type-"+this.model.get("type")).request("renderOnChange")&&this.dataModel.on("change:"+this.model.get("name"),this.render,this),this.model.on("change:error",this.renderError,this),this.model.on("change:warning",this.renderWarning,this);var t=this.model.get("deps");if(t){void 0===t.settings&&(t.settings=[],_.each(t,(function(e,n){"settings"!==n&&t.settings.push({name:n,value:e})})),t.match="all");for(var n=t.settings.length-1;n>=0;n--){let e=t.settings[n].name;this.dataModel.on("change:"+e,this.render,this)}}var r=this.model.get("remote");if(r){var a,l,s,o;if(void 0!==r.refresh||r.refresh)a=document.createTextNode(this.model.get("label")),(l=document.createElement("span")).classList.add("dashicons","dashicons-update"),(s=document.createElement("a")).classList.add("extra"),s.appendChild(l),(o=document.createElement("span")).appendChild(a),o.appendChild(s),this.model.set("label",o.innerHTML);i.channel("setting").trigger("remote",this.model,this.dataModel,this),this.model.on("rerender",this.render,this)}this.listenTo(i.channel("drawer"),"opened",this.drawerOpened),this.listenTo(i.channel("drawer"),"closed",this.drawerClosed)},onBeforeDestroy:function(){this.dataModel.off("change:"+this.model.get("name"),this.render),this.model.off("change:error",this.renderError);var e=this.model.get("deps");if(e)for(var t=e.settings.length-1;t>=0;t--){let n=e.settings[t].name;this.dataModel.off("change:"+n,this.render)}if(this.model.get("remote")&&this.model.off("rerender",this.render,this),i.channel("setting-"+this.model.get("name")).trigger("destroy:setting",this.model,this.dataModel,this),i.channel("setting-type-"+this.model.get("type")).trigger("destroy:setting",this.model,this.dataModel,this),"textbox"==this.model.get("type")){var n=this.model.get("name"),r=this.dataModel.get(n);this.dataModel.set(n,_.unescape(r),{silent:!0})}},onBeforeRender:function(){if("textbox"==this.model.get("type")){var e=this.model.get("name"),t=this.dataModel.get(e);this.dataModel.set(e,_.escape(t),{silent:!0})}i.channel("app").trigger("before:renderSetting",this.model,this.dataModel),i.channel("setting-type-"+this.model.get("type")).trigger("before:renderSetting",this.model,this.dataModel,this),i.channel("setting-"+this.model.get("name")).trigger("before:renderSetting",this.model,this.dataModel,this)},onRender:function(){this.mergeTagsContentView=!1;i.channel("setting-"+this.model.get("name")).trigger("render:setting",this.model,this.dataModel,this),i.channel("setting-type-"+this.model.get("type")).trigger("render:setting",this.model,this.dataModel,this),jQuery(this.el).find(".nf-help").each((function(){var e=jQuery(this).next(".nf-help-text");jQuery(this).jBox("Tooltip",{content:e,maxWidth:200,theme:"TooltipBorder",trigger:"click",closeOnClick:!0})})),this.model.get("use_merge_tags")&&i.channel("mergeTags").request("init",this);var e=this.model.get("mask");if(void 0!==e){var t=jQuery(this.$el).find("input");switch(jQuery(t).attr("contentEditable",!0),e.type){case"numeric":var n={digitGroupSeparator:nfi18n.thousands_sep,decimalCharacter:nfi18n.decimal_point};new AutoNumeric(t[0],n);break;case"currency":n={digitGroupSeparator:nfi18n.thousands_sep,decimalCharacter:nfi18n.decimal_point,currencySymbol:nfi18n.currencySymbol};new AutoNumeric(t[0],n);break;case"custom":e.format&&t.mask(e.format);break;default:console.log('Notice: Mask type of "'+e.type+'" is not supported.')}}this.renderError()},onShow:function(){i.channel("setting-"+this.model.get("name")).trigger("show:setting",this.model,this.dataModel,this),i.channel("setting-type-"+this.model.get("type")).trigger("show:setting",this.model,this.dataModel,this)},onAttach:function(){i.channel("setting-"+this.model.get("name")).trigger("attach:setting",this.model,this.dataModel,this),i.channel("setting-type-"+this.model.get("type")).trigger("attach:setting",this.model,this.dataModel,this)},renderError:function(){this.model.get("error")?(jQuery(this.el).find(".nf-setting").addClass("nf-error"),this.error.show(new t({model:this.model}))):(jQuery(this.el).find(".nf-setting").removeClass("nf-error"),this.error.empty())},renderWarning:function(){this.model.get("warning")?(jQuery(this.el).find(".nf-setting").addClass("nf-warning"),this.error.show(new t({model:this.model}))):(jQuery(this.el).find(".nf-setting").removeClass("nf-warning"),this.error.empty())},templateHelpers:function(){var e=this;return{renderVisible:function(){if(!nfAdmin.devMode){if("Action"==e.dataModel.get("objectType")&&"email"==e.dataModel.get("type")){if("cc"==this.name)return'style="display:none;"';if("bcc"==this.name)return'style="display:none;"';if("from_name"==this.name)return'style="display:none;"';if("from_address"==this.name)return'style="display:none;"';if("email_format"==this.name)return'style="display:none;"'}if("Action"==e.dataModel.get("objectType")&&"save"==e.dataModel.get("type")&&"submitter_email"==this.name)return'style="display:none;"';if("label_pos"==this.name)return'style="display:none;"';if("input_limit"==this.name)return'style="display:none;"';if("input_limit_type"==this.name)return'style="display:none;"';if("input_limit_msg"==this.name)return'style="display:none;"';if("disable_input"==this.name)return'style="display:none;"';if("disable_browser_autocomplete"==this.name)return'style="display:none;"';if("mask"==this.name)return'style="display:none;"';if("custom_mask"==this.name)return'style="display:none;"';if("custom_name_attribute"==this.name)return'style="display:none;"';if("personally_identifiable"==this.name)return'style="display:none;"';if("key"==this.name)return'style="display:none;"';if("admin_label"==this.name)return'style="display:none;"';if("num_sort"==this.name)return'style="display:none;"';if("user_state"==this.name)return'style="display:none;"';if("checkbox"==e.dataModel.get("type")){if("checked_value"==this.name)return'style="display:none;"';if("unchecked_value"==this.name)return'style="display:none;"'}if("starrating"==e.dataModel.get("type")&&"default"==this.name)return'style="display:none;"';if("listmultiselect"==e.dataModel.get("type")&&"box_size"==this.name)return'style="display:none;"';if("date"==e.dataModel.get("type")){if("year_range_start"==this.name)return'style="display:none;"';if("year_range_end"==this.name)return'style="display:none;"'}}return i.channel("settings").request("check:deps",this,e)},renderSetting:function(){return void 0!==e.dataModel.get(this.name)?this.value=e.dataModel.get(this.name):void 0===this.value&&(this.value=""),i.channel("app").request("get:template","#tmpl-nf-edit-setting-"+this.type)(this)},renderLabelClasses:function(){var e="";return this.use_merge_tags&&(e+=" has-merge-tags"),"rte"==this.type&&(e+=" rte"),e},renderClasses:function(){var e="nf-setting ";return void 0!==this.width?e+="nf-"+this.width:e+=" nf-one-half",this.error&&(e+=" nf-error"),e},renderTooltip:function(){return this.help?((e=document.createElement("div")).innerHTML=this.help,(t=document.createElement("div")).classList.add("nf-help-text"),t.appendChild(e),(n=document.createElement("span")).classList.add("dashicons","dashicons-admin-comments"),(i=document.createElement("a")).classList.add("nf-help"),i.setAttribute("href","#"),i.setAttribute("tabindex","-1"),i.appendChild(n),(r=document.createElement("span")).appendChild(i),r.appendChild(t),r.innerHTML):"";var e,t,n,i,r},renderEmailFieldOptions:function(){var e=i.channel("fields").request("get:collection");initialOption=document.createElement("option"),initialOption.value="",initialOption.label="--",initialOption.innerHTML="--";var t=document.createElement("select");t.classList.add("setting"),t.setAttribute("data-id","my_seledt"),t.appendChild(initialOption);var n=this;return e.each((function(e){if("email"!=e.get("type"))return"";var i=document.createElement("option");i.value=e.get("key"),i.innerHTML=e.get("label"),i.label=e.get("label"),n.value===e.get("key")&&i.setAttribute("selected","selected"),t.appendChild(i),1})),label=document.createElement("label"),label.classList.add("nf-select"),label.appendChild(t),emptyContainer=document.createElement("div"),label.appendChild(emptyContainer),label.innerHTML},renderMergeTags:function(){return this.use_merge_tags&&!this.hide_merge_tags?'':""},renderMinMax:function(){var e="";return void 0!==this.min_val&&null!=this.min_val&&jQuery.isNumeric(this.min_val)&&(e=e+"min='"+this.min_val+"'"),void 0!==this.max_val&&""!=this.max_val&&jQuery.isNumeric(this.max_val)&&(e=e+" max='"+this.max_val+"'"),void 0!==this.step&&""!=this.step&&jQuery.isNumeric(this.step)&&(e=e+" step='"+this.step+"'"),e},renderMinMaxHelper:function(){var e="";return void 0!==this.min_val&&null!=this.min_val&&jQuery.isNumeric(this.min_val)&&(0==e.length&&(e="("),e=e+nfi18n.minVal+": "+this.min_val),void 0!==this.max_val&&""!=this.max_val&&jQuery.isNumeric(this.max_val)&&(0==e.length?e="(":e+=", ",e=e+nfi18n.maxVal+": "+this.max_val),0 .js-click-copytext":"copyPublicLinkHandler","click #public_link + div > .js-click-resettext":"confirmResetPublicLinkHandler","click #public_link + div > .js-click-confirm":"resetPublicLinkHandler","click #public_link + div > .js-click-cancel":"cancelResetPublicLinkHandler"},copyFormEmbedHandler:function(e){document.getElementById("embed_form").select(),document.execCommand("copy"),e.target.innerHTML="Copied!",setTimeout((function(){e.target.innerHTML="Copy"}),1500)},copyPublicLinkHandler:function(e){document.getElementById("public_link").select(),document.execCommand("copy"),e.target.innerHTML="Copied!",setTimeout((function(){e.target.innerHTML="Copy"}),1500)},confirmResetPublicLinkHandler:function(e){_.each(e.target.parentNode.children,(function(e){e.classList.contains("js-click-copytext")||e.classList.contains("js-click-resettext")?e.style.display="none":e.style.display="inline-block"}))},resetPublicLinkHandler:function(e){var t=i.channel("app").request("generate:publicLinkKey"),n=nfAdmin.publicLinkStructure.replace("[FORM_ID]",t);i.channel("settings").request("get:settings").set("public_link",n),this.cancelResetPublicLinkHandler(e),_.each(e.target.parentNode.children,(function(e){e.classList.contains("js-click-resettext")?(e.style.display="inline-block",e.classList.add("primary"),e.classList.remove("secondary"),e.innerHTML="Link Reset!",setTimeout((function(){e.classList.add("secondary"),e.classList.remove("primary"),e.innerHTML="Reset"}),1500)):e.style.display="none",e.classList.contains("js-click-copytext")&&setTimeout((function(){e.style.display="inline-block"}),1500)})),jQuery("#public_link").val(n)},cancelResetPublicLinkHandler:function(e){_.each(e.target.parentNode.children,(function(e){e.classList.contains("js-click-cancel")||e.classList.contains("js-click-confirm")?e.style.display="none":e.style.display="inline-block"}))}})})),n("views/app/drawer/headerPublicLink",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-drawer-header-public-link"})})),n("views/app/drawer/contentNewForm",["views/app/drawer/itemSetting"],(function(e){return Marionette.LayoutView.extend({tagName:"div",template:"#tmpl-nf-drawer-content-new-form",regions:{formName:".new-form-name",formSubmit:".new-form-submit"},onRender:function(){var t=i.channel("settings").request("get:settingModel","title"),n=i.channel("settings").request("get:settingModel","add_submit"),r=i.channel("settings").request("get:settings");this.formName.show(new e({model:t,dataModel:r})),void 0===i.channel("fields").request("get:collection").findWhere({type:"submit"})?this.formSubmit.show(new e({model:n,dataModel:r})):r.set("add_submit",0)},events:{"click .publish":"clickPublish"},clickPublish:function(e){i.channel("app").trigger("click:confirmPublish",e)}})})),n("views/app/drawer/headerNewForm",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-drawer-header-new-form"})})),n("controllers/app/drawerConfig",["models/app/drawerCollection","views/fields/drawer/addField","views/app/drawer/editSettings","views/app/drawer/headerEditSettings","views/actions/drawer/addAction","views/app/drawer/contentViewChanges","views/app/drawer/headerViewChanges","views/app/drawer/contentPublicLink","views/app/drawer/headerPublicLink","views/app/drawer/contentNewForm","views/app/drawer/headerNewForm"],(function(e,t,n,r,a,l,s,o,c,d,h,u){return Marionette.Object.extend({initialize:function(){this.collection=new e([{id:"addField",getContentView:function(e){return new t(e)}},{id:"addAction",getContentView:function(e){return new a(e)}},{id:"editSettings",getHeaderView:function(e){if(void 0!==e.typeModel)var t=i.channel(e.typeModel.get("id")).request("get:drawerHeaderView")||r;else t=r;return new t(e)},getContentView:function(e){return new n(e)}},{id:"viewChanges",getHeaderView:function(e){return new s(e)},getContentView:function(e){return new l(e)}},{id:"publicLink",getHeaderView:function(e){return new c(e)},getContentView:function(e){return new o(e)}},{id:"newForm",getHeaderView:function(e){return new h(e)},getContentView:function(e){return new d(e)}}]),i.channel("app").reply("get:drawerCollection",this.getDrawerCollection,this),i.channel("app").reply("get:drawer",this.getDrawer,this)},getDrawerCollection:function(){return this.collection},getDrawer:function(e){return this.collection.get(e)}})})),n("views/app/drawer/defaultSettingsTitle",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-drawer-content-edit-settings-title-default",templateHelpers:function(){return{renderTypeNicename:function(){var e=i.channel("app").request("get:currentDomain").get("id"),t=i.channel(e).request("get:type",this.type);return void 0!==t?t.get("nicename"):""}}}})})),n("views/app/empty",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-empty"})})),n("models/app/domainModel",["views/app/drawer/defaultSettingsTitle","views/app/empty"],(function(e,t){return Backbone.Model.extend({defaults:{dashicons:"",classes:"",active:!1,url:"",hotkeys:!1,disabled:!1,getSettingsTitleView:function(t){return new e(t)},getDefaultSettingsTitleView:function(t){return new e(t)},getGutterLeftView:function(e){return new t},getGutterRightView:function(e){return new t}}})})),n("models/app/domainCollection",["models/app/domainModel"],(function(e){return Backbone.Collection.extend({model:e})})),n("views/fields/subHeader",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-sub-header-fields"})})),n("views/fields/mainContentFieldCollection",[],(function(){return Marionette.CollectionView.extend({tagName:"div",reorderOnSort:!0,getChildView:function(){return i.channel("views").request("get:fieldItem")},getEmptyView:function(){return i.channel("views").request("get:mainContentEmpty")},initialize:function(){i.channel("fields").reply("get:sortableEl",this.getSortableEl,this),i.channel("fields").reply("init:sortable",this.initSortable,this),i.channel("fields").reply("destroy:sortable",this.destroySortable,this)},onRender:function(){if(this.collection.models.length>0){jQuery(this.el).addClass("nf-field-type-droppable").addClass("nf-fields-sortable");this.initSortable()}i.channel("app").trigger("render:fieldsSortable",this)},getSortableEl:function(){return this.el},initSortable:function(){if(i.channel("app").request("is:mobile"));else;jQuery(this.el).sortable({containment:"parent",helper:"clone",cancel:".nf-item-controls",placeholder:"nf-fields-sortable-placeholder",opacity:.95,grid:[5,5],appendTo:"#nf-main",scrollSensitivity:10,receive:function(e,t){t.item.dropping||jQuery(t.item).hasClass("nf-over-repeater")||i.channel("app").request("receive:fieldsSortable",t)},over:function(e,t){t.item.dropping||i.channel("app").request("over:fieldsSortable",t)},out:function(e,t){t.item.dropping||i.channel("app").request("out:fieldsSortable",t)},start:function(e,t){t.item.dropping||i.channel("app").request("start:fieldsSortable",t)},update:function(e,t){t.item.dropping||i.channel("app").request("update:fieldsSortable",t,this)},stop:function(e,t){t.item.dropping||i.channel("app").request("stop:fieldsSortable",t)}})},destroySortable:function(){jQuery(this.el).sortable("destroy")},onAddChild:function(e){i.channel("fields").request("get:adding")&&(e.$el.hide().show("clip"),i.channel("fields").request("set:adding",!1))}})})),n("views/fields/drawer/addSavedField",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-add-saved-field",initialize:function(){this.model.on("change:addSavedLoading",this.renderAddButton,this)},onRender:function(){this.renderAddButton()},renderAddButton:function(){if(this.model.get("addSavedLoading"))var e=i.channel("app").request("get:template","#tmpl-nf-add-saved-field-loading");else e=i.channel("app").request("get:template","#tmpl-nf-add-saved-field-button");jQuery(this.el).find(".add-button").html(e(this))},onBeforeDestroy:function(){this.model.off("change:addSavedLoading",this.render)},events:{"click .nf-button":"clickAddSavedField"},clickAddSavedField:function(e){i.channel("drawer").trigger("click:addSavedField",e,this.model)}})})),n("views/fields/drawer/settingsTitle",["views/fields/drawer/addSavedField"],(function(e){return Marionette.LayoutView.extend({tagName:"div",template:"#tmpl-nf-drawer-content-edit-settings-title-fields",initialize:function(){this.model.on("change:saved",this.render,this),this.model.on("change:label",this.renderjBoxContent,this)},regions:{addSaved:".nf-add-saved-field"},onBeforeDestroy:function(){this.model.off("change:saved",this.render),this.addSavedjBox.destroy(),this.model.unset("jBox",{silent:!0})},onRender:function(){this.renderjBoxContent();var e=this;this.addSavedjBox=new jBox("Tooltip",{trigger:"click",title:"Add to Favorite Fields",position:{x:"left",y:"center"},outside:"x",closeOnClick:"body",onCreated:function(){this.setContent(jQuery(e.el).find(".nf-add-saved-field"))}}),this.addSavedjBox.attach(jQuery(this.el).find(".dashicons")),this.model.set("jBox",this.addSavedjBox,{silent:!0})},renderjBoxContent:function(){this.addSaved&&this.addSaved.show(new e({model:this.model}))},templateHelpers:function(){return{renderTypeNicename:function(){var e=i.channel("app").request("get:currentDomain").get("id"),t=i.channel(e).request("get:type",this.type),n=t.get("nicename");this.saved&&(n+=" - "+i.channel(e).request("get:type",t.get("type")).get("nicename"));return n},renderSavedStar:function(){if(this.saved)var e="filled";else e="empty";return''}}}})})),n("views/actions/mainHeader",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-main-header-actions",initialize:function(){var e=i.channel("actions").request("get:collection");this.listenTo(e,"add",this.render),this.listenTo(e,"remove",this.render)},onRender:function(){0==i.channel("actions").request("get:collection").models.length?jQuery(this.el).hide():jQuery(this.el).show()}})})),n("views/actions/subHeader",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-sub-header-actions"})})),n("views/app/itemControls",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-item-controls",initialize:function(){},onRender:function(){this.currentDomain=i.channel("app").request("get:currentDomain")},events:{"mouseover .nf-item-control":"mouseoverItemControl","click .nf-edit-settings":"clickEdit","singletap .nf-item-control":"singleTapEdit","click .nf-item-delete":"clickDelete","click .nf-item-duplicate":"clickDuplicateField"},clickEdit:function(e){i.channel("app").request("is:mobile")||i.channel("app").trigger("click:edit",e,this.model)},singleTapEdit:function(e){i.channel("app").trigger("click:edit",e,this.model)},clickDelete:function(e){i.channel("app").trigger("click:delete",e,this.model)},clickDuplicateField:function(e){i.channel("app").trigger("click:duplicate",e,this.model)},mouseoverItemControl:function(e){i.channel("app").trigger("mouseover:itemControl",e,this.model)}})})),n("views/actions/actionItem",["views/app/itemControls"],(function(e){return Marionette.LayoutView.extend({tagName:"tr",template:"#tmpl-nf-action-item",regions:{itemControls:".nf-item-controls"},initialize:function(){this.template=i.channel("actions").request("get:actionItemTemplate")||this.template,this.model.on("change:label",this.render,this),this.model.on("change:editActive",this.render,this),this.model.on("change:active",this.maybeDeactivate,this)},onBeforeDestroy:function(){this.model.off("change:label",this.render),this.model.off("change:editActive",this.render),this.model.off("change:active",this.maybeDeactivate)},onRender:function(){this.model.get("editActive")?jQuery(this.el).addClass("active"):jQuery(this.el).removeClass("active"),this.maybeDeactivate(),this.itemControls.show(new e({model:this.model}))},maybeDeactivate:function(){0==this.model.get("active")?jQuery(this.el).addClass("deactivated"):jQuery(this.el).removeClass("deactivated")},events:{"change input":"changeToggle",click:"maybeClickEdit"},maybeClickEdit:function(e){"TR"==jQuery(e.target).parent().prop("tagName")&&i.channel("app").trigger("click:edit",e,this.model)},changeToggle:function(e){var t=jQuery(e.target).data("setting"),n=i.channel("actions").request("get:settingModel",t);i.channel("app").request("change:setting",e,n,this.model),i.channel("app").request("update:db")},templateHelpers:function(){return{renderToggle:function(e){this.settingName=e||"active";var t=this.label;this.label="",this.value=this[this.settingName],this.name=this.id+"-"+this.settingName;var n=i.channel("app").request("get:template","#tmpl-nf-edit-setting-toggle");return n=n(this),this.label=t,n},renderTypeNicename:function(){var e=i.channel("actions").request("get:type",this.type);if(void 0!==e)return e.get("nicename")},renderTooltip:function(){return""},renderMergeTags:function(){return this.use_merge_tags?'':""}}}})})),n("views/actions/mainContentEmpty",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-main-content-actions-empty",onBeforeDestroy:function(){jQuery(this.el).parent().parent().removeClass("nf-actions-empty")},onRender:function(){this.$el=this.$el.children(),this.$el.unwrap(),this.setElement(this.$el)},onShow:function(){jQuery(this.el).parent().parent().addClass("nf-actions-empty")}})})),n("views/actions/mainContent",["views/actions/actionItem","views/actions/mainContentEmpty"],(function(e,t){return Marionette.CompositeView.extend({template:"#tmpl-nf-action-table",childView:e,emptyView:t,initialize:function(){this.template=i.channel("actions").request("get:mainContentTemplate")||this.template},onRender:function(){jQuery(this.el).droppable({accept:".nf-action-type-draggable",activeClass:"nf-droppable-active",hoverClass:"nf-droppable-hover",drop:function(e,t){i.channel("app").request("drop:actionType",e,t)}})},attachHtml:function(e,t){void 0!==i.channel("actions").request("get:type",t.model.get("type"))&&jQuery(e.el).find("tbody").append(t.el)}})})),n("views/advanced/mainHeader",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-main-header-settings"})})),n("views/advanced/subHeader",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-sub-header-settings"})})),n("views/advanced/settingItem",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-form-setting-type",onBeforeDestroy:function(){this.model.off("change:editActive",this.updateActiveClass)},initialize:function(){this.model.on("change:editActive",this.updateActiveClass,this)},events:{click:"clickEdit"},clickEdit:function(e){if(void 0!==this.model.get("modal_content")){var t=this.model.get("modal_content");new jBox("Modal",{content:t,zIndex:99999999,closeButton:"box",overlay:!0,width:600,repositionOnOpen:!0,reposition:!0}).open()}else i.channel("settings").trigger("click:edit",e,this.model)},templateHelpers:function(){return{renderClasses:function(){var e="nf-setting-wrap "+this.id;return this.editActive&&(e+=" active"),e}}},updateActiveClass:function(){this.model.get("editActive")?jQuery(this.el).find(".nf-setting-wrap").addClass("active"):jQuery(this.el).find(".nf-setting-wrap").removeClass("active")}})})),n("views/advanced/mainContent",["views/advanced/settingItem"],(function(e){return Marionette.CompositeView.extend({childView:e,template:"#tmpl-nf-advanced-main-content",attachHtml:function(e,t){void 0!==t.model.get("modal_content")?(jQuery(e.el).find(".available").append(t.el),jQuery(e.el).find(".sub-section-header").show()):jQuery(e.el).find(".installed").append(t.el)}})})),n("models/fields/fieldModel",[],(function(){return Backbone.Model.extend({defaults:{objectType:"Field",objectDomain:"fields",editActive:!1,order:999,idAttribute:"id"},initialize:function(){var e=this.get("type");if(void 0!==e){this.on("change",this.changeSetting,this);var t=i.channel("fields").request("get:type",this.get("type")),n=t.get("parentType");_.each(t.get("settingDefaults"),(function(e,t){void 0===this.get(t)&&this.set(t,e,{silent:!0})}),this),"saved"==t.get("section")&&this.set("type",t.get("type")),"listimage"===e&&(this.get=this.listimageGet,this.set=this.listimageSet),i.channel("fields").trigger("init:fieldModel",this),i.channel("fields-"+n).trigger("init:fieldModel",this),i.channel("fields-"+this.get("type")).trigger("init:fieldModel",this),this.listenTo(i.channel("app"),"fire:updateFieldKey",this.updateFieldKey)}},listimageGet:function(e){return"options"===e&&(e="image_options"),Backbone.Model.prototype.get.call(this,e)},listimageSet:function(e,t){return"options"===e&&(e="image_options"),Backbone.Model.prototype.set.call(this,e,t)},changeSetting:function(e,t){i.channel("fieldSetting-"+_.keys(e.changedAttributes())[0]).trigger("update:setting",this,t.settingModel),i.channel("fields").trigger("update:setting",this,t.settingModel),i.channel("app").trigger("update:setting",this,t.settingModel)},updateFieldKey:function(e,t){i.channel("app").trigger("replace:fieldKey",this,e,t)},formatLabel:function(){var e=this.get("admin_label");return""==e&&(e=this.get("label")),e}})})),n("models/fields/fieldCollection",["models/fields/fieldModel"],(function(e){var t=Backbone.Collection.extend({model:e,comparator:function(e){return parseInt(e.get("order"))},tmpNum:1,initialize:function(){this.on("add",this.addField,this),this.on("remove",this.removeField,this),this.listenTo(this,"add:field",this.addNewField),this.listenTo(this,"append:field",this.appendNewField),this.listenTo(this,"remove:field",this.removeFieldResponse),this.newIDs=[]},addField:function(e){this.newIDs.push(e.get("id"))},removeField:function(e){this.removedIDs=this.removedIDs||{},this.removedIDs[e.get("id")]=e.get("id")},addNewField:function(e){this.add(e)},appendNewField:function(e){if(0==this.length)var t=0;else t=this.at(this.length-1).get("order")+1;e.set("order",t,{silent:!0}),this.add(e)},removeFieldResponse:function(e){this.remove(e)},fieldExists:function(e){return-1!=this.indexOf(e)}});return t})),n("controllers/app/domainConfig",["models/app/domainCollection","views/fields/subHeader","views/fields/mainContentFieldCollection","views/fields/drawer/settingsTitle","views/actions/mainHeader","views/actions/subHeader","views/actions/mainContent","views/advanced/mainHeader","views/advanced/subHeader","views/advanced/mainContent","views/app/empty","models/fields/fieldCollection"],(function(e,t,n,r,a,l,s,o,c,d,h,u){return Marionette.Object.extend({initialize:function(){i.channel("formContent").request("add:viewFilter",this.defaultFormContentView,10,this),i.channel("formContent").request("add:loadFilter",this.defaultFormContentLoad,10,this),i.channel("formContentGutters").request("add:leftFilter",this.defaultFormContentGutterView,10,this),i.channel("formContentGutters").request("add:rightFilter",this.defaultFormContentGutterView,10,this),this.collection=new e([{id:"fields",nicename:nfi18n.domainFormFields,hotkeys:{Esc:"close:drawer","Ctrl+Shift+n":"add:newField","Ctrl+Shift+a":"changeDomain:actions","Ctrl+Shift+s":"changeDomain:settings","Alt+Ctrl+t":"open:mergeTags",up:"up:mergeTags",down:"down:mergeTags","Shift+return":"return:mergeTags"},mobileDashicon:"dashicons-menu",getSubHeaderView:function(){return new t},getMainContentView:function(e){var t=i.channel("settings").request("get:setting","formContentData");t||(t=i.channel("settings").request("get:setting","fieldContentsData"));var n=i.channel("formContent").request("get:loadFilters"),r=_.without(n,void 0);t=(l=_.first(r))(t,i.channel("app").request("get:formModel"),!0);var a=i.channel("formContent").request("get:viewFilters"),l=(r=_.without(a,void 0),_.first(r));return formContentView=l(),i.channel("settings").request("update:setting","formContentData",t,!0),new formContentView({collection:t})},getSettingsTitleView:function(e){return"fields"==e.model.get("objectDomain")?new r(e):this.get("getDefaultSettingsTitleView").call(this,e)},getGutterLeftView:function(e){var t=i.channel("formContentGutters").request("get:leftFilters"),n=_.without(t,void 0),r=_.first(n);return gutterView=r(),new gutterView},getGutterRightView:function(){var e=i.channel("formContentGutters").request("get:rightFilters"),t=_.without(e,void 0),n=_.first(t);return gutterView=n(),new gutterView}},{id:"actions",nicename:nfi18n.domainActions,hotkeys:{Esc:"close:drawer","Ctrl+Shift+n":"add:newAction","Ctrl+Shift+f":"changeDomain:fields","Ctrl+Shift+s":"changeDomain:settings","Alt+Ctrl+t":"open:mergeTags",up:"up:mergeTags",down:"down:mergeTags","Shift+return":"return:mergeTags"},mobileDashicon:"dashicons-external",getSubHeaderView:function(){return new l},getMainContentView:function(){var e=i.channel("actions").request("get:collection");return new s({collection:e})}},{id:"settings",nicename:nfi18n.domainAdvanced,hotkeys:{Esc:"close:drawer","Ctrl+Shift+f":"changeDomain:fields","Ctrl+Shift+a":"changeDomain:actions","Alt+Ctrl+t":"open:mergeTags",up:"up:mergeTags",down:"down:mergeTags","Shift+return":"return:mergeTags"},mobileDashicon:"dashicons-admin-generic",getSubHeaderView:function(){return new c},getMainContentView:function(){var e=i.channel("settings").request("get:typeCollection");return new d({collection:e})}},{id:"preview",nicename:"Preview Form",classes:"preview",dashicons:"dashicons-visibility",mobileDashicon:"dashicons-visibility",url:nfAdmin.previewurl}]),i.channel("app").trigger("init:domainCollection",this.collection),i.channel("app").reply("get:domainCollection",this.getDomainCollection,this),i.channel("app").reply("get:domainModel",this.getDomainModel,this)},getDomainCollection:function(){return this.collection},getDomainModel:function(e){return this.collection.get(e)},defaultFormContentView:function(e){return n},defaultFormContentLoad:function(e){var t=i.channel("fields").request("get:collection"),n=i.channel("formContent").request("get:loadFilters");if(1==_.without(n,void 0).length||void 0===e||!0==e instanceof Backbone.Collection)return t;var r=_.map(e,(function(e){return t.findWhere({key:e})}),this);return new u(r)},defaultFormContentGutterView:function(e){return h}})})),n("models/app/appModel",[],(function(){return Backbone.Model.extend({defaults:{loading:!1},initialize:function(){this.on("change:clean",this.changeStatus,this)},changeStatus:function(){i.channel("app").trigger("change:clean",this.get("clean"))}})})),n("controllers/app/data",["models/app/appModel"],(function(e){return Marionette.Object.extend({initialize:function(){var t=i.channel("app").request("get:domainCollection");this.model=new e({currentDrawer:!1,currentDomain:t.get("fields"),clean:!0});var n=1==nfAdmin.mobile;this.model.set("mobile",n),i.channel("app").reply("is:mobile",this.isMobile,this),i.channel("app").reply("get:data",this.getData,this),i.channel("app").reply("get:setting",this.getSetting,this),i.channel("app").reply("get:currentDomain",this.getCurrentDomain,this),i.channel("app").reply("get:currentDrawer",this.getCurrentDrawer,this),i.channel("drawer").reply("get:current",this.getCurrentDrawer,this),i.channel("app").reply("update:currentDomain",this.updateCurrentDomain,this),i.channel("app").reply("update:currentDrawer",this.updateCurrentDrawer,this),i.channel("app").reply("update:setting",this.updateSetting,this),i.channel("settings").reply("check:deps",this.checkDeps,this)},checkDeps:function(e,t){if(!e.deps)return"";let n=e.deps.settings,i=e.deps.match,r=!1;for(var a=n.length-1;a>=0;a--){let e=n[a].name,l=n[a].value;if(t.dataModel.get(e)==l){if("any"==i){r=!1;break}}else r=!0}return r?'style="display:none;"':""},updateCurrentDomain:function(e){this.updateSetting("currentDomain",e)},updateSetting:function(e,t){return this.model.set(e,t),!0},getSetting:function(e){return this.model.get(e)},getData:function(){return this.model},getCurrentDomain:function(){return this.model.get("currentDomain")},updateCurrentDrawer:function(e){return this.updateSetting("currentDrawer",e),!0},getCurrentDrawer:function(){var e=this.model.get("currentDrawer");return i.channel("app").request("get:drawer",e)},isMobile:function(){return this.model.get("mobile")}})})),n("controllers/app/drawerToggleSettingGroup",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("drawer"),"click:toggleSettingGroup",this.toggleSettingGroup)},toggleSettingGroup:function(e,t){if(t.get("display")){var n=!1;_.each(t.get("settings").models,(function(e){e.get("error")&&(n=!0)})),n||t.set("display",!1)}else t.set("display",!0)}})})),n("controllers/app/updateDB",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("drawer"),"closed",this.updateDB),i.channel("app").reply("update:db",this.updateDB,this),i.channel("formContent").request("add:saveFilter",this.defaultSaveFilter,10,this)},updateDB:function(e){if(i.channel("app").request("get:setting","clean"))return!1;if("preview"==(e=e||"preview"))var t="nf_preview_update";else if("publish"==e)t="nf_save_form";var n=i.channel("app").request("get:formModel");_.each(n.get("fields").models,(function(e,t){e.unset("jBox",{silent:!0})}));var r=i.channel("settings").request("get:setting","formContentData");r||(r=i.channel("settings").request("get:setting","fieldContentsData"));var a=i.channel("formContent").request("get:saveFilters"),l=_.without(a,void 0);if(r=_.first(l)(r),"publish"==e&&n.get("show_publish_options")){i.channel("app").request("open:drawer","newForm");var s=i.channel("app").request("get:builderEl");return jQuery(s).addClass("disable-main"),!1}var o=i.channel("app").request("get:formModel"),c=JSON.parse(JSON.stringify(o));c.settings.formContentData=r;var d=o.get("fields").removedIDs;_.each(c.fields,(function(e){var t=e.id;delete e.id,delete e.parent_id;var n={};for(var i in e)e.hasOwnProperty(i)&&(null!==e[i]&&(n[i]=e[i]),delete e[i]);for(var r in n)null===n[r]&&delete n[r];e.settings=n,e.id=t})),c.deleted_fields=d;d=o.get("actions").removedIDs;for(var h in _.each(c.actions,(function(e){var t=e.id;delete e.id,delete e.parent_id;var n={};for(var i in e)e.hasOwnProperty(i)&&(null!==e[i]&&(n[i]=e[i]),delete e[i]);e.settings=n,e.id=t})),c.settings)null===c.settings[h]&&delete c.settings[h];if(c.deleted_actions=d,c=JSON.stringify(c),i.channel("app").trigger("before:updateDB",c),"publish"==e&&(i.channel("app").request("update:setting","loading",!0),i.channel("app").trigger("change:loading"),i.channel("app").request("is:mobile")&&i.channel("notices").request("add","publishing","Your Changes Are Being Published",{autoClose:!1})),"nf_save_form"===t){var u=1e5,p=[];if(u=0;n--){let e=t.settings[n].name;this.dataModel.on("change:"+e,this.render,this)}}this.model.on("rerender",this.render,this)},onBeforeDestroy:function(){var e=this.model.get("deps");if(e)for(var t=e.settings.length-1;t>=0;t--)name=e.settings[t].name,this.dataModel.off("change:"+name,this.render)},onBeforeRender:function(){i.channel("app").trigger("before:renderSetting",this.model,this.dataModel),i.channel("setting-type-"+this.model.get("type")).trigger("before:renderSetting",this.model,this.dataModel,this),i.channel("setting-"+this.model.get("name")).trigger("before:renderSetting",this.model,this.dataModel,this)},onRender:function(){i.channel("setting-"+this.model.get("name")).trigger("render:setting",this.model,this.dataModel,this),i.channel("setting-type-"+this.model.get("type")).trigger("render:setting",this.model,this.dataModel,this)},templateHelpers:function(){var e=this;return{renderVisible:function(){if(!nfAdmin.devMode){if("help"==this.name)return'style="display:none;"';if("classes"==this.name)return'style="display:none;"';if("input_limit_set"==this.name)return'style="display:none;"';if("checkbox"==e.dataModel.get("type")&&"checkbox_values"==this.name)return'style="display:none;"';if("date"==e.dataModel.get("type")&&"year_range"==this.name)return'style="display:none;"'}return i.channel("settings").request("check:deps",this,e)},renderSetting:function(){return i.channel("app").request("get:template","#tmpl-nf-edit-setting-"+this.type)(this)},renderClasses:function(){var e="";return void 0!==this.width?e+=this.width:e+=" one-half",this.error&&(e+=" nf-error"),e},renderError:function(){return this.error?this.error:""}}},attachHtml:function(e,t){jQuery(e.el).find(".nf-field-sub-settings").append(t.el)}})})),n("controllers/app/fieldset",["views/app/drawer/typeSettingFieldset","models/app/settingCollection"],(function(e,t){return Marionette.Object.extend({initialize:function(){i.channel("fieldset").reply("get:settingChildView",this.getSettingChildView,this),this.listenTo(i.channel("fieldset"),"init:settingModel",this.createSettingsCollection)},getSettingChildView:function(t){return e},createSettingsCollection:function(e){e.set("settings",new t(e.get("settings")))}})})),n("controllers/app/textboxSetting",[],(function(){return Marionette.Object.extend({initialize:function(){i.channel("textbox").reply("validate:updateSetting",this.validateSetting,this)},validateSetting:function(e,t,n){if(console.log(nfi18n),t.get("name").endsWith("_class")){const n=/^[a-zA-Z 0-9-_]+$/;-1===e.target.value.search(n)&&""!==e.target.value?t.set("error",nfi18n.htmlDetectedError):0!==e.target.value.search(n)&&""!==e.target.value||t.unset("error")}if(["title","processing_label","changeEmailErrorMsg","changeDateErrorMsg","confirmFieldErrorMsg","fieldNumberNumMinError","fieldNumberNumMaxError","fieldNumberIncrementBy","formErrorsCorrectErrors","validateRequiredField","honeypotHoneypotError","fieldsMarkedRequired"].includes(t.get("name"))){const n=/[/"<>`]/;if(-1!==e.target.value.search(n)&&""!==e.target.value){const i=e.target.value.search(n),r=e.target.value.charAt(i);t.set("error",r+" "+nfi18n.titleLabelsErrorMessage)}else-1!==e.target.value.search(n)&&""!==e.target.value||t.unset("error")}}})})),n("controllers/app/toggleSetting",[],(function(){return Marionette.Object.extend({initialize:function(){i.channel("setting-type-toggle").reply("renderOnChange",(function(){return!1})),i.channel("toggle").reply("before:updateSetting",this.updateSetting,this)},updateSetting:function(e,t,n,i){if(jQuery(e.target).prop("checked"))var r=1;else r=0;return r}})})),n("controllers/app/buttonToggleSetting",[],(function(){return Marionette.Object.extend({initialize:function(){i.channel("setting-type-button-toggle").reply("renderOnChange",(function(){return!1})),i.channel("button-toggle").reply("before:updateSetting",this.updateSetting,this)},updateSetting:function(e,t,n,i){return e.target.value}})})),n("controllers/app/numberSetting",[],(function(){return Marionette.Object.extend({initialize:function(){i.channel("number").reply("before:updateSetting",this.updateSetting,this),i.channel("number").reply("validate:updateSetting",this.validateSetting,this)},updateSetting:function(e,t,n,i){var r=i.get("min_val"),a=i.get("max_val");return null!=r&&e.target.valuea&&(t.set("value",a),e.target.value=a),e.target.value},validateSetting:function(e,t){if(["year_range_start","year_range_end"].includes(t.get("name"))){const n="year_range_start"===t.get("name")?e.target.value:document.getElementById("year_range_start").getAttribute("value"),i="year_range_end"===t.get("name")?e.target.value:document.getElementById("year_range_end").getAttribute("value");n.length>0&&i.length>0&&(n>=i?t.set("error","Start year must be smaller than end year"):t.unset("error"))}}})})),n("controllers/app/radioSetting",[],(function(){return Marionette.Object.extend({initialize:function(){console.log(i.channel("radio")),i.channel("radio").reply("before:updateSetting",this.updateSetting,this)},updateSetting:function(e,t,n,i){console.log("test")}})})),n("controllers/app/itemControls",[],(function(){return Marionette.Object.extend({deleting:!1,initialize:function(){this.listenTo(i.channel("app"),"click:edit",this.clickEdit),this.listenTo(i.channel("app"),"click:delete",this.maybeDelete),this.listenTo(i.channel("app"),"click:duplicate",this.clickDuplicate)},clickEdit:function(e,t){if(!this.deleting){var n=i.channel("app").request("get:currentDomain").get("id"),r=i.channel(n).request("get:type",t.get("type"));i.channel("app").request("open:drawer","editSettings",{model:t,groupCollection:r.get("settingGroups")}),i.channel("fields-repeater").trigger("clearEditActive",t)}},maybeDelete:function(e,t){this.deleting=!0;var n=t.get("id");if("field"!=t.get("objectType").toLowerCase())this.clickDelete(e,t);else if("tmp"===n.toString().substring(0,3)||-1!=jQuery.inArray(t.get("type"),["html","submit","hr","recaptcha","spam","creditcard","creditcardcvc","creditcardexpiration","creditcardfullname","creditcardnumber","creditcardzip"]))this.clickDelete(e,t);else{var i=Backbone.Radio.channel("app").request("get:formModel"),r={action:"nf_maybe_delete_field",security:nfAdmin.ajaxNonce,formID:i.get("id"),fieldKey:t.get("key"),fieldID:n},a=this;jQuery.post(ajaxurl,r).done((function(n){var i=JSON.parse(n);if(i.data.hasOwnProperty("errors")){var r=i.data.errors;return Array.isArray(r)&&r.forEach((function(e){r+=e+"\n"})),console.log("Maybe Delete Field Errors: ",r),alert(r),null}return i.data.field_has_data?(a.doDeleteFieldModal(e,t),!1):(a.clickDelete(e,t),!1)}))}},doDeleteFieldModal:function(e,t){var n=this,i={width:400,closeOnClick:!1,closeOnEsc:!0,content:nfi18n.fieldDataDeleteMsg,btnPrimary:{text:nfi18n.delete,callback:function(){r.toggleModal(!1),r.destroy(),n.clickDelete(e,t)}},btnSecondary:{text:nfi18n.cancel,callback:function(){r.toggleModal(!1),r.destroy(),n.deleting=!1}}},r=new NinjaModal(i)},clickDelete:function(e,t){var n=i.channel("app").request("clone:modelDeep",t),r={object:t.get("objectType"),label:t.get("label"),change:"Removed",dashicon:"dismiss"},a={collection:t.collection},l=i.channel("changes").request("get:collection").where({model:t});_.each(l,(function(e){var i=e.get("data");void 0!==i.fields&&_.each(i.fields,(function(e,r){e.model==t&&(i.fields[r].model=n)})),e.set("data",i),e.set("model",n),e.set("disabled",!0)})),i.channel("changes").request("register:change","removeObject",n,null,r,a);var s=i.channel("app").request("get:currentDomain").get("id");i.channel(s).request("delete",t),this.deleting=!1},clickDuplicate:function(e,t){var n=i.channel("app").request("clone:modelDeep",t),r=i.channel("app").request("get:currentDomain").get("id");n.set("label",n.get("label")+" Copy",{silent:!0});var a=i.channel(r).request("get:tmpID");n.set("id",a),i.channel(r).request("add",n,!1,!1,"duplicate");var l={object:t.get("objectType"),label:t.get("label"),change:"Duplicated",dashicon:"admin-page"},s={collection:i.channel(r).request("get:collection")};i.channel("changes").request("register:change","duplicateObject",n,null,l,s),t.trigger("change:label",t),i.channel("app").request("update:db")}})})),n("controllers/app/mergeTags",["models/app/mergeTagCollection"],(function(e){return Marionette.Object.extend({initialize:function(){this.tagSectionCollection=new e;var t=this;_.each(mergeTags,(function(n){if(n.tags)var i=new e(n.tags);else i="";t.tagSectionCollection.add({id:n.id,label:n.label,tags:i,default_group:n.default_group})}));var n=this.tagSectionCollection.get("fields").get("tags"),r=i.channel("fields").request("get:collection");_.each(r.models,(function(e){"submit"!==e.get("type")&&n.add({id:e.get("id"),label:e.get("label"),tag:t.getFieldKeyFormat(e.get("key"))})}));var a=new e,l=i.channel("app").request("get:formModel").get("settings").get("calculations");_.each(l.models,(function(e){a.add({label:e.get("name"),tag:"{calc:"+e.get("name")+"}"})})),this.tagSectionCollection.get("calcs").set("tags",a),this.currentElement={},this.settingModel={},this.open=!1,this.listenTo(i.channel("mergeTags"),"click:mergeTag",this.clickMergeTag),this.listenTo(i.channel("fields"),"add:field",this.addFieldTags),this.listenTo(i.channel("fields"),"delete:field",this.deleteFieldTags),this.listenTo(i.channel("option-repeater-calculations"),"update:option",this.updateCalcTags),this.listenTo(i.channel("option-repeater-calculations"),"remove:option",this.updateCalcTags),i.channel("mergeTags").reply("update:currentElement",this.updateCurrentElement,this),i.channel("mergeTags").reply("update:currentSetting",this.updateCurrentSetting,this),i.channel("mergeTags").reply("get:collection",this.getCollection,this),i.channel("mergeTags").reply("get:mergeTag",this.getSectionModel,this),this.listenTo(i.channel("fieldSetting-id"),"update:setting",this.updateID),this.listenTo(i.channel("fieldSetting-key"),"update:setting",this.updateKey),this.listenTo(i.channel("app"),"replace:fieldKey",this.replaceFieldKey),i.channel("app").reply("get:fieldKeyFormat",this.getFieldKeyFormat,this)},initMergeTags:function(e){var t=i.channel("mergeTags").request("get:view");this.jBoxes={};var n=this;jQuery(e.el).find(".merge-tags").each((function(){if(void 0===jQuery(this).data("jBox-id")){var i=jQuery(this).jBox("Tooltip",{title:"Insert Merge Tag",trigger:"click",position:{x:"center",y:"bottom"},closeOnClick:"body",closeOnEsc:!0,theme:"TooltipBorder",maxHeight:200,onOpen:function(){t.reRender(e.model),this.setContent(jQuery(".merge-tags-content"));var i=jQuery(this.target).prev(".setting");0==i.length&&(i=jQuery(e.el).find(".setting")),n.updateCurrentSetting(e.model),n.updateCurrentElement(i)},onClose:function(){}});jQuery(this).data("jBox-id",i.id)}}))},clickMergeTag:function(e,t){if(void 0!==this.settingModel.get("settingModel")&&"calculations"==this.settingModel.get("settingModel").get("name")){var n=jQuery(this.currentElement).val(),i=(a=jQuery(this.currentElement).caret())+t.get("tag").length,r=void 0!==t.get("calcTag")?t.get("calcTag"):t.get("tag");n=n.substr(0,a)+r+n.substr(a),jQuery(this.currentElement).val(n).caret(i).trigger("change")}else if("rte"==this.settingModel.get("type"))jQuery(this.currentElement).summernote("insertText",t.get("tag"));else{var a;n=jQuery(this.currentElement).val(),i=(a=jQuery(this.currentElement).caret())+t.get("tag").length;n=n.substr(0,a)+t.get("tag")+n.substr(a),jQuery(this.currentElement).val(n).caret(i).trigger("change")}},addFieldTags:function(e){"submit"!==e.get("type")&&this.tagSectionCollection.get("fields").get("tags").add({id:e.get("id"),label:e.get("label"),tag:this.getFieldKeyFormat(e.get("key")),calcTag:this.getFieldKeyFormatCalc(e.get("key"))})},deleteFieldTags:function(e){var t=e.get("id"),n=this.tagSectionCollection.get("fields").get("tags").get(t);this.tagSectionCollection.get("fields").get("tags").remove(n)},updateCalcTags:function(t){var n=new e,r=i.channel("app").request("get:formModel").get("settings").get("calculations");_.each(r.models,(function(e){n.add({label:e.get("name"),tag:"{calc:"+e.get("name")+"}"})})),this.tagSectionCollection.get("calcs").set("tags",n)},openMergeTags:function(e){"TEXTAREA"!=jQuery(e.target)[0].tagName&&"INPUT"!=jQuery(e.target)[0].tagName||jQuery(e.target).parent().find(".merge-tags").click()},returnMergeTags:function(e){if(this.open){e.preventDefault();var t=this.fields.where({active:!0})[0];t&&this.clickMergeTag(e,t)}},upMergeTags:function(e){this.open&&(e.preventDefault(),this.changeActiveTag("up"))},downMergeTags:function(e){this.open&&(e.preventDefault(),this.changeActiveTag("down"))},changeActiveTag:function(e){if("down"==e)var t=1;else t=-1;if(0=0,l=n.get("tag").toLowerCase().indexOf(e.toLowerCase())>=0;return(!this.calc||-1==t.indexOf(n.get("tag")))&&(a||l)},this.render(),i.channel("merge-tags").trigger("after:filtersearch")},excludeFromCalcs:function(){var e=i.channel("fields").request("get:collection"),t=[],n=["product","quantity","total","shipping","date"];return _.each(e.models,(function(e){-1!=n.indexOf(e.get("type"))&&t.push("{field:"+e.get("key")+"}")})),t}})})),n("views/app/drawer/mergeTagGroup",[],(function(){return Marionette.ItemView.extend({tagName:"li",template:"#tmpl-nf-merge-tag-box-section",events:{click:"onClick"},initialize:function(){this.listenTo(i.channel("merge-tags"),"after:filtersearch",this.updateActive)},onClick:function(){this.updateTags()},updateTags:function(){i.channel("merge-tags").request("update:taglist",this.model.get("id"))},updateActive:function(e){this.$el.removeClass("active"),e==this.model.get("id")&&this.$el.addClass("active")},setActive:function(){this.$el.addClass("active"),this.$el.siblings().removeClass("active")}})})),n("views/app/drawer/mergeTagGroupList",["views/app/drawer/mergeTagGroup"],(function(e){return Marionette.CollectionView.extend({tagName:"ul",childView:e,initialize:function(){this.listenTo(i.channel("merge-tags"),"open",this.render,this)},filter:function(e,t,n){return 0r&&(i=t-a),0>i&&(i=t),jQuery("#merge-tags-box").css("top",i);var l=jQuery("#merge-tags-box").outerHeight();jQuery("#nf-drawer").css("padding-bottom",l+"px");var s=jQuery(".merge-tag-focus").closest(".nf-list-options-tbody");if(0!=s.length){var o=s.offset().left-jQuery(window).scrollLeft();jQuery("#merge-tags-box").css("left",o)}else{var c=jQuery(".merge-tag-focus").closest(".nf-settings").offset().left-jQuery(window).scrollLeft();jQuery("#merge-tags-box").css("left",c),jQuery("#merge-tags-box").css("width",jQuery(".merge-tag-focus").closest(".nf-settings").width())}}})),jQuery(n.el).find(".setting").on("focus",this.focusCallback),jQuery(n.el).find(".setting").on("keyup",this.keyupCallback)},beforeDrawerClose:function(){jQuery("#merge-tags-box").css("display","none"),i.channel("drawer").request("enable:close")},insertTag:function(e){var t=jQuery(".merge-tag-focus");if(0!=t.closest(".nf-setting").first().find(".note-editable").length&&(t=t.closest(".nf-setting").first().find(".note-editable")),1s&&(l=r-o),0>l&&(l=r),jQuery("#merge-tags-box").css("top",l);var c=i.closest(".nf-list-options-tbody");if(0!=c.length){var d=c.offset().left-jQuery(window).scrollLeft();jQuery("#merge-tags-box").css("left",d)}else if("rte"==n){var h=i.closest(".nf-setting").find(".note-editor").offset().left-jQuery(window).scrollLeft();jQuery("#merge-tags-box").css("left",h),jQuery("#merge-tags-box").css("width",i.closest(".nf-setting").find(".note-editor").width())}else{h=jQuery(this).closest(".nf-settings").offset().left-jQuery(window).scrollLeft();jQuery("#merge-tags-box").css("left",h),jQuery("#merge-tags-box").css("width",i.closest(".nf-settings").width())}jQuery(this).data("id")},keyupCallback:function(e,t,n){n=n||"setting";if(13==e.keyCode){var r=jQuery("#merge-tags-box .merge-tag-list ul li span").first().data("tag");return i.channel("mergeTags").request("insert:tag",r),jQuery("#merge-tags-box").css("display","none"),i.channel("drawer").request("enable:close"),jQuery("#merge-tags-box").removeClass(),jQuery(".merge-tag-focus").removeClass("merge-tag-focus"),void jQuery(".merge-tag-focus-overlay").removeClass("merge-tag-focus-overlay")}if(void 0!==t)var a=jQuery(t);else a=jQuery(this);var l=jQuery(this).data("id");if(!l||"eq"!=l){if("rte"==n){var s=a.summernote("createRange");if(s)var o=s.so;else o=0;a.closest(".nf-setting").find(".setting").summernote("saveRange")}else o=a.caret();if(i.channel("mergeTags").request("set:caret",o),"rte"==n)var c=a.summernote("code").match(new RegExp(/{([a-zA-Z0-9]|:|_|-|})*/g));else c=a.val().match(new RegExp(/{([a-zA-Z0-9]|:|_|-|})*/g));if(0!==(c=_.filter(c,(function(e){return-1==e.indexOf("}")}))).length){i.channel("mergeTags").request("set:old",c[0]),jQuery("#merge-tags-box").css("display","block"),i.channel("drawer").request("prevent:close"),a.addClass("merge-tag-focus");var d=jQuery("#merge-tags-box").outerHeight();jQuery("#nf-drawer").css("padding-bottom",d+"px");var h=a.attr("autocomplete");a.attr("autocomplete","off"),a.data("autocomplete",h);var u=a.closest(".nf-setting, .nf-table-row");0!=u.find(".note-editor").length?u.find(".note-editor").addClass("merge-tag-focus-overlay"):u.addClass("merge-tag-focus-overlay"),u.off("click"),u.on("click",(function(e){-1!==(jQuery(e.target).attr("class")||[]).indexOf("merge-tag-focus-overlay")&&(i.channel("mergeTags").request("insert:tag",""),jQuery("#merge-tags-box").css("display","none"),i.channel("drawer").request("enable:close"),jQuery("#merge-tags-box").removeClass(),jQuery(".merge-tag-focus").removeClass("merge-tag-focus"),jQuery(".merge-tag-focus-overlay").removeClass("merge-tag-focus-overlay"))}));c[0].replace("{","")}else jQuery("#merge-tags-box").css("display","none"),i.channel("drawer").request("enable:close"),jQuery("#merge-tags-box").removeClass(),jQuery(".merge-tag-focus").removeClass("merge-tag-focus"),jQuery(".merge-tag-focus-overlay").removeClass("merge-tag-focus-overlay")}}})})),n("controllers/app/itemSettingFill",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("app"),"before:renderSetting",this.beforeRenderSetting)},beforeRenderSetting:function(e,t){e.get("fill")}})})),n("controllers/app/confirmPublish",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("app"),"click:confirmPublish",this.confirmPublish)},confirmPublish:function(){var e=i.channel("app").request("get:formModel");1==e.get("settings").get("add_submit")&&i.channel("fields").request("add",{type:"submit",label:"Submit",order:9999}),e.set("show_publish_options",!1),i.channel("app").request("update:db","publish")}})})),n("controllers/app/rte",[],(function(){return Marionette.Object.extend({initialize:function(){i.channel("setting-type-rte").reply("renderOnChange",(function(){return!1})),this.listenTo(i.channel("rte"),"init:settingModel",this.initSettingModel),this.listenTo(i.channel("setting-type-rte"),"render:setting",this.renderSetting),this.listenTo(i.channel("setting-type-rte"),"destroy:setting",this.destroySetting),this.listenTo(i.channel("setting-type-rte"),"click:extra",this.clickExtra),this.meta_image_frame,jQuery.summernote.options.icons={align:"dashicons dashicons-editor-alignleft",alignCenter:"dashicons dashicons-editor-aligncenter",alignJustify:"dashicons dashicons-editor-justify",alignLeft:"dashicons dashicons-editor-alignleft",alignRight:"dashicons dashicons-editor-alignright",indent:"dashicons dashicons-editor-indent",outdent:"dashicons dashicons-editor-outdent",bold:"dashicons dashicons-editor-bold",caret:"dashicons dashicons-arrow-down",close:"dashicons dashicons-dismiss",code:"dashicons dashicons-editor-code",eraser:"dashicons dashicons-editor-removeformatting",italic:"dashicons dashicons-editor-italic",link:"dashicons dashicons-admin-links",unlink:"dashicons dashicons-editor-unlink",magic:"dashicons dashicons-editor-paragraph",minus:"dashicons dashicons-minus",orderedlist:"dashicons dashicons-editor-ol",redo:"dashicons dashicons-redo",square:"dashicons fa-square",table:"dashicons dashicons-editor-table",underline:"dashicons dashicons-editor-underline",undo:"dashicons dashicons-undo",unorderedlist:"dashicons dashicons-editor-ul"},this.currentContext={}},initSettingModel:function(e){e.set("hide_merge_tags",!0)},initRTE:function(e,t,n){var r=this,a=this.mergeTags();jQuery(n.el).find("div.setting").summernote({toolbar:[["paragraphStyle",["style"]],["fontStyle",["bold","italic","underline","clear"]],["lists",["ul","ol"]],["paragraph",["paragraph"]],["customGroup",["linkButton","unlink"]],["table",["table"]],["actions",["undo","redo"]],["tools",["mediaButton","mergeTags","codeview"]]],buttons:{linkButton:function(e){return r.linkButton(e)},mergeTags:a,mediaButton:function(e){return r.mediaButton(e)}},height:150,codemirror:{theme:"monokai",lineNumbers:!0,lineWrapping:!0,callbacks:{onBlur:function(n){var i=n.getValue();r.updateDataModel(e,t,i)}}},prettifyHtml:!0,callbacks:{onBlur:function(n,a){var l=jQuery(this).summernote("code");r.updateDataModel(e,t,l),i.channel("summernote").trigger("blur",e,t,l)},onFocus:function(e,t){i.channel("summernote").trigger("focus",e,this,t)},onKeydown:function(e,t){i.channel("summernote").trigger("keydown",e,this,t)},onKeyup:function(e,t){i.channel("summernote").trigger("keyup",e,this,t)}}})},updateDataModel:function(e,t,n){var r=e.get("name"),a=t.get(r),l=n,s={attr:r,before:a,after:l},o={object:t.get("objectType"),label:t.get("label"),change:"Changed "+e.get("label")+" from "+a+" to "+l};i.channel("changes").request("register:change","changeSetting",t,s,o),t.set(e.get("name"),l)},renderSetting:function(e,t,n){this.initRTE(e,t,n);var i=jQuery(n.el).find(".link-button").next(".dropdown-menu").find("button");i.replaceWith((function(){return jQuery("
",{class:jQuery(i).attr("class"),html:this.innerHTML})}))},destroySetting:function(e,t,n){this.removeRTE(e,t,n)},removeRTE:function(e,t,n){jQuery(n.el).find("div.setting").summernote("destroy")},drawerOpened:function(e,t,n){this.initRTE(e,t,n)},linkButton:function(e){var t=this,n=jQuery.summernote.ui,r=i.channel("app").request("get:template","#tmpl-nf-rte-link-button"),a=i.channel("app").request("get:template","#tmpl-nf-rte-link-dropdown");return n.buttonGroup([n.button({className:"dropdown-toggle link-button",contents:r({}),tooltip:"Insert Link",click:function(n){t.clickLinkButton(n,e)},data:{toggle:"dropdown"}}),n.dropdown([n.buttonGroup({children:[n.button({contents:a({}),tooltip:""})]})])]).render()},mergeTags:function(e){var t=jQuery.summernote.ui,n=i.channel("app").request("get:template","#tmpl-nf-rte-merge-tags-button");return t.button({className:"dropdown-toggle merge-tags",contents:n({}),tooltip:"Merge Tags"}).render()},mediaButton:function(e){var t=this,n=jQuery.summernote.ui,r=i.channel("app").request("get:template","#tmpl-nf-rte-media-button");return n.button({className:"dropdown-toggle",contents:r({}),tooltip:"Insert Media",click:function(n){t.openMediaManager(n,e)}}).render()},openMediaManager:function(e,t){if(t.invoke("editor.createRange"),t.invoke("editor.saveRange"),this.currentContext=t,this.meta_image_frame)this.meta_image_frame.open();else{this.meta_image_frame=wp.media.frames.meta_image_frame=wp.media({title:"Select a file",button:{text:"insert"}});var n=this;this.meta_image_frame.on("select",(function(){var e=n.meta_image_frame.state().get("selection").first().toJSON();n.insertMedia(e,t)})),this.meta_image_frame.open()}},clickLinkButton:function(e,t){var n=t.invoke("editor.createRange");t.invoke("editor.saveRange");var i=n.toString();this.currentContext=t,jQuery(e.target).closest(".note-customGroup > .note-btn-group").on("hide.bs.dropdown",(function(e){return!1})),jQuery(e.target).closest(".note-customGroup > .note-btn-group").on("shown.bs.dropdown",(function(e){jQuery(e.target).parent().parent().find(".link-text").val(i),jQuery(e.target).parent().parent().find(".link-url").focus()}))},clickExtra:function(e,t,n,i){var r=jQuery(e.target).parent().find(".link-text"),a=jQuery(e.target).parent().find(".link-url"),l=jQuery(e.target).parent().find(".link-new-window");if(this.currentContext.invoke("editor.restoreRange"),jQuery(e.target).hasClass("insert-link")){var s=r.val(),o=a.val(),c=!!l.prop("checked");0!=s.length&&0!=o.length&&this.currentContext.invoke("editor.createLink",{text:s,url:o,isNewWindow:c})}r.val(""),a.val(""),l.prop("checked",!1),jQuery(e.target).closest("div.note-btn-group.open").removeClass("open")},insertMedia:function(e,t){this.currentContext.invoke("editor.restoreRange"),"image"==e.type?this.currentContext.invoke("editor.insertImage",e.url):this.currentContext.invoke("editor.createLink",{text:e.title||e.filename,url:e.url})}})})),n("controllers/app/settingFieldSelect",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("field-select"),"init:settingModel",this.trackKeyChanges),this.listenTo(i.channel("setting-type-field-select"),"before:renderSetting",this.beforeRender),this.listenTo(i.channel("field-select"),"init:settingModel",(function(){this.listenTo(i.channel("app"),"change:setting",this.maybeSwitchToFieldsDomain)})),this.listenTo(i.channel("app"),"change:currentDomain",this.autoOpenDrawer),this.listenTo(i.channel("drawer"),"opened",this.filterDrawerContents),this.listenTo(i.channel("drawer"),"closed",this.SwitchToFieldsDomain)},trackKeyChanges:function(e){e.listenTo(i.channel("app"),"update:fieldKey",e.updateKey),this.listenTo(i.channel("app"),"replace:fieldKey",this.updateFieldMap)},updateFieldMap:function(e,t,n){var i=t._previousAttributes.key,r=t.get("key");"field-select"==n.get("type")&&e.get(n.get("name"))==i&&e.set(n.get("name"),r)},beforeRender:function(e,t){var n=i.channel("fields").request("get:collection"),r=e.get("field_types"),a=[{label:"--",value:0}];_.each(n.models,(function(n){if(t.cid!=n.cid&&(void 0===r||0==r.length||_.contains(r,n.get("type")))){var i=e.get("field_filter");if(i&&void 0!==i[n.get("type")]){var l=!1;if(_.each(i[n.get("type")],(function(e,t){console.log(e+":"+n.get(t)),e!=n.get(t)&&(l=!0)})),l)return}var s=n.get("key");if("key"===e.get("field_value_format"))s=n.get("key");else s="{field:"+n.get("key")+"}";a.push({label:n.get("label"),value:s})}})),void 0!==r&&0!=r.length&&_.each(r,(function(e){var t=i.channel("fields").request("get:type",e);a.push({label:"-- Add "+t.get("nicename")+" Field",value:"addField:"+e})})),e.set("options",a)},maybeSwitchToFieldsDomain:function(e,t,n){if("field-select"==t.get("type")){var r=t.get("name"),a=n.get(r);if(a){var l=a.split(":");"addField"==l[0]&&(this.openDrawer="addField",this.filterDrawer=l[1],n.set(r,""),this.switchDomain=!0,i.channel("app").request("close:drawer"))}}},SwitchToFieldsDomain:function(){if(this.switchDomain){var e=i.channel("app").request("get:domainModel","fields");i.channel("app").request("change:currentDomain",null,e),this.switchDomain=null}},autoOpenDrawer:function(){this.openDrawer&&(i.channel("app").request("open:drawer",this.openDrawer),this.openDrawer=null)},filterDrawerContents:function(){this.filterDrawer&&(i.channel("drawer-addField").trigger("change:filter",this.filterDrawer),this.filterDrawer=null)}})})),n("controllers/app/settingFieldList",["views/app/drawer/typeSettingFieldset","models/app/settingCollection"],(function(e,t){return Marionette.Object.extend({fieldListSettings:[],initialize:function(){this.listenTo(i.channel("field-list"),"init:settingModel",this.registerFieldListSettings),this.listenTo(i.channel("fields"),"update:setting",this.updateFieldListSettingKeys),i.channel("field-list").reply("get:settingChildView",this.getSettingChildView,this)},registerFieldListSettings:function(e){this.fieldListSettings.push(e.get("name"))},updateFieldListSettingKeys:function(e){if(void 0!==e.changed.key){var t=e._previousAttributes.key,n=e.changed.key,i=this;_.each(Backbone.Radio.channel("actions").request("get:collection").models,(function(e){_.each(e.attributes,(function(r,a){var l="";_.each(i.fieldListSettings,(function(i){if(a==i+"-"+t&&l!=t){var r=e.get(i+"-"+t);e.set(i+"-"+n,r),e.set(i+"-"+t,0),l=t}}))}))}))}},getSettingChildView:function(n){var r=_.filter(i.channel("fields").request("get:collection").models,(function(e){return _.contains(n.get("field_types"),e.get("type"))})),a=_.map(r,(function(e){return{name:n.get("name")+"-"+e.get("key"),type:"toggle",label:e.get("label"),width:"full"}}));return n.set("settings",new t(a)),e}})})),n("controllers/app/settingHTML",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("setting-type-html"),"before:renderSetting",this.init)},init:function(e,t){"undefined"!=e.get("mirror")&&t.on("change:"+e.get("mirror"),this.update,e)},update:function(e,t){e.set(this.get("name"),t)}})})),n("controllers/app/settingColor",[],(function(){return Marionette.Object.extend({initialize:function(){i.channel("setting-type-color").reply("renderOnChange",this.setRenderFalse),this.listenTo(i.channel("setting-type-color"),"destroy:setting",this.closeColorPickers),this.listenTo(i.channel("setting-type-color"),"render:setting",this.initColorPicker)},initColorPicker:function(e,t,n){e.get("name");var r=jQuery(n.el).find("input");jQuery(r).wpColorPicker({change:function(n,r){i.channel("app").request("change:setting",n,e,t,r.color.toString())}})},setRenderFalse:function(){return!1},closeColorPickers:function(e,t,n){jQuery(n.el).find(".wp-color-picker").wpColorPicker("close")}})})),n("controllers/app/changeMenu",[],(function(){return Marionette.Object.extend({editFormText:"",initialize:function(){this.editFormText=nfAdmin.editFormText||"Edit Form",this.listenTo(i.channel("app"),"after:appStart",this.changeMenu),this.listenTo(i.channel("app"),"response:updateDB",this.formPublish)},changeMenu:function(){var e=i.channel("app").request("get:formModel");this.isNewForm(e.id)?this.highlightAddNew():this.appendEditForm()},isNewForm:function(e){return isNaN(e)},highlightAddNew:function(){jQuery(".wp-submenu li").removeClass("current"),jQuery('a[href="admin.php?page=ninja-forms&form_id=new"]').parent().addClass("current")},appendEditForm:function(){var e,t,n;jQuery('li a:contains("'+this.editFormText+'")').length>0||(e=document.createTextNode(this.editFormText),(t=document.createElement("a")).appendChild(e),(n=document.createElement("li")).appendChild(t),n.classList.add("current"),jQuery(".wp-submenu li").removeClass("current"),jQuery('a[href="admin.php?page=ninja-forms#new-form"]').parent().after(n))},formPublish:function(e){if("publish"!==e.action)return!1;this.changeMenu()}})})),n("controllers/app/mobile",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("app"),"click:menu",this.closeMobileMenu)},closeMobileMenu:function(){var e=i.channel("app").request("get:builderEl");jQuery(e).removeClass("nf-menu-expand")}})})),n("controllers/app/notices",[],(function(){return Marionette.Object.extend({initialize:function(){i.channel("notices").reply("add",this.addNotice,this),i.channel("notices").reply("close",this.closeNotice,this),this.notices={}},addNotice:function(e,t,n){var r={content:t,color:"green",zIndex:1e7,constructOnInit:!0,stack:!0,animation:{open:"flip",close:"flip"}};if(i.channel("app").request("is:mobile"))var a={position:{x:"center",y:"top"},animation:{open:"slide:top",close:"slide:left"},autoClose:2e3,offset:{x:0,y:55}};else a={attributes:{x:"left",y:"bottom"},autoClose:4e3};a=jQuery.extend(a,r);n=jQuery.extend(a,n);this.notices[e]=new jBox("Notice",n)},closeNotice:function(e){void 0!==this.notices[e]&&this.notices[e].close()},openNotice:function(e){void 0!==this.notices[e]&&this.notices[e].open()}})})),n("controllers/app/unloadCheck",[],(function(){return Marionette.Object.extend({initialize:function(){jQuery(window).bind("beforeunload",this.maybePrompt)},maybePrompt:function(e){if(!i.channel("app").request("get:setting","clean"))return"You have unsaved changes."}})})),n("controllers/app/formContentFilters",[],(function(){return Marionette.Object.extend({initialize:function(){this.viewFilters=[],this.saveFilters=[],this.loadFilters=[],i.channel("formContent").reply("add:viewFilter",this.addViewFilter,this),i.channel("formContent").reply("add:saveFilter",this.addSaveFilter,this),i.channel("formContent").reply("add:loadFilter",this.addLoadFilter,this),i.channel("formContent").reply("get:viewFilters",this.getViewFilters,this),i.channel("formContent").reply("get:saveFilters",this.getSaveFilters,this),i.channel("formContent").reply("get:loadFilters",this.getLoadFilters,this),i.channel("fieldContents").reply("add:viewFilter",this.addViewFilter,this),i.channel("fieldContents").reply("add:saveFilter",this.addSaveFilter,this),i.channel("fieldContents").reply("add:loadFilter",this.addLoadFilter,this),i.channel("fieldContents").reply("get:viewFilters",this.getViewFilters,this),i.channel("fieldContents").reply("get:saveFilters",this.getSaveFilters,this),i.channel("fieldContents").reply("get:loadFilters",this.getLoadFilters,this)},addViewFilter:function(e,t){this.viewFilters[t]=e},getViewFilters:function(){return this.viewFilters},addSaveFilter:function(e,t){this.saveFilters[t]=e},getSaveFilters:function(){return this.saveFilters},addLoadFilter:function(e,t){this.loadFilters[t]=e},getLoadFilters:function(){return this.loadFilters}})})),n("controllers/app/formContentGutterFilters",[],(function(){return Marionette.Object.extend({initialize:function(){this.leftFilters=[],this.rightFilters=[],i.channel("formContentGutters").reply("add:leftFilter",this.addLeftFilter,this),i.channel("formContentGutters").reply("add:rightFilter",this.addRightFilter,this),i.channel("formContentGutters").reply("get:leftFilters",this.getLeftFilters,this),i.channel("formContentGutters").reply("get:rightFilters",this.getRightFilters,this)},addLeftFilter:function(e,t){this.leftFilters[t]=e},addRightFilter:function(e,t){this.rightFilters[t]=e},getLeftFilters:function(){return this.leftFilters},getRightFilters:function(){return this.rightFilters}})})),n("controllers/app/cloneCollectionDeep",[],(function(){return Marionette.Object.extend({initialize:function(){i.channel("app").reply("clone:collectionDeep",this.cloneCollectionDeep,this)},cloneCollectionDeep:function(e){var t=[];return _.each(e.models,(function(e){var n=i.channel("app").request("clone:modelDeep",e);t.push(n)})),new e.constructor(t,e.options)}})})),n("controllers/app/trackKeyDown",[],(function(){return Marionette.Object.extend({keys:[],initialize:function(){var e=this;jQuery(document).on("keydown",(function(t){e.keyDown(t,e)})),jQuery(document).on("keyup",(function(t){e.keyUp(t,e)})),i.channel("app").reply("get:keydown",this.getKeyDown,this)},keyDown:function(e,t){t.keys[e.keyCode]=e.keyCode},keyUp:function(e,t){-1!=t.keys.indexOf(e.keyCode)&&delete t.keys[e.keyCode]},getKeyDown:function(){return this.keys}})})),n("controllers/app/perfectScroll",[],(function(){return Marionette.Object.extend({movedPos:!1,initialize:function(){this.listenTo(i.channel("main"),"show:main",this.initPerfectScroll),this.listenTo(i.channel("drawer"),"opened",this.moveRail),this.listenTo(i.channel("drawer"),"before:closeDrawer",this.resetRail)},initPerfectScroll:function(e){i.channel("app").request("is:mobile")||jQuery(e.el).parent().perfectScrollbar({suppressScrollX:!0}),jQuery("head").append('')},moveRail:function(){var e=i.channel("app").request("get:drawerEl"),t=jQuery(e).outerWidth();jQuery("#ps-scrollbar-css").text(".ps-scrollbar-moved { right: "+t+"px !important; } "),jQuery("#nf-main .ps-scrollbar-y-rail").addClass("ps-scrollbar-moved ")},resetRail:function(){jQuery(".ps-scrollbar-y-rail").removeClass("ps-scrollbar-moved ")}})})),n("controllers/app/getNewSettingGroupCollection",["models/app/settingGroupCollection"],(function(e){return Marionette.Object.extend({initialize:function(){i.channel("app").reply("get:settingGroupCollectionDefinition",this.getNewSettingGroupCollection,this)},getNewSettingGroupCollection:function(){return e}})})),n("controllers/app/settingMedia",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("setting-type-media"),"click:extra",this.clickExtra)},clickExtra:function(e,t,n,i){var r=jQuery(e.target).parent().find(".setting");if(jQuery(e.target).hasClass("open-media-manager")){if(this.meta_image_frame)return void this.meta_image_frame.open();this.meta_image_frame=wp.media.frames.meta_image_frame=wp.media({title:"Select a file",button:{text:"insert"}});var a=this;this.meta_image_frame.on("select",(function(){var e=a.meta_image_frame.state().get("selection").first().toJSON();r.val(e.url).change()})),this.meta_image_frame.open()}}})})),n("controllers/app/publicLink",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("app"),"after:appStart",this.validatePublicLink,this),i.channel("app").reply("generate:publicLinkKey",this.newPublicLinkKey,this)},newPublicLinkKey:function(){for(var e=i.channel("settings").request("get:settings"),t=i.channel("app").request("get:formModel").get("id"),n=0;n<4;n++){t+=Math.random().toString(36).slice(-1)}return e.set("public_link_key",t),t},validatePublicLink:function(){var e=i.channel("app").request("get:formModel").get("id"),t=i.channel("settings").request("get:settings");if(void 0===t.get("public_link_key"))return!1;if(0===t.get("public_link_key").indexOf(e))return!1;var n=this.newPublicLinkKey(),r=nfAdmin.publicLinkStructure.replace("[FORM_ID]",n);t.set("public_link",r)}})})),n("models/fields/typeSectionModel",[],(function(){return Backbone.Model.extend({defaults:{classes:""}})})),n("models/fields/typeSectionCollection",["models/fields/typeSectionModel"],(function(e){return Backbone.Collection.extend({model:e})})),n("controllers/fields/types",["models/app/typeCollection","models/fields/typeSectionCollection"],(function(e,t){return Marionette.Object.extend({initialize:function(){this.sections=new t(fieldTypeSections),this.listenTo(i.channel("fields"),"init:typeModel",this.registerSection),this.collection=new e(fieldTypeData,{type:"fields"}),i.channel("fields").reply("get:type",this.getFieldType,this),i.channel("fields").reply("get:typeCollection",this.getTypeCollection,this),i.channel("fields").reply("get:typeSections",this.getTypeSections,this),i.channel("fields").reply("get:savedFields",this.getSavedFields,this),this.listenTo(i.channel("drawer"),"click:fieldType",this.addField)},registerSection:function(e){"fields"==e.collection.type&&e.get("section")&&this.sections.get(e.get("section")).get("fieldTypes").push(e.get("id"))},getFieldType:function(e){return this.collection.get(e)},getTypeCollection:function(e){return this.collection},addField:function(e){var t=jQuery(e.target).data("id");if(e.shiftKey)i.channel("fields").request("add:stagedField",t);else{var n=i.channel("fields").request("add",{type:t,label:i.channel("fields").request("get:type",t).get("nicename")});console.log(n);var r={object:"Field",label:n.get("label"),change:"Added",dashicon:"plus-alt"},a={collection:i.channel("fields").request("get:collection")};i.channel("changes").request("register:change","addObject",n,null,r,a),i.channel("fields").request("redraw:collection")}},getTypeSections:function(){return this.sections},getSavedFields:function(){this.sections.get("saved")}})})),n("controllers/fields/fieldTypeDrag",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("drawer-addField"),"startDrag:type",this.startDrag),this.listenTo(i.channel("drawer-addField"),"stopDrag:type",this.stopDrag),i.channel("drawer-addField").reply("get:typeHelperClone",this.getCurrentDraggableHelperClone,this)},startDrag:function(e,t){this.drawerEl=i.channel("app").request("get:drawerEl"),this.mainEl=i.channel("app").request("get:mainEl"),jQuery(this.drawerEl)[0].style.setProperty("overflow","visible","important"),this.draggableHelperClone=jQuery(t.helper).clone()},stopDrag:function(e,t){jQuery(this.drawerEl)[0].style.setProperty("overflow","hidden","important")},getCurrentDraggableHelperClone:function(){return this.draggableHelperClone}})})),n("controllers/fields/stagingDrag",[],(function(){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("drawer-addField"),"startDrag:fieldStaging",this.startDrag),this.listenTo(i.channel("drawer-addField"),"stopDrag:fieldStaging",this.stopDrag)},startDrag:function(e,t){this.drawerEl=i.channel("app").request("get:drawerEl"),this.mainEl=i.channel("app").request("get:mainEl"),jQuery(this.drawerEl)[0].style.setProperty("overflow","visible","important");var n=i.channel("fields").request("get:staging"),r=i.channel("app").request("get:template","#tmpl-nf-staged-fields-drag");jQuery(t.helper).html(r({num:n.models.length})),jQuery(t.helper).prop("id","nf-staged-fields-drag"),jQuery(t.item).css("opacity","0.7")},stopDrag:function(e,t){jQuery(this.drawerEl)[0].style.setProperty("overflow","hidden","important")}})})),n("controllers/fields/staging",["models/fields/stagingCollection"],(function(e){return Marionette.Object.extend({initialize:function(){this.collection=new e,i.channel("fields").reply("add:stagedField",this.addStagedField,this),i.channel("fields").reply("remove:stagedField",this.removeStagedField,this),i.channel("fields").reply("get:staging",this.getStagingCollection,this),i.channel("fields").reply("sort:staging",this.sortStagedFields,this),i.channel("fields").reply("clear:staging",this.clearStagedFields,this),this.listenTo(i.channel("drawer-addField"),"click:removeStagedField",this.removeStagedField),this.listenTo(i.channel("drawer-addField"),"before:closeDrawer",this.beforeCloseDrawer)},getStagingCollection:function(){return this.collection},addStagedField:function(e,t){t=t||!1;var n=i.channel("fields").request("get:type",e);if(void 0!==n.get("modal_content"))return!1;var r="nf-staged-field-"+jQuery.now(),a={id:r,slug:n.get("type"),nicename:n.get("nicename"),icon:n.get("icon")},l=this.collection.add(a);return t||i.channel("fields").trigger("add:stagedField",l),r},removeStagedField:function(e,t){this.collection.remove(t),i.channel("fields").trigger("remove:stagedField",t)},beforeCloseDrawer:function(){if(0!=this.collection.models.length){var e=i.channel("fields").request("get:collection");_.each(this.collection.models,(function(t){var n={id:i.channel("fields").request("get:tmpID"),label:t.get("nicename"),type:t.get("slug")},r=i.channel("fields").request("add",n,!1),a={object:"Field",label:r.get("label"),change:"Added",dashicon:"plus-alt"},l={collection:e};i.channel("changes").request("register:change","addObject",r,null,a,l)})),e.trigger("reset",e),this.collection.reset()}i.channel("fields").request("sort:fields",null,null,!1)},sortStagedFields:function(){var e=i.channel("app").request("get:stagedFieldsEl"),t=jQuery(e).sortable("toArray");_.each(this.collection.models,(function(e){var n=e.get("id"),i=t.indexOf(n);e.set("order",i)})),this.collection.sort()},clearStagedFields:function(){this.collection.reset()}})})),n("controllers/fields/stagingSortable",["models/fields/stagingCollection"],(function(e){return Marionette.Object.extend({initialize:function(){this.listenTo(i.channel("drawer-addField"),"receive:stagedFields",this.receiveStagedFields),this.listenTo(i.channel("drawer-addField"),"over:stagedFields",this.overStagedFields),this.listenTo(i.channel("drawer-addField"),"out:stagedFields",this.outStagedFields),this.listenTo(i.channel("drawer-addField"),"start:stagedFields",this.startStagedFields),this.listenTo(i.channel("drawer-addField"),"stop:stagedFields",this.stopStagedFields)},receiveStagedFields:function(e){if(jQuery(e.item).hasClass("nf-field-type-draggable")){var t=jQuery(e.item).data("id"),n=i.channel("fields").request("add:stagedField",t);jQuery(e.helper).prop("id",n),i.channel("fields").request("sort:staging"),jQuery(e.helper).remove(),i.channel("drawer-addField").trigger("drop:fieldType",t)}},addActiveClass:function(){var e=i.channel("app").request("get:stagedFieldsEl");jQuery(e).addClass("nf-droppable-active")},removeActiveClass:function(){var e=i.channel("app").request("get:stagedFieldsEl");jQuery(e).removeClass("nf-droppable-active")},overStagedFields:function(e,t){if(jQuery(t.item).hasClass("nf-field-type-draggable")){var n=jQuery(t.item).data("id"),r=i.channel("fields").request("get:type",n).get("nicename");this.currentHelper=t.helper,jQuery(t.helper).html(r+''),jQuery(t.helper).removeClass("nf-field-type-button").addClass("nf-item-dock").css({opacity:"0.8",width:"",height:""});var a=i.channel("app").request("get:stagedFieldsEl");jQuery(a).hasClass("ui-sortable")&&jQuery(a).addClass("nf-droppable-hover")}},outStagedFields:function(e){if(jQuery(e.item).hasClass("nf-field-type-draggable")){var t=i.channel("drawer-addField").request("get:typeHelperClone");jQuery(this.currentHelper).html(jQuery(t).html()),jQuery(this.currentHelper).removeClass("nf-item-dock").addClass("nf-field-type-button");var n=i.channel("app").request("get:stagedFieldsEl");jQuery(n).hasClass("ui-sortable")&&jQuery(n).removeClass("nf-droppable-hover")}},startStagedFields:function(e){jQuery(e.item).show(),jQuery(e.item).css({display:"inline",opacity:"0.7"}),jQuery(e.helper).css("opacity","0.5")},stopStagedFields:function(e){jQuery(e.item).css("opacity",""),jQuery(e.helper).remove()}})})),n("controllers/fields/filterTypes",["models/fields/typeSectionCollection"],(function(e){return Marionette.Object.extend({initialize:function(){this.hiddenFields=["product","quantity","shipping","total","button"],this.listenTo(i.channel("app"),"add:hiddenFields",this.addHiddenFieldTypes),this.listenTo(i.channel("drawer-addField"),"change:filter",this.filterFieldTypes),i.channel("app").trigger("request:hiddenFields",this)},filterFieldTypes:function(t,n){if(""!=String(t).trim()){var r=[];_.each(this.filterCollection(t),(function(e){r.push(e.get("id"))}));for(var a=new e([{id:"filtered",nicename:"Filtered Fields",fieldTypes:r}]),l=a.models[0].get("fieldTypes").length-1;l>=0;l--){-11&&-1!=t.toLowerCase().indexOf(e.replace("#",""))&&(n=!0)})),t.get("alias")&&_.each(t.get("alias"),(function(t){-1!=t.toLowerCase().indexOf(e)&&(n=!0)})),n}))}})})),n("views/fields/preview/element",[],(function(){return Marionette.ItemView.extend({tagName:"div",template:"#tmpl-nf-field-input",initialize:function(){var e=this.model.get("type");if(this.model.set("value",this.model.get("default")),"date"==e&&this.model.get("date_default")){var t=this.model.get("date_format");"default"!=t&&""!=t||(t=this.convertDateFormat(nfAdmin.dateFormat));var n=moment.locale();moment.locales().includes("ninja-forms")||moment.defineLocale("ninja-forms",{months:nfi18n.months,monthsShort:nfi18n.monthsShort,weekdays:nfi18n.weekdays,weekdaysShort:nfi18n.weekdaysShort,weekdaysMin:nfi18n.weekdaysMin}),this.model.set("value",moment().format(t)),moment.locale(n)}"phone"==e&&(e="tel"),"spam"==e&&(e="input"),"confirm"==e&&(e="input"),"password"==e&&(e="input"),"passwordconfirm"==e&&(e="input"),"quantity"==e&&(e="number"),"terms"==e&&(e="listcheckbox"),"liststate"==e&&(e="listselect"),"listcountry"==e&&(e="listselect"),"listmultiselect"==e&&(e="listselect"),"save"==e&&(e="submit"),1==jQuery("#tmpl-nf-builder-field-"+e).length?this.template="#tmpl-nf-builder-field-"+e:this.template="#tmpl-nf-field-"+e},onRender:function(){this.model.get("container_class").includes("two-col-list")&&(jQuery(this.el).find("> ul").css("display","grid"),jQuery(this.el).find("> ul").css("grid-template-columns","repeat(2, 1fr)")),this.model.get("container_class").includes("three-col-list")&&(jQuery(this.el).find("> ul").css("display","grid"),jQuery(this.el).find("> ul").css("grid-template-columns","repeat(3, 1fr)")),this.model.get("container_class").includes("four-col-list")&&(jQuery(this.el).find("> ul").css("display","grid"),jQuery(this.el).find("> ul").css("grid-template-columns","repeat(4, 1fr)"))},templateHelpers:function(){return{renderClasses:function(){},maybeFilterHTML:function(){return void 0!==nfAdmin.filter_esc_status?nfAdmin.filter_esc_status:"false"},renderPlaceholder:function(){if(void 0!==this.placeholder)return'placeholder="'+String(_.escape(this.placeholder)).trim()+'"'},maybeDisabled:function(){if(void 0!==this.disable_input&&this.disable_input)return'disabled="disabled"'},maybeRequired:function(){},maybeInputLimit:function(){},maybeDisableAutocomplete:function(){},maybeChecked:function(){if("checked"==this.default_value)return' checked="checked"'},renderOptions:function(){let e;switch(this.type){case"terms":if(!this.taxonomy)return"(No taxonomy selected)";var t=fieldTypeData.find((function(e){return"terms"==e.id})).settingGroups.find((function(e){return"primary"==e.id})).settings.find((function(e){return"taxonomy_terms"==e.name})).settings,n=Object.keys(this).filter(function(e){return 0==e.indexOf("taxonomy_term_")&&this[e]}.bind(this));return 0==n.length?"(No available terms selected)":n.reduce(function(e,n){var i=t.find((function(e){return n==e.name}));return void 0===i?e:e+'
  • '+i.label+"
  • "}.bind(this),"");case"liststate":case"listselect":if(0==this.options.models.length)return"";var i=this.options.models.filter((function(e){return e.get("selected")}));return 0==i.length&&(i=this.options.models),e=void 0!==nfAdmin.filter_esc_status&&"true"===nfAdmin.filter_esc_status?_.escape(i[0].get("label")):i[0].get("label"),"";case"listmultiselect":return this.options.models.reduce((function(t,n){return e=void 0!==nfAdmin.filter_esc_status&&"true"===nfAdmin.filter_esc_status?_.escape(n.get("label")):n.get("label"),t+""+e+""}),"");case"listcheckbox":return this.options.models.reduce((function(t,n){return e=void 0!==nfAdmin.filter_esc_status&&"true"===nfAdmin.filter_esc_status?_.escape(n.get("label")):n.get("label"),t+'
  • "+e+"
  • "}),"");case"listradio":var r=!1;return this.options.models.reduce((function(t,n){return e=void 0!==nfAdmin.filter_esc_status&&"true"===nfAdmin.filter_esc_status?_.escape(n.get("label")):n.get("label"),t+'
  • "+e+"
  • "}),"");case"listcountry":var a=this.default,l=fieldTypeData.find((function(e){return"listcountry"==e.id})).settingGroups.find((function(e){return"primary"==e.id})).settings.find((function(e){return"default"==e.name})).options.find((function(e){return a==e.value}));return e=void 0!==l?l.label:"--",e=void 0!==nfAdmin.filter_esc_status&&"true"===nfAdmin.filter_esc_status?_.escape(e):e,"";default:return""}},renderOtherAttributes:function(){var e=[];if("listmultiselect"==this.type){e.push("multiple");var t=this.multi_size||"5";e.push('size="'+t+'"')}return e.join(" ")},renderProduct:function(){},renderNumberDefault:function(){return this.value},renderCurrencyFormatting:function(){},renderRatings:function(){for(var e="",t=0;t