$.blue="#2e7bcc";$.green="#3FB618";$.red="#FF0039";$.yellow="#FFA500";$.orange="#FF7518";$.pink="#E671B8";$.purple="#9954BB";$.black="#333333",function(n,t,i){(function(n){typeof define=="function"&&define.amd?define(["jquery"],n):jQuery&&!jQuery.fn.sparkline&&n(jQuery)})(function(r){"use strict";var c={},tt,u,e,s,l,o,v,it,rt,y,pt,ut,ft,et,h,ot,st,a,p,ht,ct,lt,w,b,k,at,vt,yt,d,g,nt,f,wt=0;tt=function(){return{common:{type:"line",lineColor:"#00f",fillColor:"#cdf",defaultPixelsPerValue:3,width:"auto",height:"auto",composite:!1,tagValuesAttribute:"values",tagOptionsPrefix:"spark",enableTagOptions:!1,enableHighlight:!0,highlightLighten:1.4,tooltipSkipNull:!0,tooltipPrefix:"",tooltipSuffix:"",disableHiddenCheck:!1,numberFormatter:!1,numberDigitGroupCount:3,numberDigitGroupSep:",",numberDecimalMark:".",disableTooltips:!1,disableInteraction:!1},line:{spotColor:"#f80",highlightSpotColor:"#5f5",highlightLineColor:"#f22",spotRadius:1.5,minSpotColor:"#f80",maxSpotColor:"#f80",lineWidth:1,normalRangeMin:i,normalRangeMax:i,normalRangeColor:"#ccc",drawNormalOnTop:!1,chartRangeMin:i,chartRangeMax:i,chartRangeMinX:i,chartRangeMaxX:i,tooltipFormat:new e('<span style="color: {{color}}">&#9679;<\/span> {{prefix}}{{y}}{{suffix}}')},bar:{barColor:r.blue,negBarColor:"#f44",stackedBarColor:[r.blue,r.red,r.yellow,r.green,"#66aa00",r.pink,"#0099c6",r.purple],zeroColor:i,nullColor:i,zeroAxis:!0,barWidth:4,barSpacing:1,chartRangeMax:i,chartRangeMin:i,chartRangeClip:!1,colorMap:i,tooltipFormat:new e('<span style="color: {{color}}">&#9679;<\/span> {{prefix}}{{value}}{{suffix}}')},tristate:{barWidth:4,barSpacing:1,posBarColor:"#6f6",negBarColor:"#f44",zeroBarColor:"#999",colorMap:{},tooltipFormat:new e('<span style="color: {{color}}">&#9679;<\/span> {{value:map}}'),tooltipValueLookups:{map:{"-1":"Loss","0":"Draw","1":"Win"}}},discrete:{lineHeight:"auto",thresholdColor:i,thresholdValue:0,chartRangeMax:i,chartRangeMin:i,chartRangeClip:!1,tooltipFormat:new e("{{prefix}}{{value}}{{suffix}}")},bullet:{targetColor:"#f33",targetWidth:3,performanceColor:"#33f",rangeColors:["#d3dafe","#a8b6ff","#7f94ff"],base:i,tooltipFormat:new e("{{fieldkey:fields}} - {{value}}"),tooltipValueLookups:{fields:{r:"Range",p:"Performance",t:"Target"}}},pie:{offset:0,sliceColors:[r.blue,r.red,r.yellow,r.green,"#66aa00",r.pink,"#0099c6",r.purple],borderWidth:0,borderColor:"#000",tooltipFormat:new e('<span style="color: {{color}}">&#9679;<\/span> {{value}} ({{percent.1}}%)')},box:{raw:!1,boxLineColor:"#000",boxFillColor:"#cdf",whiskerColor:"#000",outlierLineColor:"#333",outlierFillColor:"#fff",medianColor:"#f00",showOutliers:!0,outlierIQR:1.5,spotRadius:1.5,target:i,targetColor:"#4a2",chartRangeMax:i,chartRangeMin:i,tooltipFormat:new e("{{field:fields}}: {{value}}"),tooltipFormatFieldlistKey:"field",tooltipValueLookups:{fields:{lq:"Lower Quartile",med:"Median",uq:"Upper Quartile",lo:"Left Outlier",ro:"Right Outlier",lw:"Left Whisker",rw:"Right Whisker"}}}}};at='.jqstooltip { position: absolute;left: 0px;top: 0px;visibility: hidden;background: rgb(0, 0, 0) transparent;background-color: rgba(0,0,0,0.6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";color: white;font: 10px arial, san serif;text-align: left;white-space: nowrap;padding: 5px;border: 1px solid white;z-index: 10000;}.jqsfield { color: white;font: 10px arial, san serif;text-align: left;}';u=function(){var n,t;return n=function(){this.init.apply(this,arguments)},arguments.length>1?(arguments[0]?(n.prototype=r.extend(new arguments[0],arguments[arguments.length-1]),n._super=arguments[0].prototype):n.prototype=arguments[arguments.length-1],arguments.length>2&&(t=Array.prototype.slice.call(arguments,1,-1),t.unshift(n.prototype),r.extend.apply(r,t))):n.prototype=arguments[0],n.prototype.cls=n,n};r.SPFormatClass=e=u({fre:/\{\{([\w.]+?)(:(.+?))?\}\}/g,precre:/(\w+)\.(\d+)/,init:function(n,t){this.format=n;this.fclass=t},render:function(n,t,r){var h=this,c=n,e,o,f,u,s;return this.format.replace(this.fre,function(){var n;return(o=arguments[1],f=arguments[3],e=h.precre.exec(o),e?(s=e[2],o=e[1]):s=!1,u=c[o],u===i)?"":f&&t&&t[f]?(n=t[f],n.get?t[f].get(u)||u:t[f][u]||u):(rt(u)&&(u=r.get("numberFormatter")?r.get("numberFormatter")(u):et(u,s,r.get("numberDigitGroupCount"),r.get("numberDigitGroupSep"),r.get("numberDecimalMark"))),u)})}});r.spformat=function(n,t){return new e(n,t)};s=function(n,t,i){return n<t?t:n>i?i:n};l=function(n,i){var r;return i===2?(r=t.floor(n.length/2),n.length%2?n[r]:(n[r-1]+n[r])/2):n.length%2?(r=(n.length*i+i)/4,r%1?(n[t.floor(r)]+n[t.floor(r)-1])/2:n[r-1]):(r=(n.length*i+2)/4,r%1?(n[t.floor(r)]+n[t.floor(r)-1])/2:n[r-1])};o=function(n){var t;switch(n){case"undefined":n=i;break;case"null":n=null;break;case"true":n=!0;break;case"false":n=!1;break;default:t=parseFloat(n);n==t&&(n=t)}return n};v=function(n){for(var i=[],t=n.length;t--;)i[t]=o(n[t]);return i};it=function(n,t){for(var u=[],i=0,r=n.length;i<r;i++)n[i]!==t&&u.push(n[i]);return u};rt=function(n){return!isNaN(parseFloat(n))&&isFinite(n)};et=function(n,t,i,u,f){var e,o;for(n=(t===!1?parseFloat(n).toString():n.toFixed(t)).split(""),e=(e=r.inArray(".",n))<0?n.length:e,e<n.length&&(n[e]=f),o=e-i;o>0;o-=i)n.splice(o,0,u);return n.join("")};y=function(n,t,i){for(var r=t.length;r--;)if((!i||t[r]!==null)&&t[r]!==n)return!1;return!0};pt=function(n){for(var i=0,t=n.length;t--;)i+=typeof n[t]=="number"?n[t]:0;return i};ft=function(n){return r.isArray(n)?n:[n]};ut=function(t){var i;n.createStyleSheet?n.createStyleSheet().cssText=t:(i=n.createElement("style"),i.type="text/css",n.getElementsByTagName("head")[0].appendChild(i),i[typeof n.body.style.WebkitAppearance=="string"?"innerText":"innerHTML"]=t)};r.fn.simpledraw=function(t,u,f,e){var o,s,h;if(f&&(o=this.data("_jqs_vcanvas")))return o;if(r.fn.sparkline.canvas===!1)return!1;if(r.fn.sparkline.canvas===i)if(h=n.createElement("canvas"),!(h.getContext&&h.getContext("2d")))if(n.namespaces&&!n.namespaces.v)n.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML"),r.fn.sparkline.canvas=function(n,t,i){return new nt(n,t,i)};else return r.fn.sparkline.canvas=!1,!1;else r.fn.sparkline.canvas=function(n,t,i,r){return new g(n,t,i,r)};return t===i&&(t=r(this).innerWidth()),u===i&&(u=r(this).innerHeight()),o=r.fn.sparkline.canvas(t,u,this,e),s=r(this).data("_jqs_mhandler"),s&&s.registerCanvas(o),o};r.fn.cleardraw=function(){var n=this.data("_jqs_vcanvas");n&&n.reset()};r.RangeMapClass=h=u({init:function(n){var i,t,r=[];for(i in n)n.hasOwnProperty(i)&&typeof i=="string"&&i.indexOf(":")>-1&&(t=i.split(":"),t[0]=t[0].length===0?-Infinity:parseFloat(t[0]),t[1]=t[1].length===0?Infinity:parseFloat(t[1]),t[2]=n[i],r.push(t));this.map=n;this.rangelist=r||!1},get:function(n){var r=this.rangelist,u,t,f;if((f=this.map[n])!==i)return f;if(r)for(u=r.length;u--;)if(t=r[u],t[0]<=n&&t[1]>=n)return t[2];return i}});r.range_map=function(n){return new h(n)};ot=u({init:function(n,t){var i=r(n);this.$el=i;this.options=t;this.currentPageX=0;this.currentPageY=0;this.el=n;this.splist=[];this.tooltip=null;this.over=!1;this.displayTooltips=!t.get("disableTooltips");this.highlightEnabled=!t.get("disableHighlight")},registerSparkline:function(n){this.splist.push(n);this.over&&this.updateDisplay()},registerCanvas:function(n){var t=r(n.canvas);this.canvas=n;this.$canvas=t;t.mouseenter(r.proxy(this.mouseenter,this));t.mouseleave(r.proxy(this.mouseleave,this));t.click(r.proxy(this.mouseclick,this))},reset:function(n){this.splist=[];this.tooltip&&n&&(this.tooltip.remove(),this.tooltip=i)},mouseclick:function(n){var t=r.Event("sparklineClick");t.originalEvent=n;t.sparklines=this.splist;this.$el.trigger(t)},mouseenter:function(t){r(n.body).unbind("mousemove.jqs");r(n.body).bind("mousemove.jqs",r.proxy(this.mousemove,this));this.over=!0;this.currentPageX=t.pageX;this.currentPageY=t.pageY;this.currentEl=t.target;!this.tooltip&&this.displayTooltips&&(this.tooltip=new st(this.options),this.tooltip.updatePosition(t.pageX,t.pageY));this.updateDisplay()},mouseleave:function(){r(n.body).unbind("mousemove.jqs");var i=this.splist,e=i.length,u=!1,f,t;for(this.over=!1,this.currentEl=null,this.tooltip&&(this.tooltip.remove(),this.tooltip=null),t=0;t<e;t++)f=i[t],f.clearRegionHighlight()&&(u=!0);u&&this.canvas.render()},mousemove:function(n){this.currentPageX=n.pageX;this.currentPageY=n.pageY;this.currentEl=n.target;this.tooltip&&this.tooltip.updatePosition(n.pageX,n.pageY);this.updateDisplay()},updateDisplay:function(){var i=this.splist,o=i.length,s=!1,h=this.$canvas.offset(),c=this.currentPageX-h.left,l=this.currentPageY-h.top,u,t,n,f,e;if(this.over){for(n=0;n<o;n++)t=i[n],f=t.setRegionHighlight(this.currentEl,c,l),f&&(s=!0);if(s){if(e=r.Event("sparklineRegionChange"),e.sparklines=this.splist,this.$el.trigger(e),this.tooltip){for(u="",n=0;n<o;n++)t=i[n],u+=t.getCurrentRegionTooltip();this.tooltip.setContent(u)}this.disableHighlight||this.canvas.render()}f===null&&this.mouseleave()}}});st=u({sizeStyle:"position: static !important;display: block !important;visibility: hidden !important;float: left !important;",init:function(t){var u=t.get("tooltipClassname","jqstooltip"),f=this.sizeStyle,i;this.container=t.get("tooltipContainer")||n.body;this.tooltipOffsetX=t.get("tooltipOffsetX",10);this.tooltipOffsetY=t.get("tooltipOffsetY",12);r("#jqssizetip").remove();r("#jqstooltip").remove();this.sizetip=r("<div/>",{id:"jqssizetip",style:f,"class":u});this.tooltip=r("<div/>",{id:"jqstooltip","class":u}).appendTo(this.container);i=this.tooltip.offset();this.offsetLeft=i.left;this.offsetTop=i.top;this.hidden=!0;r(window).unbind("resize.jqs scroll.jqs");r(window).bind("resize.jqs scroll.jqs",r.proxy(this.updateWindowDims,this));this.updateWindowDims()},updateWindowDims:function(){this.scrollTop=r(window).scrollTop();this.scrollLeft=r(window).scrollLeft();this.scrollRight=this.scrollLeft+r(window).width();this.updatePosition()},getSize:function(n){this.sizetip.html(n).appendTo(this.container);this.width=this.sizetip.width()+1;this.height=this.sizetip.height();this.sizetip.remove()},setContent:function(n){if(!n){this.tooltip.css("visibility","hidden");this.hidden=!0;return}this.getSize(n);this.tooltip.html(n).css({width:this.width,height:this.height,visibility:"visible"});this.hidden&&(this.hidden=!1,this.updatePosition())},updatePosition:function(n,t){if(n===i){if(this.mousex===i)return;n=this.mousex-this.offsetLeft;t=this.mousey-this.offsetTop}else this.mousex=n=n-this.offsetLeft,this.mousey=t=t-this.offsetTop;this.height&&this.width&&!this.hidden&&(t-=this.height+this.tooltipOffsetY,n+=this.tooltipOffsetX,t<this.scrollTop&&(t=this.scrollTop),n<this.scrollLeft?n=this.scrollLeft:n+this.width>this.scrollRight&&(n=this.scrollRight-this.width),this.tooltip.css({left:n,top:t}))},remove:function(){this.tooltip.remove();this.sizetip.remove();this.sizetip=this.tooltip=i;r(window).unbind("resize.jqs scroll.jqs")}});vt=function(){ut(at)};r(vt);f=[];r.fn.sparkline=function(t,u){return this.each(function(){var e=new r.fn.sparkline.options(this,u),h=r(this),s,o;if(s=function(){var s,a,c,f,u,l,o;if(t==="html"||t===i?(o=this.getAttribute(e.get("tagValuesAttribute")),(o===i||o===null)&&(o=h.html()),s=o.replace(/(^\s*<!--)|(-->\s*$)|\s+/g,"").split(",")):s=t,a=e.get("width")==="auto"?s.length*e.get("defaultPixelsPerValue"):e.get("width"),e.get("height")==="auto"?e.get("composite")&&r.data(this,"_jqs_vcanvas")||(f=n.createElement("span"),f.innerHTML="a",h.html(f),c=r(f).innerHeight()||r(f).height(),r(f).remove(),f=null):c=e.get("height"),e.get("disableInteraction")?u=!1:(u=r.data(this,"_jqs_mhandler"),u?e.get("composite")||u.reset():(u=new ot(this,e),r.data(this,"_jqs_mhandler",u))),e.get("composite")&&!r.data(this,"_jqs_vcanvas")){r.data(this,"_jqs_errnotify")||(alert("Attempted to attach a composite sparkline to an element with no existing sparkline"),r.data(this,"_jqs_errnotify",!0));return}l=new r.fn.sparkline[e.get("type")](this,s,e,a,c);l.render();u&&u.registerSparkline(l)},r(this).html()&&!e.get("disableHiddenCheck")&&r(this).is(":hidden")||!r(this).parents("body").length){if(!e.get("composite")&&r.data(this,"_jqs_pending"))for(o=f.length;o;o--)f[o-1][0]==this&&f.splice(o-1,1);f.push([this,s]);r.data(this,"_jqs_pending",!0)}else s.call(this)})};r.fn.sparkline.defaults=tt();r.sparkline_display_visible=function(){for(var t,i=[],n=0,u=f.length;n<u;n++)t=f[n][0],r(t).is(":visible")&&!r(t).parents().is(":hidden")?(f[n][1].call(t),r.data(f[n][0],"_jqs_pending",!1),i.push(n)):r(t).closest("html").length||r.data(t,"_jqs_pending")||(r.data(f[n][0],"_jqs_pending",!1),i.push(n));for(n=i.length;n;n--)f.splice(i[n-1],1)};r.fn.sparkline.options=u({init:function(n,t){var e,i,u,f;this.userOptions=t=t||{};this.tag=n;this.tagValCache={};i=r.fn.sparkline.defaults;u=i.common;this.tagOptionsPrefix=t.enableTagOptions&&(t.tagOptionsPrefix||u.tagOptionsPrefix);f=this.getTagSetting("type");e=f===c?i[t.type||u.type]:i[f];this.mergedOptions=r.extend({},u,e,t)},getTagSetting:function(n){var u=this.tagOptionsPrefix,t,r,f,e;if(u===!1||u===i)return c;if(this.tagValCache.hasOwnProperty(n))t=this.tagValCache.key;else{if(t=this.tag.getAttribute(u+n),t===i||t===null)t=c;else if(t.substr(0,1)==="[")for(t=t.substr(1,t.length-2).split(","),r=t.length;r--;)t[r]=o(t[r].replace(/(^\s*)|(\s*$)/g,""));else if(t.substr(0,1)==="{")for(f=t.substr(1,t.length-2).split(","),t={},r=f.length;r--;)e=f[r].split(":",2),t[e[0].replace(/(^\s*)|(\s*$)/g,"")]=o(e[1].replace(/(^\s*)|(\s*$)/g,""));else t=o(t);this.tagValCache.key=t}return t},get:function(n,t){var r=this.getTagSetting(n),u;return r!==c?r:(u=this.mergedOptions[n])===i?t:u}});r.fn.sparkline._base=u({disabled:!1,init:function(n,t,u,f,e){this.el=n;this.$el=r(n);this.values=t;this.options=u;this.width=f;this.height=e;this.currentRegion=i},initTarget:function(){var n=!this.options.get("disableInteraction");(this.target=this.$el.simpledraw(this.width,this.height,this.options.get("composite"),n))?(this.canvasWidth=this.target.pixelWidth,this.canvasHeight=this.target.pixelHeight):this.disabled=!0},render:function(){return this.disabled?(this.el.innerHTML="",!1):!0},getRegion:function(){},setRegionHighlight:function(n,t,r){var f=this.currentRegion,e=!this.options.get("disableHighlight"),u;return t>this.canvasWidth||r>this.canvasHeight||t<0||r<0?null:(u=this.getRegion(n,t,r),f!==u)?(f!==i&&e&&this.removeHighlight(),this.currentRegion=u,u!==i&&e&&this.renderHighlight(),!0):!1},clearRegionHighlight:function(){return this.currentRegion!==i?(this.removeHighlight(),this.currentRegion=i,!0):!1},renderHighlight:function(){this.changeHighlight(!0)},removeHighlight:function(){this.changeHighlight(!1)},changeHighlight:function(){},getCurrentRegionTooltip:function(){var t=this.options,y="",h=[],n,o,p,w,b,u,c,l,a,k,v,s,d,f;if(this.currentRegion===i)return"";if(n=this.getCurrentRegionFields(),v=t.get("tooltipFormatter"),v)return v(this,t,n);if(t.get("tooltipChartTitle")&&(y+='<div class="jqs jqstitle">'+t.get("tooltipChartTitle")+"<\/div>\n"),o=this.options.get("tooltipFormat"),!o)return"";if(r.isArray(o)||(o=[o]),r.isArray(n)||(n=[n]),c=this.options.get("tooltipFormatFieldlist"),l=this.options.get("tooltipFormatFieldlistKey"),c&&l){for(a=[],u=n.length;u--;)k=n[u][l],(f=r.inArray(k,c))!=-1&&(a[f]=n[u]);n=a}for(p=o.length,d=n.length,u=0;u<p;u++)for(s=o[u],typeof s=="string"&&(s=new e(s)),w=s.fclass||"jqsfield",f=0;f<d;f++)n[f].isNull&&t.get("tooltipSkipNull")||(r.extend(n[f],{prefix:t.get("tooltipPrefix"),suffix:t.get("tooltipSuffix")}),b=s.render(n[f],t.get("tooltipValueLookups"),t),h.push('<div class="'+w+'">'+b+"<\/div>"));return h.length?y+h.join("\n"):""},getCurrentRegionFields:function(){},calcHighlightColor:function(n,i){var e=i.get("highlightColor"),o=i.get("highlightLighten"),u,h,f,r;if(e)return e;if(o&&(u=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(n)||/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(n),u)){for(f=[],h=n.length===4?16:1,r=0;r<3;r++)f[r]=s(t.round(parseInt(u[r+1],16)*h*o),0,255);return"rgb("+f.join(",")+")"}return n}});a={changeHighlight:function(n){var i=this.currentRegion,f=this.target,u=this.regionShapes[i],t;u&&(t=this.renderRegion(i,n),r.isArray(t)||r.isArray(u)?(f.replaceWithShapes(u,t),this.regionShapes[i]=r.map(t,function(n){return n.id})):(f.replaceWithShape(u,t),this.regionShapes[i]=t.id))},render:function(){var e=this.values,o=this.target,u=this.regionShapes,n,f,t,i;if(this.cls._super.render.call(this)){for(t=e.length;t--;)if(n=this.renderRegion(t),n)if(r.isArray(n)){for(f=[],i=n.length;i--;)n[i].append(),f.push(n[i].id);u[t]=f}else n.append(),u[t]=n.id;else u[t]=null;o.render()}}};r.fn.sparkline.line=p=u(r.fn.sparkline._base,{type:"line",init:function(n,t,i,r,u){p._super.init.call(this,n,t,i,r,u);this.vertices=[];this.regionMap=[];this.xvalues=[];this.yvalues=[];this.yminmax=[];this.hightlightSpotId=null;this.lastShapeId=null;this.initTarget()},getRegion:function(n,t){for(var u=this.regionMap,r=u.length;r--;)if(u[r]!==null&&t>=u[r][0]&&t<=u[r][1])return u[r][2];return i},getCurrentRegionFields:function(){var n=this.currentRegion;return{isNull:this.yvalues[n]===null,x:this.xvalues[n],y:this.yvalues[n],color:this.options.get("lineColor"),fillColor:this.options.get("fillColor"),offset:n}},renderHighlight:function(){var h=this.currentRegion,t=this.target,n=this.vertices[h],r=this.options,e=r.get("spotRadius"),o=r.get("highlightSpotColor"),s=r.get("highlightLineColor"),u,f;n&&(e&&o&&(u=t.drawCircle(n[0],n[1],e,i,o),this.highlightSpotId=u.id,t.insertAfterShape(this.lastShapeId,u)),s&&(f=t.drawLine(n[0],this.canvasTop,n[0],this.canvasTop+this.canvasHeight,s),this.highlightLineId=f.id,t.insertAfterShape(this.lastShapeId,f)))},removeHighlight:function(){var n=this.target;this.highlightSpotId&&(n.removeShapeId(this.highlightSpotId),this.highlightSpotId=null);this.highlightLineId&&(n.removeShapeId(this.highlightLineId),this.highlightLineId=null)},scanValues:function(){for(var i=this.values,c=i.length,r=this.xvalues,e=this.yvalues,u=this.yminmax,f,s,h,o,n=0;n<c;n++)f=i[n],s=typeof i[n]=="string",h=typeof i[n]=="object"&&i[n]instanceof Array,o=s&&i[n].split(":"),s&&o.length===2?(r.push(Number(o[0])),e.push(Number(o[1])),u.push(Number(o[1]))):h?(r.push(f[0]),e.push(f[1]),u.push(f[1])):(r.push(n),i[n]===null||i[n]==="null"?e.push(null):(e.push(Number(f)),u.push(Number(f))));this.options.get("xvalues")&&(r=this.options.get("xvalues"));this.maxy=this.maxyorg=t.max.apply(t,u);this.miny=this.minyorg=t.min.apply(t,u);this.maxx=t.max.apply(t,r);this.minx=t.min.apply(t,r);this.xvalues=r;this.yvalues=e;this.yminmax=u},processRangeOptions:function(){var n=this.options,t=n.get("normalRangeMin"),r=n.get("normalRangeMax");t!==i&&(t<this.miny&&(this.miny=t),r>this.maxy&&(this.maxy=r));n.get("chartRangeMin")!==i&&(n.get("chartRangeClip")||n.get("chartRangeMin")<this.miny)&&(this.miny=n.get("chartRangeMin"));n.get("chartRangeMax")!==i&&(n.get("chartRangeClip")||n.get("chartRangeMax")>this.maxy)&&(this.maxy=n.get("chartRangeMax"));n.get("chartRangeMinX")!==i&&(n.get("chartRangeClipX")||n.get("chartRangeMinX")<this.minx)&&(this.minx=n.get("chartRangeMinX"));n.get("chartRangeMaxX")!==i&&(n.get("chartRangeClipX")||n.get("chartRangeMaxX")>this.maxx)&&(this.maxx=n.get("chartRangeMaxX"))},drawNormalRange:function(n,r,u,f,e){var s=this.options.get("normalRangeMin"),o=this.options.get("normalRangeMax"),h=r+t.round(u-u*((o-this.miny)/e)),c=t.round(u*(o-s)/e);this.target.drawRect(n,h,f,c,i,this.options.get("normalRangeColor")).append()},render:function(){var n=this.options,v=this.target,c=this.canvasWidth,o=this.canvasHeight,at=this.vertices,f=n.get("spotRadius"),pt=this.regionMap,b,y,k,l,a,ht,e,ut,g,d,vt,tt,yt,ct,ft,et,ot,st,nt,it,rt,lt,w,s,u;if(p._super.render.call(this)&&(this.scanValues(),this.processRangeOptions(),w=this.xvalues,s=this.yvalues,this.yminmax.length&&!(this.yvalues.length<2))){for(l=a=0,b=this.maxx-this.minx==0?1:this.maxx-this.minx,y=this.maxy-this.miny==0?1:this.maxy-this.miny,k=this.yvalues.length-1,f&&(c<f*4||o<f*4)&&(f=0),f&&(rt=n.get("highlightSpotColor")&&!n.get("disableInteraction"),(rt||n.get("minSpotColor")||n.get("spotColor")&&s[k]===this.miny)&&(o-=t.ceil(f)),(rt||n.get("maxSpotColor")||n.get("spotColor")&&s[k]===this.maxy)&&(o-=t.ceil(f),l+=t.ceil(f)),(rt||(n.get("minSpotColor")||n.get("maxSpotColor"))&&(s[0]===this.miny||s[0]===this.maxy))&&(a+=t.ceil(f),c-=t.ceil(f)),(rt||n.get("spotColor")||n.get("minSpotColor")||n.get("maxSpotColor")&&(s[k]===this.miny||s[k]===this.maxy))&&(c-=t.ceil(f))),o--,n.get("normalRangeMin")===i||n.get("drawNormalOnTop")||this.drawNormalRange(a,l,o,c,y),e=[],ut=[e],ct=ft=null,et=s.length,u=0;u<et;u++)g=w[u],vt=w[u+1],d=s[u],tt=a+t.round((g-this.minx)*(c/b)),yt=u<et-1?a+t.round((vt-this.minx)*(c/b)):c,ft=tt+(yt-tt)/2,pt[u]=[ct||0,ft,u],ct=ft,d===null?u&&(s[u-1]!==null&&(e=[],ut.push(e)),at.push(null)):(d<this.miny&&(d=this.miny),d>this.maxy&&(d=this.maxy),e.length||e.push([tt,l+o]),ht=[tt,l+t.round(o-o*((d-this.miny)/y))],e.push(ht),at.push(ht));for(ot=[],st=[],nt=ut.length,u=0;u<nt;u++)e=ut[u],e.length&&(n.get("fillColor")&&(e.push([e[e.length-1][0],l+o]),st.push(e.slice(0)),e.pop()),e.length>2&&(e[0]=[e[0][0],e[1][1]]),ot.push(e));for(nt=st.length,u=0;u<nt;u++)v.drawShape(st[u],n.get("fillColor"),n.get("fillColor")).append();for(n.get("normalRangeMin")!==i&&n.get("drawNormalOnTop")&&this.drawNormalRange(a,l,o,c,y),nt=ot.length,u=0;u<nt;u++)v.drawShape(ot[u],n.get("lineColor"),i,n.get("lineWidth")).append();if(f&&n.get("valueSpots"))for(it=n.get("valueSpots"),it.get===i&&(it=new h(it)),u=0;u<et;u++)lt=it.get(s[u]),lt&&v.drawCircle(a+t.round((w[u]-this.minx)*(c/b)),l+t.round(o-o*((s[u]-this.miny)/y)),f,i,lt).append();f&&n.get("spotColor")&&s[k]!==null&&v.drawCircle(a+t.round((w[w.length-1]-this.minx)*(c/b)),l+t.round(o-o*((s[k]-this.miny)/y)),f,i,n.get("spotColor")).append();this.maxy!==this.minyorg&&(f&&n.get("minSpotColor")&&(g=w[r.inArray(this.minyorg,s)],v.drawCircle(a+t.round((g-this.minx)*(c/b)),l+t.round(o-o*((this.minyorg-this.miny)/y)),f,i,n.get("minSpotColor")).append()),f&&n.get("maxSpotColor")&&(g=w[r.inArray(this.maxyorg,s)],v.drawCircle(a+t.round((g-this.minx)*(c/b)),l+t.round(o-o*((this.maxyorg-this.miny)/y)),f,i,n.get("maxSpotColor")).append()));this.lastShapeId=v.getLastShapeId();this.canvasTop=l;v.render()}}});r.fn.sparkline.bar=ht=u(r.fn.sparkline._base,a,{type:"bar",init:function(n,u,f,e,c){var ct=parseInt(f.get("barWidth"),10),lt=parseInt(f.get("barSpacing"),10),dt=f.get("chartRangeMin"),gt=f.get("chartRangeMax"),at=f.get("chartRangeClip"),nt=Infinity,d=-Infinity,vt,yt,pt,tt,b,a,rt,wt,ut,ft,y,p,bt,kt,w,et,g,ni,ti,l,k,ii,ot,st;for(ht._super.init.call(this,n,u,f,e,c),a=0,rt=u.length;a<rt;a++)l=u[a],vt=typeof l=="string"&&l.indexOf(":")>-1,(vt||r.isArray(l))&&(w=!0,vt&&(l=u[a]=v(l.split(":"))),l=it(l,null),yt=t.min.apply(t,l),pt=t.max.apply(t,l),yt<nt&&(nt=yt),pt>d&&(d=pt));for(this.stacked=w,this.regionShapes={},this.barWidth=ct,this.barSpacing=lt,this.totalBarWidth=ct+lt,this.width=e=u.length*ct+(u.length-1)*lt,this.initTarget(),at&&(bt=dt===i?-Infinity:dt,kt=gt===i?Infinity:gt),b=[],tt=w?[]:b,ot=[],st=[],a=0,rt=u.length;a<rt;a++)if(w)for(et=u[a],u[a]=ti=[],ot[a]=0,tt[a]=st[a]=0,g=0,ni=et.length;g<ni;g++)l=ti[g]=at?s(et[g],bt,kt):et[g],l!==null&&(l>0&&(ot[a]+=l),nt<0&&d>0?l<0?st[a]+=t.abs(l):tt[a]+=l:tt[a]+=t.abs(l-(l<0?d:nt)),b.push(l));else l=at?s(u[a],bt,kt):u[a],l=u[a]=o(l),l!==null&&b.push(l);this.max=p=t.max.apply(t,b);this.min=y=t.min.apply(t,b);this.stackMax=d=w?t.max.apply(t,ot):p;this.stackMin=nt=w?t.min.apply(t,b):y;f.get("chartRangeMin")!==i&&(f.get("chartRangeClip")||f.get("chartRangeMin")<y)&&(y=f.get("chartRangeMin"));f.get("chartRangeMax")!==i&&(f.get("chartRangeClip")||f.get("chartRangeMax")>p)&&(p=f.get("chartRangeMax"));this.zeroAxis=ut=f.get("zeroAxis",!0);ft=y<=0&&p>=0&&ut?0:ut==!1?y:y>0?y:p;this.xaxisOffset=ft;wt=w?t.max.apply(t,tt)+t.max.apply(t,st):p-y;this.canvasHeightEf=ut&&y<0?this.canvasHeight-2:this.canvasHeight-1;y<ft?(ii=w&&p>=0?d:p,k=(ii-ft)/wt*this.canvasHeight,k!==t.ceil(k)&&(this.canvasHeightEf-=2,k=t.ceil(k))):k=this.canvasHeight;this.yoffset=k;r.isArray(f.get("colorMap"))?(this.colorMapByIndex=f.get("colorMap"),this.colorMapByValue=null):(this.colorMapByIndex=null,this.colorMapByValue=f.get("colorMap"),this.colorMapByValue&&this.colorMapByValue.get===i&&(this.colorMapByValue=new h(this.colorMapByValue)));this.range=wt},getRegion:function(n,r){var u=t.floor(r/this.totalBarWidth);return u<0||u>=this.values.length?i:u},getCurrentRegionFields:function(){for(var i=this.currentRegion,r=ft(this.values[i]),u=[],n,t=r.length;t--;)n=r[t],u.push({isNull:n===null,value:n,color:this.calcColor(t,n,i),offset:i});return u},calcColor:function(n,t,u){var o=this.colorMapByIndex,s=this.colorMapByValue,e=this.options,f,h;return f=this.stacked?e.get("stackedBarColor"):t<0?e.get("negBarColor"):e.get("barColor"),t===0&&e.get("zeroColor")!==i&&(f=e.get("zeroColor")),s&&(h=s.get(t))?f=h:o&&o.length>u&&(f=o[u]),r.isArray(f)?f[n%f.length]:f},renderRegion:function(n,u){var f=this.values[n],h=this.options,c=this.xaxisOffset,p=[],b=this.range,rt=this.stacked,k=this.target,d=n*this.totalBarWidth,ut=this.canvasHeightEf,o=this.yoffset,l,a,e,g,w,v,nt,s,tt,it;if(f=r.isArray(f)?f:[f],nt=f.length,s=f[0],g=y(null,f),it=y(c,f,!0),g)return h.get("nullColor")?(e=u?h.get("nullColor"):this.calcHighlightColor(h.get("nullColor"),h),l=o>0?o-1:o,k.drawRect(d,l,this.barWidth-1,0,e,e)):i;for(w=o,v=0;v<nt;v++){if(s=f[v],rt&&s===c){if(!it||tt)continue;tt=!0}a=b>0?t.floor(ut*(t.abs(s-c)/b))+1:1;s<c||s===c&&o===0?(l=w,w+=a):(l=o-a,o-=a);e=this.calcColor(v,s,n);u&&(e=this.calcHighlightColor(e,h));p.push(k.drawRect(d,l,this.barWidth-1,a-1,e,e))}return p.length===1?p[0]:p}});r.fn.sparkline.tristate=ct=u(r.fn.sparkline._base,a,{type:"tristate",init:function(n,t,u,f,e){var o=parseInt(u.get("barWidth"),10),s=parseInt(u.get("barSpacing"),10);ct._super.init.call(this,n,t,u,f,e);this.regionShapes={};this.barWidth=o;this.barSpacing=s;this.totalBarWidth=o+s;this.values=r.map(t,Number);this.width=f=t.length*o+(t.length-1)*s;r.isArray(u.get("colorMap"))?(this.colorMapByIndex=u.get("colorMap"),this.colorMapByValue=null):(this.colorMapByIndex=null,this.colorMapByValue=u.get("colorMap"),this.colorMapByValue&&this.colorMapByValue.get===i&&(this.colorMapByValue=new h(this.colorMapByValue)));this.initTarget()},getRegion:function(n,i){return t.floor(i/this.totalBarWidth)},getCurrentRegionFields:function(){var n=this.currentRegion;return{isNull:this.values[n]===i,value:this.values[n],color:this.calcColor(this.values[n],n),offset:n}},calcColor:function(n,t){var u=this.values,i=this.options,r=this.colorMapByIndex,f=this.colorMapByValue,e;return f&&(e=f.get(n))?e:r&&r.length>t?r[t]:u[t]<0?i.get("negBarColor"):u[t]>0?i.get("posBarColor"):i.get("zeroBarColor")},renderRegion:function(n,i){var o=this.values,l=this.options,s=this.target,h,f,u,c,e,r;if(h=s.pixelHeight,u=t.round(h/2),c=n*this.totalBarWidth,o[n]<0?(e=u,f=u-1):o[n]>0?(e=0,f=u-1):(e=u-1,f=2),r=this.calcColor(o[n],n),r!==null)return i&&(r=this.calcHighlightColor(r,l)),s.drawRect(c,e,this.barWidth-1,f-1,r,r)}});r.fn.sparkline.discrete=lt=u(r.fn.sparkline._base,a,{type:"discrete",init:function(n,u,f,e,o){lt._super.init.call(this,n,u,f,e,o);this.regionShapes={};this.values=u=r.map(u,Number);this.min=t.min.apply(t,u);this.max=t.max.apply(t,u);this.range=this.max-this.min;this.width=e=f.get("width")==="auto"?u.length*2:this.width;this.interval=t.floor(e/u.length);this.itemWidth=e/u.length;f.get("chartRangeMin")!==i&&(f.get("chartRangeClip")||f.get("chartRangeMin")<this.min)&&(this.min=f.get("chartRangeMin"));f.get("chartRangeMax")!==i&&(f.get("chartRangeClip")||f.get("chartRangeMax")>this.max)&&(this.max=f.get("chartRangeMax"));this.initTarget();this.target&&(this.lineHeight=f.get("lineHeight")==="auto"?t.round(this.canvasHeight*.3):f.get("lineHeight"))},getRegion:function(n,i){return t.floor(i/this.itemWidth)},getCurrentRegionFields:function(){var n=this.currentRegion;return{isNull:this.values[n]===i,value:this.values[n],offset:n}},renderRegion:function(n,i){var a=this.values,r=this.options,h=this.min,v=this.max,y=this.range,p=this.interval,w=this.target,b=this.canvasHeight,c=this.lineHeight,l=b-c,f,e,u,o;return e=s(a[n],h,v),o=n*p,f=t.round(l-l*((e-h)/y)),u=r.get("thresholdColor")&&e<r.get("thresholdValue")?r.get("thresholdColor"):r.get("lineColor"),i&&(u=this.calcHighlightColor(u,r)),w.drawLine(o,f,o,f+c,u)}});r.fn.sparkline.bullet=w=u(r.fn.sparkline._base,{type:"bullet",init:function(n,r,u,f,e){var s,h,o;w._super.init.call(this,n,r,u,f,e);this.values=r=v(r);o=r.slice();o[0]=o[0]===null?o[2]:o[0];o[1]=r[1]===null?o[2]:o[1];s=t.min.apply(t,r);h=t.max.apply(t,r);s=u.get("base")===i?s<0?s:0:u.get("base");this.min=s;this.max=h;this.range=h-s;this.shapes={};this.valueShapes={};this.regiondata={};this.width=f=u.get("width")==="auto"?"4.0em":f;this.target=this.$el.simpledraw(f,e,u.get("composite"));r.length||(this.disabled=!0);this.initTarget()},getRegion:function(n,t,r){var u=this.target.getShapeAt(n,t,r);return u!==i&&this.shapes[u]!==i?this.shapes[u]:i},getCurrentRegionFields:function(){var n=this.currentRegion;return{fieldkey:n.substr(0,1),value:this.values[n.substr(1)],region:n}},changeHighlight:function(n){var i=this.currentRegion,r=this.valueShapes[i],t;delete this.shapes[r];switch(i.substr(0,1)){case"r":t=this.renderRange(i.substr(1),n);break;case"p":t=this.renderPerformance(n);break;case"t":t=this.renderTarget(n)}this.valueShapes[i]=t.id;this.shapes[t.id]=i;this.target.replaceWithShape(r,t)},renderRange:function(n,i){var u=this.values[n],f=t.round(this.canvasWidth*((u-this.min)/this.range)),r=this.options.get("rangeColors")[n-2];return i&&(r=this.calcHighlightColor(r,this.options)),this.target.drawRect(0,0,f-1,this.canvasHeight-1,r,r)},renderPerformance:function(n){var r=this.values[1],u=t.round(this.canvasWidth*((r-this.min)/this.range)),i=this.options.get("performanceColor");return n&&(i=this.calcHighlightColor(i,this.options)),this.target.drawRect(0,t.round(this.canvasHeight*.3),u-1,t.round(this.canvasHeight*.4)-1,i,i)},renderTarget:function(n){var u=this.values[0],f=t.round(this.canvasWidth*((u-this.min)/this.range)-this.options.get("targetWidth")/2),r=t.round(this.canvasHeight*.1),e=this.canvasHeight-r*2,i=this.options.get("targetColor");return n&&(i=this.calcHighlightColor(i,this.options)),this.target.drawRect(f,r,this.options.get("targetWidth")-1,e-1,i,i)},render:function(){var i=this.values.length,r=this.target,t,n;if(w._super.render.call(this)){for(t=2;t<i;t++)n=this.renderRange(t).append(),this.shapes[n.id]="r"+t,this.valueShapes["r"+t]=n.id;this.values[1]!==null&&(n=this.renderPerformance().append(),this.shapes[n.id]="p1",this.valueShapes.p1=n.id);this.values[0]!==null&&(n=this.renderTarget().append(),this.shapes[n.id]="t0",this.valueShapes.t0=n.id);r.render()}}});r.fn.sparkline.pie=b=u(r.fn.sparkline._base,{type:"pie",init:function(n,i,u,f,e){var s=0,o;if(b._super.init.call(this,n,i,u,f,e),this.shapes={},this.valueShapes={},this.values=i=r.map(i,Number),u.get("width")==="auto"&&(this.width=this.height),i.length>0)for(o=i.length;o--;)s+=i[o];this.total=s;this.initTarget();this.radius=t.floor(t.min(this.canvasWidth,this.canvasHeight)/2)},getRegion:function(n,t,r){var u=this.target.getShapeAt(n,t,r);return u!==i&&this.shapes[u]!==i?this.shapes[u]:i},getCurrentRegionFields:function(){var n=this.currentRegion;return{isNull:this.values[n]===i,value:this.values[n],percent:this.values[n]/this.total*100,color:this.options.get("sliceColors")[n%this.options.get("sliceColors").length],offset:n}},changeHighlight:function(n){var t=this.currentRegion,i=this.renderSlice(t,n),r=this.valueShapes[t];delete this.shapes[r];this.target.replaceWithShape(r,i);this.valueShapes[t]=i.id;this.shapes[i.id]=t},renderSlice:function(n,r){for(var p=this.target,f=this.options,h=this.radius,w=f.get("borderWidth"),c=f.get("offset"),b=2*t.PI,l=this.values,a=this.total,e=c?2*t.PI*(c/360):0,v,o,s,y=l.length,u=0;u<y;u++){if(v=e,o=e,a>0&&(o=e+b*(l[u]/a)),n===u)return s=f.get("sliceColors")[u%f.get("sliceColors").length],r&&(s=this.calcHighlightColor(s,f)),p.drawPieSlice(h,h,h-w,v,o,i,s);e=o}},render:function(){var e=this.target,o=this.values,s=this.options,r=this.radius,u=s.get("borderWidth"),f,n;if(b._super.render.call(this)){for(u&&e.drawCircle(r,r,t.floor(r-u/2),s.get("borderColor"),i,u).append(),n=o.length;n--;)o[n]&&(f=this.renderSlice(n).append(),this.valueShapes[n]=f.id,this.shapes[f.id]=n);e.render()}}});r.fn.sparkline.box=k=u(r.fn.sparkline._base,{type:"box",init:function(n,t,i,u,f){k._super.init.call(this,n,t,i,u,f);this.values=r.map(t,Number);this.width=i.get("width")==="auto"?"4.0em":u;this.initTarget();this.values.length||(this.disabled=1)},getRegion:function(){return 1},getCurrentRegionFields:function(){var n=[{field:"lq",value:this.quartiles[0]},{field:"med",value:this.quartiles[1]},{field:"uq",value:this.quartiles[2]}];return this.loutlier!==i&&n.push({field:"lo",value:this.loutlier}),this.routlier!==i&&n.push({field:"ro",value:this.routlier}),this.lwhisker!==i&&n.push({field:"lw",value:this.lwhisker}),this.rwhisker!==i&&n.push({field:"rw",value:this.rwhisker}),n},render:function(){var s=this.target,r=this.values,g=r.length,n=this.options,nt=this.canvasWidth,u=this.canvasHeight,e=n.get("chartRangeMin")===i?t.min.apply(t,r):n.get("chartRangeMin"),it=n.get("chartRangeMax")===i?t.max.apply(t,r):n.get("chartRangeMax"),o=0,h,w,tt,a,p,v,c,b,y,d,f;if(k._super.render.call(this)){if(n.get("raw"))n.get("showOutliers")&&r.length>5?(w=r[0],h=r[1],a=r[2],p=r[3],v=r[4],c=r[5],b=r[6]):(h=r[0],a=r[1],p=r[2],v=r[3],c=r[4]);else if(r.sort(function(n,t){return n-t}),a=l(r,1),p=l(r,2),v=l(r,3),tt=v-a,n.get("showOutliers")){for(h=c=i,y=0;y<g;y++)h===i&&r[y]>a-tt*n.get("outlierIQR")&&(h=r[y]),r[y]<v+tt*n.get("outlierIQR")&&(c=r[y]);w=r[0];b=r[g-1]}else h=r[0],c=r[g-1];this.quartiles=[a,p,v];this.lwhisker=h;this.rwhisker=c;this.loutlier=w;this.routlier=b;f=nt/(it-e+1);n.get("showOutliers")&&(o=t.ceil(n.get("spotRadius")),nt-=2*t.ceil(n.get("spotRadius")),f=nt/(it-e+1),w<h&&s.drawCircle((w-e)*f+o,u/2,n.get("spotRadius"),n.get("outlierLineColor"),n.get("outlierFillColor")).append(),b>c&&s.drawCircle((b-e)*f+o,u/2,n.get("spotRadius"),n.get("outlierLineColor"),n.get("outlierFillColor")).append());s.drawRect(t.round((a-e)*f+o),t.round(u*.1),t.round((v-a)*f),t.round(u*.8),n.get("boxLineColor"),n.get("boxFillColor")).append();s.drawLine(t.round((h-e)*f+o),t.round(u/2),t.round((a-e)*f+o),t.round(u/2),n.get("lineColor")).append();s.drawLine(t.round((h-e)*f+o),t.round(u/4),t.round((h-e)*f+o),t.round(u-u/4),n.get("whiskerColor")).append();s.drawLine(t.round((c-e)*f+o),t.round(u/2),t.round((v-e)*f+o),t.round(u/2),n.get("lineColor")).append();s.drawLine(t.round((c-e)*f+o),t.round(u/4),t.round((c-e)*f+o),t.round(u-u/4),n.get("whiskerColor")).append();s.drawLine(t.round((p-e)*f+o),t.round(u*.1),t.round((p-e)*f+o),t.round(u*.9),n.get("medianColor")).append();n.get("target")&&(d=t.ceil(n.get("spotRadius")),s.drawLine(t.round((n.get("target")-e)*f+o),t.round(u/2-d),t.round((n.get("target")-e)*f+o),t.round(u/2+d),n.get("targetColor")).append(),s.drawLine(t.round((n.get("target")-e)*f+o-d),t.round(u/2),t.round((n.get("target")-e)*f+o+d),t.round(u/2),n.get("targetColor")).append());s.render()}}});yt=u({init:function(n,t,i,r){this.target=n;this.id=t;this.type=i;this.args=r},append:function(){return this.target.appendShape(this),this}});d=u({_pxregex:/(\d+)(px)?\s*$/i,init:function(n,t,i){n&&(this.width=n,this.height=t,this.target=i,this.lastShapeId=null,i[0]&&(i=i[0]),r.data(i,"_jqs_vcanvas",this))},drawLine:function(n,t,i,r,u,f){return this.drawShape([[n,t],[i,r]],u,f)},drawShape:function(n,t,i,r){return this._genShape("Shape",[n,t,i,r])},drawCircle:function(n,t,i,r,u,f){return this._genShape("Circle",[n,t,i,r,u,f])},drawPieSlice:function(n,t,i,r,u,f,e){return this._genShape("PieSlice",[n,t,i,r,u,f,e])},drawRect:function(n,t,i,r,u,f){return this._genShape("Rect",[n,t,i,r,u,f])},getElement:function(){return this.canvas},getLastShapeId:function(){return this.lastShapeId},reset:function(){alert("reset not implemented")},_insert:function(n,t){r(t).html(n)},_calculatePixelDims:function(n,t,i){var u;u=this._pxregex.exec(t);this.pixelHeight=u?u[1]:r(i).height();u=this._pxregex.exec(n);this.pixelWidth=u?u[1]:r(i).width()},_genShape:function(n,t){var i=wt++;return t.unshift(i),new yt(this,i,n,t)},appendShape:function(){alert("appendShape not implemented")},replaceWithShape:function(){alert("replaceWithShape not implemented")},insertAfterShape:function(){alert("insertAfterShape not implemented")},removeShapeId:function(){alert("removeShapeId not implemented")},getShapeAt:function(){alert("getShapeAt not implemented")},render:function(){alert("render not implemented")}});g=u(d,{init:function(t,u,f,e){g._super.init.call(this,t,u,f);this.canvas=n.createElement("canvas");f[0]&&(f=f[0]);r.data(f,"_jqs_vcanvas",this);r(this.canvas).css({display:"inline-block",width:t,height:u,verticalAlign:"top"});this._insert(this.canvas,f);this._calculatePixelDims(t,u,this.canvas);this.canvas.width=this.pixelWidth;this.canvas.height=this.pixelHeight;this.interact=e;this.shapes={};this.shapeseq=[];this.currentTargetShapeId=i;r(this.canvas).css({width:this.pixelWidth,height:this.pixelHeight})},_getContext:function(n,t,r){var u=this.canvas.getContext("2d");return n!==i&&(u.strokeStyle=n),u.lineWidth=r===i?1:r,t!==i&&(u.fillStyle=t),u},reset:function(){var n=this._getContext();n.clearRect(0,0,this.pixelWidth,this.pixelHeight);this.shapes={};this.shapeseq=[];this.currentTargetShapeId=i},_drawShape:function(n,t,r,u,f){var e=this._getContext(r,u,f),o,s;for(e.beginPath(),e.moveTo(t[0][0]+.5,t[0][1]+.5),o=1,s=t.length;o<s;o++)e.lineTo(t[o][0]+.5,t[o][1]+.5);r!==i&&e.stroke();u!==i&&e.fill();this.targetX!==i&&this.targetY!==i&&e.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=n)},_drawCircle:function(n,r,u,f,e,o,s){var h=this._getContext(e,o,s);h.beginPath();h.arc(r,u,f,0,2*t.PI,!1);this.targetX!==i&&this.targetY!==i&&h.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=n);e!==i&&h.stroke();o!==i&&h.fill()},_drawPieSlice:function(n,t,r,u,f,e,o,s){var h=this._getContext(o,s);h.beginPath();h.moveTo(t,r);h.arc(t,r,u,f,e,!1);h.lineTo(t,r);h.closePath();o!==i&&h.stroke();s&&h.fill();this.targetX!==i&&this.targetY!==i&&h.isPointInPath(this.targetX,this.targetY)&&(this.currentTargetShapeId=n)},_drawRect:function(n,t,i,r,u,f,e){return this._drawShape(n,[[t,i],[t+r,i],[t+r,i+u],[t,i+u],[t,i]],f,e)},appendShape:function(n){return this.shapes[n.id]=n,this.shapeseq.push(n.id),this.lastShapeId=n.id,n.id},replaceWithShape:function(n,t){var r=this.shapeseq,i;for(this.shapes[t.id]=t,i=r.length;i--;)r[i]==n&&(r[i]=t.id);delete this.shapes[n]},replaceWithShapes:function(n,t){for(var r=this.shapeseq,f={},u,e,i=n.length;i--;)f[n[i]]=!0;for(i=r.length;i--;)u=r[i],f[u]&&(r.splice(i,1),delete this.shapes[u],e=i);for(i=t.length;i--;)r.splice(e,0,t[i].id),this.shapes[t[i].id]=t[i]},insertAfterShape:function(n,t){for(var r=this.shapeseq,i=r.length;i--;)if(r[i]===n){r.splice(i+1,0,t.id);this.shapes[t.id]=t;return}},removeShapeId:function(n){for(var i=this.shapeseq,t=i.length;t--;)if(i[t]===n){i.splice(t,1);break}delete this.shapes[n]},getShapeAt:function(n,t,i){return this.targetX=t,this.targetY=i,this.render(),this.currentTargetShapeId},render:function(){var i=this.shapeseq,u=this.shapes,f=i.length,e=this._getContext(),r,t,n;for(e.clearRect(0,0,this.pixelWidth,this.pixelHeight),n=0;n<f;n++)r=i[n],t=u[r],this["_draw"+t.type].apply(this,t.args);this.interact||(this.shapes={},this.shapeseq=[])}});nt=u(d,{init:function(t,i,u){var f;nt._super.init.call(this,t,i,u);u[0]&&(u=u[0]);r.data(u,"_jqs_vcanvas",this);this.canvas=n.createElement("span");r(this.canvas).css({display:"inline-block",position:"relative",overflow:"hidden",width:t,height:i,margin:"0px",padding:"0px",verticalAlign:"top"});this._insert(this.canvas,u);this._calculatePixelDims(t,i,this.canvas);this.canvas.width=this.pixelWidth;this.canvas.height=this.pixelHeight;f='<v:group coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'" style="position:absolute;top:0;left:0;width:'+this.pixelWidth+"px;height="+this.pixelHeight+'px;"><\/v:group>';this.canvas.insertAdjacentHTML("beforeEnd",f);this.group=r(this.canvas).children()[0];this.rendered=!1;this.prerender=""},_drawShape:function(n,t,r,u,f){for(var e=[],s,h,c,l,o=0,a=t.length;o<a;o++)e[o]=""+t[o][0]+","+t[o][1];return s=e.splice(0,1),f=f===i?1:f,h=r===i?' stroked="false" ':' strokeWeight="'+f+'px" strokeColor="'+r+'" ',c=u===i?' filled="false"':' fillColor="'+u+'" filled="true" ',l=e[0]===e[e.length-1]?"x ":"",'<v:shape coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'"  id="jqsshape'+n+'" '+h+c+' style="position:absolute;left:0px;top:0px;height:'+this.pixelHeight+"px;width:"+this.pixelWidth+'px;padding:0px;margin:0px;"  path="m '+s+" l "+e.join(", ")+" "+l+'e"> <\/v:shape>'},_drawCircle:function(n,t,r,u,f,e,o){var s,h;return t-=u,r-=u,s=f===i?' stroked="false" ':' strokeWeight="'+o+'px" strokeColor="'+f+'" ',h=e===i?' filled="false"':' fillColor="'+e+'" filled="true" ','<v:oval  id="jqsshape'+n+'" '+s+h+' style="position:absolute;top:'+r+"px; left:"+t+"px; width:"+u*2+"px; height:"+u*2+'px"><\/v:oval>'},_drawPieSlice:function(n,r,u,f,e,o,s,h){var y,c,l,a,v,p,w;if(e===o)return"";if(o-e==2*t.PI&&(e=0,o=2*t.PI),c=r+t.round(t.cos(e)*f),l=u+t.round(t.sin(e)*f),a=r+t.round(t.cos(o)*f),v=u+t.round(t.sin(o)*f),c===a&&l===v){if(o-e<t.PI)return"";c=a=r+f;l=v=u}return c===a&&l===v&&o-e<t.PI?"":(y=[r-f,u-f,r+f,u+f,c,l,a,v],p=s===i?' stroked="false" ':' strokeWeight="1px" strokeColor="'+s+'" ',w=h===i?' filled="false"':' fillColor="'+h+'" filled="true" ','<v:shape coordorigin="0 0" coordsize="'+this.pixelWidth+" "+this.pixelHeight+'"  id="jqsshape'+n+'" '+p+w+' style="position:absolute;left:0px;top:0px;height:'+this.pixelHeight+"px;width:"+this.pixelWidth+'px;padding:0px;margin:0px;"  path="m '+r+","+u+" wa "+y.join(", ")+' x e"> <\/v:shape>')},_drawRect:function(n,t,i,r,u,f,e){return this._drawShape(n,[[t,i],[t,i+u],[t+r,i+u],[t+r,i],[t,i]],f,e)},reset:function(){this.group.innerHTML=""},appendShape:function(n){var t=this["_draw"+n.type].apply(this,n.args);return this.rendered?this.group.insertAdjacentHTML("beforeEnd",t):this.prerender+=t,this.lastShapeId=n.id,n.id},replaceWithShape:function(n,t){var i=r("#jqsshape"+n),u=this["_draw"+t.type].apply(this,t.args);i[0].outerHTML=u},replaceWithShapes:function(n,t){for(var f=r("#jqsshape"+n[0]),u="",e=t.length,i=0;i<e;i++)u+=this["_draw"+t[i].type].apply(this,t[i].args);for(f[0].outerHTML=u,i=1;i<n.length;i++)r("#jqsshape"+n[i]).remove()},insertAfterShape:function(n,t){var i=r("#jqsshape"+n),u=this["_draw"+t.type].apply(this,t.args);i[0].insertAdjacentHTML("afterEnd",u)},removeShapeId:function(n){var t=r("#jqsshape"+n);this.group.removeChild(t[0])},getShapeAt:function(n){return n.id.substr(8)},render:function(){this.rendered||(this.group.innerHTML=this.prerender,this.rendered=!0)}})})}(document,Math)