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