3 lines
360 KiB
JavaScript
3 lines
360 KiB
JavaScript
function touchHandler(e){var t=e.changedTouches,n=t[0],a="";switch(e.type){case"touchstart":a="mousedown";break;case"touchmove":a="mousemove";break;case"touchend":a="mouseup";break;default:return}var r=n.screenX,i=n.screenY,o=n.clientX,s=n.clientY,l=new MouseEvent(a,{bubbles:!0,cancelable:!0,view:window,detail:1,screenX:r,screenY:i,clientX:o,clientY:s,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});t.length<2&&(n.target.dispatchEvent(l),e.preventDefault())}document.addEventListener("touchstart",touchHandler,!0),document.addEventListener("touchmove",touchHandler,!0),document.addEventListener("touchend",touchHandler,!0),document.addEventListener("touchcancel",touchHandler,!0);var _typeof="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},asyncToGenerator=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){return function a(r,i){try{var o=t[r](i),s=o.value}catch(e){return void n(e)}if(!o.done)return Promise.resolve(s).then(function(e){a("next",e)},function(e){a("throw",e)});e(s)}("next")})}},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},inherits=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)},possibleConstructorReturn=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},slicedToArray=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],a=!0,r=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,i=e}finally{try{!a&&s.return&&s.return()}finally{if(r)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),toConsumableArray=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)},NS={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/"},getReverseNS=function(){var e={};return Object.entries(NS).forEach(function(t){var n=slicedToArray(t,2),a=n[0],r=n[1];e[r]=a.toLowerCase()}),e};!function(){if(!("SVGPathSeg"in window)){var e=function(){function e(t,n,a){classCallCheck(this,e),this.pathSegType=t,this.pathSegTypeAsLetter=n,this._owningPathSegList=a}return createClass(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 n(t){return classCallCheck(this,n),possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CLOSEPATH,"z",t))}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegClosePath]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter}},{key:"clone",value:function(){return new n(void 0)}}]),n}(),n=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_MOVETO_ABS,"M",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegMovetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(n.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 a=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_MOVETO_REL,"m",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegMovetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(a.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 r=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_ABS,"L",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(r.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 i=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_REL,"l",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(i.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 o=function(t){function n(t,a,r,i,o,s,l){classCallCheck(this,n);var c=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_ABS,"C",t));return c._x=a,c._y=r,c._x1=i,c._y1=o,c._x2=s,c._y2=l,c}return inherits(n,e),createClass(n,[{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 n(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),n}();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},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 s=function(t){function n(t,a,r,i,o,s,l){classCallCheck(this,n);var c=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_REL,"c",t));return c._x=a,c._y=r,c._x1=i,c._y1=o,c._x2=s,c._y2=l,c}return inherits(n,e),createClass(n,[{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 n(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),n}();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},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 l=function(t){function n(t,a,r,i,o){classCallCheck(this,n);var s=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t));return s._x=a,s._y=r,s._x1=i,s._y1=o,s}return inherits(n,e),createClass(n,[{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 n(void 0,this._x,this._y,this._x1,this._y1)}}]),n}();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},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 c=function(t){function n(t,a,r,i,o){classCallCheck(this,n);var s=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_REL,"q",t));return s._x=a,s._y=r,s._x1=i,s._y1=o,s}return inherits(n,e),createClass(n,[{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 n(void 0,this._x,this._y,this._x1,this._y1)}}]),n}();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}});var u=function(t){function n(t,a,r,i,o,s,l,c){classCallCheck(this,n);var u=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_ARC_ABS,"A",t));return u._x=a,u._y=r,u._r1=i,u._r2=o,u._angle=s,u._largeArcFlag=l,u._sweepFlag=c,u}return inherits(n,e),createClass(n,[{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 n(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),n}();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},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 d=function(t){function n(t,a,r,i,o,s,l,c){classCallCheck(this,n);var u=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_ARC_REL,"a",t));return u._x=a,u._y=r,u._r1=i,u._r2=o,u._angle=s,u._largeArcFlag=l,u._sweepFlag=c,u}return inherits(n,e),createClass(n,[{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 n(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),n}();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},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 h=function(t){function n(t,a){classCallCheck(this,n);var r=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t));return r._x=a,r}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new n(void 0,this._x)}}]),n}();Object.defineProperty(h.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var g=function(t){function n(t,a){classCallCheck(this,n);var r=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_HORIZONTAL_REL,"h",t));return r._x=a,r}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new n(void 0,this._x)}}]),n}();Object.defineProperty(g.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var p=function(t){function n(t,a){classCallCheck(this,n);var r=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_VERTICAL_ABS,"V",t));return r._y=a,r}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._y)}}]),n}();Object.defineProperty(p.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var f=function(t){function n(t,a){classCallCheck(this,n);var r=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_VERTICAL_REL,"v",t));return r._y=a,r}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._y)}}]),n}();Object.defineProperty(f.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var v=function(t){function n(t,a,r,i,o){classCallCheck(this,n);var s=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t));return s._x=a,s._y=r,s._x2=i,s._y2=o,s}return inherits(n,e),createClass(n,[{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 n(void 0,this._x,this._y,this._x2,this._y2)}}]),n}();Object.defineProperties(v.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 m=function(t){function n(t,a,r,i,o){classCallCheck(this,n);var s=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t));return s._x=a,s._y=r,s._x2=i,s._y2=o,s}return inherits(n,e),createClass(n,[{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 n(void 0,this._x,this._y,this._x2,this._y2)}}]),n}();Object.defineProperties(m.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 _=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(_.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 b=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();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}}),SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new t(void 0)},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(e,t){return new n(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(e,t){return new a(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new r(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new i(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,a,r,i){return new o(void 0,e,t,n,a,r,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,a,r,i){return new s(void 0,e,t,n,a,r,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,a){return new l(void 0,e,t,n,a)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(e,t,n,a){return new c(void 0,e,t,n,a)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(e,t,n,a,r,i,o){return new u(void 0,e,t,n,a,r,i,o)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,a,r,i,o){return new d(void 0,e,t,n,a,r,i,o)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(e){return new h(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(e){return new g(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new p(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new f(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,a){return new v(void 0,e,t,n,a)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,a){return new m(void 0,e,t,n,a)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new _(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new b(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=n,window.SVGPathSegMovetoRel=a,window.SVGPathSegLinetoAbs=r,window.SVGPathSegLinetoRel=i,window.SVGPathSegCurvetoCubicAbs=o,window.SVGPathSegCurvetoCubicRel=s,window.SVGPathSegCurvetoQuadraticAbs=l,window.SVGPathSegCurvetoQuadraticRel=c,window.SVGPathSegArcAbs=u,window.SVGPathSegArcRel=d,window.SVGPathSegLinetoHorizontalAbs=h,window.SVGPathSegLinetoHorizontalRel=g,window.SVGPathSegLinetoVerticalAbs=p,window.SVGPathSegLinetoVerticalRel=f,window.SVGPathSegCurvetoCubicSmoothAbs=v,window.SVGPathSegCurvetoCubicSmoothRel=m,window.SVGPathSegCurvetoQuadraticSmoothAbs=_,window.SVGPathSegCurvetoQuadraticSmoothRel=b}if(!("SVGPathSegList"in window&&"appendItem"in SVGPathSegList.prototype)){var y=function(){function e(t){classCallCheck(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 createClass(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,n=function(){function e(){classCallCheck(this,e),this.pathSegList=[]}return createClass(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),a=function(){function e(t){classCallCheck(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return createClass(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,a=0,r=1,i=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,c=1;l>=s;)t+=c*(this._string.charAt(l--)-"0"),c*=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,a+=(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++,i=-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 u=t+a;if(u*=r,e&&(u*=Math.pow(10,i*e)),o!==this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),u}}},{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 a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,a.x,a.y,a.x1,a.y1,a.x2,a.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 i={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(t,i.x,i.y,i.x2,i.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 c={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,c.x,c.y,c.x1,c.y1,c.arcAngle,c.arcLarge,c.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS: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 SVGPathSegArcAbs(t,u.x,u.y,u.x1,u.y1,u.arcAngle,u.arcLarge,u.arcSweep);default:throw new Error("Unknown path seg type.")}}}]),e}(),r=new n,i=new a(e);if(!i.initialCommandIsMoveTo())return[];for(;i.hasMoreData();){var o=i.parseSegment();if(!o)return[];r.appendSegment(o)}return r.pathSegList}}]),e}();y.prototype.classname="SVGPathSegList",Object.defineProperty(y.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),y._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 y(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=y}}();var $=jQuery,supportsSVG_=!!document.createElementNS&&!!document.createElementNS(NS.SVG,"svg").createSVGRect,_navigator=navigator,userAgent=_navigator.userAgent,svg=document.createElementNS(NS.SVG,"svg"),isOpera_=!!window.opera,isWebkit_=userAgent.includes("AppleWebKit"),isGecko_=userAgent.includes("Gecko/"),isIE_=userAgent.includes("MSIE"),isChrome_=userAgent.includes("Chrome/"),isWindows_=userAgent.includes("Windows"),isMac_=userAgent.includes("Macintosh"),isTouch_="ontouchstart"in window,supportsSelectors_=!!svg.querySelector,supportsXpath_=!!document.evaluate,supportsPathReplaceItem_=function(){var e=document.createElementNS(NS.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}(),supportsPathInsertItemBefore_=function(){var e=document.createElementNS(NS.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}(),supportsGoodTextCharPos_=function(){var e=document.createElementNS(NS.SVG,"svg"),t=document.createElementNS(NS.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(NS.SVG,"text");n.textContent="a",t.append(n);var a=n.getStartPositionOfChar(0).x;return e.remove(),0===a}(),supportsPathBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(NS.SVG,"path");t.setAttribute("d","M0,0 C0,0 10,10 10,0"),e.append(t);var n=t.getBBox();return e.remove(),n.height>4&&n.height<5}(),supportsHVLineContainerBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(NS.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(NS.SVG,"path");n.setAttribute("d","M5,0 15,0");var a=document.createElementNS(NS.SVG,"g");a.append(t,n),e.append(a);var r=a.getBBox();return e.remove(),15===r.width}(),supportsGoodDecimals_=function(){var e=document.createElementNS(NS.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");return t||$.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.'),t}(),supportsNonScalingStroke_=function(){var e=document.createElementNS(NS.SVG,"rect");return e.setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===e.style.vectorEffect}(),supportsNativeSVGTransformLists_=function(){var e=document.createElementNS(NS.SVG,"rect").transform.baseVal,t=svg.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}(),isOpera=function(){return isOpera_},isWebkit=function(){return isWebkit_},isGecko=function(){return isGecko_},isIE=function(){return isIE_},isChrome=function(){return isChrome_},isMac=function(){return isMac_},isTouch=function(){return isTouch_},supportsSelectors=function(){return supportsSelectors_},supportsXpath=function(){return supportsXpath_},supportsPathReplaceItem=function(){return supportsPathReplaceItem_},supportsPathInsertItemBefore=function(){return supportsPathInsertItemBefore_},supportsPathBBox=function(){return supportsPathBBox_},supportsHVLineContainerBBox=function(){return supportsHVLineContainerBBox_},supportsGoodTextCharPos=function(){return supportsGoodTextCharPos_},supportsNonScalingStroke=function(){return supportsNonScalingStroke_},supportsNativeTransformLists=function(){return supportsNativeSVGTransformLists_};function jqPluginSVG(e){var t=e.fn.attr;return e.fn.attr=function(e,n){var a=this.length;if(!a)return t.apply(this,arguments);for(var r=0;r<a;++r){var i=this[r];if("http://www.w3.org/2000/svg"!==i.namespaceURI)return t.apply(this,arguments);if(void 0!==n)i.setAttribute(e,n);else if(Array.isArray(e)){for(var o={},s=e.length;s--;){var l=e[s],c=i.getAttribute(l);(c||"0"===c)&&(c=isNaN(c)?c:c-0),o[l]=c}return o}if("object"!==(void 0===e?"undefined":_typeof(e))){var u=i.getAttribute(e);return(u||"0"===u)&&(u=isNaN(u)?u:u-0),u}var d=!0,h=!1,g=void 0;try{for(var p,f=Object.entries(e)[Symbol.iterator]();!(d=(p=f.next()).done);d=!0){var v=p.value,m=slicedToArray(v,2),_=m[0],b=m[1];i.setAttribute(_,b)}}catch(e){h=!0,g=e}finally{try{!d&&f.return&&f.return()}finally{if(h)throw g}}}return this},e}var svgroot=document.createElementNS(NS.SVG,"svg");function transformToString(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 a=0,r=0;if(0!==e.angle){var i=1-t.a;r=(i*t.f+t.b*t.e)/(i*i+t.b*t.b),a=(t.e-t.b*r)/i}n="rotate("+e.angle+" "+a+","+r+")"}return n}var listMap_={},SVGTransformList=function(){function e(t){classCallCheck(this,e),this._elem=t||null,this._xforms=[],this._update=function(){var e="";svgroot.createSVGMatrix();for(var t=0;t<this.numberOfItems;++t){e+=transformToString(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*/,a=!0;a;)a=t.match(n),t=t.replace(n,""),a&&a[1]&&function(){var t=a[1].split(/\s*\(/),n=t[0],r=t[1].match(/\s*(.*?)\s*\)/);r[1]=r[1].replace(/(\d)-/g,"$1 -");var i=r[1].split(/[, ]+/),o="abcdef".split(""),s=svgroot.createSVGMatrix();Object.values(i).forEach(function(e,t){i[t]=parseFloat(e),"matrix"===n&&(s[o[t]]=i[t])});var l=svgroot.createSVGTransform(),c="set"+n.charAt(0).toUpperCase()+n.slice(1),u="matrix"===n?[s]:i;"scale"===n&&1===u.length?u.push(u[0]):"translate"===n&&1===u.length?u.push(0):"rotate"===n&&1===u.length&&u.push(0,0),l[c].apply(l,u),e._list.appendItem(l)}()},this._removeFromOtherLists=function(e){if(e){var t=!1;for(var n in listMap_){for(var a=listMap_[n],r=0,i=a._xforms.length;r<i;++r)if(a._xforms[r]===e){t=!0,a.removeItem(r);break}if(t)break}}},this.numberOfItems=0}return createClass(e,[{key:"clear",value:function(){this.numberOfItems=0,this._xforms=[]}},{key:"initialize",value:function(e){this.numberOfItems=1,this._removeFromOtherLists(e),this._xforms=[e]}},{key:"getItem",value: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}},{key:"insertItemBefore",value:function(e,t){var n=null;if(t>=0)if(t<this.numberOfItems){this._removeFromOtherLists(e);var a=new Array(this.numberOfItems+1),r=void 0;for(r=0;r<t;++r)a[r]=this._xforms[r];a[r]=e;for(var i=r+1;r<this.numberOfItems;++i,++r)a[i]=this._xforms[r];this.numberOfItems++,this._xforms=a,n=e,this._list._update()}else n=this._list.appendItem(e);return n}},{key:"replaceItem",value: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}},{key:"removeItem",value:function(e){if(e<this.numberOfItems&&e>=0){var t=this._xforms[e],n=new Array(this.numberOfItems-1),a=void 0;for(a=0;a<e;++a)n[a]=this._xforms[a];for(var r=a;r<this.numberOfItems-1;++r,++a)n[r]=this._xforms[a+1];return this.numberOfItems--,this._xforms=n,this._list._update(),t}var i=new Error("DOMException with code=INDEX_SIZE_ERR");throw i.code=1,i}},{key:"appendItem",value:function(e){return this._removeFromOtherLists(e),this._xforms.push(e),this.numberOfItems++,this._list._update(),e}}]),e}(),resetListMap=function(){listMap_={}},removeElementFromListMap=function(e){e.id&&listMap_[e.id]&&delete listMap_[e.id]},getTransformList=function(e){if(!supportsNativeTransformLists()){var t=e.id||"temp",n=listMap_[t];return n&&"temp"!==t||(listMap_[t]=new SVGTransformList(e),listMap_[t]._init(),n=listMap_[t]),n}return e.transform?e.transform.baseVal:e.gradientTransform?e.gradientTransform.baseVal:e.patternTransform?e.patternTransform.baseVal:null},wAttrs=["x","x1","cx","rx","width"],hAttrs=["y","y1","cy","ry","height"],unitAttrs=["r","radius"].concat(wAttrs,hAttrs),elementContainer_=void 0,typeMap_={},init=function(e){elementContainer_=e;var t=document.createElementNS(NS.SVG,"svg");document.body.append(t);var n=document.createElementNS(NS.SVG,"rect");n.setAttribute("width","1em"),n.setAttribute("height","1ex"),n.setAttribute("x","1in"),t.append(n);var a=n.getBBox();t.remove();var r=a.x;typeMap_={em:a.width,ex:a.height,in:r,cm:r/2.54,mm:r/25.4,pt:r/72,pc:r/6,px:1,"%":0}},getTypeMap=function(){return typeMap_},shortFloat=function e(t){var n=elementContainer_.getRoundDigits();return isNaN(t)?Array.isArray(t)?e(t[0])+","+e(t[1]):parseFloat(t).toFixed(n)-0:+(+t).toFixed(n)},convertUnit=function(e,t){return t=t||elementContainer_.getBaseUnit(),shortFloat(e/typeMap_[t])},setUnitAttr=function(e,t,n){e.setAttribute(t,n)},convertToNum=function(e,t){if(!isNaN(t))return t-0;if("%"===t.substr(-1)){var n=t.substr(0,t.length-1)/100,a=elementContainer_.getWidth(),r=elementContainer_.getHeight();return wAttrs.includes(e)?n*a:hAttrs.includes(e)?n*r:n*Math.sqrt(a*a+r*r)/Math.sqrt(2)}var i=t.substr(-2);return t.substr(0,t.length-2)*typeMap_[i]},isValidUnit=function(e,t,n){if(unitAttrs.includes(e))return!isNaN(t)||(t=t.toLowerCase(),Object.keys(typeMap_).some(function(e){return new RegExp("^-?[\\d\\.]+"+e+"$").test(t)}));if("id"===e){var a=!1;try{var r=elementContainer_.getElement(t);a=null==r||r===n}catch(e){}return a}return!0},HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"},Command=function(){function e(){classCallCheck(this,e)}return createClass(e,[{key:"getText",value:function(){return this.text}}]),e}(),MoveElementCommand=function(e){function t(e,n,a,r){classCallCheck(this,t);var i=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.elem=e,i.text=r?"Move "+e.tagName+" to "+r:"Move "+e.tagName,i.oldNextSibling=n,i.oldParent=a,i.newNextSibling=e.nextSibling,i.newParent=e.parentNode,i}return inherits(t,Command),createClass(t,[{key:"type",value:function(){return"svgedit.history.MoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this),this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this),this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();MoveElementCommand.type=MoveElementCommand.prototype.type;var InsertElementCommand=function(e){function t(e,n){classCallCheck(this,t);var a=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.elem=e,a.text=n||"Create "+e.tagName,a.parent=e.parentNode,a.nextSibling=a.elem.nextSibling,a}return inherits(t,Command),createClass(t,[{key:"type",value:function(){return"svgedit.history.InsertElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this),this.elem=this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this),this.parent=this.elem.parentNode,this.elem=this.elem.parentNode.removeChild(this.elem),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();InsertElementCommand.type=InsertElementCommand.prototype.type;var RemoveElementCommand=function(e){function t(e,n,a,r){classCallCheck(this,t);var i=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.elem=e,i.text=r||"Delete "+e.tagName,i.nextSibling=n,i.parent=a,removeElementFromListMap(e),i}return inherits(t,Command),createClass(t,[{key:"type",value:function(){return"svgedit.history.RemoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this),removeElementFromListMap(this.elem),this.parent=this.elem.parentNode,this.elem=this.parent.removeChild(this.elem),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this),removeElementFromListMap(this.elem),null==this.nextSibling&&window.console&&console.log("Error: reference element was lost"),this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();RemoveElementCommand.type=RemoveElementCommand.prototype.type;var ChangeElementCommand=function(e){function t(e,n,a){classCallCheck(this,t);var r=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));for(var i in r.elem=e,r.text=a?"Change "+e.tagName+" "+a:"Change "+e.tagName,r.newValues={},r.oldValues=n,n)r.newValues[i]="#text"===i?e.textContent:"#href"===i?getHref(e):e.getAttribute(i);return r}return inherits(t,Command),createClass(t,[{key:"type",value:function(){return"svgedit.history.ChangeElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.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?setHref(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 a=getRotationAngle(this.elem);if(a){var r=this.elem.getBBox(),i=["rotate(",a," ",r.x+r.width/2,",",r.y+r.height/2,")"].join("");i!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",i)}}return e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this),!0}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.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?setHref(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 a=getRotationAngle(this.elem);if(a){var r=this.elem.getBBox(),i=["rotate(",a," ",r.x+r.width/2,",",r.y+r.height/2,")"].join("");i!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",i)}}return removeElementFromListMap(this.elem),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this),!0}},{key:"elements",value:function(){return[this.elem]}}]),t}();ChangeElementCommand.type=ChangeElementCommand.prototype.type;var BatchCommand=function(e){function t(e){classCallCheck(this,t);var n=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.text=e||"Batch Command",n.stack=[],n}return inherits(t,Command),createClass(t,[{key:"type",value:function(){return"svgedit.history.BatchCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this);for(var t=this.stack.length,n=0;n<t;++n)this.stack[n].apply(e);e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this);for(var t=this.stack.length-1;t>=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){for(var e=[],t=this.stack.length;t--;)for(var n=this.stack[t].elements(),a=n.length;a--;)e.includes(n[a])||e.push(n[a]);return e}},{key:"addSubCommand",value:function(e){this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),t}();BatchCommand.type=BatchCommand.prototype.type;var UndoManager=function(){function e(t){classCallCheck(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return createClass(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,a=t.length,r=new Array(a),i=new Array(a);a--;){var o=t[a];null!=o&&(i[a]=o,r[a]=o.getAttribute(e))}this.undoableChangeStack[n]={attrName:e,oldValues:r,elements:i}}},{key:"finishUndoableChange",value:function(){for(var e=this.undoChangeStackPointer--,t=this.undoableChangeStack[e],n=t.attrName,a=new BatchCommand("Change "+n),r=t.elements.length;r--;){var i=t.elements[r];if(null!=i){var o={};o[n]=t.oldValues[r],o[n]!==i.getAttribute(n)&&a.addSubCommand(new ChangeElementCommand(i,o,n))}}return this.undoableChangeStack[e]=null,a}}]),e}(),history=Object.freeze({HistoryEventTypes:HistoryEventTypes,MoveElementCommand:MoveElementCommand,InsertElementCommand:InsertElementCommand,RemoveElementCommand:RemoveElementCommand,ChangeElementCommand:ChangeElementCommand,BatchCommand:BatchCommand,UndoManager:UndoManager}),NEAR_ZERO=1e-14,svg$1=document.createElementNS(NS.SVG,"svg"),transformPoint=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},isIdentity=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},matrixMultiply=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=t.reduceRight(function(e,t){return t.multiply(e)});return Math.abs(a.a)<NEAR_ZERO&&(a.a=0),Math.abs(a.b)<NEAR_ZERO&&(a.b=0),Math.abs(a.c)<NEAR_ZERO&&(a.c=0),Math.abs(a.d)<NEAR_ZERO&&(a.d=0),Math.abs(a.e)<NEAR_ZERO&&(a.e=0),Math.abs(a.f)<NEAR_ZERO&&(a.f=0),a},hasMatrixTransform=function(e){if(!e)return!1;for(var t=e.numberOfItems;t--;){var n=e.getItem(t);if(1===n.type&&!isIdentity(n.matrix))return!0}return!1},transformBox=function(e,t,n,a,r){var i=transformPoint(e,t,r),o=transformPoint(e+n,t,r),s=transformPoint(e,t+a,r),l=transformPoint(e+n,t+a,r),c=Math.min(i.x,o.x,s.x,l.x),u=Math.max(i.x,o.x,s.x,l.x),d=Math.min(i.y,o.y,s.y,l.y);return{tl:i,tr:o,bl:s,br:l,aabox:{x:c,y:d,width:u-c,height:Math.max(i.y,o.y,s.y,l.y)-d}}},transformListToTransform=function(e,t,n){if(null==e)return svg$1.createSVGTransformFromMatrix(svg$1.createSVGMatrix());if(t=t||0,n=n||e.numberOfItems-1,(t=parseInt(t,10))>(n=parseInt(n,10))){var a=n;n=t,t=a}for(var r=svg$1.createSVGMatrix(),i=t;i<=n;++i){var o=i>=0&&i<e.numberOfItems?e.getItem(i).matrix:svg$1.createSVGMatrix();r=matrixMultiply(r,o)}return svg$1.createSVGTransformFromMatrix(r)},getMatrix=function(e){var t=getTransformList(e);return transformListToTransform(t).matrix},snapToAngle=function(e,t,n,a){var r=Math.PI/4,i=n-e,o=a-t,s=Math.atan2(o,i),l=Math.sqrt(i*i+o*o),c=Math.round(s/r)*r;return{x:e+l*Math.cos(c),y:t+l*Math.sin(c),a:c}},rectsIntersect=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},$$1=jQuery,segData={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"]},uiStrings={},setUiStrings=function(e){Object.assign(uiStrings,e.ui)},pathFuncs=[],linkControlPts=!0,pathData={},setLinkControlPoints=function(e){linkControlPts=e},path=null,editorContext_=null,init$1=function(e){editorContext_=e,pathFuncs=[0,"ClosePath"];$$1.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(e,t){pathFuncs.push(t+"Abs"),pathFuncs.push(t+"Rel")})},insertItemBefore=function(e,t,n){var a=e.pathSegList;if(supportsPathInsertItemBefore())a.insertItemBefore(t,n);else{for(var r=a.numberOfItems,i=[],o=0;o<r;o++){var s=a.getItem(o);i.push(s)}a.clear();for(var l=0;l<r;l++)l===n&&a.appendItem(t),a.appendItem(i[l])}},ptObjToArr=function(e,t){return segData[e].map(function(e){return t[e]})},getGripPt=function(e,t){var n=e.path,a={x:t?t.x:e.item.x,y:t?t.y:e.item.y};n.matrix&&(a=transformPoint(a.x,a.y,n.matrix));var r=editorContext_.getCurrentZoom();return a.x*=r,a.y*=r,a},getPointFromGrip=function(e,t){var n={x:e.x,y:e.y};t.matrix&&(e=transformPoint(n.x,n.y,t.imatrix),n.x=e.x,n.y=e.y);var a=editorContext_.getCurrentZoom();return n.x/=a,n.y/=a,n},addPointGrip=function(e,t,n){var a=getGripContainer(),r=getElem("pathpointgrip_"+e);if(!r){r=document.createElementNS(NS.SVG,"circle");var i={id:"pathpointgrip_"+e,display:"none",r:4,fill:"#0FF",stroke:"#00F","stroke-width":2,cursor:"move",style:"pointer-events:all"};"pathNodeTooltip"in uiStrings&&(i["xlink:title"]=uiStrings.pathNodeTooltip),assignAttributes(r,i),r=a.appendChild(r),$$1("#pathpointgrip_"+e).dblclick(function(){path&&path.setSegType()})}return t&&n&&assignAttributes(r,{cx:t,cy:n,display:"inline"}),r},getGripContainer=function(){var e=getElem("pathpointgrip_container");e||((e=getElem("selectorParentGroup").appendChild(document.createElementNS(NS.SVG,"g"))).id="pathpointgrip_container");return e},addCtrlGrip=function(e){var t=getElem("ctrlpointgrip_"+e);if(t)return t;t=document.createElementNS(NS.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 uiStrings&&(n["xlink:title"]=uiStrings.pathCtrlPtTooltip),assignAttributes(t,n),getGripContainer().append(t),t},getCtrlLine=function(e){var t=getElem("ctrlLine_"+e);return t||(t=document.createElementNS(NS.SVG,"line"),assignAttributes(t,{id:"ctrlLine_"+e,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),getGripContainer().append(t),t)},getPointGrip=function(e,t){var n=e.index,a=addPointGrip(n);if(t){var r=getGripPt(e);assignAttributes(a,{cx:r.x,cy:r.y,display:"inline"})}return a},getControlPoints=function(e){var t=e.item,n=e.index;if(!("x1"in t&&"x2"in t))return null;var a={};getGripContainer();for(var r=[path.segs[n-1].item,t],i=1;i<3;i++){var o=n+"c"+i,s=a["c"+i+"_line"]=getCtrlLine(o),l=getGripPt(e,{x:t["x"+i],y:t["y"+i]}),c=getGripPt(e,{x:r[i-1].x,y:r[i-1].y});assignAttributes(s,{x1:l.x,y1:l.y,x2:c.x,y2:c.y,display:"inline"}),a["c"+i+"_line"]=s;var u=a["c"+i]=addCtrlGrip(o);assignAttributes(u,{cx:l.x,cy:l.y,display:"inline"}),a["c"+i]=u}return a},replacePathSeg=function(e,t,n,a){var r=a||path.elem,i=r["createSVGPathSeg"+pathFuncs[e]].apply(r,n);if(supportsPathReplaceItem())r.pathSegList.replaceItem(i,t);else{for(var o=r.pathSegList,s=o.numberOfItems,l=[],c=0;c<s;c++){var u=o.getItem(c);l.push(u)}o.clear();for(var d=0;d<s;d++)d===t?o.appendItem(i):o.appendItem(l[d])}},getSegSelector=function(e,t){var n=e.index,a=getElem("segline_"+n);if(!a){var r=getGripContainer();a=document.createElementNS(NS.SVG,"path"),assignAttributes(a,{id:"segline_"+n,display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"}),r.append(a)}if(t){var i=e.prev;if(!i)return a.setAttribute("display","none"),a;var o=getGripPt(i);replacePathSeg(2,0,[o.x,o.y],a);for(var s=ptObjToArr(e.type,e.item,!0),l=0;l<s.length;l+=2){var c=getGripPt(e,{x:s[l],y:s[l+1]});s[l]=c.x,s[l+1]=c.y}replacePathSeg(e.type,1,s,a)}return a},smoothControlPoints=function(e,t,n){var a=e.x-n.x,r=e.y-n.y,i=t.x-n.x,o=t.y-n.y;if(!(0===a&&0===r||0===i&&0===o)){var s=Math.sqrt(a*a+r*r),l=Math.sqrt(i*i+o*o),c=editorContext_.getSVGRoot().createSVGPoint(),u=editorContext_.getSVGRoot().createSVGPoint(),d=Math.atan2(r,a),h=Math.atan2(o,i);d<0&&(d+=2*Math.PI),h<0&&(h+=2*Math.PI);var g=Math.abs(d-h),p=Math.abs(Math.PI-g)/2,f=void 0,v=void 0;return d-h>0?(f=g<Math.PI?d+p:d-p,v=g<Math.PI?h-p:h+p):(f=g<Math.PI?d-p:d+p,v=g<Math.PI?h+p:h-p),c.x=s*Math.cos(f)+n.x,c.y=s*Math.sin(f)+n.y,u.x=l*Math.cos(v)+n.x,u.y=l*Math.sin(v)+n.y,[c,u]}},Segment=function(){function e(t,n){classCallCheck(this,e),this.selected=!1,this.index=t,this.item=n,this.type=n.pathSegType,this.ctrlpts=[],this.ptgrip=null,this.segsel=null}return createClass(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){$$1("#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=getPointGrip(this,!0),this.ctrlpts=getControlPoints(this,!0),this.segsel=getSegSelector(this,!0)}},{key:"update",value:function(e){if(this.ptgrip){var t=getGripPt(this);assignAttributes(this.ptgrip,{cx:t.x,cy:t.y}),getSegSelector(this,!0),this.ctrlpts&&(e&&(this.item=path.elem.pathSegList.getItem(this.index),this.type=this.item.pathSegType),getControlPoints(this))}}},{key:"move",value:function(e,t){var n=this.item,a=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(replacePathSeg(this.type,this.index,a),this.next&&this.next.ctrlpts){var r=this.next.item,i=[r.x,r.y,r.x1+=e,r.y1+=t,r.x2,r.y2];replacePathSeg(this.next.type,this.next.index,i)}if(this.mate){var o=this.mate.item,s=[o.x+=e,o.y+=t];replacePathSeg(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,a=void 0;if(2===e){if(n=1,!(t=this.next))return;a=this.item}else{if(n=2,!(t=this.prev))return;a=t.item}var r=t.item;r["x"+n]=a.x+(a.x-this.item["x"+e]),r["y"+n]=a.y+(a.y-this.item["y"+e]);var i=[r.x,r.y,r.x1,r.y1,r.x2,r.y2];replacePathSeg(t.type,t.index,i),t.update(!0)}},{key:"moveCtrl",value:function(e,t,n){var a=this.item;a["x"+e]+=t,a["y"+e]+=n;var r=[a.x,a.y,a.x1,a.y1,a.x2,a.y2];replacePathSeg(this.type,this.index,r),this.update(!0)}},{key:"setType",value:function(e,t){replacePathSeg(e,this.index,t),this.type=e,this.item=path.elem.pathSegList.getItem(this.index),this.showCtrlPts(6===e),this.ctrlpts=getControlPoints(this),this.update(!0)}}]),e}(),Path=function(){function e(t){if(classCallCheck(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=[],path=this,this.init()}return createClass(e,[{key:"init",value:function(){$$1(getGripContainer()).find("*").each(function(){$$1(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 a=e.getItem(n),r=new Segment(n,a);r.path=this,this.segs.push(r)}for(var i=this.segs,o=null,s=0;s<t;s++){var l=i[s],c=s+1>=t?null:i[s+1],u=s-1<0?null:i[s-1];if(2===l.type){if(u&&1!==u.type){var d=i[o];d.next=i[o+1],d.next.prev=d,d.addGrip()}o=s}else if(c&&1===c.type)l.next=i[o+1],l.next.prev=l,l.mate=i[o],l.addGrip(),null==this.first_seg&&(this.first_seg=l);else if(c)1!==l.type&&(l.addGrip(),c&&2!==c.type&&(l.next=c,l.next.prev=l));else if(1!==l.type){var h=i[o];h.next=i[o+1],h.next.prev=h,h.addGrip(),l.addGrip(),this.first_seg||(this.first_seg=i[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,a=void 0,r=void 0,i=void 0;switch(t.item.pathSegType){case 4:r=(t.item.x+n.item.x)/2,i=(t.item.y+n.item.y)/2,a=this.elem.createSVGPathSegLinetoAbs(r,i);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,c=(o+s)/2,u=(s+l)/2;r=(c+u)/2;var d=(n.item.y+t.item.y1)/2,h=(t.item.y1+t.item.y2)/2,g=(t.item.y2+t.item.y)/2,p=(d+h)/2,f=(h+g)/2;i=(p+f)/2,a=this.elem.createSVGPathSegCurvetoCubicAbs(r,i,o,d,c,p);var v=[t.item.x,t.item.y,u,f,l,g];replacePathSeg(t.type,e,v)}insertItemBefore(this.elem,a,e)}}},{key:"deleteSeg",value:function(e){var t=this.segs[e],n=this.elem.pathSegList;t.show(!1);var a=t.next;if(t.mate){var r=[a.item.x,a.item.y];replacePathSeg(2,a.index,r),replacePathSeg(4,t.index,r),n.removeItem(t.mate.index)}else if(t.prev)n.removeItem(e);else{var i=[a.item.x,a.item.y];replacePathSeg(2,t.next.index,i),n.removeItem(e)}}},{key:"subpathIsClosed",value:function(e){var t=!1;return path.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),linkControlPts&&n.setLinked(this.dragctrl)}},{key:"setSegType",value:function(e){this.storeD();for(var t=this.selected_pts.length,n=void 0;t--;){var a=this.selected_pts[t],r=this.segs[a],i=r.prev;if(i){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=i.item.x,c=i.item.y,u=void 0;switch(e){case 6:if(r.olditem){var d=r.olditem;u=[o,s,d.x1,d.y1,d.x2,d.y2]}else{var h=o-l,g=s-c;u=[o,s,l+h/3,c+g/3,o-h/3,s-g/3]}break;case 4:u=[o,s],r.olditem=r.item}r.setType(e,u)}}path.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,linkControlPts&&this.segs[e].setLinked(t))}},{key:"update",value:function(){var e=this.elem;return getRotationAngle(e)?(this.matrix=getMatrix(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){isWebkit()&&editorContext_.resetD(this.elem);var t=new ChangeElementCommand(this.elem,{d:this.last_d},e);editorContext_.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 a=this.selected_pts.length,r=[];for(r.length=a;a--;){var i=this.selected_pts[a],o=this.segs[i];o.select(!0),r[a]=o.ptgrip}var s=this.subpathIsClosed(this.selected_pts[0]);editorContext_.addPtsToSelection({grips:r,closedSubpath:s})}}]),e}(),getPath_=function(e){var t=pathData[e.id];return t||(t=pathData[e.id]=new Path(e)),t},removePath_=function(e){e in pathData&&delete pathData[e]},newcx=void 0,newcy=void 0,oldcx=void 0,oldcy=void 0,angle=void 0,getRotVals=function(e,t){var n=e-oldcx,a=t-oldcy,r=Math.sqrt(n*n+a*a),i=Math.atan2(a,n)+angle;return n=r*Math.cos(i)+oldcx,a=r*Math.sin(i)+oldcy,n-=newcx,a-=newcy,r=Math.sqrt(n*n+a*a),i=Math.atan2(a,n)-angle,{x:r*Math.cos(i)+newcx,y:r*Math.sin(i)+newcy}},recalcRotatedPath=function(){var e=path.elem;if(angle=getRotationAngle(e,!0)){var t=path.oldbbox;oldcx=t.x+t.width/2,oldcy=t.y+t.height/2;var n=getBBox(e);newcx=n.x+n.width/2,newcy=n.y+n.height/2;var a=newcx-oldcx,r=newcy-oldcy,i=Math.sqrt(a*a+r*r),o=Math.atan2(r,a)+angle;newcx=i*Math.cos(o)+oldcx,newcy=i*Math.sin(o)+oldcy;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var c=s.getItem(l),u=c.pathSegType;if(1!==u){var d=getRotVals(c.x,c.y),h=[d.x,d.y];if(null!=c.x1&&null!=c.x2){var g=getRotVals(c.x1,c.y1),p=getRotVals(c.x2,c.y2);h.splice(h.length,0,g.x,g.y,p.x,p.y)}replacePathSeg(u,l,h)}}n=getBBox(e);var f=editorContext_.getSVGRoot().createSVGTransform(),v=getTransformList(e);f.setRotate(180*angle/Math.PI,newcx,newcy),v.replaceItem(f,0)}},clearData=function(){pathData={}},reorientGrads=function(e,t){for(var n=getBBox(e),a=0;a<2;a++){var r=0===a?"fill":"stroke",i=e.getAttribute(r);if(i&&i.startsWith("url(")){var o=getRefElem(i);if("linearGradient"===o.tagName){var s=o.getAttribute("x1")||0,l=o.getAttribute("y1")||0,c=o.getAttribute("x2")||1,u=o.getAttribute("y2")||0;s=n.width*s+n.x,l=n.height*l+n.y,c=n.width*c+n.x,u=n.height*u+n.y;var d=transformPoint(s,l,t),h=transformPoint(c,u,t),g={};g.x1=(d.x-n.x)/n.width,g.y1=(d.y-n.y)/n.height,g.x2=(h.x-n.x)/n.width,g.y2=(h.y-n.y)/n.height;var p=o.cloneNode(!0);$$1(p).attr(g),p.id=editorContext_.getNextId(),findDefs().append(p),e.setAttribute(r,"url(#"+p.id+")")}}}},pathMap=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],convertPath=function(e,t){for(var n=e.pathSegList,a=n.numberOfItems,r=0,i=0,o="",s=null,l=0;l<a;++l){var c=n.getItem(l),u=c.x||0,d=c.y||0,h=c.x1||0,g=c.y1||0,p=c.x2||0,f=c.y2||0,v=c.pathSegType,m=pathMap[v]["to"+(t?"Lower":"Upper")+"Case"]();switch(v){case 1:o+="z",s&&!t&&(r=s[0],i=s[1]);break;case 12:u-=r;case 13:t?(r+=u,m="l"):(r=u+=r,m="L"),o+=pathDSegment(m,[[u,i]]);break;case 14:d-=i;case 15:t?(i+=d,m="l"):(i=d+=i,m="L"),o+=pathDSegment(m,[[r,d]]);break;case 2:case 4:case 18:u-=r,d-=i;case 5:case 3:case 19:t?(r+=u,i+=d):(r=u+=r,i=d+=i),2!==v&&3!==v||(s=[r,i]),o+=pathDSegment(m,[[u,d]]);break;case 6:u-=r,h-=r,p-=r,d-=i,g-=i,f-=i;case 7:t?(r+=u,i+=d):(h+=r,p+=r,g+=i,f+=i,r=u+=r,i=d+=i),o+=pathDSegment(m,[[h,g],[p,f],[u,d]]);break;case 8:u-=r,h-=r,d-=i,g-=i;case 9:t?(r+=u,i+=d):(h+=r,g+=i,r=u+=r,i=d+=i),o+=pathDSegment(m,[[h,g],[u,d]]);break;case 10:u-=r,d-=i;case 11:t?(r+=u,i+=d):(r=u+=r,i=d+=i),o+=pathDSegment(m,[[c.r1,c.r2]],[c.angle,c.largeArcFlag?1:0,c.sweepFlag?1:0],[u,d]);break;case 16:u-=r,p-=r,d-=i,f-=i;case 17:t?(r+=u,i+=d):(p+=r,f+=i,r=u+=r,i=d+=i),o+=pathDSegment(m,[[p,f],[u,d]])}}return o};function pathDSegment(e,t,n,a){$$1.each(t,function(e,n){t[e]=shortFloat(n)});var r=e+t.join(" ");return n&&(r+=" "+n.join(" ")),a&&(r+=" "+shortFloat(a)),r}var pathActions=function(){var e=!1,t=void 0,n=void 0,a=null,r=!1;return{mouseDown:function(n,a,r,i){var o=void 0;if("path"!==editorContext_.getCurrentMode()){if(path){path.storeD();var s=void 0;if("pathpointgrip_"===(o=n.target.id).substr(0,14)){s=path.cur_pt=parseInt(o.substr(14),10),path.dragging=[r,i];var l=path.segs[s];n.shiftKey?l.selected?path.removePtFromSelection(s):path.addPtsToSelection(s):((path.selected_pts.length<=1||!l.selected)&&path.clearSelection(),path.addPtsToSelection(s))}else if(o.startsWith("ctrlpointgrip_")){path.dragging=[r,i];var c=o.split("_")[1].split("c");s=Number(c[0]);var u=Number(c[1]);path.selectPt(s,u)}if(!path.dragging){var d=editorContext_.getRubberBox();null==d&&(d=editorContext_.setRubberBox(editorContext_.selectorManager.getRubberBandBox()));var h=editorContext_.getCurrentZoom();assignAttributes(d,{x:r*h,y:i*h,width:0,height:0,display:"inline"},100)}}}else{var g=r,p=i,f=editorContext_.getCurrentZoom(),v=g/f,m=p/f,_=getElem("path_stretch_line");t=[v,m],editorContext_.getGridSnapping()&&(v=snapToGrid(v),m=snapToGrid(m),g=snapToGrid(g),p=snapToGrid(p)),_||(_=document.createElementNS(NS.SVG,"path"),assignAttributes(_,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}),_=getElem("selectorParentGroup").appendChild(_)),_.setAttribute("display","inline");var b=void 0,y=editorContext_.getDrawnPath();if(y){for(var x=y.pathSegList,C=x.numberOfItems,S=6/f,w=!1;C;){C--;var $=x.getItem(C),k=$.x,A=$.y;if(v>=k-S&&v<=k+S&&m>=A-S&&m<=A+S){w=!0;break}}o=editorContext_.getId(),removePath_(o);var E=getElem(o),P=void 0,T=void 0,G=x.numberOfItems;if(w){if(C<=1&&G>=2){var N=x.getItem(0).x,L=x.getItem(0).y;P=4===(T=_.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(N,L):y.createSVGPathSegCurvetoCubicAbs(N,L,T.x1/f,T.y1/f,N,L);var I=y.createSVGPathSegClosePath();x.appendItem(P),x.appendItem(I)}else if(G<3)return!1;if($$1(_).remove(),y=editorContext_.setDrawnPath(null),editorContext_.setStarted(!1),e){path.matrix&&editorContext_.remapElement(E,{},path.matrix.inverse());var M=E.getAttribute("d"),R=$$1(path.elem).attr("d");return $$1(path.elem).attr("d",R+M),$$1(E).remove(),path.matrix&&recalcRotatedPath(),init$1(),pathActions.toEditMode(path.elem),path.selectPt(),!1}}else{if(!$$1.contains(editorContext_.getContainer(),editorContext_.getMouseTarget(n)))return console.log("Clicked outside canvas"),!1;var O=y.pathSegList.numberOfItems,V=y.pathSegList.getItem(O-1),B=V.x,j=V.y;if(n.shiftKey){var D=snapToAngle(B,j,v,m);v=D.x,m=D.y}P=4===(T=_.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(editorContext_.round(v),editorContext_.round(m)):y.createSVGPathSegCurvetoCubicAbs(editorContext_.round(v),editorContext_.round(m),T.x1/f,T.y1/f,T.x2/f,T.y2/f),y.pathSegList.appendItem(P),v*=f,m*=f,_.setAttribute("d",["M",v,m,v,m].join(" ")),b=O,e&&(b+=path.segs.length),addPointGrip(b,v,m)}}else{var F="M"+v+","+m+" ";y=editorContext_.setDrawnPath(editorContext_.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:F,id:editorContext_.getNextId(),opacity:editorContext_.getOpacity()/2}})),_.setAttribute("d",["M",g,p,g,p].join(" ")),b=e?path.segs.length:0,addPointGrip(b,g,p)}}},mouseMove:function(e,a){var i=editorContext_.getCurrentZoom();r=!0;var o=editorContext_.getDrawnPath();if("path"!==editorContext_.getCurrentMode())if(path.dragging){var s=getPointFromGrip({x:path.dragging[0],y:path.dragging[1]},path),l=getPointFromGrip({x:e,y:a},path),c=l.x-s.x,u=l.y-s.y;path.dragging=[e,a],path.dragctrl?path.moveCtrl(c,u):path.movePts(c,u)}else path.selected_pts=[],path.eachSeg(function(e){if(this.next||this.prev){var t=editorContext_.getRubberBox().getBBox(),n=getGripPt(this),a={x:n.x,y:n.y,width:0,height:0},r=rectsIntersect(t,a);this.select(r),r&&path.selected_pts.push(this.index)}});else{if(!o)return;var d=o.pathSegList,h=d.numberOfItems-1;if(t){var g=addCtrlGrip("1c1"),p=addCtrlGrip("0c2");g.setAttribute("cx",e),g.setAttribute("cy",a),g.setAttribute("display","inline");var f=t[0],v=t[1],m=f+(f-e/i),_=v+(v-a/i);p.setAttribute("cx",m*i),p.setAttribute("cy",_*i),p.setAttribute("display","inline");var b=getCtrlLine(1);if(assignAttributes(b,{x1:e,y1:a,x2:m*i,y2:_*i,display:"inline"}),0===h)n=[e,a];else{var y=d.getItem(h-1),x=y.x,C=y.y;6===y.pathSegType?(x+=x-y.x2,C+=C-y.y2):n&&(x=n[0]/i,C=n[1]/i),replacePathSeg(6,h,[f,v,x,C,m,_],o)}}else{var S=getElem("path_stretch_line");if(S){var w=d.getItem(h);if(6===w.pathSegType){var $=w.x+(w.x-w.x2),k=w.y+(w.y-w.y2);replacePathSeg(6,1,[e,a,$*i,k*i,e,a],S)}else n?replacePathSeg(6,1,[e,a,n[0],n[1],e,a],S):replacePathSeg(4,1,[e,a],S)}}}},mouseUp:function(e,a,i,o){var s=editorContext_.getDrawnPath();if("path"===editorContext_.getCurrentMode())return t=null,s||(a=getElem(editorContext_.getId()),editorContext_.setStarted(!1),n=null),{keep:!0,element:a};var l=editorContext_.getRubberBox();if(path.dragging){var c=path.cur_pt;path.dragging=!1,path.dragctrl=!1,path.update(),r&&path.endChanges("Move path point(s)"),e.shiftKey||r||path.selectPt(c)}else l&&"none"!==l.getAttribute("display")?(l.setAttribute("display","none"),l.getAttribute("width")<=2&&l.getAttribute("height")<=2&&pathActions.toSelectMode(e.target)):pathActions.toSelectMode(e.target);r=!1},toEditMode:function(t){path=getPath_(t),editorContext_.setCurrentMode("pathedit"),editorContext_.clearSelection(),path.show(!0).update(),path.oldbbox=getBBox(path.elem),e=!1},toSelectMode:function(e){var t=e===path.elem;editorContext_.setCurrentMode("select"),path.show(!1),a=!1,editorContext_.clearSelection(),path.matrix&&recalcRotatedPath(),t&&(editorContext_.call("selected",[e]),editorContext_.addToSelection([e],!0))},addSubPath:function(t){t?(editorContext_.setCurrentMode("path"),e=!0):(pathActions.clear(!0),pathActions.toEditMode(path.elem))},select:function(e){a===e?(pathActions.toEditMode(e),editorContext_.setCurrentMode("pathedit")):a=e},reorient:function(){var e=editorContext_.getSelectedElements()[0];if(e&&0!==getRotationAngle(e)){var t=new BatchCommand("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new ChangeElementCommand(e,n)),editorContext_.clearSelection(),this.resetOrientation(e),editorContext_.addCommandToHistory(t),getPath_(e).show(!1).matrix=null,this.clear(),editorContext_.addToSelection([e],!0),editorContext_.call("changed",editorContext_.getSelectedElements())}},clear:function(e){var t=editorContext_.getDrawnPath();if(a=null,t){var r=getElem(editorContext_.getId());$$1(getElem("path_stretch_line")).remove(),$$1(r).remove(),$$1(getElem("pathpointgrip_container")).find("*").attr("display","none"),n=null,editorContext_.setDrawnPath(null),editorContext_.setStarted(!1)}else"pathedit"===editorContext_.getCurrentMode()&&this.toSelectMode();path&&path.init().show(!1)},resetOrientation:function(e){if(null==e||"path"!==e.nodeName)return!1;var t=getTransformList(e),n=transformListToTransform(t).matrix;t.clear(),e.removeAttribute("transform");for(var a=e.pathSegList,r=a.numberOfItems,i=function(t){var r=a.getItem(t),i=r.pathSegType;if(1===i)return"continue";var o=[];$$1.each(["",1,2],function(e,t){var a=r["x"+t],i=r["y"+t];if(void 0!==a&&void 0!==i){var s=transformPoint(a,i,n);o.splice(o.length,0,s.x,s.y)}}),replacePathSeg(i,t,o,e)},o=0;o<r;++o)i(o);reorientGrads(e,n)},zoomChange:function(){"pathedit"===editorContext_.getCurrentMode()&&path.update()},getNodePoint:function(){var e=path.selected_pts.length?path.selected_pts[0]:1,t=path.segs[e];return{x:t.item.x,y:t.item.y,type:t.type}},linkControlPoints:function(e){setLinkControlPoints(e)},clonePathNode:function(){path.storeD();for(var e=path.selected_pts,t=e.length,n=[];t--;){var a=e[t];path.addSeg(a),n.push(a+t),n.push(a+t+1)}path.init().addPtsToSelection(n),path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var e=path.selected_pts;if(1===e.length){var t=path.elem,n=t.pathSegList,a=e[0],r=null,i=null;if(path.eachSeg(function(e){return 2===this.type&&e<=a&&(i=this.item),e<=a||(2===this.type?(r=e,!1):1===this.type?(r=!1,!1):void 0)}),null==r&&(r=path.segs.length-1),!1!==r){var o=t.createSVGPathSegLinetoAbs(i.x,i.y),s=t.createSVGPathSegClosePath();return r===path.segs.length-1?(n.appendItem(o),n.appendItem(s)):(insertItemBefore(t,s,r),insertItemBefore(t,o,r)),void path.init().selectPt(r+1)}if(path.segs[a].mate)return n.removeItem(a),n.removeItem(a),void path.init().selectPt(a-1);for(var l=void 0,c=void 0,u=0;u<n.numberOfItems;u++){var d=n.getItem(u);if(2===d.pathSegType)l=u;else if(u===a)n.removeItem(l);else if(1===d.pathSegType&&a<u){c=u-1,n.removeItem(u);break}}for(var h=a-l-1;h--;)insertItemBefore(t,n.getItem(l),c);var g=n.getItem(l);replacePathSeg(2,l,[g.x,g.y]),path.init().selectPt(0)}},deletePathNode:function(){if(pathActions.canDeleteNodes){path.storeD();for(var e=path.selected_pts,t=e.length;t--;){var n=e[t];path.deleteSeg(n)}if(function e(){var t=path.elem.pathSegList,n=t.numberOfItems,a=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 i=t.getItem(n-1),o=t.getItem(n-2);if(2===i.pathSegType){a(n-1,2),e();break}if(2===o.pathSegType){a(n-2,3),e();break}}else if(2===r.pathSegType&&n>0){var s=t.getItem(n-1).pathSegType;if(2===s){a(n-1,1),e();break}if(1===s&&t.numberOfItems-1===n){a(n,1),e();break}}}return!1}(),path.elem.pathSegList.numberOfItems<=1)return pathActions.toSelectMode(path.elem),void editorContext_.canvas.deleteSelectedElements();if(path.init(),path.clearSelection(),window.opera){var a=$$1(path.elem);a.attr("d",a.attr("d"))}path.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t=void 0,n=e.points,a=n.numberOfItems;if(a>=4){var r=n.getItem(0),i=null,o=[];for(o.push(["M",r.x,",",r.y," C"].join("")),t=1;t<=a-4;t+=3){var s=n.getItem(t),l=n.getItem(t+1),c=n.getItem(t+2);if(i){var u=smoothControlPoints(i,s,r);if(u&&2===u.length){var d=o[o.length-1].split(",");d[2]=u[0].x,d[3]=u[0].y,o[o.length-1]=d.join(","),s=u[1]}}o.push([s.x,s.y,l.x,l.y,c.x,c.y].join(",")),r=c,i=l}for(o.push("L");t<a;){var h=n.getItem(t);o.push([h.x,h.y].join(",")),t++}o=o.join(" "),e=editorContext_.addSVGElementFromJson({element:"path",curStyles:!0,attr:{id:editorContext_.getId(),d:o,fill:"none"}})}return e},setSegType:function(e){path.setSegType(e)},moveNode:function(e,t){var n=path.selected_pts;if(n.length){path.storeD();var a=path.segs[n[0]],r={x:0,y:0};r[e]=t-a.item[e],a.move(r.x,r.y),path.endChanges("Move path point")}},fixEnd:function(e){for(var t=e.pathSegList,n=t.numberOfItems,a=void 0,r=0;r<n;++r){var i=t.getItem(r);if(2===i.pathSegType&&(a=i),1===i.pathSegType){var o=t.getItem(r-1);if(o.x!==a.x||o.y!==a.y){var s=e.createSVGPathSegLinetoAbs(a.x,a.y);insertItemBefore(e,s,r),pathActions.fixEnd(e);break}}}isWebkit()&&editorContext_.resetD(e)},convertPath:convertPath}}(),$$2=jqPluginSVG(jQuery),KEYSTR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",visElems="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",visElemsArr=visElems.split(","),editorContext_$1=null,domdoc_=null,domcontainer_=null,svgroot_=null,init$2=function(e){editorContext_$1=e,domdoc_=e.getDOMDocument(),domcontainer_=e.getDOMContainer(),svgroot_=e.getSVGRoot()},toXml=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/,"'")},encode64=function(e){if(e=encodeUTF8(e),window.btoa)return window.btoa(e);var t=[];t.length=4*Math.floor((e.length+2)/3);var n=0,a=0;do{var r=e.charCodeAt(n++),i=e.charCodeAt(n++),o=e.charCodeAt(n++),s=r>>2,l=(3&r)<<4|i>>4,c=(15&i)<<2|o>>6,u=63&o;isNaN(i)?c=u=64:isNaN(o)&&(u=64),t[a++]=KEYSTR.charAt(s),t[a++]=KEYSTR.charAt(l),t[a++]=KEYSTR.charAt(c),t[a++]=KEYSTR.charAt(u)}while(n<e.length);return t.join("")},decode64=function(e){if(window.atob)return decodeUTF8(window.atob(e));e=e.replace(/[^A-Za-z0-9+/=]/g,"");var t="",n=0;do{var a=KEYSTR.indexOf(e.charAt(n++)),r=KEYSTR.indexOf(e.charAt(n++)),i=KEYSTR.indexOf(e.charAt(n++)),o=KEYSTR.indexOf(e.charAt(n++)),s=a<<2|r>>4,l=(15&r)<<4|i>>2,c=(3&i)<<6|o;t+=String.fromCharCode(s),64!==i&&(t+=String.fromCharCode(l)),64!==o&&(t+=String.fromCharCode(c))}while(n<e.length);return decodeUTF8(t)},decodeUTF8=function(e){return decodeURIComponent(escape(e))},encodeUTF8=function(e){return unescape(encodeURIComponent(e))},dataURLToObjectURL=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],a=atob(t[1]),r=a.length,i=new Uint8Array(r);r--;)i[r]=a.charCodeAt(r);var o=new Blob([i],{type:n});return URL.createObjectURL(o)},createObjectURL=function(e){return e&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(e):""},blankPageObjectURL=function(){if("undefined"==typeof Blob)return"";var e=new Blob(["<html><head><title>SVG-edit</title></head><body> </body></html>"],{type:"text/html"});return createObjectURL(e)}(),text2xml=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 window.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},bboxToObj=function(e){return{x:e.x,y:e.y,width:e.width,height:e.height}},walkTree=function e(t,n){if(t&&1===t.nodeType){n(t);for(var a=t.childNodes.length;a--;)e(t.childNodes.item(a),n)}},walkTreePost=function(e,t){if(e&&1===e.nodeType){for(var n=e.childNodes.length;n--;)walkTree(e.childNodes.item(n),t);t(e)}},getUrlFromAttr=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},getHref=function(e){return e.getAttributeNS(NS.XLINK,"href")},setHref=function(e,t){e.setAttributeNS(NS.XLINK,"xlink:href",t)},findDefs=function(){var e=editorContext_$1.getSVGContent(),t=e.getElementsByTagNameNS(NS.SVG,"defs");return t.length>0?t=t[0]:(t=e.ownerDocument.createElementNS(NS.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.append(t)),t},getPathBBox=function(e){for(var t=e.pathSegList,n=t.numberOfItems,a=[[],[]],r=t.getItem(0),i=[r.x,r.y],o=0;o<n;o++){var s=t.getItem(o);void 0!==s.x&&(a[0].push(i[0]),a[1].push(i[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(a){return Math.pow(1-a,3)*i[r]+3*Math.pow(1-a,2)*a*e[r]+3*(1-a)*Math.pow(a,2)*t[r]+Math.pow(a,3)*n[r]},s=6*i[r]-12*e[r]+6*t[r],l=-3*i[r]+9*e[r]-9*t[r]+3*n[r],c=3*e[r]-3*i[r];if(0===l){if(0===s)return"continue";var u=-c/s;return u>0&&u<1&&a[r].push(o(u)),"continue"}var d=Math.pow(s,2)-4*c*l;if(d<0)return"continue";var h=(-s+Math.sqrt(d))/(2*l);h>0&&h<1&&a[r].push(o(h));var g=(-s-Math.sqrt(d))/(2*l);g>0&&g<1&&a[r].push(o(g))},o=0;o<2;o++)r(o);i=n}():(a[0].push(s.x),a[1].push(s.y)))}var l=Math.min.apply(null,a[0]),c=Math.max.apply(null,a[0])-l,u=Math.min.apply(null,a[1]);return{x:l,y:u,width:c,height:Math.max.apply(null,a[1])-u}};function groupBBFix(e){if(supportsHVLineContainerBBox())try{return e.getBBox()}catch(e){}var t=$$2.data(e,"ref"),n=null,a=void 0,r=void 0;t?(r=$$2(t).children().clone().attr("visibility","hidden"),$$2(svgroot_).append(r),n=r.filter("line, path")):n=$$2(e).find("line, path");var i=!1;if(n.length)if(n.each(function(){var e=this.getBBox();e.width&&e.height||(i=!0)}),i){var o=t?r:$$2(e).children();a=getStrokedBBox(o)}else a=e.getBBox();else a=e.getBBox();return t&&r.remove(),a}var getBBox=function(e){var t=e||editorContext_$1.geSelectedElements()[0];if(1!==e.nodeType)return null;var n=t.nodeName,a=null;switch(n){case"text":""===t.textContent?(t.textContent="a",a=t.getBBox(),t.textContent=""):t.getBBox&&(a=t.getBBox());break;case"path":supportsPathBBox()?t.getBBox&&(a=t.getBBox()):a=getPathBBox(t);break;case"g":case"a":a=groupBBFix(t);break;default:if("use"===n&&(a=groupBBFix(t,!0)),"use"===n||"foreignObject"===n&&isWebkit()){if(a||(a=t.getBBox()),!isWebkit()){var r={};r.width=a.width,r.height=a.height,r.x=a.x+parseFloat(t.getAttribute("x")||0),r.y=a.y+parseFloat(t.getAttribute("y")||0),a=r}}else if(visElemsArr.includes(n))if(t)try{a=t.getBBox()}catch(e){var i=t.getExtentOfChar(0),o=t.getComputedTextLength();a={x:i.x,y:i.y,width:o,height:i.height}}else{var s=$$2(t).closest("foreignObject");s.length&&s[0].getBBox&&(a=s[0].getBBox())}}return a&&(a=bboxToObj(a)),a},getPathDFromSegments=function(e){var t="";return $$2.each(e,function(e,n){var a=slicedToArray(n,2),r=a[0],i=a[1];t+=r;for(var o=0;o<i.length;o+=2)t+=i[o]+","+i[o+1]+" "}),t},getPathDFromElement=function(e){var t=1.81,n=void 0,a=void 0,r=void 0,i=void 0;switch(e.tagName){case"ellipse":case"circle":var o=a=$$2(e).attr(["rx","ry","cx","cy"]),s=o.cx,l=o.cy,c=a;r=c.rx,i=c.ry,"circle"===e.tagName&&(r=i=$$2(e).attr("r")),n=getPathDFromSegments([["M",[s-r,l]],["C",[s-r,l-i/t,s-r/t,l-i,s,l-i]],["C",[s+r/t,l-i,s+r,l-i/t,s+r,l]],["C",[s+r,l+i/t,s+r/t,l+i,s,l+i]],["C",[s-r/t,l+i,s-r,l+i/t,s-r,l]],["Z",[]]]);break;case"path":n=e.getAttribute("d");break;case"line":n="M"+(a=$$2(e).attr(["x1","y1","x2","y2"])).x1+","+a.y1+"L"+a.x2+","+a.y2;break;case"polyline":n="M"+e.getAttribute("points");break;case"polygon":n="M"+e.getAttribute("points")+" Z";break;case"rect":var u=$$2(e).attr(["rx","ry"]);r=u.rx,i=u.ry;var d=e.getBBox(),h=d.x,g=d.y,p=d.width,f=d.height;t=4-t,n=getPathDFromSegments(r||i?[["M",[h,g+i]],["C",[h,g+i/t,h+r/t,g,h+r,g]],["L",[h+p-r,g]],["C",[h+p-r/t,g,h+p,g+i/t,h+p,g+i]],["L",[h+p,g+f-i]],["C",[h+p,g+f-i/t,h+p-r/t,g+f,h+p-r,g+f]],["L",[h+r,g+f]],["C",[h+r/t,g+f,h,g+f-i/t,h,g+f-i]],["L",[h,g+i]],["Z",[]]]:[["M",[h,g]],["L",[h+p,g]],["L",[h+p,g+f]],["L",[h,g+f]],["L",[h,g]],["Z",[]]])}return n},getExtraAttributesForConvertToPath=function(e){var t={};return $$2.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){var n=e.getAttribute(this);n&&(t[this]=n)}),t},getBBoxOfElementAsPath=function(e,t,n){var a=t({element:"path",attr:getExtraAttributesForConvertToPath(e)}),r=e.getAttribute("transform");r&&a.setAttribute("transform",r);var i=e.parentNode;e.nextSibling?e.before(a):i.append(a);var o=getPathDFromElement(e);o?a.setAttribute("d",o):a.remove(),n.resetOrientation(a);var s=!1;try{s=a.getBBox()}catch(e){}return a.remove(),s},convertToPath=function(e,t,n,a,r,i,o,s){var l=new o.BatchCommand("Convert element to Path"),c=n({element:"path",attr:t=$$2.extend({},t,getExtraAttributesForConvertToPath(e))}),u=e.getAttribute("transform");u&&c.setAttribute("transform",u);var d=e.id,h=e.parentNode;e.nextSibling?e.before(c):h.append(c);var g=getPathDFromElement(e);if(g){if(c.setAttribute("d",g),u){var p=getTransformList(c);hasMatrixTransform(p)&&a.resetOrientation(c)}var f=e.nextSibling;return l.addSubCommand(new o.RemoveElementCommand(e,f,h)),l.addSubCommand(new o.InsertElementCommand(c)),r(),e.remove(),c.setAttribute("id",d),c.removeAttribute("visibility"),i([c],!0),s(l),c}return c.remove(),null};function bBoxCanBeOptimizedOverNativeGetBBox(e,t){var n=e%90;return t||!(n>-.001&&n<.001||(n<-89.99||n>89.99))}var getBBoxWithTransform=function(e,t,n){var a=getBBox(e);if(!a)return null;var r=getTransformList(e),i=getRotationAngleFromTransformList(r),o=hasMatrixTransform(r);if(i||o){var s=!1;if(bBoxCanBeOptimizedOverNativeGetBBox(i,o)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))a=s=getBBoxOfElementAsPath(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(a=s=getBBoxOfElementAsPath(e,t,n))}}if(!s){var u=transformListToTransform(r).matrix;a=transformBox(a.x,a.y,a.width,a.height,u).aabox}}return a};function getStrokeOffsetForBBox(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var getStrokedBBox=function(e,t,n){if(!e||!e.length)return!1;var a=void 0;if($$2.each(e,function(){a||this.parentNode&&(a=getBBoxWithTransform(this,t,n))}),void 0===a)return null;var r=a.x+a.width,i=a.y+a.height,o=a.x,s=a.y;if(1===e.length){var l=getStrokeOffsetForBBox(e[0]);o-=l,s-=l,r+=l,i+=l}else $$2.each(e,function(e,a){var l=getBBoxWithTransform(a,t,n);if(l){var c=getStrokeOffsetForBBox(a);o=Math.min(o,l.x-c),s=Math.min(s,l.y-c),1===a.nodeType&&(r=Math.max(r,l.x+l.width+c),i=Math.max(i,l.y+l.height+c))}});return a.x=o,a.y=s,a.width=r-o,a.height=i-s,a},getVisibleElements=function(e){e||(e=$$2(editorContext_$1.getSVGContent()).children());var t=[];return $$2(e).children().each(function(e,n){n.getBBox&&t.push(n)}),t.reverse()},getStrokedBBoxDefaultVisible=function(e){return e||(e=getVisibleElements()),getStrokedBBox(e,editorContext_$1.addSVGElementFromJson,editorContext_$1.pathActions)},getRotationAngleFromTransformList=function(e,t){if(!e)return 0;for(var n=e.numberOfItems,a=0;a<n;++a){var r=e.getItem(a);if(4===r.type)return t?r.angle*Math.PI/180:r.angle}return 0},getRotationAngle=function(e,t){var n=e||editorContext_$1.getSelectedElements()[0],a=getTransformList(n);return getRotationAngleFromTransformList(a,t)},getRefElem=function(e){return getElem(getUrlFromAttr(e).substr(1))},getElem=supportsSelectors()?function(e){return svgroot_.querySelector("#"+e)}:supportsXpath()?function(e){return domdoc_.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+e+'"]',domcontainer_,function(){return NS.SVG},9,null).singleNodeValue}:function(e){return $$2(svgroot_).find("[id="+e+"]")[0]},assignAttributes=function(e,t,n,a){var r=!0,i=!1,o=void 0;try{for(var s,l=Object.entries(t)[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value,u=slicedToArray(c,2),d=u[0],h=u[1],g="xml:"===d.substr(0,4)?NS.XML:"xlink:"===d.substr(0,6)?NS.XLINK:null;g?e.setAttributeNS(g,d,h):a?setUnitAttr(e,d,h):e.setAttribute(d,h)}}catch(e){i=!0,o=e}finally{try{!r&&l.return&&l.return()}finally{if(i)throw o}}},cleanupElement=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 a=t[n];e.getAttribute(n)===String(a)&&e.removeAttribute(n)}},snapToGrid=function(e){var t=editorContext_$1.getBaseUnit(),n=editorContext_$1.getSnappingStep();return"px"!==t&&(n*=getTypeMap()[t]),e=Math.round(e/n)*n},regexEscape=function(e){return String(e).replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")},preventClickDefault=function(e){$$2(e).click(function(e){e.preventDefault()})},copyElem=function e(t,n){var a=document.createElementNS(t.namespaceURI,t.nodeName);if($$2.each(t.attributes,function(e,t){"-moz-math-font-style"!==t.localName&&a.setAttributeNS(t.namespaceURI,t.nodeName,t.value)}),a.removeAttribute("id"),a.id=n(),isWebkit()&&"path"===t.nodeName){var r=convertPath(t);a.setAttribute("d",r)}if($$2.each(t.childNodes,function(t,r){switch(r.nodeType){case 1:a.append(e(r,n));break;case 3:a.textContent=r.nodeValue}}),$$2(t).data("gsvg"))$$2(a).data("gsvg",a.firstChild);else if($$2(t).data("symbol")){var i=$$2(t).data("symbol");$$2(a).data("ref",i).data("symbol",i)}else"image"===a.tagName&&preventClickDefault(a);return a},$$3=jQuery,contextMenuExtensions={},hasCustomHandler=function(e){return Boolean(contextMenuExtensions[e])},getCustomHandler=function(e){return contextMenuExtensions[e].action},injectExtendedContextMenuItemIntoDom=function(e){Object.keys(contextMenuExtensions).length||$$3("#cmenu_canvas").append("<li class='separator'>");var t=e.shortcut||"";$$3("#cmenu_canvas").append("<li class='disabled'><a href='#"+e.id+"'>"+e.label+"<span class='shortcut'>"+t+"</span></a></li>")},injectExtendedContextMenuItemsIntoDom=function(){for(var e in contextMenuExtensions)injectExtendedContextMenuItemIntoDom(contextMenuExtensions[e])};function toAbsoluteURL(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}function addScriptAtts(e,t){["id","class","type"].forEach(function(n){n in t&&(e[n]=t[n])})}var importSetGlobalDefault=function(){var e=asyncToGenerator(regeneratorRuntime.mark(function e(t,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",importSetGlobal(t,_extends({},n,{returnDefault:!0})));case 1:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),importSetGlobal=function(){var e=asyncToGenerator(regeneratorRuntime.mark(function e(t,n){var a=n.global,r=n.returnDefault;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)){e.next=3;break}return e.abrupt("return",importModule(t,void 0,{returnDefault:r}));case 3:return e.next=5,importScript(t);case 5:return e.abrupt("return",window[a]);case 6:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}();function importScript(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?Promise.all(e.map(function(e){return importScript(e,t)})):new Promise(function(n,a){var r=document.createElement("script"),i=function(){r.onerror=null,r.onload=null,r.remove(),r.src=""};r.defer="defer",addScriptAtts(r,t),r.onerror=function(){a(new Error("Failed to import: "+e)),i()},r.onload=function(){n(),i()},r.src=e,document.head.append(r)})}function importModule(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).returnDefault,a=void 0!==n&&n;return Array.isArray(e)?Promise.all(e.map(function(e){return importModule(e,t)})):new Promise(function(n,r){var i="$importModule$"+Math.random().toString(32).slice(2),o=document.createElement("script"),s=function(){delete window[i],o.onerror=null,o.onload=null,o.remove(),URL.revokeObjectURL(o.src),o.src=""};addScriptAtts(o,t),o.defer="defer",o.type="module",o.onerror=function(){r(new Error("Failed to import: "+e)),s()},o.onload=function(){n(window[i]),s()};var l="import * as m from '"+toAbsoluteURL(e).replace(/'/g,"\\'")+"'; window."+i+" = "+(a?"m.default || ":"")+"m;",c=new Blob([l],{type:"text/javascript"});o.src=URL.createObjectURL(c),document.head.append(o)})}var $$4=jQuery,Layer=function(){function e(t,n,a){if(classCallCheck(this,e),this.name_=t,this.group_=a?null:n,a){var r=a.ownerDocument;this.group_=r.createElementNS(NS.SVG,"g");var i=r.createElementNS(NS.SVG,"title");i.textContent=t,this.group_.append(i),n?$$4(n).after(this.group_):a.append(this.group_)}addLayerClass(this.group_),walkTree(this.group_,function(e){e.setAttribute("style","pointer-events:inherit")}),this.group_.setAttribute("style",a?"pointer-events:all":"pointer-events:none")}return createClass(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_.append(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=toXml(e);var a=this.getTitleElement();return a?($$4(a).empty(),a.textContent=e,this.name_=e,t&&t.changeElement(a,{"#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 addLayerClass(e){var t=e.getAttribute("class");null!==t&&void 0!==t&&t.length?Layer.CLASS_REGEX.test(t)||e.setAttribute("class",t+" "+Layer.CLASS_NAME):e.setAttribute("class",Layer.CLASS_NAME)}Layer.CLASS_NAME="layer",Layer.CLASS_REGEX=new RegExp("(\\s|^)"+Layer.CLASS_NAME+"(\\s|$)");var HistoryRecordingService=function(){function e(t){classCallCheck(this,e),this.undoManager_=t,this.currentBatchCommand_=null,this.batchCommandStack_=[]}return createClass(e,[{key:"startBatchCommand",value:function(e){return this.undoManager_?(this.currentBatchCommand_=new BatchCommand(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,a){return this.undoManager_?(this.addCommand_(new MoveElementCommand(e,t,n,a)),this):this}},{key:"insertElement",value:function(e,t){return this.undoManager_?(this.addCommand_(new InsertElementCommand(e,t)),this):this}},{key:"removeElement",value:function(e,t,n,a){return this.undoManager_?(this.addCommand_(new RemoveElementCommand(e,t,n,a)),this):this}},{key:"changeElement",value:function(e,t,n){return this.undoManager_?(this.addCommand_(new ChangeElementCommand(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}();HistoryRecordingService.NO_HISTORY=new HistoryRecordingService;var $$5=jQuery,visElems$1="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),RandomizeModes={LET_DOCUMENT_DECIDE:0,ALWAYS_RANDOMIZE:1,NEVER_RANDOMIZE:2},randIds=RandomizeModes.LET_DOCUMENT_DECIDE,disabledElems=[];function historyRecordingService(e){return e||new HistoryRecordingService(canvas_.undoMgr)}function findLayerNameInGroup(e){return $$5("title",e).text()||(isOpera()&&e.querySelectorAll?$$5(e.querySelectorAll("title")).text():"")}function getNewLayerName(e){for(var t=1;e.includes("Layer "+t);)t++;return"Layer "+t}var Drawing=function(){function e(t,n){if(classCallCheck(this,e),!t||!t.tagName||!t.namespaceURI||"svg"!==t.tagName||t.namespaceURI!==NS.SVG)throw new Error("Error: svgedit.draw.Drawing instance initialized without a <svg> element");this.svgElem_=t,this.obj_num=0,this.idPrefix=n||"svg_",this.releasedNums=[],this.all_layers=[],this.layer_map={},this.current_layer=null,this.nonce_="";var a=this.svgElem_.getAttributeNS(NS.SE,"nonce");a&&randIds!==RandomizeModes.NEVER_RANDOMIZE?this.nonce_=a:randIds===RandomizeModes.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(100001*Math.random()))}return createClass(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):$$5(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(NS.XMLNS,"xmlns:se",NS.SE),this.svgElem_.setAttributeNS(NS.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 a=this.current_layer.getName();(n=this.current_layer.setName(e,t))&&(delete this.layer_map[a],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 a=this.current_layer.getGroup(),r=a.nextSibling,i=null;return e>n?e<t-1&&(i=this.all_layers[e+1].getGroup()):i=this.all_layers[e].getGroup(),this.svgElem_.insertBefore(a,i),this.identifyLayers(),this.setCurrentLayer(this.getLayerName(e)),{currentGroup:a,oldNextSibling:r}}return null}},{key:"mergeLayer",value:function(e){var t=this.current_layer.getGroup(),n=$$5(t).prev()[0];if(n){e.startBatchCommand("Merge Layer");var a=t.nextSibling;for(e.removeElement(t,a,this.svgElem_);t.firstChild;){var r=t.firstChild;if("title"!==r.localName){var i=r.nextSibling;n.append(r),e.moveElement(r,i,t)}else e.removeElement(r,r.nextSibling,t),r.remove()}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=this.svgElem_.childNodes.length,t=[],n=[],a=null,r=!1,i=0;i<e;++i){var o=this.svgElem_.childNodes.item(i);if(o&&1===o.nodeType)if("g"===o.tagName){r=!0;var s=findLayerNameInGroup(o);s?(n.push(s),a=new Layer(s,o),this.all_layers.push(a),this.layer_map[s]=a):t.push(o)}else visElems$1.includes(o.nodeName)&&t.push(o)}t.length>0||!r?((a=new Layer(getNewLayerName(n),null,this.svgElem_)).appendChildren(t),this.all_layers.push(a),this.layer_map[name]=a):a.activate(),this.current_layer=a}},{key:"createLayer",value:function(e,t){this.current_layer&&this.current_layer.deactivate(),(void 0===e||null===e||""===e||this.layer_map[e])&&(e=getNewLayerName(Object.keys(this.layer_map)));var n=new Layer(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=getNewLayerName(Object.keys(this.layer_map)));for(var n=this.current_layer.getGroup(),a=new Layer(e,n,this.svgElem_),r=a.getGroup(),i=n.childNodes,o=0;o<i.length;o++){var s=i[o];"title"!==s.localName&&r.append(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,a):this.all_layers.push(a),this.layer_map[e]=a,this.current_layer=a,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 copyElem(e,function(){return t.getNextId()})}}]),e}(),randomizeIds=function(e,t){(randIds=!1===e?RandomizeModes.NEVER_RANDOMIZE:RandomizeModes.ALWAYS_RANDOMIZE)!==RandomizeModes.ALWAYS_RANDOMIZE||t.getNonce()?randIds===RandomizeModes.NEVER_RANDOMIZE&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},canvas_=void 0,init$3=function(e){canvas_=e},identifyLayers=function(){leaveContext(),canvas_.getCurrentDrawing().identifyLayers()},createLayer=function(e,t){var n=canvas_.getCurrentDrawing().createLayer(e,historyRecordingService(t));canvas_.clearSelection(),canvas_.call("changed",[n])},cloneLayer=function(e,t){var n=canvas_.getCurrentDrawing().cloneLayer(e,historyRecordingService(t));canvas_.clearSelection(),leaveContext(),canvas_.call("changed",[n])},deleteCurrentLayer=function(){var e=canvas_.getCurrentDrawing().getCurrentLayer(),t=e.nextSibling,n=e.parentNode;if(e=canvas_.getCurrentDrawing().deleteCurrentLayer()){var a=new BatchCommand("Delete Layer");return a.addSubCommand(new RemoveElementCommand(e,t,n)),canvas_.addCommandToHistory(a),canvas_.clearSelection(),canvas_.call("changed",[n]),!0}return!1},setCurrentLayer=function(e){var t=canvas_.getCurrentDrawing().setCurrentLayer(toXml(e));return t&&canvas_.clearSelection(),t},renameCurrentLayer=function(e){var t=canvas_.getCurrentDrawing(),n=t.getCurrentLayer();if(n&&t.setCurrentLayerName(e,historyRecordingService()))return canvas_.call("changed",[n]),!0;return!1},setCurrentLayerPosition=function(e){var t=canvas_.getCurrentDrawing().setCurrentLayerPosition(e);return!!t&&(canvas_.addCommandToHistory(new MoveElementCommand(t.currentGroup,t.oldNextSibling,canvas_.getSVGContent())),!0)},setLayerVisibility=function(e,t){var n=canvas_.getCurrentDrawing(),a=n.getLayerVisibility(e),r=n.setLayerVisibility(e,t);if(!r)return!1;var i=a?"inline":"none";return canvas_.addCommandToHistory(new ChangeElementCommand(r,{display:i},"Layer Visibility")),r===n.getCurrentLayer()&&(canvas_.clearSelection(),canvas_.pathActions.clear()),!0},moveSelectedToLayer=function(e){var t=canvas_.getCurrentDrawing().getLayerByName(e);if(!t)return!1;for(var n=new BatchCommand("Move Elements to Layer"),a=canvas_.getSelectedElements(),r=a.length;r--;){var i=a[r];if(i){var o=i.nextSibling,s=i.parentNode;t.append(i),n.addSubCommand(new MoveElementCommand(i,o,s))}}return canvas_.addCommandToHistory(n),!0},mergeLayer=function(e){canvas_.getCurrentDrawing().mergeLayer(historyRecordingService(e)),canvas_.clearSelection(),leaveContext(),canvas_.changeSVGContent()},mergeAllLayers=function(e){canvas_.getCurrentDrawing().mergeAllLayers(historyRecordingService(e)),canvas_.clearSelection(),leaveContext(),canvas_.changeSVGContent()},leaveContext=function(){var e=disabledElems.length;if(e){for(var t=0;t<e;t++){var n=disabledElems[t],a=canvas_.elData(n,"orig_opac");1!==a?n.setAttribute("opacity",a):n.removeAttribute("opacity"),n.setAttribute("style","pointer-events: inherit")}disabledElems=[],canvas_.clearSelection(!0),canvas_.call("contextset",null)}canvas_.setCurrentGroup(null)},setContext=function(e){leaveContext(),"string"==typeof e&&(e=getElem(e)),canvas_.setCurrentGroup(e),$$5(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var e=this.getAttribute("opacity")||1;canvas_.elData(this,"orig_opac",e),this.setAttribute("opacity",.33*e),this.setAttribute("style","pointer-events: none"),disabledElems.push(this)}),canvas_.clearSelection(),canvas_.call("contextset",canvas_.getCurrentGroup())},draw=Object.freeze({Drawing:Drawing,randomizeIds:randomizeIds,init:init$3,identifyLayers:identifyLayers,createLayer:createLayer,cloneLayer:cloneLayer,deleteCurrentLayer:deleteCurrentLayer,setCurrentLayer:setCurrentLayer,renameCurrentLayer:renameCurrentLayer,setCurrentLayerPosition:setCurrentLayerPosition,setLayerVisibility:setLayerVisibility,moveSelectedToLayer:moveSelectedToLayer,mergeLayer:mergeLayer,mergeAllLayers:mergeAllLayers,leaveContext:leaveContext,setContext:setContext,Layer:Layer}),REVERSE_NS=getReverseNS(),svgWhiteList_={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:[]},svgWhiteListNS_={};Object.entries(svgWhiteList_).forEach(function(e){var t=slicedToArray(e,2),n=t[0],a=t[1],r={};Object.entries(a).forEach(function(e){var t=slicedToArray(e,2),n=(t[0],t[1]);if(n.includes(":")){var a=n.split(":");r[a[1]]=NS[a[0].toUpperCase()]}else r[n]="xmlns"===n?NS.XMLNS:null}),svgWhiteListNS_[n]=r});var sanitizeSvg=function e(t){if(3===t.nodeType&&(t.nodeValue=t.nodeValue.replace(/^\s+|\s+$/g,""),t.nodeValue.length||t.remove()),1===t.nodeType){var n=t.ownerDocument,a=t.parentNode;if(n&&a){var r=svgWhiteList_[t.nodeName],i=svgWhiteListNS_[t.nodeName];if(void 0!==r){for(var o=[],s=t.attributes.length;s--;){var l=t.attributes.item(s),c=l.nodeName,u=l.localName,d=l.namespaceURI;if(i.hasOwnProperty(u)&&d===i[u]&&d!==NS.XMLNS||d===NS.XMLNS&&REVERSE_NS[l.value]||((c.startsWith("se:")||c.startsWith("data-"))&&o.push([c,l.value]),t.removeAttributeNS(d,u)),isGecko())switch(c){case"transform":case"gradientTransform":case"patternTransform":var h=l.value.replace(/(\d)-/g,"$1 -");t.setAttribute(c,h)}if("style"===c){for(var g=l.value.split(";"),p=g.length;p--;){var f=g[p].split(":"),v=slicedToArray(f,2),m=v[0],_=v[1],b=(m||"").trim(),y=(_||"").trim();r.includes(b)&&t.setAttribute(b,y)}t.removeAttribute("style")}}Object.values(o).forEach(function(e){var n=slicedToArray(e,2),a=n[0],r=n[1];t.setAttributeNS(NS.SE,a,r)});var x=getHref(t);if(x&&["filter","linearGradient","pattern","radialGradient","textPath","use"].includes(t.nodeName)&&"#"!==x[0]&&(setHref(t,""),t.removeAttributeNS(NS.XLINK,"href")),"use"===t.nodeName&&!getHref(t))return void t.remove();for(Object.values(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(e){var n=t.getAttribute(e);n&&(n=getUrlFromAttr(n))&&"#"!==n[0]&&(t.setAttribute(e,""),t.removeAttribute(e))}),s=t.childNodes.length;s--;)e(t.childNodes.item(s))}else{for(var C=[];t.hasChildNodes();)C.push(a.insertBefore(t.firstChild,t));t.remove();for(var S=C.length;S--;)e(C[S])}}}},$$6=jQuery,pathMap$1=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],editorContext_$2=null,init$4=function(e){editorContext_$2=e},remapElement=function(e,t,n){for(var a=function(e,t){return transformPoint(e,t,n)},r=function(e){return n.a*e},i=function(e){return n.d*e},o=editorContext_$2.getGridSnapping()&&"svg"===e.parentNode.parentNode.localName,s=function(){if(o)for(var n in t)t[n]=snapToGrid(t[n]);assignAttributes(e,t,1e3,!0)},l=getBBox(e),c=0;c<2;c++){var u=0===c?"fill":"stroke",d=e.getAttribute(u);if(d&&d.startsWith("url(")&&(n.a<0||n.d<0)){var h=getRefElem(d).cloneNode(!0);if(n.a<0){var g=h.getAttribute("x1"),p=h.getAttribute("x2");h.setAttribute("x1",-(g-1)),h.setAttribute("x2",-(p-1))}if(n.d<0){var f=h.getAttribute("y1"),v=h.getAttribute("y2");h.setAttribute("y1",-(f-1)),h.setAttribute("y2",-(v-1))}h.id=editorContext_$2.getDrawing().getNextId(),findDefs().append(h),e.setAttribute(u,"url(#"+h.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 _=getTransformList(e),b=editorContext_$2.getSVGRoot().createSVGTransform();b.setMatrix(matrixMultiply(transformListToTransform(_).matrix,n)),_.clear(),_.appendItem(b)}else{var y=transformListToTransform(e).matrix,x=matrixMultiply(y.inverse(),n,y);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 C=getTransformList(e),S=editorContext_$2.getSVGRoot().createSVGTransform();S.setMatrix(matrixMultiply(transformListToTransform(C).matrix,n)),C.clear(),C.appendItem(S)}else{var w=a(t.x,t.y);t.width=r(t.width),t.height=i(t.height),t.x=w.x+Math.min(0,t.width),t.y=w.y+Math.min(0,t.height),t.width=Math.abs(t.width),t.height=Math.abs(t.height)}s();break;case"ellipse":var $=a(t.cx,t.cy);t.cx=$.x,t.cy=$.y,t.rx=r(t.rx),t.ry=i(t.ry),t.rx=Math.abs(t.rx),t.ry=Math.abs(t.ry),s();break;case"circle":var k=a(t.cx,t.cy);t.cx=k.x,t.cy=k.y;var A=transformBox(l.x,l.y,l.width,l.height,n),E=A.tr.x-A.tl.x,P=A.bl.y-A.tl.y;t.r=Math.min(E/2,P/2),t.r&&(t.r=Math.abs(t.r)),s();break;case"line":var T=a(t.x1,t.y1),G=a(t.x2,t.y2);t.x1=T.x,t.y1=T.y,t.x2=G.x,t.y2=G.y;case"text":case"tspan":case"use":s();break;case"g":var N=$$6(e).data("gsvg");N&&assignAttributes(N,t,1e3,!0);break;case"polyline":case"polygon":for(var L=t.points.length,I=0;I<L;++I){var M=t.points[I],R=a(M.x,M.y),O=R.x,V=R.y;t.points[I].x=O,t.points[I].y=V}for(var B="",j=0;j<L;++j){var D=t.points[j];B+=D.x+","+D.y+" "}e.setAttribute("points",B);break;case"path":var F=e.pathSegList,U=F.numberOfItems;t.d=[];for(var H=0;H<U;++H){var z=F.getItem(H);t.d[H]={type:z.pathSegType,x:z.x,y:z.y,x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,r1:z.r1,r2:z.r2,angle:z.angle,largeArcFlag:z.largeArcFlag,sweepFlag:z.sweepFlag}}U=t.d.length;var q=t.d[0],W=a(q.x,q.y);t.d[0].x=W.x,t.d[0].y=W.y;for(var Y=1;Y<U;++Y){var X=t.d[Y];if(X.type%2==0){var K=a(void 0!==X.x?X.x:W.x,void 0!==X.y?X.y:W.y),Q=a(X.x1,X.y1),Z=a(X.x2,X.y2);X.x=K.x,X.y=K.y,X.x1=Q.x,X.y1=Q.y,X.x2=Z.x,X.y2=Z.y,X.r1=r(X.r1),X.r2=i(X.r2)}else X.x=r(X.x),X.y=i(X.y),X.x1=r(X.x1),X.y1=i(X.y1),X.x2=r(X.x2),X.y2=i(X.y2),X.r1=r(X.r1),X.r2=i(X.r2)}var J="";U=t.d.length;for(var ee=0;ee<U;++ee){var te=t.d[ee],ne=te.type;switch(J+=pathMap$1[ne],ne){case 13:case 12:J+=te.x+" ";break;case 15:case 14:J+=te.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:J+=te.x+","+te.y+" ";break;case 7:case 6:J+=te.x1+","+te.y1+" "+te.x2+","+te.y2+" "+te.x+","+te.y+" ";break;case 9:case 8:J+=te.x1+","+te.y1+" "+te.x+","+te.y+" ";break;case 11:case 10:J+=te.r1+","+te.r2+" "+te.angle+" "+ +te.largeArcFlag+" "+ +te.sweepFlag+" "+te.x+","+te.y+" ";break;case 17:case 16:J+=te.x2+","+te.y2+" "+te.x+","+te.y+" "}}e.setAttribute("d",J)}},$$7=jqPluginSVG(jQuery),context_=void 0,init$5=function(e){context_=e},updateClipPath=function(e,t,n){var a=getRefElem(e).firstChild,r=getTransformList(a),i=context_.getSVGRoot().createSVGTransform();i.setTranslate(t,n),r.appendItem(i),recalculateDimensions(a)},recalculateDimensions=function e(t){if(null==t)return null;if("svg"===t.nodeName&&navigator.userAgent.includes("Firefox/20"))return null;var n=context_.getSVGRoot(),a=getTransformList(t);if(a&&a.numberOfItems>0){for(var r=a.numberOfItems,i=r;r--;){var o=a.getItem(r);if(0===o.type)a.removeItem(r);else if(1===o.type){if(isIdentity(o.matrix)){if(1===i)return t.removeAttribute("transform"),null;a.removeItem(r)}}else 4===o.type&&0===o.angle&&a.removeItem(r)}if(1===a.numberOfItems&&getRotationAngle(t))return null}if(!a||0===a.numberOfItems)return t.setAttribute("transform",""),t.removeAttribute("transform"),null;if(a){for(var s=[],l=a.numberOfItems;l--;){var c=a.getItem(l);1===c.type?s.push([c.matrix,l]):s.length&&(s=[])}if(2===s.length){var u=n.createSVGTransformFromMatrix(matrixMultiply(s[1][0],s[0][0]));a.removeItem(s[0][1]),a.removeItem(s[1][1]),a.insertItemBefore(u,s[1][1])}if((l=a.numberOfItems)>=2&&1===a.getItem(l-2).type&&2===a.getItem(l-1).type){var d=n.createSVGTransform(),h=matrixMultiply(a.getItem(l-2).matrix,a.getItem(l-1).matrix);d.setMatrix(h),a.removeItem(l-2),a.removeItem(l-2),a.appendItem(d)}}switch(t.tagName){case"line":case"polyline":case"polygon":case"path":break;default:if(1===a.numberOfItems&&1===a.getItem(0).type||2===a.numberOfItems&&1===a.getItem(0).type&&4===a.getItem(0).type)return null}var g=$$7(t).data("gsvg"),p=new BatchCommand("Transform"),f={},v=null,m=[];switch(t.tagName){case"line":m=["x1","y1","x2","y2"];break;case"circle":m=["cx","cy","r"];break;case"ellipse":m=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":m=["width","height","x","y"];break;case"use":case"text":case"tspan":m=["x","y"];break;case"polygon":case"polyline":(v={}).points=t.getAttribute("points");var _=t.points,b=_.numberOfItems;f.points=new Array(b);for(var y=0;y<b;++y){var x=_.getItem(y);f.points[y]={x:x.x,y:x.y}}break;case"path":(v={}).d=t.getAttribute("d"),f.d=t.getAttribute("d")}m.length?(f=$$7(t).attr(m),$$7.each(f,function(e,t){f[e]=convertToNum(e,t)})):g&&(f={x:$$7(g).attr("x")||0,y:$$7(g).attr("y")||0}),null==v&&(v=$$7.extend(!0,{},f),$$7.each(v,function(e,t){v[e]=convertToNum(e,t)})),v.transform=context_.getStartTransform()||"";var C=void 0,S=void 0;if("g"===t.tagName&&!g||"a"===t.tagName){var w=getBBox(t);C={x:w.x+w.width/2,y:w.y+w.height/2},S=transformPoint(w.x+w.width/2,w.y+w.height/2,transformListToTransform(a).matrix);var $=n.createSVGMatrix(),k=getRotationAngle(t);if(k){var A=k*Math.PI/180,E=void 0;E=Math.abs(A)>1e-10?Math.sin(A)/(1-Math.cos(A)):2/A;for(var P=0;P<a.numberOfItems;++P){var T=a.getItem(P);if(4===T.type){var G=T.matrix;C.y=(E*G.e+G.f)/2,C.x=(G.e-E*G.f)/2,a.removeItem(P);break}}}var N=a.numberOfItems,L=0,I=0,M=0,R=void 0;N&&(R=a.getItem(0).matrix);var O=void 0;if(N>=3&&3===a.getItem(N-2).type&&2===a.getItem(N-3).type&&2===a.getItem(N-1).type){M=3;for(var V=a.getItem(N-3).matrix,B=a.getItem(N-2).matrix,j=a.getItem(N-1).matrix,D=t.childNodes,F=D.length;F--;){var U=D.item(F);if(L=0,I=0,1===U.nodeType){var H=getTransformList(U);if(!H)continue;var z=transformListToTransform(H).matrix,q=getRotationAngle(U);if(O=context_.getStartTransform(),context_.setStartTransform(U.getAttribute("transform")),q||hasMatrixTransform(H)){var W=n.createSVGTransform();W.setMatrix(matrixMultiply(V,B,j,z)),H.clear(),H.appendItem(W)}else{var Y=matrixMultiply(z.inverse(),j,z),X=n.createSVGMatrix();X.e=-Y.e,X.f=-Y.f;var K=matrixMultiply(X.inverse(),z.inverse(),V,B,j,z,Y.inverse()),Q=n.createSVGTransform(),Z=n.createSVGTransform(),J=n.createSVGTransform();Q.setTranslate(Y.e,Y.f),Z.setScale(K.a,K.d),J.setTranslate(X.e,X.f),H.appendItem(J),H.appendItem(Z),H.appendItem(Q)}p.addSubCommand(e(U)),context_.setStartTransform(O)}}a.removeItem(N-1),a.removeItem(N-2),a.removeItem(N-3)}else if(N>=3&&1===a.getItem(N-1).type){M=3,$=transformListToTransform(a).matrix;var ee=n.createSVGTransform();ee.setMatrix($),a.clear(),a.appendItem(ee)}else if((1===N||N>1&&3!==a.getItem(1).type)&&2===a.getItem(0).type){M=2;var te=transformListToTransform(a).matrix;a.removeItem(0);var ne=transformListToTransform(a).matrix.inverse(),ae=matrixMultiply(ne,te);if(L=ae.e,I=ae.f,0!==L||0!==I){for(var re=t.childNodes,ie=re.length,oe=[];ie--;){var se=re.item(ie);if(1===se.nodeType){if(se.getAttribute("clip-path")){var le=se.getAttribute("clip-path");oe.includes(le)||(updateClipPath(le,L,I),oe.push(le))}O=context_.getStartTransform(),context_.setStartTransform(se.getAttribute("transform"));var ce=getTransformList(se);if(ce){var ue=n.createSVGTransform();ue.setTranslate(L,I),ce.numberOfItems?ce.insertItemBefore(ue,0):ce.appendItem(ue),p.addSubCommand(e(se));for(var de=t.getElementsByTagNameNS(NS.SVG,"use"),he="#"+se.id,ge=de.length;ge--;){var pe=de.item(ge);if(he===getHref(pe)){var fe=n.createSVGTransform();fe.setTranslate(-L,-I),getTransformList(pe).insertItemBefore(fe,0),p.addSubCommand(e(pe))}}context_.setStartTransform(O)}}}oe=[],context_.setStartTransform(O)}}else{if(1!==N||1!==a.getItem(0).type||k){if(k){var ve=n.createSVGTransform();ve.setRotate(k,S.x,S.y),a.numberOfItems?a.insertItemBefore(ve,0):a.appendItem(ve)}return 0===a.numberOfItems&&t.removeAttribute("transform"),null}M=1;for(var me=a.getItem(0).matrix,_e=t.childNodes,be=_e.length;be--;){var ye=_e.item(be);if(1===ye.nodeType){O=context_.getStartTransform(),context_.setStartTransform(ye.getAttribute("transform"));var xe=getTransformList(ye);if(!xe)continue;var Ce=matrixMultiply(me,transformListToTransform(xe).matrix),Se=n.createSVGTransform();Se.setMatrix(Ce),xe.clear(),xe.appendItem(Se,0),p.addSubCommand(e(ye)),context_.setStartTransform(O);var we=ye.getAttribute("stroke-width");if("none"!==ye.getAttribute("stroke")&&!isNaN(we)){var $e=(Math.abs(Ce.a)+Math.abs(Ce.d))/2;ye.setAttribute("stroke-width",we*$e)}}}a.clear()}if(2===M){if(k){S={x:C.x+R.e,y:C.y+R.f};var ke=n.createSVGTransform();ke.setRotate(k,S.x,S.y),a.numberOfItems?a.insertItemBefore(ke,0):a.appendItem(ke)}}else if(3===M){var Ae=transformListToTransform(a).matrix,Ee=n.createSVGTransform();Ee.setRotate(k,C.x,C.y);var Pe=Ee.matrix,Te=n.createSVGTransform();Te.setRotate(k,S.x,S.y);var Ge=Te.matrix.inverse(),Ne=Ae.inverse(),Le=matrixMultiply(Ne,Ge,Pe,Ae);if(L=Le.e,I=Le.f,0!==L||0!==I)for(var Ie=t.childNodes,Me=Ie.length;Me--;){var Re=Ie.item(Me);if(1===Re.nodeType){O=context_.getStartTransform(),context_.setStartTransform(Re.getAttribute("transform"));var Oe=getTransformList(Re),Ve=n.createSVGTransform();Ve.setTranslate(L,I),Oe.numberOfItems?Oe.insertItemBefore(Ve,0):Oe.appendItem(Ve),p.addSubCommand(e(Re)),context_.setStartTransform(O)}}k&&(a.numberOfItems?a.insertItemBefore(Te,0):a.appendItem(Te))}}else{var Be=getBBox(t);if(!Be&&"path"!==t.tagName)return null;var je=n.createSVGMatrix(),De=getRotationAngle(t);if(De){C={x:Be.x+Be.width/2,y:Be.y+Be.height/2},S=transformPoint(Be.x+Be.width/2,Be.y+Be.height/2,transformListToTransform(a).matrix);for(var Fe=De*Math.PI/180,Ue=Math.abs(Fe)>1e-10?Math.sin(Fe)/(1-Math.cos(Fe)):2/Fe,He=0;He<a.numberOfItems;++He){var ze=a.getItem(He);if(4===ze.type){var qe=ze.matrix;C.y=(Ue*qe.e+qe.f)/2,C.x=(qe.e-Ue*qe.f)/2,a.removeItem(He);break}}}var We=0,Ye=a.numberOfItems;if(!isWebkit()){var Xe=t.getAttribute("fill");if(Xe&&Xe.startsWith("url(")){var Ke=getRefElem(Xe),Qe="pattern";if(Ke.tagName!==Qe&&(Qe="gradient"),"userSpaceOnUse"===Ke.getAttribute(Qe+"Units")){je=transformListToTransform(a).matrix;var Ze=getTransformList(Ke),Je=transformListToTransform(Ze).matrix,et="matrix("+[(je=matrixMultiply(je,Je)).a,je.b,je.c,je.d,je.e,je.f].join(",")+")";Ke.setAttribute(Qe+"Transform",et)}}}if(Ye>=3&&3===a.getItem(Ye-2).type&&2===a.getItem(Ye-3).type&&2===a.getItem(Ye-1).type)We=3,je=transformListToTransform(a,Ye-3,Ye-1).matrix,a.removeItem(Ye-1),a.removeItem(Ye-2),a.removeItem(Ye-3);else if(4===Ye&&1===a.getItem(Ye-1).type){We=3,je=transformListToTransform(a).matrix;var tt=n.createSVGTransform();tt.setMatrix(je),a.clear(),a.appendItem(tt),je=n.createSVGMatrix()}else if((1===Ye||Ye>1&&3!==a.getItem(1).type)&&2===a.getItem(0).type){We=2;var nt=a.getItem(0).matrix,at=transformListToTransform(a,1).matrix,rt=at.inverse();je=matrixMultiply(rt,nt,at),a.removeItem(0)}else{if(1!==Ye||1!==a.getItem(0).type||De){if(We=4,De){var it=n.createSVGTransform();it.setRotate(De,S.x,S.y),a.numberOfItems?a.insertItemBefore(it,0):a.appendItem(it)}return 0===a.numberOfItems&&t.removeAttribute("transform"),null}switch(je=transformListToTransform(a).matrix,t.tagName){case"line":f=$$7(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(f.points=t.getAttribute("points"),f.points){var ot=t.points,st=ot.numberOfItems;f.points=new Array(st);for(var lt=0;lt<st;++lt){var ct=ot.getItem(lt);f.points[lt]={x:ct.x,y:ct.y}}}case"path":f.d=t.getAttribute("d"),We=1,a.clear()}}if(1!==We&&2!==We&&3!==We||remapElement(t,f,je),2===We){if(De){hasMatrixTransform(a)||(S={x:C.x+je.e,y:C.y+je.f});var ut=n.createSVGTransform();ut.setRotate(De,S.x,S.y),a.numberOfItems?a.insertItemBefore(ut,0):a.appendItem(ut)}if("text"===t.tagName)for(var dt=t.childNodes,ht=dt.length;ht--;){var gt=dt.item(ht);if("tspan"===gt.tagName){var pt={x:$$7(gt).attr("x")||0,y:$$7(gt).attr("y")||0};remapElement(gt,pt,je)}}}else if(3===We&&De){var ft=transformListToTransform(a).matrix,vt=n.createSVGTransform();vt.setRotate(De,C.x,C.y);var mt=vt.matrix,_t=n.createSVGTransform();_t.setRotate(De,S.x,S.y);var bt=_t.matrix.inverse(),yt=ft.inverse(),xt=matrixMultiply(yt,bt,mt,ft);remapElement(t,f,xt),De&&(a.numberOfItems?a.insertItemBefore(_t,0):a.appendItem(_t))}}return 0===a.numberOfItems&&t.removeAttribute("transform"),p.addSubCommand(new ChangeElementCommand(t,v)),p},$$8=jQuery,svgFactory_=void 0,config_=void 0,selectorManager_=void 0,gripRadius=isTouch()?10:4,Selector=function(){function e(t,n,a){classCallCheck(this,e),this.id=t,this.selectedElement=n,this.locked=!0,this.selectorGroup=svgFactory_.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}}),this.selectorRect=this.selectorGroup.appendChild(svgFactory_.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,a)}return createClass(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=[],a=Math.round(e/45);for(t in a<0&&(a+=8),selectorManager_.selectorGrips)n.push(t);for(;a>0;)n.push(n.shift()),a--;var r=0;for(t in selectorManager_.selectorGrips)selectorManager_.selectorGrips[t].setAttribute("style","cursor:"+n[r]+"-resize"),r++}},{key:"showGrips",value:function(e){var t=e?"inline":"none";selectorManager_.selectorGripsGroup.setAttribute("display",t);var n=this.selectedElement;this.hasGrips=e,n&&e&&(this.selectorGroup.append(selectorManager_.selectorGripsGroup),this.updateGripCursors(getRotationAngle(n)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=selectorManager_,a=n.selectorGrips,r=this.selectedElement,i=r.getAttribute("stroke-width"),o=svgFactory_.getCurrentZoom(),s=1/o;"none"===r.getAttribute("stroke")||isNaN(i)||(s+=i/2);var l=r.tagName;"text"===l&&(s+=2/o);var c=getTransformList(r),u=transformListToTransform(c).matrix;if(u.e*=o,u.f*=o,e||(e=getBBox(r)),"g"===l&&!$$8.data(r,"gsvg")){var d=getStrokedBBox([r.childNodes]);d&&(e=d)}var h=e.x,g=e.y,p=e.width,f=e.height;e={x:h,y:g,width:p,height:f},s*=o;var v=transformBox(h*o,g*o,p*o,f*o,u),m=v.aabox,_=m.x-s,b=m.y-s,y=m.width+2*s,x=m.height+2*s,C=_+y/2,S=b+x/2,w=getRotationAngle(r);if(w){var $=svgFactory_.svgRoot().createSVGTransform();$.setRotate(-w,C,S);var k=$.matrix;v.tl=transformPoint(v.tl.x,v.tl.y,k),v.tr=transformPoint(v.tr.x,v.tr.y,k),v.bl=transformPoint(v.bl.x,v.bl.y,k),v.br=transformPoint(v.br.x,v.br.y,k);var A=v.tl,E=A.x,P=A.y,T=A.x,G=A.y,N=Math.min,L=Math.max;_=E=N(E,N(v.tr.x,N(v.bl.x,v.br.x)))-s,b=P=N(P,N(v.tr.y,N(v.bl.y,v.br.y)))-s,y=(T=L(T,L(v.tr.x,L(v.bl.x,v.br.x)))+s)-E,x=(G=L(G,L(v.tr.y,L(v.bl.y,v.br.y)))+s)-P}var I="M"+_+","+b+" L"+(_+y)+","+b+" "+(_+y)+","+(b+x)+" "+_+","+(b+x)+"z";t.setAttribute("d",I);var M=w?"rotate("+[w,C,S].join(",")+")":"";for(var R in this.selectorGroup.setAttribute("transform",M),this.gripCoords={nw:[_,b],ne:[_+y,b],sw:[_,b+x],se:[_+y,b+x],n:[_+y/2,b],w:[_,b+x/2],e:[_+y,b+x/2],s:[_+y/2,b+x]},this.gripCoords){var O=this.gripCoords[R];a[R].setAttribute("cx",O[0]),a[R].setAttribute("cy",O[1])}n.rotateGripConnector.setAttribute("x1",_+y/2),n.rotateGripConnector.setAttribute("y1",b),n.rotateGripConnector.setAttribute("x2",_+y/2),n.rotateGripConnector.setAttribute("y2",b-5*gripRadius),n.rotateGrip.setAttribute("cx",_+y/2),n.rotateGrip.setAttribute("cy",b-5*gripRadius)}}]),e}(),SelectorManager=function(){function e(){classCallCheck(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 createClass(e,[{key:"initGroup",value:function(){for(var e in this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.remove(),this.selectorParentGroup=svgFactory_.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=svgFactory_.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.append(this.selectorGripsGroup),svgFactory_.svgRoot().append(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,this.selectorGrips){var t=svgFactory_.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+e,fill:"#22C",r:gripRadius,style:"cursor:"+e+"-resize","stroke-width":2,"pointer-events":"all"}});$$8.data(t,"dir",e),$$8.data(t,"type","resize"),this.selectorGrips[e]=this.selectorGripsGroup.appendChild(t)}if(this.rotateGripConnector=this.selectorGripsGroup.appendChild(svgFactory_.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(svgFactory_.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:gripRadius,stroke:"#22C","stroke-width":2,style:"cursor:url("+config_.imgPath+"rotate.png) 12 12, auto;"}})),$$8.data(this.rotateGrip,"type","rotate"),!$$8("#canvasBackground").length){var n=slicedToArray(config_.dimensions,2),a=n[0],r=n[1],i=svgFactory_.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:a,height:r,x:0,y:0,overflow:isWebkit()?"none":"visible",style:"pointer-events:none"}}),o=svgFactory_.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});i.append(o),svgFactory_.svgRoot().insertBefore(i,svgFactory_.svgContent())}}},{key:"requestSelector",value:function(e,t){if(null==e)return null;var n=this.selectors.length;if("object"===_typeof(this.selectorMap[e.id]))return this.selectorMap[e.id].locked=!0,this.selectorMap[e.id];for(var a=0;a<n;++a)if(this.selectors[a]&&!this.selectors[a].locked)return this.selectors[a].locked=!0,this.selectors[a].reset(e,t),this.selectorMap[e.id]=this.selectors[a],this.selectors[a];return this.selectors[n]=new Selector(n,e,t),this.selectorParentGroup.append(this.selectors[n].selectorGroup),this.selectorMap[e.id]=this.selectors[n],this.selectors[n]}},{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 a=0;a<t;++a)if(this.selectors[a]&&this.selectors[a]===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(svgFactory_.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}(),init$6=function(e,t){config_=e,svgFactory_=t,selectorManager_=new SelectorManager},getSelectorManager=function(){return selectorManager_},$$9=jqPluginSVG(jQuery),MoveElementCommand$1=MoveElementCommand,InsertElementCommand$1=InsertElementCommand,RemoveElementCommand$1=RemoveElementCommand,ChangeElementCommand$1=ChangeElementCommand,BatchCommand$1=BatchCommand,UndoManager$1=UndoManager,HistoryEventTypes$1=HistoryEventTypes;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 SvgCanvas=function e(t,n){classCallCheck(this,e);var a={show_outside_canvas:!0,selectNew:!0,dimensions:[640,480]};n&&$$9.extend(a,n);var r=a.dimensions,i=this,o=t.ownerDocument,s=o.importNode(text2xml('<svg id="svgroot" xmlns="'+NS.SVG+'" xlinkns="'+NS.XLINK+'" width="'+r[0]+'" height="'+r[1]+'" x="'+r[0]+'" y="'+r[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);t.append(s);var l=o.createElementNS(NS.SVG,"svg");(i.clearSvgContentElement=function(){$$9(l).empty(),$$9(l).attr({id:"svgcontent",width:r[0],height:r[1],x:r[0],y:r[1],overflow:a.show_outside_canvas?"visible":"hidden",xmlns:NS.SVG,"xmlns:se":NS.SE,"xmlns:xlink":NS.XLINK}).appendTo(s);var e=o.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");l.append(e)})();var c="svg_";i.setIdPrefix=function(e){c=e},i.current_drawing_=new Drawing(l,c);var u=i.getCurrentDrawing=function(){return i.current_drawing_},d=1,h=null,g={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}};g.text=$$9.extend(!0,{},g.shape),$$9.extend(g.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 p=g.shape,f=[],v=this.getJsonFromSvgElement=function(e){if(3===e.nodeType)return e.nodeValue;for(var t,n={element:e.tagName,attr:{},children:[]},a=0;t=e.attributes[a];a++)n.attr[t.name]=t.value;for(var r,i=0;r=e.childNodes[i];i++)n.children[i]=v(r);return n},m=this.addSVGElementFromJson=function(e){if("string"==typeof e)return o.createTextNode(e);var t=getElem(e.attr.id),n=u().getCurrentLayer();if(t&&e.element!==t.tagName&&(t.remove(),t=null),!t){var a=e.namespace||NS.SVG;t=o.createElementNS(a,e.element),n&&(h||n).append(t)}return e.curStyles&&assignAttributes(t,{fill:p.fill,stroke:p.stroke,"stroke-width":p.stroke_width,"stroke-dasharray":p.stroke_dasharray,"stroke-linejoin":p.stroke_linejoin,"stroke-linecap":p.stroke_linecap,"stroke-opacity":p.stroke_opacity,"fill-opacity":p.fill_opacity,opacity:p.opacity/2,style:"pointer-events:inherit"},100),assignAttributes(t,e.attr,100),cleanupElement(t),e.children&&e.children.forEach(function(e){t.append(m(e))}),t};i.getTransformList=getTransformList,i.matrixMultiply=matrixMultiply,i.hasMatrixTransform=hasMatrixTransform,i.transformListToTransform=transformListToTransform;var _=function(){return a.baseUnit};init({getBaseUnit:_,getElement:getElem,getHeight:function(){return l.getAttribute("height")/d},getWidth:function(){return l.getAttribute("width")/d},getRoundDigits:function(){return z.round_digits}}),i.convertToNum=convertToNum;var b=function(){return l},y=this.getSelectedElems=function(){return f},x=pathActions,C=function(){return s};init$2({pathActions:x,getSVGContent:b,addSVGElementFromJson:m,getSelectedElements:y,getDOMDocument:function(){return o},getDOMContainer:function(){return t},getSVGRoot:C,getBaseUnit:_,getSnappingStep:function(){return a.snappingStep}}),i.findDefs=findDefs,i.getUrlFromAttr=getUrlFromAttr,i.getHref=getHref,i.setHref=setHref,i.getBBox=getBBox,i.getRotationAngle=getRotationAngle,i.getElem=getElem,i.getRefElem=getRefElem,i.assignAttributes=assignAttributes,this.cleanupElement=cleanupElement;var S=function(){return a.gridSnapping};init$4({getDrawing:function(){return u()},getSVGRoot:C,getGridSnapping:S}),this.remapElement=remapElement,init$5({getSVGRoot:C,getStartTransform:function(){return Z},setStartTransform:function(e){Z=e}}),this.recalculateDimensions=recalculateDimensions;var w=getReverseNS();i.sanitizeSvg=sanitizeSvg;var $=i.undoMgr=new UndoManager$1({handleHistoryEvent:function(e,t){var n=HistoryEventTypes$1;if(e===n.BEFORE_UNAPPLY||e===n.BEFORE_APPLY)i.clearSelection();else if(e===n.AFTER_APPLY||e===n.AFTER_UNAPPLY){var a=t.elements();i.pathActions.clear(),N("changed",a);var r=t.type(),o=e===n.AFTER_APPLY;if(r===MoveElementCommand$1.type())(o?t.newParent:t.oldParent)===l&&identifyLayers();else if(r===InsertElementCommand$1.type()||r===RemoveElementCommand$1.type())t.parent===l&&identifyLayers(),r===InsertElementCommand$1.type()?o&&U(t.elem):o||U(t.elem),"use"===t.elem.tagName&&Ve(t.elem);else if(r===ChangeElementCommand$1.type()){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===l&&identifyLayers();var s=o?t.newValues:t.oldValues;s.stdDeviation&&i.setBlurOffsets(t.elem.parentNode,s.stdDeviation)}}}}),k=function(e){i.undoMgr.addCommandToHistory(e)},A=this.getZoom=function(){return d},E=this.round=function(e){return parseInt(e*d,10)/d};init$6(a,{createSVGElement:function(e){return i.addSVGElementFromJson(e)},svgRoot:function(){return s},svgContent:function(){return l},getCurrentZoom:A});var P=this.selectorManager=getSelectorManager(),T=i.getNextId=function(){return u().getNextId()},G=i.getId=function(){return u().getId()},N=function(e,t){if(ue[e])return ue[e](window,t)},L=this.clearSelection=function(e){f.forEach(function(e){null!=e&&P.releaseSelector(e)}),f=[],e||N("selected",f)},I=this.addToSelection=function(e,t){if(e.length){for(var n=0;n<f.length&&null!=f[n];)++n;for(var a=e.length;a--;){var r=e[a];if(r){var i=getBBox(r);if(i&&("a"===r.tagName&&1===r.childNodes.length&&(r=r.firstChild),!f.includes(r))){f[n]=r,n++;var o=P.requestSelector(r,i);f.length>1&&o.showGrips(!1)}}}for(N("selected",f),t||1===f.length?P.requestSelector(f[0]).showGrips(!0):P.requestSelector(f[0]).showGrips(!1),f.sort(function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):null==e?1:void 0});null==f[0];)f.shift(0)}},M=function(){return p.opacity},R=this.getMouseTarget=function(e){if(null==e)return null;var n=e.target;if(n.correspondingUseElement&&(n=n.correspondingUseElement),[NS.MATH,NS.HTML].includes(n.namespaceURI)&&"svgcanvas"!==n.id)for(;"foreignObject"!==n.nodeName;)if(!(n=n.parentNode))return s;var a=u().getCurrentLayer();if([s,t,l,a].includes(n))return s;if($$9(n).closest("#selectorParentGroup").length)return P.selectorParentGroup;for(;n.parentNode!==(h||a);)n=n.parentNode;return n};i.pathActions=x,init$1({selectorManager:P,canvas:i,call:N,resetD:function(e){e.setAttribute("d",x.convertPath(e))},round:E,clearSelection:L,addToSelection:I,addCommandToHistory:k,remapElement:remapElement,addSVGElementFromJson:m,getGridSnapping:S,getOpacity:M,getSelectedElements:y,getContainer:function(){return t},setStarted:function(e){Q=e},getRubberBox:function(){return ae},setRubberBox:function(e){return ae=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;x.canDeleteNodes=!0,x.closed_subpath=t,N("pointsAdded",{closedSubpath:t,grips:n}),N("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;k(t),N("changed",[n])},getCurrentZoom:A,getId:G,getNextId:T,getMouseTarget:R,getCurrentMode:function(){return J},setCurrentMode:function(e){return J=e},getDrawnPath:function(){return Ne},setDrawnPath:function(e){return Ne=e},getSVGRoot:C});var O={},V="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",B=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],j=$$9.data,D=document.createElementNS(NS.SVG,"animate");$$9(D).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(s);var F,U=function e(t){var n=$$9(t).attr(B);for(var a in n){var r=n[a];if(r&&r.startsWith("url(")){var i=getUrlFromAttr(r).substr(1);getElem(i)||(findDefs().append(X[i]),delete X[i])}}var o=t.getElementsByTagName("*");if(o.length)for(var s=0,l=o.length;s<l;s++)e(o[s])},H={},z={round_digits:5},q={},W=g.text,Y={},X={},K=a.imgPath+"logo.png",Q=!1,Z=null,J="select",ee="none",te=p,ne=null,ae=null,re=[],ie=null,oe=this.runExtensions=function(e,t,n){var a=!!n&&[];return $$9.each(Y,function(r,i){i&&e in i&&("function"==typeof t&&(t=t(r)),n?a.push(i[e](t)):a=i[e](t))}),a};this.addExtension=(F=asyncToGenerator(regeneratorRuntime.mark(function e(t,n,a){var r,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("function"==typeof n){e.next=2;break}throw new TypeError("Function argument expected for `svgcanvas.addExtension`");case 2:if(r={},t in Y){e.next=14;break}if(o=$$9.extend(i.getPrivateMethods(),{importLocale:a,svgroot:s,svgcontent:l,nonce:u().getNonce(),selectorManager:P}),!n){e.next=9;break}return e.next=8,n(o);case 8:r=e.sent;case 9:r&&(r.name=t),Y[t]=r,N("extension_added",r),e.next=15;break;case 14:console.log('Cannot add extension "'+t+'", an extension by that name already exists.');case 15:case"end":return e.stop()}},e,this)})),function(e,t,n){return F.apply(this,arguments)});var se=this.getIntersectionList=function(e){if(null==ae)return null;var t=h||u().getCurrentLayer(),n=void 0;if(e)(n=l.createSVGRect()).x=e.x,n.y=e.y,n.width=e.width,n.height=e.height;else{n=ae.getBBox();var a=l.createSVGRect();for(var r in n)a[r]=n[r]/d;n=a}var i=null;if(isIE||"function"==typeof s.getIntersectionList&&(n.x+=parseInt(l.getAttribute("x"),10),n.y+=parseInt(l.getAttribute("y"),10),i=s.getIntersectionList(n,t)),null==i||"function"!=typeof i.item){i=[],re.length||(re=le(t));for(var o=re.length;o--;)n.width&&rectsIntersect(n,re[o].bbox)&&i.push(re[o].elem)}return i};this.getStrokedBBox=getStrokedBBoxDefaultVisible,this.getVisibleElements=getVisibleElements;var le=this.getVisibleElementsAndBBoxes=function(e){e||(e=$$9(l).children());var t=[];return $$9(e).children().each(function(e,n){n.getBBox&&t.push({elem:n,bbox:getStrokedBBoxDefaultVisible([n])})}),t.reverse()},ce=this.groupSvgElem=function(e){var t=document.createElementNS(NS.SVG,"g");e.replaceWith(t),$$9(t).append(e).data("gsvg",e)[0].id=T()},ue={};i.call=N,i.bind=function(e,t){var n=ue[e];return ue[e]=t,n},this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement),[].concat(toConsumableArray(e.getElementsByTagNameNS(NS.SVG,"path"))).forEach(function(e){e.setAttribute("d",x.convertPath(e)),x.fixEnd(e)})};var de=function(e){if(!isGecko())return e;var t=e.cloneNode(!0);return e.before(t),e.remove(),P.releaseSelector(e),f[0]=t,P.requestSelector(t).showGrips(!0),t};this.setRotationAngle=function(e,t){e=parseFloat(e);var n=f[0],a=n.getAttribute("transform"),r=getBBox(n),i=r.x+r.width/2,o=r.y+r.height/2,l=getTransformList(n);l.numberOfItems>0&&(4===l.getItem(0).type&&l.removeItem(0));if(0!==e){var c=transformPoint(i,o,transformListToTransform(l).matrix),u=s.createSVGTransform();u.setRotate(e,c.x,c.y),l.numberOfItems?l.insertItemBefore(u,0):l.appendItem(u)}else 0===l.numberOfItems&&n.removeAttribute("transform");if(!t){var d=n.getAttribute("transform");n.setAttribute("transform",a),qe("transform",d,f),N("changed",f)}var h=P.requestSelector(f[0]);h.resize(),h.updateGripCursors(e)};var he=this.recalculateAllSelectedDimensions=function(){for(var e=new BatchCommand$1("none"===ee?"position":"size"),t=f.length;t--;){var n=f[t],a=recalculateDimensions(n);a&&e.addSubCommand(a)}e.isEmpty()||(k(e),N("changed",f))},ge=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},pe=null,fe=this.selectOnly=function(e,t){L(!0),I(e,t)};this.removeFromSelection=function(e){if(null!=f[0]&&e.length){for(var t=[],n=f.length,a=0;a<n;++a){var r=f[a];r&&(e.includes(r)?P.releaseSelector(r):t.push(r))}f=t}},this.selectAllInCurrentLayer=function(){var e=u().getCurrentLayer();e&&(J="select",fe($$9(h||e).children()))};var ve,me,_e,be,ye,xe,Ce,Se,we,$e,ke,Ae,Ee,Pe,Te,Ge,Ne=null;ve={minx:null,miny:null,maxx:null,maxy:null},me=null,_e=null,be=null,ye=null,xe=null,Ce={},Se=0,we={x:0,y:0},$e={x:0,y:0},ke={x:0,y:0},Ae={x:0,y:0},Ee={x:0,y:0},Pe={x:0,y:0},Te=void 0,Ge=function(e){var t={x:0,y:0},n=we,a=$e,r=ke,i=Ae,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]+a.x*l[0][1]+r.x*l[0][2]+i.x*l[0][3])*s+(n.x*l[1][0]+a.x*l[1][1]+r.x*l[1][2]+i.x*l[1][3])*o+(n.x*l[2][0]+a.x*l[2][1]+r.x*l[2][2]+i.x*l[2][3])*e+(n.x*l[3][0]+a.x*l[3][1]+r.x*l[3][2]+i.x*l[3][3])),t.y=1/6*((n.y*l[0][0]+a.y*l[0][1]+r.y*l[0][2]+i.y*l[0][3])*s+(n.y*l[1][0]+a.y*l[1][1]+r.y*l[1][2]+i.y*l[1][3])*o+(n.y*l[2][0]+a.y*l[2][1]+r.y*l[2][2]+i.y*l[2][3])*e+(n.y*l[3][0]+a.y*l[3][1]+r.y*l[3][2]+i.y*l[3][3])),{x:t.x,y:t.y}},$$9(t).mousedown(function(e){if(!i.spaceKey&&1!==e.button){var t=2===e.button;e.altKey&&i.cloneSelectedElements(0,0),pe=$$9("#svgcontent g")[0].getScreenCTM().inverse();var n=transformPoint(e.pageX,e.pageY,pe),r=n.x*d,o=n.y*d;e.preventDefault(),t&&(J="select",ie=n);var l=r/d,c=o/d,u=R(e);"a"===u.tagName&&1===u.childNodes.length&&(u=u.firstChild);var h=l;ye=_e=l;var g=c;if(xe=be=c,a.gridSnapping&&(l=snapToGrid(l),c=snapToGrid(c),_e=snapToGrid(_e),be=snapToGrid(be)),u===P.selectorParentGroup&&null!=f[0]){var v=e.target,_=j(v,"type");"rotate"===_?J="rotate":"resize"===_&&(J="resize",ee=j(v,"dir")),u=f[0]}Z=u.getAttribute("transform");var b=void 0,y=void 0,C=getTransformList(u);switch(J){case"select":if(Q=!0,ee="none",t&&(Q=!1),u!==s){if(f.includes(u)||(e.shiftKey||L(!0),I([u]),ne=u,x.clear()),!t)for(b=0;b<f.length;++b)if(null!=f[b]){var S=getTransformList(f[b]);S.numberOfItems?S.insertItemBefore(s.createSVGTransform(),0):S.appendItem(s.createSVGTransform())}}else t||(L(),J="multiselect",null==ae&&(ae=P.getRubberBandBox()),assignAttributes(ae,{x:ye*=d,y:xe*=d,width:0,height:0,display:"inline"},100));break;case"zoom":Q=!0,null==ae&&(ae=P.getRubberBandBox()),assignAttributes(ae,{x:h*d,y:h*d,width:0,height:0,display:"inline"},100);break;case"resize":Q=!0,_e=l,be=c,Ce=getBBox($$9("#selectedBox0")[0]);var w={};$$9.each(Ce,function(e,t){w[e]=t/d}),Ce=w;var $=getRotationAngle(u)?1:0;if(hasMatrixTransform(C))C.insertItemBefore(s.createSVGTransform(),$),C.insertItemBefore(s.createSVGTransform(),$),C.insertItemBefore(s.createSVGTransform(),$);else if(C.appendItem(s.createSVGTransform()),C.appendItem(s.createSVGTransform()),C.appendItem(s.createSVGTransform()),supportsNonScalingStroke()){var k=isWebkit(),A=void 0;k&&(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",k&&A(u);var E=u.getElementsByTagName("*"),G=E.length;for(b=0;b<G;b++)E[b].style&&(E[b].style.vectorEffect="non-scaling-stroke",k&&A(E[b]))}break;case"fhellipse":case"fhrect":case"fhpath":ke.x=h,ke.y=g,Q=!0,me=h+","+g+" ",y=0===parseFloat(p.stroke_width)?1:p.stroke_width,m({element:"polyline",curStyles:!0,attr:{points:me,id:T(),fill:"none",opacity:p.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}}),ve.minx=h,ve.maxx=h,ve.miny=g,ve.maxy=g;break;case"image":Q=!0;var N=m({element:"image",attr:{x:l,y:c,width:0,height:0,id:T(),opacity:p.opacity/2,style:"pointer-events:inherit"}});setHref(N,K),preventClickDefault(N);break;case"square":case"rect":Q=!0,_e=l,be=c,m({element:"rect",curStyles:!0,attr:{x:l,y:c,width:0,height:0,id:T(),opacity:p.opacity/2}});break;case"line":Q=!0,y=0===Number(p.stroke_width)?1:p.stroke_width,m({element:"line",curStyles:!0,attr:{x1:l,y1:c,x2:l,y2:c,id:T(),stroke:p.stroke,"stroke-width":y,"stroke-dasharray":p.stroke_dasharray,"stroke-linejoin":p.stroke_linejoin,"stroke-linecap":p.stroke_linecap,"stroke-opacity":p.stroke_opacity,fill:"none",opacity:p.opacity/2,style:"pointer-events:none"}});break;case"circle":Q=!0,m({element:"circle",curStyles:!0,attr:{cx:l,cy:c,r:0,id:T(),opacity:p.opacity/2}});break;case"ellipse":Q=!0,m({element:"ellipse",curStyles:!0,attr:{cx:l,cy:c,rx:0,ry:0,id:T(),opacity:p.opacity/2}});break;case"text":Q=!0,m({element:"text",curStyles:!0,attr:{x:l,y:c,id:T(),fill:W.fill,"stroke-width":W.stroke_width,"font-size":W.font_size,"font-family":W.font_family,"text-anchor":"middle","xml:space":"preserve",opacity:p.opacity}});break;case"path":case"pathedit":_e*=d,be*=d,x.mouseDown(e,u,_e,be),Q=!0;break;case"textedit":_e*=d,be*=d,Le.mouseDown(e,u,_e,be),Q=!0;break;case"rotate":Q=!0,i.undoMgr.beginUndoableChange("transform",f)}var M=oe("mouseDown",{event:e,start_x:_e,start_y:be,selectedElements:f},!0);$$9.each(M,function(e,t){t&&t.started&&(Q=!0)})}}).mousemove(function(e){if(Q&&1!==e.button&&!i.spaceKey){var t=void 0,n=void 0,r=void 0,o=void 0,l=void 0,c=void 0,u=void 0,h=void 0,g=void 0,p=f[0],v=transformPoint(e.pageX,e.pageY,pe),m=v.x*d,_=v.y*d,b=getElem(G()),y=m/d,C=y,S=_/d,w=S;a.gridSnapping&&(C=snapToGrid(C),w=snapToGrid(w)),e.preventDefault();var $=void 0;switch(J){case"select":if(null!==f[0]){if(l=C-_e,c=w-be,a.gridSnapping&&(l=snapToGrid(l),c=snapToGrid(c)),e.shiftKey){var k=n=snapToAngle(_e,be,C,w);C=k.x,w=k.y}if(0!==l||0!==c){for(u=f.length,t=0;t<u&&null!=(p=f[t]);++t){var A=s.createSVGTransform();$=getTransformList(p),A.setTranslate(l,c),$.numberOfItems?$.replaceItem(A,0):$.appendItem(A),P.requestSelector(p).resize()}N("transition",f)}}break;case"multiselect":y*=d,S*=d,assignAttributes(ae,{x:Math.min(ye,y),y:Math.min(xe,S),width:Math.abs(y-ye),height:Math.abs(S-xe)},100);var E=f.slice(),T=[],L=se();for(u=L.length,t=0;t<u;++t){var I=L[t];f.includes(I)||T.push(I);var M=E.indexOf(I);-1!==M&&E.splice(M,1)}E.length>0&&i.removeFromSelection(E),T.length>0&&i.addToSelection(T);break;case"resize":$=getTransformList(p);var R=hasMatrixTransform($),O=(g=R?Ce:getBBox(p)).x,V=g.y,B=g,j=B.width,D=B.height;if(l=C-_e,c=w-be,a.gridSnapping&&(l=snapToGrid(l),c=snapToGrid(c),D=snapToGrid(D),j=snapToGrid(j)),h=getRotationAngle(p)){var F=Math.sqrt(l*l+c*c),U=Math.atan2(c,l)-h*Math.PI/180;l=F*Math.cos(U),c=F*Math.sin(U)}ee.includes("n")||ee.includes("s")||(c=0),ee.includes("e")||ee.includes("w")||(l=0);var H=0,z=0,q=D?(D+c)/D:1,W=j?(j+l)/j:1;ee.includes("n")&&(q=D?(D-c)/D:1,z=D),ee.includes("w")&&(W=j?(j-l)/j:1,H=j);var Y=s.createSVGTransform(),X=s.createSVGTransform(),K=s.createSVGTransform();if(a.gridSnapping&&(O=snapToGrid(O),H=snapToGrid(H),V=snapToGrid(V),z=snapToGrid(z)),Y.setTranslate(-(O+H),-(V+z)),e.shiftKey&&(1===W?W=q:q=W),X.setScale(W,q),K.setTranslate(O+H,V+z),R){var Z=h?1:0;$.replaceItem(Y,2+Z),$.replaceItem(X,1+Z),$.replaceItem(K,Number(Z))}else{var te=$.numberOfItems;$.replaceItem(K,te-3),$.replaceItem(X,te-2),$.replaceItem(Y,te-1)}P.requestSelector(p).resize(),N("transition",f);break;case"zoom":y*=d,S*=d,assignAttributes(ae,{x:Math.min(ye*d,y),y:Math.min(xe*d,S),width:Math.abs(y-ye*d),height:Math.abs(S-xe*d)},100);break;case"text":assignAttributes(b,{x:C,y:w},1e3);break;case"line":a.gridSnapping&&(C=snapToGrid(C),w=snapToGrid(w));var ne=C,re=w;e.shiftKey&&(ne=(n=snapToAngle(_e,be,ne,re)).x,re=n.y),b.setAttributeNS(null,"x2",ne),b.setAttributeNS(null,"y2",re);break;case"foreignObject":case"square":case"rect":case"image":var ie="square"===J||e.shiftKey,le=Math.abs(C-_e),ce=Math.abs(w-be),ue=void 0,de=void 0;ie?(le=ce=Math.max(le,ce),ue=_e<C?_e:_e-le,de=be<w?be:be-ce):(ue=Math.min(_e,C),de=Math.min(be,w)),a.gridSnapping&&(le=snapToGrid(le),ce=snapToGrid(ce),ue=snapToGrid(ue),de=snapToGrid(de)),assignAttributes(b,{width:le,height:ce,x:ue,y:de},1e3);break;case"circle":var he=$$9(b).attr(["cx","cy"]);r=he.cx,o=he.cy;var ge=Math.sqrt((C-r)*(C-r)+(w-o)*(w-o));a.gridSnapping&&(ge=snapToGrid(ge)),b.setAttributeNS(null,"r",ge);break;case"ellipse":var fe=$$9(b).attr(["cx","cy"]);r=fe.cx,o=fe.cy,a.gridSnapping&&(C=snapToGrid(C),r=snapToGrid(r),w=snapToGrid(w),o=snapToGrid(o)),b.setAttributeNS(null,"rx",Math.abs(C-r));var Ne=Math.abs(e.shiftKey?C-r:w-o);b.setAttributeNS(null,"ry",Ne);break;case"fhellipse":case"fhrect":ve.minx=Math.min(y,ve.minx),ve.maxx=Math.max(y,ve.maxx),ve.miny=Math.min(S,ve.miny),ve.maxy=Math.max(S,ve.maxy);case"fhpath":if(Ae.x=y,Ae.y=S,we.x&&we.y)for(t=0;t<9;t++)Te=t/10,Ee=Ge((t+1)/10),Pe=Ee,Ee=Ge(Te),(Se+=Math.sqrt((Pe.x-Ee.x)*(Pe.x-Ee.x)+(Pe.y-Ee.y)*(Pe.y-Ee.y)))>.8&&(me+=+Ee.x+","+Ee.y+" ",b.setAttributeNS(null,"points",me),Se-=.8);we={x:$e.x,y:$e.y},$e={x:ke.x,y:ke.y},ke={x:Ae.x,y:Ae.y};break;case"path":case"pathedit":if(C*=d,w*=d,a.gridSnapping&&(C=snapToGrid(C),w=snapToGrid(w),_e=snapToGrid(_e),be=snapToGrid(be)),e.shiftKey){var Ie=path,Me=void 0,Re=void 0;Ie?(Me=Ie.dragging?Ie.dragging[0]:_e,Re=Ie.dragging?Ie.dragging[1]:be):(Me=_e,Re=be);var Oe=n=snapToAngle(Me,Re,C,w);C=Oe.x,w=Oe.y}ae&&"none"!==ae.getAttribute("display")&&(y*=d,S*=d,assignAttributes(ae,{x:Math.min(ye*d,y),y:Math.min(xe*d,S),width:Math.abs(y-ye*d),height:Math.abs(S-xe*d)},100)),x.mouseMove(C,w);break;case"textedit":C*=d,w*=d,Le.mouseMove(m,_);break;case"rotate":r=(g=getBBox(p)).x+g.width/2,o=g.y+g.height/2;var Ve=getMatrix(p),Be=transformPoint(r,o,Ve);r=Be.x,o=Be.y,h=(Math.atan2(o-w,r-C)*(180/Math.PI)-90)%360,a.gridSnapping&&(h=snapToGrid(h)),e.shiftKey&&(h=45*Math.round(h/45)),i.setRotationAngle(h<-180?360+h:h,!0),N("transition",f)}oe("mouseMove",{event:e,mouse_x:m,mouse_y:_,selected:p})}}).click(function(e){return e.preventDefault(),!1}).dblclick(function(e){var t=e.target.parentNode;if(t!==h){var n=R(e),a=n.tagName;if("text"===a&&"textedit"!==J){var r=transformPoint(e.pageX,e.pageY,pe);Le.select(n,r.x,r.y)}"g"!==a&&"a"!==a||!getRotationAngle(n)||(We(n),n=f[0],L(!0)),h&&leaveContext(),"g"!==t.tagName&&"a"!==t.tagName||t===u().getCurrentLayer()||n===P.selectorParentGroup||setContext(n)}}).mouseup(function(e){if(2!==e.button){var t=ne;if(ne=null,Q){var n=transformPoint(e.pageX,e.pageY,pe),r=n.x*d,o=n.y*d,s=r/d,l=o/d,c=getElem(G()),h=!1,g=s,v=l;Q=!1;var _=void 0,b=void 0;switch(J){case"resize":case"multiselect":null!=ae&&(ae.setAttribute("display","none"),re=[]),J="select";case"select":if(null!=f[0]){if(null==f[1]){var y=f[0];switch(y.tagName){case"g":case"use":case"image":case"foreignObject":break;default:te.fill=y.getAttribute("fill"),te.fill_opacity=y.getAttribute("fill-opacity"),te.stroke=y.getAttribute("stroke"),te.stroke_opacity=y.getAttribute("stroke-opacity"),te.stroke_width=y.getAttribute("stroke-width"),te.stroke_dasharray=y.getAttribute("stroke-dasharray"),te.stroke_linejoin=y.getAttribute("stroke-linejoin"),te.stroke_linecap=y.getAttribute("stroke-linecap")}"text"===y.tagName&&(W.font_size=y.getAttribute("font-size"),W.font_family=y.getAttribute("font-family")),P.requestSelector(y).showGrips(!0)}if(he(),g!==ye||v!==xe)for(var C=f.length,S=0;S<C&&null!=f[S];++S)f[S].firstChild||P.requestSelector(f[S]).resize();else b=e.target,"path"===f[0].nodeName&&null==f[1]?x.select(f[0]):e.shiftKey&&t!==b&&i.removeFromSelection([b]);if(supportsNonScalingStroke()){var w=f[0];w&&(w.removeAttribute("style"),walkTree(w,function(e){e.removeAttribute("style")}))}}return;case"zoom":null!=ae&&ae.setAttribute("display","none");var $=e.shiftKey?.5:2;return void N("zoomed",{x:Math.min(ye,g),y:Math.min(xe,v),width:Math.abs(g-ye),height:Math.abs(v-xe),factor:$});case"fhpath":Se=0,we={x:0,y:0},$e={x:0,y:0},ke={x:0,y:0},Ae={x:0,y:0};var A=c.getAttribute("points"),E=A.indexOf(",");(h=E>=0?A.indexOf(",",E+1)>=0:A.indexOf(" ",A.indexOf(" ")+1)>=0)&&(c=x.smoothPolylineIntoPath(c));break;case"line":_=$$9(c).attr(["x1","x2","y1","y2"]),h=_.x1!==_.x2||_.y1!==_.y2;break;case"foreignObject":case"square":case"rect":case"image":_=$$9(c).attr(["width","height"]),h=_.width||_.height||"image"===J;break;case"circle":h="0"!==c.getAttribute("r");break;case"ellipse":_=$$9(c).attr(["rx","ry"]),h=_.rx||_.ry;break;case"fhellipse":ve.maxx-ve.minx>0&&ve.maxy-ve.miny>0&&(c=m({element:"ellipse",curStyles:!0,attr:{cx:(ve.minx+ve.maxx)/2,cy:(ve.miny+ve.maxy)/2,rx:(ve.maxx-ve.minx)/2,ry:(ve.maxy-ve.miny)/2,id:G()}}),N("changed",[c]),h=!0);break;case"fhrect":ve.maxx-ve.minx>0&&ve.maxy-ve.miny>0&&(c=m({element:"rect",curStyles:!0,attr:{x:ve.minx,y:ve.miny,width:ve.maxx-ve.minx,height:ve.maxy-ve.miny,id:G()}}),N("changed",[c]),h=!0);break;case"text":h=!0,fe([c]),Le.start(c);break;case"path":c=null,Q=!0;var T=x.mouseUp(e,c,r,o);c=T.element,h=T.keep;break;case"pathedit":h=!0,c=null,x.mouseUp(e);break;case"textedit":h=!1,c=null,Le.mouseUp(e,r,o);break;case"rotate":h=!0,c=null,J="select";var L=i.undoMgr.finishUndoableChange();L.isEmpty()||k(L),he(),N("changed",f)}var I=oe("mouseUp",{event:e,mouse_x:r,mouse_y:o},!0);if($$9.each(I,function(e,t){t&&(h=t.keep||h,c=t.element,Q=t.started||Q)}),h||null==c){if(null!=c){i.addedNew=!0;var M=.2,R=void 0;if(D.beginElement&&parseFloat(c.getAttribute("opacity"))!==p.opacity){R=$$9(D).clone().attr({to:p.opacity,dur:M}).appendTo(c);try{R[0].beginElement()}catch(e){}}else M=0;setTimeout(function(){R&&R.remove(),c.setAttribute("opacity",p.opacity),c.setAttribute("style","pointer-events:inherit"),cleanupElement(c),"path"===J?x.toEditMode(c):a.selectNew&&fe([c],!0),k(new InsertElementCommand$1(c)),N("changed",[c])},1e3*M)}}else{for(u().releaseId(G()),c.remove(),c=null,b=e.target;b&&b.parentNode&&b.parentNode.parentNode&&"g"===b.parentNode.parentNode.tagName;)b=b.parentNode;"path"===J&&Ne||!b||!b.parentNode||"selectorParentGroup"===b.parentNode.id||"svgcanvas"===b.id||"svgroot"===b.id||(i.setMode("select"),fe([b],!0))}Z=null}}}),$$9(t).bind("mousewheel DOMMouseScroll",function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;pe=$$9("#svgcontent g")[0].getScreenCTM().inverse();var n=$$9("#workarea"),r=a.showRulers?16:0,o=transformPoint(t.pageX,t.pageY,pe),s=n.width(),l=n.height(),c=s-15-r,u=l-15-r,h=c*pe.a,g=u*pe.d,p=n.offset(),f=p.left+r,v=p.top+r,m=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(m){var _=Math.max(.75,Math.min(4/3,m)),b=void 0,y=void 0;_>1?(b=Math.ceil(c/h*_*100)/100,y=Math.ceil(u/g*_*100)/100):(b=Math.floor(c/h*_*100)/100,y=Math.floor(u/g*_*100)/100);var x=Math.min(b,y);if((x=Math.min(10,Math.max(.01,x)))!==d){_=x/d;var C=transformPoint(f,v,pe),S={x:(o.x-(o.x-C.x)/_)*x-r+s/2,y:(o.y-(o.y-C.y)/_)*x-r+l/2};i.setZoom(x),$$9("#zoom").val((100*x).toFixed(1)),N("updateCanvas",{center:!1,newCtr:S}),N("zoomDone")}}}});var Le=i.textActions=function(){var e=void 0,t=void 0,n=void 0,a=void 0,r=void 0,o=[],l=void 0,c=void 0,u=void 0,h=void 0,g=void 0;function p(e){var i=""===t.value;if($$9(t).focus(),!arguments.length)if(i)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var s=o[e];i||t.setSelectionRange(e,e),(n=getElem("text_cursor"))||(n=document.createElementNS(NS.SVG,"line"),assignAttributes(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=getElem("selectorParentGroup").appendChild(n)),r||(r=setInterval(function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")},600));var c=x(s.x,l.y),u=x(s.x,l.y+l.height);assignAttributes(n,{x1:c.x,y1:c.y,x2:u.x,y2:u.y,visibility:"visible",display:"inline"}),a&&a.setAttribute("d","")}function v(e,r,i){if(e!==r){i||t.setSelectionRange(e,r),(a=getElem("text_selectblock"))||(a=document.createElementNS(NS.SVG,"path"),assignAttributes(a,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),getElem("selectorParentGroup").append(a));var s=o[e],c=o[r];n.setAttribute("visibility","hidden");var u=x(s.x,l.y),d=x(s.x+(c.x-s.x),l.y),h=x(s.x,l.y+l.height),g=x(s.x+(c.x-s.x),l.y+l.height),f="M"+u.x+","+u.y+" L"+d.x+","+d.y+" "+g.x+","+g.y+" "+h.x+","+h.y+"z";assignAttributes(a,{d:f,display:"inline"})}else p(r)}function m(t,n){var a=s.createSVGPoint();if(a.x=t,a.y=n,1===o.length)return 0;var r=e.getCharNumAtPosition(a);r<0?(r=o.length-2,t<=o[0].x&&(r=0)):r>=o.length-2&&(r=o.length-2);var i=o[r];return t>i.x+i.width/2&&r++,r}function _(e,t){p(m(e,t))}function b(e,n,a){var r=t.selectionStart,i=m(e,n);v(Math.min(r,i),Math.max(r,i),!a)}function y(e,t){var n={x:e,y:t};if(n.x/=d,n.y/=d,c){var a=transformPoint(n.x,n.y,c.inverse());n.x=a.x,n.y=a.y}return n}function x(e,t){var n={x:e,y:t};if(c){var a=transformPoint(n.x,n.y,c);n.x=a.x,n.y=a.y}return n.x*=d,n.y*=d,n}function C(t){v(0,e.textContent.length),$$9(this).unbind(t)}function S(t){if(g&&e){var n=transformPoint(t.pageX,t.pageY,pe),a=y(n.x*d,n.y*d),r=m(a.x,a.y),i=e.textContent,o=i.substr(0,r).replace(/[a-z0-9]+$/i,"").length,s=i.substr(r).match(/^[a-z0-9]+/i);v(o,(s?s[0].length:0)+r),$$9(t.target).click(C),setTimeout(function(){$$9(t.target).unbind("click",C)},300)}}return{select:function(t,n,a){e=t,Le.toEditMode(n,a)},start:function(t){e=t,Le.toEditMode()},mouseDown:function(e,n,a,r){var i=y(a,r);t.focus(),_(i.x,i.y),u=a,h=r},mouseMove:function(e,t){var n=y(e,t);b(n.x,n.y)},mouseUp:function(t,n,a){var r=y(n,a);b(r.x,r.y,!0),t.target!==e&&n<u+2&&n>u-2&&a<h+2&&a>h-2&&Le.toSelectMode(!0)},setCursor:p,toEditMode:function(t,n){if(g=!1,J="textedit",P.requestSelector(e).showGrips(!1),P.requestSelector(e),Le.init(),$$9(e).css("cursor","text"),arguments.length){var a=y(t,n);_(a.x,a.y)}else p();setTimeout(function(){g=!0},300)},toSelectMode:function(o){J="select",clearInterval(r),r=null,a&&$$9(a).attr("display","none"),n&&$$9(n).attr("visibility","hidden"),$$9(e).css("cursor","move"),o&&(L(),$$9(e).css("cursor","move"),N("selected",[e]),I([e],!0)),e&&!e.textContent.length&&i.deleteSelectedElements(),$$9(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===J&&Le.toSelectMode()},init:function(n){if(e){var a=void 0,r=void 0;e.parentNode||(e=f[0],P.requestSelector(e).showGrips(!1));var s=e.textContent.length,u=e.getAttribute("transform");for(l=getBBox(e),c=u?getMatrix(e):null,(o=[]).length=s,t.focus(),$$9(e).unbind("dblclick",S).dblclick(S),s||(r={x:l.x+l.width/2,width:0}),a=0;a<s;a++){var h=e.getStartPositionOfChar(a);if(r=e.getEndPositionOfChar(a),!supportsGoodTextCharPos()){var g=i.contentW*d;h.x-=g,r.x-=g,h.x/=d,r.x/=d}o[a]={x:h.x,y:l.y,width:r.x-h.x,height:l.height}}o.push({x:r.x,width:0}),v(t.selectionStart,t.selectionEnd,!0)}}}}(),Ie=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(NS.SVG,"defs");if(!e||!e.length)return 0;var t=[],n=0,a=["fill","stroke","filter","marker-start","marker-mid","marker-end"],r=a.length,i=l.getElementsByTagNameNS(NS.SVG,"*"),o=i.length,s=void 0,c=void 0;for(s=0;s<o;s++){var u=i[s];for(c=0;c<r;c++){var d=getUrlFromAttr(u.getAttribute(a[c]));d&&t.push(d.substr(1))}var h=getHref(u);h&&h.startsWith("#")&&t.push(h.substr(1))}var g=$$9(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");for(s=g.length;s--;){var p=g[s],f=p.id;t.includes(f)||(X[f]=p,p.remove(),n++)}return n};function Me(){L();var e=[],t=[],n={feGaussianBlur:O.exportNoBlur,foreignObject:O.exportNoforeignObject,"[stroke-dasharray]":O.exportNoDashArray},a=$$9(l);return"font"in $$9("<canvas>")[0].getContext("2d")||(n.text=O.exportNoText),$$9.each(n,function(n,r){a.find(n).length&&(t.push(n),e.push(r))}),{issues:e,issueCodes:t}}this.svgCanvasToString=function(){for(;Ie()>0;);x.clear(!0),$$9.each(l.childNodes,function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&l.firstChild.before(t)}),h&&(leaveContext(),fe([h]));var e=[];$$9(l).find("g:data(gsvg)").each(function(){for(var t=this.attributes,n=t.length,a=0;a<n;a++)"id"!==t[a].nodeName&&"style"!==t[a].nodeName||n--;if(n<=0){var r=this.firstChild;e.push(r),$$9(this).replaceWith(r)}});var t=this.svgToString(l,0);return e.length&&$$9(e).each(function(){ce(this)}),t},this.svgToString=function(e,t){var n=[],r=a.baseUnit,i=new RegExp("^-?[\\d\\.]+"+r+"$");if(e){cleanupElement(e);var o=Array.from(e.attributes),s=void 0,l=e.childNodes;for(o.sort(function(e,t){return e.name>t.name?-1:1}),s=0;s<t;s++)n.push(" ");if(n.push("<"),n.push(e.nodeName),"svgcontent"===e.id){var c=De();"px"!==r&&(c.w=convertUnit(c.w,r)+r,c.h=convertUnit(c.h,r)+r),n.push(' width="'+c.w+'" height="'+c.h+'" xmlns="'+NS.SVG+'"');var u={};$$9(e).find("*").andSelf().each(function(){var e=this.namespaceURI;e&&!u[e]&&w[e]&&"xmlns"!==w[e]&&"xml"!==w[e]&&(u[e]=!0,n.push(" xmlns:"+w[e]+'="'+e+'"')),$$9.each(this.attributes,function(e,t){var a=t.namespaceURI;a&&!u[a]&&"xmlns"!==w[a]&&"xml"!==w[a]&&(u[a]=!0,n.push(" xmlns:"+w[a]+'="'+a+'"'))})}),s=o.length;for(var d=["width","height","xmlns","x","y","viewBox","id","overflow"];s--;){var h=o[s],g=toXml(h.value);h.nodeName.startsWith("xmlns:")||(""===g||d.includes(h.localName)||h.namespaceURI&&!w[h.namespaceURI]||(n.push(" "),n.push(h.nodeName),n.push('="'),n.push(g),n.push('"')))}}else{if("defs"===e.nodeName&&!e.firstChild)return;var p=["-moz-math-font-style","_moz-math-font-style"];for(s=o.length-1;s>=0;s--){var f=o[s],v=toXml(f.value);if(!p.includes(f.localName)&&""!==v){if(v.startsWith("pointer-events"))continue;if("class"===f.localName&&v.startsWith("se_"))continue;if(n.push(" "),"d"===f.localName&&(v=x.convertPath(e,!0)),isNaN(v)?i.test(v)&&(v=shortFloat(v)+r):v=shortFloat(v),z.apply&&"image"===e.nodeName&&"href"===f.localName&&z.images&&"embed"===z.images){var m=H[v];m&&(v=m)}f.namespaceURI&&f.namespaceURI!==NS.SVG&&!w[f.namespaceURI]||(n.push(f.nodeName),n.push('="'),n.push(v),n.push('"'))}}}if(e.hasChildNodes()){n.push(">"),t++;var _=!1;for(s=0;s<l.length;s++){var b=l.item(s);switch(b.nodeType){case 1:n.push("\n"),n.push(this.svgToString(l.item(s),t));break;case 3:var y=b.nodeValue.replace(/^\s+|\s+$/g,"");""!==y&&(_=!0,n.push(String(toXml(y))));break;case 4:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("<![CDATA["),n.push(b.nodeValue),n.push("]]>");break;case 8:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("\x3c!--"),n.push(b.data),n.push("--\x3e")}}if(t--,!_)for(n.push("\n"),s=0;s<t;s++)n.push(" ");n.push("</"),n.push(e.nodeName),n.push(">")}else n.push("/>")}return n.join("")},this.embedImage=function(e,t){return new Promise(function(n,a){$$9(new Image).load(function(r,i,o){if("error"!==i){var s=document.createElement("canvas");s.width=this.width,s.height=this.height,s.getContext("2d").drawImage(this,0,0);try{var l=";svgedit_url="+encodeURIComponent(e);l=s.toDataURL().replace(";base64",l+";base64"),H[e]=l}catch(t){H[e]=!1}K=e,t&&t(H[e]),n(H[e])}else a(new Error("Error loading image: "+o.status+" "+o.statusText))}).attr("src",e)})},this.setGoodImage=function(e){K=e},this.open=function(){},this.save=function(e){L(),e&&$$9.extend(z,e),z.apply=!0;var t=this.svgCanvasToString();N("saved",t)};var Re=void 0;this.rasterExport=function(e,t,n,r){var o,s=this,l="ICO"===e?"BMP":e||"PNG",c="image/"+l.toLowerCase(),u=Me(),d=u.issues,h=u.issueCodes,g=this.svgCanvasToString();return new Promise((o=asyncToGenerator(regeneratorRuntime.mark(function o(u,p){var f,v,m,_,b,y;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(y=function(){var a={datauri:_,bloburl:b,svg:g,issues:d,issueCodes:h,type:e,mimeType:c,quality:t,exportWindowName:n};N("exported",a),r&&r(a),u(a)},Re){o.next=6;break}return o.next=4,importSetGlobal(a.canvgPath+"canvg.js",{global:"canvg"});case 4:f=o.sent,Re=f.canvg;case 6:return $$9("#export_canvas").length||$$9("<canvas>",{id:"export_canvas"}).hide().appendTo("body"),(v=$$9("#export_canvas")[0]).width=i.contentW,v.height=i.contentH,o.next=12,Re(v,g);case 12:if(m=l.toLowerCase(),_=t?v.toDataURL("image/"+m,t):v.toDataURL("image/"+m),b=void 0,!v.toBlob){o.next=18;break}return v.toBlob(function(e){b=createObjectURL(e),y()},c,t),o.abrupt("return");case 18:b=dataURLToObjectURL(_),y();case 20:case"end":return o.stop()}},o,s)})),function(e,t){return o.apply(this,arguments)}))},this.exportPDF=function(e,t,n){var r,i=this,o=this;return new Promise((r=asyncToGenerator(regeneratorRuntime.mark(function r(s,l){var c,u,d,h,g,p,f,v,m,_;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(window.jsPDF){r.next=6;break}return r.next=3,importScript(["jspdf/underscore-min.js","jspdf/jspdf.min.js"]);case 3:return c=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules),r.next=6,importScript(a.jspdfPath+"jspdf.plugin.svgToPdf.js",{type:c?"module":"text/javascript"});case 6:u=De(),d=u.w>u.h?"landscape":"portrait",h=jsPDF({orientation:d,unit:"pt",format:[u.w,u.h]}),g=Fe(),h.setProperties({title:g}),p=Me(),f=p.issues,v=p.issueCodes,m=o.svgCanvasToString(),h.addSVG(m,0,0),(_={svg:m,issues:f,issueCodes:v,exportWindowName:e,outputType:t=t||"dataurlstring"}).output=h.output(t),n&&n(_),s(_),N("exportedPDF",_);case 21:case"end":return r.stop()}},r,i)})),function(e,t){return r.apply(this,arguments)}))},this.getSvgString=function(){return z.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?randomizeIds(!1,u()):randomizeIds(!0,u())};var Oe=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var a in walkTree(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),$$9.each(B,function(n,a){var r=e.getAttributeNode(a);if(r){var i=getUrlFromAttr(r.value),o=i?i.substr(1):null;o&&(o in t||(t[o]={elem:null,attrs:[],hrefs:[]}),t[o].attrs.push(r))}});var a=getHref(e);if(a&&n.includes(e.nodeName)){var r=a.substr(1);r&&(r in t||(t[r]={elem:null,attrs:[],hrefs:[]}),t[r].hrefs.push(e))}}}),t)if(a){var r=t[a].elem;if(r){var i=T();r.id=i;for(var o=t[a].attrs,s=o.length;s--;){var l=o[s];l.ownerElement.setAttribute(l.name,"url(#"+i+")")}for(var c=t[a].hrefs,u=c.length;u--;){var d=c[u];setHref(d,"#"+i)}}}},Ve=this.setUseData=function(e){var t=$$9(e);"use"!==e.tagName&&(t=t.find("use")),t.each(function(){var e=getHref(this).substr(1),t=getElem(e);t&&($$9(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||$$9(this).data("symbol",t).data("ref",t))})},Be=this.convertGradients=function(e){var t=$$9(e).find("linearGradient, radialGradient");!t.length&&isWebkit()&&(t=$$9(e).find("*").filter(function(){return this.tagName.includes("Gradient")})),t.each(function(){if("userSpaceOnUse"===$$9(this).attr("gradientUnits")){var e=$$9(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=getBBox(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=$$9(this).attr(["x1","y1","x2","y2"]),a=this.gradientTransform.baseVal;if(a&&a.numberOfItems>0){var r=transformListToTransform(a).matrix,i=transformPoint(n.x1,n.y1,r),o=transformPoint(n.x2,n.y2,r);n.x1=i.x,n.y1=i.y,n.x2=o.x,n.y2=o.y,this.removeAttribute("gradientTransform")}$$9(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")}}})},je=this.convertToGroup=function(e){e||(e=f[0]);var t=$$9(e),n=new BatchCommand$1,a=void 0;if(t.data("gsvg")){var r=e.firstChild,i=$$9(r).attr(["x","y"]);$$9(e.firstChild.firstChild).unwrap(),$$9(e).removeData("gsvg");var c=getTransformList(e),u=s.createSVGTransform();u.setTranslate(i.x,i.y),c.appendItem(u),recalculateDimensions(e),N("selected",[e])}else if(t.data("symbol")){e=t.data("symbol"),a=t.attr("transform");var d=t.attr(["x","y"]),h=e.getAttribute("viewBox");if(h){var g=h.split(" ");d.x-=+g[0],d.y-=+g[1]}a+=" translate("+(d.x||0)+","+(d.y||0)+")";var p=t.prev();n.addSubCommand(new RemoveElementCommand$1(t[0],t[0].nextSibling,t[0].parentNode)),t.remove();var v=$$9(l).find("use:data(symbol)").length,m=o.createElementNS(NS.SVG,"g"),_=e.childNodes,b=void 0;for(b=0;b<_.length;b++)m.append(_[b].cloneNode(!0));if(isGecko()){var y=$$9(findDefs()).children("linearGradient,radialGradient,pattern").clone();$$9(m).append(y)}a&&m.setAttribute("transform",a);var x=e.parentNode;if(Oe(m),isGecko()&&$$9(findDefs()).append($$9(m).find("linearGradient,radialGradient,pattern")),m.id=T(),p.after(m),x){if(!v){var C=e.nextSibling;e.remove(),n.addSubCommand(new RemoveElementCommand$1(e,C,x))}n.addSubCommand(new InsertElementCommand$1(m))}Ve(m),isGecko()?Be(findDefs()):Be(m),walkTreePost(m,function(e){try{recalculateDimensions(e)}catch(e){console.log(e)}}),$$9(m).find(V).each(function(){this.id||(this.id=T())}),fe([m]);var S=We(m,!0);S&&n.addSubCommand(S),k(n)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e,t){try{var n=text2xml(e);if(n.firstElementChild&&n.firstElementChild.namespaceURI!==NS.SVG)return!1;this.prepareSvg(n);var r=new BatchCommand$1("Change Source"),h=l.nextSibling,g=s.removeChild(l);r.addSubCommand(new RemoveElementCommand$1(g,h,s)),l=o.adoptNode?o.adoptNode(n.documentElement):o.importNode(n.documentElement,!0),s.append(l);var p=$$9(l);i.current_drawing_=new Drawing(l,c);var f=u().getNonce();f?N("setnonce",f):N("unsetnonce"),p.find("image").each(function(){var e=this;preventClickDefault(e);var t=getHref(this);if(t){if(t.startsWith("data:")){var n=t.match(/svgedit_url=(.*?);/);if(n){var a=decodeURIComponent(n[1]);$$9(new Image).load(function(){e.setAttributeNS(NS.XLINK,"xlink:href",a)}).attr("src",a)}}i.embedImage(t)}}),p.find("svg").each(function(){if(!$$9(this).closest("defs").length){Oe(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?($$9(e).data("gsvg",this),e.id=e.id||T()):ce(this)}}),isGecko()&&p.find("linearGradient, radialGradient, pattern").appendTo(findDefs()),Ve(p),Be(p[0]);var v={id:"svgcontent",overflow:a.show_outside_canvas?"visible":"hidden"},m=!1;if(p.attr("viewBox")){var _=p.attr("viewBox").split(" ");v.width=_[2],v.height=_[3]}else $$9.each(["width","height"],function(e,t){var n=p.attr(t)||"100%";"%"===String(n).substr(-1)?m=!0:v[t]=convertToNum(t,n)});if(identifyLayers(),p.children().find(V).each(function(){this.id||(this.id=T())}),m){var b=getStrokedBBoxDefaultVisible();v.width=b.width+b.x,v.height=b.height+b.y}v.width<=0&&(v.width=100),v.height<=0&&(v.height=100),p.attr(v),this.contentW=v.width,this.contentH=v.height,r.addSubCommand(new InsertElementCommand$1(l));var y=p.attr(["width","height"]);r.addSubCommand(new ChangeElementCommand$1(s,y)),d=1,resetListMap(),L(),clearData(),s.append(P.selectorParentGroup),t||k(r),N("changed",[l])}catch(e){return console.log(e),!1}return!0},this.importSvgString=function(e){var t=void 0,n=void 0,a=void 0;try{var r=encode64(e.length+e).substr(0,32),i=!1;q[r]&&$$9(q[r].symbol).parents("#svgroot").length&&(i=!0);var s=new BatchCommand$1("Import Image"),c=void 0;if(i)c=q[r].symbol,n=q[r].xform;else{var d=text2xml(e);this.prepareSvg(d);var g=void 0;g=o.adoptNode?o.adoptNode(d.documentElement):o.importNode(d.documentElement,!0),Oe(g);var p=convertToNum("width",g.getAttribute("width")),f=convertToNum("height",g.getAttribute("height")),v=g.getAttribute("viewBox"),m=v?v.split(" "):[0,0,p,f];for(t=0;t<4;++t)m[t]=+m[t];var _=+l.getAttribute("height");n="translate(0) "+(n=f>p?"scale("+_/3/m[3]+")":"scale("+_/3/m[2]+")")+" translate(0)",c=o.createElementNS(NS.SVG,"symbol");var b=findDefs();for(isGecko()&&$$9(g).find("linearGradient, radialGradient, pattern").appendTo(b);g.firstChild;){var y=g.firstChild;c.append(y)}for(var x=g.attributes,C=0;C<x.length;C++){var S=x[C];c.setAttribute(S.nodeName,S.value)}c.id=T(),q[r]={symbol:c,xform:n},findDefs().append(c),s.addSubCommand(new InsertElementCommand$1(c))}(a=o.createElementNS(NS.SVG,"use")).id=T(),setHref(a,"#"+c.id),(h||u().getCurrentLayer()).append(a),s.addSubCommand(new InsertElementCommand$1(a)),L(),a.setAttribute("transform",n),recalculateDimensions(a),$$9(a).data("symbol",c).data("ref",c),I([a]),k(s),N("changed",[l])}catch(e){return console.log(e),null}return a},["identifyLayers","createLayer","cloneLayer","deleteCurrentLayer","setCurrentLayer","renameCurrentLayer","setCurrentLayerPosition","setLayerVisibility","moveSelectedToLayer","mergeLayer","mergeAllLayers","leaveContext","setContext"].forEach(function(e){i[e]=draw[e]}),init$3({pathActions:x,getCurrentGroup:function(){return h},setCurrentGroup:function(e){h=e},getSelectedElements:y,getSVGContent:b,undoMgr:$,elData:j,getCurrentDrawing:u,clearSelection:L,call:N,addCommandToHistory:k,changeSVGContent:function(){N("changed",[l])}}),this.clear=function(){x.clear(),L(),i.clearSvgContentElement(),i.current_drawing_=new Drawing(l),i.createLayer("Layer 1"),i.undoMgr.resetUndoStack(),P.initGroup(),ae=P.getRubberBandBox(),N("cleared")},this.linkControlPoints=x.linkControlPoints,this.getContentElem=function(){return l},this.getRootElem=function(){return s};var De=this.getResolution=function(){return{w:l.getAttribute("width")/d,h:l.getAttribute("height")/d,zoom:d}};this.getSnapToGrid=function(){return a.gridSnapping},this.getVersion=function(){return"svgcanvas.js ($Rev$)"},this.setUiStrings=function(e){Object.assign(O,e.notification),setUiStrings(e)},this.setConfig=function(e){Object.assign(a,e)},this.getTitle=function(e){if(e=e||f[0]){for(var t=(e=$$9(e).data("gsvg")||$$9(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=f[0];t=$$9(t).data("gsvg")||t;var n=$$9(t).children("title"),a=new BatchCommand$1("Set Label"),r=void 0;if(e.length)n.length?(r=n[0],a.addSubCommand(new ChangeElementCommand$1(r,{"#text":r.textContent})),r.textContent=e):((r=o.createElementNS(NS.SVG,"title")).textContent=e,$$9(t).prepend(r),a.addSubCommand(new InsertElementCommand$1(r)));else{var i=n.nextSibling;a.addSubCommand(new RemoveElementCommand$1(n[0],i,t)),n.remove()}k(a)};var Fe=this.getDocumentTitle=function(){return i.getTitle(l)};this.setDocumentTitle=function(e){for(var t=l.childNodes,n=!1,a="",r=new BatchCommand$1("Change Image Title"),i=0;i<t.length;i++)if("title"===t[i].nodeName){a=(n=t[i]).textContent;break}n||(n=o.createElementNS(NS.SVG,"title"),l.insertBefore(n,l.firstChild)),e.length?n.textContent=e:n.remove(),r.addSubCommand(new ChangeElementCommand$1(n,{"#text":a})),k(r)},this.getEditorNS=function(e){return e&&l.setAttribute("xmlns:se",NS.SE),NS.SE},this.setResolution=function(e,t){var n=De(),a=n.w,r=n.h,o=void 0;if("fit"===e){var s=getStrokedBBoxDefaultVisible();if(!s)return!1;o=new BatchCommand$1("Fit Canvas to Content");var c=getVisibleElements();I(c);var u=[],h=[];$$9.each(c,function(e,t){u.push(-1*s.x),h.push(-1*s.y)});var g=i.moveSelectedElements(u,h,!0);o.addSubCommand(g),L(),e=Math.round(s.width),t=Math.round(s.height)}return e===a&&t===r||(o||(o=new BatchCommand$1("Change Image Dimensions")),e=convertToNum("width",e),t=convertToNum("height",t),l.setAttribute("width",e),l.setAttribute("height",t),this.contentW=e,this.contentH=t,o.addSubCommand(new ChangeElementCommand$1(l,{width:a,height:r})),l.setAttribute("viewBox",[0,0,e/d,t/d].join(" ")),o.addSubCommand(new ChangeElementCommand$1(l,{viewBox:["0 0",a,r].join(" ")})),k(o),N("changed",[l])),!0},this.getOffset=function(){return $$9(l).attr(["x","y"])},this.setBBoxZoom=function(e,t,n){var a=.85,r=void 0,o=function(e){if(!e)return!1;var r=Math.round(t/e.width*100*a)/100,o=Math.round(n/e.height*100*a)/100,s=Math.min(r,o);return i.setZoom(s),{zoom:s,bbox:e}};if("object"===(void 0===e?"undefined":_typeof(e))){if(0===(r=e).width||0===r.height){var s=r.zoom?r.zoom:d*r.factor;return i.setZoom(s),{zoom:d,bbox:r}}return o(r)}switch(e){case"selection":if(!f[0])return;var l=$$9.map(f,function(e){if(e)return e});r=getStrokedBBoxDefaultVisible(l);break;case"canvas":var c=De();a=.95,r={width:c.w,height:c.h,x:0,y:0};break;case"content":r=getStrokedBBoxDefaultVisible();break;case"layer":r=getStrokedBBoxDefaultVisible(getVisibleElements(u().getCurrentLayer()));break;default:return}return o(r)},this.setZoom=function(e){var t=De();l.setAttribute("viewBox","0 0 "+t.w/e+" "+t.h/e),d=e,$$9.each(f,function(e,t){t&&P.requestSelector(t).resize()}),x.zoomChange(),oe("zoomChanged",e)},this.getMode=function(){return J},this.setMode=function(e){x.clear(!0),Le.clear(),te=f[0]&&"text"===f[0].nodeName?W:p,J=e},this.getColor=function(e){return te[e]},this.setColor=function(e,t,n){p[e]=t,te[e+"_paint"]={type:"solidColor"};var a=[];function r(e){"g"!==e.nodeName&&a.push(e)}for(var i=f.length;i--;){var o=f[i];o&&("g"===o.tagName?walkTree(o,r):"fill"===e?"polyline"!==o.tagName&&"line"!==o.tagName&&a.push(o):a.push(o))}a.length>0&&(n?ze(e,t,a):(qe(e,t,a),N("changed",a)))};var Ue=this.setGradient=function(e){if(te[e+"_paint"]&&"solidColor"!==te[e+"_paint"].type){var t=i[e+"Grad"],n=He(t),a=findDefs();n?t=n:(t=a.appendChild(o.importNode(t,!0))).id=T(),i.setColor(e,"url(#"+t.id+")")}},He=function(e){for(var t=findDefs(),n=$$9(t).find("linearGradient, radialGradient"),a=n.length,r=["r","cx","cy","fx","fy"];a--;){var i=n[a];if("linearGradient"===e.tagName){if(e.getAttribute("x1")!==i.getAttribute("x1")||e.getAttribute("y1")!==i.getAttribute("y1")||e.getAttribute("x2")!==i.getAttribute("x2")||e.getAttribute("y2")!==i.getAttribute("y2"))continue}else if("continue"===function(){var t=$$9(e).attr(r),n=$$9(i).attr(r),a=!1;if($$9.each(r,function(e,r){t[r]!==n[r]&&(a=!0)}),a)return"continue"}())continue;var o=e.getElementsByTagNameNS(NS.SVG,"stop"),s=i.getElementsByTagNameNS(NS.SVG,"stop");if(o.length===s.length){for(var l=o.length;l--;){var c=o[l],u=s[l];if(c.getAttribute("offset")!==u.getAttribute("offset")||c.getAttribute("stop-opacity")!==u.getAttribute("stop-opacity")||c.getAttribute("stop-color")!==u.getAttribute("stop-color"))break}if(-1===l)return i}}return null};this.setPaint=function(e,t){var n=new $$9.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),te[e+"_paint"]=n,n.type){case"solidColor":this.setColor(e,"none"!==n.solidColor?"#"+n.solidColor:"none");break;case"linearGradient":case"radialGradient":i[e+"Grad"]=n[n.type],Ue(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return te.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(J))i.setStrokeWidth(1);else{te.stroke_width=e;for(var t=[],n=f.length;n--;){var a=f[n];a&&("g"===a.tagName?walkTree(a,r):t.push(a))}t.length>0&&(qe("stroke-width",e,t),N("changed",f))}function r(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){p[e.replace("-","_")]=t;for(var n=[],a=f.length;a--;){var r=f[a];r&&("g"===r.tagName?walkTree(r,function(e){"g"!==e.nodeName&&n.push(e)}):n.push(r))}n.length>0&&(qe(e,t,n),N("changed",f))},this.getStyle=function(){return p},this.getOpacity=M,this.setOpacity=function(e){p.opacity=e,qe("opacity",e)},this.getFillOpacity=function(){return p.fill_opacity},this.getStrokeOpacity=function(){return p.stroke_opacity},this.setPaintOpacity=function(e,t,n){p[e+"_opacity"]=t,n?ze(e+"-opacity",t):qe(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=getElem(e.id+"_blur");n&&(t=n.firstChild.getAttribute("stdDeviation"))}return t},function(){var e=null,t=null,n=!1;function a(){var n=i.undoMgr.finishUndoableChange();e.addSubCommand(n),k(e),e=null,t=null}i.setBlurNoUndo=function(e){if(t)if(0===e)ze("filter",""),n=!0;else{var a=f[0];n&&ze("filter","url(#"+a.id+"_blur)"),isWebkit()&&(console.log("e",a),a.removeAttribute("filter"),a.setAttribute("filter","url(#"+a.id+"_blur)")),ze("stdDeviation",e,[t.firstChild]),i.setBlurOffsets(t,e)}else i.setBlur(e)},i.setBlurOffsets=function(e,t){t>3?assignAttributes(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100):isWebkit()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},i.setBlur=function(n,r){if(e)a();else{var o=f[0],s=o.id;t=getElem(s+"_blur"),n-=0;var l=new BatchCommand$1;if(t)0===n&&(t=null);else{var c=m({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=m({element:"filter",attr:{id:s+"_blur"}})).append(c),findDefs().append(t),l.addSubCommand(new InsertElementCommand$1(t))}var u={filter:o.getAttribute("filter")};if(0===n)return o.removeAttribute("filter"),void l.addSubCommand(new ChangeElementCommand$1(o,u));qe("filter","url(#"+s+"_blur)"),l.addSubCommand(new ChangeElementCommand$1(o,u)),i.setBlurOffsets(t,n),e=l,i.undoMgr.beginUndoableChange("stdDeviation",[t?t.firstChild:null]),r&&(i.setBlurNoUndo(n),a())}}}(),this.getBold=function(){var e=f[0];return null!=e&&"text"===e.tagName&&null==f[1]&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=f[0];null!=t&&"text"===t.tagName&&null==f[1]&&qe("font-weight",e?"bold":"normal"),f[0].textContent||Le.setCursor()},this.getItalic=function(){var e=f[0];return null!=e&&"text"===e.tagName&&null==f[1]&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=f[0];null!=t&&"text"===t.tagName&&null==f[1]&&qe("font-style",e?"italic":"normal"),f[0].textContent||Le.setCursor()},this.getFontFamily=function(){return W.font_family},this.setFontFamily=function(e){W.font_family=e,qe("font-family",e),f[0]&&!f[0].textContent&&Le.setCursor()},this.setFontColor=function(e){W.fill=e,qe("fill",e)},this.getFontColor=function(){return W.fill},this.getFontSize=function(){return W.font_size},this.setFontSize=function(e){W.font_size=e,qe("font-size",e),f[0].textContent||Le.setCursor()},this.getText=function(){var e=f[0];return null==e?"":e.textContent},this.setTextContent=function(e){qe("#text",e),Le.init(e),Le.setCursor()},this.setImageURL=function(e){var t=f[0];if(t){var n=$$9(t).attr(["width","height"]),a=!n.width||!n.height,r=getHref(t);if(r!==e)a=!0;else if(!a)return;var i=new BatchCommand$1("Change Image URL");setHref(t,e),i.addSubCommand(new ChangeElementCommand$1(t,{"#href":r})),a?$$9(new Image).load(function(){var e=$$9(t).attr(["width","height"]);$$9(t).attr({width:this.width,height:this.height}),P.requestSelector(t).resize(),i.addSubCommand(new ChangeElementCommand$1(t,e)),k(i),N("changed",[t])}).attr("src",e):k(i)}},this.setLinkURL=function(e){var t=f[0];if(t){if("a"!==t.tagName){var n=$$9(t).parents("a");if(!n.length)return;t=n[0]}var a=getHref(t);if(a!==e){var r=new BatchCommand$1("Change Link URL");setHref(t,e),r.addSubCommand(new ChangeElementCommand$1(t,{"#href":a})),k(r)}}},this.setRectRadius=function(e){var t=f[0];if(null!=t&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),k(new ChangeElementCommand$1(t,{rx:n,ry:n},"Radius")),N("changed",[t]))}},this.makeHyperlink=function(e){i.groupSelectedElements("a",e)},this.removeHyperlink=function(){i.ungroupSelectedElement()},this.setSegType=function(e){x.setSegType(e)},this.convertToPath=function(e,t){if(null!=e){if(t)return getBBoxOfElementAsPath(e,m,x);var n={fill:p.fill,"fill-opacity":p.fill_opacity,stroke:p.stroke,"stroke-width":p.stroke_width,"stroke-dasharray":p.stroke_dasharray,"stroke-linejoin":p.stroke_linejoin,"stroke-linecap":p.stroke_linecap,"stroke-opacity":p.stroke_opacity,opacity:p.opacity,visibility:"hidden"};return convertToPath(e,n,m,x,L,I,history,k)}var a=f;$$9.each(a,function(e,t){t&&i.convertToPath(t)})};var ze=function(e,t,n){"pathedit"===J&&x.moveNode(e,t);for(var a=(n=n||f).length,r=["g","polyline","path"],o=["transform","opacity","filter"],l=function(){var l=n[a];if(null==l)return"continue";if(("x"===e||"y"===e)&&r.includes(l.tagName)){var c=getStrokedBBoxDefaultVisible([l]),u="x"===e?t-c.x:0,h="y"===e?t-c.y:0;return i.moveSelectedElements(u*d,h*d,!0),"continue"}"g"===l.tagName&&o.includes(e);var g="#text"===e?l.textContent:l.getAttribute(e);if(null==g&&(g=""),g!==String(t)){"#text"===e?(l.textContent=t,/rotate/.test(l.getAttribute("transform"))&&(l=de(l))):"#href"===e?setHref(l,t):l.setAttribute(e,t),"textedit"===J&&"#text"!==e&&l.textContent.length&&Le.toSelectMode(l),isGecko()&&"text"===l.nodeName&&/rotate/.test(l.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&l.textContent)&&(l=de(l)),f.includes(l)&&setTimeout(function(){l.parentNode&&P.requestSelector(l).resize()},0);var p=getRotationAngle(l);if(0!==p&&"transform"!==e)for(var v=getTransformList(l),m=v.numberOfItems;m--;){if(4===v.getItem(m).type){v.removeItem(m);var _=getBBox(l),b=transformPoint(_.x+_.width/2,_.y+_.height/2,transformListToTransform(v).matrix),y=b.x,x=b.y,C=s.createSVGTransform();C.setRotate(p,y,x),v.insertItemBefore(C,m);break}}}};a--;)l()},qe=this.changeSelectedAttribute=function(e,t,n){n=n||f,i.undoMgr.beginUndoableChange(e,n),ze(e,t,n);var a=i.undoMgr.finishUndoableChange();a.isEmpty()||k(a)};this.deleteSelectedElements=function(){for(var e=new BatchCommand$1("Delete Elements"),t=f.length,n=[],a=0;a<t;++a){var r=f[a];if(null==r)break;var i=r.parentNode,o=r;P.releaseSelector(o),removePath_(o.id),"a"===i.tagName&&1===i.childNodes.length&&(o=i,i=i.parentNode);var s=o.nextSibling,l=i.removeChild(o);n.push(r),e.addSubCommand(new RemoveElementCommand$1(l,s,i))}f=[],e.isEmpty()||k(e),N("changed",n),L()},this.cutSelectedElements=function(){i.copySelectedElements(),i.deleteSelectedElements()},this.copySelectedElements=function(){localStorage.setItem("svgedit_clipboard",JSON.stringify(f.map(function(e){return v(e)}))),$$9("#cmenu_canvas").enableContextMenuItems("#paste,#paste_in_place")},this.pasteElements=function(e,t,n){var a=JSON.parse(localStorage.getItem("svgedit_clipboard")),r=a.length;if(r){var o=[],s=new BatchCommand$1("Paste elements"),l={};for(a.forEach(function e(t){t.attr&&t.attr.id&&(l[t.attr.id]=T(),t.attr.id=l[t.attr.id]),t.children&&t.children.forEach(e)}),oe("IDsUpdated",{elems:a,changes:l},!0).forEach(function(e){e&&"remove"in e&&e.remove.forEach(function(e){a=a.filter(function(t){return t.attr.id!==e})})});r--;){var c=a[r];if(c){var u=m(c);o.push(u),s.addSubCommand(new InsertElementCommand$1(u)),U(u)}}if(fe(o),"in_place"!==e){var d=void 0,h=void 0;e?"point"===e&&(d=t,h=n):(d=ie.x,h=ie.y);var g=getStrokedBBoxDefaultVisible(o),p=d-(g.x+g.width/2),f=h-(g.y+g.height/2),v=[],_=[];$$9.each(o,function(e,t){v.push(p),_.push(f)});var b=i.moveSelectedElements(v,_,!1);b&&s.addSubCommand(b)}k(s),N("changed",o)}},this.groupSelectedElements=function(e,t){e||(e="g");var n="",a=void 0;switch(e){case"a":n="Make hyperlink",a=t||"";break;default:e="g",n="Group Elements"}var r=new BatchCommand$1(n),i=m({element:e,attr:{id:T()}});"a"===e&&setHref(i,a),r.addSubCommand(new InsertElementCommand$1(i));for(var o=f.length;o--;){var s=f[o];if(null!=s){"a"===s.parentNode.tagName&&1===s.parentNode.childNodes.length&&(s=s.parentNode);var l=s.nextSibling,c=s.parentNode;i.append(s),r.addSubCommand(new MoveElementCommand$1(s,l,c))}}r.isEmpty()||k(r),fe([i],!0)};var We=this.pushGroupProperties=function(e,t){for(var n=e.childNodes,a=n.length,r=e.getAttribute("transform"),o=getTransformList(e),l=transformListToTransform(o).matrix,c=new BatchCommand$1("Push group properties"),d=getRotationAngle(e),h=$$9(e).attr(["filter","opacity"]),g=void 0,p=void 0,f=void 0,v=u(),m=0;m<a;m++){var _=n[m];if(1===_.nodeType){if(null!==h.opacity&&1!==h.opacity){var b=Math.round((_.getAttribute("opacity")||1)*h.opacity*100)/100;qe("opacity",b,[_])}if(h.filter){var y=this.getBlur(_),x=y;p||(p=this.getBlur(e)),y?y=Number(p)+Number(y):0===y&&(y=p),x?g=getRefElem(_.getAttribute("filter")):g?(g=v.copyElem(g),findDefs().append(g)):g=getRefElem(h.filter);var C="feGaussianBlur"===g.firstChild.tagName?"blur":"filter";g.id=_.id+"_"+C,qe("filter","url(#"+g.id+")",[_]),y&&(qe("stdDeviation",y,[g.firstChild]),i.setBlurOffsets(g,y))}var S=getTransformList(_);if(_.tagName.includes("Gradient")&&(S=null),S&&"defs"!==_.tagName&&o.numberOfItems){if(d&&1===o.numberOfItems){var w=o.getItem(0).matrix,$=s.createSVGMatrix(),k=getRotationAngle(_);k&&($=S.getItem(0).matrix);var A=getBBox(_),E=transformListToTransform(S).matrix,P=transformPoint(A.x+A.width/2,A.y+A.height/2,E),T=d+k,G=s.createSVGTransform();G.setRotate(T,P.x,P.y);var N=matrixMultiply(w,$,G.matrix.inverse());if(k&&S.removeItem(0),T&&(S.numberOfItems?S.insertItemBefore(G,0):S.appendItem(G)),N.e||N.f){var L=s.createSVGTransform();L.setTranslate(N.e,N.f),S.numberOfItems?S.insertItemBefore(L,0):S.appendItem(L)}}else{var I=_.getAttribute("transform");(f={}).transform=I||"";var M=s.createSVGTransform(),R=transformListToTransform(S).matrix,O=R.inverse(),V=matrixMultiply(O,l,R);M.setMatrix(V),S.appendItem(M)}var B=recalculateDimensions(_);B&&c.addSubCommand(B)}}}if(r&&((f={}).transform=r,e.setAttribute("transform",""),e.removeAttribute("transform"),c.addSubCommand(new ChangeElementCommand$1(e,f))),t&&!c.isEmpty())return c};this.ungroupSelectedElement=function(){var e=f[0];if(e)if($$9(e).data("gsvg")||$$9(e).data("symbol"))je(e);else{if("use"===e.tagName){var t=getElem(getHref(e).substr(1));return $$9(e).data("symbol",t).data("ref",t),void je(e)}var n=$$9(e).parents("a");if(n.length&&(e=n[0]),"g"===e.tagName||"a"===e.tagName){var a=new BatchCommand$1("Ungroup Elements"),r=We(e,!0);r&&a.addSubCommand(r);for(var i=e.parentNode,o=e.nextSibling,s=new Array(e.childNodes.length),l=0;e.firstChild;){var c=e.firstChild,u=c.nextSibling,d=c.parentNode;if("title"!==c.tagName)s[l++]=c=i.insertBefore(c,o),a.addSubCommand(new MoveElementCommand$1(c,u,d));else{var h=c.nextSibling;a.addSubCommand(new RemoveElementCommand$1(c,h,d)),c.remove()}}L();var g=e.nextSibling;e=i.removeChild(e),a.addSubCommand(new RemoveElementCommand$1(e,g,i)),a.isEmpty()||k(a),I(s)}}},this.moveToTopSelectedElement=function(){var e=slicedToArray(f,1)[0];if(null!=e){var t=e,n=t.parentNode,a=t.nextSibling;a!==(t=t.parentNode.appendChild(t)).nextSibling&&(k(new MoveElementCommand$1(t,a,n,"top")),N("changed",[t]))}},this.moveToBottomSelectedElement=function(){var e=slicedToArray(f,1)[0];if(null!=e){var t=e,n=t.parentNode,a=t.nextSibling,r=t.parentNode.firstChild;"title"===r.tagName&&(r=r.nextSibling),"defs"===r.tagName&&(r=r.nextSibling),a!==(t=t.parentNode.insertBefore(t,r)).nextSibling&&(k(new MoveElementCommand$1(t,a,n,"bottom")),N("changed",[t]))}},this.moveUpDownSelected=function(e){var t=f[0];if(t){re=[];var n=void 0,a=void 0,r=$$9(se(getStrokedBBoxDefaultVisible([t]))).toArray();if("Down"===e&&r.reverse(),$$9.each(r,function(){if(a)return n=this,!1;this===t&&(a=!0)}),n){var i=t,o=i.parentNode,s=i.nextSibling;$$9(n)["Down"===e?"before":"after"](i),s!==i.nextSibling&&(k(new MoveElementCommand$1(i,s,o,"Move "+e)),N("changed",[i]))}}},this.moveSelectedElements=function(e,t,n){e.constructor!==Array&&(e/=d,t/=d),n=n||!0;for(var a=new BatchCommand$1("position"),r=f.length;r--;){var i=f[r];if(null!=i){var o=s.createSVGTransform(),l=getTransformList(i);e.constructor===Array?o.setTranslate(e[r],t[r]):o.setTranslate(e,t),l.numberOfItems?l.insertItemBefore(o,0):l.appendItem(o);var c=recalculateDimensions(i);c&&a.addSubCommand(c),P.requestSelector(i).resize()}}if(!a.isEmpty())return n&&k(a),N("changed",f),a},this.cloneSelectedElements=function(e,t){var n=void 0,a=void 0,r=new BatchCommand$1("Clone Elements"),i=f.length;for(f.sort(function(e,t){return $$9(t).index()-$$9(e).index()}),n=0;n<i&&null!=(a=f[n]);++n);var o=f.slice(0,n);this.clearSelection(!0);var s=u();for(n=o.length;n--;)a=o[n]=s.copyElem(o[n]),(h||s.getCurrentLayer()).append(a),r.addSubCommand(new InsertElementCommand$1(a));r.isEmpty()||(I(o.reverse()),this.moveSelectedElements(e,t,!1),k(r))},this.alignSelectedElements=function(e,t){var n=[],a=f.length;if(a){for(var r=Number.MAX_VALUE,o=Number.MIN_VALUE,s=Number.MAX_VALUE,l=Number.MIN_VALUE,c=Number.MIN_VALUE,u=Number.MIN_VALUE,d=0;d<a&&null!=f[d];++d){var h=f[d];switch(n[d]=getStrokedBBoxDefaultVisible([h]),t){case"smallest":(("l"===e||"c"===e||"r"===e)&&(c===Number.MIN_VALUE||c>n[d].width)||("t"===e||"m"===e||"b"===e)&&(u===Number.MIN_VALUE||u>n[d].height))&&(r=n[d].x,s=n[d].y,o=n[d].x+n[d].width,l=n[d].y+n[d].height,c=n[d].width,u=n[d].height);break;case"largest":(("l"===e||"c"===e||"r"===e)&&(c===Number.MIN_VALUE||c<n[d].width)||("t"===e||"m"===e||"b"===e)&&(u===Number.MIN_VALUE||u<n[d].height))&&(r=n[d].x,s=n[d].y,o=n[d].x+n[d].width,l=n[d].y+n[d].height,c=n[d].width,u=n[d].height);break;default:n[d].x<r&&(r=n[d].x),n[d].y<s&&(s=n[d].y),n[d].x+n[d].width>o&&(o=n[d].x+n[d].width),n[d].y+n[d].height>l&&(l=n[d].y+n[d].height)}}"page"===t&&(r=0,s=0,o=i.contentW,l=i.contentH);for(var g=new Array(a),p=new Array(a),v=0;v<a&&null!=f[v];++v){var m=n[v];switch(g[v]=0,p[v]=0,e){case"l":g[v]=r-m.x;break;case"c":g[v]=(r+o)/2-(m.x+m.width/2);break;case"r":g[v]=o-(m.x+m.width);break;case"t":p[v]=s-m.y;break;case"m":p[v]=(s+l)/2-(m.y+m.height/2);break;case"b":p[v]=l-(m.y+m.height)}}this.moveSelectedElements(g,p)}},this.contentW=De().w,this.contentH=De().h,this.updateCanvas=function(e,t){s.setAttribute("width",e),s.setAttribute("height",t);var n=$$9("#canvasBackground")[0],a=l.getAttribute("x"),r=l.getAttribute("y"),i=e/2-this.contentW*d/2,o=t/2-this.contentH*d/2;assignAttributes(l,{width:this.contentW*d,height:this.contentH*d,x:i,y:o,viewBox:"0 0 "+this.contentW+" "+this.contentH}),assignAttributes(n,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:i,y:o});var c=getElem("background_image");return c&&assignAttributes(c,{width:"100%",height:"100%"}),P.selectorParentGroup.setAttribute("transform","translate("+i+","+o+")"),oe("canvasUpdated",{new_x:i,new_y:o,old_x:a,old_y:r,d_x:i-a,d_y:o-r}),{x:i,y:o,old_x:a,old_y:r,d_x:i-a,d_y:o-r}},this.setBackground=function(e,t){var n=getElem("canvasBackground"),a=$$9(n).find("rect")[0],r=getElem("background_image");a.setAttribute("fill",e),t?(r||(r=o.createElementNS(NS.SVG,"image"),assignAttributes(r,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})),setHref(r,t),n.append(r)):r&&r.remove()},this.cycleElement=function(e){var t=void 0,n=f[0],a=!1,r=getVisibleElements(h||u().getCurrentLayer());if(r.length){if(null==n)a=r[t=e?r.length-1:0];else for(var i=r.length;i--;)if(r[i]===n){(t=e?i-1:i+1)>=r.length?t=0:t<0&&(t=r.length-1),a=r[t];break}fe([a],!0),N("selected",f)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:k,setGradient:Ue,addSVGElementFromJson:m,assignAttributes:assignAttributes,BatchCommand:BatchCommand$1,call:N,ChangeElementCommand:ChangeElementCommand$1,copyElem:function(e){return u().copyElem(e)},decode64:decode64,encode64:encode64,ffClone:de,findDefs:findDefs,findDuplicateGradient:He,getElem:getElem,getId:G,getIntersectionList:se,getMouseTarget:R,getNextId:T,getPathBBox:getPathBBox,getTypeMap:getTypeMap,getUrlFromAttr:getUrlFromAttr,hasMatrixTransform:hasMatrixTransform,identifyLayers:identifyLayers,InsertElementCommand:InsertElementCommand$1,isChrome:isChrome,isIdentity:isIdentity,isIE:isIE,logMatrix:ge,matrixMultiply:matrixMultiply,MoveElementCommand:MoveElementCommand$1,NS:NS,preventClickDefault:preventClickDefault,recalculateAllSelectedDimensions:he,recalculateDimensions:recalculateDimensions,remapElement:remapElement,RemoveElementCommand:RemoveElementCommand$1,removeUnusedDefElems:Ie,round:E,runExtensions:oe,sanitizeSvg:sanitizeSvg,SVGEditTransformList:SVGTransformList,text2xml:text2xml,toString:toString,transformBox:transformBox,transformListToTransform:transformListToTransform,transformPoint:transformPoint,walkTree:walkTree}}};function jqPluginJSHotkeys(e){function t(t){if("string"==typeof t.data){var n=t.handler,a=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],i=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+i]=!0,s[o+e.hotkeys.shiftNums[i]]=!0,"shift+"===o&&(s[e.hotkeys.shiftNums[i]]=!0));for(var l=0,c=a.length;l<c;l++)if(s[a[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 jqPluginBBQ(e){return function(e,t){var n,a,r,i,o,s,l,c,u=Array.prototype.slice,d=decodeURIComponent,h=e.param,g=e.bbq=e.bbq||{},p=e.event.special,f="hashchange",v="querystring",m="fragment",_="elemUrlAttr",b="location",y="href",x="src",C=/^.*\?|#.*$/g,S=/^.*\#/,w={};function $(e){return"string"==typeof e}function k(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}}function A(a,i,o,s,l){var u,g,p,f,_;return s!==n?(_=(p=o.match(a?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/))[3]||"",2===l&&$(s)?g=s.replace(a?S:C,""):(f=r(p[2]),s=$(s)?r[a?m:v](s):s,g=2===l?s:1===l?e.extend({},s,f):e.extend({},f,s),g=h(g),a&&(g=g.replace(c,d))),u=p[1]+(a?"#":g||!p[1]?"?":"")+g+_):u=i(o!==n?o:t[b][y]),u}function E(e,t,a){return t===n||"boolean"==typeof t?(a=t,t=h[e?m:v]()):t=$(t)?t.replace(e?S:C,""):t,r(t,a)}function P(t,a,r,i){return $(r)||"object"===(void 0===r?"undefined":_typeof(r))||(i=r,r=a,a=n),this.each(function(){var n=e(this),o=a||l()[(this.nodeName||"").toLowerCase()]||"",s=o&&n.attr(o)||"";n.attr(o,h[t](s,r,i))})}h[v]=k(A,0,function(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}),h[m]=a=k(A,1,function(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}),a.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);c=new RegExp(n.join("|"),"g")},a.noEscape(",/"),e.deparam=r=function(t,a){var r={},i={true:!0,false:!1,null:null};return e.each(t.replace(/\+/g," ").split("&"),function(t,o){var s,l=o.split("="),c=d(l[0]),u=r,h=0,g=c.split("]["),p=g.length-1;if(/\[/.test(g[0])&&/\]$/.test(g[p])?(g[p]=g[p].replace(/\]$/,""),p=(g=g.shift().split("[").concat(g)).length-1):p=0,2===l.length)if(s=d(l[1]),a&&(s=s&&!isNaN(s)?+s:"undefined"===s?n:i[s]!==n?i[s]:s),p)for(;h<=p;h++)u=u[c=""===g[h]?u.length:g[h]]=h<p?u[c]||(g[h+1]&&isNaN(g[h+1])?{}:[]):s;else e.isArray(r[c])?r[c].push(s):r[c]!==n?r[c]=[r[c],s]:r[c]=s;else c&&(r[c]=a?n:"")}),r},r[v]=k(E,0),r[m]=i=k(E,1),e[_]||(e[_]=function(t){return e.extend(w,t)})({a:y,base:y,iframe:x,img:x,input:x,form:"action",link:y,script:x}),l=e[_],e.fn[v]=k(P,v),e.fn[m]=k(P,m),g.pushState=o=function(e,r){$(e)&&/^#/.test(e)&&r===n&&(r=2);var i=e!==n,o=a(t[b][y],i?e:{},i?r:2);t[b][y]=o+(/#/.test(o)?"":"#")},g.getState=s=function(e,t){return e===n||"boolean"==typeof e?i(e):i(t)[e]},g.removeState=function(t){var a={};t!==n&&(a=s(),e.each(e.isArray(t)?t:arguments,function(e,t){delete a[t]})),o(a,2)},p[f]=e.extend(p[f],{add:function(t){var i;function o(e){var t=e[m]=a();e.getState=function(e,a){return e===n||"boolean"==typeof e?r(t,e):r(t,a)[e]},i.apply(this,arguments)}if(e.isFunction(t))return i=t,o;i=t.handler,t.handler=o}})}(e,window),function(e,t,n){var a,r=e.event.special,i="location",o="hashchange",s="href",l=e.browser,c=document.documentMode,u=l.msie&&(void 0===c||c<8),d="on"+o in t&&!u;function h(e){return(e=e||t[i][s]).replace(/^[^#]*#?(.*)$/,"$1")}e[o+"Delay"]=100,r[o]=e.extend(r[o],{setup:function(){if(d)return!1;e(a.start)},teardown:function(){if(d)return!1;e(a.stop)}}),a=function(){var n,a,r,l,c={};return c.start=function(){if(!n){var c=h();r||(r=l=function(e){return e},u&&(a=e('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow,l=function(){return h(a.document[i][s])},(r=function(e,t){if(e!==t){var n=a.document;n.open().close(),n[i].hash="#"+e}})(h()))),function a(){var u=h(),d=l(c);u!==c?(r(c=u,d),e(t).trigger(o)):d!==c&&(t[i][s]=t[i][s].replace(/#.*/,"")+"#"+d),n=setTimeout(a,e[o+"Delay"])}()}},c.stop=function(){a||(n&&clearTimeout(n),n=0)},c}()}(e,window),e}function jqPluginSVGIcons(e){var t={},n=void 0;return e.svgIcons=function(a){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xlink",s=r.w||24,l=r.h||24,c=void 0,u=void 0,d=void 0,h=!1,g=!1,p=0,f=!!window.opera,v="data:image/svg+xml;charset=utf-8;base64,",m=void 0;if(r.svgz){m=e('<object data="'+a+'" type=image/svg+xml>').appendTo("body").hide();try{u=m[0].contentDocument,m.load(b),b(0,!0)}catch(e){w()}}else{var _=new DOMParser;e.ajax({url:a,dataType:"string",success:function(t){t?(u=_.parseFromString(t,"text/xml"),e(function(){b("ajax")})):e(w)},error:function(t){window.opera?e(function(){w()}):t.responseText?((u=_.parseFromString(t.responseText,"text/xml")).childNodes.length||e(w),e(function(){b("ajax")})):e(w)}})}function b(t,n){if("ajax"!==t){if(g)return;var a=(u=m[0].contentDocument)&&u.getElementById("svg_eof");if(!(a||n&&a))return void(++p<50?setTimeout(b,20):(w(),g=!0));g=!0}if(c=e(u.firstChild).children(),r.no_img)setTimeout(function(){h||S()},500);else{var i=v+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";d=e(new Image).attr({src:i,width:0,height:0}).appendTo("body").load(function(){S(!0)}).error(function(){S()})}}var y=function(e,t,n,a){if(f&&t.css("visibility","hidden"),r.replace){a&&t.attr("id",n);var i=e.attr("class");i&&t.attr("class","svg_icon "+i),e.replaceWith(t)}else e.append(t);f&&setTimeout(function(){t.removeAttr("style")},1)},x=void 0,C=function(e,n){void 0!==r.id_match&&!1===r.id_match||y(x,e,n,!0),t[n]=e};function S(a,u){if(!h){r.no_img&&(a=!1);var g=void 0;if(a&&(g=e(document.createElement("div"))).hide().appendTo("body"),u){var p=r.fallback_path||"";e.each(u,function(t,n){x=e("#"+t);var a=e(new Image).attr({class:"svg_icon",src:p+n,width:s,height:l,alt:"icon"});C(a,t)})}else for(var _=c.length,b=0;b<_;b++){var S=c[b],w=S.id;if("svg_eof"===w)break;x=e("#"+w);var k=document.createElementNS(i,"svg");k.setAttributeNS(null,"viewBox",[0,0,s,l].join(" "));var A=S.getElementsByTagNameNS(i,"svg")[0],E=A.getAttribute("width"),P=A.getAttribute("height");A.removeAttribute("width"),A.removeAttribute("height"),A.getAttribute("viewBox")||A.setAttribute("viewBox",[0,0,E,P].join(" ")),k.setAttribute("xmlns",i),k.setAttribute("width",s),k.setAttribute("height",l),k.setAttribute("xmlns:xlink",o),k.setAttribute("class","svg_icon"),f||(A=A.cloneNode(!0)),k.append(A);var T=void 0;if(a){g.empty().append(k);var G=v+$(unescape(encodeURIComponent((new XMLSerializer).serializeToString(k))));T=e(new Image).attr({class:"svg_icon",src:G})}else T=n(e(k),b);C(T,w)}r.placement&&e.each(r.placement,function(r,i){t[i]&&e(r).each(function(r){var o=t[i].clone();r>0&&!a&&(o=n(o,r,!0)),y(e(this),o,i)})}),u||(a&&g.remove(),m&&m.remove(),d&&d.remove()),r.resize&&e.resizeSvgIcons(r.resize),h=!0,r.callback&&r.callback(t)}}function w(){if(a.includes(".svgz")){var t=a.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg"),e.svgIcons(t,r)}else r.fallback&&S(!1,r.fallback)}function $(e){if(window.btoa)return window.btoa(e);var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=new Array(4*Math.floor((e.length+2)/3)),a=0,r=0;do{var i=e.charCodeAt(a++),o=e.charCodeAt(a++),s=e.charCodeAt(a++),l=i>>2,c=(3&i)<<4|o>>4,u=(15&o)<<2|s>>6,d=63&s;isNaN(o)?u=d=64:isNaN(s)&&(d=64),n[r++]=t.charAt(l),n[r++]=t.charAt(c),n[r++]=t.charAt(u),n[r++]=t.charAt(d)}while(a<e.length);return n.join("")}n=function(e,t,n){var a=e.find("defs");if(!a.length)return e;var r=void 0;r=f?a.find("*").filter(function(){return!!this.id}):a.find("[id]");var i=e[0].getElementsByTagName("*"),o=i.length;return r.each(function(e){var n=this.id,a="x"+n+t+e;this.id=a;var r="url(#"+n+")",s="url(#"+a+")";for(e=0;e<o;e++){var l=i[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,a){var r=t[e];return a&&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,a){var r=Array.isArray(a),i=r?a[0]:a,o=r?a[1]:a;n&&(t=t.replace(/\.svg_icon/g,"svg")),e(t).each(function(){this.setAttribute("width",i),this.setAttribute("height",o),window.opera&&window.widget&&(this.parentNode.style.width=i+"px",this.parentNode.style.height=o+"px")})})},e}var ns={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};function jqPluginJGraduate(e){e.loadingStylesheets||(e.loadingStylesheets=[]);e.loadingStylesheets.includes("jgraduate/css/jGraduate.css")||e.loadingStylesheets.push("jgraduate/css/jGraduate.css");e.jGraduate={Paint:function e(t){classCallCheck(this,e);var n=t||{};if(this.alpha=isNaN(n.alpha)?100:n.alpha,n.copy)switch(this.type=n.copy.type,this.alpha=n.copy.alpha,this.solidColor=null,this.linearGradient=null,this.radialGradient=null,this.type){case"none":break;case"solidColor":this.solidColor=n.copy.solidColor;break;case"linearGradient":this.linearGradient=n.copy.linearGradient.cloneNode(!0);break;case"radialGradient":this.radialGradient=n.copy.radialGradient.cloneNode(!0)}else n.linearGradient?(this.type="linearGradient",this.solidColor=null,this.radialGradient=null,this.linearGradient=n.linearGradient.cloneNode(!0)):n.radialGradient?(this.type="radialGradient",this.solidColor=null,this.linearGradient=null,this.radialGradient=n.radialGradient.cloneNode(!0)):n.solidColor?(this.type="solidColor",this.solidColor=n.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 t=navigator.userAgent.includes("Gecko/");function n(e,n,a){var r=document.createElementNS(ns.svg,e);return function(e,n){if(t)for(var a in n)e.setAttribute(a,n[a]);else for(var r in n){var i=n[r],o=e[r];o&&"SVGLength"===o.constructor?o.baseVal.value=i:e.setAttribute(r,i)}}(r,n),a&&a.append(r),r}return e.fn.jGraduate=function(t,a,r){return this.each(function(){var i=e(this),o=e.extend(!0,{},e.fn.jGraduateDefaults,t||{}),s=i.attr("id"),l="#"+i.attr("id")+" ";if(l){var c=function(){switch(i.paint.type){case"radialGradient":i.paint.linearGradient=null;break;case"linearGradient":i.paint.radialGradient=null;break;case"solidColor":i.paint.radialGradient=i.paint.linearGradient=null}"function"==typeof i.okCallback&&i.okCallback(i.paint),i.hide()},u=function(){"function"==typeof i.cancelCallback&&i.cancelCallback(),i.hide()};e.extend(!0,i,{paint:new e.jGraduate.Paint({copy:o.paint}),okCallback:"function"==typeof a?a:null,cancelCallback:"function"==typeof r?r:null});var d=null,h=e(window);"none"===i.paint.type&&(i.paint=new e.jGraduate.Paint({solidColor:"ffffff"})),i.addClass("jGraduate_Picker"),i.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 g=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 f=256,v=f-0,m=f-0,_={};e(".jGraduate_SliderBar").width(145);var b=e("#"+s+"_jGraduate_GradContainer")[0],y=n("svg",{id:s+"_jgraduate_svg",width:f,height:f,xmlns:ns.svg},b),x=i.paint.type,C=i.paint[x],S=C,w=i.paint.alpha,$="solidColor"===x;switch(x){case"solidColor":case"linearGradient":if($||(S.id=s+"_lg_jgraduate_grad",C=S=y.appendChild(S)),n("radialGradient",{id:s+"_rg_jgraduate_grad"},y),"linearGradient"===x)break;case"radialGradient":$||(S.id=s+"_rg_jgraduate_grad",C=S=y.appendChild(S)),n("linearGradient",{id:s+"_lg_jgraduate_grad"},y)}var k=void 0;if($){C=S=e("#"+s+"_lg_jgraduate_grad")[0],Ne(0,"#"+(d=i.paint[x]),1);var A=_typeof(o.newstop);if("string"===A)switch(o.newstop){case"same":Ne(1,"#"+d,1);break;case"inverse":for(var E="",P=0;P<6;P+=2){var T=(255-parseInt(d.substr(P,2),16)).toString(16);T.length<2&&(T=0+T),E+=T}Ne(1,"#"+E,1);break;case"white":Ne(1,"#ffffff",1);break;case"black":Ne(1,"#000000",1)}else if("object"===A){var G="opac"in o.newstop?o.newstop.opac:1;Ne(1,o.newstop.color||"#"+d,G)}}var N=parseFloat(C.getAttribute("x1")||0),L=parseFloat(C.getAttribute("y1")||0),I=parseFloat(C.getAttribute("x2")||1),M=parseFloat(C.getAttribute("y2")||0),R=parseFloat(C.getAttribute("cx")||.5),O=parseFloat(C.getAttribute("cy")||.5),V=parseFloat(C.getAttribute("fx")||R),B=parseFloat(C.getAttribute("fy")||O),j=n("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:v,height:m,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":w/100},y),D=e("<div/>").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:L*f,left:N*f}).data("coord","start").appendTo(b),F=D.clone().text(2).css({top:M*f,left:I*f}).attr("title","End stop").data("coord","end").appendTo(b),U=e("<div/>").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:O*f,left:R*f}).data("coord","center").appendTo(b),H=U.clone().text("F").css({top:B*f,left:V*f,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(b);H[0].id=s+"_jGraduate_focusCoord";var z=void 0;e.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(t,n){var a=isNaN(n[1]),r=S.getAttribute(n);r||(r=a?"0.5":"x2"===n?"1.0":"0.0"),_[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]||z)&&(a&&"radialGradient"===x||!a&&"linearGradient"===x)&&S.setAttribute(n,this.value);var e=a?"c"===n[0]?U:H:"1"===n[1]?D:F,t=n.includes("x")?"left":"top";e.css(t,this.value*f)}).change()});var q=e("#"+s+"_jGraduate_StopSlider"),W=void 0,Y=void 0,X=void 0,K=n("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),Q=void 0,Z=1,J=1,ee=0,te=R,ne=O,ae=n("svg",{width:"100%",height:45},q[0]),re=n("image",{width:16,height:16},n("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ae)),ie=o.images.clientPath+"map-opacity.png";re.setAttributeNS(ns.xlink,"xlink:href",ie),e(ae).click(function(e){if(Q=q.offset(),"path"!==e.target.tagName){var t=e.pageX-Q.left-8;Ne((t=t<10?10:t>f+10?f+10:t)/f,0,0,!0),e.stopPropagation()}}),e(ae).mouseover(function(){ae.append(K)}),k=n("g",{},ae),n("line",{x1:10,y1:15,x2:f+10,y2:15,"stroke-width":2,stroke:"#000"},ae);var oe=p.find(".jGraduate_spreadMethod").change(function(){S.setAttribute("spreadMethod",e(this).val())}),se=null,le=function(e){var t=e.pageX-he.left,n=e.pageY-he.top;t=t<0?0:t>f?f:t,n=n<0?0:n>f?f:n,se.css("left",t).css("top",n);var a=t/v,r=n/m,i=se.data("coord"),o=S;switch(i){case"start":_.x1.val(a),_.y1.val(r),o.setAttribute("x1",a),o.setAttribute("y1",r);break;case"end":_.x2.val(a),_.y2.val(r),o.setAttribute("x2",a),o.setAttribute("y2",r);break;case"center":_.cx.val(a),_.cy.val(r),o.setAttribute("cx",a),o.setAttribute("cy",r),te=a,ne=r,Me();break;case"focus":_.fx.val(a),_.fy.val(r),o.setAttribute("fx",a),o.setAttribute("fy",r),Me()}e.preventDefault()},ce=function e(){se=null,h.unbind("mousemove",le).unbind("mouseup",e)},ue=(W=S.getElementsByTagNameNS(ns.svg,"stop")).length;if(ue<2){for(;ue<2;)S.append(document.createElementNS(ns.svg,"stop")),++ue;W=S.getElementsByTagNameNS(ns.svg,"stop")}for(var de=0;de<ue;de++)Ne(0,0,0,0,W[de]);oe.val(S.getAttribute("spreadMethod")||"pad");var he=void 0;z=!1,j.setAttribute("fill-opacity",w/100),e("#"+s+" div.grad_coord").mousedown(function(t){t.preventDefault(),se=e(this),he=se.parent().offset(),h.mousemove(le).mouseup(ce)}),e("#"+s+"_jGraduate_Ok").bind("click",function(){i.paint.type=x,i.paint[x]=S.cloneNode(!0),i.paint.solidColor=null,c()}),e("#"+s+"_jGraduate_Cancel").bind("click",function(e){u()}),"radialGradient"===x&&(z?H.show():(H.hide(),_.fx.val(""),_.fy.val(""))),e("#"+s+"_jGraduate_match_ctr")[0].checked=!z;var ge=void 0,pe=void 0;if(e("#"+s+"_jGraduate_match_ctr").change(function(){z=!this.checked,H.toggle(z),_.fx.val(""),_.fy.val("");var e=S;if(z){var t=ge||.5,n=pe||.5;e.setAttribute("fx",t),e.setAttribute("fy",n),_.fx.val(t),_.fy.val(n)}else ge=e.getAttribute("fx"),pe=e.getAttribute("fy"),e.removeAttribute("fx"),e.removeAttribute("fy")}),(ue=(W=S.getElementsByTagNameNS(ns.svg,"stop")).length)<2){for(;ue<2;)S.append(document.createElementNS(ns.svg,"stop")),++ue;W=S.getElementsByTagNameNS(ns.svg,"stop")}var fe=void 0,ve=0,me=0;if("radialGradient"===x){var _e=S.gradientTransform.baseVal;if(2===_e.numberOfItems){var be=_e.getItem(0),ye=_e.getItem(1);if(2===be.type&&3===ye.type){var xe=ye.matrix;1!==xe.a?ve=Math.round(100*-(1-xe.a)):1!==xe.d&&(ve=Math.round(100*(1-xe.d)))}}else if(3===_e.numberOfItems){var Ce=_e.getItem(0),Se=_e.getItem(1),we=_e.getItem(2);if(4===Ce.type&&2===Se.type&&3===we.type){me=Math.round(Ce.angle);var $e=we.matrix;1!==$e.a?ve=Math.round(100*-(1-$e.a)):1!==$e.d&&(ve=Math.round(100*(1-$e.d)))}}}var ke={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:i.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(ke,function(t,n){var a=e(n.handle);a.mousedown(function(r){var i=a.parent();fe={type:t,elem:a,input:e(n.input),parent:i,offset:i.offset()},h.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":i.paint.alpha=n,j.setAttribute("fill-opacity",n/100),r=1.45*n;break;case"ellip":if(Z=J=1,0===n){r=72.5;break}n>99.5&&(n=99.5),n>0?J=1-n/100:Z=-n/100-1,r=(n+100)/2*145/100,e&&Me();break;case"angle":r=(ee=n)/180,r+=.5,r*=145,e&&Me()}r>145?r=145:r<0&&(r=0),a.css({"margin-left":r-5})}).change()});for(var Ae=function(e){!function(e){var t=fe.offset,n=fe.parent,a=e.pageX-t.left-parseInt(n.css("border-left-width"));a>145&&(a=145),a<=0&&(a=0);var r=a-5;switch(a/=145,fe.type){case"radius":(a=Math.pow(2*a,2.5))>.98&&a<1.02&&(a=1),a<=.01&&(a=.01),S.setAttribute("r",a);break;case"opacity":i.paint.alpha=parseInt(100*a),j.setAttribute("fill-opacity",a);break;case"ellip":Z=1,J=1,a<.5?Z=(a/=.5)<=0?.01:a:a>.5&&(J=(a=2-(a/=.5))<=0?.01:a),Me(),J===1+(a-=1)&&(a=Math.abs(a));break;case"angle":a-=.5,ee=a*=180,Me(),a/=100}fe.elem.css({"margin-left":r}),a=Math.round(100*a),fe.input.val(a)}(e),e.preventDefault()},Ee=function e(t){h.unbind("mousemove",Ae).unbind("mouseup",e),fe=null},Pe=(255*i.paint.alpha/100).toString(16);Pe.length<2;)Pe="0"+Pe;Pe=Pe.split(".")[0],d="none"===i.paint.solidColor?"":i.paint.solidColor+Pe,$||(d=W[0].getAttribute("stop-color")),e.extend(e.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),g.jPicker({window:{title:o.window.pickerTitle},images:{clientPath:o.images.clientPath},color:{active:d,alphaSupport:!0}},function(e){i.paint.type="solidColor",i.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,i.paint.solidColor=e.val("hex")?e.val("hex"):"none",i.paint.radialGradient=null,c()},null,function(){u()});var Te=e(l+" .jGraduate_tabs li");Te.click(function(){Te.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(i.paint.alpha).change();var n=e("#"+s+"_"+t+"_jgraduate_grad")[0];if(S!==n){var a=e(S).find("stop");e(n).empty().append(a),S=n;var r=oe.val();S.setAttribute("spreadMethod",r)}z="rg"===t&&null!=S.getAttribute("fx")&&!(R===V&&O===B),e("#"+s+"_jGraduate_focusCoord").toggle(z),z&&(e("#"+s+"_jGraduate_match_ctr")[0].checked=!1)}else e(l+" .jGraduate_gradPick").hide(),e(l+" .jGraduate_colPick").show()}),e(l+" > div").hide(),Te.removeClass("jGraduate_tab_current");var Ge=void 0;switch(i.paint.type){case"linearGradient":Ge=e(l+" .jGraduate_tab_lingrad");break;case"radialGradient":Ge=e(l+" .jGraduate_tab_radgrad");break;default:Ge=e(l+" .jGraduate_tab_color")}i.show(),setTimeout(function(){Ge.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Ne(t,a,r,i,l){var c=l||n("stop",{"stop-color":a,"stop-opacity":r,offset:t},S);l?(a=l.getAttribute("stop-color"),r=l.getAttribute("stop-opacity"),t=l.getAttribute("offset")):S.append(c),null===r&&(r=1);var u="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",d=n("path",{d:u,fill:"url(#jGraduate_trans)",transform:"translate("+(10+t*f)+", 26)"},k),g=n("path",{d:u,fill:a,"fill-opacity":r,transform:"translate("+(10+t*f)+", 26)",stroke:"#000","stroke-width":1.5},k);return e(g).mousedown(function(e){return Le(this),X=Y,h.mousemove(Re).mouseup(Ie),Q=q.offset(),e.preventDefault(),!1}).data("stop",c).data("bg",d).dblclick(function(){e("div.jGraduate_LightBox").show();for(var t=this,n=+c.getAttribute("stop-opacity")||1,r=c.getAttribute("stop-color")||1,i=(255*parseFloat(n)).toString(16);i.length<2;)i="0"+i;a=r.substr(1)+i,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:a,alphaSupport:!0}},function(a,i){r=a.val("hex")?"#"+a.val("hex"):"none",n=null!==a.val("a")?a.val("a")/256:1,t.setAttribute("fill",r),t.setAttribute("fill-opacity",n),c.setAttribute("stop-color",r),c.setAttribute("stop-opacity",n),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 n=e(this);if(+this.getAttribute("offset")>t){if(!a){var r=this.getAttribute("stop-color"),i=this.getAttribute("stop-opacity");c.setAttribute("stop-color",r),g.setAttribute("fill",r),c.setAttribute("stop-opacity",null===i?1:i),g.setAttribute("fill-opacity",null===i?1:i)}return n.before(c),!1}}),i&&Le(g),c}function Le(e){Y&&Y.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),(Y=e).parentNode.append(Y)}function Ie(){h.unbind("mousemove",Re),"none"!==K.getAttribute("display")&&function(){K.setAttribute("display","none");var t=e(Y),n=t.data("stop"),a=t.data("bg");e([Y,n,a]).remove()}(),X=null}function Me(){var e=ee?"rotate("+ee+","+te+","+ne+") ":"";if(1===Z&&1===J)S.removeAttribute("gradientTransform");else{var t=-te*(Z-1),n=-ne*(J-1);S.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+Z+","+J+")")}}function Re(t){var n=t.pageX-Q.left,a=t.pageY-Q.top,r="translate("+(n=n<10?10:n>f+10?f+10:n)+", 26)";a<-60||a>130?(K.setAttribute("display","block"),K.setAttribute("transform",r)):K.setAttribute("display","none"),X.setAttribute("transform",r),e.data(X,"bg").setAttribute("transform",r);var i=e.data(X,"stop"),o=(n-10)/f;i.setAttribute("offset",o);var s=0;e(S).find("stop").each(function(t){var n=this.getAttribute("offset"),a=e(this);n<s&&(a.prev().before(a),W=e(S).find("stop")),s=n})}})},e}function jqPluginSpinBtn(e){e.loadingStylesheets||(e.loadingStylesheets=[]);return e.loadingStylesheets.includes("spinbtn/jQuery.SpinButton.css")||e.loadingStylesheets.push("spinbtn/jQuery.SpinButton.css"),e.fn.SpinButton=function(t){function n(t,n){for(var a=document.body,r=t[n];(t=t.offsetParent)&&t!==a;)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(a){var r=a.pageX||a.x,i=a.pageY||a.y,o=a.target,s=t.stateObj.tool_scale||1,l=e(o).height()/2,c=r>n(o,"offsetLeft")+o.offsetWidth*s-this.spinCfg._btn_width?i<n(o,"offsetTop")+l*s?1:-1:0;if(c!==this.spinCfg._direction){switch(c){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=c}}).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,a=function(){t.adjustValue(t.spinCfg._direction*n)};a(),this.spinCfg._delay=window.setTimeout(function(){a(),t.spinCfg._repeat=window.setInterval(a,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}function jQueryContextMenu(e){var t=e(window),n=e(document);return e.extend(e.fn,{contextMenu:function(a,r){return void 0!==a.menu&&(void 0===a.inSpeed&&(a.inSpeed=150),void 0===a.outSpeed&&(a.outSpeed=75),0===a.inSpeed&&(a.inSpeed=-1),0===a.outSpeed&&(a.outSpeed=-1),e(this).each(function(){var i=e(this),o=e(i).offset(),s=e("#"+a.menu);s.addClass("contextMenu"),e(this).bind("mousedown",function(l){var c=l;e(this).mouseup(function(l){var u=e(this);if(u.unbind("mouseup"),2===c.button||a.allowLeft||c.ctrlKey&&isMac()){if(l.stopPropagation(),e(".contextMenu").hide(),i.hasClass("disabled"))return!1;var d=l.pageX,h=l.pageY,g=t.width()-s.width(),p=t.height()-s.height();d>g-15&&(d=g-15),h>p-30&&(h=p-30),n.unbind("click"),s.css({top:h,left:d}).fadeIn(a.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(u),{x:d-o.left,y:h-o.top,docX:d,docY:h}),!1}),setTimeout(function(){n.click(function(){return n.unbind("click").unbind("keypress"),s.fadeOut(a.outSpeed),!1})},0)}})}),e.browser.mozilla?e("#"+a.menu).each(function(){e(this).css({MozUserSelect:"none"})}):e.browser.msie?e("#"+a.menu).each(function(){e(this).bind("selectstart.disableTextSelect",function(){return!1})}):e("#"+a.menu).each(function(){e(this).bind("mousedown.disableTextSelect",function(){return!1})}),e(i).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(","),a=0;a<n.length;a++)e(this).find('A[href="'+n[a]+'"]').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(","),a=0;a<n.length;a++)e(this).find('A[href="'+n[a]+'"]').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}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 jPicker=function(e){e.loadingStylesheets||(e.loadingStylesheets=[]);function t(t,n){var a=this;function r(n){var r=t.offset();u={l:0|r.left,t:0|r.top},clearTimeout(d),d=setTimeout(function(){s.call(a,n)},0),e(document).bind("mousemove",i).bind("mouseup",o),n.preventDefault()}function i(e){return clearTimeout(d),d=setTimeout(function(){s.call(a,e)},0),e.stopPropagation(),e.preventDefault(),!1}function o(t){return e(document).unbind("mouseup",o).unbind("mousemove",i),t.stopPropagation(),t.preventDefault(),!1}function s(e){var n=t.w,r=t.h,i=e.pageX-u.l,o=e.pageY-u.t;i<0?i=0:i>n&&(i=n),o<0?o=0:o>r&&(o=r),l.call(a,"xy",{x:i/n*v+p,y:o/r*b+m})}function l(e,t,n){if(!(void 0!==t))switch(void 0!==e&&null!=e||(e="xy"),e.toLowerCase()){case"x":return h;case"y":return g;case"xy":default:return{x:h,y:g}}if(null==n||n!==a){var r=!1,i=void 0,o=void 0;switch(null==e&&(e="xy"),e.toLowerCase()){case"x":i=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:i=t&&t.x&&0|t.x||0,o=t&&t.y&&0|t.y||0}null!=i&&(i<p?i=p:i>f&&(i=f),h!==i&&(h=i,r=!0)),null!=o&&(o<m?o=m:o>_&&(o=_),g!==o&&(g=o,r=!0)),r&&function(e){for(var t=0;t<x.length;t++)x[t].call(a,a,e)}.call(a,n||a)}}function c(e){"function"==typeof e&&x.push(e)}var u=void 0,d=void 0,h=0,g=0,p=0,f=100,v=100,m=0,_=100,b=100,y=t.find("img:first"),x=[];e.extend(!0,a,{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 f;case"rangex":return{minX:p,maxX:f,rangeX:v};case"miny":return m;case"maxy":return _;case"rangey":return{minY:m,maxY:_,rangeY:b};case"all":default:return{minX:p,maxX:f,rangeX:v,minY:m,maxY:_,rangeY:b}}var n=void 0,a=void 0,r=void 0,i=void 0;switch(null==e&&(e="all"),e.toLowerCase()){case"minx":n=t&&(t.minX&&0|t.minX||0|t)||0;break;case"maxx":a=t&&(t.maxX&&0|t.maxX||0|t)||0;break;case"rangex":n=t&&t.minX&&0|t.minX||0,a=t&&t.maxX&&0|t.maxX||0;break;case"miny":r=t&&(t.minY&&0|t.minY||0|t)||0;break;case"maxy":i=t&&(t.maxY&&0|t.maxY||0|t)||0;break;case"rangey":r=t&&t.minY&&0|t.minY||0,i=t&&t.maxY&&0|t.maxY||0;break;case"all":default:n=t&&t.minX&&0|t.minX||0,a=t&&t.maxX&&0|t.maxX||0,r=t&&t.minY&&0|t.minY||0,i=t&&t.maxY&&0|t.maxY||0}null!=n&&p!==n&&(v=f-(p=n)),null!=a&&f!==a&&(v=(f=a)-p),null!=r&&m!==r&&(b=_-(m=r)),null!=i&&_!==i&&(b=(_=i)-m)},bind:c,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",i),t.unbind("mousedown",r),t=null,y=null,x=null}}),y.src=n.arrow&&n.arrow.image,y.w=n.arrow&&n.arrow.width||y.width(),y.h=n.arrow&&n.arrow.height||y.height(),t.w=n.map&&n.map.width||t.width(),t.h=n.map&&n.map.height||t.height(),t.bind("mousedown",r),c.call(a,function(){var e=t.w,n=t.h,a=y.w,r=y.h,i=0,o=0;setTimeout(function(){v>0&&(i=h===f?e:h/v*e|0),b>0&&(o=g===_?n:g/b*n|0),a>=e?i=(e>>1)-(a>>1):i-=a>>1,r>=n?o=(n>>1)-(r>>1):o-=r>>1,y.css({left:i+"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){var n=this;function a(e){for(var t=0;t<g.length;t++)g[t].call(n,n,e)}function r(e,t,g){var p=Boolean(t);if(p&&""===t.ahex&&(t.ahex="00000000"),!p){if(void 0!==e&&null!=e&&""!==e||(e="all"),null==o)return null;switch(e.toLowerCase()){case"ahex":return i.rgbaToHex({r:o,g:s,b:l,a:c});case"hex":return r("ahex").substring(0,6);case"all":return{r:o,g:s,b:l,a:c,h:u,s:d,v:h,hex:r.call(n,"hex"),ahex:r.call(n,"ahex")};default:for(var f={},v=0;v<e.length;v++)switch(e.charAt(v)){case"r":1===e.length?f=o:f.r=o;break;case"g":1===e.length?f=s:f.g=s;break;case"b":1===e.length?f=l:f.b=l;break;case"a":1===e.length?f=c:f.a=c;break;case"h":1===e.length?f=u:f.h=u;break;case"s":1===e.length?f=d:f.s=d;break;case"v":1===e.length?f=h:f.v=h}return e.length?f:r.call(n,"all")}}if(null==g||g!==n){null==e&&(e="");var m=!1;if(null==t)return null!=o&&(o=null,m=!0),null!=s&&(s=null,m=!0),null!=l&&(l=null,m=!0),null!=c&&(c=null,m=!0),null!=u&&(u=null,m=!0),null!=d&&(d=null,m=!0),null!=h&&(h=null,m=!0),void(m&&a.call(n,g||n));switch(e.toLowerCase()){case"ahex":case"hex":var _=i.hexToRgba(t&&(t.ahex||t.hex)||t||"none");r.call(n,"rgba",{r:_.r,g:_.g,b:_.b,a:"ahex"===e?_.a:null!=c?c:255},g);break;default:if(t&&(null!=t.ahex||null!=t.hex))return void r.call(n,"ahex",t.ahex||t.hex||"00000000",g);var b={},y=!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 C=0;C<e.length;C++)switch(e.charAt(C)){case"r":if(x)continue;y=!0,b.r=t&&t.r&&0|t.r||t&&0|t||0,b.r<0?b.r=0:b.r>255&&(b.r=255),o!==b.r&&(o=b.r,m=!0);break;case"g":if(x)continue;y=!0,b.g=t&&t.g&&0|t.g||t&&0|t||0,b.g<0?b.g=0:b.g>255&&(b.g=255),s!==b.g&&(s=b.g,m=!0);break;case"b":if(x)continue;y=!0,b.b=t&&t.b&&0|t.b||t&&0|t||0,b.b<0?b.b=0:b.b>255&&(b.b=255),l!==b.b&&(l=b.b,m=!0);break;case"a":b.a=t&&null!=t.a?0|t.a:null!=t?0|t:255,b.a<0?b.a=0:b.a>255&&(b.a=255),c!==b.a&&(c=b.a,m=!0);break;case"h":if(y)continue;x=!0,b.h=t&&t.h&&0|t.h||t&&0|t||0,b.h<0?b.h=0:b.h>360&&(b.h=360),u!==b.h&&(u=b.h,m=!0);break;case"s":if(y)continue;x=!0,b.s=t&&null!=t.s?0|t.s:null!=t?0|t:100,b.s<0?b.s=0:b.s>100&&(b.s=100),d!==b.s&&(d=b.s,m=!0);break;case"v":if(y)continue;x=!0,b.v=t&&null!=t.v?0|t.v:null!=t?0|t:100,b.v<0?b.v=0:b.v>100&&(b.v=100),h!==b.v&&(h=b.v,m=!0)}if(m){if(y){o=o||0,s=s||0,l=l||0;var S=i.rgbToHsv({r:o,g:s,b:l});u=S.h,d=S.s,h=S.v}else if(x){u=u||0,d=null!=d?d:100,h=null!=h?h:100;var w=i.hsvToRgb({h:u,s:d,v:h});o=w.r,s=w.g,l=w.b}c=null!=c?c:255,a.call(n,g||n)}}}}var o=void 0,s=void 0,l=void 0,c=void 0,u=void 0,d=void 0,h=void 0,g=[];e.extend(!0,n,{val:r,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}}),t&&(null!=t.ahex?r("ahex",t):null!=t.hex?r((null!=t.a?"a":"")+"hex",null!=t.a?{ahex:t.hex+i.intToHex(t.a)}:t):null!=t.r&&null!=t.g&&null!=t.b?r("rgb"+(null!=t.a?"a":""),t):null!=t.h&&null!=t.s&&null!=t.v&&r("hsv"+(null!=t.a?"a":""),t))},ColorMethods:{hexToRgba:function(e){if(""===e||"none"===e)return{r:null,g:null,b:null,a:null};var t="00",n="00",a="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),a=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&&(a=e.substring(0,e.length))),{r:this.hexToInt(t),g:this.hexToInt(n),b:this.hexToInt(a),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,a=e.b/255,r={h:0,s:0,v:0},i=0,o=0;t>=n&&t>=a?(o=t,i=n>a?a:n):n>=a&&n>=t?(o=n,i=t>a?a:t):(o=a,i=n>t?t:n),r.v=o,r.s=o?(o-i)/o:0;var s=void 0;return r.s?(s=o-i,r.h=t===o?(n-a)/s:n===o?2+(a-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,a=e.s,r=e.v;if(0===a)t.r=t.g=t.b=0===r?0:255*r/100|0;else{360===n&&(n=0);var i=0|(n/=60),o=n-i,s=(r/=100)*(1-(a/=100)),l=r*(1-a*o),c=r*(1-a*(1-o));switch(i){case 0:t.r=r,t.g=c,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=c;break;case 3:t.r=s,t.g=l,t.b=r;break;case 4:t.r=c,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 n=e.jPicker,a=n.Color,r=n.List,i=n.ColorMethods;return e.fn.jPicker=function(n){var o=arguments;return this.each(function(){var s=this,l=e.extend(!0,{},e.fn.jPicker.defaults,n);"input"===e(s).get(0).nodeName.toLowerCase()&&(e.extend(!0,l,{window:{bindToInput:!0,expandable:!0,input:e(s)}}),""===e(s).val()?(l.color.active=new a({hex:null}),l.color.current=new a({hex:null})):i.validateHex(e(s).val())&&(l.color.active=new a({hex:e(s).val(),a:l.color.active.val("a")}),l.color.current=new a({hex:e(s).val(),a:l.color.active.val("a")}))),l.window.expandable?e(s).after('<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>'):l.window.liveUpdate=!1;var c=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function u(e){var t=M.active,n=t.val("hex"),a=void 0,r=void 0;switch(l.color.mode=e,e){case"h":if(setTimeout(function(){p.call(s,D,"transparent"),v.call(s,U,0),m.call(s,U,100),v.call(s,H,260),m.call(s,H,100),p.call(s,F,"transparent"),v.call(s,q,0),m.call(s,q,100),v.call(s,W,260),m.call(s,W,100),v.call(s,Y,260),m.call(s,Y,100),v.call(s,X,260),m.call(s,X,100),v.call(s,Q,260),m.call(s,Q,100)},0),Z.range("all",{minX:0,maxX:100,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:360}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("s"),y:100-t.val("v")},Z),J.val("y",360-t.val("h"),J);break;case"s":if(setTimeout(function(){p.call(s,D,"transparent"),v.call(s,U,-260),v.call(s,H,-520),v.call(s,q,-260),v.call(s,W,-520),v.call(s,Q,260),m.call(s,Q,100)},0),Z.range("all",{minX:0,maxX:360,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("h"),y:100-t.val("v")},Z),J.val("y",100-t.val("s"),J);break;case"v":if(setTimeout(function(){p.call(s,D,"000000"),v.call(s,U,-780),v.call(s,H,260),p.call(s,F,n),v.call(s,q,-520),v.call(s,W,260),m.call(s,W,100),v.call(s,Q,260),m.call(s,Q,100)},0),Z.range("all",{minX:0,maxX:360,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("h"),y:100-t.val("s")},Z),J.val("y",100-t.val("v"),J);break;case"r":if(a=-1040,r=-780,Z.range("all",{minX:0,maxX:255,minY:0,maxY:255}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("b"),y:255-t.val("g")},Z),J.val("y",255-t.val("r"),J);break;case"g":if(a=-1560,r=-1820,Z.range("all",{minX:0,maxX:255,minY:0,maxY:255}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("b"),y:255-t.val("r")},Z),J.val("y",255-t.val("g"),J);break;case"b":if(a=-2080,r=-2860,Z.range("all",{minX:0,maxX:255,minY:0,maxY:255}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("r"),y:255-t.val("g")},Z),J.val("y",255-t.val("b"),J);break;case"a":if(setTimeout(function(){p.call(s,D,"transparent"),v.call(s,U,-260),v.call(s,H,-520),v.call(s,q,260),v.call(s,W,260),m.call(s,W,100),v.call(s,Q,0),m.call(s,Q,100)},0),Z.range("all",{minX:0,maxX:360,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;Z.val("xy",{x:t.val("h"),y:100-t.val("v")},Z),J.val("y",255-t.val("a"),J);break;default:throw new Error("Invalid Mode")}switch(e){case"h":break;case"s":case"v":case"a":setTimeout(function(){m.call(s,U,100),m.call(s,q,100),v.call(s,Y,260),m.call(s,Y,100),v.call(s,X,260),m.call(s,X,100)},0);break;case"r":case"g":case"b":setTimeout(function(){p.call(s,D,"transparent"),p.call(s,F,"transparent"),m.call(s,q,100),m.call(s,U,100),v.call(s,U,a),v.call(s,H,a-260),v.call(s,q,r-780),v.call(s,W,r-520),v.call(s,Y,r),v.call(s,X,r-260),v.call(s,Q,260),m.call(s,Q,100)},0)}null!=t.val("ahex")&&d.call(s,t)}function d(e,t){(null==t||t!==J&&t!==Z)&&function(e,t){if(t!==Z)switch(l.color.mode){case"h":var n=e.val("sv");Z.val("xy",{x:null!=n?n.s:100,y:100-(null!=n?n.v:100)},t);break;case"s":case"a":var a=e.val("hv");Z.val("xy",{x:a&&a.h||0,y:100-(null!=a?a.v:100)},t);break;case"v":var r=e.val("hs");Z.val("xy",{x:r&&r.h||0,y:100-(null!=r?r.s:100)},t);break;case"r":var i=e.val("bg");Z.val("xy",{x:i&&i.b||0,y:255-(i&&i.g||0)},t);break;case"g":var o=e.val("br");Z.val("xy",{x:o&&o.b||0,y:255-(o&&o.r||0)},t);break;case"b":var s=e.val("rg");Z.val("xy",{x:s&&s.r||0,y:255-(s&&s.g||0)},t)}if(t!==J)switch(l.color.mode){case"h":J.val("y",360-(e.val("h")||0),t);break;case"s":var c=e.val("s");J.val("y",100-(null!=c?c:100),t);break;case"v":var u=e.val("v");J.val("y",100-(null!=u?u:100),t);break;case"r":J.val("y",255-(e.val("r")||0),t);break;case"g":J.val("y",255-(e.val("g")||0),t);break;case"b":J.val("y",255-(e.val("b")||0),t);break;case"a":var d=e.val("a");J.val("y",255-(null!=d?d:255),t)}}.call(s,e,t),setTimeout(function(){(function(e){try{var t=e.val("all");te.css({backgroundColor:t&&"#"+t.hex||"transparent"}),m.call(s,te,t&&Math.precision(100*t.a/255,4)||0)}catch(e){}}).call(s,e),function(e){switch(l.color.mode){case"h":p.call(s,D,new a({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");m.call(s,H,100-(null!=t?t:100));break;case"v":var n=e.val("v");m.call(s,U,null!=n?n:100);break;case"r":m.call(s,H,Math.precision((e.val("r")||0)/255*100,4));break;case"g":m.call(s,H,Math.precision((e.val("g")||0)/255*100,4));break;case"b":m.call(s,H,Math.precision((e.val("b")||0)/255*100))}var r=e.val("a");m.call(s,z,Math.precision(100*(255-(r||0))/255,4))}.call(s,e),function(e){switch(l.color.mode){case"h":var t=e.val("a");m.call(s,K,Math.precision(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),r=new a({h:n&&n.h||0,s:100,v:null!=n?n.v:100});p.call(s,F,r.val("hex")),m.call(s,W,100-(null!=n?n.v:100)),m.call(s,K,Math.precision(100*(255-(n&&n.a||0))/255,4));break;case"v":var i=e.val("hsa"),o=new a({h:i&&i.h||0,s:null!=i?i.s:100,v:100});p.call(s,F,o.val("hex")),m.call(s,K,Math.precision(100*(255-(i&&i.a||0))/255,4));break;case"r":case"g":case"b":var c=e.val("rgba"),u=0,d=0;"r"===l.color.mode?(u=c&&c.b||0,d=c&&c.g||0):"g"===l.color.mode?(u=c&&c.b||0,d=c&&c.r||0):"b"===l.color.mode&&(u=c&&c.r||0,d=c&&c.g||0);var h=d>u?u:d;m.call(s,W,u>d?Math.precision((u-d)/(255-d)*100,4):0),m.call(s,Y,d>u?Math.precision((d-u)/(255-u)*100,4):0),m.call(s,X,Math.precision(h/255*100,4)),m.call(s,K,Math.precision(100*(255-(c&&c.a||0))/255,4));break;case"a":var g=e.val("a");p.call(s,F,e.val("hex")||"000000"),m.call(s,K,null!=g?0:100),m.call(s,Q,null!=g?100:0)}}.call(s,e)},0)}function h(e,t){var n=M.active;if(t===Z||null!=n.val()){var a=e.val("all");switch(l.color.mode){case"h":n.val("sv",{s:a.x,v:100-a.y},t);break;case"s":case"a":n.val("hv",{h:a.x,v:100-a.y},t);break;case"v":n.val("hs",{h:a.x,s:100-a.y},t);break;case"r":n.val("gb",{g:255-a.y,b:a.x},t);break;case"g":n.val("rb",{r:255-a.y,b:a.x},t);break;case"b":n.val("rg",{r:a.x,g:255-a.y},t)}}}function g(e,t){var n=M.active;if(t===J||null!=n.val())switch(l.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 p(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function f(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 v(e,t){e.css({top:t+"px"})}function m(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 a=e.attr("pngSrc");null!=a&&(a.includes("AlphaBar.png")||a.includes("Bars.png")||a.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a+"', sizingMethod='scale')"}):e.css({opacity:""})}else e.css({opacity:""})}function _(){M.active.val("ahex",M.current.val("ahex"))}function b(t){e(this).parents("tbody:first").find('input:radio[value!="'+t.target.value+'"]').removeAttr("checked"),u.call(s,t.target.value)}function y(){_.call(s)}function x(){_.call(s),l.window.expandable&&G.call(s),"function"==typeof he&&he.call(s,M.active,re)}function C(){(function(){M.current.val("ahex",M.active.val("ahex"))}).call(s),l.window.expandable&&G.call(s),"function"==typeof ue&&ue.call(s,M.active,ae)}function S(){T.call(s)}function w(e,t){var n=e.val("hex");ne.css({backgroundColor:n&&"#"+n||"transparent"}),m.call(s,ne,Math.precision(100*(e.val("a")||0)/255,4))}function $(e,t){var n=e.val("hex"),a=e.val("va");oe.css({backgroundColor:n&&"#"+n||"transparent"}),m.call(s,se,Math.precision(100*(255-(a&&a.a||0))/255,4)),l.window.bindToInput&&l.window.updateInputColor&&l.window.input.css({backgroundColor:n&&"#"+n||"transparent",color:null==a||a.v>75?"#000000":"#ffffff"})}function k(t){R=parseInt(j.css("left")),O=parseInt(j.css("top")),V=t.pageX,B=t.pageY,e(document).bind("mousemove",A).bind("mouseup",E),t.preventDefault()}function A(t){return j.css({left:R-(V-t.pageX)+"px",top:O-(B-t.pageY)+"px"}),l.window.expandable&&!e.support.boxModel&&j.prev().css({left:j.css("left"),top:j.css("top")}),t.stopPropagation(),t.preventDefault(),!1}function E(t){return e(document).unbind("mousemove",A).unbind("mouseup",E),t.stopPropagation(),t.preventDefault(),!1}function P(t){return t.preventDefault(),t.stopPropagation(),M.active.val("ahex",e(this).attr("title")||null,t.target),!1}function T(){function t(){if(l.window.expandable&&!e.support.boxModel){var t=j.find("table:first");j.before("<iframe/>"),j.prev().css({width:t.width(),height:j.height(),opacity:0,position:"absolute",left:j.css("left"),top:j.css("top")})}}switch(M.current.val("ahex",M.active.val("ahex")),l.window.expandable&&(e(document.body).children("div.jPicker.Container").css({zIndex:10}),j.css({zIndex:20})),l.window.effects.type){case"fade":j.fadeIn(l.window.effects.speed.show,t);break;case"slide":j.slideDown(l.window.effects.speed.show,t);break;case"show":default:j.show(l.window.effects.speed.show,t)}}function G(){function t(){l.window.expandable&&j.css({zIndex:10}),l.window.expandable&&!e.support.boxModel&&j.prev().remove()}switch(l.window.effects.type){case"fade":j.fadeOut(l.window.effects.speed.hide,t);break;case"slide":j.slideUp(l.window.effects.speed.hide,t);break;case"show":default:j.hide(l.window.effects.speed.hide,t)}}function N(){var n=l.window,r=n.expandable?e(s).next().find(".Container:first"):null;(j=n.expandable?e("<div/>"):e(s)).addClass("jPicker Container"),n.expandable&&j.hide(),j.get(0).onselectstart=function(e){if("input"!==e.target.nodeName.toLowerCase())return!1};var i=M.active.val("all");n.alphaPrecision<0?n.alphaPrecision=0:n.alphaPrecision>2&&(n.alphaPrecision=2);var o='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(n.expandable?'<tr><td class="Move" colspan="5"> </td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(n.title||I.text.title)+'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="'+L.clientPath+L.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="'+L.clientPath+L.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview">'+I.text.newColor+'<div><span class="Active" title="'+I.tooltips.colors.newColor+'"> </span><span class="Current" title="'+I.tooltips.colors.currentColor+'"> </span></div>'+I.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+I.text.ok+'" title="'+I.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+I.text.cancel+'" title="'+I.tooltips.buttons.cancel+'"/><hr/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="'+I.tooltips.hue.radio+'"><input type="radio" value="h"'+("h"===l.color.mode?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=i?i.h:"")+'" title="'+I.tooltips.hue.textbox+'"/> °</td></tr><tr class="Saturation"><td class="Radio"><label title="'+I.tooltips.saturation.radio+'"><input type="radio" value="s"'+("s"===l.color.mode?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=i?i.s:"")+'" title="'+I.tooltips.saturation.textbox+'"/> %</td></tr><tr class="Value"><td class="Radio"><label title="'+I.tooltips.value.radio+'"><input type="radio" value="v"'+("v"===l.color.mode?' checked="checked"':"")+'/>V:</label><br/><br/></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=i?i.v:"")+'" title="'+I.tooltips.value.textbox+'"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+I.tooltips.red.radio+'"><input type="radio" value="r"'+("r"===l.color.mode?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=i?i.r:"")+'" title="'+I.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+I.tooltips.green.radio+'"><input type="radio" value="g"'+("g"===l.color.mode?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=i?i.g:"")+'" title="'+I.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+I.tooltips.blue.radio+'"><input type="radio" value="b"'+("b"===l.color.mode?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=i?i.b:"")+'" title="'+I.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(n.alphaSupport?'<label title="'+I.tooltips.alpha.radio+'"><input type="radio" value="a"'+("a"===l.color.mode?' checked="checked"':"")+"/>A:</label>":" ")+'</td><td class="Text">'+(n.alphaSupport?'<input type="text" maxlength="'+(3+n.alphaPrecision)+'" value="'+(null!=i?Math.precision(100*i.a/255,n.alphaPrecision):"")+'" title="'+I.tooltips.alpha.textbox+'"/> %':" ")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+I.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(null!=i?i.hex:"")+'"/></label>'+(n.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(null!=i?i.ahex.substring(6):"")+'" title="'+I.tooltips.hex.alpha+'"/></td>':" ")+"</tr></tbody></table>";n.expandable?(j.html(o),e(document.body).children("div.jPicker.Container").length?e(document.body).children("div.jPicker.Container:last").after(j):e(document.body).prepend(j),j.mousedown(function(){e(document.body).children("div.jPicker.Container").css({zIndex:10}),j.css({zIndex:20})}),j.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"})):(j=e(s)).html(o);var c=j.find("tbody:first");D=c.find("div.Map:first"),F=c.find("div.Bar:first");var p=D.find("span"),v=F.find("span");U=p.filter(".Map1:first"),H=p.filter(".Map2:first"),z=p.filter(".Map3:first"),q=v.filter(".Map1:first"),W=v.filter(".Map2:first"),Y=v.filter(".Map3:first"),X=v.filter(".Map4:first"),K=v.filter(".Map5:first"),Q=v.filter(".Map6:first"),(Z=new t(D,{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(h),(J=new t(F,{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(g),ee=new function(t,n,a,r){var i=this,o=t.find("td.Text input");function s(e){if(""!==e.target.value||e.target===y.get(0)||(null==a||e.target===a.get(0))&&null!=a){if(!u(e))return e;switch(e.target){case g.get(0):switch(e.keyCode){case 38:return g.val(d.call(i,1+(g.val()<<0),0,255)),n.val("r",g.val(),e.target),!1;case 40:return g.val(d.call(i,(g.val()<<0)-1,0,255)),n.val("r",g.val(),e.target),!1}break;case p.get(0):switch(e.keyCode){case 38:return p.val(d.call(i,1+(p.val()<<0),0,255)),n.val("g",p.val(),e.target),!1;case 40:return p.val(d.call(i,(p.val()<<0)-1,0,255)),n.val("g",p.val(),e.target),!1}break;case f.get(0):switch(e.keyCode){case 38:return f.val(d.call(i,1+(f.val()<<0),0,255)),n.val("b",f.val(),e.target),!1;case 40:return f.val(d.call(i,(f.val()<<0)-1,0,255)),n.val("b",f.val(),e.target),!1}break;case v&&v.get(0):switch(e.keyCode){case 38:return v.val(d.call(i,parseFloat(v.val())+1,0,100)),n.val("a",Math.precision(255*v.val()/100,r),e.target),!1;case 40:return v.val(d.call(i,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(d.call(i,1+(m.val()<<0),0,360)),n.val("h",m.val(),e.target),!1;case 40:return m.val(d.call(i,(m.val()<<0)-1,0,360)),n.val("h",m.val(),e.target),!1}break;case _.get(0):switch(e.keyCode){case 38:return _.val(d.call(i,1+(_.val()<<0),0,100)),n.val("s",_.val(),e.target),!1;case 40:return _.val(d.call(i,(_.val()<<0)-1,0,100)),n.val("s",_.val(),e.target),!1}break;case b.get(0):switch(e.keyCode){case 38:return b.val(d.call(i,1+(b.val()<<0),0,100)),n.val("v",b.val(),e.target),!1;case 40:return b.val(d.call(i,(b.val()<<0)-1,0,100)),n.val("v",b.val(),e.target),!1}}}}function l(e){if(""!==e.target.value||e.target===y.get(0)||(null==a||e.target===a.get(0))&&null!=a){if(!u(e))return e;switch(e.target){case g.get(0):g.val(d.call(i,g.val(),0,255)),n.val("r",g.val(),e.target);break;case p.get(0):p.val(d.call(i,p.val(),0,255)),n.val("g",p.val(),e.target);break;case f.get(0):f.val(d.call(i,f.val(),0,255)),n.val("b",f.val(),e.target);break;case v&&v.get(0):v.val(d.call(i,v.val(),0,100)),n.val("a",Math.precision(255*v.val()/100,r),e.target);break;case m.get(0):m.val(d.call(i,m.val(),0,360)),n.val("h",m.val(),e.target);break;case _.get(0):_.val(d.call(i,_.val(),0,100)),n.val("s",_.val(),e.target);break;case b.get(0):b.val(d.call(i,b.val(),0,100)),n.val("v",b.val(),e.target);break;case y.get(0):y.val(y.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),a&&a.val(y.val()),n.val("hex",""!==y.val()?y.val():null,e.target);break;case a&&a.get(0):a.val(a.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),y.val(a.val()),n.val("hex",""!==a.val()?a.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 c(e){if(null!=n.val())switch(e.target){case g.get(0):g.val(n.val("r"));break;case p.get(0):p.val(n.val("g"));break;case f.get(0):f.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 _.get(0):_.val(n.val("s"));break;case b.get(0):b.val(n.val("v"));break;case y.get(0):case a&&a.get(0):y.val(n.val("hex")),a&&a.val(n.val("hex"));break;case x&&x.get(0):x.val(n.val("ahex").substring(6))}}function u(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 d(e,t,n){return""===e||isNaN(e)?t:e>n?n:e<t?t:e}function h(e,t){var n=e.val("all");t!==g.get(0)&&g.val(null!=n?n.r:""),t!==p.get(0)&&p.val(null!=n?n.g:""),t!==f.get(0)&&f.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!==_.get(0)&&_.val(null!=n?n.s:""),t!==b.get(0)&&b.val(null!=n?n.v:""),t!==y.get(0)&&(a&&t!==a.get(0)||!a)&&y.val(null!=n?n.hex:""),a&&t!==a.get(0)&&t!==y.get(0)&&a.val(null!=n?n.hex:""),x&&t!==x.get(0)&&x.val(null!=n?n.ahex.substring(6):"")}var g=o.eq(3),p=o.eq(4),f=o.eq(5),v=o.length>7?o.eq(6):null,m=o.eq(0),_=o.eq(1),b=o.eq(2),y=o.eq(o.length>7?7:6),x=o.length>7?o.eq(8):null;e.extend(!0,i,{destroy:function(){g.add(p).add(f).add(v).add(m).add(_).add(b).add(y).add(a).add(x).unbind("keyup",l).unbind("blur",c),g.add(p).add(f).add(v).add(m).add(_).add(b).unbind("keydown",s),n.unbind(h),g=null,p=null,f=null,v=null,m=null,_=null,b=null,y=null,x=null}}),g.add(p).add(f).add(v).add(m).add(_).add(b).add(y).add(a).add(x).bind("keyup",l).bind("blur",c),g.add(p).add(f).add(v).add(m).add(_).add(b).bind("keydown",s),n.bind(h)}(c,M.active,n.expandable&&n.bindToInput?n.input:null,n.alphaPrecision);var _=null!=i?i.hex:null,A=c.find(".Preview"),E=c.find(".Button");if(te=A.find(".Active:first").css({backgroundColor:_&&"#"+_||"transparent"}),ne=A.find(".Current:first").css({backgroundColor:_&&"#"+_||"transparent"}).bind("click",y),m.call(s,ne,Math.precision(100*M.current.val("a"))/255,4),ae=E.find(".Ok:first").bind("click",C),re=E.find(".Cancel:first").bind("click",x),ie=E.find(".Grid:first"),setTimeout(function(){f.call(s,U,L.clientPath+"Maps.png"),f.call(s,H,L.clientPath+"Maps.png"),f.call(s,z,L.clientPath+"map-opacity.png"),f.call(s,q,L.clientPath+"Bars.png"),f.call(s,W,L.clientPath+"Bars.png"),f.call(s,Y,L.clientPath+"Bars.png"),f.call(s,X,L.clientPath+"Bars.png"),f.call(s,K,L.clientPath+"bar-opacity.png"),f.call(s,Q,L.clientPath+"AlphaBar.png"),f.call(s,A.find("div:first"),L.clientPath+"preview-opacity.png")},0),c.find("td.Radio input").bind("click",b),M.quickList&&M.quickList.length>0){for(var G="",N=0;N<M.quickList.length;N++){"string"===_typeof(M.quickList[N]).toString().toLowerCase()&&(M.quickList[N]=new a({hex:M.quickList[N]}));var R=M.quickList[N].val("a"),O=M.quickList[N].val("ahex");!n.alphaSupport&&O&&(O=O.substring(0,6)+"ff");var V=M.quickList[N].val("hex");O||(O="00000000"),G+='<span class="QuickColor"'+(O&&' title="#'+O+'"'||"none")+' style="background-color:'+(V&&"#"+V||"")+";"+(V?"":"background-image:url("+L.clientPath+"NoColor.png)")+(n.alphaSupport&&R&&R<255?";opacity:"+Math.precision(R/255,4)+";filter:Alpha(opacity="+Math.precision(R/2.55,4)+")":"")+'"> </span>'}f.call(s,ie,L.clientPath+"bar-opacity.png"),ie.html(G),ie.find(".QuickColor").click(P)}u.call(s,l.color.mode),M.active.bind(d),"function"==typeof de&&M.active.bind(de),M.current.bind(w),n.expandable?(s.icon=r.parents(".Icon:first"),oe=s.icon.find(".Color:first").css({backgroundColor:_&&"#"+_||"transparent"}),se=s.icon.find(".Alpha:first"),f.call(s,se,L.clientPath+"bar-opacity.png"),m.call(s,se,Math.precision(100*(255-(null!=i?i.a:0))/255,4)),le=s.icon.find(".Image:first").css({backgroundImage:"url('"+L.clientPath+L.picker.file+"')"}).bind("click",S),n.bindToInput&&n.updateInputColor&&n.input.css({backgroundColor:_&&"#"+_||"transparent",color:null==i||i.v>75?"#000000":"#ffffff"}),ce=c.find(".Move:first").bind("mousedown",k),M.active.bind($)):T.call(s)}var L=l.images,I=l.localization,M={active:"string"===_typeof(l.color.active).toString().toLowerCase()?new a({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new a({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:"string"===_typeof(l.color.active).toString().toLowerCase()?new a({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new a({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),quickList:l.color.quickList},R=null,O=null,V=null,B=null,j=null,D=null,F=null,U=null,H=null,z=null,q=null,W=null,Y=null,X=null,K=null,Q=null,Z=null,J=null,ee=null,te=null,ne=null,ae=null,re=null,ie=null,oe=null,se=null,le=null,ce=null,ue="function"==typeof o[1]?o[1]:null,de="function"==typeof o[2]?o[2]:null,he="function"==typeof o[3]?o[3]:null;e.extend(!0,s,{commitCallback:ue,liveCallback:de,cancelCallback:he,color:M,show:T,hide:G,destroy:function(){j.find("td.Radio input").unbind("click",b),ne.unbind("click",y),re.unbind("click",x),ae.unbind("click",C),l.window.expandable&&(le.unbind("click",S),ce.unbind("mousedown",k),s.icon=null),j.find(".QuickColor").unbind("click",P),D=null,F=null,U=null,H=null,z=null,q=null,W=null,Y=null,X=null,K=null,Q=null,Z.destroy(),Z=null,J.destroy(),J=null,ee.destroy(),ee=null,te=null,ne=null,ae=null,re=null,ie=null,ue=null,he=null,de=null,j.html("");for(var e=0;e<r.length;e++)r[e]===s&&r.splice(e,1)}}),r.push(s),setTimeout(function(){N.call(s)},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 “OK” 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 “Hue” Color Mode",textbox:"Enter A “Hue” Value (0-360°)"},saturation:{radio:"Set To “Saturation” Color Mode",textbox:"Enter A “Saturation” Value (0-100%)"},value:{radio:"Set To “Value” Color Mode",textbox:"Enter A “Value” Value (0-100%)"},red:{radio:"Set To “Red” Color Mode",textbox:"Enter A “Red” Value (0-255)"},green:{radio:"Set To “Green” Color Mode",textbox:"Enter A “Green” Value (0-255)"},blue:{radio:"Set To “Blue” Color Mode",textbox:"Enter A “Blue” Value (0-255)"},alpha:{radio:"Set To “Alpha” Color Mode",textbox:"Enter A “Alpha” Value (0-100)"},hex:{textbox:"Enter A “Hex” Color Value (#000000-#ffffff)",alpha:"Enter A “Alpha” Value (#00-#ff)"}}}},e},$$a=jQuery,langParam=void 0,setStrings=function(e,t,n){var a=$$a("#svg_editor").parent();Object.entries(t).forEach(function(t){var r=slicedToArray(t,2),i=r[0],o=r[1];if(o||console.log(i),n&&(i="#"+i),a.find(i).length){var s=a.find(i)[0];switch(e){case"content":for(var l,c=0;l=s.childNodes[c];c++)if(3===l.nodeType&&l.textContent.trim()){l.textContent=o;break}break;case"title":s.title=o}}else console.log("Missing: "+i)})},editor_=void 0,init$7=function(e){editor_=e},readLang=function(){var e=asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,a,r,i,o,s,l,c,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,editor_.addLangData(langParam);case 2:if(n=e.sent,$$a.each(n,function(e,n){n.data&&(t=$$a.merge(t,n.data))}),t.tools){e.next=6;break}return e.abrupt("return");case 6:return r=(a=t).tools,i=a.properties,o=a.config,s=a.layers,l=a.common,c=a.ui,setStrings("content",{curve_segments:i.curve_segments,fitToContent:r.fitToContent,fit_to_all:r.fit_to_all,fit_to_canvas:r.fit_to_canvas,fit_to_layer_content:r.fit_to_layer_content,fit_to_sel:r.fit_to_sel,icon_large:o.icon_large,icon_medium:o.icon_medium,icon_small:o.icon_small,icon_xlarge:o.icon_xlarge,image_opt_embed:o.image_opt_embed,image_opt_ref:o.image_opt_ref,includedImages:o.included_images,largest_object:r.largest_object,layersLabel:s.layers,page:r.page,relativeToLabel:r.relativeTo,selLayerLabel:s.move_elems_to,selectedPredefined:o.select_predefined,selected_objects:r.selected_objects,smallest_object:r.smallest_object,straight_segments:i.straight_segments,svginfo_bg_url:o.editor_img_url+":",svginfo_bg_note:o.editor_bg_note,svginfo_change_background:o.background,svginfo_dim:o.doc_dims,svginfo_editor_prefs:o.editor_prefs,svginfo_height:l.height,svginfo_icons:o.icon_size,svginfo_image_props:o.image_props,svginfo_lang:o.language,svginfo_title:o.doc_title,svginfo_width:l.width,tool_docprops_cancel:l.cancel,tool_docprops_save:l.ok,tool_source_cancel:l.cancel,tool_source_save:l.ok,tool_prefs_cancel:l.cancel,tool_prefs_save:l.ok,sidepanel_handle:s.layers.split("").join(" "),tool_clear:r.new_doc,tool_docprops:r.docprops,tool_export:r.export_img,tool_import:r.import_doc,tool_open:r.open_doc,tool_save:r.save_doc,svginfo_units_rulers:o.units_and_rulers,svginfo_rulers_onoff:o.show_rulers,svginfo_unit:o.base_unit,svginfo_grid_settings:o.grid,svginfo_snap_onoff:o.snapping_onoff,svginfo_snap_step:o.snapping_stepsize,svginfo_grid_color:o.grid_color},!0),u={},$$a.each(["cut","copy","paste","paste_in_place","delete","group","ungroup","move_front","move_up","move_down","move_back"],function(){u['#cmenu_canvas a[href="#'+this+'"]']=r[this]}),$$a.each(["dupe","merge_down","merge_all"],function(){u['#cmenu_layers a[href="#'+this+'"]']=s[this]}),u['#cmenu_layers a[href="#delete"]']=s.del,setStrings("content",u),setStrings("title",{align_relative_to:r.align_relative_to,circle_cx:i.circle_cx,circle_cy:i.circle_cy,circle_r:i.circle_r,cornerRadiusLabel:i.corner_radius,ellipse_cx:i.ellipse_cx,ellipse_cy:i.ellipse_cy,ellipse_rx:i.ellipse_rx,ellipse_ry:i.ellipse_ry,fill_color:i.fill_color,font_family:i.font_family,idLabel:i.id,image_height:i.image_height,image_url:i.image_url,image_width:i.image_width,layer_delete:s.del,layer_down:s.move_down,layer_new:s.new,layer_rename:s.rename,layer_moreopts:l.more_opts,layer_up:s.move_up,line_x1:i.line_x1,line_x2:i.line_x2,line_y1:i.line_y1,line_y2:i.line_y2,linecap_butt:i.linecap_butt,linecap_round:i.linecap_round,linecap_square:i.linecap_square,linejoin_bevel:i.linejoin_bevel,linejoin_miter:i.linejoin_miter,linejoin_round:i.linejoin_round,main_icon:r.main_menu,palette:c.palette_info,zoom_panel:c.zoom_level,path_node_x:i.node_x,path_node_y:i.node_y,rect_height_tool:i.rect_height,rect_width_tool:i.rect_width,seg_type:i.seg_type,selLayerNames:s.move_selected,selected_x:i.pos_x,selected_y:i.pos_y,stroke_color:i.stroke_color,stroke_style:i.stroke_style,stroke_width:i.stroke_width,svginfo_title:o.doc_title,text:i.text_contents,toggle_stroke_tools:c.toggle_stroke_tools,tool_add_subpath:r.add_subpath,tool_alignbottom:r.align_bottom,tool_aligncenter:r.align_center,tool_alignleft:r.align_left,tool_alignmiddle:r.align_middle,tool_alignright:r.align_right,tool_aligntop:r.align_top,tool_angle:i.angle,tool_blur:i.blur,tool_bold:i.bold,tool_circle:r.mode_circle,tool_clone:r.clone,tool_clone_multi:r.clone,tool_delete:r.del,tool_delete_multi:r.del,tool_ellipse:r.mode_ellipse,tool_fhellipse:r.mode_fhellipse,tool_fhpath:r.mode_fhpath,tool_fhrect:r.mode_fhrect,tool_font_size:i.font_size,tool_group_elements:r.group_elements,tool_make_link:r.make_link,tool_link_url:r.set_link_url,tool_image:r.mode_image,tool_italic:i.italic,tool_line:r.mode_line,tool_move_bottom:r.move_bottom,tool_move_top:r.move_top,tool_node_clone:r.node_clone,tool_node_delete:r.node_delete,tool_node_link:r.node_link,tool_opacity:i.opacity,tool_openclose_path:r.openclose_path,tool_path:r.mode_path,tool_position:r.align_to_page,tool_rect:r.mode_rect,tool_redo:r.redo,tool_reorient:r.reorient_path,tool_select:r.mode_select,tool_source:r.source_save,tool_square:r.mode_square,tool_text:r.mode_text,tool_topath:r.to_path,tool_undo:r.undo,tool_ungroup:r.ungroup,tool_wireframe:r.wireframe_mode,tool_zoom:r.mode_zoom,url_notice:r.no_embed},!0),e.abrupt("return",{langParam:langParam,langData:t});case 15:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),putLocale=function(){var e=asyncToGenerator(regeneratorRuntime.mark(function e(t,n,a){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t?langParam=t:((langParam=$$a.pref("lang"))||(navigator.userLanguage?langParam=navigator.userLanguage:navigator.language&&(langParam=navigator.language)),console.log("Lang: "+langParam),n.includes(langParam)||"test"===langParam||(langParam="en")),r=a.langPath+"lang."+langParam+".js",e.t0=readLang,e.next=5,importSetGlobalDefault(r,{global:"svgEditorLang_"+langParam.replace(/-/g,"_")});case 5:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1));case 7:case"end":return e.stop()}},e,this)}));return function(t,n,a){return e.apply(this,arguments)}}();function loadStylesheets(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.before,a=t.after,r=t.favicon,i=t.canvas,o=t.image,s=void 0===o||o,l=t.acceptErrors;return e=Array.isArray(e)?e:[e],Promise.all(e.map(function(e){var t={};if(Array.isArray(e)){var o=slicedToArray(e,2);e=o[0];var c=o[1];t=void 0===c?{}:c}var u=t.favicon,d=void 0===u?r:u,h=t,g=h.before,p=void 0===g?n:g,f=h.after,v=void 0===f?a:f,m=h.canvas,_=void 0===m?i:m,b=h.image,y=void 0===b?s:b;function x(){p?p.before(C):v?v.after(C):document.head.appendChild(C)}var C=document.createElement("link");return new Promise(function(n,a){var r=a;if(l&&(r="function"==typeof l?function(r){l({error:r,stylesheetURL:e,options:t,resolve:n,reject:a})}:n),e.endsWith(".css")?d=!1:e.endsWith(".ico")&&(d=!0),d){if(C.rel="shortcut icon",C.type="image/x-icon",!1===y)return C.href=e,x(),void n(C);var i=document.createElement("canvas");i.width=16,i.height=16;var o=i.getContext("2d"),s=document.createElement("img");return s.addEventListener("error",function(e){a(e)}),s.addEventListener("load",function(){o.drawImage(s,0,0),C.href=_?i.toDataURL("image/x-icon"):e,x(),n(C)}),void(s.src=e)}C.rel="stylesheet",C.type="text/css",C.href=e,x(),C.addEventListener("error",function(e){r(e)}),C.addEventListener("load",function(){n(C)})})}))}var editor={},$$b=[jqPluginJSHotkeys,jqPluginBBQ,jqPluginSVGIcons,jqPluginJGraduate,jqPluginSpinBtn,jqPluginSVG,jQueryContextMenu,jPicker].reduce(function(e,t){return t(e)},jQuery),stylesheet="svg-editor.css";$$b.loadingStylesheets.includes(stylesheet)||$$b.loadingStylesheets.push(stylesheet);var favicon="images/logo.png";$$b.loadingStylesheets.some(function(e){return!Array.isArray(e)||e[0]!==favicon})&&$$b.loadingStylesheets.push([favicon,{favicon:!0}]),editor.tool_scale=1,editor.exportWindowCt=0,editor.langChanged=!1,editor.showSaveWarning=!1,editor.storagePromptClosed=!1;var callbacks=[],defaultPrefs={lang:"",iconsize:"",bkgd_color:"#FFF",bkgd_url:"",img_save:"embed",save_notice_done:!1,export_notice_done:!1},defaultExtensions=["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"],defaultConfig={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/",canvgPath:"canvg/",jspdfPath:"jspdf/",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},uiStrings$1=editor.uiStrings={},svgCanvas=void 0,urldata=void 0,isReady=!1,customExportImage=!1,customExportPDF=!1,curPrefs={},curConfig={extensions:[],stylesheets:[],allowedOrigins:[]};function loadSvgString(e,t){var n=!1!==svgCanvas.setSvgString(e);t=t||$$b.noop,n?t(!0):$$b.alert(uiStrings$1.notification.errorLoadingSVG,function(){t(!1)})}function getImportLocale(e){var t=e.defaultLang,n=e.defaultName;return function(){var e=asyncToGenerator(regeneratorRuntime.mark(function e(){var a,r=(a=asyncToGenerator(regeneratorRuntime.mark(function e(t){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=curConfig.extPath+"ext-locale/"+s+"/"+t+".js",e.abrupt("return",importSetGlobalDefault(n,{global:"svgEditorExtensionLocale_"+s+"_"+t}));case 2:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)}),i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=i.name,s=void 0===o?n:o,l=i.lang,c=void 0===l?t:l;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.abrupt("return",r(c));case 4:return e.prev=4,e.t0=e.catch(0),e.abrupt("return",r("en"));case 7:case"end":return e.stop()}},e,this,[[0,4]])}));return function(){return e.apply(this,arguments)}}()}$$b.pref=function(e,t){return t?(curPrefs[e]=t,void(editor.curPrefs=curPrefs)):e in curPrefs?curPrefs[e]:defaultPrefs[e]},editor.putLocale=putLocale,editor.readLang=readLang,editor.setStrings=setStrings,editor.loadContentAndPrefs=function(){if(curConfig.forceStorage||!curConfig.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/)){if(editor.storage&&(curConfig.forceStorage||!curConfig.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)store=prefsAndContent/))){var e="svgedit-"+curConfig.canvasName,t=editor.storage.getItem(e);t&&editor.loadFromString(t)}for(var n in defaultPrefs)if(defaultPrefs.hasOwnProperty(n)){var a="svg-edit-"+n;if(editor.storage){var r=editor.storage.getItem(a);r&&(defaultPrefs[n]=String(r))}else if(window.widget)defaultPrefs[n]=window.widget.preferenceForKey(a);else{var i=document.cookie.match(new RegExp("(?:^|;\\s*)"+regexEscape(encodeURIComponent(a))+"=([^;]+)"));defaultPrefs[n]=i?decodeURIComponent(i[1]):""}}}},editor.setConfig=function(e,t){function n(e,t,n){e[t]&&"object"===_typeof(e[t])?$$b.extend(!0,e[t],n):e[t]=n}t=t||{},$$b.each(e,function(a,r){if(e.hasOwnProperty(a))if(defaultPrefs.hasOwnProperty(a)){if(!1===t.overwrite&&(curConfig.preventAllURLConfig||curPrefs.hasOwnProperty(a)))return;!0===t.allowInitialUserOverride?defaultPrefs[a]=r:$$b.pref(a,r)}else if(["extensions","stylesheets","allowedOrigins"].includes(a)){if(!1===t.overwrite&&(curConfig.preventAllURLConfig||["allowedOrigins","stylesheets"].includes(a)||"extensions"===a&&curConfig.lockExtensions))return;curConfig[a]=curConfig[a].concat(r)}else if(defaultConfig.hasOwnProperty(a)){if(!1===t.overwrite&&(curConfig.preventAllURLConfig||curConfig.hasOwnProperty(a)))return;if(curConfig.hasOwnProperty(a)){if(!1===t.overwrite)return;n(curConfig,a,r)}else!0===t.allowInitialUserOverride?n(defaultConfig,a,r):defaultConfig[a]&&"object"===_typeof(defaultConfig[a])?(curConfig[a]={},$$b.extend(!0,curConfig[a],r)):curConfig[a]=r}}),editor.curConfig=curConfig},editor.setCustomHandlers=function(e){editor.ready(function(){e.open&&($$b('#tool_open > input[type="file"]').remove(),$$b("#tool_open").show(),svgCanvas.open=e.open),e.save&&(editor.showSaveWarning=!1,svgCanvas.bind("saved",e.save)),e.exportImage&&(customExportImage=e.exportImage,svgCanvas.bind("exported",customExportImage)),e.exportPDF&&(customExportPDF=e.exportPDF,svgCanvas.bind("exportedPDF",customExportPDF))})},editor.randomizeIds=function(e){return svgCanvas.randomizeIds(e)},editor.init=function(){!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)||Object.assign(defaultConfig,{langPath:"../dist/locale/",extPath:"../dist/extensions/",canvgPath:"../dist/",jspdfPath:"../dist/"});try{"localStorage"in window&&(editor.storage=localStorage)}catch(e){}var e=[];function t(){(curConfig=$$b.extend(!0,{},defaultConfig,curConfig)).noDefaultExtensions||(curConfig.extensions=curConfig.extensions.concat(defaultExtensions)),["extensions","stylesheets","allowedOrigins"].forEach(function(e){curConfig[e]=$$b.grep(curConfig[e],function(t,n){return n===curConfig[e].indexOf(t)})}),editor.curConfig=curConfig}$$b("#lang_select option").each(function(){e.push(this.value)}),function(){var e=void 0,n=void 0;if(urldata=$$b.deparam.querystring(!0),$$b.isEmptyObject(urldata))t(),editor.loadContentAndPrefs();else{if(urldata.dimensions&&(urldata.dimensions=urldata.dimensions.split(",")),urldata.bkgd_color&&(urldata.bkgd_color="#"+urldata.bkgd_color),urldata.extensions&&(urldata.extensions=urldata.extensions.match(/[:/\\]/)?"":urldata.extensions.split(",")),["extPath","imgPath","extIconsPath","canvgPath","langPath","jGraduatePath","jspdfPath"].forEach(function(e){urldata[e]&&delete urldata[e]}),editor.setConfig(urldata,{overwrite:!1}),t(),!curConfig.preventURLContentLoading){if(e=urldata.source,n=$$b.param.querystring(),e||n.includes("source=data:")&&(e=n.match(/source=(data:[^&]*)/)[1]),e)return void(e.startsWith("data:")?editor.loadFromDataURI(e):editor.loadFromString(e));if(urldata.url)return void editor.loadFromURL(urldata.url)}urldata.noStorageOnLoad&&!curConfig.forceStorage||editor.loadContentAndPrefs()}curPrefs=$$b.extend(!0,{},defaultPrefs,curPrefs),editor.curPrefs=curPrefs}();var n,a=editor.setIcon=function(e,t,n){var a="string"==typeof t?$$b.getSvgIcon(t,!0):t.clone();a?$$b(e).empty().append(a):console.log("NOTE: Icon image missing: "+t)},r=(n=asyncToGenerator(regeneratorRuntime.mark(function t(){var n,a,r,i=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,editor.putLocale(null,e,curConfig);case 2:return n=t.sent,a=n.langParam,r=n.langData,Qt(a,r),t.prev=6,t.next=9,Promise.all(curConfig.extensions.map(function(){var e=asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,r,o,s,l,c,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.match(/^ext-(.+)\.js/)){e.next=3;break}return e.abrupt("return");case 3:return r=curConfig.extPath+t,e.prev=4,e.next=7,importSetGlobalDefault(r,{global:"svgEditorExtension_"+n[1].replace(/-/g,"_")});case 7:return o=e.sent,s=o.name,l=void 0===s?n[1]:s,c=o.init,u=getImportLocale({defaultLang:a,defaultName:l}),e.abrupt("return",editor.addExtension(l,c&&c.bind(editor),u));case 13:e.prev=13,e.t0=e.catch(4),console.log(e.t0),console.error("Extension failed to load: "+t+"; "+e.t0);case 17:case"end":return e.stop()}},e,i,[[4,13]])}));return function(t){return e.apply(this,arguments)}}()));case 9:svgCanvas.bind("extensions_added",function(e,t){extensionsAdded=!0,messageQueue.forEach(function(e){svgCanvas.call("message",e)})}),svgCanvas.call("extensions_added"),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),console.log(t.t0);case 16:case"end":return t.stop()}},t,this,[[6,13]])})),function(){return n.apply(this,arguments)}),i={tool_scale:editor.tool_scale},o=function(){$$b(".tools_flyout").each(function(){var e=$$b("#"+this.id+"_show"),t=e.offset(),n=e.outerWidth();$$b(this).css({left:(t.left+n)*editor.tool_scale,top:t.top})})},s=function(){var e=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,t=document.getElementsByTagName("script")[0];for(var n in t.style)if(e.test(n))return n.match(e)[0];return"WebkitOpacity"in t.style?"Webkit":"KhtmlOpacity"in t.style?"Khtml":""}(),l=editor.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=$$b(t),a=1;if("number"==typeof e)a=e;else{a={s:.75,m:1,l:1.25,xl:1.5}[e]}i.tool_scale=editor.tool_scale=a,o();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=$$b(this),a=e.outerWidth()*(t-1),r=e.outerHeight()*(t-1),i=0;i<4;i++){var o=n[i],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+=a:"bottom"===o&&(l+=r),e.css("margin-"+o,l)}})}(n,a),r.css("visibility","visible").hide(),$$b.pref("iconsize",e),$$b("#iconsize").val(e);var l={"#tools_top":{left:50+$$b("#main_button").width(),height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}},c=$$b("#tool_size_rules");if(c.length?c.empty():c=$$b('<style id="tool_size_rules"></style>').appendTo("head"),"m"!==e){var u="";$$b.each(l,function(t,n){t="#svg_editor "+t.replace(/,/g,", #svg_editor"),u+=t+"{",$$b.each(n,function(t,n){var r=void 0;"number"==typeof n?r=n*a+"px":(n[e]||n.all)&&(r=n[e]||n.all),u+=t+":"+r+";"}),u+="}"});var d="-"+s.toLowerCase()+"-";u+=t+"{"+d+"transform: scale("+a+");} #svg_editor div.toolset .toolset {"+d+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+d+"transform: scale("+1/a+");}",c.text(u)}o()};$$b.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:24,h:24,id_match:!1,no_img:!isWebkit(),fallback_path:curConfig.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){$$b(".toolbar_button button > svg, .toolbar_button button > img").each(function(){$$b(this).parent().prepend(this)});var t=$$b("#tools_left"),n=void 0;t.length&&(n=t.offset().top+t.outerHeight());var a=$$b.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/jQuery.SpinButton.css":return 4;default:return 1/0}}editor.setIconSize(a||($$b(window).height()<n?"s":"m")),$$b(".tools_flyout").each(function(){var e=$$b("#"+this.id+"_show"),t=e.attr("data-curopt");if(!e.children("svg, img").length){var n=$$b(t).children().clone();n.length&&(n[0].removeAttribute("style"),e.append(n))}});var i=$$b.loadingStylesheets.sort(function(e,t){var n=r(e),a=r(t);return n===a?0:n>a});if(curConfig.stylesheets.length){var o,s=(i=[].concat(toConsumableArray(new Set(curConfig.stylesheets)))).indexOf("@default");if(s>-1)(o=i).splice.apply(o,[s,1].concat(toConsumableArray($$b.loadingStylesheets)))}loadStylesheets(i,{acceptErrors:function(e){var t=e.stylesheetURL,n=e.reject,a=e.resolve;$$b.loadingStylesheets.includes(t)?n(new Error("Missing expected stylesheet: "+t)):a()}}).then(function(){$$b("#svg_container")[0].style.visibility="visible",editor.runCallbacks(),setTimeout(function(){$$b(".flyout_arrow_horiz:empty").each(function(){$$b(this).append($$b.getSvgIcon("arrow_right").width(5).height(5))})},1)})}}),editor.canvas=svgCanvas=new SvgCanvas(document.getElementById("svgcanvas"),curConfig);var c=isMac()?"meta+":"ctrl+",u=svgCanvas.pathActions,d=svgCanvas.undoMgr,h=$$b("#workarea"),g=$$b("#cmenu_canvas"),p={fill:null,stroke:null},f=void 0,v=void 0,m=null,_=curConfig.imgPath+"logo.png",b="crosshair",y="crosshair",x="toolbars";!function(){var e=window.opener||window.parent;if(e)try{var t=new e.CustomEvent("svgEditorReady",{bubbles:!0,cancelable:!0});e.document.documentElement.dispatchEvent(t)}catch(e){}}(),function(){$$b("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");var e=$$b("#dialog_box"),t=$$b("#dialog_buttons"),n=$$b("#dialog_content"),a=function(a,r,i,o,s,l,c){n.html("<p>"+r.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt","prompt"===a),t.empty();var u=$$b('<input type="button" value="'+uiStrings$1.common.ok+'">').appendTo(t);"alert"!==a&&$$b('<input type="button" value="'+uiStrings$1.common.cancel+'">').appendTo(t).click(function(){e.hide(),i&&i(!1)});var d=void 0,h=void 0;if("prompt"===a)(d=$$b('<input type="text">').prependTo(t)).val(o||""),d.bind("keydown","return",function(){u.click()});else if("select"===a){var g=$$b('<div style="text-align:center;">');if(d=$$b("<select>").appendTo(g),c){var p=$$b("<label>").text(c.label);(h=$$b('<input type="checkbox">').appendTo(p)).val(c.value),c.tooltip&&p.attr("title",c.tooltip),h.prop("checked",!!c.checked),g.append($$b("<div>").append(p))}$$b.each(s||[],function(e,t){"object"===(void 0===t?"undefined":_typeof(t))?d.append($$b("<option>").val(t.value).html(t.text)):d.append($$b("<option>").html(t))}),n.append(g),o&&d.val(o),l&&d.bind("change","return",l),d.bind("keydown","return",function(){u.click()})}else"process"===a&&u.hide();e.show(),u.click(function(){e.hide();var t="prompt"!==a&&"select"!==a||d.val();i&&(h?i(t,h.prop("checked")):i(t))}).focus(),"prompt"!==a&&"select"!==a||d.focus()};$$b.alert=function(e,t){a("alert",e,t)},$$b.confirm=function(e,t){a("confirm",e,t)},$$b.process_cancel=function(e,t){a("process",e,t)},$$b.prompt=function(e,t,n){a("prompt",e,n,t)},$$b.select=function(e,t,n,r,i,o){a("select",e,n,i,t,r,o)}}();for(var C=function(){var e=$$b(".tool_button_current");e.length&&"tool_select"!==e[0].id&&(e.removeClass("tool_button_current").addClass("tool_button"),$$b("#tool_select").addClass("tool_button_current").removeClass("tool_button"),$$b("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}")),svgCanvas.setMode("select"),h.css("cursor","auto")},S=$$b("title:first").text(),w=[],$=.1;$<1e5;$*=10)w.push($),w.push(2*$),w.push(5*$);var k=function(e){var t=void 0,n=[],a=svgCanvas.getCurrentDrawing().getNumLayers();for(t=0;t<a;t++)n[t]=svgCanvas.getCurrentDrawing().getLayerName(t);if(e)for(t=0;t<a;++t)n[t]!==e&&svgCanvas.getCurrentDrawing().setLayerOpacity(n[t],.5);else for(t=0;t<a;++t)svgCanvas.getCurrentDrawing().setLayerOpacity(n[t],1)},A=function(){svgCanvas.clearSelection();for(var e=$$b("#layerlist tbody").empty(),t=$$b("#selLayerNames").empty(),n=svgCanvas.getCurrentDrawing(),a=n.getCurrentLayerName(),r=$$b.getSvgIcon("eye"),i=svgCanvas.getCurrentDrawing().getNumLayers();i--;){var o=n.getLayerName(i),s=$$b('<tr class="layer">').toggleClass("layersel",o===a),l=$$b('<td class="layervis">').toggleClass("layerinvis",!n.getLayerVisibility(o)),c=$$b('<td class="layername">'+o+"</td>");e.append(s.append(l,c)),t.append('<option value="'+o+'">'+o+"</option>")}if(void 0!==r){var u=r.clone();$$b("td.layervis",e).append(u),$$b.resizeSvgIcons({"td.layervis .svg_icon":14})}$$b("#layerlist td.layername").mouseup(function(e){$$b("#layerlist tr.layer").removeClass("layersel"),$$b(this.parentNode).addClass("layersel"),svgCanvas.setCurrentLayer(this.textContent),e.preventDefault()}).mouseover(function(){k(this.textContent)}).mouseout(function(){k()}),$$b("#layerlist td.layervis").click(function(){var e=$$b(this.parentNode).prevAll().length,t=$$b("#layerlist tr.layer:eq("+e+") td.layername").text(),n=$$b(this).hasClass("layerinvis");svgCanvas.setLayerVisibility(t,n),$$b(this).toggleClass("layerinvis")});for(var d=5-$$b("#layerlist tr.layer").size();d-- >0;)e.append('<tr><td style="color:white">_</td><td/></tr>')},E=!1,P="",T=function(e,t){E||(E=!0,P=svgCanvas.getSvgString(),$$b("#save_output_btns").toggle(!!t),$$b("#tool_source_back").toggle(!t),$$b("#svg_source_textarea").val(P),$$b("#svg_source_editor").fadeIn(),$$b("#svg_source_textarea").focus())},G=null,N=!1,L=function(){window.opera&&$$b("<p/>").hide().appendTo("body").remove()};function I(e,t){var n=e.id,r=n.split("_"),i=r[0],o=r[1];t&&svgCanvas.setStrokeAttr("stroke-"+i,o),L(),a("#cur_"+i,n,20),$$b(e).addClass("current").siblings().removeClass("current")}var M=editor.toolButtonClick=function(e,t){if($$b(e).hasClass("disabled"))return!1;if($$b(e).parent().hasClass("tools_flyout"))return!0;return t||$$b(".tools_flyout").fadeOut("normal"),$$b("#styleoverrides").text(""),h.css("cursor","auto"),$$b(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),$$b(e).addClass("tool_button_current").removeClass("tool_button"),!0},R=editor.clickSelect=function(){M("#tool_select")&&(svgCanvas.setMode("select"),$$b("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}"))},O=editor.setImageURL=function(e){e||(e=_),svgCanvas.setImageURL(e),$$b("#image_url").val(e),e.startsWith("data:")?($$b("#image_url").hide(),$$b("#change_image_url").show()):(svgCanvas.embedImage(e,function(t){$$b("#url_notice").toggle(!t),_=e}),$$b("#image_url").show(),$$b("#change_image_url").hide())};function V(e,t){$$b.pref("bkgd_color",e),$$b.pref("bkgd_url",t),svgCanvas.setBackground(e,t)}function B(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).cancelDeletes,t=void 0!==e&&e,n=svgCanvas.getHref(G);n=n.startsWith("data:")?"":n,$$b.prompt(uiStrings$1.notification.enterNewImgURL,n,function(e){e?O(e):t&&svgCanvas.deleteSelectedElements()})}function j(e,t){t||(t=svgCanvas.getZoom()),e||(e=$$b("#svgcanvas"));var n=void 0,a=void 0,r=svgCanvas.getContentElem(),i=getTypeMap()[curConfig.baseUnit];for(n=0;n<2;n++){var o=0===n,s=o?"x":"y",l=o?"width":"height",c=Number(r.getAttribute(s)),u=$$b("#ruler_"+s+" canvas:first"),d=u.clone();u.replaceWith(d);var h=d[0],g=e[l](),p=g;h.parentNode.style[l]=p+"px";var f=h.getContext("2d"),v=void 0,m=void 0,_=void 0;if(f.fillStyle="rgb(200,0,0)",f.fillRect(0,0,h.width,h.height),d.siblings().remove(),g>=3e4){_=parseInt(g/3e4,10)+1,(v=[])[0]=f;var b=void 0;for(a=1;a<_;a++)h[l]=3e4,b=h.cloneNode(!0),h.parentNode.append(b),v[a]=b.getContext("2d");b[l]=g%3e4,g=3e4}h[l]=g;var y=i*t,x=50/y,C=1;for(a=0;a<w.length&&(C=m=w[a],!(x<=m));a++);var S=C*y;f.font="9px sans-serif";for(var $=c/y%C*y,k=$-S,A=0;$<p;){k+=S;var E=Math.round($)+.5;o?(f.moveTo(E,15),f.lineTo(E,0)):(f.moveTo(15,E),f.lineTo(0,E)),m=(k-c)/y;var P=void 0;if(C>=1)P=Math.round(m);else{var T=String(C).split(".")[1].length;P=m.toFixed(T)}if(0!==P&&1e3!==P&&P%1e3==0&&(P=P/1e3+"K"),o)f.fillText(P,$+2,8);else{var G=String(P).split("");for(a=0;a<G.length;a++)f.fillText(G[a],1,$+9+9*a)}var N=S/10;for(a=1;a<10;a++){var L=Math.round($+N*a)+.5;if(v&&L>g){if(A++,f.stroke(),A>=_){a=10,$=p;continue}f=v[A],$-=3e4,L=Math.round($+N*a)+.5}var I=a%2?12:10;o?(f.moveTo(L,15),f.lineTo(L,I)):(f.moveTo(15,L),f.lineTo(I,L))}$+=S}f.strokeStyle="#000",f.stroke()}}var D=editor.updateCanvas=function(e,t){var n=svgCanvas.getZoom(),a=h,r=$$b("#svgcanvas"),i=h.width(),o=h.height(),s=i,l=o,c=a[0].scrollLeft+s/2,u=a[0].scrollTop+l/2,d=curConfig.canvas_expansion;i=Math.max(s,svgCanvas.contentW*n*d),o=Math.max(l,svgCanvas.contentH*n*d),i===s&&o===l?h.css("overflow","hidden"):h.css("overflow","scroll");var g=r.height()/2,p=r.width()/2;r.width(i).height(o);var f=o/2,v=i/2,m=svgCanvas.updateCanvas(i,o),_=v/p,b=i/2-s/2,y=o/2-l/2;t?(t.x+=m.x,t.y+=m.y):t={x:v+(c-p)*_,y:f+(u-g)*_};e?svgCanvas.contentW>a.width()?(h[0].scrollLeft=m.x-10,h[0].scrollTop=m.y-10):(a[0].scrollLeft=b,a[0].scrollTop=y):(a[0].scrollLeft=t.x-s/2,a[0].scrollTop=t.y-l/2),curConfig.showRulers&&(j(r,n),h.scroll()),!0===urldata.storagePrompt||editor.storagePromptClosed||$$b("#dialog_box").hide()},F=function(){var e=void 0,t=void 0,n="none"===svgCanvas.getColor("fill"),a="none"===svgCanvas.getColor("stroke"),r=["#tool_fhpath","#tool_line"],i=["#tools_rect .tool_button","#tools_ellipse .tool_button","#tool_text","#tool_path"];if(a)for(e in r)$$b(t=r[e]).hasClass("tool_button_current")&&R(),$$b(t).addClass("disabled");else for(e in r)$$b(t=r[e]).removeClass("disabled");if(a&&n)for(e in i)$$b(t=i[e]).hasClass("tool_button_current")&&R(),$$b(t).addClass("disabled");else for(e in i)$$b(t=i[e]).removeClass("disabled");svgCanvas.runExtensions("toolButtonStateUpdate",{nofill:n,nostroke:a}),$$b(".tools_flyout").each(function(){var e=$$b("#"+this.id+"_show"),t=!1;$$b(this).children().each(function(){$$b(this).hasClass("disabled")||(t=!0)}),e.toggleClass("disabled",!t)}),L()},U=function(){var e=G;null==e||e.parentNode||(e=null);var t=svgCanvas.getCurrentDrawing().getCurrentLayerName(),n=svgCanvas.getMode(),r="px"!==curConfig.baseUnit?curConfig.baseUnit:null,i="pathedit"===n,o=$$b("#cmenu_canvas li");if($$b("#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=svgCanvas.getRotationAngle(e);$$b("#angle").val(l);var c=svgCanvas.getBlur(e);if($$b("#blur").val(c),$$b("#blur_slider").slider("option","value",c),svgCanvas.addedNew&&"image"===s&&"image"===svgCanvas.getMode()&&(svgCanvas.getHref(e).startsWith("data:")||B({cancelDeletes:!0})),i||"pathedit"===n){var h=u.getNodePoint();if($$b("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"),$$b("#tool_node_delete").toggleClass("disabled",!u.canDeleteNodes),a("#tool_openclose_path",u.closed_subpath?"open_path":"close_path"),h){var p=$$b("#seg_type");r&&(h.x=convertUnit(h.x),h.y=convertUnit(h.y)),$$b("#path_node_x").val(h.x),$$b("#path_node_y").val(h.y),h.type?p.val(h.type).removeAttr("disabled"):p.val(4).attr("disabled","disabled")}return}if($$b("#selected_panel").show(),["line","circle","ellipse"].includes(s))$$b("#xy_panel").hide();else{var f=void 0,v=void 0;if(["g","polyline","path"].includes(s)){var m=svgCanvas.getStrokedBBox([e]);m&&(f=m.x,v=m.y)}else f=e.getAttribute("x"),v=e.getAttribute("y");r&&(f=convertUnit(f),v=convertUnit(v)),$$b("#selected_x").val(f||0),$$b("#selected_y").val(v||0),$$b("#xy_panel").show()}var _=!["image","text","path","g","use"].includes(s);$$b("#tool_topath").toggle(_),$$b("#tool_reorient").toggle("path"===s),$$b("#tool_reorient").toggleClass("disabled",0===l);var b={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:[]},y=e.tagName,x=null;if("a"===y&&(x=svgCanvas.getHref(e),$$b("#g_panel").show()),"a"===e.parentNode.tagName&&($$b(e).siblings().length||($$b("#a_panel").show(),x=svgCanvas.getHref(e.parentNode))),$$b("#tool_make_link, #tool_make_link").toggle(!x),x&&$$b("#link_url").val(x),b[y]){var C=b[y];if($$b("#"+y+"_panel").show(),$$b.each(C,function(t,n){var a=e.getAttribute(n);if("px"!==curConfig.baseUnit&&e[n]){var r=e[n].baseVal.value;a=convertUnit(r)}$$b("#"+y+"_"+n).val(a||0)}),"text"===y)$$b("#text_panel").css("display","inline"),$$b("#tool_font_size").css("display","inline"),svgCanvas.getItalic()?$$b("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):$$b("#tool_italic").removeClass("push_button_pressed").addClass("tool_button"),svgCanvas.getBold()?$$b("#tool_bold").addClass("push_button_pressed").removeClass("tool_button"):$$b("#tool_bold").removeClass("push_button_pressed").addClass("tool_button"),$$b("#font_family").val(e.getAttribute("font-family")),$$b("#font_size").val(e.getAttribute("font-size")),$$b("#text").val(e.textContent),svgCanvas.addedNew&&setTimeout(function(){$$b("#text").focus().select()},100);else if("image"===y&&"image"===svgCanvas.getMode())O(svgCanvas.getHref(e));else if("g"===y||"use"===y){$$b("#container_panel").show();var S=svgCanvas.getTitle(),w=$$b("#g_title")[0];w.value=S,function(e){var t=Math.min(Math.max(12+6*e.value.length,50),300);$$b(e).width(t)}(w),$$b("#g_title").prop("disabled","use"===y)}}o[("g"===y?"en":"dis")+"ableContextMenuItems"]("#ungroup"),o[("g"!==y&&N?"en":"dis")+"ableContextMenuItems"]("#group")}else N?($$b("#multiselected_panel").show(),o.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")):o.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");$$b("#tool_undo").toggleClass("disabled",0===d.getUndoStackSize()),$$b("#tool_redo").toggleClass("disabled",0===d.getRedoStackSize()),svgCanvas.addedNew=!1,e&&!i||N?($$b("#selLayerNames").removeAttr("disabled").val(t),g.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")):$$b("#selLayerNames").attr("disabled","disabled")},H=function(){if(!Gt){var e="#workarea.wireframe #svgcontent * { stroke-width: "+1/svgCanvas.getZoom()+"px; }";$$b("#wireframe_rules").text(h.hasClass("wireframe")?e:"")}},z="",q=function(e){e=e||svgCanvas.getDocumentTitle();var t=S+(e?": "+e:"");$$b("title:first").text(t)};function W(e){return e&&"g"===e.tagName&&Layer.CLASS_REGEX.test(e.getAttribute("class"))}var Y=function(){H()},X=svgCanvas.zoomChanged=function(e,t,n){var a=h,r=svgCanvas.setBBoxZoom(t,a.width()-15,a.height()-15);if(r){var i=r.zoom,o=r.bbox;i<.001?K({value:.1}):($$b("#zoom").val((100*i).toFixed(1)),n?D():D(!1,{x:o.x*i+o.width*i/2,y:o.y*i+o.height*i/2}),"zoom"===svgCanvas.getMode()&&o.width&&C(),Y())}},K=function(e){var t=e.value/100;if(t<.001)e.value=.1;else{var n=svgCanvas.getZoom(),a=h;X(window,{width:0,height:0,x:(a[0].scrollLeft+a.width()/2)/n,y:(a[0].scrollTop+a.height()/2)/n,zoom:t},!0)}};$$b("#cur_context_panel").delegate("a","click",function(){var e=$$b(this);return e.attr("data-root")?svgCanvas.leaveContext():svgCanvas.setContext(e.text()),svgCanvas.clearSelection(),!1});var Q=function(){p.fill.prep(),p.stroke.prep()},Z={},J=function(){$$b(".tools_flyout").each(function(){var e=$$b("#"+this.id+"_show");if(!e.data("isLibrary")){var t=[];$$b(this).children().each(function(){t.push(this.title)}),e[0].title=t.join(" / ")}})},ee=function(e){$$b.each(e,function(t,n){var a=$$b(t).children(),r=t+"_show",i=$$b(r),o=!1;a.addClass("tool_button").unbind("click mousedown mouseup").each(function(t){var a=n[t];Z[a.sel]=a.fn,a.isDefault&&(o=t);var s=function(t){var n=a;if("keydown"===t.type){var o=$$b(n.parent+"_show").hasClass("tool_button_current"),s=$$b(n.parent+"_show").attr("data-curopt");$$b.each(e[a.parent],function(r,i){i.sel===s&&(n=t.shiftKey&&o?e[a.parent][r+1]||e[a.parent][0]:i)})}if($$b(this).hasClass("disabled"))return!1;M(r)&&n.fn();var l=void 0;(l=n.icon?$$b.getSvgIcon(n.icon,!0):$$b(n.sel).children().eq(0).clone())[0].setAttribute("width",i.width()),l[0].setAttribute("height",i.height()),i.children(":not(.flyout_arrow_horiz)").remove(),i.append(l).attr("data-curopt",n.sel)};$$b(this).mouseup(s),a.key&&$$b(document).bind("keydown",a.key[0]+" shift+"+a.key[0],s)}),o?i.attr("data-curopt",n[o].sel):i.attr("data-curopt")||i.attr("data-curopt",n[0].sel);var s=void 0,l=$$b(r).position();i.mousedown(function(e){if(i.hasClass("disabled"))return!1;var n=$$b(t),a=l.left+34,r=-1*n.width(),o=n.data("shown_popop")?200:0;s=setTimeout(function(){i.data("isLibrary")?n.css("left",a).show():n.css("left",r).show().animate({left:a},150),n.data("shown_popop",!0)},o),e.preventDefault()}).mouseup(function(e){clearTimeout(s);var t=$$b(this).attr("data-curopt");i.data("isLibrary")&&$$b(r.replace("_show","")).is(":visible")?M(r,!0):M(r)&&Z[t]&&Z[t]()})}),J(),o()},te=function(e,t){return $$b("<div>",{class:"tools_flyout",id:e}).appendTo("#svg_editor").append(t)},ne=function(e,t,n,r){var i=$$b(e),o=r.dropUp;t=$$b(t),o&&$$b(e).addClass("dropup"),t.find("li").bind("mouseup",function(){r.seticon&&(a("#cur_"+i[0].id,$$b(this).children()),$$b(this).addClass("current").siblings().removeClass("current")),n.apply(this,arguments)});var s=!1;$$b(window).mouseup(function(e){s||(i.removeClass("down"),t.hide(),t.css({top:0,left:0})),s=!1}),i.bind("mousedown",function(){var e=i.offset();o?(e.top-=t.height(),e.left+=8):e.top+=i.height(),t.offset(e),i.hasClass("down")?(t.hide(),t.css({top:0,left:0})):(t.show(),s=!0),i.toggleClass("down")}).hover(function(){s=!0}).mouseout(function(){s=!1}),r.multiclick&&t.mousedown(function(){s=!0})},ae=[];svgCanvas.bind("selected",function(e,t){var n=svgCanvas.getMode();"select"===n&&C();var r="pathedit"===n;G=1===t.length||null==t[1]?t[0]:null,N=t.length>=2&&null!=t[1],null!=G&&(r||function(){var e=void 0,t=void 0;if(null!=G)switch(G.tagName){case"use":case"image":case"foreignObject":break;case"g":case"a":var n=G.getElementsByTagName("*"),a=null;for(e=0,t=n.length;e<t;e++){var r=n[e].getAttribute("stroke-width");0===e?a=r:a!==r&&(a=null)}$$b("#stroke_width").val(null===a?"":a),p.fill.update(!0),p.stroke.update(!0);break;default:p.fill.update(!0),p.stroke.update(!0),$$b("#stroke_width").val(G.getAttribute("stroke-width")||1),$$b("#stroke_style").val(G.getAttribute("stroke-dasharray")||"none");var i=G.getAttribute("stroke-linejoin")||"miter";$$b("#linejoin_"+i).length&&I($$b("#linejoin_"+i)[0]),i=G.getAttribute("stroke-linecap")||"butt",$$b("#linecap_"+i).length&&I($$b("#linecap_"+i)[0])}if(null!=G){var o=100*(G.getAttribute("opacity")||1);$$b("#group_opacity").val(o),$$b("#opac_slider").slider("option","value",o),$$b("#elem_id").val(G.id),$$b("#elem_class").val(G.getAttribute("class"))}F()}()),function(e,t){$$b("#path_node_panel").toggle(e),$$b("#tools_bottom_2,#tools_bottom_3").toggle(!e),e?($$b(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),$$b("#tool_select").addClass("tool_button_current").removeClass("tool_button"),a("#tool_select","select_node"),N=!1,t.length&&(G=t[0])):setTimeout(function(){a("#tool_select","select")},1e3)}(r,t),U(),svgCanvas.runExtensions("selectedChanged",{elems:t,selectedElement:G,multiselected:N})}),svgCanvas.bind("transition",function(e,t){var n=svgCanvas.getMode(),a=t[0];if(a){if(!(N=t.length>=2&&null!=t[1]))switch(n){case"rotate":var r=svgCanvas.getRotationAngle(a);$$b("#angle").val(r),$$b("#tool_reorient").toggleClass("disabled",0===r)}svgCanvas.runExtensions("elementTransition",{elems:t})}}),svgCanvas.bind("changed",function(e,t){var n=svgCanvas.getMode();"select"===n&&C();for(var a=0;a<t.length;++a){var r=t[a],i=r&&"svg"===r.tagName;i||W(r)?(A(),i&&D()):r&&G&&null==G.parentNode&&(G=r)}editor.showSaveWarning=!0,U(),G&&"select"===n&&(p.fill.update(),p.stroke.update()),svgCanvas.runExtensions("elementChanged",{elems:t})}),svgCanvas.bind("saved",function(e,t){if(editor.showSaveWarning=!1,t='<?xml version="1.0"?>\n'+t,isIE())T(0,!0);else{var n=document.createElement("a");n.href="data:image/svg+xml;base64,"+encode64(t),n.download="icon.svg",n.click();var a=$$b.pref("save_notice_done");if("all"!==a){var r=uiStrings$1.notification.saveFromBrowser.replace("%s","SVG");isGecko()?t.includes("<defs")?(r+="\n\n"+uiStrings$1.notification.defsFailOnSave,$$b.pref("save_notice_done","all"),a="all"):$$b.pref("save_notice_done","part"):$$b.pref("save_notice_done","all"),"part"!==a&&alert(r)}}}),svgCanvas.bind("exported",function(e,t){var n=t.issues,a=t.exportWindowName;if(a&&(m=window.open(blankPageObjectURL||"",a)),m&&!m.closed){if(m.location.href=t.bloburl||t.datauri,"all"!==$$b.pref("export_notice_done")){var r=uiStrings$1.notification.saveFromBrowser.replace("%s",t.type);n.length&&(r+="\n\n"+uiStrings$1.notification.noteTheseIssues+"\n • "+n.join("\n • ")),$$b.pref("export_notice_done","all"),m.alert(r)}}else $$b.alert(uiStrings$1.notification.popupWindowBlocked)}),svgCanvas.bind("exportedPDF",function(e,t){var n=t.exportWindowName;n&&(m=window.open("",n)),m&&!m.closed?m.location.href=t.output:$$b.alert(uiStrings$1.notification.popupWindowBlocked)}),svgCanvas.bind("zoomed",X),svgCanvas.bind("zoomDone",Y),svgCanvas.bind("updateCanvas",function(e,t){var n=t.center,a=t.newCtr;D(n,a)}),svgCanvas.bind("contextset",function(e,t){var n="";if(t){var a="";n='<a href="#" data-root="y">'+svgCanvas.getCurrentDrawing().getCurrentLayerName()+"</a>",$$b(t).parentsUntil("#svgcontent > g").andSelf().each(function(){this.id&&(a+=" > "+this.id,n+=this!==t?' > <a href="#">'+this.id+"</a>":" > "+this.id)}),z=a}else z=null;$$b("#cur_context_panel").toggle(!!t).html(n),q()}),svgCanvas.bind("extension_added",function(e,t){if(t){var n=!1,a=!1;if(t.langReady)if(editor.langChanged){var r=$$b.pref("lang");t.langReady({lang:r,uiStrings:uiStrings$1,importLocale:getImportLocale({defaultLang:r,defaultName:t.name})})}else ae.push(t);var i=function(){t.callback&&!n&&(n=!0,t.callback.call(editor))},o=[];t.context_tools&&$$b.each(t.context_tools,function(e,t){var n=t.container_id?' id="'+t.container_id+'"':"",a=$$b("#"+t.panel);a.length||(a=$$b("<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 i=$$b(r).appendTo(a);t.events&&$$b.each(t.events,function(e,t){$$b(i).bind(e,t)});break;case"select":r="<label"+n+'><select id="'+t.id+'">',$$b.each(t.options,function(e,n){var a=e===t.defval?" selected":"";r+='<option value="'+e+'"'+a+">"+n+"</option>"});var s=$$b(r+="</select></label>").appendTo(a).find("select");$$b.each(t.events,function(e,t){$$b(s).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=$$b('<ul id="'+t.id+'_opts"></ul>').appendTo("#option_lists");t.colnum&&l.addClass("optcols"+t.colnum),$$b(r).appendTo(a).children(),o.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 c=$$b(r).appendTo(a).find("input");t.spindata&&c.SpinButton(t.spindata),t.events&&$$b.each(t.events,function(e,t){c.bind(e,t)})}});var s=t.svgicons;if(t.buttons){var c={},u={},d={};$$b.each(t.buttons,function(e,t){for(var n=t.id,a=e;$$b("#"+n).length;)n=t.id+"_"+ ++a;var r=void 0;if(s){c[n]=t.icon;var i=t.svgicon||t.id;"app_menu"===t.type?u["#"+n+" > div"]=i:u["#"+n]=i}else r=$$b('<img src="'+t.icon+'">');var o=void 0,l=void 0;switch(t.type){case"mode_flyout":case"mode":o="tool_button",l="#tools_left";break;case"context":o="tool_button",l="#"+t.panel,$$b(l).length||$$b("<div>",{id:t.panel}).appendTo("#tools_top");break;case"app_menu":o="",l="#main_menu ul"}var h=void 0,g=void 0,p=void 0,f=void 0,v=void 0,m=$$b(t.list||"app_menu"===t.type?"<li/>":"<div/>").attr("id",n).attr("title",t.title).addClass(o);if(t.includeWith||t.list){if(t.list){if(m.addClass("push_button"),$$b("#"+t.list+"_opts").append(m),t.isDefault){$$b("#cur_"+t.list).append(m.children().clone());var _=t.svgicon||t.id;u["#cur_"+t.list]=_}}else if(t.includeWith){var b=t.includeWith;h=(v=$$b(b.button)).parent();var y=void 0;v.parent().hasClass("tools_flyout")||(y=v[0].id.replace("tool_","tools_"),p=v.clone().attr("id",y+"_show").append($$b("<div>",{class:"flyout_arrow_horiz"})),v.before(p),h=te(y,v)),f=zt.getButtonData(b.button),b.isDefault&&(u["#"+y+"_show"]=t.id),g=d["#"+h[0].id]=[{sel:"#"+n,fn:t.events.click,icon:t.id,key:t.key,isDefault:t.includeWith?t.includeWith.isDefault:0},f];var x="position"in b?b.position:"last",C=h.children().length;!isNaN(x)&&x>=0&&x<C?h.children().eq(x).before(m):(h.append(m),g.reverse())}}else if("position"in t?$$b(l).children().eq(t.position).length?$$b(l).children().eq(t.position).before(m):$$b(l).children().last().before(m):m.appendTo(l),"mode_flyout"===t.type){h=(v=$$b(m)).parent();var S=void 0;v.parent().hasClass("tools_flyout")||(S=v[0].id.replace("tool_","tools_"),p=v.clone().attr("id",S+"_show").append($$b("<div>",{class:"flyout_arrow_horiz"})),v.before(p),(h=te(S,v)).data("isLibrary",!0),p.data("isLibrary",!0)),u["#"+S+"_show"]=t.id,g=d["#"+h[0].id]=[{sel:"#"+n,fn:t.events.click,icon:t.id,isDefault:!0},f]}else"app_menu"===t.type&&m.append("<div>").append(t.title);s||m.append(r),t.list||$$b.each(t.events,function(e,n){"click"===e&&"mode"===t.type?(t.includeWith?m.bind(e,n):m.bind(e,function(){M(m)&&n()}),t.key&&($$b(document).bind("keydown",t.key,n),t.title&&m.attr("title",t.title+" ["+t.key+"]"))):m.bind(e,n)}),ee(d)}),$$b.each(o,function(){ne(this.elem,this.list,this.callback,{seticon:!0})}),s&&$$b.svgIcons(s,{w:24,h:24,id_match:!1,no_img:!isWebkit(),fallback:c,placement:u,callback:function(e){"m"!==$$b.pref("iconsize")&&(f&&(clearTimeout(f),f=null),a||(f=setTimeout(function(){a=!0,l($$b.pref("iconsize"))},50))),i()}})}s||i()}}),svgCanvas.textActions.setInputElem($$b("#text")[0]);var re='<div class="palette_item" data-rgb="none"></div>';$$b.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){re+='<div class="palette_item" style="background-color: '+t+';" data-rgb="'+t+'"></div>'}),$$b("#palette").append(re);re="",$$b.each(["#FFF","#888","#000"],function(){re+='<div class="color_block" style="background-color:'+this+';"></div>'}),$$b("#bg_blocks").append(re);var ie=$$b("#bg_blocks div");ie.each(function(){$$b(this).click(function(){ie.removeClass("cur_background"),$$b(this).addClass("cur_background")})}),V($$b.pref("bkgd_color"),$$b.pref("bkgd_url")),$$b("#image_save_opts input").val([$$b.pref("img_save")]);var oe=function(e,t){null==t&&(t=e.value),$$b("#group_opacity").val(t),e&&e.handle||$$b("#opac_slider").slider("option","value",t),svgCanvas.setOpacity(t/100)},se=function(e,t,n){null==t&&(t=e.value),$$b("#blur").val(t);var a=!1;e&&e.handle||($$b("#blur_slider").slider("option","value",t),a=!0),n?svgCanvas.setBlurNoUndo(t):svgCanvas.setBlur(t,a)};$$b("#stroke_style").change(function(){svgCanvas.setStrokeAttr("stroke-dasharray",$$b(this).val()),L()}),$$b("#stroke_linejoin").change(function(){svgCanvas.setStrokeAttr("stroke-linejoin",$$b(this).val()),L()}),$$b("select").change(function(){$$b(this).blur()});var le,ce,ue,de,he,ge=!1;$$b("#selLayerNames").change(function(){var e=this.options[this.selectedIndex].value,t=uiStrings$1.notification.QmoveElemsToLayer.replace("%s",e),n=function(t){t&&(ge=!0,svgCanvas.moveSelectedToLayer(e),svgCanvas.clearSelection(),A())};e&&(ge?n(!0):$$b.confirm(t,n))}),$$b("#font_family").change(function(){svgCanvas.setFontFamily(this.value)}),$$b("#seg_type").change(function(){svgCanvas.setSegType($$b(this).val())}),$$b("#text").bind("keyup input",function(){svgCanvas.setTextContent(this.value)}),$$b("#image_url").change(function(){O(this.value)}),$$b("#link_url").change(function(){this.value.length?svgCanvas.setLinkURL(this.value):svgCanvas.removeHyperlink()}),$$b("#g_title").change(function(){svgCanvas.setGroupTitle(this.value)}),$$b(".attr_changer").change(function(){var e=this.getAttribute("data-attr"),t=this.value;if(!isValidUnit(e,t,G))return $$b.alert(uiStrings$1.notification.invalidAttrValGiven),this.value=G.getAttribute(e),!1;if("id"!==e&&"class"!==e)if(isNaN(t))t=svgCanvas.convertToNum(e,t);else if("px"!==curConfig.baseUnit){var n=getTypeMap();(G[e]||"pathedit"===svgCanvas.getMode()||"x"===e||"y"===e)&&(t*=n[curConfig.baseUnit])}if("id"===e){var a=G;svgCanvas.clearSelection(),a.id=t,svgCanvas.addToSelection([a],!0)}else svgCanvas.changeSelectedAttribute(e,t);this.blur()}),$$b("#palette").mouseover(function(){var e=$$b('<input type="hidden">');$$b(this).append(e),e.focus().remove()}),$$b(".palette_item").mousedown(function(e){var t=e.shiftKey||2===e.button?"stroke":"fill",n=$$b(this).data("rgb"),a=void 0;"none"===n||"transparent"===n||"initial"===n?(n="none",a=new $$b.jGraduate.Paint):a=new $$b.jGraduate.Paint({alpha:100,solidColor:n.substr(1)}),p[t].setPaint(a),svgCanvas.setColor(t,n),"none"!==n&&1!==svgCanvas.getPaintOpacity(t)&&svgCanvas.setPaintOpacity(t,1),F()}).bind("contextmenu",function(e){e.preventDefault()}),$$b("#toggle_stroke_tools").on("click",function(){$$b("#tools_bottom").toggleClass("expanded")}),le=h[0],ce=null,ue=null,de=!1,he=!1,$$b("#svgcanvas").bind("mousemove mouseup",function(e){if(!1!==de)return le.scrollLeft-=e.clientX-ce,le.scrollTop-=e.clientY-ue,ce=e.clientX,ue=e.clientY,"mouseup"===e.type&&(de=!1),!1}).mousedown(function(e){if(1===e.button||!0===he)return de=!0,ce=e.clientX,ue=e.clientY,!1}),$$b(window).mouseup(function(){de=!1}),$$b(document).bind("keydown","space",function(e){svgCanvas.spaceKey=he=!0,e.preventDefault()}).bind("keyup","space",function(e){e.preventDefault(),svgCanvas.spaceKey=he=!1}).bind("keydown","shift",function(e){"zoom"===svgCanvas.getMode()&&h.css("cursor",y)}).bind("keyup","shift",function(e){"zoom"===svgCanvas.getMode()&&h.css("cursor",b)}),editor.setPanning=function(e){svgCanvas.spaceKey=he=e},function(){var e=$$b("#main_icon"),t=$$b("#main_icon span"),n=$$b("#main_menu"),a=!1,r=0,i=!0,o=!1;$$b(window).mouseup(function(t){a||(e.removeClass("buttondown"),"INPUT"!==t.target.tagName?n.fadeOut(200):o||(o=!0,$$b(t.target).click(function(){n.css("margin-left","-9999px").show()}))),a=!1}).mousedown(function(e){$$b(e.target).closest("div.tools_flyout, .contextMenu").length||$$b(".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),a=!0),e.toggleClass("buttondown buttonup")}).hover(function(){a=!0}).mouseout(function(){a=!1});var s=$$b("#main_menu li");s.mouseover(function(){i="rgba(0, 0, 0, 0)"===$$b(this).css("background-color"),s.unbind("mouseover"),i&&s.mouseover(function(){this.style.backgroundColor="#FFC"}).mouseout(function(){return this.style.backgroundColor="transparent",!0})})}(),editor.addDropDown=function(e,t,n){if($$b(e).length){var a=$$b(e).find("button"),r=$$b(e).find("ul").attr("id",$$b(e)[0].id+"-list");n?$$b(e).addClass("dropup"):$$b("#option_lists").append(r),r.find("li").bind("mouseup",t);var i=!1;$$b(window).mouseup(function(e){i||(a.removeClass("down"),r.hide()),i=!1}),a.bind("mousedown",function(){if(a.hasClass("down"))r.hide();else{if(!n){var t=$$b(e).position();r.css({top:t.top+24,left:t.left-10})}r.show(),i=!0}a.toggleClass("down")}).hover(function(){i=!0}).mouseout(function(){i=!1})}},editor.addDropDown("#font_family_dropdown",function(){$$b("#font_family").val($$b(this).text()).change()}),editor.addDropDown("#opacity_dropdown",function(){if(!$$b(this).find("div").length){var e=parseInt($$b(this).text().split("%")[0],10);oe(!1,e)}},!0),$$b("#opac_slider").slider({start:function(){$$b("#opacity_dropdown li:not(.special)").hide()},stop:function(){$$b("#opacity_dropdown li").show(),$$b(window).mouseup()},slide:function(e,t){oe(t)}}),editor.addDropDown("#blur_dropdown",$$b.noop);var pe,fe,ve=!1;$$b("#blur_slider").slider({max:10,step:.1,stop:function(e,t){ve=!1,se(t),$$b("#blur_dropdown li").show(),$$b(window).mouseup()},start:function(){ve=!0},slide:function(e,t){se(t,null,ve)}}),editor.addDropDown("#zoom_dropdown",function(){var e=$$b(this),t=e.data("val");t?X(window,t):K({value:parseFloat(e.text())})},!0),ne("#stroke_linecap","#linecap_opts",function(){I(this,!0)},{dropUp:!0}),ne("#stroke_linejoin","#linejoin_opts",function(){I(this,!0)},{dropUp:!0}),ne("#tool_position","#position_opts",function(){var e=this.id.replace("tool_pos","").charAt(0);svgCanvas.alignSelectedElements(e,"page")},{multiclick:!0}),pe=void 0,fe=function(){$$b(pe).blur()},$$b("#svg_editor").find("button, select, input:not(#text)").focus(function(){pe=this,x="toolbars",h.mousedown(fe)}).blur(function(){x="canvas",h.unbind("mousedown",fe),"textedit"===svgCanvas.getMode()&&$$b("#text").focus()});var me=function(){M("#tool_fhpath")&&svgCanvas.setMode("fhpath")},_e=function(){M("#tool_line")&&svgCanvas.setMode("line")},be=function(){M("#tool_square")&&svgCanvas.setMode("square")},ye=function(){M("#tool_rect")&&svgCanvas.setMode("rect")},xe=function(){M("#tool_fhrect")&&svgCanvas.setMode("fhrect")},Ce=function(){M("#tool_circle")&&svgCanvas.setMode("circle")},Se=function(){M("#tool_ellipse")&&svgCanvas.setMode("ellipse")},we=function(){M("#tool_fhellipse")&&svgCanvas.setMode("fhellipse")},$e=function(){M("#tool_image")&&svgCanvas.setMode("image")},ke=function(){M("#tool_zoom")&&(svgCanvas.setMode("zoom"),h.css("cursor",b))},Ae=function(e){var t=svgCanvas.getResolution();e=e?t.zoom*e:1,$$b("#zoom").val(100*e),svgCanvas.setZoom(e),Y(),D(!0)},Ee=function(){M("#tool_zoom")&&(Ae(),C())},Pe=function(){M("#tool_text")&&svgCanvas.setMode("text")},Te=function(){M("#tool_path")&&svgCanvas.setMode("path")},Ge=function(){(null!=G||N)&&svgCanvas.deleteSelectedElements()},Ne=function(){(null!=G||N)&&svgCanvas.cutSelectedElements()},Le=function(){(null!=G||N)&&svgCanvas.copySelectedElements()},Ie=function(){var e=svgCanvas.getZoom(),t=(h[0].scrollLeft+h.width()/2)/e-svgCanvas.contentW,n=(h[0].scrollTop+h.height()/2)/e-svgCanvas.contentH;svgCanvas.pasteElements("point",t,n)},Me=function(){null!=G&&svgCanvas.moveToTopSelectedElement()},Re=function(){null!=G&&svgCanvas.moveToBottomSelectedElement()},Oe=function(e){null!=G&&svgCanvas.moveUpDownSelected(e)},Ve=function(){null!=G&&svgCanvas.convertToPath()},Be=function(){null!=G&&u.reorient()},je=function(){(null!=G||N)&&$$b.prompt(uiStrings$1.notification.enterNewLinkURL,"http://",function(e){e&&svgCanvas.makeHyperlink(e)})},De=function(e,t){if(null!=G||N){if(curConfig.gridSnapping){var n=svgCanvas.getZoom()*curConfig.snappingStep;e*=n,t*=n}svgCanvas.moveSelectedElements(e,t)}},Fe=function(){$$b("#tool_node_link").toggleClass("push_button_pressed tool_button");var e=$$b("#tool_node_link").hasClass("push_button_pressed");u.linkControlPoints(e)},Ue=function(){u.getNodePoint()&&u.clonePathNode()},He=function(){u.getNodePoint()&&u.deletePathNode()},ze=function(){var e=$$b("#tool_add_subpath"),t=!e.hasClass("push_button_pressed");e.toggleClass("push_button_pressed tool_button"),u.addSubPath(t)},qe=function(){u.opencloseSubPath()},We=function(){svgCanvas.cycleElement(1)},Ye=function(){svgCanvas.cycleElement(0)},Xe=function(e,t){if(null!=G&&!N){e||(t*=-1);var n=parseFloat($$b("#angle").val())+t;svgCanvas.setRotationAngle(n),U()}},Ke=function(){var e=curConfig.dimensions;$$b.confirm(uiStrings$1.notification.QwantToClear,function(t){t&&(C(),svgCanvas.clear(),svgCanvas.setResolution(e[0],e[1]),D(!0),Ae(),A(),U(),Q(),svgCanvas.runExtensions("onNewDocument"))})},Qe=function(){return svgCanvas.setBold(!svgCanvas.getBold()),U(),!1},Ze=function(){return svgCanvas.setItalic(!svgCanvas.getItalic()),U(),!1},Je=void 0,et=function(){$$b.select("Select an image type for export: ",["PNG","JPEG","BMP","WEBP","PDF"],function(e){if(e){var t=void 0;if("PDF"===e)customExportPDF||a(),svgCanvas.exportPDF(t);else{customExportImage||a();var n=parseInt($$b("#image-slider").val(),10)/100;svgCanvas.rasterExport(e,n,t)}}function a(){var e=uiStrings$1.notification.loadingImage;"new"===curConfig.exportWindowType&&editor.exportWindowCt++,t=curConfig.canvasName+editor.exportWindowCt;var n=void 0,a=void 0;if(Je)a=Je;else{if(n='<!DOCTYPE html><html><head><meta charset="utf-8"><title>'+e+"</title></head><body><h1>"+e+"</h1></body><html>",("undefined"==typeof URL||_typeof(URL))&&URL.createObjectURL){var r=new Blob([n],{type:"text/html"});a=URL.createObjectURL(r)}else a="data:text/html;base64;charset=utf-8,"+encode64(n);Je=a}m=window.open(a,t)}},function(){var e=$$b(this);"JPEG"===e.val()||"WEBP"===e.val()?$$b("#image-slider").length||$$b("<div><label>"+uiStrings$1.ui.quality+'\n <input id="image-slider"\n type="range" min="1" max="100" value="92" />\n </label></div>').appendTo(e.parent()):$$b("#image-slider").parent().remove()})},tt=function(){svgCanvas.open()},nt=function(){},at=function(){d.getUndoStackSize()>0&&(d.undo(),A())},rt=function(){d.getRedoStackSize()>0&&(d.redo(),A())},it=function(){N?svgCanvas.groupSelectedElements():G&&svgCanvas.ungroupSelectedElement()},ot=function(){svgCanvas.cloneSelectedElements(20,20)},st=function(){var e=this.id.replace("tool_align","").charAt(0);svgCanvas.alignSelectedElements(e,$$b("#align_relative_to").val())},lt=function(){if($$b("#tool_wireframe").toggleClass("push_button_pressed tool_button"),h.toggleClass("wireframe"),!Gt){var e=$$b("#wireframe_rules");e.length?e.empty():e=$$b('<style id="wireframe_rules"></style>').appendTo("head"),H()}};$$b("#svg_docprops_container, #svg_prefs_container").draggable({cancel:"button,fieldset",containment:"window"}).css("position","absolute");var ct,ut,dt=!1,ht=!1,gt=function(){if(!dt){dt=!0,$$b("#image_save_opts input").val([$$b.pref("img_save")]);var e=svgCanvas.getResolution();"px"!==curConfig.baseUnit&&(e.w=convertUnit(e.w)+curConfig.baseUnit,e.h=convertUnit(e.h)+curConfig.baseUnit),$$b("#canvas_width").val(e.w),$$b("#canvas_height").val(e.h),$$b("#canvas_title").val(svgCanvas.getDocumentTitle()),$$b("#svg_docprops").show()}},pt=function(){$$b("#svg_source_editor").hide(),E=!1,$$b("#svg_source_textarea").blur()},ft=function(){if(E){var e=function(){svgCanvas.clearSelection(),pt(),Ae(),A(),q(),Q()};svgCanvas.setSvgString($$b("#svg_source_textarea").val())?e():$$b.confirm(uiStrings$1.notification.QerrorsRevertToSource,function(t){if(!t)return!1;e()}),C()}},vt=function(){$$b("#svg_docprops").hide(),$$b("#canvas_width,#canvas_height").removeAttr("disabled"),$$b("#resolution")[0].selectedIndex=0,$$b("#image_save_opts input").val([$$b.pref("img_save")]),dt=!1},mt=function(){$$b("#svg_prefs").hide(),ht=!1},_t=function(){var e=$$b("#canvas_title").val();q(e),svgCanvas.setDocumentTitle(e);var t=$$b("#canvas_width"),n=t.val(),a=$$b("#canvas_height"),r=a.val();return"fit"===n||isValidUnit("width",n)?(t.parent().removeClass("error"),"fit"===r||isValidUnit("height",r)?(a.parent().removeClass("error"),svgCanvas.setResolution(n,r)?($$b.pref("img_save",$$b("#image_save_opts :checked").val()),D(),void vt()):($$b.alert(uiStrings$1.notification.noContentToFitTo),!1)):($$b.alert(uiStrings$1.notification.invalidAttrValGiven),a.parent().addClass("error"),!1)):($$b.alert(uiStrings$1.notification.invalidAttrValGiven),t.parent().addClass("error"),!1)},bt=editor.savePreferences=function(){V($$b("#bg_blocks div.cur_background").css("background-color")||"#FFF",$$b("#canvas_bg_url").val());var t=$$b("#lang_select").val();t!==$$b.pref("lang")&&editor.putLocale(t,e,curConfig),l($$b("#iconsize").val()),curConfig.gridSnapping=$$b("#grid_snapping_on")[0].checked,curConfig.snappingStep=$$b("#grid_snapping_step").val(),curConfig.gridColor=$$b("#grid_color").val(),curConfig.showRulers=$$b("#show_rulers")[0].checked,$$b("#rulers").toggle(curConfig.showRulers),curConfig.showRulers&&j(),curConfig.baseUnit=$$b("#base_unit").val(),svgCanvas.setConfig(curConfig),D(),mt()},yt=$$b.noop,xt=function(){$$b("#dialog_box").hide(),E||dt||ht?(E?P!==$$b("#svg_source_textarea").val()?$$b.confirm(uiStrings$1.notification.QignoreSourceChanges,function(e){e&&pt()}):pt():dt?vt():ht&&mt(),yt()):z&&svgCanvas.leaveContext()},Ct={width:$$b(window).width(),height:$$b(window).height()};if(isIE()&&(yt=function(){0===h[0].scrollLeft&&0===h[0].scrollTop&&(h[0].scrollLeft=v.left,h[0].scrollTop=v.top)},v={left:h[0].scrollLeft,top:h[0].scrollTop},$$b(window).resize(yt),editor.ready(function(){setTimeout(function(){yt()},500)}),h.scroll(function(){v={left:h[0].scrollLeft,top:h[0].scrollTop}})),$$b(window).resize(function(e){$$b.each(Ct,function(e,t){var n=$$b(window)[e]();h[0]["scroll"+("width"===e?"Left":"Top")]-=(n-t)/2,Ct[e]=n}),o()}),h.scroll(function(){$$b("#ruler_x").length&&($$b("#ruler_x")[0].scrollLeft=h[0].scrollLeft),$$b("#ruler_y").length&&($$b("#ruler_y")[0].scrollTop=h[0].scrollTop)}),$$b("#url_notice").click(function(){$$b.alert(this.title)}),$$b("#change_image_url").click(B),ct="tool_button_current",ut="",$$b.each(["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],function(e,t){ut+=(e?",":"")+"#tool_"+t}),$$b(ut).mousedown(function(){$$b(this).addClass(ct)}).bind("mousedown mouseout",function(){$$b(this).removeClass(ct)}),$$b("#tool_undo, #tool_redo").mousedown(function(){$$b(this).hasClass("disabled")||$$b(this).addClass(ct)}).bind("mousedown mouseout",function(){$$b(this).removeClass(ct)}),isMac()&&!window.opera)for(var St=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"],wt=St.length;wt--;){var $t=document.getElementById(St[wt]);if($t){var kt=$t.title,At=kt.indexOf("Ctrl+");$t.title=[kt.substr(0,At),"Cmd+",kt.substr(At+5)].join("")}}var Et=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",a=e.offset(),r=p[t].paint;$$b("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(curConfig.colorPickerCSS||{left:a.left-140,bottom:40}).jGraduate({paint:r,window:{pickerTitle:n},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(e){r=new $$b.jGraduate.Paint(e),p[t].setPaint(r),svgCanvas.setPaint(t,r),$$b("#color_picker").hide()},function(){$$b("#color_picker").hide()})},Pt=function(e,t){var n=void 0,a=void 0,r=curConfig["fill"===t?"initFill":"initStroke"],i=(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;(i=$$b(e)[0].appendChild(document.importNode(i,!0))).setAttribute("width",16.5),this.rect=i.firstChild,this.defs=i.getElementsByTagName("defs")[0],this.grad=this.defs.firstChild,this.paint=new $$b.jGraduate.Paint({solidColor:r.color}),this.type=t,this.setPaint=function(e,t){this.paint=e;var r=e.type,i=e.alpha/100,o="none";switch(r){case"solidColor":o="none"!==e[r]?"#"+e[r]:e[r];break;case"linearGradient":case"radialGradient":this.grad.remove(),this.grad=this.defs.appendChild(e[r]),o="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",o),this.rect.setAttribute("opacity",i),t&&(svgCanvas.setColor(this.type,n,!0),svgCanvas.setPaintOpacity(this.type,a,!0))},this.update=function(e){if(G){var t=this.type;switch(G.tagName){case"use":case"image":case"foreignObject":return;case"g":case"a":for(var r=G.getElementsByTagName("*"),i=null,o=0,s=r.length;o<s;o++){var l=r[o].getAttribute(t);if(0===o)i=l;else if(i!==l){i=null;break}}if(null===i)return void(n=null);n=i,a=1;break;default:a=parseFloat(G.getAttribute(t+"-opacity")),isNaN(a)&&(a=1);var c="fill"===t?"black":"none";n=G.getAttribute(t)||c}e&&(svgCanvas.setColor(t,n,!0),svgCanvas.setPaintOpacity(t,a,!0));var u=function(e,t,n){var a={alpha:t};if(e.startsWith("url(#")){var r=svgCanvas.getRefElem(e);a[(r=r?r.cloneNode(!0):$$b("#"+n+"_color defs *")[0]).tagName]=r}else e.startsWith("#")?a.solidColor=e.substr(1):a.solidColor="none";return new $$b.jGraduate.Paint(a)}(n,a*=100,t);this.setPaint(u)}},this.prep=function(){switch(this.paint.type){case"linearGradient":case"radialGradient":var e=new $$b.jGraduate.Paint({copy:this.paint});svgCanvas.setPaint(t,e)}}};p.fill=new Pt("#fill_color","fill"),p.stroke=new Pt("#stroke_color","stroke"),$$b("#stroke_width").val(curConfig.initStroke.width),$$b("#group_opacity").val(100*curConfig.initOpacity);var Tt=p.fill.rect.cloneNode(!1);Tt.setAttribute("style","vector-effect:non-scaling-stroke");var Gt="non-scaling-stroke"===Tt.style.vectorEffect;Tt.removeAttribute("style");var Nt,Lt,It=p.fill.rect.ownerDocument.createElementNS(NS.SVG,"feGaussianBlur");function Mt(){svgCanvas.deleteCurrentLayer()&&(U(),A(),$$b("#layerlist tr.layer").removeClass("layersel"),$$b("#layerlist tr.layer:first").addClass("layersel"))}function Rt(e){var t=svgCanvas.getCurrentDrawing().getNumLayers(),n=$$b("#layerlist tr.layersel").index();(n>0||n<t-1)&&(n+=e,svgCanvas.setCurrentLayerPosition(t-n-1),A())}void 0===It.stdDeviationX&&$$b("#tool_blur").hide(),$$b(It).remove(),Nt="-"+s.toLowerCase()+"-zoom-",Lt=Nt+"in",h.css("cursor",Lt),h.css("cursor")===Lt&&(b=Lt,y=Nt+"out"),h.css("cursor","auto"),setTimeout(function(){svgCanvas.embedImage("images/logo.png",function(e){e||($$b("#image_save_opts [value=embed]").attr("disabled","disabled"),$$b("#image_save_opts input").val(["ref"]),$$b.pref("img_save","ref"),$$b("#image_opt_embed").css("color","#666").attr("title",uiStrings$1.notification.featNotSupported))})},1e3),$$b("#fill_color, #tool_fill .icon_label").click(function(){Et($$b("#fill_color")),F()}),$$b("#stroke_color, #tool_stroke .icon_label").click(function(){Et($$b("#stroke_color")),F()}),$$b("#group_opacityLabel").click(function(){$$b("#opacity_dropdown button").mousedown(),$$b(window).mouseup()}),$$b("#zoomLabel").click(function(){$$b("#zoom_dropdown button").mousedown(),$$b(window).mouseup()}),$$b("#tool_move_top").mousedown(function(e){$$b("#tools_stacking").show(),e.preventDefault()}),$$b(".layer_button").mousedown(function(){$$b(this).addClass("layer_buttonpressed")}).mouseout(function(){$$b(this).removeClass("layer_buttonpressed")}).mouseup(function(){$$b(this).removeClass("layer_buttonpressed")}),$$b(".push_button").mousedown(function(){$$b(this).hasClass("disabled")||$$b(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){$$b(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){$$b(this).removeClass("push_button_pressed").addClass("push_button")}),$$b("#layer_new").click(function(){var e=void 0,t=svgCanvas.getCurrentDrawing().getNumLayers();do{e=uiStrings$1.layers.layer+" "+ ++t}while(svgCanvas.getCurrentDrawing().hasLayer(e));$$b.prompt(uiStrings$1.notification.enterUniqueLayerName,e,function(e){e&&(svgCanvas.getCurrentDrawing().hasLayer(e)?$$b.alert(uiStrings$1.notification.dupeLayerName):(svgCanvas.createLayer(e),U(),A()))})}),$$b("#layer_delete").click(Mt),$$b("#layer_up").click(function(){Rt(-1)}),$$b("#layer_down").click(function(){Rt(1)}),$$b("#layer_rename").click(function(){var e=$$b("#layerlist tr.layersel td.layername").text();$$b.prompt(uiStrings$1.notification.enterNewLayerName,"",function(t){t&&(e===t||svgCanvas.getCurrentDrawing().hasLayer(t)?$$b.alert(uiStrings$1.notification.layerHasThatName):(svgCanvas.renameCurrentLayer(t),A()))})});var Ot=-1,Vt=!1,Bt=!1,jt=function(e){var t=$$b("#ruler_x");$$b("#sidepanels").width("+="+e),$$b("#layerpanel").width("+="+e),t.css("right",parseInt(t.css("right"),10)+e),h.css("right",parseInt(h.css("right"),10)+e),svgCanvas.runExtensions("workareaResized")},Dt=function(e){if(Bt&&-1!==Ot){Vt=!0;var t=Ot-e.pageX,n=$$b("#sidepanels").width();n+t>300?(t=300-n,n=300):n+t<2&&(t=2-n,n=2),0!==t&&(Ot-=t,jt(t))}},Ft=function(e){var t=$$b("#sidepanels").width();jt((t>2||e?2:150)-t)};$$b("#sidepanel_handle").mousedown(function(e){Ot=e.pageX,$$b(window).mousemove(Dt),Bt=!1,setTimeout(function(){Bt=!0},20)}).mouseup(function(e){Vt||Ft(),Ot=-1,Vt=!1}),$$b(window).mouseup(function(){Ot=-1,Vt=!1,$$b("#svg_editor").unbind("mousemove",Dt)}),A();$$b(window).bind("load resize",function(){h.css("line-height",h.height()+"px")}),$$b("#resolution").change(function(){var e=$$b("#canvas_width,#canvas_height");if(this.selectedIndex)if("content"===this.value)e.val("fit").attr("disabled","disabled");else{var t=this.value.split("x");$$b("#canvas_width").val(t[0]),$$b("#canvas_height").val(t[1]),e.removeAttr("disabled")}else"fit"===$$b("#canvas_width").val()&&e.removeAttr("disabled").val(100)}),$$b("input,select").attr("autocomplete","off");var Ut,Ht,zt=(Ut=[{sel:"#tool_select",fn:R,evt:"click",key:["V",!0]},{sel:"#tool_fhpath",fn:me,evt:"click",key:["Q",!0]},{sel:"#tool_line",fn:_e,evt:"click",key:["L",!0]},{sel:"#tool_rect",fn:ye,evt:"mouseup",key:["R",!0],parent:"#tools_rect",icon:"rect"},{sel:"#tool_square",fn:be,evt:"mouseup",parent:"#tools_rect",icon:"square"},{sel:"#tool_fhrect",fn:xe,evt:"mouseup",parent:"#tools_rect",icon:"fh_rect"},{sel:"#tool_ellipse",fn:Se,evt:"mouseup",key:["E",!0],parent:"#tools_ellipse",icon:"ellipse"},{sel:"#tool_circle",fn:Ce,evt:"mouseup",parent:"#tools_ellipse",icon:"circle"},{sel:"#tool_fhellipse",fn:we,evt:"mouseup",parent:"#tools_ellipse",icon:"fh_ellipse"},{sel:"#tool_path",fn:Te,evt:"click",key:["P",!0]},{sel:"#tool_text",fn:Pe,evt:"click",key:["T",!0]},{sel:"#tool_image",fn:$e,evt:"mouseup"},{sel:"#tool_zoom",fn:ke,evt:"mouseup",key:["Z",!0]},{sel:"#tool_clear",fn:Ke,evt:"mouseup",key:["N",!0]},{sel:"#tool_save",fn:function(){var e;E?ft():(e={images:$$b.pref("img_save"),round_digits:6},svgCanvas.save(e))},evt:"mouseup",key:["S",!0]},{sel:"#tool_export",fn:et,evt:"mouseup"},{sel:"#tool_open",fn:tt,evt:"mouseup",key:["O",!0]},{sel:"#tool_import",fn:nt,evt:"mouseup"},{sel:"#tool_source",fn:T,evt:"click",key:["U",!0]},{sel:"#tool_wireframe",fn:lt,evt:"click",key:["F",!0]},{sel:"#tool_source_cancel,.overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:xt,evt:"click",key:["esc",!1,!1],hidekey:!0},{sel:"#tool_source_save",fn:ft,evt:"click"},{sel:"#tool_docprops_save",fn:_t,evt:"click"},{sel:"#tool_docprops",fn:gt,evt:"mouseup"},{sel:"#tool_prefs_save",fn:bt,evt:"click"},{sel:"#tool_prefs_option",fn:function(){return function(){if(!ht){ht=!0,$$b("#main_menu").hide();var e=$$b("#bg_blocks div"),t="cur_background",n=curPrefs.bkgd_color,a=$$b.pref("bkgd_url");e.each(function(){var e=$$b(this),a=e.css("background-color")===n;e.toggleClass(t,a),a&&$$b("#canvas_bg_url").removeClass(t)}),n||e.eq(0).addClass(t),a&&$$b("#canvas_bg_url").val(a),$$b("#grid_snapping_on").prop("checked",curConfig.gridSnapping),$$b("#grid_snapping_step").attr("value",curConfig.snappingStep),$$b("#grid_color").attr("value",curConfig.gridColor),$$b("#svg_prefs").show()}}(),!1},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:Ge,evt:"click",key:["del/backspace",!0]},{sel:"#tool_reorient",fn:Be,evt:"click"},{sel:"#tool_node_link",fn:Fe,evt:"click"},{sel:"#tool_node_clone",fn:Ue,evt:"click"},{sel:"#tool_node_delete",fn:He,evt:"click"},{sel:"#tool_openclose_path",fn:qe,evt:"click"},{sel:"#tool_add_subpath",fn:ze,evt:"click"},{sel:"#tool_move_top",fn:Me,evt:"click",key:"ctrl+shift+]"},{sel:"#tool_move_bottom",fn:Re,evt:"click",key:"ctrl+shift+["},{sel:"#tool_topath",fn:Ve,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:je,evt:"click"},{sel:"#tool_undo",fn:at,evt:"click"},{sel:"#tool_redo",fn:rt,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:ot,evt:"click",key:["D",!0]},{sel:"#tool_group_elements",fn:it,evt:"click",key:["G",!0]},{sel:"#tool_ungroup",fn:it,evt:"click"},{sel:"#tool_unlink_use",fn:it,evt:"click"},{sel:"[id^=tool_align]",fn:st,evt:"click"},{sel:"#tool_bold",fn:Qe,evt:"mousedown"},{sel:"#tool_italic",fn:Ze,evt:"mousedown"},{sel:"#sidepanel_handle",fn:Ft,key:["X"]},{sel:"#copy_save_done",fn:xt,evt:"click"},{key:"ctrl+left",fn:function(){Xe(0,1)}},{key:"ctrl+right",fn:function(){Xe(1,1)}},{key:"ctrl+shift+left",fn:function(){Xe(0,5)}},{key:"ctrl+shift+right",fn:function(){Xe(1,5)}},{key:"shift+O",fn:Ye},{key:"shift+P",fn:We},{key:[c+"up",!0],fn:function(){Ae(2)}},{key:[c+"down",!0],fn:function(){Ae(.5)}},{key:[c+"]",!0],fn:function(){Oe("Up")}},{key:[c+"[",!0],fn:function(){Oe("Down")}},{key:["up",!0],fn:function(){De(0,-1)}},{key:["down",!0],fn:function(){De(0,1)}},{key:["left",!0],fn:function(){De(-1,0)}},{key:["right",!0],fn:function(){De(1,0)}},{key:"shift+up",fn:function(){De(0,-10)}},{key:"shift+down",fn:function(){De(0,10)}},{key:"shift+left",fn:function(){De(-10,0)}},{key:"shift+right",fn:function(){De(10,0)}},{key:["alt+up",!0],fn:function(){svgCanvas.cloneSelectedElements(0,-1)}},{key:["alt+down",!0],fn:function(){svgCanvas.cloneSelectedElements(0,1)}},{key:["alt+left",!0],fn:function(){svgCanvas.cloneSelectedElements(-1,0)}},{key:["alt+right",!0],fn:function(){svgCanvas.cloneSelectedElements(1,0)}},{key:["alt+shift+up",!0],fn:function(){svgCanvas.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",!0],fn:function(){svgCanvas.cloneSelectedElements(0,10)}},{key:["alt+shift+left",!0],fn:function(){svgCanvas.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",!0],fn:function(){svgCanvas.cloneSelectedElements(10,0)}},{key:"A",fn:function(){svgCanvas.selectAllInCurrentLayer()}},{key:c+"z",fn:at},{key:c+"shift+z",fn:rt},{key:c+"y",fn:rt},{key:c+"x",fn:Ne},{key:c+"c",fn:Le},{key:c+"v",fn:Ie}],Ht={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"},{setAll:function(){var e={};$$b.each(Ut,function(t,n){var a=void 0;if(n.sel){if(!(a=$$b(n.sel)).length)return!0;if(n.evt&&(isTouch()&&"click"===n.evt&&(n.evt="mousedown"),a[n.evt](n.fn)),n.parent&&$$b(n.parent+"_show").length){var r=$$b(n.parent);r.length||(r=te(n.parent.substr(1))),r.append(a),Array.isArray(e[n.parent])||(e[n.parent]=[]),e[n.parent].push(n)}}if(n.key){var i=void 0,o=!1;Array.isArray(n.key)?(i=n.key[0],n.key.length>1&&(o=n.key[1])):i=n.key,i+="";var s=n.fn;if($$b.each(i.split("/"),function(e,t){$$b(document).bind("keydown",t,function(e){return s(),o&&e.preventDefault(),!1})}),n.sel&&!n.hidekey&&a.attr("title")){var l=a.attr("title").split("[")[0]+" ("+i+")";Ht[i]=n.sel,a.parents("#main_menu").length||a.attr("title",l)}}}),ee(e),$$b(".attr_changer, #image_url").bind("keydown","return",function(e){$$b(this).change(),e.preventDefault()}),$$b(window).bind("keydown","tab",function(e){"canvas"===x&&(e.preventDefault(),We())}).bind("keydown","shift+tab",function(e){"canvas"===x&&(e.preventDefault(),Ye())}),$$b("#tool_zoom").dblclick(Ee)},setTitles:function(){$$b.each(Ht,function(e,t){var n=$$b(t).parents("#main_menu").length;$$b(t).each(function(){var t=void 0;t=n?$$b(this).text().split(" [")[0]:this.title.split(" [")[0];var a="";$$b.each(e.split("/"),function(e,t){var n=t.split("+"),r="";n.length>1&&(r=n[0]+"+",t=n[1]),a+=(e?"/":"")+r+(uiStrings$1["key_"+t]||t)}),n?this.lastChild.textContent=t+" ["+a+"]":this.title=t+" ["+a+"]"})})},getButtonData:function(e){var t=void 0;return $$b.each(Ut,function(n,a){a.sel===e&&(t=a)}),t}});zt.setAll(),editor.ready(function(){var e=curConfig.initTool,t=$$b("#tools_left, #svg_editor .tools_flyout"),n=t.find("#tool_"+e),a=t.find("#"+e);(n.length?n:a.length?a:$$b("#tool_select")).click().mouseup(),curConfig.wireframe&&$$b("#tool_wireframe").click(),curConfig.showlayers&&Ft(),$$b("#rulers").toggle(!!curConfig.showRulers),curConfig.showRulers&&($$b("#show_rulers")[0].checked=!0),curConfig.baseUnit&&$$b("#base_unit").val(curConfig.baseUnit),curConfig.gridSnapping&&($$b("#grid_snapping_on")[0].checked=!0),curConfig.snappingStep&&$$b("#grid_snapping_step").val(curConfig.snappingStep),curConfig.gridColor&&$$b("#grid_color").val(curConfig.gridColor)}),$$b("#rect_rx").SpinButton({min:0,max:1e3,stateObj:i,callback:function(e){svgCanvas.setRectRadius(e.value)}}),$$b("#stroke_width").SpinButton({min:0,max:99,smallStep:.1,stateObj:i,callback:function(e){var t=e.value;0===t&&G&&["line","polyline"].includes(G.nodeName)&&(t=e.value=1),svgCanvas.setStrokeWidth(t)}}),$$b("#angle").SpinButton({min:-180,max:180,step:5,stateObj:i,callback:function(e){svgCanvas.setRotationAngle(e.value),$$b("#tool_reorient").toggleClass("disabled",0===parseInt(e.value,10))}}),$$b("#font_size").SpinButton({min:.001,stepfunc:function(e,t){var n=Number(e.value),a=n+t,r=a>=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:a},stateObj:i,callback:function(e){svgCanvas.setFontSize(e.value)}}),$$b("#group_opacity").SpinButton({min:0,max:100,step:5,stateObj:i,callback:oe}),$$b("#blur").SpinButton({min:0,max:10,step:.1,stateObj:i,callback:se}),$$b("#zoom").SpinButton({min:.001,max:1e4,step:50,stepfunc:function(e,t){var n=Number(e.value);if(0===n)return 100;var a=n+t;return 0===t?n:n>=100?a:a>=n?2*n:n/2},stateObj:i,callback:K}).val(100*svgCanvas.getZoom()),$$b("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(e,t,n){switch(e){case"delete":Ge();break;case"cut":Ne();break;case"copy":Le();break;case"paste":svgCanvas.pasteElements();break;case"paste_in_place":svgCanvas.pasteElements("in_place");break;case"group":case"group_elements":svgCanvas.groupSelectedElements();break;case"ungroup":svgCanvas.ungroupSelectedElement();break;case"move_front":Me();break;case"move_up":Oe("Up");break;case"move_down":Oe("Down");break;case"move_back":Re();break;default:hasCustomHandler(e)&&getCustomHandler(e).call()}});var qt=function(e,t,n){switch(e){case"dupe":a=svgCanvas.getCurrentDrawing().getCurrentLayerName()+" copy",$$b.prompt(uiStrings$1.notification.enterUniqueLayerName,a,function(e){e&&(svgCanvas.getCurrentDrawing().hasLayer(e)?$$b.alert(uiStrings$1.notification.dupeLayerName):(svgCanvas.cloneLayer(e),U(),A()))});break;case"delete":Mt();break;case"merge_down":$$b("#layerlist tr.layersel").index()!==svgCanvas.getCurrentDrawing().getNumLayers()-1&&(svgCanvas.mergeLayer(),U(),A());break;case"merge_all":svgCanvas.mergeAllLayers(),U(),A()}var a};function Wt(){var e=void 0;try{e=localStorage.getItem("svgedit_clipboard")}catch(e){}g[(e?"en":"dis")+"ableContextMenuItems"]("#paste,#paste_in_place")}if($$b("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},qt),$$b("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:!0},qt),$$b(".contextMenu li").mousedown(function(e){e.preventDefault()}),$$b("#cmenu_canvas li").disableContextMenu(),g.enableContextMenuItems("#delete,#cut,#copy"),Wt(),window.addEventListener("storage",function(e){"svgedit_clipboard"===e.key&&Wt()}),window.addEventListener("beforeunload",function(e){if(0===d.getUndoStackSize()&&(editor.showSaveWarning=!1),!curConfig.no_save_warning&&editor.showSaveWarning)return e.returnValue=uiStrings$1.notification.unsavedChanges,uiStrings$1.notification.unsavedChanges},!1),editor.canvas.getUIStrings=function(){return uiStrings$1},editor.openPrep=function(e){$$b("#main_menu").hide(),0===d.getUndoStackSize()?e(!0):$$b.confirm(uiStrings$1.notification.QwantToOpen,e)},window.FileReader){var Yt=function(e){$$b.process_cancel(uiStrings$1.notification.loadingImage),e.stopPropagation(),e.preventDefault(),$$b("#workarea").removeAttr("style"),$$b("#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=svgCanvas.importSvgString(e.target.result,!0);svgCanvas.ungroupSelectedElement(),svgCanvas.ungroupSelectedElement(),svgCanvas.groupSelectedElements(),svgCanvas.alignSelectedElements("m","page"),svgCanvas.alignSelectedElements("c","page"),svgCanvas.selectOnly([t]),$$b("#dialog_box").hide()},n.readAsText(t)):((n=new FileReader).onloadend=function(e){var t=100,n=100,a=new Image;a.src=e.target.result,a.style.opacity=0,a.onload=function(){var r,i,o;t=a.offsetWidth,n=a.offsetHeight,r=t,i=n,o=svgCanvas.addSVGElementFromJson({element:"image",attr:{x:0,y:0,width:r,height:i,id:svgCanvas.getNextId(),style:"pointer-events:inherit"}}),svgCanvas.setHref(o,e.target.result),svgCanvas.selectOnly([o]),svgCanvas.alignSelectedElements("m","page"),svgCanvas.alignSelectedElements("c","page"),U(),$$b("#dialog_box").hide()}},n.readAsDataURL(t))}}else $$b("#dialog_box").hide()};h[0].addEventListener("dragenter",function(e){e.stopPropagation(),e.preventDefault()},!1),h[0].addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault()},!1),h[0].addEventListener("dragleave",function(e){e.stopPropagation(),e.preventDefault()},!1),h[0].addEventListener("drop",Yt,!1);var Xt=$$b('<input type="file">').change(function(){var e=this;editor.openPrep(function(t){if(t&&(svgCanvas.clear(),1===e.files.length)){$$b.process_cancel(uiStrings$1.notification.loadingImage);var n=new FileReader;n.onloadend=function(e){loadSvgString(e.target.result),D()},n.readAsText(e.files[0])}})});$$b("#tool_open").show().prepend(Xt);var Kt=$$b('<input type="file">').change(Yt);$$b("#tool_import").show().prepend(Kt)}D(!0);var Qt=editor.setLang=function(e,t){if(editor.langChanged=!0,$$b.pref("lang",e),$$b("#lang_select").val(e),t){$$b.extend(uiStrings$1,t);var n=$$b("#layerlist tr.layersel td.layername").text()===uiStrings$1.common.layer+" 1";if(svgCanvas.setUiStrings(t),zt.setTitles(),n&&(svgCanvas.renameCurrentLayer(uiStrings$1.common.layer+" 1"),A()),ae.length)for(;ae.length;){var a=ae.shift();a.langReady({lang:e,uiStrings:uiStrings$1,importLocale:getImportLocale({defaultLang:e,defaultName:a.name})})}else svgCanvas.runExtensions("langReady",{lang:e,uiStrings:uiStrings$1});svgCanvas.runExtensions("langChanged",e),J();$$b.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){$$b(t).attr("title",$$b(e)[0].title)}),$$b("#multiselected_panel div[id^=tool_align]").each(function(){$$b("#tool_pos"+this.id.substr(10))[0].title=this.title})}};init$7({addLangData:function(e){return svgCanvas.runExtensions("addLangData",function(t){return{lang:e,importLocale:getImportLocale({defaultLang:e,defaultName:t})}},!0)},curConfig:curConfig}),"file:"===document.location.protocol?setTimeout(r,100):r()},editor.ready=function(e){isReady?e():callbacks.push(e)},editor.runCallbacks=function(){callbacks.forEach(function(e){e()}),isReady=!0},editor.loadFromString=function(e){editor.ready(function(){loadSvgString(e)})},editor.disableUI=function(e){},editor.loadFromURL=function(e,t){t||(t={});var n=t,a=n.cache,r=n.callback;editor.ready(function(){$$b.ajax({url:e,dataType:"text",cache:!!a,beforeSend:function(){$$b.process_cancel(uiStrings$1.notification.loadingImage)},success:function(e){loadSvgString(e,r)},error:function(e,t,n){404!==e.status&&e.responseText?loadSvgString(e.responseText,r):$$b.alert(uiStrings$1.notification.URLloadFail+": \n"+n,r)},complete:function(){$$b("#dialog_box").hide()}})})},editor.loadFromDataURI=function(e){editor.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 a=e.slice(n.length);loadSvgString(t?decode64(a):decodeURIComponent(a))})},editor.addExtension=function(e,t,n){if(!svgCanvas)throw new Error("Extension added too early");return svgCanvas.addExtension.call(this,e,t,n)},editor.ready(function(){injectExtendedContextMenuItemsIntoDom()});var extensionsAdded=!1,messageQueue=[],messageListener=function(e){var t={data:e.data,origin:e.origin};extensionsAdded?svgCanvas.call("message",t):messageQueue.push(t)};window.addEventListener("message",messageListener),Promise.resolve().then(function(){editor.init()});export default editor;
|
|
//# sourceMappingURL=index-es.min.js.map
|