(function($,window){var http;window.Granite=window.Granite||{};window.Granite.$=window.Granite.$||$;window._g=window._g||{};window._g.$=window._g.$||$;http=Granite.HTTP;$.ajaxSetup({externalize:true,encodePath:true,hook:true,beforeSend:function(jqXHR,s){if(typeof G_IS_HOOKED==="undefined"||!G_IS_HOOKED(s.url)){if(s.externalize)s.url=http.externalize(s.url);if(s.encodePath)s.url=http.encodePathOfURI(s.url)}if(s.hook){var hook=http.getXhrHook(s.url,s.type,s.data);if(hook){s.url=hook.url;if(hook.params)if(s.type.toUpperCase()=== "GET")s.url+="?"+$.param(hook.params);else s.data=$.param(hook.params)}}},statusCode:{403:function(jqXHR){if(jqXHR.getResponseHeader("X-Reason")==="Authentication Failed")http.handleLoginRedirect()}}});$.ajaxSettings.traditional=true})(jQuery,this); (function(window,undefined){window.Granite=window.Granite||{};if(window.Granite.csrf)return;window.Granite.csrf={initialised:false,refreshToken:getToken};function Promise(){this._handler=[]}Promise.prototype={then:function(resolveFn,rejectFn){this._handler.push({resolve:resolveFn,reject:rejectFn})},resolve:function(){this._execute("resolve",arguments)},reject:function(){this._execute("reject",arguments)},_execute:function(result,args){if(this._handler===null)throw new Error("Promise already completed."); for(var i=0,ln=this._handler.length;i