/* * # Fomantic UI - 2.8.6 * https://github.com/fomantic/Fomantic-UI * http://fomantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(P,j,e,O){"use strict";P.isWindow=P.isWindow||function(e){return null!=e&&e===e.window},j=void 0!==j&&j.Math==Math?j:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),P.api=P.fn.api=function(R){var q,e=P.isFunction(this)?P(j):P(this),x=e.selector||"",S=(new Date).getTime(),A=[],w=R,T="string"==typeof w,k=[].slice.call(arguments,1);return e.each(function(){var s,i,r,e,a,u,c=P.isPlainObject(R)?P.extend(!0,{},P.fn.api.settings,R):P.extend({},P.fn.api.settings),t=c.namespace,n=c.metadata,o=c.selector,d=c.error,l=c.className,f="."+t,g="module-"+t,p=P(this),m=p.closest(o.form),b=c.stateContext?P(c.stateContext):p,v=this,h=b[0],y=p.data(g);u={initialize:function(){T||u.bind.events(),u.instantiate()},instantiate:function(){u.verbose("Storing instance of module",u),y=u,p.data(g,y)},destroy:function(){u.verbose("Destroying previous module for",v),p.removeData(g).off(f)},bind:{events:function(){var e=u.get.event();e?(u.verbose("Attaching API events to element",e),p.on(e+f,u.event.trigger)):"now"==c.on&&(u.debug("Querying API endpoint immediately"),u.query())}},decode:{json:function(e){if(e!==O&&"string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}},read:{cachedResponse:function(e){var t;if(j.Storage!==O)return t=sessionStorage.getItem(e),u.debug("Using cached response",e,t),t=u.decode.json(t);u.error(d.noStorage)}},write:{cachedResponse:function(e,t){t&&""===t?u.debug("Response empty, not caching",t):j.Storage!==O?(P.isPlainObject(t)&&(t=JSON.stringify(t)),sessionStorage.setItem(e,t),u.verbose("Storing cached response for url",e,t)):u.error(d.noStorage)}},query:function(){if(u.is.disabled())u.debug("Element is disabled API request aborted");else{if(u.is.loading()){if(!c.interruptRequests)return void u.debug("Cancelling request, previous request is still pending");u.debug("Interrupting previous request"),u.abort()}if(c.defaultData&&P.extend(!0,c.urlData,u.get.defaultData()),c.serializeForm&&(c.data=u.add.formData(c.data)),!1===(i=u.get.settings()))return u.cancelled=!0,void u.error(d.beforeSend);if(u.cancelled=!1,(r=u.get.templatedURL())||u.is.mocked()){if((r=u.add.urlData(r))||u.is.mocked()){if(i.url=c.base+r,s=P.extend(!0,{},c,{type:c.method||c.type,data:e,url:c.base+r,beforeSend:c.beforeXHR,success:function(){},failure:function(){},complete:function(){}}),u.debug("Querying URL",s.url),u.verbose("Using AJAX settings",s),"local"===c.cache&&u.read.cachedResponse(r))return u.debug("Response returned from local cache"),u.request=u.create.request(),void u.request.resolveWith(h,[u.read.cachedResponse(r)]);c.throttle?c.throttleFirstRequest||u.timer?(u.debug("Throttling request",c.throttle),clearTimeout(u.timer),u.timer=setTimeout(function(){u.timer&&delete u.timer,u.debug("Sending throttled request",e,s.method),u.send.request()},c.throttle)):(u.debug("Sending request",e,s.method),u.send.request(),u.timer=setTimeout(function(){},c.throttle)):(u.debug("Sending request",e,s.method),u.send.request())}}else u.error(d.missingURL)}},should:{removeError:function(){return!0===c.hideError||"auto"===c.hideError&&!u.is.form()}},is:{disabled:function(){return 0