!function($,I,O,L){"use strict";$.isFunction=$.isFunction||function(e){return"function"==typeofe&&"number"!=typeofe.nodeType},I=void0!==I&&I.Math==Math?I:"undefined"!=typeofself&&self.Math==Math?self:Function("return this")(),$.fn.form=function(C){varw,V=$(this),A=V.selector||"",D=(newDate).getTime(),F=[],R=C,S=arguments[1],T="string"==typeofR,j=[].slice.call(arguments,1);returnV.each(function(){varn,d,t,e,f,s,m,p,g,r,u,i,a,l,c,h=$(this),v=this,b=[],y=!1,o=!1,x=!1,k=["clean","clean"],E={initialize:function(){E.get.settings(),T?(c===L&&E.instantiate(),E.invoke(R)):(c!==L&&(c.invoke("destroy"),E.refresh()),E.verbose("Initializing form validation",h,f),E.bindEvents(),E.set.defaults(),f.autoCheckRequired&&E.set.autoCheck(),E.instantiate())},instantiate:function(){E.verbose("Storing instance of module",E),c=E,h.data(a,E)},destroy:function(){E.verbose("Destroying previous module",c),E.removeEvents(),h.removeData(a)},refresh:function(){E.verbose("Refreshing selector cache"),n=h.find(p.field),d=h.find(p.group),t=h.find(p.message),h.find(p.prompt),e=h.find(p.submit),h.find(p.clear),h.find(p.reset)},submit:function(){E.verbose("Submitting form",h),o=!0,h.submit()},attachEvents:function(e,t){t=t||"submit",$(e).on("click"+l,function(e){E[t](),e.preventDefault()})},bindEvents:function(){E.verbose("Attaching form events"),h.on("submit"+l,E.validate.form).on("blur"+l,p.field,E.event.field.blur).on("click"+l,p.submit,E.submit).on("click"+l,p.reset,E.reset).on("click"+l,p.clear,E.clear),f.keyboardShortcuts&&h.on("keydown"+l,p.field,E.event.field.keydown),n.each(function(e,t){vart=$(t),n=t.prop("type"),n=E.get.changeEvent(n,t);t.on(n+l,E.event.field.change)}),f.preventLeaving&&$(I).on("beforeunload"+l,E.event.beforeUnload),n.on("change click keyup keydown blur",function(e){E.determine.isDirty()}),h.on("dirty"+l,function(e){f.onDirty.call()}),h.on("clean"+l,function(e){f.onClean.call()})},clear:function(){n.each(function(e,t){vart=$(t),n=t.parent(),r=t.closest(d),i=r.find(p.prompt),a=t.closest(p.uiCalendar),o=t.data(m.defaultValue)||"",l=n.is(p.uiCheckbox),s=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),u=0<a.length&&E.can.useElement("calendar");r.hasClass(g.error)&&(E.verbose("Resetting error on field",r),r.removeClass(g.error),i.remove()),s?(E.verbose("Resetting dropdown value",n,o),n.dropdown("clear",!0)):l?t.prop("checked",!1):u?a.calendar("clear"):(E.verbose("Resetting field value",t,o),t.val(""))}),E.remove.states()},reset:function(){n.each(function(e,t){vart=$(t),n=t.parent(),r=t.closest(d),i=t.closest(p.uiCalendar),a=r.find(p.prompt),o=t.data(m.defaultValue),l=n.is(p.uiCheckbox),s=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),u=0<i.length&&E.can.useElement("calendar"),c=r.hasClass(g.error);o!==L&&(c&&(E.verbose("Resetting error on field",r),r.removeClass(g.error),a.remove()),s?(E.verbose("Resetting dropdown value",n,o),n.dropdown("restore defaults",!0)):l?(E.verbose("Resetting checkbox value",n,o),t.prop("checked",o)):u?i.calendar("set date",o):(E.verbose("Resetting field value",t,o),t.val(o)))}),E.remove.states()},determine:{isValid:function(){varn=!0;return$.each(s,function(e,t){E.validate.field(t,e,!0)||(n=!1)}),n},isDirty:function(e){varr=!1;n.each(function(e,t){vart=$(t),n=0<t.filter(p.checkbox).length?E.is.checkboxDirty(t):E.is.fieldDirty(t);t.data(f.metadata.isDirty,n),r|=n}),r?E.set.dirty():E.set.clean()}},is:{bracketedRule:function(e){returne.type&&e.type.match(f.regExp.bracket)},shorthandRules:function(e){return"string"==typeofe||Array.isArray(e)},empty:function(e){return!e||0===e.length||(e.is(p.checkbox)?!e.is(":checked"):E.is.blank(e))},blank:function(e){return""===String(e.val()).trim()},valid:function(e,n){varr=!0;returne?(E.verbose("Checking if field is valid",e),E.validate.field(s[e],e,!!n)):(E.verbose("Checking if form is valid"),$.each(s,function(e,t){E.is.valid(e,n)||(r=!1)}),r)},dirty:function(){returnx},clean:function(){return!x},fieldDirty:function(e){vart=e.data(m.defaultValue),e=(null==t?t="":Array.isArray(t)&&(t=t.toString()),e.val()),n=(null==e?e="":Array.isArray(e)&&(e=e.toSt