!function(P,j,O){"use strict";P.isWindow=P.isWindow||function(e){returnnull!=e&&e===e.window},j=void0!==j&&j.Math==Math?j:"undefined"!=typeofself&&self.Math==Math?self:Function("return this")(),P.api=P.fn.api=function(R){varq,e=P.isFunction(this)?P(j):P(this),x=e.selector||"",S=(newDate).getTime(),A=[],w=R,T="string"==typeofw,k=[].slice.call(arguments,1);returne.each(function(){vars,n,r,e,p,i=P.isPlainObject(R)?P.extend(!0,{},P.fn.api.settings,R):P.extend({},P.fn.api.settings),t=i.namespace,o=i.metadata,m=i.selector,a=i.error,b=i.className,v="."+t,h="module-"+t,u=P(this),y=u.closest(m.form),c=i.stateContext?P(i.stateContext):u,d=this,l=c[0],f=u.data(h),g={initialize:function(){T||g.bind.events(),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),f=g,u.data(h,f)},destroy:function(){g.verbose("Destroying previous module for",d),u.removeData(h).off(v)},bind:{events:function(){vare=g.get.event();e?(g.verbose("Attaching API events to element",e),u.on(e+v,g.event.trigger)):"now"==i.on&&(g.debug("Querying API endpoint immediately"),g.query())}},decode:{json:function(e){if(e!==O&&"string"==typeofe)try{e=JSON.parse(e)}catch(e){}returne}},read:{cachedResponse:function(e){vart;if(j.Storage!==O)returnt=sessionStorage.getItem(e),g.debug("Using cached response",e,t),g.decode.json(t);g.error(a.noStorage)}},write:{cachedResponse:function(e,t){t&&""===t?g.debug("Response empty, not caching",t):j.Storage!==O?(P.isPlainObject(t)&&(t=JSON.stringify(t)),sessionStorage.setItem(e,t),g.verbose("Storing cached response for url",e,t)):g.error(a.noStorage)}},query:function(){if(g.is.disabled())g.debug("Element is disabled API request aborted");else{if(g.is.loading()){if(!i.interruptRequests)returnvoidg.debug("Cancelling request, previous request is still pending");g.debug("Interrupting previous request"),g.abort()}if(i.defaultData&&P.extend(!0,i.urlData,g.get.defaultData()),i.serializeForm&&(i.data=g.add.formData(i.data)),!1===(n=g.get.settings()))returng.cancelled=!0,voidg.error(a.beforeSend);if(g.cancelled=!1,(r=g.get.templatedURL())||g.is.mocked()){if((r=g.add.urlData(r))||g.is.mocked()){if(n.url=i.base+r,s=P.extend(!0,{},i,{type:i.method||i.type,data:e,url:i.base+r,beforeSend:i.beforeXHR,success:function(){},failure:function(){},complete:function(){}}),g.debug("Querying URL",s.url),g.verbose("Using AJAX settings",s),"local"===i.cache&&g.read.cachedResponse(r))returng.debug("Response returned from local cache"),g.request=g.create.request(),voidg.request.resolveWith(l,[g.read.cachedResponse(r)]);i.throttle?i.throttleFirstRequest||g.timer?(g.debug("Throttling request",i.throttle),clearTimeout(g.timer),g.timer=setTimeout(function(){g.timer&&deleteg.timer,g.debug("Sending throttled request",e,s.method),g.send.request()},i.throttle)):(g.debug("Sending request",e,s.method),g.send.request(),g.timer=setTimeout(function(){},i.throttle)):(g.debug("Sending request",e,s.method),g.send.request())}}elseg.error(a.missingURL)}},should:{removeError:function(){return!0===i.hideError||"auto"===i.hideError&&!g.is.form()}},is:{disabled:function(){return0<u.filter(m.disabled).length},expectingJSON:function(){return"json"===i.dataType||"jsonp"===i.dataType},form:function(){returnu.is("form")||c.is("form")},mocked:function(){returni.mockResponse||i.mockResponseAsync||i.response||i.responseAsync},input:function(){returnu.is("input")},loading:function(){return!!g.request&&"pending"==g.request.state()},abortedRequest:function(e){returne&&e.readyState!==O&&0===e.readyState?(g.verbose("XHR request determined to be aborted"),!0):(g.verbose("XHR request was not aborted"),!1)},validResponse:function(e){returng.is.expectingJSON()&&P.isFunction(i.successTest)?(g.debug("Checking JSON returned success",i.successTest,e),i.successTest(e)?(g.debug("Response passed success test",e),!0):(g.debug("Response failed success test",e),!1)):(g.verbose("Response is not JSON, skipping validation",i.successTest,e),!0)}},was:{cancelled:function(){returng.cancelled||!1},succesful:function(){returng.verbose('Thisbehaviorwillbedeleted