//>>built
define("dojox/gfx/svg","dojo/_base/lang dojo/_base/sniff dojo/_base/window dojo/dom dojo/_base/declare dojo/_base/array dojo/dom-geometry dojo/dom-attr dojo/_base/Color ./_base ./shape ./path".split(" "),function(m,p,q,r,k,x,C,w,D,g,h,v){function l(a,b){return q.doc.createElementNS?q.doc.createElementNS(a,b):q.doc.createElement(b)}function y(a,b,c,e){return a.setAttributeNS?a.setAttributeNS(b,c,e):a.setAttribute(c,e)}function z(a){return d.useSvgWeb?q.doc.createTextNode(a,!0):q.doc.createTextNode(a)}
var d=g.svg={};d.useSvgWeb="undefined"!=typeof window.svgweb;var E=navigator.userAgent,F=p("ios"),A=p("android"),G=p("chrome")||A&&4<=A?"auto":"optimizeLegibility";d.xmlns={xlink:"http://www.w3.org/1999/xlink",svg:"http://www.w3.org/2000/svg"};d.getRef=function(a){return a&&"none"!=a?a.match(/^url\(#.+\)$/)?r.byId(a.slice(5,-1)):a.match(/^#dojoUnique\d+$/)?r.byId(a.slice(1)):null:null};d.dasharray={solid:"none",shortdash:[4,1],shortdot:[1,1],shortdashdot:[4,1,1,1],shortdashdotdot:[4,1,1,1,1,1],dot:[1,
3],dash:[4,3],longdash:[8,3],dashdot:[4,3,1,3],longdashdot:[8,3,1,3],longdashdotdot:[8,3,1,3,1,3]};var H=0;d.Shape=k("dojox.gfx.svg.Shape",h.Shape,{destroy:function(){if(this.fillStyle&&"type"in this.fillStyle){var a=this.rawNode.getAttribute("fill");(a=d.getRef(a))&&a.parentNode.removeChild(a)}this.clip&&(a=this.rawNode.getAttribute("clip-path"))&&(a=r.byId(a.match(/gfx_clip[\d]+/)[0]))&&a.parentNode.removeChild(a);h.Shape.prototype.destroy.apply(this,arguments)},setFill:function(a){if(!a)return this.fillStyle=
null,this.rawNode.setAttribute("fill","none"),this.rawNode.setAttribute("fill-opacity",0),this;var b=function(e){this.setAttribute(e,c[e].toFixed(8))};if("object"==typeof a&&"type"in a){switch(a.type){case "linear":var c=g.makeParameters(g.defaultLinearGradient,a);a=this._setFillObject(c,"linearGradient");x.forEach(["x1","y1","x2","y2"],b,a);break;case "radial":c=g.makeParameters(g.defaultRadialGradient,a);a=this._setFillObject(c,"radialGradient");x.forEach(["cx","cy","r"],b,a);break;case "pattern":c=
g.makeParameters(g.defaultPattern,a),a=this._setFillObject(c,"pattern"),x.forEach(["x","y","width","height"],b,a)}this.fillStyle=c;return this}this.fillStyle=c=g.normalizeColor(a);this.rawNode.setAttribute("fill",c.toCss());this.rawNode.setAttribute("fill-opacity",c.a);this.rawNode.setAttribute("fill-rule","evenodd");return this},setStroke:function(a){var b=this.rawNode;if(!a)return this.strokeStyle=null,b.setAttribute("stroke","none"),b.setAttribute("stroke-opacity",0),this;if("string"==typeof a||
m.isArray(a)||a instanceof D)a={color:a};a=this.strokeStyle=g.makeParameters(g.defaultStroke,a);a.color=g.normalizeColor(a.color);if(a){var c=0>a.width?0:a.width;b.setAttribute("stroke",a.color.toCss());b.setAttribute("stroke-opacity",a.color.a);b.setAttribute("stroke-width",c);b.setAttribute("stroke-linecap",a.cap);"number"==typeof a.join?(b.setAttribute("stroke-linejoin","miter"),b.setAttribute("stroke-miterlimit",a.join)):b.setAttribute("stroke-linejoin",a.join);var e=a.style.toLowerCase();e in
d.dasharray&&(e=d.dasharray[e]);if(e instanceof Array){e=m._toArray(e);var f;for(f=0;f<e.length;++f)e[f]*=c;if("butt"!=a.cap){for(f=0;f<e.length;f+=2)e[f]-=c,1>e[f]&&(e[f]=1);for(f=1;f<e.length;f+=2)e[f]+=c}e=e.join(",")}b.setAttribute("stroke-dasharray",e);b.setAttribute("dojoGfxStrokeStyle",a.style)}return this},_getParentSurface:function(){for(var a=this.parent;a&&!(a instanceof g.Surface);a=a.parent);return a},_setFillObject:function(a,b){var c=d.xmlns.svg;this.fillStyle=a;var e=this._getParentSurface().defNode,
f=this.rawNode.getAttribute("fill");if(f=d.getRef(f))if(f.tagName.toLowerCase()!=b.toLowerCase()){var n=f.id;f.parentNode.removeChild(f);f=l(c,b);f.setAttribute("id",n);e.appendChild(f)}else for(;f.childNodes.length;)f.removeChild(f.lastChild);else f=l(c,b),f.setAttribute("id",g._base._getUniqueId()),e.appendChild(f);if("pattern"==b)f.setAttribute("patternUnits","userSpaceOnUse"),c=l(c,"image"),c.setAttribute("x",0),c.setAttribute("y",0),c.setAttribute("width",(0>a.width?0:a.width).toFixed(8)),c.setAttribute("height",
(0>a.height?0:a.height).toFixed(8)),y(c,d.xmlns.xlink,"xlink:href",a.src),f.appendChild(c);else for(f.setAttribute("gradientUnits","userSpaceOnUse"),e=0;e<a.colors.length;++e){n=a.colors[e];var t=l(c,"stop"),B=n.color=g.normalizeColor(n.color);t.setAttribute("offset",n.offset.toFixed(8));t.setAttribute("stop-color",B.toCss());t.setAttribute("stop-opacity",B.a);f.appendChild(t)}this.rawNode.setAttribute("fill","url(#"+f.getAttribute("id")+")");this.rawNode.removeAttribute("fill-opacity");this.rawNode.setAttribute("fill-rule",
"evenodd");return f},_applyTransform:function(){if(this.matrix){var a=this.matrix;this.rawNode.setAttribute("transform","matrix("+a.xx.toFixed(8)+","+a.yx.toFixed(8)+","+a.xy.toFixed(8)+","+a.yy.toFixed(8)+","+a.dx.toFixed(8)+","+a.dy.toFixed(8)+")")}else this.rawNode.removeAttribute("transform");return this},setRawNode:function(a){a=this.rawNode=a;"image"!=this.shape.type&&a.setAttribute("fill","none");a.setAttribute("fill-opacity",0);a.setAttribute("stroke","none");a.setAttribute("stroke-opacity",
0);a.setAttribute("stroke-width",1);a.setAttribute("stroke-linecap","butt");a.setAttribute("stroke-linejoin","miter");a.setAttribute("stroke-miterlimit",4);a.__gfxObject__=this},setShape:function(a){this.shape=g.makeParameters(this.shape,a);for(var b in this.shape)if("type"!=b){a=this.shape[b];if("width"===b||"height"===b)a=0>a?0:a;this.rawNode.setAttribute(b,a)}this.bbox=null;return this},_moveToFront:function(){this.rawNode.parentNode.appendChild(this.rawNode);return this},_moveToBack:function(){this.rawNode.parentNode.insertBefore(this.rawNode,
this.rawNode.parentNode.firstChild);return this},setClip:function(a){this.inherited(arguments);var b=a?"width"in a?"rect":"cx"in a?"ellipse":"points"in a?"polyline":"d"in a?"path":null:null;if(a&&!b)return this;"polyline"===b&&(a=m.clone(a),a.points=a.points.join(","));var c,e=w.get(this.rawNode,"clip-path");e&&(c=r.byId(e.match(/gfx_clip[\d]+/)[0]))&&c.removeChild(c.childNodes[0]);a?(c?(b=l(d.xmlns.svg,b),c.appendChild(b)):(e="gfx_clip"+ ++H,this.rawNode.setAttribute("clip-path","url(#"+e+")"),c=
l(d.xmlns.svg,"clipPath"),b=l(d.xmlns.svg,b),c.appendChild(b),this.rawNode.parentNode.insertBefore(c,this.rawNode),w.set(c,"id",e)),w.set(b,a)):(this.rawNode.removeAttribute("clip-path"),c&&c.parentNode.removeChild(c));return this},_removeClipNode:function(){var a,b=w.get(this.rawNode,"clip-path");b&&(a=r.byId(b.match(/gfx_clip[\d]+/)[0]))&&a.parentNode.removeChild(a);return a}});d.Group=k("dojox.gfx.svg.Group",d.Shape,{constructor:function(){h.Container._init.call(this)},setRawNode:function(a){this.rawNode=
a;this.rawNode.__gfxObject__=this},destroy:function(){this.clear(!0);d.Shape.prototype.destroy.apply(this,arguments)}});d.Group.nodeType="g";d.Rect=k("dojox.gfx.svg.Rect",[d.Shape,h.Rect],{setShape:function(a){this.shape=g.makeParameters(this.shape,a);this.bbox=null;for(var b in this.shape)if("type"!=b&&"r"!=b){a=this.shape[b];if("width"===b||"height"===b)a=0>a?0:a;this.rawNode.setAttribute(b,a)}null!=this.shape.r&&(this.rawNode.setAttribute("ry",this.shape.r),this.rawNode.setAttribute("rx",this.shape.r));
return this}});d.Rect.nodeType="rect";d.Ellipse=k("dojox.gfx.svg.Ellipse",[d.Shape,h.Ellipse],{});d.Ellipse.nodeType="ellipse";d.Circle=k("dojox.gfx.svg.Circle",[d.Shape,h.Circle],{});d.Circle.nodeType="circle";d.Line=k("dojox.gfx.svg.Line",[d.Shape,h.Line],{});d.Line.nodeType="line";d.Polyline=k("dojox.gfx.svg.Polyline",[d.Shape,h.Polyline],{setShape:function(a,b){a&&a instanceof Array?(this.shape=g.makeParameters(this.shape,{points:a}),b&&this.shape.points.length&&this.shape.points.push(this.shape.points[0])):
this.shape=g.makeParameters(this.shape,a);this.bbox=null;this._normalizePoints();for(var c=[],e=this.shape.points,f=0;f<e.length;++f)c.push(e[f].x.toFixed(8),e[f].y.toFixed(8));this.rawNode.setAttribute("points",c.join(" "));return this}});d.Polyline.nodeType="polyline";d.Image=k("dojox.gfx.svg.Image",[d.Shape,h.Image],{setShape:function(a){this.shape=g.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;for(var b in this.shape)if("type"!=b&&"src"!=b){var c=this.shape[b];if("width"===b||"height"===
b)c=0>c?0:c;a.setAttribute(b,c)}a.setAttribute("preserveAspectRatio","none");y(a,d.xmlns.xlink,"xlink:href",this.shape.src);a.__gfxObject__=this;return this}});d.Image.nodeType="image";d.Text=k("dojox.gfx.svg.Text",[d.Shape,h.Text],{setShape:function(a){this.shape=g.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;var b=this.shape;a.setAttribute("x",b.x);a.setAttribute("y",b.y);a.setAttribute("text-anchor",b.align);a.setAttribute("text-decoration",b.decoration);a.setAttribute("rotate",b.rotated?
90:0);a.setAttribute("kerning",b.kerning?"auto":0);a.setAttribute("text-rendering",G);a.firstChild?a.firstChild.nodeValue=b.text:a.appendChild(z(b.text));return this},getTextWidth:function(){var a=this.rawNode,b=a.parentNode;a=a.cloneNode(!0);a.style.visibility="hidden";var c=0,e=a.firstChild.nodeValue;b.appendChild(a);if(""!=e)for(;!c;)c=a.getBBox?parseInt(a.getBBox().width):68;b.removeChild(a);return c},getBoundingBox:function(){var a=null;if(this.getShape().text)try{a=this.rawNode.getBBox()}catch(b){a=
{x:0,y:0,width:0,height:0}}return a}});d.Text.nodeType="text";d.Path=k("dojox.gfx.svg.Path",[d.Shape,v.Path],{_updateWithSegment:function(a){this.inherited(arguments);"string"==typeof this.shape.path&&this.rawNode.setAttribute("d",this.shape.path)},setShape:function(a){this.inherited(arguments);this.shape.path?this.rawNode.setAttribute("d",this.shape.path):this.rawNode.removeAttribute("d");return this}});d.Path.nodeType="path";d.TextPath=k("dojox.gfx.svg.TextPath",[d.Shape,v.TextPath],{_updateWithSegment:function(a){this.inherited(arguments);
this._setTextPath()},setShape:function(a){this.inherited(arguments);this._setTextPath();return this},_setTextPath:function(){if("string"==typeof this.shape.path){var a=this.rawNode;if(!a.firstChild){var b=l(d.xmlns.svg,"textPath"),c=z("");b.appendChild(c);a.appendChild(b)}b=(b=a.firstChild.getAttributeNS(d.xmlns.xlink,"href"))&&d.getRef(b);if(!b&&(c=this._getParentSurface())){c=c.defNode;b=l(d.xmlns.svg,"path");var e=g._base._getUniqueId();b.setAttribute("id",e);c.appendChild(b);y(a.firstChild,d.xmlns.xlink,
"xlink:href","#"+e)}b&&b.setAttribute("d",this.shape.path)}},_setText:function(){var a=this.rawNode;if(!a.firstChild){var b=l(d.xmlns.svg,"textPath"),c=z("");b.appendChild(c);a.appendChild(b)}a=a.firstChild;b=this.text;a.setAttribute("alignment-baseline","middle");switch(b.align){case "middle":a.setAttribute("text-anchor","middle");a.setAttribute("startOffset","50%");break;case "end":a.setAttribute("text-anchor","end");a.setAttribute("startOffset","100%");break;default:a.setAttribute("text-anchor",
"start"),a.setAttribute("startOffset","0%")}a.setAttribute("baseline-shift","0.5ex");a.setAttribute("text-decoration",b.decoration);a.setAttribute("rotate",b.rotated?90:0);a.setAttribute("kerning",b.kerning?"auto":0);a.firstChild.data=b.text}});d.TextPath.nodeType="text";var I=534<function(){var a=/WebKit\/(\d*)/.exec(E);return a?a[1]:0}();d.Surface=k("dojox.gfx.svg.Surface",h.Surface,{constructor:function(){h.Container._init.call(this)},destroy:function(){h.Container.clear.call(this,!0);this.defNode=
null;this.inherited(arguments)},setDimensions:function(a,b){if(!this.rawNode)return this;var c=0>a?0:a,e=0>b?0:b;this.rawNode.setAttribute("width",c);this.rawNode.setAttribute("height",e);I&&(this.rawNode.style.width=c,this.rawNode.style.height=e);return this},getDimensions:function(){return this.rawNode?{width:g.normalizedLength(this.rawNode.getAttribute("width")),height:g.normalizedLength(this.rawNode.getAttribute("height"))}:null}});d.createSurface=function(a,b,c){var e=new d.Surface;e.rawNode=
l(d.xmlns.svg,"svg");e.rawNode.setAttribute("overflow","hidden");b&&e.rawNode.setAttribute("width",0>b?0:b);c&&e.rawNode.setAttribute("height",0>c?0:c);b=l(d.xmlns.svg,"defs");e.rawNode.appendChild(b);e.defNode=b;e._parent=r.byId(a);e._parent.appendChild(e.rawNode);g._base._fixMsTouchAction(e);return e};p={_setFont:function(){var a=this.fontStyle;this.rawNode.setAttribute("font-style",a.style);this.rawNode.setAttribute("font-variant",a.variant);this.rawNode.setAttribute("font-weight",a.weight);this.rawNode.setAttribute("font-size",
a.size);this.rawNode.setAttribute("font-family",a.family)}};var u=h.Container;k=d.Container={openBatch:function(){if(!this._batch){var a=d.useSvgWeb?q.doc.createDocumentFragment(!0):q.doc.createDocumentFragment();this.fragment=a}++this._batch;return this},closeBatch:function(){this._batch=0<this._batch?--this._batch:0;this.fragment&&!this._batch&&(this.rawNode.appendChild(this.fragment),delete this.fragment);return this},add:function(a){this!=a.getParent()&&(this.fragment?this.fragment.appendChild(a.rawNode):
this.rawNode.appendChild(a.rawNode),u.add.apply(this,arguments),a.setClip(a.clip));return this},remove:function(a,b){this==a.getParent()&&(this.rawNode==a.rawNode.parentNode&&this.rawNode.removeChild(a.rawNode),this.fragment&&this.fragment==a.rawNode.parentNode&&this.fragment.removeChild(a.rawNode),a._removeClipNode(),u.remove.apply(this,arguments));return this},clear:function(){for(var a=this.rawNode;a.lastChild;)a.removeChild(a.lastChild);var b=this.defNode;if(b){for(;b.lastChild;)b.removeChild(b.lastChild);
a.appendChild(b)}return u.clear.apply(this,arguments)},getBoundingBox:u.getBoundingBox,_moveChildToFront:u._moveChildToFront,_moveChildToBack:u._moveChildToBack};v=d.Creator={createObject:function(a,b){if(!this.rawNode)return null;var c=new a,e=l(d.xmlns.svg,a.nodeType);c.setRawNode(e);c.setShape(b);this.add(c);return c}};m.extend(d.Text,p);m.extend(d.TextPath,p);m.extend(d.Group,k);m.extend(d.Group,h.Creator);m.extend(d.Group,v);m.extend(d.Surface,k);m.extend(d.Surface,h.Creator);m.extend(d.Surface,
v);d.fixTarget=function(a,b){a.gfxTarget||(a.gfxTarget=F&&a.target.wholeText?a.target.parentElement.__gfxObject__:a.target.__gfxObject__);return!0};d.useSvgWeb&&(d.createSurface=function(a,b,c){var e=new d.Surface;b=0>b?0:b;c=0>c?0:c;if(!b||!c){var f=C.position(a);b=b||f.w;c=c||f.h}a=r.byId(a);f=a.id?a.id+"_svgweb":g._base._getUniqueId();var n=l(d.xmlns.svg,"svg");n.id=f;n.setAttribute("width",b);n.setAttribute("height",c);svgweb.appendChild(n,a);n.addEventListener("SVGLoad",function(){e.rawNode=
this;e.isLoaded=!0;var t=l(d.xmlns.svg,"defs");e.rawNode.appendChild(t);e.defNode=t;if(e.onLoad)e.onLoad(e)},!1);e.isLoaded=!1;return e},d.Surface.extend({destroy:function(){var a=this.rawNode;svgweb.removeChild(a,a.parentNode)}}),p={connect:function(a,b,c){"on"===a.substring(0,2)&&(a=a.substring(2));c=2==arguments.length?b:m.hitch(b,c);this.getEventSource().addEventListener(a,c,!1);return[this,a,c]},disconnect:function(a){this.getEventSource().removeEventListener(a[1],a[2],!1);delete a[0]}},m.extend(d.Shape,
p),m.extend(d.Surface,p));return d});