(function(){function i(){}function t(n,t){this.path=n;typeof t!="undefined"&&t!==null?(this.at_2x_path=t,this.perform_check=!1):(this.at_2x_path=n.replace(/\.\w+$/,function(n){return"@2x"+n}),this.perform_check=!0)}function r(n){this.el=n;this.path=new t(this.el.getAttribute("src"),this.el.getAttribute("data-at2x"));var i=this;this.path.check_2x_variant(function(n){n&&i.swap()})}var n=typeof exports=="undefined"?window:exports,u={check_mime_type:!0};n.Retina=i;i.configure=function(n){n==null&&(n={});for(var t in n)u[t]=n[t]};i.init=function(t){t==null&&(t=n);var i=t.onload||new Function;t.onload=function(){for(var t=document.getElementsByTagName("img"),f=[],u,n=0;n<t.length;n++)u=t[n],f.push(new r(u));i()}};i.isRetina=function(){return n.devicePixelRatio>1?!0:n.matchMedia&&n.matchMedia("(-webkit-min-device-pixel-ratio: 1.5),                      (min--moz-device-pixel-ratio: 1.5),                      (-o-min-device-pixel-ratio: 3/2),                      (min-resolution: 1.5dppx)").matches?!0:!1};n.RetinaImagePath=t;t.confirmed_paths=[];t.prototype.is_external=function(){return!!(this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain))};t.prototype.check_2x_variant=function(n){var i,r=this;if(this.is_external())return n(!1);if(this.perform_check||typeof this.at_2x_path=="undefined"||this.at_2x_path===null){if(this.at_2x_path in t.confirmed_paths)return n(!0);i=new XMLHttpRequest;i.open("HEAD",this.at_2x_path);i.onreadystatechange=function(){if(i.readyState!=4)return n(!1);if(i.status>=200&&i.status<=399){if(u.check_mime_type){var f=i.getResponseHeader("Content-Type");if(f==null||!f.match(/^image/i))return n(!1)}return t.confirmed_paths.push(r.at_2x_path),n(!0)}return n(!1)};i.send()}else return n(!0)};n.RetinaImage=r;r.prototype.swap=function(n){function i(){t.el.complete?(t.el.setAttribute("width",t.el.offsetWidth),t.el.setAttribute("height",t.el.offsetHeight),t.el.setAttribute("src",n)):setTimeout(i,5)}typeof n=="undefined"&&(n=this.path.at_2x_path);var t=this;i()};i.isRetina()&&i.init(n)})()