svgedit/dist/index-umd.min.js

3 lines
396 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.svgEditor=t()}(this,function(){"use strict";function e(e){var t=e.changedTouches,n=t[0],i="";switch(e.type){case"touchstart":i="mousedown";break;case"touchmove":i="mousemove";break;case"touchend":i="mouseup";break;default:return}var r=document.createEvent("MouseEvent");r.initMouseEvent(i,!0,!0,window,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),t.length<2&&(n.target.dispatchEvent(r),e.preventDefault())}document.addEventListener("touchstart",e,!0),document.addEventListener("touchmove",e,!0),document.addEventListener("touchend",e,!0),document.addEventListener("touchcancel",e,!0);var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,r=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},l={HTML:"http://www.w3.org/1999/xhtml",MATH:"http://www.w3.org/1998/Math/MathML",SE:"http://svg-edit.googlecode.com",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"},u=function(){var e={};return Object.entries(l).forEach(function(t){var n=o(t,2),i=n[0],r=n[1];e[r]=i.toLowerCase()}),e};!function(){if(!("SVGPathSeg"in window)){var e=function(){function e(t,i,r){n(this,e),this.pathSegType=t,this.pathSegTypeAsLetter=i,this._owningPathSegList=r}return i(e,[{key:"_segmentChanged",value:function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)}}]),e}();e.prototype.classname="SVGPathSeg",e.PATHSEG_UNKNOWN=0,e.PATHSEG_CLOSEPATH=1,e.PATHSEG_MOVETO_ABS=2,e.PATHSEG_MOVETO_REL=3,e.PATHSEG_LINETO_ABS=4,e.PATHSEG_LINETO_REL=5,e.PATHSEG_CURVETO_CUBIC_ABS=6,e.PATHSEG_CURVETO_CUBIC_REL=7,e.PATHSEG_CURVETO_QUADRATIC_ABS=8,e.PATHSEG_CURVETO_QUADRATIC_REL=9,e.PATHSEG_ARC_ABS=10,e.PATHSEG_ARC_REL=11,e.PATHSEG_LINETO_HORIZONTAL_ABS=12,e.PATHSEG_LINETO_HORIZONTAL_REL=13,e.PATHSEG_LINETO_VERTICAL_ABS=14,e.PATHSEG_LINETO_VERTICAL_REL=15,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19;var t=function(t){function o(t){return n(this,o),a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_CLOSEPATH,"z",t))}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegClosePath]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter}},{key:"clone",value:function(){return new o(void 0)}}]),o}(),o=function(t){function o(t,i,r){n(this,o);var s=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_MOVETO_ABS,"M",t));return s._x=i,s._y=r,s}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegMovetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y)}}]),o}();Object.defineProperties(o.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var s=function(t){function o(t,i,r){n(this,o);var s=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_MOVETO_REL,"m",t));return s._x=i,s._y=r,s}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegMovetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y)}}]),o}();Object.defineProperties(s.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var l=function(t){function o(t,i,r){n(this,o);var s=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_LINETO_ABS,"L",t));return s._x=i,s._y=r,s}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegLinetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y)}}]),o}();Object.defineProperties(l.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var u=function(t){function o(t,i,r){n(this,o);var s=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_LINETO_REL,"l",t));return s._x=i,s._y=r,s}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegLinetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y)}}]),o}();Object.defineProperties(u.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var c=function(t){function o(t,i,r,s,l,u,c){n(this,o);var h=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_CURVETO_CUBIC_ABS,"C",t));return h._x=i,h._y=r,h._x1=s,h._y1=l,h._x2=u,h._y2=c,h}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),o}();Object.defineProperties(c.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var h=function(t){function o(t,i,r,s,l,u,c){n(this,o);var h=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_CURVETO_CUBIC_REL,"c",t));return h._x=i,h._y=r,h._x1=s,h._y1=l,h._x2=u,h._y2=c,h}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),o}();Object.defineProperties(h.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var d=function(t){function o(t,i,r,s,l){n(this,o);var u=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t));return u._x=i,u._y=r,u._x1=s,u._y1=l,u}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y,this._x1,this._y1)}}]),o}();Object.defineProperties(d.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var f=function(t){function o(t,i,r,s,l){n(this,o);var u=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_CURVETO_QUADRATIC_REL,"q",t));return u._x=i,u._y=r,u._x1=s,u._y1=l,u}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y,this._x1,this._y1)}}]),o}();Object.defineProperties(f.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var p=function(t){function o(t,i,r,s,l,u,c,h){n(this,o);var d=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_ARC_ABS,"A",t));return d._x=i,d._y=r,d._r1=s,d._r2=l,d._angle=u,d._largeArcFlag=c,d._sweepFlag=h,d}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegArcAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),o}();Object.defineProperties(p.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var g=function(t){function o(t,i,r,s,l,u,c,h){n(this,o);var d=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_ARC_REL,"a",t));return d._x=i,d._y=r,d._r1=s,d._r2=l,d._angle=u,d._largeArcFlag=c,d._sweepFlag=h,d}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegArcRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),o}();Object.defineProperties(g.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var v=function(t){function o(t,i){n(this,o);var r=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t));return r._x=i,r}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new o(void 0,this._x)}}]),o}();Object.defineProperty(v.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var m=function(t){function o(t,i){n(this,o);var r=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_LINETO_HORIZONTAL_REL,"h",t));return r._x=i,r}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new o(void 0,this._x)}}]),o}();Object.defineProperty(m.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var y=function(t){function o(t,i){n(this,o);var r=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_LINETO_VERTICAL_ABS,"V",t));return r._y=i,r}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._y)}}]),o}();Object.defineProperty(y.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var _=function(t){function o(t,i){n(this,o);var r=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_LINETO_VERTICAL_REL,"v",t));return r._y=i,r}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._y)}}]),o}();Object.defineProperty(_.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var b=function(t){function o(t,i,r,s,l){n(this,o);var u=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t));return u._x=i,u._y=r,u._x2=s,u._y2=l,u}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y,this._x2,this._y2)}}]),o}();Object.defineProperties(b.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var x=function(t){function o(t,i,r,s,l){n(this,o);var u=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t));return u._x=i,u._y=r,u._x2=s,u._y2=l,u}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y,this._x2,this._y2)}}]),o}();Object.defineProperties(x.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var w=function(t){function o(t,i,r){n(this,o);var s=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t));return s._x=i,s._y=r,s}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y)}}]),o}();Object.defineProperties(w.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var S=function(t){function o(t,i,r){n(this,o);var s=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t));return s._x=i,s._y=r,s}return r(o,e),i(o,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new o(void 0,this._x,this._y)}}]),o}();Object.defineProperties(S.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}}),SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new t(void 0)},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(e,t){return new o(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(e,t){return new s(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new l(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new u(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,i,r,a){return new c(void 0,e,t,n,i,r,a)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,i,r,a){return new h(void 0,e,t,n,i,r,a)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,i){return new d(void 0,e,t,n,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(e,t,n,i){return new f(void 0,e,t,n,i)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(e,t,n,i,r,a,o){return new p(void 0,e,t,n,i,r,a,o)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,i,r,a,o){return new g(void 0,e,t,n,i,r,a,o)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(e){return new v(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(e){return new m(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new y(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new _(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,i){return new b(void 0,e,t,n,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,i){return new x(void 0,e,t,n,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new w(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new S(void 0,e,t)},"getPathSegAtLength"in SVGPathElement.prototype||(SVGPathElement.prototype.getPathSegAtLength=function(e){if(void 0===e||!isFinite(e))throw new Error("Invalid arguments.");var t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",this.getAttribute("d"));var n=t.pathSegList.numberOfItems-1;if(n<=0)return 0;do{if(t.pathSegList.removeItem(n),e>t.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=o,window.SVGPathSegMovetoRel=s,window.SVGPathSegLinetoAbs=l,window.SVGPathSegLinetoRel=u,window.SVGPathSegCurvetoCubicAbs=c,window.SVGPathSegCurvetoCubicRel=h,window.SVGPathSegCurvetoQuadraticAbs=d,window.SVGPathSegCurvetoQuadraticRel=f,window.SVGPathSegArcAbs=p,window.SVGPathSegArcRel=g,window.SVGPathSegLinetoHorizontalAbs=v,window.SVGPathSegLinetoHorizontalRel=m,window.SVGPathSegLinetoVerticalAbs=y,window.SVGPathSegLinetoVerticalRel=_,window.SVGPathSegCurvetoCubicSmoothAbs=b,window.SVGPathSegCurvetoCubicSmoothRel=x,window.SVGPathSegCurvetoQuadraticSmoothAbs=w,window.SVGPathSegCurvetoQuadraticSmoothRel=S}if(!("SVGPathSegList"in window&&"appendItem"in SVGPathSegList.prototype)){var k=function(){function e(t){n(this,e),this._pathElement=t,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}return i(e,[{key:"_checkPathSynchronizedToList",value:function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())}},{key:"_updateListFromPathMutations",value:function(e){if(this._pathElement){var t=!1;e.forEach(function(e){"d"===e.attributeName&&(t=!0)}),t&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}}},{key:"_writeListToPath",value:function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",e._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}},{key:"segmentChanged",value:function(e){this._writeListToPath()}},{key:"clear",value:function(){this._checkPathSynchronizedToList(),this._list.forEach(function(e){e._owningPathSegList=null}),this._list=[],this._writeListToPath()}},{key:"initialize",value:function(e){return this._checkPathSynchronizedToList(),this._list=[e],e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_checkValidIndex",value:function(e){if(isNaN(e)||e<0||e>=this.numberOfItems)throw new Error("INDEX_SIZE_ERR")}},{key:"getItem",value:function(e){return this._checkPathSynchronizedToList(),this._checkValidIndex(e),this._list[e]}},{key:"insertItemBefore",value:function(e,t){return this._checkPathSynchronizedToList(),t>this.numberOfItems&&(t=this.numberOfItems),e._owningPathSegList&&(e=e.clone()),this._list.splice(t,0,e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"replaceItem",value:function(e,t){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._checkValidIndex(t),this._list[t]=e,e._owningPathSegList=this,this._writeListToPath(),e}},{key:"removeItem",value:function(e){this._checkPathSynchronizedToList(),this._checkValidIndex(e);var t=this._list[e];return this._list.splice(e,1),this._writeListToPath(),t}},{key:"appendItem",value:function(e){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._list.push(e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_parsePath",value:function(e){if(!e||!e.length)return[];var t=this,r=function(){function e(){n(this,e),this.pathSegList=[]}return i(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),a=function(){function e(t){n(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return i(e,[{key:"_isCurrentSpace",value:function(){var e=this._string[this._currentIndex];return e<=" "&&(" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e)}},{key:"_skipOptionalSpaces",value:function(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex++;return this._currentIndex<this._endIndex}},{key:"_skipOptionalSpacesOrDelimiter",value:function(){return!(this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&","!==this._string.charAt(this._currentIndex))&&(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&","===this._string.charAt(this._currentIndex)&&(this._currentIndex++,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)}},{key:"hasMoreData",value:function(){return this._currentIndex<this._endIndex}},{key:"peekSegmentType",value:function(){var e=this._string[this._currentIndex];return this._pathSegTypeFromChar(e)}},{key:"_pathSegTypeFromChar",value:function(e){switch(e){case"Z":case"z":return SVGPathSeg.PATHSEG_CLOSEPATH;case"M":return SVGPathSeg.PATHSEG_MOVETO_ABS;case"m":return SVGPathSeg.PATHSEG_MOVETO_REL;case"L":return SVGPathSeg.PATHSEG_LINETO_ABS;case"l":return SVGPathSeg.PATHSEG_LINETO_REL;case"C":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS;case"c":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL;case"Q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;case"q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;case"A":return SVGPathSeg.PATHSEG_ARC_ABS;case"a":return SVGPathSeg.PATHSEG_ARC_REL;case"H":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;case"h":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;case"V":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;case"v":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;case"S":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;case"s":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;case"T":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;case"t":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;default:return SVGPathSeg.PATHSEG_UNKNOWN}}},{key:"_nextCommandHelper",value:function(e,t){return("+"===e||"-"===e||"."===e||e>="0"&&e<="9")&&t!==SVGPathSeg.PATHSEG_CLOSEPATH?t===SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:t===SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:t:SVGPathSeg.PATHSEG_UNKNOWN}},{key:"initialCommandIsMoveTo",value:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===SVGPathSeg.PATHSEG_MOVETO_ABS||e===SVGPathSeg.PATHSEG_MOVETO_REL}},{key:"_parseNumber",value:function(){var e=0,t=0,n=1,i=0,r=1,a=1,o=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex<this._endIndex&&"+"===this._string.charAt(this._currentIndex)?this._currentIndex++:this._currentIndex<this._endIndex&&"-"===this._string.charAt(this._currentIndex)&&(this._currentIndex++,r=-1),!(this._currentIndex===this._endIndex||(this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")&&"."!==this._string.charAt(this._currentIndex))){for(var s=this._currentIndex;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==s)for(var l=this._currentIndex-1,u=1;l>=s;)t+=u*(this._string.charAt(l--)-"0"),u*=10;if(this._currentIndex<this._endIndex&&"."===this._string.charAt(this._currentIndex)){if(this._currentIndex++,this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)n*=10,i+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==o&&this._currentIndex+1<this._endIndex&&("e"===this._string.charAt(this._currentIndex)||"E"===this._string.charAt(this._currentIndex))&&"x"!==this._string.charAt(this._currentIndex+1)&&"m"!==this._string.charAt(this._currentIndex+1)){if(this._currentIndex++,"+"===this._string.charAt(this._currentIndex)?this._currentIndex++:"-"===this._string.charAt(this._currentIndex)&&(this._currentIndex++,a=-1),this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)e*=10,e+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var c=t+i;if(c*=r,e&&(c*=Math.pow(10,a*e)),o!==this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),c}}},{key:"_parseArcFlag",value:function(){if(!(this._currentIndex>=this._endIndex)){var e=!1,t=this._string.charAt(this._currentIndex++);if("0"===t)e=!1;else{if("1"!==t)return;e=!0}return this._skipOptionalSpacesOrDelimiter(),e}}},{key:"parseSegment",value:function(){var e=this._string[this._currentIndex],n=this._pathSegTypeFromChar(e);if(n===SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand===SVGPathSeg.PATHSEG_UNKNOWN)return null;if((n=this._nextCommandHelper(e,this._previousCommand))===SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=n,n){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(t);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var i={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,i.x,i.y,i.x1,i.y1,i.x2,i.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:var a={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(t,a.x,a.y,a.x2,a.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:var o={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,o.x,o.y,o.x2,o.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var s={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,s.x,s.y,s.x1,s.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:var l={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(t,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:var u={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(t,u.x,u.y,u.x1,u.y1,u.arcAngle,u.arcLarge,u.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:var c={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(t,c.x,c.y,c.x1,c.y1,c.arcAngle,c.arcLarge,c.arcSweep);default:throw new Error("Unknown path seg type.")}}}]),e}(),o=new r,s=new a(e);if(!s.initialCommandIsMoveTo())return[];for(;s.hasMoreData();){var l=s.parseSegment();if(!l)return[];o.appendSegment(l)}return o.pathSegList}}]),e}();k.prototype.classname="SVGPathSegList",Object.defineProperty(k.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),k._pathSegArrayAsString=function(e){var t="",n=!0;return e.forEach(function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()}),t},Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new k(this)),this._pathSegList},enumerable:!0},normalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedNormalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0}}),window.SVGPathSegList=k}}();var c,h=jQuery,d=(!!document.createElementNS&&document.createElementNS(l.SVG,"svg").createSVGRect,navigator.userAgent),f=document.createElementNS(l.SVG,"svg"),p=!!window.opera,g=d.includes("AppleWebKit"),v=d.includes("Gecko/"),m=d.includes("MSIE"),y=d.includes("Chrome/"),_=(d.includes("Windows"),d.includes("Macintosh")),b="ontouchstart"in window,x=!!f.querySelector,w=!!document.evaluate,S=function(){var e=document.createElementNS(l.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.replaceItem(n,1),!0}catch(e){}return!1}(),k=function(){var e=document.createElementNS(l.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.insertItemBefore(n,1),!0}catch(e){}return!1}(),C=function(){var e=document.createElementNS(l.SVG,"svg"),t=document.createElementNS(l.SVG,"svg");document.documentElement.appendChild(e),t.setAttribute("x",5),e.appendChild(t);var n=document.createElementNS(l.SVG,"text");n.textContent="a",t.appendChild(n);var i=n.getStartPositionOfChar(0).x;return document.documentElement.removeChild(e),0===i}(),P=function(){var e=document.createElementNS(l.SVG,"svg");document.documentElement.appendChild(e);var t=document.createElementNS(l.SVG,"path");t.setAttribute("d","M0,0 C0,0 10,10 10,0"),e.appendChild(t);var n=t.getBBox();return document.documentElement.removeChild(e),n.height>4&&n.height<5}(),A=function(){var e=document.createElementNS(l.SVG,"svg");document.documentElement.appendChild(e);var t=document.createElementNS(l.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(l.SVG,"path");n.setAttribute("d","M5,0 15,0");var i=document.createElementNS(l.SVG,"g");i.appendChild(t),i.appendChild(n),e.appendChild(i);var r=i.getBBox();return document.documentElement.removeChild(e),15===r.width}(),E=(function(){var e=document.createElementNS(l.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");t||h.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the <a href="http://opera.com">latest version</a> in which the problems have been fixed.')}(),(c=document.createElementNS(l.SVG,"rect")).setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===c.style.vectorEffect),T=function(){var e=document.createElementNS(l.SVG,"rect").transform.baseVal,t=f.createSVGTransform();e.appendItem(t);var n=e.getItem(0);return n instanceof SVGTransform&&t instanceof SVGTransform&&n.type===t.type&&n.angle===t.angle&&n.matrix.a===t.matrix.a&&n.matrix.b===t.matrix.b&&n.matrix.c===t.matrix.c&&n.matrix.d===t.matrix.d&&n.matrix.e===t.matrix.e&&n.matrix.f===t.matrix.f}(),G=function(){return p},N=function(){return g},I=function(){return v},M=function(){return m},L=function(){return y},O=function(){return _},V=function(){return b},j=function(){return A},B=function(){return E};function R(e){this.ok=!1,"#"===e.charAt(0)&&(e=e.substr(1,6)),e=(e=e.replace(/ /g,"")).toLowerCase();var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var n in t)t.hasOwnProperty(n)&&e===n&&(e=t[n]);for(var i=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(e){return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],r=0;r<i.length;r++){var a=i[r].re,o=i[r].process,s=a.exec(e);if(s){var l=o(s);this.r=l[0],this.g=l[1],this.b=l[2],this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var e=this.r.toString(16),t=this.g.toString(16),n=this.b.toString(16);return 1===e.length&&(e="0"+e),1===t.length&&(t="0"+t),1===n.length&&(n="0"+n),"#"+e+t+n},this.getHelpXML=function(){for(var e=[],n=0;n<i.length;n++)for(var r=i[n].example,a=0;a<r.length;a++)e[e.length]=r[a];for(var o in t)t.hasOwnProperty(o)&&(e[e.length]=o);var s=document.createElement("ul");s.setAttribute("id","rgbcolor-examples");for(var l=0;l<e.length;l++)try{var u=document.createElement("li"),c=new R(e[l]),h=document.createElement("div");h.style.cssText="margin: 3px; border: 1px solid black; background:"+c.toHex()+"; color:"+c.toHex(),h.appendChild(document.createTextNode("test"));var d=document.createTextNode(" "+e[l]+" -> "+c.toRGB()+" -> "+c.toHex());u.appendChild(h),u.appendChild(d),s.appendChild(u)}catch(e){}return s}}function D(e){var n=e.fn.attr;return e.fn.attr=function(e,i){var r=this.length;if(!r)return n.apply(this,arguments);for(var a=0;a<r;++a){var o=this[a];if("http://www.w3.org/2000/svg"!==o.namespaceURI)return n.apply(this,arguments);if(void 0!==i)o.setAttribute(e,i);else if(Array.isArray(e)){for(var s={},l=e.length;l--;){var u=e[l],c=o.getAttribute(u);(c||"0"===c)&&(c=isNaN(c)?c:c-0),s[u]=c}return s}if("object"!==(void 0===e?"undefined":t(e))){var h=o.getAttribute(e);return(h||"0"===h)&&(h=isNaN(h)?h:h-0),h}for(var d in e)o.setAttribute(d,e[d])}return this},e}function F(e){return new Promise(function(t,n){var i=document.createElement("script"),r=function(){i.onerror=null,i.onload=null,i.remove(),i.src=""};i.defer="defer",i.onerror=function(){n(new Error("Failed to import: "+e)),r()},i.onload=function(){t(),r()},i.src=e,document.head.appendChild(i)})}function U(e){return new Promise(function(t,n){var i="$importModule$"+Math.random().toString(32).slice(2),r=document.createElement("script"),a=function(){delete window[i],r.onerror=null,r.onload=null,r.remove(),URL.revokeObjectURL(r.src),r.src=""};r.defer="defer",r.type="module",r.onerror=function(){n(new Error("Failed to import: "+e)),a()},r.onload=function(){t(window[i]),a()};var o=function(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}(e),s=new Blob(['import * as m from "'+o+'"; window.'+i+" = m;"],{type:"text/javascript"});r.src=URL.createObjectURL(s),document.head.appendChild(r)})}var z=document.createElementNS(l.SVG,"svg");function H(e){var t=e.matrix,n="";switch(e.type){case 1:n="matrix("+[t.a,t.b,t.c,t.d,t.e,t.f].join(",")+")";break;case 2:n="translate("+t.e+","+t.f+")";break;case 3:n=t.a===t.d?"scale("+t.a+")":"scale("+t.a+","+t.d+")";break;case 4:var i=0,r=0;if(0!==e.angle){var a=1-t.a;r=(a*t.f+t.b*t.e)/(a*a+t.b*t.b),i=(t.e-t.b*r)/a}n="rotate("+e.angle+" "+i+","+r+")"}return n}var q={},X=function e(t){n(this,e),this._elem=t||null,this._xforms=[],this._update=function(){var e="";z.createSVGMatrix();for(var t=0;t<this.numberOfItems;++t){e+=H(this._list.getItem(t))+" "}this._elem.setAttribute("transform",e)},this._list=this,this._init=function(){var e=this,t=this._elem.getAttribute("transform");if(t)for(var n=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,i=!0;i;)i=t.match(n),t=t.replace(n,""),i&&i[1]&&function(){var t=i[1].split(/\s*\(/),n=t[0],r=t[1].match(/\s*(.*?)\s*\)/);r[1]=r[1].replace(/(\d)-/g,"$1 -");var a=r[1].split(/[, ]+/),o="abcdef".split(""),s=z.createSVGMatrix();Object.values(a).forEach(function(e,t){a[t]=parseFloat(e),"matrix"===n&&(s[o[t]]=a[t])});var l=z.createSVGTransform(),u="set"+n.charAt(0).toUpperCase()+n.slice(1),c="matrix"===n?[s]:a;"scale"===n&&1===c.length?c.push(c[0]):"translate"===n&&1===c.length?c.push(0):"rotate"===n&&1===c.length&&c.push(0,0),l[u].apply(l,c),e._list.appendItem(l)}()},this._removeFromOtherLists=function(e){if(e){var t=!1;for(var n in q){for(var i=q[n],r=0,a=i._xforms.length;r<a;++r)if(i._xforms[r]===e){t=!0,i.removeItem(r);break}if(t)break}}},this.numberOfItems=0,this.clear=function(){this.numberOfItems=0,this._xforms=[]},this.initialize=function(e){this.numberOfItems=1,this._removeFromOtherLists(e),this._xforms=[e]},this.getItem=function(e){if(e<this.numberOfItems&&e>=0)return this._xforms[e];var t=new Error("DOMException with code=INDEX_SIZE_ERR");throw t.code=1,t},this.insertItemBefore=function(e,t){var n=null;if(t>=0)if(t<this.numberOfItems){this._removeFromOtherLists(e);var i=new Array(this.numberOfItems+1),r=void 0;for(r=0;r<t;++r)i[r]=this._xforms[r];i[r]=e;for(var a=r+1;r<this.numberOfItems;++a,++r)i[a]=this._xforms[r];this.numberOfItems++,this._xforms=i,n=e,this._list._update()}else n=this._list.appendItem(e);return n},this.replaceItem=function(e,t){var n=null;return t<this.numberOfItems&&t>=0&&(this._removeFromOtherLists(e),this._xforms[t]=e,n=e,this._list._update()),n},this.removeItem=function(e){if(e<this.numberOfItems&&e>=0){var t=this._xforms[e],n=new Array(this.numberOfItems-1),i=void 0;for(i=0;i<e;++i)n[i]=this._xforms[i];for(var r=i;r<this.numberOfItems-1;++r,++i)n[r]=this._xforms[i+1];return this.numberOfItems--,this._xforms=n,this._list._update(),t}var a=new Error("DOMException with code=INDEX_SIZE_ERR");throw a.code=1,a},this.appendItem=function(e){return this._removeFromOtherLists(e),this._xforms.push(e),this.numberOfItems++,this._list._update(),e}},Y=function(e){e.id&&q[e.id]&&delete q[e.id]},W=function(e){if(!T){var t=e.id||"temp",n=q[t];return n&&"temp"!==t||(q[t]=new X(e),q[t]._init(),n=q[t]),n}return e.transform?e.transform.baseVal:e.gradientTransform?e.gradientTransform.baseVal:e.patternTransform?e.patternTransform.baseVal:null},Q=["x","x1","cx","rx","width"],$=["y","y1","cy","ry","height"],Z=["r","radius"].concat(Q,$),K=void 0,J={},ee=function(){return J},te=function e(t){var n=K.getRoundDigits();return isNaN(t)?Array.isArray(t)?e(t[0])+","+e(t[1]):parseFloat(t).toFixed(n)-0:+(+t).toFixed(n)},ne=function(e,t){return t=t||K.getBaseUnit(),te(e/J[t])},ie=function(e,t){if(!isNaN(t))return t-0;if("%"===t.substr(-1)){var n=t.substr(0,t.length-1)/100,i=K.getWidth(),r=K.getHeight();return Q.includes(e)?n*i:$.includes(e)?n*r:n*Math.sqrt(i*i+r*r)/Math.sqrt(2)}var a=t.substr(-2);return t.substr(0,t.length-2)*J[a]},re=function(e,t,n){var i=!1;if(Z.includes(e))isNaN(t)?(t=t.toLowerCase(),Object.keys(J).forEach(function(e){i||new RegExp("^-?[\\d\\.]+"+e+"$").test(t)&&(i=!0)})):i=!0;else if("id"===e){var r=!1;try{var a=K.getElement(t);r=null==a||a===n}catch(e){}return r}return i=!0},ae={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"},oe=function(){function e(t,i,r,a){n(this,e),this.elem=t,this.text=a?"Move "+t.tagName+" to "+a:"Move "+t.tagName,this.oldNextSibling=i,this.oldParent=r,this.newNextSibling=t.nextSibling,this.newParent=t.parentNode}return i(e,[{key:"getText",value:function(){return this.text}},{key:"type",value:function(){return"svgedit.history.MoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_APPLY,this),this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling),e&&e.handleHistoryEvent(ae.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_UNAPPLY,this),this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling),e&&e.handleHistoryEvent(ae.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),e}();oe.type=oe.prototype.type;var se=function(){function e(t,i){n(this,e),this.elem=t,this.text=i||"Create "+t.tagName,this.parent=t.parentNode,this.nextSibling=this.elem.nextSibling}return i(e,[{key:"type",value:function(){return"svgedit.history.InsertElementCommand"}},{key:"getText",value:function(){return this.text}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_APPLY,this),this.elem=this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(ae.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_UNAPPLY,this),this.parent=this.elem.parentNode,this.elem=this.elem.parentNode.removeChild(this.elem),e&&e.handleHistoryEvent(ae.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),e}();se.type=se.prototype.type;var le=function(){function e(t,i,r,a){n(this,e),this.elem=t,this.text=a||"Delete "+t.tagName,this.nextSibling=i,this.parent=r,Y(t)}return i(e,[{key:"type",value:function(){return"svgedit.history.RemoveElementCommand"}},{key:"getText",value:function(){return this.text}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_APPLY,this),Y(this.elem),this.parent=this.elem.parentNode,this.elem=this.parent.removeChild(this.elem),e&&e.handleHistoryEvent(ae.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_UNAPPLY,this),Y(this.elem),null==this.nextSibling&&window.console&&console.log("Error: reference element was lost"),this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(ae.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),e}();le.type=le.prototype.type;var ue=function(){function e(t,i,r){for(var a in n(this,e),this.elem=t,this.text=r?"Change "+t.tagName+" "+r:"Change "+t.tagName,this.newValues={},this.oldValues=i,i)this.newValues[a]="#text"===a?t.textContent:"#href"===a?At(t):t.getAttribute(a)}return i(e,[{key:"type",value:function(){return"svgedit.history.ChangeElementCommand"}},{key:"getText",value:function(){return this.text}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_APPLY,this);var t=!1;for(var n in this.newValues)this.newValues[n]?"#text"===n?this.elem.textContent=this.newValues[n]:"#href"===n?Et(this.elem,this.newValues[n]):this.elem.setAttribute(n,this.newValues[n]):"#text"===n?this.elem.textContent="":(this.elem.setAttribute(n,""),this.elem.removeAttribute(n)),"transform"===n&&(t=!0);if(!t){var i=zt(this.elem);if(i){var r=this.elem.getBBox(),a=["rotate(",i," ",r.x+r.width/2,",",r.y+r.height/2,")"].join("");a!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",a)}}return e&&e.handleHistoryEvent(ae.AFTER_APPLY,this),!0}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_UNAPPLY,this);var t=!1;for(var n in this.oldValues)this.oldValues[n]?"#text"===n?this.elem.textContent=this.oldValues[n]:"#href"===n?Et(this.elem,this.oldValues[n]):this.elem.setAttribute(n,this.oldValues[n]):"#text"===n?this.elem.textContent="":this.elem.removeAttribute(n),"transform"===n&&(t=!0);if(!t){var i=zt(this.elem);if(i){var r=this.elem.getBBox(),a=["rotate(",i," ",r.x+r.width/2,",",r.y+r.height/2,")"].join("");a!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",a)}}return Y(this.elem),e&&e.handleHistoryEvent(ae.AFTER_UNAPPLY,this),!0}},{key:"elements",value:function(){return[this.elem]}}]),e}();ue.type=ue.prototype.type;var ce=function(){function e(t){n(this,e),this.text=t||"Batch Command",this.stack=[]}return i(e,[{key:"type",value:function(){return"svgedit.history.BatchCommand"}},{key:"getText",value:function(){return this.text}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_APPLY,this);for(var t=this.stack.length,n=0;n<t;++n)this.stack[n].apply(e);e&&e.handleHistoryEvent(ae.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ae.BEFORE_UNAPPLY,this);for(var t=this.stack.length-1;t>=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(ae.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){for(var e=[],t=this.stack.length;t--;)for(var n=this.stack[t].elements(),i=n.length;i--;)e.includes(n[i])||e.push(n[i]);return e}},{key:"addSubCommand",value:function(e){this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),e}();ce.type=ce.prototype.type;var he=function(){function e(t){n(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return i(e,[{key:"resetUndoStack",value:function(){this.undoStack=[],this.undoStackPointer=0}},{key:"getUndoStackSize",value:function(){return this.undoStackPointer}},{key:"getRedoStackSize",value:function(){return this.undoStack.length-this.undoStackPointer}},{key:"getNextUndoCommandText",value:function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():""}},{key:"getNextRedoCommandText",value:function(){return this.undoStackPointer<this.undoStack.length?this.undoStack[this.undoStackPointer].getText():""}},{key:"undo",value:function(){this.undoStackPointer>0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}},{key:"redo",value:function(){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}},{key:"addCommandToHistory",value:function(e){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&(this.undoStack=this.undoStack.splice(0,this.undoStackPointer)),this.undoStack.push(e),this.undoStackPointer=this.undoStack.length}},{key:"beginUndoableChange",value:function(e,t){for(var n=++this.undoChangeStackPointer,i=t.length,r=new Array(i),a=new Array(i);i--;){var o=t[i];null!=o&&(a[i]=o,r[i]=o.getAttribute(e))}this.undoableChangeStack[n]={attrName:e,oldValues:r,elements:a}}},{key:"finishUndoableChange",value:function(){for(var e=this.undoChangeStackPointer--,t=this.undoableChangeStack[e],n=t.attrName,i=new ce("Change "+n),r=t.elements.length;r--;){var a=t.elements[r];if(null!=a){var o={};o[n]=t.oldValues[r],o[n]!==a.getAttribute(n)&&i.addSubCommand(new ue(a,o,n))}}return this.undoableChangeStack[e]=null,i}}]),e}(),de=Object.freeze({HistoryEventTypes:ae,MoveElementCommand:oe,InsertElementCommand:se,RemoveElementCommand:le,ChangeElementCommand:ue,BatchCommand:ce,UndoManager:he}),fe=document.createElementNS(l.SVG,"svg"),pe=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},ge=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},ve=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=t.reduceRight(function(e,t){return t.multiply(e)});return Math.abs(i.a)<1e-14&&(i.a=0),Math.abs(i.b)<1e-14&&(i.b=0),Math.abs(i.c)<1e-14&&(i.c=0),Math.abs(i.d)<1e-14&&(i.d=0),Math.abs(i.e)<1e-14&&(i.e=0),Math.abs(i.f)<1e-14&&(i.f=0),i},me=function(e){if(!e)return!1;for(var t=e.numberOfItems;t--;){var n=e.getItem(t);if(1===n.type&&!ge(n.matrix))return!0}return!1},ye=function(e,t,n,i,r){var a=pe(e,t,r),o=pe(e+n,t,r),s=pe(e,t+i,r),l=pe(e+n,t+i,r),u=Math.min(a.x,o.x,s.x,l.x),c=Math.max(a.x,o.x,s.x,l.x),h=Math.min(a.y,o.y,s.y,l.y);return{tl:a,tr:o,bl:s,br:l,aabox:{x:u,y:h,width:c-u,height:Math.max(a.y,o.y,s.y,l.y)-h}}},_e=function(e,t,n){if(null==e)return fe.createSVGTransformFromMatrix(fe.createSVGMatrix());if(t=t||0,n=n||e.numberOfItems-1,(t=parseInt(t,10))>(n=parseInt(n,10))){var i=n;n=t,t=i}for(var r=fe.createSVGMatrix(),a=t;a<=n;++a){var o=a>=0&&a<e.numberOfItems?e.getItem(a).matrix:fe.createSVGMatrix();r=ve(r,o)}return fe.createSVGTransformFromMatrix(r)},be=function(e){var t=W(e);return _e(t).matrix},xe=function(e,t,n,i){var r=Math.PI/4,a=n-e,o=i-t,s=Math.atan2(o,a),l=Math.sqrt(a*a+o*o),u=Math.round(s/r)*r;return{x:e+l*Math.cos(u),y:t+l*Math.sin(u),a:u}},we=function(e,t){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y},Se=jQuery,ke={2:["x","y"],4:["x","y"],6:["x","y","x1","y1","x2","y2"],8:["x","y","x1","y1"],10:["x","y","r1","r2","angle","largeArcFlag","sweepFlag"],12:["x"],14:["y"],16:["x","y","x2","y2"],18:["x","y"]},Ce={},Pe=function(e){Object.assign(Ce,e.ui)},Ae=[],Ee=!0,Te={},Ge=null,Ne=null,Ie=function(e){Ne=e,Ae=[0,"ClosePath"];Se.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(e,t){Ae.push(t+"Abs"),Ae.push(t+"Rel")})},Me=function(e,t,n){var i=e.pathSegList;if(k)i.insertItemBefore(t,n);else{for(var r=i.numberOfItems,a=[],o=0;o<r;o++){var s=i.getItem(o);a.push(s)}i.clear();for(var l=0;l<r;l++)l===n&&i.appendItem(t),i.appendItem(a[l])}},Le=function(e,t){var n=e.path,i={x:t?t.x:e.item.x,y:t?t.y:e.item.y};n.matrix&&(i=pe(i.x,i.y,n.matrix));var r=Ne.getCurrentZoom();return i.x*=r,i.y*=r,i},Oe=function(e,t){var n={x:e.x,y:e.y};t.matrix&&(e=pe(n.x,n.y,t.imatrix),n.x=e.x,n.y=e.y);var i=Ne.getCurrentZoom();return n.x/=i,n.y/=i,n},Ve=function(e,t,n){var i=je(),r=qt("pathpointgrip_"+e);if(!r){r=document.createElementNS(l.SVG,"circle");var a={id:"pathpointgrip_"+e,display:"none",r:4,fill:"#0FF",stroke:"#00F","stroke-width":2,cursor:"move",style:"pointer-events:all"};"pathNodeTooltip"in Ce&&(a["xlink:title"]=Ce.pathNodeTooltip),Xt(r,a),r=i.appendChild(r),Se("#pathpointgrip_"+e).dblclick(function(){Ge&&Ge.setSegType()})}return t&&n&&Xt(r,{cx:t,cy:n,display:"inline"}),r},je=function(){var e=qt("pathpointgrip_container");e||((e=qt("selectorParentGroup").appendChild(document.createElementNS(l.SVG,"g"))).id="pathpointgrip_container");return e},Be=function(e){var t=qt("ctrlpointgrip_"+e);if(t)return t;t=document.createElementNS(l.SVG,"circle");var n={id:"ctrlpointgrip_"+e,display:"none",r:4,fill:"#0FF",stroke:"#55F","stroke-width":1,cursor:"move",style:"pointer-events:all"};return"pathCtrlPtTooltip"in Ce&&(n["xlink:title"]=Ce.pathCtrlPtTooltip),Xt(t,n),je().appendChild(t),t},Re=function(e){var t=qt("ctrlLine_"+e);return t||(t=document.createElementNS(l.SVG,"line"),Xt(t,{id:"ctrlLine_"+e,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),je().appendChild(t),t)},De=function(e){var t=e.item,n=e.index;if(!("x1"in t&&"x2"in t))return null;var i={};je();for(var r=[Ge.segs[n-1].item,t],a=1;a<3;a++){var o=n+"c"+a,s=i["c"+a+"_line"]=Re(o),l=Le(e,{x:t["x"+a],y:t["y"+a]}),u=Le(e,{x:r[a-1].x,y:r[a-1].y});Xt(s,{x1:l.x,y1:l.y,x2:u.x,y2:u.y,display:"inline"}),i["c"+a+"_line"]=s;var c=i["c"+a]=Be(o);Xt(c,{cx:l.x,cy:l.y,display:"inline"}),i["c"+a]=c}return i},Fe=function(e,t,n,i){var r=i||Ge.elem,a=r["createSVGPathSeg"+Ae[e]].apply(r,n);if(S)r.pathSegList.replaceItem(a,t);else{for(var o=r.pathSegList,s=o.numberOfItems,l=[],u=0;u<s;u++){var c=o.getItem(u);l.push(c)}o.clear();for(var h=0;h<s;h++)h===t?o.appendItem(a):o.appendItem(l[h])}},Ue=function(e,t){var n=e.index,i=qt("segline_"+n);if(!i){var r=je();i=document.createElementNS(l.SVG,"path"),Xt(i,{id:"segline_"+n,display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"}),r.appendChild(i)}if(t){var a=e.prev;if(!a)return i.setAttribute("display","none"),i;var o=Le(a);Fe(2,0,[o.x,o.y],i);for(var s=function(e,t){for(var n=ke[e],i=n.length,r=[],a=0;a<i;a++)r[a]=t[n[a]];return r}(e.type,e.item),u=0;u<s.length;u+=2){var c=Le(e,{x:s[u],y:s[u+1]});s[u]=c.x,s[u+1]=c.y}Fe(e.type,1,s,i)}return i},ze=function(e,t,n){var i=e.x-n.x,r=e.y-n.y,a=t.x-n.x,o=t.y-n.y;if(!(0===i&&0===r||0===a&&0===o)){var s=Math.sqrt(i*i+r*r),l=Math.sqrt(a*a+o*o),u=Ne.getSVGRoot().createSVGPoint(),c=Ne.getSVGRoot().createSVGPoint(),h=Math.atan2(r,i),d=Math.atan2(o,a);h<0&&(h+=2*Math.PI),d<0&&(d+=2*Math.PI);var f=Math.abs(h-d),p=Math.abs(Math.PI-f)/2,g=void 0,v=void 0;return h-d>0?(g=f<Math.PI?h+p:h-p,v=f<Math.PI?d-p:d+p):(g=f<Math.PI?h-p:h+p,v=f<Math.PI?d+p:d-p),u.x=s*Math.cos(g)+n.x,u.y=s*Math.sin(g)+n.y,c.x=l*Math.cos(v)+n.x,c.y=l*Math.sin(v)+n.y,[u,c]}},He=function(){function e(t,i){n(this,e),this.selected=!1,this.index=t,this.item=i,this.type=i.pathSegType,this.ctrlpts=[],this.ptgrip=null,this.segsel=null}return i(e,[{key:"showCtrlPts",value:function(e){for(var t in this.ctrlpts)this.ctrlpts.hasOwnProperty(t)&&this.ctrlpts[t].setAttribute("display",e?"inline":"none")}},{key:"selectCtrls",value:function(e){Se("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill",e?"#0FF":"#EEE")}},{key:"show",value:function(e){this.ptgrip&&(this.ptgrip.setAttribute("display",e?"inline":"none"),this.segsel.setAttribute("display",e?"inline":"none"),this.showCtrlPts(e))}},{key:"select",value:function(e){this.ptgrip&&(this.ptgrip.setAttribute("stroke",e?"#0FF":"#00F"),this.segsel.setAttribute("display",e?"inline":"none"),this.ctrlpts&&this.selectCtrls(e),this.selected=e)}},{key:"addGrip",value:function(){this.ptgrip=function(e,t){var n=e.index,i=Ve(n);if(t){var r=Le(e);Xt(i,{cx:r.x,cy:r.y,display:"inline"})}return i}(this,!0),this.ctrlpts=De(this),this.segsel=Ue(this,!0)}},{key:"update",value:function(e){if(this.ptgrip){var t=Le(this);Xt(this.ptgrip,{cx:t.x,cy:t.y}),Ue(this,!0),this.ctrlpts&&(e&&(this.item=Ge.elem.pathSegList.getItem(this.index),this.type=this.item.pathSegType),De(this))}}},{key:"move",value:function(e,t){var n=this.item,i=this.ctrlpts?[n.x+=e,n.y+=t,n.x1,n.y1,n.x2+=e,n.y2+=t]:[n.x+=e,n.y+=t];if(Fe(this.type,this.index,i),this.next&&this.next.ctrlpts){var r=this.next.item,a=[r.x,r.y,r.x1+=e,r.y1+=t,r.x2,r.y2];Fe(this.next.type,this.next.index,a)}if(this.mate){var o=this.mate.item,s=[o.x+=e,o.y+=t];Fe(this.mate.type,this.mate.index,s)}this.update(!0),this.next&&this.next.update(!0)}},{key:"setLinked",value:function(e){var t=void 0,n=void 0,i=void 0;if(2===e){if(n=1,!(t=this.next))return;i=this.item}else{if(n=2,!(t=this.prev))return;i=t.item}var r=t.item;r["x"+n]=i.x+(i.x-this.item["x"+e]),r["y"+n]=i.y+(i.y-this.item["y"+e]);var a=[r.x,r.y,r.x1,r.y1,r.x2,r.y2];Fe(t.type,t.index,a),t.update(!0)}},{key:"moveCtrl",value:function(e,t,n){var i=this.item;i["x"+e]+=t,i["y"+e]+=n;var r=[i.x,i.y,i.x1,i.y1,i.x2,i.y2];Fe(this.type,this.index,r),this.update(!0)}},{key:"setType",value:function(e,t){Fe(e,this.index,t),this.type=e,this.item=Ge.elem.pathSegList.getItem(this.index),this.showCtrlPts(6===e),this.ctrlpts=De(this),this.update(!0)}}]),e}(),qe=function(){function e(t){if(n(this,e),!t||"path"!==t.tagName)throw new Error("svgedit.path.Path constructed without a <path> element");this.elem=t,this.segs=[],this.selected_pts=[],Ge=this,this.init()}return i(e,[{key:"init",value:function(){Se(je()).find("*").each(function(){Se(this).attr("display","none")});var e=this.elem.pathSegList,t=e.numberOfItems;this.segs=[],this.selected_pts=[],this.first_seg=null;for(var n=0;n<t;n++){var i=e.getItem(n),r=new He(n,i);r.path=this,this.segs.push(r)}for(var a=this.segs,o=null,s=0;s<t;s++){var l=a[s],u=s+1>=t?null:a[s+1],c=s-1<0?null:a[s-1];if(2===l.type){if(c&&1!==c.type){var h=a[o];h.next=a[o+1],h.next.prev=h,h.addGrip()}o=s}else if(u&&1===u.type)l.next=a[o+1],l.next.prev=l,l.mate=a[o],l.addGrip(),null==this.first_seg&&(this.first_seg=l);else if(u)1!==l.type&&(l.addGrip(),u&&2!==u.type&&(l.next=u,l.next.prev=l));else if(1!==l.type){var d=a[o];d.next=a[o+1],d.next.prev=d,d.addGrip(),l.addGrip(),this.first_seg||(this.first_seg=a[o])}}return this}},{key:"eachSeg",value:function(e){for(var t=this.segs.length,n=0;n<t;n++){if(!1===e.call(this.segs[n],n))break}}},{key:"addSeg",value:function(e){var t=this.segs[e];if(t.prev){var n=t.prev,i=void 0,r=void 0,a=void 0;switch(t.item.pathSegType){case 4:r=(t.item.x+n.item.x)/2,a=(t.item.y+n.item.y)/2,i=this.elem.createSVGPathSegLinetoAbs(r,a);break;case 6:var o=(n.item.x+t.item.x1)/2,s=(t.item.x1+t.item.x2)/2,l=(t.item.x2+t.item.x)/2,u=(o+s)/2,c=(s+l)/2;r=(u+c)/2;var h=(n.item.y+t.item.y1)/2,d=(t.item.y1+t.item.y2)/2,f=(t.item.y2+t.item.y)/2,p=(h+d)/2,g=(d+f)/2;a=(p+g)/2,i=this.elem.createSVGPathSegCurvetoCubicAbs(r,a,o,h,u,p);var v=[t.item.x,t.item.y,c,g,l,f];Fe(t.type,e,v)}Me(this.elem,i,e)}}},{key:"deleteSeg",value:function(e){var t=this.segs[e],n=this.elem.pathSegList;t.show(!1);var i=t.next;if(t.mate){var r=[i.item.x,i.item.y];Fe(2,i.index,r),Fe(4,t.index,r),n.removeItem(t.mate.index)}else if(t.prev)n.removeItem(e);else{var a=[i.item.x,i.item.y];Fe(2,t.next.index,a),n.removeItem(e)}}},{key:"subpathIsClosed",value:function(e){var t=!1;return Ge.eachSeg(function(n){return n<=e||2!==this.type&&(1===this.type?(t=!0,!1):void 0)}),t}},{key:"removePtFromSelection",value:function(e){var t=this.selected_pts.indexOf(e);-1!==t&&(this.segs[e].select(!1),this.selected_pts.splice(t,1))}},{key:"clearSelection",value:function(){this.eachSeg(function(){this.select(!1)}),this.selected_pts=[]}},{key:"storeD",value:function(){this.last_d=this.elem.getAttribute("d")}},{key:"show",value:function(e){return this.eachSeg(function(){this.show(e)}),e&&this.selectPt(this.first_seg.index),this}},{key:"movePts",value:function(e,t){for(var n=this.selected_pts.length;n--;){this.segs[this.selected_pts[n]].move(e,t)}}},{key:"moveCtrl",value:function(e,t){var n=this.segs[this.selected_pts[0]];n.moveCtrl(this.dragctrl,e,t),Ee&&n.setLinked(this.dragctrl)}},{key:"setSegType",value:function(e){this.storeD();for(var t=this.selected_pts.length,n=void 0;t--;){var i=this.selected_pts[t],r=this.segs[i],a=r.prev;if(a){if(!e)n="Toggle Path Segment Type",e=6===r.type?4:6;e=Number(e);var o=r.item.x,s=r.item.y,l=a.item.x,u=a.item.y,c=void 0;switch(e){case 6:if(r.olditem){var h=r.olditem;c=[o,s,h.x1,h.y1,h.x2,h.y2]}else{var d=o-l,f=s-u;c=[o,s,l+d/3,u+f/3,o-d/3,s-f/3]}break;case 4:c=[o,s],r.olditem=r.item}r.setType(e,c)}}Ge.endChanges(n)}},{key:"selectPt",value:function(e,t){this.clearSelection(),null==e&&this.eachSeg(function(t){this.prev&&(e=t)}),this.addPtsToSelection(e),t&&(this.dragctrl=t,Ee&&this.segs[e].setLinked(t))}},{key:"update",value:function(){var e=this.elem;return zt(e)?(this.matrix=be(e),this.imatrix=this.matrix.inverse()):(this.matrix=null,this.imatrix=null),this.eachSeg(function(t){this.item=e.pathSegList.getItem(t),this.update()}),this}},{key:"endChanges",value:function(e){N()&&Ne.resetD(this.elem);var t=new ue(this.elem,{d:this.last_d},e);Ne.endChanges({cmd:t,elem:this.elem})}},{key:"addPtsToSelection",value:function(e){Array.isArray(e)||(e=[e]);for(var t=0;t<e.length;t++){var n=e[t];this.segs[n].ptgrip&&!this.selected_pts.includes(n)&&n>=0&&this.selected_pts.push(n)}this.selected_pts.sort();var i=this.selected_pts.length,r=[];for(r.length=i;i--;){var a=this.selected_pts[i],o=this.segs[a];o.select(!0),r[i]=o.ptgrip}var s=this.subpathIsClosed(this.selected_pts[0]);Ne.addPtsToSelection({grips:r,closedSubpath:s})}}]),e}(),Xe=function(e){var t=Te[e.id];return t||(t=Te[e.id]=new qe(e)),t},Ye=function(e){e in Te&&delete Te[e]},We=void 0,Qe=void 0,$e=void 0,Ze=void 0,Ke=void 0,Je=function(e,t){var n=e-$e,i=t-Ze,r=Math.sqrt(n*n+i*i),a=Math.atan2(i,n)+Ke;return n=r*Math.cos(a)+$e,i=r*Math.sin(a)+Ze,n-=We,i-=Qe,r=Math.sqrt(n*n+i*i),a=Math.atan2(i,n)-Ke,{x:r*Math.cos(a)+We,y:r*Math.sin(a)+Qe}},et=function(){var e=Ge.elem;if(Ke=zt(e,!0)){var t=Ge.oldbbox;$e=t.x+t.width/2,Ze=t.y+t.height/2;var n=It(e);We=n.x+n.width/2,Qe=n.y+n.height/2;var i=We-$e,r=Qe-Ze,a=Math.sqrt(i*i+r*r),o=Math.atan2(r,i)+Ke;We=a*Math.cos(o)+$e,Qe=a*Math.sin(o)+Ze;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var u=s.getItem(l),c=u.pathSegType;if(1!==c){var h=Je(u.x,u.y),d=[h.x,h.y];if(null!=u.x1&&null!=u.x2){var f=Je(u.x1,u.y1),p=Je(u.x2,u.y2);d.splice(d.length,0,f.x,f.y,p.x,p.y)}Fe(c,l,d)}}n=It(e);var g=Ne.getSVGRoot().createSVGTransform(),v=W(e);g.setRotate(180*Ke/Math.PI,We,Qe),v.replaceItem(g,0)}},tt=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],nt=function(e,t){for(var n=e.pathSegList,i=n.numberOfItems,r=0,a=0,o="",s=null,l=0;l<i;++l){var u=n.getItem(l),c=u.x||0,h=u.y||0,d=u.x1||0,f=u.y1||0,p=u.x2||0,g=u.y2||0,v=u.pathSegType,m=tt[v]["to"+(t?"Lower":"Upper")+"Case"]();switch(v){case 1:o+="z",s&&!t&&(r=s[0],a=s[1]);break;case 12:c-=r;case 13:t?(r+=c,m="l"):(r=c+=r,m="L"),o+=it(m,[[c,a]]);break;case 14:h-=a;case 15:t?(a+=h,m="l"):(a=h+=a,m="L"),o+=it(m,[[r,h]]);break;case 2:case 4:case 18:c-=r,h-=a;case 5:case 3:case 19:t?(r+=c,a+=h):(r=c+=r,a=h+=a),2!==v&&3!==v||(s=[r,a]),o+=it(m,[[c,h]]);break;case 6:c-=r,d-=r,p-=r,h-=a,f-=a,g-=a;case 7:t?(r+=c,a+=h):(d+=r,p+=r,f+=a,g+=a,r=c+=r,a=h+=a),o+=it(m,[[d,f],[p,g],[c,h]]);break;case 8:c-=r,d-=r,h-=a,f-=a;case 9:t?(r+=c,a+=h):(d+=r,f+=a,r=c+=r,a=h+=a),o+=it(m,[[d,f],[c,h]]);break;case 10:c-=r,h-=a;case 11:t?(r+=c,a+=h):(r=c+=r,a=h+=a),o+=it(m,[[u.r1,u.r2]],[u.angle,u.largeArcFlag?1:0,u.sweepFlag?1:0],[c,h]);break;case 16:c-=r,p-=r,h-=a,g-=a;case 17:t?(r+=c,a+=h):(p+=r,g+=a,r=c+=r,a=h+=a),o+=it(m,[[p,g],[c,h]])}}return o};function it(e,t,n,i){Se.each(t,function(e,n){t[e]=te(n)});var r=e+t.join(" ");return n&&(r+=" "+n.join(" ")),i&&(r+=" "+te(i)),r}var rt,at,ot,st,lt,ut=(rt=!1,at=void 0,ot=void 0,st=null,lt=!1,{mouseDown:function(e,t,n,i){var r=void 0;if("path"!==Ne.getCurrentMode()){if(Ge){Ge.storeD();var a=void 0;if("pathpointgrip_"===(r=e.target.id).substr(0,14)){a=Ge.cur_pt=parseInt(r.substr(14),10),Ge.dragging=[n,i];var o=Ge.segs[a];e.shiftKey?o.selected?Ge.removePtFromSelection(a):Ge.addPtsToSelection(a):((Ge.selected_pts.length<=1||!o.selected)&&Ge.clearSelection(),Ge.addPtsToSelection(a))}else if(r.startsWith("ctrlpointgrip_")){Ge.dragging=[n,i];var s=r.split("_")[1].split("c");a=Number(s[0]);var u=Number(s[1]);Ge.selectPt(a,u)}if(!Ge.dragging){var c=Ne.getRubberBox();null==c&&(c=Ne.setRubberBox(Ne.selectorManager.getRubberBandBox()));var h=Ne.getCurrentZoom();Xt(c,{x:n*h,y:i*h,width:0,height:0,display:"inline"},100)}}}else{var d=n,f=i,p=Ne.getCurrentZoom(),g=d/p,v=f/p,m=qt("path_stretch_line");at=[g,v],Ne.getGridSnapping()&&(g=Wt(g),v=Wt(v),d=Wt(d),f=Wt(f)),m||(m=document.createElementNS(l.SVG,"path"),Xt(m,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}),m=qt("selectorParentGroup").appendChild(m)),m.setAttribute("display","inline");var y=void 0,_=Ne.getDrawnPath();if(_){for(var b=_.pathSegList,x=b.numberOfItems,w=6/p,S=!1;x;){x--;var k=b.getItem(x),C=k.x,P=k.y;if(g>=C-w&&g<=C+w&&v>=P-w&&v<=P+w){S=!0;break}}r=Ne.getId(),Ye(r);var A=qt(r),E=void 0,T=void 0,G=b.numberOfItems;if(S){if(x<=1&&G>=2){var N=b.getItem(0).x,I=b.getItem(0).y;E=4===(T=m.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(N,I):_.createSVGPathSegCurvetoCubicAbs(N,I,T.x1/p,T.y1/p,N,I);var M=_.createSVGPathSegClosePath();b.appendItem(E),b.appendItem(M)}else if(G<3)return!1;if(Se(m).remove(),_=Ne.setDrawnPath(null),Ne.setStarted(!1),rt){Ge.matrix&&Ne.remapElement(A,{},Ge.matrix.inverse());var L=A.getAttribute("d"),O=Se(Ge.elem).attr("d");return Se(Ge.elem).attr("d",O+L),Se(A).remove(),Ge.matrix&&et(),Ie(),ut.toEditMode(Ge.elem),Ge.selectPt(),!1}}else{if(!Se.contains(Ne.getContainer(),Ne.getMouseTarget(e)))return console.log("Clicked outside canvas"),!1;var V=_.pathSegList.numberOfItems,j=_.pathSegList.getItem(V-1),B=j.x,R=j.y;if(e.shiftKey){var D=xe(B,R,g,v);g=D.x,v=D.y}E=4===(T=m.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(Ne.round(g),Ne.round(v)):_.createSVGPathSegCurvetoCubicAbs(Ne.round(g),Ne.round(v),T.x1/p,T.y1/p,T.x2/p,T.y2/p),_.pathSegList.appendItem(E),g*=p,v*=p,m.setAttribute("d",["M",g,v,g,v].join(" ")),y=V,rt&&(y+=Ge.segs.length),Ve(y,g,v)}}else{var F="M"+g+","+v+" ";_=Ne.setDrawnPath(Ne.addSvgElementFromJson({element:"path",curStyles:!0,attr:{d:F,id:Ne.getNextId(),opacity:Ne.getOpacity()/2}})),m.setAttribute("d",["M",d,f,d,f].join(" ")),y=rt?Ge.segs.length:0,Ve(y,d,f)}}},mouseMove:function(e,t){var n=Ne.getCurrentZoom();lt=!0;var i=Ne.getDrawnPath();if("path"!==Ne.getCurrentMode())if(Ge.dragging){var r=Oe({x:Ge.dragging[0],y:Ge.dragging[1]},Ge),a=Oe({x:e,y:t},Ge),o=a.x-r.x,s=a.y-r.y;Ge.dragging=[e,t],Ge.dragctrl?Ge.moveCtrl(o,s):Ge.movePts(o,s)}else Ge.selected_pts=[],Ge.eachSeg(function(e){if(this.next||this.prev){var t=Ne.getRubberBox().getBBox(),n=Le(this),i={x:n.x,y:n.y,width:0,height:0},r=we(t,i);this.select(r),r&&Ge.selected_pts.push(this.index)}});else{if(!i)return;var l=i.pathSegList,u=l.numberOfItems-1;if(at){var c=Be("1c1"),h=Be("0c2");c.setAttribute("cx",e),c.setAttribute("cy",t),c.setAttribute("display","inline");var d=at[0],f=at[1],p=d+(d-e/n),g=f+(f-t/n);h.setAttribute("cx",p*n),h.setAttribute("cy",g*n),h.setAttribute("display","inline");var v=Re(1);if(Xt(v,{x1:e,y1:t,x2:p*n,y2:g*n,display:"inline"}),0===u)ot=[e,t];else{var m=l.getItem(u-1),y=m.x,_=m.y;6===m.pathSegType?(y+=y-m.x2,_+=_-m.y2):ot&&(y=ot[0]/n,_=ot[1]/n),Fe(6,u,[d,f,y,_,p,g],i)}}else{var b=qt("path_stretch_line");if(b){var x=l.getItem(u);if(6===x.pathSegType){var w=x.x+(x.x-x.x2),S=x.y+(x.y-x.y2);Fe(6,1,[e,t,w*n,S*n,e,t],b)}else ot?Fe(6,1,[e,t,ot[0],ot[1],e,t],b):Fe(4,1,[e,t],b)}}}},mouseUp:function(e,t,n,i){var r=Ne.getDrawnPath();if("path"===Ne.getCurrentMode())return at=null,r||(t=qt(Ne.getId()),Ne.setStarted(!1),ot=null),{keep:!0,element:t};var a=Ne.getRubberBox();if(Ge.dragging){var o=Ge.cur_pt;Ge.dragging=!1,Ge.dragctrl=!1,Ge.update(),lt&&Ge.endChanges("Move path point(s)"),e.shiftKey||lt||Ge.selectPt(o)}else a&&"none"!==a.getAttribute("display")?(a.setAttribute("display","none"),a.getAttribute("width")<=2&&a.getAttribute("height")<=2&&ut.toSelectMode(e.target)):ut.toSelectMode(e.target);lt=!1},toEditMode:function(e){Ge=Xe(e),Ne.setCurrentMode("pathedit"),Ne.clearSelection(),Ge.show(!0).update(),Ge.oldbbox=It(Ge.elem),rt=!1},toSelectMode:function(e){var t=e===Ge.elem;Ne.setCurrentMode("select"),Ge.show(!1),st=!1,Ne.clearSelection(),Ge.matrix&&et(),t&&(Ne.call("selected",[e]),Ne.addToSelection([e],!0))},addSubPath:function(e){e?(Ne.setCurrentMode("path"),rt=!0):(ut.clear(!0),ut.toEditMode(Ge.elem))},select:function(e){st===e?(ut.toEditMode(e),Ne.setCurrentMode("pathedit")):st=e},reorient:function(){var e=Ne.getSelectedElements()[0];if(e&&0!==zt(e)){var t=new ce("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new ue(e,n)),Ne.clearSelection(),this.resetOrientation(e),Ne.addCommandToHistory(t),Xe(e).show(!1).matrix=null,this.clear(),Ne.addToSelection([e],!0),Ne.call("changed",Ne.getSelectedElements())}},clear:function(e){var t=Ne.getDrawnPath();if(st=null,t){var n=qt(Ne.getId());Se(qt("path_stretch_line")).remove(),Se(n).remove(),Se(qt("pathpointgrip_container")).find("*").attr("display","none"),ot=null,Ne.setDrawnPath(null),Ne.setStarted(!1)}else"pathedit"===Ne.getCurrentMode()&&this.toSelectMode();Ge&&Ge.init().show(!1)},resetOrientation:function(e){if(null==e||"path"!==e.nodeName)return!1;var t=W(e),n=_e(t).matrix;t.clear(),e.removeAttribute("transform");for(var i=e.pathSegList,r=i.numberOfItems,a=function(t){var r=i.getItem(t),a=r.pathSegType;if(1===a)return"continue";var o=[];Se.each(["",1,2],function(e,t){var i=r["x"+t],a=r["y"+t];if(void 0!==i&&void 0!==a){var s=pe(i,a,n);o.splice(o.length,0,s.x,s.y)}}),Fe(a,t,o,e)},o=0;o<r;++o)a(o);!function(e,t){for(var n=It(e),i=0;i<2;i++){var r=0===i?"fill":"stroke",a=e.getAttribute(r);if(a&&a.startsWith("url(")){var o=Ht(a);if("linearGradient"===o.tagName){var s=o.getAttribute("x1")||0,l=o.getAttribute("y1")||0,u=o.getAttribute("x2")||1,c=o.getAttribute("y2")||0;s=n.width*s+n.x,l=n.height*l+n.y,u=n.width*u+n.x,c=n.height*c+n.y;var h=pe(s,l,t),d=pe(u,c,t),f={};f.x1=(h.x-n.x)/n.width,f.y1=(h.y-n.y)/n.height,f.x2=(d.x-n.x)/n.width,f.y2=(d.y-n.y)/n.height;var p=o.cloneNode(!0);Se(p).attr(f),p.id=Ne.getNextId(),Tt().appendChild(p),e.setAttribute(r,"url(#"+p.id+")")}}}}(e,n)},zoomChange:function(){"pathedit"===Ne.getCurrentMode()&&Ge.update()},getNodePoint:function(){var e=Ge.selected_pts.length?Ge.selected_pts[0]:1,t=Ge.segs[e];return{x:t.item.x,y:t.item.y,type:t.type}},linkControlPoints:function(e){Ee=e},clonePathNode:function(){Ge.storeD();for(var e=Ge.selected_pts,t=e.length,n=[];t--;){var i=e[t];Ge.addSeg(i),n.push(i+t),n.push(i+t+1)}Ge.init().addPtsToSelection(n),Ge.endChanges("Clone path node(s)")},opencloseSubPath:function(){var e=Ge.selected_pts;if(1===e.length){var t=Ge.elem,n=t.pathSegList,i=e[0],r=null,a=null;if(Ge.eachSeg(function(e){return 2===this.type&&e<=i&&(a=this.item),e<=i||(2===this.type?(r=e,!1):1===this.type?(r=!1,!1):void 0)}),null==r&&(r=Ge.segs.length-1),!1!==r){var o=t.createSVGPathSegLinetoAbs(a.x,a.y),s=t.createSVGPathSegClosePath();return r===Ge.segs.length-1?(n.appendItem(o),n.appendItem(s)):(Me(t,s,r),Me(t,o,r)),void Ge.init().selectPt(r+1)}if(Ge.segs[i].mate)return n.removeItem(i),n.removeItem(i),void Ge.init().selectPt(i-1);for(var l=void 0,u=void 0,c=0;c<n.numberOfItems;c++){var h=n.getItem(c);if(2===h.pathSegType)l=c;else if(c===i)n.removeItem(l);else if(1===h.pathSegType&&i<c){u=c-1,n.removeItem(c);break}}for(var d=i-l-1;d--;)Me(t,n.getItem(l),u);var f=n.getItem(l);Fe(2,l,[f.x,f.y]),Ge.init().selectPt(0)}},deletePathNode:function(){if(ut.canDeleteNodes){Ge.storeD();for(var e=Ge.selected_pts,t=e.length;t--;){var n=e[t];Ge.deleteSeg(n)}if(function e(){var t=Ge.elem.pathSegList,n=t.numberOfItems,i=function(e,n){for(;n--;)t.removeItem(e)};if(n<=1)return!0;for(;n--;){var r=t.getItem(n);if(1===r.pathSegType){var a=t.getItem(n-1),o=t.getItem(n-2);if(2===a.pathSegType){i(n-1,2),e();break}if(2===o.pathSegType){i(n-2,3),e();break}}else if(2===r.pathSegType&&n>0){var s=t.getItem(n-1).pathSegType;if(2===s){i(n-1,1),e();break}if(1===s&&t.numberOfItems-1===n){i(n,1),e();break}}}return!1}(),Ge.elem.pathSegList.numberOfItems<=1)return ut.toSelectMode(Ge.elem),void Ne.canvas.deleteSelectedElements();if(Ge.init(),Ge.clearSelection(),window.opera){var i=Se(Ge.elem);i.attr("d",i.attr("d"))}Ge.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t=void 0,n=e.points,i=n.numberOfItems;if(i>=4){var r=n.getItem(0),a=null,o=[];for(o.push(["M",r.x,",",r.y," C"].join("")),t=1;t<=i-4;t+=3){var s=n.getItem(t),l=n.getItem(t+1),u=n.getItem(t+2);if(a){var c=ze(a,s,r);if(c&&2===c.length){var h=o[o.length-1].split(",");h[2]=c[0].x,h[3]=c[0].y,o[o.length-1]=h.join(","),s=c[1]}}o.push([s.x,s.y,l.x,l.y,u.x,u.y].join(",")),r=u,a=l}for(o.push("L");t<i;){var d=n.getItem(t);o.push([d.x,d.y].join(",")),t++}o=o.join(" "),e=Ne.addSvgElementFromJson({element:"path",curStyles:!0,attr:{id:Ne.getId(),d:o,fill:"none"}})}return e},setSegType:function(e){Ge.setSegType(e)},moveNode:function(e,t){var n=Ge.selected_pts;if(n.length){Ge.storeD();var i=Ge.segs[n[0]],r={x:0,y:0};r[e]=t-i.item[e],i.move(r.x,r.y),Ge.endChanges("Move path point")}},fixEnd:function(e){for(var t=e.pathSegList,n=t.numberOfItems,i=void 0,r=0;r<n;++r){var a=t.getItem(r);if(2===a.pathSegType&&(i=a),1===a.pathSegType){var o=t.getItem(r-1);if(o.x!==i.x||o.y!==i.y){var s=e.createSVGPathSegLinetoAbs(i.x,i.y);Me(e,s,r),ut.fixEnd(e);break}}}N()&&Ne.resetD(e)},convertPath:nt}),ct=D(jQuery),ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",dt="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),ft=null,pt=null,gt=null,vt=null,mt=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/,"&#x27;")},yt=function(e){if(e=xt(e),window.btoa)return window.btoa(e);var t=[];t.length=4*Math.floor((e.length+2)/3);var n=0,i=0;do{var r=e.charCodeAt(n++),a=e.charCodeAt(n++),o=e.charCodeAt(n++),s=r>>2,l=(3&r)<<4|a>>4,u=(15&a)<<2|o>>6,c=63&o;isNaN(a)?u=c=64:isNaN(o)&&(c=64),t[i++]=ht.charAt(s),t[i++]=ht.charAt(l),t[i++]=ht.charAt(u),t[i++]=ht.charAt(c)}while(n<e.length);return t.join("")},_t=function(e){if(window.atob)return bt(window.atob(e));e=e.replace(/[^A-Za-z0-9+/=]/g,"");var t="",n=0;do{var i=ht.indexOf(e.charAt(n++)),r=ht.indexOf(e.charAt(n++)),a=ht.indexOf(e.charAt(n++)),o=ht.indexOf(e.charAt(n++)),s=i<<2|r>>4,l=(15&r)<<4|a>>2,u=(3&a)<<6|o;t+=String.fromCharCode(s),64!==a&&(t+=String.fromCharCode(l)),64!==o&&(t+=String.fromCharCode(u))}while(n<e.length);return bt(t)},bt=function(e){return decodeURIComponent(escape(e))},xt=function(e){return unescape(encodeURIComponent(e))},wt=function(e){return e&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(e):""},St=function(){if("undefined"==typeof Blob)return"";var e=new Blob(["<html><head><title>SVG-edit</title></head><body>&nbsp;</body></html>"],{type:"text/html"});return wt(e)}(),kt=function(e){e.includes("<svg:svg")&&(e=e.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns"));var t=void 0,n=void 0;try{(n=window.DOMParser?new DOMParser:new ActiveXObject("Microsoft.XMLDOM")).async=!1}catch(e){throw new Error("XML Parser could not be instantiated")}try{t=n.loadXML?!!n.loadXML(e)&&n:n.parseFromString(e,"text/xml")}catch(e){throw new Error("Error parsing XML string")}return t},Ct=function e(t,n){if(t&&1===t.nodeType){n(t);for(var i=t.childNodes.length;i--;)e(t.childNodes.item(i),n)}},Pt=function(e){if(e){if(e.startsWith('url("'))return e.substring(5,e.indexOf('"',6));if(e.startsWith("url('"))return e.substring(5,e.indexOf("'",6));if(e.startsWith("url("))return e.substring(4,e.indexOf(")"))}return null},At=function(e){return e.getAttributeNS(l.XLINK,"href")},Et=function(e,t){e.setAttributeNS(l.XLINK,"xlink:href",t)},Tt=function(){var e=ft.getSVGContent(),t=e.getElementsByTagNameNS(l.SVG,"defs");return t.length>0?t=t[0]:(t=e.ownerDocument.createElementNS(l.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.appendChild(t)),t},Gt=function(e){for(var t=e.pathSegList,n=t.numberOfItems,i=[[],[]],r=t.getItem(0),a=[r.x,r.y],o=0;o<n;o++){var s=t.getItem(o);void 0!==s.x&&(i[0].push(a[0]),i[1].push(a[1]),s.x1?function(){for(var e=[s.x1,s.y1],t=[s.x2,s.y2],n=[s.x,s.y],r=function(r){var o=function(i){return Math.pow(1-i,3)*a[r]+3*Math.pow(1-i,2)*i*e[r]+3*(1-i)*Math.pow(i,2)*t[r]+Math.pow(i,3)*n[r]},s=6*a[r]-12*e[r]+6*t[r],l=-3*a[r]+9*e[r]-9*t[r]+3*n[r],u=3*e[r]-3*a[r];if(0===l){if(0===s)return"continue";var c=-u/s;return c>0&&c<1&&i[r].push(o(c)),"continue"}var h=Math.pow(s,2)-4*u*l;if(h<0)return"continue";var d=(-s+Math.sqrt(h))/(2*l);d>0&&d<1&&i[r].push(o(d));var f=(-s-Math.sqrt(h))/(2*l);f>0&&f<1&&i[r].push(o(f))},o=0;o<2;o++)r(o);a=n}():(i[0].push(s.x),i[1].push(s.y)))}var l=Math.min.apply(null,i[0]),u=Math.max.apply(null,i[0])-l,c=Math.min.apply(null,i[1]);return{x:l,y:c,width:u,height:Math.max.apply(null,i[1])-c}};function Nt(e){if(j())try{return e.getBBox()}catch(e){}var t=ct.data(e,"ref"),n=null,i=void 0,r=void 0;t?(r=ct(t).children().clone().attr("visibility","hidden"),ct(vt).append(r),n=r.filter("line, path")):n=ct(e).find("line, path");var a=!1;if(n.length)if(n.each(function(){var e=this.getBBox();e.width&&e.height||(a=!0)}),a){var o=t?r:ct(e).children();i=Rt(o)}else i=e.getBBox();else i=e.getBBox();return t&&r.remove(),i}var It=function(e){var t=e||ft.geSelectedElements()[0];if(1!==e.nodeType)return null;var n,i=t.nodeName,r=null;switch(i){case"text":""===t.textContent?(t.textContent="a",r=t.getBBox(),t.textContent=""):t.getBBox&&(r=t.getBBox());break;case"path":P?t.getBBox&&(r=t.getBBox()):r=Gt(t);break;case"g":case"a":r=Nt(t);break;default:if("use"===i&&(r=Nt(t)),"use"===i||"foreignObject"===i&&N()){if(r||(r=t.getBBox()),!N()){var a={};a.width=r.width,a.height=r.height,a.x=r.x+parseFloat(t.getAttribute("x")||0),a.y=r.y+parseFloat(t.getAttribute("y")||0),r=a}}else if(dt.includes(i))if(t)try{r=t.getBBox()}catch(e){var o=t.getExtentOfChar(0),s=t.getComputedTextLength();r={x:o.x,y:o.y,width:s,height:o.height}}else{var l=ct(t).closest("foreignObject");l.length&&l[0].getBBox&&(r=l[0].getBBox())}}return r&&(r={x:(n=r).x,y:n.y,width:n.width,height:n.height}),r},Mt=function(e){var t="";return ct.each(e,function(e,n){var i=n[1];t+=n[0];for(var r=0;r<i.length;r+=2)t+=i[r]+","+i[r+1]+" "}),t},Lt=function(e){var t=1.81,n=void 0,i=void 0,r=void 0,a=void 0;switch(e.tagName){case"ellipse":case"circle":var o=i=ct(e).attr(["rx","ry","cx","cy"]),s=o.cx,l=o.cy,u=i;r=u.rx,a=u.ry,"circle"===e.tagName&&(r=a=ct(e).attr("r")),n=Mt([["M",[s-r,l]],["C",[s-r,l-a/t,s-r/t,l-a,s,l-a]],["C",[s+r/t,l-a,s+r,l-a/t,s+r,l]],["C",[s+r,l+a/t,s+r/t,l+a,s,l+a]],["C",[s-r/t,l+a,s-r,l+a/t,s-r,l]],["Z",[]]]);break;case"path":n=e.getAttribute("d");break;case"line":n="M"+(i=ct(e).attr(["x1","y1","x2","y2"])).x1+","+i.y1+"L"+i.x2+","+i.y2;break;case"polyline":n="M"+e.getAttribute("points");break;case"polygon":n="M"+e.getAttribute("points")+" Z";break;case"rect":var c=ct(e).attr(["rx","ry"]);r=c.rx,a=c.ry;var h=e.getBBox(),d=h.x,f=h.y,p=h.width,g=h.height;t=4-t,n=Mt(r||a?[["M",[d,f+a]],["C",[d,f+a/t,d+r/t,f,d+r,f]],["L",[d+p-r,f]],["C",[d+p-r/t,f,d+p,f+a/t,d+p,f+a]],["L",[d+p,f+g-a]],["C",[d+p,f+g-a/t,d+p-r/t,f+g,d+p-r,f+g]],["L",[d+r,f+g]],["C",[d+r/t,f+g,d,f+g-a/t,d,f+g-a]],["L",[d,f+a]],["Z",[]]]:[["M",[d,f]],["L",[d+p,f]],["L",[d+p,f+g]],["L",[d,f+g]],["L",[d,f]],["Z",[]]])}return n},Ot=function(e){var t={};return ct.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){var n=e.getAttribute(this);n&&(t[this]=n)}),t},Vt=function(e,t,n){var i=t({element:"path",attr:Ot(e)}),r=e.getAttribute("transform");r&&i.setAttribute("transform",r);var a=e.parentNode;e.nextSibling?a.insertBefore(i,e):a.appendChild(i);var o=Lt(e);o?i.setAttribute("d",o):i.parentNode.removeChild(i),n.resetOrientation(i);var s=!1;try{s=i.getBBox()}catch(e){}return i.parentNode.removeChild(i),s};var jt=function(e,t,n){var i=It(e);if(!i)return null;var r=W(e),a=Ut(r),o=me(r);if(a||o){var s=!1;if(function(e,t){var n=e%90;return t||!(n>-.001&&n<.001||n<-89.99||n>89.99)}(a,o)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))i=s=Vt(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),u=e.getAttribute("ry");(l||u)&&(i=s=Vt(e,t,n))}}if(!s){var c=_e(r).matrix;i=ye(i.x,i.y,i.width,i.height,c).aabox}}return i};function Bt(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var Rt=function(e,t,n){if(!e||!e.length)return!1;var i=void 0;if(ct.each(e,function(){i||this.parentNode&&(i=jt(this,t,n))}),void 0===i)return null;var r=i.x+i.width,a=i.y+i.height,o=i.x,s=i.y;if(1===e.length){var l=Bt(e[0]);o-=l,s-=l,r+=l,a+=l}else ct.each(e,function(e,i){var l=jt(i,t,n);if(l){var u=Bt(i);o=Math.min(o,l.x-u),s=Math.min(s,l.y-u),1===i.nodeType&&(r=Math.max(r,l.x+l.width+u),a=Math.max(a,l.y+l.height+u))}});return i.x=o,i.y=s,i.width=r-o,i.height=a-s,i},Dt=function(e){e||(e=ct(ft.getSVGContent()).children());var t=[];return ct(e).children().each(function(e,n){n.getBBox&&t.push(n)}),t.reverse()},Ft=function(e){return e||(e=Dt()),Rt(e,ft.addSvgElementFromJson,ft.pathActions)},Ut=function(e,t){if(!e)return 0;for(var n=e.numberOfItems,i=0;i<n;++i){var r=e.getItem(i);if(4===r.type)return t?r.angle*Math.PI/180:r.angle}return 0},zt=function(e,t){var n=e||ft.getSelectedElements()[0],i=W(n);return Ut(i,t)},Ht=function(e){return qt(Pt(e).substr(1))},qt=x?function(e){return vt.querySelector("#"+e)}:w?function(e){return pt.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+e+'"]',gt,function(){return l.SVG},9,null).singleNodeValue}:function(e){return ct(vt).find("[id="+e+"]")[0]},Xt=function(e,t,n,i){for(var r in t){var a="xml:"===r.substr(0,4)?l.XML:"xlink:"===r.substr(0,6)?l.XLINK:null;a?e.setAttributeNS(a,r,t[r]):i?(o=e,s=r,u=t[r],o.setAttribute(s,u)):e.setAttribute(r,t[r])}var o,s,u},Yt=function(e){var t={"fill-opacity":1,"stop-opacity":1,opacity:1,stroke:"none","stroke-dasharray":"none","stroke-linejoin":"miter","stroke-linecap":"butt","stroke-opacity":1,"stroke-width":1,rx:0,ry:0};for(var n in"ellipse"===e.nodeName&&(delete t.rx,delete t.ry),t){var i=t[n];e.getAttribute(n)===String(i)&&e.removeAttribute(n)}},Wt=function(e){var t=ft.getBaseUnit(),n=ft.getSnappingStep();return"px"!==t&&(n*=ee()[t]),e=Math.round(e/n)*n},Qt={},$t=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{globals:!1};return function(){var r=arguments;function a(){n.apply(null,r)}var o=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules);if(!0===Qt[e])a();else if(Array.isArray(Qt[e]))Qt[e].push(a);else{Qt[e]=[];var s=o&&!i.globals?U:F;t.reduce(function(e,t){return e.then(function(){return s(t)})},Promise.resolve()).then(function(){a(),Qt[e].forEach(function(e){e()}),Qt[e]=!0})()}}},Zt=function(e){return $t("canvg",["canvg/rgbcolor.js","canvg/canvg.js"],e)},Kt=function(e){ct(e).click(function(e){e.preventDefault()})},Jt=jQuery,en={},tn=function(e){Object.keys(en).length||Jt("#cmenu_canvas").append("<li class='separator'>");var t=e.shortcut||"";Jt("#cmenu_canvas").append("<li class='disabled'><a href='#"+e.id+"'>"+e.label+"<span class='shortcut'>"+t+"</span></a></li>")};function nn(e,t,o){if(null!=e||null!=t||null!=o){"string"==typeof e&&(e=document.getElementById(e)),null!=e.svg&&e.svg.stop();var s=function(e){var t={opts:e,FRAMERATE:30,MAX_VIRTUAL_PIXELS:3e4,log:function(e){}};!0===t.opts.log&&"undefined"!=typeof console&&(t.log=function(e){console.log(e)});t.init=function(e){var n=0;t.UniqueId=function(){return"canvg"+ ++n},t.Definitions={},t.Styles={},t.Animations=[],t.Images=[],t.ctx=e,t.ViewPort=new function(){this.viewPorts=[],this.Clear=function(){this.viewPorts=[]},this.SetCurrent=function(e,t){this.viewPorts.push({width:e,height:t})},this.RemoveCurrent=function(){this.viewPorts.pop()},this.Current=function(){return this.viewPorts[this.viewPorts.length-1]},this.width=function(){return this.Current().width},this.height=function(){return this.Current().height},this.ComputeSize=function(e){return null!=e&&"number"==typeof e?e:"x"===e?this.width():"y"===e?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}},t.init(),t.ImagesLoaded=function(){for(var e=0;e<t.Images.length;e++)if(!t.Images[e].loaded)return!1;return!0},t.trim=function(e){return e.replace(/^\s+|\s+$/g,"")},t.compressSpaces=function(e){return e.replace(/[\s\r\t\n]+/gm," ")},t.ajax=function(e){var t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");return t?(t.open("GET",e,!1),t.send(null),t.responseText):null},t.parseXml=function(e){if(window.DOMParser){var t=new DOMParser;return t.parseFromString(e,"text/xml")}e=e.replace(/<!DOCTYPE svg[^>]*>/,"");var n=new ActiveXObject("Microsoft.XMLDOM");return n.async="false",n.loadXML(e),n};var o={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};return t.Property=function(){function e(t,i){n(this,e),this.name=t,this.value=i}return i(e,[{key:"getValue",value:function(){return this.value}},{key:"hasValue",value:function(){return null!=this.value&&""!==this.value}},{key:"numValue",value:function(){if(!this.hasValue())return 0;var e=parseFloat(this.value);return(this.value+"").match(/%$/)&&(e/=100),e}},{key:"valueOrDefault",value:function(e){return this.hasValue()?this.value:e}},{key:"numValueOrDefault",value:function(e){return this.hasValue()?this.numValue():e}},{key:"addOpacity",value:function(e){var n=this.value;if(null!=e.value&&""!==e.value&&"string"==typeof this.value){var i=new R(this.value);i.ok&&(n="rgba("+i.r+", "+i.g+", "+i.b+", "+e.numValue()+")")}return new t.Property(this.name,n)}},{key:"getDefinition",value:function(){var e=this.value.match(/#([^)'"]+)/);return e&&(e=e[1]),e||(e=this.value),t.Definitions[e]}},{key:"isUrlDefinition",value:function(){return this.value.startsWith("url(")}},{key:"getFillStyleDefinition",value:function(e,n){var i=this.getDefinition();if(null!=i&&i.createGradient)return i.createGradient(t.ctx,e,n);if(null!=i&&i.createPattern){if(i.getHrefAttribute().hasValue()){var r=i.attribute("patternTransform");i=i.getHrefAttribute().getDefinition(),r.hasValue()&&(i.attribute("patternTransform",!0).value=r.value)}return i.createPattern(t.ctx,e)}return null}},{key:"getDPI",value:function(e){return 96}},{key:"getEM",value:function(e){var n=12,i=new t.Property("fontSize",t.Font.Parse(t.ctx.font).fontSize);return i.hasValue()&&(n=i.toPixels(e)),n}},{key:"getUnits",value:function(){return(this.value+"").replace(/[0-9.-]/g,"")}},{key:"toPixels",value:function(e,n){if(!this.hasValue())return 0;var i=this.value+"";if(i.match(/em$/))return this.numValue()*this.getEM(e);if(i.match(/ex$/))return this.numValue()*this.getEM(e)/2;if(i.match(/px$/))return this.numValue();if(i.match(/pt$/))return this.numValue()*this.getDPI(e)*(1/72);if(i.match(/pc$/))return 15*this.numValue();if(i.match(/cm$/))return this.numValue()*this.getDPI(e)/2.54;if(i.match(/mm$/))return this.numValue()*this.getDPI(e)/25.4;if(i.match(/in$/))return this.numValue()*this.getDPI(e);if(i.match(/%$/))return this.numValue()*t.ViewPort.ComputeSize(e);var r=this.numValue();return n&&r<1?r*t.ViewPort.ComputeSize(e):r}},{key:"toMilliseconds",value:function(){if(!this.hasValue())return 0;var e=this.value+"";return e.match(/s$/)?1e3*this.numValue():(e.match(/ms$/),this.numValue())}},{key:"toRadians",value:function(){if(!this.hasValue())return 0;var e=this.value+"";return e.match(/deg$/)?this.numValue()*(Math.PI/180):e.match(/grad$/)?this.numValue()*(Math.PI/200):e.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)}},{key:"toTextBaseline",value:function(){return this.hasValue()?o[this.value]:null}}]),e}(),t.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(e,n,i,r,a,o){var s=null!=o?this.Parse(o):this.CreateFont("","","","","",t.ctx.font);return{fontFamily:a||s.fontFamily,fontSize:r||s.fontSize,fontStyle:e||s.fontStyle,fontWeight:i||s.fontWeight,fontVariant:n||s.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var e=this;this.Parse=function(n){for(var i={},r=t.trim(t.compressSpaces(n||"")).split(" "),a={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},o="",s=0;s<r.length;s++)!a.fontStyle&&e.Styles.includes(r[s])?("inherit"!==r[s]&&(i.fontStyle=r[s]),a.fontStyle=!0):!a.fontVariant&&e.Variants.includes(r[s])?("inherit"!==r[s]&&(i.fontVariant=r[s]),a.fontStyle=a.fontVariant=!0):!a.fontWeight&&e.Weights.includes(r[s])?("inherit"!==r[s]&&(i.fontWeight=r[s]),a.fontStyle=a.fontVariant=a.fontWeight=!0):a.fontSize?"inherit"!==r[s]&&(o+=r[s]):("inherit"!==r[s]&&(i.fontSize=r[s].split("/")[0]),a.fontStyle=a.fontVariant=a.fontWeight=a.fontSize=!0);return""!==o&&(i.fontFamily=o),i}},t.ToNumberArray=function(e){for(var n=t.trim(t.compressSpaces((e||"").replace(/,/g," "))).split(" "),i=0;i<n.length;i++)n[i]=parseFloat(n[i]);return n},t.Point=function(){function e(t,i){n(this,e),this.x=t,this.y=i}return i(e,[{key:"angleTo",value:function(e){return Math.atan2(e.y-this.y,e.x-this.x)}},{key:"applyTransform",value:function(e){var t=this.x*e[0]+this.y*e[2]+e[4],n=this.x*e[1]+this.y*e[3]+e[5];this.x=t,this.y=n}}]),e}(),t.CreatePoint=function(e){var n=t.ToNumberArray(e);return new t.Point(n[0],n[1])},t.CreatePath=function(e){for(var n=t.ToNumberArray(e),i=[],r=0;r<n.length;r+=2)i.push(new t.Point(n[r],n[r+1]));return i},t.BoundingBox=function(e,t,n,i){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.x=function(){return this.x1},this.y=function(){return this.y1},this.width=function(){return this.x2-this.x1},this.height=function(){return this.y2-this.y1},this.addPoint=function(e,t){null!=e&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),null!=t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))},this.addX=function(e){this.addPoint(e,null)},this.addY=function(e){this.addPoint(null,e)},this.addBoundingBox=function(e){this.addPoint(e.x1,e.y1),this.addPoint(e.x2,e.y2)},this.addQuadraticCurve=function(e,t,n,i,r,a){var o=e+2/3*(n-e),s=t+2/3*(i-t),l=o+1/3*(r-e),u=s+1/3*(a-t);this.addBezierCurve(e,t,o,l,s,u,r,a)},this.addBezierCurve=function(e,t,n,i,r,a,o,s){var l=this,u=[e,t],c=[n,i],h=[r,a],d=[o,s];this.addPoint(u[0],u[1]),this.addPoint(d[0],d[1]);for(var f=function(e){var t=function(t){return Math.pow(1-t,3)*u[e]+3*Math.pow(1-t,2)*t*c[e]+3*(1-t)*Math.pow(t,2)*h[e]+Math.pow(t,3)*d[e]},n=6*u[e]-12*c[e]+6*h[e],i=-3*u[e]+9*c[e]-9*h[e]+3*d[e],r=3*c[e]-3*u[e];if(0===i){if(0===n)return"continue";var a=-r/n;return a>0&&a<1&&(0===e&&l.addX(t(a)),1===e&&l.addY(t(a))),"continue"}var o=Math.pow(n,2)-4*r*i;if(o<0)return"continue";var s=(-n+Math.sqrt(o))/(2*i);s>0&&s<1&&(0===e&&l.addX(t(s)),1===e&&l.addY(t(s)));var f=(-n-Math.sqrt(o))/(2*i);f>0&&f<1&&(0===e&&l.addX(t(f)),1===e&&l.addY(t(f)))},p=0;p<=1;p++)f(p)},this.isPointInBox=function(e,t){return this.x1<=e&&e<=this.x2&&this.y1<=t&&t<=this.y2},this.addPoint(e,t),this.addPoint(n,i)},t.Transform=function(e){this.Type={},this.Type.translate=function(e){this.p=t.CreatePoint(e),this.apply=function(e){e.translate(this.p.x||0,this.p.y||0)},this.unapply=function(e){e.translate(-1*this.p.x||0,-1*this.p.y||0)},this.applyToPoint=function(e){e.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0])}},this.Type.rotate=function(e){var n=t.ToNumberArray(e);this.angle=new t.Property("angle",n[0]),this.cx=n[1]||0,this.cy=n[2]||0,this.apply=function(e){e.translate(this.cx,this.cy),e.rotate(this.angle.toRadians()),e.translate(-this.cx,-this.cy)},this.unapply=function(e){e.translate(this.cx,this.cy),e.rotate(-1*this.angle.toRadians()),e.translate(-this.cx,-this.cy)},this.applyToPoint=function(e){var t=this.angle.toRadians();e.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]),e.applyTransform([Math.cos(t),Math.sin(t),-Math.sin(t),Math.cos(t),0,0]),e.applyTransform([1,0,0,1,-this.p.x||0,-this.p.y||0])}},this.Type.scale=function(e){this.p=t.CreatePoint(e),this.apply=function(e){e.scale(this.p.x||1,this.p.y||this.p.x||1)},this.unapply=function(e){e.scale(1/this.p.x||1,1/this.p.y||this.p.x||1)},this.applyToPoint=function(e){e.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}},this.Type.matrix=function(e){this.m=t.ToNumberArray(e),this.apply=function(e){e.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])},this.applyToPoint=function(e){e.applyTransform(this.m)}},this.Type.SkewBase=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.angle=new t.Property("angle",e),r}return r(i,e),i}(this.Type.matrix),this.Type.skewX=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.m=[1,0,Math.tan(i.angle.toRadians()),1,0,0],i}return r(t,e),t}(this.Type.SkewBase),this.Type.skewY=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.m=[1,Math.tan(i.angle.toRadians()),0,1,0,0],i}return r(t,e),t}(this.Type.SkewBase),this.transforms=[],this.apply=function(e){for(var t=0;t<this.transforms.length;t++)this.transforms[t].apply(e)},this.unapply=function(e){for(var t=this.transforms.length-1;t>=0;t--)this.transforms[t].unapply(e)},this.applyToPoint=function(e){for(var t=0;t<this.transforms.length;t++)this.transforms[t].applyToPoint(e)};for(var i=t.trim(t.compressSpaces(e)).replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/),o=0;o<i.length;o++){var s=t.trim(i[o].split("(")[0]),l=i[o].split("(")[1].replace(")",""),u=new this.Type[s](l);u.type=s,this.transforms.push(u)}},t.AspectRatio=function(e,n,i,r,a,o,s,l,u,c){var h=(n=(n=t.compressSpaces(n)).replace(/^defer\s/,"")).split(" ")[0]||"xMidYMid",d=n.split(" ")[1]||"meet",f=i/r,p=a/o,g=Math.min(f,p),v=Math.max(f,p);"meet"===d&&(r*=g,o*=g),"slice"===d&&(r*=v,o*=v),u=new t.Property("refX",u),c=new t.Property("refY",c),u.hasValue()&&c.hasValue()?e.translate(-g*u.toPixels("x"),-g*c.toPixels("y")):(h.match(/^xMid/)&&("meet"===d&&g===p||"slice"===d&&v===p)&&e.translate(i/2-r/2,0),h.match(/YMid$/)&&("meet"===d&&g===f||"slice"===d&&v===f)&&e.translate(0,a/2-o/2),h.match(/^xMax/)&&("meet"===d&&g===p||"slice"===d&&v===p)&&e.translate(i-r,0),h.match(/YMax$/)&&("meet"===d&&g===f||"slice"===d&&v===f)&&e.translate(0,a-o)),"none"===h?e.scale(f,p):"meet"===d?e.scale(g,g):"slice"===d&&e.scale(v,v),e.translate(null==s?0:-s,null==l?0:-l)},t.Element={},t.EmptyProperty=new t.Property("EMPTY",""),t.Element.ElementBase=function(e){if(this.attributes={},this.styles={},this.children=[],this.attribute=function(e,n){var i=this.attributes[e];return null!=i?i:(!0===n&&(i=new t.Property(e,""),this.attributes[e]=i),i||t.EmptyProperty)},this.getHrefAttribute=function(){for(var e in this.attributes)if(e.match(/:href$/))return this.attributes[e];return t.EmptyProperty},this.style=function(e,n,i){var r=this.styles[e];if(null!=r)return r;var a=this.attribute(e);if(null!=a&&a.hasValue())return this.styles[e]=a,a;if(!0!==i){var o=this.parent;if(null!=o){var s=o.style(e);if(null!=s&&s.hasValue())return s}}return!0===n&&(r=new t.Property(e,""),this.styles[e]=r),r||t.EmptyProperty},this.render=function(e){if("none"!==this.style("display").value&&"hidden"!==this.style("visibility").value){if(e.save(),this.attribute("mask").hasValue()){var t=this.attribute("mask").getDefinition();null!=t&&t.apply(e,this)}else if(this.style("filter").hasValue()){var n=this.style("filter").getDefinition();null!=n&&n.apply(e,this)}else this.setContext(e),this.renderChildren(e),this.clearContext(e);e.restore()}},this.setContext=function(e){},this.clearContext=function(e){},this.renderChildren=function(e){for(var t=0;t<this.children.length;t++)this.children[t].render(e)},this.addChild=function(e,n){var i=n?t.CreateElement(e):e;i.parent=this,"title"!==i.type&&this.children.push(i)},null!=e&&1===e.nodeType){for(var n,i=0;n=e.childNodes[i];i++)if(1===n.nodeType&&this.addChild(n,!0),this.captureTextNodes&&(3===n.nodeType||4===n.nodeType)){var r=n.nodeValue||n.text||"";""!==t.trim(t.compressSpaces(r))&&this.addChild(new t.Element.tspan(n),!1)}for(var a=0;a<e.attributes.length;a++){var o=e.attributes[a];this.attributes[o.nodeName]=new t.Property(o.nodeName,o.nodeValue)}var s=t.Styles[e.nodeName];if(null!=s)for(var l in s)this.styles[l]=s[l];if(this.attribute("class").hasValue())for(var u=t.compressSpaces(this.attribute("class").value).split(" "),c=0;c<u.length;c++){if(null!=(s=t.Styles["."+u[c]]))for(var h in s)this.styles[h]=s[h];if(null!=(s=t.Styles[e.nodeName+"."+u[c]]))for(var d in s)this.styles[d]=s[d]}if(this.attribute("id").hasValue()){var f=t.Styles["#"+this.attribute("id").value];if(null!=f)for(var p in f)this.styles[p]=f[p]}if(this.attribute("style").hasValue())for(var g=this.attribute("style").value.split(";"),v=0;v<g.length;v++)if(""!==t.trim(g[v])){var m=g[v].split(":"),y=t.trim(m[0]),_=t.trim(m[1]);this.styles[y]=new t.Property(y,_)}this.attribute("id").hasValue()&&null==t.Definitions[this.attribute("id").value]&&(t.Definitions[this.attribute("id").value]=this)}},t.Element.RenderedElementBase=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.setContext=function(e){if(this.style("fill").isUrlDefinition()){var n=this.style("fill").getFillStyleDefinition(this,this.style("fill-opacity"));null!=n&&(e.fillStyle=n)}else if(this.style("fill").hasValue()){var i=this.style("fill");"currentColor"===i.value&&(i.value=this.style("color").value),e.fillStyle="none"===i.value?"rgba(0,0,0,0)":i.value}if(this.style("fill-opacity").hasValue()){var r=new t.Property("fill",e.fillStyle);r=r.addOpacity(this.style("fill-opacity")),e.fillStyle=r.value}if(this.style("stroke").isUrlDefinition()){var a=this.style("stroke").getFillStyleDefinition(this,this.style("stroke-opacity"));null!=a&&(e.strokeStyle=a)}else if(this.style("stroke").hasValue()){var o=this.style("stroke");"currentColor"===o.value&&(o.value=this.style("color").value),e.strokeStyle="none"===o.value?"rgba(0,0,0,0)":o.value}if(this.style("stroke-opacity").hasValue()){var s=new t.Property("stroke",e.strokeStyle);s=s.addOpacity(this.style("stroke-opacity")),e.strokeStyle=s.value}if(this.style("stroke-width").hasValue()){var l=this.style("stroke-width").toPixels();e.lineWidth=0===l?.001:l}if(this.style("stroke-linecap").hasValue()&&(e.lineCap=this.style("stroke-linecap").value),this.style("stroke-linejoin").hasValue()&&(e.lineJoin=this.style("stroke-linejoin").value),this.style("stroke-miterlimit").hasValue()&&(e.miterLimit=this.style("stroke-miterlimit").value),this.style("stroke-dasharray").hasValue()&&"none"!==this.style("stroke-dasharray").value){var u=t.ToNumberArray(this.style("stroke-dasharray").value);void 0!==e.setLineDash?e.setLineDash(u):void 0!==e.webkitLineDash?e.webkitLineDash=u:void 0===e.mozDash||1===u.length&&0===u[0]||(e.mozDash=u);var c=this.style("stroke-dashoffset").numValueOrDefault(1);void 0!==e.lineDashOffset?e.lineDashOffset=c:void 0!==e.webkitLineDashOffset?e.webkitLineDashOffset=c:void 0!==e.mozDashOffset&&(e.mozDashOffset=c)}if(void 0!==e.font&&(e.font=t.Font.CreateFont(this.style("font-style").value,this.style("font-variant").value,this.style("font-weight").value,this.style("font-size").hasValue()?this.style("font-size").toPixels()+"px":"",this.style("font-family").value).toString()),this.attribute("transform").hasValue()&&new t.Transform(this.attribute("transform").value).apply(e),this.style("clip-path",!1,!0).hasValue()){var h=this.style("clip-path",!1,!0).getDefinition();null!=h&&h.apply(e)}this.style("opacity").hasValue()&&(e.globalAlpha=this.style("opacity").numValue())},r}return r(i,e),i}(t.Element.ElementBase),t.Element.PathElementBase=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.path=function(e){return null!=e&&e.beginPath(),new t.BoundingBox},r.renderChildren=function(e){this.path(e),t.Mouse.checkPath(this,e),""!==e.fillStyle&&("inherit"!==this.style("fill-rule").valueOrDefault("inherit")?e.fill(this.style("fill-rule").value):e.fill()),""!==e.strokeStyle&&e.stroke();var n=this.getMarkers();if(null!=n){if(this.style("marker-start").isUrlDefinition()&&this.style("marker-start").getDefinition().render(e,n[0][0],n[0][1]),this.style("marker-mid").isUrlDefinition())for(var i=this.style("marker-mid").getDefinition(),r=1;r<n.length-1;r++)i.render(e,n[r][0],n[r][1]);this.style("marker-end").isUrlDefinition()&&this.style("marker-end").getDefinition().render(e,n[n.length-1][0],n[n.length-1][1])}},r.getBoundingBox=function(){return this.path()},r.getMarkers=function(){return null},r}return r(i,e),i}(t.Element.RenderedElementBase),t.Element.svg=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.baseClearContext=r.clearContext,r.clearContext=function(e){this.baseClearContext(e),t.ViewPort.RemoveCurrent()},r.baseSetContext=r.setContext,r.setContext=function(e){e.strokeStyle="rgba(0,0,0,0)",e.lineCap="butt",e.lineJoin="miter",e.miterLimit=4,void 0!==e.font&&void 0!==window.getComputedStyle&&(e.font=window.getComputedStyle(e.canvas).getPropertyValue("font")),this.baseSetContext(e),this.attribute("x").hasValue()||(this.attribute("x",!0).value=0),this.attribute("y").hasValue()||(this.attribute("y",!0).value=0),e.translate(this.attribute("x").toPixels("x"),this.attribute("y").toPixels("y"));var n=t.ViewPort.width(),i=t.ViewPort.height();if(this.attribute("width").hasValue()||(this.attribute("width",!0).value="100%"),this.attribute("height").hasValue()||(this.attribute("height",!0).value="100%"),void 0===this.root){n=this.attribute("width").toPixels("x"),i=this.attribute("height").toPixels("y");var r=0,a=0;this.attribute("refX").hasValue()&&this.attribute("refY").hasValue()&&(r=-this.attribute("refX").toPixels("x"),a=-this.attribute("refY").toPixels("y")),"visible"!==this.attribute("overflow").valueOrDefault("hidden")&&(e.beginPath(),e.moveTo(r,a),e.lineTo(n,a),e.lineTo(n,i),e.lineTo(r,i),e.closePath(),e.clip())}if(t.ViewPort.SetCurrent(n,i),this.attribute("viewBox").hasValue()){var o=t.ToNumberArray(this.attribute("viewBox").value),s=o[0],l=o[1];n=o[2],i=o[3],t.AspectRatio(e,this.attribute("preserveAspectRatio").value,t.ViewPort.width(),n,t.ViewPort.height(),i,s,l,this.attribute("refX").value,this.attribute("refY").value),t.ViewPort.RemoveCurrent(),t.ViewPort.SetCurrent(o[2],o[3])}},r}return r(i,e),i}(t.Element.RenderedElementBase),t.Element.rect=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.path=function(e){var n=this.attribute("x").toPixels("x"),i=this.attribute("y").toPixels("y"),r=this.attribute("width").toPixels("x"),a=this.attribute("height").toPixels("y"),o=this.attribute("rx").toPixels("x"),s=this.attribute("ry").toPixels("y");return this.attribute("rx").hasValue()&&!this.attribute("ry").hasValue()&&(s=o),this.attribute("ry").hasValue()&&!this.attribute("rx").hasValue()&&(o=s),o=Math.min(o,r/2),s=Math.min(s,a/2),null!=e&&(e.beginPath(),e.moveTo(n+o,i),e.lineTo(n+r-o,i),e.quadraticCurveTo(n+r,i,n+r,i+s),e.lineTo(n+r,i+a-s),e.quadraticCurveTo(n+r,i+a,n+r-o,i+a),e.lineTo(n+o,i+a),e.quadraticCurveTo(n,i+a,n,i+a-s),e.lineTo(n,i+s),e.quadraticCurveTo(n,i,n+o,i),e.closePath()),new t.BoundingBox(n,i,n+r,i+a)},r}return r(i,e),i}(t.Element.PathElementBase),t.Element.circle=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.path=function(e){var n=this.attribute("cx").toPixels("x"),i=this.attribute("cy").toPixels("y"),r=this.attribute("r").toPixels();return null!=e&&(e.beginPath(),e.arc(n,i,r,0,2*Math.PI,!0),e.closePath()),new t.BoundingBox(n-r,i-r,n+r,i+r)},r}return r(i,e),i}(t.Element.PathElementBase),t.Element.ellipse=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.path=function(e){var n=(Math.sqrt(2)-1)/3*4,i=this.attribute("rx").toPixels("x"),r=this.attribute("ry").toPixels("y"),a=this.attribute("cx").toPixels("x"),o=this.attribute("cy").toPixels("y");return null!=e&&(e.beginPath(),e.moveTo(a,o-r),e.bezierCurveTo(a+n*i,o-r,a+i,o-n*r,a+i,o),e.bezierCurveTo(a+i,o+n*r,a+n*i,o+r,a,o+r),e.bezierCurveTo(a-n*i,o+r,a-i,o+n*r,a-i,o),e.bezierCurveTo(a-i,o-n*r,a-n*i,o-r,a,o-r),e.closePath()),new t.BoundingBox(a-i,o-r,a+i,o+r)},r}return r(i,e),i}(t.Element.PathElementBase),t.Element.line=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.getPoints=function(){return[new t.Point(this.attribute("x1").toPixels("x"),this.attribute("y1").toPixels("y")),new t.Point(this.attribute("x2").toPixels("x"),this.attribute("y2").toPixels("y"))]},r.path=function(e){var n=this.getPoints();return null!=e&&(e.beginPath(),e.moveTo(n[0].x,n[0].y),e.lineTo(n[1].x,n[1].y)),new t.BoundingBox(n[0].x,n[0].y,n[1].x,n[1].y)},r.getMarkers=function(){var e=this.getPoints(),t=e[0].angleTo(e[1]);return[[e[0],t],[e[1],t]]},r}return r(i,e),i}(t.Element.PathElementBase),t.Element.polyline=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.points=t.CreatePath(r.attribute("points").value),r.path=function(e){var n=new t.BoundingBox(this.points[0].x,this.points[0].y);null!=e&&(e.beginPath(),e.moveTo(this.points[0].x,this.points[0].y));for(var i=1;i<this.points.length;i++)n.addPoint(this.points[i].x,this.points[i].y),null!=e&&e.lineTo(this.points[i].x,this.points[i].y);return n},r.getMarkers=function(){for(var e=[],t=0;t<this.points.length-1;t++)e.push([this.points[t],this.points[t].angleTo(this.points[t+1])]);return e.push([this.points[this.points.length-1],e[e.length-1][1]]),e},r}return r(i,e),i}(t.Element.PathElementBase),t.Element.polygon=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.basePath=i.path,i.path=function(e){var t=this.basePath(e);return null!=e&&(e.lineTo(this.points[0].x,this.points[0].y),e.closePath()),t},i}return r(t,e),t}(t.Element.polyline),t.Element.path=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e)),o=r.attribute("d").value;return o=(o=(o=(o=(o=(o=(o=(o=o.replace(/,/gm," ")).replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2")).replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2")).replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,"$1 $2")).replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2")).replace(/([0-9])([+-])/gm,"$1 $2")).replace(/(\.[0-9]*)(\.)/gm,"$1 $2")).replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 "),o=t.compressSpaces(o),o=t.trim(o),r.PathParser=new function(e){this.tokens=e.split(" "),this.reset=function(){this.i=-1,this.command="",this.previousCommand="",this.start=new t.Point(0,0),this.control=new t.Point(0,0),this.current=new t.Point(0,0),this.points=[],this.angles=[]},this.isEnd=function(){return this.i>=this.tokens.length-1},this.isCommandOrEnd=function(){return!!this.isEnd()||null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var e=new t.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(e)},this.getAsControlPoint=function(){var e=this.getPoint();return this.control=e,e},this.getAsCurrentPoint=function(){var e=this.getPoint();return this.current=e,e},this.getReflectedControlPoint=function(){return"c"!==this.previousCommand.toLowerCase()&&"s"!==this.previousCommand.toLowerCase()&&"q"!==this.previousCommand.toLowerCase()&&"t"!==this.previousCommand.toLowerCase()?this.current:new t.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},this.makeAbsolute=function(e){return this.isRelativeCommand()&&(e.x+=this.current.x,e.y+=this.current.y),e},this.addMarker=function(e,t,n){null!=n&&this.angles.length>0&&null==this.angles[this.angles.length-1]&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(n)),this.addMarkerAngle(e,null==t?null:t.angleTo(e))},this.addMarkerAngle=function(e,t){this.points.push(e),this.angles.push(t)},this.getMarkerPoints=function(){return this.points},this.getMarkerAngles=function(){for(var e=0;e<this.angles.length;e++)if(null==this.angles[e])for(var t=e+1;t<this.angles.length;t++)if(null!=this.angles[t]){this.angles[e]=this.angles[t];break}return this.angles}}(o),r.path=function(e){var n=this.PathParser;n.reset();var i=new t.BoundingBox;for(null!=e&&e.beginPath();!n.isEnd();)switch(n.nextCommand(),n.command){case"M":case"m":var r=n.getAsCurrentPoint();for(n.addMarker(r),i.addPoint(r.x,r.y),null!=e&&e.moveTo(r.x,r.y),n.start=n.current;!n.isCommandOrEnd();){var a=n.getAsCurrentPoint();n.addMarker(a,n.start),i.addPoint(a.x,a.y),null!=e&&e.lineTo(a.x,a.y)}break;case"L":case"l":for(;!n.isCommandOrEnd();){var o=n.current,s=n.getAsCurrentPoint();n.addMarker(s,o),i.addPoint(s.x,s.y),null!=e&&e.lineTo(s.x,s.y)}break;case"H":case"h":for(;!n.isCommandOrEnd();){var l=new t.Point((n.isRelativeCommand()?n.current.x:0)+n.getScalar(),n.current.y);n.addMarker(l,n.current),n.current=l,i.addPoint(n.current.x,n.current.y),null!=e&&e.lineTo(n.current.x,n.current.y)}break;case"V":case"v":for(;!n.isCommandOrEnd();){var u=new t.Point(n.current.x,(n.isRelativeCommand()?n.current.y:0)+n.getScalar());n.addMarker(u,n.current),n.current=u,i.addPoint(n.current.x,n.current.y),null!=e&&e.lineTo(n.current.x,n.current.y)}break;case"C":case"c":for(;!n.isCommandOrEnd();){var c=n.current,h=n.getPoint(),d=n.getAsControlPoint(),f=n.getAsCurrentPoint();n.addMarker(f,d,h),i.addBezierCurve(c.x,c.y,h.x,h.y,d.x,d.y,f.x,f.y),null!=e&&e.bezierCurveTo(h.x,h.y,d.x,d.y,f.x,f.y)}break;case"S":case"s":for(;!n.isCommandOrEnd();){var p=n.current,g=n.getReflectedControlPoint(),v=n.getAsControlPoint(),m=n.getAsCurrentPoint();n.addMarker(m,v,g),i.addBezierCurve(p.x,p.y,g.x,g.y,v.x,v.y,m.x,m.y),null!=e&&e.bezierCurveTo(g.x,g.y,v.x,v.y,m.x,m.y)}break;case"Q":case"q":for(;!n.isCommandOrEnd();){var y=n.current,_=n.getAsControlPoint(),b=n.getAsCurrentPoint();n.addMarker(b,_,_),i.addQuadraticCurve(y.x,y.y,_.x,_.y,b.x,b.y),null!=e&&e.quadraticCurveTo(_.x,_.y,b.x,b.y)}break;case"T":case"t":for(;!n.isCommandOrEnd();){var x=n.current,w=n.getReflectedControlPoint();n.control=w;var S=n.getAsCurrentPoint();n.addMarker(S,w,w),i.addQuadraticCurve(x.x,x.y,w.x,w.y,S.x,S.y),null!=e&&e.quadraticCurveTo(w.x,w.y,S.x,S.y)}break;case"A":case"a":for(var k=function(){var r=n.current,a=n.getScalar(),o=n.getScalar(),s=n.getScalar()*(Math.PI/180),l=n.getScalar(),u=n.getScalar(),c=n.getAsCurrentPoint(),h=new t.Point(Math.cos(s)*(r.x-c.x)/2+Math.sin(s)*(r.y-c.y)/2,-Math.sin(s)*(r.x-c.x)/2+Math.cos(s)*(r.y-c.y)/2),d=Math.pow(h.x,2)/Math.pow(a,2)+Math.pow(h.y,2)/Math.pow(o,2);d>1&&(a*=Math.sqrt(d),o*=Math.sqrt(d));var f=(l===u?-1:1)*Math.sqrt((Math.pow(a,2)*Math.pow(o,2)-Math.pow(a,2)*Math.pow(h.y,2)-Math.pow(o,2)*Math.pow(h.x,2))/(Math.pow(a,2)*Math.pow(h.y,2)+Math.pow(o,2)*Math.pow(h.x,2)));isNaN(f)&&(f=0);var p=new t.Point(f*a*h.y/o,f*-o*h.x/a),g=new t.Point((r.x+c.x)/2+Math.cos(s)*p.x-Math.sin(s)*p.y,(r.y+c.y)/2+Math.sin(s)*p.x+Math.cos(s)*p.y),v=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2))},m=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(v(e)*v(t))},y=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(m(e,t))},_=y([1,0],[(h.x-p.x)/a,(h.y-p.y)/o]),b=[(h.x-p.x)/a,(h.y-p.y)/o],x=[(-h.x-p.x)/a,(-h.y-p.y)/o],w=y(b,x);m(b,x)<=-1&&(w=Math.PI),m(b,x)>=1&&(w=0);var S=1-u?1:-1,k=_+S*(w/2),C=new t.Point(g.x+a*Math.cos(k),g.y+o*Math.sin(k));if(n.addMarkerAngle(C,k-S*Math.PI/2),n.addMarkerAngle(c,k-S*Math.PI),i.addPoint(c.x,c.y),null!=e){var P=a>o?a:o,A=a>o?1:a/o,E=a>o?o/a:1;e.translate(g.x,g.y),e.rotate(s),e.scale(A,E),e.arc(0,0,P,_,_+w,1-u),e.scale(1/A,1/E),e.rotate(-s),e.translate(-g.x,-g.y)}};!n.isCommandOrEnd();)k();break;case"Z":case"z":null!=e&&e.closePath(),n.current=n.start}return i},r.getMarkers=function(){for(var e=this.PathParser.getMarkerPoints(),t=this.PathParser.getMarkerAngles(),n=[],i=0;i<e.length;i++)n.push([e[i],t[i]]);return n},r}return r(i,e),i}(t.Element.PathElementBase),t.Element.pattern=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.createPattern=function(e,n){var i=this.attribute("width").toPixels("x",!0),r=this.attribute("height").toPixels("y",!0),a=new t.Element.svg;a.attributes.viewBox=new t.Property("viewBox",this.attribute("viewBox").value),a.attributes.width=new t.Property("width",i+"px"),a.attributes.height=new t.Property("height",r+"px"),a.attributes.transform=new t.Property("transform",this.attribute("patternTransform").value),a.children=this.children;var o=document.createElement("canvas");o.width=i,o.height=r;var s=o.getContext("2d");this.attribute("x").hasValue()&&this.attribute("y").hasValue()&&s.translate(this.attribute("x").toPixels("x",!0),this.attribute("y").toPixels("y",!0));for(var l=-1;l<=1;l++)for(var u=-1;u<=1;u++)s.save(),s.translate(l*o.width,u*o.height),a.render(s),s.restore();return e.createPattern(o,"repeat")},r}return r(i,e),i}(t.Element.ElementBase),t.Element.marker=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.baseRender=r.render,r.render=function(e,n,i){e.translate(n.x,n.y),"auto"===this.attribute("orient").valueOrDefault("auto")&&e.rotate(i),"strokeWidth"===this.attribute("markerUnits").valueOrDefault("strokeWidth")&&e.scale(e.lineWidth,e.lineWidth),e.save();var r=new t.Element.svg;r.attributes.viewBox=new t.Property("viewBox",this.attribute("viewBox").value),r.attributes.refX=new t.Property("refX",this.attribute("refX").value),r.attributes.refY=new t.Property("refY",this.attribute("refY").value),r.attributes.width=new t.Property("width",this.attribute("markerWidth").value),r.attributes.height=new t.Property("height",this.attribute("markerHeight").value),r.attributes.fill=new t.Property("fill",this.attribute("fill").valueOrDefault("black")),r.attributes.stroke=new t.Property("stroke",this.attribute("stroke").valueOrDefault("none")),r.children=this.children,r.render(e),e.restore(),"strokeWidth"===this.attribute("markerUnits").valueOrDefault("strokeWidth")&&e.scale(1/e.lineWidth,1/e.lineWidth),"auto"===this.attribute("orient").valueOrDefault("auto")&&e.rotate(-i),e.translate(-n.x,-n.y)},r}return r(i,e),i}(t.Element.ElementBase),t.Element.defs=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.render=function(e){},i}return r(t,e),t}(t.Element.ElementBase),t.Element.GradientBase=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));r.gradientUnits=r.attribute("gradientUnits").valueOrDefault("objectBoundingBox"),r.stops=[];for(var o=0;o<r.children.length;o++){var s=r.children[o];"stop"===s.type&&r.stops.push(s)}return r.getGradient=function(){},r.createGradient=function(e,n,i){var r=this.getHrefAttribute().hasValue()?this.getHrefAttribute().getDefinition():this,a=function(e){return i.hasValue()?new t.Property("color",e).addOpacity(i).value:e},o=this.getGradient(e,n);if(null==o)return a(r.stops[r.stops.length-1].color);for(var s=0;s<r.stops.length;s++)o.addColorStop(r.stops[s].offset,a(r.stops[s].color));if(this.attribute("gradientTransform").hasValue()){var l=t.ViewPort.viewPorts[0],u=new t.Element.rect;u.attributes.x=new t.Property("x",-t.MAX_VIRTUAL_PIXELS/3),u.attributes.y=new t.Property("y",-t.MAX_VIRTUAL_PIXELS/3),u.attributes.width=new t.Property("width",t.MAX_VIRTUAL_PIXELS),u.attributes.height=new t.Property("height",t.MAX_VIRTUAL_PIXELS);var c=new t.Element.g;c.attributes.transform=new t.Property("transform",this.attribute("gradientTransform").value),c.children=[u];var h=new t.Element.svg;h.attributes.x=new t.Property("x",0),h.attributes.y=new t.Property("y",0),h.attributes.width=new t.Property("width",l.width),h.attributes.height=new t.Property("height",l.height),h.children=[c];var d=document.createElement("canvas");d.width=l.width,d.height=l.height;var f=d.getContext("2d");return f.fillStyle=o,h.render(f),f.createPattern(d,"no-repeat")}return o},r}return r(i,e),i}(t.Element.ElementBase),t.Element.linearGradient=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.getGradient=function(e,t){var n="objectBoundingBox"===this.gradientUnits?t.getBoundingBox():null;this.attribute("x1").hasValue()||this.attribute("y1").hasValue()||this.attribute("x2").hasValue()||this.attribute("y2").hasValue()||(this.attribute("x1",!0).value=0,this.attribute("y1",!0).value=0,this.attribute("x2",!0).value=1,this.attribute("y2",!0).value=0);var i="objectBoundingBox"===this.gradientUnits?n.x()+n.width()*this.attribute("x1").numValue():this.attribute("x1").toPixels("x"),r="objectBoundingBox"===this.gradientUnits?n.y()+n.height()*this.attribute("y1").numValue():this.attribute("y1").toPixels("y"),a="objectBoundingBox"===this.gradientUnits?n.x()+n.width()*this.attribute("x2").numValue():this.attribute("x2").toPixels("x"),o="objectBoundingBox"===this.gradientUnits?n.y()+n.height()*this.attribute("y2").numValue():this.attribute("y2").toPixels("y");return i===a&&r===o?null:e.createLinearGradient(i,r,a,o)},i}return r(t,e),t}(t.Element.GradientBase),t.Element.radialGradient=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.getGradient=function(e,t){var n=t.getBoundingBox();this.attribute("cx").hasValue()||(this.attribute("cx",!0).value="50%"),this.attribute("cy").hasValue()||(this.attribute("cy",!0).value="50%"),this.attribute("r").hasValue()||(this.attribute("r",!0).value="50%");var i="objectBoundingBox"===this.gradientUnits?n.x()+n.width()*this.attribute("cx").numValue():this.attribute("cx").toPixels("x"),r="objectBoundingBox"===this.gradientUnits?n.y()+n.height()*this.attribute("cy").numValue():this.attribute("cy").toPixels("y"),a=i,o=r;this.attribute("fx").hasValue()&&(a="objectBoundingBox"===this.gradientUnits?n.x()+n.width()*this.attribute("fx").numValue():this.attribute("fx").toPixels("x")),this.attribute("fy").hasValue()&&(o="objectBoundingBox"===this.gradientUnits?n.y()+n.height()*this.attribute("fy").numValue():this.attribute("fy").toPixels("y"));var s="objectBoundingBox"===this.gradientUnits?(n.width()+n.height())/2*this.attribute("r").numValue():this.attribute("r").toPixels();return e.createRadialGradient(a,o,0,i,r,s)},i}return r(t,e),t}(t.Element.GradientBase),t.Element.stop=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));i.offset=i.attribute("offset").numValue(),i.offset<0&&(i.offset=0),i.offset>1&&(i.offset=1);var r=i.style("stop-color");return i.style("stop-opacity").hasValue()&&(r=r.addOpacity(i.style("stop-opacity"))),i.color=r.value,i}return r(t,e),t}(t.Element.ElementBase),t.Element.AnimateBase=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return t.Animations.push(r),r.duration=0,r.begin=r.attribute("begin").toMilliseconds(),r.maxDuration=r.begin+r.attribute("dur").toMilliseconds(),r.getProperty=function(){var e=this.attribute("attributeType").value,t=this.attribute("attributeName").value;return"CSS"===e?this.parent.style(t,!0):this.parent.attribute(t,!0)},r.initialValue=null,r.initialUnits="",r.removed=!1,r.calcValue=function(){return""},r.update=function(e){if(null==this.initialValue&&(this.initialValue=this.getProperty().value,this.initialUnits=this.getProperty().getUnits()),this.duration>this.maxDuration){if("indefinite"===this.attribute("repeatCount").value||"indefinite"===this.attribute("repeatDur").value)this.duration=0;else if("freeze"!==this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"===this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration=this.duration+e;var t=!1;if(this.begin<this.duration){var n=this.calcValue();this.attribute("type").hasValue()&&(n=this.attribute("type").value+"("+n+")"),this.getProperty().value=n,t=!0}return t},r.from=r.attribute("from"),r.to=r.attribute("to"),r.values=r.attribute("values"),r.values.hasValue()&&(r.values.value=r.values.value.split(";")),r.progress=function(){var e={progress:(this.duration-this.begin)/(this.maxDuration-this.begin)};if(this.values.hasValue()){var n=e.progress*(this.values.value.length-1),i=Math.floor(n),r=Math.ceil(n);e.from=new t.Property("from",parseFloat(this.values.value[i])),e.to=new t.Property("to",parseFloat(this.values.value[r])),e.progress=(n-i)/(r-i)}else e.from=this.from,e.to=this.to;return e},r}return r(i,e),i}(t.Element.ElementBase),t.Element.animate=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.calcValue=function(){var e=this.progress();return e.from.numValue()+(e.to.numValue()-e.from.numValue())*e.progress+this.initialUnits},i}return r(t,e),t}(t.Element.AnimateBase),t.Element.animateColor=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.calcValue=function(){var e=this.progress(),t=new R(e.from.value),n=new R(e.to.value);if(t.ok&&n.ok){var i=t.r+(n.r-t.r)*e.progress,r=t.g+(n.g-t.g)*e.progress,a=t.b+(n.b-t.b)*e.progress;return"rgb("+parseInt(i,10)+","+parseInt(r,10)+","+parseInt(a,10)+")"}return this.attribute("from").value},i}return r(t,e),t}(t.Element.AnimateBase),t.Element.animateTransform=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.calcValue=function(){for(var e=this.progress(),n=t.ToNumberArray(e.from.value),i=t.ToNumberArray(e.to.value),r="",a=0;a<n.length;a++)r+=n[a]+(i[a]-n[a])*e.progress+" ";return r},r}return r(i,e),i}(t.Element.animate),t.Element.font=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));r.horizAdvX=r.attribute("horiz-adv-x").numValue(),r.isRTL=!1,r.isArabic=!1,r.fontFace=null,r.missingGlyph=null,r.glyphs=[];for(var o=0;o<r.children.length;o++){var s=r.children[o];"font-face"===s.type?(r.fontFace=s,s.style("font-family").hasValue()&&(t.Definitions[s.style("font-family").value]=r)):"missing-glyph"===s.type?r.missingGlyph=s:"glyph"===s.type&&(""!==s.arabicForm?(r.isRTL=!0,r.isArabic=!0,void 0===r.glyphs[s.unicode]&&(r.glyphs[s.unicode]=[]),r.glyphs[s.unicode][s.arabicForm]=s):r.glyphs[s.unicode]=s)}return r}return r(i,e),i}(t.Element.ElementBase),t.Element.fontface=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.ascent=i.attribute("ascent").value,i.descent=i.attribute("descent").value,i.unitsPerEm=i.attribute("units-per-em").numValue(),i}return r(t,e),t}(t.Element.ElementBase),t.Element.missingglyph=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.horizAdvX=0,i}return r(t,e),t}(t.Element.path),t.Element.glyph=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.horizAdvX=i.attribute("horiz-adv-x").numValue(),i.unicode=i.attribute("unicode").value,i.arabicForm=i.attribute("arabic-form").value,i}return r(t,e),t}(t.Element.path),t.Element.text=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.captureTextNodes=!0,r.baseSetContext=r.setContext,r.setContext=function(e){this.baseSetContext(e);var t=this.style("dominant-baseline").toTextBaseline();null==t&&(t=this.style("alignment-baseline").toTextBaseline()),null!=t&&(e.textBaseline=t)},r.getBoundingBox=function(){var e=this.attribute("x").toPixels("x"),n=this.attribute("y").toPixels("y"),i=this.parent.style("font-size").numValueOrDefault(t.Font.Parse(t.ctx.font).fontSize);return new t.BoundingBox(e,n-i,e+Math.floor(2*i/3)*this.children[0].getText().length,n)},r.renderChildren=function(e){this.x=this.attribute("x").toPixels("x"),this.y=this.attribute("y").toPixels("y"),this.x+=this.getAnchorDelta(e,this,0);for(var t=0;t<this.children.length;t++)this.renderChild(e,this,t)},r.getAnchorDelta=function(e,t,n){var i=this.style("text-anchor").valueOrDefault("start");if("start"!==i){for(var r=0,a=n;a<t.children.length;a++){var o=t.children[a];if(a>n&&o.attribute("x").hasValue())break;r+=o.measureTextRecursive(e)}return-1*("end"===i?r:r/2)}return 0},r.renderChild=function(e,t,n){var i=t.children[n];i.attribute("x").hasValue()?(i.x=i.attribute("x").toPixels("x")+this.getAnchorDelta(e,t,n),i.attribute("dx").hasValue()&&(i.x+=i.attribute("dx").toPixels("x"))):(this.attribute("dx").hasValue()&&(this.x+=this.attribute("dx").toPixels("x")),i.attribute("dx").hasValue()&&(this.x+=i.attribute("dx").toPixels("x")),i.x=this.x),this.x=i.x+i.measureText(e),i.attribute("y").hasValue()?(i.y=i.attribute("y").toPixels("y"),i.attribute("dy").hasValue()&&(i.y+=i.attribute("dy").toPixels("y"))):(this.attribute("dy").hasValue()&&(this.y+=this.attribute("dy").toPixels("y")),i.attribute("dy").hasValue()&&(this.y+=i.attribute("dy").toPixels("y")),i.y=this.y),this.y=i.y,i.render(e);for(var r=0;r<i.children.length;r++)this.renderChild(e,i,r)},r}return r(i,e),i}(t.Element.RenderedElementBase),t.Element.TextElementBase=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.getGlyph=function(e,t,n){var i=t[n],r=null;if(e.isArabic){var a="isolated";(0===n||" "===t[n-1])&&n<t.length-2&&" "!==t[n+1]&&(a="terminal"),n>0&&" "!==t[n-1]&&n<t.length-2&&" "!==t[n+1]&&(a="medial"),n>0&&" "!==t[n-1]&&(n===t.length-1||" "===t[n+1])&&(a="initial"),void 0!==e.glyphs[i]&&null==(r=e.glyphs[i][a])&&"glyph"===e.glyphs[i].type&&(r=e.glyphs[i])}else r=e.glyphs[i];return null==r&&(r=e.missingGlyph),r},r.renderChildren=function(e){var n=this.parent.style("font-family").getDefinition();if(null==n)""!==e.fillStyle&&e.fillText(t.compressSpaces(this.getText()),this.x,this.y),""!==e.strokeStyle&&e.strokeText(t.compressSpaces(this.getText()),this.x,this.y);else{var i=this.parent.style("font-size").numValueOrDefault(t.Font.Parse(t.ctx.font).fontSize),r=this.parent.style("font-style").valueOrDefault(t.Font.Parse(t.ctx.font).fontStyle),a=this.getText();n.isRTL&&(a=a.split("").reverse().join(""));for(var o=t.ToNumberArray(this.parent.attribute("dx").value),s=0;s<a.length;s++){var l=this.getGlyph(n,a,s),u=i/n.fontFace.unitsPerEm;e.translate(this.x,this.y),e.scale(u,-u);var c=e.lineWidth;e.lineWidth=e.lineWidth*n.fontFace.unitsPerEm/i,"italic"===r&&e.transform(1,0,.4,1,0,0),l.render(e),"italic"===r&&e.transform(1,0,-.4,1,0,0),e.lineWidth=c,e.scale(1/u,-1/u),e.translate(-this.x,-this.y),this.x+=i*(l.horizAdvX||n.horizAdvX)/n.fontFace.unitsPerEm,void 0===o[s]||isNaN(o[s])||(this.x+=o[s])}}},r.getText=function(){},r.measureTextRecursive=function(e){for(var t=this.measureText(e),n=0;n<this.children.length;n++)t+=this.children[n].measureTextRecursive(e);return t},r.measureText=function(e){var n=this.parent.style("font-family").getDefinition();if(null!=n){var i=this.parent.style("font-size").numValueOrDefault(t.Font.Parse(t.ctx.font).fontSize),r=0,a=this.getText();n.isRTL&&(a=a.split("").reverse().join(""));for(var o=t.ToNumberArray(this.parent.attribute("dx").value),s=0;s<a.length;s++)r+=(this.getGlyph(n,a,s).horizAdvX||n.horizAdvX)*i/n.fontFace.unitsPerEm,void 0===o[s]||isNaN(o[s])||(r+=o[s]);return r}var l=t.compressSpaces(this.getText());if(!e.measureText)return 10*l.length;e.save(),this.setContext(e);var u=e.measureText(l).width;return e.restore(),u},r}return r(i,e),i}(t.Element.RenderedElementBase),t.Element.tspan=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.captureTextNodes=!0,i.text=e.nodeValue||e.text||"",i.getText=function(){return this.text},i}return r(t,e),t}(t.Element.TextElementBase),t.Element.tref=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.getText=function(){var e=this.getHrefAttribute().getDefinition();if(null!=e)return e.children[0].getText()},i}return r(t,e),t}(t.Element.TextElementBase),t.Element.a=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));r.hasText=!0;for(var o,s=0;o=e.childNodes[s];s++)3!==o.nodeType&&(r.hasText=!1);return r.text=r.hasText?e.childNodes[0].nodeValue:"",r.getText=function(){return this.text},r.baseRenderChildren=r.renderChildren,r.renderChildren=function(e){if(this.hasText){this.baseRenderChildren(e);var n=new t.Property("fontSize",t.Font.Parse(t.ctx.font).fontSize);t.Mouse.checkBoundingBox(this,new t.BoundingBox(this.x,this.y-n.toPixels("y"),this.x+this.measureText(e),this.y))}else{var i=new t.Element.g;i.children=this.children,i.parent=this,i.render(e)}},r.onclick=function(){window.open(this.getHrefAttribute().value)},r.onmousemove=function(){t.ctx.canvas.style.cursor="pointer"},r}return r(i,e),i}(t.Element.TextElementBase),t.Element.image=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e)),o=r.getHrefAttribute().value;if(""===o)return a(r);var s=o.match(/\.svg$/);if(t.Images.push(r),r.loaded=!1,s)r.img=t.ajax(o),r.loaded=!0;else{r.img=document.createElement("img"),!0===t.opts.useCORS&&(r.img.crossOrigin="Anonymous");var l=r;r.img.onload=function(){l.loaded=!0},r.img.onerror=function(){t.log('ERROR: image "'+o+'" not found'),l.loaded=!0},r.img.src=o}return r.renderChildren=function(e){var n=this.attribute("x").toPixels("x"),i=this.attribute("y").toPixels("y"),r=this.attribute("width").toPixels("x"),a=this.attribute("height").toPixels("y");0!==r&&0!==a&&(e.save(),s?e.drawSvg(this.img,n,i,r,a):(e.translate(n,i),t.AspectRatio(e,this.attribute("preserveAspectRatio").value,r,this.img.width,a,this.img.height,0,0),e.drawImage(this.img,0,0)),e.restore())},r.getBoundingBox=function(){var e=this.attribute("x").toPixels("x"),n=this.attribute("y").toPixels("y"),i=this.attribute("width").toPixels("x"),r=this.attribute("height").toPixels("y");return new t.BoundingBox(e,n,e+i,n+r)},r}return r(i,e),i}(t.Element.RenderedElementBase),t.Element.g=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.getBoundingBox=function(){for(var e=new t.BoundingBox,n=0;n<this.children.length;n++)e.addBoundingBox(this.children[n].getBoundingBox());return e},r}return r(i,e),i}(t.Element.RenderedElementBase),t.Element.symbol=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.render=function(e){},i}return r(t,e),t}(t.Element.RenderedElementBase),t.Element.style=function(e){function i(e){n(this,i);for(var r,o=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e)),s="",l=0;r=e.childNodes[l];l++)s+=r.nodeValue;s=s.replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"");for(var u=(s=t.compressSpaces(s)).split("}"),c=0;c<u.length;c++)if(""!==t.trim(u[c]))for(var h=u[c].split("{"),d=h[0].split(","),f=h[1].split(";"),p=0;p<d.length;p++){var g=t.trim(d[p]);if(""!==g){for(var v={},m=0;m<f.length;m++){var y=f[m].indexOf(":"),_=f[m].substr(0,y),b=f[m].substr(y+1,f[m].length-y);null!=_&&null!=b&&(v[t.trim(_)]=new t.Property(t.trim(_),t.trim(b)))}if(t.Styles[g]=v,"@font-face"===g)for(var x=v["font-family"].value.replace(/"/g,""),w=v.src.value.split(","),S=0;S<w.length;S++)if(w[S].includes('format("svg")'))for(var k=w[S].indexOf("url"),C=w[S].indexOf(")",k),P=w[S].substr(k+5,C-k-6),A=t.parseXml(t.ajax(P)).getElementsByTagName("font"),E=0;E<A.length;E++){var T=t.CreateElement(A[E]);t.Definitions[x]=T}}}return o}return r(i,e),i}(t.Element.ElementBase),t.Element.use=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));r.baseSetContext=r.setContext,r.setContext=function(e){this.baseSetContext(e),this.attribute("x").hasValue()&&e.translate(this.attribute("x").toPixels("x"),0),this.attribute("y").hasValue()&&e.translate(0,this.attribute("y").toPixels("y"))};var o=r.getHrefAttribute().getDefinition();return r.path=function(e){null!=o&&o.path(e)},r.getBoundingBox=function(){if(null!=o)return o.getBoundingBox()},r.renderChildren=function(e){if(null!=o){var n=o;"symbol"===o.type&&((n=new t.Element.svg).type="svg",n.attributes.viewBox=new t.Property("viewBox",o.attribute("viewBox").value),n.attributes.preserveAspectRatio=new t.Property("preserveAspectRatio",o.attribute("preserveAspectRatio").value),n.attributes.overflow=new t.Property("overflow",o.attribute("overflow").value),n.children=o.children),"svg"===n.type&&(this.attribute("width").hasValue()&&(n.attributes.width=new t.Property("width",this.attribute("width").value)),this.attribute("height").hasValue()&&(n.attributes.height=new t.Property("height",this.attribute("height").value)));var i=n.parent;n.parent=null,n.render(e),n.parent=i}},r}return r(i,e),i}(t.Element.RenderedElementBase),t.Element.mask=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.apply=function(e,n){var i=this.attribute("x").toPixels("x"),r=this.attribute("y").toPixels("y"),a=this.attribute("width").toPixels("x"),o=this.attribute("height").toPixels("y");if(0===a&&0===o){for(var s=new t.BoundingBox,l=0;l<this.children.length;l++)s.addBoundingBox(this.children[l].getBoundingBox());i=Math.floor(s.x1),r=Math.floor(s.y1),a=Math.floor(s.width()),o=Math.floor(s.height())}var u=n.attribute("mask").value;n.attribute("mask").value="";var c=document.createElement("canvas");c.width=i+a,c.height=r+o;var h=c.getContext("2d");this.renderChildren(h);var d=document.createElement("canvas");d.width=i+a,d.height=r+o;var f=d.getContext("2d");n.render(f),f.globalCompositeOperation="destination-in",f.fillStyle=h.createPattern(c,"no-repeat"),f.fillRect(0,0,i+a,r+o),e.fillStyle=f.createPattern(d,"no-repeat"),e.fillRect(0,0,i+a,r+o),n.attribute("mask").value=u},r.render=function(e){},r}return r(i,e),i}(t.Element.ElementBase),t.Element.clipPath=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.apply=function(e){for(var n=0;n<this.children.length;n++){var i=this.children[n];if(void 0!==i.path){var r=null;i.attribute("transform").hasValue()&&(r=new t.Transform(i.attribute("transform").value)).apply(e),i.path(e),e.clip(),r&&r.unapply(e)}}},r.render=function(e){},r}return r(i,e),i}(t.Element.ElementBase),t.Element.filter=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.apply=function(e,t){var n=t.getBoundingBox(),i=Math.floor(n.x1),r=Math.floor(n.y1),a=Math.floor(n.width()),o=Math.floor(n.height()),s=t.style("filter").value;t.style("filter").value="";for(var l=0,u=0,c=0;c<this.children.length;c++){var h=this.children[c].extraFilterDistance||0;l=Math.max(l,h),u=Math.max(u,h)}var d=document.createElement("canvas");d.width=a+2*l,d.height=o+2*u;var f=d.getContext("2d");f.translate(-i+l,-r+u),t.render(f);for(var p=0;p<this.children.length;p++)this.children[p].apply(f,0,0,a+2*l,o+2*u);e.drawImage(d,0,0,a+2*l,o+2*u,i-l,r-u,a+2*l,o+2*u),t.style("filter",!0).value=s},i.render=function(e){},i}return r(t,e),t}(t.Element.ElementBase),t.Element.feMorphology=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.apply=function(e,t,n,i,r){},i}return r(t,e),t}(t.Element.ElementBase),t.Element.feComposite=function(e){function t(e){n(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.apply=function(e,t,n,i,r){},i}return r(t,e),t}(t.Element.ElementBase),t.Element.feColorMatrix=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e)),o=t.ToNumberArray(r.attribute("values").value);switch(r.attribute("type").valueOrDefault("matrix")){case"saturate":var s=o[0];o=[.213+.787*s,.715-.715*s,.072-.072*s,0,0,.213-.213*s,.715+.285*s,.072-.072*s,0,0,.213-.213*s,.715-.715*s,.072+.928*s,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var l=o[0]*Math.PI/180,u=function(e,t,n){return e+Math.cos(l)*t+Math.sin(l)*n};o=[u(.213,.787,-.213),u(.715,-.715,-.715),u(.072,-.072,.928),0,0,u(.213,-.213,.143),u(.715,.285,.14),u(.072,-.072,-.283),0,0,u(.213,-.213,-.787),u(.715,-.715,.715),u(.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}function c(e,t,n,i,r,a){return e[n*i*4+4*t+a]}function h(e,t,n,i,r,a,o){e[n*i*4+4*t+a]=o}function d(e,t){var n=o[e];return n*(n<0?t-255:t)}return r.apply=function(e,t,n,i,r){for(var a=e.getImageData(0,0,i,r),o=0;o<r;o++)for(var s=0;s<i;s++){var l=c(a.data,s,o,i,0,0),u=c(a.data,s,o,i,0,1),f=c(a.data,s,o,i,0,2),p=c(a.data,s,o,i,0,3);h(a.data,s,o,i,0,0,d(0,l)+d(1,u)+d(2,f)+d(3,p)+d(4,1)),h(a.data,s,o,i,0,1,d(5,l)+d(6,u)+d(7,f)+d(8,p)+d(9,1)),h(a.data,s,o,i,0,2,d(10,l)+d(11,u)+d(12,f)+d(13,p)+d(14,1)),h(a.data,s,o,i,0,3,d(15,l)+d(16,u)+d(17,f)+d(18,p)+d(19,1))}e.clearRect(0,0,i,r),e.putImageData(a,0,0)},r}return r(i,e),i}(t.Element.ElementBase),t.Element.feGaussianBlur=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return r.blurRadius=Math.floor(r.attribute("stdDeviation").numValue()),r.extraFilterDistance=r.blurRadius,r.apply=function(e,n,i,r,a){"undefined"!=typeof stackBlurCanvasRGBA?(e.canvas.id=t.UniqueId(),e.canvas.style.display="none",document.body.appendChild(e.canvas),stackBlurCanvasRGBA(e.canvas.id,n,i,r,a,this.blurRadius),document.body.removeChild(e.canvas)):t.log("ERROR: StackBlur.js must be included for blur to work")},r}return r(i,e),i}(t.Element.ElementBase),t.Element.title=function(e){function t(e){return n(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return r(t,e),t}(t.Element.ElementBase),t.Element.desc=function(e){function t(e){return n(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return r(t,e),t}(t.Element.ElementBase),t.Element.MISSING=function(e){function i(e){n(this,i);var r=a(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return t.log("ERROR: Element '"+e.nodeName+"' not yet implemented."),r}return r(i,e),i}(t.Element.ElementBase),t.CreateElement=function(e){var n=e.nodeName.replace(/^[^:]+:/,"").replace(/-/g,""),i=void 0;return(i=void 0!==t.Element[n]?new t.Element[n](e):new t.Element.MISSING(e)).type=e.nodeName,i},t.load=function(e,n){t.loadXml(e,t.ajax(n))},t.loadXml=function(e,n){t.loadXmlDoc(e,t.parseXml(n))},t.loadXmlDoc=function(e,n){t.init(e);var i=function(t){for(var n=e.canvas;n;)t.x-=n.offsetLeft,t.y-=n.offsetTop,n=n.offsetParent;return window.scrollX&&(t.x+=window.scrollX),window.scrollY&&(t.y+=window.scrollY),t};!0!==t.opts.ignoreMouse&&(e.canvas.onclick=function(e){var n=i(new t.Point(null!=e?e.clientX:event.clientX,null!=e?e.clientY:event.clientY));t.Mouse.onclick(n.x,n.y)},e.canvas.onmousemove=function(e){var n=i(new t.Point(null!=e?e.clientX:event.clientX,null!=e?e.clientY:event.clientY));t.Mouse.onmousemove(n.x,n.y)});var r=t.CreateElement(n.documentElement);r.root=!0;var a=!0,o=function(){t.ViewPort.Clear(),e.canvas.parentNode&&t.ViewPort.SetCurrent(e.canvas.parentNode.clientWidth,e.canvas.parentNode.clientHeight),!0!==t.opts.ignoreDimensions&&(r.style("width").hasValue()&&(e.canvas.width=r.style("width").toPixels("x"),e.canvas.style.width=e.canvas.width+"px"),r.style("height").hasValue()&&(e.canvas.height=r.style("height").toPixels("y"),e.canvas.style.height=e.canvas.height+"px"));var i=e.canvas.clientWidth||e.canvas.width,o=e.canvas.clientHeight||e.canvas.height;if(!0===t.opts.ignoreDimensions&&r.style("width").hasValue()&&r.style("height").hasValue()&&(i=r.style("width").toPixels("x"),o=r.style("height").toPixels("y")),t.ViewPort.SetCurrent(i,o),null!=t.opts.offsetX&&(r.attribute("x",!0).value=t.opts.offsetX),null!=t.opts.offsetY&&(r.attribute("y",!0).value=t.opts.offsetY),null!=t.opts.scaleWidth||null!=t.opts.scaleHeight){var s=t.ToNumberArray(r.attribute("viewBox").value),l=null,u=null;null!=t.opts.scaleWidth&&(r.attribute("width").hasValue()?l=r.attribute("width").toPixels("x")/t.opts.scaleWidth:isNaN(s[2])||(l=s[2]/t.opts.scaleWidth)),null!=t.opts.scaleHeight&&(r.attribute("height").hasValue()?u=r.attribute("height").toPixels("y")/t.opts.scaleHeight:isNaN(s[3])||(u=s[3]/t.opts.scaleHeight)),null==l&&(l=u),null==u&&(u=l),r.attribute("width",!0).value=t.opts.scaleWidth,r.attribute("height",!0).value=t.opts.scaleHeight,r.attribute("viewBox",!0).value="0 0 "+i*l+" "+o*u,r.attribute("preserveAspectRatio",!0).value="none"}!0!==t.opts.ignoreClear&&e.clearRect(0,0,i,o),r.render(e),a&&(a=!1,"function"==typeof t.opts.renderCallback&&t.opts.renderCallback(n))},s=!0;t.ImagesLoaded()&&(s=!1,o()),t.intervalID=setInterval(function(){var e=!1;if(s&&t.ImagesLoaded()&&(s=!1,e=!0),!0!==t.opts.ignoreMouse&&(e|=t.Mouse.hasEvents()),!0!==t.opts.ignoreAnimation)for(var n=0;n<t.Animations.length;n++)e|=t.Animations[n].update(1e3/t.FRAMERATE);"function"==typeof t.opts.forceRedraw&&!0===t.opts.forceRedraw()&&(e=!0),e&&(o(),t.Mouse.runEvents())},1e3/t.FRAMERATE)},t.stop=function(){t.intervalID&&clearInterval(t.intervalID)},t.Mouse=new function(){this.events=[],this.hasEvents=function(){return 0!==this.events.length},this.onclick=function(e,t){this.events.push({type:"onclick",x:e,y:t,run:function(e){e.onclick&&e.onclick()}})},this.onmousemove=function(e,t){this.events.push({type:"onmousemove",x:e,y:t,run:function(e){e.onmousemove&&e.onmousemove()}})},this.eventElements=[],this.checkPath=function(e,t){for(var n=0;n<this.events.length;n++){var i=this.events[n];t.isPointInPath&&t.isPointInPath(i.x,i.y)&&(this.eventElements[n]=e)}},this.checkBoundingBox=function(e,t){for(var n=0;n<this.events.length;n++){var i=this.events[n];t.isPointInBox(i.x,i.y)&&(this.eventElements[n]=e)}},this.runEvents=function(){t.ctx.canvas.style.cursor="";for(var e=0;e<this.events.length;e++)for(var n=this.events[e],i=this.eventElements[e];i;)n.run(i),i=i.parent;this.events=[],this.eventElements=[]}},t}(o||{});1===e.childNodes.length&&"OBJECT"===e.childNodes[0].nodeName||(e.svg=s);var l=e.getContext("2d");void 0!==t.documentElement?s.loadXmlDoc(l,t):"<"===t.substr(0,1)?s.loadXml(l,t):s.load(l,t)}else for(var u=document.querySelectorAll("svg"),c=0;c<u.length;c++){var h=u[c],d=document.createElement("canvas");d.width=h.clientWidth,d.height=h.clientHeight,h.parentNode.insertBefore(d,h),h.parentNode.removeChild(h);var f=document.createElement("div");f.appendChild(h),nn(d,f.innerHTML)}}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(e,t,n,i,r){nn(this.canvas,e,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:t,offsetY:n,scaleWidth:i,scaleHeight:r})});var rn=jQuery,an=function(){function e(t,i,r){if(n(this,e),this.name_=t,this.group_=r?null:i,r){var a=r.ownerDocument;this.group_=a.createElementNS(l.SVG,"g");var o=a.createElementNS(l.SVG,"title");o.textContent=t,this.group_.appendChild(o),i?rn(i).after(this.group_):r.appendChild(this.group_)}on(this.group_),Ct(this.group_,function(e){e.setAttribute("style","pointer-events:inherit")}),this.group_.setAttribute("style",r?"pointer-events:all":"pointer-events:none")}return i(e,[{key:"getName",value:function(){return this.name_}},{key:"getGroup",value:function(){return this.group_}},{key:"activate",value:function(){this.group_.setAttribute("style","pointer-events:all")}},{key:"deactivate",value:function(){this.group_.setAttribute("style","pointer-events:none")}},{key:"setVisible",value:function(e){var t=void 0===e||e?"inline":"none";this.group_.getAttribute("display")!==t&&this.group_.setAttribute("display",t)}},{key:"isVisible",value:function(){return"none"!==this.group_.getAttribute("display")}},{key:"getOpacity",value:function(){var e=this.group_.getAttribute("opacity");return null===e||void 0===e?1:parseFloat(e)}},{key:"setOpacity",value:function(e){"number"==typeof e&&e>=0&&e<=1&&this.group_.setAttribute("opacity",e)}},{key:"appendChildren",value:function(e){for(var t=0;t<e.length;++t)this.group_.appendChild(e[t])}},{key:"getTitleElement",value:function(){for(var e=this.group_.childNodes.length,t=0;t<e;++t){var n=this.group_.childNodes.item(t);if(n&&"title"===n.tagName)return n}return null}},{key:"setName",value:function(e,t){var n=this.name_;e=mt(e);var i=this.getTitleElement();return i?(rn(i).empty(),i.textContent=e,this.name_=e,t&&t.changeElement(i,{"#text":n}),this.name_):null}},{key:"removeGroup",value:function(){var e=this.group_.parentNode.removeChild(this.group_);return this.group_=void 0,e}}]),e}();function on(e){var t=e.getAttribute("class");null!==t&&void 0!==t&&t.length?an.CLASS_REGEX.test(t)||e.setAttribute("class",t+" "+an.CLASS_NAME):e.setAttribute("class",an.CLASS_NAME)}an.CLASS_NAME="layer",an.CLASS_REGEX=new RegExp("(\\s|^)"+an.CLASS_NAME+"(\\s|$)");var sn=function(){function e(t){n(this,e),this.undoManager_=t,this.currentBatchCommand_=null,this.batchCommandStack_=[]}return i(e,[{key:"startBatchCommand",value:function(e){return this.undoManager_?(this.currentBatchCommand_=new ce(e),this.batchCommandStack_.push(this.currentBatchCommand_),this):this}},{key:"endBatchCommand",value:function(){if(!this.undoManager_)return this;if(this.currentBatchCommand_){var e=this.currentBatchCommand_;this.batchCommandStack_.pop();var t=this.batchCommandStack_.length;this.currentBatchCommand_=t?this.batchCommandStack_[t-1]:null,this.addCommand_(e)}return this}},{key:"moveElement",value:function(e,t,n,i){return this.undoManager_?(this.addCommand_(new oe(e,t,n,i)),this):this}},{key:"insertElement",value:function(e,t){return this.undoManager_?(this.addCommand_(new se(e,t)),this):this}},{key:"removeElement",value:function(e,t,n,i){return this.undoManager_?(this.addCommand_(new le(e,t,n,i)),this):this}},{key:"changeElement",value:function(e,t,n){return this.undoManager_?(this.addCommand_(new ue(e,t,n)),this):this}},{key:"addCommand_",value:function(e){if(!this.undoManager_)return this;this.currentBatchCommand_?this.currentBatchCommand_.addSubCommand(e):this.undoManager_.addCommandToHistory(e)}}]),e}();sn.NO_HISTORY=new sn;var ln=jQuery,un="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),cn={LET_DOCUMENT_DECIDE:0,ALWAYS_RANDOMIZE:1,NEVER_RANDOMIZE:2},hn=cn.LET_DOCUMENT_DECIDE,dn=[];function fn(e){return e||new sn(mn.undoMgr)}function pn(e){for(var t=1;e.includes("Layer "+t);)t++;return"Layer "+t}var gn=function(){function e(t,i){if(n(this,e),!t||!t.tagName||!t.namespaceURI||"svg"!==t.tagName||t.namespaceURI!==l.SVG)throw new Error("Error: svgedit.draw.Drawing instance initialized without a <svg> element");this.svgElem_=t,this.obj_num=0,this.idPrefix=i||"svg_",this.releasedNums=[],this.all_layers=[],this.layer_map={},this.current_layer=null,this.nonce_="";var r=this.svgElem_.getAttributeNS(l.SE,"nonce");r&&hn!==cn.NEVER_RANDOMIZE?this.nonce_=r:hn===cn.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(100001*Math.random()))}return i(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):ln(this.svgElem_).find("[id="+e+"]")[0]}},{key:"getSvgElem",value:function(){return this.svgElem_}},{key:"getNonce",value:function(){return this.nonce_}},{key:"setNonce",value:function(e){this.svgElem_.setAttributeNS(l.XMLNS,"xmlns:se",l.SE),this.svgElem_.setAttributeNS(l.SE,"se:nonce",e),this.nonce_=e}},{key:"clearNonce",value:function(){this.nonce_=""}},{key:"getId",value:function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num}},{key:"getNextId",value:function(){var e=this.obj_num,t=!1;this.releasedNums.length>0?(this.obj_num=this.releasedNums.pop(),t=!0):this.obj_num++;for(var n=this.getId();this.getElem_(n);)t&&(this.obj_num=e,t=!1),this.obj_num++,n=this.getId();return t&&(this.obj_num=e),n}},{key:"releaseId",value:function(e){var t=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if("string"!=typeof e||!e.startsWith(t))return!1;var n=parseInt(e.substr(t.length),10);return!("number"!=typeof n||n<=0||this.releasedNums.includes(n))&&(this.releasedNums.push(n),!0)}},{key:"getNumLayers",value:function(){return this.all_layers.length}},{key:"hasLayer",value:function(e){return void 0!==this.layer_map[e]}},{key:"getLayerName",value:function(e){return e>=0&&e<this.getNumLayers()?this.all_layers[e].getName():""}},{key:"getCurrentLayer",value:function(){return this.current_layer?this.current_layer.getGroup():null}},{key:"getLayerByName",value:function(e){var t=this.layer_map[e];return t?t.getGroup():null}},{key:"getCurrentLayerName",value:function(){return this.current_layer?this.current_layer.getName():""}},{key:"setCurrentLayerName",value:function(e,t){var n=null;if(this.current_layer){var i=this.current_layer.getName();(n=this.current_layer.setName(e,t))&&(delete this.layer_map[i],this.layer_map[n]=this.current_layer)}return n}},{key:"setCurrentLayerPosition",value:function(e){var t=this.getNumLayers();if(!this.current_layer||e<0||e>=t)return null;var n=void 0;for(n=0;n<t&&this.all_layers[n]!==this.current_layer;++n);if(n===t)return null;if(n!==e){var i=this.current_layer.getGroup(),r=i.nextSibling,a=null;return e>n?e<t-1&&(a=this.all_layers[e+1].getGroup()):a=this.all_layers[e].getGroup(),this.svgElem_.insertBefore(i,a),this.identifyLayers(),this.setCurrentLayer(this.getLayerName(e)),{currentGroup:i,oldNextSibling:r}}return null}},{key:"mergeLayer",value:function(e){var t=this.current_layer.getGroup(),n=ln(t).prev()[0];if(n){e.startBatchCommand("Merge Layer");var i=t.nextSibling;for(e.removeElement(t,i,this.svgElem_);t.firstChild;){var r=t.firstChild;if("title"!==r.localName){var a=r.nextSibling;n.appendChild(r),e.moveElement(r,a,t)}else e.removeElement(r,r.nextSibling,t),t.removeChild(r)}this.current_layer.removeGroup();var o=this.all_layers.indexOf(this.current_layer);if(o>0){var s=this.current_layer.getName();this.current_layer=this.all_layers[o-1],this.all_layers.splice(o,1),delete this.layer_map[s]}e.endBatchCommand()}}},{key:"mergeAllLayers",value:function(e){for(this.current_layer=this.all_layers[this.all_layers.length-1],e.startBatchCommand("Merge all Layers");this.all_layers.length>1;)this.mergeLayer(e);e.endBatchCommand()}},{key:"setCurrentLayer",value:function(e){var t=this.layer_map[e];return!!t&&(this.current_layer&&this.current_layer.deactivate(),this.current_layer=t,this.current_layer.activate(),!0)}},{key:"deleteCurrentLayer",value:function(){if(this.current_layer&&this.getNumLayers()>1){var e=this.current_layer.removeGroup();return this.identifyLayers(),e}return null}},{key:"identifyLayers",value:function(){this.all_layers=[],this.layer_map={};for(var e,t=this.svgElem_.childNodes.length,n=[],i=[],r=null,a=!1,o=0;o<t;++o){var s=this.svgElem_.childNodes.item(o);if(s&&1===s.nodeType)if("g"===s.tagName){a=!0;var l=ln("title",e=s).text()||(G()&&e.querySelectorAll?ln(e.querySelectorAll("title")).text():"");l?(i.push(l),r=new an(l,s),this.all_layers.push(r),this.layer_map[l]=r):n.push(s)}else un.includes(s.nodeName)&&n.push(s)}n.length>0||!a?((r=new an(pn(i),null,this.svgElem_)).appendChildren(n),this.all_layers.push(r),this.layer_map[name]=r):r.activate(),this.current_layer=r}},{key:"createLayer",value:function(e,t){this.current_layer&&this.current_layer.deactivate(),(void 0===e||null===e||""===e||this.layer_map[e])&&(e=pn(Object.keys(this.layer_map)));var n=new an(e,null,this.svgElem_);return t&&(t.startBatchCommand("Create Layer"),t.insertElement(n.getGroup()),t.endBatchCommand()),this.all_layers.push(n),this.layer_map[e]=n,this.current_layer=n,n.getGroup()}},{key:"cloneLayer",value:function(e,t){if(!this.current_layer)return null;this.current_layer.deactivate(),(void 0===e||null===e||""===e||this.layer_map[e])&&(e=pn(Object.keys(this.layer_map)));for(var n=this.current_layer.getGroup(),i=new an(e,n,this.svgElem_),r=i.getGroup(),a=n.childNodes,o=0;o<a.length;o++){var s=a[o];"title"!==s.localName&&r.appendChild(this.copyElem(s))}t&&(t.startBatchCommand("Duplicate Layer"),t.insertElement(r),t.endBatchCommand());var l=this.all_layers.indexOf(this.current_layer);return l>=0?this.all_layers.splice(l+1,0,i):this.all_layers.push(i),this.layer_map[e]=i,this.current_layer=i,r}},{key:"getLayerVisibility",value:function(e){var t=this.layer_map[e];return!!t&&t.isVisible()}},{key:"setLayerVisibility",value:function(e,t){if("boolean"!=typeof t)return null;var n=this.layer_map[e];return n?(n.setVisible(t),n.getGroup()):null}},{key:"getLayerOpacity",value:function(e){var t=this.layer_map[e];return t?t.getOpacity():null}},{key:"setLayerOpacity",value:function(e,t){if(!("number"!=typeof t||t<0||t>1)){var n=this.layer_map[e];n&&n.setOpacity(t)}}},{key:"copyElem",value:function(e){var t=this;return function e(t,n){var i=document.createElementNS(t.namespaceURI,t.nodeName);if(ct.each(t.attributes,function(e,t){"-moz-math-font-style"!==t.localName&&i.setAttributeNS(t.namespaceURI,t.nodeName,t.value)}),i.removeAttribute("id"),i.id=n(),N()&&"path"===t.nodeName){var r=nt(t);i.setAttribute("d",r)}if(ct.each(t.childNodes,function(t,r){switch(r.nodeType){case 1:i.appendChild(e(r,n));break;case 3:i.textContent=r.nodeValue}}),ct(t).data("gsvg"))ct(i).data("gsvg",i.firstChild);else if(ct(t).data("symbol")){var a=ct(t).data("symbol");ct(i).data("ref",a).data("symbol",a)}else"image"===i.tagName&&Kt(i);return i}(e,function(){return t.getNextId()})}}]),e}(),vn=function(e,t){(hn=!1===e?cn.NEVER_RANDOMIZE:cn.ALWAYS_RANDOMIZE)!==cn.ALWAYS_RANDOMIZE||t.getNonce()?hn===cn.NEVER_RANDOMIZE&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},mn=void 0,yn=function(e){mn=e},_n=function(){bn(),mn.getCurrentDrawing().identifyLayers()},bn=function(){var e=dn.length;if(e){for(var t=0;t<e;t++){var n=dn[t],i=mn.elData(n,"orig_opac");1!==i?n.setAttribute("opacity",i):n.removeAttribute("opacity"),n.setAttribute("style","pointer-events: inherit")}dn=[],mn.clearSelection(!0),mn.call("contextset",null)}mn.setCurrentGroup(null)},xn=function(e){bn(),"string"==typeof e&&(e=qt(e)),mn.setCurrentGroup(e),ln(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var e=this.getAttribute("opacity")||1;mn.elData(this,"orig_opac",e),this.setAttribute("opacity",.33*e),this.setAttribute("style","pointer-events: none"),dn.push(this)}),mn.clearSelection(),mn.call("contextset",mn.getCurrentGroup())},wn=Object.freeze({Drawing:gn,randomizeIds:vn,init:yn,identifyLayers:_n,createLayer:function(e,t){var n=mn.getCurrentDrawing().createLayer(e,fn(t));mn.clearSelection(),mn.call("changed",[n])},cloneLayer:function(e,t){var n=mn.getCurrentDrawing().cloneLayer(e,fn(t));mn.clearSelection(),bn(),mn.call("changed",[n])},deleteCurrentLayer:function(){var e=mn.getCurrentDrawing().getCurrentLayer(),t=e.nextSibling,n=e.parentNode;if(e=mn.getCurrentDrawing().deleteCurrentLayer()){var i=new ce("Delete Layer");return i.addSubCommand(new le(e,t,n)),mn.addCommandToHistory(i),mn.clearSelection(),mn.call("changed",[n]),!0}return!1},setCurrentLayer:function(e){var t=mn.getCurrentDrawing().setCurrentLayer(mt(e));return t&&mn.clearSelection(),t},renameCurrentLayer:function(e){var t=mn.getCurrentDrawing(),n=t.getCurrentLayer();if(n&&t.setCurrentLayerName(e,fn()))return mn.call("changed",[n]),!0;return!1},setCurrentLayerPosition:function(e){var t=mn.getCurrentDrawing().setCurrentLayerPosition(e);return!!t&&(mn.addCommandToHistory(new oe(t.currentGroup,t.oldNextSibling,mn.getSVGContent())),!0)},setLayerVisibility:function(e,t){var n=mn.getCurrentDrawing(),i=n.getLayerVisibility(e),r=n.setLayerVisibility(e,t);if(!r)return!1;var a=i?"inline":"none";return mn.addCommandToHistory(new ue(r,{display:a},"Layer Visibility")),r===n.getCurrentLayer()&&(mn.clearSelection(),mn.pathActions.clear()),!0},moveSelectedToLayer:function(e){var t=mn.getCurrentDrawing().getLayerByName(e);if(!t)return!1;for(var n=new ce("Move Elements to Layer"),i=mn.getSelectedElements(),r=i.length;r--;){var a=i[r];if(a){var o=a.nextSibling,s=a.parentNode;t.appendChild(a),n.addSubCommand(new oe(a,o,s))}}return mn.addCommandToHistory(n),!0},mergeLayer:function(e){mn.getCurrentDrawing().mergeLayer(fn(e)),mn.clearSelection(),bn(),mn.changeSvgcontent()},mergeAllLayers:function(e){mn.getCurrentDrawing().mergeAllLayers(fn(e)),mn.clearSelection(),bn(),mn.changeSvgcontent()},leaveContext:bn,setContext:xn,Layer:an}),Sn=u(),kn={a:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","id","mask","opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","xlink:href","xlink:title"],circle:["class","clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","id","mask","opacity","r","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],clipPath:["class","clipPathUnits","id"],defs:[],style:["type"],desc:[],ellipse:["class","clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","id","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],feGaussianBlur:["class","color-interpolation-filters","id","requiredFeatures","stdDeviation"],filter:["class","color-interpolation-filters","filterRes","filterUnits","height","id","primitiveUnits","requiredFeatures","width","x","xlink:href","y"],foreignObject:["class","font-size","height","id","opacity","requiredFeatures","style","transform","width","x","y"],g:["class","clip-path","clip-rule","id","display","fill","fill-opacity","fill-rule","filter","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","font-family","font-size","font-style","font-weight","text-anchor"],image:["class","clip-path","clip-rule","filter","height","id","mask","opacity","requiredFeatures","style","systemLanguage","transform","width","x","xlink:href","xlink:title","y"],line:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","id","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","x1","x2","y1","y2"],linearGradient:["class","id","gradientTransform","gradientUnits","requiredFeatures","spreadMethod","systemLanguage","x1","x2","xlink:href","y1","y2"],marker:["id","class","markerHeight","markerUnits","markerWidth","orient","preserveAspectRatio","refX","refY","systemLanguage","viewBox"],mask:["class","height","id","maskContentUnits","maskUnits","width","x","y"],metadata:["class","id"],path:["class","clip-path","clip-rule","d","fill","fill-opacity","fill-rule","filter","id","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],pattern:["class","height","id","patternContentUnits","patternTransform","patternUnits","requiredFeatures","style","systemLanguage","viewBox","width","x","xlink:href","y"],polygon:["class","clip-path","clip-rule","id","fill","fill-opacity","fill-rule","filter","id","class","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],polyline:["class","clip-path","clip-rule","id","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],radialGradient:["class","cx","cy","fx","fy","gradientTransform","gradientUnits","id","r","requiredFeatures","spreadMethod","systemLanguage","xlink:href"],rect:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","id","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","width","x","y"],stop:["class","id","offset","requiredFeatures","stop-color","stop-opacity","style","systemLanguage"],svg:["class","clip-path","clip-rule","filter","id","height","mask","preserveAspectRatio","requiredFeatures","style","systemLanguage","viewBox","width","x","xmlns","xmlns:se","xmlns:xlink","y"],switch:["class","id","requiredFeatures","systemLanguage"],symbol:["class","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","opacity","preserveAspectRatio","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","viewBox"],text:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","text-anchor","transform","x","xml:space","y"],textPath:["class","id","method","requiredFeatures","spacing","startOffset","style","systemLanguage","transform","xlink:href"],title:[],tspan:["class","clip-path","clip-rule","dx","dy","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","mask","opacity","requiredFeatures","rotate","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","text-anchor","textLength","transform","x","xml:space","y"],use:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","id","mask","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","transform","width","x","xlink:href","y"],annotation:["encoding"],"annotation-xml":["encoding"],maction:["actiontype","other","selection"],math:["class","id","display","xmlns"],menclose:["notation"],merror:[],mfrac:["linethickness"],mi:["mathvariant"],mmultiscripts:[],mn:[],mo:["fence","lspace","maxsize","minsize","rspace","stretchy"],mover:[],mpadded:["lspace","width","height","depth","voffset"],mphantom:[],mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth","height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],semantics:[]},Cn={};Object.entries(kn).forEach(function(e){var t=o(e,2),n=t[0],i=t[1],r={};Object.entries(i).forEach(function(e){var t=o(e,2),n=(t[0],t[1]);if(n.includes(":")){var i=n.split(":");r[i[1]]=l[i[0].toUpperCase()]}else r[n]="xmlns"===n?l.XMLNS:null}),Cn[n]=r});var Pn=function e(t){if(3===t.nodeType&&(t.nodeValue=t.nodeValue.replace(/^\s+|\s+$/g,""),t.nodeValue.length||t.parentNode.removeChild(t)),1===t.nodeType){var n=t.ownerDocument,i=t.parentNode;if(n&&i){var r=kn[t.nodeName],a=Cn[t.nodeName];if(void 0!==r){for(var s=[],u=t.attributes.length;u--;){var c=t.attributes.item(u),h=c.nodeName,d=c.localName,f=c.namespaceURI;if(a.hasOwnProperty(d)&&f===a[d]&&f!==l.XMLNS||f===l.XMLNS&&Sn[c.value]||((h.startsWith("se:")||h.startsWith("data-"))&&s.push([h,c.value]),t.removeAttributeNS(f,d)),I())switch(h){case"transform":case"gradientTransform":case"patternTransform":var p=c.value.replace(/(\d)-/g,"$1 -");t.setAttribute(h,p)}if("style"===h){for(var g=c.value.split(";"),v=g.length;v--;){var m=g[v].split(":"),y=o(m,2),_=y[0],b=y[1],x=(_||"").trim(),w=(b||"").trim();r.includes(x)&&t.setAttribute(x,w)}t.removeAttribute("style")}}Object.values(s).forEach(function(e){t.setAttributeNS(l.SE,e[0],e[1])});var S=At(t);if(S&&["filter","linearGradient","pattern","radialGradient","textPath","use"].includes(t.nodeName)&&"#"!==S[0]&&(Et(t,""),t.removeAttributeNS(l.XLINK,"href")),"use"===t.nodeName&&!At(t))return void i.removeChild(t);for(Object.values(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(e){var n=t.getAttribute(e);n&&(n=Pt(n))&&"#"!==n[0]&&(t.setAttribute(e,""),t.removeAttribute(e))}),u=t.childNodes.length;u--;)e(t.childNodes.item(u))}else{for(var k=[];t.hasChildNodes();)k.push(i.insertBefore(t.firstChild,t));i.removeChild(t);for(var C=k.length;C--;)e(k[C])}}}},An=jQuery,En=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Tn=null,Gn=function(e,t,n){for(var i=function(e,t){return pe(e,t,n)},r=function(e){return n.a*e},a=function(e){return n.d*e},o=Tn.getGridSnapping()&&"svg"===e.parentNode.parentNode.localName,s=function(){if(o)for(var n in t)t[n]=Wt(t[n]);Xt(e,t,1e3,!0)},l=It(e),u=0;u<2;u++){var c=0===u?"fill":"stroke",h=e.getAttribute(c);if(h&&h.startsWith("url(")&&(n.a<0||n.d<0)){var d=Ht(h).cloneNode(!0);if(n.a<0){var f=d.getAttribute("x1"),p=d.getAttribute("x2");d.setAttribute("x1",-(f-1)),d.setAttribute("x2",-(p-1))}if(n.d<0){var g=d.getAttribute("y1"),v=d.getAttribute("y2");d.setAttribute("y1",-(g-1)),d.setAttribute("y2",-(v-1))}d.id=Tn.getDrawing().getNextId(),Tt().appendChild(d),e.setAttribute(c,"url(#"+d.id+")")}}var m=e.tagName;if("g"===m||"text"===m||"tspan"===m||"use"===m)if(1!==n.a||0!==n.b||0!==n.c||1!==n.d||0===n.e&&0===n.f){var y=W(e),_=Tn.getSVGRoot().createSVGTransform();_.setMatrix(ve(_e(y).matrix,n)),y.clear(),y.appendItem(_)}else{var b=_e(e).matrix,x=ve(b.inverse(),n,b);t.x=parseFloat(t.x)+x.e,t.y=parseFloat(t.y)+x.f}switch(m){case"foreignObject":case"rect":case"image":if("image"===m&&(n.a<0||n.d<0)){var w=W(e),S=Tn.getSVGRoot().createSVGTransform();S.setMatrix(ve(_e(w).matrix,n)),w.clear(),w.appendItem(S)}else{var k=i(t.x,t.y);t.width=r(t.width),t.height=a(t.height),t.x=k.x+Math.min(0,t.width),t.y=k.y+Math.min(0,t.height),t.width=Math.abs(t.width),t.height=Math.abs(t.height)}s();break;case"ellipse":var C=i(t.cx,t.cy);t.cx=C.x,t.cy=C.y,t.rx=r(t.rx),t.ry=a(t.ry),t.rx=Math.abs(t.rx),t.ry=Math.abs(t.ry),s();break;case"circle":var P=i(t.cx,t.cy);t.cx=P.x,t.cy=P.y;var A=ye(l.x,l.y,l.width,l.height,n),E=A.tr.x-A.tl.x,T=A.bl.y-A.tl.y;t.r=Math.min(E/2,T/2),t.r&&(t.r=Math.abs(t.r)),s();break;case"line":var G=i(t.x1,t.y1),N=i(t.x2,t.y2);t.x1=G.x,t.y1=G.y,t.x2=N.x,t.y2=N.y;case"text":case"tspan":case"use":s();break;case"g":var I=An(e).data("gsvg");I&&Xt(I,t,1e3,!0);break;case"polyline":case"polygon":for(var M=t.points.length,L=0;L<M;++L){var O=t.points[L],V=i(O.x,O.y),j=V.x,B=V.y;t.points[L].x=j,t.points[L].y=B}for(var R="",D=0;D<M;++D){var F=t.points[D];R+=F.x+","+F.y+" "}e.setAttribute("points",R);break;case"path":var U=e.pathSegList,z=U.numberOfItems;t.d=[];for(var H=0;H<z;++H){var q=U.getItem(H);t.d[H]={type:q.pathSegType,x:q.x,y:q.y,x1:q.x1,y1:q.y1,x2:q.x2,y2:q.y2,r1:q.r1,r2:q.r2,angle:q.angle,largeArcFlag:q.largeArcFlag,sweepFlag:q.sweepFlag}}z=t.d.length;var X=t.d[0],Y=i(X.x,X.y);t.d[0].x=Y.x,t.d[0].y=Y.y;for(var Q=1;Q<z;++Q){var $=t.d[Q];if($.type%2==0){var Z=i(void 0!==$.x?$.x:Y.x,void 0!==$.y?$.y:Y.y),K=i($.x1,$.y1),J=i($.x2,$.y2);$.x=Z.x,$.y=Z.y,$.x1=K.x,$.y1=K.y,$.x2=J.x,$.y2=J.y,$.r1=r($.r1),$.r2=a($.r2)}else $.x=r($.x),$.y=a($.y),$.x1=r($.x1),$.y1=a($.y1),$.x2=r($.x2),$.y2=a($.y2),$.r1=r($.r1),$.r2=a($.r2)}var ee="";z=t.d.length;for(var te=0;te<z;++te){var ne=t.d[te],ie=ne.type;switch(ee+=En[ie],ie){case 13:case 12:ee+=ne.x+" ";break;case 15:case 14:ee+=ne.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:ee+=ne.x+","+ne.y+" ";break;case 7:case 6:ee+=ne.x1+","+ne.y1+" "+ne.x2+","+ne.y2+" "+ne.x+","+ne.y+" ";break;case 9:case 8:ee+=ne.x1+","+ne.y1+" "+ne.x+","+ne.y+" ";break;case 11:case 10:ee+=ne.r1+","+ne.r2+" "+ne.angle+" "+ +ne.largeArcFlag+" "+ +ne.sweepFlag+" "+ne.x+","+ne.y+" ";break;case 17:case 16:ee+=ne.x2+","+ne.y2+" "+ne.x+","+ne.y+" "}}e.setAttribute("d",ee)}},Nn=D(jQuery),In=void 0,Mn=function(e,t,n){var i=Ht(e).firstChild,r=W(i),a=In.getSVGRoot().createSVGTransform();a.setTranslate(t,n),r.appendItem(a),Ln(i)},Ln=function e(t){if(null==t)return null;if("svg"===t.nodeName&&navigator.userAgent.includes("Firefox/20"))return null;var n=In.getSVGRoot(),i=W(t);if(i&&i.numberOfItems>0){for(var r=i.numberOfItems,a=r;r--;){var o=i.getItem(r);if(0===o.type)i.removeItem(r);else if(1===o.type){if(ge(o.matrix)){if(1===a)return t.removeAttribute("transform"),null;i.removeItem(r)}}else 4===o.type&&0===o.angle&&i.removeItem(r)}if(1===i.numberOfItems&&zt(t))return null}if(!i||0===i.numberOfItems)return t.setAttribute("transform",""),t.removeAttribute("transform"),null;if(i){for(var s=[],u=i.numberOfItems;u--;){var c=i.getItem(u);1===c.type?s.push([c.matrix,u]):s.length&&(s=[])}if(2===s.length){var h=n.createSVGTransformFromMatrix(ve(s[1][0],s[0][0]));i.removeItem(s[0][1]),i.removeItem(s[1][1]),i.insertItemBefore(h,s[1][1])}if((u=i.numberOfItems)>=2&&1===i.getItem(u-2).type&&2===i.getItem(u-1).type){var d=n.createSVGTransform(),f=ve(i.getItem(u-2).matrix,i.getItem(u-1).matrix);d.setMatrix(f),i.removeItem(u-2),i.removeItem(u-2),i.appendItem(d)}}switch(t.tagName){case"line":case"polyline":case"polygon":case"path":break;default:if(1===i.numberOfItems&&1===i.getItem(0).type||2===i.numberOfItems&&1===i.getItem(0).type&&4===i.getItem(0).type)return null}var p=Nn(t).data("gsvg"),g=new ce("Transform"),v={},m=null,y=[];switch(t.tagName){case"line":y=["x1","y1","x2","y2"];break;case"circle":y=["cx","cy","r"];break;case"ellipse":y=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":y=["width","height","x","y"];break;case"use":case"text":case"tspan":y=["x","y"];break;case"polygon":case"polyline":(m={}).points=t.getAttribute("points");var _=t.points,b=_.numberOfItems;v.points=new Array(b);for(var x=0;x<b;++x){var w=_.getItem(x);v.points[x]={x:w.x,y:w.y}}break;case"path":(m={}).d=t.getAttribute("d"),v.d=t.getAttribute("d")}y.length?(v=Nn(t).attr(y),Nn.each(v,function(e,t){v[e]=ie(e,t)})):p&&(v={x:Nn(p).attr("x")||0,y:Nn(p).attr("y")||0}),null==m&&(m=Nn.extend(!0,{},v),Nn.each(m,function(e,t){m[e]=ie(e,t)})),m.transform=In.getStartTransform()||"";var S=void 0,k=void 0;if("g"===t.tagName&&!p||"a"===t.tagName){var C=It(t);S={x:C.x+C.width/2,y:C.y+C.height/2},k=pe(C.x+C.width/2,C.y+C.height/2,_e(i).matrix);var P=n.createSVGMatrix(),A=zt(t);if(A){var E=A*Math.PI/180,T=void 0;T=Math.abs(E)>1e-10?Math.sin(E)/(1-Math.cos(E)):2/E;for(var G=0;G<i.numberOfItems;++G){var I=i.getItem(G);if(4===I.type){var M=I.matrix;S.y=(T*M.e+M.f)/2,S.x=(M.e-T*M.f)/2,i.removeItem(G);break}}}var L=i.numberOfItems,O=0,V=0,j=0,B=void 0;L&&(B=i.getItem(0).matrix);var R=void 0;if(L>=3&&3===i.getItem(L-2).type&&2===i.getItem(L-3).type&&2===i.getItem(L-1).type){j=3;for(var D=i.getItem(L-3).matrix,F=i.getItem(L-2).matrix,U=i.getItem(L-1).matrix,z=t.childNodes,H=z.length;H--;){var q=z.item(H);if(O=0,V=0,1===q.nodeType){var X=W(q);if(!X)continue;var Y=_e(X).matrix,Q=zt(q);if(R=In.getStartTransform(),In.setStartTransform(q.getAttribute("transform")),Q||me(X)){var $=n.createSVGTransform();$.setMatrix(ve(D,F,U,Y)),X.clear(),X.appendItem($)}else{var Z=ve(Y.inverse(),U,Y),K=n.createSVGMatrix();K.e=-Z.e,K.f=-Z.f;var J=ve(K.inverse(),Y.inverse(),D,F,U,Y,Z.inverse()),ee=n.createSVGTransform(),te=n.createSVGTransform(),ne=n.createSVGTransform();ee.setTranslate(Z.e,Z.f),te.setScale(J.a,J.d),ne.setTranslate(K.e,K.f),X.appendItem(ne),X.appendItem(te),X.appendItem(ee)}g.addSubCommand(e(q)),In.setStartTransform(R)}}i.removeItem(L-1),i.removeItem(L-2),i.removeItem(L-3)}else if(L>=3&&1===i.getItem(L-1).type){j=3,P=_e(i).matrix;var re=n.createSVGTransform();re.setMatrix(P),i.clear(),i.appendItem(re)}else if((1===L||L>1&&3!==i.getItem(1).type)&&2===i.getItem(0).type){j=2;var ae=_e(i).matrix;i.removeItem(0);var oe=_e(i).matrix.inverse(),se=ve(oe,ae);if(O=se.e,V=se.f,0!==O||0!==V){for(var le=t.childNodes,he=le.length,de=[];he--;){var fe=le.item(he);if(1===fe.nodeType){if(fe.getAttribute("clip-path")){var ye=fe.getAttribute("clip-path");de.includes(ye)||(Mn(ye,O,V),de.push(ye))}R=In.getStartTransform(),In.setStartTransform(fe.getAttribute("transform"));var be=W(fe);if(be){var xe=n.createSVGTransform();xe.setTranslate(O,V),be.numberOfItems?be.insertItemBefore(xe,0):be.appendItem(xe),g.addSubCommand(e(fe));for(var we=t.getElementsByTagNameNS(l.SVG,"use"),Se="#"+fe.id,ke=we.length;ke--;){var Ce=we.item(ke);if(Se===At(Ce)){var Pe=n.createSVGTransform();Pe.setTranslate(-O,-V),W(Ce).insertItemBefore(Pe,0),g.addSubCommand(e(Ce))}}In.setStartTransform(R)}}}de=[],In.setStartTransform(R)}}else{if(1!==L||1!==i.getItem(0).type||A){if(A){var Ae=n.createSVGTransform();Ae.setRotate(A,k.x,k.y),i.numberOfItems?i.insertItemBefore(Ae,0):i.appendItem(Ae)}return 0===i.numberOfItems&&t.removeAttribute("transform"),null}j=1;for(var Ee=i.getItem(0).matrix,Te=t.childNodes,Ge=Te.length;Ge--;){var Ne=Te.item(Ge);if(1===Ne.nodeType){R=In.getStartTransform(),In.setStartTransform(Ne.getAttribute("transform"));var Ie=W(Ne);if(!Ie)continue;var Me=ve(Ee,_e(Ie).matrix),Le=n.createSVGTransform();Le.setMatrix(Me),Ie.clear(),Ie.appendItem(Le,0),g.addSubCommand(e(Ne)),In.setStartTransform(R);var Oe=Ne.getAttribute("stroke-width");if("none"!==Ne.getAttribute("stroke")&&!isNaN(Oe)){var Ve=(Math.abs(Me.a)+Math.abs(Me.d))/2;Ne.setAttribute("stroke-width",Oe*Ve)}}}i.clear()}if(2===j){if(A){k={x:S.x+B.e,y:S.y+B.f};var je=n.createSVGTransform();je.setRotate(A,k.x,k.y),i.numberOfItems?i.insertItemBefore(je,0):i.appendItem(je)}}else if(3===j){var Be=_e(i).matrix,Re=n.createSVGTransform();Re.setRotate(A,S.x,S.y);var De=Re.matrix,Fe=n.createSVGTransform();Fe.setRotate(A,k.x,k.y);var Ue=Fe.matrix.inverse(),ze=Be.inverse(),He=ve(ze,Ue,De,Be);if(O=He.e,V=He.f,0!==O||0!==V)for(var qe=t.childNodes,Xe=qe.length;Xe--;){var Ye=qe.item(Xe);if(1===Ye.nodeType){R=In.getStartTransform(),In.setStartTransform(Ye.getAttribute("transform"));var We=W(Ye),Qe=n.createSVGTransform();Qe.setTranslate(O,V),We.numberOfItems?We.insertItemBefore(Qe,0):We.appendItem(Qe),g.addSubCommand(e(Ye)),In.setStartTransform(R)}}A&&(i.numberOfItems?i.insertItemBefore(Fe,0):i.appendItem(Fe))}}else{var $e=It(t);if(!$e&&"path"!==t.tagName)return null;var Ze=n.createSVGMatrix(),Ke=zt(t);if(Ke){S={x:$e.x+$e.width/2,y:$e.y+$e.height/2},k=pe($e.x+$e.width/2,$e.y+$e.height/2,_e(i).matrix);for(var Je=Ke*Math.PI/180,et=Math.abs(Je)>1e-10?Math.sin(Je)/(1-Math.cos(Je)):2/Je,tt=0;tt<i.numberOfItems;++tt){var nt=i.getItem(tt);if(4===nt.type){var it=nt.matrix;S.y=(et*it.e+it.f)/2,S.x=(it.e-et*it.f)/2,i.removeItem(tt);break}}}var rt=0,at=i.numberOfItems;if(!N()){var ot=t.getAttribute("fill");if(ot&&ot.startsWith("url(")){var st=Ht(ot),lt="pattern";if(st.tagName!==lt&&(lt="gradient"),"userSpaceOnUse"===st.getAttribute(lt+"Units")){Ze=_e(i).matrix;var ut=W(st),ct=_e(ut).matrix,ht="matrix("+[(Ze=ve(Ze,ct)).a,Ze.b,Ze.c,Ze.d,Ze.e,Ze.f].join(",")+")";st.setAttribute(lt+"Transform",ht)}}}if(at>=3&&3===i.getItem(at-2).type&&2===i.getItem(at-3).type&&2===i.getItem(at-1).type)rt=3,Ze=_e(i,at-3,at-1).matrix,i.removeItem(at-1),i.removeItem(at-2),i.removeItem(at-3);else if(4===at&&1===i.getItem(at-1).type){rt=3,Ze=_e(i).matrix;var dt=n.createSVGTransform();dt.setMatrix(Ze),i.clear(),i.appendItem(dt),Ze=n.createSVGMatrix()}else if((1===at||at>1&&3!==i.getItem(1).type)&&2===i.getItem(0).type){rt=2;var ft=i.getItem(0).matrix,pt=_e(i,1).matrix,gt=pt.inverse();Ze=ve(gt,ft,pt),i.removeItem(0)}else{if(1!==at||1!==i.getItem(0).type||Ke){if(rt=4,Ke){var vt=n.createSVGTransform();vt.setRotate(Ke,k.x,k.y),i.numberOfItems?i.insertItemBefore(vt,0):i.appendItem(vt)}return 0===i.numberOfItems&&t.removeAttribute("transform"),null}switch(Ze=_e(i).matrix,t.tagName){case"line":v=Nn(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(v.points=t.getAttribute("points"),v.points){var mt=t.points,yt=mt.numberOfItems;v.points=new Array(yt);for(var _t=0;_t<yt;++_t){var bt=mt.getItem(_t);v.points[_t]={x:bt.x,y:bt.y}}}case"path":v.d=t.getAttribute("d"),rt=1,i.clear()}}if(1!==rt&&2!==rt&&3!==rt||Gn(t,v,Ze),2===rt){if(Ke){me(i)||(k={x:S.x+Ze.e,y:S.y+Ze.f});var xt=n.createSVGTransform();xt.setRotate(Ke,k.x,k.y),i.numberOfItems?i.insertItemBefore(xt,0):i.appendItem(xt)}if("text"===t.tagName)for(var wt=t.childNodes,St=wt.length;St--;){var kt=wt.item(St);if("tspan"===kt.tagName){var Ct={x:Nn(kt).attr("x")||0,y:Nn(kt).attr("y")||0};Gn(kt,Ct,Ze)}}}else if(3===rt&&Ke){var Pt=_e(i).matrix,Et=n.createSVGTransform();Et.setRotate(Ke,S.x,S.y);var Tt=Et.matrix,Gt=n.createSVGTransform();Gt.setRotate(Ke,k.x,k.y);var Nt=Gt.matrix.inverse(),Mt=Pt.inverse(),Lt=ve(Mt,Nt,Tt,Pt);Gn(t,v,Lt),Ke&&(i.numberOfItems?i.insertItemBefore(Gt,0):i.appendItem(Gt))}}return 0===i.numberOfItems&&t.removeAttribute("transform"),g.addSubCommand(new ue(t,m)),g},On=jQuery,Vn=void 0,jn=void 0,Bn=void 0,Rn=V()?10:4,Dn=function(){function e(t,i,r){n(this,e),this.id=t,this.selectedElement=i,this.locked=!0,this.selectorGroup=Vn.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}}),this.selectorRect=this.selectorGroup.appendChild(Vn.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#22C","stroke-width":"1","stroke-dasharray":"5,5",style:"pointer-events:none"}})),this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null},this.reset(this.selectedElement,r)}return i(e,[{key:"reset",value:function(e,t){this.locked=!0,this.selectedElement=e,this.resize(t),this.selectorGroup.setAttribute("display","inline")}},{key:"updateGripCursors",value:function(e){var t=void 0,n=[],i=Math.round(e/45);for(t in i<0&&(i+=8),Bn.selectorGrips)n.push(t);for(;i>0;)n.push(n.shift()),i--;var r=0;for(t in Bn.selectorGrips)Bn.selectorGrips[t].setAttribute("style","cursor:"+n[r]+"-resize"),r++}},{key:"showGrips",value:function(e){var t=e?"inline":"none";Bn.selectorGripsGroup.setAttribute("display",t);var n=this.selectedElement;this.hasGrips=e,n&&e&&(this.selectorGroup.appendChild(Bn.selectorGripsGroup),this.updateGripCursors(zt(n)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=Bn,i=n.selectorGrips,r=this.selectedElement,a=r.getAttribute("stroke-width"),o=Vn.getCurrentZoom(),s=1/o;"none"===r.getAttribute("stroke")||isNaN(a)||(s+=a/2);var l=r.tagName;"text"===l&&(s+=2/o);var u=W(r),c=_e(u).matrix;if(c.e*=o,c.f*=o,e||(e=It(r)),"g"===l&&!On.data(r,"gsvg")){var h=Rt([r.childNodes]);h&&(e=h)}var d=e.x,f=e.y,p=e.width,g=e.height;e={x:d,y:f,width:p,height:g},s*=o;var v=ye(d*o,f*o,p*o,g*o,c),m=v.aabox,y=m.x-s,_=m.y-s,b=m.width+2*s,x=m.height+2*s,w=y+b/2,S=_+x/2,k=zt(r);if(k){var C=Vn.svgRoot().createSVGTransform();C.setRotate(-k,w,S);var P=C.matrix;v.tl=pe(v.tl.x,v.tl.y,P),v.tr=pe(v.tr.x,v.tr.y,P),v.bl=pe(v.bl.x,v.bl.y,P),v.br=pe(v.br.x,v.br.y,P);var A=v.tl,E=A.x,T=A.y,G=A.x,N=A.y,I=Math.min,M=Math.max;y=E=I(E,I(v.tr.x,I(v.bl.x,v.br.x)))-s,_=T=I(T,I(v.tr.y,I(v.bl.y,v.br.y)))-s,b=(G=M(G,M(v.tr.x,M(v.bl.x,v.br.x)))+s)-E,x=(N=M(N,M(v.tr.y,M(v.bl.y,v.br.y)))+s)-T}var L="M"+y+","+_+" L"+(y+b)+","+_+" "+(y+b)+","+(_+x)+" "+y+","+(_+x)+"z";t.setAttribute("d",L);var O=k?"rotate("+[k,w,S].join(",")+")":"";for(var V in this.selectorGroup.setAttribute("transform",O),this.gripCoords={nw:[y,_],ne:[y+b,_],sw:[y,_+x],se:[y+b,_+x],n:[y+b/2,_],w:[y,_+x/2],e:[y+b,_+x/2],s:[y+b/2,_+x]},this.gripCoords){var j=this.gripCoords[V];i[V].setAttribute("cx",j[0]),i[V].setAttribute("cy",j[1])}n.rotateGripConnector.setAttribute("x1",y+b/2),n.rotateGripConnector.setAttribute("y1",_),n.rotateGripConnector.setAttribute("x2",y+b/2),n.rotateGripConnector.setAttribute("y2",_-5*Rn),n.rotateGrip.setAttribute("cx",y+b/2),n.rotateGrip.setAttribute("cy",_-5*Rn)}}]),e}(),Fn=function(){function e(){n(this,e),this.selectorParentGroup=null,this.rubberBandBox=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.rotateGripConnector=null,this.rotateGrip=null,this.initGroup()}return i(e,[{key:"initGroup",value:function(){for(var e in this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup),this.selectorParentGroup=Vn.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=Vn.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.appendChild(this.selectorGripsGroup),Vn.svgRoot().appendChild(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,this.selectorGrips){var t=Vn.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+e,fill:"#22C",r:Rn,style:"cursor:"+e+"-resize","stroke-width":2,"pointer-events":"all"}});On.data(t,"dir",e),On.data(t,"type","resize"),this.selectorGrips[e]=this.selectorGripsGroup.appendChild(t)}if(this.rotateGripConnector=this.selectorGripsGroup.appendChild(Vn.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(Vn.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:Rn,stroke:"#22C","stroke-width":2,style:"cursor:url("+jn.imgPath+"rotate.png) 12 12, auto;"}})),On.data(this.rotateGrip,"type","rotate"),!On("#canvasBackground").length){var n=jn.dimensions,i=Vn.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:n[0],height:n[1],x:0,y:0,overflow:N()?"none":"visible",style:"pointer-events:none"}}),r=Vn.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});i.appendChild(r),Vn.svgRoot().insertBefore(i,Vn.svgContent())}}},{key:"requestSelector",value:function(e,n){if(null==e)return null;var i=this.selectors.length;if("object"===t(this.selectorMap[e.id]))return this.selectorMap[e.id].locked=!0,this.selectorMap[e.id];for(var r=0;r<i;++r)if(this.selectors[r]&&!this.selectors[r].locked)return this.selectors[r].locked=!0,this.selectors[r].reset(e,n),this.selectorMap[e.id]=this.selectors[r],this.selectors[r];return this.selectors[i]=new Dn(i,e,n),this.selectorParentGroup.appendChild(this.selectors[i].selectorGroup),this.selectorMap[e.id]=this.selectors[i],this.selectors[i]}},{key:"releaseSelector",value:function(e){if(null!=e){var t=this.selectors.length,n=this.selectorMap[e.id];n.locked||console.log("WARNING! selector was released but was already unlocked");for(var i=0;i<t;++i)if(this.selectors[i]&&this.selectors[i]===n){delete this.selectorMap[e.id],n.locked=!1,n.selectedElement=null,n.showGrips(!1);try{n.selectorGroup.setAttribute("display","none")}catch(e){}break}}}},{key:"getRubberBandBox",value:function(){return this.rubberBandBox||(this.rubberBandBox=this.selectorParentGroup.appendChild(Vn.createSVGElement({element:"rect",attr:{id:"selectorRubberBand",fill:"#22C","fill-opacity":.15,stroke:"#22C","stroke-width":.5,display:"none",style:"pointer-events:none"}}))),this.rubberBandBox}}]),e}(),Un=D(jQuery),zn=oe,Hn=se,qn=le,Xn=ue,Yn=ce,Wn=he,Qn=ae;window.console||(window.console={},window.console.log=function(e){},window.console.dir=function(e){}),window.opera&&(window.console.log=function(e){opera.postError(e)},window.console.dir=function(e){});var $n=function e(i,r){n(this,e);var a={show_outside_canvas:!0,selectNew:!0,dimensions:[640,480]};r&&Un.extend(a,r);var o=a.dimensions,s=this,c=i.ownerDocument,h=c.importNode(kt('<svg id="svgroot" xmlns="'+l.SVG+'" xlinkns="'+l.XLINK+'" width="'+o[0]+'" height="'+o[1]+'" x="'+o[0]+'" y="'+o[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement,!0);i.appendChild(h);var d=c.createElementNS(l.SVG,"svg");(s.clearSvgContentElement=function(){Un(d).empty(),Un(d).attr({id:"svgcontent",width:o[0],height:o[1],x:o[0],y:o[1],overflow:a.show_outside_canvas?"visible":"hidden",xmlns:l.SVG,"xmlns:se":l.SE,"xmlns:xlink":l.XLINK}).appendTo(h);var e=c.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");d.appendChild(e)})();var f="svg_";s.setIdPrefix=function(e){f=e},s.current_drawing_=new gn(d,f);var p=s.getCurrentDrawing=function(){return s.current_drawing_},g=1,v=null,m={shape:{fill:("none"===a.initFill.color?"":"#")+a.initFill.color,fill_paint:null,fill_opacity:a.initFill.opacity,stroke:"#"+a.initStroke.color,stroke_paint:null,stroke_opacity:a.initStroke.opacity,stroke_width:a.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:a.initOpacity}};m.text=Un.extend(!0,{},m.shape),Un.extend(m.text,{fill:"#000000",stroke_width:a.text&&a.text.stroke_width,font_size:a.text&&a.text.font_size,font_family:a.text&&a.text.font_family});var y=m.shape,_=[],b=this.getJsonFromSvgElement=function(e){if(3===e.nodeType)return e.nodeValue;for(var t,n={element:e.tagName,attr:{},children:[]},i=0;t=e.attributes[i];i++)n.attr[t.name]=t.value;for(var r,a=0;r=e.childNodes[a];a++)n.children[a]=b(r);return n},x=this.addSvgElementFromJson=function(e){if("string"==typeof e)return c.createTextNode(e);var t=qt(e.attr.id),n=p().getCurrentLayer();if(t&&e.element!==t.tagName&&(n.removeChild(t),t=null),!t){var i=e.namespace||l.SVG;t=c.createElementNS(i,e.element),n&&(v||n).appendChild(t)}return e.curStyles&&Xt(t,{fill:y.fill,stroke:y.stroke,"stroke-width":y.stroke_width,"stroke-dasharray":y.stroke_dasharray,"stroke-linejoin":y.stroke_linejoin,"stroke-linecap":y.stroke_linecap,"stroke-opacity":y.stroke_opacity,"fill-opacity":y.fill_opacity,opacity:y.opacity/2,style:"pointer-events:inherit"},100),Xt(t,e.attr,100),Yt(t),e.children&&e.children.forEach(function(e){t.appendChild(x(e))}),t};s.getTransformList=W,s.matrixMultiply=ve,s.hasMatrixTransform=me,s.transformListToTransform=_e,function(e){K=e;var t=document.createElementNS(l.SVG,"svg");document.body.appendChild(t);var n=document.createElementNS(l.SVG,"rect");n.setAttribute("width","1em"),n.setAttribute("height","1ex"),n.setAttribute("x","1in"),t.appendChild(n);var i=n.getBBox();document.body.removeChild(t);var r=i.x;J={em:i.width,ex:i.height,in:r,cm:r/2.54,mm:r/25.4,pt:r/72,pc:r/6,px:1,"%":0}}({getBaseUnit:function(){return a.baseUnit},getElement:qt,getHeight:function(){return d.getAttribute("height")/g},getWidth:function(){return d.getAttribute("width")/g},getRoundDigits:function(){return ue.round_digits}}),s.convertToNum=ie;var w,S=function(){return d},k=this.getSelectedElems=function(){return _},P=ut;ft=w={pathActions:P,getSVGContent:S,addSvgElementFromJson:x,getSelectedElements:k,getDOMDocument:function(){return c},getDOMContainer:function(){return i},getSVGRoot:function(){return h},getBaseUnit:function(){return a.baseUnit},getSnappingStep:function(){return a.snappingStep}},pt=w.getDOMDocument(),gt=w.getDOMContainer(),vt=w.getSVGRoot(),s.findDefs=Tt,s.getUrlFromAttr=Pt,s.getHref=At,s.setHref=Et,s.getBBox=It,s.getRotationAngle=zt,s.getElem=qt,s.getRefElem=Ht,s.assignAttributes=Xt,this.cleanupElement=Yt;var A=function(){return a.gridSnapping};!function(e){Tn=e}({getDrawing:function(){return p()},getSVGRoot:function(){return h},getGridSnapping:A}),this.remapElement=Gn,function(e){In=e}({getSVGRoot:function(){return h},getStartTransform:function(){return Ae},setStartTransform:function(e){Ae=e}}),this.recalculateDimensions=Ln;var E=u();s.sanitizeSvg=Pn;var T=s.undoMgr=new Wn({handleHistoryEvent:function(e,t){var n=Qn;if(e===n.BEFORE_UNAPPLY||e===n.BEFORE_APPLY)s.clearSelection();else if(e===n.AFTER_APPLY||e===n.AFTER_UNAPPLY){var i=t.elements();s.pathActions.clear(),U("changed",i);var r=t.type(),a=e===n.AFTER_APPLY;if(r===zn.type())(a?t.newParent:t.oldParent)===d&&_n();else if(r===Hn.type()||r===qn.type())t.parent===d&&_n(),r===Hn.type()?a&&se(t.elem):a||se(t.elem),"use"===t.elem.tagName&&jt(t.elem);else if(r===Xn.type()){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===d&&_n();var o=a?t.newValues:t.oldValues;o.stdDeviation&&s.setBlurOffsets(t.elem.parentNode,o.stdDeviation)}}}}),G=function(e){s.undoMgr.addCommandToHistory(e)},O=this.getZoom=function(){return g},V=this.round=function(e){return parseInt(e*g,10)/g};!function(e,t){jn=e,Vn=t,Bn=new Fn}(a,{createSVGElement:function(e){return s.addSvgElementFromJson(e)},svgRoot:function(){return h},svgContent:function(){return d},getCurrentZoom:O});var j=this.selectorManager=Bn,D=s.getNextId=function(){return p().getNextId()},F=s.getId=function(){return p().getId()},U=function(e,t){if(Ue[e])return Ue[e](window,t)},z=function(e){_.map(function(e){null!=e&&j.releaseSelector(e)}),_=[],e||U("selected",_)},H=function(e,t){if(e.length){for(var n=0;n<_.length&&null!=_[n];)++n;for(var i=e.length;i--;){var r=e[i];if(r){var a=It(r);if(a&&("a"===r.tagName&&1===r.childNodes.length&&(r=r.firstChild),!_.includes(r))){_[n]=r,n++;var o=j.requestSelector(r,a);_.length>1&&o.showGrips(!1)}}}for(U("selected",_),t||1===_.length?j.requestSelector(_[0]).showGrips(!0):j.requestSelector(_[0]).showGrips(!1),_.sort(function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):null==e?1:void 0});null==_[0];)_.shift(0)}},Y=function(){return y.opacity},Q=this.getMouseTarget=function(e){if(null==e)return null;var t=e.target;if(t.correspondingUseElement&&(t=t.correspondingUseElement),[l.MATH,l.HTML].includes(t.namespaceURI)&&"svgcanvas"!==t.id)for(;"foreignObject"!==t.nodeName;)if(!(t=t.parentNode))return h;var n=p().getCurrentLayer();if([h,i,d,n].includes(t))return h;if(Un(t).closest("#selectorParentGroup").length)return j.selectorParentGroup;for(;t.parentNode!==(v||n);)t=t.parentNode;return t};s.pathActions=P,Ie({selectorManager:j,canvas:s,call:U,resetD:function(e){e.setAttribute("d",P.convertPath(e))},round:V,clearSelection:z,addToSelection:H,addCommandToHistory:G,remapElement:Gn,addSvgElementFromJson:x,getGridSnapping:A,getOpacity:Y,getSelectedElements:k,getContainer:function(){return i},setStarted:function(e){Ce=e},getRubberBox:function(){return Oe},setRubberBox:function(e){return Oe=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;P.canDeleteNodes=!0,P.closed_subpath=t,U("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;G(t),U("changed",[n])},getCurrentZoom:O,getId:F,getNextId:D,getMouseTarget:Q,getCurrentMode:function(){return Ee},setCurrentMode:function(e){return Ee=e},getDrawnPath:function(){return bt},setDrawnPath:function(e){return bt=e},getSVGRoot:function(){return h}});var $={},Z="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",re=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],ae=Un.data,oe=document.createElementNS(l.SVG,"animate");Un(oe).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(h);var se=function e(t){var n=Un(t).attr(re);for(var i in n){var r=n[i];if(r&&r.startsWith("url(")){var a=Pt(r).substr(1);qt(a)||(Tt().appendChild(Se[a]),delete Se[a])}}var o=t.getElementsByTagName("*");if(o.length)for(var s=0,l=o.length;s<l;s++)e(o[s])},le={},ue={round_digits:5},ce={},he=m.text,fe={},Se={},ke=a.imgPath+"logo.png",Ce=!1,Ae=null,Ee="select",Ne="none",Me=y,Le=null,Oe=null,Ve=[],je=null,Be=this.runExtensions=function(e,t,n){var i=!!n&&[];return Un.each(fe,function(r,a){a&&e in a&&(n?i.push(a[e](t)):i=a[e](t))}),i};this.addExtension=function(e,t){var n=void 0;if(e in fe)console.log('Cannot add extension "'+e+'", an extension by that name already exists.');else{var i=Un.extend(s.getPrivateMethods(),{svgroot:h,svgcontent:d,nonce:p().getNonce(),selectorManager:j});"function"==typeof t?n=t(i):(n=t).callback&&(n.callback=n.callback.bind(n,i)),fe[e]=n,U("extension_added",n)}};var Re=this.getIntersectionList=function(e){if(null==Oe)return null;var t=v||p().getCurrentLayer(),n=void 0;if(e)(n=d.createSVGRect()).x=e.x,n.y=e.y,n.width=e.width,n.height=e.height;else{n=Oe.getBBox();var i=d.createSVGRect();for(var r in n)i[r]=n[r]/g;n=i}var a=null;if(M||"function"==typeof h.getIntersectionList&&(n.x+=parseInt(d.getAttribute("x"),10),n.y+=parseInt(d.getAttribute("y"),10),a=h.getIntersectionList(n,t)),null==a||"function"!=typeof a.item){a=[],Ve.length||(Ve=De(t));for(var o=Ve.length;o--;)n.width&&we(n,Ve[o].bbox)&&a.push(Ve[o].elem)}return a};this.getStrokedBBox=Ft,this.getVisibleElements=Dt;var De=this.getVisibleElementsAndBBoxes=function(e){e||(e=Un(d).children());var t=[];return Un(e).children().each(function(e,n){n.getBBox&&t.push({elem:n,bbox:Ft([n])})}),t.reverse()},Fe=this.groupSvgElem=function(e){var t=document.createElementNS(l.SVG,"g");e.parentNode.replaceChild(t,e),Un(t).append(e).data("gsvg",e)[0].id=D()},Ue={};s.call=U,s.bind=function(e,t){var n=Ue[e];return Ue[e]=t,n},this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);for(var t=e.getElementsByTagNameNS(l.SVG,"path"),n=0,i=t.length;n<i;++n){var r=t[n];r.setAttribute("d",P.convertPath(r)),P.fixEnd(r)}};var ze=function(e){if(!I())return e;var t=e.cloneNode(!0);return e.parentNode.insertBefore(t,e),e.parentNode.removeChild(e),j.releaseSelector(e),_[0]=t,j.requestSelector(t).showGrips(!0),t};this.setRotationAngle=function(e,t){e=parseFloat(e);var n=_[0],i=n.getAttribute("transform"),r=It(n),a=r.x+r.width/2,o=r.y+r.height/2,s=W(n);s.numberOfItems>0&&(4===s.getItem(0).type&&s.removeItem(0));if(0!==e){var l=pe(a,o,_e(s).matrix),u=h.createSVGTransform();u.setRotate(e,l.x,l.y),s.numberOfItems?s.insertItemBefore(u,0):s.appendItem(u)}else 0===s.numberOfItems&&n.removeAttribute("transform");if(!t){var c=n.getAttribute("transform");n.setAttribute("transform",i),rn("transform",c,_),U("changed",_)}var d=j.requestSelector(_[0]);d.resize(),d.updateGripCursors(e)};var He=this.recalculateAllSelectedDimensions=function(){for(var e=new Yn("none"===Ne?"position":"size"),t=_.length;t--;){var n=_[t],i=Ln(n);i&&e.addSubCommand(i)}e.isEmpty()||(G(e),U("changed",_))},qe=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Xe=null;this.clearSelection=z,this.addToSelection=H;var We=this.selectOnly=function(e,t){z(!0),H(e,t)};this.removeFromSelection=function(e){if(null!=_[0]&&e.length){var t=0,n=[],i=_.length;n.length=i;for(var r=0;r<i;++r){var a=_[r];a&&(e.includes(a)?j.releaseSelector(a):(n[t]=a,t++))}_=n}},this.selectAllInCurrentLayer=function(){var e=p().getCurrentLayer();e&&(Ee="select",We(Un(v||e).children()))};var Qe,$e,Ze,Ke,Je,et,tt,nt,it,rt,at,ot,st,lt,ht,dt,bt=null;Qe={minx:null,miny:null,maxx:null,maxy:null},$e=null,Ze=null,Ke=null,Je=null,et=null,tt={},nt=0,it={x:0,y:0},rt={x:0,y:0},at={x:0,y:0},ot={x:0,y:0},st={x:0,y:0},lt={x:0,y:0},ht=void 0,dt=function(e){var t={x:0,y:0},n=it,i=rt,r=at,a=ot,o=e*e,s=o*e,l=[[-1,3,-3,1],[3,-6,3,0],[-3,0,3,0],[1,4,1,0]];return t.x=1/6*((n.x*l[0][0]+i.x*l[0][1]+r.x*l[0][2]+a.x*l[0][3])*s+(n.x*l[1][0]+i.x*l[1][1]+r.x*l[1][2]+a.x*l[1][3])*o+(n.x*l[2][0]+i.x*l[2][1]+r.x*l[2][2]+a.x*l[2][3])*e+(n.x*l[3][0]+i.x*l[3][1]+r.x*l[3][2]+a.x*l[3][3])),t.y=1/6*((n.y*l[0][0]+i.y*l[0][1]+r.y*l[0][2]+a.y*l[0][3])*s+(n.y*l[1][0]+i.y*l[1][1]+r.y*l[1][2]+a.y*l[1][3])*o+(n.y*l[2][0]+i.y*l[2][1]+r.y*l[2][2]+a.y*l[2][3])*e+(n.y*l[3][0]+i.y*l[3][1]+r.y*l[3][2]+a.y*l[3][3])),{x:t.x,y:t.y}},Un(i).mousedown(function(e){if(!s.spaceKey&&1!==e.button){var t=2===e.button;e.altKey&&s.cloneSelectedElements(0,0),Xe=Un("#svgcontent g")[0].getScreenCTM().inverse();var n=pe(e.pageX,e.pageY,Xe),i=n.x*g,r=n.y*g;e.preventDefault(),t&&(Ee="select",je=n);var o=i/g,l=r/g,u=Q(e);"a"===u.tagName&&1===u.childNodes.length&&(u=u.firstChild);var c=o;Je=Ze=o;var d=l;if(et=Ke=l,a.gridSnapping&&(o=Wt(o),l=Wt(l),Ze=Wt(Ze),Ke=Wt(Ke)),u===j.selectorParentGroup&&null!=_[0]){var f=e.target,p=ae(f,"type");"rotate"===p?Ee="rotate":"resize"===p&&(Ee="resize",Ne=ae(f,"dir")),u=_[0]}Ae=u.getAttribute("transform");var v=void 0,m=void 0,b=W(u);switch(Ee){case"select":if(Ce=!0,Ne="none",t&&(Ce=!1),u!==h){if(_.includes(u)||(e.shiftKey||z(!0),H([u]),Le=u,P.clear()),!t)for(v=0;v<_.length;++v)if(null!=_[v]){var w=W(_[v]);w.numberOfItems?w.insertItemBefore(h.createSVGTransform(),0):w.appendItem(h.createSVGTransform())}}else t||(z(),Ee="multiselect",null==Oe&&(Oe=j.getRubberBandBox()),Xt(Oe,{x:Je*=g,y:et*=g,width:0,height:0,display:"inline"},100));break;case"zoom":Ce=!0,null==Oe&&(Oe=j.getRubberBandBox()),Xt(Oe,{x:c*g,y:c*g,width:0,height:0,display:"inline"},100);break;case"resize":Ce=!0,Ze=o,Ke=l,tt=It(Un("#selectedBox0")[0]);var S={};Un.each(tt,function(e,t){S[e]=t/g}),tt=S;var k=zt(u)?1:0;if(me(b))b.insertItemBefore(h.createSVGTransform(),k),b.insertItemBefore(h.createSVGTransform(),k),b.insertItemBefore(h.createSVGTransform(),k);else if(b.appendItem(h.createSVGTransform()),b.appendItem(h.createSVGTransform()),b.appendItem(h.createSVGTransform()),B()){var C=N(),A=void 0;C&&(A=function(e){var t=e.getAttributeNS(null,"stroke");e.removeAttributeNS(null,"stroke"),null!==t&&setTimeout(function(){e.setAttributeNS(null,"stroke",t)},0)}),u.style.vectorEffect="non-scaling-stroke",C&&A(u);var E=u.getElementsByTagName("*"),T=E.length;for(v=0;v<T;v++)E[v].style.vectorEffect="non-scaling-stroke",C&&A(E[v])}break;case"fhellipse":case"fhrect":case"fhpath":at.x=c,at.y=d,Ce=!0,$e=c+","+d+" ",m=0===parseFloat(y.stroke_width)?1:y.stroke_width,x({element:"polyline",curStyles:!0,attr:{points:$e,id:D(),fill:"none",opacity:y.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}}),Qe.minx=c,Qe.maxx=c,Qe.miny=d,Qe.maxy=d;break;case"image":Ce=!0;var G=x({element:"image",attr:{x:o,y:l,width:0,height:0,id:D(),opacity:y.opacity/2,style:"pointer-events:inherit"}});Et(G,ke),Kt(G);break;case"square":case"rect":Ce=!0,Ze=o,Ke=l,x({element:"rect",curStyles:!0,attr:{x:o,y:l,width:0,height:0,id:D(),opacity:y.opacity/2}});break;case"line":Ce=!0,m=0===Number(y.stroke_width)?1:y.stroke_width,x({element:"line",curStyles:!0,attr:{x1:o,y1:l,x2:o,y2:l,id:D(),stroke:y.stroke,"stroke-width":m,"stroke-dasharray":y.stroke_dasharray,"stroke-linejoin":y.stroke_linejoin,"stroke-linecap":y.stroke_linecap,"stroke-opacity":y.stroke_opacity,fill:"none",opacity:y.opacity/2,style:"pointer-events:none"}});break;case"circle":Ce=!0,x({element:"circle",curStyles:!0,attr:{cx:o,cy:l,r:0,id:D(),opacity:y.opacity/2}});break;case"ellipse":Ce=!0,x({element:"ellipse",curStyles:!0,attr:{cx:o,cy:l,rx:0,ry:0,id:D(),opacity:y.opacity/2}});break;case"text":Ce=!0,x({element:"text",curStyles:!0,attr:{x:o,y:l,id:D(),fill:he.fill,"stroke-width":he.stroke_width,"font-size":he.font_size,"font-family":he.font_family,"text-anchor":"middle","xml:space":"preserve",opacity:y.opacity}});break;case"path":case"pathedit":Ze*=g,Ke*=g,P.mouseDown(e,u,Ze,Ke),Ce=!0;break;case"textedit":Ze*=g,Ke*=g,xt.mouseDown(e,u,Ze,Ke),Ce=!0;break;case"rotate":Ce=!0,s.undoMgr.beginUndoableChange("transform",_)}var I=Be("mouseDown",{event:e,start_x:Ze,start_y:Ke,selectedElements:_},!0);Un.each(I,function(e,t){t&&t.started&&(Ce=!0)})}}).mousemove(function(e){if(Ce&&1!==e.button&&!s.spaceKey){var t=void 0,n=void 0,i=void 0,r=void 0,o=void 0,l=void 0,u=void 0,c=void 0,d=void 0,f=_[0],p=pe(e.pageX,e.pageY,Xe),v=p.x*g,m=p.y*g,y=qt(F()),b=v/g,x=b,w=m/g,S=w;a.gridSnapping&&(x=Wt(x),S=Wt(S)),e.preventDefault();var k=void 0;switch(Ee){case"select":if(null!==_[0]){if(o=x-Ze,l=S-Ke,a.gridSnapping&&(o=Wt(o),l=Wt(l)),e.shiftKey){var C=n=xe(Ze,Ke,x,S);x=C.x,S=C.y}if(0!==o||0!==l){for(u=_.length,t=0;t<u&&null!=(f=_[t]);++t){var A=h.createSVGTransform();k=W(f),A.setTranslate(o,l),k.numberOfItems?k.replaceItem(A,0):k.appendItem(A),j.requestSelector(f).resize()}U("transition",_)}}break;case"multiselect":b*=g,w*=g,Xt(Oe,{x:Math.min(Je,b),y:Math.min(et,w),width:Math.abs(b-Je),height:Math.abs(w-et)},100);var E=_.slice(),T=[],G=Re();for(u=G.length,t=0;t<u;++t){var N=G[t];_.includes(N)||T.push(N);var I=E.indexOf(N);-1!==I&&E.splice(I,1)}E.length>0&&s.removeFromSelection(E),T.length>0&&s.addToSelection(T);break;case"resize":k=W(f);var M=me(k),L=(d=M?tt:It(f)).x,O=d.y,V=d,B=V.width,R=V.height;if(o=x-Ze,l=S-Ke,a.gridSnapping&&(o=Wt(o),l=Wt(l),R=Wt(R),B=Wt(B)),c=zt(f)){var D=Math.sqrt(o*o+l*l),z=Math.atan2(l,o)-c*Math.PI/180;o=D*Math.cos(z),l=D*Math.sin(z)}Ne.includes("n")||Ne.includes("s")||(l=0),Ne.includes("e")||Ne.includes("w")||(o=0);var H=0,q=0,X=R?(R+l)/R:1,Y=B?(B+o)/B:1;Ne.includes("n")&&(X=R?(R-l)/R:1,q=R),Ne.includes("w")&&(Y=B?(B-o)/B:1,H=B);var Q=h.createSVGTransform(),$=h.createSVGTransform(),Z=h.createSVGTransform();if(a.gridSnapping&&(L=Wt(L),H=Wt(H),O=Wt(O),q=Wt(q)),Q.setTranslate(-(L+H),-(O+q)),e.shiftKey&&(1===Y?Y=X:X=Y),$.setScale(Y,X),Z.setTranslate(L+H,O+q),M){var K=c?1:0;k.replaceItem(Q,2+K),k.replaceItem($,1+K),k.replaceItem(Z,Number(K))}else{var J=k.numberOfItems;k.replaceItem(Z,J-3),k.replaceItem($,J-2),k.replaceItem(Q,J-1)}j.requestSelector(f).resize(),U("transition",_);break;case"zoom":b*=g,w*=g,Xt(Oe,{x:Math.min(Je*g,b),y:Math.min(et*g,w),width:Math.abs(b-Je*g),height:Math.abs(w-et*g)},100);break;case"text":Xt(y,{x:x,y:S},1e3);break;case"line":a.gridSnapping&&(x=Wt(x),S=Wt(S));var ee=x,te=S;e.shiftKey&&(ee=(n=xe(Ze,Ke,ee,te)).x,te=n.y),y.setAttributeNS(null,"x2",ee),y.setAttributeNS(null,"y2",te);break;case"foreignObject":case"square":case"rect":case"image":var ne="square"===Ee||e.shiftKey,ie=Math.abs(x-Ze),re=Math.abs(S-Ke),ae=void 0,oe=void 0;ne?(ie=re=Math.max(ie,re),ae=Ze<x?Ze:Ze-ie,oe=Ke<S?Ke:Ke-re):(ae=Math.min(Ze,x),oe=Math.min(Ke,S)),a.gridSnapping&&(ie=Wt(ie),re=Wt(re),ae=Wt(ae),oe=Wt(oe)),Xt(y,{width:ie,height:re,x:ae,y:oe},1e3);break;case"circle":var se=Un(y).attr(["cx","cy"]);i=se.cx,r=se.cy;var le=Math.sqrt((x-i)*(x-i)+(S-r)*(S-r));a.gridSnapping&&(le=Wt(le)),y.setAttributeNS(null,"r",le);break;case"ellipse":var ue=Un(y).attr(["cx","cy"]);i=ue.cx,r=ue.cy,a.gridSnapping&&(x=Wt(x),i=Wt(i),S=Wt(S),r=Wt(r)),y.setAttributeNS(null,"rx",Math.abs(x-i));var ce=Math.abs(e.shiftKey?x-i:S-r);y.setAttributeNS(null,"ry",ce);break;case"fhellipse":case"fhrect":Qe.minx=Math.min(b,Qe.minx),Qe.maxx=Math.max(b,Qe.maxx),Qe.miny=Math.min(w,Qe.miny),Qe.maxy=Math.max(w,Qe.maxy);case"fhpath":if(ot.x=b,ot.y=w,it.x&&it.y)for(t=0;t<9;t++)ht=t/10,st=dt((t+1)/10),lt=st,st=dt(ht),(nt+=Math.sqrt((lt.x-st.x)*(lt.x-st.x)+(lt.y-st.y)*(lt.y-st.y)))>.8&&($e+=+st.x+","+st.y+" ",y.setAttributeNS(null,"points",$e),nt-=.8);it={x:rt.x,y:rt.y},rt={x:at.x,y:at.y},at={x:ot.x,y:ot.y};break;case"path":case"pathedit":if(x*=g,S*=g,a.gridSnapping&&(x=Wt(x),S=Wt(S),Ze=Wt(Ze),Ke=Wt(Ke)),e.shiftKey){var he=Ge,de=void 0,fe=void 0;he?(de=he.dragging?he.dragging[0]:Ze,fe=he.dragging?he.dragging[1]:Ke):(de=Ze,fe=Ke);var ge=n=xe(de,fe,x,S);x=ge.x,S=ge.y}Oe&&"none"!==Oe.getAttribute("display")&&(b*=g,w*=g,Xt(Oe,{x:Math.min(Je*g,b),y:Math.min(et*g,w),width:Math.abs(b-Je*g),height:Math.abs(w-et*g)},100)),P.mouseMove(x,S);break;case"textedit":x*=g,S*=g,xt.mouseMove(v,m);break;case"rotate":i=(d=It(f)).x+d.width/2,r=d.y+d.height/2;var ve=be(f),ye=pe(i,r,ve);i=ye.x,r=ye.y,c=(Math.atan2(r-S,i-x)*(180/Math.PI)-90)%360,a.gridSnapping&&(c=Wt(c)),e.shiftKey&&(c=45*Math.round(c/45)),s.setRotationAngle(c<-180?360+c:c,!0),U("transition",_)}Be("mouseMove",{event:e,mouse_x:v,mouse_y:m,selected:f})}}).click(function(e){return e.preventDefault(),!1}).dblclick(function(e){var t=e.target.parentNode;if(t!==v){var n=Q(e),i=n.tagName;if("text"===i&&"textedit"!==Ee){var r=pe(e.pageX,e.pageY,Xe);xt.select(n,r.x,r.y)}"g"!==i&&"a"!==i||!zt(n)||(an(n),n=_[0],z(!0)),v&&bn(),"g"!==t.tagName&&"a"!==t.tagName||t===p().getCurrentLayer()||n===j.selectorParentGroup||xn(n)}}).mouseup(function(e){if(2!==e.button){var t=Le;if(Le=null,Ce){var n=pe(e.pageX,e.pageY,Xe),i=n.x*g,r=n.y*g,o=i/g,l=r/g,u=qt(F()),c=!1,h=o,d=l;Ce=!1;var f=void 0,v=void 0;switch(Ee){case"resize":case"multiselect":null!=Oe&&(Oe.setAttribute("display","none"),Ve=[]),Ee="select";case"select":if(null!=_[0]){if(null==_[1]){var m=_[0];switch(m.tagName){case"g":case"use":case"image":case"foreignObject":break;default:Me.fill=m.getAttribute("fill"),Me.fill_opacity=m.getAttribute("fill-opacity"),Me.stroke=m.getAttribute("stroke"),Me.stroke_opacity=m.getAttribute("stroke-opacity"),Me.stroke_width=m.getAttribute("stroke-width"),Me.stroke_dasharray=m.getAttribute("stroke-dasharray"),Me.stroke_linejoin=m.getAttribute("stroke-linejoin"),Me.stroke_linecap=m.getAttribute("stroke-linecap")}"text"===m.tagName&&(he.font_size=m.getAttribute("font-size"),he.font_family=m.getAttribute("font-family")),j.requestSelector(m).showGrips(!0)}if(He(),h!==Je||d!==et)for(var b=_.length,w=0;w<b&&null!=_[w];++w)_[w].firstChild||j.requestSelector(_[w]).resize();else v=e.target,"path"===_[0].nodeName&&null==_[1]?P.select(_[0]):e.shiftKey&&t!==v&&s.removeFromSelection([v]);if(B()){var S=_[0];S&&(S.removeAttribute("style"),Ct(S,function(e){e.removeAttribute("style")}))}}return;case"zoom":null!=Oe&&Oe.setAttribute("display","none");var k=e.shiftKey?.5:2;return void U("zoomed",{x:Math.min(Je,h),y:Math.min(et,d),width:Math.abs(h-Je),height:Math.abs(d-et),factor:k});case"fhpath":nt=0,it={x:0,y:0},rt={x:0,y:0},at={x:0,y:0},ot={x:0,y:0};var C=u.getAttribute("points"),A=C.indexOf(",");(c=A>=0?C.indexOf(",",A+1)>=0:C.indexOf(" ",C.indexOf(" ")+1)>=0)&&(u=P.smoothPolylineIntoPath(u));break;case"line":f=Un(u).attr(["x1","x2","y1","y2"]),c=f.x1!==f.x2||f.y1!==f.y2;break;case"foreignObject":case"square":case"rect":case"image":f=Un(u).attr(["width","height"]),c="0"!==f.width||"0"!==f.height||"image"===Ee;break;case"circle":c="0"!==u.getAttribute("r");break;case"ellipse":f=Un(u).attr(["rx","ry"]),c=null!=f.rx||null!=f.ry;break;case"fhellipse":Qe.maxx-Qe.minx>0&&Qe.maxy-Qe.miny>0&&(u=x({element:"ellipse",curStyles:!0,attr:{cx:(Qe.minx+Qe.maxx)/2,cy:(Qe.miny+Qe.maxy)/2,rx:(Qe.maxx-Qe.minx)/2,ry:(Qe.maxy-Qe.miny)/2,id:F()}}),U("changed",[u]),c=!0);break;case"fhrect":Qe.maxx-Qe.minx>0&&Qe.maxy-Qe.miny>0&&(u=x({element:"rect",curStyles:!0,attr:{x:Qe.minx,y:Qe.miny,width:Qe.maxx-Qe.minx,height:Qe.maxy-Qe.miny,id:F()}}),U("changed",[u]),c=!0);break;case"text":c=!0,We([u]),xt.start(u);break;case"path":u=null,Ce=!0;var E=P.mouseUp(e,u,i,r);u=E.element,c=E.keep;break;case"pathedit":c=!0,u=null,P.mouseUp(e);break;case"textedit":c=!1,u=null,xt.mouseUp(e,i,r);break;case"rotate":c=!0,u=null,Ee="select";var T=s.undoMgr.finishUndoableChange();T.isEmpty()||G(T),He(),U("changed",_)}var N=Be("mouseUp",{event:e,mouse_x:i,mouse_y:r},!0);if(Un.each(N,function(e,t){t&&(c=t.keep||c,u=t.element,Ce=t.started||Ce)}),c||null==u){if(null!=u){s.addedNew=!0;var I=.2,M=void 0;if(oe.beginElement&&parseFloat(u.getAttribute("opacity"))!==y.opacity){M=Un(oe).clone().attr({to:y.opacity,dur:I}).appendTo(u);try{M[0].beginElement()}catch(e){}}else I=0;setTimeout(function(){M&&M.remove(),u.setAttribute("opacity",y.opacity),u.setAttribute("style","pointer-events:inherit"),Yt(u),"path"===Ee?P.toEditMode(u):a.selectNew&&We([u],!0),G(new Hn(u)),U("changed",[u])},1e3*I)}}else{for(p().releaseId(F()),u.parentNode.removeChild(u),u=null,v=e.target;v&&v.parentNode&&v.parentNode.parentNode&&"g"===v.parentNode.parentNode.tagName;)v=v.parentNode;"path"===Ee&&bt||!v||!v.parentNode||"selectorParentGroup"===v.parentNode.id||"svgcanvas"===v.id||"svgroot"===v.id||(s.setMode("select"),We([v],!0))}Ae=null}}}),Un(i).bind("mousewheel DOMMouseScroll",function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;Xe=Un("#svgcontent g")[0].getScreenCTM().inverse();var n=Un("#workarea"),i=a.showRulers?16:0,r=pe(t.pageX,t.pageY,Xe),o=n.width(),l=n.height(),u=o-15-i,c=l-15-i,h=u*Xe.a,d=c*Xe.d,f=n.offset(),p=f.left+i,v=f.top+i,m=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(m){var y=Math.max(.75,Math.min(4/3,m)),_=void 0,b=void 0;y>1?(_=Math.ceil(u/h*y*100)/100,b=Math.ceil(c/d*y*100)/100):(_=Math.floor(u/h*y*100)/100,b=Math.floor(c/d*y*100)/100);var x=Math.min(_,b);if((x=Math.min(10,Math.max(.01,x)))!==g){y=x/g;var w=pe(p,v,Xe),S={x:(r.x-(r.x-w.x)/y)*x-i+o/2,y:(r.y-(r.y-w.y)/y)*x-i+l/2};s.setZoom(x),Un("#zoom").val((100*x).toFixed(1)),U("updateCanvas",{center:!1,newCtr:S}),U("zoomDone")}}}});var xt=s.textActions=function(){var e=void 0,t=void 0,n=void 0,i=void 0,r=void 0,a=[],o=void 0,u=void 0,c=void 0,d=void 0,f=void 0;function p(e){var s=""===t.value;if(Un(t).focus(),!arguments.length)if(s)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var u=a[e];s||t.setSelectionRange(e,e),(n=qt("text_cursor"))||(n=document.createElementNS(l.SVG,"line"),Xt(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=qt("selectorParentGroup").appendChild(n)),r||(r=setInterval(function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")},600));var c=w(u.x,o.y),h=w(u.x,o.y+o.height);Xt(n,{x1:c.x,y1:c.y,x2:h.x,y2:h.y,visibility:"visible",display:"inline"}),i&&i.setAttribute("d","")}function v(e,r,s){if(e!==r){s||t.setSelectionRange(e,r),(i=qt("text_selectblock"))||(i=document.createElementNS(l.SVG,"path"),Xt(i,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),qt("selectorParentGroup").appendChild(i));var u=a[e],c=a[r];n.setAttribute("visibility","hidden");var h=w(u.x,o.y),d=w(u.x+(c.x-u.x),o.y),f=w(u.x,o.y+o.height),g=w(u.x+(c.x-u.x),o.y+o.height),v="M"+h.x+","+h.y+" L"+d.x+","+d.y+" "+g.x+","+g.y+" "+f.x+","+f.y+"z";Xt(i,{d:v,display:"inline"})}else p(r)}function m(t,n){var i=h.createSVGPoint();if(i.x=t,i.y=n,1===a.length)return 0;var r=e.getCharNumAtPosition(i);r<0?(r=a.length-2,t<=a[0].x&&(r=0)):r>=a.length-2&&(r=a.length-2);var o=a[r];return t>o.x+o.width/2&&r++,r}function y(e,t){p(m(e,t))}function b(e,n,i){var r=t.selectionStart,a=m(e,n);v(Math.min(r,a),Math.max(r,a),!i)}function x(e,t){var n={x:e,y:t};if(n.x/=g,n.y/=g,u){var i=pe(n.x,n.y,u.inverse());n.x=i.x,n.y=i.y}return n}function w(e,t){var n={x:e,y:t};if(u){var i=pe(n.x,n.y,u);n.x=i.x,n.y=i.y}return n.x*=g,n.y*=g,n}function S(t){v(0,e.textContent.length),Un(this).unbind(t)}function k(t){if(f&&e){var n=pe(t.pageX,t.pageY,Xe),i=x(n.x*g,n.y*g),r=m(i.x,i.y),a=e.textContent,o=a.substr(0,r).replace(/[a-z0-9]+$/i,"").length,s=a.substr(r).match(/^[a-z0-9]+/i);v(o,(s?s[0].length:0)+r),Un(t.target).click(S),setTimeout(function(){Un(t.target).unbind("click",S)},300)}}return{select:function(t,n,i){e=t,xt.toEditMode(n,i)},start:function(t){e=t,xt.toEditMode()},mouseDown:function(e,n,i,r){var a=x(i,r);t.focus(),y(a.x,a.y),c=i,d=r},mouseMove:function(e,t){var n=x(e,t);b(n.x,n.y)},mouseUp:function(t,n,i){var r=x(n,i);b(r.x,r.y,!0),t.target!==e&&n<c+2&&n>c-2&&i<d+2&&i>d-2&&xt.toSelectMode(!0)},setCursor:p,toEditMode:function(t,n){if(f=!1,Ee="textedit",j.requestSelector(e).showGrips(!1),j.requestSelector(e),xt.init(),Un(e).css("cursor","text"),arguments.length){var i=x(t,n);y(i.x,i.y)}else p();setTimeout(function(){f=!0},300)},toSelectMode:function(a){Ee="select",clearInterval(r),r=null,i&&Un(i).attr("display","none"),n&&Un(n).attr("visibility","hidden"),Un(e).css("cursor","move"),a&&(z(),Un(e).css("cursor","move"),U("selected",[e]),H([e],!0)),e&&!e.textContent.length&&s.deleteSelectedElements(),Un(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===Ee&&xt.toSelectMode()},init:function(n){if(e){var i=void 0,r=void 0;e.parentNode||(e=_[0],j.requestSelector(e).showGrips(!1));var l=e.textContent.length,c=e.getAttribute("transform");for(o=It(e),u=c?be(e):null,(a=[]).length=l,t.focus(),Un(e).unbind("dblclick",k).dblclick(k),l||(r={x:o.x+o.width/2,width:0}),i=0;i<l;i++){var h=e.getStartPositionOfChar(i);if(r=e.getEndPositionOfChar(i),!C){var d=s.contentW*g;h.x-=d,r.x-=d,h.x/=g,r.x/=g}a[i]={x:h.x,y:o.y,width:r.x-h.x,height:o.height}}a.push({x:r.x,width:0}),v(t.selectionStart,t.selectionEnd,!0)}}}}(),St=this.removeUnusedDefElems=function(){var e=d.getElementsByTagNameNS(l.SVG,"defs");if(!e||!e.length)return 0;var t=[],n=0,i=["fill","stroke","filter","marker-start","marker-mid","marker-end"],r=i.length,a=d.getElementsByTagNameNS(l.SVG,"*"),o=a.length,s=void 0,u=void 0;for(s=0;s<o;s++){var c=a[s];for(u=0;u<r;u++){var h=Pt(c.getAttribute(i[u]));h&&t.push(h.substr(1))}var f=At(c);f&&f.startsWith("#")&&t.push(f.substr(1))}var p=Un(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");for(s=p.length;s--;){var g=p[s],v=g.id;t.includes(v)||(Se[v]=g,g.parentNode.removeChild(g),n++)}return n};function Nt(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).codesOnly,t=void 0!==e&&e;z();var n=[],i={feGaussianBlur:$.exportNoBlur,foreignObject:$.exportNoforeignObject,"[stroke-dasharray]":$.exportNoDashArray},r=Un(d);return"font"in Un("<canvas>")[0].getContext("2d")||(i.text=$.exportNoText),Un.each(i,function(e,i){r.find(e).length&&n.push(t?e:i)}),n}this.svgCanvasToString=function(){for(;St()>0;);P.clear(!0),Un.each(d.childNodes,function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&d.insertBefore(t,d.firstChild)}),v&&(bn(),We([v]));var e=[];Un(d).find("g:data(gsvg)").each(function(){for(var t=this.attributes,n=t.length,i=0;i<n;i++)"id"!==t[i].nodeName&&"style"!==t[i].nodeName||n--;if(n<=0){var r=this.firstChild;e.push(r),Un(this).replaceWith(r)}});var t=this.svgToString(d,0);return e.length&&Un(e).each(function(){Fe(this)}),t},this.svgToString=function(e,t){var n=[],i=a.baseUnit,r=new RegExp("^-?[\\d\\.]+"+i+"$");if(e){Yt(e);var o=e.attributes,s=void 0,u=void 0,c=e.childNodes;for(u=0;u<t;u++)n.push(" ");if(n.push("<"),n.push(e.nodeName),"svgcontent"===e.id){var h=Ut();"px"!==i&&(h.w=ne(h.w,i)+i,h.h=ne(h.h,i)+i),n.push(' width="'+h.w+'" height="'+h.h+'" xmlns="'+l.SVG+'"');var d={};Un(e).find("*").andSelf().each(function(){var e=this.namespaceURI;e&&!d[e]&&E[e]&&"xmlns"!==E[e]&&"xml"!==E[e]&&(d[e]=!0,n.push(" xmlns:"+E[e]+'="'+e+'"')),Un.each(this.attributes,function(e,t){var i=t.namespaceURI;i&&!d[i]&&"xmlns"!==E[i]&&"xml"!==E[i]&&(d[i]=!0,n.push(" xmlns:"+E[i]+'="'+i+'"'))})}),u=o.length;for(var f=["width","height","xmlns","x","y","viewBox","id","overflow"];u--;){s=o.item(u);var p=mt(s.value);s.nodeName.startsWith("xmlns:")||(""===p||f.includes(s.localName)||s.namespaceURI&&!E[s.namespaceURI]||(n.push(" "),n.push(s.nodeName),n.push('="'),n.push(p),n.push('"')))}}else{if("defs"===e.nodeName&&!e.firstChild)return;var g=["-moz-math-font-style","_moz-math-font-style"];for(u=o.length-1;u>=0;u--){s=o.item(u);var v=mt(s.value);if(!g.includes(s.localName)&&""!==v){if(v.startsWith("pointer-events"))continue;if("class"===s.localName&&v.startsWith("se_"))continue;if(n.push(" "),"d"===s.localName&&(v=P.convertPath(e,!0)),isNaN(v)?r.test(v)&&(v=te(v)+i):v=te(v),ue.apply&&"image"===e.nodeName&&"href"===s.localName&&ue.images&&"embed"===ue.images){var m=le[v];m&&(v=m)}s.namespaceURI&&s.namespaceURI!==l.SVG&&!E[s.namespaceURI]||(n.push(s.nodeName),n.push('="'),n.push(v),n.push('"'))}}}if(e.hasChildNodes()){n.push(">"),t++;var y=!1;for(u=0;u<c.length;u++){var _=c.item(u);switch(_.nodeType){case 1:n.push("\n"),n.push(this.svgToString(c.item(u),t));break;case 3:var b=_.nodeValue.replace(/^\s+|\s+$/g,"");""!==b&&(y=!0,n.push(String(mt(b))));break;case 4:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("<![CDATA["),n.push(_.nodeValue),n.push("]]>");break;case 8:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("\x3c!--"),n.push(_.data),n.push("--\x3e")}}if(t--,!y)for(n.push("\n"),u=0;u<t;u++)n.push(" ");n.push("</"),n.push(e.nodeName),n.push(">")}else n.push("/>")}return n.join("")},this.embedImage=function(e,t){Un(new Image).load(function(){var n=document.createElement("canvas");n.width=this.width,n.height=this.height,n.getContext("2d").drawImage(this,0,0);try{var i=";svgedit_url="+encodeURIComponent(e);i=n.toDataURL().replace(";base64",i+";base64"),le[e]=i}catch(t){le[e]=!1}ke=e,t&&t(le[e])}).attr("src",e)},this.setGoodImage=function(e){ke=e},this.open=function(){},this.save=function(e){z(),e&&Un.extend(ue,e),ue.apply=!0;var t=this.svgCanvasToString();U("saved",t)},this.rasterExport=function(e,t,n){var i="image/"+e.toLowerCase(),r=Nt(),a=Nt({codesOnly:!0}),o=this.svgCanvasToString();Zt(function(){var l=e||"PNG";Un("#export_canvas").length||Un("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var u=Un("#export_canvas")[0];u.width=s.contentW,u.height=s.contentH,nn(u,o,{renderCallback:function(){var s=("ICO"===l?"BMP":l).toLowerCase(),c=t?u.toDataURL("image/"+s,t):u.toDataURL("image/"+s);if(u.toBlob)u.toBlob(function(s){var l=wt(s);U("exported",{datauri:c,bloburl:l,svg:o,issues:r,issueCodes:a,type:e,mimeType:i,quality:t,exportWindowName:n})},i,t);else{var h=function(e){if("undefined"==typeof Uint8Array||"undefined"==typeof Blob||"undefined"==typeof URL||!URL.createObjectURL)return"";for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),r=i.length,a=new Uint8Array(r);r--;)a[r]=i.charCodeAt(r);var o=new Blob([a],{type:n});return URL.createObjectURL(o)}(c);U("exported",{datauri:c,bloburl:h,svg:o,issues:r,issueCodes:a,type:e,mimeType:i,quality:t,exportWindowName:n})}}})})()},this.exportPDF=function(e,t){var n,i=this;(n=function(){var n=Ut(),r=n.w>n.h?"landscape":"portrait",a=jsPDF({orientation:r,unit:"pt",format:[n.w,n.h]}),o=Qt();a.setProperties({title:o});var s=Nt(),l=Nt({codesOnly:!0}),u=i.svgCanvasToString();a.addSVG(u,0,0);var c={svg:u,issues:s,issueCodes:l,exportWindowName:e},h=t||"dataurlstring";c[h]=a.output(h),U("exportedPDF",c)},$t("RGBColor",["canvg/rgbcolor.js"],function(){var e=[];R&&void 0!==R.ok||e.push("canvg/rgbcolor.js"),$t("jsPDF",[].concat(e,["jspdf/underscore-min.js","jspdf/jspdf.min.js","jspdf/jspdf.plugin.svgToPdf.js"]),n,{globals:!0})()}))()},this.getSvgString=function(){return ue.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?vn(!1,p()):vn(!0,p())};var Mt=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var i in Ct(e,function(e){if(1===e.nodeType){e.id&&(e.id in t||(t[e.id]={elem:null,attrs:[],hrefs:[]}),t[e.id].elem=e),Un.each(re,function(n,i){var r=e.getAttributeNode(i);if(r){var a=Pt(r.value),o=a?a.substr(1):null;o&&(o in t||(t[o]={elem:null,attrs:[],hrefs:[]}),t[o].attrs.push(r))}});var i=At(e);if(i&&n.includes(e.nodeName)){var r=i.substr(1);r&&(r in t||(t[r]={elem:null,attrs:[],hrefs:[]}),t[r].hrefs.push(e))}}}),t)if(i){var r=t[i].elem;if(r){var a=D();r.id=a;for(var o=t[i].attrs,s=o.length;s--;){var l=o[s];l.ownerElement.setAttribute(l.name,"url(#"+a+")")}for(var u=t[i].hrefs,c=u.length;c--;){var h=u[c];Et(h,"#"+a)}}}},jt=this.setUseData=function(e){var t=Un(e);"use"!==e.tagName&&(t=t.find("use")),t.each(function(){var e=At(this).substr(1),t=qt(e);t&&(Un(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||Un(this).data("symbol",t).data("ref",t))})},Bt=this.convertGradients=function(e){var t=Un(e).find("linearGradient, radialGradient");!t.length&&N()&&(t=Un(e).find("*").filter(function(){return this.tagName.includes("Gradient")})),t.each(function(){if("userSpaceOnUse"===Un(this).attr("gradientUnits")){var e=Un(d).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=It(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=Un(this).attr(["x1","y1","x2","y2"]),i=this.gradientTransform.baseVal;if(i&&i.numberOfItems>0){var r=_e(i).matrix,a=pe(n.x1,n.y1,r),o=pe(n.x2,n.y2,r);n.x1=a.x,n.y1=a.y,n.x2=o.x,n.y2=o.y,this.removeAttribute("gradientTransform")}Un(this).attr({x1:(n.x1-t.x)/t.width,y1:(n.y1-t.y)/t.height,x2:(n.x2-t.x)/t.width,y2:(n.y2-t.y)/t.height}),this.removeAttribute("gradientUnits")}}})},Rt=this.convertToGroup=function(e){e||(e=_[0]);var t=Un(e),n=new Yn,i=void 0;if(t.data("gsvg")){var r=e.firstChild,a=Un(r).attr(["x","y"]);Un(e.firstChild.firstChild).unwrap(),Un(e).removeData("gsvg");var o=W(e),s=h.createSVGTransform();s.setTranslate(a.x,a.y),o.appendItem(s),Ln(e),U("selected",[e])}else if(t.data("symbol")){e=t.data("symbol"),i=t.attr("transform");var u=t.attr(["x","y"]),f=e.getAttribute("viewBox");if(f){var p=f.split(" ");u.x-=+p[0],u.y-=+p[1]}i+=" translate("+(u.x||0)+","+(u.y||0)+")";var g=t.prev();n.addSubCommand(new qn(t[0],t[0].nextSibling,t[0].parentNode)),t.remove();var v=Un(d).find("use:data(symbol)").length,m=c.createElementNS(l.SVG,"g"),y=e.childNodes,b=void 0;for(b=0;b<y.length;b++)m.appendChild(y[b].cloneNode(!0));if(I()){var x=Un(Tt()).children("linearGradient,radialGradient,pattern").clone();Un(m).append(x)}i&&m.setAttribute("transform",i);var w=e.parentNode;if(Mt(m),I()&&Un(Tt()).append(Un(m).find("linearGradient,radialGradient,pattern")),m.id=D(),g.after(m),w){if(!v){var S=e.nextSibling;w.removeChild(e),n.addSubCommand(new qn(e,S,w))}n.addSubCommand(new Hn(m))}jt(m),I()?Bt(Tt()):Bt(m),function(e,t){if(e&&1===e.nodeType){for(var n=e.childNodes.length;n--;)Ct(e.childNodes.item(n),t);t(e)}}(m,function(e){try{Ln(e)}catch(e){console.log(e)}}),Un(m).find(Z).each(function(){this.id||(this.id=D())}),We([m]);var k=an(m,!0);k&&n.addSubCommand(k),G(n)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e,t){try{var n=kt(e);if(n.firstElementChild&&n.firstElementChild.namespaceURI!==l.SVG)return!1;this.prepareSvg(n);var i=new Yn("Change Source"),r=d.nextSibling,o=h.removeChild(d);i.addSubCommand(new qn(o,r,h)),d=c.adoptNode?c.adoptNode(n.documentElement):c.importNode(n.documentElement,!0),h.appendChild(d);var u=Un(d);s.current_drawing_=new gn(d,f);var v=p().getNonce();v?U("setnonce",v):U("unsetnonce"),u.find("image").each(function(){var e=this;Kt(e);var t=At(this);if(t){if(t.startsWith("data:")){var n=t.match(/svgedit_url=(.*?);/);if(n){var i=decodeURIComponent(n[1]);Un(new Image).load(function(){e.setAttributeNS(l.XLINK,"xlink:href",i)}).attr("src",i)}}s.embedImage(t)}}),u.find("svg").each(function(){if(!Un(this).closest("defs").length){Mt(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?(Un(e).data("gsvg",this),e.id=e.id||D()):Fe(this)}}),I()&&u.find("linearGradient, radialGradient, pattern").appendTo(Tt()),jt(u),Bt(u[0]);var m={id:"svgcontent",overflow:a.show_outside_canvas?"visible":"hidden"},y=!1;if(u.attr("viewBox")){var _=u.attr("viewBox").split(" ");m.width=_[2],m.height=_[3]}else Un.each(["width","height"],function(e,t){var n=u.attr(t)||"100%";"%"===String(n).substr(-1)?y=!0:m[t]=ie(t,n)});if(_n(),u.children().find(Z).each(function(){this.id||(this.id=D())}),y){var b=Ft();m.width=b.width+b.x,m.height=b.height+b.y}m.width<=0&&(m.width=100),m.height<=0&&(m.height=100),u.attr(m),this.contentW=m.width,this.contentH=m.height,i.addSubCommand(new Hn(d));var x=u.attr(["width","height"]);i.addSubCommand(new Xn(h,x)),g=1,q={},z(),Te={},h.appendChild(j.selectorParentGroup),t||G(i),U("changed",[d])}catch(e){return console.log(e),!1}return!0},this.importSvgString=function(e){var t=void 0,n=void 0,i=void 0;try{var r=yt(e.length+e).substr(0,32),a=!1;ce[r]&&Un(ce[r].symbol).parents("#svgroot").length&&(a=!0);var o=new Yn("Import Image"),s=void 0;if(a)s=ce[r].symbol,n=ce[r].xform;else{var u=kt(e);this.prepareSvg(u);var h=void 0;h=c.adoptNode?c.adoptNode(u.documentElement):c.importNode(u.documentElement,!0),Mt(h);var f=ie("width",h.getAttribute("width")),g=ie("height",h.getAttribute("height")),m=h.getAttribute("viewBox"),y=m?m.split(" "):[0,0,f,g];for(t=0;t<4;++t)y[t]=+y[t];var _=+d.getAttribute("height");n="translate(0) "+(n=g>f?"scale("+_/3/y[3]+")":"scale("+_/3/y[2]+")")+" translate(0)",s=c.createElementNS(l.SVG,"symbol");var b=Tt();for(I()&&Un(h).find("linearGradient, radialGradient, pattern").appendTo(b);h.firstChild;){var x=h.firstChild;s.appendChild(x)}for(var w=h.attributes,S=0;S<w.length;S++){var k=w[S];s.setAttribute(k.nodeName,k.value)}s.id=D(),ce[r]={symbol:s,xform:n},Tt().appendChild(s),o.addSubCommand(new Hn(s))}(i=c.createElementNS(l.SVG,"use")).id=D(),Et(i,"#"+s.id),(v||p().getCurrentLayer()).appendChild(i),o.addSubCommand(new Hn(i)),z(),i.setAttribute("transform",n),Ln(i),Un(i).data("symbol",s).data("ref",s),H([i]),G(o),U("changed",[d])}catch(e){return console.log(e),null}return i},["identifyLayers","createLayer","cloneLayer","deleteCurrentLayer","setCurrentLayer","renameCurrentLayer","setCurrentLayerPosition","setLayerVisibility","moveSelectedToLayer","mergeLayer","mergeAllLayers","leaveContext","setContext"].forEach(function(e){s[e]=wn[e]}),yn({pathActions:P,getCurrentGroup:function(){return v},setCurrentGroup:function(e){v=e},getSelectedElements:k,getSVGContent:S,undoMgr:T,elData:ae,getCurrentDrawing:p,clearSelection:z,call:U,addCommandToHistory:G,changeSvgcontent:function(){U("changed",[d])}}),this.clear=function(){P.clear(),z(),s.clearSvgContentElement(),s.current_drawing_=new gn(d),s.createLayer("Layer 1"),s.undoMgr.resetUndoStack(),j.initGroup(),Oe=j.getRubberBandBox(),U("cleared")},this.linkControlPoints=P.linkControlPoints,this.getContentElem=function(){return d},this.getRootElem=function(){return h};var Ut=this.getResolution=function(){return{w:d.getAttribute("width")/g,h:d.getAttribute("height")/g,zoom:g}};this.getSnapToGrid=function(){return a.gridSnapping},this.getVersion=function(){return"svgcanvas.js ($Rev$)"},this.setUiStrings=function(e){Object.assign($,e.notification),Pe(e)},this.setConfig=function(e){Object.assign(a,e)},this.getTitle=function(e){if(e=e||_[0]){for(var t=(e=Un(e).data("gsvg")||Un(e).data("symbol")||e).childNodes,n=0;n<t.length;n++)if("title"===t[n].nodeName)return t[n].textContent;return""}},this.setGroupTitle=function(e){var t=_[0];t=Un(t).data("gsvg")||t;var n=Un(t).children("title"),i=new Yn("Set Label"),r=void 0;if(e.length)n.length?(r=n[0],i.addSubCommand(new Xn(r,{"#text":r.textContent})),r.textContent=e):((r=c.createElementNS(l.SVG,"title")).textContent=e,Un(t).prepend(r),i.addSubCommand(new Hn(r)));else{var a=n.nextSibling;i.addSubCommand(new qn(n[0],a,t)),n.remove()}G(i)};var Qt=this.getDocumentTitle=function(){return s.getTitle(d)};this.setDocumentTitle=function(e){for(var t=d.childNodes,n=!1,i="",r=new Yn("Change Image Title"),a=0;a<t.length;a++)if("title"===t[a].nodeName){i=(n=t[a]).textContent;break}n||(n=c.createElementNS(l.SVG,"title"),d.insertBefore(n,d.firstChild)),e.length?n.textContent=e:n.parentNode.removeChild(n),r.addSubCommand(new Xn(n,{"#text":i})),G(r)},this.getEditorNS=function(e){return e&&d.setAttribute("xmlns:se",l.SE),l.SE},this.setResolution=function(e,t){var n=Ut(),i=n.w,r=n.h,a=void 0;if("fit"===e){var o=Ft();if(!o)return!1;a=new Yn("Fit Canvas to Content");var l=Dt();H(l);var u=[],c=[];Un.each(l,function(e,t){u.push(-1*o.x),c.push(-1*o.y)});var h=s.moveSelectedElements(u,c,!0);a.addSubCommand(h),z(),e=Math.round(o.width),t=Math.round(o.height)}return e===i&&t===r||(a||(a=new Yn("Change Image Dimensions")),e=ie("width",e),t=ie("height",t),d.setAttribute("width",e),d.setAttribute("height",t),this.contentW=e,this.contentH=t,a.addSubCommand(new Xn(d,{width:i,height:r})),d.setAttribute("viewBox",[0,0,e/g,t/g].join(" ")),a.addSubCommand(new Xn(d,{viewBox:["0 0",i,r].join(" ")})),G(a),U("changed",[d])),!0},this.getOffset=function(){return Un(d).attr(["x","y"])},this.setBBoxZoom=function(e,n,i){var r=.85,a=void 0,o=function(e){if(!e)return!1;var t=Math.round(n/e.width*100*r)/100,a=Math.round(i/e.height*100*r)/100,o=Math.min(t,a);return s.setZoom(o),{zoom:o,bbox:e}};if("object"===(void 0===e?"undefined":t(e))){if(0===(a=e).width||0===a.height){var l=a.zoom?a.zoom:g*a.factor;return s.setZoom(l),{zoom:g,bbox:a}}return o(a)}switch(e){case"selection":if(!_[0])return;var u=Un.map(_,function(e){if(e)return e});a=Ft(u);break;case"canvas":var c=Ut();r=.95,a={width:c.w,height:c.h,x:0,y:0};break;case"content":a=Ft();break;case"layer":a=Ft(Dt(p().getCurrentLayer()));break;default:return}return o(a)},this.setZoom=function(e){var t=Ut();d.setAttribute("viewBox","0 0 "+t.w/e+" "+t.h/e),g=e,Un.each(_,function(e,t){t&&j.requestSelector(t).resize()}),P.zoomChange(),Be("zoomChanged",e)},this.getMode=function(){return Ee},this.setMode=function(e){P.clear(!0),xt.clear(),Me=_[0]&&"text"===_[0].nodeName?he:y,Ee=e},this.getColor=function(e){return Me[e]},this.setColor=function(e,t,n){y[e]=t,Me[e+"_paint"]={type:"solidColor"};var i=[];function r(e){"g"!==e.nodeName&&i.push(e)}for(var a=_.length;a--;){var o=_[a];o&&("g"===o.tagName?Ct(o,r):"fill"===e?"polyline"!==o.tagName&&"line"!==o.tagName&&i.push(o):i.push(o))}i.length>0&&(n?tn(e,t,i):(rn(e,t,i),U("changed",i)))};var Jt=this.setGradient=function(e){if(Me[e+"_paint"]&&"solidColor"!==Me[e+"_paint"].type){var t=s[e+"Grad"],n=en(t),i=Tt();n?t=n:(t=i.appendChild(c.importNode(t,!0))).id=D(),s.setColor(e,"url(#"+t.id+")")}},en=function(e){for(var t=Tt(),n=Un(t).find("linearGradient, radialGradient"),i=n.length,r=["r","cx","cy","fx","fy"];i--;){var a=n[i];if("linearGradient"===e.tagName){if(e.getAttribute("x1")!==a.getAttribute("x1")||e.getAttribute("y1")!==a.getAttribute("y1")||e.getAttribute("x2")!==a.getAttribute("x2")||e.getAttribute("y2")!==a.getAttribute("y2"))continue}else if("continue"===function(){var t=Un(e).attr(r),n=Un(a).attr(r),i=!1;if(Un.each(r,function(e,r){t[r]!==n[r]&&(i=!0)}),i)return"continue"}())continue;var o=e.getElementsByTagNameNS(l.SVG,"stop"),s=a.getElementsByTagNameNS(l.SVG,"stop");if(o.length===s.length){for(var u=o.length;u--;){var c=o[u],h=s[u];if(c.getAttribute("offset")!==h.getAttribute("offset")||c.getAttribute("stop-opacity")!==h.getAttribute("stop-opacity")||c.getAttribute("stop-color")!==h.getAttribute("stop-color"))break}if(-1===u)return a}}return null};this.setPaint=function(e,t){var n=new Un.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),Me[e+"_paint"]=n,n.type){case"solidColor":this.setColor(e,"none"!==n.solidColor?"#"+n.solidColor:"none");break;case"linearGradient":case"radialGradient":s[e+"Grad"]=n[n.type],Jt(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return Me.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(Ee))s.setStrokeWidth(1);else{Me.stroke_width=e;for(var t=[],n=_.length;n--;){var i=_[n];i&&("g"===i.tagName?Ct(i,r):t.push(i))}t.length>0&&(rn("stroke-width",e,t),U("changed",_))}function r(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){y[e.replace("-","_")]=t;for(var n=[],i=_.length;i--;){var r=_[i];r&&("g"===r.tagName?Ct(r,function(e){"g"!==e.nodeName&&n.push(e)}):n.push(r))}n.length>0&&(rn(e,t,n),U("changed",_))},this.getStyle=function(){return y},this.getOpacity=Y,this.setOpacity=function(e){y.opacity=e,rn("opacity",e)},this.getFillOpacity=function(){return y.fill_opacity},this.getStrokeOpacity=function(){return y.stroke_opacity},this.setPaintOpacity=function(e,t,n){y[e+"_opacity"]=t,n?tn(e+"-opacity",t):rn(e+"-opacity",t)},this.getPaintOpacity=function(e){return"fill"===e?this.getFillOpacity():this.getStrokeOpacity()},this.getBlur=function(e){var t=0;if(e&&e.getAttribute("filter")){var n=qt(e.id+"_blur");n&&(t=n.firstChild.getAttribute("stdDeviation"))}return t},function(){var e=null,t=null,n=!1;function i(){var n=s.undoMgr.finishUndoableChange();e.addSubCommand(n),G(e),e=null,t=null}s.setBlurNoUndo=function(e){if(t)if(0===e)tn("filter",""),n=!0;else{var i=_[0];n&&tn("filter","url(#"+i.id+"_blur)"),N()&&(console.log("e",i),i.removeAttribute("filter"),i.setAttribute("filter","url(#"+i.id+"_blur)")),tn("stdDeviation",e,[t.firstChild]),s.setBlurOffsets(t,e)}else s.setBlur(e)},s.setBlurOffsets=function(e,t){t>3?Xt(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100):N()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},s.setBlur=function(n,r){if(e)i();else{var a=_[0],o=a.id;t=qt(o+"_blur"),n-=0;var l=new Yn;if(t)0===n&&(t=null);else{var u=x({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=x({element:"filter",attr:{id:o+"_blur"}})).appendChild(u),Tt().appendChild(t),l.addSubCommand(new Hn(t))}var c={filter:a.getAttribute("filter")};if(0===n)return a.removeAttribute("filter"),void l.addSubCommand(new Xn(a,c));rn("filter","url(#"+o+"_blur)"),l.addSubCommand(new Xn(a,c)),s.setBlurOffsets(t,n),e=l,s.undoMgr.beginUndoableChange("stdDeviation",[t?t.firstChild:null]),r&&(s.setBlurNoUndo(n),i())}}}(),this.getBold=function(){var e=_[0];return null!=e&&"text"===e.tagName&&null==_[1]&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=_[0];null!=t&&"text"===t.tagName&&null==_[1]&&rn("font-weight",e?"bold":"normal"),_[0].textContent||xt.setCursor()},this.getItalic=function(){var e=_[0];return null!=e&&"text"===e.tagName&&null==_[1]&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=_[0];null!=t&&"text"===t.tagName&&null==_[1]&&rn("font-style",e?"italic":"normal"),_[0].textContent||xt.setCursor()},this.getFontFamily=function(){return he.font_family},this.setFontFamily=function(e){he.font_family=e,rn("font-family",e),_[0]&&!_[0].textContent&&xt.setCursor()},this.setFontColor=function(e){he.fill=e,rn("fill",e)},this.getFontColor=function(){return he.fill},this.getFontSize=function(){return he.font_size},this.setFontSize=function(e){he.font_size=e,rn("font-size",e),_[0].textContent||xt.setCursor()},this.getText=function(){var e=_[0];return null==e?"":e.textContent},this.setTextContent=function(e){rn("#text",e),xt.init(e),xt.setCursor()},this.setImageURL=function(e){var t=_[0];if(t){var n=Un(t).attr(["width","height"]),i=!n.width||!n.height,r=At(t);if(r!==e)i=!0;else if(!i)return;var a=new Yn("Change Image URL");Et(t,e),a.addSubCommand(new Xn(t,{"#href":r})),i?Un(new Image).load(function(){var e=Un(t).attr(["width","height"]);Un(t).attr({width:this.width,height:this.height}),j.requestSelector(t).resize(),a.addSubCommand(new Xn(t,e)),G(a),U("changed",[t])}).attr("src",e):G(a)}},this.setLinkURL=function(e){var t=_[0];if(t){if("a"!==t.tagName){var n=Un(t).parents("a");if(!n.length)return;t=n[0]}var i=At(t);if(i!==e){var r=new Yn("Change Link URL");Et(t,e),r.addSubCommand(new Xn(t,{"#href":i})),G(r)}}},this.setRectRadius=function(e){var t=_[0];if(null!=t&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),G(new Xn(t,{rx:n,ry:n},"Radius")),U("changed",[t]))}},this.makeHyperlink=function(e){s.groupSelectedElements("a",e)},this.removeHyperlink=function(){s.ungroupSelectedElement()},this.setSegType=function(e){P.setSegType(e)},this.convertToPath=function(e,t){if(null!=e){return t?Vt(e,x,P):function(e,t,n,i,r,a,o,s){var l=new o.BatchCommand("Convert element to Path"),u=n({element:"path",attr:t=ct.extend({},t,Ot(e))}),c=e.getAttribute("transform");c&&u.setAttribute("transform",c);var h=e.id,d=e.parentNode;e.nextSibling?d.insertBefore(u,e):d.appendChild(u);var f=Lt(e);if(f){if(u.setAttribute("d",f),c){var p=W(u);me(p)&&i.resetOrientation(u)}var g=e.nextSibling;return l.addSubCommand(new o.RemoveElementCommand(e,g,d)),l.addSubCommand(new o.InsertElementCommand(u)),r(),e.parentNode.removeChild(e),u.setAttribute("id",h),u.removeAttribute("visibility"),a([u],!0),s(l),u}return u.parentNode.removeChild(u),null}(e,{fill:y.fill,"fill-opacity":y.fill_opacity,stroke:y.stroke,"stroke-width":y.stroke_width,"stroke-dasharray":y.stroke_dasharray,"stroke-linejoin":y.stroke_linejoin,"stroke-linecap":y.stroke_linecap,"stroke-opacity":y.stroke_opacity,opacity:y.opacity,visibility:"hidden"},x,P,z,H,de,G)}else{var n=_;Un.each(n,function(e,t){t&&s.convertToPath(t)})}};var tn=function(e,t,n){"pathedit"===Ee&&P.moveNode(e,t);for(var i=(n=n||_).length,r=["g","polyline","path"],a=["transform","opacity","filter"],o=function(){var o=n[i];if(null==o)return"continue";if(("x"===e||"y"===e)&&r.includes(o.tagName)){var l=Ft([o]),u="x"===e?t-l.x:0,c="y"===e?t-l.y:0;return s.moveSelectedElements(u*g,c*g,!0),"continue"}"g"===o.tagName&&a.includes(e);var d="#text"===e?o.textContent:o.getAttribute(e);if(null==d&&(d=""),d!==String(t)){"#text"===e?(o.textContent=t,/rotate/.test(o.getAttribute("transform"))&&(o=ze(o))):"#href"===e?Et(o,t):o.setAttribute(e,t),"textedit"===Ee&&"#text"!==e&&o.textContent.length&&xt.toSelectMode(o),I()&&"text"===o.nodeName&&/rotate/.test(o.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&o.textContent)&&(o=ze(o)),_.includes(o)&&setTimeout(function(){o.parentNode&&j.requestSelector(o).resize()},0);var f=zt(o);if(0!==f&&"transform"!==e)for(var p=W(o),v=p.numberOfItems;v--;){if(4===p.getItem(v).type){p.removeItem(v);var m=It(o),y=pe(m.x+m.width/2,m.y+m.height/2,_e(p).matrix),b=y.x,x=y.y,w=h.createSVGTransform();w.setRotate(f,b,x),p.insertItemBefore(w,v);break}}}};i--;)o()},rn=this.changeSelectedAttribute=function(e,t,n){n=n||_,s.undoMgr.beginUndoableChange(e,n),tn(e,t,n);var i=s.undoMgr.finishUndoableChange();i.isEmpty()||G(i)};this.deleteSelectedElements=function(){for(var e=new Yn("Delete Elements"),t=_.length,n=[],i=0;i<t;++i){var r=_[i];if(null==r)break;var a=r.parentNode,o=r;j.releaseSelector(o),Ye(o.id),"a"===a.tagName&&1===a.childNodes.length&&(o=a,a=a.parentNode);var s=o.nextSibling,l=a.removeChild(o);n.push(r),e.addSubCommand(new qn(l,s,a))}_=[],e.isEmpty()||G(e),U("changed",n),z()},this.cutSelectedElements=function(){s.copySelectedElements(),s.deleteSelectedElements()},this.copySelectedElements=function(){localStorage.setItem("svgedit_clipboard",JSON.stringify(_.map(function(e){return b(e)}))),Un("#cmenu_canvas").enableContextMenuItems("#paste,#paste_in_place")},this.pasteElements=function(e,t,n){var i=JSON.parse(localStorage.getItem("svgedit_clipboard")),r=i.length;if(r){var a=[],o=new Yn("Paste elements"),l={};for(i.forEach(function e(t){t.attr&&t.attr.id&&(l[t.attr.id]=D(),t.attr.id=l[t.attr.id]),t.children&&t.children.forEach(e)}),Be("IDsUpdated",{elems:i,changes:l},!0).forEach(function(e){e&&"remove"in e&&e.remove.forEach(function(e){i=i.filter(function(t){return t.attr.id!==e})})});r--;){var u=i[r];if(u){var c=x(u);a.push(c),o.addSubCommand(new Hn(c)),se(c)}}if(We(a),"in_place"!==e){var h=void 0,d=void 0;e?"point"===e&&(h=t,d=n):(h=je.x,d=je.y);var f=Ft(a),p=h-(f.x+f.width/2),g=d-(f.y+f.height/2),v=[],m=[];Un.each(a,function(e,t){v.push(p),m.push(g)});var y=s.moveSelectedElements(v,m,!1);y&&o.addSubCommand(y)}G(o),U("changed",a)}},this.groupSelectedElements=function(e,t){e||(e="g");var n="",i=void 0;switch(e){case"a":n="Make hyperlink",i="",arguments.length>1&&(i=t);break;default:e="g",n="Group Elements"}var r=new Yn(n),a=x({element:e,attr:{id:D()}});"a"===e&&Et(a,i),r.addSubCommand(new Hn(a));for(var o=_.length;o--;){var s=_[o];if(null!=s){"a"===s.parentNode.tagName&&1===s.parentNode.childNodes.length&&(s=s.parentNode);var l=s.nextSibling,u=s.parentNode;a.appendChild(s),r.addSubCommand(new zn(s,l,u))}}r.isEmpty()||G(r),We([a],!0)};var an=this.pushGroupProperties=function(e,t){for(var n=e.childNodes,i=n.length,r=e.getAttribute("transform"),a=W(e),o=_e(a).matrix,l=new Yn("Push group properties"),u=zt(e),c=Un(e).attr(["filter","opacity"]),d=void 0,f=void 0,g=void 0,v=p(),m=0;m<i;m++){var y=n[m];if(1===y.nodeType){if(null!==c.opacity&&1!==c.opacity){var _=Math.round((y.getAttribute("opacity")||1)*c.opacity*100)/100;rn("opacity",_,[y])}if(c.filter){var b=this.getBlur(y),x=b;f||(f=this.getBlur(e)),b?b=Number(f)+Number(b):0===b&&(b=f),x?d=Ht(y.getAttribute("filter")):d?(d=v.copyElem(d),Tt().appendChild(d)):d=Ht(c.filter);var w="feGaussianBlur"===d.firstChild.tagName?"blur":"filter";d.id=y.id+"_"+w,rn("filter","url(#"+d.id+")",[y]),b&&(rn("stdDeviation",b,[d.firstChild]),s.setBlurOffsets(d,b))}var S=W(y);if(y.tagName.includes("Gradient")&&(S=null),S&&"defs"!==y.tagName&&a.numberOfItems){if(u&&1===a.numberOfItems){var k=a.getItem(0).matrix,C=h.createSVGMatrix(),P=zt(y);P&&(C=S.getItem(0).matrix);var A=It(y),E=_e(S).matrix,T=pe(A.x+A.width/2,A.y+A.height/2,E),G=u+P,N=h.createSVGTransform();N.setRotate(G,T.x,T.y);var I=ve(k,C,N.matrix.inverse());if(P&&S.removeItem(0),G&&(S.numberOfItems?S.insertItemBefore(N,0):S.appendItem(N)),I.e||I.f){var M=h.createSVGTransform();M.setTranslate(I.e,I.f),S.numberOfItems?S.insertItemBefore(M,0):S.appendItem(M)}}else{var L=y.getAttribute("transform");(g={}).transform=L||"";var O=h.createSVGTransform(),V=_e(S).matrix,j=V.inverse(),B=ve(j,o,V);O.setMatrix(B),S.appendItem(O)}var R=Ln(y);R&&l.addSubCommand(R)}}}if(r&&((g={}).transform=r,e.setAttribute("transform",""),e.removeAttribute("transform"),l.addSubCommand(new Xn(e,g))),t&&!l.isEmpty())return l};this.ungroupSelectedElement=function(){var e=_[0];if(e)if(Un(e).data("gsvg")||Un(e).data("symbol"))Rt(e);else{if("use"===e.tagName){var t=qt(At(e).substr(1));return Un(e).data("symbol",t).data("ref",t),void Rt(e)}var n=Un(e).parents("a");if(n.length&&(e=n[0]),"g"===e.tagName||"a"===e.tagName){var i=new Yn("Ungroup Elements"),r=an(e,!0);r&&i.addSubCommand(r);for(var a=e.parentNode,o=e.nextSibling,s=new Array(e.childNodes.length),l=0;e.firstChild;){var u=e.firstChild,c=u.nextSibling,h=u.parentNode;if("title"!==u.tagName)s[l++]=u=a.insertBefore(u,o),i.addSubCommand(new zn(u,c,h));else{var d=u.nextSibling;i.addSubCommand(new qn(u,d,h)),h.removeChild(u)}}z();var f=e.nextSibling;e=a.removeChild(e),i.addSubCommand(new qn(e,f,a)),i.isEmpty()||G(i),H(s)}}},this.moveToTopSelectedElement=function(){var e=_[0];if(null!=e){var t=e,n=t.parentNode,i=t.nextSibling;i!==(t=t.parentNode.appendChild(t)).nextSibling&&(G(new zn(t,i,n,"top")),U("changed",[t]))}},this.moveToBottomSelectedElement=function(){var e=_[0];if(null!=e){var t=e,n=t.parentNode,i=t.nextSibling,r=t.parentNode.firstChild;"title"===r.tagName&&(r=r.nextSibling),"defs"===r.tagName&&(r=r.nextSibling),i!==(t=t.parentNode.insertBefore(t,r)).nextSibling&&(G(new zn(t,i,n,"bottom")),U("changed",[t]))}},this.moveUpDownSelected=function(e){var t=_[0];if(t){Ve=[];var n=void 0,i=void 0,r=Un(Re(Ft([t]))).toArray();if("Down"===e&&r.reverse(),Un.each(r,function(){if(i)return n=this,!1;this===t&&(i=!0)}),n){var a=t,o=a.parentNode,s=a.nextSibling;Un(n)["Down"===e?"before":"after"](a),s!==a.nextSibling&&(G(new zn(a,s,o,"Move "+e)),U("changed",[a]))}}},this.moveSelectedElements=function(e,t,n){e.constructor!==Array&&(e/=g,t/=g),n=n||!0;for(var i=new Yn("position"),r=_.length;r--;){var a=_[r];if(null!=a){var o=h.createSVGTransform(),s=W(a);e.constructor===Array?o.setTranslate(e[r],t[r]):o.setTranslate(e,t),s.numberOfItems?s.insertItemBefore(o,0):s.appendItem(o);var l=Ln(a);l&&i.addSubCommand(l),j.requestSelector(a).resize()}}if(!i.isEmpty())return n&&G(i),U("changed",_),i},this.cloneSelectedElements=function(e,t){var n=void 0,i=void 0,r=new Yn("Clone Elements"),a=_.length;for(_.sort(function(e,t){return Un(t).index()-Un(e).index()}),n=0;n<a&&null!=(i=_[n]);++n);var o=_.slice(0,n);this.clearSelection(!0);var s=p();for(n=o.length;n--;)i=o[n]=s.copyElem(o[n]),(v||s.getCurrentLayer()).appendChild(i),r.addSubCommand(new Hn(i));r.isEmpty()||(H(o.reverse()),this.moveSelectedElements(e,t,!1),G(r))},this.alignSelectedElements=function(e,t){var n=[],i=_.length;if(i){for(var r=Number.MAX_VALUE,a=Number.MIN_VALUE,o=Number.MAX_VALUE,l=Number.MIN_VALUE,u=Number.MIN_VALUE,c=Number.MIN_VALUE,h=0;h<i&&null!=_[h];++h){var d=_[h];switch(n[h]=Ft([d]),t){case"smallest":(("l"===e||"c"===e||"r"===e)&&(u===Number.MIN_VALUE||u>n[h].width)||("t"===e||"m"===e||"b"===e)&&(c===Number.MIN_VALUE||c>n[h].height))&&(r=n[h].x,o=n[h].y,a=n[h].x+n[h].width,l=n[h].y+n[h].height,u=n[h].width,c=n[h].height);break;case"largest":(("l"===e||"c"===e||"r"===e)&&(u===Number.MIN_VALUE||u<n[h].width)||("t"===e||"m"===e||"b"===e)&&(c===Number.MIN_VALUE||c<n[h].height))&&(r=n[h].x,o=n[h].y,a=n[h].x+n[h].width,l=n[h].y+n[h].height,u=n[h].width,c=n[h].height);break;default:n[h].x<r&&(r=n[h].x),n[h].y<o&&(o=n[h].y),n[h].x+n[h].width>a&&(a=n[h].x+n[h].width),n[h].y+n[h].height>l&&(l=n[h].y+n[h].height)}}"page"===t&&(r=0,o=0,a=s.contentW,l=s.contentH);for(var f=new Array(i),p=new Array(i),g=0;g<i&&null!=_[g];++g){var v=n[g];switch(f[g]=0,p[g]=0,e){case"l":f[g]=r-v.x;break;case"c":f[g]=(r+a)/2-(v.x+v.width/2);break;case"r":f[g]=a-(v.x+v.width);break;case"t":p[g]=o-v.y;break;case"m":p[g]=(o+l)/2-(v.y+v.height/2);break;case"b":p[g]=l-(v.y+v.height)}}this.moveSelectedElements(f,p)}},this.contentW=Ut().w,this.contentH=Ut().h,this.updateCanvas=function(e,t){h.setAttribute("width",e),h.setAttribute("height",t);var n=Un("#canvasBackground")[0],i=d.getAttribute("x"),r=d.getAttribute("y"),a=e/2-this.contentW*g/2,o=t/2-this.contentH*g/2;Xt(d,{width:this.contentW*g,height:this.contentH*g,x:a,y:o,viewBox:"0 0 "+this.contentW+" "+this.contentH}),Xt(n,{width:d.getAttribute("width"),height:d.getAttribute("height"),x:a,y:o});var s=qt("background_image");return s&&Xt(s,{width:"100%",height:"100%"}),j.selectorParentGroup.setAttribute("transform","translate("+a+","+o+")"),Be("canvasUpdated",{new_x:a,new_y:o,old_x:i,old_y:r,d_x:a-i,d_y:o-r}),{x:a,y:o,old_x:i,old_y:r,d_x:a-i,d_y:o-r}},this.setBackground=function(e,t){var n=qt("canvasBackground"),i=Un(n).find("rect")[0],r=qt("background_image");i.setAttribute("fill",e),t?(r||(r=c.createElementNS(l.SVG,"image"),Xt(r,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})),Et(r,t),n.appendChild(r)):r&&r.parentNode.removeChild(r)},this.cycleElement=function(e){var t=void 0,n=_[0],i=!1,r=Dt(v||p().getCurrentLayer());if(r.length){if(null==n)i=r[t=e?r.length-1:0];else for(var a=r.length;a--;)if(r[a]===n){(t=e?a-1:a+1)>=r.length?t=0:t<0&&(t=r.length-1),i=r[t];break}We([i],!0),U("selected",_)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:G,setGradient:Jt,addSvgElementFromJson:x,assignAttributes:Xt,BatchCommand:Yn,buildCanvgCallback:Zt,call:U,canvg:nn,ChangeElementCommand:Xn,copyElem:function(e){return p().copyElem(e)},decode64:_t,encode64:yt,executeAfterLoads:$t,ffClone:ze,findDefs:Tt,findDuplicateGradient:en,getElem:qt,getId:F,getIntersectionList:Re,getMouseTarget:Q,getNextId:D,getPathBBox:Gt,getTypeMap:ee,getUrlFromAttr:Pt,hasMatrixTransform:me,identifyLayers:_n,InsertElementCommand:Hn,isChrome:L,isIdentity:ge,isIE:M,logMatrix:qe,matrixMultiply:ve,MoveElementCommand:zn,NS:l,preventClickDefault:Kt,recalculateAllSelectedDimensions:He,recalculateDimensions:Ln,remapElement:Gn,RemoveElementCommand:qn,removeUnusedDefElems:St,round:V,runExtensions:Be,sanitizeSvg:Pn,SVGEditTransformList:X,text2xml:kt,toString:toString,transformBox:ye,transformListToTransform:_e,transformPoint:pe,walkTree:Ct}}};var Zn={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};window.console||(window.console={log:function(e){},dir:function(e){}}),Math.precision=function(e,t){return void 0===t&&(t=0),Math.round(e*Math.pow(10,t))/Math.pow(10,t)};var Kn=jQuery,Jn=void 0;function ei(e,t,n){var i=Kn("#svg_editor").parent();for(var r in t){var a=t[r];if(a||console.log(r),n&&(r="#"+r),i.find(r).length){var o=i.find(r)[0];switch(e){case"content":for(var s,l=0;s=o.childNodes[l];l++)if(3===s.nodeType&&s.textContent.trim()){s.textContent=a;break}break;case"title":o.title=a}}else console.log("Missing: "+r)}}var ti=void 0;var ni=[function(e){function t(t){if("string"==typeof t.data){var n=t.handler,i=t.data.toLowerCase().split(" ");t.handler=function(t){if(this===t.target||!/textarea|select/i.test(t.target.nodeName)&&"text"!==t.target.type){var r="keypress"!==t.type&&e.hotkeys.specialKeys[t.which],a=String.fromCharCode(t.which).toLowerCase(),o="",s={};t.altKey&&"alt"!==r&&(o+="alt+"),t.ctrlKey&&"ctrl"!==r&&(o+="ctrl+"),t.metaKey&&!t.ctrlKey&&"meta"!==r&&(o+="meta+"),t.shiftKey&&"shift"!==r&&(o+="shift+"),r?s[o+r]=!0:(s[o+a]=!0,s[o+e.hotkeys.shiftNums[a]]=!0,"shift+"===o&&(s[e.hotkeys.shiftNums[a]]=!0));for(var l=0,u=i.length;l<u;l++)if(s[i[l]])return n.apply(this,arguments)}}}}return e.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:t}}),e},function(e){return function(e,n){var i,r,a,o,s,l,u,c,h=Array.prototype.slice,d=decodeURIComponent,f=e.param,p=e.bbq=e.bbq||{},g=e.event.special,v="hashchange",m="querystring",y="fragment",_="elemUrlAttr",b="location",x="href",w="src",S=/^.*\?|#.*$/g,k=/^.*\#/,C={};function P(e){return"string"==typeof e}function A(e){var t=h.call(arguments,1);return function(){return e.apply(this,t.concat(h.call(arguments)))}}function E(t,r,o,s,l){var u,h,p,g,v;return s!==i?(v=(p=o.match(t?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/))[3]||"",2===l&&P(s)?h=s.replace(t?k:S,""):(g=a(p[2]),s=P(s)?a[t?y:m](s):s,h=2===l?s:1===l?e.extend({},s,g):e.extend({},g,s),h=f(h),t&&(h=h.replace(c,d))),u=p[1]+(t?"#":h||!p[1]?"?":"")+h+v):u=r(o!==i?o:n[b][x]),u}function T(e,t,n){return t===i||"boolean"==typeof t?(n=t,t=f[e?y:m]()):t=P(t)?t.replace(e?k:S,""):t,a(t,n)}function G(n,r,a,o){return P(a)||"object"===(void 0===a?"undefined":t(a))||(o=a,a=r,r=i),this.each(function(){var t=e(this),i=r||u()[(this.nodeName||"").toLowerCase()]||"",s=i&&t.attr(i)||"";t.attr(i,f[n](s,a,o))})}f[m]=A(E,0,function(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}),f[y]=r=A(E,1,function(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}),r.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);c=new RegExp(n.join("|"),"g")},r.noEscape(",/"),e.deparam=a=function(t,n){var r={},a={true:!0,false:!1,null:null};return e.each(t.replace(/\+/g," ").split("&"),function(t,o){var s,l=o.split("="),u=d(l[0]),c=r,h=0,f=u.split("]["),p=f.length-1;if(/\[/.test(f[0])&&/\]$/.test(f[p])?(f[p]=f[p].replace(/\]$/,""),p=(f=f.shift().split("[").concat(f)).length-1):p=0,2===l.length)if(s=d(l[1]),n&&(s=s&&!isNaN(s)?+s:"undefined"===s?i:a[s]!==i?a[s]:s),p)for(;h<=p;h++)c=c[u=""===f[h]?c.length:f[h]]=h<p?c[u]||(f[h+1]&&isNaN(f[h+1])?{}:[]):s;else e.isArray(r[u])?r[u].push(s):r[u]!==i?r[u]=[r[u],s]:r[u]=s;else u&&(r[u]=n?i:"")}),r},a[m]=A(T,0),a[y]=o=A(T,1),e[_]||(e[_]=function(t){return e.extend(C,t)})({a:x,base:x,iframe:w,img:w,input:w,form:"action",link:x,script:w}),u=e[_],e.fn[m]=A(G,m),e.fn[y]=A(G,y),p.pushState=s=function(e,t){P(e)&&/^#/.test(e)&&t===i&&(t=2);var a=e!==i,o=r(n[b][x],a?e:{},a?t:2);n[b][x]=o+(/#/.test(o)?"":"#")},p.getState=l=function(e,t){return e===i||"boolean"==typeof e?o(e):o(t)[e]},p.removeState=function(t){var n={};t!==i&&(n=l(),e.each(e.isArray(t)?t:arguments,function(e,t){delete n[t]})),s(n,2)},g[v]=e.extend(g[v],{add:function(t){var n;function o(e){var t=e[y]=r();e.getState=function(e,n){return e===i||"boolean"==typeof e?a(t,e):a(t,n)[e]},n.apply(this,arguments)}if(e.isFunction(t))return n=t,o;n=t.handler,t.handler=o}})}(e,window),function(e,t,n){var i,r,a,o,s,l,u=e.event.special,c="location",h="hashchange",d="href",f=e.browser,p=document.documentMode,g=f.msie&&(void 0===p||p<8),v="on"+h in t&&!g;function m(e){return(e=e||t[c][d]).replace(/^[^#]*#?(.*)$/,"$1")}e[h+"Delay"]=100,u[h]=e.extend(u[h],{setup:function(){if(v)return!1;e(i.start)},teardown:function(){if(v)return!1;e(i.stop)}}),(l={}).start=function(){if(!r){var n=m();o||(o=s=function(e){return e},g&&(a=e('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow,s=function(){return m(a.document[c][d])},(o=function(e,t){if(e!==t){var n=a.document;n.open().close(),n[c].hash="#"+e}})(m()))),function i(){var a=m(),l=s(n);a!==n?(o(n=a,l),e(t).trigger(h)):l!==n&&(t[c][d]=t[c][d].replace(/#.*/,"")+"#"+l),r=setTimeout(i,e[h+"Delay"])}()}},l.stop=function(){a||(r&&clearTimeout(r),r=0)},i=l}(e,window),e},function(e){var t={},n=void 0;return e.svgIcons=function(i,r){var a="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xlink",s=r.w||24,l=r.h||24,u=void 0,c=void 0,h=void 0,d=!1,f=!1,p=0,g=!!window.opera,v="data:image/svg+xml;charset=utf-8;base64,",m=void 0;if(r.svgz){m=e('<object data="'+i+'" type=image/svg+xml>').appendTo("body").hide();try{c=m[0].contentDocument,m.load(_),_(0,!0)}catch(e){k()}}else{var y=new DOMParser;e.ajax({url:i,dataType:"string",success:function(t){t?(c=y.parseFromString(t,"text/xml"),e(function(){_("ajax")})):e(k)},error:function(t){window.opera?e(function(){k()}):t.responseText?((c=y.parseFromString(t.responseText,"text/xml")).childNodes.length||e(k),e(function(){_("ajax")})):e(k)}})}function _(t,n){if("ajax"!==t){if(f)return;var i=(c=m[0].contentDocument)&&c.getElementById("svg_eof");if(!(i||n&&i))return void(++p<50?setTimeout(_,20):(k(),f=!0));f=!0}if(u=e(c.firstChild).children(),r.no_img)setTimeout(function(){d||S()},500);else{var a=v+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";h=e(new Image).attr({src:a,width:0,height:0}).appendTo("body").load(function(){S(!0)}).error(function(){S()})}}var b=function(e,t,n,i){if(g&&t.css("visibility","hidden"),r.replace){i&&t.attr("id",n);var a=e.attr("class");a&&t.attr("class","svg_icon "+a),e.replaceWith(t)}else e.append(t);g&&setTimeout(function(){t.removeAttr("style")},1)},x=void 0,w=function(e,n){void 0!==r.id_match&&!1===r.id_match||b(x,e,n,!0),t[n]=e};function S(i,c){if(!d){r.no_img&&(i=!1);var f=void 0;if(i&&(f=e(document.createElement("div"))).hide().appendTo("body"),c){var p=r.fallback_path||"";e.each(c,function(t,n){x=e("#"+t);var i=e(new Image).attr({class:"svg_icon",src:p+n,width:s,height:l,alt:"icon"});w(i,t)})}else for(var y=u.length,_=0;_<y;_++){var S=u[_],k=S.id;if("svg_eof"===k)break;x=e("#"+k);var P=document.createElementNS(a,"svg");P.setAttributeNS(null,"viewBox",[0,0,s,l].join(" "));var A=S.getElementsByTagNameNS(a,"svg")[0],E=A.getAttribute("width"),T=A.getAttribute("height");A.removeAttribute("width"),A.removeAttribute("height"),A.getAttribute("viewBox")||A.setAttribute("viewBox",[0,0,E,T].join(" ")),P.setAttribute("xmlns",a),P.setAttribute("width",s),P.setAttribute("height",l),P.setAttribute("xmlns:xlink",o),P.setAttribute("class","svg_icon"),g||(A=A.cloneNode(!0)),P.appendChild(A);var G=void 0;if(i){f.empty().append(P);var N=v+C(unescape(encodeURIComponent((new XMLSerializer).serializeToString(P))));G=e(new Image).attr({class:"svg_icon",src:N})}else G=n(e(P),_);w(G,k)}r.placement&&e.each(r.placement,function(r,a){t[a]&&e(r).each(function(r){var o=t[a].clone();r>0&&!i&&(o=n(o,r,!0)),b(e(this),o,a)})}),c||(i&&f.remove(),m&&m.remove(),h&&h.remove()),r.resize&&e.resizeSvgIcons(r.resize),d=!0,r.callback&&r.callback(t)}}function k(){if(i.includes(".svgz")){var t=i.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg"),e.svgIcons(t,r)}else r.fallback&&S(!1,r.fallback)}function C(e){if(window.btoa)return window.btoa(e);var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=new Array(4*Math.floor((e.length+2)/3)),i=0,r=0;do{var a=e.charCodeAt(i++),o=e.charCodeAt(i++),s=e.charCodeAt(i++),l=a>>2,u=(3&a)<<4|o>>4,c=(15&o)<<2|s>>6,h=63&s;isNaN(o)?c=h=64:isNaN(s)&&(h=64),n[r++]=t.charAt(l),n[r++]=t.charAt(u),n[r++]=t.charAt(c),n[r++]=t.charAt(h)}while(i<e.length);return n.join("")}n=function(e,t,n){var i=e.find("defs");if(!i.length)return e;var r=void 0;r=g?i.find("*").filter(function(){return!!this.id}):i.find("[id]");var a=e[0].getElementsByTagName("*"),o=a.length;return r.each(function(e){var n=this.id,i="x"+n+t+e;this.id=i;var r="url(#"+n+")",s="url(#"+i+")";for(e=0;e<o;e++){var l=a[e];l.getAttribute("fill")===r&&l.setAttribute("fill",s),l.getAttribute("stroke")===r&&l.setAttribute("stroke",s),l.getAttribute("filter")===r&&l.setAttribute("filter",s)}}),e}},e.getSvgIcon=function(e,i){var r=t[e];return i&&r&&(r=n(r,0,!0).clone(!0)),r},e.resizeSvgIcons=function(t){var n=!e(".svg_icon:first").length;e.each(t,function(t,i){var r=Array.isArray(i),a=r?i[0]:i,o=r?i[1]:i;n&&(t=t.replace(/\.svg_icon/g,"svg")),e(t).each(function(){this.setAttribute("width",a),this.setAttribute("height",o),window.opera&&window.widget&&(this.parentNode.style.width=a+"px",this.parentNode.style.height=o+"px")})})},e},function(e){e.loadingStylesheets||(e.loadingStylesheets=[]),e.loadingStylesheets.includes("jgraduate/css/jgraduate.css")||e.loadingStylesheets.push("jgraduate/css/jgraduate.css"),e.jGraduate={Paint:function(e){var t=e||{};if(this.alpha=isNaN(t.alpha)?100:t.alpha,t.copy)switch(this.type=t.copy.type,this.alpha=t.copy.alpha,this.solidColor=null,this.linearGradient=null,this.radialGradient=null,this.type){case"none":break;case"solidColor":this.solidColor=t.copy.solidColor;break;case"linearGradient":this.linearGradient=t.copy.linearGradient.cloneNode(!0);break;case"radialGradient":this.radialGradient=t.copy.radialGradient.cloneNode(!0)}else t.linearGradient?(this.type="linearGradient",this.solidColor=null,this.radialGradient=null,this.linearGradient=t.linearGradient.cloneNode(!0)):t.radialGradient?(this.type="radialGradient",this.solidColor=null,this.linearGradient=null,this.radialGradient=t.radialGradient.cloneNode(!0)):t.solidColor?(this.type="solidColor",this.solidColor=t.solidColor):(this.type="none",this.solidColor=null,this.linearGradient=null,this.radialGradient=null)}},e.fn.jGraduateDefaults={paint:new e.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var n=navigator.userAgent.includes("Gecko/");function i(e,t,i){var r=document.createElementNS(Zn.svg,e);return function(e,t){if(n)for(var i in t)e.setAttribute(i,t[i]);else for(var r in t){var a=t[r],o=e[r];o&&"SVGLength"===o.constructor?o.baseVal.value=a:e.setAttribute(r,a)}}(r,t),i&&i.appendChild(r),r}return e.fn.jGraduate=function(n){var r=arguments;return this.each(function(){var a=e(this),o=e.extend(!0,{},e.fn.jGraduateDefaults,n),s=a.attr("id"),l="#"+a.attr("id")+" ";if(l){var u=function(){switch(a.paint.type){case"radialGradient":a.paint.linearGradient=null;break;case"linearGradient":a.paint.radialGradient=null;break;case"solidColor":a.paint.radialGradient=a.paint.linearGradient=null}"function"==typeof a.okCallback&&a.okCallback(a.paint),a.hide()},c=function(){"function"==typeof a.cancelCallback&&a.cancelCallback(),a.hide()};e.extend(!0,a,{paint:new e.jGraduate.Paint({copy:o.paint}),okCallback:"function"==typeof r[1]&&r[1]||null,cancelCallback:"function"==typeof r[2]&&r[2]||null});var h=null,d=e(window);"none"===a.paint.type&&(a.paint=e.jGraduate.Paint({solidColor:"ffffff"})),a.addClass("jGraduate_Picker"),a.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+s+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var f=e(l+"> .jGraduate_colPick"),p=e(l+"> .jGraduate_gradPick");p.html('<div id="'+s+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+o.window.pickerTitle+'</h2><div id="'+s+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+s+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+s+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+s+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+s+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+s+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+s+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+s+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+s+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+s+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+s+'_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="'+s+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+s+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+o.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+s+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+s+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+o.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+s+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+s+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+o.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_AngleInput" size="3" value="0"/>deg</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+s+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+s+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+o.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+s+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+s+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+s+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var g=256,v=g-0,m=g-0,y={};e(".jGraduate_SliderBar").width(145);var _=e("#"+s+"_jGraduate_GradContainer")[0],b=i("svg",{id:s+"_jgraduate_svg",width:g,height:g,xmlns:Zn.svg},_),x=a.paint.type,w=a.paint[x],S=w,k=a.paint.alpha,C="solidColor"===x;switch(x){case"solidColor":case"linearGradient":if(C||(S.id=s+"_lg_jgraduate_grad",w=S=b.appendChild(S)),i("radialGradient",{id:s+"_rg_jgraduate_grad"},b),"linearGradient"===x)break;case"radialGradient":C||(S.id=s+"_rg_jgraduate_grad",w=S=b.appendChild(S)),i("linearGradient",{id:s+"_lg_jgraduate_grad"},b)}var P=void 0;if(C){w=S=e("#"+s+"_lg_jgraduate_grad")[0],Ie(0,"#"+(h=a.paint[x]),1);var A=t(o.newstop);if("string"===A)switch(o.newstop){case"same":Ie(1,"#"+h,1);break;case"inverse":for(var E="",T=0;T<6;T+=2){var G=(255-parseInt(h.substr(T,2),16)).toString(16);G.length<2&&(G=0+G),E+=G}Ie(1,"#"+E,1);break;case"white":Ie(1,"#ffffff",1);break;case"black":Ie(1,"#000000",1)}else if("object"===A){var N="opac"in o.newstop?o.newstop.opac:1;Ie(1,o.newstop.color||"#"+h,N)}}var I=parseFloat(w.getAttribute("x1")||0),M=parseFloat(w.getAttribute("y1")||0),L=parseFloat(w.getAttribute("x2")||1),O=parseFloat(w.getAttribute("y2")||0),V=parseFloat(w.getAttribute("cx")||.5),j=parseFloat(w.getAttribute("cy")||.5),B=parseFloat(w.getAttribute("fx")||V),R=parseFloat(w.getAttribute("fy")||j),D=i("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:v,height:m,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":k/100},b),F=e("<div/>").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:M*g,left:I*g}).data("coord","start").appendTo(_),U=F.clone().text(2).css({top:O*g,left:L*g}).attr("title","End stop").data("coord","end").appendTo(_),z=e("<div/>").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:j*g,left:V*g}).data("coord","center").appendTo(_),H=z.clone().text("F").css({top:R*g,left:B*g,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(_);H[0].id=s+"_jGraduate_focusCoord";var q=void 0;e.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(t,n){var i=isNaN(n[1]),r=S.getAttribute(n);r||(r=i?"0.5":"x2"===n?"1.0":"0.0"),y[n]=e("#"+s+"_jGraduate_"+n).val(r).change(function(){isNaN(parseFloat(this.value))||this.value<0?this.value=0:this.value>1&&(this.value=1),("f"!==n[0]||q)&&(i&&"radialGradient"===x||!i&&"linearGradient"===x)&&S.setAttribute(n,this.value);var e=i?"c"===n[0]?z:H:"1"===n[1]?F:U,t=n.includes("x")?"left":"top";e.css(t,this.value*g)}).change()});var X=e("#"+s+"_jGraduate_StopSlider"),Y=void 0,W=void 0,Q=void 0,$=i("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},void 0),Z=void 0,K=1,J=1,ee=0,te=V,ne=j,ie=i("svg",{width:"100%",height:45},X[0]),re=i("image",{width:16,height:16},i("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ie)),ae=o.images.clientPath+"map-opacity.png";re.setAttributeNS(Zn.xlink,"xlink:href",ae),e(ie).click(function(e){if(Z=X.offset(),"path"!==e.target.tagName){var t=e.pageX-Z.left-8;Ie((t=t<10?10:t>g+10?g+10:t)/g,0,0,!0),e.stopPropagation()}}),e(ie).mouseover(function(){ie.appendChild($)}),P=i("g",{},ie),i("line",{x1:10,y1:15,x2:g+10,y2:15,"stroke-width":2,stroke:"#000"},ie);var oe=p.find(".jGraduate_spreadMethod").change(function(){S.setAttribute("spreadMethod",e(this).val())}),se=null,le=function(e){var t=e.pageX-de.left,n=e.pageY-de.top;t=t<0?0:t>g?g:t,n=n<0?0:n>g?g:n,se.css("left",t).css("top",n);var i=t/v,r=n/m,a=se.data("coord"),o=S;switch(a){case"start":y.x1.val(i),y.y1.val(r),o.setAttribute("x1",i),o.setAttribute("y1",r);break;case"end":y.x2.val(i),y.y2.val(r),o.setAttribute("x2",i),o.setAttribute("y2",r);break;case"center":y.cx.val(i),y.cy.val(r),o.setAttribute("cx",i),o.setAttribute("cy",r),te=i,ne=r,Oe();break;case"focus":y.fx.val(i),y.fy.val(r),o.setAttribute("fx",i),o.setAttribute("fy",r),Oe()}e.preventDefault()},ue=function e(){se=null,d.unbind("mousemove",le).unbind("mouseup",e)},ce=(Y=S.getElementsByTagNameNS(Zn.svg,"stop")).length;if(ce<2){for(;ce<2;)S.appendChild(document.createElementNS(Zn.svg,"stop")),++ce;Y=S.getElementsByTagNameNS(Zn.svg,"stop")}for(var he=0;he<ce;he++)Ie(0,0,0,0,Y[he]);oe.val(S.getAttribute("spreadMethod")||"pad");var de=void 0;q=!1,D.setAttribute("fill-opacity",k/100),e("#"+s+" div.grad_coord").mousedown(function(t){t.preventDefault(),se=e(this),de=se.parent().offset(),d.mousemove(le).mouseup(ue)}),e("#"+s+"_jGraduate_Ok").bind("click",function(){a.paint.type=x,a.paint[x]=S.cloneNode(!0),a.paint.solidColor=null,u()}),e("#"+s+"_jGraduate_Cancel").bind("click",function(e){c()}),"radialGradient"===x&&(q?H.show():(H.hide(),y.fx.val(""),y.fy.val(""))),e("#"+s+"_jGraduate_match_ctr")[0].checked=!q;var fe=void 0,pe=void 0;if(e("#"+s+"_jGraduate_match_ctr").change(function(){q=!this.checked,H.toggle(q),y.fx.val(""),y.fy.val("");var e=S;if(q){var t=fe||.5,n=pe||.5;e.setAttribute("fx",t),e.setAttribute("fy",n),y.fx.val(t),y.fy.val(n)}else fe=e.getAttribute("fx"),pe=e.getAttribute("fy"),e.removeAttribute("fx"),e.removeAttribute("fy")}),(ce=(Y=S.getElementsByTagNameNS(Zn.svg,"stop")).length)<2){for(;ce<2;)S.appendChild(document.createElementNS(Zn.svg,"stop")),++ce;Y=S.getElementsByTagNameNS(Zn.svg,"stop")}var ge=void 0,ve=0,me=0;if("radialGradient"===x){var ye=S.gradientTransform.baseVal;if(2===ye.numberOfItems){var _e=ye.getItem(0),be=ye.getItem(1);if(2===_e.type&&3===be.type){var xe=be.matrix;1!==xe.a?ve=Math.round(100*-(1-xe.a)):1!==xe.d&&(ve=Math.round(100*(1-xe.d)))}}else if(3===ye.numberOfItems){var we=ye.getItem(0),Se=ye.getItem(1),ke=ye.getItem(2);if(4===we.type&&2===Se.type&&3===ke.type){me=Math.round(we.angle);var Ce=ke.matrix;1!==Ce.a?ve=Math.round(100*-(1-Ce.a)):1!==Ce.d&&(ve=Math.round(100*(1-Ce.d)))}}}var Pe={radius:{handle:"#"+s+"_jGraduate_RadiusArrows",input:"#"+s+"_jGraduate_RadiusInput",val:100*(S.getAttribute("r")||.5)},opacity:{handle:"#"+s+"_jGraduate_OpacArrows",input:"#"+s+"_jGraduate_OpacInput",val:a.paint.alpha||100},ellip:{handle:"#"+s+"_jGraduate_EllipArrows",input:"#"+s+"_jGraduate_EllipInput",val:ve},angle:{handle:"#"+s+"_jGraduate_AngleArrows",input:"#"+s+"_jGraduate_AngleInput",val:me}};e.each(Pe,function(t,n){var i=e(n.handle);i.mousedown(function(r){var a=i.parent();ge={type:t,elem:i,input:e(n.input),parent:a,offset:a.offset()},d.mousemove(Ae).mouseup(Ee),r.preventDefault()}),e(n.input).val(n.val).change(function(){var e="radialGradient"===x,n=+this.value,r=0;switch(t){case"radius":e&&S.setAttribute("r",n/100),r=Math.pow(n/100,.4)/2*145;break;case"opacity":a.paint.alpha=n,D.setAttribute("fill-opacity",n/100),r=1.45*n;break;case"ellip":if(K=J=1,0===n){r=72.5;break}n>99.5&&(n=99.5),n>0?J=1-n/100:K=-n/100-1,r=(n+100)/2*145/100,e&&Oe();break;case"angle":r=(ee=n)/180,r+=.5,r*=145,e&&Oe()}r>145?r=145:r<0&&(r=0),i.css({"margin-left":r-5})}).change()});for(var Ae=function(e){!function(e){var t=ge.offset,n=ge.parent,i=e.pageX-t.left-parseInt(n.css("border-left-width"));i>145&&(i=145),i<=0&&(i=0);var r=i-5;switch(i/=145,ge.type){case"radius":(i=Math.pow(2*i,2.5))>.98&&i<1.02&&(i=1),i<=.01&&(i=.01),S.setAttribute("r",i);break;case"opacity":a.paint.alpha=parseInt(100*i),D.setAttribute("fill-opacity",i);break;case"ellip":K=1,J=1,i<.5?K=(i/=.5)<=0?.01:i:i>.5&&(J=(i=2-(i/=.5))<=0?.01:i),Oe(),J===1+(i-=1)&&(i=Math.abs(i));break;case"angle":i-=.5,ee=i*=180,Oe(),i/=100}ge.elem.css({"margin-left":r}),i=Math.round(100*i),ge.input.val(i)}(e),e.preventDefault()},Ee=function e(t){d.unbind("mousemove",Ae).unbind("mouseup",e),ge=null},Te=(255*a.paint.alpha/100).toString(16);Te.length<2;)Te="0"+Te;Te=Te.split(".")[0],h="none"===a.paint.solidColor?"":a.paint.solidColor+Te,C||(h=Y[0].getAttribute("stop-color")),e.extend(e.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),f.jPicker({window:{title:o.window.pickerTitle},images:{clientPath:o.images.clientPath},color:{active:h,alphaSupport:!0}},function(e){a.paint.type="solidColor",a.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,a.paint.solidColor=e.val("hex")?e.val("hex"):"none",a.paint.radialGradient=null,u()},null,function(){c()});var Ge=e(l+" .jGraduate_tabs li");Ge.click(function(){Ge.removeClass("jGraduate_tab_current"),e(this).addClass("jGraduate_tab_current"),e(l+" > div").hide();var t=e(this).attr("data-type");if(e(l+" .jGraduate_gradPick").show(),"rg"===t||"lg"===t){e(".jGraduate_"+t+"_field").show(),e(".jGraduate_"+("lg"===t?"rg":"lg")+"_field").hide(),e("#"+s+"_jgraduate_rect")[0].setAttribute("fill","url(#"+s+"_"+t+"_jgraduate_grad)"),x="lg"===t?"linearGradient":"radialGradient",e("#"+s+"_jGraduate_OpacInput").val(a.paint.alpha).change();var n=e("#"+s+"_"+t+"_jgraduate_grad")[0];if(S!==n){var i=e(S).find("stop");e(n).empty().append(i),S=n;var r=oe.val();S.setAttribute("spreadMethod",r)}q="rg"===t&&null!=S.getAttribute("fx")&&!(V===B&&j===R),e("#"+s+"_jGraduate_focusCoord").toggle(q),q&&(e("#"+s+"_jGraduate_match_ctr")[0].checked=!1)}else e(l+" .jGraduate_gradPick").hide(),e(l+" .jGraduate_colPick").show()}),e(l+" > div").hide(),Ge.removeClass("jGraduate_tab_current");var Ne=void 0;switch(a.paint.type){case"linearGradient":Ne=e(l+" .jGraduate_tab_lingrad");break;case"radialGradient":Ne=e(l+" .jGraduate_tab_radgrad");break;default:Ne=e(l+" .jGraduate_tab_color")}a.show(),setTimeout(function(){Ne.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Ie(t,n,r,a,l){var u=l||i("stop",{"stop-color":n,"stop-opacity":r,offset:t},S);l?(n=l.getAttribute("stop-color"),r=l.getAttribute("stop-opacity"),t=l.getAttribute("offset")):S.appendChild(u),null===r&&(r=1);var c="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",h=i("path",{d:c,fill:"url(#jGraduate_trans)",transform:"translate("+(10+t*g)+", 26)"},P),f=i("path",{d:c,fill:n,"fill-opacity":r,transform:"translate("+(10+t*g)+", 26)",stroke:"#000","stroke-width":1.5},P);return e(f).mousedown(function(e){return Me(this),Q=W,d.mousemove(Ve).mouseup(Le),Z=X.offset(),e.preventDefault(),!1}).data("stop",u).data("bg",h).dblclick(function(){e("div.jGraduate_LightBox").show();for(var t=this,i=+u.getAttribute("stop-opacity")||1,r=u.getAttribute("stop-color")||1,a=(255*parseFloat(i)).toString(16);a.length<2;)a="0"+a;n=r.substr(1)+a,e("#"+s+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:o.images.clientPath},color:{active:n,alphaSupport:!0}},function(n,a){r=n.val("hex")?"#"+n.val("hex"):"none",i=null!==n.val("a")?n.val("a")/256:1,t.setAttribute("fill",r),t.setAttribute("fill-opacity",i),u.setAttribute("stop-color",r),u.setAttribute("stop-opacity",i),e("div.jGraduate_LightBox").hide(),e("#"+s+"_jGraduate_stopPicker").hide()},null,function(){e("div.jGraduate_LightBox").hide(),e("#"+s+"_jGraduate_stopPicker").hide()})}),e(S).find("stop").each(function(){var i=e(this);if(+this.getAttribute("offset")>t){if(!n){var r=this.getAttribute("stop-color"),a=this.getAttribute("stop-opacity");u.setAttribute("stop-color",r),f.setAttribute("fill",r),u.setAttribute("stop-opacity",null===a?1:a),f.setAttribute("fill-opacity",null===a?1:a)}return i.before(u),!1}}),a&&Me(f),u}function Me(e){W&&W.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),(W=e).parentNode.appendChild(W)}function Le(){d.unbind("mousemove",Ve),"none"!==$.getAttribute("display")&&function(){$.setAttribute("display","none");var t=e(W),n=t.data("stop"),i=t.data("bg");e([W,n,i]).remove()}(),Q=null}function Oe(){var e=ee?"rotate("+ee+","+te+","+ne+") ":"";if(1===K&&1===J)S.removeAttribute("gradientTransform");else{var t=-te*(K-1),n=-ne*(J-1);S.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+K+","+J+")")}}function Ve(t){var n=t.pageX-Z.left,i=t.pageY-Z.top,r="translate("+(n=n<10?10:n>g+10?g+10:n)+", 26)";i<-60||i>130?($.setAttribute("display","block"),$.setAttribute("transform",r)):$.setAttribute("display","none"),Q.setAttribute("transform",r),e.data(Q,"bg").setAttribute("transform",r);var a=e.data(Q,"stop"),o=(n-10)/g;a.setAttribute("offset",o);var s=0;e(S).find("stop").each(function(t){var n=this.getAttribute("offset"),i=e(this);n<s&&(i.prev().before(i),Y=e(S).find("stop")),s=n})}})},e},function(e){return e.loadingStylesheets||(e.loadingStylesheets=[]),e.loadingStylesheets.includes("spinbtn/JQuerySpinBtn.css")||e.loadingStylesheets.push("spinbtn/JQuerySpinBtn.css"),e.fn.SpinButton=function(t){function n(t,n){for(var i=document.body,r=t[n];(t=t.offsetParent)&&t!==i;)e.browser.msie&&"relative"===t.currentStyle.position||(r+=t[n]);return r}return t=t||{},this.each(function(){this.repeating=!1,this.spinCfg={min:isNaN(parseFloat(t.min))?null:Number(t.min),max:isNaN(parseFloat(t.max))?null:Number(t.max),step:t.step?Number(t.step):1,stepfunc:t.stepfunc||!1,page:t.page?Number(t.page):10,upClass:t.upClass||"up",downClass:t.downClass||"down",reset:t.reset||this.value,delay:t.delay?Number(t.delay):500,interval:t.interval?Number(t.interval):100,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:t.callback||null},this.spinCfg.smallStep=t.smallStep||this.spinCfg.step/2,this.adjustValue=function(e){var t=void 0;t=isNaN(this.value)?this.spinCfg.reset:"function"==typeof this.spinCfg.stepfunc?this.spinCfg.stepfunc(this,e):Number((Number(this.value)+Number(e)).toFixed(5)),null!==this.spinCfg.min&&(t=Math.max(t,this.spinCfg.min)),null!==this.spinCfg.max&&(t=Math.min(t,this.spinCfg.max)),this.value=t,"function"==typeof this.spinCfg.callback&&this.spinCfg.callback(this)},e(this).addClass(t.spinClass||"spin-button").mousemove(function(i){var r=i.pageX||i.x,a=i.pageY||i.y,o=i.target,s=t.stateObj.tool_scale||1,l=e(o).height()/2,u=r>n(o,"offsetLeft")+o.offsetWidth*s-this.spinCfg._btn_width?a<n(o,"offsetTop")+l*s?1:-1:0;if(u!==this.spinCfg._direction){switch(u){case 1:e(this).removeClass(this.spinCfg.downClass).addClass(this.spinCfg.upClass);break;case-1:e(this).removeClass(this.spinCfg.upClass).addClass(this.spinCfg.downClass);break;default:e(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass)}this.spinCfg._direction=u}}).mouseout(function(){e(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass),this.spinCfg._direction=null,window.clearInterval(this.spinCfg._repeat),window.clearTimeout(this.spinCfg._delay)}).mousedown(function(e){var t=this;if(0===e.button&&0!==this.spinCfg._direction){var n=e.shiftKey?this.spinCfg.smallStep:this.spinCfg.step,i=function(){t.adjustValue(t.spinCfg._direction*n)};i(),this.spinCfg._delay=window.setTimeout(function(){i(),t.spinCfg._repeat=window.setInterval(i,t.spinCfg.interval)},this.spinCfg.delay)}}).mouseup(function(e){window.clearInterval(this.spinCfg._repeat),window.clearTimeout(this.spinCfg._delay)}).dblclick(function(t){e.browser.msie&&this.adjustValue(this.spinCfg._direction*this.spinCfg.step)}).keydown(function(e){switch(e.keyCode){case 38:this.adjustValue(this.spinCfg.step);break;case 40:this.adjustValue(-this.spinCfg.step);break;case 33:this.adjustValue(this.spinCfg.page);break;case 34:this.adjustValue(-this.spinCfg.page)}}).keypress(function(e){if(this.repeating)switch(e.keyCode){case 38:this.adjustValue(this.spinCfg.step);break;case 40:this.adjustValue(-this.spinCfg.step);break;case 33:this.adjustValue(this.spinCfg.page);break;case 34:this.adjustValue(-this.spinCfg.page)}else this.repeating=!0}).keyup(function(e){switch(this.repeating=!1,e.keyCode){case 38:case 40:case 33:case 34:case 13:this.adjustValue(0)}}).bind("mousewheel",function(e){e.wheelDelta>=120?this.adjustValue(this.spinCfg.step):e.wheelDelta<=-120&&this.adjustValue(-this.spinCfg.step),e.preventDefault()}).change(function(e){this.adjustValue(0)}),this.addEventListener&&this.addEventListener("DOMMouseScroll",function(e){e.detail>0?this.adjustValue(-this.spinCfg.step):e.detail<0&&this.adjustValue(this.spinCfg.step),e.preventDefault()},!1)})},e},D,function(e){var t=e(window),n=e(document);return e.extend(e.fn,{contextMenu:function(i,r){return void 0!==i.menu&&(void 0===i.inSpeed&&(i.inSpeed=150),void 0===i.outSpeed&&(i.outSpeed=75),0===i.inSpeed&&(i.inSpeed=-1),0===i.outSpeed&&(i.outSpeed=-1),e(this).each(function(){var a=e(this),o=e(a).offset(),s=e("#"+i.menu);s.addClass("contextMenu"),e(this).bind("mousedown",function(l){var u=l;e(this).mouseup(function(l){var c=e(this);if(c.unbind("mouseup"),2===u.button||i.allowLeft||u.ctrlKey&&O()){if(l.stopPropagation(),e(".contextMenu").hide(),a.hasClass("disabled"))return!1;var h=l.pageX,d=l.pageY,f=t.width()-s.width(),p=t.height()-s.height();h>f-15&&(h=f-15),d>p-30&&(d=p-30),n.unbind("click"),s.css({top:d,left:h}).fadeIn(i.inSpeed),s.find("A").mouseover(function(){s.find("LI.hover").removeClass("hover"),e(this).parent().addClass("hover")}).mouseout(function(){s.find("LI.hover").removeClass("hover")}),n.keypress(function(e){switch(e.keyCode){case 38:s.find("LI.hover").length?(s.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"),s.find("LI.hover").length||s.find("LI:last").addClass("hover")):s.find("LI:last").addClass("hover");break;case 40:s.find("LI.hover").length?(s.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover"),s.find("LI.hover").length||s.find("LI:first").addClass("hover")):s.find("LI:first").addClass("hover");break;case 13:s.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}}),s.find("A").unbind("mouseup"),s.find("LI:not(.disabled) A").mouseup(function(){return n.unbind("click").unbind("keypress"),e(".contextMenu").hide(),r&&r(e(this).attr("href").substr(1),e(c),{x:h-o.left,y:d-o.top,docX:h,docY:d}),!1}),setTimeout(function(){n.click(function(){return n.unbind("click").unbind("keypress"),s.fadeOut(i.outSpeed),!1})},0)}})}),e.browser.mozilla?e("#"+i.menu).each(function(){e(this).css({MozUserSelect:"none"})}):e.browser.msie?e("#"+i.menu).each(function(){e(this).bind("selectstart.disableTextSelect",function(){return!1})}):e("#"+i.menu).each(function(){e(this).bind("mousedown.disableTextSelect",function(){return!1})}),e(a).add(e("UL.contextMenu")).bind("contextmenu",function(){return!1})}),e(this))},disableContextMenuItems:function(t){return void 0===t?(e(this).find("LI").addClass("disabled"),e(this)):(e(this).each(function(){if(void 0!==t)for(var n=t.split(","),i=0;i<n.length;i++)e(this).find('A[href="'+n[i]+'"]').parent().addClass("disabled")}),e(this))},enableContextMenuItems:function(t){return void 0===t?(e(this).find("LI.disabled").removeClass("disabled"),e(this)):(e(this).each(function(){if(void 0!==t)for(var n=t.split(","),i=0;i<n.length;i++)e(this).find('A[href="'+n[i]+'"]').parent().removeClass("disabled")}),e(this))},disableContextMenu:function(){return e(this).each(function(){e(this).addClass("disabled")}),e(this)},enableContextMenu:function(){return e(this).each(function(){e(this).removeClass("disabled")}),e(this)},destroyContextMenu:function(){return e(this).each(function(){e(this).unbind("mousedown").unbind("mouseup")}),e(this)}}),e},function(e){e.loadingStylesheets||(e.loadingStylesheets=[]);function i(t,n){var i=this;function r(n){var r=t.offset();c={l:0|r.left,t:0|r.top},clearTimeout(h),h=setTimeout(function(){s.call(i,n)},0),e(document).bind("mousemove",a).bind("mouseup",o),n.preventDefault()}function a(e){return clearTimeout(h),h=setTimeout(function(){s.call(i,e)},0),e.stopPropagation(),e.preventDefault(),!1}function o(t){return e(document).unbind("mouseup",o).unbind("mousemove",a),t.stopPropagation(),t.preventDefault(),!1}function s(e){var n=t.w,r=t.h,a=e.pageX-c.l,o=e.pageY-c.t;a<0?a=0:a>n&&(a=n),o<0?o=0:o>r&&(o=r),l.call(i,"xy",{x:a/n*v+p,y:o/r*_+m})}function l(e,t,n){if(void 0===t)switch(void 0!==e&&null!=e||(e="xy"),e.toLowerCase()){case"x":return d;case"y":return f;case"xy":default:return{x:d,y:f}}if(null==n||n!==i){var r=!1,a=void 0,o=void 0;switch(null==e&&(e="xy"),e.toLowerCase()){case"x":a=t&&(t.x&&0|t.x||0|t)||0;break;case"y":o=t&&(t.y&&0|t.y||0|t)||0;break;case"xy":default:a=t&&t.x&&0|t.x||0,o=t&&t.y&&0|t.y||0}null!=a&&(a<p?a=p:a>g&&(a=g),d!==a&&(d=a,r=!0)),null!=o&&(o<m?o=m:o>y&&(o=y),f!==o&&(f=o,r=!0)),r&&function(e){for(var t=0;t<x.length;t++)x[t].call(i,i,e)}.call(i,n||i)}}function u(e){"function"==typeof e&&x.push(e)}var c=void 0,h=void 0,d=0,f=0,p=0,g=100,v=100,m=0,y=100,_=100,b=t.find("img:first"),x=[];e.extend(!0,i,{val:l,range:function(e,t){if(void 0===t)switch(void 0!==e&&null!=e||(e="all"),e.toLowerCase()){case"minx":return p;case"maxx":return g;case"rangex":return{minX:p,maxX:g,rangeX:v};case"miny":return m;case"maxy":return y;case"rangey":return{minY:m,maxY:y,rangeY:_};case"all":default:return{minX:p,maxX:g,rangeX:v,minY:m,maxY:y,rangeY:_}}var n=void 0,i=void 0,r=void 0,a=void 0;switch(null==e&&(e="all"),e.toLowerCase()){case"minx":n=t&&(t.minX&&0|t.minX||0|t)||0;break;case"maxx":i=t&&(t.maxX&&0|t.maxX||0|t)||0;break;case"rangex":n=t&&t.minX&&0|t.minX||0,i=t&&t.maxX&&0|t.maxX||0;break;case"miny":r=t&&(t.minY&&0|t.minY||0|t)||0;break;case"maxy":a=t&&(t.maxY&&0|t.maxY||0|t)||0;break;case"rangey":r=t&&t.minY&&0|t.minY||0,a=t&&t.maxY&&0|t.maxY||0;break;case"all":default:n=t&&t.minX&&0|t.minX||0,i=t&&t.maxX&&0|t.maxX||0,r=t&&t.minY&&0|t.minY||0,a=t&&t.maxY&&0|t.maxY||0}null!=n&&p!==n&&(v=g-(p=n)),null!=i&&g!==i&&(v=(g=i)-p),null!=r&&m!==r&&(_=y-(m=r)),null!=a&&y!==a&&(_=(y=a)-m)},bind:u,unbind:function(e){if("function"==typeof e)for(var t=void 0;t=x.includes(e);)x.splice(t,1)},destroy:function(){e(document).unbind("mouseup",o).unbind("mousemove",a),t.unbind("mousedown",r),t=null,b=null,x=null}}),b.src=n.arrow&&n.arrow.image,b.w=n.arrow&&n.arrow.width||b.width(),b.h=n.arrow&&n.arrow.height||b.height(),t.w=n.map&&n.map.width||t.width(),t.h=n.map&&n.map.height||t.height(),t.bind("mousedown",r),u.call(i,function(){var e=t.w,n=t.h,i=b.w,r=b.h,a=0,o=0;setTimeout(function(){v>0&&(a=d===g?e:d/v*e|0),_>0&&(o=f===y?n:f/_*n|0),i>=e?a=(e>>1)-(i>>1):a-=i>>1,r>=n?o=(n>>1)-(r>>1):o-=r>>1,b.css({left:a+"px",top:o+"px"})},0)})}e.loadingStylesheets.includes("jgraduate/css/jPicker.css")||e.loadingStylesheets.push("jgraduate/css/jPicker.css"),e.jPicker={List:[],Color:function t(i){n(this,t);var r=this;function a(e){for(var t=0;t<g.length;t++)g[t].call(r,r,e)}function o(e,t,n){var i=Boolean(t);if(i&&""===t.ahex&&(t.ahex="00000000"),!i){if(void 0!==e&&null!=e&&""!==e||(e="all"),null==l)return null;switch(e.toLowerCase()){case"ahex":return s.rgbaToHex({r:l,g:u,b:c,a:h});case"hex":return o("ahex").substring(0,6);case"all":return{r:l,g:u,b:c,a:h,h:d,s:f,v:p,hex:o.call(r,"hex"),ahex:o.call(r,"ahex")};default:for(var g={},v=0;v<e.length;v++)switch(e.charAt(v)){case"r":1===e.length?g=l:g.r=l;break;case"g":1===e.length?g=u:g.g=u;break;case"b":1===e.length?g=c:g.b=c;break;case"a":1===e.length?g=h:g.a=h;break;case"h":1===e.length?g=d:g.h=d;break;case"s":1===e.length?g=f:g.s=f;break;case"v":1===e.length?g=p:g.v=p}return e.length?g:o.call(r,"all")}}if(null==n||n!==r){null==e&&(e="");var m=!1;if(null==t)return null!=l&&(l=null,m=!0),null!=u&&(u=null,m=!0),null!=c&&(c=null,m=!0),null!=h&&(h=null,m=!0),null!=d&&(d=null,m=!0),null!=f&&(f=null,m=!0),null!=p&&(p=null,m=!0),void(m&&a.call(r,n||r));switch(e.toLowerCase()){case"ahex":case"hex":var y=s.hexToRgba(t&&(t.ahex||t.hex)||t||"none");o.call(r,"rgba",{r:y.r,g:y.g,b:y.b,a:"ahex"===e?y.a:null!=h?h:255},n);break;default:if(t&&(null!=t.ahex||null!=t.hex))return void o.call(r,"ahex",t.ahex||t.hex||"00000000",n);var _={},b=!1,x=!1;void 0===t.r||e.includes("r")||(e+="r"),void 0===t.g||e.includes("g")||(e+="g"),void 0===t.b||e.includes("b")||(e+="b"),void 0===t.a||e.includes("a")||(e+="a"),void 0===t.h||e.includes("h")||(e+="h"),void 0===t.s||e.includes("s")||(e+="s"),void 0===t.v||e.includes("v")||(e+="v");for(var w=0;w<e.length;w++)switch(e.charAt(w)){case"r":if(x)continue;b=!0,_.r=t&&t.r&&0|t.r||t&&0|t||0,_.r<0?_.r=0:_.r>255&&(_.r=255),l!==_.r&&(l=_.r,m=!0);break;case"g":if(x)continue;b=!0,_.g=t&&t.g&&0|t.g||t&&0|t||0,_.g<0?_.g=0:_.g>255&&(_.g=255),u!==_.g&&(u=_.g,m=!0);break;case"b":if(x)continue;b=!0,_.b=t&&t.b&&0|t.b||t&&0|t||0,_.b<0?_.b=0:_.b>255&&(_.b=255),c!==_.b&&(c=_.b,m=!0);break;case"a":_.a=t&&null!=t.a?0|t.a:null!=t?0|t:255,_.a<0?_.a=0:_.a>255&&(_.a=255),h!==_.a&&(h=_.a,m=!0);break;case"h":if(b)continue;x=!0,_.h=t&&t.h&&0|t.h||t&&0|t||0,_.h<0?_.h=0:_.h>360&&(_.h=360),d!==_.h&&(d=_.h,m=!0);break;case"s":if(b)continue;x=!0,_.s=t&&null!=t.s?0|t.s:null!=t?0|t:100,_.s<0?_.s=0:_.s>100&&(_.s=100),f!==_.s&&(f=_.s,m=!0);break;case"v":if(b)continue;x=!0,_.v=t&&null!=t.v?0|t.v:null!=t?0|t:100,_.v<0?_.v=0:_.v>100&&(_.v=100),p!==_.v&&(p=_.v,m=!0)}if(m){if(b){l=l||0,u=u||0,c=c||0;var S=s.rgbToHsv({r:l,g:u,b:c});d=S.h,f=S.s,p=S.v}else if(x){d=d||0,f=null!=f?f:100,p=null!=p?p:100;var k=s.hsvToRgb({h:d,s:f,v:p});l=k.r,u=k.g,c=k.b}h=null!=h?h:255,a.call(r,n||r)}}}}var l=void 0,u=void 0,c=void 0,h=void 0,d=void 0,f=void 0,p=void 0,g=[];e.extend(!0,r,{val:o,bind:function(e){"function"==typeof e&&g.push(e)},unbind:function(e){if("function"==typeof e)for(var t=void 0;t=g.includes(e);)g.splice(t,1)},destroy:function(){g=null}}),i&&(null!=i.ahex?o("ahex",i):null!=i.hex?o((null!=i.a?"a":"")+"hex",null!=i.a?{ahex:i.hex+s.intToHex(i.a)}:i):null!=i.r&&null!=i.g&&null!=i.b?o("rgb"+(null!=i.a?"a":""),i):null!=i.h&&null!=i.s&&null!=i.v&&o("hsv"+(null!=i.a?"a":""),i))},ColorMethods:{hexToRgba:function(e){if(""===e||"none"===e)return{r:null,g:null,b:null,a:null};var t="00",n="00",i="00",r="255";return 6===(e=this.validateHex(e)).length&&(e+="ff"),e.length>6?(t=e.substring(0,2),n=e.substring(2,4),i=e.substring(4,6),r=e.substring(6,e.length)):(e.length>4&&(t=e.substring(4,e.length),e=e.substring(0,4)),e.length>2&&(n=e.substring(2,e.length),e=e.substring(0,2)),e.length>0&&(i=e.substring(0,e.length))),{r:this.hexToInt(t),g:this.hexToInt(n),b:this.hexToInt(i),a:this.hexToInt(r)}},validateHex:function(e){return(e=e.toLowerCase().replace(/[^a-f0-9]/g,"")).length>8&&(e=e.substring(0,8)),e},rgbaToHex:function(e){return this.intToHex(e.r)+this.intToHex(e.g)+this.intToHex(e.b)+this.intToHex(e.a)},intToHex:function(e){var t=(0|e).toString(16);return 1===t.length&&(t="0"+t),t.toLowerCase()},hexToInt:function(e){return parseInt(e,16)},rgbToHsv:function(e){var t=e.r/255,n=e.g/255,i=e.b/255,r={h:0,s:0,v:0},a=0,o=0;t>=n&&t>=i?(o=t,a=n>i?i:n):n>=i&&n>=t?(o=n,a=t>i?i:t):(o=i,a=n>t?t:n),r.v=o,r.s=o?(o-a)/o:0;var s=void 0;return r.s?(s=o-a,r.h=t===o?(n-i)/s:n===o?2+(i-t)/s:4+(t-n)/s,r.h=parseInt(60*r.h),r.h<0&&(r.h+=360)):r.h=0,r.s=100*r.s|0,r.v=100*r.v|0,r},hsvToRgb:function(e){var t={r:0,g:0,b:0,a:100},n=e.h,i=e.s,r=e.v;if(0===i)t.r=t.g=t.b=0===r?0:255*r/100|0;else{360===n&&(n=0);var a=0|(n/=60),o=n-a,s=(r/=100)*(1-(i/=100)),l=r*(1-i*o),u=r*(1-i*(1-o));switch(a){case 0:t.r=r,t.g=u,t.b=s;break;case 1:t.r=l,t.g=r,t.b=s;break;case 2:t.r=s,t.g=r,t.b=u;break;case 3:t.r=s,t.g=l,t.b=r;break;case 4:t.r=u,t.g=s,t.b=r;break;case 5:t.r=r,t.g=s,t.b=l}t.r=255*t.r|0,t.g=255*t.g|0,t.b=255*t.b|0}return t}}};var r=e.jPicker,a=r.Color,o=r.List,s=r.ColorMethods;return e.fn.jPicker=function(n){var r=arguments;return this.each(function(){var l=this,u=e.extend(!0,{},e.fn.jPicker.defaults,n);"input"===e(l).get(0).nodeName.toLowerCase()&&(e.extend(!0,u,{window:{bindToInput:!0,expandable:!0,input:e(l)}}),""===e(l).val()?(u.color.active=new a({hex:null}),u.color.current=new a({hex:null})):s.validateHex(e(l).val())&&(u.color.active=new a({hex:e(l).val(),a:u.color.active.val("a")}),u.color.current=new a({hex:e(l).val(),a:u.color.active.val("a")}))),u.window.expandable?e(l).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>'):u.window.liveUpdate=!1;var c=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function h(e){var t=V.active,n=t.val("hex"),i=void 0,r=void 0;switch(u.color.mode=e,e){case"h":if(setTimeout(function(){g.call(l,U,"transparent"),m.call(l,H,0),y.call(l,H,100),m.call(l,q,260),y.call(l,q,100),g.call(l,z,"transparent"),m.call(l,Y,0),y.call(l,Y,100),m.call(l,W,260),y.call(l,W,100),m.call(l,Q,260),y.call(l,Q,100),m.call(l,$,260),y.call(l,$,100),m.call(l,K,260),y.call(l,K,100)},0),J.range("all",{minX:0,maxX:100,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:360}),null==t.val("ahex"))break;J.val("xy",{x:t.val("s"),y:100-t.val("v")},J),ee.val("y",360-t.val("h"),ee);break;case"s":if(setTimeout(function(){g.call(l,U,"transparent"),m.call(l,H,-260),m.call(l,q,-520),m.call(l,Y,-260),m.call(l,W,-520),m.call(l,K,260),y.call(l,K,100)},0),J.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;J.val("xy",{x:t.val("h"),y:100-t.val("v")},J),ee.val("y",100-t.val("s"),ee);break;case"v":if(setTimeout(function(){g.call(l,U,"000000"),m.call(l,H,-780),m.call(l,q,260),g.call(l,z,n),m.call(l,Y,-520),m.call(l,W,260),y.call(l,W,100),m.call(l,K,260),y.call(l,K,100)},0),J.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;J.val("xy",{x:t.val("h"),y:100-t.val("s")},J),ee.val("y",100-t.val("v"),ee);break;case"r":if(i=-1040,r=-780,J.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("b"),y:255-t.val("g")},J),ee.val("y",255-t.val("r"),ee);break;case"g":if(i=-1560,r=-1820,J.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("b"),y:255-t.val("r")},J),ee.val("y",255-t.val("g"),ee);break;case"b":if(i=-2080,r=-2860,J.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("r"),y:255-t.val("g")},J),ee.val("y",255-t.val("b"),ee);break;case"a":if(setTimeout(function(){g.call(l,U,"transparent"),m.call(l,H,-260),m.call(l,q,-520),m.call(l,Y,260),m.call(l,W,260),y.call(l,W,100),m.call(l,K,0),y.call(l,K,100)},0),J.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("h"),y:100-t.val("v")},J),ee.val("y",255-t.val("a"),ee);break;default:throw new Error("Invalid Mode")}switch(e){case"h":break;case"s":case"v":case"a":setTimeout(function(){y.call(l,H,100),y.call(l,Y,100),m.call(l,Q,260),y.call(l,Q,100),m.call(l,$,260),y.call(l,$,100)},0);break;case"r":case"g":case"b":setTimeout(function(){g.call(l,U,"transparent"),g.call(l,z,"transparent"),y.call(l,Y,100),y.call(l,H,100),m.call(l,H,i),m.call(l,q,i-260),m.call(l,Y,r-780),m.call(l,W,r-520),m.call(l,Q,r),m.call(l,$,r-260),m.call(l,K,260),y.call(l,K,100)},0)}null!=t.val("ahex")&&d.call(l,t)}function d(e,t){(null==t||t!==ee&&t!==J)&&function(e,t){if(t!==J)switch(u.color.mode){case"h":var n=e.val("sv");J.val("xy",{x:null!=n?n.s:100,y:100-(null!=n?n.v:100)},t);break;case"s":case"a":var i=e.val("hv");J.val("xy",{x:i&&i.h||0,y:100-(null!=i?i.v:100)},t);break;case"v":var r=e.val("hs");J.val("xy",{x:r&&r.h||0,y:100-(null!=r?r.s:100)},t);break;case"r":var a=e.val("bg");J.val("xy",{x:a&&a.b||0,y:255-(a&&a.g||0)},t);break;case"g":var o=e.val("br");J.val("xy",{x:o&&o.b||0,y:255-(o&&o.r||0)},t);break;case"b":var s=e.val("rg");J.val("xy",{x:s&&s.r||0,y:255-(s&&s.g||0)},t)}if(t!==ee)switch(u.color.mode){case"h":ee.val("y",360-(e.val("h")||0),t);break;case"s":var l=e.val("s");ee.val("y",100-(null!=l?l:100),t);break;case"v":var c=e.val("v");ee.val("y",100-(null!=c?c:100),t);break;case"r":ee.val("y",255-(e.val("r")||0),t);break;case"g":ee.val("y",255-(e.val("g")||0),t);break;case"b":ee.val("y",255-(e.val("b")||0),t);break;case"a":var h=e.val("a");ee.val("y",255-(null!=h?h:255),t)}}.call(l,e,t),setTimeout(function(){(function(e){try{var t=e.val("all");ne.css({backgroundColor:t&&"#"+t.hex||"transparent"}),y.call(l,ne,t&&Math.precision(100*t.a/255,4)||0)}catch(e){}}).call(l,e),function(e){switch(u.color.mode){case"h":g.call(l,U,new a({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");y.call(l,q,100-(null!=t?t:100));break;case"v":var n=e.val("v");y.call(l,H,null!=n?n:100);break;case"r":y.call(l,q,Math.precision((e.val("r")||0)/255*100,4));break;case"g":y.call(l,q,Math.precision((e.val("g")||0)/255*100,4));break;case"b":y.call(l,q,Math.precision((e.val("b")||0)/255*100))}var i=e.val("a");y.call(l,X,Math.precision(100*(255-(i||0))/255,4))}.call(l,e),function(e){switch(u.color.mode){case"h":var t=e.val("a");y.call(l,Z,Math.precision(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),i=new a({h:n&&n.h||0,s:100,v:null!=n?n.v:100});g.call(l,z,i.val("hex")),y.call(l,W,100-(null!=n?n.v:100)),y.call(l,Z,Math.precision(100*(255-(n&&n.a||0))/255,4));break;case"v":var r=e.val("hsa"),o=new a({h:r&&r.h||0,s:null!=r?r.s:100,v:100});g.call(l,z,o.val("hex")),y.call(l,Z,Math.precision(100*(255-(r&&r.a||0))/255,4));break;case"r":case"g":case"b":var s=e.val("rgba"),c=0,h=0;"r"===u.color.mode?(c=s&&s.b||0,h=s&&s.g||0):"g"===u.color.mode?(c=s&&s.b||0,h=s&&s.r||0):"b"===u.color.mode&&(c=s&&s.r||0,h=s&&s.g||0);var d=h>c?c:h;y.call(l,W,c>h?Math.precision((c-h)/(255-h)*100,4):0),y.call(l,Q,h>c?Math.precision((h-c)/(255-c)*100,4):0),y.call(l,$,Math.precision(d/255*100,4)),y.call(l,Z,Math.precision(100*(255-(s&&s.a||0))/255,4));break;case"a":var f=e.val("a");g.call(l,z,e.val("hex")||"000000"),y.call(l,Z,null!=f?0:100),y.call(l,K,null!=f?100:0)}}.call(l,e)},0)}function f(e,t){var n=V.active;if(t===J||null!=n.val()){var i=e.val("all");switch(u.color.mode){case"h":n.val("sv",{s:i.x,v:100-i.y},t);break;case"s":case"a":n.val("hv",{h:i.x,v:100-i.y},t);break;case"v":n.val("hs",{h:i.x,s:100-i.y},t);break;case"r":n.val("gb",{g:255-i.y,b:i.x},t);break;case"g":n.val("rb",{r:255-i.y,b:i.x},t);break;case"b":n.val("rg",{r:i.x,g:255-i.y},t)}}}function p(e,t){var n=V.active;if(t===ee||null!=n.val())switch(u.color.mode){case"h":n.val("h",{h:360-e.val("y")},t);break;case"s":n.val("s",{s:100-e.val("y")},t);break;case"v":n.val("v",{v:100-e.val("y")},t);break;case"r":n.val("r",{r:255-e.val("y")},t);break;case"g":n.val("g",{g:255-e.val("y")},t);break;case"b":n.val("b",{b:255-e.val("y")},t);break;case"a":n.val("a",255-e.val("y"),t)}}function g(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function v(e,t){c&&(t.includes("AlphaBar.png")||t.includes("Bars.png")||t.includes("Maps.png"))?(e.attr("pngSrc",t),e.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+t+"', sizingMethod='scale')"})):e.css({backgroundImage:"url('"+t+"')"})}function m(e,t){e.css({top:t+"px"})}function y(e,t){if(e.css({visibility:t>0?"visible":"hidden"}),t>0&&t<100)if(c){var n=e.attr("pngSrc");null!=n&&(n.includes("AlphaBar.png")||n.includes("Bars.png")||n.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+n+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+t+")"}):e.css({opacity:Math.precision(t/100,4)})}else e.css({opacity:Math.precision(t/100,4)});else if(0===t||100===t)if(c){var i=e.attr("pngSrc");null!=i&&(i.includes("AlphaBar.png")||i.includes("Bars.png")||i.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+i+"', sizingMethod='scale')"}):e.css({opacity:""})}else e.css({opacity:""})}function _(){V.active.val("ahex",V.current.val("ahex"))}function b(t){e(this).parents("tbody:first").find('input:radio[value!="'+t.target.value+'"]').removeAttr("checked"),h.call(l,t.target.value)}function x(){_.call(l)}function w(){_.call(l),u.window.expandable&&I.call(l),"function"==typeof fe&&fe.call(l,V.active,ae)}function S(){(function(){V.current.val("ahex",V.active.val("ahex"))}).call(l),u.window.expandable&&I.call(l),"function"==typeof he&&he.call(l,V.active,re)}function k(){N.call(l)}function C(e,t){var n=e.val("hex");ie.css({backgroundColor:n&&"#"+n||"transparent"}),y.call(l,ie,Math.precision(100*(e.val("a")||0)/255,4))}function P(e,t){var n=e.val("hex"),i=e.val("va");se.css({backgroundColor:n&&"#"+n||"transparent"}),y.call(l,le,Math.precision(100*(255-(i&&i.a||0))/255,4)),u.window.bindToInput&&u.window.updateInputColor&&u.window.input.css({backgroundColor:n&&"#"+n||"transparent",color:null==i||i.v>75?"#000000":"#ffffff"})}function A(t){j=parseInt(F.css("left")),B=parseInt(F.css("top")),R=t.pageX,D=t.pageY,e(document).bind("mousemove",E).bind("mouseup",T),t.preventDefault()}function E(t){return F.css({left:j-(R-t.pageX)+"px",top:B-(D-t.pageY)+"px"}),u.window.expandable&&!e.support.boxModel&&F.prev().css({left:F.css("left"),top:F.css("top")}),t.stopPropagation(),t.preventDefault(),!1}function T(t){return e(document).unbind("mousemove",E).unbind("mouseup",T),t.stopPropagation(),t.preventDefault(),!1}function G(t){return t.preventDefault(),t.stopPropagation(),V.active.val("ahex",e(this).attr("title")||null,t.target),!1}function N(){function t(){if(u.window.expandable&&!e.support.boxModel){var t=F.find("table:first");F.before("<iframe/>"),F.prev().css({width:t.width(),height:F.height(),opacity:0,position:"absolute",left:F.css("left"),top:F.css("top")})}}switch(V.current.val("ahex",V.active.val("ahex")),u.window.expandable&&(e(document.body).children("div.jPicker.Container").css({zIndex:10}),F.css({zIndex:20})),u.window.effects.type){case"fade":F.fadeIn(u.window.effects.speed.show,t);break;case"slide":F.slideDown(u.window.effects.speed.show,t);break;case"show":default:F.show(u.window.effects.speed.show,t)}}function I(){function t(){u.window.expandable&&F.css({zIndex:10}),u.window.expandable&&!e.support.boxModel&&F.prev().remove()}switch(u.window.effects.type){case"fade":F.fadeOut(u.window.effects.speed.hide,t);break;case"slide":F.slideUp(u.window.effects.speed.hide,t);break;case"show":default:F.hide(u.window.effects.speed.hide,t)}}function M(){var n=u.window,r=n.expandable?e(l).next().find(".Container:first"):null;(F=n.expandable?e("<div/>"):e(l)).addClass("jPicker Container"),n.expandable&&F.hide(),F.get(0).onselectstart=function(e){if("input"!==e.target.nodeName.toLowerCase())return!1};var o=V.active.val("all");n.alphaPrecision<0?n.alphaPrecision=0:n.alphaPrecision>2&&(n.alphaPrecision=2);var s='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(n.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(n.title||O.text.title)+'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+L.clientPath+L.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+L.clientPath+L.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview">'+O.text.newColor+'<div><span class="Active" title="'+O.tooltips.colors.newColor+'">&nbsp;</span><span class="Current" title="'+O.tooltips.colors.currentColor+'">&nbsp;</span></div>'+O.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+O.text.ok+'" title="'+O.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+O.text.cancel+'" title="'+O.tooltips.buttons.cancel+'"/><hr/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label title="'+O.tooltips.hue.radio+'"><input type="radio" value="h"'+("h"===u.color.mode?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.h:"")+'" title="'+O.tooltips.hue.textbox+'"/>&nbsp;&deg;</td></tr><tr class="Saturation"><td class="Radio"><label title="'+O.tooltips.saturation.radio+'"><input type="radio" value="s"'+("s"===u.color.mode?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.s:"")+'" title="'+O.tooltips.saturation.textbox+'"/>&nbsp;%</td></tr><tr class="Value"><td class="Radio"><label title="'+O.tooltips.value.radio+'"><input type="radio" value="v"'+("v"===u.color.mode?' checked="checked"':"")+'/>V:</label><br/><br/></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.v:"")+'" title="'+O.tooltips.value.textbox+'"/>&nbsp;%<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+O.tooltips.red.radio+'"><input type="radio" value="r"'+("r"===u.color.mode?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.r:"")+'" title="'+O.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+O.tooltips.green.radio+'"><input type="radio" value="g"'+("g"===u.color.mode?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.g:"")+'" title="'+O.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+O.tooltips.blue.radio+'"><input type="radio" value="b"'+("b"===u.color.mode?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.b:"")+'" title="'+O.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(n.alphaSupport?'<label title="'+O.tooltips.alpha.radio+'"><input type="radio" value="a"'+("a"===u.color.mode?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td><td class="Text">'+(n.alphaSupport?'<input type="text" maxlength="'+(3+n.alphaPrecision)+'" value="'+(null!=o?Math.precision(100*o.a/255,n.alphaPrecision):"")+'" title="'+O.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+O.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(null!=o?o.hex:"")+'"/></label>'+(n.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(null!=o?o.ahex.substring(6):"")+'" title="'+O.tooltips.hex.alpha+'"/></td>':"&nbsp;")+"</tr></tbody></table>";n.expandable?(F.html(s),e(document.body).children("div.jPicker.Container").length?e(document.body).children("div.jPicker.Container:last").after(F):e(document.body).prepend(F),F.mousedown(function(){e(document.body).children("div.jPicker.Container").css({zIndex:10}),F.css({zIndex:20})}),F.css({left:"left"===n.position.x?r.offset().left-530-("center"===n.position.y?25:0)+"px":"center"===n.position.x?r.offset().left-260+"px":"right"===n.position.x?r.offset().left-10+("center"===n.position.y?25:0)+"px":"screenCenter"===n.position.x?(e(document).width()>>1)-260+"px":r.offset().left+parseInt(n.position.x)+"px",position:"absolute",top:"top"===n.position.y?r.offset().top-312+"px":"center"===n.position.y?r.offset().top-156+"px":"bottom"===n.position.y?r.offset().top+25+"px":r.offset().top+parseInt(n.position.y)+"px"})):(F=e(l)).html(s);var c=F.find("tbody:first");U=c.find("div.Map:first"),z=c.find("div.Bar:first");var g=U.find("span"),m=z.find("span");H=g.filter(".Map1:first"),q=g.filter(".Map2:first"),X=g.filter(".Map3:first"),Y=m.filter(".Map1:first"),W=m.filter(".Map2:first"),Q=m.filter(".Map3:first"),$=m.filter(".Map4:first"),Z=m.filter(".Map5:first"),K=m.filter(".Map6:first"),(J=new i(U,{map:{width:L.colorMap.width,height:L.colorMap.height},arrow:{image:L.clientPath+L.colorMap.arrow.file,width:L.colorMap.arrow.width,height:L.colorMap.arrow.height}})).bind(f),(ee=new i(z,{map:{width:L.colorBar.width,height:L.colorBar.height},arrow:{image:L.clientPath+L.colorBar.arrow.file,width:L.colorBar.arrow.width,height:L.colorBar.arrow.height}})).bind(p),te=new function(t,n,i,r){var a=this,o=t.find("td.Text input");function s(e){if(""!==e.target.value||e.target===b.get(0)||(null==i||e.target===i.get(0))&&null!=i){if(!c(e))return e;switch(e.target){case f.get(0):switch(e.keyCode){case 38:return f.val(h.call(a,1+(f.val()<<0),0,255)),n.val("r",f.val(),e.target),!1;case 40:return f.val(h.call(a,(f.val()<<0)-1,0,255)),n.val("r",f.val(),e.target),!1}break;case p.get(0):switch(e.keyCode){case 38:return p.val(h.call(a,1+(p.val()<<0),0,255)),n.val("g",p.val(),e.target),!1;case 40:return p.val(h.call(a,(p.val()<<0)-1,0,255)),n.val("g",p.val(),e.target),!1}break;case g.get(0):switch(e.keyCode){case 38:return g.val(h.call(a,1+(g.val()<<0),0,255)),n.val("b",g.val(),e.target),!1;case 40:return g.val(h.call(a,(g.val()<<0)-1,0,255)),n.val("b",g.val(),e.target),!1}break;case v&&v.get(0):switch(e.keyCode){case 38:return v.val(h.call(a,parseFloat(v.val())+1,0,100)),n.val("a",Math.precision(255*v.val()/100,r),e.target),!1;case 40:return v.val(h.call(a,parseFloat(v.val())-1,0,100)),n.val("a",Math.precision(255*v.val()/100,r),e.target),!1}break;case m.get(0):switch(e.keyCode){case 38:return m.val(h.call(a,1+(m.val()<<0),0,360)),n.val("h",m.val(),e.target),!1;case 40:return m.val(h.call(a,(m.val()<<0)-1,0,360)),n.val("h",m.val(),e.target),!1}break;case y.get(0):switch(e.keyCode){case 38:return y.val(h.call(a,1+(y.val()<<0),0,100)),n.val("s",y.val(),e.target),!1;case 40:return y.val(h.call(a,(y.val()<<0)-1,0,100)),n.val("s",y.val(),e.target),!1}break;case _.get(0):switch(e.keyCode){case 38:return _.val(h.call(a,1+(_.val()<<0),0,100)),n.val("v",_.val(),e.target),!1;case 40:return _.val(h.call(a,(_.val()<<0)-1,0,100)),n.val("v",_.val(),e.target),!1}}}}function l(e){if(""!==e.target.value||e.target===b.get(0)||(null==i||e.target===i.get(0))&&null!=i){if(!c(e))return e;switch(e.target){case f.get(0):f.val(h.call(a,f.val(),0,255)),n.val("r",f.val(),e.target);break;case p.get(0):p.val(h.call(a,p.val(),0,255)),n.val("g",p.val(),e.target);break;case g.get(0):g.val(h.call(a,g.val(),0,255)),n.val("b",g.val(),e.target);break;case v&&v.get(0):v.val(h.call(a,v.val(),0,100)),n.val("a",Math.precision(255*v.val()/100,r),e.target);break;case m.get(0):m.val(h.call(a,m.val(),0,360)),n.val("h",m.val(),e.target);break;case y.get(0):y.val(h.call(a,y.val(),0,100)),n.val("s",y.val(),e.target);break;case _.get(0):_.val(h.call(a,_.val(),0,100)),n.val("v",_.val(),e.target);break;case b.get(0):b.val(b.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),i&&i.val(b.val()),n.val("hex",""!==b.val()?b.val():null,e.target);break;case i&&i.get(0):i.val(i.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),b.val(i.val()),n.val("hex",""!==i.val()?i.val():null,e.target);break;case x&&x.get(0):x.val(x.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2)),n.val("a",null!=x.val()?parseInt(x.val(),16):null,e.target)}}}function u(e){if(null!=n.val())switch(e.target){case f.get(0):f.val(n.val("r"));break;case p.get(0):p.val(n.val("g"));break;case g.get(0):g.val(n.val("b"));break;case v&&v.get(0):v.val(Math.precision(100*n.val("a")/255,r));break;case m.get(0):m.val(n.val("h"));break;case y.get(0):y.val(n.val("s"));break;case _.get(0):_.val(n.val("v"));break;case b.get(0):case i&&i.get(0):b.val(n.val("hex")),i&&i.val(n.val("hex"));break;case x&&x.get(0):x.val(n.val("ahex").substring(6))}}function c(e){switch(e.keyCode){case 9:case 16:case 29:case 37:case 39:return!1;case"c".charCodeAt():case"v".charCodeAt():if(e.ctrlKey)return!1}return!0}function h(e,t,n){return""===e||isNaN(e)?t:e>n?n:e<t?t:e}function d(e,t){var n=e.val("all");t!==f.get(0)&&f.val(null!=n?n.r:""),t!==p.get(0)&&p.val(null!=n?n.g:""),t!==g.get(0)&&g.val(null!=n?n.b:""),v&&t!==v.get(0)&&v.val(null!=n?Math.precision(100*n.a/255,r):""),t!==m.get(0)&&m.val(null!=n?n.h:""),t!==y.get(0)&&y.val(null!=n?n.s:""),t!==_.get(0)&&_.val(null!=n?n.v:""),t!==b.get(0)&&(i&&t!==i.get(0)||!i)&&b.val(null!=n?n.hex:""),i&&t!==i.get(0)&&t!==b.get(0)&&i.val(null!=n?n.hex:""),x&&t!==x.get(0)&&x.val(null!=n?n.ahex.substring(6):"")}var f=o.eq(3),p=o.eq(4),g=o.eq(5),v=o.length>7?o.eq(6):null,m=o.eq(0),y=o.eq(1),_=o.eq(2),b=o.eq(o.length>7?7:6),x=o.length>7?o.eq(8):null;e.extend(!0,a,{destroy:function(){f.add(p).add(g).add(v).add(m).add(y).add(_).add(b).add(i).add(x).unbind("keyup",l).unbind("blur",u),f.add(p).add(g).add(v).add(m).add(y).add(_).unbind("keydown",s),n.unbind(d),f=null,p=null,g=null,v=null,m=null,y=null,_=null,b=null,x=null}}),f.add(p).add(g).add(v).add(m).add(y).add(_).add(b).add(i).add(x).bind("keyup",l).bind("blur",u),f.add(p).add(g).add(v).add(m).add(y).add(_).bind("keydown",s),n.bind(d)}(c,V.active,n.expandable&&n.bindToInput?n.input:null,n.alphaPrecision);var _=null!=o?o.hex:null,E=c.find(".Preview"),T=c.find(".Button");if(ne=E.find(".Active:first").css({backgroundColor:_&&"#"+_||"transparent"}),ie=E.find(".Current:first").css({backgroundColor:_&&"#"+_||"transparent"}).bind("click",x),y.call(l,ie,Math.precision(100*V.current.val("a"))/255,4),re=T.find(".Ok:first").bind("click",S),ae=T.find(".Cancel:first").bind("click",w),oe=T.find(".Grid:first"),setTimeout(function(){v.call(l,H,L.clientPath+"Maps.png"),v.call(l,q,L.clientPath+"Maps.png"),v.call(l,X,L.clientPath+"map-opacity.png"),v.call(l,Y,L.clientPath+"Bars.png"),v.call(l,W,L.clientPath+"Bars.png"),v.call(l,Q,L.clientPath+"Bars.png"),v.call(l,$,L.clientPath+"Bars.png"),v.call(l,Z,L.clientPath+"bar-opacity.png"),v.call(l,K,L.clientPath+"AlphaBar.png"),v.call(l,E.find("div:first"),L.clientPath+"preview-opacity.png")},0),c.find("td.Radio input").bind("click",b),V.quickList&&V.quickList.length>0){for(var I="",M=0;M<V.quickList.length;M++){"string"===t(V.quickList[M]).toString().toLowerCase()&&(V.quickList[M]=new a({hex:V.quickList[M]}));var j=V.quickList[M].val("a"),B=V.quickList[M].val("ahex");!n.alphaSupport&&B&&(B=B.substring(0,6)+"ff");var R=V.quickList[M].val("hex");B||(B="00000000"),I+='<span class="QuickColor"'+(B&&' title="#'+B+'"'||"none")+' style="background-color:'+(R&&"#"+R||"")+";"+(R?"":"background-image:url("+L.clientPath+"NoColor.png)")+(n.alphaSupport&&j&&j<255?";opacity:"+Math.precision(j/255,4)+";filter:Alpha(opacity="+Math.precision(j/2.55,4)+")":"")+'">&nbsp;</span>'}v.call(l,oe,L.clientPath+"bar-opacity.png"),oe.html(I),oe.find(".QuickColor").click(G)}h.call(l,u.color.mode),V.active.bind(d),"function"==typeof de&&V.active.bind(de),V.current.bind(C),n.expandable?(l.icon=r.parents(".Icon:first"),se=l.icon.find(".Color:first").css({backgroundColor:_&&"#"+_||"transparent"}),le=l.icon.find(".Alpha:first"),v.call(l,le,L.clientPath+"bar-opacity.png"),y.call(l,le,Math.precision(100*(255-(null!=o?o.a:0))/255,4)),ue=l.icon.find(".Image:first").css({backgroundImage:"url('"+L.clientPath+L.picker.file+"')"}).bind("click",k),n.bindToInput&&n.updateInputColor&&n.input.css({backgroundColor:_&&"#"+_||"transparent",color:null==o||o.v>75?"#000000":"#ffffff"}),ce=c.find(".Move:first").bind("mousedown",A),V.active.bind(P)):N.call(l)}var L=u.images,O=u.localization,V={active:"string"===t(u.color.active).toString().toLowerCase()?new a({ahex:!u.window.alphaSupport&&u.color.active?u.color.active.substring(0,6)+"ff":u.color.active}):new a({ahex:!u.window.alphaSupport&&u.color.active.val("ahex")?u.color.active.val("ahex").substring(0,6)+"ff":u.color.active.val("ahex")}),current:"string"===t(u.color.active).toString().toLowerCase()?new a({ahex:!u.window.alphaSupport&&u.color.active?u.color.active.substring(0,6)+"ff":u.color.active}):new a({ahex:!u.window.alphaSupport&&u.color.active.val("ahex")?u.color.active.val("ahex").substring(0,6)+"ff":u.color.active.val("ahex")}),quickList:u.color.quickList},j=null,B=null,R=null,D=null,F=null,U=null,z=null,H=null,q=null,X=null,Y=null,W=null,Q=null,$=null,Z=null,K=null,J=null,ee=null,te=null,ne=null,ie=null,re=null,ae=null,oe=null,se=null,le=null,ue=null,ce=null,he="function"==typeof r[1]?r[1]:null,de="function"==typeof r[2]?r[2]:null,fe="function"==typeof r[3]?r[3]:null;e.extend(!0,l,{commitCallback:he,liveCallback:de,cancelCallback:fe,color:V,show:N,hide:I,destroy:function(){F.find("td.Radio input").unbind("click",b),ie.unbind("click",x),ae.unbind("click",w),re.unbind("click",S),u.window.expandable&&(ue.unbind("click",k),ce.unbind("mousedown",A),l.icon=null),F.find(".QuickColor").unbind("click",G),U=null,z=null,H=null,q=null,X=null,Y=null,W=null,Q=null,$=null,Z=null,K=null,J.destroy(),J=null,ee.destroy(),ee=null,te.destroy(),te=null,ne=null,ie=null,re=null,ae=null,oe=null,he=null,fe=null,de=null,F.html("");for(var e=0;e<o.length;e++)o[e]===l&&o.splice(e,1)}}),o.push(l),setTimeout(function(){M.call(l)},0)})},e.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:!1,liveUpdate:!0,alphaSupport:!1,alphaPrecision:0,updateInputColor:!0},color:{mode:"h",active:new a({ahex:"#ffcc00ff"}),quickList:[new a({h:360,s:33,v:100}),new a({h:360,s:66,v:100}),new a({h:360,s:100,v:100}),new a({h:360,s:100,v:75}),new a({h:360,s:100,v:50}),new a({h:180,s:0,v:100}),new a({h:30,s:33,v:100}),new a({h:30,s:66,v:100}),new a({h:30,s:100,v:100}),new a({h:30,s:100,v:75}),new a({h:30,s:100,v:50}),new a({h:180,s:0,v:90}),new a({h:60,s:33,v:100}),new a({h:60,s:66,v:100}),new a({h:60,s:100,v:100}),new a({h:60,s:100,v:75}),new a({h:60,s:100,v:50}),new a({h:180,s:0,v:80}),new a({h:90,s:33,v:100}),new a({h:90,s:66,v:100}),new a({h:90,s:100,v:100}),new a({h:90,s:100,v:75}),new a({h:90,s:100,v:50}),new a({h:180,s:0,v:70}),new a({h:120,s:33,v:100}),new a({h:120,s:66,v:100}),new a({h:120,s:100,v:100}),new a({h:120,s:100,v:75}),new a({h:120,s:100,v:50}),new a({h:180,s:0,v:60}),new a({h:150,s:33,v:100}),new a({h:150,s:66,v:100}),new a({h:150,s:100,v:100}),new a({h:150,s:100,v:75}),new a({h:150,s:100,v:50}),new a({h:180,s:0,v:50}),new a({h:180,s:33,v:100}),new a({h:180,s:66,v:100}),new a({h:180,s:100,v:100}),new a({h:180,s:100,v:75}),new a({h:180,s:100,v:50}),new a({h:180,s:0,v:40}),new a({h:210,s:33,v:100}),new a({h:210,s:66,v:100}),new a({h:210,s:100,v:100}),new a({h:210,s:100,v:75}),new a({h:210,s:100,v:50}),new a({h:180,s:0,v:30}),new a({h:240,s:33,v:100}),new a({h:240,s:66,v:100}),new a({h:240,s:100,v:100}),new a({h:240,s:100,v:75}),new a({h:240,s:100,v:50}),new a({h:180,s:0,v:20}),new a({h:270,s:33,v:100}),new a({h:270,s:66,v:100}),new a({h:270,s:100,v:100}),new a({h:270,s:100,v:75}),new a({h:270,s:100,v:50}),new a({h:180,s:0,v:10}),new a({h:300,s:33,v:100}),new a({h:300,s:66,v:100}),new a({h:300,s:100,v:100}),new a({h:300,s:100,v:75}),new a({h:300,s:100,v:50}),new a({h:180,s:0,v:0}),new a({h:330,s:33,v:100}),new a({h:330,s:66,v:100}),new a({h:330,s:100,v:100}),new a({h:330,s:100,v:75}),new a({h:330,s:100,v:50}),new a]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:20,height:7}},picker:{file:"picker.gif",width:25,height:24}},localization:{text:{title:"Drag Markers To Pick A Color",newColor:"new",currentColor:"current",ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press &ldquo;OK&rdquo; To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To &ldquo;Hue&rdquo; Color Mode",textbox:"Enter A &ldquo;Hue&rdquo; Value (0-360&deg;)"},saturation:{radio:"Set To &ldquo;Saturation&rdquo; Color Mode",textbox:"Enter A &ldquo;Saturation&rdquo; Value (0-100%)"},value:{radio:"Set To &ldquo;Value&rdquo; Color Mode",textbox:"Enter A &ldquo;Value&rdquo; Value (0-100%)"},red:{radio:"Set To &ldquo;Red&rdquo; Color Mode",textbox:"Enter A &ldquo;Red&rdquo; Value (0-255)"},green:{radio:"Set To &ldquo;Green&rdquo; Color Mode",textbox:"Enter A &ldquo;Green&rdquo; Value (0-255)"},blue:{radio:"Set To &ldquo;Blue&rdquo; Color Mode",textbox:"Enter A &ldquo;Blue&rdquo; Value (0-255)"},alpha:{radio:"Set To &ldquo;Alpha&rdquo; Color Mode",textbox:"Enter A &ldquo;Alpha&rdquo; Value (0-100)"},hex:{textbox:"Enter A &ldquo;Hex&rdquo; Color Value (#000000-#ffffff)",alpha:"Enter A &ldquo;Alpha&rdquo; Value (#00-#ff)"}}}},e}].reduce(function(e,t){return t(e)},jQuery);ni.loadingStylesheets.includes("svg-editor.css")||ni.loadingStylesheets.push("svg-editor.css");ni.loadingStylesheets.some(function(e){return!Array.isArray(e)||"images/logo.png"!==e[0]})&&ni.loadingStylesheets.push(["images/logo.png",{favicon:!0}]);var ii={tool_scale:1,exportWindowCt:0,langChanged:!1,showSaveWarning:!1,storagePromptClosed:!1},ri=[],ai={lang:"",iconsize:"",bkgd_color:"#FFF",bkgd_url:"",img_save:"embed",save_notice_done:!1,export_notice_done:!1},oi=["ext-overview_window.js","ext-markers.js","ext-connector.js","ext-eyedropper.js","ext-shapes.js","ext-imagelib.js","ext-grid.js","ext-polygon.js","ext-star.js","ext-panning.js","ext-storage.js"],si={canvasName:"default",canvas_expansion:3,initFill:{color:"FF0000",opacity:1},initStroke:{width:5,color:"000000",opacity:1},text:{stroke_width:0,font_size:24,font_family:"serif"},initOpacity:1,colorPickerCSS:null,initTool:"select",exportWindowType:"new",wireframe:!1,showlayers:!1,no_save_warning:!1,imgPath:"images/",langPath:"locale/",extPath:"extensions/",extIconsPath:"extensions/",jGraduatePath:"jgraduate/images/",dimensions:[640,480],gridSnapping:!1,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:!0,preventAllURLConfig:!1,preventURLContentLoading:!1,lockExtensions:!1,noDefaultExtensions:!1,showGrid:!1,noStorageOnLoad:!1,forceStorage:!1,emptyStorageOnDecline:!1},li=ii.uiStrings={},ui=void 0,ci=void 0,hi=!1,di=!1,fi=!1,pi={},gi={extensions:[],stylesheets:[],allowedOrigins:[]};function vi(e,t){var n=!1!==ui.setSvgString(e);t=t||ni.noop,n?t(!0):ni.alert(li.notification.errorLoadingSVG,function(){t(!1)})}return ni.pref=function(e,t){return t?(pi[e]=t,void(ii.curPrefs=pi)):e in pi?pi[e]:ai[e]},ii.putLocale=function(e,t,n){e?Jn=e:((Jn=Kn.pref("lang"))||(navigator.userLanguage?Jn=navigator.userLanguage:navigator.language&&(Jn=navigator.language)),console.log("Lang: "+Jn),t.includes(Jn)||"test"===Jn||(Jn="en"));var i=document.createElement("script"),r=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules),a=n.langPath+"lang."+Jn+".js";r&&(i.type="module"),i.src=a,document.querySelector("head").appendChild(i)},ii.readLang=function(e){var t=ti.addLangData(Jn);if(Kn.each(t,function(t,n){n.data&&(e=Kn.merge(e,n.data))}),e.tools){var n=e,i=n.tools,r=n.properties,a=n.config,o=n.layers,s=n.common,l=n.ui;ei("content",{curve_segments:r.curve_segments,fitToContent:i.fitToContent,fit_to_all:i.fit_to_all,fit_to_canvas:i.fit_to_canvas,fit_to_layer_content:i.fit_to_layer_content,fit_to_sel:i.fit_to_sel,icon_large:a.icon_large,icon_medium:a.icon_medium,icon_small:a.icon_small,icon_xlarge:a.icon_xlarge,image_opt_embed:a.image_opt_embed,image_opt_ref:a.image_opt_ref,includedImages:a.included_images,largest_object:i.largest_object,layersLabel:o.layers,page:i.page,relativeToLabel:i.relativeTo,selLayerLabel:o.move_elems_to,selectedPredefined:a.select_predefined,selected_objects:i.selected_objects,smallest_object:i.smallest_object,straight_segments:r.straight_segments,svginfo_bg_url:a.editor_img_url+":",svginfo_bg_note:a.editor_bg_note,svginfo_change_background:a.background,svginfo_dim:a.doc_dims,svginfo_editor_prefs:a.editor_prefs,svginfo_height:s.height,svginfo_icons:a.icon_size,svginfo_image_props:a.image_props,svginfo_lang:a.language,svginfo_title:a.doc_title,svginfo_width:s.width,tool_docprops_cancel:s.cancel,tool_docprops_save:s.ok,tool_source_cancel:s.cancel,tool_source_save:s.ok,tool_prefs_cancel:s.cancel,tool_prefs_save:s.ok,sidepanel_handle:o.layers.split("").join(" "),tool_clear:i.new_doc,tool_docprops:i.docprops,tool_export:i.export_img,tool_import:i.import_doc,tool_imagelib:i.imagelib,tool_open:i.open_doc,tool_save:i.save_doc,svginfo_units_rulers:a.units_and_rulers,svginfo_rulers_onoff:a.show_rulers,svginfo_unit:a.base_unit,svginfo_grid_settings:a.grid,svginfo_snap_onoff:a.snapping_onoff,svginfo_snap_step:a.snapping_stepsize,svginfo_grid_color:a.grid_color},!0);var u={};for(var c in e.shape_cats)u['#shape_cats [data-cat="'+c+'"]']=e.shape_cats[c];setTimeout(function(){ei("content",u)},2e3);var h={};Kn.each(["cut","copy","paste","paste_in_place","delete","group","ungroup","move_front","move_up","move_down","move_back"],function(){h['#cmenu_canvas a[href="#'+this+'"]']=i[this]}),Kn.each(["dupe","merge_down","merge_all"],function(){h['#cmenu_layers a[href="#'+this+'"]']=o[this]}),h['#cmenu_layers a[href="#delete"]']=o.del,ei("content",h),ei("title",{align_relative_to:i.align_relative_to,circle_cx:r.circle_cx,circle_cy:r.circle_cy,circle_r:r.circle_r,cornerRadiusLabel:r.corner_radius,ellipse_cx:r.ellipse_cx,ellipse_cy:r.ellipse_cy,ellipse_rx:r.ellipse_rx,ellipse_ry:r.ellipse_ry,fill_color:r.fill_color,font_family:r.font_family,idLabel:r.id,image_height:r.image_height,image_url:r.image_url,image_width:r.image_width,layer_delete:o.del,layer_down:o.move_down,layer_new:o.new,layer_rename:o.rename,layer_moreopts:s.more_opts,layer_up:o.move_up,line_x1:r.line_x1,line_x2:r.line_x2,line_y1:r.line_y1,line_y2:r.line_y2,linecap_butt:r.linecap_butt,linecap_round:r.linecap_round,linecap_square:r.linecap_square,linejoin_bevel:r.linejoin_bevel,linejoin_miter:r.linejoin_miter,linejoin_round:r.linejoin_round,main_icon:i.main_menu,mode_connect:i.mode_connect,tools_shapelib_show:i.mode_shapelib,palette:l.palette_info,zoom_panel:l.zoom_level,path_node_x:r.node_x,path_node_y:r.node_y,rect_height_tool:r.rect_height,rect_width_tool:r.rect_width,seg_type:r.seg_type,selLayerNames:o.move_selected,selected_x:r.pos_x,selected_y:r.pos_y,stroke_color:r.stroke_color,stroke_style:r.stroke_style,stroke_width:r.stroke_width,svginfo_title:a.doc_title,text:r.text_contents,toggle_stroke_tools:l.toggle_stroke_tools,tool_add_subpath:i.add_subpath,tool_alignbottom:i.align_bottom,tool_aligncenter:i.align_center,tool_alignleft:i.align_left,tool_alignmiddle:i.align_middle,tool_alignright:i.align_right,tool_aligntop:i.align_top,tool_angle:r.angle,tool_blur:r.blur,tool_bold:r.bold,tool_circle:i.mode_circle,tool_clone:i.clone,tool_clone_multi:i.clone,tool_delete:i.del,tool_delete_multi:i.del,tool_ellipse:i.mode_ellipse,tool_eyedropper:i.mode_eyedropper,tool_fhellipse:i.mode_fhellipse,tool_fhpath:i.mode_fhpath,tool_fhrect:i.mode_fhrect,tool_font_size:r.font_size,tool_group_elements:i.group_elements,tool_make_link:i.make_link,tool_link_url:i.set_link_url,tool_image:i.mode_image,tool_italic:r.italic,tool_line:i.mode_line,tool_move_bottom:i.move_bottom,tool_move_top:i.move_top,tool_node_clone:i.node_clone,tool_node_delete:i.node_delete,tool_node_link:i.node_link,tool_opacity:r.opacity,tool_openclose_path:i.openclose_path,tool_path:i.mode_path,tool_position:i.align_to_page,tool_rect:i.mode_rect,tool_redo:i.redo,tool_reorient:i.reorient_path,tool_select:i.mode_select,tool_source:i.source_save,tool_square:i.mode_square,tool_text:i.mode_text,tool_topath:i.to_path,tool_undo:i.undo,tool_ungroup:i.ungroup,tool_wireframe:i.wireframe_mode,view_grid:i.toggle_grid,tool_zoom:i.mode_zoom,url_notice:i.no_embed},!0),ti.setLang(Jn,e)}},ii.loadContentAndPrefs=function(){if(gi.forceStorage||!gi.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/)){if(ii.storage&&(gi.forceStorage||!gi.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)store=prefsAndContent/))){var e="svgedit-"+gi.canvasName,t=ii.storage.getItem(e);t&&ii.loadFromString(t)}for(var n in ai)if(ai.hasOwnProperty(n)){var i="svg-edit-"+n;if(ii.storage){var r=ii.storage.getItem(i);r&&(ai[n]=String(r))}else if(window.widget)ai[n]=window.widget.preferenceForKey(i);else{var a=document.cookie.match(new RegExp("(?:^|;\\s*)"+(o=encodeURIComponent(i),s=void 0,String(o).replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\"+(s||"")+"-]","g"),"\\$&"))+"=([^;]+)"));ai[n]=a?decodeURIComponent(a[1]):""}}var o,s}},ii.setConfig=function(e,n){function i(e,n,i){e[n]&&"object"===t(e[n])?ni.extend(!0,e[n],i):e[n]=i}n=n||{},ni.each(e,function(r,a){if(e.hasOwnProperty(r))if(ai.hasOwnProperty(r)){if(!1===n.overwrite&&(gi.preventAllURLConfig||pi.hasOwnProperty(r)))return;!0===n.allowInitialUserOverride?ai[r]=a:ni.pref(r,a)}else if(["extensions","stylesheets","allowedOrigins"].includes(r)){if(!1===n.overwrite&&(gi.preventAllURLConfig||["allowedOrigins","stylesheets"].includes(r)||"extensions"===r&&gi.lockExtensions))return;gi[r]=gi[r].concat(a)}else if(si.hasOwnProperty(r)){if(!1===n.overwrite&&(gi.preventAllURLConfig||gi.hasOwnProperty(r)))return;if(gi.hasOwnProperty(r)){if(!1===n.overwrite)return;i(gi,r,a)}else!0===n.allowInitialUserOverride?i(si,r,a):si[r]&&"object"===t(si[r])?(gi[r]={},ni.extend(!0,gi[r],a)):gi[r]=a}}),ii.curConfig=gi},ii.setCustomHandlers=function(e){ii.ready(function(){e.open&&(ni('#tool_open > input[type="file"]').remove(),ni("#tool_open").show(),ui.open=e.open),e.save&&(ii.showSaveWarning=!1,ui.bind("saved",e.save)),e.exportImage&&(di=e.exportImage,ui.bind("exported",di)),e.exportPDF&&(fi=e.exportPDF,ui.bind("exportedPDF",fi))})},ii.randomizeIds=function(){ui.randomizeIds(arguments)},ii.init=function(){var e=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules);e||Object.assign(si,{langPath:"../dist/locale/",extPath:"../dist/extensions/"});try{"localStorage"in window&&(ii.storage=localStorage)}catch(e){}var n=[];function i(){pi=ni.extend(!0,{},ai,pi),ii.curPrefs=pi}function r(){(gi=ni.extend(!0,{},si,gi)).noDefaultExtensions||(gi.extensions=gi.extensions.concat(oi)),ni.each(["extensions","stylesheets","allowedOrigins"],function(e,t){gi[t]=ni.grep(gi[t],function(e,n){return n===gi[t].indexOf(e)})}),ii.curConfig=gi}ni("#lang_select option").each(function(){n.push(this.value)}),function(){var e=void 0,t=void 0;if(ci=ni.deparam.querystring(!0),ni.isEmptyObject(ci))r(),ii.loadContentAndPrefs(),i();else{if(ci.dimensions&&(ci.dimensions=ci.dimensions.split(",")),ci.bkgd_color&&(ci.bkgd_color="#"+ci.bkgd_color),ci.extensions&&(ci.extensions=ci.extensions.match(/[:/\\]/)?"":ci.extensions.split(",")),ni.each(["extPath","imgPath","extIconsPath","langPath","jGraduatePath"],function(e){ci[e]&&delete ci[e]}),ii.setConfig(ci,{overwrite:!1}),r(),!gi.preventURLContentLoading){if(e=ci.source,t=ni.param.querystring(),e||t.includes("source=data:")&&(e=t.match(/source=(data:[^&]*)/)[1]),e)return void(e.startsWith("data:")?ii.loadFromDataURI(e):ii.loadFromString(e));if(ci.url)return void ii.loadFromURL(ci.url)}ci.noStorageOnLoad&&!gi.forceStorage||ii.loadContentAndPrefs(),i()}}();var a=ii.setIcon=function(e,t,n){var i="string"==typeof t?ni.getSvgIcon(t,!0):t.clone();i?ni(e).empty().append(i):console.log("NOTE: Icon image missing: "+t)},u=function(){ni.each(gi.extensions,function(){if(this.match(/^ext-.*\.js/)){var t=document.createElement("script");e&&(t.type="module");var n=gi.extPath+this;t.src=n,document.querySelector("head").appendChild(t)}}),ii.putLocale(null,n,gi)},c={tool_scale:ii.tool_scale},h=function(){ni(".tools_flyout").each(function(){var e=ni("#"+this.id+"_show"),t=e.offset(),n=e.outerWidth();ni(this).css({left:(t.left+n)*ii.tool_scale,top:t.top})})},d=ii.setIconSize=function(e){var t="#tools_top .toolset, #editor_panel > *, #history_panel > *, #main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *, #g_panel > *, #tool_font_size > *, .tools_flyout",n=ni(t),i=1;if("number"==typeof e)i=e;else{i={s:.75,m:1,l:1.25,xl:1.5}[e]}c.tool_scale=ii.tool_scale=i,h();var r=n.parents(":hidden");r.css("visibility","hidden").show(),function(e,t){var n=["top","left","bottom","right"];e.each(function(){for(var e=ni(this),i=e.outerWidth()*(t-1),r=e.outerHeight()*(t-1),a=0;a<4;a++){var o=n[a],s=e.data("orig_margin-"+o);null==s&&(s=parseInt(e.css("margin-"+o),10),e.data("orig_margin-"+o,s));var l=s*t;"right"===o?l+=i:"bottom"===o&&(l+=r),e.css("margin-"+o,l)}})}(n,i),r.css("visibility","visible").hide(),ni.pref("iconsize",e),ni("#iconsize").val(e);var a={"#tools_top":{left:50+ni("#main_button").width(),height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}},o=ni("#tool_size_rules");if(o.length?o.empty():o=ni('<style id="tool_size_rules"></style>').appendTo("head"),"m"!==e){var s="";ni.each(a,function(t,n){t="#svg_editor "+t.replace(/,/g,", #svg_editor"),s+=t+"{",ni.each(n,function(t,n){var r=void 0;"number"==typeof n?r=n*i+"px":(n[e]||n.all)&&(r=n[e]||n.all),s+=t+":"+r+";"}),s+="}"});var l="-"+pe.toLowerCase()+"-";s+=t+"{"+l+"transform: scale("+i+");} #svg_editor div.toolset .toolset {"+l+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+l+"transform: scale("+1/i+");}",o.text(s)}h()};ni.svgIcons(gi.imgPath+"svg_edit_icons.svg",{w:24,h:24,id_match:!1,no_img:!N(),fallback_path:gi.imgPath,fallback:{new_image:"clear.png",save:"save.png",open:"open.png",source:"source.png",docprops:"document-properties.png",wireframe:"wireframe.png",undo:"undo.png",redo:"redo.png",select:"select.png",select_node:"select_node.png",pencil:"fhpath.png",pen:"line.png",square:"square.png",rect:"rect.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png",fh_ellipse:"freehand-circle.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png",clone:"clone.png",node_clone:"node_clone.png",delete:"delete.png",node_delete:"node_delete.png",group:"shape_group_elements.png",ungroup:"shape_ungroup.png",move_top:"move_top.png",move_bottom:"move_bottom.png",to_path:"to_path.png",link_controls:"link_controls.png",reorient:"reorient.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",go_up:"go-up.png",go_down:"go-down.png",ok:"save.png",cancel:"cancel.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_clear div,#layer_new":"new_image","#tool_save div":"save","#tool_export div":"export","#tool_open div div":"open","#tool_import div div":"import","#tool_source":"source","#tool_docprops > div":"docprops","#tool_wireframe":"wireframe","#tool_undo":"undo","#tool_redo":"redo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_square":"square","#tool_fhrect":"fh_rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_circle":"circle","#tool_fhellipse":"fh_ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_clone,#tool_clone_multi":"clone","#tool_node_clone":"node_clone","#layer_delete,#tool_delete,#tool_delete_multi":"delete","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_move_top":"move_top","#tool_move_bottom":"move_bottom","#tool_topath":"to_path","#tool_node_link":"link_controls","#tool_reorient":"reorient","#tool_group_elements":"group_elements","#tool_ungroup":"ungroup","#tool_unlink_use":"unlink_use","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#linecap_butt,#cur_linecap":"linecap_butt","#linecap_round":"linecap_round","#linecap_square":"linecap_square","#linejoin_miter,#cur_linejoin":"linejoin_miter","#linejoin_round":"linejoin_round","#linejoin_bevel":"linejoin_bevel","#url_notice":"warning","#layer_up":"go_up","#layer_down":"go_down","#layer_moreopts":"context_menu","#layerlist td.layervis":"eye","#tool_source_save,#tool_docprops_save,#tool_prefs_save":"ok","#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel":"cancel","#rwidthLabel, #iwidthLabel":"width","#rheightLabel, #iheightLabel":"height","#cornerRadiusLabel span":"c_radius","#angleLabel":"angle","#linkLabel,#tool_make_link,#tool_make_link_multi":"globe_link","#zoomLabel":"zoom","#tool_fill label":"fill","#tool_stroke .icon_label":"stroke","#group_opacityLabel":"opacity","#blurLabel":"blur","#font_sizeLabel":"fontsize",".flyout_arrow_horiz":"arrow_right",".dropdown button, #main_button .dropdown":"arrow_down","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":28,".flyout_arrow_horiz .svg_icon":5,".layer_button .svg_icon, #layerlist td.layervis .svg_icon":14,".dropdown button .svg_icon":7,"#main_button .dropdown .svg_icon":9,".palette_item:first .svg_icon":15,"#fill_bg .svg_icon, #stroke_bg .svg_icon":16,".toolbar_button button .svg_icon":16,".stroke_tool div div .svg_icon":20,"#tools_bottom label .svg_icon":18},callback:function(e){ni(".toolbar_button button > svg, .toolbar_button button > img").each(function(){ni(this).parent().prepend(this)});var t=ni("#tools_left"),n=void 0;t.length&&(n=t.offset().top+t.outerHeight());var i=ni.pref("iconsize");function r(e){switch(e){case"jgraduate/css/jPicker.css":return 1;case"jgraduate/css/jgraduate.css":return 2;case"svg-editor.css":return 3;case"spinbtn/JQuerySpinBtn.css":return 4;default:return 1/0}}ii.setIconSize(i||(ni(window).height()<n?"s":"m")),ni(".tools_flyout").each(function(){var e=ni("#"+this.id+"_show"),t=e.attr("data-curopt");if(!e.children("svg, img").length){var n=ni(t).children().clone();n.length&&(n[0].removeAttribute("style"),e.append(n))}});var a=ni.loadingStylesheets.sort(function(e,t){var n=r(e),i=r(t);return n===i?0:n>i});if(gi.stylesheets.length){var l,u=(a=[].concat(s(new Set(gi.stylesheets)))).indexOf("@default");if(u>-1)(l=a).splice.apply(l,[u,1].concat(s(ni.loadingStylesheets)))}(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.before,i=t.after,r=t.favicon,a=t.canvas,s=t.image,l=void 0===s||s,u=t.acceptErrors;return e=Array.isArray(e)?e:[e],Promise.all(e.map(function(e){var t={};if(Array.isArray(e)){var s=o(e,2);e=s[0];var c=s[1];t=void 0===c?{}:c}var h=t.favicon,d=void 0===h?r:h,f=t,p=f.before,g=void 0===p?n:p,v=f.after,m=void 0===v?i:v,y=f.canvas,_=void 0===y?a:y,b=f.image,x=void 0===b?l:b;function w(){g?g.before(S):m?m.after(S):document.head.appendChild(S)}var S=document.createElement("link");return new Promise(function(n,i){if(u&&(i="function"==typeof u?function(r){u({error:r,stylesheetURL:e,options:t,resolve:n,reject:i})}:n),e.endsWith(".css")?d=!1:e.endsWith(".ico")&&(d=!0),d){if(S.rel="shortcut icon",S.type="image/x-icon",!1===x)return S.href=e,w(),void n(S);var r=document.createElement("canvas");r.width=16,r.height=16;var a=r.getContext("2d"),o=document.createElement("img");return o.addEventListener("error",function(e){i(e)}),o.addEventListener("load",function(){a.drawImage(o,0,0),S.href=_?r.toDataURL("image/x-icon"):e,w(),n(S)}),void(o.src=e)}S.rel="stylesheet",S.type="text/css",S.href=e,w(),S.addEventListener("error",function(e){i(e)}),S.addEventListener("load",function(){n(S)})})}))})(a,{acceptErrors:function(e){var t=e.stylesheetURL,n=e.reject,i=e.resolve;ni.loadingStylesheets.includes(t)?n(new Error("Missing expected stylesheet: "+t)):i()}}).then(function(){ni("#svg_container")[0].style.visibility="visible",ii.runCallbacks(),setTimeout(function(){ni(".flyout_arrow_horiz:empty").each(function(){ni(this).append(ni.getSvgIcon("arrow_right").width(5).height(5))})},1)})}}),ii.canvas=ui=new $n(document.getElementById("svgcanvas"),gi);var f=O()?"meta+":"ctrl+",p=ui.pathActions,g=ui.undoMgr,v=ni("#workarea"),m=ni("#cmenu_canvas"),y={fill:null,stroke:null},_=void 0,b=void 0,x=null,w=gi.imgPath+"logo.png",S="crosshair",k="crosshair",C="toolbars";!function(){var e=window.opener||window.parent,t=void 0;if(e)try{(t=e.document.createEvent("Event")).initEvent("svgEditorReady",!0,!0),e.document.documentElement.dispatchEvent(t)}catch(e){}}(),function(){ni("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");var e=ni("#dialog_box"),n=ni("#dialog_buttons"),i=ni("#dialog_content"),r=function(r,a,o,s,l,u,c){i.html("<p>"+a.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt","prompt"===r),n.empty();var h=ni('<input type="button" value="'+li.common.ok+'">').appendTo(n);"alert"!==r&&ni('<input type="button" value="'+li.common.cancel+'">').appendTo(n).click(function(){e.hide(),o&&o(!1)});var d=void 0,f=void 0;if("prompt"===r)(d=ni('<input type="text">').prependTo(n)).val(s||""),d.bind("keydown","return",function(){h.click()});else if("select"===r){var p=ni('<div style="text-align:center;">');if(d=ni("<select>").appendTo(p),c){var g=ni("<label>").text(c.label);(f=ni('<input type="checkbox">').appendTo(g)).val(c.value),c.tooltip&&g.attr("title",c.tooltip),f.prop("checked",!!c.checked),p.append(ni("<div>").append(g))}ni.each(l||[],function(e,n){"object"===(void 0===n?"undefined":t(n))?d.append(ni("<option>").val(n.value).html(n.text)):d.append(ni("<option>").html(n))}),i.append(p),s&&d.val(s),u&&d.bind("change","return",u),d.bind("keydown","return",function(){h.click()})}else"process"===r&&h.hide();e.show(),h.click(function(){e.hide();var t="prompt"!==r&&"select"!==r||d.val();o&&(f?o(t,f.prop("checked")):o(t))}).focus(),"prompt"!==r&&"select"!==r||d.focus()};ni.alert=function(e,t){r("alert",e,t)},ni.confirm=function(e,t){r("confirm",e,t)},ni.process_cancel=function(e,t){r("process",e,t)},ni.prompt=function(e,t,n){r("prompt",e,n,t)},ni.select=function(e,t,n,i,a,o){r("select",e,n,a,t,i,o)}}();for(var P=function(){var e=ni(".tool_button_current");e.length&&"tool_select"!==e[0].id&&(e.removeClass("tool_button_current").addClass("tool_button"),ni("#tool_select").addClass("tool_button_current").removeClass("tool_button"),ni("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}")),ui.setMode("select"),v.css("cursor","auto")},A=ni("title:first").text(),E=[],T=.1;T<1e5;T*=10)E.push(T),E.push(2*T),E.push(5*T);var G=function(e){var t=void 0,n=[],i=ui.getCurrentDrawing().getNumLayers();for(t=0;t<i;t++)n[t]=ui.getCurrentDrawing().getLayerName(t);if(e)for(t=0;t<i;++t)n[t]!==e&&ui.getCurrentDrawing().setLayerOpacity(n[t],.5);else for(t=0;t<i;++t)ui.getCurrentDrawing().setLayerOpacity(n[t],1)},L=function(){ui.clearSelection();for(var e=ni("#layerlist tbody").empty(),t=ni("#selLayerNames").empty(),n=ui.getCurrentDrawing(),i=n.getCurrentLayerName(),r=ni.getSvgIcon("eye"),a=ui.getCurrentDrawing().getNumLayers();a--;){var o=n.getLayerName(a),s=ni('<tr class="layer">').toggleClass("layersel",o===i),l=ni('<td class="layervis">').toggleClass("layerinvis",!n.getLayerVisibility(o)),u=ni('<td class="layername">'+o+"</td>");e.append(s.append(l,u)),t.append('<option value="'+o+'">'+o+"</option>")}if(void 0!==r){var c=r.clone();ni("td.layervis",e).append(c),ni.resizeSvgIcons({"td.layervis .svg_icon":14})}ni("#layerlist td.layername").mouseup(function(e){ni("#layerlist tr.layer").removeClass("layersel"),ni(this.parentNode).addClass("layersel"),ui.setCurrentLayer(this.textContent),e.preventDefault()}).mouseover(function(){G(this.textContent)}).mouseout(function(){G()}),ni("#layerlist td.layervis").click(function(){var e=ni(this.parentNode).prevAll().length,t=ni("#layerlist tr.layer:eq("+e+") td.layername").text(),n=ni(this).hasClass("layerinvis");ui.setLayerVisibility(t,n),ni(this).toggleClass("layerinvis")});for(var h=5-ni("#layerlist tr.layer").size();h-- >0;)e.append('<tr><td style="color:white">_</td><td/></tr>')},j=!1,B="",R=function(e,t){j||(j=!0,B=ui.getSvgString(),ni("#save_output_btns").toggle(!!t),ni("#tool_source_back").toggle(!t),ni("#svg_source_textarea").val(B),ni("#svg_source_editor").fadeIn(),ni("#svg_source_textarea").focus())},D=null,F=!1,U=function(){window.opera&&ni("<p/>").hide().appendTo("body").remove()};function z(e,t){var n=e.id,i=n.split("_"),r=i[0],o=i[1];t&&ui.setStrokeAttr("stroke-"+r,o),U(),a("#cur_"+r,n,20),ni(e).addClass("current").siblings().removeClass("current")}var H=ii.toolButtonClick=function(e,t){if(ni(e).hasClass("disabled"))return!1;if(ni(e).parent().hasClass("tools_flyout"))return!0;return t||ni(".tools_flyout").fadeOut("normal"),ni("#styleoverrides").text(""),v.css("cursor","auto"),ni(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),ni(e).addClass("tool_button_current").removeClass("tool_button"),!0},q=ii.clickSelect=function(){H("#tool_select")&&(ui.setMode("select"),ni("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}"))},X=ii.setImageURL=function(e){e||(e=w),ui.setImageURL(e),ni("#image_url").val(e),e.startsWith("data:")?(ni("#image_url").hide(),ni("#change_image_url").show()):(ui.embedImage(e,function(t){ni("#url_notice").toggle(!t),w=e}),ni("#image_url").show(),ni("#change_image_url").hide())};function Y(e,t){ni.pref("bkgd_color",e),ni.pref("bkgd_url",t),ui.setBackground(e,t)}function W(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).cancelDeletes,t=void 0!==e&&e,n=ui.getHref(D);n=n.startsWith("data:")?"":n,ni.prompt(li.notification.enterNewImgURL,n,function(e){e?X(e):t&&ui.deleteSelectedElements()})}function Q(e,t){t||(t=ui.getZoom()),e||(e=ni("#svgcanvas"));var n=void 0,i=void 0,r=ui.getContentElem(),a=ee()[gi.baseUnit];for(n=0;n<2;n++){var o=0===n,s=o?"x":"y",l=o?"width":"height",u=Number(r.getAttribute(s)),c=ni("#ruler_"+s+" canvas:first"),h=c.clone();c.replaceWith(h);var d=h[0],f=e[l](),p=f;d.parentNode.style[l]=p+"px";var g=d.getContext("2d"),v=void 0,m=void 0,y=void 0;if(g.fillStyle="rgb(200,0,0)",g.fillRect(0,0,d.width,d.height),h.siblings().remove(),f>=3e4){y=parseInt(f/3e4,10)+1,(v=[])[0]=g;var _=void 0;for(i=1;i<y;i++)d[l]=3e4,_=d.cloneNode(!0),d.parentNode.appendChild(_),v[i]=_.getContext("2d");_[l]=f%3e4,f=3e4}d[l]=f;var b=a*t,x=50/b,w=1;for(i=0;i<E.length&&(w=m=E[i],!(x<=m));i++);var S=w*b;g.font="9px sans-serif";for(var k=u/b%w*b,C=k-S,P=0;k<p;){C+=S;var A=Math.round(k)+.5;o?(g.moveTo(A,15),g.lineTo(A,0)):(g.moveTo(15,A),g.lineTo(0,A)),m=(C-u)/b;var T=void 0;if(w>=1)T=Math.round(m);else{var G=String(w).split(".")[1].length;T=m.toFixed(G)}if(0!==T&&1e3!==T&&T%1e3==0&&(T=T/1e3+"K"),o)g.fillText(T,k+2,8);else{var N=String(T).split("");for(i=0;i<N.length;i++)g.fillText(N[i],1,k+9+9*i)}var I=S/10;for(i=1;i<10;i++){var M=Math.round(k+I*i)+.5;if(v&&M>f){if(P++,g.stroke(),P>=y){i=10,k=p;continue}g=v[P],k-=3e4,M=Math.round(k+I*i)+.5}var L=i%2?12:10;o?(g.moveTo(M,15),g.lineTo(M,L)):(g.moveTo(15,M),g.lineTo(L,M))}k+=S}g.strokeStyle="#000",g.stroke()}}var $=ii.updateCanvas=function(e,t){var n=ui.getZoom(),i=v,r=ni("#svgcanvas"),a=v.width(),o=v.height(),s=a,l=o,u=i[0].scrollLeft+s/2,c=i[0].scrollTop+l/2,h=gi.canvas_expansion;a=Math.max(s,ui.contentW*n*h),o=Math.max(l,ui.contentH*n*h),a===s&&o===l?v.css("overflow","hidden"):v.css("overflow","scroll");var d=r.height()/2,f=r.width()/2;r.width(a).height(o);var p=o/2,g=a/2,m=ui.updateCanvas(a,o),y=g/f,_=a/2-s/2,b=o/2-l/2;t?(t.x+=m.x,t.y+=m.y):t={x:g+(u-f)*y,y:p+(c-d)*y};e?ui.contentW>i.width()?(v[0].scrollLeft=m.x-10,v[0].scrollTop=m.y-10):(i[0].scrollLeft=_,i[0].scrollTop=b):(i[0].scrollLeft=t.x-s/2,i[0].scrollTop=t.y-l/2),gi.showRulers&&(Q(r,n),v.scroll()),!0===ci.storagePrompt||ii.storagePromptClosed||ni("#dialog_box").hide()},Z=function(){var e=void 0,t=void 0,n="none"===ui.getColor("fill"),i="none"===ui.getColor("stroke"),r=["#tool_fhpath","#tool_line"],a=["#tools_rect .tool_button","#tools_ellipse .tool_button","#tool_text","#tool_path"];if(i)for(e in r)ni(t=r[e]).hasClass("tool_button_current")&&q(),ni(t).addClass("disabled");else for(e in r)ni(t=r[e]).removeClass("disabled");if(i&&n)for(e in a)ni(t=a[e]).hasClass("tool_button_current")&&q(),ni(t).addClass("disabled");else for(e in a)ni(t=a[e]).removeClass("disabled");ui.runExtensions("toolButtonStateUpdate",{nofill:n,nostroke:i}),ni(".tools_flyout").each(function(){var e=ni("#"+this.id+"_show"),t=!1;ni(this).children().each(function(){ni(this).hasClass("disabled")||(t=!0)}),e.toggleClass("disabled",!t)}),U()},K=function(){var e=D;null==e||e.parentNode||(e=null);var t=ui.getCurrentDrawing().getCurrentLayerName(),n=ui.getMode(),i="px"!==gi.baseUnit?gi.baseUnit:null,r="pathedit"===n,o=ni("#cmenu_canvas li");if(ni("#selected_panel, #multiselected_panel, #g_panel, #rect_panel, #circle_panel,#ellipse_panel, #line_panel, #text_panel, #image_panel, #container_panel, #use_panel, #a_panel").hide(),null!=e){var s=e.nodeName,l=ui.getRotationAngle(e);ni("#angle").val(l);var u=ui.getBlur(e);if(ni("#blur").val(u),ni("#blur_slider").slider("option","value",u),ui.addedNew&&"image"===s&&"image"===ui.getMode()&&(ui.getHref(e).startsWith("data:")||W({cancelDeletes:!0})),r||"pathedit"===n){var c=p.getNodePoint();if(ni("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"),ni("#tool_node_delete").toggleClass("disabled",!p.canDeleteNodes),a("#tool_openclose_path",p.closed_subpath?"open_path":"close_path"),c){var h=ni("#seg_type");i&&(c.x=ne(c.x),c.y=ne(c.y)),ni("#path_node_x").val(c.x),ni("#path_node_y").val(c.y),c.type?h.val(c.type).removeAttr("disabled"):h.val(4).attr("disabled","disabled")}return}if(ni("#selected_panel").show(),["line","circle","ellipse"].includes(s))ni("#xy_panel").hide();else{var d=void 0,f=void 0;if(["g","polyline","path"].includes(s)){var v=ui.getStrokedBBox([e]);v&&(d=v.x,f=v.y)}else d=e.getAttribute("x"),f=e.getAttribute("y");i&&(d=ne(d),f=ne(f)),ni("#selected_x").val(d||0),ni("#selected_y").val(f||0),ni("#xy_panel").show()}var y=!["image","text","path","g","use"].includes(s);ni("#tool_topath").toggle(y),ni("#tool_reorient").toggle("path"===s),ni("#tool_reorient").toggleClass("disabled",0===l);var _={g:[],a:[],rect:["rx","width","height"],image:["width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:[],use:[]},b=e.tagName,x=null;if("a"===b&&(x=ui.getHref(e),ni("#g_panel").show()),"a"===e.parentNode.tagName&&(ni(e).siblings().length||(ni("#a_panel").show(),x=ui.getHref(e.parentNode))),ni("#tool_make_link, #tool_make_link").toggle(!x),x&&ni("#link_url").val(x),_[b]){var w=_[b];if(ni("#"+b+"_panel").show(),ni.each(w,function(t,n){var i=e.getAttribute(n);if("px"!==gi.baseUnit&&e[n]){var r=e[n].baseVal.value;i=ne(r)}ni("#"+b+"_"+n).val(i||0)}),"text"===b)ni("#text_panel").css("display","inline"),ni("#tool_font_size").css("display","inline"),ui.getItalic()?ni("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):ni("#tool_italic").removeClass("push_button_pressed").addClass("tool_button"),ui.getBold()?ni("#tool_bold").addClass("push_button_pressed").removeClass("tool_button"):ni("#tool_bold").removeClass("push_button_pressed").addClass("tool_button"),ni("#font_family").val(e.getAttribute("font-family")),ni("#font_size").val(e.getAttribute("font-size")),ni("#text").val(e.textContent),ui.addedNew&&setTimeout(function(){ni("#text").focus().select()},100);else if("image"===b&&"image"===ui.getMode())X(ui.getHref(e));else if("g"===b||"use"===b){ni("#container_panel").show();var S=ui.getTitle(),k=ni("#g_title")[0];k.value=S,function(e){var t=Math.min(Math.max(12+6*e.value.length,50),300);ni(e).width(t)}(k),ni("#g_title").prop("disabled","use"===b)}}o[("g"===b?"en":"dis")+"ableContextMenuItems"]("#ungroup"),o[("g"!==b&&F?"en":"dis")+"ableContextMenuItems"]("#group")}else F?(ni("#multiselected_panel").show(),o.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")):o.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");ni("#tool_undo").toggleClass("disabled",0===g.getUndoStackSize()),ni("#tool_redo").toggleClass("disabled",0===g.getRedoStackSize()),ui.addedNew=!1,e&&!r||F?(ni("#selLayerNames").removeAttr("disabled").val(t),m.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")):ni("#selLayerNames").attr("disabled","disabled")},J=function(){if(!Xt){var e="#workarea.wireframe #svgcontent * { stroke-width: "+1/ui.getZoom()+"px; }";ni("#wireframe_rules").text(v.hasClass("wireframe")?e:"")}},te="",ie=function(e){e=e||ui.getDocumentTitle();var t=A+(e?": "+e:"");ni("title:first").text(t)};function ae(e){return e&&"g"===e.tagName&&an.CLASS_REGEX.test(e.getAttribute("class"))}var oe=function(){J()},se=ui.zoomChanged=function(e,t,n){var i=v,r=ui.setBBoxZoom(t,i.width()-15,i.height()-15);if(r){var a=r.zoom,o=r.bbox;a<.001?le({value:.1}):(ni("#zoom").val((100*a).toFixed(1)),n?$():$(!1,{x:o.x*a+o.width*a/2,y:o.y*a+o.height*a/2}),"zoom"===ui.getMode()&&o.width&&P(),oe())}},le=function(e){var t=e.value/100;if(t<.001)e.value=.1;else{var n=ui.getZoom(),i=v;se(window,{width:0,height:0,x:(i[0].scrollLeft+i.width()/2)/n,y:(i[0].scrollTop+i.height()/2)/n,zoom:t},!0)}};ni("#cur_context_panel").delegate("a","click",function(){var e=ni(this);return e.attr("data-root")?ui.leaveContext():ui.setContext(e.text()),ui.clearSelection(),!1});var ue=function(){y.fill.prep(),y.stroke.prep()},ce={},he=function(){ni(".tools_flyout").each(function(){var e=ni("#"+this.id+"_show");if(!e.data("isLibrary")){var t=[];ni(this).children().each(function(){t.push(this.title)}),e[0].title=t.join(" / ")}})},de=function(e){ni.each(e,function(t,n){var i=ni(t).children(),r=t+"_show",a=ni(r),o=!1;i.addClass("tool_button").unbind("click mousedown mouseup").each(function(t){var i=n[t];ce[i.sel]=i.fn,i.isDefault&&(o=t);var s=function(t){var n=i;if("keydown"===t.type){var o=ni(n.parent+"_show").hasClass("tool_button_current"),s=ni(n.parent+"_show").attr("data-curopt");ni.each(e[i.parent],function(r,a){a.sel===s&&(n=t.shiftKey&&o?e[i.parent][r+1]||e[i.parent][0]:a)})}if(ni(this).hasClass("disabled"))return!1;H(r)&&n.fn();var l=void 0;(l=n.icon?ni.getSvgIcon(n.icon,!0):ni(n.sel).children().eq(0).clone())[0].setAttribute("width",a.width()),l[0].setAttribute("height",a.height()),a.children(":not(.flyout_arrow_horiz)").remove(),a.append(l).attr("data-curopt",n.sel)};ni(this).mouseup(s),i.key&&ni(document).bind("keydown",i.key[0]+" shift+"+i.key[0],s)}),o?a.attr("data-curopt",n[o].sel):a.attr("data-curopt")||a.attr("data-curopt",n[0].sel);var s=void 0,l=ni(r).position();a.mousedown(function(e){if(a.hasClass("disabled"))return!1;var n=ni(t),i=l.left+34,r=-1*n.width(),o=n.data("shown_popop")?200:0;s=setTimeout(function(){a.data("isLibrary")?n.css("left",i).show():n.css("left",r).show().animate({left:i},150),n.data("shown_popop",!0)},o),e.preventDefault()}).mouseup(function(e){clearTimeout(s);var t=ni(this).attr("data-curopt");a.data("isLibrary")&&ni(r.replace("_show","")).is(":visible")?H(r,!0):H(r)&&ce[t]&&ce[t]()})}),he(),h()},fe=function(e,t){return ni("<div>",{class:"tools_flyout",id:e}).appendTo("#svg_editor").append(t)},pe=function(){var e=void 0,t=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0];for(e in n.style)if(t.test(e))return e.match(t)[0];return"WebkitOpacity"in n.style?"Webkit":"KhtmlOpacity"in n.style?"Khtml":""}(),ge=function(e,t,n,i){var r=ni(e),o=i.dropUp;t=ni(t),o&&ni(e).addClass("dropup"),t.find("li").bind("mouseup",function(){i.seticon&&(a("#cur_"+r[0].id,ni(this).children()),ni(this).addClass("current").siblings().removeClass("current")),n.apply(this,arguments)});var s=!1;ni(window).mouseup(function(e){s||(r.removeClass("down"),t.hide(),t.css({top:0,left:0})),s=!1}),r.bind("mousedown",function(){var e=r.offset();o?(e.top-=t.height(),e.left+=8):e.top+=r.height(),t.offset(e),r.hasClass("down")?(t.hide(),t.css({top:0,left:0})):(t.show(),s=!0),r.toggleClass("down")}).hover(function(){s=!0}).mouseout(function(){s=!1}),i.multiclick&&t.mousedown(function(){s=!0})},ve=[];ui.bind("selected",function(e,t){var n=ui.getMode();"select"===n&&P();var i="pathedit"===n;D=1===t.length||null==t[1]?t[0]:null,F=t.length>=2&&null!=t[1],null!=D&&(i||function(){var e=void 0,t=void 0;if(null!=D)switch(D.tagName){case"use":case"image":case"foreignObject":break;case"g":case"a":var n=D.getElementsByTagName("*"),i=null;for(e=0,t=n.length;e<t;e++){var r=n[e].getAttribute("stroke-width");0===e?i=r:i!==r&&(i=null)}ni("#stroke_width").val(null===i?"":i),y.fill.update(!0),y.stroke.update(!0);break;default:y.fill.update(!0),y.stroke.update(!0),ni("#stroke_width").val(D.getAttribute("stroke-width")||1),ni("#stroke_style").val(D.getAttribute("stroke-dasharray")||"none");var a=D.getAttribute("stroke-linejoin")||"miter";ni("#linejoin_"+a).length&&z(ni("#linejoin_"+a)[0]),a=D.getAttribute("stroke-linecap")||"butt",ni("#linecap_"+a).length&&z(ni("#linecap_"+a)[0])}if(null!=D){var o=100*(D.getAttribute("opacity")||1);ni("#group_opacity").val(o),ni("#opac_slider").slider("option","value",o),ni("#elem_id").val(D.id),ni("#elem_class").val(D.getAttribute("class"))}Z()}()),function(e,t){ni("#path_node_panel").toggle(e),ni("#tools_bottom_2,#tools_bottom_3").toggle(!e),e?(ni(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),ni("#tool_select").addClass("tool_button_current").removeClass("tool_button"),a("#tool_select","select_node"),F=!1,t.length&&(D=t[0])):setTimeout(function(){a("#tool_select","select")},1e3)}(i,t),K(),ui.runExtensions("selectedChanged",{elems:t,selectedElement:D,multiselected:F})}),ui.bind("transition",function(e,t){var n=ui.getMode(),i=t[0];if(i){if(!(F=t.length>=2&&null!=t[1]))switch(n){case"rotate":var r=ui.getRotationAngle(i);ni("#angle").val(r),ni("#tool_reorient").toggleClass("disabled",0===r)}ui.runExtensions("elementTransition",{elems:t})}}),ui.bind("changed",function(e,t){var n=ui.getMode();"select"===n&&P();for(var i=0;i<t.length;++i){var r=t[i],a=r&&"svg"===r.tagName;a||ae(r)?(L(),a&&$()):r&&D&&null==D.parentNode&&(D=r)}ii.showSaveWarning=!0,K(),D&&"select"===n&&(y.fill.update(),y.stroke.update()),ui.runExtensions("elementChanged",{elems:t})}),ui.bind("saved",function(e,t){if(ii.showSaveWarning=!1,t='<?xml version="1.0"?>\n'+t,M())R(0,!0);else{var n=document.createElement("a");n.href="data:image/svg+xml;base64,"+yt(t),n.download="icon.svg",n.click();var i=ni.pref("save_notice_done");if("all"!==i){var r=li.notification.saveFromBrowser.replace("%s","SVG");I()?t.includes("<defs")?(r+="\n\n"+li.notification.defsFailOnSave,ni.pref("save_notice_done","all"),i="all"):ni.pref("save_notice_done","part"):ni.pref("save_notice_done","all"),"part"!==i&&alert(r)}}}),ui.bind("exported",function(e,t){var n=t.issues,i=t.exportWindowName;if(i&&(x=window.open(St||"",i)),x&&!x.closed){if(x.location.href=t.bloburl||t.datauri,"all"!==ni.pref("export_notice_done")){var r=li.notification.saveFromBrowser.replace("%s",t.type);n.length&&(r+="\n\n"+li.notification.noteTheseIssues+"\n • "+n.join("\n • ")),ni.pref("export_notice_done","all"),x.alert(r)}}else ni.alert(li.notification.popupWindowBlocked)}),ui.bind("exportedPDF",function(e,t){var n=t.exportWindowName;n&&(x=window.open("",n)),x.location.href=t.dataurlstring}),ui.bind("zoomed",se),ui.bind("zoomDone",oe),ui.bind("updateCanvas",function(e,t){var n=t.center,i=t.newCtr;$(n,i)}),ui.bind("contextset",function(e,t){var n="";if(t){var i="";n='<a href="#" data-root="y">'+ui.getCurrentDrawing().getCurrentLayerName()+"</a>",ni(t).parentsUntil("#svgcontent > g").andSelf().each(function(){this.id&&(i+=" > "+this.id,n+=this!==t?' > <a href="#">'+this.id+"</a>":" > "+this.id)}),te=i}else te=null;ni("#cur_context_panel").toggle(!!t).html(n),ie()}),ui.bind("extension_added",function(e,t){if(t){var n=!1,i=!1,r=!0;if(t.langReady)if(ii.langChanged){var a=ni.pref("lang");t.langReady({lang:a,uiStrings:li})}else ve.push(t);var o=function(){t.callback&&!n&&r&&(n=!0,t.callback())},s=[];if(t.context_tools&&ni.each(t.context_tools,function(e,t){var n=t.container_id?' id="'+t.container_id+'"':"",i=ni("#"+t.panel);i.length||(i=ni("<div>",{id:t.panel}).appendTo("#tools_top"));var r=void 0;switch(t.type){case"tool_button":r='<div class="tool_button">'+t.id+"</div>";var a=ni(r).appendTo(i);t.events&&ni.each(t.events,function(e,t){ni(a).bind(e,t)});break;case"select":r="<label"+n+'><select id="'+t.id+'">',ni.each(t.options,function(e,n){var i=e===t.defval?" selected":"";r+='<option value="'+e+'"'+i+">"+n+"</option>"});var o=ni(r+="</select></label>").appendTo(i).find("select");ni.each(t.events,function(e,t){ni(o).bind(e,t)});break;case"button-select":r='<div id="'+t.id+'" class="dropdown toolset" title="'+t.title+'"><div id="cur_'+t.id+'" class="icon_label"></div><button></button></div>';var l=ni('<ul id="'+t.id+'_opts"></ul>').appendTo("#option_lists");t.colnum&&l.addClass("optcols"+t.colnum),ni(r).appendTo(i).children(),s.push({elem:"#"+t.id,list:"#"+t.id+"_opts",title:t.title,callback:t.events.change,cur:"#cur_"+t.id});break;case"input":r="<label"+n+'><span id="'+t.id+'_label">'+t.label+':</span><input id="'+t.id+'" title="'+t.title+'" size="'+(t.size||"4")+'" value="'+(t.defval||"")+'" type="text"/></label>';var u=ni(r).appendTo(i).find("input");t.spindata&&u.SpinButton(t.spindata),t.events&&ni.each(t.events,function(e,t){u.bind(e,t)})}}),t.buttons){var l={},u={},c=t.svgicons,h={};ni.each(t.buttons,function(e,t){for(var n=void 0,i=void 0,r=void 0,a=t.id,o=e;ni("#"+a).length;)a=t.id+"_"+ ++o;c?(l[a]=t.icon,i=t.svgicon||t.id,"app_menu"===t.type?u["#"+a+" > div"]=i:u["#"+a]=i):n=ni('<img src="'+t.icon+'">');var s=void 0,d=void 0;switch(t.type){case"mode_flyout":case"mode":s="tool_button",d="#tools_left";break;case"context":s="tool_button",d="#"+t.panel,ni(d).length||ni("<div>",{id:t.panel}).appendTo("#tools_top");break;case"app_menu":s="",d="#main_menu ul"}var f=void 0,p=void 0,g=void 0,v=void 0,m=void 0,y=ni(t.list||"app_menu"===t.type?"<li/>":"<div/>").attr("id",a).attr("title",t.title).addClass(s);if(t.includeWith||t.list){if(t.list)y.addClass("push_button"),ni("#"+t.list+"_opts").append(y),t.isDefault&&(ni("#cur_"+t.list).append(y.children().clone()),i=t.svgicon||t.id,u["#cur_"+t.list]=i);else if(t.includeWith){var _=t.includeWith;f=(m=ni(_.button)).parent(),m.parent().hasClass("tools_flyout")||(r=m[0].id.replace("tool_","tools_"),g=m.clone().attr("id",r+"_show").append(ni("<div>",{class:"flyout_arrow_horiz"})),m.before(g),f=fe(r,m)),v=un.getButtonData(_.button),_.isDefault&&(u["#"+r+"_show"]=t.id),p=h["#"+f[0].id]=[{sel:"#"+a,fn:t.events.click,icon:t.id,key:t.key,isDefault:t.includeWith?t.includeWith.isDefault:0},v];var b="position"in _?_.position:"last",x=f.children().length;!isNaN(b)&&b>=0&&b<x?f.children().eq(b).before(y):(f.append(y),p.reverse())}}else"position"in t?ni(d).children().eq(t.position).length?ni(d).children().eq(t.position).before(y):ni(d).children().last().before(y):y.appendTo(d),"mode_flyout"===t.type?(f=(m=ni(y)).parent(),m.parent().hasClass("tools_flyout")||(r=m[0].id.replace("tool_","tools_"),g=m.clone().attr("id",r+"_show").append(ni("<div>",{class:"flyout_arrow_horiz"})),m.before(g),(f=fe(r,m)).data("isLibrary",!0),g.data("isLibrary",!0)),u["#"+r+"_show"]=t.id,p=h["#"+f[0].id]=[{sel:"#"+a,fn:t.events.click,icon:t.id,isDefault:!0},v]):"app_menu"===t.type&&y.append("<div>").append(t.title);c||y.append(n),t.list||ni.each(t.events,function(e,n){"click"===e&&"mode"===t.type?(t.includeWith?y.bind(e,n):y.bind(e,function(){H(y)&&n()}),t.key&&(ni(document).bind("keydown",t.key,n),t.title&&y.attr("title",t.title+" ["+t.key+"]"))):y.bind(e,n)}),de(h)}),ni.each(s,function(){ge(this.elem,this.list,this.callback,{seticon:!0})}),c&&(r=!1),ni.svgIcons(c,{w:24,h:24,id_match:!1,no_img:!N(),fallback:l,placement:u,callback:function(e){"m"!==ni.pref("iconsize")&&(_&&(clearTimeout(_),_=null),i||(_=setTimeout(function(){i=!0,d(ni.pref("iconsize"))},50))),r=!0,o()}})}o()}}),ui.textActions.setInputElem(ni("#text")[0]);var me='<div class="palette_item" data-rgb="none"></div>';ni.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff","#aaaaff","#d4aaff","#ffaaff","#ffaad4"],function(e,t){me+='<div class="palette_item" style="background-color: '+t+';" data-rgb="'+t+'"></div>'}),ni("#palette").append(me);me="",ni.each(["#FFF","#888","#000"],function(){me+='<div class="color_block" style="background-color:'+this+';"></div>'}),ni("#bg_blocks").append(me);var ye=ni("#bg_blocks div");ye.each(function(){ni(this).click(function(){ye.removeClass("cur_background"),ni(this).addClass("cur_background")})}),Y(ni.pref("bkgd_color"),ni.pref("bkgd_url")),ni("#image_save_opts input").val([ni.pref("img_save")]);var _e=function(e,t){null==t&&(t=e.value),ni("#group_opacity").val(t),e&&e.handle||ni("#opac_slider").slider("option","value",t),ui.setOpacity(t/100)},be=function(e,t,n){null==t&&(t=e.value),ni("#blur").val(t);var i=!1;e&&e.handle||(ni("#blur_slider").slider("option","value",t),i=!0),n?ui.setBlurNoUndo(t):ui.setBlur(t,i)};ni("#stroke_style").change(function(){ui.setStrokeAttr("stroke-dasharray",ni(this).val()),U()}),ni("#stroke_linejoin").change(function(){ui.setStrokeAttr("stroke-linejoin",ni(this).val()),U()}),ni("select").change(function(){ni(this).blur()});var xe,we,Se,ke,Ce,Pe=!1;ni("#selLayerNames").change(function(){var e=this.options[this.selectedIndex].value,t=li.notification.QmoveElemsToLayer.replace("%s",e),n=function(t){t&&(Pe=!0,ui.moveSelectedToLayer(e),ui.clearSelection(),L())};e&&(Pe?n(!0):ni.confirm(t,n))}),ni("#font_family").change(function(){ui.setFontFamily(this.value)}),ni("#seg_type").change(function(){ui.setSegType(ni(this).val())}),ni("#text").bind("keyup input",function(){ui.setTextContent(this.value)}),ni("#image_url").change(function(){X(this.value)}),ni("#link_url").change(function(){this.value.length?ui.setLinkURL(this.value):ui.removeHyperlink()}),ni("#g_title").change(function(){ui.setGroupTitle(this.value)}),ni(".attr_changer").change(function(){var e=this.getAttribute("data-attr"),t=this.value;if(!re(e,t,D))return ni.alert(li.notification.invalidAttrValGiven),this.value=D.getAttribute(e),!1;if("id"!==e&&"class"!==e)if(isNaN(t))t=ui.convertToNum(e,t);else if("px"!==gi.baseUnit){var n=ee();(D[e]||"pathedit"===ui.getMode()||"x"===e||"y"===e)&&(t*=n[gi.baseUnit])}if("id"===e){var i=D;ui.clearSelection(),i.id=t,ui.addToSelection([i],!0)}else ui.changeSelectedAttribute(e,t);this.blur()}),ni("#palette").mouseover(function(){var e=ni('<input type="hidden">');ni(this).append(e),e.focus().remove()}),ni(".palette_item").mousedown(function(e){var t=e.shiftKey||2===e.button?"stroke":"fill",n=ni(this).data("rgb"),i=void 0;"none"===n||"transparent"===n||"initial"===n?(n="none",i=new ni.jGraduate.Paint):i=new ni.jGraduate.Paint({alpha:100,solidColor:n.substr(1)}),y[t].setPaint(i),ui.setColor(t,n),"none"!==n&&1!==ui.getPaintOpacity(t)&&ui.setPaintOpacity(t,1),Z()}).bind("contextmenu",function(e){e.preventDefault()}),ni("#toggle_stroke_tools").on("click",function(){ni("#tools_bottom").toggleClass("expanded")}),xe=v[0],we=null,Se=null,ke=!1,Ce=!1,ni("#svgcanvas").bind("mousemove mouseup",function(e){if(!1!==ke)return xe.scrollLeft-=e.clientX-we,xe.scrollTop-=e.clientY-Se,we=e.clientX,Se=e.clientY,"mouseup"===e.type&&(ke=!1),!1}).mousedown(function(e){if(1===e.button||!0===Ce)return ke=!0,we=e.clientX,Se=e.clientY,!1}),ni(window).mouseup(function(){ke=!1}),ni(document).bind("keydown","space",function(e){ui.spaceKey=Ce=!0,e.preventDefault()}).bind("keyup","space",function(e){e.preventDefault(),ui.spaceKey=Ce=!1}).bind("keydown","shift",function(e){"zoom"===ui.getMode()&&v.css("cursor",k)}).bind("keyup","shift",function(e){"zoom"===ui.getMode()&&v.css("cursor",S)}),ii.setPanning=function(e){ui.spaceKey=Ce=e},function(){var e=ni("#main_icon"),t=ni("#main_icon span"),n=ni("#main_menu"),i=!1,r=0,a=!0,o=!1;ni(window).mouseup(function(t){i||(e.removeClass("buttondown"),"INPUT"!==t.target.tagName?n.fadeOut(200):o||(o=!0,ni(t.target).click(function(){n.css("margin-left","-9999px").show()}))),i=!1}).mousedown(function(e){ni(e.target).closest("div.tools_flyout, .contextMenu").length||ni(".tools_flyout:visible,.contextMenu").fadeOut(250)}),t.bind("mousedown",function(){e.hasClass("buttondown")?n.fadeOut(200):(n.css("margin-left",0).show(),r||(r=n.height()),n.css("height",0).animate({height:r},200),i=!0),e.toggleClass("buttondown buttonup")}).hover(function(){i=!0}).mouseout(function(){i=!1});var s=ni("#main_menu li");s.mouseover(function(){a="rgba(0, 0, 0, 0)"===ni(this).css("background-color"),s.unbind("mouseover"),a&&s.mouseover(function(){this.style.backgroundColor="#FFC"}).mouseout(function(){return this.style.backgroundColor="transparent",!0})})}(),ii.addDropDown=function(e,t,n){if(ni(e).length){var i=ni(e).find("button"),r=ni(e).find("ul").attr("id",ni(e)[0].id+"-list");n?ni(e).addClass("dropup"):ni("#option_lists").append(r),r.find("li").bind("mouseup",t);var a=!1;ni(window).mouseup(function(e){a||(i.removeClass("down"),r.hide()),a=!1}),i.bind("mousedown",function(){if(i.hasClass("down"))r.hide();else{if(!n){var t=ni(e).position();r.css({top:t.top+24,left:t.left-10})}r.show(),a=!0}i.toggleClass("down")}).hover(function(){a=!0}).mouseout(function(){a=!1})}},ii.addDropDown("#font_family_dropdown",function(){ni("#font_family").val(ni(this).text()).change()}),ii.addDropDown("#opacity_dropdown",function(){if(!ni(this).find("div").length){var e=parseInt(ni(this).text().split("%")[0],10);_e(!1,e)}},!0),ni("#opac_slider").slider({start:function(){ni("#opacity_dropdown li:not(.special)").hide()},stop:function(){ni("#opacity_dropdown li").show(),ni(window).mouseup()},slide:function(e,t){_e(t)}}),ii.addDropDown("#blur_dropdown",ni.noop);var Ae,Ee,Te=!1;ni("#blur_slider").slider({max:10,step:.1,stop:function(e,t){Te=!1,be(t),ni("#blur_dropdown li").show(),ni(window).mouseup()},start:function(){Te=!0},slide:function(e,t){be(t,null,Te)}}),ii.addDropDown("#zoom_dropdown",function(){var e=ni(this),t=e.data("val");t?se(window,t):le({value:parseFloat(e.text())})},!0),ge("#stroke_linecap","#linecap_opts",function(){z(this,!0)},{dropUp:!0}),ge("#stroke_linejoin","#linejoin_opts",function(){z(this,!0)},{dropUp:!0}),ge("#tool_position","#position_opts",function(){var e=this.id.replace("tool_pos","").charAt(0);ui.alignSelectedElements(e,"page")},{multiclick:!0}),Ae=void 0,Ee=function(){ni(Ae).blur()},ni("#svg_editor").find("button, select, input:not(#text)").focus(function(){Ae=this,C="toolbars",v.mousedown(Ee)}).blur(function(){C="canvas",v.unbind("mousedown",Ee),"textedit"===ui.getMode()&&ni("#text").focus()});var Ge=function(){H("#tool_fhpath")&&ui.setMode("fhpath")},Ne=function(){H("#tool_line")&&ui.setMode("line")},Ie=function(){H("#tool_square")&&ui.setMode("square")},Me=function(){H("#tool_rect")&&ui.setMode("rect")},Le=function(){H("#tool_fhrect")&&ui.setMode("fhrect")},Oe=function(){H("#tool_circle")&&ui.setMode("circle")},Ve=function(){H("#tool_ellipse")&&ui.setMode("ellipse")},je=function(){H("#tool_fhellipse")&&ui.setMode("fhellipse")},Be=function(){H("#tool_image")&&ui.setMode("image")},Re=function(){H("#tool_zoom")&&(ui.setMode("zoom"),v.css("cursor",S))},De=function(e){var t=ui.getResolution();e=e?t.zoom*e:1,ni("#zoom").val(100*e),ui.setZoom(e),oe(),$(!0)},Fe=function(){H("#tool_zoom")&&(De(),P())},Ue=function(){H("#tool_text")&&ui.setMode("text")},ze=function(){H("#tool_path")&&ui.setMode("path")},He=function(){(null!=D||F)&&ui.deleteSelectedElements()},qe=function(){(null!=D||F)&&ui.cutSelectedElements()},Xe=function(){(null!=D||F)&&ui.copySelectedElements()},Ye=function(){var e=ui.getZoom(),t=(v[0].scrollLeft+v.width()/2)/e-ui.contentW,n=(v[0].scrollTop+v.height()/2)/e-ui.contentH;ui.pasteElements("point",t,n)},We=function(){null!=D&&ui.moveToTopSelectedElement()},Qe=function(){null!=D&&ui.moveToBottomSelectedElement()},$e=function(e){null!=D&&ui.moveUpDownSelected(e)},Ze=function(){null!=D&&ui.convertToPath()},Ke=function(){null!=D&&p.reorient()},Je=function(){(null!=D||F)&&ni.prompt(li.notification.enterNewLinkURL,"http://",function(e){e&&ui.makeHyperlink(e)})},et=function(e,t){if(null!=D||F){if(gi.gridSnapping){var n=ui.getZoom()*gi.snappingStep;e*=n,t*=n}ui.moveSelectedElements(e,t)}},tt=function(){ni("#tool_node_link").toggleClass("push_button_pressed tool_button");var e=ni("#tool_node_link").hasClass("push_button_pressed");p.linkControlPoints(e)},nt=function(){p.getNodePoint()&&p.clonePathNode()},it=function(){p.getNodePoint()&&p.deletePathNode()},rt=function(){var e=ni("#tool_add_subpath"),t=!e.hasClass("push_button_pressed");e.toggleClass("push_button_pressed tool_button"),p.addSubPath(t)},at=function(){p.opencloseSubPath()},ot=function(){ui.cycleElement(1)},st=function(){ui.cycleElement(0)},lt=function(e,t){if(null!=D&&!F){e||(t*=-1);var n=parseFloat(ni("#angle").val())+t;ui.setRotationAngle(n),K()}},ut=function(){var e=gi.dimensions;ni.confirm(li.notification.QwantToClear,function(t){t&&(P(),ui.clear(),ui.setResolution(e[0],e[1]),$(!0),De(),L(),K(),ue(),ui.runExtensions("onNewDocument"))})},ct=function(){return ui.setBold(!ui.getBold()),K(),!1},ht=function(){return ui.setItalic(!ui.getItalic()),K(),!1},dt=void 0,ft=function(){ni.select("Select an image type for export: ",["PNG","JPEG","BMP","WEBP","PDF"],function(e){if(e){var n=void 0;if("PDF"===e)fi||r(),ui.exportPDF(n);else{di||r();var i=parseInt(ni("#image-slider").val(),10)/100;ui.rasterExport(e,i,n)}}function r(){var e=li.notification.loadingImage;"new"===gi.exportWindowType&&ii.exportWindowCt++,n=gi.canvasName+ii.exportWindowCt;var i=void 0,r=void 0;if(dt)r=dt;else{if(i='<!DOCTYPE html><html><head><meta charset="utf-8"><title>'+e+"</title></head><body><h1>"+e+"</h1></body><html>",("undefined"==typeof URL||t(URL))&&URL.createObjectURL){var a=new Blob([i],{type:"text/html"});r=URL.createObjectURL(a)}else r="data:text/html;base64;charset=utf-8,"+yt(i);dt=r}x=window.open(r,n)}},function(){var e=ni(this);"JPEG"===e.val()||"WEBP"===e.val()?ni("#image-slider").length||ni("<div><label>"+li.ui.quality+'\n <input id="image-slider"\n type="range" min="1" max="100" value="92" />\n </label></div>').appendTo(e.parent()):ni("#image-slider").parent().remove()})},pt=function(){ui.open()},gt=function(){},vt=function(){g.getUndoStackSize()>0&&(g.undo(),L())},mt=function(){g.getRedoStackSize()>0&&(g.redo(),L())},_t=function(){F?ui.groupSelectedElements():D&&ui.ungroupSelectedElement()},bt=function(){ui.cloneSelectedElements(20,20)},xt=function(){var e=this.id.replace("tool_align","").charAt(0);ui.alignSelectedElements(e,ni("#align_relative_to").val())},wt=function(){if(ni("#tool_wireframe").toggleClass("push_button_pressed tool_button"),v.toggleClass("wireframe"),!Xt){var e=ni("#wireframe_rules");e.length?e.empty():e=ni('<style id="wireframe_rules"></style>').appendTo("head"),J()}};ni("#svg_docprops_container, #svg_prefs_container").draggable({cancel:"button,fieldset",containment:"window"});var kt,Ct,Pt=!1,At=!1,Et=function(){if(!Pt){Pt=!0,ni("#image_save_opts input").val([ni.pref("img_save")]);var e=ui.getResolution();"px"!==gi.baseUnit&&(e.w=ne(e.w)+gi.baseUnit,e.h=ne(e.h)+gi.baseUnit),ni("#canvas_width").val(e.w),ni("#canvas_height").val(e.h),ni("#canvas_title").val(ui.getDocumentTitle()),ni("#svg_docprops").show()}},Tt=function(){ni("#svg_source_editor").hide(),j=!1,ni("#svg_source_textarea").blur()},Gt=function(){if(j){var e=function(){ui.clearSelection(),Tt(),De(),L(),ie(),ue()};ui.setSvgString(ni("#svg_source_textarea").val())?e():ni.confirm(li.notification.QerrorsRevertToSource,function(t){if(!t)return!1;e()}),P()}},Nt=function(){ni("#svg_docprops").hide(),ni("#canvas_width,#canvas_height").removeAttr("disabled"),ni("#resolution")[0].selectedIndex=0,ni("#image_save_opts input").val([ni.pref("img_save")]),Pt=!1},It=function(){ni("#svg_prefs").hide(),At=!1},Mt=function(){var e=ni("#canvas_title").val();ie(e),ui.setDocumentTitle(e);var t=ni("#canvas_width"),n=t.val(),i=ni("#canvas_height"),r=i.val();return"fit"===n||re("width",n)?(t.parent().removeClass("error"),"fit"===r||re("height",r)?(i.parent().removeClass("error"),ui.setResolution(n,r)?(ni.pref("img_save",ni("#image_save_opts :checked").val()),$(),void Nt()):(ni.alert(li.notification.noContentToFitTo),!1)):(ni.alert(li.notification.invalidAttrValGiven),i.parent().addClass("error"),!1)):(ni.alert(li.notification.invalidAttrValGiven),t.parent().addClass("error"),!1)},Lt=ii.savePreferences=function(){Y(ni("#bg_blocks div.cur_background").css("background-color")||"#FFF",ni("#canvas_bg_url").val());var e=ni("#lang_select").val();e!==ni.pref("lang")&&ii.putLocale(e,n,gi),d(ni("#iconsize").val()),gi.gridSnapping=ni("#grid_snapping_on")[0].checked,gi.snappingStep=ni("#grid_snapping_step").val(),gi.gridColor=ni("#grid_color").val(),gi.showRulers=ni("#show_rulers")[0].checked,ni("#rulers").toggle(gi.showRulers),gi.showRulers&&Q(),gi.baseUnit=ni("#base_unit").val(),ui.setConfig(gi),$(),It()},Ot=ni.noop,Vt=function(){ni("#dialog_box").hide(),j||Pt||At?(j?B!==ni("#svg_source_textarea").val()?ni.confirm(li.notification.QignoreSourceChanges,function(e){e&&Tt()}):Tt():Pt?Nt():At&&It(),Ot()):te&&ui.leaveContext()},jt={width:ni(window).width(),height:ni(window).height()};if(M()&&(Ot=function(){0===v[0].scrollLeft&&0===v[0].scrollTop&&(v[0].scrollLeft=b.left,v[0].scrollTop=b.top)},b={left:v[0].scrollLeft,top:v[0].scrollTop},ni(window).resize(Ot),ii.ready(function(){setTimeout(function(){Ot()},500)}),v.scroll(function(){b={left:v[0].scrollLeft,top:v[0].scrollTop}})),ni(window).resize(function(e){ni.each(jt,function(e,t){var n=ni(window)[e]();v[0]["scroll"+("width"===e?"Left":"Top")]-=(n-t)/2,jt[e]=n}),h()}),v.scroll(function(){ni("#ruler_x").length&&(ni("#ruler_x")[0].scrollLeft=v[0].scrollLeft),ni("#ruler_y").length&&(ni("#ruler_y")[0].scrollTop=v[0].scrollTop)}),ni("#url_notice").click(function(){ni.alert(this.title)}),ni("#change_image_url").click(W),kt="tool_button_current",Ct="",ni.each(["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],function(e,t){Ct+=(e?",":"")+"#tool_"+t}),ni(Ct).mousedown(function(){ni(this).addClass(kt)}).bind("mousedown mouseout",function(){ni(this).removeClass(kt)}),ni("#tool_undo, #tool_redo").mousedown(function(){ni(this).hasClass("disabled")||ni(this).addClass(kt)}).bind("mousedown mouseout",function(){ni(this).removeClass(kt)}),O()&&!window.opera)for(var Bt=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"],Rt=Bt.length;Rt--;){var Dt=document.getElementById(Bt[Rt]);if(Dt){var Ft=Dt.title,Ut=Ft.indexOf("Ctrl+");Dt.title=[Ft.substr(0,Ut),"Cmd+",Ft.substr(Ut+5)].join("")}}var zt=function(e){var t="stroke_color"===e.attr("id")?"stroke":"fill",n="stroke"===t?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity",i=e.offset(),r=y[t].paint;ni("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(gi.colorPickerCSS||{left:i.left-140,bottom:40}).jGraduate({paint:r,window:{pickerTitle:n},images:{clientPath:gi.jGraduatePath},newstop:"inverse"},function(e){r=new ni.jGraduate.Paint(e),y[t].setPaint(r),ui.setPaint(t,r),ni("#color_picker").hide()},function(){ni("#color_picker").hide()})},Ht=function(e,t){var n=void 0,i=void 0,r=gi["fill"===t?"initFill":"initStroke"],a=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="16.5" height="16.5" fill="#'+r.color+'" opacity="'+r.opacity+'"/> <defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;(a=ni(e)[0].appendChild(document.importNode(a,!0))).setAttribute("width",16.5),this.rect=a.firstChild,this.defs=a.getElementsByTagName("defs")[0],this.grad=this.defs.firstChild,this.paint=new ni.jGraduate.Paint({solidColor:r.color}),this.type=t,this.setPaint=function(e,t){this.paint=e;var r=e.type,a=e.alpha/100,o="none";switch(r){case"solidColor":o="none"!==e[r]?"#"+e[r]:e[r];break;case"linearGradient":case"radialGradient":this.defs.removeChild(this.grad),this.grad=this.defs.appendChild(e[r]),o="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",o),this.rect.setAttribute("opacity",a),t&&(ui.setColor(this.type,n,!0),ui.setPaintOpacity(this.type,i,!0))},this.update=function(e){if(D){var t=this.type;switch(D.tagName){case"use":case"image":case"foreignObject":return;case"g":case"a":for(var r=D.getElementsByTagName("*"),a=null,o=0,s=r.length;o<s;o++){var l=r[o].getAttribute(t);if(0===o)a=l;else if(a!==l){a=null;break}}if(null===a)return void(n=null);n=a,i=1;break;default:i=parseFloat(D.getAttribute(t+"-opacity")),isNaN(i)&&(i=1);var u="fill"===t?"black":"none";n=D.getAttribute(t)||u}e&&(ui.setColor(t,n,!0),ui.setPaintOpacity(t,i,!0));var c=function(e,t,n){var i={alpha:t};if(e.startsWith("url(#")){var r=ui.getRefElem(e);i[(r=r?r.cloneNode(!0):ni("#"+n+"_color defs *")[0]).tagName]=r}else e.startsWith("#")?i.solidColor=e.substr(1):i.solidColor="none";return new ni.jGraduate.Paint(i)}(n,i*=100,t);this.setPaint(c)}},this.prep=function(){switch(this.paint.type){case"linearGradient":case"radialGradient":var e=new ni.jGraduate.Paint({copy:this.paint});ui.setPaint(t,e)}}};y.fill=new Ht("#fill_color","fill"),y.stroke=new Ht("#stroke_color","stroke"),ni("#stroke_width").val(gi.initStroke.width),ni("#group_opacity").val(100*gi.initOpacity);var qt=y.fill.rect.cloneNode(!1);qt.setAttribute("style","vector-effect:non-scaling-stroke");var Xt="non-scaling-stroke"===qt.style.vectorEffect;qt.removeAttribute("style");var Yt,Wt,Qt=y.fill.rect.ownerDocument.createElementNS(l.SVG,"feGaussianBlur");function $t(){ui.deleteCurrentLayer()&&(K(),L(),ni("#layerlist tr.layer").removeClass("layersel"),ni("#layerlist tr.layer:first").addClass("layersel"))}function Zt(e){var t=ui.getCurrentDrawing().getNumLayers(),n=ni("#layerlist tr.layersel").index();(n>0||n<t-1)&&(n+=e,ui.setCurrentLayerPosition(t-n-1),L())}void 0===Qt.stdDeviationX&&ni("#tool_blur").hide(),ni(Qt).remove(),Yt="-"+pe.toLowerCase()+"-zoom-",Wt=Yt+"in",v.css("cursor",Wt),v.css("cursor")===Wt&&(S=Wt,k=Yt+"out"),v.css("cursor","auto"),setTimeout(function(){ui.embedImage("images/logo.png",function(e){e||(ni("#image_save_opts [value=embed]").attr("disabled","disabled"),ni("#image_save_opts input").val(["ref"]),ni.pref("img_save","ref"),ni("#image_opt_embed").css("color","#666").attr("title",li.notification.featNotSupported))})},1e3),ni("#fill_color, #tool_fill .icon_label").click(function(){zt(ni("#fill_color")),Z()}),ni("#stroke_color, #tool_stroke .icon_label").click(function(){zt(ni("#stroke_color")),Z()}),ni("#group_opacityLabel").click(function(){ni("#opacity_dropdown button").mousedown(),ni(window).mouseup()}),ni("#zoomLabel").click(function(){ni("#zoom_dropdown button").mousedown(),ni(window).mouseup()}),ni("#tool_move_top").mousedown(function(e){ni("#tools_stacking").show(),e.preventDefault()}),ni(".layer_button").mousedown(function(){ni(this).addClass("layer_buttonpressed")}).mouseout(function(){ni(this).removeClass("layer_buttonpressed")}).mouseup(function(){ni(this).removeClass("layer_buttonpressed")}),ni(".push_button").mousedown(function(){ni(this).hasClass("disabled")||ni(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){ni(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){ni(this).removeClass("push_button_pressed").addClass("push_button")}),ni("#layer_new").click(function(){var e=void 0,t=ui.getCurrentDrawing().getNumLayers();do{e=li.layers.layer+" "+ ++t}while(ui.getCurrentDrawing().hasLayer(e));ni.prompt(li.notification.enterUniqueLayerName,e,function(e){e&&(ui.getCurrentDrawing().hasLayer(e)?ni.alert(li.notification.dupeLayerName):(ui.createLayer(e),K(),L()))})}),ni("#layer_delete").click($t),ni("#layer_up").click(function(){Zt(-1)}),ni("#layer_down").click(function(){Zt(1)}),ni("#layer_rename").click(function(){var e=ni("#layerlist tr.layersel td.layername").text();ni.prompt(li.notification.enterNewLayerName,"",function(t){t&&(e===t||ui.getCurrentDrawing().hasLayer(t)?ni.alert(li.notification.layerHasThatName):(ui.renameCurrentLayer(t),L()))})});var Kt=-1,Jt=!1,tn=!1,nn=function(e){var t=ni("#ruler_x");ni("#sidepanels").width("+="+e),ni("#layerpanel").width("+="+e),t.css("right",parseInt(t.css("right"),10)+e),v.css("right",parseInt(v.css("right"),10)+e),ui.runExtensions("workareaResized")},rn=function(e){if(tn&&-1!==Kt){Jt=!0;var t=Kt-e.pageX,n=ni("#sidepanels").width();n+t>300?(t=300-n,n=300):n+t<2&&(t=2-n,n=2),0!==t&&(Kt-=t,nn(t))}},on=function(e){var t=ni("#sidepanels").width();nn((t>2||e?2:150)-t)};ni("#sidepanel_handle").mousedown(function(e){Kt=e.pageX,ni(window).mousemove(rn),tn=!1,setTimeout(function(){tn=!0},20)}).mouseup(function(e){Jt||on(),Kt=-1,Jt=!1}),ni(window).mouseup(function(){Kt=-1,Jt=!1,ni("#svg_editor").unbind("mousemove",rn)}),L();ni(window).bind("load resize",function(){v.css("line-height",v.height()+"px")}),ni("#resolution").change(function(){var e=ni("#canvas_width,#canvas_height");if(this.selectedIndex)if("content"===this.value)e.val("fit").attr("disabled","disabled");else{var t=this.value.split("x");ni("#canvas_width").val(t[0]),ni("#canvas_height").val(t[1]),e.removeAttr("disabled")}else"fit"===ni("#canvas_width").val()&&e.removeAttr("disabled").val(100)}),ni("input,select").attr("autocomplete","off");var sn,ln,un=(sn=[{sel:"#tool_select",fn:q,evt:"click",key:["V",!0]},{sel:"#tool_fhpath",fn:Ge,evt:"click",key:["Q",!0]},{sel:"#tool_line",fn:Ne,evt:"click",key:["L",!0]},{sel:"#tool_rect",fn:Me,evt:"mouseup",key:["R",!0],parent:"#tools_rect",icon:"rect"},{sel:"#tool_square",fn:Ie,evt:"mouseup",parent:"#tools_rect",icon:"square"},{sel:"#tool_fhrect",fn:Le,evt:"mouseup",parent:"#tools_rect",icon:"fh_rect"},{sel:"#tool_ellipse",fn:Ve,evt:"mouseup",key:["E",!0],parent:"#tools_ellipse",icon:"ellipse"},{sel:"#tool_circle",fn:Oe,evt:"mouseup",parent:"#tools_ellipse",icon:"circle"},{sel:"#tool_fhellipse",fn:je,evt:"mouseup",parent:"#tools_ellipse",icon:"fh_ellipse"},{sel:"#tool_path",fn:ze,evt:"click",key:["P",!0]},{sel:"#tool_text",fn:Ue,evt:"click",key:["T",!0]},{sel:"#tool_image",fn:Be,evt:"mouseup"},{sel:"#tool_zoom",fn:Re,evt:"mouseup",key:["Z",!0]},{sel:"#tool_clear",fn:ut,evt:"mouseup",key:["N",!0]},{sel:"#tool_save",fn:function(){var e;j?Gt():(e={images:ni.pref("img_save"),round_digits:6},ui.save(e))},evt:"mouseup",key:["S",!0]},{sel:"#tool_export",fn:ft,evt:"mouseup"},{sel:"#tool_open",fn:pt,evt:"mouseup",key:["O",!0]},{sel:"#tool_import",fn:gt,evt:"mouseup"},{sel:"#tool_source",fn:R,evt:"click",key:["U",!0]},{sel:"#tool_wireframe",fn:wt,evt:"click",key:["F",!0]},{sel:"#tool_source_cancel,.overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Vt,evt:"click",key:["esc",!1,!1],hidekey:!0},{sel:"#tool_source_save",fn:Gt,evt:"click"},{sel:"#tool_docprops_save",fn:Mt,evt:"click"},{sel:"#tool_docprops",fn:Et,evt:"mouseup"},{sel:"#tool_prefs_save",fn:Lt,evt:"click"},{sel:"#tool_prefs_option",fn:function(){return function(){if(!At){At=!0,ni("#main_menu").hide();var e=ni("#bg_blocks div"),t="cur_background",n=pi.bkgd_color,i=ni.pref("bkgd_url");e.each(function(){var e=ni(this),i=e.css("background-color")===n;e.toggleClass(t,i),i&&ni("#canvas_bg_url").removeClass(t)}),n||e.eq(0).addClass(t),i&&ni("#canvas_bg_url").val(i),ni("#grid_snapping_on").prop("checked",gi.gridSnapping),ni("#grid_snapping_step").attr("value",gi.snappingStep),ni("#grid_color").attr("value",gi.gridColor),ni("#svg_prefs").show()}}(),!1},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:He,evt:"click",key:["del/backspace",!0]},{sel:"#tool_reorient",fn:Ke,evt:"click"},{sel:"#tool_node_link",fn:tt,evt:"click"},{sel:"#tool_node_clone",fn:nt,evt:"click"},{sel:"#tool_node_delete",fn:it,evt:"click"},{sel:"#tool_openclose_path",fn:at,evt:"click"},{sel:"#tool_add_subpath",fn:rt,evt:"click"},{sel:"#tool_move_top",fn:We,evt:"click",key:"ctrl+shift+]"},{sel:"#tool_move_bottom",fn:Qe,evt:"click",key:"ctrl+shift+["},{sel:"#tool_topath",fn:Ze,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:Je,evt:"click"},{sel:"#tool_undo",fn:vt,evt:"click"},{sel:"#tool_redo",fn:mt,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:bt,evt:"click",key:["D",!0]},{sel:"#tool_group_elements",fn:_t,evt:"click",key:["G",!0]},{sel:"#tool_ungroup",fn:_t,evt:"click"},{sel:"#tool_unlink_use",fn:_t,evt:"click"},{sel:"[id^=tool_align]",fn:xt,evt:"click"},{sel:"#tool_bold",fn:ct,evt:"mousedown"},{sel:"#tool_italic",fn:ht,evt:"mousedown"},{sel:"#sidepanel_handle",fn:on,key:["X"]},{sel:"#copy_save_done",fn:Vt,evt:"click"},{key:"ctrl+left",fn:function(){lt(0,1)}},{key:"ctrl+right",fn:function(){lt(1,1)}},{key:"ctrl+shift+left",fn:function(){lt(0,5)}},{key:"ctrl+shift+right",fn:function(){lt(1,5)}},{key:"shift+O",fn:st},{key:"shift+P",fn:ot},{key:[f+"up",!0],fn:function(){De(2)}},{key:[f+"down",!0],fn:function(){De(.5)}},{key:[f+"]",!0],fn:function(){$e("Up")}},{key:[f+"[",!0],fn:function(){$e("Down")}},{key:["up",!0],fn:function(){et(0,-1)}},{key:["down",!0],fn:function(){et(0,1)}},{key:["left",!0],fn:function(){et(-1,0)}},{key:["right",!0],fn:function(){et(1,0)}},{key:"shift+up",fn:function(){et(0,-10)}},{key:"shift+down",fn:function(){et(0,10)}},{key:"shift+left",fn:function(){et(-10,0)}},{key:"shift+right",fn:function(){et(10,0)}},{key:["alt+up",!0],fn:function(){ui.cloneSelectedElements(0,-1)}},{key:["alt+down",!0],fn:function(){ui.cloneSelectedElements(0,1)}},{key:["alt+left",!0],fn:function(){ui.cloneSelectedElements(-1,0)}},{key:["alt+right",!0],fn:function(){ui.cloneSelectedElements(1,0)}},{key:["alt+shift+up",!0],fn:function(){ui.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",!0],fn:function(){ui.cloneSelectedElements(0,10)}},{key:["alt+shift+left",!0],fn:function(){ui.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",!0],fn:function(){ui.cloneSelectedElements(10,0)}},{key:"A",fn:function(){ui.selectAllInCurrentLayer()}},{key:f+"z",fn:vt},{key:f+"shift+z",fn:mt},{key:f+"y",fn:mt},{key:f+"x",fn:qe},{key:f+"c",fn:Xe},{key:f+"v",fn:Ye}],ln={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"},{setAll:function(){var e={};ni.each(sn,function(t,n){var i=void 0;if(n.sel){if(!(i=ni(n.sel)).length)return!0;if(n.evt&&(V()&&"click"===n.evt&&(n.evt="mousedown"),i[n.evt](n.fn)),n.parent&&ni(n.parent+"_show").length){var r=ni(n.parent);r.length||(r=fe(n.parent.substr(1))),r.append(i),Array.isArray(e[n.parent])||(e[n.parent]=[]),e[n.parent].push(n)}}if(n.key){var a=void 0,o=!1;Array.isArray(n.key)?(a=n.key[0],n.key.length>1&&(o=n.key[1])):a=n.key,a+="";var s=n.fn;if(ni.each(a.split("/"),function(e,t){ni(document).bind("keydown",t,function(e){return s(),o&&e.preventDefault(),!1})}),n.sel&&!n.hidekey&&i.attr("title")){var l=i.attr("title").split("[")[0]+" ("+a+")";ln[a]=n.sel,i.parents("#main_menu").length||i.attr("title",l)}}}),de(e),ni(".attr_changer, #image_url").bind("keydown","return",function(e){ni(this).change(),e.preventDefault()}),ni(window).bind("keydown","tab",function(e){"canvas"===C&&(e.preventDefault(),ot())}).bind("keydown","shift+tab",function(e){"canvas"===C&&(e.preventDefault(),st())}),ni("#tool_zoom").dblclick(Fe)},setTitles:function(){ni.each(ln,function(e,t){var n=ni(t).parents("#main_menu").length;ni(t).each(function(){var t=void 0;t=n?ni(this).text().split(" [")[0]:this.title.split(" [")[0];var i="";ni.each(e.split("/"),function(e,t){var n=t.split("+"),r="";n.length>1&&(r=n[0]+"+",t=n[1]),i+=(e?"/":"")+r+(li["key_"+t]||t)}),n?this.lastChild.textContent=t+" ["+i+"]":this.title=t+" ["+i+"]"})})},getButtonData:function(e){var t=void 0;return ni.each(sn,function(n,i){i.sel===e&&(t=i)}),t}});un.setAll(),ii.ready(function(){var e=gi.initTool,t=ni("#tools_left, #svg_editor .tools_flyout"),n=t.find("#tool_"+e),i=t.find("#"+e);(n.length?n:i.length?i:ni("#tool_select")).click().mouseup(),gi.wireframe&&ni("#tool_wireframe").click(),gi.showlayers&&on(),ni("#rulers").toggle(!!gi.showRulers),gi.showRulers&&(ni("#show_rulers")[0].checked=!0),gi.baseUnit&&ni("#base_unit").val(gi.baseUnit),gi.gridSnapping&&(ni("#grid_snapping_on")[0].checked=!0),gi.snappingStep&&ni("#grid_snapping_step").val(gi.snappingStep),gi.gridColor&&ni("#grid_color").val(gi.gridColor)}),ni("#rect_rx").SpinButton({min:0,max:1e3,stateObj:c,callback:function(e){ui.setRectRadius(e.value)}}),ni("#stroke_width").SpinButton({min:0,max:99,smallStep:.1,stateObj:c,callback:function(e){var t=e.value;0===t&&D&&["line","polyline"].includes(D.nodeName)&&(t=e.value=1),ui.setStrokeWidth(t)}}),ni("#angle").SpinButton({min:-180,max:180,step:5,stateObj:c,callback:function(e){ui.setRotationAngle(e.value),ni("#tool_reorient").toggleClass("disabled",0===parseInt(e.value,10))}}),ni("#font_size").SpinButton({min:.001,stepfunc:function(e,t){var n=Number(e.value),i=n+t,r=i>=n;return 0===t?n:n>=24?r?Math.round(1.1*n):Math.round(n/1.1):n<=1?r?2*n:n/2:i},stateObj:c,callback:function(e){ui.setFontSize(e.value)}}),ni("#group_opacity").SpinButton({min:0,max:100,step:5,stateObj:c,callback:_e}),ni("#blur").SpinButton({min:0,max:10,step:.1,stateObj:c,callback:be}),ni("#zoom").SpinButton({min:.001,max:1e4,step:50,stepfunc:function(e,t){var n=Number(e.value);if(0===n)return 100;var i=n+t;return 0===t?n:n>=100?i:i>=n?2*n:n/2},stateObj:c,callback:le}).val(100*ui.getZoom()),ni("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(e,t,n){switch(e){case"delete":He();break;case"cut":qe();break;case"copy":Xe();break;case"paste":ui.pasteElements();break;case"paste_in_place":ui.pasteElements("in_place");break;case"group":case"group_elements":ui.groupSelectedElements();break;case"ungroup":ui.ungroupSelectedElement();break;case"move_front":We();break;case"move_up":$e("Up");break;case"move_down":$e("Down");break;case"move_back":Qe();break;default:Boolean(en[e])&&function(e){return en[e].action}(e).call()}});var cn=function(e,t,n){switch(e){case"dupe":i=ui.getCurrentDrawing().getCurrentLayerName()+" copy",ni.prompt(li.notification.enterUniqueLayerName,i,function(e){e&&(ui.getCurrentDrawing().hasLayer(e)?ni.alert(li.notification.dupeLayerName):(ui.cloneLayer(e),K(),L()))});break;case"delete":$t();break;case"merge_down":ni("#layerlist tr.layersel").index()!==ui.getCurrentDrawing().getNumLayers()-1&&(ui.mergeLayer(),K(),L());break;case"merge_all":ui.mergeAllLayers(),K(),L()}var i};if(ni("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},cn),ni("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:!0},cn),ni(".contextMenu li").mousedown(function(e){e.preventDefault()}),ni("#cmenu_canvas li").disableContextMenu(),m.enableContextMenuItems("#delete,#cut,#copy"),m[(localStorage.getItem("svgedit_clipboard")?"en":"dis")+"ableContextMenuItems"]("#paste,#paste_in_place"),window.addEventListener("storage",function(e){"svgedit_clipboard"===e.key&&m[(localStorage.getItem("svgedit_clipboard")?"en":"dis")+"ableContextMenuItems"]("#paste,#paste_in_place")}),window.addEventListener("beforeunload",function(e){if(0===g.getUndoStackSize()&&(ii.showSaveWarning=!1),!gi.no_save_warning&&ii.showSaveWarning)return e.returnValue=li.notification.unsavedChanges,li.notification.unsavedChanges},!1),ii.canvas.getUIStrings=function(){return li},ii.openPrep=function(e){ni("#main_menu").hide(),0===g.getUndoStackSize()?e(!0):ni.confirm(li.notification.QwantToOpen,e)},window.FileReader){var hn=function(e){ni.process_cancel(li.notification.loadingImage),e.stopPropagation(),e.preventDefault(),ni("#workarea").removeAttr("style"),ni("#main_menu").hide();var t="drop"===e.type?e.dataTransfer.files[0]:this.files[0];if(t){if(t.type.includes("image")){var n=void 0;t.type.includes("svg")?((n=new FileReader).onloadend=function(e){var t=ui.importSvgString(e.target.result,!0);ui.ungroupSelectedElement(),ui.ungroupSelectedElement(),ui.groupSelectedElements(),ui.alignSelectedElements("m","page"),ui.alignSelectedElements("c","page"),ui.selectOnly([t]),ni("#dialog_box").hide()},n.readAsText(t)):((n=new FileReader).onloadend=function(e){var t=100,n=100,i=new Image;i.src=e.target.result,i.style.opacity=0,i.onload=function(){var r,a,o;t=i.offsetWidth,n=i.offsetHeight,r=t,a=n,o=ui.addSvgElementFromJson({element:"image",attr:{x:0,y:0,width:r,height:a,id:ui.getNextId(),style:"pointer-events:inherit"}}),ui.setHref(o,e.target.result),ui.selectOnly([o]),ui.alignSelectedElements("m","page"),ui.alignSelectedElements("c","page"),K(),ni("#dialog_box").hide()}},n.readAsDataURL(t))}}else ni("#dialog_box").hide()};v[0].addEventListener("dragenter",function(e){e.stopPropagation(),e.preventDefault()},!1),v[0].addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault()},!1),v[0].addEventListener("dragleave",function(e){e.stopPropagation(),e.preventDefault()},!1),v[0].addEventListener("drop",hn,!1);var dn=ni('<input type="file">').change(function(){var e=this;ii.openPrep(function(t){if(t&&(ui.clear(),1===e.files.length)){ni.process_cancel(li.notification.loadingImage);var n=new FileReader;n.onloadend=function(e){vi(e.target.result),$()},n.readAsText(e.files[0])}})});ni("#tool_open").show().prepend(dn);var fn=ni('<input type="file">').change(hn);ni("#tool_import").show().prepend(fn)}$(!0),window.svgCanvas=ui,ui.ready=ii.ready;var pn=ii.setLang=function(e,t){if(ii.langChanged=!0,ni.pref("lang",e),ni("#lang_select").val(e),t){ni.extend(li,t);var n=ni("#layerlist tr.layersel td.layername").text()===li.common.layer+" 1";if(ui.setUiStrings(t),un.setTitles(),n&&(ui.renameCurrentLayer(li.common.layer+" 1"),L()),ve.length)for(;ve.length;){ve.shift().langReady({lang:e,uiStrings:li})}else ui.runExtensions("langReady",{lang:e,uiStrings:li});ui.runExtensions("langChanged",e),he();ni.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(e,t){ni(t).attr("title",ni(e)[0].title)}),ni("#multiselected_panel div[id^=tool_align]").each(function(){ni("#tool_pos"+this.id.substr(10))[0].title=this.title})}};!function(e){ti=e}({addLangData:function(e){return ii.canvas.runExtensions("addlangData",e,!0)},curConfig:gi,setLang:pn}),"file:"===document.location.protocol?setTimeout(u,100):u()},ii.ready=function(e){hi?e():ri.push(e)},ii.runCallbacks=function(){Promise.all(ri.map(function(e){return e()})).then(function(){hi=!0})},ii.loadFromString=function(e){ii.ready(function(){vi(e)})},ii.disableUI=function(e){},ii.loadFromURL=function(e,t){t||(t={});var n=t,i=n.cache,r=n.callback;ii.ready(function(){ni.ajax({url:e,dataType:"text",cache:!!i,beforeSend:function(){ni.process_cancel(li.notification.loadingImage)},success:function(e){vi(e,r)},error:function(e,t,n){404!==e.status&&e.responseText?vi(e.responseText,r):ni.alert(li.notification.URLloadFail+": \n"+n,r)},complete:function(){ni("#dialog_box").hide()}})})},ii.loadFromDataURI=function(e){ii.ready(function(){var t=!1,n=e.match(/^data:image\/svg\+xml;base64,/);n?t=!0:n=e.match(/^data:image\/svg\+xml(?:;(?:utf8)?)?,/),n&&(n=n[0]);var i=e.slice(n.length);vi(t?_t(i):decodeURIComponent(i))})},ii.addExtension=function(){var e=arguments;ui&&ui.addExtension.apply(this,e)},ii.ready(function(){!function(){for(var e in en)tn(en[e])}()}),Promise.resolve().then(function(){ii.init()}),ii});
//# sourceMappingURL=index-umd.min.js.map