require.def("tabs/pageStats",["domplate/domplate","core/lib","i18n!nls/pageStats","preview/harSchema","preview/harModel","core/cookies","domplate/infoTip","core/trace"],function(Domplate,Lib,Strings,HarSchema,HarModel,Cookies,InfoTip,Trace){with(Domplate){function Pie(){}Pie.prototype={data:[],title:"",getLabelTooltipText:function(a){return a.label+": "+Lib.formatSize(a.value)},cleanUp:function(){for(var a=0;a0?g.timings.ssl:0,timingPie.data[3].value+=g.timings.connect,timingPie.data[4].value+=g.timings.send,timingPie.data[5].value+=g.timings.wait,timingPie.data[6].value+=g.timings.receive,g.timings.ssl>0&&(timingPie.data[3].value-=g.timings.ssl);var h=g.response,i=h.bodySize>0?h.bodySize:0,j=h.content.mimeType,k=j?j.match(/^([^;]+)/)[1]:null,j=k?k:h.content.mimeType;htmlTypes[j]?(contentPie.data[0].value+=i,contentPie.data[0].count++):jsTypes[j]?(contentPie.data[1].value+=i,contentPie.data[1].count++):cssTypes[j]?(contentPie.data[2].value+=i,contentPie.data[2].count++):imageTypes[j]?(contentPie.data[3].value+=i,contentPie.data[3].count++):flashTypes[j]?(contentPie.data[4].value+=i,contentPie.data[4].count++):(contentPie.data[5].value+=i,contentPie.data[5].count++),trafficPie.data[0].value+=g.request.headersSize>0?g.request.headersSize:0,trafficPie.data[1].value+=g.request.bodySize>0?g.request.bodySize:0,trafficPie.data[2].value+=g.response.headersSize>0?g.response.headersSize:0,trafficPie.data[3].value+=i,g.response.status==206?(cachePie.data[1].value+=i,cachePie.data[1].count++):g.response.status==304?(cachePie.data[2].value+=i,cachePie.data[2].count++):i>0&&(cachePie.data[0].value+=i,cachePie.data[0].count++)}}Pie.draw(Lib.$(this.timingPie,"pieGraph"),timingPie),Pie.draw(Lib.$(this.contentPie,"pieGraph"),contentPie),Pie.draw(Lib.$(this.trafficPie,"pieGraph"),trafficPie),Pie.draw(Lib.$(this.cachePie,"pieGraph"),cachePie)}},cleanUp:function(){timingPie.cleanUp(),contentPie.cleanUp(),trafficPie.cleanUp(),cachePie.cleanUp()},showInfoTip:function(a,b,c,d){return Pie.showInfoTip(a,b,c,d)},onSelectionChange:function(a){this.update(a)},show:function(a){if(!this.isVisible()){InfoTip.addListener(this),Lib.setClass(this.element,"opened"),!a||$.browser.msie?this.element.style.display="block":$(this.element).slideDown();var b=this.timeline.getSelection();this.update(b)}},hide:function(a){this.isVisible()&&(InfoTip.removeListener(this),Lib.removeClass(this.element,"opened"),!a||$.browser.msie?this.element.style.display="none":$(this.element).slideUp())},isVisible:function(){return Lib.hasClass(this.element,"opened")},toggle:function(a){this.isVisible()?this.hide(a):this.show(a)},render:function(a){this.element=this.tag.replace({},a),this.timingPie=Pie.render(timingPie,this.element),this.contentPie=Pie.render(contentPie,this.element),this.trafficPie=Pie.render(trafficPie,this.element),this.cachePie=Pie.render(cachePie,this.element),this.cachePie.style.borderRight=0;return this.element}});var Pie=domplate({tag:TABLE({"class":"pagePieTable",cellpadding:0,cellspacing:0,_repObject:"$pie"},TBODY(TR(TD({"class":"pieBox",title:"$pie.title"}),TD(FOR("item","$pie.data",DIV({"class":"pieLabel",_repObject:"$item"},SPAN({"class":"box",style:"background-color: $item.color"}," "),SPAN({"class":"label"},"$item.label"))))))),render:function(a,b){var c=this.tag.append({pie:a},b),d=Lib.$(c,"pieBox"),e=document.createElement("canvas");e.setAttribute("class","pieGraph "),e.setAttribute("height","100"),e.setAttribute("width","100"),d.appendChild(e),typeof G_vmlCanvasManager!="undefined"&&G_vmlCanvasManager.initElement(e);return c},draw:function(a,b){if(a&&a.getContext){var c=a.getContext("2d"),d=Math.min(a.width,a.height)/2,e=[a.width/2,a.height/2];c.clearRect(0,0,a.width,a.height);var f=0,g=b.data,h=0;for(var i in g)h+=g[i].value;if(!h){c.beginPath(),c.moveTo(e[0],e[1]),c.arc(e[0],e[1],d,0,Math.PI*2,!1),c.closePath(),c.fillStyle="rgb(229,236,238)",c.lineStyle="lightgray",c.fill();return}for(var i=0;i