(function(){function c(){}function d(a,b){this.path=a;"undefined"!==typeof b&&null!==b?(this.at_2x_path=b,this.perform_check=!1):(this.at_2x_path=a.replace(/\.\w+$/,function(a){return"@2x"+a}),this.perform_check=!0)}function f(a){this.el=a;this.path=new d(this.el.getAttribute("src"),this.el.getAttribute("data-at2x"));var b=this;this.path.check_2x_variant(function(a){a&&b.swap()})}var e="undefined"==typeof exports?window:exports,g={check_mime_type:!0};e.Retina=c;c.configure=function(a){null==a&&(a=
{});for(var b in a)g[b]=a[b]};c.init=function(a){null==a&&(a=e);var b=a.onload||new Function;a.onload=function(){var a=document.getElementsByTagName("img"),e=[],d,c;for(d=0;d<a.length;d++)c=a[d],e.push(new f(c));b()}};c.isRetina=function(){return 1<e.devicePixelRatio||e.matchMedia&&e.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};e.RetinaImagePath=d;d.confirmed_paths=[];d.prototype.is_external=
    function(){return!(!this.path.match(/^https?\:/i)||this.path.match("//"+document.domain))};d.prototype.check_2x_variant=function(a){var b,e=this;if(this.is_external())return a(!1);if(this.perform_check||"undefined"===typeof this.at_2x_path||null===this.at_2x_path){if(this.at_2x_path in d.confirmed_paths)return a(!0);b=new XMLHttpRequest;b.open("HEAD",this.at_2x_path);b.onreadystatechange=function(){if(4==b.readyState&&200<=b.status&&399>=b.status){if(g.check_mime_type){var c=b.getResponseHeader("Content-Type");
    if(null==c||!c.match(/^image/i))return a(!1)}d.confirmed_paths.push(e.at_2x_path);return a(!0)}return a(!1)};b.send()}else return a(!0)};e.RetinaImage=f;f.prototype.swap=function(a){function b(){c.el.complete?(c.el.setAttribute("width",c.el.offsetWidth),c.el.setAttribute("height",c.el.offsetHeight),c.el.setAttribute("src",a)):setTimeout(b,5)}"undefined"==typeof a&&(a=this.path.at_2x_path);var c=this;b()};c.isRetina()&&c.init(e)})();