diff --git a/editor/lib/touch.js b/editor/lib/touch.js index 7db1544..b18237e 100644 --- a/editor/lib/touch.js +++ b/editor/lib/touch.js @@ -1,28 +1,32 @@ -function touchHandler(event) -{ - - var touches = event.changedTouches, - first = touches[0], - type = ""; - switch(event.type) - { - case "touchstart": type="mousedown"; break; - case "touchmove": type="mousemove"; break; - case "touchend": type="mouseup"; break; - default: return; - } +(function() { - //initMouseEvent(type, canBubble, cancelable, view, clickCount, - // screenX, screenY, clientX, clientY, ctrlKey, - // altKey, shiftKey, metaKey, button, relatedTarget); - - var simulatedEvent = document.createEvent("MouseEvent"); - simulatedEvent.initMouseEvent(type, true, true, window, 1, - first.screenX, first.screenY, - first.clientX, first.clientY, false, - false, false, false, 0/*left*/, null); - if(touches.length < 2) { - first.target.dispatchEvent(simulatedEvent); - event.preventDefault(); - } +document.addEventListener("touchstart", touchHandler, true); +document.addEventListener("touchmove", touchHandler, true); +document.addEventListener("touchend", touchHandler, true); +document.addEventListener("touchcancel", touchHandler, true); + +function touchHandler(event) { + var touches = event.changedTouches, + first = touches[0], + type = ""; + switch(event.type) { + case "touchstart": type="mousedown"; break; + case "touchmove": type="mousemove"; break; + case "touchend": type="mouseup"; break; + default: return; + } + + var simulatedEvent = document.createEvent("MouseEvent"); + simulatedEvent.initMouseEvent( + type, true, true, window, 1, + first.screenX, first.screenY, + first.clientX, first.clientY, false, + false, false, false, 0/*left*/, null + ); + if(touches.length < 2) { + first.target.dispatchEvent(simulatedEvent); + //event.preventDefault(); + } } + +})(); diff --git a/editor/method-draw.compiled.js b/editor/method-draw.compiled.js deleted file mode 100644 index 541d705..0000000 --- a/editor/method-draw.compiled.js +++ /dev/null @@ -1,760 +0,0 @@ -(function(){if(!("SVGPathSeg"in window)){window.SVGPathSeg=function(a,o,e){this.pathSegType=a;this.pathSegTypeAsLetter=o;this._owningPathSegList=e};SVGPathSeg.PATHSEG_UNKNOWN=0;SVGPathSeg.PATHSEG_CLOSEPATH=1;SVGPathSeg.PATHSEG_MOVETO_ABS=2;SVGPathSeg.PATHSEG_MOVETO_REL=3;SVGPathSeg.PATHSEG_LINETO_ABS=4;SVGPathSeg.PATHSEG_LINETO_REL=5;SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS=6;SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL=7;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS=8;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL=9;SVGPathSeg.PATHSEG_ARC_ABS= -10;SVGPathSeg.PATHSEG_ARC_REL=11;SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS=12;SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL=13;SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS=14;SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL=15;SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16;SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18;SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19;SVGPathSeg.prototype._segmentChanged=function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)}; -window.SVGPathSegClosePath=function(a){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CLOSEPATH,"z",a)};SVGPathSegClosePath.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegClosePath.prototype.toString=function(){return"[object SVGPathSegClosePath]"};SVGPathSegClosePath.prototype._asPathString=function(){return this.pathSegTypeAsLetter};SVGPathSegClosePath.prototype.clone=function(){return new SVGPathSegClosePath(undefined)};window.SVGPathSegMovetoAbs=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_MOVETO_ABS, -"M",a);this._x=o;this._y=e};SVGPathSegMovetoAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegMovetoAbs.prototype.toString=function(){return"[object SVGPathSegMovetoAbs]"};SVGPathSegMovetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegMovetoAbs.prototype.clone=function(){return new SVGPathSegMovetoAbs(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegMovetoAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x= -a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegMovetoAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegMovetoRel=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_MOVETO_REL,"m",a);this._x=o;this._y=e};SVGPathSegMovetoRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegMovetoRel.prototype.toString=function(){return"[object SVGPathSegMovetoRel]"};SVGPathSegMovetoRel.prototype._asPathString= -function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegMovetoRel.prototype.clone=function(){return new SVGPathSegMovetoRel(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegMovetoRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegMovetoRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoAbs= -function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_ABS,"L",a);this._x=o;this._y=e};SVGPathSegLinetoAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoAbs.prototype.toString=function(){return"[object SVGPathSegLinetoAbs]"};SVGPathSegLinetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegLinetoAbs.prototype.clone=function(){return new SVGPathSegLinetoAbs(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegLinetoAbs.prototype, -"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegLinetoAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoRel=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_REL,"l",a);this._x=o;this._y=e};SVGPathSegLinetoRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoRel.prototype.toString=function(){return"[object SVGPathSegLinetoRel]"}; -SVGPathSegLinetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegLinetoRel.prototype.clone=function(){return new SVGPathSegLinetoRel(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegLinetoRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegLinetoRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()}, -enumerable:true});window.SVGPathSegCurvetoCubicAbs=function(a,o,e,b,l,s,c){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,"C",a);this._x=o;this._y=e;this._x1=b;this._y1=l;this._x2=s;this._y2=c};SVGPathSegCurvetoCubicAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicAbs]"};SVGPathSegCurvetoCubicAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+ -" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicAbs.prototype.clone=function(){return new SVGPathSegCurvetoCubicAbs(undefined,this._x,this._y,this._x1,this._y1,this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true}); -Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, -"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoCubicRel=function(a,o,e,b,l,s,c){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,"c",a);this._x=o;this._y=e;this._x1=b;this._y1=l;this._x2=s;this._y2=c};SVGPathSegCurvetoCubicRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicRel]"};SVGPathSegCurvetoCubicRel.prototype._asPathString= -function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicRel.prototype.clone=function(){return new SVGPathSegCurvetoCubicRel(undefined,this._x,this._y,this._x1,this._y1,this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y",{get:function(){return this._y}, -set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2= -a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoQuadraticAbs=function(a,o,e,b,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",a);this._x=o;this._y=e;this._x1=b;this._y1=l};SVGPathSegCurvetoQuadraticAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticAbs.prototype.toString= -function(){return"[object SVGPathSegCurvetoQuadraticAbs]"};SVGPathSegCurvetoQuadraticAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y};SVGPathSegCurvetoQuadraticAbs.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticAbs(undefined,this._x,this._y,this._x1,this._y1)};Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true}); -Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true}); -window.SVGPathSegCurvetoQuadraticRel=function(a,o,e,b,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL,"q",a);this._x=o;this._y=e;this._x1=b;this._y1=l};SVGPathSegCurvetoQuadraticRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticRel]"};SVGPathSegCurvetoQuadraticRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}; -SVGPathSegCurvetoQuadraticRel.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticRel(undefined,this._x,this._y,this._x1,this._y1)};Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, -"x1",{get:function(){return this._x1},set:function(a){this._x1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype,"y1",{get:function(){return this._y1},set:function(a){this._y1=a;this._segmentChanged()},enumerable:true});window.SVGPathSegArcAbs=function(a,o,e,b,l,s,c,g){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_ARC_ABS,"A",a);this._x=o;this._y=e;this._r1=b;this._r2=l;this._angle=s;this._largeArcFlag=c;this._sweepFlag=g};SVGPathSegArcAbs.prototype= -Object.create(SVGPathSeg.prototype);SVGPathSegArcAbs.prototype.toString=function(){return"[object SVGPathSegArcAbs]"};SVGPathSegArcAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y};SVGPathSegArcAbs.prototype.clone=function(){return new SVGPathSegArcAbs(undefined,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)};Object.defineProperty(SVGPathSegArcAbs.prototype, -"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"r1",{get:function(){return this._r1},set:function(a){this._r1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"r2",{get:function(){return this._r2},set:function(a){this._r2= -a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(a){this._largeArcFlag=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcAbs.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(a){this._sweepFlag= -a;this._segmentChanged()},enumerable:true});window.SVGPathSegArcRel=function(a,o,e,b,l,s,c,g){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_ARC_REL,"a",a);this._x=o;this._y=e;this._r1=b;this._r2=l;this._angle=s;this._largeArcFlag=c;this._sweepFlag=g};SVGPathSegArcRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegArcRel.prototype.toString=function(){return"[object SVGPathSegArcRel]"};SVGPathSegArcRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+ -this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y};SVGPathSegArcRel.prototype.clone=function(){return new SVGPathSegArcRel(undefined,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)};Object.defineProperty(SVGPathSegArcRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"y",{get:function(){return this._y}, -set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"r1",{get:function(){return this._r1},set:function(a){this._r1=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"r2",{get:function(){return this._r2},set:function(a){this._r2=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle= -a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(a){this._largeArcFlag=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegArcRel.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(a){this._sweepFlag=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoHorizontalAbs=function(a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS, -"H",a);this._x=o};SVGPathSegLinetoHorizontalAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoHorizontalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalAbs]"};SVGPathSegLinetoHorizontalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x};SVGPathSegLinetoHorizontalAbs.prototype.clone=function(){return new SVGPathSegLinetoHorizontalAbs(undefined,this._x)};Object.defineProperty(SVGPathSegLinetoHorizontalAbs.prototype,"x",{get:function(){return this._x}, -set:function(a){this._x=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoHorizontalRel=function(a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL,"h",a);this._x=o};SVGPathSegLinetoHorizontalRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoHorizontalRel.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalRel]"};SVGPathSegLinetoHorizontalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x};SVGPathSegLinetoHorizontalRel.prototype.clone= -function(){return new SVGPathSegLinetoHorizontalRel(undefined,this._x)};Object.defineProperty(SVGPathSegLinetoHorizontalRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoVerticalAbs=function(a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS,"V",a);this._y=o};SVGPathSegLinetoVerticalAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoVerticalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalAbs]"}; -SVGPathSegLinetoVerticalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y};SVGPathSegLinetoVerticalAbs.prototype.clone=function(){return new SVGPathSegLinetoVerticalAbs(undefined,this._y)};Object.defineProperty(SVGPathSegLinetoVerticalAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegLinetoVerticalRel=function(a,o){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL,"v",a); -this._y=o};SVGPathSegLinetoVerticalRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegLinetoVerticalRel.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalRel]"};SVGPathSegLinetoVerticalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y};SVGPathSegLinetoVerticalRel.prototype.clone=function(){return new SVGPathSegLinetoVerticalRel(undefined,this._y)};Object.defineProperty(SVGPathSegLinetoVerticalRel.prototype,"y",{get:function(){return this._y}, -set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoCubicSmoothAbs=function(a,o,e,b,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",a);this._x=o;this._y=e;this._x2=b;this._y2=l};SVGPathSegCurvetoCubicSmoothAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"};SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+ -" "+this._x2+" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicSmoothAbs.prototype.clone=function(){return new SVGPathSegCurvetoCubicSmoothAbs(undefined,this._x,this._y,this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()}, -enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoCubicSmoothRel=function(a,o,e,b,l){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",a);this._x=o; -this._y=e;this._x2=b;this._y2=l};SVGPathSegCurvetoCubicSmoothRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoCubicSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"};SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y};SVGPathSegCurvetoCubicSmoothRel.prototype.clone=function(){return new SVGPathSegCurvetoCubicSmoothRel(undefined,this._x,this._y, -this._x2,this._y2)};Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"x2",{get:function(){return this._x2},set:function(a){this._x2=a;this._segmentChanged()}, -enumerable:true});Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype,"y2",{get:function(){return this._y2},set:function(a){this._y2=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoQuadraticSmoothAbs=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",a);this._x=o;this._y=e};SVGPathSegCurvetoQuadraticSmoothAbs.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"}; -SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype, -"y",{get:function(){return this._y},set:function(a){this._y=a;this._segmentChanged()},enumerable:true});window.SVGPathSegCurvetoQuadraticSmoothRel=function(a,o,e){SVGPathSeg.call(this,SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",a);this._x=o;this._y=e};SVGPathSegCurvetoQuadraticSmoothRel.prototype=Object.create(SVGPathSeg.prototype);SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"};SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString= -function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y};SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone=function(){return new SVGPathSegCurvetoQuadraticSmoothRel(undefined,this._x,this._y)};Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype,"x",{get:function(){return this._x},set:function(a){this._x=a;this._segmentChanged()},enumerable:true});Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype,"y",{get:function(){return this._y},set:function(a){this._y= -a;this._segmentChanged()},enumerable:true});SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new SVGPathSegClosePath(undefined)};SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(a,o){return new SVGPathSegMovetoAbs(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegMovetoRel=function(a,o){return new SVGPathSegMovetoRel(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(a,o){return new SVGPathSegLinetoAbs(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegLinetoRel= -function(a,o){return new SVGPathSegLinetoRel(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(a,o,e,b,l,s){return new SVGPathSegCurvetoCubicAbs(undefined,a,o,e,b,l,s)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(a,o,e,b,l,s){return new SVGPathSegCurvetoCubicRel(undefined,a,o,e,b,l,s)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(a,o,e,b){return new SVGPathSegCurvetoQuadraticAbs(undefined,a,o,e,b)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel= -function(a,o,e,b){return new SVGPathSegCurvetoQuadraticRel(undefined,a,o,e,b)};SVGPathElement.prototype.createSVGPathSegArcAbs=function(a,o,e,b,l,s,c){return new SVGPathSegArcAbs(undefined,a,o,e,b,l,s,c)};SVGPathElement.prototype.createSVGPathSegArcRel=function(a,o,e,b,l,s,c){return new SVGPathSegArcRel(undefined,a,o,e,b,l,s,c)};SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(a){return new SVGPathSegLinetoHorizontalAbs(undefined,a)};SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel= -function(a){return new SVGPathSegLinetoHorizontalRel(undefined,a)};SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(a){return new SVGPathSegLinetoVerticalAbs(undefined,a)};SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(a){return new SVGPathSegLinetoVerticalRel(undefined,a)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(a,o,e,b){return new SVGPathSegCurvetoCubicSmoothAbs(undefined,a,o,e,b)};SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel= -function(a,o,e,b){return new SVGPathSegCurvetoCubicSmoothRel(undefined,a,o,e,b)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(a,o){return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined,a,o)};SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(a,o){return new SVGPathSegCurvetoQuadraticSmoothRel(undefined,a,o)}}if(!("SVGPathSegList"in window)){window.SVGPathSegList=function(a){this._pathElement=a;this._list=this._parsePath(this._pathElement.getAttribute("d")); -this._mutationObserverConfig={attributes:true,attributeFilter:["d"]};this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this));this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)};Object.defineProperty(SVGPathSegList.prototype,"numberOfItems",{get:function(){this._checkPathSynchronizedToList();return this._list.length},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"pathSegList",{get:function(){if(!this._pathSegList)this._pathSegList= -new SVGPathSegList(this);return this._pathSegList},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"normalizedPathSegList",{get:function(){return this.pathSegList},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"animatedPathSegList",{get:function(){return this.pathSegList},enumerable:true});Object.defineProperty(SVGPathElement.prototype,"animatedNormalizedPathSegList",{get:function(){return this.pathSegList},enumerable:true});SVGPathSegList.prototype._checkPathSynchronizedToList= -function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())};SVGPathSegList.prototype._updateListFromPathMutations=function(a){if(this._pathElement){var o=false;a.forEach(function(e){if(e.attributeName=="d")o=true});if(o)this._list=this._parsePath(this._pathElement.getAttribute("d"))}};SVGPathSegList.prototype._writeListToPath=function(){this._pathElementMutationObserver.disconnect();this._pathElement.setAttribute("d",SVGPathSegList._pathSegArrayAsString(this._list)); -this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)};SVGPathSegList.prototype.segmentChanged=function(){this._writeListToPath()};SVGPathSegList.prototype.clear=function(){this._checkPathSynchronizedToList();this._list.forEach(function(a){a._owningPathSegList=null});this._list=[];this._writeListToPath()};SVGPathSegList.prototype.initialize=function(a){this._checkPathSynchronizedToList();this._list=[a];a._owningPathSegList=this;this._writeListToPath();return a}; -SVGPathSegList.prototype._checkValidIndex=function(a){if(isNaN(a)||a<0||a>=this.numberOfItems)throw"INDEX_SIZE_ERR";};SVGPathSegList.prototype.getItem=function(a){this._checkPathSynchronizedToList();this._checkValidIndex(a);return this._list[a]};SVGPathSegList.prototype.insertItemBefore=function(a,o){this._checkPathSynchronizedToList();if(o>this.numberOfItems)o=this.numberOfItems;if(a._owningPathSegList)a=a.clone();this._list.splice(o,0,a);a._owningPathSegList=this;this._writeListToPath();return a}; -SVGPathSegList.prototype.replaceItem=function(a,o){this._checkPathSynchronizedToList();if(a._owningPathSegList)a=a.clone();this._checkValidIndex(o);this._list[o]=a;a._owningPathSegList=this;this._writeListToPath();return a};SVGPathSegList.prototype.removeItem=function(a){this._checkPathSynchronizedToList();this._checkValidIndex(a);var o=this._list[a];this._list.splice(a,1);this._writeListToPath();return o};SVGPathSegList.prototype.appendItem=function(a){this._checkPathSynchronizedToList();if(a._owningPathSegList)a= -a.clone();this._list.push(a);a._owningPathSegList=this;this._writeListToPath();return a};SVGPathSegList._pathSegArrayAsString=function(a){var o="",e=true;a.forEach(function(b){if(e){e=false;o+=b._asPathString()}else o+=" "+b._asPathString()});return o};SVGPathSegList.prototype._parsePath=function(a){if(!a||a.length==0)return[];var o=this,e=function(){this.pathSegList=[]};e.prototype.appendSegment=function(l){this.pathSegList.push(l)};var b=function(l){this._string=l;this._currentIndex=0;this._endIndex= -this._string.length;this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN;this._skipOptionalSpaces()};b.prototype._isCurrentSpace=function(){var l=this._string[this._currentIndex];return l<=" "&&(l==" "||l=="\n"||l=="\t"||l=="\r"||l=="\u000c")};b.prototype._skipOptionalSpaces=function(){for(;this._currentIndex="0"&&l<="9")&&s!=SVGPathSeg.PATHSEG_CLOSEPATH){if(s==SVGPathSeg.PATHSEG_MOVETO_ABS)return SVGPathSeg.PATHSEG_LINETO_ABS;if(s==SVGPathSeg.PATHSEG_MOVETO_REL)return SVGPathSeg.PATHSEG_LINETO_REL;return s}return SVGPathSeg.PATHSEG_UNKNOWN};b.prototype.initialCommandIsMoveTo=function(){if(!this.hasMoreData())return true;var l=this.peekSegmentType();return l==SVGPathSeg.PATHSEG_MOVETO_ABS|| -l==SVGPathSeg.PATHSEG_MOVETO_REL};b.prototype._parseNumber=function(){var l=0,s=0,c=1,g=0,d=1,p=1,w=this._currentIndex;this._skipOptionalSpaces();if(this._currentIndex"9")&&this._string.charAt(this._currentIndex)!= -".")){for(var C=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!=C)for(var v=this._currentIndex-1,L=1;v>=C;){s+=L*(this._string.charAt(v--)-"0");L*=10}if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)> -"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)g+=(this._string.charAt(this._currentIndex++)-"0")*(c*=0.1)}if(this._currentIndex!=w&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";){l*=10;l+=this._string.charAt(this._currentIndex)-"0";this._currentIndex++}}s=s+g;s*=d;if(l)s*=Math.pow(10,p*l);if(w!=this._currentIndex){this._skipOptionalSpacesOrDelimiter(); -return s}}};b.prototype._parseArcFlag=function(){if(!(this._currentIndex>=this._endIndex)){var l=false;l=this._string.charAt(this._currentIndex++);if(l=="0")l=false;else if(l=="1")l=true;else return;this._skipOptionalSpacesOrDelimiter();return l}};b.prototype.parseSegment=function(){var l=this._string[this._currentIndex],s=this._pathSegTypeFromChar(l);if(s==SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand==SVGPathSeg.PATHSEG_UNKNOWN)return null;s=this._nextCommandHelper(l,this._previousCommand); -if(s==SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;this._previousCommand=s;switch(s){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(o,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(o,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(o,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(o,this._parseNumber(), -this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(o,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(o,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(o,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(o,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:this._skipOptionalSpaces(); -return new SVGPathSegClosePath(o);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:l={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(o,l.x,l.y,l.x1,l.y1,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:l={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(o, -l.x,l.y,l.x1,l.y1,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:l={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(o,l.x,l.y,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:l={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(o,l.x,l.y,l.x2,l.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:l={x1:this._parseNumber(), -y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(o,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:l={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(o,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(o,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(o, -this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:l={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(o,l.x,l.y,l.x1,l.y1,l.arcAngle,l.arcLarge,l.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:l={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(), -x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(o,l.x,l.y,l.x1,l.y1,l.arcAngle,l.arcLarge,l.arcSweep);default:throw"Unknown path seg type.";}};e=new e;a=new b(a);if(!a.initialCommandIsMoveTo())return[];for(;a.hasMoreData();){b=a.parseSegment();if(!b)return[];e.appendSegment(b)}return e.pathSegList}}})();function touchHandler(a){var o=a.changedTouches,e=o[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var l=document.createEvent("MouseEvent");l.initMouseEvent(b,true,true,window,1,e.screenX,e.screenY,e.clientX,e.clientY,false,false,false,false,0,null);if(o.length<2){e.target.dispatchEvent(l);a.preventDefault()}};(function(a){function o(e){if(typeof e.data==="string"){var b=e.handler,l=e.data.toLowerCase().split(" ");e.handler=function(s){if(!(this!==s.target&&(/textarea|select/i.test(s.target.nodeName)||s.target.type==="text"))){var c=s.type!=="keypress"&&a.hotkeys.specialKeys[s.which],g=String.fromCharCode(s.which).toLowerCase(),d="",p={};if(s.altKey&&c!=="alt")d+="alt+";if(s.ctrlKey&&c!=="ctrl")d+="ctrl+";if(s.metaKey&&!s.ctrlKey&&c!=="meta")d+="meta+";if(s.shiftKey&&c!=="shift")d+="shift+";if(c)p[d+c]= -true;else{p[d+g]=true;p[d+a.hotkeys.shiftNums[g]]=true;if(d==="shift+")p[a.hotkeys.shiftNums[g]]=true}c=0;for(g=l.length;c","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:o}})})(jQuery);(function(a){var o={},e;a.svgIcons=function(b,l){function s(ka,Z){if(ka!=="ajax"){if(U)return;var da=(Q=X[0].contentDocument)&&Q.getElementById("svg_eof");if(!da&&!(Z&&da)){R++;if(R<50)setTimeout(s,20);else{g();U=true}return}U=true}L=a(Q.firstChild).children();if(l.no_img)setTimeout(function(){H||c()},500);else{da=la+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";J=a(new Image).attr({src:da,width:0,height:0}).appendTo("body").load(function(){c(true)}).error(function(){c()})}} -function c(ka,Z){if(!H){if(l.no_img)ka=false;if(ka){var da=a(document.createElement("div"));da.hide().appendTo("body")}if(Z){var pa=l.fallback_path?l.fallback_path:"";a.each(Z,function(Ia,Ka){a("#"+Ia);var Ba=a(new Image).attr({"class":"svg_icon",src:pa+Ka,width:C,height:v,alt:"icon"});ia(Ba,Ia)})}else for(var oa=L.length,ma=0;ma0&&!ka)xa=e(xa,Ba,true);ta(a(this),xa,Ka)})});if(!Z){ka&&da.remove();X&&X.remove();J&&J.remove()}l.resize&&a.resizeSvgIcons(l.resize);H=true;l.callback&&l.callback(o)}}function g(){if(b.indexOf(".svgz")!=-1){var ka=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ka,l)}else l.fallback&&c(false,l.fallback)} -function d(ka){if(window.btoa)return window.btoa(ka);var Z=Array(Math.floor((ka.length+2)/3)*4),da,pa,oa,ma,na,Ja,Fa=0,Na=0;do{da=ka.charCodeAt(Fa++);pa=ka.charCodeAt(Fa++);oa=ka.charCodeAt(Fa++);ma=da>>2;da=(da&3)<<4|pa>>4;na=(pa&15)<<2|oa>>6;Ja=oa&63;if(isNaN(pa))na=Ja=64;else if(isNaN(oa))Ja=64;Z[Na++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);Z[Na++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(da);Z[Na++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(na); -Z[Na++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ja)}while(Fa-1&&N.indexOf("Chrome/");var la="data:image/svg+xml;charset=utf-8;base64,";if(l.svgz){var X=a('').appendTo("body").hide();try{Q=X[0].contentDocument;X.load(s); -s(0,true)}catch(W){g()}}else{var fa=new DOMParser;a.ajax({url:b,dataType:"string",success:function(ka){if(ka){Q=fa.parseFromString(ka,"text/xml");a(function(){s("ajax")})}else a(g)},error:function(ka){if(window.opera)a(function(){g()});else if(ka.responseText){Q=fa.parseFromString(ka.responseText,"text/xml");Q.childNodes.length||a(g);a(function(){s("ajax")})}else a(g)}})}var ta=function(ka,Z,da,pa){ca&&Z.css("visibility","hidden");if(l.replace){pa&&Z.attr("id",da);(da=ka.attr("class"))&&Z.attr("class", -"svg_icon "+da);ka.replaceWith(Z)}else ka.append(Z);ca&&setTimeout(function(){Z.removeAttr("style")},1)},ia=function(ka,Z){if(l.id_match===undefined||l.id_match!==false)ta(holder,ka,Z,true);o[Z]=ka};e=function(ka,Z){var da=ka.find("defs");if(!da.length)return ka;da=ca?da.find("*").filter(function(){return!!this.id}):da.find("[id]");var pa=ka[0].getElementsByTagName("*"),oa=pa.length;da.each(function(ma){var na=this.id;a(Q).find("#"+na);this.id=ma="x"+na+Z+ma;na="url(#"+na+")";var Ja="url(#"+ma+")"; -for(ma=0;ma=0;jQuery.fn.jGraduate=function(b){var l= -arguments;return this.each(function(){function s(ha,Y,ja,M,P){var ba=P||a("stop",{"stop-color":Y,"stop-opacity":ja,offset:ha},fa);if(P){Y=P.getAttribute("stop-color");ja=P.getAttribute("stop-opacity");ha=P.getAttribute("offset")}else fa.appendChild(ba);if(ja===null)ja=1;P=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+ha*ca)+", 26)"},kb);var Ca= -a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:Y,"fill-opacity":ja,transform:"translate("+(10+ha*ca)+", 26)",stroke:"#000","stroke-width":1.5},kb);$(Ca).mousedown(function(Ma){c(this);Va=cb;U.mousemove(p).mouseup(g);ua=vb.offset();Ma.preventDefault();return false}).data("stop",ba).data("bg",P).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Ma=this,Wa=+ba.getAttribute("stop-opacity")|| -1,Za=ba.getAttribute("stop-color")||1,nb=(parseFloat(Wa)*255).toString(16);nb.length<2;)nb="0"+nb;Y=Za.substr(1)+nb;$("#"+v+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:C.images.clientPath},color:{active:Y,alphaSupport:true}},function(Qa){Za=Qa.val("hex")?"#"+Qa.val("hex"):"none";Wa=Qa.val("a")!==null?Qa.val("a")/256:1;Ma.setAttribute("fill",Za);Ma.setAttribute("fill-opacity",Wa);ba.setAttribute("stop-color", -Za);ba.setAttribute("stop-opacity",Wa);$("div.jGraduate_LightBox").hide();$("#"+v+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+v+"_jGraduate_stopPicker").hide()})});$(fa).find("stop").each(function(){var Ma=$(this);if(+this.getAttribute("offset")>ha){if(!Y){var Wa=this.getAttribute("stop-color"),Za=this.getAttribute("stop-opacity");ba.setAttribute("stop-color",Wa);Ca.setAttribute("fill",Wa);ba.setAttribute("stop-opacity",Za===null?1:Za);Ca.setAttribute("fill-opacity", -Za===null?1:Za)}Ma.before(ba);return false}});M&&c(Ca);return ba}function c(ha){cb&&cb.setAttribute("stroke","#000");ha.setAttribute("stroke","blue");cb=ha;cb.parentNode.appendChild(cb)}function g(){U.unbind("mousemove",p);if(Da.getAttribute("display")!=="none"){Da.setAttribute("display","none");var ha=$(cb),Y=ha.data("stop");ha=ha.data("bg");$([cb,Y,ha]).remove()}Va=null}function d(){var ha=Ra?"rotate("+Ra+","+Ea+","+db+") ":"";$a===1&&Ga===1?fa.removeAttribute("gradientTransform"):fa.setAttribute("gradientTransform", -ha+"translate("+-Ea*($a-1)+","+-db*(Ga-1)+") scale("+$a+","+Ga+")")}function p(ha){var Y=ha.pageX-ua.left;ha=ha.pageY-ua.top;Y=Y<10?10:Y>ca+10?ca+10:Y;var ja="translate("+Y+", 26)";if(ha<-60||ha>130){Da.setAttribute("display","block");Da.setAttribute("transform",ja)}else Da.setAttribute("display","none");Va.setAttribute("transform",ja);$.data(Va,"bg").setAttribute("transform",ja);$.data(Va,"stop").setAttribute("offset",(Y-10)/ca);var M=0;$(fa).find("stop").each(function(){var P=this.getAttribute("offset"), -ba=$(this);if(P
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var R=$(L+"> .jGraduate_colPick"),N=$(L+"> .jGraduate_gradPick");N.html('

    '+C.window.pickerTitle+'


    ');var ca=256,la=ca-0,X=ca-0,W,fa,ta,ia={};$(".jGraduate_SliderBar").width(145);var ka=$("#"+v+"_jGraduate_GradContainer")[0],Z=a("svg",{id:v+"_jgraduate_svg",width:ca,height:ca,xmlns:o.svg},ka);W=W||w.paint.type;var da=fa=w.paint[W],pa=w.paint.alpha,oa=W==="solidColor";switch(W){case "solidColor":case "linearGradient":if(!oa){fa.id=v+"_lg_jgraduate_grad"; -da=fa=Z.appendChild(fa)}a("radialGradient",{id:v+"_rg_jgraduate_grad"},Z);if(W==="linearGradient")break;case "radialGradient":if(!oa){fa.id=v+"_rg_jgraduate_grad";da=fa=Z.appendChild(fa)}a("linearGradient",{id:v+"_lg_jgraduate_grad",x1:0,y1:0,x2:1,y2:0},Z)}if(oa){da=fa=$("#"+v+"_lg_jgraduate_grad")[0];H=w.paint[W];s(0,"#"+H,1);var ma=typeof C.newstop;if(ma==="string")switch(C.newstop){case "same":s(1,"#"+H,1);break;case "inverse":ma="";if(H.length===3)H=H.split("").map(function(ha){return ha+""+ha}).join(""); -for(var na=0;na<6;na+=2){H.substr(na,2);var Ja=(255-parseInt(H.substr(na,2),16)).toString(16);if(Ja.length<2)Ja=0+Ja;ma+=Ja}s(1,"#"+ma,1);break;case "white":s(1,"#ffffff",1);break;case "black":s(1,"#000000",1)}else if(ma==="object")s(1,C.newstop.color||"#"+H,"opac"in C.newstop?C.newstop.opac:1)}H=parseFloat(da.getAttribute("x1")||0);ma=parseFloat(da.getAttribute("y1")||0);na=parseFloat(da.getAttribute("x2")||1);Ja=parseFloat(da.getAttribute("y2")||0);var Fa=parseFloat(da.getAttribute("cx")||0.5), -Na=parseFloat(da.getAttribute("cy")||0.5),Sa=parseFloat(da.getAttribute("fx")||Fa),Ia=parseFloat(da.getAttribute("fy")||Na);ta=a("rect",{id:v+"_jgraduate_rect",x:0,y:0,width:la,height:X,fill:"url(#"+v+"_jgraduate_grad)","fill-opacity":pa/100},Z);var Ka=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ca,left:H*ca}).data("coord","start").appendTo(ka),Ba=Ka.clone().text(2).css({top:Ja*ca,left:na*ca}).attr("title","End stop").data("coord","end").appendTo(ka), -xa=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Na*ca,left:Fa*ca}).data("coord","center").appendTo(ka),ra=xa.clone().text("F").css({top:Ia*ca,left:Sa*ca,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ka);ra[0].id=v+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ha,Y){var ja=fa.getAttribute(Y),M=isNaN(Y[1]);ja||(ja=M?"0.5":Y==="x2"?"1.0":"0.0");ia[Y]=$("#"+v+"_jGraduate_"+ -Y).val(ja).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>1)this.value=1;if(!(Y[0]==="f"&&!eb))if(M&&W==="radialGradient"||!M&&W==="linearGradient")fa.setAttribute(Y,this.value);var P=M?Y[0]==="c"?xa:ra:Y[1]==="1"?Ka:Ba,ba=Y.indexOf("x")>=0?"left":"top";P.css(ba,this.value*ca)}).change()});var wa,kb,vb=$("#"+v+"_jGraduate_StopSlider"),cb,Ta,Va,Da=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"}, -Ta),ua,$a=1,Ga=1,Ra=0,Ea=Fa,db=Na;Ta=a("svg",{width:"100%",height:45},vb[0]);ka=a("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ta);a("image",{width:16,height:16},ka).setAttributeNS(o.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Ta).on("click touchstart",function(ha){ua=vb.offset();if(ha.target.tagName!=="path"){var Y=ha.pageX-ua.left-8;Y=Y<10?10:Y>ca+10?ca+10:Y;s(Y/ca,0,0,true);ha.stopPropagation()}});$(Ta).mouseover(function(){Ta.appendChild(Da)}); -kb=a("g",{},Ta);a("line",{x1:10,y1:15,x2:ca+10,y2:15,"stroke-width":2,stroke:"#000"},Ta);var lb=N.find(".jGraduate_spreadMethod").change(function(){fa.setAttribute("spreadMethod",$(this).val())}),Ua=null,Xa=function(ha){var Y=ha.pageX-hb.left,ja=ha.pageY-hb.top;Y=Y<0?0:Y>ca?ca:Y;ja=ja<0?0:ja>ca?ca:ja;Ua.css("left",Y).css("top",ja);Y=Y/la;ja=ja/X;var M=Ua.data("coord"),P=fa;switch(M){case "start":ia.x1.val(Y);ia.y1.val(ja);P.setAttribute("x1",Y);P.setAttribute("y1",ja);break;case "end":ia.x2.val(Y); -ia.y2.val(ja);P.setAttribute("x2",Y);P.setAttribute("y2",ja);break;case "center":ia.cx.val(Y);ia.cy.val(ja);P.setAttribute("cx",Y);P.setAttribute("cy",ja);Ea=Y;db=ja;d();break;case "focus":ia.fx.val(Y);ia.fy.val(ja);P.setAttribute("fx",Y);P.setAttribute("fy",ja);d()}ha.preventDefault()},wb=function(){Ua=null;U.unbind("mousemove",Xa).unbind("mouseup",wb)};wa=fa.getElementsByTagNameNS(o.svg,"stop");if(sa<2){for(;sa<2;){fa.appendChild(document.createElementNS(o.svg,"stop"));++sa}wa=fa.getElementsByTagNameNS(o.svg, -"stop")}var sa=wa.length;for(na=0;na99.5)M=99.5;if(M>0)Ga=1-M/100;else $a=-(M/100)-1;P=145*((M+100)/2)/100;ba&&d();break;case "angle":Ra=M;P=Ra/180;P+=0.5;P*=145;ba&&d()}if(P>145)P=145;else if(P<0)P=0;ja.css({"margin-left":P-5})}).change()});var ob=function(ha){var Y=ha.pageX-ab.offset.left-parseInt(ab.parent.css("border-left-width"));if(Y>145)Y=145;if(Y<=0)Y=0;var ja=Y-5;Y/=145;switch(ab.type){case "radius":Y=Math.pow(Y*2,2.5);if(Y>0.98&&Y<1.02)Y=1;if(Y<=0.01)Y=0.01;fa.setAttribute("r",Y);break;case "opacity":w.paint.alpha= -parseInt(Y*100);ta.setAttribute("fill-opacity",Y);break;case "ellip":Ga=$a=1;if(Y<0.5){Y/=0.5;$a=Y<=0?0.01:Y}else if(Y>0.5){Y/=0.5;Y=2-Y;Ga=Y<=0?0.01:Y}d();Y-=1;if(Ga===Y+1)Y=Math.abs(Y);break;case "angle":Y-=0.5;Ra=Y*=180;d();Y/=100}ab.elem.css({"margin-left":ja});Y=Math.round(Y*100);ab.input.val(Y);ha.preventDefault()},pb=function(){U.unbind("mousemove",ob).unbind("mouseup",pb);ab=null};for(N=(w.paint.alpha*255/100).toString(16);N.length<2;)N="0"+N;N=N.split(".")[0];H=w.paint.solidColor=="none"? -"":w.paint.solidColor+N;oa||(H=wa[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});R.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:H,alphaSupport:true}},function(ha){w.paint.type="solidColor";w.paint.alpha=ha.val("ahex")?Math.round(ha.val("a")/255*100):100;w.paint.solidColor=ha.val("hex")?ha.val("hex"):"none";w.paint.radialGradient=null;Q()},null,function(){J()});var fb=$(L+ -" .jGraduate_tabs li");fb.on("click touchstart",function(){fb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ha=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ha==="rg"||ha==="lg"){$(".jGraduate_"+ha+"_field").show();$(".jGraduate_"+(ha==="lg"?"rg":"lg")+"_field").hide();$("#"+v+"_jgraduate_rect")[0].setAttribute("fill","url(#"+v+"_"+ha+"_jgraduate_grad)");W=ha==="lg"?"linearGradient":"radialGradient";$("#"+v+"_jGraduate_OpacInput").val(w.paint.alpha).change(); -var Y=$("#"+v+"_"+ha+"_jgraduate_grad")[0];if(fa!==Y){var ja=$(fa).find("stop");$(Y).empty().append(ja);fa=Y;Y=lb.val();fa.setAttribute("spreadMethod",Y)}eb=ha==="rg"&&fa.getAttribute("fx")!=null&&!(Fa==Sa&&Na==Ia);$("#"+v+"_jGraduate_focusCoord").toggle(eb);if(eb)$("#"+v+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();fb.removeClass("jGraduate_tab_current");var tb;switch(w.paint.type){case "linearGradient":tb= -$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":tb=$(L+" .jGraduate_tab_radgrad");break;default:tb=$(L+" .jGraduate_tab_color")}w.show();setTimeout(function(){tb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),o=$(document);$.extend($.fn,{contextMenu:function(e,b){if(e.menu==undefined)return false;if(e.inSpeed==undefined)e.inSpeed=150;if(e.outSpeed==undefined)e.outSpeed=75;if(e.inSpeed==0)e.inSpeed=-1;if(e.outSpeed==0)e.outSpeed=-1;$(this).each(function(){var l=$(this),s=$(l).offset(),c=$("#"+e.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(p){var w=$(this);w.unbind("mouseup");$(".contextMenu").hide();if(d.button===2|| -e.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||g(p,d,w)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var p=$(this);p.unbind("mouseup");g(d,d,p)});var g=function(d,p,w){if(typeof p=="undefined")p=d;d.stopPropagation();if(l.hasClass("disabled")||p.altKey)return false;var C=d.pageX,v=d.pageY;if(svgedit.browser.isTouch()){C=d.originalEvent.touches[0].pageX;v=d.originalEvent.touches[0].pageY}d=a.width()-c.width();p=a.height()-c.height();if(C>d-15)C=d-15; -if(v>p-30)v=p-30;if(svgedit.browser.isTouch())v-=c.height()/2;o.unbind("click");c.css({top:v,left:C}).fadeIn(e.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});o.keypress(function(L){switch(L.keyCode){case 38:if(c.find("LI.hover").length){c.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:last").addClass("hover")}else c.find("LI:last").addClass("hover"); -break;case 40:if(c.find("LI.hover").length==0)c.find("LI:first").addClass("hover");else{c.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:first").addClass("hover")}break;case 13:c.find("LI.hover A").trigger("click");break;case 27:o.trigger("click")}});c.find("A").unbind("mouseup");c.find("LI:not(.disabled) A").mouseup(function(){o.unbind("click").unbind("keypress");$(".contextMenu").hide();b&&b($(this).attr("href").substr(1), -$(w),{x:C-s.left,y:v-s.top,docX:C,docY:v});return false});setTimeout(function(){o.click(function(){o.unbind("click").unbind("keypress");c.fadeOut(e.outSpeed);return false})},0)};$(l).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(e){if(e==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(e!=undefined)for(var b=e.split(","),l=0;l=0,s=o.indexOf("Gecko/")>=0,c=o.indexOf("MSIE")>=0,g=o.indexOf("Chrome/")>=0,d=o.indexOf("Windows")>=0,p=o.indexOf("Macintosh")>= -0,w="ontouchstart"in window,C=!!e.querySelector,v=!!document.evaluate,L=function(){var ca=document.createElementNS("http://www.w3.org/2000/svg","svg"),la=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ca);la.setAttribute("x",5);ca.appendChild(la);var X=document.createElementNS("http://www.w3.org/2000/svg","text");X.textContent="a";la.appendChild(X);la=X.getStartPositionOfChar(0);la=la.x;document.documentElement.removeChild(ca);return la===0}(),Q= -function(){var ca=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ca);var la=document.createElementNS("http://www.w3.org/2000/svg","path");la.setAttribute("d","M0,0 C0,0 10,10 10,0");ca.appendChild(la);la=la.getBBox();document.documentElement.removeChild(ca);return la.height>4&&la.height<5}(),J=function(){var ca=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ca);var la=document.createElementNS("http://www.w3.org/2000/svg", -"path");la.setAttribute("d","M0,0 10,0");var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M5,0 15,0");var W=document.createElementNS("http://www.w3.org/2000/svg","g");W.appendChild(la);W.appendChild(X);ca.appendChild(W);la=W.getBBox();document.documentElement.removeChild(ca);return la.width==15}(),H=function(){var ca=document.createElementNS("http://www.w3.org/2000/svg","rect");ca.setAttribute("x",0.1);(ca=ca.cloneNode(false).getAttribute("x").indexOf(",")== --1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n Please upgrade to the latest version in which the problems have been fixed.");return ca}(),U=function(){var ca=document.createElementNS("http://www.w3.org/2000/svg","rect");ca.setAttribute("style","vector-effect:non-scaling-stroke");return ca.style.vectorEffect==="non-scaling-stroke"}(),R=function(){var ca=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal, -la=e.createSVGTransform();ca.appendItem(la);return ca.getItem(0)==la}(),N=function(){if(typeof Blob!="function")return false;var ca=new Blob([""],{type:"image/svg+xml;charset=utf-8"}),la=new Image;la.onload=function(){svgedit.browser.supportsBlobs=function(){return true}};la.onerror=function(){svgedit.browser.supportsBlobs=function(){return false}};la.src=URL.createObjectURL(ca);return false}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit= -function(){return l};svgedit.browser.isGecko=function(){return s};svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return g};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return p};svgedit.browser.isTouch=function(){return w};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return v};svgedit.browser.supportsPathBBox=function(){return Q};svgedit.browser.supportsHVLineContainerBBox=function(){return J}; -svgedit.browser.supportsGoodTextCharPos=function(){return L};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return H};svgedit.browser.supportsNonScalingStroke=function(){return U};svgedit.browser.supportsNativeTransformLists=function(){return R};svgedit.browser.supportsBlobs=function(){return N}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; -(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),o={};svgedit.transformlist.SVGTransformList=function(e){this._elem=e||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var l=0;l=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,l){var s=null;if(l>=0)if(l=0){this._removeFromOtherLists(b);s=this._xforms[l]=b;this._list._update()}return s};this.removeItem=function(b){if(b=0){for(var l=this._xforms[b],s=Array(this.numberOfItems- -1),c=0;c1;)b=o[e-1].multiply(b);if(Math.abs(b.a)<1.0E-14)b.a=0;if(Math.abs(b.b)<1.0E-14)b.b=0;if(Math.abs(b.c)<1.0E-14)b.c=0;if(Math.abs(b.d)< -1.0E-14)b.d=0;if(Math.abs(b.e)<1.0E-14)b.e=0;if(Math.abs(b.f)<1.0E-14)b.f=0;return b};svgedit.math.hasMatrixTransform=function(o){if(!o)return false;for(var e=o.numberOfItems;e--;){var b=o.getItem(e);if(b.type==1&&!svgedit.math.isIdentity(b.matrix))return true}return false};svgedit.math.transformBox=function(o,e,b,l,s){var c={x:o,y:e},g={x:o+b,y:e};b={x:o+b,y:e+l};o={x:o,y:e+l};e=svgedit.math.transformPoint;c=e(c.x,c.y,s);var d=l=c.x,p=c.y,w=c.y;g=e(g.x,g.y,s);l=Math.min(l,g.x);d=Math.max(d,g.x); -p=Math.min(p,g.y);w=Math.max(w,g.y);o=e(o.x,o.y,s);l=Math.min(l,o.x);d=Math.max(d,o.x);p=Math.min(p,o.y);w=Math.max(w,o.y);b=e(b.x,b.y,s);l=Math.min(l,b.x);d=Math.max(d,b.x);p=Math.min(p,b.y);w=Math.max(w,b.y);return{tl:c,tr:g,bl:o,br:b,aabox:{x:l,y:p,width:d-l,height:w-p}}};svgedit.math.transformListToTransform=function(o,e,b){if(o==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());e=e==undefined?0:e;b=b==undefined?o.numberOfItems-1:b;e=parseInt(e);b=parseInt(b);if(e>b){var l=b;b=e; -e=l}l=a.createSVGMatrix();for(e=e;e<=b;++e){var s=e>=0&&eo.x&&e.yo.y}})();svgedit=svgedit||{}; -(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],o=["y","y1","cy","ry","height"],e=$.merge(["r","radius"],a);$.merge(e,o);var b,l={px:1};svgedit.units.init=function(c){b=c;c=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(c);var g=document.createElementNS("http://www.w3.org/2000/svg","rect");g.setAttribute("width","1em");g.setAttribute("height","1ex");g.setAttribute("x","1in");c.appendChild(g);g=g.getBBox();document.body.removeChild(c); -c=g.x;l.em=g.width;l.ex=g.height;l["in"]=c;l.cm=c/2.54;l.mm=c/25.4;l.pt=c/72;l.pc=c/6;l["%"]=0};svgedit.units.getTypeMap=function(){return l};svgedit.units.shortFloat=function(c){var g=b.getRoundDigits();if(isNaN(c)){if($.isArray(c))return svgedit.units.shortFloat(c[0])+","+svgedit.units.shortFloat(c[1])}else return+(+c).toFixed(g);return parseFloat(c).toFixed(g)-0};svgedit.units.convertUnit=function(c,g){g=g||b.getBaseUnit();return svgedit.unit.shortFloat(c/l[g])};svgedit.units.setUnitAttr=function(c, -g,d){isNaN(d)||c.getAttribute(g);c.setAttribute(g,d)};var s={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(c){var g=c.tagName,d=b.getBaseUnit();if(g=s[g])for(var p=g.length,w=0;w=0?d*p:o.indexOf(c)>=0?d*w:d*Math.sqrt(p*p+w*w)/Math.sqrt(2)}else{p=g.substr(-2);d=g.substr(0,g.length-2);return d*l[p]}};svgedit.units.isValidUnit=function(c,g,d){var p=false;if(e.indexOf(c)>=0)if(isNaN(g)){g=g.toLowerCase();$.each(l,function(v){if(!p)if(RegExp("^-?[\\d\\.]+"+v+"$").test(g))p=true})}else p=true;else if(c=="id"){c=false;try{var w=b.getElement(g); -c=w==null||w===d}catch(C){}return c}else p=true;return p}})();svgedit=svgedit||{}; -(function(){function a(c){if(svgedit.browser.supportsHVLineContainerBBox())try{return c.getBBox()}catch(g){}var d=$.data(c,"ref"),p=null;if(d){var w=$(d).children().clone().attr("visibility","hidden");$(s).append(w);p=w.filter("line, path")}else p=$(c).find("line, path");var C=false;if(p.length){p.each(function(){var v=this.getBBox();if(!v.width||!v.height)C=true});if(C){c=d?w:$(c).children();ret=getStrokedBBox(c)}else ret=c.getBBox()}else ret=c.getBBox();d&&w.remove();return ret}if(!svgedit.utilities)svgedit.utilities= -{};var o="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),e=null,b=null,l=null,s=null;svgedit.utilities.init=function(c){e=c;b=c.getDOMDocument();l=c.getDOMContainer();s=c.getSVGRoot()};svgedit.utilities.toXml=function(c){return $("

    ").text(c).html()};svgedit.utilities.fromXml=function(c){return $("

    ").html(c).text()};svgedit.utilities.encode64=function(c){c=svgedit.utilities.convertToXMLReferences(c);if(window.btoa)return window.btoa(c); -var g=Array(Math.floor((c.length+2)/3)*4),d,p,w,C,v,L,Q=0,J=0;do{d=c.charCodeAt(Q++);p=c.charCodeAt(Q++);w=c.charCodeAt(Q++);C=d>>2;d=(d&3)<<4|p>>4;v=(p&15)<<2|w>>6;L=w&63;if(isNaN(p))v=L=64;else if(isNaN(w))L=64;g[J++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(C);g[J++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);g[J++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(v);g[J++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(Q< -c.length);return g.join("")};svgedit.utilities.decode64=function(c){if(window.atob)return window.atob(c);var g="",d,p,w="",C,v="",L=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++)); -d=d<<2|p>>4;p=(p&15)<<4|C>>2;w=(C&3)<<6|v;g+=String.fromCharCode(d);if(C!=64)g+=String.fromCharCode(p);if(v!=64)g+=String.fromCharCode(w)}while(L127)g+="&#"+p+";"}return g};svgedit.utilities.text2xml=function(c){if(c.indexOf("=0)c=c.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var g;try{var d=window.DOMParser? -new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(p){throw Error("XML Parser could not be instantiated");}try{g=d.loadXML?d.loadXML(c)?d:false:d.parseFromString(c,"text/xml")}catch(w){throw Error("Error parsing XML string");}return g};svgedit.utilities.bboxToObj=function(c){return{x:c.x,y:c.y,width:c.width,height:c.height}};svgedit.utilities.walkTree=function(c,g){if(c&&c.nodeType==1){g(c);for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),g)}}; -svgedit.utilities.walkTreePost=function(c,g){if(c&&c.nodeType==1){for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),g);g(c)}};svgedit.utilities.getUrlFromAttr=function(c){if(c)if(c.indexOf('url("')===0)return c.substring(5,c.indexOf('"',6));else if(c.indexOf("url('")===0)return c.substring(5,c.indexOf("'",6));else if(c.indexOf("url(")===0)return c.substring(4,c.indexOf(")"));return null};svgedit.utilities.getHref=function(c){if(c)return c.getAttributeNS("http://www.w3.org/1999/xlink", -"href")};svgedit.utilities.setHref=function(c,g){c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",g)};svgedit.utilities.findDefs=function(c){c=e.getSVGContent().documentElement;var g=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return g=g.length>0?g[0]:c.insertBefore(c.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),c.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(c){var g=c.pathSegList,d=g.numberOfItems;c=[[],[]];var p=g.getItem(0), -w=[p.x,p.y];for(p=0;p=0){var p=d.split(":");c[p[1]]=o[p[0]]}else c[d]=d=="xmlns"?"http://www.w3.org/2000/xmlns/":null});b[l]=c});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(l){if(l.nodeType==3){l.nodeValue=l.nodeValue.replace(/^\s+|\s+$/g,"");l.nodeValue.length||l.parentNode.removeChild(l)}if(l.nodeType==1){var s=l.parentNode;if(l.ownerDocument&&s){var c=e[l.nodeName],g=b[l.nodeName];if(c!= -undefined){for(var d=[],p=l.attributes.length;p--;){var w=l.attributes.item(p),C=w.nodeName,v=w.localName,L=w.namespaceURI;if(!(g.hasOwnProperty(v)&&L==g[v]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[w.nodeValue])){C.indexOf("se:")==0&&d.push([C,w.nodeValue]);l.removeAttributeNS(L,v)}if(svgedit.browser.isGecko())switch(C){case "transform":case "gradientTransform":case "patternTransform":v=w.nodeValue.replace(/(\d)-/g,"$1 -");l.setAttribute(C,v)}if(C=="style"){w= -w.nodeValue.split(";");for(C=w.length;C--;){v=w[C].split(":");c.indexOf(v[0])>=0&&l.setAttribute(v[0],v[1])}l.removeAttribute("style")}}$.each(d,function(Q,J){l.setAttributeNS("http://svg-edit.googlecode.com",J[0],J[1])});if((p=svgedit.utilities.getHref(l))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(l.nodeName)>=0)if(p[0]!="#"){svgedit.utilities.setHref(l,"");l.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(l.nodeName=="use"&&!svgedit.utilities.getHref(l))s.removeChild(l); -else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(Q,J){var H=l.getAttribute(J);if(H)if((H=svgedit.utilities.getUrlFromAttr(H))&&H[0]!=="#"){l.setAttribute(J,"");l.removeAttribute(J)}});for(p=l.childNodes.length;p--;)svgedit.sanitize.sanitizeSvg(l.childNodes.item(p))}}else{for(c=[];l.hasChildNodes();)c.push(s.insertBefore(l.firstChild,l));s.removeChild(l);for(p=c.length;p--;)svgedit.sanitize.sanitizeSvg(c[p])}}}}})();svgedit=svgedit||{}; -(function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,o,e,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=o;this.oldParent=e;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= -svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, -this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,o){this.elem=a;this.text=o||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type= -svgedit.history.InsertElementCommand.type;svgedit.history.InsertElementCommand.prototype.getText=function(){return this.text};svgedit.history.InsertElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.InsertElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, -this);this.parent=this.elem.parentNode;this.elem=this.elem.parentNode.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.InsertElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.RemoveElementCommand=function(a,o,e,b){this.elem=a;this.text=b||"Delete "+a.tagName;this.nextSibling=o;this.parent=e;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"}; -svgedit.history.RemoveElementCommand.prototype.type=svgedit.history.RemoveElementCommand.type;svgedit.history.RemoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.RemoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.parent=this.elem.parentNode;this.elem=this.parent.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, -this)};svgedit.history.RemoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.nextSibling==null&&window.console&&console.log("Error: reference element was lost");this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.RemoveElementCommand.prototype.elements=function(){return[this.elem]}; -svgedit.history.ChangeElementCommand=function(a,o,e){this.elem=a;this.text=e?"Change "+a.tagName+" "+e:"Change "+a.tagName;this.newValues={};this.oldValues=o;for(var b in o)this.newValues[b]=b=="#text"?a.textContent:b=="#href"?svgedit.utilities.getHref(a):a.getAttribute(b)};svgedit.history.ChangeElementCommand.type=function(){return"svgedit.history.ChangeElementCommand"};svgedit.history.ChangeElementCommand.prototype.type=svgedit.history.ChangeElementCommand.type;svgedit.history.ChangeElementCommand.prototype.getText= -function(){return this.text};svgedit.history.ChangeElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);var o=false,e;for(e in this.newValues){if(this.newValues[e])if(e=="#text")this.elem.textContent=this.newValues[e];else e=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[e]):this.elem.setAttribute(e,this.newValues[e]);else if(e=="#text")this.elem.textContent="";else{this.elem.setAttribute(e,"");this.elem.removeAttribute(e)}if(e== -"transform")o=true}if(!o)if(o=svgedit.utilities.getRotationAngle(this.elem)){e=elem.getBBox();o=["rotate(",o," ",e.x+e.width/2,",",e.y+e.height/2,")"].join("");o!=elem.getAttribute("transform")&&elem.setAttribute("transform",o)}a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);var o=false,e;for(e in this.oldValues){if(this.oldValues[e])if(e== -"#text")this.elem.textContent=this.oldValues[e];else e=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[e]):this.elem.setAttribute(e,this.oldValues[e]);else if(e=="#text")this.elem.textContent="";else this.elem.removeAttribute(e);if(e=="transform")o=true}if(!o)if(o=svgedit.utilities.getRotationAngle(this.elem)){e=this.elem.getBBox();o=["rotate(",o," ",e.x+e.width/2,",",e.y+e.height/2,")"].join("");o!=this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",o)}svgedit.transformlist.removeElementFromListMap(this.elem); -a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.BatchCommand=function(a){this.text=a||"Batch Command";this.stack=[]};svgedit.history.BatchCommand.type=function(){return"svgedit.history.BatchCommand"};svgedit.history.BatchCommand.prototype.type=svgedit.history.BatchCommand.type;svgedit.history.BatchCommand.prototype.getText=function(){return this.text};svgedit.history.BatchCommand.prototype.apply= -function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var o=this.stack.length,e=0;e=0;o--)this.stack[o].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, -this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],o=this.stack.length;o--;)for(var e=this.stack[o].elements(),b=e.length;b--;)a.indexOf(e[b])==-1&&a.push(e[b]);return a};svgedit.history.BatchCommand.prototype.addSubCommand=function(a){this.stack.push(a)};svgedit.history.BatchCommand.prototype.isEmpty=function(){return this.stack.length==0};svgedit.history.UndoManager=function(a){this.handler_=a||null;this.undoStackPointer=0;this.undoStack=[];this.undoChangeStackPointer= --1;this.undoableChangeStack=[]};svgedit.history.UndoManager.prototype.resetUndoStack=function(){this.undoStack=[];this.undoStackPointer=0};svgedit.history.UndoManager.prototype.getUndoStackSize=function(){return this.undoStackPointer};svgedit.history.UndoManager.prototype.getRedoStackSize=function(){return this.undoStack.length-this.undoStackPointer};svgedit.history.UndoManager.prototype.getNextUndoCommandText=function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText(): -""};svgedit.history.UndoManager.prototype.getNextRedoCommandText=function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)};svgedit.history.UndoManager.prototype.redo=function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}; -svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,o){for(var e=++this.undoChangeStackPointer,b=o.length,l=Array(b),s=Array(b);b--;){var c=o[b];if(c!=null){s[b]=c;l[b]=c.getAttribute(a)}}this.undoableChangeStack[e]= -{attrName:a,oldValues:l,elements:s}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,o=this.undoableChangeStack[a],e=o.elements.length,b=o.attrName,l=new svgedit.history.BatchCommand("Change "+b);e--;){var s=o.elements[e];if(s!=null){var c={};c[b]=o.oldValues[e];c[b]!=s.getAttribute(b)&&l.addSubCommand(new svgedit.history.ChangeElementCommand(s,c,b))}}this.undoableChangeStack[a]=null;return l}})();svgedit=svgedit||{}; -(function(){if(!svgedit.select)svgedit.select={};var a,o,e;svgedit.select.Selector=function(b,l){this.id=b;this.selectedElement=l;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity", -0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(b){this.locked=true;this.selectedElement=b;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(b){var l=[];b=Math.round(b/45);if(b<0)b+=8;for(var s in e.selectorGrips)l.push(s);for(;b>0;){l.push(l.shift());b--}b=0;for(s in e.selectorGrips){e.selectorGrips[s].setAttribute("style", -"cursor:"+l[b]+"-resize");b++}};svgedit.select.Selector.prototype.showGrips=function(b){e.selectorGripsGroup.setAttribute("display",b?"inline":"none");var l=this.selectedElement;this.hasGrips=b;if(l&&b){this.selectorGroup.appendChild(e.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(l))}};svgedit.select.Selector.prototype.resize=function(){var b=this.selectorRect,l=e,s=l.selectorGrips,c=this.selectedElement,g=c.getAttribute("stroke-width"),d=a.currentZoom(),p=1/d;if(c.getAttribute("stroke")!== -"none"&&!isNaN(g))p+=g/2;var w=c.tagName;if(w==="text")p+=2/d;g=svgedit.transformlist.getTransformList(c);g=svgedit.math.transformListToTransform(g).matrix;g.e*=d;g.f*=d;var C=svgedit.utilities.getBBox(c);if(w==="g"&&!$.data(c,"gsvg"))if(w=a.getStrokedBBox(c.childNodes))C=w;w=C.x;var v=C.y,L=C.width;C=C.height;p*=d;d=svgedit.math.transformBox(w*d,v*d,L*d,C*d,g);g=d.aabox;w=g.x-p;v=g.y-p;var Q=g.width+p*2;L=g.height+p*2;g=w+Q/2;C=v+L/2;if(c=svgedit.utilities.getRotationAngle(c)){w=a.svgRoot().createSVGTransform(); -w.setRotate(-c,g,C);w=w.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,w);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,w);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,w);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,w);w=d.tl;Q=w.x;L=w.y;var J=w.x,H=w.y;w=Math.min;v=Math.max;Q=w(Q,w(d.tr.x,w(d.bl.x,d.br.x)))-p;L=w(L,w(d.tr.y,w(d.bl.y,d.br.y)))-p;J=v(J,v(d.tr.x,v(d.bl.x,d.br.x)))+p;H=v(H,v(d.tr.y,v(d.bl.y,d.br.y)))+p;w=Q;v=L;Q=J-Q;L=H-L}b.setAttribute("d","M"+w+","+v+" L"+(w+Q)+","+v+" "+ -(w+Q)+","+(v+L)+" "+w+","+(v+L)+"z");this.selectorGroup.setAttribute("transform",c?"rotate("+[c,g,C].join(",")+")":"");if(svgedit.browser.isTouch()){w-=15.75;v-=15.75}else{w-=4;v-=4}this.gripCoords={nw:[w,v].map(Math.round),ne:[w+Q,v].map(Math.round),sw:[w,v+L].map(Math.round),se:[w+Q,v+L].map(Math.round),n:[w+Q/2,v].map(Math.round),w:[w,v+L/2].map(Math.round),e:[w+Q,v+L/2].map(Math.round),s:[w+Q/2,v+L].map(Math.round)};for(var U in this.gripCoords){b=this.gripCoords[U];s[U].setAttribute("x",b[0]); -s[U].setAttribute("y",b[1])}this.rotateCoords={nw:[w,v],ne:[w+Q+8,v],sw:[w,v+L+8],se:[w+Q+8,v+L+8]};for(U in this.rotateCoords){b=this.rotateCoords[U];l.rotateGrips[U].setAttribute("cx",b[0]);l.rotateGrips[U].setAttribute("cy",b[1])}};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null, -se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);a.svgRoot().appendChild(this.selectorParentGroup); -this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var b in this.rotateGrips){var l=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+b,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+o.imgPath+"rotate.png) 12 12, auto;"}});$.data(l,"dir",b);$.data(l,"type","rotate");this.rotateGrips[b]=this.selectorGripsGroup.appendChild(l)}for(b in this.selectorGrips){l=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+ -b,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+b+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){l.setAttribute("width",30.5);l.setAttribute("height",30.5);l.setAttribute("fill-opacity",0.3)}$.data(l,"dir",b);$.data(l,"type","resize");this.selectorGrips[b]=this.selectorGripsGroup.appendChild(l)}if(!$("#canvasBackground").length){b=o.dimensions;b=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:b[0],height:b[1],x:0,y:0, -overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});l=a.createSVGElement({element:"defs",attr:{id:"placeholder_defs"}});var s=a.createSVGElement({element:"pattern",attr:{id:"checkerPattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:20,height:20,viewBox:"0 0 10 10"}}),c=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:10,height:10,fill:"#fff"}}),g=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:5,height:5,fill:"#eee"}}),d=a.createSVGElement({element:"rect", -attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),p=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"url(#checkerPattern)",style:"pointer-events:none"}});b.appendChild(l);l.appendChild(s);s.appendChild(c);s.appendChild(g);s.appendChild(d);b.appendChild(p);a.svgRoot().insertBefore(b,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(b){if(b==null)return null;var l=this.selectors.length;if(typeof this.selectorMap[b.id]== -"object"){this.selectorMap[b.id].locked=true;return this.selectorMap[b.id]}for(var s=0;s element";this.svgElem_=b;this.obj_num=0;this.idPrefix=l||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= -"";var s=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(s&&e!=o.NEVER_RANDOMIZE)this.nonce_=s;else e==o.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(b){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+b):$(this.svgElem_).find("[id="+b+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_}; -svgedit.draw.Drawing.prototype.setNonce=function(b){this.svgElem_.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:se","http://svg-edit.googlecode.com");this.svgElem_.setAttributeNS("http://svg-edit.googlecode.com","se:nonce",b);this.nonce_=b};svgedit.draw.Drawing.prototype.clearNonce=function(){this.nonce_=""};svgedit.draw.Drawing.prototype.getId=function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num};svgedit.draw.Drawing.prototype.getNextId=function(){var b= -this.obj_num,l=false;if(this.releasedNums.length>0){this.obj_num=this.releasedNums.pop();l=true}else this.obj_num++;for(var s=this.getId();this.getElem_(s);){if(l){this.obj_num=b;l=false}this.obj_num++;s=this.getId()}if(l)this.obj_num=b;return s};svgedit.draw.Drawing.prototype.releaseId=function(b){var l=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof b!="string"||b.indexOf(l)!=0)return false;b=parseInt(b.substr(l.length));if(typeof b!="number"||b<=0||this.releasedNums.indexOf(b)!=-1)return false; -this.releasedNums.push(b);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(b){for(var l=0;l=0&&b1){var b=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return b}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var b=this.svgElem_.childNodes.length,l=[],s=[],c=null,g=false,d=0;d0||!g){for(d=1;s.indexOf("Layer "+d)>=0;)d++;s="Layer "+d;c=b.createElementNS("http://www.w3.org/2000/svg","g");g=b.createElementNS("http://www.w3.org/2000/svg","title");g.textContent=s; -c.appendChild(g);for(g=0;g1))for(var s= -0;s0){g=Q element";this.elem=g;this.segs=[];this.selected_pts=[];svgedit.path.path=this; -this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var g=this.elem.pathSegList,d=g.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var p=0;p=d?null:g[p+1],L=p-1<0?null:g[p-1];if(C.type===2){if(L&&L.type!==1){v=g[w];v.next=g[w+1];v.next.prev=v;v.addGrip()}w=p}else if(v&& -v.type===1){C.next=g[w+1];C.next.prev=C;C.mate=g[w];C.addGrip();if(this.first_seg==null)this.first_seg=C}else if(v){if(C.type!==1){C.addGrip();if(v&&v.type!==2){C.next=v;C.next.prev=C}}}else if(C.type!==1){v=g[w];v.next=g[w+1];v.next.prev=v;v.addGrip();C.addGrip();if(!this.first_seg)this.first_seg=g[w]}}return this};svgedit.path.Path.prototype.eachSeg=function(g){for(var d=this.segs.length,p=0;p').documentElement, -true);a.appendChild(d);var p=g.createElementNS(b,"svg");(c.clearSvgContentElement=function(){for(;p.firstChild;)p.removeChild(p.firstChild);$(p).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:l.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var f=g.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");p.appendChild(f)})();var w="svg_";c.setIdPrefix= -function(f){w=f};c.current_drawing_=new svgedit.draw.Drawing(p,w);var C=c.getCurrentDrawing=function(){return c.current_drawing_},v=1,L=null,Q={shape:{fill:(l.initFill.color=="none"?"":"#")+l.initFill.color,fill_paint:null,fill_opacity:l.initFill.opacity,stroke:"#"+l.initStroke.color,stroke_paint:null,stroke_opacity:l.initStroke.opacity,stroke_width:l.initStroke.width,stroke_dasharray:"none",opacity:l.initOpacity}};Q.text=$.extend(true,{},Q.shape);$.extend(Q.text,{fill:"#000000",stroke_width:0,font_size:24, -font_family:"Helvetica, Arial, sans-serif"});var J=Q.shape,H=Array(1),U=this.addSvgElementFromJson=function(f){var h=svgedit.utilities.getElem(f.attr.id),m=C().getCurrentLayer();if(h&&f.element!=h.tagName){m.removeChild(h);h=null}if(!h){h=g.createElementNS(b,f.element);if(m)(L||m).appendChild(h)}f.curStyles&&svgedit.utilities.assignAttributes(h,{fill:J.fill,stroke:J.stroke,"stroke-width":J.stroke_width,"stroke-dasharray":J.stroke_dasharray,"stroke-opacity":J.stroke_opacity,"fill-opacity":J.fill_opacity, -opacity:J.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,f.attr,100);svgedit.utilities.cleanupElement(h);return h},R=c.getTransformList=svgedit.transformlist.getTransformList,N=svgedit.math.transformPoint,ca=c.matrixMultiply=svgedit.math.matrixMultiply,la=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,X=c.transformListToTransform=svgedit.math.transformListToTransform,W=svgedit.math.snapToAngle,fa=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return l.baseUnit}, -getElement:svgedit.utilities.getElem,getHeight:function(){return p.getAttribute("height")/v},getWidth:function(){return p.getAttribute("width")/v},getRoundDigits:function(){return $a.round_digits}});var ta=c.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return g},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return H},getSVGContent:function(){return p}});var ia=c.getUrlFromAttr=svgedit.utilities.getUrlFromAttr, -ka=c.getHref=svgedit.utilities.getHref,Z=c.setHref=svgedit.utilities.setHref,da=svgedit.utilities.getPathBBox;c.getBBox=svgedit.utilities.getBBox;var pa=c.getRotationAngle=svgedit.utilities.getRotationAngle,oa=c.getElem=svgedit.utilities.getElem,ma=c.assignAttributes=svgedit.utilities.assignAttributes,na=this.cleanupElement=svgedit.utilities.cleanupElement,Ja=svgedit.sanitize.getNSMap(),Fa=c.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Na=svgedit.history.MoveElementCommand,Sa=svgedit.history.InsertElementCommand, -Ia=svgedit.history.RemoveElementCommand,Ka=svgedit.history.ChangeElementCommand,Ba=svgedit.history.BatchCommand;c.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(f,h){var m=svgedit.history.HistoryEventTypes;if(f==m.BEFORE_UNAPPLY||f==m.BEFORE_APPLY)c.clearSelection();else if(f==m.AFTER_APPLY||f==m.AFTER_UNAPPLY){var B=h.elements();c.pathActions.clear();M("changed",B);B=h.type();m=f==m.AFTER_APPLY;if(B==Na.type())(m?h.newParent:h.oldParent)==p&&c.identifyLayers();else if(B==Sa.type()|| -B==Ia.type()){h.parent==p&&c.identifyLayers();if(B==Sa.type())m&&Ta(h.elem);else m||Ta(h.elem);h.elem.tagName==="use"&&Gb(h.elem)}else if(B==Ka.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==p&&c.identifyLayers();m=m?h.newValues:h.oldValues;m.stdDeviation&&c.setBlurOffsets(h.elem.parentNode,m.stdDeviation)}}}});var xa=function(f){c.undoMgr.addCommandToHistory(f)};svgedit.select.init(l,{createSVGElement:function(f){return c.addSvgElementFromJson(f)},svgRoot:function(){return d},svgContent:function(){return p}, -currentZoom:function(){return v},getStrokedBBox:function(f){return c.getStrokedBBox([f])}});var ra=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return v},getSVGRoot:function(){return d}});svgedit.utilities.snapToGrid=function(f){var h=l.snappingStep,m=l.baseUnit;if(m!=="px")h*=svgedit.units.getTypeMap()[m];return f=Math.round(f/h)*h};var wa=svgedit.utilities.snapToGrid,kb={exportNoBlur:"Blurred elements will appear as un-blurred",exportNoforeignObject:"foreignObject elements will not appear", -exportNoDashArray:"Strokes will appear filled",exportNoText:"Text may not appear as expected"},vb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],cb=$.data,Ta=function(f){var h=$(f).attr(vb),m;for(m in h){var B=h[m];if(B&&B.indexOf("url(")===0){B=ia(B).substr(1);if(!oa(B)){gb().appendChild(sb[B]);delete sb[B]}}}f=f.getElementsByTagName("*");if(f.length){h=0;for(m=f.length;h=0)n=q=c.convertToPath(k,true);else if(k.tagName=="rect"){var u=k.getAttribute("rx"),E=k.getAttribute("ry");if(u||E)n=q=c.convertToPath(k,true)}if(!q){var I=k.cloneNode(true),K=document.createElementNS(b, -"g"),O=k.parentNode;O.appendChild(K);K.appendChild(I);n=svgedit.utilities.bboxToObj(K.getBBox());O.removeChild(K)}}return n}catch(V){console.log(k,V)}},m;$.each(f,function(){if(!m)if(this.parentNode)m=h(this)});if(m==null)return null;var B=m.x+m.width,A=m.y+m.height,G=m.x,D=m.y,z=function(k){var n=k.getAttribute("stroke-width"),q=0;if(k.getAttribute("stroke")!="none"&&!isNaN(n))q+=n/2;return q},F=[];$.each(f,function(k,n){var q=h(n);if(q){var u=z(n);G=Math.min(G,q.x-u);D=Math.min(D,q.y-u);F.push(q)}}); -m.x=G;m.y=D;$.each(f,function(k,n){var q=F[k];if(q&&n.nodeType==1){var u=z(n);B=Math.max(B,q.x+q.width+u);A=Math.max(A,q.y+q.height+u)}});m.width=B-G;m.height=A-D;return m};var pb=this.getVisibleElements=function(f){f||(f=$(p).children());f.find("#canvas_background").length&&f.splice(0,1);var h=[];$(f).children().each(function(m,B){try{B.getBBox()&&h.push(B)}catch(A){}});return h.reverse()},fb=this.getVisibleElementsAndBBoxes=function(f){f||(f=$(p).children());var h=[];$(f).children().each(function(m, -B){try{B.getBBox()&&h.push({elem:B,bbox:getStrokedBBox([B])})}catch(A){}});return h.reverse()},tb=this.groupSvgElem=function(f){var h=document.createElementNS(b,"g");f.parentNode.replaceChild(h,f);$(h).append(f).data("gsvg",f)[0].id=ja()},ha=function(f){var h=document.createElementNS(f.namespaceURI,f.nodeName);h.removeAttribute("id");$.each(f.attributes,function(B,A){A.localName!="-moz-math-font-style"&&h.setAttributeNS(A.namespaceURI,A.nodeName,A.nodeValue)});if(svgedit.browser.isWebkit()&&f.nodeName== -"path"){var m=Ha.convertPath(f);h.setAttribute("d",m)}$.each(f.childNodes,function(B,A){switch(A.nodeType){case 1:h.appendChild(ha(A));break;case 3:h.textContent=A.nodeValue}});if($(f).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(f).data("symbol")){f=$(f).data("symbol");$(h).data("ref",f).data("symbol",f)}else h.tagName=="image"&&Fb(h);h.id=ja();return h},Y,ja,M;(function(f){var h={};Y=f.getId=function(){return C().getId()};ja=f.getNextId=function(){return C().getNextId()};M=f.call=function(m, -B){if(h[m])return h[m](this,B)};f.bind=function(m,B){var A=h[m];h[m]=B;return A}})(c);this.prepareSvg=function(f){this.sanitizeSvg(f.documentElement);f=f.getElementsByTagNameNS(b,"path");for(var h=0,m=f.length;h0&&A.getItem(0).type==4&&A.removeItem(0);if(f!=0){G=N(G,D,X(A).matrix);D=d.createSVGTransform();D.setRotate(f,G.x,G.y);A.numberOfItems?A.insertItemBefore(D,0):A.appendItem(D)}else A.numberOfItems==0&&m.removeAttribute("transform");if(!h){A=m.getAttribute("transform"); -m.setAttribute("transform",B);Ya("transform",A,H);M("changed",H)}oa("pathpointgrip_container");m=ra.requestSelector(H[0]);m.resize();m.updateGripCursors(f)}};var Ca=this.recalculateAllSelectedDimensions=function(){for(var f=new Ba(db=="none"?"position":"size"),h=H.length;h--;){var m=Qa(H[h]);m&&f.addSubCommand(m)}if(!f.isEmpty()){xa(f);M("changed",H)}},Ma=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Wa=function(f){console.log([f.a,f.b,f.c,f.d,f.e,f.f])},Za=this.remapElement= -function(f,h,m){var B=l.gridSnapping&&f.parentNode.parentNode.localName==="svg",A=function(){if(B)for(var q in h)h[q]=wa(h[q]);ma(f,h,1E3,true)};box=svgedit.utilities.getBBox(f);for(var G=0;G<2;G++){var D=G===0?"fill":"stroke",z=f.getAttribute(D);if(z&&z.indexOf("url(")===0)if(m.a<0||m.d<0){z=P(z).cloneNode(true);if(m.a<0){var F=z.getAttribute("x1"),k=z.getAttribute("x2");z.setAttribute("x1",-(F-1));z.setAttribute("x2",-(k-1))}if(m.d<0){F=z.getAttribute("y1");k=z.getAttribute("y2");z.setAttribute("y1", --(F-1));z.setAttribute("y2",-(k-1))}z.id=ja();gb().appendChild(z);f.setAttribute(D,"url(#"+z.id+")")}}G=f.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){D=X(f).matrix;D=ca(D.inverse(),m,D);h.x=parseFloat(h.x)+D.e;h.y=parseFloat(h.y)+D.f}else{D=R(f);z=d.createSVGTransform();z.setMatrix(ca(X(D).matrix,m));D.clear();D.appendItem(z)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){D=R(f);z=d.createSVGTransform();z.setMatrix(ca(X(D).matrix, -m));D.clear();D.appendItem(z)}else{D=N(h.x,h.y,m);h.width=m.a*h.width;h.height=m.d*h.height;h.x=D.x+Math.min(0,h.width);h.y=D.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}A();break;case "ellipse":G=N(h.cx,h.cy,m);h.cx=G.x;h.cy=G.y;h.rx=m.a*h.rx;h.ry=m.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);A();break;case "circle":G=N(h.cx,h.cy,m);h.cx=G.x;h.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);h.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/ -2);if(h.r)h.r=Math.abs(h.r);A();break;case "line":D=N(h.x1,h.y1,m);F=N(h.x2,h.y2,m);h.x1=D.x;h.y1=D.y;h.x2=F.x;h.y2=F.y;case "text":m=f.querySelectorAll("tspan");for(G=m.length;G--;){D=ta("x",f.getAttribute("x"));z=ta("x",m[G].getAttribute("x"));F=ta("y",f.getAttribute("y"));k=ta("y",m[G].getAttribute("y"));var n={};if(!isNaN(D)&&!isNaN(z)&&D!=0&&z!=0&&h.x)n.x=h.x-(D-z);if(!isNaN(F)&&!isNaN(k)&&F!=0&&k!=0&&h.y)n.y=h.y-(F-k);if(n.x||n.y)ma(m[G],n,1E3,true)}A();break;case "use":A();break;case "g":(A= -$(f).data("gsvg"))&&ma(A,h,1E3,true);break;case "polyline":case "polygon":A=h.points.length;for(G=0;G0){for(var m=h.numberOfItems;m--;){var B=h.getItem(m);if(B.type===0)h.removeItem(m);else if(B.type===1)svgedit.math.isIdentity(B.matrix)&&h.removeItem(m);else B.type===4&&B.angle===0&&h.removeItem(m)}if(h.numberOfItems===1&&pa(f))return null}if(!h||h.numberOfItems==0){f.removeAttribute("transform");return null}if(h){m=h.numberOfItems;for(var A=[];m--;){B=h.getItem(m);if(B.type===1)A.push([B.matrix,m]);else if(A.length)A=[]}if(A.length===2){m=d.createSVGTransformFromMatrix(ca(A[1][0], -A[0][0]));h.removeItem(A[0][1]);h.removeItem(A[1][1]);h.insertItemBefore(m,A[1][1])}m=h.numberOfItems;if(m>=2&&h.getItem(m-2).type===1&&h.getItem(m-1).type===2){A=d.createSVGTransform();B=ca(h.getItem(m-2).matrix,h.getItem(m-1).matrix);A.setMatrix(B);h.removeItem(m-2);h.removeItem(m-2);h.appendItem(A)}}switch(f.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type=== -4)return null}var G=$(f).data("gsvg");m=new Ba("Transform");var D={},z=null;B=[];switch(f.tagName){case "line":B=["x1","y1","x2","y2"];break;case "circle":B=["cx","cy","r"];break;case "ellipse":B=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":B=["width","height","x","y"];break;case "use":case "text":case "tspan":B=["x","y"];break;case "polygon":case "polyline":z={};z.points=f.getAttribute("points");A=f.points;var F=A.numberOfItems;D.points=Array(F);for(var k=0;k1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;var K=h.getItem(E-3).matrix,O=h.getItem(E-2).matrix,V=h.getItem(E-1).matrix;F=f.childNodes;for(n=F.length;n--;){var aa=F.item(n);B=G=0;if(aa.nodeType== -1){var S=R(aa);if(S){B=X(S).matrix;G=pa(aa);var ea=Ra,ga=[];Ra=aa.getAttribute("transform");if(G||la(S)){var T=d.createSVGTransform();T.setMatrix(ca(K,O,V,B));S.clear();S.appendItem(T);ga.push(T)}else{G=ca(B.inverse(),V,B);T=d.createSVGMatrix();T.e=-G.e;T.f=-G.f;B=ca(T.inverse(),B.inverse(),K,O,V,B,G.inverse());var qa=d.createSVGTransform(),va=d.createSVGTransform(),za=d.createSVGTransform();qa.setTranslate(G.e,G.f);va.setScale(B.a,B.d);za.setTranslate(T.e,T.f);S.appendItem(za);S.appendItem(va);S.appendItem(qa); -ga.push(za);ga.push(va);ga.push(qa)}m.addSubCommand(Qa(aa));Ra=ea}}}h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E>=3&&h.getItem(E-1).type==1){k=3;B=X(h).matrix;T=d.createSVGTransform();T.setMatrix(B);h.clear();h.appendItem(T)}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;G=X(h).matrix;h.removeItem(0);B=X(h).matrix.inverse();B=ca(B,G);G=B.e;B=B.f;if(G!=0||B!=0){F=f.childNodes;n=F.length;for(E=[];n--;){aa=F.item(n);if(aa.nodeType==1){if(aa.getAttribute("clip-path")){ea= -aa.getAttribute("clip-path");if(E.indexOf(ea)===-1){nb(ea,G,B);E.push(ea)}}ea=Ra;Ra=aa.getAttribute("transform");if(S=R(aa)){K=d.createSVGTransform();K.setTranslate(G,B);S.numberOfItems?S.insertItemBefore(K,0):S.appendItem(K);m.addSubCommand(Qa(aa));S=f.getElementsByTagNameNS(b,"use");aa="#"+aa.id;for(K=S.length;K--;){O=S.item(K);if(aa==ka(O)){V=d.createSVGTransform();V.setTranslate(-G,-B);R(O).insertItemBefore(V,0);m.addSubCommand(Qa(O))}}Ra=ea}}}E=[];Ra=ea}}else if(E==1&&h.getItem(0).type==1&&!A){k= -1;B=h.getItem(0).matrix;F=f.childNodes;for(n=F.length;n--;){aa=F.item(n);if(aa.nodeType==1){ea=Ra;Ra=aa.getAttribute("transform");if(S=R(aa)){G=ca(B,X(S).matrix);E=d.createSVGTransform();E.setMatrix(G);S.clear();S.appendItem(E,0);m.addSubCommand(Qa(aa));Ra=ea;ea=aa.getAttribute("stroke-width");aa.getAttribute("stroke")!=="none"&&!isNaN(ea)&&aa.setAttribute("stroke-width",ea*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(A){q=d.createSVGTransform();q.setRotate(A,u.x,u.y);h.numberOfItems?h.insertItemBefore(q, -0):h.appendItem(q)}h.numberOfItems==0&&f.removeAttribute("transform");return null}if(k==2){if(A){u={x:q.x+I.e,y:q.y+I.f};q=d.createSVGTransform();q.setRotate(A,u.x,u.y);h.numberOfItems?h.insertItemBefore(q,0):h.appendItem(q)}}else if(k==3){B=X(h).matrix;I=d.createSVGTransform();I.setRotate(A,q.x,q.y);I=I.matrix;q=d.createSVGTransform();q.setRotate(A,u.x,u.y);u=q.matrix.inverse();ea=B.inverse();u=ca(ea,u,I,B);G=u.e;B=u.f;if(G!=0||B!=0){F=f.childNodes;for(n=F.length;n--;){aa=F.item(n);if(aa.nodeType== -1){ea=Ra;Ra=aa.getAttribute("transform");S=R(aa);K=d.createSVGTransform();K.setTranslate(G,B);S.numberOfItems?S.insertItemBefore(K,0):S.appendItem(K);m.addSubCommand(Qa(aa));Ra=ea}}}if(A)h.numberOfItems?h.insertItemBefore(q,0):h.appendItem(q)}}else{A=svgedit.utilities.getBBox(f);if(!A&&f.tagName!="path")return null;B=d.createSVGMatrix();if(G=pa(f)){q={x:A.x+A.width/2,y:A.y+A.height/2};u=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);k=G*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/ -k;for(k=0;k=3&&h.getItem(E-2).type== -3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;B=X(h,E-3,E-1).matrix;h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E==4&&h.getItem(E-1).type==1){k=3;B=X(h).matrix;T=d.createSVGTransform();T.setMatrix(B);h.clear();h.appendItem(T);B=d.createSVGMatrix()}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;I=h.getItem(0).matrix;ea=X(h,1).matrix;A=ea.inverse();B=ca(A,I,ea);h.removeItem(0)}else if(E==1&&h.getItem(0).type==1&&!G){B=X(h).matrix;switch(f.tagName){case "line":D= -$(f).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":D.points=f.getAttribute("points");if(D.points){A=f.points;F=A.numberOfItems;D.points=Array(F);for(k=0;k1&&A.showGrips(false)}}}M("selected",H);h||H.length==1?ra.requestSelector(H[0]).showGrips(true): -ra.requestSelector(H[0]).showGrips(false);for(H.sort(function(G,D){if(G&&D&&G.compareDocumentPosition)return 3-(D.compareDocumentPosition(G)&6);else if(G==null)return 1});H[0]==null;)H.shift(0)}},rb=this.selectOnly=function(f,h){ya(true);qb(f,h)};this.removeFromSelection=function(f){if(H[0]!=null)if(f.length!=0){var h=Array(H.length);j=0;len=H.length;for(var m=0;m=0&&f.id!="svgcanvas")for(;f.nodeName!="foreignObject";){f=f.parentNode;if(!f)return d}var h=C().getCurrentLayer();if([d,a,p,h].indexOf(f)>=0)return d;if($(f).closest("#selectorParentGroup").length)return ra.selectorParentGroup; -for(;f.parentNode&&f.parentNode!==(L||h);)f=f.parentNode;return f};(function(){var f=null,h=null,m=null,B=null,A=null,G={},D={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(z){if(!c.spaceKey){var F=z.button===2;mb=p.querySelector("g").getScreenCTM().inverse();var k=N(z.pageX,z.pageY,mb),n=k.x*v;k=k.y*v;z.preventDefault();if(F)Ea="select";n=n/v;k=k/v;var q=Bb(z);if(q.tagName==="a"&&q.childNodes.length===1)q=q.firstChild;var u=B=h=n,E=A=m=k;if(l.gridSnapping){n=wa(n);k=wa(k);h=wa(h); -m=wa(m)}if(q==ra.selectorParentGroup&&H[0]!=null){q=z.target;var I=cb(q,"type");if(I=="rotate"){Ea="rotate";current_rotate_mode=cb(q,"dir")}else if(I=="resize"){Ea="resize";db=cb(q,"dir")}q=H[0]}Ra=q.getAttribute("transform");I=R(q);switch(Ea){case "select":Ga=true;db="none";if(F)Ga=false;if(q!=d){if(H.indexOf(q)==-1){z.shiftKey||ya(true);qb([q]);wb=q;Ha.clear()}if(!F)for(F=0;F1))if(Ga)if(!(z.button=== -1||c.spaceKey)){var F=H[0],k=N(z.pageX,z.pageY,mb),n=k.x*v;k=k.y*v;var q=oa(Y()),u=x=n/v,E=y=k/v;if(l.gridSnapping){x=wa(x);y=wa(y)}z.preventDefault();switch(Ea){case "select":if(H[0]!==null){u=x-h;var I=y-m;if(l.gridSnapping){u=wa(u);I=wa(I)}if(z.shiftKey){var K=W(h,m,x,y);x=K.x;y=K.y}if(u!=0||I!=0){E=H.length;for(var O=0;O0&&c.removeFromSelection(q);u.length>0&&qb(u);break;case "resize":q=R(F);u=(K=la(q))?G:svgedit.utilities.getBBox(F);E=u.x;O=u.y;var aa=u.width,S=u.height;u=x-h;I=y-m;if(l.gridSnapping){u=wa(u);I=wa(I);S=wa(S);aa=wa(aa)}if(V=pa(F)){var ea=Math.sqrt(u*u+I*I);I=Math.atan2(I,u)-V*Math.PI/180;u=ea*Math.cos(I);I=ea*Math.sin(I)}if(db.indexOf("n")==-1&&db.indexOf("s")==-1)I=0;if(db.indexOf("e")==-1&&db.indexOf("w")==-1)u=0;var ga=ea=0,T=S?(S+I)/S:1,qa=aa?(aa+u)/aa:1;if(db.indexOf("n")>=0){T=S?(S- -I)/S:1;ga=S}if(db.indexOf("w")>=0){qa=aa?(aa-u)/aa:1;ea=aa}u=d.createSVGTransform();I=d.createSVGTransform();aa=d.createSVGTransform();if(l.gridSnapping){E=wa(E);ea=wa(ea);O=wa(O);ga=wa(ga)}u.setTranslate(-(E+ea),-(O+ga));if(z.shiftKey)if(qa==1)qa=T;else T=qa;I.setScale(qa,T);aa.setTranslate(E+ea,O+ga);if(K){K=V?1:0;q.replaceItem(u,2+K);q.replaceItem(I,1+K);q.replaceItem(aa,0+K)}else{K=q.numberOfItems;q.replaceItem(aa,K-3);q.replaceItem(I,K-2);q.replaceItem(u,K-1)}ra.requestSelector(F).resize();M("transition", -H);break;case "zoom":u*=v;E*=v;ma(sa,{x:Math.min(B*v,u),y:Math.min(A*v,E),width:Math.abs(u-B*v),height:Math.abs(E-A*v)},100);break;case "text":ma(q,{x:x,y:y},1E3);break;case "line":if(l.gridSnapping){x=wa(x);y=wa(y)}u=x;K=y;if(z.shiftKey){K=W(h,m,u,K);u=K.x;K=K.y}q.setAttributeNS(null,"x2",u);q.setAttributeNS(null,"y2",K);break;case "foreignObject":case "square":case "rect":case "image":u=Math.abs(x-h);K=Math.abs(y-m);if(Ea=="square"||z.shiftKey){u=K=Math.max(u,K);E=hm?m+u:m- -u}if(z.altKey){K=h;E=m;u=Math.abs(x-K);O=z.shiftKey?u:Math.abs(y-E)}q.setAttributeNS(null,"rx",u);q.setAttributeNS(null,"ry",O);q.setAttributeNS(null,"cx",K);q.setAttributeNS(null,"cy",E);break;case "fhellipse":case "fhrect":D.minx=Math.min(u,D.minx);D.maxx=Math.max(u,D.maxx);D.miny=Math.min(E,D.miny);D.maxy=Math.max(E,D.maxy);case "fhpath":f+=+u+","+E+" ";q.setAttributeNS(null,"points",f);break;case "path":case "pathedit":x*=v;y*=v;if(l.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(z.shiftKey){if(K= -svgedit.path.path){q=K.dragging?K.dragging[0]:h;K=K.dragging?K.dragging[1]:m}else{q=h;K=m}K=W(q,K,x,y);x=K.x;y=K.y}if(sa&&sa.getAttribute("display")!=="none"){u*=v;E*=v;ma(sa,{x:Math.min(B*v,u),y:Math.min(A*v,E),width:Math.abs(u-B*v),height:Math.abs(E-A*v)},100)}Ha.mouseMove(z,x,y);break;case "textedit":x*=v;y*=v;bb.mouseMove(n,k);break;case "rotate":u=svgedit.utilities.getBBox(F);K=u.x+u.width/2;E=u.y+u.height/2;q=fa(F);q=N(K,E,q);K=q.x;E=q.y;q=u.x;O=u.y;if(current_rotate_mode=="nw")q=u.x+u.width; -if(current_rotate_mode=="se")O=u.y+u.height;if(current_rotate_mode=="sw"){q=u.x+u.width;O=u.y+u.height}compensation_angle=(Math.atan2(E-O,K-q)*(180/Math.PI)-90)%360;V=(Math.atan2(E-y,K-x)*(180/Math.PI)-90)%360;V+=compensation_angle;if(l.gridSnapping)V=wa(V);if(z.shiftKey)V=Math.round(V/45)*45;c.setRotationAngle(V<-180?360+V:V,true);M("transition",H)}ib("mouseMove",{event:z,mouse_x:n,mouse_y:k,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode, -k=Bb(z),n=k.tagName;if(F!==L){if(n==="text"&&Ea!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(k,z.x,z.y)}if((n==="g"||n==="a")&&pa(k)){Db(k);k=H[0];ya(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===C().getCurrentLayer()||k===ra.selectorParentGroup||Kb(k)}}).mouseup(function(z){c.addClones=false;window.removeEventListener("keyup",c.removeClones);H=H.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ga){var k=N(z.pageX,z.pageY,mb),n=k.x*v;k=k.y*v;var q=n/v,u=k/v,E=oa(Y()),I=false;Ga=false; -switch(Ea){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Ea="select";case "select":if(H[0]!=null){if(H.length==1){n=H[0];switch(n.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill=n.getAttribute("fill");Xa.fill_opacity=n.getAttribute("fill-opacity");Xa.stroke=n.getAttribute("stroke");Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray"); -Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Ca();B=B;A=A;n=Math.abs(u-A);if(n>1||n>1){z=H.length;for(n=0;n=0?F.indexOf(",",u+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=Ha.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);I=F.x1!=F.x2|| -F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);I=F.width!=0||F.height!=0||Ea==="image";break;case "circle":I=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx","ry"]);I=F.rx!=null||F.ry!=null;break;case "fhellipse":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=U({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:Y()}});M("changed",[E]);I=true}break;case "fhrect":if(D.maxx- -D.minx>0&&D.maxy-D.miny>0){E=U({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:Y()}});M("changed",[E]);I=true}break;case "text":I=true;rb([E]);bb.start(E);break;case "path":E=null;Ga=true;F=Ha.mouseUp(z,E,n,k);E=F.element;I=F.keep;break;case "pathedit":I=true;E=null;Ha.mouseUp(z);break;case "textedit":I=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":I=true;E=null;Ea="select";F=c.undoMgr.finishUndoableChange();F.isEmpty()||xa(F);Ca();M("changed", -H)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(V,aa){if(aa){I=aa.keep||I;E=aa.element;Ga=aa.started||Ga}});if(!I&&E!=null){C().releaseId(Y());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName=="g";)n=n.parentNode;if((Ea!="path"||!drawn_path)&&n.parentNode.id!="selectorParentGroup"&&n.id!="svgcanvas"&&n.id!="svgroot"){c.setMode("select");rb([n],true)}}else if(E!=null){c.addedNew=true;z=0.2;var K;if(false.beginElement&&E.getAttribute("opacity")!= -J.opacity){K=$(false).clone().attr({to:J.opacity,dur:z}).appendTo(E);try{K[0].beginElement()}catch(O){}}else z=0;setTimeout(function(){K&&K.remove();E.setAttribute("opacity",J.opacity);E.setAttribute("style","pointer-events:inherit");na(E);if(Ea==="path")Ha.toEditMode(E);else l.selectNew&&rb([E],true);xa(new Sa(E));M("changed",[E])},z*1E3)}Ra=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=p.getScreenCTM().inverse();var F=N(z.pageX,z.pageY,mb);F={x:F.x, -y:F.y,width:0,height:0};if(z.wheelDelta)if(z.wheelDelta>=120)F.factor=2;else{if(z.wheelDelta<=-120)F.factor=0.5}else if(z.detail)if(z.detail>0)F.factor=0.5;else if(z.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var Fb=function(f){$(f).click(function(h){h.preventDefault()})},bb=c.textActions=function(){function f(S){var ea=k.value==="";$(k).focus();if(!arguments.length)if(ea)S=0;else{if(k.selectionEnd!==k.selectionStart)return;S=k.selectionEnd}var ga;ga=E[S];ea||k.setSelectionRange(S,S);n=oa("text_cursor"); -if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=oa("selectorParentGroup").appendChild(n)}u||(u=setInterval(function(){var T=n.getAttribute("display")==="none";n.setAttribute("display",T?"inline":"none")},600));ea=G(ga.x,I.y);ga=G(ga.x,I.y+I.height);ma(n,{x1:ea.x,y1:ea.y,x2:ga.x,y2:ga.y,visibility:"visible",display:"inline"});q&&q.setAttribute("d","M 0 0")}function h(S,ea,ga){if(S===ea)f(ea);else{ga||k.setSelectionRange(S,ea);q=oa("text_selectblock"); -if(!q){q=document.createElementNS(b,"path");ma(q,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});oa("selectorParentGroup").appendChild(q)}S=E[S];var T=E[ea];n.setAttribute("visibility","hidden");ea=G(S.x,I.y);ga=G(S.x+(T.x-S.x),I.y);var qa=G(S.x,I.y+I.height);S=G(S.x+(T.x-S.x),I.y+I.height);ma(q,{d:"M"+ea.x+","+ea.y+" L"+ga.x+","+ga.y+" "+S.x+","+S.y+" "+qa.x+","+qa.y+"z",display:"inline"})}}function m(S,ea){var ga=d.createSVGPoint();ga.x=S;ga.y=ea;if(E.length==1)return 0; -ga=F.getCharNumAtPosition(ga);if(ga<0){ga=E.length-2;if(S<=E[0].x)ga=0}else if(ga>=E.length-2)ga=E.length-2;var T=E[ga];S>T.x+T.width/2&&ga++;return ga}function B(S,ea,ga){var T=k.selectionStart;S=m(S,ea);h(Math.min(T,S),Math.max(T,S),!ga)}function A(S,ea){var ga={x:S,y:ea};ga.x/=v;ga.y/=v;if(K){var T=N(ga.x,ga.y,K.inverse());ga.x=T.x;ga.y=T.y}return ga}function G(S,ea){var ga={x:S,y:ea};if(K){var T=N(ga.x,ga.y,K);ga.x=T.x;ga.y=T.y}ga.x*=v;ga.y*=v;return ga}function D(S){h(0,F.textContent.length); -$(this).unbind(S)}function z(S){if(aa&&F){var ea=N(S.pageX,S.pageY,mb);ea=A(ea.x*v,ea.y*v);ea=m(ea.x,ea.y);var ga=F.textContent,T=ga.substr(0,ea).replace(/[a-z0-9]+$/i,"").length;ga=ga.substr(ea).match(/^[a-z0-9]+/i);h(T,(ga?ga[0].length:0)+ea);$(S.target).click(D);setTimeout(function(){$(S.target).unbind("click",D)},300)}}var F,k,n,q,u,E=[],I,K,O,V,aa;return{select:function(S,ea,ga){F=S;bb.toEditMode(ea,ga)},start:function(S){F=S;bb.toEditMode()},mouseDown:function(S,ea,ga,T){S=A(ga,T);k.focus(); -f(m(S.x,S.y));O=ga;V=T},mouseMove:function(S,ea){var ga=A(S,ea);B(ga.x,ga.y)},mouseUp:function(S,ea,ga){var T=A(ea,ga);B(T.x,T.y,true);S.target!==F&&eaO-2&&gaV-2&&bb.toSelectMode(true)},setCursor:f,toEditMode:function(S,ea){rb([F],false);aa=false;Ea="textedit";ra.requestSelector(F).showGrips(false);ra.requestSelector(F);bb.init();$(F).css("cursor","text");if(arguments.length){var ga=A(S,ea);f(m(ga.x,ga.y))}else f();setTimeout(function(){aa=true},300)},toSelectMode:function(S){Ea= -"select";clearInterval(u);u=null;q&&$(q).attr("display","none");n&&$(n).attr("visibility","hidden");$(F).css("cursor","move");if(S){ya();$(F).css("cursor","move");M("selected",[F]);qb([F],true)}F&&!F.textContent.length&&c.deleteSelectedElements();$(k).blur();F=false},setInputElem:function(S){k=S},clear:function(){Ea=="textedit"&&bb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=H[0];ra.requestSelector(F).showGrips(false)}var S=F.textContent.length,ea=F.getAttribute("transform");I=svgedit.utilities.getBBox(F); -K=ea?fa(F):null;E=Array(S);k.focus();$(F).unbind("dblclick",z).dblclick(z);if(!S)var ga={x:I.x+I.width/2,width:0};for(ea=0;ea=0&&this.selected_pts.push(F)}this.selected_pts.sort();z=this.selected_pts.length;for(D=Array(z);z--;){k=this.segs[this.selected_pts[z]];k.select(true);D[z]= -k.ptgrip}Ha.canDeleteNodes=true;Ha.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",D)};var A=h=null,G=false;this.lastCtrlPoint=[0,0];return{mouseDown:function(D,z,F,k){if(Ea==="path"){mouse_x=F;mouse_y=k;F=mouse_x/v;z=mouse_y/v;k=oa("path_stretch_line");m=[F,z];if(l.gridSnapping){F=wa(F);z=wa(z);mouse_x=wa(mouse_x);mouse_y=wa(mouse_y)}if(!k){k=document.createElementNS(b,"path");ma(k,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});k=oa("selectorParentGroup").appendChild(k)}k.setAttribute("display", -"inline");this.stretchy=k;var n=null;if(A){n=A.pathSegList;for(var q=n.numberOfItems,u=6/v,E=false;q;){q--;var I=n.getItem(q),K=I.x;I=I.y;if(F>=K-u&&F<=K+u&&z>=I-u&&z<=I+u){E=true;break}}u=Y();svgedit.path.removePath_(u);u=oa(u);K=n.numberOfItems;if(E){if(q<=1&&K>=2){F=n.getItem(0).x;z=n.getItem(0).y;q=svgedit.path.first_grip?svgedit.path.first_grip[0]/v:n.getItem(0).x;E=svgedit.path.first_grip?svgedit.path.first_grip[1]/v:n.getItem(0).y;D=k.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(F, -z):A.createSVGPathSegCurvetoCubicAbs(F,z,D.x1/v,D.y1/v,q,E);F=A.createSVGPathSegClosePath();n.appendItem(D);n.appendItem(F)}else if(K<3)return n=false;$(k).remove();element=u;A=null;Ga=false;if(f){svgedit.path.path.matrix&&Za(u,{},svgedit.path.path.matrix.inverse());F=u.getAttribute("d");k=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",k+F);$(u).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ha.toEditMode(svgedit.path.path.elem); -svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Bb(D))){console.log("Clicked outside canvas");return false}n=A.pathSegList.numberOfItems;q=A.pathSegList.getItem(n-1);u=q.x;q=q.y;if(D.shiftKey){z=W(u,q,F,z);F=z.x;z=z.y}D=k.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(ab(F),ab(z)):A.createSVGPathSegCurvetoCubicAbs(ab(F),ab(z),D.x1/v,D.y1/v,D.x2/v,D.y2/v);A.pathSegList.appendItem(D);F*=v;z*=v;k.setAttribute("d",["M",F,z,F,z].join(" "));k=svgedit.path.addCtrlGrip("1c1"); -D=svgedit.path.addCtrlGrip("0c2");u=svgedit.path.getCtrlLine(1);q=svgedit.path.getCtrlLine(2);k.setAttribute("cx",F);k.setAttribute("cy",z);D.setAttribute("cx",F);D.setAttribute("cy",z);u.setAttribute("x1",F);u.setAttribute("x2",F);u.setAttribute("y1",z);u.setAttribute("y2",z);q.setAttribute("x1",F);q.setAttribute("x2",F);q.setAttribute("y1",z);q.setAttribute("y2",z);k=n;if(f)k+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(k,F,z)}n=true}else{d_attr="M"+F+","+z+" ";A=U({element:"path",curStyles:true, -attr:{d:d_attr,id:ja(),opacity:J.opacity/2}});k.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));k=f?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(k,mouse_x,mouse_y);svgedit.path.first_grip=null}}else if(svgedit.path.path){svgedit.path.path.storeD();u=D.target.id;if(u.substr(0,14)=="pathpointgrip_"){z=svgedit.path.path.cur_pt=parseInt(u.substr(14));svgedit.path.path.dragging=[F,k];u=svgedit.path.path.segs[z];if(D.shiftKey)u.selected?svgedit.path.path.removePtFromSelection(z): -svgedit.path.path.addPtsToSelection(z);else{if(svgedit.path.path.selected_pts.length<=1||!u.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(z)}}else if(u.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,k];D=u.split("_")[1].split("c");z=D[0]-0;n=D=D[1]-0;q=svgedit.path.path.segs[z];svgedit.path.path.selectPt(z,D);if(n==2){E=1;u=q.next}else{E=2;u=q.prev}if(!u)return;D=function(O,V){return Math.sqrt(Math.pow(O.x-V.x,2)+Math.pow(O.y-V.y,2))};z={x:q.item["x"+ -n],y:q.item["y"+n]};n=n==2?{x:q.item.x,y:q.item.y}:{x:u.item.x,y:u.item.y};q={x:u.item["x"+E],y:u.item["y"+E]};u=D(z,n);D=D(q,n);z=Math.abs(Math.round(Math.atan2(z.y-n.y,z.x-n.x)*(180/Math.PI),0)-Math.round(Math.atan2(q.y-n.y,q.x-n.x)*(180/Math.PI),0))==180;if(Math.abs(u-D)<5&&z){svgedit.path.setLinkControlPoints(true);svgedit.path.is_linked=true}else{svgedit.path.setLinkControlPoints(false);svgedit.path.is_linked=false}}if(!svgedit.path.path.dragging){if(sa==null)sa=ra.getRubberBandBox();ma(sa,{x:F* -v,y:k*v,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;var k=!D.altKey;if(Ea==="path"){if(A){var n=A.pathSegList,q=n.numberOfItems-1,u=svgedit.path.addCtrlGrip("1c1"),E=svgedit.path.addCtrlGrip("0c2");if(m){var I=E.getAttribute("cx")/v||0,K=E.getAttribute("cy")/v||0;u.setAttribute("cx",z);u.setAttribute("cy",F);u.setAttribute("display","inline");D=m[0];u=m[1];n.getItem(q);var O=z/v,V=F/v;I=k?D+(D-O):I;k=k?u+(u-V):K;E.setAttribute("cx",I*v);E.setAttribute("cy",k*v);E.setAttribute("display", -"inline");E=svgedit.path.getCtrlLine(1);K=svgedit.path.getCtrlLine(2);ma(E,{x1:z,y1:F,x2:D*v,y2:u*v,display:"inline"});ma(K,{x1:I*v,y1:k*v,x2:D*v,y2:u*v,display:"inline"});if(q===0)B=[z,F];else{n=n.getItem(q-1);z=n.x;F=n.y;if(n.pathSegType===6){z+=z-n.x2;F+=F-n.y2}else if(B){z=B[0]/v;F=B[1]/v}svgedit.path.replacePathSeg(6,q,[D,u,this.lastCtrlPoint[0]/v,this.lastCtrlPoint[1]/v,I,k],A)}}else if(k=this.stretchy){q=n.getItem(q);n=z;u=F;if(D.target.id==="pathpointgrip_0"&&svgedit.path.first_grip){n=svgedit.path.first_grip[0]; -u=svgedit.path.first_grip[1]}if(q.pathSegType===6)svgedit.path.replacePathSeg(6,1,[z,F,(this.lastCtrlPoint[0]/v||q.x+(q.x-q.x2))*v,(this.lastCtrlPoint[1]/v||q.y+(q.y-q.y2))*v,n,u],k);else B?svgedit.path.replacePathSeg(6,1,[z,F,B[0],B[1],z,F],k):svgedit.path.replacePathSeg(4,1,[z,F],k)}}}else if(svgedit.path.path.dragging){n=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);D=svgedit.path.getPointFromGrip({x:z,y:F},svgedit.path.path); -q=D.x-n.x;n=D.y-n.y;svgedit.path.path.dragging=[z,F];!k||!svgedit.path.is_linked?svgedit.path.setLinkControlPoints(false):svgedit.path.setLinkControlPoints(true);svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(q,n):svgedit.path.path.movePts(q,n)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var aa=sa.getBBox(),S=svgedit.path.getGripPt(this);aa=svgedit.math.rectsIntersect(aa,{x:S.x,y:S.y,width:0,height:0});this.select(aa);aa&&svgedit.path.path.selected_pts.push(this.index)}})}}, -mouseUp:function(D,z,F,k){var n=oa("ctrlpointgrip_1c1"),q=oa("ctrlpointgrip_0c2");this.lastCtrlPoint=n?[n.getAttribute("cx"),n.getAttribute("cy")]:[F,k];if(!svgedit.path.first_grip)svgedit.path.first_grip=q?[q.getAttribute("cx"),q.getAttribute("cy")]:[F,k];if(Ea==="path"){m=null;if(!A){z=oa(Y());Ga=false;B=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){z=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)"); -!D.shiftKey&&!G&&svgedit.path.path.selectPt(z)}else if(sa&&sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&Ha.toSelectMode(D.target)}else Ha.toSelectMode(D.target);G=false},toEditMode:function(D){svgedit.path.path=svgedit.path.getPath_(D);Ea="pathedit";ya();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);f=false},toSelectMode:function(D){var z=D==svgedit.path.path.elem; -Ea="select";svgedit.path.path.show(false);h=false;ya();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Ea="path";f=true}else{Ha.clear(true);Ha.toEditMode(svgedit.path.path.elem)}},select:function(D){if(h===D){Ha.toEditMode(D);Ea="pathedit"}else h=D},reorient:function(){var D=H[0];if(D)if(pa(D)!=0){var z=new Ba("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ka(D,F)); -ya();this.resetOrientation(D);xa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",H)}},clear:function(D){h=null;if(A){var z=oa(Y());$(oa("path_stretch_line")).remove();D&&$(z).remove();$(oa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ga=false}else Ea=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=R(D),F=X(z).matrix; -z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var k=z.numberOfItems,n=0;n0){u=k.getItem(n-1).pathSegType;if(u===2){q(n-1,1);F();break}else if(u=== -1&&k.numberOfItems-1===n){q(n,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){c.setMode("select");c.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){D=$(svgedit.path.path.elem);D.attr("d",D.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(D){var z=D.points,F=z.numberOfItems;if(F>=4){var k=z.getItem(0),n=null;D=[];D.push(["M",k.x,",",k.y," C"].join("")); -for(var q=1;q<=F-4;q+=3){var u=z.getItem(q),E=z.getItem(q+1),I=z.getItem(q+2);if(n)if((k=svgedit.path.smoothControlPoints(n,u,k))&&k.length==2){u=D[D.length-1].split(",");u[2]=k[0].x;u[3]=k[0].y;D[D.length-1]=u.join(",");u=k[1]}D.push([u.x,u.y,E.x,E.y,I.x,I.y].join(","));k=I;n=E}for(D.push("L");q0;);Ha.clear(true);$.each(p.childNodes,function(m, -B){m&&B.nodeType===8&&B.data.indexOf("Created with")>=0&&p.insertBefore(B,p.firstChild)});if(L){Eb();rb([L])}$("#canvasGrid").attr("display","none");var f=[];$(p).find("g:data(gsvg)").each(function(){for(var m=this.attributes,B=m.length,A=0;A=0;F--){z=D.item(F);q=B(z.nodeValue);if(!(u.indexOf(z.localName)>= -0))if(q!="")if(q.indexOf("pointer-events")!==0)if(!(z.localName==="class"&&q.indexOf("se_")===0)){m.push(" ");if(z.localName==="d")q=Ha.convertPath(f,true);if(isNaN(q)){if(G.test(q))q=svgedit.units.shortFloat(q)+A}else q=svgedit.units.shortFloat(q);if($a.apply&&f.nodeName==="image"&&z.localName==="href"&&$a.images&&$a.images==="embed"){var E=Va[q];if(E)q=E}if(!z.namespaceURI||z.namespaceURI==b||Ja[z.namespaceURI]){m.push(z.nodeName);m.push('="');m.push(q);m.push('"')}}}}if(f.hasChildNodes()){m.push(">"); -h++;D=false;for(F=0;F");break;case 8:m.push("\n");m.push(Array(h+1).join(" "));m.push("