/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

/*
	This is an optimized version of Dojo, built for deployment and not for
	development. To get sources and documentation, please visit:

		http://dojotoolkit.org
*/

window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.gfx.shape"],["provide","dojox.gfx.path"],["provide","dojox.gfx.arc"],["provide","dojox.gfx.decompose"],["provide","dojox.gfx.canvas"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.gfx.shape"]){_4._hasResource["dojox.gfx.shape"]=true;_4.provide("dojox.gfx.shape");_4.declare("dojox.gfx.shape.Shape",null,{constructor:function(){this.rawNode=null;this.shape=null;this.matrix=null;this.fillStyle=null;this.strokeStyle=null;this.bbox=null;this.parent=null;this.parentMatrix=null;},getNode:function(){return this.rawNode;},getShape:function(){return this.shape;},getTransform:function(){return this.matrix;},getFill:function(){return this.fillStyle;},getStroke:function(){return this.strokeStyle;},getParent:function(){return this.parent;},getBoundingBox:function(){return this.bbox;},getTransformedBoundingBox:function(){var b=this.getBoundingBox();if(!b){return null;}var m=this._getRealMatrix();gm=_6.gfx.matrix;return [gm.multiplyPoint(m,b.x,b.y),gm.multiplyPoint(m,b.x+b.width,b.y),gm.multiplyPoint(m,b.x+b.width,b.y+b.height),gm.multiplyPoint(m,b.x,b.y+b.height)];},getEventSource:function(){return this.rawNode;},setShape:function(_7){this.shape=_6.gfx.makeParameters(this.shape,_7);this.bbox=null;return this;},setFill:function(_8){if(!_8){this.fillStyle=null;return this;}var f=null;if(typeof (_8)=="object"&&"type" in _8){switch(_8.type){case "linear":f=_6.gfx.makeParameters(_6.gfx.defaultLinearGradient,_8);break;case "radial":f=_6.gfx.makeParameters(_6.gfx.defaultRadialGradient,_8);break;case "pattern":f=_6.gfx.makeParameters(_6.gfx.defaultPattern,_8);break;}}else{f=_6.gfx.normalizeColor(_8);}this.fillStyle=f;return this;},setStroke:function(_9){if(!_9){this.strokeStyle=null;return this;}if(typeof _9=="string"||_4.isArray(_9)||_9 instanceof _4.Color){_9={color:_9};}var s=this.strokeStyle=_6.gfx.makeParameters(_6.gfx.defaultStroke,_9);s.color=_6.gfx.normalizeColor(s.color);return this;},setTransform:function(_a){this.matrix=_6.gfx.matrix.clone(_a?_6.gfx.matrix.normalize(_a):_6.gfx.matrix.identity);return this._applyTransform();},_applyTransform:function(){return this;},moveToFront:function(){var p=this.getParent();if(p){p._moveChildToFront(this);this._moveToFront();}return this;},moveToBack:function(){var p=this.getParent();if(p){p._moveChildToBack(this);this._moveToBack();}return this;},_moveToFront:function(){},_moveToBack:function(){},applyRightTransform:function(_b){return _b?this.setTransform([this.matrix,_b]):this;},applyLeftTransform:function(_c){return _c?this.setTransform([_c,this.matrix]):this;},applyTransform:function(_d){return _d?this.setTransform([this.matrix,_d]):this;},removeShape:function(_e){if(this.parent){this.parent.remove(this,_e);}return this;},_setParent:function(_f,_10){this.parent=_f;return this._updateParentMatrix(_10);},_updateParentMatrix:function(_11){this.parentMatrix=_11?_6.gfx.matrix.clone(_11):null;return this._applyTransform();},_getRealMatrix:function(){var m=this.matrix;var p=this.parent;while(p){if(p.matrix){m=_6.gfx.matrix.multiply(p.matrix,m);}p=p.parent;}return m;}});_6.gfx.shape._eventsProcessing={connect:function(_12,_13,_14){return arguments.length>2?_4.connect(this.getEventSource(),_12,_13,_14):_4.connect(this.getEventSource(),_12,_13);},disconnect:function(_15){_4.disconnect(_15);}};_4.extend(_6.gfx.shape.Shape,_6.gfx.shape._eventsProcessing);_6.gfx.shape.Container={_init:function(){this.children=[];},openBatch:function(){},closeBatch:function(){},add:function(_16){var _17=_16.getParent();if(_17){_17.remove(_16,true);}this.children.push(_16);return _16._setParent(this,this._getRealMatrix());},remove:function(_18,_19){for(var i=0;i<this.children.length;++i){if(this.children[i]==_18){if(_19){}else{_18.parent=null;_18.parentMatrix=null;}this.children.splice(i,1);break;}}return this;},clear:function(){this.children=[];return this;},_moveChildToFront:function(_1a){for(var i=0;i<this.children.length;++i){if(this.children[i]==_1a){this.children.splice(i,1);this.children.push(_1a);break;}}return this;},_moveChildToBack:function(_1b){for(var i=0;i<this.children.length;++i){if(this.children[i]==_1b){this.children.splice(i,1);this.children.unshift(_1b);break;}}return this;}};_4.declare("dojox.gfx.shape.Surface",null,{constructor:function(){this.rawNode=null;this._parent=null;this._nodes=[];this._events=[];},destroy:function(){_4.forEach(this._nodes,_4.destroy);this._nodes=[];_4.forEach(this._events,_4.disconnect);this._events=[];this.rawNode=null;if(_4.isIE){while(this._parent.lastChild){_4.destroy(this._parent.lastChild);}}else{this._parent.innerHTML="";}this._parent=null;},getEventSource:function(){return this.rawNode;},_getRealMatrix:function(){return null;},isLoaded:true,onLoad:function(_1c){},whenLoaded:function(_1d,_1e){var f=_4.hitch(_1d,_1e);if(this.isLoaded){f(this);}else{var h=_4.connect(this,"onLoad",function(_1f){_4.disconnect(h);f(_1f);});}}});_4.extend(_6.gfx.shape.Surface,_6.gfx.shape._eventsProcessing);_4.declare("dojox.gfx.Point",null,{});_4.declare("dojox.gfx.Rectangle",null,{});_4.declare("dojox.gfx.shape.Rect",_6.gfx.shape.Shape,{constructor:function(_20){this.shape=_6.gfx.getDefault("Rect");this.rawNode=_20;},getBoundingBox:function(){return this.shape;}});_4.declare("dojox.gfx.shape.Ellipse",_6.gfx.shape.Shape,{constructor:function(_21){this.shape=_6.gfx.getDefault("Ellipse");this.rawNode=_21;},getBoundingBox:function(){if(!this.bbox){var _22=this.shape;this.bbox={x:_22.cx-_22.rx,y:_22.cy-_22.ry,width:2*_22.rx,height:2*_22.ry};}return this.bbox;}});_4.declare("dojox.gfx.shape.Circle",_6.gfx.shape.Shape,{constructor:function(_23){this.shape=_6.gfx.getDefault("Circle");this.rawNode=_23;},getBoundingBox:function(){if(!this.bbox){var _24=this.shape;this.bbox={x:_24.cx-_24.r,y:_24.cy-_24.r,width:2*_24.r,height:2*_24.r};}return this.bbox;}});_4.declare("dojox.gfx.shape.Line",_6.gfx.shape.Shape,{constructor:function(_25){this.shape=_6.gfx.getDefault("Line");this.rawNode=_25;},getBoundingBox:function(){if(!this.bbox){var _26=this.shape;this.bbox={x:Math.min(_26.x1,_26.x2),y:Math.min(_26.y1,_26.y2),width:Math.abs(_26.x2-_26.x1),height:Math.abs(_26.y2-_26.y1)};}return this.bbox;}});_4.declare("dojox.gfx.shape.Polyline",_6.gfx.shape.Shape,{constructor:function(_27){this.shape=_6.gfx.getDefault("Polyline");this.rawNode=_27;},setShape:function(_28,_29){if(_28&&_28 instanceof Array){this.inherited(arguments,[{points:_28}]);if(_29&&this.shape.points.length){this.shape.points.push(this.shape.points[0]);}}else{this.inherited(arguments,[_28]);}return this;},_normalizePoints:function(){var p=this.shape.points,l=p&&p.length;if(l&&typeof p[0]=="number"){var _2a=[];for(var i=0;i<l;i+=2){_2a.push({x:p[i],y:p[i+1]});}this.shape.points=_2a;}},getBoundingBox:function(){if(!this.bbox&&this.shape.points.length){var p=this.shape.points;var l=p.length;var t=p[0];var _2b={l:t.x,t:t.y,r:t.x,b:t.y};for(var i=1;i<l;++i){t=p[i];if(_2b.l>t.x){_2b.l=t.x;}if(_2b.r<t.x){_2b.r=t.x;}if(_2b.t>t.y){_2b.t=t.y;}if(_2b.b<t.y){_2b.b=t.y;}}this.bbox={x:_2b.l,y:_2b.t,width:_2b.r-_2b.l,height:_2b.b-_2b.t};}return this.bbox;}});_4.declare("dojox.gfx.shape.Image",_6.gfx.shape.Shape,{constructor:function(_2c){this.shape=_6.gfx.getDefault("Image");this.rawNode=_2c;},getBoundingBox:function(){return this.shape;},setStroke:function(){return this;},setFill:function(){return this;}});_4.declare("dojox.gfx.shape.Text",_6.gfx.shape.Shape,{constructor:function(_2d){this.fontStyle=null;this.shape=_6.gfx.getDefault("Text");this.rawNode=_2d;},getFont:function(){return this.fontStyle;},setFont:function(_2e){this.fontStyle=typeof _2e=="string"?_6.gfx.splitFontString(_2e):_6.gfx.makeParameters(_6.gfx.defaultFont,_2e);this._setFont();return this;}});_6.gfx.shape.Creator={createShape:function(_2f){var gfx=_6.gfx;switch(_2f.type){case gfx.defaultPath.type:return this.createPath(_2f);case gfx.defaultRect.type:return this.createRect(_2f);case gfx.defaultCircle.type:return this.createCircle(_2f);case gfx.defaultEllipse.type:return this.createEllipse(_2f);case gfx.defaultLine.type:return this.createLine(_2f);case gfx.defaultPolyline.type:return this.createPolyline(_2f);case gfx.defaultImage.type:return this.createImage(_2f);case gfx.defaultText.type:return this.createText(_2f);case gfx.defaultTextPath.type:return this.createTextPath(_2f);}return null;},createGroup:function(){return this.createObject(_6.gfx.Group);},createRect:function(_30){return this.createObject(_6.gfx.Rect,_30);},createEllipse:function(_31){return this.createObject(_6.gfx.Ellipse,_31);},createCircle:function(_32){return this.createObject(_6.gfx.Circle,_32);},createLine:function(_33){return this.createObject(_6.gfx.Line,_33);},createPolyline:function(_34){return this.createObject(_6.gfx.Polyline,_34);},createImage:function(_35){return this.createObject(_6.gfx.Image,_35);},createText:function(_36){return this.createObject(_6.gfx.Text,_36);},createPath:function(_37){return this.createObject(_6.gfx.Path,_37);},createTextPath:function(_38){return this.createObject(_6.gfx.TextPath,{}).setText(_38);},createObject:function(_39,_3a){return null;}};}if(!_4._hasResource["dojox.gfx.path"]){_4._hasResource["dojox.gfx.path"]=true;_4.provide("dojox.gfx.path");_4.declare("dojox.gfx.path.Path",_6.gfx.shape.Shape,{constructor:function(_3b){this.shape=_4.clone(_6.gfx.defaultPath);this.segments=[];this.tbbox=null;this.absolute=true;this.last={};this.rawNode=_3b;this.segmented=false;},setAbsoluteMode:function(_3c){this._confirmSegmented();this.absolute=typeof _3c=="string"?(_3c=="absolute"):_3c;return this;},getAbsoluteMode:function(){this._confirmSegmented();return this.absolute;},getBoundingBox:function(){this._confirmSegmented();return (this.bbox&&("l" in this.bbox))?{x:this.bbox.l,y:this.bbox.t,width:this.bbox.r-this.bbox.l,height:this.bbox.b-this.bbox.t}:null;},_getRealBBox:function(){this._confirmSegmented();if(this.tbbox){return this.tbbox;}var _3d=this.bbox,_3e=this._getRealMatrix();this.bbox=null;for(var i=0,len=this.segments.length;i<len;++i){this._updateWithSegment(this.segments[i],_3e);}var t=this.bbox;this.bbox=_3d;this.tbbox=t?[{x:t.l,y:t.t},{x:t.r,y:t.t},{x:t.r,y:t.b},{x:t.l,y:t.b}]:null;return this.tbbox;},getLastPosition:function(){this._confirmSegmented();return "x" in this.last?this.last:null;},_applyTransform:function(){this.tbbox=null;return this.inherited(arguments);},_updateBBox:function(x,y,_3f){if(_3f){var t=_6.gfx.matrix.multiplyPoint(_3f,x,y);x=t.x;y=t.y;}if(this.bbox&&("l" in this.bbox)){if(this.bbox.l>x){this.bbox.l=x;}if(this.bbox.r<x){this.bbox.r=x;}if(this.bbox.t>y){this.bbox.t=y;}if(this.bbox.b<y){this.bbox.b=y;}}else{this.bbox={l:x,b:y,r:x,t:y};}},_updateWithSegment:function(_40,_41){var n=_40.args,l=n.length;switch(_40.action){case "M":case "L":case "C":case "S":case "Q":case "T":for(var i=0;i<l;i+=2){this._updateBBox(n[i],n[i+1],_41);}this.last.x=n[l-2];this.last.y=n[l-1];this.absolute=true;break;case "H":for(var i=0;i<l;++i){this._updateBBox(n[i],this.last.y,_41);}this.last.x=n[l-1];this.absolute=true;break;case "V":for(var i=0;i<l;++i){this._updateBBox(this.last.x,n[i],_41);}this.last.y=n[l-1];this.absolute=true;break;case "m":var _42=0;if(!("x" in this.last)){this._updateBBox(this.last.x=n[0],this.last.y=n[1],_41);_42=2;}for(var i=_42;i<l;i+=2){this._updateBBox(this.last.x+=n[i],this.last.y+=n[i+1],_41);}this.absolute=false;break;case "l":case "t":for(var i=0;i<l;i+=2){this._updateBBox(this.last.x+=n[i],this.last.y+=n[i+1],_41);}this.absolute=false;break;case "h":for(var i=0;i<l;++i){this._updateBBox(this.last.x+=n[i],this.last.y,_41);}this.absolute=false;break;case "v":for(var i=0;i<l;++i){this._updateBBox(this.last.x,this.last.y+=n[i],_41);}this.absolute=false;break;case "c":for(var i=0;i<l;i+=6){this._updateBBox(this.last.x+n[i],this.last.y+n[i+1],_41);this._updateBBox(this.last.x+n[i+2],this.last.y+n[i+3],_41);this._updateBBox(this.last.x+=n[i+4],this.last.y+=n[i+5],_41);}this.absolute=false;break;case "s":case "q":for(var i=0;i<l;i+=4){this._updateBBox(this.last.x+n[i],this.last.y+n[i+1],_41);this._updateBBox(this.last.x+=n[i+2],this.last.y+=n[i+3],_41);}this.absolute=false;break;case "A":for(var i=0;i<l;i+=7){this._updateBBox(n[i+5],n[i+6],_41);}this.last.x=n[l-2];this.last.y=n[l-1];this.absolute=true;break;case "a":for(var i=0;i<l;i+=7){this._updateBBox(this.last.x+=n[i+5],this.last.y+=n[i+6],_41);}this.absolute=false;break;}var _43=[_40.action];for(var i=0;i<l;++i){_43.push(_6.gfx.formatNumber(n[i],true));}if(typeof this.shape.path=="string"){this.shape.path+=_43.join("");}else{Array.prototype.push.apply(this.shape.path,_43);}},_validSegments:{m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},_pushSegment:function(_44,_45){this.tbbox=null;var _46=this._validSegments[_44.toLowerCase()];if(typeof _46=="number"){if(_46){if(_45.length>=_46){var _47={action:_44,args:_45.slice(0,_45.length-_45.length%_46)};this.segments.push(_47);this._updateWithSegment(_47);}}else{var _47={action:_44,args:[]};this.segments.push(_47);this._updateWithSegment(_47);}}},_collectArgs:function(_48,_49){for(var i=0;i<_49.length;++i){var t=_49[i];if(typeof t=="boolean"){_48.push(t?1:0);}else{if(typeof t=="number"){_48.push(t);}else{if(t instanceof Array){this._collectArgs(_48,t);}else{if("x" in t&&"y" in t){_48.push(t.x,t.y);}}}}}},moveTo:function(){this._confirmSegmented();var _4a=[];this._collectArgs(_4a,arguments);this._pushSegment(this.absolute?"M":"m",_4a);return this;},lineTo:function(){this._confirmSegmented();var _4b=[];this._collectArgs(_4b,arguments);this._pushSegment(this.absolute?"L":"l",_4b);return this;},hLineTo:function(){this._confirmSegmented();var _4c=[];this._collectArgs(_4c,arguments);this._pushSegment(this.absolute?"H":"h",_4c);return this;},vLineTo:function(){this._confirmSegmented();var _4d=[];this._collectArgs(_4d,arguments);this._pushSegment(this.absolute?"V":"v",_4d);return this;},curveTo:function(){this._confirmSegmented();var _4e=[];this._collectArgs(_4e,arguments);this._pushSegment(this.absolute?"C":"c",_4e);return this;},smoothCurveTo:function(){this._confirmSegmented();var _4f=[];this._collectArgs(_4f,arguments);this._pushSegment(this.absolute?"S":"s",_4f);return this;},qCurveTo:function(){this._confirmSegmented();var _50=[];this._collectArgs(_50,arguments);this._pushSegment(this.absolute?"Q":"q",_50);return this;},qSmoothCurveTo:function(){this._confirmSegmented();var _51=[];this._collectArgs(_51,arguments);this._pushSegment(this.absolute?"T":"t",_51);return this;},arcTo:function(){this._confirmSegmented();var _52=[];this._collectArgs(_52,arguments);this._pushSegment(this.absolute?"A":"a",_52);return this;},closePath:function(){this._confirmSegmented();this._pushSegment("Z",[]);return this;},_confirmSegmented:function(){if(!this.segmented){var _53=this.shape.path;this.shape.path=[];this._setPath(_53);this.shape.path=this.shape.path.join("");this.segmented=true;}},_setPath:function(_54){var p=_4.isArray(_54)?_54:_54.match(_6.gfx.pathSvgRegExp);this.segments=[];this.absolute=true;this.bbox={};this.last={};if(!p){return;}var _55="",_56=[],l=p.length;for(var i=0;i<l;++i){var t=p[i],x=parseFloat(t);if(isNaN(x)){if(_55){this._pushSegment(_55,_56);}_56=[];_55=t;}else{_56.push(x);}}this._pushSegment(_55,_56);},setShape:function(_57){this.inherited(arguments,[typeof _57=="string"?{path:_57}:_57]);this.segmented=false;this.segments=[];if(!_6.gfx.lazyPathSegmentation){this._confirmSegmented();}return this;},_2PI:Math.PI*2});_4.declare("dojox.gfx.path.TextPath",_6.gfx.path.Path,{constructor:function(_58){if(!("text" in this)){this.text=_4.clone(_6.gfx.defaultTextPath);}if(!("fontStyle" in this)){this.fontStyle=_4.clone(_6.gfx.defaultFont);}},getText:function(){return this.text;},setText:function(_59){this.text=_6.gfx.makeParameters(this.text,typeof _59=="string"?{text:_59}:_59);this._setText();return this;},getFont:function(){return this.fontStyle;},setFont:function(_5a){this.fontStyle=typeof _5a=="string"?_6.gfx.splitFontString(_5a):_6.gfx.makeParameters(_6.gfx.defaultFont,_5a);this._setFont();return this;}});}if(!_4._hasResource["dojox.gfx.arc"]){_4._hasResource["dojox.gfx.arc"]=true;_4.provide("dojox.gfx.arc");(function(){var m=_6.gfx.matrix,_5b=2*Math.PI,pi4=Math.PI/4,pi8=Math.PI/8,_5c=pi4+pi8,_5d=_5e(pi8);function _5e(_5f){var _60=Math.cos(_5f),_61=Math.sin(_5f),p2={x:_60+(4/3)*(1-_60),y:_61-(4/3)*_60*(1-_60)/_61};return {s:{x:_60,y:-_61},c1:{x:p2.x,y:-p2.y},c2:p2,e:{x:_60,y:_61}};};_6.gfx.arc={unitArcAsBezier:_5e,curvePI4:_5d,arcAsBezier:function(_62,rx,ry,_63,_64,_65,x,y){_64=Boolean(_64);_65=Boolean(_65);var _66=m._degToRad(_63),rx2=rx*rx,ry2=ry*ry,pa=m.multiplyPoint(m.rotate(-_66),{x:(_62.x-x)/2,y:(_62.y-y)/2}),_67=pa.x*pa.x,_68=pa.y*pa.y,c1=Math.sqrt((rx2*ry2-rx2*_68-ry2*_67)/(rx2*_68+ry2*_67));if(isNaN(c1)){c1=0;}var ca={x:c1*rx*pa.y/ry,y:-c1*ry*pa.x/rx};if(_64==_65){ca={x:-ca.x,y:-ca.y};}var c=m.multiplyPoint([m.translate((_62.x+x)/2,(_62.y+y)/2),m.rotate(_66)],ca);var _69=m.normalize([m.translate(c.x,c.y),m.rotate(_66),m.scale(rx,ry)]);var _6a=m.invert(_69),sp=m.multiplyPoint(_6a,_62),ep=m.multiplyPoint(_6a,x,y),_6b=Math.atan2(sp.y,sp.x),_6c=Math.atan2(ep.y,ep.x),_6d=_6b-_6c;if(_65){_6d=-_6d;}if(_6d<0){_6d+=_5b;}else{if(_6d>_5b){_6d-=_5b;}}var _6e=pi8,_6f=_5d,_70=_65?_6e:-_6e,_71=[];for(var _72=_6d;_72>0;_72-=pi4){if(_72<_5c){_6e=_72/2;_6f=_5e(_6e);_70=_65?_6e:-_6e;_72=0;}var c1,c2,e,M=m.normalize([_69,m.rotate(_6b+_70)]);if(_65){c1=m.multiplyPoint(M,_6f.c1);c2=m.multiplyPoint(M,_6f.c2);e=m.multiplyPoint(M,_6f.e);}else{c1=m.multiplyPoint(M,_6f.c2);c2=m.multiplyPoint(M,_6f.c1);e=m.multiplyPoint(M,_6f.s);}_71.push([c1.x,c1.y,c2.x,c2.y,e.x,e.y]);_6b+=2*_70;}return _71;}};})();}if(!_4._hasResource["dojox.gfx.decompose"]){_4._hasResource["dojox.gfx.decompose"]=true;_4.provide("dojox.gfx.decompose");(function(){var m=_6.gfx.matrix;function eq(a,b){return Math.abs(a-b)<=0.000001*(Math.abs(a)+Math.abs(b));};function _73(r1,m1,r2,m2){if(!isFinite(r1)){return r2;}else{if(!isFinite(r2)){return r1;}}m1=Math.abs(m1),m2=Math.abs(m2);return (m1*r1+m2*r2)/(m1+m2);};function _74(_75){var M=new m.Matrix2D(_75);return _4.mixin(M,{dx:0,dy:0,xy:M.yx,yx:M.xy});};function _76(_77){return (_77.xx*_77.yy<0||_77.xy*_77.yx>0)?-1:1;};function _78(_79){var M=m.normalize(_79),b=-M.xx-M.yy,c=M.xx*M.yy-M.xy*M.yx,d=Math.sqrt(b*b-4*c),l1=-(b+(b<0?-d:d))/2,l2=c/l1,vx1=M.xy/(l1-M.xx),vy1=1,vx2=M.xy/(l2-M.xx),vy2=1;if(eq(l1,l2)){vx1=1,vy1=0,vx2=0,vy2=1;}if(!isFinite(vx1)){vx1=1,vy1=(l1-M.xx)/M.xy;if(!isFinite(vy1)){vx1=(l1-M.yy)/M.yx,vy1=1;if(!isFinite(vx1)){vx1=1,vy1=M.yx/(l1-M.yy);}}}if(!isFinite(vx2)){vx2=1,vy2=(l2-M.xx)/M.xy;if(!isFinite(vy2)){vx2=(l2-M.yy)/M.yx,vy2=1;if(!isFinite(vx2)){vx2=1,vy2=M.yx/(l2-M.yy);}}}var d1=Math.sqrt(vx1*vx1+vy1*vy1),d2=Math.sqrt(vx2*vx2+vy2*vy2);if(!isFinite(vx1/=d1)){vx1=0;}if(!isFinite(vy1/=d1)){vy1=0;}if(!isFinite(vx2/=d2)){vx2=0;}if(!isFinite(vy2/=d2)){vy2=0;}return {value1:l1,value2:l2,vector1:{x:vx1,y:vy1},vector2:{x:vx2,y:vy2}};};function _7a(M,_7b){var _7c=_76(M),a=_7b.angle1=(Math.atan2(M.yx,M.yy)+Math.atan2(-_7c*M.xy,_7c*M.xx))/2,cos=Math.cos(a),sin=Math.sin(a);_7b.sx=_73(M.xx/cos,cos,-M.xy/sin,sin);_7b.sy=_73(M.yy/cos,cos,M.yx/sin,sin);return _7b;};function _7d(M,_7e){var _7f=_76(M),a=_7e.angle2=(Math.atan2(_7f*M.yx,_7f*M.xx)+Math.atan2(-M.xy,M.yy))/2,cos=Math.cos(a),sin=Math.sin(a);_7e.sx=_73(M.xx/cos,cos,M.yx/sin,sin);_7e.sy=_73(M.yy/cos,cos,-M.xy/sin,sin);return _7e;};_6.gfx.decompose=function(_80){var M=m.normalize(_80),_81={dx:M.dx,dy:M.dy,sx:1,sy:1,angle1:0,angle2:0};if(eq(M.xy,0)&&eq(M.yx,0)){return _4.mixin(_81,{sx:M.xx,sy:M.yy});}if(eq(M.xx*M.yx,-M.xy*M.yy)){return _7a(M,_81);}if(eq(M.xx*M.xy,-M.yx*M.yy)){return _7d(M,_81);}var MT=_74(M),u=_78([M,MT]),v=_78([MT,M]),U=new m.Matrix2D({xx:u.vector1.x,xy:u.vector2.x,yx:u.vector1.y,yy:u.vector2.y}),VT=new m.Matrix2D({xx:v.vector1.x,xy:v.vector1.y,yx:v.vector2.x,yy:v.vector2.y}),S=new m.Matrix2D([m.invert(U),M,m.invert(VT)]);_7a(VT,_81);S.xx*=_81.sx;S.yy*=_81.sy;_7d(U,_81);S.xx*=_81.sx;S.yy*=_81.sy;return _4.mixin(_81,{sx:S.xx,sy:S.yy});};})();}if(!_4._hasResource["dojox.gfx.canvas"]){_4._hasResource["dojox.gfx.canvas"]=true;_4.provide("dojox.gfx.canvas");_4.experimental("dojox.gfx.canvas");(function(){var d=_4,g=_6.gfx,gs=g.shape,ga=g.arc,_82=g.canvas,m=g.matrix,mp=m.multiplyPoint,pi=Math.PI,_83=2*pi,_84=pi/2,_85=null;d.declare("dojox.gfx.canvas.Shape",gs.Shape,{_render:function(ctx){ctx.save();this._renderTransform(ctx);this._renderShape(ctx);this._renderFill(ctx,true);this._renderStroke(ctx,true);ctx.restore();},_renderTransform:function(ctx){if("canvasTransform" in this){var t=this.canvasTransform;ctx.translate(t.dx,t.dy);ctx.rotate(t.angle2);ctx.scale(t.sx,t.sy);ctx.rotate(t.angle1);}},_renderShape:function(ctx){},_renderFill:function(ctx,_86){if("canvasFill" in this){var fs=this.fillStyle;if("canvasFillImage" in this){var w=fs.width,h=fs.height,iw=this.canvasFillImage.width,ih=this.canvasFillImage.height,sx=w==iw?1:w/iw,sy=h==ih?1:h/ih,s=Math.min(sx,sy),dx=(w-s*iw)/2,dy=(h-s*ih)/2;_85.width=w;_85.height=h;var _87=_85.getContext("2d");_87.clearRect(0,0,w,h);_87.drawImage(this.canvasFillImage,0,0,iw,ih,dx,dy,s*iw,s*ih);this.canvasFill=ctx.createPattern(_85,"repeat");delete this.canvasFillImage;}ctx.fillStyle=this.canvasFill;if(_86){if(fs.type==="pattern"&&(fs.x!==0||fs.y!==0)){ctx.translate(fs.x,fs.y);}ctx.fill();}}else{ctx.fillStyle="rgba(0,0,0,0.0)";}},_renderStroke:function(ctx,_88){var s=this.strokeStyle;if(s){ctx.strokeStyle=s.color.toString();ctx.lineWidth=s.width;ctx.lineCap=s.cap;if(typeof s.join=="number"){ctx.lineJoin="miter";ctx.miterLimit=s.join;}else{ctx.lineJoin=s.join;}if(_88){ctx.stroke();}}else{if(!_88){ctx.strokeStyle="rgba(0,0,0,0.0)";}}},getEventSource:function(){return null;},connect:function(){},disconnect:function(){}});var _89=function(_8a,_8b,_8c){var old=_8a.prototype[_8b];_8a.prototype[_8b]=_8c?function(){this.surface.makeDirty();old.apply(this,arguments);_8c.call(this);return this;}:function(){this.surface.makeDirty();return old.apply(this,arguments);};};_89(_82.Shape,"setTransform",function(){if(this.matrix){this.canvasTransform=g.decompose(this.matrix);}else{delete this.canvasTransform;}});_89(_82.Shape,"setFill",function(){var fs=this.fillStyle,f;if(fs){if(typeof (fs)=="object"&&"type" in fs){var ctx=this.surface.rawNode.getContext("2d");switch(fs.type){case "linear":case "radial":f=fs.type=="linear"?ctx.createLinearGradient(fs.x1,fs.y1,fs.x2,fs.y2):ctx.createRadialGradient(fs.cx,fs.cy,0,fs.cx,fs.cy,fs.r);d.forEach(fs.colors,function(_8d){f.addColorStop(_8d.offset,g.normalizeColor(_8d.color).toString());});break;case "pattern":if(!_85){_85=document.createElement("canvas");}var img=new Image();this.surface.downloadImage(img,fs.src);this.canvasFillImage=img;}}else{f=fs.toString();}this.canvasFill=f;}else{delete this.canvasFill;}});_89(_82.Shape,"setStroke");_89(_82.Shape,"setShape");_4.declare("dojox.gfx.canvas.Group",_82.Shape,{constructor:function(){gs.Container._init.call(this);},_render:function(ctx){ctx.save();this._renderTransform(ctx);for(var i=0;i<this.children.length;++i){this.children[i]._render(ctx);}ctx.restore();}});_4.declare("dojox.gfx.canvas.Rect",[_82.Shape,gs.Rect],{_renderShape:function(ctx){var s=this.shape,r=Math.min(s.r,s.height/2,s.width/2),xl=s.x,xr=xl+s.width,yt=s.y,yb=yt+s.height,xl2=xl+r,xr2=xr-r,yt2=yt+r,yb2=yb-r;ctx.beginPath();ctx.moveTo(xl2,yt);if(r){ctx.arc(xr2,yt2,r,-_84,0,false);ctx.arc(xr2,yb2,r,0,_84,false);ctx.arc(xl2,yb2,r,_84,pi,false);ctx.arc(xl2,yt2,r,pi,pi+_84,false);}else{ctx.lineTo(xr2,yt);ctx.lineTo(xr,yb2);ctx.lineTo(xl2,yb);ctx.lineTo(xl,yt2);}ctx.closePath();}});var _8e=[];(function(){var u=ga.curvePI4;_8e.push(u.s,u.c1,u.c2,u.e);for(var a=45;a<360;a+=45){var r=m.rotateg(a);_8e.push(mp(r,u.c1),mp(r,u.c2),mp(r,u.e));}})();_4.declare("dojox.gfx.canvas.Ellipse",[_82.Shape,gs.Ellipse],{setShape:function(){this.inherited(arguments);var s=this.shape,t,c1,c2,r=[],M=m.normalize([m.translate(s.cx,s.cy),m.scale(s.rx,s.ry)]);t=mp(M,_8e[0]);r.push([t.x,t.y]);for(var i=1;i<_8e.length;i+=3){c1=mp(M,_8e[i]);c2=mp(M,_8e[i+1]);t=mp(M,_8e[i+2]);r.push([c1.x,c1.y,c2.x,c2.y,t.x,t.y]);}this.canvasEllipse=r;return this;},_renderShape:function(ctx){var r=this.canvasEllipse;ctx.beginPath();ctx.moveTo.apply(ctx,r[0]);for(var i=1;i<r.length;++i){ctx.bezierCurveTo.apply(ctx,r[i]);}ctx.closePath();}});_4.declare("dojox.gfx.canvas.Circle",[_82.Shape,gs.Circle],{_renderShape:function(ctx){var s=this.shape;ctx.beginPath();ctx.arc(s.cx,s.cy,s.r,0,_83,1);}});_4.declare("dojox.gfx.canvas.Line",[_82.Shape,gs.Line],{_renderShape:function(ctx){var s=this.shape;ctx.beginPath();ctx.moveTo(s.x1,s.y1);ctx.lineTo(s.x2,s.y2);}});_4.declare("dojox.gfx.canvas.Polyline",[_82.Shape,gs.Polyline],{setShape:function(){this.inherited(arguments);var p=this.shape.points,f=p[0],r=[],c,i;if(p.length){if(typeof f=="number"){r.push(f,p[1]);i=2;}else{r.push(f.x,f.y);i=1;}for(;i<p.length;++i){c=p[i];if(typeof c=="number"){r.push(c,p[++i]);}else{r.push(c.x,c.y);}}}this.canvasPolyline=r;return this;},_renderShape:function(ctx){var p=this.canvasPolyline;if(p.length){ctx.beginPath();ctx.moveTo(p[0],p[1]);for(var i=2;i<p.length;i+=2){ctx.lineTo(p[i],p[i+1]);}}}});_4.declare("dojox.gfx.canvas.Image",[_82.Shape,gs.Image],{setShape:function(){this.inherited(arguments);var img=new Image();this.surface.downloadImage(img,this.shape.src);this.canvasImage=img;return this;},_renderShape:function(ctx){var s=this.shape;ctx.drawImage(this.canvasImage,s.x,s.y,s.width,s.height);}});_4.declare("dojox.gfx.canvas.Text",[_82.Shape,gs.Text],{_setFont:function(){if(this.fontStyle){this.canvasFont=g.makeFontString(this.fontStyle);}else{delete this.canvasFont;}},getTextWidth:function(){var s=this.shape,w=0,ctx;if(s.text&&s.text.length>0){ctx=this.surface.rawNode.getContext("2d");ctx.save();this._renderTransform(ctx);this._renderFill(ctx,false);this._renderStroke(ctx,false);if(this.canvasFont){ctx.font=this.canvasFont;}w=ctx.measureText(s.text).width;ctx.restore();}return w;},_render:function(ctx){ctx.save();this._renderTransform(ctx);this._renderFill(ctx,false);this._renderStroke(ctx,false);this._renderShape(ctx);ctx.restore();},_renderShape:function(ctx){var ta,s=this.shape;if(!s.text||s.text.length==0){return;}ta=s.align==="middle"?"center":s.align;ctx.textAlign=ta;if(this.canvasFont){ctx.font=this.canvasFont;}if(this.canvasFill){ctx.fillText(s.text,s.x,s.y);}if(this.strokeStyle){ctx.beginPath();ctx.strokeText(s.text,s.x,s.y);ctx.closePath();}}});_89(_82.Text,"setFont");if(typeof _4.doc.createElement("canvas").getContext("2d").fillText!="function"){_82.Text.extend({getTextWidth:function(){return 0;},_renderShape:function(){}});}var _8f={M:"_moveToA",m:"_moveToR",L:"_lineToA",l:"_lineToR",H:"_hLineToA",h:"_hLineToR",V:"_vLineToA",v:"_vLineToR",C:"_curveToA",c:"_curveToR",S:"_smoothCurveToA",s:"_smoothCurveToR",Q:"_qCurveToA",q:"_qCurveToR",T:"_qSmoothCurveToA",t:"_qSmoothCurveToR",A:"_arcTo",a:"_arcTo",Z:"_closePath",z:"_closePath"};_4.declare("dojox.gfx.canvas.Path",[_82.Shape,g.path.Path],{constructor:function(){this.lastControl={};},setShape:function(){this.canvasPath=[];return this.inherited(arguments);},_updateWithSegment:function(_90){var _91=d.clone(this.last);this[_8f[_90.action]](this.canvasPath,_90.action,_90.args);this.last=_91;this.inherited(arguments);},_renderShape:function(ctx){var r=this.canvasPath;ctx.beginPath();for(var i=0;i<r.length;i+=2){ctx[r[i]].apply(ctx,r[i+1]);}},_moveToA:function(_92,_93,_94){_92.push("moveTo",[_94[0],_94[1]]);for(var i=2;i<_94.length;i+=2){_92.push("lineTo",[_94[i],_94[i+1]]);}this.last.x=_94[_94.length-2];this.last.y=_94[_94.length-1];this.lastControl={};},_moveToR:function(_95,_96,_97){if("x" in this.last){_95.push("moveTo",[this.last.x+=_97[0],this.last.y+=_97[1]]);}else{_95.push("moveTo",[this.last.x=_97[0],this.last.y=_97[1]]);}for(var i=2;i<_97.length;i+=2){_95.push("lineTo",[this.last.x+=_97[i],this.last.y+=_97[i+1]]);}this.lastControl={};},_lineToA:function(_98,_99,_9a){for(var i=0;i<_9a.length;i+=2){_98.push("lineTo",[_9a[i],_9a[i+1]]);}this.last.x=_9a[_9a.length-2];this.last.y=_9a[_9a.length-1];this.lastControl={};},_lineToR:function(_9b,_9c,_9d){for(var i=0;i<_9d.length;i+=2){_9b.push("lineTo",[this.last.x+=_9d[i],this.last.y+=_9d[i+1]]);}this.lastControl={};},_hLineToA:function(_9e,_9f,_a0){for(var i=0;i<_a0.length;++i){_9e.push("lineTo",[_a0[i],this.last.y]);}this.last.x=_a0[_a0.length-1];this.lastControl={};},_hLineToR:function(_a1,_a2,_a3){for(var i=0;i<_a3.length;++i){_a1.push("lineTo",[this.last.x+=_a3[i],this.last.y]);}this.lastControl={};},_vLineToA:function(_a4,_a5,_a6){for(var i=0;i<_a6.length;++i){_a4.push("lineTo",[this.last.x,_a6[i]]);}this.last.y=_a6[_a6.length-1];this.lastControl={};},_vLineToR:function(_a7,_a8,_a9){for(var i=0;i<_a9.length;++i){_a7.push("lineTo",[this.last.x,this.last.y+=_a9[i]]);}this.lastControl={};},_curveToA:function(_aa,_ab,_ac){for(var i=0;i<_ac.length;i+=6){_aa.push("bezierCurveTo",_ac.slice(i,i+6));}this.last.x=_ac[_ac.length-2];this.last.y=_ac[_ac.length-1];this.lastControl.x=_ac[_ac.length-4];this.lastControl.y=_ac[_ac.length-3];this.lastControl.type="C";},_curveToR:function(_ad,_ae,_af){for(var i=0;i<_af.length;i+=6){_ad.push("bezierCurveTo",[this.last.x+_af[i],this.last.y+_af[i+1],this.lastControl.x=this.last.x+_af[i+2],this.lastControl.y=this.last.y+_af[i+3],this.last.x+_af[i+4],this.last.y+_af[i+5]]);this.last.x+=_af[i+4];this.last.y+=_af[i+5];}this.lastControl.type="C";},_smoothCurveToA:function(_b0,_b1,_b2){for(var i=0;i<_b2.length;i+=4){var _b3=this.lastControl.type=="C";_b0.push("bezierCurveTo",[_b3?2*this.last.x-this.lastControl.x:this.last.x,_b3?2*this.last.y-this.lastControl.y:this.last.y,_b2[i],_b2[i+1],_b2[i+2],_b2[i+3]]);this.lastControl.x=_b2[i];this.lastControl.y=_b2[i+1];this.lastControl.type="C";}this.last.x=_b2[_b2.length-2];this.last.y=_b2[_b2.length-1];},_smoothCurveToR:function(_b4,_b5,_b6){for(var i=0;i<_b6.length;i+=4){var _b7=this.lastControl.type=="C";_b4.push("bezierCurveTo",[_b7?2*this.last.x-this.lastControl.x:this.last.x,_b7?2*this.last.y-this.lastControl.y:this.last.y,this.last.x+_b6[i],this.last.y+_b6[i+1],this.last.x+_b6[i+2],this.last.y+_b6[i+3]]);this.lastControl.x=this.last.x+_b6[i];this.lastControl.y=this.last.y+_b6[i+1];this.lastControl.type="C";this.last.x+=_b6[i+2];this.last.y+=_b6[i+3];}},_qCurveToA:function(_b8,_b9,_ba){for(var i=0;i<_ba.length;i+=4){_b8.push("quadraticCurveTo",_ba.slice(i,i+4));}this.last.x=_ba[_ba.length-2];this.last.y=_ba[_ba.length-1];this.lastControl.x=_ba[_ba.length-4];this.lastControl.y=_ba[_ba.length-3];this.lastControl.type="Q";},_qCurveToR:function(_bb,_bc,_bd){for(var i=0;i<_bd.length;i+=4){_bb.push("quadraticCurveTo",[this.lastControl.x=this.last.x+_bd[i],this.lastControl.y=this.last.y+_bd[i+1],this.last.x+_bd[i+2],this.last.y+_bd[i+3]]);this.last.x+=_bd[i+2];this.last.y+=_bd[i+3];}this.lastControl.type="Q";},_qSmoothCurveToA:function(_be,_bf,_c0){for(var i=0;i<_c0.length;i+=2){var _c1=this.lastControl.type=="Q";_be.push("quadraticCurveTo",[this.lastControl.x=_c1?2*this.last.x-this.lastControl.x:this.last.x,this.lastControl.y=_c1?2*this.last.y-this.lastControl.y:this.last.y,_c0[i],_c0[i+1]]);this.lastControl.type="Q";}this.last.x=_c0[_c0.length-2];this.last.y=_c0[_c0.length-1];},_qSmoothCurveToR:function(_c2,_c3,_c4){for(var i=0;i<_c4.length;i+=2){var _c5=this.lastControl.type=="Q";_c2.push("quadraticCurveTo",[this.lastControl.x=_c5?2*this.last.x-this.lastControl.x:this.last.x,this.lastControl.y=_c5?2*this.last.y-this.lastControl.y:this.last.y,this.last.x+_c4[i],this.last.y+_c4[i+1]]);this.lastControl.type="Q";this.last.x+=_c4[i];this.last.y+=_c4[i+1];}},_arcTo:function(_c6,_c7,_c8){var _c9=_c7=="a";for(var i=0;i<_c8.length;i+=7){var x1=_c8[i+5],y1=_c8[i+6];if(_c9){x1+=this.last.x;y1+=this.last.y;}var _ca=ga.arcAsBezier(this.last,_c8[i],_c8[i+1],_c8[i+2],_c8[i+3]?1:0,_c8[i+4]?1:0,x1,y1);d.forEach(_ca,function(p){_c6.push("bezierCurveTo",p);});this.last.x=x1;this.last.y=y1;}this.lastControl={};},_closePath:function(_cb,_cc,_cd){_cb.push("closePath",[]);this.lastControl={};}});d.forEach(["moveTo","lineTo","hLineTo","vLineTo","curveTo","smoothCurveTo","qCurveTo","qSmoothCurveTo","arcTo","closePath"],function(_ce){_89(_82.Path,_ce);});_4.declare("dojox.gfx.canvas.TextPath",[_82.Shape,g.path.TextPath],{_renderShape:function(ctx){var s=this.shape;},_setText:function(){},_setFont:function(){}});_4.declare("dojox.gfx.canvas.Surface",gs.Surface,{constructor:function(){gs.Container._init.call(this);this.pendingImageCount=0;this.makeDirty();},setDimensions:function(_cf,_d0){this.width=g.normalizedLength(_cf);this.height=g.normalizedLength(_d0);if(!this.rawNode){return this;}this.rawNode.width=_cf;this.rawNode.height=_d0;this.makeDirty();return this;},getDimensions:function(){return this.rawNode?{width:this.rawNode.width,height:this.rawNode.height}:null;},_render:function(){if(this.pendingImageCount){return;}var ctx=this.rawNode.getContext("2d");ctx.save();ctx.clearRect(0,0,this.rawNode.width,this.rawNode.height);for(var i=0;i<this.children.length;++i){this.children[i]._render(ctx);}ctx.restore();if("pendingRender" in this){clearTimeout(this.pendingRender);delete this.pendingRender;}},makeDirty:function(){if(!this.pendingImagesCount&&!("pendingRender" in this)){this.pendingRender=setTimeout(d.hitch(this,this._render),0);}},downloadImage:function(img,url){var _d1=d.hitch(this,this.onImageLoad);if(!this.pendingImageCount++&&"pendingRender" in this){clearTimeout(this.pendingRender);delete this.pendingRender;}img.onload=_d1;img.onerror=_d1;img.onabort=_d1;img.src=url;},onImageLoad:function(){if(!--this.pendingImageCount){this._render();}},getEventSource:function(){return null;},connect:function(){},disconnect:function(){}});_82.createSurface=function(_d2,_d3,_d4){if(!_d3&&!_d4){var pos=d.position(_d2);_d3=_d3||pos.w;_d4=_d4||pos.h;}if(typeof _d3=="number"){_d3=_d3+"px";}if(typeof _d4=="number"){_d4=_d4+"px";}var s=new _82.Surface(),p=d.byId(_d2),c=p.ownerDocument.createElement("canvas");c.width=g.normalizedLength(_d3);c.height=g.normalizedLength(_d4);p.appendChild(c);s.rawNode=c;s._parent=p;s.surface=s;return s;};var C=gs.Container,_d5={add:function(_d6){this.surface.makeDirty();return C.add.apply(this,arguments);},remove:function(_d7,_d8){this.surface.makeDirty();return C.remove.apply(this,arguments);},clear:function(){this.surface.makeDirty();return C.clear.apply(this,arguments);},_moveChildToFront:function(_d9){this.surface.makeDirty();return C._moveChildToFront.apply(this,arguments);},_moveChildToBack:function(_da){this.surface.makeDirty();return C._moveChildToBack.apply(this,arguments);}};var _db={createObject:function(_dc,_dd){var _de=new _dc();_de.surface=this.surface;_de.setShape(_dd);this.add(_de);return _de;}};d.extend(_82.Group,_d5);d.extend(_82.Group,gs.Creator);d.extend(_82.Group,_db);d.extend(_82.Surface,_d5);d.extend(_82.Surface,gs.Creator);d.extend(_82.Surface,_db);if(g.loadAndSwitch==="canvas"){g.switchTo("canvas");delete g.loadAndSwitch;}})();}}};});
