{"version":3,"names":[],"mappings":"","sources":["main.js"],"sourcesContent":["!function(){var e,t,i;!function(n){function r(e,t){return b.call(e,t)}function o(e,t){var i,n,r,o,a,l,s,d,c,f,u,h=t&&t.split(\"/\"),g=y.map,m=g&&g[\"*\"]||{};if(e&&\".\"===e.charAt(0))if(t){for(e=e.split(\"/\"),a=e.length-1,y.nodeIdCompat&&_.test(e[a])&&(e[a]=e[a].replace(_,\"\")),e=h.slice(0,h.length-1).concat(e),c=0;c<e.length;c+=1)if(\".\"===(u=e[c]))e.splice(c,1),c-=1;else if(\"..\"===u){if(1===c&&(\"..\"===e[2]||\"..\"===e[0]))break;c>0&&(e.splice(c-1,2),c-=2)}e=e.join(\"/\")}else 0===e.indexOf(\"./\")&&(e=e.substring(2));if((h||m)&&g){for(i=e.split(\"/\"),c=i.length;c>0;c-=1){if(n=i.slice(0,c).join(\"/\"),h)for(f=h.length;f>0;f-=1)if((r=g[h.slice(0,f).join(\"/\")])&&(r=r[n])){o=r,l=c;break}if(o)break;!s&&m&&m[n]&&(s=m[n],d=c)}!o&&s&&(o=s,l=d),o&&(i.splice(0,l,o),e=i.join(\"/\"))}return e}function a(e,t){return function(){var i=w.call(arguments,0);return\"string\"!=typeof i[0]&&1===i.length&&i.push(null),h.apply(n,i.concat([e,t]))}}function l(e){return function(t){return o(t,e)}}function s(e){return function(t){p[e]=t}}function d(e){if(r(v,e)){var t=v[e];delete v[e],R[e]=!0,u.apply(n,t)}if(!r(p,e)&&!r(R,e))throw new Error(\"No \"+e);return p[e]}function c(e){var t,i=e?e.indexOf(\"!\"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function f(e){return function(){return y&&y.config&&y.config[e]||{}}}var u,h,g,m,p={},v={},y={},R={},b=Object.prototype.hasOwnProperty,w=[].slice,_=/\\.js$/;g=function(e,t){var i,n=c(e),r=n[0];return e=n[1],r&&(r=o(r,t),i=d(r)),r?e=i&&i.normalize?i.normalize(e,l(t)):o(e,t):(e=o(e,t),n=c(e),r=n[0],e=n[1],r&&(i=d(r))),{f:r?r+\"!\"+e:e,n:e,pr:r,p:i}},m={require:function(e){return a(e)},exports:function(e){var t=p[e];return void 0!==t?t:p[e]={}},module:function(e){return{id:e,uri:\"\",exports:p[e],config:f(e)}}},u=function(e,t,i,o){var l,c,f,u,h,y,b=[],w=typeof i;if(o=o||e,\"undefined\"===w||\"function\"===w){for(t=!t.length&&i.length?[\"require\",\"exports\",\"module\"]:t,h=0;h<t.length;h+=1)if(u=g(t[h],o),\"require\"===(c=u.f))b[h]=m.require(e);else if(\"exports\"===c)b[h]=m.exports(e),y=!0;else if(\"module\"===c)l=b[h]=m.module(e);else if(r(p,c)||r(v,c)||r(R,c))b[h]=d(c);else{if(!u.p)throw new Error(e+\" missing \"+c);u.p.load(u.n,a(o,!0),s(c),{}),b[h]=p[c]}f=i?i.apply(p[e],b):void 0,e&&(l&&l.exports!==n&&l.exports!==p[e]?p[e]=l.exports:f===n&&y||(p[e]=f))}else e&&(p[e]=i)},e=t=h=function(e,t,i,r,o){if(\"string\"==typeof e)return m[e]?m[e](t):d(g(e,t).f);if(!e.splice){if(y=e,y.deps&&h(y.deps,y.callback),!t)return;t.splice?(e=t,t=i,i=null):e=n}return t=t||function(){},\"function\"==typeof i&&(i=r,r=o),r?u(n,e,t,i):setTimeout(function(){u(n,e,t,i)},4),h},h.config=function(e){return h(e)},e._defined=p,i=function(e,t,i){if(\"string\"!=typeof e)throw new Error(\"See almond README: incorrect module build, no module name\");t.splice||(i=t,t=[]),r(p,e)||r(v,e)||(v[e]=[e,t,i])},i.amd={jQuery:!0}}(),i(\"../lib/almond\",function(){}),i(\"models/fieldErrorModel\",[],function(){return Backbone.Model.extend({})}),i(\"models/fieldErrorCollection\",[\"models/fieldErrorModel\"],function(e){return Backbone.Collection.extend({model:e})}),i(\"models/fieldModel\",[\"models/fieldErrorCollection\"],function(e){return Backbone.Model.extend({defaults:{placeholder:\"\",value:\"\",label_pos:\"\",classes:\"ninja-forms-field\",reRender:!1,mirror_field:!1,confirm_field:!1,clean:!0,disabled:\"\",visible:!0,invalid:!1},initialize:function(){this.set(\"formID\",this.collection.options.formModel.get(\"id\")),this.listenTo(nfRadio.channel(\"form-\"+this.get(\"formID\")),\"reset\",this.resetModel),this.bind(\"change\",this.changeModel,this),this.bind(\"change:value\",this.changeValue,this),this.set(\"errors\",new e),nfRadio.channel(\"fields\").trigger(\"init:model\",this),nfRadio.channel(this.get(\"type\")).trigger(\"init:model\",this),nfRadio.channel(\"fields-\"+this.get(\"type\")).trigger(\"init:model\",this),\"undefined\"!=this.get(\"parentType\")&&nfRadio.channel(this.get(\"parentType\")).trigger(\"init:model\",this),this.listenTo(nfRadio.channel(\"form-\"+this.get(\"formID\")),\"loaded\",this.formLoaded),this.listenTo(nfRadio.channel(\"form-\"+this.get(\"formID\")),\"before:submit\",this.beforeSubmit)},changeModel:function(){nfRadio.channel(\"field-\"+this.get(\"id\")).trigger(\"change:model\",this),nfRadio.channel(this.get(\"type\")).trigger(\"change:model\",this),nfRadio.channel(\"fields\").trigger(\"change:model\",this)},changeValue:function(){nfRadio.channel(\"field-\"+this.get(\"id\")).trigger(\"change:modelValue\",this),nfRadio.channel(this.get(\"type\")).trigger(\"change:modelValue\",this),nfRadio.channel(\"fields\").trigger(\"change:modelValue\",this)},addWrapperClass:function(e){this.set(\"addWrapperClass\",e)},removeWrapperClass:function(e){this.set(\"removeWrapperClass\",e)},setInvalid:function(e){this.set(\"invalid\",e)},formLoaded:function(){nfRadio.channel(\"fields\").trigger(\"formLoaded\",this),nfRadio.channel(\"fields-\"+this.get(\"type\")).trigger(\"formLoaded\",this)},beforeSubmit:function(e){nfRadio.channel(this.get(\"type\")).trigger(\"before:submit\",this),nfRadio.channel(\"fields\").trigger(\"before:submit\",this)}})}),i(\"models/fieldCollection\",[\"models/fieldModel\"],function(e){return Backbone.Collection.extend({model:e,comparator:\"order\",initialize:function(e,t){this.options=t,this.on(\"reset\",function(e){nfRadio.channel(\"fields\").trigger(\"reset:collection\",e)},this)},validateFields:function(){_.each(this.models,function(e){e.set(\"clean\",!1),nfRadio.channel(\"submit\").trigger(\"validate:field\",e)},this)},showFields:function(){this.invoke(\"set\",{visible:!0}),this.invoke(function(){this.trigger(\"change:value\",this)})},hideFields:function(){this.invoke(\"set\",{visible:!1}),this.invoke(function(){this.trigger(\"change:value\",this)})}})}),i(\"models/formErrorModel\",[],function(){return Backbone.Model.extend({})}),i(\"models/formErrorCollection\",[\"models/formErrorModel\"],function(e){return Backbone.Collection.extend({model:e})}),i(\"models/formModel\",[\"models/fieldCollection\",\"models/formErrorCollection\"],function(e,t){return Backbone.Model.extend({defaults:{beforeForm:\"\",afterForm:\"\",beforeFields:\"\",afterFields:\"\",wrapper_class:\"\",element_class:\"\",hp:\"\",fieldErrors:{},extra:{}},initialize:function(){_.each(this.get(\"settings\"),function(e,t){this.set(t,e)},this),this.set(\"loadedFields\",this.get(\"fields\")),this.set(\"fields\",new e(this.get(\"fields\"),{formModel:this})),this.set(\"errors\",new t),nfRadio.channel(\"form\").trigger(\"before:filterData\",this);var i=this.get(\"formContentData\");i||(i=this.get(\"fieldContentsData\"));var n=nfRadio.channel(\"formContent\").request(\"get:loadFilters\"),r=_.without(n,void 0);i=_.first(r)(i,this,this),this.set(\"formContentData\",i),nfRadio.channel(\"forms\").trigger(\"init:model\",this),nfRadio.channel(\"form-\"+this.get(\"id\")).trigger(\"init:model\",this),nfRadio.channel(\"form-\"+this.get(\"id\")).reply(\"get:fieldByKey\",this.getFieldByKey,this),nfRadio.channel(\"form-\"+this.get(\"id\")).reply(\"add:error\",this.addError,this),nfRadio.channel(\"form-\"+this.get(\"id\")).reply(\"remove:error\",this.removeError,this),nfRadio.channel(\"form-\"+this.get(\"id\")).reply(\"get:extra\",this.getExtra,this),nfRadio.channel(\"form-\"+this.get(\"id\")).reply(\"add:extra\",this.addExtra,this),nfRadio.channel(\"form-\"+this.get(\"id\")).reply(\"remove:extra\",this.removeExtra,this),nfRadio.channel(\"form-\"+this.get(\"id\")).reply(\"get:form\",this.getForm,this),nfRadio.channel(\"form\").trigger(\"loaded\",this),nfRadio.channel(\"form\").trigger(\"after:loaded\",this),nfRadio.channel(\"form-\"+this.get(\"id\")).trigger(\"loaded\",this)},getFieldByKey:function(e){return this.get(\"fields\").findWhere({key:e})},addError:function(e,t){this.get(\"errors\").add({id:e,msg:t}),nfRadio.channel(\"form-\"+this.get(\"id\")).trigger(\"add:error\",this,e,t)},removeError:function(e){var t=this.get(\"errors\"),i=t.get(e);t.remove(i),nfRadio.channel(\"form-\"+this.get(\"id\")).trigger(\"remove:error\",this,e)},getExtra:function(e){var t=this.get(\"extra\");return void 0===e?t:t[e]},addExtra:function(e,t){this.get(\"extra\")[e]=t,nfRadio.channel(\"form-\"+this.get(\"id\")).trigger(\"add:extra\",this,e,t)},removeExtra:function(e){delete this.get(\"extra\")[e],nfRadio.channel(\"form-\"+this.get(\"id\")).trigger(\"remove:extra\",this,e)},getForm:function(){return this}})}),i(\"models/formCollection\",[\"models/formModel\"],function(e){return Backbone.Collection.extend({model:e})}),i(\"controllers/formData\",[\"models/formModel\",\"models/formCollection\",\"models/fieldCollection\",\"models/formErrorCollection\"],function(e,t,i,n){return Marionette.Object.extend({initialize:function(){this.collection=new t(nfForms),nfRadio.channel(\"forms\").trigger(\"loaded\",this.collection),nfRadio.channel(\"app\").trigger(\"forms:loaded\",this.collection),nfRadio.channel(\"app\").reply(\"get:form\",this.getForm,this),nfRadio.channel(\"app\").reply(\"get:forms\",this.getForms,this),nfRadio.channel(\"fields\").reply(\"get:field\",this.getField,this)},getForm:function(e){return this.collection.get(e)},getForms:function(){return this.collection},getField:function(e){var t=!1;return _.each(this.collection.models,function(i){t||(t=i.get(\"fields\").get(e))}),t}})}),i(\"controllers/fieldError\",[\"models/fieldErrorModel\"],function(e){return Marionette.Object.extend({initialize:function(){nfRadio.channel(\"fields\").reply(\"add:error\",this.addError),nfRadio.channel(\"fields\").reply(\"remove:error\",this.removeError),nfRadio.channel(\"fields\").reply(\"get:error\",this.getError)},addError:function(e,t,i){var n=nfRadio.channel(\"fields\").request(\"get:field\",e);if(void 0!==n){var r=n.get(\"errors\");r.add({id:t,msg:i}),n.set(\"errors\",r),n.trigger(\"change:errors\",n),n.set(\"clean\",!1),nfRadio.channel(\"fields\").trigger(\"add:error\",n,t,i)}},removeError:function(e,t){var i=nfRadio.channel(\"fields\").request(\"get:field\",e);if(void 0!==i){var n=i.get(\"errors\"),r=n.get(t);void 0!==r&&(n.remove(r),i.set(\"errors\",n),i.trigger(\"change:errors\",i),nfRadio.channel(\"fields\").trigger(\"remove:error\",i,t))}},getError:function(e,t){var i=nfRadio.channel(\"fields\").request(\"get:field\",e),n=i.get(\"errors\"),r=n.get(t);return\"undefined\"!=r&&r}})}),i(\"controllers/changeField\",[],function(){return Marionette.Object.extend({initialize:function(){nfRadio.channel(\"nfAdmin\").reply(\"change:field\",this.changeField),this.listenTo(nfRadio.channel(\"fields\"),\"blur:field\",this.blurField)},changeField:function(e,t){var i=nfRadio.channel(t.get(\"type\")).request(\"before:updateField\",e,t);i=void 0!==i?i:nfRadio.channel(t.get(\"parentType\")).request(\"before:updateField\",e,t),i=void 0!==i?i:jQuery(e).val(),t.set(\"isUpdated\",!1),t.set(\"clean\",!1),nfRadio.channel(\"field-\"+t.get(\"id\")).trigger(\"change:field\",e,t),nfRadio.channel(t.get(\"type\")).trigger(\"change:field\",e,t),nfRadio.channel(\"fields\").trigger(\"change:field\",e,t),nfRadio.channel(\"nfAdmin\").request(\"update:field\",t,i)},blurField:function(e,t){t.set(\"clean\",!1)}})}),i(\"controllers/changeEmail\",[],function(){var e=nfRadio.channel(\"email\"),t=/^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,i=\"invalid-email\";return Marionette.Object.extend({initialize:function(){this.listenTo(e,\"change:modelValue\",this.onChangeModelValue),this.listenTo(e,\"keyup:field\",this.emailKeyup),this.listenTo(e,\"blur:field\",this.onBlurField)},onChangeModelValue:function(e){var t=e.get(\"value\"),i=e.get(\"id\");this.emailChange(t,i)},onBlurField:function(e,t){var i=jQuery(e).val(),n=t.get(\"id\");this.emailChange(i,n)},emailChange:function(e,n){if(0<e.length)if(t.test(e))nfRadio.channel(\"fields\").request(\"remove:error\",n,i);else{var r=nfRadio.channel(\"fields\").request(\"get:field\",n),o=nfRadio.channel(\"app\").request(\"get:form\",r.get(\"formID\"));nfRadio.channel(\"fields\").request(\"add:error\",n,i,o.get(\"settings\").changeEmailErrorMsg)}else nfRadio.channel(\"fields\").request(\"remove:error\",n,i)},emailKeyup:function(e,n,r){if(9==r)return!1;var o=jQuery(e).val(),a=n.get(\"id\");if(0==o.length)nfRadio.channel(\"fields\").request(\"remove:error\",a,i);else if(t.test(o)||n.get(\"clean\"))t.test(o)&&(nfRadio.channel(\"fields\").request(\"remove:error\",a,i),n.addWrapperClass(\"nf-pass\"),n.set(\"clean\",!1));else{var l=nfRadio.channel(\"fields\").request(\"get:field\",a),s=nfRadio.channel(\"app\").request(\"get:form\",l.get(\"formID\"));nfRadio.channel(\"fields\").request(\"add:error\",a,i,s.get(\"settings\").changeEmailErrorMsg),n.removeWrapperClass(\"nf-pass\")}}})}),i(\"controllers/changeDate\",[],function(){var e=nfRadio.channel(\"date\"),t=\"invalid-date\";return Marionette.Object.extend({initialize:function(){this.listenTo(e,\"change:modelValue\",this.onChangeModelValue),this.listenTo(e,\"keyup:field\",this.dateKeyup),this.listenTo(e,\"blur:field\",this.onBlurField)},onChangeModelValue:function(e){this.dateChange(e)},onBlurField:function(e,t){this.dateChange(t)},dateChange:function(e){var i=e.get(\"id\"),n=e.get(\"value\"),r=e.get(\"date_format\");if(\"default\"===r&&(r=nfi18n.dateFormat),0<n.length)if(moment(n,r).isValid())nfRadio.channel(\"fields\").request(\"remove:error\",i,t);else{var o=nfRadio.channel(\"fields\").request(\"get:field\",i),a=nfRadio.channel(\"app\").request(\"get:form\",o.get(\"formID\"));nfRadio.channel(\"fields\").request(\"add:error\",i,t,a.get(\"settings\").changeDateErrorMsg)}else nfRadio.channel(\"fields\").request(\"remove:error\",i,t)},dateKeyup:function(e,i,n){if(9==n)return!1;var r=jQuery(e).val(),o=i.get(\"id\"),a=i.get(\"date_format\");if(\"default\"===a&&(a=nfi18n.dateFormat),0==r.length)nfRadio.channel(\"fields\").request(\"remove:error\",o,t);else if(moment(r,a).isValid()||i.get(\"clean\"))moment(r,a).isValid()&&(nfRadio.channel(\"fields\").request(\"remove:error\",o,t),i.addWrapperClass(\"nf-pass\"),i.set(\"clean\",!1));else{var l=nfRadio.channel(\"fields\").request(\"get:field\",o),s=nfRadio.channel(\"app\").request(\"get:form\",l.get(\"formID\"));nfRadio.channel(\"fields\").request(\"add:error\",o,t,s.get(\"settings\").changeDateErrorMsg),i.removeWrapperClass(\"nf-pass\")}}})}),i(\"controllers/fieldCheckbox\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"checkbox\"),\"init:model\",this.registerRenderClasses),nfRadio.channel(\"checkbox\").reply(\"validate:required\",this.validateRequired),nfRadio.channel(\"checkbox\").reply(\"validate:modelData\",this.validateModelData),nfRadio.channel(\"checkbox\").reply(\"before:updateField\",this.beforeUpdateField,this),nfRadio.channel(\"checkbox\").reply(\"get:calcValue\",this.getCalcValue,this)},beforeUpdateField:function(e,t){if(jQuery(e).prop(\"checked\")){var i=1;jQuery(e).addClass(\"nf-checked\"),jQuery(e).closest(\".field-wrap\").find('label[for=\"'+jQuery(e).prop(\"id\")+'\"]').addClass(\"nf-checked-label\")}else{var i=0;jQuery(e).removeClass(\"nf-checked\"),jQuery(e).closest(\".field-wrap\").find('label[for=\"'+jQuery(e).prop(\"id\")+'\"]').removeClass(\"nf-checked-label\")}return i},validateRequired:function(e,t){return e[0].checked},validateModelData:function(e){return 0!=e.get(\"value\")},getCalcValue:function(e){return 1==e.get(\"value\")?calcValue=e.get(\"checked_calc_value\"):calcValue=e.get(\"unchecked_calc_value\"),calcValue},registerRenderClasses:function(e){\"checked\"==e.get(\"default_value\")?e.set(\"value\",1):e.set(\"value\",0),e.set(\"customClasses\",this.customClasses),e.set(\"customLabelClasses\",this.customLabelClasses),e.set(\"maybeChecked\",this.maybeChecked)},customClasses:function(e){return 1==this.value||this.clean&&void 0!==this.default_value&&\"checked\"==this.default_value?e+=\" nf-checked\":e.replace(\"nf-checked\",\"\"),e},customLabelClasses:function(e){return 1==this.value||this.clean&&void 0!==this.default_value&&\"checked\"==this.default_value?e+=\" nf-checked-label\":e.replace(\"nf-checked-label\",\"\"),e},maybeChecked:function(){return 1==this.value||this.clean&&void 0!==this.default_value&&\"checked\"==this.default_value?\" checked\":\"\"}})}),i(\"controllers/fieldCheckboxList\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"listcheckbox\"),\"init:model\",this.register),this.listenTo(nfRadio.channel(\"terms\"),\"init:model\",this.register),nfRadio.channel(\"listcheckbox\").reply(\"before:updateField\",this.beforeUpdateField,this),nfRadio.channel(\"terms\").reply(\"before:updateField\",this.beforeUpdateField,this),nfRadio.channel(\"listcheckbox\").reply(\"get:calcValue\",this.getCalcValue,this),nfRadio.channel(\"terms\").reply(\"get:calcValue\",this.getCalcValue,this)},register:function(e){if(e.set(\"renderOptions\",this.renderOptions),e.set(\"renderOtherText\",this.renderOtherText),e.set(\"selected\",[]),0!=e.get(\"options\").length){var t=_.filter(e.get(\"options\"),function(e){return 1==e.selected});t=_.map(t,function(e){return e.value})}var i=e.get(\"value\");void 0!==i&&Array.isArray(i)?e.set(\"value\",i):void 0!==t&&e.set(\"value\",t)},renderOptions:function(){var e=\"\";if(\"\"==this.value||Array.isArray(this.value)&&0<this.value.length||0<this.value.length)var t=!0;else var t=!1;if(_.each(this.options,function(i,n){Array.isArray(this.value)&&(Array.isArray(this.value[0])&&-1!==_.indexOf(this.value[0],i.value)?t=!0:_.indexOf(this.value,i.value)&&(t=!0)),i.value==this.value&&(t=!0),void 0===i.visible&&(i.visible=!0),i.fieldID=this.id,i.classes=this.classes,i.index=n;var r=!1;Array.isArray(this.value)&&0<this.value.length?-1===_.indexOf(this.value[0].split(\",\"),i.value)&&-1===_.indexOf(this.value,i.value)||(r=!0):_.isArray(this.value)||i.value!=this.value?1==i.selected&&this.clean&&void 0===this.value&&(r=!0):r=!0,i.selected=r,i.isSelected=r,i.required=this.required;var o=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-listcheckbox-option\");e+=o(i)},this),1==this.show_other){\"nf-other\"==this.value&&(t=!1);var i={fieldID:this.id,classes:this.classes,currentValue:this.value,renderOtherText:this.renderOtherText,valueFound:t},n=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-listcheckbox-other\");e+=n(i)}return e},renderOtherText:function(){if(\"nf-other\"==this.currentValue||!this.valueFound){\"nf-other\"==this.currentValue&&(this.currentValue=\"\");var e={fieldID:this.fieldID,classes:this.classes,currentValue:this.currentValue};return nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-listcheckbox-other-text\")(e)}},getCalcValue:function(e){var t=0,i=e.get(\"options\");return 0!=i.length&&_.each(e.get(\"value\"),function(e){var n=_.find(i,function(t){return t.value==e});t=Number(t)+Number(n.calc)}),t},beforeUpdateField:function(e,t){var i=t.get(\"value\")||[];\"string\"==typeof i&&(i=[i]);var n=jQuery(e).val();if(jQuery(e).prop(\"checked\"))i.push(n),jQuery(e).addClass(\"nf-checked\"),jQuery(e).parent().find('label[for=\"'+jQuery(e).prop(\"id\")+'\"]').addClass(\"nf-checked-label\");else{jQuery(e).removeClass(\"nf-checked\"),jQuery(e).parent().find('label[for=\"'+jQuery(e).prop(\"id\")+'\"]').removeClass(\"nf-checked-label\");var r=i.indexOf(n);if(-1!=r)i.splice(r,1);else if(Array.isArray(i)){var o=i[0].split(\",\"),a=o.indexOf(n);-1!==a&&o.splice(a,1),i=o.join(\",\")}}return _.clone(i)}})}),i(\"controllers/fieldRadio\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"listradio\"),\"change:modelValue\",this.changeModelValue),this.listenTo(nfRadio.channel(\"listradio\"),\"init:model\",this.register),nfRadio.channel(\"listradio\").reply(\"get:calcValue\",this.getCalcValue,this),this.listenTo(nfRadio.channel(\"listradio\"),\"change:field\",this.updateCheckedClass,this)},register:function(e){if(e.set(\"renderOptions\",this.renderOptions),e.set(\"renderOtherText\",this.renderOtherText),0!=e.get(\"options\").length){var t=_.find(e.get(\"options\"),function(e){return 1==e.selected});void 0!==t&&e.set(\"value\",t.value)}},changeModelValue:function(e){1==e.get(\"show_other\")&&e.trigger(\"reRender\")},renderOptions:function(){var e=\"\";if(\"\"==this.value)var t=!0;else var t=!1;if(_.each(this.options,function(i,n){i.value==this.value&&(t=!0),void 0===i.visible&&(i.visible=!0),i.selected=!1,i.fieldID=this.id,i.classes=this.classes,i.currentValue=this.value,i.index=n,i.required=this.required,this.clean&&1==this.selected?i.selected=!0:this.value==i.value?i.selected=!0:i.selected=!1;var r=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-listradio-option\");e+=r(i)},this),1==this.show_other){\"nf-other\"==this.value&&(t=!1);var i={fieldID:this.id,classes:this.classes,currentValue:this.value,renderOtherText:this.renderOtherText,valueFound:t},n=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-listradio-other\");e+=n(i)}return e},renderOtherText:function(){if(\"nf-other\"==this.currentValue||!this.valueFound){\"nf-other\"==this.currentValue&&(this.currentValue=\"\");var e={fieldID:this.fieldID,classes:this.classes,currentValue:this.currentValue};return nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-listradio-other-text\")(e)}},getCalcValue:function(e){var t=0;if(0!=e.get(\"options\").length){var i=_.find(e.get(\"options\"),function(t){return e.get(\"value\")==t.value});void 0!==i&&(t=i.calc)}return t},updateCheckedClass:function(e,t){jQuery('[name=\"'+jQuery(e).attr(\"name\")+'\"]').removeClass(\"nf-checked\"),jQuery(e).closest(\"ul\").find(\"label\").removeClass(\"nf-checked-label\"),jQuery(e).addClass(\"nf-checked\"),jQuery(e).closest(\"li\").find('label[for=\"'+jQuery(e).prop(\"id\")+'\"]').addClass(\"nf-checked-label\")}})}),i(\"controllers/fieldNumber\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"number\"),\"init:model\",this.maybeMinDefault),this.listenTo(nfRadio.channel(\"number\"),\"keyup:field\",this.validateMinMax)},maybeMinDefault:function(e){if(\"\"==e.get(\"value\")){var t=e.get(\"num_min\");e.set(\"value\",t)}},validateMinMax:function(e,t){var i=jQuery(e),n=parseFloat(i.val()),r=i.attr(\"min\"),o=i.attr(\"max\"),a=parseFloat(i.attr(\"step\"));if(r&&n<r){var l=nfRadio.channel(\"fields\").request(\"get:field\",t.get(\"id\")),s=nfRadio.channel(\"app\").request(\"get:form\",l.get(\"formID\"));nfRadio.channel(\"fields\").request(\"add:error\",t.get(\"id\"),\"number-min\",s.get(\"settings\").fieldNumberNumMinError)}else nfRadio.channel(\"fields\").request(\"remove:error\",t.get(\"id\"),\"number-min\");if(o&&n>o){var l=nfRadio.channel(\"fields\").request(\"get:field\",t.get(\"id\")),s=nfRadio.channel(\"app\").request(\"get:form\",l.get(\"formID\"));nfRadio.channel(\"fields\").request(\"add:error\",t.get(\"id\"),\"number-max\",s.get(\"settings\").fieldNumberNumMaxError)}else nfRadio.channel(\"fields\").request(\"remove:error\",t.get(\"id\"),\"number-max\");var d=Math.round(1e9*parseFloat(n)),c=Math.round(1e9*parseFloat(a));if(n&&0!=d%c){var l=nfRadio.channel(\"fields\").request(\"get:field\",t.get(\"id\")),s=nfRadio.channel(\"app\").request(\"get:form\",l.get(\"formID\"));nfRadio.channel(\"fields\").request(\"add:error\",t.get(\"id\"),\"number-step\",s.get(\"settings\").fieldNumberIncrementBy+a)}else nfRadio.channel(\"fields\").request(\"remove:error\",t.get(\"id\"),\"number-step\")}})}),i(\"controllers/mirrorField\",[],function(){var e=nfRadio.channel(\"fields\");return Marionette.Object.extend({listeningModel:\"\",initialize:function(){this.listenTo(e,\"init:model\",this.registerMirror)},registerMirror:function(e){if(e.get(\"mirror_field\")){this.listeningModel=e;var t=e.get(\"mirror_field\");this.listenTo(nfRadio.channel(\"field-\"+t),\"change:modelValue\",this.changeValue)}},changeValue:function(e){this.listeningModel.set(\"value\",e.get(\"value\")),this.listeningModel.trigger(\"reRender\")}})}),i(\"controllers/confirmField\",[],function(){var e=nfRadio.channel(\"fields\"),t=\"confirm-mismatch\";return Marionette.Object.extend({initialize:function(){this.listenTo(e,\"init:model\",this.registerConfirm),this.listenTo(e,\"keyup:field\",this.confirmKeyup)},registerConfirm:function(e){e.get(\"confirm_field\")&&this.listenTo(nfRadio.channel(\"form\"),\"loaded\",function(t){this.registerConfirmListeners(e)})},registerConfirmListeners:function(e){var t=nfRadio.channel(\"form-\"+e.get(\"formID\")).request(\"get:fieldByKey\",e.get(\"confirm_field\"));void 0!==t&&(t.set(\"confirm_with\",e.get(\"id\")),this.listenTo(nfRadio.channel(\"field-\"+t.get(\"id\")),\"change:modelValue\",this.changeValue),this.listenTo(nfRadio.channel(\"field-\"+e.get(\"id\")),\"change:modelValue\",this.changeValue))},changeValue:function(i){if(void 0===i.get(\"confirm_with\"))var n=i,r=nfRadio.channel(\"form-\"+i.get(\"formID\")).request(\"get:fieldByKey\",n.get(\"confirm_field\"));else var r=i,n=e.request(\"get:field\",r.get(\"confirm_with\"));var o=(r.get(\"id\"),n.get(\"id\"));if(\"\"==n.get(\"value\")||n.get(\"value\")==r.get(\"value\"))nfRadio.channel(\"fields\").request(\"remove:error\",o,t);else{var a=nfRadio.channel(\"fields\").request(\"get:field\",o),l=nfRadio.channel(\"app\").request(\"get:form\",a.get(\"formID\"));nfRadio.channel(\"fields\").request(\"add:error\",o,t,l.get(\"settings\").confirmFieldErrorMsg)}},confirmKeyup:function(e,i,n){var r=jQuery(e).val();if(i.get(\"confirm_field\"))var o=i,a=i.get(\"id\"),l=nfRadio.channel(\"form-\"+i.get(\"formID\")).request(\"get:fieldByKey\",o.get(\"confirm_field\")),s=l.get(\"value\"),d=r;else if(i.get(\"confirm_with\"))var o=nfRadio.channel(\"fields\").request(\"get:field\",i.get(\"confirm_with\")),a=o.get(\"id\"),d=o.get(\"value\"),s=d;if(void 0!==o)if(\"\"==d)nfRadio.channel(\"fields\").request(\"remove:error\",a,t);else if(r==s)nfRadio.channel(\"fields\").request(\"remove:error\",a,t);else{var c=nfRadio.channel(\"fields\").request(\"get:field\",a),f=nfRadio.channel(\"app\").request(\"get:form\",c.get(\"formID\"));nfRadio.channel(\"fields\").request(\"add:error\",a,t,f.get(\"settings\").confirmFieldErrorMsg)}}})}),i(\"controllers/updateFieldModel\",[],function(){return Marionette.Object.extend({initialize:function(){nfRadio.channel(\"nfAdmin\").reply(\"update:field\",this.updateField)},updateField:function(e,t){e.get(\"isUpdated\")||(e.set(\"value\",t),e.set(\"isUpdated\",!0),_.isArray(t)&&e.trigger(\"change:value\",e))}})}),i(\"controllers/submitButton\",[\"controllers/submitButton\"],function(e){return Marionette.Object.extend({bound:{},initialize:function(){this.listenTo(nfRadio.channel(\"submit\"),\"init:model\",this.registerHandlers)},registerHandlers:function(e){if(void 0!==this.bound[e.get(\"id\")])return!1;this.listenTo(nfRadio.channel(\"field-\"+e.get(\"id\")),\"click:field\",this.click,this),e.listenTo(nfRadio.channel(\"form-\"+e.get(\"formID\")),\"before:submit\",this.beforeSubmit,e),e.listenTo(nfRadio.channel(\"form-\"+e.get(\"formID\")),\"submit:failed\",this.resetLabel,e),e.listenTo(nfRadio.channel(\"form-\"+e.get(\"formID\")),\"submit:response\",this.resetLabel,e),e.listenTo(nfRadio.channel(\"form-\"+e.get(\"formID\")),\"enable:submit\",this.maybeEnable,e),e.listenTo(nfRadio.channel(\"form-\"+e.get(\"formID\")),\"disable:submit\",this.maybeDisable,e),e.listenTo(nfRadio.channel(\"form-\"+e.get(\"formID\")),\"processingLabel\",this.processingLabel,e),e.listenTo(nfRadio.channel(\"fields\"),\"add:error\",this.maybeDisable,e),e.listenTo(nfRadio.channel(\"fields\"),\"remove:error\",this.maybeEnable,e),this.bound[e.get(\"id\")]=!0},click:function(e,t){var i=nfRadio.channel(\"app\").request(\"get:form\",t.get(\"formID\"));nfRadio.channel(\"form-\"+t.get(\"formID\")).request(\"submit\",i)},beforeSubmit:function(){this.set(\"disabled\",!0),nfRadio.channel(\"form-\"+this.get(\"formID\")).trigger(\"processingLabel\",this)},maybeDisable:function(e){void 0!==e&&e.get(\"formID\")!=this.get(\"formID\")||(this.set(\"disabled\",!0),this.trigger(\"reRender\"))},maybeEnable:function(e){if(void 0!==e&&e.get(\"formID\")!=this.get(\"formID\"))return!1;var t=nfRadio.channel(\"app\").request(\"get:form\",this.get(\"formID\"));0==_.size(t.get(\"fieldErrors\"))&&(this.set(\"disabled\",!1),this.trigger(\"reRender\"))},processingLabel:function(){if(this.get(\"label\")==this.get(\"processing_label\"))return!1;this.set(\"oldLabel\",this.get(\"label\")),this.set(\"label\",this.get(\"processing_label\")),this.trigger(\"reRender\")},resetLabel:function(e){void 0!==this.get(\"oldLabel\")&&this.set(\"label\",this.get(\"oldLabel\")),this.set(\"disabled\",!1),this.trigger(\"reRender\")}})}),i(\"controllers/submitDebug\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"forms\"),\"submit:response\",this.submitDebug)},submitDebug:function(e,t,i,n){if(void 0!==e.debug){if(void 0!==e.debug.form){var r=document.createElement(\"span\");_.each(e.debug.form,function(e,t){var i=document.createTextNode(e);r.appendChild(i),r.appendChild(document.createElement(\"br\"))}),jQuery(\".nf-debug-msg\").html(r)}if(void 0!==e.debug.console){console.log(\"%c%s\",\"\",\"NINJA SUPPORT\"),_.each(e.debug.console,function(e,t){console.log(e)}),console.log(\"%c%s\",\"\",\"END NINJA SUPPORT\")}}}})}),i(\"controllers/getFormErrors\",[],function(){nfRadio.channel(\"fields\");return Marionette.Object.extend({initialize:function(e){nfRadio.channel(\"form\").reply(\"get:errors\",this.getFormErrors)},getFormErrors:function(e){var t=nfRadio.channel(\"app\").request(\"get:form\",e),i=!1;return t&&(0!==t.get(\"errors\").length&&_.each(t.get(\"errors\").models,function(e){i=i||{},i[e.get(\"id\")]=e.get(\"msg\")}),_.each(t.get(\"fields\").models,function(e){\"submit\"!=e.get(\"type\")&&e.get(\"errors\").length>0&&(i=i||{},i[e.get(\"id\")]=e.get(\"errors\"))})),i}})}),i(\"controllers/validateRequired\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"fields\"),\"blur:field\",this.validateRequired),this.listenTo(nfRadio.channel(\"fields\"),\"change:field\",this.validateRequired),this.listenTo(nfRadio.channel(\"fields\"),\"keyup:field\",this.validateKeyup),this.listenTo(nfRadio.channel(\"fields\"),\"change:modelValue\",this.validateModelData),this.listenTo(nfRadio.channel(\"submit\"),\"validate:field\",this.validateModelData)},validateKeyup:function(e,t,i){if(1!=t.get(\"required\"))return!1;t.get(\"clean\")||this.validateRequired(e,t)},validateRequired:function(e,t){if(1!=t.get(\"required\")||!t.get(\"visible\"))return!1;var i=jQuery(e).val(),n=nfRadio.channel(t.get(\"type\")).request(\"validate:required\",e,t),r=!0,o=t.get(\"mask\");if(o&&(o=o.replace(/9/g,\"_\"),o=o.replace(/a/g,\"_\"),o=o.replace(/\\*/g,\"_\")),o&&i===o&&0<t.get(\"errors\").length&&(r=!1),jQuery.trim(i)||(r=!1),void 0!==n)var a=n;else var a=r;this.maybeError(a,t)},validateModelData:function(e){if(1!=e.get(\"required\")||!e.get(\"visible\")||e.get(\"clean\"))return!1;if(e.get(\"errors\").get(\"required-error\"))return!1;currentValue=e.get(\"value\");var t=!0;jQuery.trim(currentValue)||(t=!1);var i=nfRadio.channel(e.get(\"type\")).request(\"validate:modelData\",e);if(void 0!==i)var n=i;else var n=t;this.maybeError(n,e)},maybeError:function(e,t){if(e)nfRadio.channel(\"fields\").request(\"remove:error\",t.get(\"id\"),\"required-error\");else{var i=nfRadio.channel(\"form-\"+t.get(\"formID\")).request(\"get:form\");void 0!==i&&nfRadio.channel(\"fields\").request(\"add:error\",t.get(\"id\"),\"required-error\",i.get(\"settings\").validateRequiredField)}}})}),i(\"controllers/submitError\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"forms\"),\"submit:response\",this.submitErrors)},submitErrors:function(e,t,i,n){if(_.size(e.errors.fields)>0&&_.each(e.errors.fields,function(e,t){\"object\"==typeof e?nfRadio.channel(\"fields\").request(\"add:error\",t,e.slug,e.message):nfRadio.channel(\"fields\").request(\"add:error\",t,\"required-error\",e)}),_.size(e.errors.form)>0&&_.each(e.errors.form,function(e,t){nfRadio.channel(\"form-\"+n).request(\"remove:error\",t),nfRadio.channel(\"form-\"+n).request(\"add:error\",t,e)}),void 0!==e.errors.last&&void 0!==e.errors.last.message){var r=\"background: rgba( 255, 207, 115, .5 ); color: #FFA700; display: block;\";console.log(\"%c NINJA FORMS SUPPORT: SERVER ERROR\",r),console.log(e.errors.last.message),console.log(\"%c END SERVER ERROR MESSAGE\",r)}jQuery(\"#nf-form-\"+n+\"-cont .nf-field-container\").show()}})}),i(\"controllers/actionRedirect\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"forms\"),\"submit:response\",this.actionRedirect)},actionRedirect:function(e){void 0!==e.data.halt&&void 0!==e.data.halt.redirect&&\"\"!=e.data.halt.redirect&&(window.location=e.data.halt.redirect),0==_.size(e.errors)&&void 0!==e.data.actions&&void 0!==e.data.actions.redirect&&\"\"!=e.data.actions.redirect&&(window.location=e.data.actions.redirect)}})}),i(\"controllers/actionSuccess\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"forms\"),\"submit:response\",this.actionSubmit)},actionSubmit:function(e){if(0==_.size(e.errors)&&void 0!==e.data.actions&&void 0!==e.data.actions.success_message&&\"\"!=e.data.actions.success_message){\nvar t=e.data.form_id,i=jQuery(\"#nf-form-\"+t+\"-cont .nf-response-msg\");i.html(e.data.actions.success_message).show();var n=i.offset().top,r=i.offset().top+i.outerHeight(),o=jQuery(window).scrollTop()+jQuery(window).height(),a=jQuery(window).scrollTop();o>r&&a<n||jQuery(\"html, body\").animate({scrollTop:i.offset().top-50},300)}}})}),i(\"controllers/fieldSelect\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"fields\"),\"init:model\",function(e){\"list\"==e.get(\"parentType\")&&this.register(e)},this),nfRadio.channel(\"listselect\").reply(\"get:calcValue\",this.getCalcValue,this),nfRadio.channel(\"listmultiselect\").reply(\"get:calcValue\",this.getCalcValue,this)},register:function(e){if(e.set(\"renderOptions\",this.renderOptions),e.set(\"renderOtherAttributes\",this.renderOtherAttributes),0!=e.get(\"options\").length){var t=e.get(\"value\");if(\"listmultiselect\"==e.get(\"type\")){var i=_.filter(e.get(\"options\"),function(e){return 1==e.selected});i=_.map(i,function(e){return e.value});var n=i}else if(\"listradio\"!==e.get(\"type\")){var i=_.find(e.get(\"options\"),function(e){return 1==e.selected});if(void 0===i&&(i=_.first(e.get(\"options\"))),void 0!==i&&void 0!==i.value)var n=i.value;else if(void 0!==i)var n=i.label}void 0!==t&&\"\"!==t&&Array.isArray(t)?e.set(\"value\",t):void 0!==i&&e.set(\"value\",n)}},renderOptions:function(){var e=\"\";return _.each(this.options,function(t){if(_.isArray(this.value)){if(\"listmultiselect\"===this.type&&0<this.value.length&&-1!=_.indexOf(this.value[0].split(\",\"),t.value))var i=!0;else if(-1!=_.indexOf(this.value,t.value))var i=!0}else if(_.isArray(this.value)||t.value!=this.value)if(1==t.selected&&this.clean&&void 0===this.value)var i=!0;else var i=!1;else var i=!0;void 0===t.visible&&(t.visible=!0),t.selected=i,t.fieldID=this.id,t.classes=this.classes,t.currentValue=this.value;var n=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-listselect-option\");e+=n(t)},this),e},renderOtherAttributes:function(){var e=\"\";if(\"listmultiselect\"==this.type){e+=\" multiple\";e=e+' size=\"'+(this.multi_size||5)+'\"'}return e},getCalcValue:function(e){var t=0,i=e.get(\"options\");if(0!=i.length)if(\"listmultiselect\"==e.get(\"type\"))_.each(e.get(\"value\"),function(e){var n=_.find(i,function(t){return t.value==e});t+=n.calc});else{var n=_.find(i,function(t){return e.get(\"value\")==t.value});void 0===n&&(n=e.get(\"options\")[0]),t=n.calc}return t}})}),i(\"controllers/coreSubmitResponse\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"forms\"),\"submit:response\",this.actionSubmit)},actionSubmit:function(e){var t=nfRadio.channel(\"app\").request(\"get:form\",e.data.form_id);if(0!=_.size(e.errors))return!1;1==e.data.settings.clear_complete&&(t.get(\"fields\").reset(t.get(\"loadedFields\")),1!=e.data.settings.hide_complete&&nfRadio.channel(\"captcha\").trigger(\"reset\")),1==e.data.settings.hide_complete&&t.trigger(\"hide\")}})}),i(\"controllers/fieldProduct\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"product\"),\"init:model\",this.register),nfRadio.channel(\"product\").reply(\"get:calcValue\",this.getCalcValue,this)},register:function(e){e.set(\"renderProductQuantity\",this.renderProductQuantity),e.set(\"renderProduct\",this.renderProduct),e.set(\"renderOptions\",this.renderOptions)},renderProduct:function(){switch(this.product_type){case\"user\":var e=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-textbox\");return e(this);case\"hidden\":var e=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-hidden\");return e(this);case\"dropdown\":var e=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-product-dropdown\");return e(this);default:var e=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-product-single\");return e(this)}},renderProductQuantity:function(){if(1==this.product_use_quantity){return nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-product-quantity\")(this)}},renderOptions:function(){var e=this,t=\"\";return _.each(this.options,function(i){if(1==i.selected)var n=!0;else var n=!1;i.selected=n,i.fieldID=e.id,i.classes=e.classes,i.currentValue=e.value;var r=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-product-\"+e.product_type+\"-option\");t+=r(i)}),t},getCalcValue:function(e){return e.get(\"product_price\")*e.get(\"value\")}})}),i(\"controllers/fieldTotal\",[],function(){return Marionette.Object.extend({totalModel:{},productTotals:{},initialize:function(){this.listenTo(nfRadio.channel(\"total\"),\"init:model\",this.register),this.listenTo(nfRadio.channel(\"shipping\"),\"init:model\",this.registerShipping)},register:function(e){this.totalModel=e;var t=e.get(\"formID\");this.listenTo(nfRadio.channel(\"form-\"+t),\"loaded\",this.onFormLoaded),this.listenTo(nfRadio.channel(\"product\"),\"change:modelValue\",this.onChangeProduct),this.listenTo(nfRadio.channel(\"quantity\"),\"change:modelValue\",this.onChangeQuantity)},registerShipping:function(e){this.shippingCost=e.get(\"shipping_cost\")},onFormLoaded:function(e){var t=e.get(\"fields\").models,i={},n={};for(var r in t){var o=t[r],a=o.get(\"id\");if(\"product\"==o.get(\"type\"))i[a]=o;else if(\"quantity\"==o.get(\"type\")){var l=o.get(\"product_assignment\");n[l]=o}}for(var l in i){var s=i[l],d=Number(s.get(\"product_price\"));n[l]?d*=n[l].get(\"value\"):1==s.get(\"product_use_quantity\")&&(d*=s.get(\"value\")),this.productTotals[l]=d}this.updateTotal()},onChangeProduct:function(e){var t=e.get(\"id\"),i=Number(e.get(\"product_price\")),n=Number(e.get(\"value\")),r=n*i;this.productTotals[t]=r,this.updateTotal()},onChangeQuantity:function(e){var t=e.get(\"product_assignment\"),i=nfRadio.channel(\"fields\").request(\"get:field\",t),n=Number(i.get(\"product_price\")),r=Number(e.get(\"value\")),o=r*n;this.productTotals[t]=o,this.updateTotal()},updateTotal:function(){var e=0;for(var t in this.productTotals)e+=Number(this.productTotals[t]);e&&this.shippingCost&&(e+=Number(this.shippingCost)),this.totalModel.set(\"value\",e.toFixed(2)),this.totalModel.trigger(\"reRender\")}})}),i(\"controllers/fieldQuantity\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"quantity\"),\"init:model\",this.registerQuantity)},registerQuantity:function(e){var t=e.get(\"product_assignment\"),i=nfRadio.channel(\"fields\").request(\"get:field\",t);i&&i.set(\"product_use_quantity\",0)}})}),i(\"models/calcModel\",[],function(){return Backbone.Model.extend({initialize:function(){this.set(\"formID\",this.collection.options.formModel.get(\"id\")),this.set(\"fields\",{}),nfRadio.channel(\"calc\").trigger(\"init:model\",this),this.on(\"change:value\",this.changeValue,this)},changeField:function(e){nfRadio.channel(\"calc\").trigger(\"change:field\",this,e)},changeCalc:function(e){nfRadio.channel(\"calc\").trigger(\"change:calc\",this,e)},changeValue:function(){nfRadio.channel(\"calc\").trigger(\"change:value\",this)}})}),i(\"models/calcCollection\",[\"models/calcModel\"],function(e){return Backbone.Collection.extend({model:e,comparator:\"order\",initialize:function(e,t){this.options=t,_.each(e,function(e){void 0!==e.dec&&(\"\"===e.dec.toString().trim()&&(e.dec=2),e.dec=parseInt(e.dec))}),nfRadio.channel(\"form-\"+t.formModel.get(\"id\")).reply(\"get:calc\",this.getCalc,this)},getCalc:function(e){return this.findWhere({name:e})}})}),i(\"controllers/calculations\",[\"models/calcCollection\"],function(e){return Marionette.Object.extend({initialize:function(){this.calcs={},this.displayFields={},this.listenTo(nfRadio.channel(\"form\"),\"loaded\",this.registerCalcs),this.listenTo(nfRadio.channel(\"fields\"),\"reset:collection\",this.resetCalcs),this.listenTo(nfRadio.channel(\"calc\"),\"change:field\",this.changeField),this.listenTo(nfRadio.channel(\"calc\"),\"change:calc\",this.changeCalc);var e=this;_.each(nfFrontEnd.use_merge_tags.calculations,function(t){e.listenTo(nfRadio.channel(\"fields-\"+t),\"init:model\",e.initDisplayField)}),this.listenTo(nfRadio.channel(\"calc\"),\"change:value\",this.updateDisplayFields),this.init={}},resetCalcs:function(e){void 0!==e.options.formModel&&this.registerCalcs(e.options.formModel)},registerCalcs:function(t){var i=new e(t.get(\"settings\").calculations,{formModel:t});this.calcs[t.get(\"id\")]=i;var n=this;_.each(i.models,function(e){n.init[e.get(\"name\")]=!0,n.setupCalc(e)})},setupCalc:function(e){var t=this,i=e.get(\"eq\"),n=i,r=(e.get(\"name\"),i.match(new RegExp(/{field:(.*?)}/g)));r&&(r=r.map(function(i){var r=i.replace(\":calc}\",\"\").replace(\"}\",\"\").replace(\"{field:\",\"\");if(fieldModel=nfRadio.channel(\"form-\"+e.get(\"formID\")).request(\"get:fieldByKey\",r),\"undefined\"!=typeof fieldModel){fieldModel.set(\"clean\",!1),fieldModel.on(\"change:value\",e.changeField,e);var o=t.getCalcValue(fieldModel);t.updateCalcFields(e,r,o),n=t.replaceKey(\"field\",r,o,n)}}));var o=i.match(new RegExp(/{calc:(.*?)}/g));o&&(o=o.map(function(i){var r=i.replace(\"}\",\"\").replace(\"{calc:\",\"\"),o=e.collection.findWhere({name:r});if(void 0!==o){o.on(\"change:value\",e.changeCalc,e);var a=o.get(\"value\");n=t.replaceKey(\"calc\",r,a,n)}})),n=n.replace(/{([a-zA-Z0-9]|:|_|-)*}/g,0),n=n.replace(/\\r?\\n|\\r/g,\"\");try{e.set(\"value\",Number(mexp.eval(n)).toFixed(e.get(\"dec\")))}catch(e){console.log(e)}\"NaN\"===e.get(\"value\")&&e.set(\"value\",\"0\")},updateCalcFields:function(e,t,i){var n=e.get(\"fields\");n[t]=i,e.set(\"fields\",n)},getCalcValue:function(e){var t=nfRadio.channel(e.get(\"type\")).request(\"get:calcValue\",e);return void 0===t&&(t=jQuery.isNumeric(e.get(\"value\"))?e.get(\"value\"):0),e.get(\"visible\")||(t=0),jQuery.isNumeric(t)?t:0},replaceKey:function(e,t,i,n){n=n||calcModel.get(\"eq\"),tag=\"{\"+e+\":\"+t+\"}\";var r=new RegExp(tag,\"g\");calcTag=\"{\"+e+\":\"+t+\":calc}\";var o=new RegExp(calcTag,\"g\");return n=n.replace(r,i),n=n.replace(o,i)},replaceAllKeys:function(e){var t=e.get(\"eq\"),i=this;_.each(e.get(\"fields\"),function(e,n){t=i.replaceKey(\"field\",n,e,t)});var n=t.match(new RegExp(/{calc:(.*?)}/g));return n&&_.each(n,function(i){var n=i.replace(\"}\",\"\").replace(\"{calc:\",\"\"),r=e.collection.findWhere({name:n});if(void 0!==r){var o=new RegExp(i,\"g\");t=t.replace(o,r.get(\"value\"))}}),t},changeField:function(e,t){var i=t.get(\"key\"),n=this.getCalcValue(t);this.updateCalcFields(e,i,n);var r=this.replaceAllKeys(e);r=r.replace(/{([a-zA-Z0-9]|:|_|-)*}/g,\"0\"),r=r.replace(/\\r?\\n|\\r/g,\"\");try{e.set(\"value\",Number(mexp.eval(r)).toFixed(e.get(\"dec\")))}catch(e){console.log(e)}\"NaN\"===e.get(\"value\")&&e.set(\"value\",\"0\")},initDisplayField:function(e){if(e.get(\"default\")&&\"string\"==typeof e.get(\"default\")){var t=e.get(\"default\").match(new RegExp(/{calc:(.*?)}/g));t&&_.each(t,function(t){t=t.replace(\"{calc:\",\"\").replace(\"}\",\"\").replace(\":2\",\"\"),this.displayFields[t]=this.displayFields[t]||[],this.displayFields[t].push(e)},this)}},updateDisplayFields:function(e){var t=this;void 0!==this.displayFields[e.get(\"name\")]&&_.each(this.displayFields[e.get(\"name\")],function(i){var n=\"\";n=\"html\"===i.get(\"type\")?i.get(\"value\"):i.get(\"default\");var r=n.match(new RegExp(/<span data-key=\"calc:(.*?)<\\/span>/g));_.each(r,function(e){var t=\"{\"+e.replace('<span data-key=\"',\"\").replace(/\">(.*?)<\\/span>/,\"\")+\"}\";n=n.replace(e,t)});var o=n.match(new RegExp(/{calc:(.*?)}/g));_.each(o,function(e){var r=e.replace(\"}\",\"\").replace(\"{calc:\",\"\").replace(\":2\",\"\"),o=t.calcs[i.get(\"formID\")].findWhere({name:r}),a=new RegExp(e,\"g\"),l=o.get(\"value\");void 0!==l&&(l=t.applyLocaleFormatting(l)),n=\"html\"===i.get(\"type\")?n.replace(a,'<span data-key=\"calc:'+r+'\">'+l+\"</span>\"):l}),i.set(\"value\",n),t.init[e.get(\"name\")]||i.trigger(\"reRender\"),t.init[e.get(\"name\")]=!1})},getCalc:function(e,t){return this.calcs[t].findWhere({name:e})},changeCalc:function(e,t){var i=this.replaceAllKeys(e);i=i.replace(\"[\",\"\").replace(\"]\",\"\"),i=i.replace(/\\r?\\n|\\r/g,\"\");try{e.set(\"value\",Number(mexp.eval(i)).toFixed(e.get(\"dec\")))}catch(e){console.log(e)}\"NaN\"===e.get(\"value\")&&e.set(\"value\",\"0\")},applyLocaleFormatting:function(e){var t=e.split(\".\");if(t.length>1){t[0]=t[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g,nfi18n.thousands_sep);var i=t.join(nfi18n.decimal_point)}else var i=e.replace(/\\B(?=(\\d{3})+(?!\\d))/g,nfi18n.thousands_sep);return i}})}),i(\"controllers/fieldDate\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"date\"),\"render:view\",this.initDatepicker)},initDatepicker:function(e){var t=e.model.get(\"date_format\");\"\"!=t&&\"default\"!=t||(t=this.convertDateFormat(nfi18n.dateFormat));var i=jQuery(e.el).find(\".nf-element\")[0],n=pikadayResponsive(i,{format:t,outputFormat:t,classes:jQuery(i).attr(\"class\"),placeholder:e.model.get(\"placeholder\"),pikadayOptions:{yearRange:this.getYearRange(e.model),minDate:this.getMinDate(e.model),maxDate:this.getMaxDate(e.model),firstDay:parseInt(nfi18n.startOfWeek)}});1==e.model.get(\"date_default\")&&n.setDate(moment()),nfRadio.channel(\"pikaday\").trigger(\"init\",n,e.model)},getYearRange:function(e){var t=e.get(\"year_range_start\"),i=e.get(\"year_range_end\");return t&&i?[t,i]:t?(i=t+10,[t,i]):i?(t=i-10,[t,i]):10},getMinDate:function(e){var t=e.get(\"year_range_start\");return t?new Date(t,0,1):null},getMaxDate:function(e){var t=e.get(\"year_range_end\");return t?new Date(t,11,31):null},convertDateFormat:function(e){return e=e.replace(\"D\",\"ddd\"),e=e.replace(\"d\",\"DD\"),e=e.replace(\"l\",\"dddd\"),e=e.replace(\"j\",\"D\"),e=e.replace(\"N\",\"\"),e=e.replace(\"S\",\"\"),e=e.replace(\"w\",\"d\"),e=e.replace(\"z\",\"\"),e=e.replace(\"W\",\"W\"),e=e.replace(\"M\",\"MMM\"),e=e.replace(\"F\",\"MMMM\"),e=e.replace(\"m\",\"MM\"),e=e.replace(\"n\",\"M\"),e=e.replace(\"t\",\"\"),e=e.replace(\"L\",\"\"),e=e.replace(\"o\",\"YYYY\"),e=e.replace(\"Y\",\"YYYY\"),e=e.replace(\"y\",\"YY\"),e=e.replace(\"a\",\"\"),e=e.replace(\"A\",\"\"),e=e.replace(\"B\",\"\"),e=e.replace(\"g\",\"\"),e=e.replace(\"G\",\"\"),e=e.replace(\"h\",\"\"),e=e.replace(\"H\",\"\"),e=e.replace(\"i\",\"\"),e=e.replace(\"s\",\"\"),e=e.replace(\"u\",\"\"),e=e.replace(\"v\",\"\"),e=e.replace(\"e\",\"\"),e=e.replace(\"I\",\"\"),e=e.replace(\"O\",\"\"),e=e.replace(\"P\",\"\"),e=e.replace(\"T\",\"\"),e=e.replace(\"Z\",\"\"),e=e.replace(\"c\",\"\"),e=e.replace(\"r\",\"\"),e=e.replace(\"u\",\"\")}})}),i(\"controllers/fieldRecaptcha\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"recaptcha\"),\"init:model\",this.initRecaptcha),this.listenTo(nfRadio.channel(\"forms\"),\"submit:response\",this.resetRecaptcha)},initRecaptcha:function(e){nfRadio.channel(\"recaptcha\").reply(\"update:response\",this.updateResponse,this,e.id)},updateResponse:function(e,t){var i=nfRadio.channel(\"fields\").request(\"get:field\",t);i.set(\"value\",e),nfRadio.channel(\"fields\").request(\"remove:error\",i.get(\"id\"),\"required-error\")},resetRecaptcha:function(){var e=0;jQuery(\".g-recaptcha\").each(function(){try{grecaptcha.reset(e)}catch(e){console.log(\"Notice: Error trying to reset grecaptcha.\")}e++})}})}),i(\"controllers/fieldHTML\",[],function(){return Marionette.Object.extend({htmlFields:[],trackedMergeTags:[],initialize:function(){this.listenTo(Backbone.Radio.channel(\"fields-html\"),\"init:model\",this.setupFieldMergeTagTracking)},setupFieldMergeTagTracking:function(e){this.htmlFields.push(e);var t=e.get(\"formID\");this.listenTo(nfRadio.channel(\"form-\"+t),\"init:model\",function(t){var i=e.get(\"default\").match(new RegExp(/{field:(.*?)}/g));i&&(_.each(i,function(e){var i=e.replace(\"{field:\",\"\").replace(\"}\",\"\"),n=t.get(\"fields\").findWhere({key:i});void 0!==n&&(this.trackedMergeTags.push(n),this.listenTo(nfRadio.channel(\"field-\"+n.get(\"id\")),\"change:modelValue\",this.updateFieldMergeTags))},this),this.updateFieldMergeTags())},this)},updateFieldMergeTags:function(e){_.each(this.htmlFields,function(e){var t=e.get(\"value\");_.each(this.trackedMergeTags,function(e){var i=t.match(new RegExp(/<span data-key=\"field:(.*?)<\\/span>/g));_.each(i,function(i){-1<i.indexOf('data-key=\"field:'+e.get(\"key\"))&&(t=t.replace(i,\"{field:\"+e.get(\"key\")+\"}\"))});var n=\"{field:\"+e.get(\"key\")+\"}\";t=t.replace(n,'<span data-key=\"field:'+e.get(\"key\")+'\">'+e.get(\"value\")+\"</span>\")},this),e.set(\"value\",t),e.trigger(\"reRender\")},this)}})}),i(\"controllers/helpText\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"form\"),\"render:view\",this.initHelpText),nfRadio.channel(\"form\").reply(\"init:help\",this.initHelpText)},initHelpText:function(e){jQuery(e.el).find(\".nf-help\").each(function(){jQuery(this).jBox(\"Tooltip\",{theme:\"TooltipBorder\",content:jQuery(this).data(\"text\")})})}})}),i(\"controllers/fieldTextareaRTE\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"textarea\"),\"render:view\",this.initTextareaRTEs),this.listenTo(nfRadio.channel(\"textarea\"),\"click:extra\",this.clickExtra),this.meta_image_frame,this.currentContext={},void 0!==jQuery.summernote&&(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\"})},initTextareaRTEs:function(e){if(1!=e.model.get(\"textarea_rte\"))return!1;var t=this,i=function(e){return t.linkButton(e)},n=function(e){return t.mediaButton(e)},r=[[\"paragraphStyle\",[\"style\"]],[\"fontStyle\",[\"bold\",\"italic\",\"underline\",\"clear\"]],[\"lists\",[\"ul\",\"ol\"]],[\"paragraph\",[\"paragraph\"]],[\"customGroup\",[\"linkButton\",\"unlink\"]],[\"table\",[\"table\"]],[\"actions\",[\"undo\",\"redo\"]]];1==e.model.get(\"textarea_media\")&&0!=userSettings.uid&&r.push([\"tools\",[\"mediaButton\"]]),jQuery(e.el).find(\".nf-element\").summernote({toolbar:r,buttons:{linkButton:i,mediaButton:n},height:150,codemirror:{theme:\"monokai\",lineNumbers:!0},prettifyHtml:!0,callbacks:{onChange:function(t){e.model.set(\"value\",jQuery(this).summernote(\"code\"))}}});var o=jQuery(e.el).find(\".link-button\").next(\".dropdown-menu\").find(\"button\");o.replaceWith(function(){return jQuery(\"<div/>\",{class:jQuery(o).attr(\"class\"),html:this.innerHTML})})},linkButton:function(e){var t=this,i=jQuery.summernote.ui,n=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-rte-link-button\"),r=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-rte-link-dropdown\");return i.buttonGroup([i.button({className:\"dropdown-toggle link-button\",contents:n({}),tooltip:nfi18n.fieldTextareaRTEInsertLink,click:function(i){t.clickLinkButton(i,e)},data:{toggle:\"dropdown\"}}),i.dropdown([i.buttonGroup({children:[i.button({contents:r({}),tooltip:\"\"})]})])]).render()},mediaButton:function(e){var t=this,i=jQuery.summernote.ui,n=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-rte-media-button\");return i.button({className:\"dropdown-toggle\",contents:n({}),tooltip:nfi18n.fieldTextareaRTEInsertMedia,click:function(i){t.openMediaManager(i,e)}}).render()},openMediaManager:function(e,t){if(t.invoke(\"editor.saveRange\"),this.meta_image_frame)return void this.meta_image_frame.open();this.meta_image_frame=wp.media.frames.meta_image_frame=wp.media({title:nfi18n.fieldTextareaRTESelectAFile,button:{text:\"insert\"}});var i=this;this.meta_image_frame.on(\"select\",function(){var e=i.meta_image_frame.state().get(\"selection\").first().toJSON();i.insertMedia(e,t)}),this.meta_image_frame.open()},clickLinkButton:function(e,t){var i=t.invoke(\"editor.createRange\");t.invoke(\"editor.saveRange\");var n=i.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(n),jQuery(e.target).parent().parent().find(\".link-url\").focus()})},clickExtra:function(e){var t=jQuery(e.target).parent().find(\".link-text\"),i=jQuery(e.target).parent().find(\".link-url\"),n=jQuery(e.target).parent().find(\".link-new-window\");if(this.currentContext.invoke(\"editor.restoreRange\"),jQuery(e.target).hasClass(\"insert-link\")){var r=t.val(),o=i.val(),a=!!n.prop(\"checked\");0!=r.length&&0!=o.length&&this.currentContext.invoke(\"editor.createLink\",{text:r,url:o,isNewWindow:a})}t.val(\"\"),i.val(\"\"),n.prop(\"checked\",!1),jQuery(e.target).closest(\"div.note-btn-group.open\").removeClass(\"open\")},insertMedia:function(e,t){t.invoke(\"editor.restoreRange\"),\"image\"==e.type?t.invoke(\"editor.insertImage\",e.url):t.invoke(\"editor.createLink\",{text:e.filename,url:e.url})}})}),i(\"controllers/fieldStarRating\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"starrating\"),\"init:model\",this.register),this.listenTo(nfRadio.channel(\"starrating\"),\"render:view\",this.initRating)},register:function(e){e.set(\"renderRatings\",this.renderRatings)},initRating:function(e){jQuery(e.el).find(\".starrating\").rating()},renderRatings:function(){for(var e=document.createElement(\"span\"),t=0;t<=this.number_of_stars-1;t++){var i=nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-starrating-star\"),n=t+1,r=\"\";this.value==n&&(r=\"checked\");var o=i({id:this.id,classes:this.classes,num:n,checked:r,required:this.required});e.appendChild(document.createRange().createContextualFragment(o))}return e.innerHTML}})}),i(\"controllers/fieldTerms\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"terms\"),\"init:model\",this.register)},register:function(e){this.listenTo(nfRadio.channel(\"field-\"+e.get(\"id\")),\"click:extra\",this.clickExtra),this.listenTo(nfRadio.channel(\"field-\"+e.get(\"id\")),\"keyup:field\",this.keyUpExtra)},clickExtra:function(e,t){var i=jQuery(e.currentTarget),n=i.parent().find(\".extra-value\").val();this.addOption(t,n)},keyUpExtra:function(e,t,i){13==i&&this.addOption(t,e.val())},addOption:function(e,t){if(t){var i=e.get(\"options\"),n={label:t,value:t,selected:0};i.push(n);e.get(\"value\").push(t),e.trigger(\"reRender\")}}})}),i(\"controllers/formContentFilters\",[],function(){return Marionette.Object.extend({initialize:function(){this.viewFilters=[],this.loadFilters=[],nfRadio.channel(\"formContent\").reply(\"add:viewFilter\",this.addViewFilter,this),nfRadio.channel(\"formContent\").reply(\"add:loadFilter\",this.addLoadFilter,this),nfRadio.channel(\"formContent\").reply(\"get:viewFilters\",this.getViewFilters,this),nfRadio.channel(\"formContent\").reply(\"get:loadFilters\",this.getLoadFilters,this),nfRadio.channel(\"fieldContents\").reply(\"add:viewFilter\",this.addViewFilter,this),nfRadio.channel(\"fieldContents\").reply(\"add:loadFilter\",this.addLoadFilter,this),nfRadio.channel(\"fieldContents\").reply(\"get:viewFilters\",this.getViewFilters,this),nfRadio.channel(\"fieldContents\").reply(\"get:loadFilters\",this.getLoadFilters,this)},addViewFilter:function(e,t){this.viewFilters[t]=e},getViewFilters:function(){return this.viewFilters},addLoadFilter:function(e,t){this.loadFilters[t]=e},getLoadFilters:function(){return this.loadFilters}})}),i(\"views/fieldItem\",[],function(){return Marionette.ItemView.extend({tagName:\"div\",initialize:function(){this.listenTo(this.model,\"reRender\",this.render,this),this.listenTo(this.model,\"change:addWrapperClass\",this.addWrapperClass,this),this.listenTo(this.model,\"change:removeWrapperClass\",this.removeWrapperClass,this),this.listenTo(this.model,\"change:invalid\",this.toggleAriaInvalid,this),this.template=\"#tmpl-nf-field-\"+this.model.get(\"wrap_template\")},test:function(e){console.log(\"firing from trigger 1\")},addWrapperClass:function(){var e=this.model.get(\"addWrapperClass\");\"\"!=e&&(jQuery(this.el).addClass(e),this.model.set(\"addWrapperClass\",\"\"))},removeWrapperClass:function(){var e=this.model.get(\"removeWrapperClass\");\"\"!=e&&(jQuery(this.el).removeClass(e),this.model.set(\"removeWrapperClass\",\"\"))},toggleAriaInvalid:function(){var e=this.model.get(\"invalid\");jQuery(\"[aria-invalid]\",this.el).attr(\"aria-invalid\",JSON.stringify(e))},onRender:function(){if(this.$el=this.$el.children(),this.$el.unwrap(),this.setElement(this.$el),void 0!==this.model.get(\"mask\")&&\"\"!=jQuery.trim(this.model.get(\"mask\"))){if(\"custom\"==this.model.get(\"mask\"))var e=this.model.get(\"custom_mask\");else var e=this.model.get(\"mask\");if(Number.isInteger=Number.isInteger||function(e){return\"number\"==typeof e&&isFinite(e)&&Math.floor(e)===e},Number.isInteger(e)&&(e=e.toString()),\"currency\"==e){var t=nfRadio.channel(\"app\").request(\"get:form\",this.model.get(\"formID\")),i=t.get(\"thousands_sep\");\" \"==i&&(i=\" \");var n=jQuery(\"<div/>\").html(t.get(\"currencySymbol\")).text();i=jQuery(\"<div/>\").html(i).text();var r=jQuery(\"<div/>\").html(t.get(\"decimal_point\")).text(),o={digitGroupSeparator:i,decimalCharacter:r,currencySymbol:n},a=jQuery(jQuery(this.el).find(\".nf-element\")[0]);new AutoNumeric(jQuery(this.el).find(\".nf-element\")[0],o);var l=this;a.on(\"change\",function(e){l.model.set(\"value\",e.target.value)})}else jQuery(this.el).find(\".nf-element\").mask(e)}nfRadio.channel(this.model.get(\"type\")).trigger(\"render:view\",this),nfRadio.channel(\"fields\").trigger(\"render:view\",this)},templateHelpers:function(){var e=this;return{renderElement:function(){var e=_.find(this.element_templates,function(e){if(0<jQuery(\"#tmpl-nf-field-\"+e).length)return!0});return nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-\"+e)(this)},renderLabel:function(){return nfRadio.channel(\"app\").request(\"get:template\",\"#tmpl-nf-field-label\")(this)},renderLabelClasses:function(){var e=\"\";return void 0!==this.customLabelClasses&&(e=this.customLabelClasses(e)),e},renderPlaceholder:function(){var e=this.placeholder;return void 0!==this.customPlaceholder&&(e=this.customPlaceholder(e)),\"\"!=jQuery.trim(e)?'placeholder=\"'+e+'\"':\"\"},renderWrapClass:function(){var e=\"field-wrap \"+this.type+\"-wrap\";return this.type!==this.parentType&&(e=e+\" \"+this.parentType+\"-wrap\"),void 0!==this.old_classname&&0<jQuery.trim(this.old_classname).length&&(e+=\" \"+this.old_classname+\"-wrap\"),\"undefined\"!=typeof customWrapClass&&(e=customWrapClass(e)),e},renderClasses:function(){var e=this.classes;return this.error?e+=\" nf-error\":e=e.replace(\"nf-error\",\"\"),void 0!==this.element_class&&0<jQuery.trim(this.element_class).length&&(e+=\" \"+this.element_class),void 0!==this.customClasses&&(e=this.customClasses(e)),e},maybeDisabled:function(){return 1==this.disable_input?\"disabled\":\"\"},maybeRequired:function(){return 1==this.required?\"required\":\"\"},maybeDisableAutocomplete:function(){return 1==this.disable_browser_autocomplete?'autocomplete=\"off\"':\"\"},maybeInputLimit:function(){return\"characters\"==this.input_limit_type&&\"\"!=jQuery.trim(this.input_limit)?'maxlength=\"'+this.input_limit+'\"':\"\"},getHelpText:function(){return void 0!==this.help_text?this.help_text:\"\"},maybeRenderHelp:function(){var e=document.createElement(\"p\");e.innerHTML=this.help_text;var t=!1;if((0!=jQuery.trim(jQuery(e).text()).length||0<jQuery(e).find(\"img\").length)&&(t=!0),void 0!==this.help_text&&t){var i=document.createElement(\"span\");return i.classList.add(\"fa\",\"fa-info-circle\",\"nf-help\"),i.setAttribute(\"data-text\",this.getHelpText()),i.outerHTML}return\"\"},renderDescText:function(){if(void 0===this.desc_text)return\"\";var e=document.createElement(\"p\");if(e.innerHTML=this.desc_text,0==jQuery.trim(e.innerText).length)return\"\";var t,i;if(i=document.createTextNode(this.desc_text),t=document.createElement(\"p\"),t.appendChild(i),0!=jQuery.trim(jQuery(t).text()).length){var n,r;return n=document.createRange().createContextualFragment(this.desc_text),r=document.createElement(\"div\"),r.classList.add(\"nf-field-description\"),r.appendChild(n),r.outerHTML}return\"\"},renderNumberDefault:function(){return this.clean?this.default?this.default:this.placeholder?\"\":this.value:this.value},renderCurrencyFormatting:function(t){var i=t.toString().replace(\".\",\"||\"),n=i.replace(/\\B(?=(\\d{3})+(?!\\d))/g,nfi18n.thousands_sep),r=n.replace(\"||\",nfi18n.decimal_point);return nfRadio.channel(\"app\").request(\"get:form\",e.model.get(\"formID\")).get(\"settings\").currency_symbol+r}}},events:{\"change .nf-element\":\"fieldChange\",\"keyup .nf-element\":\"fieldKeyup\",\"click .nf-element\":\"fieldClick\",\"click .extra\":\"extraClick\",\"blur .nf-element\":\"fieldBlur\"},fieldChange:function(e){var t=jQuery(e.currentTarget);nfRadio.channel(\"nfAdmin\").request(\"change:field\",t,this.model)},fieldKeyup:function(e){var t=jQuery(e.currentTarget),i=e.keyCode;nfRadio.channel(\"field-\"+this.model.get(\"id\")).trigger(\"keyup:field\",t,this.model,i),nfRadio.channel(this.model.get(\"type\")).trigger(\"keyup:field\",t,this.model,i),nfRadio.channel(\"fields\").trigger(\"keyup:field\",t,this.model,i)},fieldClick:function(e){var t=jQuery(e.currentTarget);nfRadio.channel(\"field-\"+this.model.get(\"id\")).trigger(\"click:field\",t,this.model),nfRadio.channel(this.model.get(\"type\")).trigger(\"click:field\",t,this.model),nfRadio.channel(\"fields\").trigger(\"click:field\",t,this.model)},extraClick:function(e){nfRadio.channel(\"field-\"+this.model.get(\"id\")).trigger(\"click:extra\",e,this.model),nfRadio.channel(this.model.get(\"type\")).trigger(\"click:extra\",e,this.model),nfRadio.channel(\"fields\").trigger(\"click:extra\",e,this.model)},fieldBlur:function(e){var t=jQuery(e.currentTarget);nfRadio.channel(\"field-\"+this.model.get(\"id\")).trigger(\"blur:field\",t,this.model),nfRadio.channel(this.model.get(\"type\")).trigger(\"blur:field\",t,this.model),nfRadio.channel(\"fields\").trigger(\"blur:field\",t,this.model)},onAttach:function(){nfRadio.channel(this.model.get(\"type\")).trigger(\"attach:view\",this)}})}),i(\"views/beforeField\",[],function(){return Marionette.ItemView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-field-before\"})}),i(\"views/fieldErrorItem\",[],function(){return Marionette.ItemView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-field-error\",onRender:function(){this.$el=this.$el.children(),this.$el.unwrap(),this.setElement(this.$el)}})}),i(\"views/fieldErrorCollection\",[\"views/fieldErrorItem\"],function(e){return Marionette.CollectionView.extend({tagName:\"nf-errors\",childView:e,initialize:function(e){this.fieldModel=e.fieldModel},onRender:function(){0==this.fieldModel.get(\"errors\").models.length?(this.fieldModel.removeWrapperClass(\"nf-error\"),this.fieldModel.removeWrapperClass(\"nf-fail\"),this.fieldModel.addWrapperClass(\"nf-pass\"),this.fieldModel.setInvalid(!1)):(this.fieldModel.removeWrapperClass(\"nf-pass\"),this.fieldModel.addWrapperClass(\"nf-fail\"),this.fieldModel.addWrapperClass(\"nf-error\"),this.fieldModel.setInvalid(!0))}})}),i(\"views/inputLimit\",[],function(){return Marionette.ItemView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-field-input-limit\",initialize:function(){this.listenTo(nfRadio.channel(\"field-\"+this.model.get(\"id\")),\"keyup:field\",this.updateCount),this.count=this.model.get(\"input_limit\"),this.render()},updateCount:function(e,t){var i=jQuery(e).val(),n=/\\s+/gi,r=i.trim().replace(n,\" \").split(\" \"),o=r.length,a=i.length;if(\"characters\"==this.model.get(\"input_limit_type\")||\"char\"==this.model.get(\"input_limit_type\"))jQuery(e).attr(\"maxlength\",this.model.get(\"input_limit\")),this.count=this.model.get(\"input_limit\")-a;else{this.count=this.model.get(\"input_limit\")-o;var l=this.model.get(\"input_limit\");o>l&&jQuery(e).val(r.slice(0,l).join(\" \"))}this.render()},templateHelpers:function(){var e=this;return{currentCount:function(){return e.count}}}})}),i(\"views/afterField\",[\"views/fieldErrorCollection\",\"views/inputLimit\"],function(e,t){return Marionette.ItemView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-field-after\",initialize:function(){this.model.on(\"change:errors\",this.changeError,this)},onRender:function(){var i=jQuery(this.el).children(\".nf-error-wrap\");if(this.errorCollectionView=new e({el:i,collection:this.model.get(\"errors\"),\nfieldModel:this.model}),0<this.model.get(\"errors\").length&&this.errorCollectionView.render(),void 0!==this.model.get(\"input_limit\")&&\"\"!=jQuery.trim(this.model.get(\"input_limit\"))){var n=jQuery(this.el).children(\".nf-input-limit\");this.inputLimitView=new t({el:n,model:this.model})}},changeError:function(){this.errorCollectionView.render()}})}),i(\"views/fieldLayout\",[\"views/fieldItem\",\"views/beforeField\",\"views/afterField\"],function(e,t,i){return Marionette.LayoutView.extend({tagName:\"nf-field\",regions:{beforeField:\".nf-before-field\",field:\".nf-field\",afterField:\".nf-after-field\"},initialize:function(){this.listenTo(this.model,\"change:visible\",this.render,this)},getTemplate:function(){return this.model.get(\"visible\")?\"#tmpl-nf-field-layout\":\"#tmpl-nf-empty\"},onRender:function(){this.model.get(\"visible\")&&(this.beforeField.show(new t({model:this.model})),this.field.show(new e({model:this.model})),this.afterField.show(new i({model:this.model})))},templateHelpers:function(){return{renderContainerClass:function(){var e=\" label-\"+this.label_pos+\" \";return void 0!==this.desc_pos&&(e+=\"desc-\"+this.desc_pos+\" \"),void 0!==this.container_class&&0<jQuery.trim(this.container_class).length&&(e+=this.container_class+\" \"),this.type!==this.parentType&&(e+=\" \"+this.parentType+\"-container\"),e}}}})}),i(\"controllers/loadViews\",[\"views/fieldItem\",\"views/fieldLayout\"],function(e,t){return Marionette.Object.extend({initialize:function(){nfRadio.channel(\"views\").reply(\"get:fieldItem\",this.getFieldItem),nfRadio.channel(\"views\").reply(\"get:fieldLayout\",this.getFieldLayout)},getFieldItem:function(t){return e},getFieldLayout:function(){return t}})}),i(\"controllers/formErrors\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"fields\"),\"add:error\",this.addError),this.listenTo(nfRadio.channel(\"fields\"),\"remove:error\",this.removeError),nfRadio.channel(\"form\").reply(\"get:errors\",this.getFormErrors)},addError:function(e,t,i){var n=nfRadio.channel(\"app\").request(\"get:form\",e.get(\"formID\"));void 0===n.get(\"fieldErrors\")[e.get(\"id\")]&&(n.get(\"fieldErrors\")[e.get(\"id\")]={}),n.get(\"fieldErrors\")[e.get(\"id\")][t]=i,nfRadio.channel(\"form-\"+e.get(\"formID\")).request(\"add:error\",\"field-errors\",n.get(\"settings\").formErrorsCorrectErrors)},removeError:function(e,t){var i=nfRadio.channel(\"app\").request(\"get:form\",e.get(\"formID\"));i.get(\"fieldErrors\")[e.get(\"id\")]=_.omit(i.get(\"fieldErrors\")[e.get(\"id\")],t),0==_.size(i.get(\"fieldErrors\")[e.get(\"id\")])&&delete i.get(\"fieldErrors\")[e.get(\"id\")],0==_.size(i.get(\"fieldErrors\"))&&nfRadio.channel(\"form-\"+e.get(\"formID\")).request(\"remove:error\",\"field-errors\")},getFormErrors:function(e){var t=nfRadio.channel(\"app\").request(\"get:form\",e),i=!1;return t&&0!==t.get(\"errors\").length&&_.each(t.get(\"errors\").models,function(e){i=i||{},i[e.get(\"id\")]=e.get(\"msg\")}),i}})}),i(\"controllers/submit\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"forms\"),\"init:model\",this.registerSubmitHandler)},registerSubmitHandler:function(e){nfRadio.channel(\"form-\"+e.get(\"id\")).reply(\"submit\",this.submit)},submit:function(e){nfRadio.channel(\"forms\").trigger(\"before:submit\",e),nfRadio.channel(\"form-\"+e.get(\"id\")).trigger(\"before:submit\",e);var t=nfRadio.channel(\"forms\").request(\"maybe:validate\",e);if(!1!==t&&(_.each(e.get(\"fields\").models,function(e){e.set(\"clean\",!1)}),e.get(\"formContentData\").validateFields()),0==nfRadio.channel(\"form-\"+e.get(\"id\")).request(\"maybe:submit\",e))return nfRadio.channel(\"forms\").trigger(\"submit:cancel\",e),void nfRadio.channel(\"form-\"+e.get(\"id\")).trigger(\"submit:cancel\",e);if(!1!==t){var i=_.filter(e.get(\"errors\").models,function(e){return\"invalid_email\"!=e.get(\"id\")&&\"email_not_sent\"!=e.get(\"id\")});if(0!=_.size(i))return nfRadio.channel(\"forms\").trigger(\"submit:failed\",e),nfRadio.channel(\"form-\"+e.get(\"id\")).trigger(\"submit:failed\",e),!1}nfRadio.channel(\"forms\").trigger(\"after:submitValidation\",e),nfRadio.channel(\"form-\"+e.get(\"id\")).trigger(\"after:submitValidation\",e);var n=e.get(\"id\"),r={};_.each(e.get(\"fields\").models,function(e){var t={value:e.get(\"value\"),id:e.get(\"id\")};r[e.get(\"id\")]=nfRadio.channel(e.get(\"type\")).request(\"get:submitData\",t,e)||t});var o=e.get(\"extra\"),a=e.get(\"settings\");delete a.formContentData;var l=JSON.stringify({id:n,fields:r,settings:a,extra:o}),s={action:\"nf_ajax_submit\",security:nfFrontEnd.ajaxNonce,nonce_ts:nfFrontEnd.nonce_ts,formData:l};jQuery.ajax({url:nfFrontEnd.adminAjax,type:\"POST\",data:s,cache:!1,success:function(t,i,n){try{var r=t;nfRadio.channel(\"forms\").trigger(\"submit:response\",r,i,n,e.get(\"id\")),nfRadio.channel(\"form-\"+e.get(\"id\")).trigger(\"submit:response\",r,i,n),jQuery(document).trigger(\"nfFormSubmitResponse\",{response:r,id:e.get(\"id\")})}catch(e){console.log(e),console.log(\"Parse Error\"),console.log(e)}},error:function(t,i,n){console.log(\"ERRORS: \"+n),console.log(t);try{var r=jQuery.parseJSON(t.responseText);nfRadio.channel(\"forms\").trigger(\"submit:response\",r,i,t,e.get(\"id\")),nfRadio.channel(\"form-\"+e.get(\"id\")).trigger(\"submit:response\",r,i,t)}catch(e){console.log(\"Parse Error\")}nfRadio.channel(\"forms\").trigger(\"submit:response\",\"error\",i,t,n)}})}})}),i(\"views/fieldCollection\",[\"views/fieldLayout\"],function(e){return Marionette.CollectionView.extend({tagName:\"nf-fields-wrap\",childView:e})}),i(\"controllers/defaultFilters\",[\"views/fieldCollection\",\"models/fieldCollection\"],function(e,t){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"form\"),\"before:filterData\",this.registerDefaultDataFilter)},registerDefaultDataFilter:function(e){nfRadio.channel(\"formContent\").request(\"add:loadFilter\",this.defaultFormContentLoad,10,this),nfRadio.channel(\"formContent\").request(\"add:viewFilter\",this.defaultFormContentView,10,this)},defaultFormContentLoad:function(e,i,n){var r=i.get(\"fields\"),o=nfRadio.channel(\"formContent\").request(\"get:loadFilters\");if(1==_.without(o,void 0).length||void 0===e||1==e instanceof Backbone.Collection)return i.get(\"fields\");var a=_.map(e,function(e){return i.get(\"fields\").findWhere({key:e})},this),l=new t(a);return r.on(\"reset\",function(e){var t=[];l.each(function(i){\"submit\"!=i.get(\"type\")?t.push(e.findWhere({key:i.get(\"key\")})):t.push(i)}),l.options={formModel:i},l.reset(t)}),l},defaultFormContentView:function(){return e}})}),i(\"controllers/uniqueFieldError\",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel(\"fields\"),\"change:modelValue\",this.removeError),this.listenTo(nfRadio.channel(\"fields\"),\"keyup:field\",this.removeError),this.listenTo(nfRadio.channel(\"fields\"),\"blur:field\",this.removeError)},removeError:function(e,t){t=t||e,nfRadio.channel(\"fields\").request(\"remove:error\",t.get(\"id\"),\"unique_field\")}})}),i(\"controllers/loadControllers\",[\"controllers/formData\",\"controllers/fieldError\",\"controllers/changeField\",\"controllers/changeEmail\",\"controllers/changeDate\",\"controllers/fieldCheckbox\",\"controllers/fieldCheckboxList\",\"controllers/fieldRadio\",\"controllers/fieldNumber\",\"controllers/mirrorField\",\"controllers/confirmField\",\"controllers/updateFieldModel\",\"controllers/submitButton\",\"controllers/submitDebug\",\"controllers/getFormErrors\",\"controllers/validateRequired\",\"controllers/submitError\",\"controllers/actionRedirect\",\"controllers/actionSuccess\",\"controllers/fieldSelect\",\"controllers/coreSubmitResponse\",\"controllers/fieldProduct\",\"controllers/fieldTotal\",\"controllers/fieldQuantity\",\"controllers/calculations\",\"controllers/fieldDate\",\"controllers/fieldRecaptcha\",\"controllers/fieldHTML\",\"controllers/helpText\",\"controllers/fieldTextareaRTE\",\"controllers/fieldStarRating\",\"controllers/fieldTerms\",\"controllers/formContentFilters\",\"controllers/loadViews\",\"controllers/formErrors\",\"controllers/submit\",\"controllers/defaultFilters\",\"controllers/uniqueFieldError\"],function(e,t,i,n,r,o,a,l,s,d,c,f,u,h,g,m,p,v,y,R,b,w,_,x,C,F,M,T,k,j,E,q,Q,D,V,O,I,L){return Marionette.Object.extend({initialize:function(){new D,new V,new O,new o,new a,new l,new s,new R,new w,new _,new x,new M,new T,new k,new j,new E,new q,new Q,new L,new t,new i,new n,new r,new d,new c,new f,new u,new h,new g,new m,new p,new v,new y,new b,new C,new I,new F,new e}})}),i(\"views/beforeForm\",[],function(){return Marionette.ItemView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-before-form\"})}),i(\"views/formErrorItem\",[],function(){return Marionette.ItemView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-form-error\",onRender:function(){}})}),i(\"views/formErrorCollection\",[\"views/formErrorItem\"],function(e){return Marionette.CollectionView.extend({tagName:\"nf-errors\",childView:e})}),i(\"views/honeyPot\",[],function(){return Marionette.ItemView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-form-hp\",events:{\"keyup .nf-field-hp\":\"maybeError\",\"change .nf-field-hp\":\"maybeError\"},maybeError:function(e){if(0==jQuery(e.target).val().length)nfRadio.channel(\"form-\"+this.model.get(\"id\")).request(\"remove:error\",\"honeyPot\");else{var t=nfRadio.channel(\"app\").request(\"get:form\",this.model.get(\"id\"));nfRadio.channel(\"form-\"+this.model.get(\"id\")).request(\"add:error\",\"honeyPot\",t.get(\"settings\").honeypotHoneypotError)}}})}),i(\"views/afterFormContent\",[\"views/formErrorCollection\",\"views/honeyPot\"],function(e,t){return Marionette.LayoutView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-after-fields\",regions:{errors:\".nf-form-errors\",hp:\".nf-form-hp\"},onShow:function(){this.errors.show(new e({collection:this.model.get(\"errors\")})),this.hp.show(new t({model:this.model}))}})}),i(\"views/beforeFormContent\",[],function(){return Marionette.ItemView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-before-fields\",templateHelpers:function(){return{renderFieldsMarkedRequired:function(){return this.fields.filter({required:1}).length?this.fieldsMarkedRequired:\"\"}}}})}),i(\"views/formLayout\",[\"views/afterFormContent\",\"views/beforeFormContent\",\"models/fieldCollection\"],function(e,t,i){return Marionette.LayoutView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-form-layout\",regions:{beforeFormContent:\".nf-before-form-content\",formContent:\".nf-form-content\",afterFormContent:\".nf-after-form-content\"},initialize:function(){nfRadio.channel(\"form-\"+this.model.get(\"id\")).reply(\"get:el\",this.getEl,this),this.listenTo(this.model,\"hide\",this.hide)},onRender:function(){this.$el=this.$el.children(),this.$el.unwrap(),this.setElement(this.$el)},onShow:function(){this.beforeFormContent.show(new t({model:this.model}));var i=this.model.get(\"formContentData\"),n=nfRadio.channel(\"formContent\").request(\"get:viewFilters\"),r=_.without(n,void 0),o=_.first(r);formContentView=o();var a={data:i,formModel:this.model};!1!=i instanceof Backbone.Collection?a.collection=i:!1!=i instanceof Backbone.Model&&(a.model=i),this.formContent.show(new formContentView(a)),this.afterFormContent.show(new e({model:this.model}))},getEl:function(){return this.el},templateHelpers:function(){return{renderClasses:function(){return\"\"}}},hide:function(){jQuery(this.el).hide()}})}),i(\"views/afterForm\",[],function(){return Marionette.ItemView.extend({tagName:\"nf-section\",template:\"#tmpl-nf-after-form\"})}),i(\"views/mainLayout\",[\"views/beforeForm\",\"views/formLayout\",\"views/afterForm\"],function(e,t,i){return Marionette.LayoutView.extend({template:\"#tmpl-nf-layout\",regions:{responseMsg:\".nf-response-msg\",beforeForm:\".nf-before-form\",formLayout:\".nf-form-layout\",afterForm:\".nf-after-form\"},initialize:function(){this.$el=jQuery(\"#nf-form-\"+this.model.id+\"-cont\"),this.el=\"#nf-form-\"+this.model.id+\"-cont\",this.render(),this.beforeForm.show(new e({model:this.model})),this.formLayout.show(new t({model:this.model,fieldCollection:this.options.fieldCollection})),this.afterForm.show(new i({model:this.model})),this.listenTo(this.model,\"hide\",this.hide)},hide:function(){jQuery(this.el).find(\".nf-form-title\").hide()}})}),function(e){var t=e.fn.val;e.fn.val=function(){var i;arguments.length>0&&(i=t.apply(this,[]));var n=t.apply(this,arguments);return arguments.length>0&&i!=t.apply(this,[])&&e(this).hasClass(\"nf-element\")&&e(this).change(),n}}(jQuery),jQuery(document).ready(function(e){t([\"models/formCollection\",\"models/formModel\",\"models/fieldCollection\",\"controllers/loadControllers\",\"views/mainLayout\"],function(t,i,n,r,o){if(\"undefined\"==typeof nfForms)return void jQuery(\".nf-form-cont\").empty();(new(Marionette.Application.extend({forms:{},initialize:function(e){var t=this;Marionette.Renderer.render=function(e,i){var e=t.template(e);return e(i)},this.getNonce(),this.urlParameters=_.object(_.compact(_.map(location.search.slice(1).split(\"&\"),function(e){if(e)return e.split(\"=\")}))),void 0!==this.urlParameters.nf_resume&&this.listenTo(nfRadio.channel(\"form-\"+this.urlParameters.nf_resume),\"loaded\",this.restart);new r;nfRadio.channel(\"app\").trigger(\"after:loadControllers\"),nfRadio.channel(\"app\").reply(\"get:template\",this.template)},onStart:function(){var e=nfRadio.channel(\"app\").request(\"get:forms\");_.each(e.models,function(e,t){var i=new o({model:e,fieldCollection:e.get(\"fields\")});nfRadio.channel(\"form\").trigger(\"render:view\",i),jQuery(document).trigger(\"nfFormReady\",i)})},restart:function(e){if(void 0!==this.urlParameters.nf_resume){var t={action:\"nf_ajax_submit\",security:nfFrontEnd.ajaxNonce,nf_resume:this.urlParameters};nfRadio.channel(\"form-\"+e.get(\"id\")).trigger(\"disable:submit\"),nfRadio.channel(\"form-\"+e.get(\"id\")).trigger(\"processingLabel\"),this.listenTo(nfRadio.channel(\"form\"),\"render:view\",function(){jQuery(\"#nf-form-\"+e.get(\"id\")+\"-cont .nf-field-container:not(.submit-container)\").hide()}),jQuery.ajax({url:nfFrontEnd.adminAjax,type:\"POST\",data:t,cache:!1,success:function(t,i,n){try{var r=t;nfRadio.channel(\"forms\").trigger(\"submit:response\",r,i,n,e.get(\"id\")),nfRadio.channel(\"form-\"+e.get(\"id\")).trigger(\"submit:response\",r,i,n)}catch(e){console.log(\"Parse Error\")}},error:function(e,t,i){console.log(\"ERRORS: \"+t),nfRadio.channel(\"forms\").trigger(\"submit:response\",\"error\",t,e,i)}})}},getNonce:function(){var e={action:\"nf_ajax_get_new_nonce\"};jQuery.ajax({url:nfFrontEnd.adminAjax,type:\"POST\",data:e,cache:!1,success:function(e,t,i){try{e=JSON.parse(e);var n=e.data;nfFrontEnd.ajaxNonce=n.new_nonce,nfFrontEnd.nonce_ts=n.nonce_ts}catch(e){console.log(\"Parse Error\")}},error:function(e,t,i){console.log(\"ERRORS: \"+t)}})},template:function(t){return _.template(e(t).html(),{evaluate:/<#([\\s\\S]+?)#>/g,interpolate:/\\{\\{\\{([\\s\\S]+?)\\}\\}\\}/g,escape:/\\{\\{([^\\}]+?)\\}\\}(?!\\})/g,variable:\"data\"})}}))).start()})}),i(\"main\",function(){})}();"],"file":"front-end.js"}