text: var __awaiter=this&&this.__awaiter||function(e,t,i,r){function s(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r["throw"](e))}catch(e){n(e)}}function c(e){e.done?i(e.value):s(e.value).then(a,o)}c((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(i)try{if(r=1,s&&(n=a[0]&2?s["return"]:a[0]?s["throw"]||((n=s["return"])&&n.call(s),0):s.next)&&!(n=n.call(s,a[1])).done)return n;if(s=0,n)a=[a[0]&2,n.value];switch(a[0]){case 0:case 1:n=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;s=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(n=i.trys,n=n.length>0&&n[n.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!n||a[1]>n[0]&&a[1]<n[3])){i.label=a[1];break}if(a[0]===6&&i.label<n[1]){i.label=n[1];n=a;break}if(n&&i.label<n[2]){i.label=n[2];i.ops.push(a);break}if(n[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];s=0}finally{r=n=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-68613371.system.js","./p-54d9d7c2.system.js"],(function(e){"use strict";var t,i,r;return{setters:[function(e){t=e.r;i=e.h},function(e){r=e.g}],execute:function(){function s(e,t){t=t.map((function(t){t=Object.assign({},t);return n(e,t)})).sort((function(e,t){if(e.mismatchedPixels>t.mismatchedPixels)return-1;if(e.mismatchedPixels<t.mismatchedPixels)return 1;if(e.desc.toLowerCase()<t.desc.toLowerCase())return-1;if(e.desc.toLowerCase()>t.desc.toLowerCase())return 1;if(e.device.toLowerCase()<t.device.toLowerCase())return-1;if(e.device.toLowerCase()>t.device.toLowerCase())return 1;return 0}));return t}function n(e,t){var i=!e.device||e.device===t.device;var r=!e.search||t.desc.includes(e.search);var s=true;if(e.diff&&e.diff===t.id){s=true}else if(e.mismatch){if(t.mismatchedPixels!=null&&e.mismatch!=="all"){s=parseInt(e.mismatch,10)<t.mismatchedPixels}}else{s=t.mismatchedPixels>0||t.mismatchedPixels==null}t.show=i&&r&&s;return t}function a(){var e={};var t=location.hash.replace("#","");if(t!==""){var i=t.split(";");i.forEach((function(t){var i=t.split("-");if(i.length>1){e[i[0]]=i[1]}else{e[i[0]]=true}}))}return e}function o(e,t){var i=Object.assign({},e,t);var r=Object.keys(i);var s=[];r.map((function(e){var t=i[e];if(t===true){s.push(e)}else if(t!=null&&t!==""){s.push(e+"-"+t)}}));window.location.hash=s.sort().join(";");return i}function c(e,t,i){var s=[];if(!t||!i){return s}i.screenshots.forEach((function(t){var i={id:t.id,desc:t.desc,testPath:t.testPath,imageA:null,imageUrlA:null,imageB:t.image,imageUrlB:""+e+t.image,identical:false,comparable:false,mismatchedPixels:null,width:t.width,height:t.height,deviceScaleFactor:t.deviceScaleFactor,device:t.device||t.userAgent,show:false,hasIntersected:false,threshold:typeof t.threshold==="number"?t.threshold:.05};s.push(i)}));t.screenshots.forEach((function(t){var i=s.find((function(e){return e.id===t.id}));if(i){i.imageA=t.image;i.imageUrlA=""+e+t.image}}));s.forEach((function(e){e.comparable=e.imageA!=null&&e.imageB!=null;e.identical=e.comparable&&e.imageA===e.imageB;if(e.identical){e.mismatchedPixels=0}else{var t=r(e.imageA,e.imageB,e.threshold);if(typeof t==="number"){e.mismatchedPixels=t;if(e.mismatchedPixels===0){e.identical=true}}}}));return s}var f=e("screenshot_compare",function(){function e(e){t(this,e);this.appSrcUrl="";this.imagesUrl="/data/images/";this.buildsUrl="/data/builds/";this.comparesUrl="/data/compares/";this.jsonpUrl=null;this.diffs=[]}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:if(!this.match)return[3,2];if(!(this.match.params.buildIdA&&this.match.params.buildIdB))return[3,2];return[4,this.loadBuilds(this.match.params.buildIdA,this.match.params.buildIdB)];case 1:t.sent();t.label=2;case 2:e=this;return[4,c(this.imagesUrl,this.a,this.b)];case 3:e.diffs=t.sent();this.filter=a();this.updateDiffs();return[2]}}))}))};e.prototype.componentDidLoad=function(){var e=this;if("IntersectionObserver"in window){var t={root:document.querySelector(".scroll-y"),rootMargin:"1200px"};var i=new IntersectionObserver((function(t){var i=false;t.forEach((function(t){if(t.isIntersecting){var r=e.diffs.find((function(e){return t.target.id==="d-"+e.id}));if(r){r.hasIntersected=true;i=true}}}));if(i){if(window.requestIdleCallback){window.requestIdleCallback((function(){e.updateDiffs()}))}else{window.requestAnimationFrame((function(){e.updateDiffs()}))}}}),t);var r=document.querySelectorAll("compare-row");for(var s=0;s<r.length;s++){i.observe(r[s])}}else{this.diffs.forEach((function(e){e.hasIntersected=true}));this.updateDiffs()}if(this.filter&&this.filter.diff){this.navToDiff(this.filter.diff)}};e.prototype.loadBuilds=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,r,s,n,a,o,c;return __generator(this,(function(f){switch(f.label){case 0:i=""+this.buildsUrl+e+".json";if(e==="master"){i+="?ts="+Date.now()}r=""+this.buildsUrl+t+".json";if(t==="master"){r+="?ts="+Date.now()}return[4,Promise.all([fetch(i),fetch(r)])];case 1:s=f.sent();return[4,s[0]];case 2:n=f.sent();return[4,s[1]];case 3:a=f.sent();if(!(n.ok&&a.ok))return[3,6];o=this;return[4,n.json()];case 4:o.a=f.sent();c=this;return[4,a.json()];case 5:c.b=f.sent();f.label=6;case 6:return[2]}}))}))};e.prototype.filterChange=function(e){this.filter=o(this.filter,e.detail);this.updateDiffs()};e.prototype.diffNavChange=function(e){var t=e.detail;this.filter=o(this.filter,{diff:t});this.updateDiffs();this.navToDiff(t)};e.prototype.navToDiff=function(e){var t=document.getElementById("d-"+e);var i=document.querySelector(".scroll-y");if(t&&i){i.scrollTop=t.offsetTop-84}};e.prototype.compareLoaded=function(e){var t=e.detail;var i=this.diffs.find((function(e){return e.id===t.id}));if(i){i.mismatchedPixels=t.mismatchedPixels}this.updateDiffs()};e.prototype.updateDiffs=function(){this.diffs=s(this.filter,this.diffs)};e.prototype.render=function(){var e=this;return[i("compare-header",{diffs:this.diffs,filter:this.filter,appSrcUrl:this.appSrcUrl}),i("section",{class:"scroll-x"},i("compare-thead",{a:this.a,b:this.b,diffs:this.diffs}),i("section",{class:"scroll-y"},i("compare-table",null,i("compare-tbody",null,this.diffs.map((function(t){return i("compare-row",{key:t.id,aId:e.a.id,bId:e.b.id,id:"d-"+t.id,show:t.show,hidden:!t.show,imagesUrl:e.imagesUrl,jsonpUrl:e.jsonpUrl,diff:t})}))))))]};return e}())}}}));