//>>built
define("dojox/gfx/silverlight","dojo/_base/kernel dojo/_base/lang dojo/_base/declare dojo/_base/Color dojo/on dojo/_base/array dojo/dom-geometry dojo/dom dojo/_base/sniff ./_base ./shape ./path ./registry".split(" "),function(q,m,n,F,G,v,w,u,x,g,l,y){function z(a){var b=g.normalizeColor(a);a=b.toHex();b=Math.round(255*b.a);b=(0>b?0:255<b?255:b).toString(16);return"#"+(2>b.length?"0"+b:b)+a.slice(1)}function p(a,b){var c={target:a,currentTarget:a,preventDefault:function(){},stopPropagation:function(){}};
try{b.source&&(c.target=b.source,c.gfxTarget=l.byId(c.target.tag))}catch(k){}if(b)try{c.ctrlKey=b.ctrl;c.shiftKey=b.shift;var d=b.getPosition(null);c.x=c.offsetX=c.layerX=d.x;c.y=c.offsetY=c.layerY=d.y;var e=t[a.getHost().content.root.name],h=w.position(e);c.clientX=h.x+d.x;c.clientY=h.y+d.y}catch(k){}return c}function A(a,b){var c={keyCode:b.platformKeyCode,ctrlKey:b.ctrl,shiftKey:b.shift};try{b.source&&(c.target=b.source,c.gfxTarget=l.byId(c.target.tag))}catch(d){}return c}var f=g.silverlight={};
q.experimental("dojox.gfx.silverlight");var B={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]},C={normal:400,bold:700},H={butt:"Flat",round:"Round",square:"Square"},I={bevel:"Bevel",round:"Round"},D={serif:"Times New Roman",times:"Times New Roman","sans-serif":"Arial",helvetica:"Arial",monotone:"Courier New",courier:"Courier New"};f.Shape=n("dojox.gfx.silverlight.Shape",
l.Shape,{destroy:function(){x("gfxRegistry")&&l.dispose(this);this.rawNode=null},setFill:function(a){var b=this.rawNode.getHost().content;if(!a)return this.fillStyle=null,this._setFillAttr(null),this;if("object"==typeof a&&"type"in a){switch(a.type){case "linear":this.fillStyle=a=g.makeParameters(g.defaultLinearGradient,a);var c=b.createFromXaml("\x3cLinearGradientBrush/\x3e");c.mappingMode="Absolute";c.startPoint=a.x1+","+a.y1;c.endPoint=a.x2+","+a.y2;v.forEach(a.colors,function(h){var k=b.createFromXaml("\x3cGradientStop/\x3e");
k.offset=h.offset;k.color=z(h.color);c.gradientStops.add(k)});this._setFillAttr(c);break;case "radial":this.fillStyle=a=g.makeParameters(g.defaultRadialGradient,a);var d=b.createFromXaml("\x3cRadialGradientBrush/\x3e"),e=g.matrix.multiplyPoint(g.matrix.invert(this._getAdjustedMatrix()),a.cx,a.cy);e=e.x+","+e.y;d.mappingMode="Absolute";d.gradientOrigin=e;d.center=e;d.radiusX=d.radiusY=a.r;v.forEach(a.colors,function(h){var k=b.createFromXaml("\x3cGradientStop/\x3e");k.offset=h.offset;k.color=z(h.color);
d.gradientStops.add(k)});this._setFillAttr(d);break;case "pattern":this.fillStyle=null,this._setFillAttr(null)}return this}this.fillStyle=a=g.normalizeColor(a);e=b.createFromXaml("\x3cSolidColorBrush/\x3e");e.color=a.toHex();e.opacity=a.a;this._setFillAttr(e);return this},_setFillAttr:function(a){this.rawNode.fill=a},setStroke:function(a){var b=this.rawNode.getHost().content,c=this.rawNode;if(!a)return this.strokeStyle=null,c.stroke=null,this;if("string"==typeof a||m.isArray(a)||a instanceof F)a=
{color:a};a=this.strokeStyle=g.makeParameters(g.defaultStroke,a);a.color=g.normalizeColor(a.color);if(a)if(b=b.createFromXaml("\x3cSolidColorBrush/\x3e"),b.color=a.color.toHex(),b.opacity=a.color.a,c.stroke=b,c.strokeThickness=a.width,c.strokeStartLineCap=c.strokeEndLineCap=c.strokeDashCap=H[a.cap],"number"==typeof a.join?(c.strokeLineJoin="Miter",c.strokeMiterLimit=a.join):c.strokeLineJoin=I[a.join],b=a.style.toLowerCase(),b in B&&(b=B[b]),b instanceof Array){b=m.clone(b);if("butt"!=a.cap){for(a=
0;a<b.length;a+=2)--b[a],1>b[a]&&(b[a]=1);for(a=1;a<b.length;a+=2)++b[a]}c.strokeDashArray=b.join(",")}else c.strokeDashArray=null;return this},_getParentSurface:function(){for(var a=this.parent;a&&!(a instanceof g.Surface);a=a.parent);return a},_applyTransform:function(){var a=this._getAdjustedMatrix(),b=this.rawNode;if(a){var c=this.rawNode.getHost().content,d=c.createFromXaml("\x3cMatrixTransform/\x3e");c=c.createFromXaml("\x3cMatrix/\x3e");c.m11=a.xx;c.m21=a.xy;c.m12=a.yx;c.m22=a.yy;c.offsetX=
a.dx;c.offsetY=a.dy;d.matrix=c;b.renderTransform=d}else b.renderTransform=null;return this},setRawNode:function(a){a.fill=null;a.stroke=null;this.rawNode=a;this.rawNode.tag=this.getUID()},_moveToFront:function(){var a=this.parent.rawNode.children,b=this.rawNode;a.remove(b);a.add(b);return this},_moveToBack:function(){var a=this.parent.rawNode.children,b=this.rawNode;a.remove(b);a.insert(0,b);return this},_getAdjustedMatrix:function(){return this.matrix},setClip:function(a){this.inherited(arguments);
var b=this.rawNode;if(a){var c=a?"width"in a?"rect":"cx"in a?"ellipse":"points"in a?"polyline":"d"in a?"path":null:null;if(a&&!c)return this;var d=this.getBoundingBox()||{x:0,y:0,width:0,height:0},e="1,0,0,1,"+-d.x+","+-d.y;switch(c){case "rect":b.clip=b.getHost().content.createFromXaml("\x3cRectangleGeometry/\x3e");b.clip.rect=a.x+","+a.y+","+a.width+","+a.height;b.clip.transform=e;break;case "ellipse":b.clip=b.getHost().content.createFromXaml("\x3cEllipseGeometry/\x3e");b.clip.center=a.cx+","+a.cy;
b.clip.radiusX=a.rx;b.clip.radiusY=a.ry;b.clip.transform="1,0,0,1,"+-d.x+","+-d.y;break;case "polyline":if(2<a.points.length){e=b.getHost().content.createFromXaml("\x3cPathGeometry/\x3e");var h=b.getHost().content.createFromXaml("\x3cPathFigure/\x3e");h.StartPoint=a.points[0]+","+a.points[1];for(var k=2;k<=a.points.length-2;k+=2)c=b.getHost().content.createFromXaml("\x3cLineSegment/\x3e"),c.Point=a.points[k]+","+a.points[k+1],h.segments.add(c);e.figures.add(h);e.transform="1,0,0,1,"+-d.x+","+-d.y;
b.clip=e}}}else b.clip=null;return this}});f.Group=n("dojox.gfx.silverlight.Group",f.Shape,{constructor:function(){l.Container._init.call(this)},setRawNode:function(a){this.rawNode=a;this.rawNode.tag=this.getUID()},destroy:function(){this.clear(!0);f.Shape.prototype.destroy.apply(this,arguments)}});f.Group.nodeType="Canvas";f.Rect=n("dojox.gfx.silverlight.Rect",[f.Shape,l.Rect],{setShape:function(a){this.shape=g.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;var b=this.shape;a.width=b.width;
a.height=b.height;a.radiusX=a.radiusY=b.r;return this._applyTransform()},_getAdjustedMatrix:function(){var a=this.matrix,b=this.shape;b={dx:b.x,dy:b.y};return new g.Matrix2D(a?[a,b]:b)}});f.Rect.nodeType="Rectangle";f.Ellipse=n("dojox.gfx.silverlight.Ellipse",[f.Shape,l.Ellipse],{setShape:function(a){this.shape=g.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;var b=this.shape;a.width=2*b.rx;a.height=2*b.ry;return this._applyTransform()},_getAdjustedMatrix:function(){var a=this.matrix,
b=this.shape;b={dx:b.cx-b.rx,dy:b.cy-b.ry};return new g.Matrix2D(a?[a,b]:b)}});f.Ellipse.nodeType="Ellipse";f.Circle=n("dojox.gfx.silverlight.Circle",[f.Shape,l.Circle],{setShape:function(a){this.shape=g.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;a.width=a.height=2*this.shape.r;return this._applyTransform()},_getAdjustedMatrix:function(){var a=this.matrix,b=this.shape;b={dx:b.cx-b.r,dy:b.cy-b.r};return new g.Matrix2D(a?[a,b]:b)}});f.Circle.nodeType="Ellipse";f.Line=n("dojox.gfx.silverlight.Line",
[f.Shape,l.Line],{setShape:function(a){this.shape=g.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;var b=this.shape;a.x1=b.x1;a.y1=b.y1;a.x2=b.x2;a.y2=b.y2;return this}});f.Line.nodeType="Line";f.Polyline=n("dojox.gfx.silverlight.Polyline",[f.Shape,l.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=this.shape.points,d=[],e=0;e<c.length;++e)d.push(c[e].x,c[e].y);this.rawNode.points=d.join(",");return this}});f.Polyline.nodeType="Polyline";f.Image=n("dojox.gfx.silverlight.Image",[f.Shape,l.Image],{setShape:function(a){this.shape=g.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;var b=this.shape;a.width=b.width;a.height=b.height;a.source=b.src;return this._applyTransform()},_getAdjustedMatrix:function(){var a=this.matrix,b=this.shape;b={dx:b.x,dy:b.y};
return new g.Matrix2D(a?[a,b]:b)},setRawNode:function(a){this.rawNode=a;this.rawNode.tag=this.getUID()}});f.Image.nodeType="Image";f.Text=n("dojox.gfx.silverlight.Text",[f.Shape,l.Text],{setShape:function(a){this.shape=g.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;var b=this.shape;a.text=""+b.text;a.textDecorations="underline"===b.decoration?"Underline":"None";a["Canvas.Left"]=-1E4;a["Canvas.Top"]=-1E4;this._delay||(this._delay=window.setTimeout(m.hitch(this,"_delayAlignment"),10));
return this},_delayAlignment:function(){var a=this.rawNode,b=this.shape;try{var c=a.actualWidth;var d=a.actualHeight}catch(h){return}var e=b.x;d=b.y-.75*d;switch(b.align){case "middle":e-=c/2;break;case "end":e-=c}this._delta={dx:e,dy:d};a["Canvas.Left"]=0;a["Canvas.Top"]=0;this._applyTransform();delete this._delay},_getAdjustedMatrix:function(){var a=this.matrix,b=this._delta;return new g.Matrix2D(a?b?[a,b]:a:b?b:{})},setStroke:function(){return this},_setFillAttr:function(a){this.rawNode.foreground=
a},setRawNode:function(a){this.rawNode=a;this.rawNode.tag=this.getUID()},getTextWidth:function(){return this.rawNode.actualWidth},getBoundingBox:function(){var a=null,b=this.getShape().text,c=this.rawNode,d=0,e=0;if(!g._base._isRendered(this))return{x:0,y:0,width:0,height:0};if(b){try{d=c.actualWidth,e=c.actualHeight}catch(h){return null}a=g._base._computeTextLocation(this.getShape(),d,e,!0);a={x:a.x,y:a.y,width:d,height:e}}return a}});f.Text.nodeType="TextBlock";f.Path=n("dojox.gfx.silverlight.Path",
[f.Shape,y.Path],{_updateWithSegment:function(a){this.inherited(arguments);var b=this.shape.path;"string"==typeof b&&(this.rawNode.data=b?b:null)},setShape:function(a){this.inherited(arguments);var b=this.shape.path;this.rawNode.data=b?b:null;return this}});f.Path.nodeType="Path";f.TextPath=n("dojox.gfx.silverlight.TextPath",[f.Shape,y.TextPath],{_updateWithSegment:function(a){},setShape:function(a){},_setText:function(){}});f.TextPath.nodeType="text";var t={},J=function(){};f.Surface=n("dojox.gfx.silverlight.Surface",
l.Surface,{constructor:function(){l.Container._init.call(this)},destroy:function(){this.clear(!0);window[this._onLoadName]=J;delete t[this._nodeName];this.inherited(arguments)},setDimensions:function(a,b){this.width=g.normalizedLength(a);this.height=g.normalizedLength(b);var c=this.rawNode&&this.rawNode.getHost();c&&(c.width=a,c.height=b);return this},getDimensions:function(){var a=this.rawNode&&this.rawNode.getHost();a=a?{width:a.content.actualWidth,height:a.content.actualHeight}:null;0>=a.width&&
(a.width=this.width);0>=a.height&&(a.height=this.height);return a}});f.createSurface=function(a,b,c){if(!b&&!c){var d=w.position(a);b=b||d.w;c=c||d.h}"number"==typeof b&&(b+="px");"number"==typeof c&&(c+="px");var e=new f.Surface;a=u.byId(a);e._parent=a;e._nodeName=g._base._getUniqueId();d=a.ownerDocument.createElement("script");d.type="text/xaml";d.id=g._base._getUniqueId();d.text="\x3c?xml version\x3d'1.0'?\x3e\x3cCanvas xmlns\x3d'http://schemas.microsoft.com/client/2007' Name\x3d'"+e._nodeName+
"'/\x3e";a.parentNode.insertBefore(d,a);e._nodes.push(d);var h=g._base._getUniqueId(),k="__"+g._base._getUniqueId()+"_onLoad";e._onLoadName=k;window[k]=function(K){e.rawNode||(e.rawNode=u.byId(h,a.ownerDocument).content.root,t[e._nodeName]=a,e.onLoad(e))};d=x("safari")?"\x3cembed type\x3d'application/x-silverlight' id\x3d'"+h+"' width\x3d'"+b+"' height\x3d'"+c+" background\x3d'transparent' source\x3d'#"+d.id+"' windowless\x3d'true' maxFramerate\x3d'60' onLoad\x3d'"+k+"' onError\x3d'__dojoSilverlightError' /\x3e\x3ciframe style\x3d'visibility:hidden;height:0;width:0'/\x3e":
"\x3cobject type\x3d'application/x-silverlight' data\x3d'data:application/x-silverlight,' id\x3d'"+h+"' width\x3d'"+b+"' height\x3d'"+c+"'\x3e\x3cparam name\x3d'background' value\x3d'transparent' /\x3e\x3cparam name\x3d'source' value\x3d'#"+d.id+"' /\x3e\x3cparam name\x3d'windowless' value\x3d'true' /\x3e\x3cparam name\x3d'maxFramerate' value\x3d'60' /\x3e\x3cparam name\x3d'onLoad' value\x3d'"+k+"' /\x3e\x3cparam name\x3d'onError' value\x3d'__dojoSilverlightError' /\x3e\x3c/object\x3e";a.innerHTML=
d;d=u.byId(h,a.ownerDocument);d.content&&d.content.root?(e.rawNode=d.content.root,t[e._nodeName]=a):(e.rawNode=null,e.isLoaded=!1);e._nodes.push(d);e.width=g.normalizedLength(b);e.height=g.normalizedLength(c);return e};__dojoSilverlightError=function(a,b){};var r=l.Container;q={add:function(a){this!=a.getParent()&&(r.add.apply(this,arguments),this.rawNode.children.add(a.rawNode));return this},remove:function(a,b){if(this==a.getParent()){var c=a.rawNode.getParent();c&&c.children.remove(a.rawNode);
r.remove.apply(this,arguments)}return this},clear:function(){this.rawNode.children.clear();return r.clear.apply(this,arguments)},getBoundingBox:r.getBoundingBox,_moveChildToFront:r._moveChildToFront,_moveChildToBack:r._moveChildToBack};n={createObject:function(a,b){if(!this.rawNode)return null;var c=new a,d=this.rawNode.getHost().content.createFromXaml("\x3c"+a.nodeType+"/\x3e");c.setRawNode(d);c.setShape(b);this.add(c);return c}};m.extend(f.Text,{_setFont:function(){var a=this.fontStyle,b=this.rawNode,
c=a.family.toLowerCase();b.fontStyle="italic"==a.style?"Italic":"Normal";b.fontWeight=a.weight in C?C[a.weight]:a.weight;b.fontSize=g.normalizedLength(a.size);b.fontFamily=c in D?D[c]:a.family;this._delay||(this._delay=window.setTimeout(m.hitch(this,"_delayAlignment"),10))}});m.extend(f.Group,q);m.extend(f.Group,l.Creator);m.extend(f.Group,n);m.extend(f.Surface,q);m.extend(f.Surface,l.Creator);m.extend(f.Surface,n);var E={onclick:{name:"MouseLeftButtonUp",fix:p},onmouseenter:{name:"MouseEnter",fix:p},
onmouseleave:{name:"MouseLeave",fix:p},onmouseover:{name:"MouseEnter",fix:p},onmouseout:{name:"MouseLeave",fix:p},onmousedown:{name:"MouseLeftButtonDown",fix:p},onmouseup:{name:"MouseLeftButtonUp",fix:p},onmousemove:{name:"MouseMove",fix:p},onkeydown:{name:"KeyDown",fix:A},onkeyup:{name:"KeyUp",fix:A}};q={connect:function(a,b,c){return this.on(a,c?m.hitch(b,c):b)},on:function(a,b){if("string"===typeof a){0===a.indexOf("mouse")&&(a="on"+a);var c=a in E?E[a]:{name:a,fix:function(){return{}}};var d=
this.getEventSource().addEventListener(c.name,function(e,h){b(c.fix(e,h))});return{name:c.name,token:d,remove:m.hitch(this,function(){this.getEventSource().removeEventListener(c.name,d)})}}return G(this,a,b)},disconnect:function(a){return a.remove()}};m.extend(f.Shape,q);m.extend(f.Surface,q);g.equalSources=function(a,b){return a&&b&&a.equals(b)};return f});