(function(x){function t(t,e,r){if(x.isPlainObject(t)){r=t;return a.call(this,r)}r=h(e,r);return this.on("click.pjax",t,function(t){n.call(this,t,r)})}function a(e){return this.on("click.pjax",function(t){n.call(this,t,e)})}function n(t,e){var r=x.extend({},e);if(!r.container)r.container=x(this).attr("data-pjax");var a=x(this).attr("data-keepjs");if(a!=undefined)r.keepjs=a;i(t,r)}function i(t,e,r){r=h(e,r);var a=t.currentTarget;var n=x(a);if(a.tagName.toUpperCase()!=="A")throw"$.fn.pjax or $.pjax.click requires an anchor element";if(t.which>1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;if(location.protocol!==a.protocol||location.hostname!==a.hostname)return;if(a.href.indexOf("#")>-1&&d(a)==d(location))return;if(t.isDefaultPrevented())return;var i={url:a.href,container:n.attr("data-pjax")||r.container,target:a};var o=x.extend({},i,r);var s=x.Event("pjax:click");x(a).trigger(s,[o]);if(!s.isDefaultPrevented()){g(o);t.preventDefault();x(a).trigger("pjax:clicked",[o])}}function e(t,e,r){r=h(e,r);var a=t.currentTarget;var n=x(a);if(a.tagName.toUpperCase()!=="FORM")throw"$.pjax.submit requires a form element";var i={type:(n.attr("method")||"GET").toUpperCase(),url:n.attr("action"),container:n.attr("data-pjax")||r.container,target:a};if(i.type!=="GET"&&window.FormData!==undefined){i.data=new FormData(a);i.processData=false;i.contentType=false}else{if(x(a).find(":file").length){return}i.data=x(a).serializeArray()}g(x.extend({},i,r));t.preventDefault()}function g(d){d=x.extend(true,{},x.ajaxSetup(),g.defaults,d);if(typeof d.url==="function"){d.url=d.target?d.url.call(d.target,d):d.url(d)}var n=d.target;var h=b(d.url).hash;var t=typeof d.container;if(t!=="string"){throw"expected string value for 'container' option; got "+t}var v=d.context=x(d.container);if(!v.length){throw"the container selector '"+d.container+"' did not match anything"}if(!d.data)d.data={};if(Array.isArray(d.data)){d.data.push({name:"_pjax",value:d.container})}else{d.data._pjax=d.container}function m(t,e,r){if(!r)r={};r.relatedTarget=n;var a=x.Event(t,r);v.trigger(a,e);if(n)x(n).trigger(a,e);return!a.isDefaultPrevented()}var a;d.beforeSend=function(t,e){if(e.type!=="GET"){e.timeout=0}t.setRequestHeader("X-PJAX","true");t.setRequestHeader("X-PJAX-Container",d.container);if(!m("pjax:beforeSend",[t,e]))return false;if(e.timeout>0){a=setTimeout(function(){if(m("pjax:timeout",[t,d]))t.abort("timeout")},e.timeout);e.timeout=0}var r=b(e.url);if(h)r.hash=h;d.requestUrl=u(r)};d.complete=function(t,e){if(a)clearTimeout(a);m("pjax:complete",[t,e,d]);m("pjax:end",[t,d])};d.error=function(t,e,r){var a=T("",t,d);var n=m("pjax:error",[t,e,r,d]);if(d.type=="GET"&&e!=="abort"&&n){j(a.url)}};d.success=function(t,e,r){var a=g.state;var n=typeof x.pjax.defaults.version==="function"?x.pjax.defaults.version():x.pjax.defaults.version;var i=r.getResponseHeader("X-PJAX-Version");var o=T(t,r,d);var s=b(o.url);if(h){s.hash=h;o.url=s.href}if(n&&i&&n!==i){j(o.url);return}if(!o.contents){j(o.url);return}g.state={id:d.id||y(),url:o.url,title:o.title,container:d.container,fragment:d.fragment,timeout:d.timeout};if(d.push||d.replace){window.history.replaceState(g.state,o.title,o.url)}var c=x.contains(d.container,document.activeElement);if(c){try{document.activeElement.blur()}catch(t){}}if(o.title)document.title=o.title;m("pjax:beforeReplace",[o.contents,d],{state:g.state,previousState:a});v.html(o.contents);var u=v.find("input[autofocus], textarea[autofocus]").last()[0];if(u&&document.activeElement!==u){u.focus()}E(o.scripts);var l=d.scrollTo;if(h){var f=decodeURIComponent(h.slice(1));var p=document.getElementById(f)||document.getElementsByName(f)[0];if(p)l=x(p).offset().top}if(typeof l=="number")x(window).scrollTop(l);m("pjax:success",[t,e,r,d])};if(!g.state){g.state={id:y(),url:window.location.href,title:document.title,container:d.container,fragment:d.fragment,timeout:d.timeout};window.history.replaceState(g.state,document.title)}p(g.xhr);g.options=d;var e=g.xhr=x.ajax(d);if(e.readyState>0){if(d.push&&!d.replace){A(g.state.id,w(v));window.history.pushState(null,"",d.requestUrl)}m("pjax:start",[e,d]);m("pjax:send",[e,d])}return g.xhr}function r(t,e){var r={url:window.location.href,push:false,replace:true,scrollTo:false};return g(x.extend(r,h(t,e)))}function j(t){window.history.replaceState(null,"",g.state.url);window.location.replace(t)}var l=true;var f=window.location.href;var o=window.history.state;if(o&&o.container){g.state=o}if("state"in window.history){l=false}function s(t){if(!l){p(g.xhr)}var e=g.state;var r=t.state;var a;if(r&&r.container){if(l&&f==r.url)return;if(e){if(e.id===r.id)return;a=e.id<r.id?"forward":"back"}var n=S[r.id]||[];var i=x(n[0]||r.container),o=n[1];if(i.length){if(e){C(a,e.id,w(i))}var s=x.Event("pjax:popstate",{state:r,direction:a});i.trigger(s);var c={id:r.id,url:r.url,container:i,push:false,fragment:r.fragment,timeout:r.timeout,scrollTo:false};if(o){i.trigger("pjax:start",[null,c]);g.state=r;if(r.title)document.title=r.title;var u=x.Event("pjax:beforeReplace",{state:r,previousState:e});i.trigger(u,[o,c]);i.html(o);i.trigger("pjax:end",[null,c])}else{g(c)}i[0].offsetHeight}else{j(location.href)}}l=false}function c(t){var e=typeof t.url=="function"?t.target?t.url.call(t.target,t):t.url(t):t.url,r=t.type?t.type.toUpperCase():"GET";var a=x("<form>",{method:r==="GET"?"GET":"POST",action:e,style:"display:none"});if(r!=="GET"&&r!=="POST"){a.append(x("<input>",{type:"hidden",name:"_method",value:r.toLowerCase()}))}var n=t.data;if(typeof n==="string"){x.each(n.split("&"),function(t,e){var r=e.split("=");a.append(x("<input>",{type:"hidden",name:r[0],value:r[1]}))})}else if(Array.isArray(n)){x.each(n,function(t,e){a.append(x("<input>",{type:"hidden",name:e.name,value:e.value}))})}else if(typeof n==="object"){var i;for(i in n)a.append(x("<input>",{type:"hidden",name:i,value:n[i]}))}x(document.body).append(a);a.trigger("submit")}function p(t){if(t&&t.readyState<4){t.onreadystatechange=x.noop;t.abort()}}function y(){return(new Date).getTime()}function w(t){var e=t.clone();e.find("script").each(function(){if(!this.src)jQuery._data(this,"globalEval",false)});return[t.selector,e.contents()]}function u(t){t.search=t.search.replace(/([?&])(_pjax|_)=[^&]*/g,"");return t.href.replace(/\?($|#)/,"$1")}function b(t){var e=document.createElement("a");e.href=t;return e}function d(t){return t.href.replace(/#.*/,"")}function h(t,e){if(t&&e){e=x.extend({},e);e.container=t;return e}else if(x.isPlainObject(t)){return t}else{return{container:t}}}function v(t,e){return t.filter(e).add(t.find(e))}function m(t){return x.parseHTML(t,document,true)}function T(t,e,r){var a={},n=/<html/i.test(t);var i=e.getResponseHeader("X-PJAX-URL");a.url=i?u(b(i)):r.requestUrl;if(n){var o=x(m(t.match(/<head[^>]*>([\s\S.]*)<\/head>/i)[0]));var s=x(m(t.match(/<body[^>]*>([\s\S.]*)<\/body>/i)[0]))}else{var o=s=x(m(t))}if(s.length===0)return a;a.title=v(o,"title").last().text();if(r.fragment){var c;if(r.fragment==="body"){c=s}else{c=v(s,r.fragment).first()}if(c.length){a.contents=r.fragment==="body"?c:c.contents();if(!a.title)a.title=c.attr("title")||c.data("title")}}else if(!n){a.contents=s}if(a.contents){a.contents=a.contents.not(function(){return x(this).is("title")});a.contents.find("title").remove();if(!r.keepjs||r.keepjs=="false"||r.keepjs=="0"){a.scripts=v(a.contents,"script[src]").remove();a.contents=a.contents.not(a.scripts)}}if(a.title)a.title=String(a.title).trim();return a}function E(t){if(!t)return;var n=x("script[src]");t.each(function(){var t=this.src;var e=n.filter(function(){return this.src===t});if(e.length)return;var r=document.createElement("script");var a=x(this).attr("type");if(a)r.type=a;r.src=x(this).attr("src");document.head.appendChild(r)})}var S={};var k=[];var P=[];function A(t,e){S[t]=e;P.push(t);D(k,0);D(P,g.defaults.maxCacheLength)}function C(t,e,r){var a,n;S[e]=r;if(t==="forward"){a=P;n=k}else{a=k;n=P}a.push(e);if(e=n.pop())delete S[e];D(a,g.defaults.maxCacheLength)}function D(t,e){while(t.length>e)delete S[t.shift()]}function R(){return x("meta").filter(function(){var t=x(this).attr("http-equiv");return t&&t.toUpperCase()==="X-PJAX-VERSION"}).attr("content")}function U(){x.fn.pjax=t;x.pjax=g;x.pjax.enable=x.noop;x.pjax.disable=X;x.pjax.click=i;x.pjax.submit=e;x.pjax.reload=r;x.pjax.defaults={timeout:650,push:true,replace:false,type:"GET",dataType:"html",scrollTo:0,maxCacheLength:20,version:R,keepjs:false};x(window).on("popstate.pjax",s)}function X(){x.fn.pjax=function(){return this};x.pjax=c;x.pjax.enable=U;x.pjax.disable=x.noop;x.pjax.click=x.noop;x.pjax.submit=x.noop;x.pjax.reload=function(){window.location.reload()};x(window).off("popstate.pjax",s)}if(x.inArray("state",x.event.props)<0)x.event.props.push("state");x.support.pjax=window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/);x.support.pjax?U():X()})(jQuery);