svgedit/dist/index-umd.min.js

3 lines
339 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.svgEditor=t()}(this,function(){"use strict";function e(e){var t=e.changedTouches,n=t[0],r="";switch(e.type){case"touchstart":r="mousedown";break;case"touchmove":r="mousemove";break;case"touchend":r="mouseup";break;default:return}var a=n.screenX,i=n.screenY,o=n.clientX,s=n.clientY,l=new MouseEvent(r,{bubbles:!0,cancelable:!0,view:window,detail:1,screenX:a,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",e,!0),document.addEventListener("touchmove",e,!0),document.addEventListener("touchend",e,!0),document.addEventListener("touchcancel",e,!0);var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){return function r(a,i){try{var o=t[a](i),s=o.value}catch(e){return void n(e)}if(!o.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}("next")})}},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=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)},s=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},l=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(a)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=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)},u={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/"},d=function(){var e={};return Object.entries(u).forEach(function(t){var n=l(t,2),r=n[0],a=n[1];e[a]=r.toLowerCase()}),e};!function(){if(!("SVGPathSeg"in window)){var e=function(){function e(t,n,a){r(this,e),this.pathSegType=t,this.pathSegTypeAsLetter=n,this._owningPathSegList=a}return a(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 r(this,n),s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CLOSEPATH,"z",t))}return o(n,e),a(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,i){r(this,n);var o=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_MOVETO_ABS,"M",t));return o._x=a,o._y=i,o}return o(n,e),a(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 i=function(t){function n(t,a,i){r(this,n);var o=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_MOVETO_REL,"m",t));return o._x=a,o._y=i,o}return o(n,e),a(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(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 l=function(t){function n(t,a,i){r(this,n);var o=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_ABS,"L",t));return o._x=a,o._y=i,o}return o(n,e),a(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(l.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var c=function(t){function n(t,a,i){r(this,n);var o=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_REL,"l",t));return o._x=a,o._y=i,o}return o(n,e),a(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(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}});var u=function(t){function n(t,a,i,o,l,c,u){r(this,n);var d=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_ABS,"C",t));return d._x=a,d._y=i,d._x1=o,d._y1=l,d._x2=c,d._y2=u,d}return o(n,e),a(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(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},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var d=function(t){function n(t,a,i,o,l,c,u){r(this,n);var d=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_REL,"c",t));return d._x=a,d._y=i,d._x1=o,d._y1=l,d._x2=c,d._y2=u,d}return o(n,e),a(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(d.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var h=function(t){function n(t,a,i,o,l){r(this,n);var c=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t));return c._x=a,c._y=i,c._x1=o,c._y1=l,c}return o(n,e),a(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(h.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var f=function(t){function n(t,a,i,o,l){r(this,n);var c=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_REL,"q",t));return c._x=a,c._y=i,c._x1=o,c._y1=l,c}return o(n,e),a(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(f.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var p=function(t){function n(t,a,i,o,l,c,u,d){r(this,n);var h=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_ARC_ABS,"A",t));return h._x=a,h._y=i,h._r1=o,h._r2=l,h._angle=c,h._largeArcFlag=u,h._sweepFlag=d,h}return o(n,e),a(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(p.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var g=function(t){function n(t,a,i,o,l,c,u,d){r(this,n);var h=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_ARC_REL,"a",t));return h._x=a,h._y=i,h._r1=o,h._r2=l,h._angle=c,h._largeArcFlag=u,h._sweepFlag=d,h}return o(n,e),a(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(g.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var v=function(t){function n(t,a){r(this,n);var i=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t));return i._x=a,i}return o(n,e),a(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(v.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var m=function(t){function n(t,a){r(this,n);var i=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_HORIZONTAL_REL,"h",t));return i._x=a,i}return o(n,e),a(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(m.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var _=function(t){function n(t,a){r(this,n);var i=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_VERTICAL_ABS,"V",t));return i._y=a,i}return o(n,e),a(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(_.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var y=function(t){function n(t,a){r(this,n);var i=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_VERTICAL_REL,"v",t));return i._y=a,i}return o(n,e),a(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(y.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var b=function(t){function n(t,a,i,o,l){r(this,n);var c=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t));return c._x=a,c._y=i,c._x2=o,c._y2=l,c}return o(n,e),a(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(b.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var x=function(t){function n(t,a,i,o,l){r(this,n);var c=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t));return c._x=a,c._y=i,c._x2=o,c._y2=l,c}return o(n,e),a(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(x.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var w=function(t){function n(t,a,i){r(this,n);var o=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t));return o._x=a,o._y=i,o}return o(n,e),a(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(w.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var S=function(t){function n(t,a,i){r(this,n);var o=s(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t));return o._x=a,o._y=i,o}return o(n,e),a(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(S.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}}),SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new t(void 0)},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(e,t){return new n(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(e,t){return new i(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new l(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new c(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,r,a,i){return new u(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,r,a,i){return new d(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,r){return new h(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(e,t,n,r){return new f(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(e,t,n,r,a,i,o){return new p(void 0,e,t,n,r,a,i,o)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,r,a,i,o){return new g(void 0,e,t,n,r,a,i,o)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(e){return new v(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(e){return new m(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new _(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new y(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,r){return new b(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,r){return new x(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new w(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new S(void 0,e,t)},"getPathSegAtLength"in SVGPathElement.prototype||(SVGPathElement.prototype.getPathSegAtLength=function(e){if(void 0===e||!isFinite(e))throw new Error("Invalid arguments.");var t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",this.getAttribute("d"));var n=t.pathSegList.numberOfItems-1;if(n<=0)return 0;do{if(t.pathSegList.removeItem(n),e>t.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=i,window.SVGPathSegLinetoAbs=l,window.SVGPathSegLinetoRel=c,window.SVGPathSegCurvetoCubicAbs=u,window.SVGPathSegCurvetoCubicRel=d,window.SVGPathSegCurvetoQuadraticAbs=h,window.SVGPathSegCurvetoQuadraticRel=f,window.SVGPathSegArcAbs=p,window.SVGPathSegArcRel=g,window.SVGPathSegLinetoHorizontalAbs=v,window.SVGPathSegLinetoHorizontalRel=m,window.SVGPathSegLinetoVerticalAbs=_,window.SVGPathSegLinetoVerticalRel=y,window.SVGPathSegCurvetoCubicSmoothAbs=b,window.SVGPathSegCurvetoCubicSmoothRel=x,window.SVGPathSegCurvetoQuadraticSmoothAbs=w,window.SVGPathSegCurvetoQuadraticSmoothRel=S}if(!("SVGPathSegList"in window&&"appendItem"in window.SVGPathSegList.prototype)){var k=function(){function e(t){r(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 a(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(){r(this,e),this.pathSegList=[]}return a(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),i=function(){function e(t){r(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return a(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,r=0,a=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++,a=-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,r+=(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+r;if(u*=a,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 r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,a.x,a.y,a.x1,a.y1,a.x2,a.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}(),o=new n,s=new i(e);if(!s.initialCommandIsMoveTo())return[];for(;s.hasMoreData();){var l=s.parseSegment();if(!l)return[];o.appendSegment(l)}return o.pathSegList}}]),e}();k.prototype.classname="SVGPathSegList",Object.defineProperty(k.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),k._pathSegArrayAsString=function(e){var t="",n=!0;return e.forEach(function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()}),t},Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new k(this)),this._pathSegList},enumerable:!0},normalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedNormalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0}}),window.SVGPathSegList=k}}();var h,f=jQuery,p=(!!document.createElementNS&&document.createElementNS(u.SVG,"svg").createSVGRect,navigator.userAgent),g=document.createElementNS(u.SVG,"svg"),v=!!window.opera,m=p.includes("AppleWebKit"),_=p.includes("Gecko/"),y=p.includes("MSIE"),b=p.includes("Chrome/"),x=(p.includes("Windows"),p.includes("Macintosh")),w="ontouchstart"in window,S=!!g.querySelector,k=!!document.evaluate,C=function(){var e=document.createElementNS(u.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}(),A=function(){var e=document.createElementNS(u.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}(),E=function(){var e=document.createElementNS(u.SVG,"svg"),t=document.createElementNS(u.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(u.SVG,"text");n.textContent="a",t.append(n);var r=n.getStartPositionOfChar(0).x;return e.remove(),0===r}(),G=function(){var e=document.createElementNS(u.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(u.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}(),P=function(){var e=document.createElementNS(u.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(u.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(u.SVG,"path");n.setAttribute("d","M5,0 15,0");var r=document.createElementNS(u.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.width}(),N=(function(){var e=document.createElementNS(u.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");t||f.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.')}(),(h=document.createElementNS(u.SVG,"rect")).setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===h.style.vectorEffect),I=function(){var e=document.createElementNS(u.SVG,"rect").transform.baseVal,t=g.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}(),T=function(){return v},L=function(){return m},M=function(){return _},O=function(){return y},j=function(){return b},V=function(){return x},R=function(){return w},B=function(){return P},D=function(){return N};function U(e){var n=e.fn.attr;return e.fn.attr=function(e,r){var a=this.length;if(!a)return n.apply(this,arguments);for(var i=0;i<a;++i){var o=this[i];if("http://www.w3.org/2000/svg"!==o.namespaceURI)return n.apply(this,arguments);if(void 0!==r)o.setAttribute(e,r);else if(Array.isArray(e)){for(var s={},c=e.length;c--;){var u=e[c],d=o.getAttribute(u);(d||"0"===d)&&(d=isNaN(d)?d:d-0),s[u]=d}return s}if("object"!==(void 0===e?"undefined":t(e))){var h=o.getAttribute(e);return(h||"0"===h)&&(h=isNaN(h)?h:h-0),h}var f=!0,p=!1,g=void 0;try{for(var v,m=Object.entries(e)[Symbol.iterator]();!(f=(v=m.next()).done);f=!0){var _=v.value,y=l(_,2),b=y[0],x=y[1];o.setAttribute(b,x)}}catch(e){p=!0,g=e}finally{try{!f&&m.return&&m.return()}finally{if(p)throw g}}}return this},e}var F=document.createElementNS(u.SVG,"svg");function H(e){var t=e.matrix,n="";switch(e.type){case 1:n="matrix("+[t.a,t.b,t.c,t.d,t.e,t.f].join(",")+")";break;case 2:n="translate("+t.e+","+t.f+")";break;case 3:n=t.a===t.d?"scale("+t.a+")":"scale("+t.a+","+t.d+")";break;case 4:var r=0,a=0;if(0!==e.angle){var i=1-t.a;a=(i*t.f+t.b*t.e)/(i*i+t.b*t.b),r=(t.e-t.b*a)/i}n="rotate("+e.angle+" "+r+","+a+")"}return n}var z={},q=function(){function e(t){r(this,e),this._elem=t||null,this._xforms=[],this._update=function(){for(var e="",t=0;t<this.numberOfItems;++t){e+=H(this._list.getItem(t))+" "}this._elem.setAttribute("transform",e)},this._list=this,this._init=function(){var e=this,t=this._elem.getAttribute("transform");if(t)for(var n=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,r=!0;r;)r=t.match(n),t=t.replace(n,""),r&&r[1]&&function(){var t=r[1].split(/\s*\(/),n=t[0],a=t[1].match(/\s*(.*?)\s*\)/);a[1]=a[1].replace(/(\d)-/g,"$1 -");var i=a[1].split(/[, ]+/),o="abcdef".split(""),s=F.createSVGMatrix();Object.values(i).forEach(function(e,t){i[t]=parseFloat(e),"matrix"===n&&(s[o[t]]=i[t])});var l=F.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 z){for(var r=z[n],a=0,i=r._xforms.length;a<i;++a)if(r._xforms[a]===e){t=!0,r.removeItem(a);break}if(t)break}}},this.numberOfItems=0}return a(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 r=new Array(this.numberOfItems+1),a=void 0;for(a=0;a<t;++a)r[a]=this._xforms[a];r[a]=e;for(var i=a+1;a<this.numberOfItems;++i,++a)r[i]=this._xforms[a];this.numberOfItems++,this._xforms=r,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),r=void 0;for(r=0;r<e;++r)n[r]=this._xforms[r];for(var a=r;a<this.numberOfItems-1;++a,++r)n[a]=this._xforms[r+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}(),Y=function(e){e.id&&z[e.id]&&delete z[e.id]},W=function(e){if(!I){var t=e.id||"temp",n=z[t];return n&&"temp"!==t||(z[t]=new q(e),z[t]._init(),n=z[t]),n}return e.transform?e.transform.baseVal:e.gradientTransform?e.gradientTransform.baseVal:e.patternTransform?e.patternTransform.baseVal:null},X=["x","x1","cx","rx","width"],Q=["y","y1","cy","ry","height"],K=["r","radius"].concat(X,Q),Z=void 0,$={},J=function(){return $},ee=function e(t){var n=Z.getRoundDigits();return isNaN(t)?Array.isArray(t)?e(t[0])+","+e(t[1]):parseFloat(t).toFixed(n)-0:+(+t).toFixed(n)},te=function(e,t){return t=t||Z.getBaseUnit(),ee(e/$[t])},ne=function(e,t,n){e.setAttribute(t,n)},re=function(e,t){if(!isNaN(t))return t-0;if("%"===t.substr(-1)){var n=t.substr(0,t.length-1)/100,r=Z.getWidth(),a=Z.getHeight();return X.includes(e)?n*r:Q.includes(e)?n*a:n*Math.sqrt(r*r+a*a)/Math.sqrt(2)}var i=t.substr(-2);return t.substr(0,t.length-2)*$[i]},ae=function(e,t,n){if(K.includes(e))return!isNaN(t)||(t=t.toLowerCase(),Object.keys($).some(function(e){return new RegExp("^-?[\\d\\.]+"+e+"$").test(t)}));if("id"===e){var r=!1;try{var a=Z.getElement(t);r=null==a||a===n}catch(e){}return r}return!0},ie={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"},oe=function(){function e(){r(this,e)}return a(e,[{key:"getText",value:function(){return this.text}}]),e}(),se=function(e){function t(e,n,a,i){r(this,t);var o=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.elem=e,o.text=i?"Move "+e.tagName+" to "+i:"Move "+e.tagName,o.oldNextSibling=n,o.oldParent=a,o.newNextSibling=e.nextSibling,o.newParent=e.parentNode,o}return o(t,oe),a(t,[{key:"type",value:function(){return"svgedit.history.MoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ie.BEFORE_APPLY,this),this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling),e&&e.handleHistoryEvent(ie.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ie.BEFORE_UNAPPLY,this),this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling),e&&e.handleHistoryEvent(ie.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();se.type=se.prototype.type;var le=function(e){function t(e,n){r(this,t);var a=s(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 o(t,oe),a(t,[{key:"type",value:function(){return"svgedit.history.InsertElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ie.BEFORE_APPLY,this),this.elem=this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(ie.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ie.BEFORE_UNAPPLY,this),this.parent=this.elem.parentNode,this.elem=this.elem.parentNode.removeChild(this.elem),e&&e.handleHistoryEvent(ie.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();le.type=le.prototype.type;var ce=function(e){function t(e,n,a,i){r(this,t);var o=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.elem=e,o.text=i||"Delete "+e.tagName,o.nextSibling=n,o.parent=a,Y(e),o}return o(t,oe),a(t,[{key:"type",value:function(){return"svgedit.history.RemoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ie.BEFORE_APPLY,this),Y(this.elem),this.parent=this.elem.parentNode,this.elem=this.parent.removeChild(this.elem),e&&e.handleHistoryEvent(ie.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ie.BEFORE_UNAPPLY,this),Y(this.elem),null==this.nextSibling&&window.console&&console.log("Error: reference element was lost"),this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(ie.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();ce.type=ce.prototype.type;var ue=function(e){function t(e,n,a){r(this,t);var i=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));for(var o in i.elem=e,i.text=a?"Change "+e.tagName+" "+a:"Change "+e.tagName,i.newValues={},i.oldValues=n,n)i.newValues[o]="#text"===o?e.textContent:"#href"===o?Nt(e):e.getAttribute(o);return i}return o(t,oe),a(t,[{key:"type",value:function(){return"svgedit.history.ChangeElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ie.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?It(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 r=Yt(this.elem);if(r){var a=this.elem.getBBox(),i=["rotate(",r," ",a.x+a.width/2,",",a.y+a.height/2,")"].join("");i!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",i)}}return e&&e.handleHistoryEvent(ie.AFTER_APPLY,this),!0}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ie.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?It(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 r=Yt(this.elem);if(r){var a=this.elem.getBBox(),i=["rotate(",r," ",a.x+a.width/2,",",a.y+a.height/2,")"].join("");i!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",i)}}return Y(this.elem),e&&e.handleHistoryEvent(ie.AFTER_UNAPPLY,this),!0}},{key:"elements",value:function(){return[this.elem]}}]),t}();ue.type=ue.prototype.type;var de=function(e){function t(e){r(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.text=e||"Batch Command",n.stack=[],n}return o(t,oe),a(t,[{key:"type",value:function(){return"svgedit.history.BatchCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(ie.BEFORE_APPLY,this);for(var t=this.stack.length,n=0;n<t;++n)this.stack[n].apply(e);e&&e.handleHistoryEvent(ie.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(ie.BEFORE_UNAPPLY,this);for(var t=this.stack.length-1;t>=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(ie.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){for(var e=[],t=this.stack.length;t--;)for(var n=this.stack[t].elements(),r=n.length;r--;)e.includes(n[r])||e.push(n[r]);return e}},{key:"addSubCommand",value:function(e){this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),t}();de.type=de.prototype.type;var he=function(){function e(t){r(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return a(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,r=t.length,a=new Array(r),i=new Array(r);r--;){var o=t[r];null!=o&&(i[r]=o,a[r]=o.getAttribute(e))}this.undoableChangeStack[n]={attrName:e,oldValues:a,elements:i}}},{key:"finishUndoableChange",value:function(){for(var e=this.undoChangeStackPointer--,t=this.undoableChangeStack[e],n=t.attrName,r=new de("Change "+n),a=t.elements.length;a--;){var i=t.elements[a];if(null!=i){var o={};o[n]=t.oldValues[a],o[n]!==i.getAttribute(n)&&r.addSubCommand(new ue(i,o,n))}}return this.undoableChangeStack[e]=null,r}}]),e}(),fe=Object.freeze({HistoryEventTypes:ie,MoveElementCommand:se,InsertElementCommand:le,RemoveElementCommand:ce,ChangeElementCommand:ue,BatchCommand:de,UndoManager:he}),pe=document.createElementNS(u.SVG,"svg"),ge=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},ve=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},me=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.reduceRight(function(e,t){return t.multiply(e)});return Math.abs(r.a)<1e-14&&(r.a=0),Math.abs(r.b)<1e-14&&(r.b=0),Math.abs(r.c)<1e-14&&(r.c=0),Math.abs(r.d)<1e-14&&(r.d=0),Math.abs(r.e)<1e-14&&(r.e=0),Math.abs(r.f)<1e-14&&(r.f=0),r},_e=function(e){if(!e)return!1;for(var t=e.numberOfItems;t--;){var n=e.getItem(t);if(1===n.type&&!ve(n.matrix))return!0}return!1},ye=function(e,t,n,r,a){var i=ge(e,t,a),o=ge(e+n,t,a),s=ge(e,t+r,a),l=ge(e+n,t+r,a),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}}},be=function(e,t,n){if(null==e)return pe.createSVGTransformFromMatrix(pe.createSVGMatrix());if(t=t||0,n=n||e.numberOfItems-1,(t=parseInt(t,10))>(n=parseInt(n,10))){var r=n;n=t,t=r}for(var a=pe.createSVGMatrix(),i=t;i<=n;++i){var o=i>=0&&i<e.numberOfItems?e.getItem(i).matrix:pe.createSVGMatrix();a=me(a,o)}return pe.createSVGTransformFromMatrix(a)},xe=function(e){var t=W(e);return be(t).matrix},we=function(e,t,n,r){var a=Math.PI/4,i=n-e,o=r-t,s=Math.atan2(o,i),l=Math.sqrt(i*i+o*o),c=Math.round(s/a)*a;return{x:e+l*Math.cos(c),y:t+l*Math.sin(c),a:c}},Se=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},ke=jQuery,Ce={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"]},Ae={},Ee=function(e){Object.assign(Ae,e.ui)},Ge=[],Pe=!0,Ne={},Ie=null,Te=null,Le=function(e){Te=e,Ge=[0,"ClosePath"];ke.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(e,t){Ge.push(t+"Abs"),Ge.push(t+"Rel")})},Me=function(e,t,n){var r=e.pathSegList;if(A)r.insertItemBefore(t,n);else{for(var a=r.numberOfItems,i=[],o=0;o<a;o++){var s=r.getItem(o);i.push(s)}r.clear();for(var l=0;l<a;l++)l===n&&r.appendItem(t),r.appendItem(i[l])}},Oe=function(e,t){var n=e.path,r={x:t?t.x:e.item.x,y:t?t.y:e.item.y};n.matrix&&(r=ge(r.x,r.y,n.matrix));var a=Te.getCurrentZoom();return r.x*=a,r.y*=a,r},je=function(e,t){var n={x:e.x,y:e.y};t.matrix&&(e=ge(n.x,n.y,t.imatrix),n.x=e.x,n.y=e.y);var r=Te.getCurrentZoom();return n.x/=r,n.y/=r,n},Ve=function(e,t,n){var r=Re(),a=Xt("pathpointgrip_"+e);if(!a){a=document.createElementNS(u.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 Ae&&(i["xlink:title"]=Ae.pathNodeTooltip),Qt(a,i),a=r.appendChild(a),ke("#pathpointgrip_"+e).dblclick(function(){Ie&&Ie.setSegType()})}return t&&n&&Qt(a,{cx:t,cy:n,display:"inline"}),a},Re=function(){var e=Xt("pathpointgrip_container");e||((e=Xt("selectorParentGroup").appendChild(document.createElementNS(u.SVG,"g"))).id="pathpointgrip_container");return e},Be=function(e){var t=Xt("ctrlpointgrip_"+e);if(t)return t;t=document.createElementNS(u.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 Ae&&(n["xlink:title"]=Ae.pathCtrlPtTooltip),Qt(t,n),Re().append(t),t},De=function(e){var t=Xt("ctrlLine_"+e);return t||(t=document.createElementNS(u.SVG,"line"),Qt(t,{id:"ctrlLine_"+e,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),Re().append(t),t)},Ue=function(e){var t=e.item,n=e.index;if(!("x1"in t&&"x2"in t))return null;var r={};Re();for(var a=[Ie.segs[n-1].item,t],i=1;i<3;i++){var o=n+"c"+i,s=r["c"+i+"_line"]=De(o),l=Oe(e,{x:t["x"+i],y:t["y"+i]}),c=Oe(e,{x:a[i-1].x,y:a[i-1].y});Qt(s,{x1:l.x,y1:l.y,x2:c.x,y2:c.y,display:"inline"}),r["c"+i+"_line"]=s;var u=r["c"+i]=Be(o);Qt(u,{cx:l.x,cy:l.y,display:"inline"}),r["c"+i]=u}return r},Fe=function(e,t,n,r){var a=r||Ie.elem,i=a["createSVGPathSeg"+Ge[e]].apply(a,n);if(C)a.pathSegList.replaceItem(i,t);else{for(var o=a.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])}},He=function(e,t){var n,r,a=e.index,i=Xt("segline_"+a);if(!i){var o=Re();i=document.createElementNS(u.SVG,"path"),Qt(i,{id:"segline_"+a,display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"}),o.append(i)}if(t){var s=e.prev;if(!s)return i.setAttribute("display","none"),i;var l=Oe(s);Fe(2,0,[l.x,l.y],i);for(var c=(n=e.type,r=e.item,Ce[n].map(function(e){return r[e]})),d=0;d<c.length;d+=2){var h=Oe(e,{x:c[d],y:c[d+1]});c[d]=h.x,c[d+1]=h.y}Fe(e.type,1,c,i)}return i},ze=function(e,t,n){var r=e.x-n.x,a=e.y-n.y,i=t.x-n.x,o=t.y-n.y;if(!(0===r&&0===a||0===i&&0===o)){var s=Math.sqrt(r*r+a*a),l=Math.sqrt(i*i+o*o),c=Te.getSVGRoot().createSVGPoint(),u=Te.getSVGRoot().createSVGPoint(),d=Math.atan2(a,r),h=Math.atan2(o,i);d<0&&(d+=2*Math.PI),h<0&&(h+=2*Math.PI);var f=Math.abs(d-h),p=Math.abs(Math.PI-f)/2,g=void 0,v=void 0;return d-h>0?(g=f<Math.PI?d+p:d-p,v=f<Math.PI?h-p:h+p):(g=f<Math.PI?d-p:d+p,v=f<Math.PI?h+p:h-p),c.x=s*Math.cos(g)+n.x,c.y=s*Math.sin(g)+n.y,u.x=l*Math.cos(v)+n.x,u.y=l*Math.sin(v)+n.y,[c,u]}},qe=function(){function e(t,n){r(this,e),this.selected=!1,this.index=t,this.item=n,this.type=n.pathSegType,this.ctrlpts=[],this.ptgrip=null,this.segsel=null}return a(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){ke("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill",e?"#0FF":"#EEE")}},{key:"show",value:function(e){this.ptgrip&&(this.ptgrip.setAttribute("display",e?"inline":"none"),this.segsel.setAttribute("display",e?"inline":"none"),this.showCtrlPts(e))}},{key:"select",value:function(e){this.ptgrip&&(this.ptgrip.setAttribute("stroke",e?"#0FF":"#00F"),this.segsel.setAttribute("display",e?"inline":"none"),this.ctrlpts&&this.selectCtrls(e),this.selected=e)}},{key:"addGrip",value:function(){this.ptgrip=function(e,t){var n=e.index,r=Ve(n);if(t){var a=Oe(e);Qt(r,{cx:a.x,cy:a.y,display:"inline"})}return r}(this,!0),this.ctrlpts=Ue(this),this.segsel=He(this,!0)}},{key:"update",value:function(e){if(this.ptgrip){var t=Oe(this);Qt(this.ptgrip,{cx:t.x,cy:t.y}),He(this,!0),this.ctrlpts&&(e&&(this.item=Ie.elem.pathSegList.getItem(this.index),this.type=this.item.pathSegType),Ue(this))}}},{key:"move",value:function(e,t){var n=this.item,r=this.ctrlpts?[n.x+=e,n.y+=t,n.x1,n.y1,n.x2+=e,n.y2+=t]:[n.x+=e,n.y+=t];if(Fe(this.type,this.index,r),this.next&&this.next.ctrlpts){var a=this.next.item,i=[a.x,a.y,a.x1+=e,a.y1+=t,a.x2,a.y2];Fe(this.next.type,this.next.index,i)}if(this.mate){var o=this.mate.item,s=[o.x+=e,o.y+=t];Fe(this.mate.type,this.mate.index,s)}this.update(!0),this.next&&this.next.update(!0)}},{key:"setLinked",value:function(e){var t=void 0,n=void 0,r=void 0;if(2===e){if(n=1,!(t=this.next))return;r=this.item}else{if(n=2,!(t=this.prev))return;r=t.item}var a=t.item;a["x"+n]=r.x+(r.x-this.item["x"+e]),a["y"+n]=r.y+(r.y-this.item["y"+e]);var i=[a.x,a.y,a.x1,a.y1,a.x2,a.y2];Fe(t.type,t.index,i),t.update(!0)}},{key:"moveCtrl",value:function(e,t,n){var r=this.item;r["x"+e]+=t,r["y"+e]+=n;var a=[r.x,r.y,r.x1,r.y1,r.x2,r.y2];Fe(this.type,this.index,a),this.update(!0)}},{key:"setType",value:function(e,t){Fe(e,this.index,t),this.type=e,this.item=Ie.elem.pathSegList.getItem(this.index),this.showCtrlPts(6===e),this.ctrlpts=Ue(this),this.update(!0)}}]),e}(),Ye=function(){function e(t){if(r(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=[],Ie=this,this.init()}return a(e,[{key:"init",value:function(){ke(Re()).find("*").each(function(){ke(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 r=e.getItem(n),a=new qe(n,r);a.path=this,this.segs.push(a)}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,r=void 0,a=void 0,i=void 0;switch(t.item.pathSegType){case 4:a=(t.item.x+n.item.x)/2,i=(t.item.y+n.item.y)/2,r=this.elem.createSVGPathSegLinetoAbs(a,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;a=(c+u)/2;var d=(n.item.y+t.item.y1)/2,h=(t.item.y1+t.item.y2)/2,f=(t.item.y2+t.item.y)/2,p=(d+h)/2,g=(h+f)/2;i=(p+g)/2,r=this.elem.createSVGPathSegCurvetoCubicAbs(a,i,o,d,c,p);var v=[t.item.x,t.item.y,u,g,l,f];Fe(t.type,e,v)}Me(this.elem,r,e)}}},{key:"deleteSeg",value:function(e){var t=this.segs[e],n=this.elem.pathSegList;t.show(!1);var r=t.next;if(t.mate){var a=[r.item.x,r.item.y];Fe(2,r.index,a),Fe(4,t.index,a),n.removeItem(t.mate.index)}else if(t.prev)n.removeItem(e);else{var i=[r.item.x,r.item.y];Fe(2,t.next.index,i),n.removeItem(e)}}},{key:"subpathIsClosed",value:function(e){var t=!1;return Ie.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),Pe&&n.setLinked(this.dragctrl)}},{key:"setSegType",value:function(e){this.storeD();for(var t=this.selected_pts.length,n=void 0;t--;){var r=this.selected_pts[t],a=this.segs[r],i=a.prev;if(i){if(!e)n="Toggle Path Segment Type",e=6===a.type?4:6;e=Number(e);var o=a.item.x,s=a.item.y,l=i.item.x,c=i.item.y,u=void 0;switch(e){case 6:if(a.olditem){var d=a.olditem;u=[o,s,d.x1,d.y1,d.x2,d.y2]}else{var h=o-l,f=s-c;u=[o,s,l+h/3,c+f/3,o-h/3,s-f/3]}break;case 4:u=[o,s],a.olditem=a.item}a.setType(e,u)}}Ie.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,Pe&&this.segs[e].setLinked(t))}},{key:"update",value:function(){var e=this.elem;return Yt(e)?(this.matrix=xe(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){L()&&Te.resetD(this.elem);var t=new ue(this.elem,{d:this.last_d},e);Te.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 r=this.selected_pts.length,a=[];for(a.length=r;r--;){var i=this.selected_pts[r],o=this.segs[i];o.select(!0),a[r]=o.ptgrip}var s=this.subpathIsClosed(this.selected_pts[0]);Te.addPtsToSelection({grips:a,closedSubpath:s})}}]),e}(),We=function(e){var t=Ne[e.id];return t||(t=Ne[e.id]=new Ye(e)),t},Xe=function(e){e in Ne&&delete Ne[e]},Qe=void 0,Ke=void 0,Ze=void 0,$e=void 0,Je=void 0,et=function(e,t){var n=e-Ze,r=t-$e,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)+Je;return n=a*Math.cos(i)+Ze,r=a*Math.sin(i)+$e,n-=Qe,r-=Ke,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)-Je,{x:a*Math.cos(i)+Qe,y:a*Math.sin(i)+Ke}},tt=function(){var e=Ie.elem;if(Je=Yt(e,!0)){var t=Ie.oldbbox;Ze=t.x+t.width/2,$e=t.y+t.height/2;var n=Ot(e);Qe=n.x+n.width/2,Ke=n.y+n.height/2;var r=Qe-Ze,a=Ke-$e,i=Math.sqrt(r*r+a*a),o=Math.atan2(a,r)+Je;Qe=i*Math.cos(o)+Ze,Ke=i*Math.sin(o)+$e;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var c=s.getItem(l),u=c.pathSegType;if(1!==u){var d=et(c.x,c.y),h=[d.x,d.y];if(null!=c.x1&&null!=c.x2){var f=et(c.x1,c.y1),p=et(c.x2,c.y2);h.splice(h.length,0,f.x,f.y,p.x,p.y)}Fe(u,l,h)}}Ot(e);var g=Te.getSVGRoot().createSVGTransform(),v=W(e);g.setRotate(180*Je/Math.PI,Qe,Ke),v.replaceItem(g,0)}},nt=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],rt=function(e,t){for(var n=e.pathSegList,r=n.numberOfItems,a=0,i=0,o="",s=null,l=0;l<r;++l){var c=n.getItem(l),u=c.x||0,d=c.y||0,h=c.x1||0,f=c.y1||0,p=c.x2||0,g=c.y2||0,v=c.pathSegType,m=nt[v]["to"+(t?"Lower":"Upper")+"Case"]();switch(v){case 1:o+="z",s&&!t&&(a=s[0],i=s[1]);break;case 12:u-=a;case 13:t?(a+=u,m="l"):(a=u+=a,m="L"),o+=at(m,[[u,i]]);break;case 14:d-=i;case 15:t?(i+=d,m="l"):(i=d+=i,m="L"),o+=at(m,[[a,d]]);break;case 2:case 4:case 18:u-=a,d-=i;case 5:case 3:case 19:t?(a+=u,i+=d):(a=u+=a,i=d+=i),2!==v&&3!==v||(s=[a,i]),o+=at(m,[[u,d]]);break;case 6:u-=a,h-=a,p-=a,d-=i,f-=i,g-=i;case 7:t?(a+=u,i+=d):(h+=a,p+=a,f+=i,g+=i,a=u+=a,i=d+=i),o+=at(m,[[h,f],[p,g],[u,d]]);break;case 8:u-=a,h-=a,d-=i,f-=i;case 9:t?(a+=u,i+=d):(h+=a,f+=i,a=u+=a,i=d+=i),o+=at(m,[[h,f],[u,d]]);break;case 10:u-=a,d-=i;case 11:t?(a+=u,i+=d):(a=u+=a,i=d+=i),o+=at(m,[[c.r1,c.r2]],[c.angle,c.largeArcFlag?1:0,c.sweepFlag?1:0],[u,d]);break;case 16:u-=a,p-=a,d-=i,g-=i;case 17:t?(a+=u,i+=d):(p+=a,g+=i,a=u+=a,i=d+=i),o+=at(m,[[p,g],[u,d]])}}return o};function at(e,t,n,r){ke.each(t,function(e,n){t[e]=ee(n)});var a=e+t.join(" ");return n&&(a+=" "+n.join(" ")),r&&(a+=" "+ee(r)),a}var it,ot,st,lt,ct,ut=(it=!1,ot=void 0,st=void 0,lt=null,ct=!1,{mouseDown:function(e,t,n,r){var a=void 0;if("path"!==Te.getCurrentMode()){if(Ie){Ie.storeD();var i=void 0;if("pathpointgrip_"===(a=e.target.id).substr(0,14)){i=Ie.cur_pt=parseInt(a.substr(14),10),Ie.dragging=[n,r];var o=Ie.segs[i];e.shiftKey?o.selected?Ie.removePtFromSelection(i):Ie.addPtsToSelection(i):((Ie.selected_pts.length<=1||!o.selected)&&Ie.clearSelection(),Ie.addPtsToSelection(i))}else if(a.startsWith("ctrlpointgrip_")){Ie.dragging=[n,r];var s=a.split("_")[1].split("c");i=Number(s[0]);var l=Number(s[1]);Ie.selectPt(i,l)}if(!Ie.dragging){var c=Te.getRubberBox();null==c&&(c=Te.setRubberBox(Te.selectorManager.getRubberBandBox()));var d=Te.getCurrentZoom();Qt(c,{x:n*d,y:r*d,width:0,height:0,display:"inline"},100)}}}else{var h=n,f=r,p=Te.getCurrentZoom(),g=h/p,v=f/p,m=Xt("path_stretch_line");ot=[g,v],Te.getGridSnapping()&&(g=Zt(g),v=Zt(v),h=Zt(h),f=Zt(f)),m||(m=document.createElementNS(u.SVG,"path"),Qt(m,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}),m=Xt("selectorParentGroup").appendChild(m)),m.setAttribute("display","inline");var _=void 0,y=Te.getDrawnPath();if(y){for(var b=y.pathSegList,x=b.numberOfItems,w=6/p,S=!1;x;){x--;var k=b.getItem(x),C=k.x,A=k.y;if(g>=C-w&&g<=C+w&&v>=A-w&&v<=A+w){S=!0;break}}a=Te.getId(),Xe(a);var E=Xt(a),G=void 0,P=void 0,N=b.numberOfItems;if(S){if(x<=1&&N>=2){var I=b.getItem(0).x,T=b.getItem(0).y;G=4===(P=m.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(I,T):y.createSVGPathSegCurvetoCubicAbs(I,T,P.x1/p,P.y1/p,I,T);var L=y.createSVGPathSegClosePath();b.appendItem(G),b.appendItem(L)}else if(N<3)return!1;if(ke(m).remove(),Te.setDrawnPath(null),Te.setStarted(!1),it){Ie.matrix&&Te.remapElement(E,{},Ie.matrix.inverse());var M=E.getAttribute("d"),O=ke(Ie.elem).attr("d");return ke(Ie.elem).attr("d",O+M),ke(E).remove(),Ie.matrix&&tt(),Le(),ut.toEditMode(Ie.elem),Ie.selectPt(),!1}}else{if(!ke.contains(Te.getContainer(),Te.getMouseTarget(e)))return console.log("Clicked outside canvas"),!1;var j=y.pathSegList.numberOfItems,V=y.pathSegList.getItem(j-1),R=V.x,B=V.y;if(e.shiftKey){var D=we(R,B,g,v);g=D.x,v=D.y}G=4===(P=m.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(Te.round(g),Te.round(v)):y.createSVGPathSegCurvetoCubicAbs(Te.round(g),Te.round(v),P.x1/p,P.y1/p,P.x2/p,P.y2/p),y.pathSegList.appendItem(G),g*=p,v*=p,m.setAttribute("d",["M",g,v,g,v].join(" ")),_=j,it&&(_+=Ie.segs.length),Ve(_,g,v)}}else{var U="M"+g+","+v+" ";Te.setDrawnPath(Te.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:U,id:Te.getNextId(),opacity:Te.getOpacity()/2}})),m.setAttribute("d",["M",h,f,h,f].join(" ")),_=it?Ie.segs.length:0,Ve(_,h,f)}}},mouseMove:function(e,t){var n=Te.getCurrentZoom();ct=!0;var r=Te.getDrawnPath();if("path"!==Te.getCurrentMode())if(Ie.dragging){var a=je({x:Ie.dragging[0],y:Ie.dragging[1]},Ie),i=je({x:e,y:t},Ie),o=i.x-a.x,s=i.y-a.y;Ie.dragging=[e,t],Ie.dragctrl?Ie.moveCtrl(o,s):Ie.movePts(o,s)}else Ie.selected_pts=[],Ie.eachSeg(function(e){if(this.next||this.prev){var t=Te.getRubberBox().getBBox(),n=Oe(this),r={x:n.x,y:n.y,width:0,height:0},a=Se(t,r);this.select(a),a&&Ie.selected_pts.push(this.index)}});else{if(!r)return;var l=r.pathSegList,c=l.numberOfItems-1;if(ot){var u=Be("1c1"),d=Be("0c2");u.setAttribute("cx",e),u.setAttribute("cy",t),u.setAttribute("display","inline");var h=ot[0],f=ot[1],p=h+(h-e/n),g=f+(f-t/n);d.setAttribute("cx",p*n),d.setAttribute("cy",g*n),d.setAttribute("display","inline");var v=De(1);if(Qt(v,{x1:e,y1:t,x2:p*n,y2:g*n,display:"inline"}),0===c)st=[e,t];else{var m=l.getItem(c-1),_=m.x,y=m.y;6===m.pathSegType?(_+=_-m.x2,y+=y-m.y2):st&&(_=st[0]/n,y=st[1]/n),Fe(6,c,[h,f,_,y,p,g],r)}}else{var b=Xt("path_stretch_line");if(b){var x=l.getItem(c);if(6===x.pathSegType){var w=x.x+(x.x-x.x2),S=x.y+(x.y-x.y2);Fe(6,1,[e,t,w*n,S*n,e,t],b)}else st?Fe(6,1,[e,t,st[0],st[1],e,t],b):Fe(4,1,[e,t],b)}}}},mouseUp:function(e,t,n,r){var a=Te.getDrawnPath();if("path"===Te.getCurrentMode())return ot=null,a||(t=Xt(Te.getId()),Te.setStarted(!1),st=null),{keep:!0,element:t};var i=Te.getRubberBox();if(Ie.dragging){var o=Ie.cur_pt;Ie.dragging=!1,Ie.dragctrl=!1,Ie.update(),ct&&Ie.endChanges("Move path point(s)"),e.shiftKey||ct||Ie.selectPt(o)}else i&&"none"!==i.getAttribute("display")?(i.setAttribute("display","none"),i.getAttribute("width")<=2&&i.getAttribute("height")<=2&&ut.toSelectMode(e.target)):ut.toSelectMode(e.target);ct=!1},toEditMode:function(e){Ie=We(e),Te.setCurrentMode("pathedit"),Te.clearSelection(),Ie.show(!0).update(),Ie.oldbbox=Ot(Ie.elem),it=!1},toSelectMode:function(e){var t=e===Ie.elem;Te.setCurrentMode("select"),Ie.show(!1),lt=!1,Te.clearSelection(),Ie.matrix&&tt(),t&&(Te.call("selected",[e]),Te.addToSelection([e],!0))},addSubPath:function(e){e?(Te.setCurrentMode("path"),it=!0):(ut.clear(!0),ut.toEditMode(Ie.elem))},select:function(e){lt===e?(ut.toEditMode(e),Te.setCurrentMode("pathedit")):lt=e},reorient:function(){var e=Te.getSelectedElements()[0];if(e&&0!==Yt(e)){var t=new de("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new ue(e,n)),Te.clearSelection(),this.resetOrientation(e),Te.addCommandToHistory(t),We(e).show(!1).matrix=null,this.clear(),Te.addToSelection([e],!0),Te.call("changed",Te.getSelectedElements())}},clear:function(e){var t=Te.getDrawnPath();if(lt=null,t){var n=Xt(Te.getId());ke(Xt("path_stretch_line")).remove(),ke(n).remove(),ke(Xt("pathpointgrip_container")).find("*").attr("display","none"),st=null,Te.setDrawnPath(null),Te.setStarted(!1)}else"pathedit"===Te.getCurrentMode()&&this.toSelectMode();Ie&&Ie.init().show(!1)},resetOrientation:function(e){if(null==e||"path"!==e.nodeName)return!1;var t=W(e),n=be(t).matrix;t.clear(),e.removeAttribute("transform");for(var r=e.pathSegList,a=r.numberOfItems,i=function(t){var a=r.getItem(t),i=a.pathSegType;if(1===i)return"continue";var o=[];ke.each(["",1,2],function(e,t){var r=a["x"+t],i=a["y"+t];if(void 0!==r&&void 0!==i){var s=ge(r,i,n);o.splice(o.length,0,s.x,s.y)}}),Fe(i,t,o,e)},o=0;o<a;++o)i(o);!function(e,t){for(var n=Ot(e),r=0;r<2;r++){var a=0===r?"fill":"stroke",i=e.getAttribute(a);if(i&&i.startsWith("url(")){var o=Wt(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=ge(s,l,t),h=ge(c,u,t),f={};f.x1=(d.x-n.x)/n.width,f.y1=(d.y-n.y)/n.height,f.x2=(h.x-n.x)/n.width,f.y2=(h.y-n.y)/n.height;var p=o.cloneNode(!0);ke(p).attr(f),p.id=Te.getNextId(),Tt().append(p),e.setAttribute(a,"url(#"+p.id+")")}}}}(e,n)},zoomChange:function(){"pathedit"===Te.getCurrentMode()&&Ie.update()},getNodePoint:function(){var e=Ie.selected_pts.length?Ie.selected_pts[0]:1,t=Ie.segs[e];return{x:t.item.x,y:t.item.y,type:t.type}},linkControlPoints:function(e){Pe=e},clonePathNode:function(){Ie.storeD();for(var e=Ie.selected_pts,t=e.length,n=[];t--;){var r=e[t];Ie.addSeg(r),n.push(r+t),n.push(r+t+1)}Ie.init().addPtsToSelection(n),Ie.endChanges("Clone path node(s)")},opencloseSubPath:function(){var e=Ie.selected_pts;if(1===e.length){var t=Ie.elem,n=t.pathSegList,r=e[0],a=null,i=null;if(Ie.eachSeg(function(e){return 2===this.type&&e<=r&&(i=this.item),e<=r||(2===this.type?(a=e,!1):1===this.type?(a=!1,!1):void 0)}),null==a&&(a=Ie.segs.length-1),!1!==a){var o=t.createSVGPathSegLinetoAbs(i.x,i.y),s=t.createSVGPathSegClosePath();return a===Ie.segs.length-1?(n.appendItem(o),n.appendItem(s)):(Me(t,s,a),Me(t,o,a)),void Ie.init().selectPt(a+1)}if(Ie.segs[r].mate)return n.removeItem(r),n.removeItem(r),void Ie.init().selectPt(r-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===r)n.removeItem(l);else if(1===d.pathSegType&&r<u){c=u-1,n.removeItem(u);break}}for(var h=r-l-1;h--;)Me(t,n.getItem(l),c);var f=n.getItem(l);Fe(2,l,[f.x,f.y]),Ie.init().selectPt(0)}},deletePathNode:function(){if(ut.canDeleteNodes){Ie.storeD();for(var e=Ie.selected_pts,t=e.length;t--;){var n=e[t];Ie.deleteSeg(n)}if(function e(){var t=Ie.elem.pathSegList,n=t.numberOfItems,r=function(e,n){for(;n--;)t.removeItem(e)};if(n<=1)return!0;for(;n--;){var a=t.getItem(n);if(1===a.pathSegType){var i=t.getItem(n-1),o=t.getItem(n-2);if(2===i.pathSegType){r(n-1,2),e();break}if(2===o.pathSegType){r(n-2,3),e();break}}else if(2===a.pathSegType&&n>0){var s=t.getItem(n-1).pathSegType;if(2===s){r(n-1,1),e();break}if(1===s&&t.numberOfItems-1===n){r(n,1),e();break}}}return!1}(),Ie.elem.pathSegList.numberOfItems<=1)return ut.toSelectMode(Ie.elem),void Te.canvas.deleteSelectedElements();if(Ie.init(),Ie.clearSelection(),window.opera){var r=ke(Ie.elem);r.attr("d",r.attr("d"))}Ie.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t=void 0,n=e.points,r=n.numberOfItems;if(r>=4){var a=n.getItem(0),i=null,o=[];for(o.push(["M",a.x,",",a.y," C"].join("")),t=1;t<=r-4;t+=3){var s=n.getItem(t),l=n.getItem(t+1),c=n.getItem(t+2);if(i){var u=ze(i,s,a);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(",")),a=c,i=l}for(o.push("L");t<r;){var h=n.getItem(t);o.push([h.x,h.y].join(",")),t++}o=o.join(" "),e=Te.addSVGElementFromJson({element:"path",curStyles:!0,attr:{id:Te.getId(),d:o,fill:"none"}})}return e},setSegType:function(e){Ie.setSegType(e)},moveNode:function(e,t){var n=Ie.selected_pts;if(n.length){Ie.storeD();var r=Ie.segs[n[0]],a={x:0,y:0};a[e]=t-r.item[e],r.move(a.x,a.y),Ie.endChanges("Move path point")}},fixEnd:function(e){for(var t=e.pathSegList,n=t.numberOfItems,r=void 0,a=0;a<n;++a){var i=t.getItem(a);if(2===i.pathSegType&&(r=i),1===i.pathSegType){var o=t.getItem(a-1);if(o.x!==r.x||o.y!==r.y){var s=e.createSVGPathSegLinetoAbs(r.x,r.y);Me(e,s,a),ut.fixEnd(e);break}}}L()&&Te.resetD(e)},convertPath:rt}),dt=U(jQuery),ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ft="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),pt=null,gt=null,vt=null,mt=null,_t=function(e){return e.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/,"$1$2")},yt=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")},bt=function(e){if(e=St(e),window.btoa)return window.btoa(e);var t=[];t.length=4*Math.floor((e.length+2)/3);var n=0,r=0;do{var a=e.charCodeAt(n++),i=e.charCodeAt(n++),o=e.charCodeAt(n++),s=a>>2,l=(3&a)<<4|i>>4,c=(15&i)<<2|o>>6,u=63&o;isNaN(i)?c=u=64:isNaN(o)&&(u=64),t[r++]=ht.charAt(s),t[r++]=ht.charAt(l),t[r++]=ht.charAt(c),t[r++]=ht.charAt(u)}while(n<e.length);return t.join("")},xt=function(e){if(window.atob)return wt(window.atob(e));e=e.replace(/[^A-Za-z0-9+\/=]/g,"");var t="",n=0;do{var r=ht.indexOf(e.charAt(n++)),a=ht.indexOf(e.charAt(n++)),i=ht.indexOf(e.charAt(n++)),o=ht.indexOf(e.charAt(n++)),s=r<<2|a>>4,l=(15&a)<<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 wt(t)},wt=function(e){return decodeURIComponent(escape(e))},St=function(e){return unescape(encodeURIComponent(e))},kt=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],r=atob(t[1]),a=r.length,i=new Uint8Array(a);a--;)i[a]=r.charCodeAt(a);var o=new Blob([i],{type:n});return URL.createObjectURL(o)},Ct=function(e){return e&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(e):""},At=function(){if("undefined"==typeof Blob)return"";var e=new Blob(["<html><head><title>SVG-edit</title></head><body>&nbsp;</body></html>"],{type:"text/html"});return Ct(e)}(),Et=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},Gt=function e(t,n){if(t&&1===t.nodeType){n(t);for(var r=t.childNodes.length;r--;)e(t.childNodes.item(r),n)}},Pt=function(e){if(e){if(e.startsWith('url("'))return e.substring(5,e.indexOf('"',6));if(e.startsWith("url('"))return e.substring(5,e.indexOf("'",6));if(e.startsWith("url("))return e.substring(4,e.indexOf(")"))}return null},Nt=function(e){return e.getAttributeNS(u.XLINK,"href")},It=function(e,t){e.setAttributeNS(u.XLINK,"xlink:href",t)},Tt=function(){var e=pt.getSVGContent(),t=e.getElementsByTagNameNS(u.SVG,"defs");return t.length>0?t=t[0]:(t=e.ownerDocument.createElementNS(u.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.append(t)),t},Lt=function(e){for(var t=e.pathSegList,n=t.numberOfItems,r=[[],[]],a=t.getItem(0),i=[a.x,a.y],o=0;o<n;o++){var s=t.getItem(o);void 0!==s.x&&(r[0].push(i[0]),r[1].push(i[1]),s.x1?function(){for(var e=[s.x1,s.y1],t=[s.x2,s.y2],n=[s.x,s.y],a=function(a){var o=function(r){return Math.pow(1-r,3)*i[a]+3*Math.pow(1-r,2)*r*e[a]+3*(1-r)*Math.pow(r,2)*t[a]+Math.pow(r,3)*n[a]},s=6*i[a]-12*e[a]+6*t[a],l=-3*i[a]+9*e[a]-9*t[a]+3*n[a],c=3*e[a]-3*i[a];if(0===l){if(0===s)return"continue";var u=-c/s;return u>0&&u<1&&r[a].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&&r[a].push(o(h));var f=(-s-Math.sqrt(d))/(2*l);f>0&&f<1&&r[a].push(o(f))},o=0;o<2;o++)a(o);i=n}():(r[0].push(s.x),r[1].push(s.y)))}var l=Math.min.apply(null,r[0]),c=Math.max.apply(null,r[0])-l,u=Math.min.apply(null,r[1]);return{x:l,y:u,width:c,height:Math.max.apply(null,r[1])-u}};function Mt(e){if(B())try{return e.getBBox()}catch(e){}var t=dt.data(e,"ref"),n=null,r=void 0,a=void 0;t?(a=dt(t).children().clone().attr("visibility","hidden"),dt(mt).append(a),n=a.filter("line, path")):n=dt(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?a:dt(e).children();r=Ft(o)}else r=e.getBBox();else r=e.getBBox();return t&&a.remove(),r}var Ot=function(e){var t=e||pt.geSelectedElements()[0];if(1!==e.nodeType)return null;var n,r=t.nodeName,a=null;switch(r){case"text":""===t.textContent?(t.textContent="a",a=t.getBBox(),t.textContent=""):t.getBBox&&(a=t.getBBox());break;case"path":G?t.getBBox&&(a=t.getBBox()):a=Lt(t);break;case"g":case"a":a=Mt(t);break;default:if("use"===r&&(a=Mt(t)),"use"===r||"foreignObject"===r&&L()){if(a||(a=t.getBBox()),!L()){var i={};i.width=a.width,i.height=a.height,i.x=a.x+parseFloat(t.getAttribute("x")||0),i.y=a.y+parseFloat(t.getAttribute("y")||0),a=i}}else if(ft.includes(r))if(t)try{a=t.getBBox()}catch(e){var o=t.getExtentOfChar(0),s=t.getComputedTextLength();a={x:o.x,y:o.y,width:s,height:o.height}}else{var l=dt(t).closest("foreignObject");l.length&&l[0].getBBox&&(a=l[0].getBBox())}}return a&&(a={x:(n=a).x,y:n.y,width:n.width,height:n.height}),a},jt=function(e){var t="";return dt.each(e,function(e,n){var r=l(n,2),a=r[0],i=r[1];t+=a;for(var o=0;o<i.length;o+=2)t+=i[o]+","+i[o+1]+" "}),t},Vt=function(e){var t=1.81,n=void 0,r=void 0,a=void 0,i=void 0;switch(e.tagName){case"ellipse":case"circle":var o=r=dt(e).attr(["rx","ry","cx","cy"]),s=o.cx,l=o.cy,c=r;a=c.rx,i=c.ry,"circle"===e.tagName&&(a=i=dt(e).attr("r")),n=jt([["M",[s-a,l]],["C",[s-a,l-i/t,s-a/t,l-i,s,l-i]],["C",[s+a/t,l-i,s+a,l-i/t,s+a,l]],["C",[s+a,l+i/t,s+a/t,l+i,s,l+i]],["C",[s-a/t,l+i,s-a,l+i/t,s-a,l]],["Z",[]]]);break;case"path":n=e.getAttribute("d");break;case"line":n="M"+(r=dt(e).attr(["x1","y1","x2","y2"])).x1+","+r.y1+"L"+r.x2+","+r.y2;break;case"polyline":n="M"+e.getAttribute("points");break;case"polygon":n="M"+e.getAttribute("points")+" Z";break;case"rect":var u=dt(e).attr(["rx","ry"]);a=u.rx,i=u.ry;var d=e.getBBox(),h=d.x,f=d.y,p=d.width,g=d.height;t=4-t,n=jt(a||i?[["M",[h,f+i]],["C",[h,f+i/t,h+a/t,f,h+a,f]],["L",[h+p-a,f]],["C",[h+p-a/t,f,h+p,f+i/t,h+p,f+i]],["L",[h+p,f+g-i]],["C",[h+p,f+g-i/t,h+p-a/t,f+g,h+p-a,f+g]],["L",[h+a,f+g]],["C",[h+a/t,f+g,h,f+g-i/t,h,f+g-i]],["L",[h,f+i]],["Z",[]]]:[["M",[h,f]],["L",[h+p,f]],["L",[h+p,f+g]],["L",[h,f+g]],["L",[h,f]],["Z",[]]])}return n},Rt=function(e){var t={};return dt.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){var n=e.getAttribute(this);n&&(t[this]=n)}),t},Bt=function(e,t,n){var r=t({element:"path",attr:Rt(e)}),a=e.getAttribute("transform");a&&r.setAttribute("transform",a);var i=e.parentNode;e.nextSibling?e.before(r):i.append(r);var o=Vt(e);o?r.setAttribute("d",o):r.remove(),n.resetOrientation(r);var s=!1;try{s=r.getBBox()}catch(e){}return r.remove(),s};var Dt=function(e,t,n){var r=Ot(e);if(!r)return null;var a=W(e),i=qt(a),o=_e(a);if(i||o){var s=!1;if(function(e,t){var n=e%90;return t||!(n>-.001&&n<.001||n<-89.99||n>89.99)}(i,o)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))r=s=Bt(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(r=s=Bt(e,t,n))}}if(!s){var u=be(a).matrix;r=ye(r.x,r.y,r.width,r.height,u).aabox}}return r};function Ut(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var Ft=function(e,t,n){if(!e||!e.length)return!1;var r=void 0;if(dt.each(e,function(){r||this.parentNode&&(r=Dt(this,t,n))}),void 0===r)return null;var a=r.x+r.width,i=r.y+r.height,o=r.x,s=r.y;if(1===e.length){var l=Ut(e[0]);o-=l,s-=l,a+=l,i+=l}else dt.each(e,function(e,r){var l=Dt(r,t,n);if(l){var c=Ut(r);o=Math.min(o,l.x-c),s=Math.min(s,l.y-c),1===r.nodeType&&(a=Math.max(a,l.x+l.width+c),i=Math.max(i,l.y+l.height+c))}});return r.x=o,r.y=s,r.width=a-o,r.height=i-s,r},Ht=function(e){e||(e=dt(pt.getSVGContent()).children());var t=[];return dt(e).children().each(function(e,n){n.getBBox&&t.push(n)}),t.reverse()},zt=function(e){return e||(e=Ht()),Ft(e,pt.addSVGElementFromJson,pt.pathActions)},qt=function(e,t){if(!e)return 0;for(var n=e.numberOfItems,r=0;r<n;++r){var a=e.getItem(r);if(4===a.type)return t?a.angle*Math.PI/180:a.angle}return 0},Yt=function(e,t){var n=e||pt.getSelectedElements()[0],r=W(n);return qt(r,t)},Wt=function(e){return Xt(Pt(e).substr(1))},Xt=S?function(e){return mt.querySelector("#"+e)}:k?function(e){return gt.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+e+'"]',vt,function(){return u.SVG},9,null).singleNodeValue}:function(e){return dt(mt).find("[id="+e+"]")[0]},Qt=function(e,t,n,r){var a=!0,i=!1,o=void 0;try{for(var s,c=Object.entries(t)[Symbol.iterator]();!(a=(s=c.next()).done);a=!0){var d=s.value,h=l(d,2),f=h[0],p=h[1],g="xml:"===f.substr(0,4)?u.XML:"xlink:"===f.substr(0,6)?u.XLINK:null;g?e.setAttributeNS(g,f,p):r?ne(e,f,p):e.setAttribute(f,p)}}catch(e){i=!0,o=e}finally{try{!a&&c.return&&c.return()}finally{if(i)throw o}}},Kt=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 r=t[n];e.getAttribute(n)===String(r)&&e.removeAttribute(n)}},Zt=function(e){var t=pt.getBaseUnit(),n=pt.getSnappingStep();return"px"!==t&&(n*=J()[t]),e=Math.round(e/n)*n},$t=function(e){dt(e).click(function(e){e.preventDefault()})},Jt=jQuery,en={},tn=function(e){Object.keys(en).length||Jt("#cmenu_canvas").append("<li class='separator'>");var t=e.shortcut||"";Jt("#cmenu_canvas").append("<li class='disabled'><a href='#"+e.id+"'>"+e.label+"<span class='shortcut'>"+t+"</span></a></li>")};function nn(e,t){["id","class","type"].forEach(function(n){n in t&&(e[n]=t[n])})}var rn,an,on=(rn=n(regeneratorRuntime.mark(function e(t,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",sn(t,i({},n,{returnDefault:!0})));case 1:case"end":return e.stop()}},e,this)})),function(e,t){return rn.apply(this,arguments)}),sn=(an=n(regeneratorRuntime.mark(function e(t,n){var r=n.global,a=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",cn(t,void 0,{returnDefault:a}));case 3:return e.next=5,ln(t);case 5:return e.abrupt("return",window[r]);case 6:case"end":return e.stop()}},e,this)})),function(e,t){return an.apply(this,arguments)});function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?Promise.all(e.map(function(e){return ln(e,t)})):new Promise(function(n,r){var a=document.createElement("script"),i=function(){a.onerror=null,a.onload=null,a.remove(),a.src=""};a.defer="defer",nn(a,t),a.onerror=function(){r(new Error("Failed to import: "+e)),i()},a.onload=function(){n(),i()},a.src=e,document.head.append(a)})}function cn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).returnDefault,r=void 0!==n&&n;return Array.isArray(e)?Promise.all(e.map(function(e){return cn(e,t)})):new Promise(function(n,a){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=""};nn(o,t),o.defer="defer",o.type="module",o.onerror=function(){a(new Error("Failed to import: "+e)),s()},o.onload=function(){n(window[i]),s()};var l="import * as m from '"+function(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}(e).replace(/'/g,"\\'")+"'; window."+i+" = "+(r?"m.default || ":"")+"m;",c=new Blob([l],{type:"text/javascript"});o.src=URL.createObjectURL(c),document.head.append(o)})}var un=jQuery,dn=function(){function e(t,n,a){if(r(this,e),this.name_=t,this.group_=a?null:n,a){var i=a.ownerDocument;this.group_=i.createElementNS(u.SVG,"g");var o=i.createElementNS(u.SVG,"title");o.textContent=t,this.group_.append(o),n?un(n).after(this.group_):a.append(this.group_)}hn(this.group_),Gt(this.group_,function(e){e.setAttribute("style","pointer-events:inherit")}),this.group_.setAttribute("style",a?"pointer-events:all":"pointer-events:none")}return a(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?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=yt(e);var r=this.getTitleElement();return r?(un(r).empty(),r.textContent=e,this.name_=e,t&&t.changeElement(r,{"#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 hn(e){var t=e.getAttribute("class");null!=t&&t.length?dn.CLASS_REGEX.test(t)||e.setAttribute("class",t+" "+dn.CLASS_NAME):e.setAttribute("class",dn.CLASS_NAME)}dn.CLASS_NAME="layer",dn.CLASS_REGEX=new RegExp("(\\s|^)"+dn.CLASS_NAME+"(\\s|$)");var fn=function(){function e(t){r(this,e),this.undoManager_=t,this.currentBatchCommand_=null,this.batchCommandStack_=[]}return a(e,[{key:"startBatchCommand",value:function(e){return this.undoManager_?(this.currentBatchCommand_=new de(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,r){return this.undoManager_?(this.addCommand_(new se(e,t,n,r)),this):this}},{key:"insertElement",value:function(e,t){return this.undoManager_?(this.addCommand_(new le(e,t)),this):this}},{key:"removeElement",value:function(e,t,n,r){return this.undoManager_?(this.addCommand_(new ce(e,t,n,r)),this):this}},{key:"changeElement",value:function(e,t,n){return this.undoManager_?(this.addCommand_(new ue(e,t,n)),this):this}},{key:"addCommand_",value:function(e){if(!this.undoManager_)return this;this.currentBatchCommand_?this.currentBatchCommand_.addSubCommand(e):this.undoManager_.addCommandToHistory(e)}}]),e}();fn.NO_HISTORY=new fn;var pn=jQuery,gn="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),vn={LET_DOCUMENT_DECIDE:0,ALWAYS_RANDOMIZE:1,NEVER_RANDOMIZE:2},mn=vn.LET_DOCUMENT_DECIDE,_n=[];function yn(e){return e||new fn(Sn.undoMgr)}function bn(e){for(var t=1;e.includes("Layer "+t);)t++;return"Layer "+t}var xn=function(){function e(t,n){if(r(this,e),!t||!t.tagName||!t.namespaceURI||"svg"!==t.tagName||t.namespaceURI!==u.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(u.SE,"nonce");a&&mn!==vn.NEVER_RANDOMIZE?this.nonce_=a:mn===vn.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(100001*Math.random()))}return a(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):pn(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(u.XMLNS,"xmlns:se",u.SE),this.svgElem_.setAttributeNS(u.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 r=this.current_layer.getName();(n=this.current_layer.setName(e,t))&&(delete this.layer_map[r],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 r=this.current_layer.getGroup(),a=r.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(r,i),this.identifyLayers(),this.setCurrentLayer(this.getLayerName(e)),{currentGroup:r,oldNextSibling:a}}return null}},{key:"mergeLayer",value:function(e){var t=this.current_layer.getGroup(),n=pn(t).prev()[0];if(n){e.startBatchCommand("Merge Layer");var r=t.nextSibling;for(e.removeElement(t,r,this.svgElem_);t.firstChild;){var a=t.firstChild;if("title"!==a.localName){var i=a.nextSibling;n.append(a),e.moveElement(a,i,t)}else e.removeElement(a,a.nextSibling,t),a.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,t=this.svgElem_.childNodes.length,n=[],r=[],a=null,i=!1,o=0;o<t;++o){var s=this.svgElem_.childNodes.item(o);if(s&&1===s.nodeType)if("g"===s.tagName){i=!0;var l=pn("title",e=s).text()||(T()&&e.querySelectorAll?pn(e.querySelectorAll("title")).text():"");l?(r.push(l),a=new dn(l,s),this.all_layers.push(a),this.layer_map[l]=a):n.push(s)}else gn.includes(s.nodeName)&&n.push(s)}n.length>0||!i?((a=new dn(bn(r),null,this.svgElem_)).appendChildren(n),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(),(null==e||""===e||this.layer_map[e])&&(e=bn(Object.keys(this.layer_map)));var n=new dn(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(),(null==e||""===e||this.layer_map[e])&&(e=bn(Object.keys(this.layer_map)));for(var n=this.current_layer.getGroup(),r=new dn(e,n,this.svgElem_),a=r.getGroup(),i=n.childNodes,o=0;o<i.length;o++){var s=i[o];"title"!==s.localName&&a.append(this.copyElem(s))}t&&(t.startBatchCommand("Duplicate Layer"),t.insertElement(a),t.endBatchCommand());var l=this.all_layers.indexOf(this.current_layer);return l>=0?this.all_layers.splice(l+1,0,r):this.all_layers.push(r),this.layer_map[e]=r,this.current_layer=r,a}},{key:"getLayerVisibility",value:function(e){var t=this.layer_map[e];return!!t&&t.isVisible()}},{key:"setLayerVisibility",value:function(e,t){if("boolean"!=typeof t)return null;var n=this.layer_map[e];return n?(n.setVisible(t),n.getGroup()):null}},{key:"getLayerOpacity",value:function(e){var t=this.layer_map[e];return t?t.getOpacity():null}},{key:"setLayerOpacity",value:function(e,t){if(!("number"!=typeof t||t<0||t>1)){var n=this.layer_map[e];n&&n.setOpacity(t)}}},{key:"copyElem",value:function(e){var t=this;return function e(t,n){var r=document.createElementNS(t.namespaceURI,t.nodeName);if(dt.each(t.attributes,function(e,t){"-moz-math-font-style"!==t.localName&&r.setAttributeNS(t.namespaceURI,t.nodeName,t.value)}),r.removeAttribute("id"),r.id=n(),L()&&"path"===t.nodeName){var a=rt(t);r.setAttribute("d",a)}if(dt.each(t.childNodes,function(t,a){switch(a.nodeType){case 1:r.append(e(a,n));break;case 3:r.textContent=a.nodeValue}}),dt(t).data("gsvg"))dt(r).data("gsvg",r.firstChild);else if(dt(t).data("symbol")){var i=dt(t).data("symbol");dt(r).data("ref",i).data("symbol",i)}else"image"===r.tagName&&$t(r);return r}(e,function(){return t.getNextId()})}}]),e}(),wn=function(e,t){(mn=!1===e?vn.NEVER_RANDOMIZE:vn.ALWAYS_RANDOMIZE)!==vn.ALWAYS_RANDOMIZE||t.getNonce()?mn===vn.NEVER_RANDOMIZE&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},Sn=void 0,kn=function(e){Sn=e},Cn=function(){An(),Sn.getCurrentDrawing().identifyLayers()},An=function(){var e=_n.length;if(e){for(var t=0;t<e;t++){var n=_n[t],r=Sn.elData(n,"orig_opac");1!==r?n.setAttribute("opacity",r):n.removeAttribute("opacity"),n.setAttribute("style","pointer-events: inherit")}_n=[],Sn.clearSelection(!0),Sn.call("contextset",null)}Sn.setCurrentGroup(null)},En=function(e){An(),"string"==typeof e&&(e=Xt(e)),Sn.setCurrentGroup(e),pn(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var e=this.getAttribute("opacity")||1;Sn.elData(this,"orig_opac",e),this.setAttribute("opacity",.33*e),this.setAttribute("style","pointer-events: none"),_n.push(this)}),Sn.clearSelection(),Sn.call("contextset",Sn.getCurrentGroup())},Gn=Object.freeze({Drawing:xn,randomizeIds:wn,init:kn,identifyLayers:Cn,createLayer:function(e,t){var n=Sn.getCurrentDrawing().createLayer(e,yn(t));Sn.clearSelection(),Sn.call("changed",[n])},cloneLayer:function(e,t){var n=Sn.getCurrentDrawing().cloneLayer(e,yn(t));Sn.clearSelection(),An(),Sn.call("changed",[n])},deleteCurrentLayer:function(){var e=Sn.getCurrentDrawing().getCurrentLayer(),t=e.nextSibling,n=e.parentNode;if(e=Sn.getCurrentDrawing().deleteCurrentLayer()){var r=new de("Delete Layer");return r.addSubCommand(new ce(e,t,n)),Sn.addCommandToHistory(r),Sn.clearSelection(),Sn.call("changed",[n]),!0}return!1},setCurrentLayer:function(e){var t=Sn.getCurrentDrawing().setCurrentLayer(yt(e));return t&&Sn.clearSelection(),t},renameCurrentLayer:function(e){var t=Sn.getCurrentDrawing(),n=t.getCurrentLayer();if(n&&t.setCurrentLayerName(e,yn()))return Sn.call("changed",[n]),!0;return!1},setCurrentLayerPosition:function(e){var t=Sn.getCurrentDrawing().setCurrentLayerPosition(e);return!!t&&(Sn.addCommandToHistory(new se(t.currentGroup,t.oldNextSibling,Sn.getSVGContent())),!0)},setLayerVisibility:function(e,t){var n=Sn.getCurrentDrawing(),r=n.getLayerVisibility(e),a=n.setLayerVisibility(e,t);if(!a)return!1;var i=r?"inline":"none";return Sn.addCommandToHistory(new ue(a,{display:i},"Layer Visibility")),a===n.getCurrentLayer()&&(Sn.clearSelection(),Sn.pathActions.clear()),!0},moveSelectedToLayer:function(e){var t=Sn.getCurrentDrawing().getLayerByName(e);if(!t)return!1;for(var n=new de("Move Elements to Layer"),r=Sn.getSelectedElements(),a=r.length;a--;){var i=r[a];if(i){var o=i.nextSibling,s=i.parentNode;t.append(i),n.addSubCommand(new se(i,o,s))}}return Sn.addCommandToHistory(n),!0},mergeLayer:function(e){Sn.getCurrentDrawing().mergeLayer(yn(e)),Sn.clearSelection(),An(),Sn.changeSVGContent()},mergeAllLayers:function(e){Sn.getCurrentDrawing().mergeAllLayers(yn(e)),Sn.clearSelection(),An(),Sn.changeSVGContent()},leaveContext:An,setContext:En,Layer:dn}),Pn=d(),Nn={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:[]},In={};Object.entries(Nn).forEach(function(e){var t=l(e,2),n=t[0],r=t[1],a={};Object.entries(r).forEach(function(e){var t=l(e,2),n=(t[0],t[1]);if(n.includes(":")){var r=n.split(":");a[r[1]]=u[r[0].toUpperCase()]}else a[n]="xmlns"===n?u.XMLNS:null}),In[n]=a});var Tn=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,r=t.parentNode;if(n&&r){var a=Nn[t.nodeName],i=In[t.nodeName];if(void 0!==a){for(var o=[],s=t.attributes.length;s--;){var c=t.attributes.item(s),d=c.nodeName,h=c.localName,f=c.namespaceURI;if(i.hasOwnProperty(h)&&f===i[h]&&f!==u.XMLNS||f===u.XMLNS&&Pn[c.value]||((d.startsWith("se:")||d.startsWith("data-"))&&o.push([d,c.value]),t.removeAttributeNS(f,h)),M())switch(d){case"transform":case"gradientTransform":case"patternTransform":var p=c.value.replace(/(\d)-/g,"$1 -");t.setAttribute(d,p)}if("style"===d){for(var g=c.value.split(";"),v=g.length;v--;){var m=g[v].split(":"),_=l(m,2),y=_[0],b=_[1],x=(y||"").trim(),w=(b||"").trim();a.includes(x)&&t.setAttribute(x,w)}t.removeAttribute("style")}}Object.values(o).forEach(function(e){var n=l(e,2),r=n[0],a=n[1];t.setAttributeNS(u.SE,r,a)});var S=Nt(t);if(S&&["filter","linearGradient","pattern","radialGradient","textPath","use"].includes(t.nodeName)&&"#"!==S[0]&&(It(t,""),t.removeAttributeNS(u.XLINK,"href")),"use"===t.nodeName&&!Nt(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=Pt(n))&&"#"!==n[0]&&(t.setAttribute(e,""),t.removeAttribute(e))}),s=t.childNodes.length;s--;)e(t.childNodes.item(s))}else{for(var k=[];t.hasChildNodes();)k.push(r.insertBefore(t.firstChild,t));t.remove();for(var C=k.length;C--;)e(k[C])}}}},Ln=jQuery,Mn=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],On=null,jn=function(e,t,n){for(var r=function(e,t){return ge(e,t,n)},a=function(e){return n.a*e},i=function(e){return n.d*e},o=On.getGridSnapping()&&"svg"===e.parentNode.parentNode.localName,s=function(){if(o)for(var n in t)t[n]=Zt(t[n]);Qt(e,t,1e3,!0)},l=Ot(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=Wt(d).cloneNode(!0);if(n.a<0){var f=h.getAttribute("x1"),p=h.getAttribute("x2");h.setAttribute("x1",-(f-1)),h.setAttribute("x2",-(p-1))}if(n.d<0){var g=h.getAttribute("y1"),v=h.getAttribute("y2");h.setAttribute("y1",-(g-1)),h.setAttribute("y2",-(v-1))}h.id=On.getDrawing().getNextId(),Tt().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 _=W(e),y=On.getSVGRoot().createSVGTransform();y.setMatrix(me(be(_).matrix,n)),_.clear(),_.appendItem(y)}else{var b=be(e).matrix,x=me(b.inverse(),n,b);t.x=parseFloat(t.x)+x.e,t.y=parseFloat(t.y)+x.f}switch(m){case"foreignObject":case"rect":case"image":if("image"===m&&(n.a<0||n.d<0)){var w=W(e),S=On.getSVGRoot().createSVGTransform();S.setMatrix(me(be(w).matrix,n)),w.clear(),w.appendItem(S)}else{var k=r(t.x,t.y);t.width=a(t.width),t.height=i(t.height),t.x=k.x+Math.min(0,t.width),t.y=k.y+Math.min(0,t.height),t.width=Math.abs(t.width),t.height=Math.abs(t.height)}s();break;case"ellipse":var C=r(t.cx,t.cy);t.cx=C.x,t.cy=C.y,t.rx=a(t.rx),t.ry=i(t.ry),t.rx=Math.abs(t.rx),t.ry=Math.abs(t.ry),s();break;case"circle":var A=r(t.cx,t.cy);t.cx=A.x,t.cy=A.y;var E=ye(l.x,l.y,l.width,l.height,n),G=E.tr.x-E.tl.x,P=E.bl.y-E.tl.y;t.r=Math.min(G/2,P/2),t.r&&(t.r=Math.abs(t.r)),s();break;case"line":var N=r(t.x1,t.y1),I=r(t.x2,t.y2);t.x1=N.x,t.y1=N.y,t.x2=I.x,t.y2=I.y;case"text":case"tspan":case"use":s();break;case"g":var T=Ln(e).data("gsvg");T&&Qt(T,t,1e3,!0);break;case"polyline":case"polygon":for(var L=t.points.length,M=0;M<L;++M){var O=t.points[M],j=r(O.x,O.y),V=j.x,R=j.y;t.points[M].x=V,t.points[M].y=R}for(var B="",D=0;D<L;++D){var U=t.points[D];B+=U.x+","+U.y+" "}e.setAttribute("points",B);break;case"path":var F=e.pathSegList,H=F.numberOfItems;t.d=[];for(var z=0;z<H;++z){var q=F.getItem(z);t.d[z]={type:q.pathSegType,x:q.x,y:q.y,x1:q.x1,y1:q.y1,x2:q.x2,y2:q.y2,r1:q.r1,r2:q.r2,angle:q.angle,largeArcFlag:q.largeArcFlag,sweepFlag:q.sweepFlag}}H=t.d.length;var Y=t.d[0],X=r(Y.x,Y.y);t.d[0].x=X.x,t.d[0].y=X.y;for(var Q=1;Q<H;++Q){var K=t.d[Q];if(K.type%2==0){var Z=r(void 0!==K.x?K.x:X.x,void 0!==K.y?K.y:X.y),$=r(K.x1,K.y1),J=r(K.x2,K.y2);K.x=Z.x,K.y=Z.y,K.x1=$.x,K.y1=$.y,K.x2=J.x,K.y2=J.y,K.r1=a(K.r1),K.r2=i(K.r2)}else K.x=a(K.x),K.y=i(K.y),K.x1=a(K.x1),K.y1=i(K.y1),K.x2=a(K.x2),K.y2=i(K.y2),K.r1=a(K.r1),K.r2=i(K.r2)}var ee="";H=t.d.length;for(var te=0;te<H;++te){var ne=t.d[te],re=ne.type;switch(ee+=Mn[re],re){case 13:case 12:ee+=ne.x+" ";break;case 15:case 14:ee+=ne.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:ee+=ne.x+","+ne.y+" ";break;case 7:case 6:ee+=ne.x1+","+ne.y1+" "+ne.x2+","+ne.y2+" "+ne.x+","+ne.y+" ";break;case 9:case 8:ee+=ne.x1+","+ne.y1+" "+ne.x+","+ne.y+" ";break;case 11:case 10:ee+=ne.r1+","+ne.r2+" "+ne.angle+" "+ +ne.largeArcFlag+" "+ +ne.sweepFlag+" "+ne.x+","+ne.y+" ";break;case 17:case 16:ee+=ne.x2+","+ne.y2+" "+ne.x+","+ne.y+" "}}e.setAttribute("d",ee)}},Vn=U(jQuery),Rn=void 0,Bn=function(e,t,n){var r=Wt(e).firstChild,a=W(r),i=Rn.getSVGRoot().createSVGTransform();i.setTranslate(t,n),a.appendItem(i),Dn(r)},Dn=function e(t){if(null==t)return null;if("svg"===t.nodeName&&navigator.userAgent.includes("Firefox/20"))return null;var n=Rn.getSVGRoot(),r=W(t);if(r&&r.numberOfItems>0){for(var a=r.numberOfItems,i=a;a--;){var o=r.getItem(a);if(0===o.type)r.removeItem(a);else if(1===o.type){if(ve(o.matrix)){if(1===i)return t.removeAttribute("transform"),null;r.removeItem(a)}}else 4===o.type&&0===o.angle&&r.removeItem(a)}if(1===r.numberOfItems&&Yt(t))return null}if(!r||0===r.numberOfItems)return t.setAttribute("transform",""),t.removeAttribute("transform"),null;if(r){for(var s=[],l=r.numberOfItems;l--;){var c=r.getItem(l);1===c.type?s.push([c.matrix,l]):s.length&&(s=[])}if(2===s.length){var d=n.createSVGTransformFromMatrix(me(s[1][0],s[0][0]));r.removeItem(s[0][1]),r.removeItem(s[1][1]),r.insertItemBefore(d,s[1][1])}if((l=r.numberOfItems)>=2&&1===r.getItem(l-2).type&&2===r.getItem(l-1).type){var h=n.createSVGTransform(),f=me(r.getItem(l-2).matrix,r.getItem(l-1).matrix);h.setMatrix(f),r.removeItem(l-2),r.removeItem(l-2),r.appendItem(h)}}switch(t.tagName){case"line":case"polyline":case"polygon":case"path":break;default:if(1===r.numberOfItems&&1===r.getItem(0).type||2===r.numberOfItems&&1===r.getItem(0).type&&4===r.getItem(0).type)return null}var p=Vn(t).data("gsvg"),g=new de("Transform"),v={},m=null,_=[];switch(t.tagName){case"line":_=["x1","y1","x2","y2"];break;case"circle":_=["cx","cy","r"];break;case"ellipse":_=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":_=["width","height","x","y"];break;case"use":case"text":case"tspan":_=["x","y"];break;case"polygon":case"polyline":(m={}).points=t.getAttribute("points");var y=t.points,b=y.numberOfItems;v.points=new Array(b);for(var x=0;x<b;++x){var w=y.getItem(x);v.points[x]={x:w.x,y:w.y}}break;case"path":(m={}).d=t.getAttribute("d"),v.d=t.getAttribute("d")}_.length?(v=Vn(t).attr(_),Vn.each(v,function(e,t){v[e]=re(e,t)})):p&&(v={x:Vn(p).attr("x")||0,y:Vn(p).attr("y")||0}),null==m&&(m=Vn.extend(!0,{},v),Vn.each(m,function(e,t){m[e]=re(e,t)})),m.transform=Rn.getStartTransform()||"";var S=void 0,k=void 0;if("g"===t.tagName&&!p||"a"===t.tagName){var C=Ot(t);S={x:C.x+C.width/2,y:C.y+C.height/2},k=ge(C.x+C.width/2,C.y+C.height/2,be(r).matrix);var A=Yt(t);if(A){var E=A*Math.PI/180,G=void 0;G=Math.abs(E)>1e-10?Math.sin(E)/(1-Math.cos(E)):2/E;for(var P=0;P<r.numberOfItems;++P){var N=r.getItem(P);if(4===N.type){var I=N.matrix;S.y=(G*I.e+I.f)/2,S.x=(I.e-G*I.f)/2,r.removeItem(P);break}}}var T=r.numberOfItems,M=0,O=0,j=0,V=void 0;T&&(V=r.getItem(0).matrix);var R=void 0;if(T>=3&&3===r.getItem(T-2).type&&2===r.getItem(T-3).type&&2===r.getItem(T-1).type){j=3;for(var B=r.getItem(T-3).matrix,D=r.getItem(T-2).matrix,U=r.getItem(T-1).matrix,F=t.childNodes,H=F.length;H--;){var z=F.item(H);if(M=0,O=0,1===z.nodeType){var q=W(z);if(!q)continue;var Y=be(q).matrix,X=Yt(z);if(R=Rn.getStartTransform(),Rn.setStartTransform(z.getAttribute("transform")),X||_e(q)){var Q=n.createSVGTransform();Q.setMatrix(me(B,D,U,Y)),q.clear(),q.appendItem(Q)}else{var K=me(Y.inverse(),U,Y),Z=n.createSVGMatrix();Z.e=-K.e,Z.f=-K.f;var $=me(Z.inverse(),Y.inverse(),B,D,U,Y,K.inverse()),J=n.createSVGTransform(),ee=n.createSVGTransform(),te=n.createSVGTransform();J.setTranslate(K.e,K.f),ee.setScale($.a,$.d),te.setTranslate(Z.e,Z.f),q.appendItem(te),q.appendItem(ee),q.appendItem(J)}g.addSubCommand(e(z)),Rn.setStartTransform(R)}}r.removeItem(T-1),r.removeItem(T-2),r.removeItem(T-3)}else if(T>=3&&1===r.getItem(T-1).type){j=3;var ne=be(r).matrix,ae=n.createSVGTransform();ae.setMatrix(ne),r.clear(),r.appendItem(ae)}else if((1===T||T>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){j=2;var ie=be(r).matrix;r.removeItem(0);var oe=be(r).matrix.inverse(),se=me(oe,ie);if(M=se.e,O=se.f,0!==M||0!==O){for(var le=t.childNodes,ce=le.length,he=[];ce--;){var fe=le.item(ce);if(1===fe.nodeType){if(fe.getAttribute("clip-path")){var pe=fe.getAttribute("clip-path");he.includes(pe)||(Bn(pe,M,O),he.push(pe))}R=Rn.getStartTransform(),Rn.setStartTransform(fe.getAttribute("transform"));var ye=W(fe);if(ye){var xe=n.createSVGTransform();xe.setTranslate(M,O),ye.numberOfItems?ye.insertItemBefore(xe,0):ye.appendItem(xe),g.addSubCommand(e(fe));for(var we=t.getElementsByTagNameNS(u.SVG,"use"),Se="#"+fe.id,ke=we.length;ke--;){var Ce=we.item(ke);if(Se===Nt(Ce)){var Ae=n.createSVGTransform();Ae.setTranslate(-M,-O),W(Ce).insertItemBefore(Ae,0),g.addSubCommand(e(Ce))}}Rn.setStartTransform(R)}}}Rn.setStartTransform(R)}}else{if(1!==T||1!==r.getItem(0).type||A){if(A){var Ee=n.createSVGTransform();Ee.setRotate(A,k.x,k.y),r.numberOfItems?r.insertItemBefore(Ee,0):r.appendItem(Ee)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}j=1;for(var Ge=r.getItem(0).matrix,Pe=t.childNodes,Ne=Pe.length;Ne--;){var Ie=Pe.item(Ne);if(1===Ie.nodeType){R=Rn.getStartTransform(),Rn.setStartTransform(Ie.getAttribute("transform"));var Te=W(Ie);if(!Te)continue;var Le=me(Ge,be(Te).matrix),Me=n.createSVGTransform();Me.setMatrix(Le),Te.clear(),Te.appendItem(Me,0),g.addSubCommand(e(Ie)),Rn.setStartTransform(R);var Oe=Ie.getAttribute("stroke-width");if("none"!==Ie.getAttribute("stroke")&&!isNaN(Oe)){var je=(Math.abs(Le.a)+Math.abs(Le.d))/2;Ie.setAttribute("stroke-width",Oe*je)}}}r.clear()}if(2===j){if(A){k={x:S.x+V.e,y:S.y+V.f};var Ve=n.createSVGTransform();Ve.setRotate(A,k.x,k.y),r.numberOfItems?r.insertItemBefore(Ve,0):r.appendItem(Ve)}}else if(3===j){var Re=be(r).matrix,Be=n.createSVGTransform();Be.setRotate(A,S.x,S.y);var De=Be.matrix,Ue=n.createSVGTransform();Ue.setRotate(A,k.x,k.y);var Fe=Ue.matrix.inverse(),He=Re.inverse(),ze=me(He,Fe,De,Re);if(M=ze.e,O=ze.f,0!==M||0!==O)for(var qe=t.childNodes,Ye=qe.length;Ye--;){var We=qe.item(Ye);if(1===We.nodeType){R=Rn.getStartTransform(),Rn.setStartTransform(We.getAttribute("transform"));var Xe=W(We),Qe=n.createSVGTransform();Qe.setTranslate(M,O),Xe.numberOfItems?Xe.insertItemBefore(Qe,0):Xe.appendItem(Qe),g.addSubCommand(e(We)),Rn.setStartTransform(R)}}A&&(r.numberOfItems?r.insertItemBefore(Ue,0):r.appendItem(Ue))}}else{var Ke=Ot(t);if(!Ke&&"path"!==t.tagName)return null;var Ze=void 0,$e=Yt(t);if($e){S={x:Ke.x+Ke.width/2,y:Ke.y+Ke.height/2},k=ge(Ke.x+Ke.width/2,Ke.y+Ke.height/2,be(r).matrix);for(var Je=$e*Math.PI/180,et=Math.abs(Je)>1e-10?Math.sin(Je)/(1-Math.cos(Je)):2/Je,tt=0;tt<r.numberOfItems;++tt){var nt=r.getItem(tt);if(4===nt.type){var rt=nt.matrix;S.y=(et*rt.e+rt.f)/2,S.x=(rt.e-et*rt.f)/2,r.removeItem(tt);break}}}var at=0,it=r.numberOfItems;if(!L()){var ot=t.getAttribute("fill");if(ot&&ot.startsWith("url(")){var st=Wt(ot),lt="pattern";if(st.tagName!==lt&&(lt="gradient"),"userSpaceOnUse"===st.getAttribute(lt+"Units")){Ze=be(r).matrix;var ct=W(st),ut=be(ct).matrix,dt="matrix("+[(Ze=me(Ze,ut)).a,Ze.b,Ze.c,Ze.d,Ze.e,Ze.f].join(",")+")";st.setAttribute(lt+"Transform",dt)}}}if(it>=3&&3===r.getItem(it-2).type&&2===r.getItem(it-3).type&&2===r.getItem(it-1).type)at=3,Ze=be(r,it-3,it-1).matrix,r.removeItem(it-1),r.removeItem(it-2),r.removeItem(it-3);else if(4===it&&1===r.getItem(it-1).type){at=3,Ze=be(r).matrix;var ht=n.createSVGTransform();ht.setMatrix(Ze),r.clear(),r.appendItem(ht),Ze=n.createSVGMatrix()}else if((1===it||it>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){at=2;var ft=r.getItem(0).matrix,pt=be(r,1).matrix,gt=pt.inverse();Ze=me(gt,ft,pt),r.removeItem(0)}else{if(1!==it||1!==r.getItem(0).type||$e){if($e){var vt=n.createSVGTransform();vt.setRotate($e,k.x,k.y),r.numberOfItems?r.insertItemBefore(vt,0):r.appendItem(vt)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}switch(Ze=be(r).matrix,t.tagName){case"line":v=Vn(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(v.points=t.getAttribute("points"),v.points){var mt=t.points,_t=mt.numberOfItems;v.points=new Array(_t);for(var yt=0;yt<_t;++yt){var bt=mt.getItem(yt);v.points[yt]={x:bt.x,y:bt.y}}}case"path":v.d=t.getAttribute("d"),at=1,r.clear()}}if(1!==at&&2!==at&&3!==at||jn(t,v,Ze),2===at){if($e){_e(r)||(k={x:S.x+Ze.e,y:S.y+Ze.f});var xt=n.createSVGTransform();xt.setRotate($e,k.x,k.y),r.numberOfItems?r.insertItemBefore(xt,0):r.appendItem(xt)}if("text"===t.tagName)for(var wt=t.childNodes,St=wt.length;St--;){var kt=wt.item(St);if("tspan"===kt.tagName){var Ct={x:Vn(kt).attr("x")||0,y:Vn(kt).attr("y")||0};jn(kt,Ct,Ze)}}}else if(3===at&&$e){var At=be(r).matrix,Et=n.createSVGTransform();Et.setRotate($e,S.x,S.y);var Gt=Et.matrix,Pt=n.createSVGTransform();Pt.setRotate($e,k.x,k.y);var It=Pt.matrix.inverse(),Tt=At.inverse(),Lt=me(Tt,It,Gt,At);jn(t,v,Lt),$e&&(r.numberOfItems?r.insertItemBefore(Pt,0):r.appendItem(Pt))}}return 0===r.numberOfItems&&t.removeAttribute("transform"),g.addSubCommand(new ue(t,m)),g},Un=jQuery,Fn=void 0,Hn=void 0,zn=void 0,qn=R()?10:4,Yn=function(){function e(t,n,a){r(this,e),this.id=t,this.selectedElement=n,this.locked=!0,this.selectorGroup=Fn.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}}),this.selectorRect=this.selectorGroup.appendChild(Fn.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 a(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=[],r=Math.round(e/45);for(t in r<0&&(r+=8),zn.selectorGrips)n.push(t);for(;r>0;)n.push(n.shift()),r--;var a=0;for(t in zn.selectorGrips)zn.selectorGrips[t].setAttribute("style","cursor:"+n[a]+"-resize"),a++}},{key:"showGrips",value:function(e){var t=e?"inline":"none";zn.selectorGripsGroup.setAttribute("display",t);var n=this.selectedElement;this.hasGrips=e,n&&e&&(this.selectorGroup.append(zn.selectorGripsGroup),this.updateGripCursors(Yt(n)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=zn,r=n.selectorGrips,a=this.selectedElement,i=a.getAttribute("stroke-width"),o=Fn.getCurrentZoom(),s=1/o;"none"===a.getAttribute("stroke")||isNaN(i)||(s+=i/2);var l=a.tagName;"text"===l&&(s+=2/o);var c=W(a),u=be(c).matrix;if(u.e*=o,u.f*=o,e||(e=Ot(a)),"g"===l&&!Un.data(a,"gsvg")){var d=Ft([a.childNodes]);d&&(e=d)}var h=e.x,f=e.y,p=e.width,g=e.height;s*=o;var v=ye(h*o,f*o,p*o,g*o,u),m=v.aabox,_=m.x-s,y=m.y-s,b=m.width+2*s,x=m.height+2*s,w=_+b/2,S=y+x/2,k=Yt(a);if(k){var C=Fn.svgRoot().createSVGTransform();C.setRotate(-k,w,S);var A=C.matrix;v.tl=ge(v.tl.x,v.tl.y,A),v.tr=ge(v.tr.x,v.tr.y,A),v.bl=ge(v.bl.x,v.bl.y,A),v.br=ge(v.br.x,v.br.y,A);var E=v.tl,G=E.x,P=E.y,N=E.x,I=E.y,T=Math.min,L=Math.max;_=G=T(G,T(v.tr.x,T(v.bl.x,v.br.x)))-s,y=P=T(P,T(v.tr.y,T(v.bl.y,v.br.y)))-s,b=(N=L(N,L(v.tr.x,L(v.bl.x,v.br.x)))+s)-G,x=(I=L(I,L(v.tr.y,L(v.bl.y,v.br.y)))+s)-P}var M="M"+_+","+y+" L"+(_+b)+","+y+" "+(_+b)+","+(y+x)+" "+_+","+(y+x)+"z";t.setAttribute("d",M);var O=k?"rotate("+[k,w,S].join(",")+")":"";for(var j in this.selectorGroup.setAttribute("transform",O),this.gripCoords={nw:[_,y],ne:[_+b,y],sw:[_,y+x],se:[_+b,y+x],n:[_+b/2,y],w:[_,y+x/2],e:[_+b,y+x/2],s:[_+b/2,y+x]},this.gripCoords){var V=this.gripCoords[j];r[j].setAttribute("cx",V[0]),r[j].setAttribute("cy",V[1])}n.rotateGripConnector.setAttribute("x1",_+b/2),n.rotateGripConnector.setAttribute("y1",y),n.rotateGripConnector.setAttribute("x2",_+b/2),n.rotateGripConnector.setAttribute("y2",y-5*qn),n.rotateGrip.setAttribute("cx",_+b/2),n.rotateGrip.setAttribute("cy",y-5*qn)}}]),e}(),Wn=function(){function e(){r(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 a(e,[{key:"initGroup",value:function(){for(var e in this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.remove(),this.selectorParentGroup=Fn.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=Fn.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.append(this.selectorGripsGroup),Fn.svgRoot().append(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,this.selectorGrips){var t=Fn.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+e,fill:"#22C",r:qn,style:"cursor:"+e+"-resize","stroke-width":2,"pointer-events":"all"}});Un.data(t,"dir",e),Un.data(t,"type","resize"),this.selectorGrips[e]=this.selectorGripsGroup.appendChild(t)}if(this.rotateGripConnector=this.selectorGripsGroup.appendChild(Fn.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(Fn.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:qn,stroke:"#22C","stroke-width":2,style:"cursor:url("+Hn.imgPath+"rotate.png) 12 12, auto;"}})),Un.data(this.rotateGrip,"type","rotate"),!Un("#canvasBackground").length){var n=l(Hn.dimensions,2),r=n[0],a=n[1],i=Fn.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:r,height:a,x:0,y:0,overflow:L()?"none":"visible",style:"pointer-events:none"}}),o=Fn.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),Fn.svgRoot().insertBefore(i,Fn.svgContent())}}},{key:"requestSelector",value:function(e,n){if(null==e)return null;var r=this.selectors.length;if("object"===t(this.selectorMap[e.id]))return this.selectorMap[e.id].locked=!0,this.selectorMap[e.id];for(var a=0;a<r;++a)if(this.selectors[a]&&!this.selectors[a].locked)return this.selectors[a].locked=!0,this.selectors[a].reset(e,n),this.selectorMap[e.id]=this.selectors[a],this.selectors[a];return this.selectors[r]=new Yn(r,e,n),this.selectorParentGroup.append(this.selectors[r].selectorGroup),this.selectorMap[e.id]=this.selectors[r],this.selectors[r]}},{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 r=0;r<t;++r)if(this.selectors[r]&&this.selectors[r]===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(Fn.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}(),Xn=U(jQuery),Qn=se,Kn=le,Zn=ce,$n=ue,Jn=de,er=he,tr=ie;window.console||(window.console={},window.console.log=function(e){},window.console.dir=function(e){}),window.opera&&(window.console.log=function(e){window.opera.postError(e)},window.console.dir=function(e){});var nr=function e(a,i){r(this,e);var o={show_outside_canvas:!0,selectNew:!0,dimensions:[640,480]};i&&Xn.extend(o,i);var s=o.dimensions,h=this,f=a.ownerDocument,p=f.importNode(Et('<svg id="svgroot" xmlns="'+u.SVG+'" xlinkns="'+u.XLINK+'" width="'+s[0]+'" height="'+s[1]+'" x="'+s[0]+'" y="'+s[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);a.append(p);var g=f.createElementNS(u.SVG,"svg");(h.clearSvgContentElement=function(){Xn(g).empty(),Xn(g).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:o.show_outside_canvas?"visible":"hidden",xmlns:u.SVG,"xmlns:se":u.SE,"xmlns:xlink":u.XLINK}).appendTo(p);var e=f.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");g.append(e)})();var v="svg_";h.setIdPrefix=function(e){v=e},h.current_drawing_=new xn(g,v);var m=h.getCurrentDrawing=function(){return h.current_drawing_},_=1,y=null,b={shape:{fill:("none"===o.initFill.color?"":"#")+o.initFill.color,fill_paint:null,fill_opacity:o.initFill.opacity,stroke:"#"+o.initStroke.color,stroke_paint:null,stroke_opacity:o.initStroke.opacity,stroke_width:o.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:o.initOpacity}};b.text=Xn.extend(!0,{},b.shape),Xn.extend(b.text,{fill:"#000000",stroke_width:o.text&&o.text.stroke_width,font_size:o.text&&o.text.font_size,font_family:o.text&&o.text.font_family});var x=b.shape,w=[],S=this.getJsonFromSvgElement=function(e){if(3===e.nodeType)return e.nodeValue;for(var t,n={element:e.tagName,attr:{},children:[]},r=0;t=e.attributes[r];r++)n.attr[t.name]=t.value;for(var a,i=0;a=e.childNodes[i];i++)n.children[i]=S(a);return n},k=this.addSVGElementFromJson=function(e){if("string"==typeof e)return f.createTextNode(e);var t=Xt(e.attr.id),n=m().getCurrentLayer();if(t&&e.element!==t.tagName&&(t.remove(),t=null),!t){var r=e.namespace||u.SVG;t=f.createElementNS(r,e.element),n&&(y||n).append(t)}return e.curStyles&&Qt(t,{fill:x.fill,stroke:x.stroke,"stroke-width":x.stroke_width,"stroke-dasharray":x.stroke_dasharray,"stroke-linejoin":x.stroke_linejoin,"stroke-linecap":x.stroke_linecap,"stroke-opacity":x.stroke_opacity,"fill-opacity":x.fill_opacity,opacity:x.opacity/2,style:"pointer-events:inherit"},100),Qt(t,e.attr,100),Kt(t),e.children&&e.children.forEach(function(e){t.append(k(e))}),t};h.getTransformList=W,h.matrixMultiply=me,h.hasMatrixTransform=_e,h.transformListToTransform=be;var C=function(){return o.baseUnit};!function(e){Z=e;var t=document.createElementNS(u.SVG,"svg");document.body.append(t);var n=document.createElementNS(u.SVG,"rect");n.setAttribute("width","1em"),n.setAttribute("height","1ex"),n.setAttribute("x","1in"),t.append(n);var r=n.getBBox();t.remove();var a=r.x;$={em:r.width,ex:r.height,in:a,cm:a/2.54,mm:a/25.4,pt:a/72,pc:a/6,px:1,"%":0}}({getBaseUnit:C,getElement:Xt,getHeight:function(){return g.getAttribute("height")/_},getWidth:function(){return g.getAttribute("width")/_},getRoundDigits:function(){return ke.round_digits}}),h.convertToNum=re;var A,G=function(){return g},P=this.getSelectedElems=function(){return w},N=ut,I=function(){return p};pt=A={pathActions:N,getSVGContent:G,addSVGElementFromJson:k,getSelectedElements:P,getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:I,getBaseUnit:C,getSnappingStep:function(){return o.snappingStep}},gt=A.getDOMDocument(),vt=A.getDOMContainer(),mt=A.getSVGRoot(),h.findDefs=Tt,h.getUrlFromAttr=Pt,h.getHref=Nt,h.setHref=It,h.getBBox=Ot,h.getRotationAngle=Yt,h.getElem=Xt,h.getRefElem=Wt,h.assignAttributes=Qt,this.cleanupElement=Kt;var T=function(){return o.gridSnapping};!function(e){On=e}({getDrawing:function(){return m()},getSVGRoot:I,getGridSnapping:T}),this.remapElement=jn,function(e){Rn=e}({getSVGRoot:I,getStartTransform:function(){return Oe},setStartTransform:function(e){Oe=e}}),this.recalculateDimensions=Dn;var V=d();h.sanitizeSvg=Tn;var R=h.undoMgr=new er({handleHistoryEvent:function(e,t){var n=tr;if(e===n.BEFORE_UNAPPLY||e===n.BEFORE_APPLY)h.clearSelection();else if(e===n.AFTER_APPLY||e===n.AFTER_UNAPPLY){var r=t.elements();h.pathActions.clear(),Q("changed",r);var a=t.type(),i=e===n.AFTER_APPLY;if(a===Qn.type())(i?t.newParent:t.oldParent)===g&&Cn();else if(a===Kn.type()||a===Zn.type())t.parent===g&&Cn(),a===Kn.type()?i&&he(t.elem):i||he(t.elem),"use"===t.elem.tagName&&Jt(t.elem);else if(a===$n.type()){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===g&&Cn();var o=i?t.newValues:t.oldValues;o.stdDeviation&&h.setBlurOffsets(t.elem.parentNode,o.stdDeviation)}}}}),B=function(e){h.undoMgr.addCommandToHistory(e)},U=this.getZoom=function(){return _},F=this.round=function(e){return parseInt(e*_,10)/_};!function(e,t){Hn=e,Fn=t,zn=new Wn}(o,{createSVGElement:function(e){return h.addSVGElementFromJson(e)},svgRoot:function(){return p},svgContent:function(){return g},getCurrentZoom:U});var H=this.selectorManager=zn,Y=h.getNextId=function(){return m().getNextId()},X=h.getId=function(){return m().getId()},Q=function(e,t){if(We[e])return We[e](window,t)},K=this.clearSelection=function(e){w.forEach(function(e){null!=e&&H.releaseSelector(e)}),w=[],e||Q("selected",w)},ne=this.addToSelection=function(e,t){if(e.length){for(var n=0;n<w.length&&null!=w[n];)++n;for(var r=e.length;r--;){var a=e[r];if(a){var i=Ot(a);if(i&&("a"===a.tagName&&1===a.childNodes.length&&(a=a.firstChild),!w.includes(a))){w[n]=a,n++;var o=H.requestSelector(a,i);w.length>1&&o.showGrips(!1)}}}for(Q("selected",w),t||1===w.length?H.requestSelector(w[0]).showGrips(!0):H.requestSelector(w[0]).showGrips(!1),w.sort(function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):null==e?1:void 0});null==w[0];)w.shift(0)}},ae=function(){return x.opacity},ie=this.getMouseTarget=function(e){if(null==e)return null;var t=e.target;if(t.correspondingUseElement&&(t=t.correspondingUseElement),[u.MATH,u.HTML].includes(t.namespaceURI)&&"svgcanvas"!==t.id)for(;"foreignObject"!==t.nodeName;)if(!(t=t.parentNode))return p;var n=m().getCurrentLayer();if([p,a,g,n].includes(t))return p;if(Xn(t).closest("#selectorParentGroup").length)return H.selectorParentGroup;for(;t.parentNode!==(y||n);)t=t.parentNode;return t};h.pathActions=N,Le({selectorManager:H,canvas:h,call:Q,resetD:function(e){e.setAttribute("d",N.convertPath(e))},round:F,clearSelection:K,addToSelection:ne,addCommandToHistory:B,remapElement:jn,addSVGElementFromJson:k,getGridSnapping:T,getOpacity:ae,getSelectedElements:P,getContainer:function(){return a},setStarted:function(e){Me=e},getRubberBox:function(){return De},setRubberBox:function(e){return De=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;N.canDeleteNodes=!0,N.closed_subpath=t,Q("pointsAdded",{closedSubpath:t,grips:n}),Q("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;B(t),Q("changed",[n])},getCurrentZoom:U,getId:X,getNextId:Y,getMouseTarget:ie,getCurrentMode:function(){return je},setCurrentMode:function(e){return je=e},getDrawnPath:function(){return Mt},setDrawnPath:function(e){return Mt=e},getSVGRoot:I});var oe={},se="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",le=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],ce=Xn.data,ue=document.createElementNS(u.SVG,"animate");Xn(ue).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(p);var de,he=function e(t){var n=Xn(t).attr(le);for(var r in n){var a=n[r];if(a&&a.startsWith("url(")){var i=Pt(a).substr(1);Xt(i)||(Tt().append(Pe[i]),delete Pe[i])}}var o=t.getElementsByTagName("*");if(o.length)for(var s=0,l=o.length;s<l;s++)e(o[s])},pe={},ke={round_digits:5},Ce={},Ae=b.text,Ge={},Pe={},Te=o.imgPath+"logo.png",Me=!1,Oe=null,je="select",Ve="none",Re=x,Be=null,De=null,Ue=[],Fe=null,He=this.runExtensions=function(e,t,n){var r=!!n&&[];return Xn.each(Ge,function(a,i){i&&e in i&&("function"==typeof t&&(t=t(a)),n?r.push(i[e](t)):r=i[e](t))}),r};this.addExtension=(de=n(regeneratorRuntime.mark(function e(t,n,r){var a,i;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(t in Ge){e.next=12;break}return a=Xn.extend(h.getPrivateMethods(),{importLocale:r,svgroot:p,svgcontent:g,nonce:m().getNonce(),selectorManager:H}),e.next=6,n(a);case 6:return(i=e.sent)&&(i.name=t),Ge[t]=i,e.abrupt("return",Q("extension_added",i));case 12:console.log('Cannot add extension "'+t+'", an extension by that name already exists.');case 13:case"end":return e.stop()}},e,this)})),function(e,t,n){return de.apply(this,arguments)});var ze=this.getIntersectionList=function(e){if(null==De)return null;var t=y||m().getCurrentLayer(),n=void 0;if(e)(n=g.createSVGRect()).x=e.x,n.y=e.y,n.width=e.width,n.height=e.height;else{n=De.getBBox();var r=g.createSVGRect();for(var a in n)r[a]=n[a]/_;n=r}var i=null;if(O||"function"==typeof p.getIntersectionList&&(n.x+=parseInt(g.getAttribute("x"),10),n.y+=parseInt(g.getAttribute("y"),10),i=p.getIntersectionList(n,t)),null==i||"function"!=typeof i.item){i=[],Ue.length||(Ue=qe(t));for(var o=Ue.length;o--;)n.width&&Se(n,Ue[o].bbox)&&i.push(Ue[o].elem)}return i};this.getStrokedBBox=zt,this.getVisibleElements=Ht;var qe=this.getVisibleElementsAndBBoxes=function(e){e||(e=Xn(g).children());var t=[];return Xn(e).children().each(function(e,n){n.getBBox&&t.push({elem:n,bbox:zt([n])})}),t.reverse()},Ye=this.groupSvgElem=function(e){var t=document.createElementNS(u.SVG,"g");e.replaceWith(t),Xn(t).append(e).data("gsvg",e)[0].id=Y()},We={};h.call=Q,h.bind=function(e,t){var n=We[e];return We[e]=t,n},this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement),[].concat(c(e.getElementsByTagNameNS(u.SVG,"path"))).forEach(function(e){e.setAttribute("d",N.convertPath(e)),N.fixEnd(e)})};var Qe=function(e){if(!M())return e;var t=e.cloneNode(!0);return e.before(t),e.remove(),H.releaseSelector(e),w[0]=t,H.requestSelector(t).showGrips(!0),t};this.setRotationAngle=function(e,t){e=parseFloat(e);var n=w[0],r=n.getAttribute("transform"),a=Ot(n),i=a.x+a.width/2,o=a.y+a.height/2,s=W(n);s.numberOfItems>0&&(4===s.getItem(0).type&&s.removeItem(0));if(0!==e){var l=ge(i,o,be(s).matrix),c=p.createSVGTransform();c.setRotate(e,l.x,l.y),s.numberOfItems?s.insertItemBefore(c,0):s.appendItem(c)}else 0===s.numberOfItems&&n.removeAttribute("transform");if(!t){var u=n.getAttribute("transform");n.setAttribute("transform",r),un("transform",u,w),Q("changed",w)}var d=H.requestSelector(w[0]);d.resize(),d.updateGripCursors(e)};var Ke=this.recalculateAllSelectedDimensions=function(){for(var e=new Jn("none"===Ve?"position":"size"),t=w.length;t--;){var n=w[t],r=Dn(n);r&&e.addSubCommand(r)}e.isEmpty()||(B(e),Q("changed",w))},Ze=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},$e=null,Je=this.selectOnly=function(e,t){K(!0),ne(e,t)};this.removeFromSelection=function(e){if(null!=w[0]&&e.length){for(var t=[],n=w.length,r=0;r<n;++r){var a=w[r];a&&(e.includes(a)?H.releaseSelector(a):t.push(a))}w=t}},this.selectAllInCurrentLayer=function(){var e=m().getCurrentLayer();e&&(je="select",Je(Xn(y||e).children()))};var et,tt,nt,rt,at,it,ot,st,lt,ct,ht,ft,wt,St,At,Mt=null;et={minx:null,miny:null,maxx:null,maxy:null},tt=null,nt=null,rt=null,at=null,it={},ot=0,st={x:0,y:0},lt={x:0,y:0},ct={x:0,y:0},ht={x:0,y:0},ft={x:0,y:0},wt={x:0,y:0},St=void 0,At=function(e){var t={x:0,y:0},n=st,r=lt,a=ct,i=ht,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]+r.x*l[0][1]+a.x*l[0][2]+i.x*l[0][3])*s+(n.x*l[1][0]+r.x*l[1][1]+a.x*l[1][2]+i.x*l[1][3])*o+(n.x*l[2][0]+r.x*l[2][1]+a.x*l[2][2]+i.x*l[2][3])*e+(n.x*l[3][0]+r.x*l[3][1]+a.x*l[3][2]+i.x*l[3][3])),t.y=1/6*((n.y*l[0][0]+r.y*l[0][1]+a.y*l[0][2]+i.y*l[0][3])*s+(n.y*l[1][0]+r.y*l[1][1]+a.y*l[1][2]+i.y*l[1][3])*o+(n.y*l[2][0]+r.y*l[2][1]+a.y*l[2][2]+i.y*l[2][3])*e+(n.y*l[3][0]+r.y*l[3][1]+a.y*l[3][2]+i.y*l[3][3])),{x:t.x,y:t.y}},Xn(a).mousedown(function(e){if(!h.spaceKey&&1!==e.button){var t=2===e.button;e.altKey&&h.cloneSelectedElements(0,0),$e=Xn("#svgcontent g")[0].getScreenCTM().inverse();var n=ge(e.pageX,e.pageY,$e),r=n.x*_,a=n.y*_;e.preventDefault(),t&&(je="select",Fe=n);var i=r/_,s=a/_,l=ie(e);"a"===l.tagName&&1===l.childNodes.length&&(l=l.firstChild);var c=i;rt=tt=i;var u=s;if(at=nt=s,o.gridSnapping&&(i=Zt(i),s=Zt(s),tt=Zt(tt),nt=Zt(nt)),l===H.selectorParentGroup&&null!=w[0]){var d=e.target,f=ce(d,"type");"rotate"===f?je="rotate":"resize"===f&&(je="resize",Ve=ce(d,"dir")),l=w[0]}Oe=l.getAttribute("transform");var g=void 0,v=void 0,m=W(l);switch(je){case"select":if(Me=!0,Ve="none",t&&(Me=!1),l!==p){if(w.includes(l)||(e.shiftKey||K(!0),ne([l]),Be=l,N.clear()),!t)for(g=0;g<w.length;++g)if(null!=w[g]){var y=W(w[g]);y.numberOfItems?y.insertItemBefore(p.createSVGTransform(),0):y.appendItem(p.createSVGTransform())}}else t||(K(),je="multiselect",null==De&&(De=H.getRubberBandBox()),Qt(De,{x:rt*=_,y:at*=_,width:0,height:0,display:"inline"},100));break;case"zoom":Me=!0,null==De&&(De=H.getRubberBandBox()),Qt(De,{x:c*_,y:c*_,width:0,height:0,display:"inline"},100);break;case"resize":Me=!0,tt=i,nt=s,it=Ot(Xn("#selectedBox0")[0]);var b={};Xn.each(it,function(e,t){b[e]=t/_}),it=b;var S=Yt(l)?1:0;if(_e(m))m.insertItemBefore(p.createSVGTransform(),S),m.insertItemBefore(p.createSVGTransform(),S),m.insertItemBefore(p.createSVGTransform(),S);else if(m.appendItem(p.createSVGTransform()),m.appendItem(p.createSVGTransform()),m.appendItem(p.createSVGTransform()),D()){var C=L(),A=void 0;C&&(A=function(e){var t=e.getAttributeNS(null,"stroke");e.removeAttributeNS(null,"stroke"),null!==t&&setTimeout(function(){e.setAttributeNS(null,"stroke",t)},0)}),l.style.vectorEffect="non-scaling-stroke",C&&A(l);var E=l.getElementsByTagName("*"),G=E.length;for(g=0;g<G;g++)E[g].style&&(E[g].style.vectorEffect="non-scaling-stroke",C&&A(E[g]))}break;case"fhellipse":case"fhrect":case"fhpath":ct.x=c,ct.y=u,Me=!0,k({element:"polyline",curStyles:!0,attr:{points:c+","+u+" ",id:Y(),fill:"none",opacity:x.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}}),et.minx=c,et.maxx=c,et.miny=u,et.maxy=u;break;case"image":Me=!0;var P=k({element:"image",attr:{x:i,y:s,width:0,height:0,id:Y(),opacity:x.opacity/2,style:"pointer-events:inherit"}});It(P,Te),$t(P);break;case"square":case"rect":Me=!0,tt=i,nt=s,k({element:"rect",curStyles:!0,attr:{x:i,y:s,width:0,height:0,id:Y(),opacity:x.opacity/2}});break;case"line":Me=!0,v=0===Number(x.stroke_width)?1:x.stroke_width,k({element:"line",curStyles:!0,attr:{x1:i,y1:s,x2:i,y2:s,id:Y(),stroke:x.stroke,"stroke-width":v,"stroke-dasharray":x.stroke_dasharray,"stroke-linejoin":x.stroke_linejoin,"stroke-linecap":x.stroke_linecap,"stroke-opacity":x.stroke_opacity,fill:"none",opacity:x.opacity/2,style:"pointer-events:none"}});break;case"circle":Me=!0,k({element:"circle",curStyles:!0,attr:{cx:i,cy:s,r:0,id:Y(),opacity:x.opacity/2}});break;case"ellipse":Me=!0,k({element:"ellipse",curStyles:!0,attr:{cx:i,cy:s,rx:0,ry:0,id:Y(),opacity:x.opacity/2}});break;case"text":Me=!0,k({element:"text",curStyles:!0,attr:{x:i,y:s,id:Y(),fill:Ae.fill,"stroke-width":Ae.stroke_width,"font-size":Ae.font_size,"font-family":Ae.font_family,"text-anchor":"middle","xml:space":"preserve",opacity:x.opacity}});break;case"path":case"pathedit":tt*=_,nt*=_,N.mouseDown(e,l,tt,nt),Me=!0;break;case"textedit":tt*=_,nt*=_,jt.mouseDown(e,l,tt,nt),Me=!0;break;case"rotate":Me=!0,h.undoMgr.beginUndoableChange("transform",w)}var I=He("mouseDown",{event:e,start_x:tt,start_y:nt,selectedElements:w},!0);Xn.each(I,function(e,t){t&&t.started&&(Me=!0)})}}).mousemove(function(e){if(Me&&1!==e.button&&!h.spaceKey){var t=void 0,n=void 0,r=void 0,a=void 0,i=void 0,s=void 0,l=void 0,c=void 0,u=void 0,d=w[0],f=ge(e.pageX,e.pageY,$e),v=f.x*_,m=f.y*_,y=Xt(X()),b=v/_,x=b,S=m/_,k=S;o.gridSnapping&&(x=Zt(x),k=Zt(k)),e.preventDefault();var C=void 0;switch(je){case"select":if(null!==w[0]&&(i=x-tt,s=k-nt,o.gridSnapping&&(i=Zt(i),s=Zt(s)),0!==i||0!==s)){for(l=w.length,t=0;t<l&&null!=(d=w[t]);++t){var A=p.createSVGTransform();C=W(d),A.setTranslate(i,s),C.numberOfItems?C.replaceItem(A,0):C.appendItem(A),H.requestSelector(d).resize()}Q("transition",w)}break;case"multiselect":b*=_,S*=_,Qt(De,{x:Math.min(rt,b),y:Math.min(at,S),width:Math.abs(b-rt),height:Math.abs(S-at)},100);var E=w.slice(),G=[],P=ze();for(l=P.length,t=0;t<l;++t){var I=P[t];w.includes(I)||G.push(I);var T=E.indexOf(I);-1!==T&&E.splice(T,1)}E.length>0&&h.removeFromSelection(E),G.length>0&&h.addToSelection(G);break;case"resize":C=W(d);var L=_e(C),M=(u=L?it:Ot(d)).x,O=u.y,j=u,V=j.width,R=j.height;if(i=x-tt,s=k-nt,o.gridSnapping&&(i=Zt(i),s=Zt(s),R=Zt(R),V=Zt(V)),c=Yt(d)){var B=Math.sqrt(i*i+s*s),D=Math.atan2(s,i)-c*Math.PI/180;i=B*Math.cos(D),s=B*Math.sin(D)}Ve.includes("n")||Ve.includes("s")||(s=0),Ve.includes("e")||Ve.includes("w")||(i=0);var U=0,F=0,z=R?(R+s)/R:1,q=V?(V+i)/V:1;Ve.includes("n")&&(z=R?(R-s)/R:1,F=R),Ve.includes("w")&&(q=V?(V-i)/V:1,U=V);var Y=p.createSVGTransform(),K=p.createSVGTransform(),Z=p.createSVGTransform();if(o.gridSnapping&&(M=Zt(M),U=Zt(U),O=Zt(O),F=Zt(F)),Y.setTranslate(-(M+U),-(O+F)),e.shiftKey&&(1===q?q=z:z=q),K.setScale(q,z),Z.setTranslate(M+U,O+F),L){var $=c?1:0;C.replaceItem(Y,2+$),C.replaceItem(K,1+$),C.replaceItem(Z,Number($))}else{var J=C.numberOfItems;C.replaceItem(Z,J-3),C.replaceItem(K,J-2),C.replaceItem(Y,J-1)}H.requestSelector(d).resize(),Q("transition",w);break;case"zoom":b*=_,S*=_,Qt(De,{x:Math.min(rt*_,b),y:Math.min(at*_,S),width:Math.abs(b-rt*_),height:Math.abs(S-at*_)},100);break;case"text":Qt(y,{x:x,y:k},1e3);break;case"line":o.gridSnapping&&(x=Zt(x),k=Zt(k));var ee=x,te=k;e.shiftKey&&(ee=(n=we(tt,nt,ee,te)).x,te=n.y),y.setAttributeNS(null,"x2",ee),y.setAttributeNS(null,"y2",te);break;case"foreignObject":case"square":case"rect":case"image":var ne="square"===je||e.shiftKey,re=Math.abs(x-tt),ae=Math.abs(k-nt),ie=void 0,oe=void 0;ne?(re=ae=Math.max(re,ae),ie=tt<x?tt:tt-re,oe=nt<k?nt:nt-ae):(ie=Math.min(tt,x),oe=Math.min(nt,k)),o.gridSnapping&&(re=Zt(re),ae=Zt(ae),ie=Zt(ie),oe=Zt(oe)),Qt(y,{width:re,height:ae,x:ie,y:oe},1e3);break;case"circle":var se=Xn(y).attr(["cx","cy"]);r=se.cx,a=se.cy;var le=Math.sqrt((x-r)*(x-r)+(k-a)*(k-a));o.gridSnapping&&(le=Zt(le)),y.setAttributeNS(null,"r",le);break;case"ellipse":var ce=Xn(y).attr(["cx","cy"]);r=ce.cx,a=ce.cy,o.gridSnapping&&(x=Zt(x),r=Zt(r),k=Zt(k),a=Zt(a)),y.setAttributeNS(null,"rx",Math.abs(x-r));var ue=Math.abs(e.shiftKey?x-r:k-a);y.setAttributeNS(null,"ry",ue);break;case"fhellipse":case"fhrect":et.minx=Math.min(b,et.minx),et.maxx=Math.max(b,et.maxx),et.miny=Math.min(S,et.miny),et.maxy=Math.max(S,et.maxy);case"fhpath":if(ht.x=b,ht.y=S,st.x&&st.y)for(t=0;t<9;t++)if(St=t/10,ft=At((t+1)/10),wt=ft,ft=At(St),(ot+=Math.sqrt((wt.x-ft.x)*(wt.x-ft.x)+(wt.y-ft.y)*(wt.y-ft.y)))>.8){ot-=.8;var de=g.createSVGPoint();de.x=ft.x,de.y=ft.y,y.points.appendItem(de)}st={x:lt.x,y:lt.y},lt={x:ct.x,y:ct.y},ct={x:ht.x,y:ht.y};break;case"path":case"pathedit":if(x*=_,k*=_,o.gridSnapping&&(x=Zt(x),k=Zt(k),tt=Zt(tt),nt=Zt(nt)),e.shiftKey){var he=Ie,fe=void 0,pe=void 0;he?(fe=he.dragging?he.dragging[0]:tt,pe=he.dragging?he.dragging[1]:nt):(fe=tt,pe=nt);var ve=n=we(fe,pe,x,k);x=ve.x,k=ve.y}De&&"none"!==De.getAttribute("display")&&(b*=_,S*=_,Qt(De,{x:Math.min(rt*_,b),y:Math.min(at*_,S),width:Math.abs(b-rt*_),height:Math.abs(S-at*_)},100)),N.mouseMove(x,k);break;case"textedit":x*=_,k*=_,jt.mouseMove(v,m);break;case"rotate":r=(u=Ot(d)).x+u.width/2,a=u.y+u.height/2;var me=xe(d),ye=ge(r,a,me);r=ye.x,a=ye.y,c=(Math.atan2(a-k,r-x)*(180/Math.PI)-90)%360,o.gridSnapping&&(c=Zt(c)),e.shiftKey&&(c=45*Math.round(c/45)),h.setRotationAngle(c<-180?360+c:c,!0),Q("transition",w)}He("mouseMove",{event:e,mouse_x:v,mouse_y:m,selected:d})}}).click(function(e){return e.preventDefault(),!1}).dblclick(function(e){var t=e.target.parentNode;if(t!==y){var n=ie(e),r=n.tagName;if("text"===r&&"textedit"!==je){var a=ge(e.pageX,e.pageY,$e);jt.select(n,a.x,a.y)}"g"!==r&&"a"!==r||!Yt(n)||(dn(n),n=w[0],K(!0)),y&&An(),"g"!==t.tagName&&"a"!==t.tagName||t===m().getCurrentLayer()||n===H.selectorParentGroup||En(n)}}).mouseup(function(e){if(2!==e.button){var t=Be;if(Be=null,Me){var n=ge(e.pageX,e.pageY,$e),r=n.x*_,a=n.y*_,i=r/_,s=a/_,l=Xt(X()),c=!1,u=i,d=s;Me=!1;var f=void 0,p=void 0;switch(je){case"resize":case"multiselect":null!=De&&(De.setAttribute("display","none"),Ue=[]),je="select";case"select":if(null!=w[0]){if(null==w[1]){var g=w[0];switch(g.tagName){case"g":case"use":case"image":case"foreignObject":break;default:Re.fill=g.getAttribute("fill"),Re.fill_opacity=g.getAttribute("fill-opacity"),Re.stroke=g.getAttribute("stroke"),Re.stroke_opacity=g.getAttribute("stroke-opacity"),Re.stroke_width=g.getAttribute("stroke-width"),Re.stroke_dasharray=g.getAttribute("stroke-dasharray"),Re.stroke_linejoin=g.getAttribute("stroke-linejoin"),Re.stroke_linecap=g.getAttribute("stroke-linecap")}"text"===g.tagName&&(Ae.font_size=g.getAttribute("font-size"),Ae.font_family=g.getAttribute("font-family")),H.requestSelector(g).showGrips(!0)}if(Ke(),u!==rt||d!==at)for(var v=w.length,y=0;y<v&&null!=w[y];++y)w[y].firstChild||H.requestSelector(w[y]).resize();else p=e.target,"path"===w[0].nodeName&&null==w[1]?N.select(w[0]):e.shiftKey&&t!==p&&h.removeFromSelection([p]);if(D()){var b=w[0];b&&(b.removeAttribute("style"),Gt(b,function(e){e.removeAttribute("style")}))}}return;case"zoom":null!=De&&De.setAttribute("display","none");var S=e.shiftKey?.5:2;return void Q("zoomed",{x:Math.min(rt,u),y:Math.min(at,d),width:Math.abs(u-rt),height:Math.abs(d-at),factor:S});case"fhpath":ot=0,st={x:0,y:0},lt={x:0,y:0},ct={x:0,y:0},ht={x:0,y:0};var C=l.getAttribute("points"),A=C.indexOf(",");(c=A>=0?C.indexOf(",",A+1)>=0:C.indexOf(" ",C.indexOf(" ")+1)>=0)&&(l=N.smoothPolylineIntoPath(l));break;case"line":f=Xn(l).attr(["x1","x2","y1","y2"]),c=f.x1!==f.x2||f.y1!==f.y2;break;case"foreignObject":case"square":case"rect":case"image":f=Xn(l).attr(["width","height"]),c=f.width||f.height||"image"===je;break;case"circle":c="0"!==l.getAttribute("r");break;case"ellipse":f=Xn(l).attr(["rx","ry"]),c=f.rx||f.ry;break;case"fhellipse":et.maxx-et.minx>0&&et.maxy-et.miny>0&&(l=k({element:"ellipse",curStyles:!0,attr:{cx:(et.minx+et.maxx)/2,cy:(et.miny+et.maxy)/2,rx:(et.maxx-et.minx)/2,ry:(et.maxy-et.miny)/2,id:X()}}),Q("changed",[l]),c=!0);break;case"fhrect":et.maxx-et.minx>0&&et.maxy-et.miny>0&&(l=k({element:"rect",curStyles:!0,attr:{x:et.minx,y:et.miny,width:et.maxx-et.minx,height:et.maxy-et.miny,id:X()}}),Q("changed",[l]),c=!0);break;case"text":c=!0,Je([l]),jt.start(l);break;case"path":l=null,Me=!0;var E=N.mouseUp(e,l,r,a);l=E.element,c=E.keep;break;case"pathedit":c=!0,l=null,N.mouseUp(e);break;case"textedit":c=!1,l=null,jt.mouseUp(e,r,a);break;case"rotate":c=!0,l=null,je="select";var G=h.undoMgr.finishUndoableChange();G.isEmpty()||B(G),Ke(),Q("changed",w)}var P=He("mouseUp",{event:e,mouse_x:r,mouse_y:a},!0);if(Xn.each(P,function(e,t){t&&(c=t.keep||c,l=t.element,Me=t.started||Me)}),c||null==l){if(null!=l){h.addedNew=!0;var I=.2,T=void 0;if(ue.beginElement&&parseFloat(l.getAttribute("opacity"))!==x.opacity){T=Xn(ue).clone().attr({to:x.opacity,dur:I}).appendTo(l);try{T[0].beginElement()}catch(e){}}else I=0;setTimeout(function(){T&&T.remove(),l.setAttribute("opacity",x.opacity),l.setAttribute("style","pointer-events:inherit"),Kt(l),"path"===je?N.toEditMode(l):o.selectNew&&Je([l],!0),B(new Kn(l)),Q("changed",[l])},1e3*I)}}else{for(m().releaseId(X()),l.remove(),l=null,p=e.target;p&&p.parentNode&&p.parentNode.parentNode&&"g"===p.parentNode.parentNode.tagName;)p=p.parentNode;"path"===je&&Mt||!p||!p.parentNode||"selectorParentGroup"===p.parentNode.id||"svgcanvas"===p.id||"svgroot"===p.id||(h.setMode("select"),Je([p],!0))}Oe=null}}}),Xn(a).bind("mousewheel DOMMouseScroll",function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;$e=Xn("#svgcontent g")[0].getScreenCTM().inverse();var n=Xn("#workarea"),r=o.showRulers?16:0,a=ge(t.pageX,t.pageY,$e),i=n.width(),s=n.height(),l=i-15-r,c=s-15-r,u=l*$e.a,d=c*$e.d,f=n.offset(),p=f.left+r,g=f.top+r,v=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(v){var m=Math.max(.75,Math.min(4/3,v)),y=void 0,b=void 0;m>1?(y=Math.ceil(l/u*m*100)/100,b=Math.ceil(c/d*m*100)/100):(y=Math.floor(l/u*m*100)/100,b=Math.floor(c/d*m*100)/100);var x=Math.min(y,b);if((x=Math.min(10,Math.max(.01,x)))!==_){m=x/_;var w=ge(p,g,$e),S={x:(a.x-(a.x-w.x)/m)*x-r+i/2,y:(a.y-(a.y-w.y)/m)*x-r+s/2};h.setZoom(x),Xn("#zoom").val((100*x).toFixed(1)),Q("updateCanvas",{center:!1,newCtr:S}),Q("zoomDone")}}}});var jt=h.textActions=function(){var e=void 0,t=void 0,n=void 0,r=void 0,a=void 0,i=[],o=void 0,s=void 0,l=void 0,c=void 0,d=void 0;function f(e){var s=""===t.value;if(Xn(t).focus(),!arguments.length)if(s)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var l=i[e];s||t.setSelectionRange(e,e),(n=Xt("text_cursor"))||(n=document.createElementNS(u.SVG,"line"),Qt(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=Xt("selectorParentGroup").appendChild(n)),a||(a=setInterval(function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")},600));var c=x(l.x,o.y),d=x(l.x,o.y+o.height);Qt(n,{x1:c.x,y1:c.y,x2:d.x,y2:d.y,visibility:"visible",display:"inline"}),r&&r.setAttribute("d","")}function g(e,a,s){if(e!==a){s||t.setSelectionRange(e,a),(r=Xt("text_selectblock"))||(r=document.createElementNS(u.SVG,"path"),Qt(r,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),Xt("selectorParentGroup").append(r));var l=i[e],c=i[a];n.setAttribute("visibility","hidden");var d=x(l.x,o.y),h=x(l.x+(c.x-l.x),o.y),p=x(l.x,o.y+o.height),g=x(l.x+(c.x-l.x),o.y+o.height),v="M"+d.x+","+d.y+" L"+h.x+","+h.y+" "+g.x+","+g.y+" "+p.x+","+p.y+"z";Qt(r,{d:v,display:"inline"})}else f(a)}function v(t,n){var r=p.createSVGPoint();if(r.x=t,r.y=n,1===i.length)return 0;var a=e.getCharNumAtPosition(r);a<0?(a=i.length-2,t<=i[0].x&&(a=0)):a>=i.length-2&&(a=i.length-2);var o=i[a];return t>o.x+o.width/2&&a++,a}function m(e,t){f(v(e,t))}function y(e,n,r){var a=t.selectionStart,i=v(e,n);g(Math.min(a,i),Math.max(a,i),!r)}function b(e,t){var n={x:e,y:t};if(n.x/=_,n.y/=_,s){var r=ge(n.x,n.y,s.inverse());n.x=r.x,n.y=r.y}return n}function x(e,t){var n={x:e,y:t};if(s){var r=ge(n.x,n.y,s);n.x=r.x,n.y=r.y}return n.x*=_,n.y*=_,n}function S(t){g(0,e.textContent.length),Xn(this).unbind(t)}function k(t){if(d&&e){var n=ge(t.pageX,t.pageY,$e),r=b(n.x*_,n.y*_),a=v(r.x,r.y),i=e.textContent,o=i.substr(0,a).replace(/[a-z0-9]+$/i,"").length,s=i.substr(a).match(/^[a-z0-9]+/i);g(o,(s?s[0].length:0)+a),Xn(t.target).click(S),setTimeout(function(){Xn(t.target).unbind("click",S)},300)}}return{select:function(t,n,r){e=t,jt.toEditMode(n,r)},start:function(t){e=t,jt.toEditMode()},mouseDown:function(e,n,r,a){var i=b(r,a);t.focus(),m(i.x,i.y),l=r,c=a},mouseMove:function(e,t){var n=b(e,t);y(n.x,n.y)},mouseUp:function(t,n,r){var a=b(n,r);y(a.x,a.y,!0),t.target!==e&&n<l+2&&n>l-2&&r<c+2&&r>c-2&&jt.toSelectMode(!0)},setCursor:f,toEditMode:function(t,n){if(d=!1,je="textedit",H.requestSelector(e).showGrips(!1),H.requestSelector(e),jt.init(),Xn(e).css("cursor","text"),arguments.length){var r=b(t,n);m(r.x,r.y)}else f();setTimeout(function(){d=!0},300)},toSelectMode:function(i){je="select",clearInterval(a),a=null,r&&Xn(r).attr("display","none"),n&&Xn(n).attr("visibility","hidden"),Xn(e).css("cursor","move"),i&&(K(),Xn(e).css("cursor","move"),Q("selected",[e]),ne([e],!0)),e&&!e.textContent.length&&h.deleteSelectedElements(),Xn(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===je&&jt.toSelectMode()},init:function(n){if(e){var r=void 0,a=void 0;e.parentNode||(e=w[0],H.requestSelector(e).showGrips(!1));var l=e.textContent.length,c=e.getAttribute("transform");for(o=Ot(e),s=c?xe(e):null,(i=[]).length=l,t.focus(),Xn(e).unbind("dblclick",k).dblclick(k),l||(a={x:o.x+o.width/2,width:0}),r=0;r<l;r++){var u=e.getStartPositionOfChar(r);if(a=e.getEndPositionOfChar(r),!E){var d=h.contentW*_;u.x-=d,a.x-=d,u.x/=_,a.x/=_}i[r]={x:u.x,y:o.y,width:a.x-u.x,height:o.height}}i.push({x:a.x,width:0}),g(t.selectionStart,t.selectionEnd,!0)}}}}(),Dt=this.removeUnusedDefElems=function(){var e=g.getElementsByTagNameNS(u.SVG,"defs");if(!e||!e.length)return 0;var t=[],n=0,r=["fill","stroke","filter","marker-start","marker-mid","marker-end"],a=r.length,i=g.getElementsByTagNameNS(u.SVG,"*"),o=i.length,s=void 0,l=void 0;for(s=0;s<o;s++){var c=i[s];for(l=0;l<a;l++){var d=Pt(c.getAttribute(r[l]));d&&t.push(d.substr(1))}var h=Nt(c);h&&h.startsWith("#")&&t.push(h.substr(1))}var f=Xn(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");for(s=f.length;s--;){var p=f[s],v=p.id;t.includes(v)||(Pe[v]=p,p.remove(),n++)}return n};function Ut(){K();var e=[],t=[],n={feGaussianBlur:oe.exportNoBlur,foreignObject:oe.exportNoforeignObject,"[stroke-dasharray]":oe.exportNoDashArray},r=Xn(g);return"font"in Xn("<canvas>")[0].getContext("2d")||(n.text=oe.exportNoText),Xn.each(n,function(n,a){r.find(n).length&&(t.push(n),e.push(a))}),{issues:e,issueCodes:t}}this.svgCanvasToString=function(){for(;Dt()>0;);N.clear(!0),Xn.each(g.childNodes,function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&g.firstChild.before(t)}),y&&(An(),Je([y]));var e=[];Xn(g).find("g:data(gsvg)").each(function(){for(var t=this.attributes,n=t.length,r=0;r<n;r++)"id"!==t[r].nodeName&&"style"!==t[r].nodeName||n--;if(n<=0){var a=this.firstChild;e.push(a),Xn(this).replaceWith(a)}});var t=this.svgToString(g,0);return e.length&&Xn(e).each(function(){Ye(this)}),t},this.svgToString=function(e,t){var n=[],r=o.baseUnit,a=new RegExp("^-?[\\d\\.]+"+r+"$");if(e){Kt(e);var i=Array.from(e.attributes),s=void 0,l=e.childNodes;for(i.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=nn();"px"!==r&&(c.w=te(c.w,r)+r,c.h=te(c.h,r)+r),n.push(' width="'+c.w+'" height="'+c.h+'" xmlns="'+u.SVG+'"');var d={};Xn(e).find("*").andSelf().each(function(){var e=this.namespaceURI;e&&!d[e]&&V[e]&&"xmlns"!==V[e]&&"xml"!==V[e]&&(d[e]=!0,n.push(" xmlns:"+V[e]+'="'+e+'"')),Xn.each(this.attributes,function(e,t){var r=t.namespaceURI;r&&!d[r]&&"xmlns"!==V[r]&&"xml"!==V[r]&&(d[r]=!0,n.push(" xmlns:"+V[r]+'="'+r+'"'))})}),s=i.length;for(var h=["width","height","xmlns","x","y","viewBox","id","overflow"];s--;){var f=i[s],p=yt(f.value);f.nodeName.startsWith("xmlns:")||(""===p||h.includes(f.localName)||f.namespaceURI&&!V[f.namespaceURI]||(n.push(" "),n.push(f.nodeName),n.push('="'),n.push(p),n.push('"')))}}else{if("defs"===e.nodeName&&!e.firstChild)return;var g=["-moz-math-font-style","_moz-math-font-style"];for(s=i.length-1;s>=0;s--){var v=i[s],m=yt(v.value);if(!g.includes(v.localName)&&""!==m){if(m.startsWith("pointer-events"))continue;if("class"===v.localName&&m.startsWith("se_"))continue;if(n.push(" "),"d"===v.localName&&(m=N.convertPath(e,!0)),isNaN(m)?a.test(m)&&(m=ee(m)+r):m=ee(m),ke.apply&&"image"===e.nodeName&&"href"===v.localName&&ke.images&&"embed"===ke.images){var _=pe[m];_&&(m=_)}v.namespaceURI&&v.namespaceURI!==u.SVG&&!V[v.namespaceURI]||(n.push(v.nodeName),n.push('="'),n.push(m),n.push('"'))}}}if(e.hasChildNodes()){n.push(">"),t++;var y=!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 x=b.nodeValue.replace(/^\s+|\s+$/g,"");""!==x&&(y=!0,n.push(String(yt(x))));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--,!y)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,r){Xn(new Image).load(function(a,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"),pe[e]=l}catch(t){pe[e]=!1}Te=e,t&&t(pe[e]),n(pe[e])}else r(new Error("Error loading image: "+o.status+" "+o.statusText))}).attr("src",e)})},this.setGoodImage=function(e){Te=e},this.open=function(){},this.save=function(e){K(),e&&Xn.extend(ke,e),ke.apply=!0;var t=this.svgCanvasToString();Q("saved",t)};var Ft=void 0;this.rasterExport=function(e,t,r,a){var i,s=this,l="ICO"===e?"BMP":e||"PNG",c="image/"+l.toLowerCase(),u=Ut(),d=u.issues,f=u.issueCodes,p=this.svgCanvasToString();return new Promise((i=n(regeneratorRuntime.mark(function n(i,u){var g,v,m,_,y,b;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(b=function(){var n={datauri:_,bloburl:y,svg:p,issues:d,issueCodes:f,type:e,mimeType:c,quality:t,exportWindowName:r};Q("exported",n),a&&a(n),i(n)},Ft){n.next=6;break}return n.next=4,sn(o.canvgPath+"canvg.js",{global:"canvg"});case 4:g=n.sent,Ft=g.canvg;case 6:return Xn("#export_canvas").length||Xn("<canvas>",{id:"export_canvas"}).hide().appendTo("body"),(v=Xn("#export_canvas")[0]).width=h.contentW,v.height=h.contentH,n.next=12,Ft(v,p);case 12:if(m=l.toLowerCase(),_=t?v.toDataURL("image/"+m,t):v.toDataURL("image/"+m),y=void 0,!v.toBlob){n.next=18;break}return v.toBlob(function(e){y=Ct(e),b()},c,t),n.abrupt("return");case 18:y=kt(_),b();case 20:case"end":return n.stop()}},n,s)})),function(e,t){return i.apply(this,arguments)}))},this.exportPDF=function(e,t,r){var a,i=this,s=this;return new Promise((a=n(regeneratorRuntime.mark(function n(a,l){var c,u,d,h,f,p,g,v,m,_;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(window.jsPDF){n.next=6;break}return n.next=3,ln(["jspdf/underscore-min.js","jspdf/jspdf.min.js"]);case 3:return c=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules),n.next=6,ln(o.jspdfPath+"jspdf.plugin.svgToPdf.js",{type:c?"module":"text/javascript"});case 6:u=nn(),d=u.w>u.h?"landscape":"portrait","pt",h=jsPDF({orientation:d,unit:"pt",format:[u.w,u.h]}),f=rn(),h.setProperties({title:f}),p=Ut(),g=p.issues,v=p.issueCodes,m=s.svgCanvasToString(),h.addSVG(m,0,0),(_={svg:m,issues:g,issueCodes:v,exportWindowName:e,outputType:t=t||"dataurlstring"}).output=h.output(t,"save"===t?e||"svg.pdf":void 0),r&&r(_),a(_),Q("exportedPDF",_);case 21:case"end":return n.stop()}},n,i)})),function(e,t){return a.apply(this,arguments)}))},this.getSvgString=function(){return ke.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?wn(!1,m()):wn(!0,m())};var qt=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var r in Gt(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),Xn.each(le,function(n,r){var a=e.getAttributeNode(r);if(a){var i=Pt(a.value),o=i?i.substr(1):null;o&&(o in t||(t[o]={elem:null,attrs:[],hrefs:[]}),t[o].attrs.push(a))}});var r=Nt(e);if(r&&n.includes(e.nodeName)){var a=r.substr(1);a&&(a in t||(t[a]={elem:null,attrs:[],hrefs:[]}),t[a].hrefs.push(e))}}}),t)if(r){var a=t[r].elem;if(a){var i=Y();a.id=i;for(var o=t[r].attrs,s=o.length;s--;){var l=o[s];l.ownerElement.setAttribute(l.name,"url(#"+i+")")}for(var c=t[r].hrefs,u=c.length;u--;){var d=c[u];It(d,"#"+i)}}}},Jt=this.setUseData=function(e){var t=Xn(e);"use"!==e.tagName&&(t=t.find("use")),t.each(function(){var e=Nt(this).substr(1),t=Xt(e);t&&(Xn(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||Xn(this).data("symbol",t).data("ref",t))})},en=this.convertGradients=function(e){var t=Xn(e).find("linearGradient, radialGradient");!t.length&&L()&&(t=Xn(e).find("*").filter(function(){return this.tagName.includes("Gradient")})),t.each(function(){if("userSpaceOnUse"===Xn(this).attr("gradientUnits")){var e=Xn(g).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=Ot(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=Xn(this).attr(["x1","y1","x2","y2"]),r=this.gradientTransform.baseVal;if(r&&r.numberOfItems>0){var a=be(r).matrix,i=ge(n.x1,n.y1,a),o=ge(n.x2,n.y2,a);n.x1=i.x,n.y1=i.y,n.x2=o.x,n.y2=o.y,this.removeAttribute("gradientTransform")}Xn(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")}}})},tn=this.convertToGroup=function(e){e||(e=w[0]);var t=Xn(e),n=new Jn,r=void 0;if(t.data("gsvg")){var a=e.firstChild,i=Xn(a).attr(["x","y"]);Xn(e.firstChild.firstChild).unwrap(),Xn(e).removeData("gsvg");var o=W(e),s=p.createSVGTransform();s.setTranslate(i.x,i.y),o.appendItem(s),Dn(e),Q("selected",[e])}else if(t.data("symbol")){e=t.data("symbol"),r=t.attr("transform");var l=t.attr(["x","y"]),c=e.getAttribute("viewBox");if(c){var d=c.split(" ");l.x-=+d[0],l.y-=+d[1]}r+=" translate("+(l.x||0)+","+(l.y||0)+")";var h=t.prev();n.addSubCommand(new Zn(t[0],t[0].nextSibling,t[0].parentNode)),t.remove();var v=Xn(g).find("use:data(symbol)").length,m=f.createElementNS(u.SVG,"g"),_=e.childNodes,y=void 0;for(y=0;y<_.length;y++)m.append(_[y].cloneNode(!0));if(M()){var b=Xn(Tt()).children("linearGradient,radialGradient,pattern").clone();Xn(m).append(b)}r&&m.setAttribute("transform",r);var x=e.parentNode;if(qt(m),M()&&Xn(Tt()).append(Xn(m).find("linearGradient,radialGradient,pattern")),m.id=Y(),h.after(m),x){if(!v){var S=e.nextSibling;e.remove(),n.addSubCommand(new Zn(e,S,x))}n.addSubCommand(new Kn(m))}Jt(m),M()?en(Tt()):en(m),function(e,t){if(e&&1===e.nodeType){for(var n=e.childNodes.length;n--;)Gt(e.childNodes.item(n),t);t(e)}}(m,function(e){try{Dn(e)}catch(e){console.log(e)}}),Xn(m).find(se).each(function(){this.id||(this.id=Y())}),Je([m]);var k=dn(m,!0);k&&n.addSubCommand(k),B(n)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e,t){try{var n=Et(e);if(n.firstElementChild&&n.firstElementChild.namespaceURI!==u.SVG)return!1;this.prepareSvg(n);var r=new Jn("Change Source"),a=g.nextSibling,i=p.removeChild(g);r.addSubCommand(new Zn(i,a,p)),g=f.adoptNode?f.adoptNode(n.documentElement):f.importNode(n.documentElement,!0),p.append(g);var s=Xn(g);h.current_drawing_=new xn(g,v);var l=m().getNonce();l?Q("setnonce",l):Q("unsetnonce"),s.find("image").each(function(){var e=this;$t(e);var t=Nt(this);if(t){if(t.startsWith("data:")){var n=t.match(/svgedit_url=(.*?);/);if(n){var r=decodeURIComponent(n[1]);Xn(new Image).load(function(){e.setAttributeNS(u.XLINK,"xlink:href",r)}).attr("src",r)}}h.embedImage(t)}}),s.find("svg").each(function(){if(!Xn(this).closest("defs").length){qt(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?(Xn(e).data("gsvg",this),e.id=e.id||Y()):Ye(this)}}),M()&&s.find("linearGradient, radialGradient, pattern").appendTo(Tt()),Jt(s),en(s[0]);var c={id:"svgcontent",overflow:o.show_outside_canvas?"visible":"hidden"},d=!1;if(s.attr("viewBox")){var y=s.attr("viewBox").split(" ");c.width=y[2],c.height=y[3]}else Xn.each(["width","height"],function(e,t){var n=s.attr(t)||"100%";"%"===String(n).substr(-1)?d=!0:c[t]=re(t,n)});if(Cn(),s.children().find(se).each(function(){this.id||(this.id=Y())}),d){var b=zt();c.width=b.width+b.x,c.height=b.height+b.y}c.width<=0&&(c.width=100),c.height<=0&&(c.height=100),s.attr(c),this.contentW=c.width,this.contentH=c.height,r.addSubCommand(new Kn(g));var x=s.attr(["width","height"]);r.addSubCommand(new $n(p,x)),_=1,z={},K(),Ne={},p.append(H.selectorParentGroup),t||B(r),Q("changed",[g])}catch(e){return console.log(e),!1}return!0},this.importSvgString=function(e){var t=void 0,n=void 0,r=void 0;try{var a=bt(e.length+e).substr(0,32),i=!1;Ce[a]&&Xn(Ce[a].symbol).parents("#svgroot").length&&(i=!0);var o=new Jn("Import Image"),s=void 0;if(i)s=Ce[a].symbol,n=Ce[a].xform;else{var l=Et(e);this.prepareSvg(l);var c=void 0;c=f.adoptNode?f.adoptNode(l.documentElement):f.importNode(l.documentElement,!0),qt(c);var d=re("width",c.getAttribute("width")),h=re("height",c.getAttribute("height")),p=c.getAttribute("viewBox"),v=p?p.split(" "):[0,0,d,h];for(t=0;t<4;++t)v[t]=+v[t];var _=+g.getAttribute("height");n="translate(0) "+(n=h>d?"scale("+_/3/v[3]+")":"scale("+_/3/v[2]+")")+" translate(0)",s=f.createElementNS(u.SVG,"symbol");var b=Tt();for(M()&&Xn(c).find("linearGradient, radialGradient, pattern").appendTo(b);c.firstChild;){var x=c.firstChild;s.append(x)}for(var w=c.attributes,S=0;S<w.length;S++){var k=w[S];s.setAttribute(k.nodeName,k.value)}s.id=Y(),Ce[a]={symbol:s,xform:n},Tt().append(s),o.addSubCommand(new Kn(s))}(r=f.createElementNS(u.SVG,"use")).id=Y(),It(r,"#"+s.id),(y||m().getCurrentLayer()).append(r),o.addSubCommand(new Kn(r)),K(),r.setAttribute("transform",n),Dn(r),Xn(r).data("symbol",s).data("ref",s),ne([r]),B(o),Q("changed",[g])}catch(e){return console.log(e),null}return r},["identifyLayers","createLayer","cloneLayer","deleteCurrentLayer","setCurrentLayer","renameCurrentLayer","setCurrentLayerPosition","setLayerVisibility","moveSelectedToLayer","mergeLayer","mergeAllLayers","leaveContext","setContext"].forEach(function(e){h[e]=Gn[e]}),kn({pathActions:N,getCurrentGroup:function(){return y},setCurrentGroup:function(e){y=e},getSelectedElements:P,getSVGContent:G,undoMgr:R,elData:ce,getCurrentDrawing:m,clearSelection:K,call:Q,addCommandToHistory:B,changeSVGContent:function(){Q("changed",[g])}}),this.clear=function(){N.clear(),K(),h.clearSvgContentElement(),h.current_drawing_=new xn(g),h.createLayer("Layer 1"),h.undoMgr.resetUndoStack(),H.initGroup(),De=H.getRubberBandBox(),Q("cleared")},this.linkControlPoints=N.linkControlPoints,this.getContentElem=function(){return g},this.getRootElem=function(){return p};var nn=this.getResolution=function(){return{w:g.getAttribute("width")/_,h:g.getAttribute("height")/_,zoom:_}};this.getSnapToGrid=function(){return o.gridSnapping},this.getVersion=function(){return"svgcanvas.js ($Rev$)"},this.setUiStrings=function(e){Object.assign(oe,e.notification),Ee(e)},this.setConfig=function(e){Object.assign(o,e)},this.getTitle=function(e){if(e=e||w[0]){for(var t=(e=Xn(e).data("gsvg")||Xn(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=w[0];t=Xn(t).data("gsvg")||t;var n=Xn(t).children("title"),r=new Jn("Set Label"),a=void 0;if(e.length)n.length?(a=n[0],r.addSubCommand(new $n(a,{"#text":a.textContent})),a.textContent=e):((a=f.createElementNS(u.SVG,"title")).textContent=e,Xn(t).prepend(a),r.addSubCommand(new Kn(a)));else{var i=n.nextSibling;r.addSubCommand(new Zn(n[0],i,t)),n.remove()}B(r)};var rn=this.getDocumentTitle=function(){return h.getTitle(g)};this.setDocumentTitle=function(e){for(var t=g.childNodes,n=!1,r="",a=new Jn("Change Image Title"),i=0;i<t.length;i++)if("title"===t[i].nodeName){r=(n=t[i]).textContent;break}n||(n=f.createElementNS(u.SVG,"title"),g.insertBefore(n,g.firstChild)),e.length?n.textContent=e:n.remove(),a.addSubCommand(new $n(n,{"#text":r})),B(a)},this.getEditorNS=function(e){return e&&g.setAttribute("xmlns:se",u.SE),u.SE},this.setResolution=function(e,t){var n=nn(),r=n.w,a=n.h,i=void 0;if("fit"===e){var o=zt();if(!o)return!1;i=new Jn("Fit Canvas to Content");var s=Ht();ne(s);var l=[],c=[];Xn.each(s,function(e,t){l.push(-1*o.x),c.push(-1*o.y)});var u=h.moveSelectedElements(l,c,!0);i.addSubCommand(u),K(),e=Math.round(o.width),t=Math.round(o.height)}return e===r&&t===a||(i||(i=new Jn("Change Image Dimensions")),e=re("width",e),t=re("height",t),g.setAttribute("width",e),g.setAttribute("height",t),this.contentW=e,this.contentH=t,i.addSubCommand(new $n(g,{width:r,height:a})),g.setAttribute("viewBox",[0,0,e/_,t/_].join(" ")),i.addSubCommand(new $n(g,{viewBox:["0 0",r,a].join(" ")})),B(i),Q("changed",[g])),!0},this.getOffset=function(){return Xn(g).attr(["x","y"])},this.setBBoxZoom=function(e,n,r){var a=.85,i=void 0,o=function(e){if(!e)return!1;var t=Math.round(n/e.width*100*a)/100,i=Math.round(r/e.height*100*a)/100,o=Math.min(t,i);return h.setZoom(o),{zoom:o,bbox:e}};if("object"===(void 0===e?"undefined":t(e))){if(0===(i=e).width||0===i.height){var s=i.zoom?i.zoom:_*i.factor;return h.setZoom(s),{zoom:_,bbox:i}}return o(i)}switch(e){case"selection":if(!w[0])return;var l=Xn.map(w,function(e){if(e)return e});i=zt(l);break;case"canvas":var c=nn();a=.95,i={width:c.w,height:c.h,x:0,y:0};break;case"content":i=zt();break;case"layer":i=zt(Ht(m().getCurrentLayer()));break;default:return}return o(i)},this.setZoom=function(e){var t=nn();g.setAttribute("viewBox","0 0 "+t.w/e+" "+t.h/e),_=e,Xn.each(w,function(e,t){t&&H.requestSelector(t).resize()}),N.zoomChange(),He("zoomChanged",e)},this.getMode=function(){return je},this.setMode=function(e){N.clear(!0),jt.clear(),Re=w[0]&&"text"===w[0].nodeName?Ae:x,je=e},this.getColor=function(e){return Re[e]},this.setColor=function(e,t,n){x[e]=t,Re[e+"_paint"]={type:"solidColor"};var r=[];function a(e){"g"!==e.nodeName&&r.push(e)}for(var i=w.length;i--;){var o=w[i];o&&("g"===o.tagName?Gt(o,a):"fill"===e?"polyline"!==o.tagName&&"line"!==o.tagName&&r.push(o):r.push(o))}r.length>0&&(n?cn(e,t,r):(un(e,t,r),Q("changed",r)))};var an=this.setGradient=function(e){if(Re[e+"_paint"]&&"solidColor"!==Re[e+"_paint"].type){var t=h[e+"Grad"],n=on(t),r=Tt();n?t=n:(t=r.appendChild(f.importNode(t,!0))).id=Y(),h.setColor(e,"url(#"+t.id+")")}},on=function(e){for(var t=Tt(),n=Xn(t).find("linearGradient, radialGradient"),r=n.length,a=["r","cx","cy","fx","fy"];r--;){var i=n[r];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=Xn(e).attr(a),n=Xn(i).attr(a),r=!1;if(Xn.each(a,function(e,a){t[a]!==n[a]&&(r=!0)}),r)return"continue"}())continue;var o=e.getElementsByTagNameNS(u.SVG,"stop"),s=i.getElementsByTagNameNS(u.SVG,"stop");if(o.length===s.length){for(var l=o.length;l--;){var c=o[l],d=s[l];if(c.getAttribute("offset")!==d.getAttribute("offset")||c.getAttribute("stop-opacity")!==d.getAttribute("stop-opacity")||c.getAttribute("stop-color")!==d.getAttribute("stop-color"))break}if(-1===l)return i}}return null};this.setPaint=function(e,t){var n=new Xn.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),Re[e+"_paint"]=n,n.type){case"solidColor":this.setColor(e,"none"!==n.solidColor?"#"+n.solidColor:"none");break;case"linearGradient":case"radialGradient":h[e+"Grad"]=n[n.type],an(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return Re.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(je))h.setStrokeWidth(1);else{Re.stroke_width=e;for(var t=[],n=w.length;n--;){var r=w[n];r&&("g"===r.tagName?Gt(r,a):t.push(r))}t.length>0&&(un("stroke-width",e,t),Q("changed",w))}function a(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){x[e.replace("-","_")]=t;for(var n=[],r=w.length;r--;){var a=w[r];a&&("g"===a.tagName?Gt(a,function(e){"g"!==e.nodeName&&n.push(e)}):n.push(a))}n.length>0&&(un(e,t,n),Q("changed",w))},this.getStyle=function(){return x},this.getOpacity=ae,this.setOpacity=function(e){x.opacity=e,un("opacity",e)},this.getFillOpacity=function(){return x.fill_opacity},this.getStrokeOpacity=function(){return x.stroke_opacity},this.setPaintOpacity=function(e,t,n){x[e+"_opacity"]=t,n?cn(e+"-opacity",t):un(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=Xt(e.id+"_blur");n&&(t=n.firstChild.getAttribute("stdDeviation"))}return t},function(){var e=null,t=null,n=!1;function r(){var n=h.undoMgr.finishUndoableChange();e.addSubCommand(n),B(e),e=null,t=null}h.setBlurNoUndo=function(e){if(t)if(0===e)cn("filter",""),n=!0;else{var r=w[0];n&&cn("filter","url(#"+r.id+"_blur)"),L()&&(console.log("e",r),r.removeAttribute("filter"),r.setAttribute("filter","url(#"+r.id+"_blur)")),cn("stdDeviation",e,[t.firstChild]),h.setBlurOffsets(t,e)}else h.setBlur(e)},h.setBlurOffsets=function(e,t){t>3?Qt(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100):L()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},h.setBlur=function(n,a){if(e)r();else{var i=w[0],o=i.id;t=Xt(o+"_blur"),n-=0;var s=new Jn;if(t)0===n&&(t=null);else{var l=k({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=k({element:"filter",attr:{id:o+"_blur"}})).append(l),Tt().append(t),s.addSubCommand(new Kn(t))}var c={filter:i.getAttribute("filter")};if(0===n)return i.removeAttribute("filter"),void s.addSubCommand(new $n(i,c));un("filter","url(#"+o+"_blur)"),s.addSubCommand(new $n(i,c)),h.setBlurOffsets(t,n),e=s,h.undoMgr.beginUndoableChange("stdDeviation",[t?t.firstChild:null]),a&&(h.setBlurNoUndo(n),r())}}}(),this.getBold=function(){var e=w[0];return null!=e&&"text"===e.tagName&&null==w[1]&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=w[0];null!=t&&"text"===t.tagName&&null==w[1]&&un("font-weight",e?"bold":"normal"),w[0].textContent||jt.setCursor()},this.getItalic=function(){var e=w[0];return null!=e&&"text"===e.tagName&&null==w[1]&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=w[0];null!=t&&"text"===t.tagName&&null==w[1]&&un("font-style",e?"italic":"normal"),w[0].textContent||jt.setCursor()},this.getFontFamily=function(){return Ae.font_family},this.setFontFamily=function(e){Ae.font_family=e,un("font-family",e),w[0]&&!w[0].textContent&&jt.setCursor()},this.setFontColor=function(e){Ae.fill=e,un("fill",e)},this.getFontColor=function(){return Ae.fill},this.getFontSize=function(){return Ae.font_size},this.setFontSize=function(e){Ae.font_size=e,un("font-size",e),w[0].textContent||jt.setCursor()},this.getText=function(){var e=w[0];return null==e?"":e.textContent},this.setTextContent=function(e){un("#text",e),jt.init(e),jt.setCursor()},this.setImageURL=function(e){var t=w[0];if(t){var n=Xn(t).attr(["width","height"]),r=!n.width||!n.height,a=Nt(t);if(a!==e||r){var i=new Jn("Change Image URL");It(t,e),i.addSubCommand(new $n(t,{"#href":a})),Xn(new Image).load(function(){var e=Xn(t).attr(["width","height"]);Xn(t).attr({width:this.width,height:this.height}),H.requestSelector(t).resize(),i.addSubCommand(new $n(t,e)),B(i),Q("changed",[t])}).attr("src",e)}}},this.setLinkURL=function(e){var t=w[0];if(t){if("a"!==t.tagName){var n=Xn(t).parents("a");if(!n.length)return;t=n[0]}var r=Nt(t);if(r!==e){var a=new Jn("Change Link URL");It(t,e),a.addSubCommand(new $n(t,{"#href":r})),B(a)}}},this.setRectRadius=function(e){var t=w[0];if(null!=t&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),B(new $n(t,{rx:n,ry:n},"Radius")),Q("changed",[t]))}},this.makeHyperlink=function(e){h.groupSelectedElements("a",e)},this.removeHyperlink=function(){h.ungroupSelectedElement()},this.setSegType=function(e){N.setSegType(e)},this.convertToPath=function(e,t){if(null!=e)return t?Bt(e,k,N):function(e,t,n,r,a,i,o,s){var l=new o.BatchCommand("Convert element to Path"),c=n({element:"path",attr:t=dt.extend({},t,Rt(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 f=Vt(e);if(f){if(c.setAttribute("d",f),u){var p=W(c);_e(p)&&r.resetOrientation(c)}var g=e.nextSibling;return l.addSubCommand(new o.RemoveElementCommand(e,g,h)),l.addSubCommand(new o.InsertElementCommand(c)),a(),e.remove(),c.setAttribute("id",d),c.removeAttribute("visibility"),i([c],!0),s(l),c}return c.remove(),null}(e,{fill:x.fill,"fill-opacity":x.fill_opacity,stroke:x.stroke,"stroke-width":x.stroke_width,"stroke-dasharray":x.stroke_dasharray,"stroke-linejoin":x.stroke_linejoin,"stroke-linecap":x.stroke_linecap,"stroke-opacity":x.stroke_opacity,opacity:x.opacity,visibility:"hidden"},k,N,K,ne,fe,B);var n=w;Xn.each(n,function(e,t){t&&h.convertToPath(t)})};var cn=function(e,t,n){"pathedit"===je&&N.moveNode(e,t);for(var r=(n=n||w).length,a=["g","polyline","path"],i=["transform","opacity","filter"],o=function(){var o=n[r];if(null==o)return"continue";if(("x"===e||"y"===e)&&a.includes(o.tagName)){var s=zt([o]),l="x"===e?t-s.x:0,c="y"===e?t-s.y:0;return h.moveSelectedElements(l*_,c*_,!0),"continue"}"g"===o.tagName&&i.includes(e);var u="#text"===e?o.textContent:o.getAttribute(e);if(null==u&&(u=""),u!==String(t)){"#text"===e?(o.textContent=t,/rotate/.test(o.getAttribute("transform"))&&(o=Qe(o))):"#href"===e?It(o,t):o.setAttribute(e,t),"textedit"===je&&"#text"!==e&&o.textContent.length&&jt.toSelectMode(o),M()&&"text"===o.nodeName&&/rotate/.test(o.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&o.textContent)&&(o=Qe(o)),w.includes(o)&&setTimeout(function(){o.parentNode&&H.requestSelector(o).resize()},0);var d=Yt(o);if(0!==d&&"transform"!==e)for(var f=W(o),g=f.numberOfItems;g--;){if(4===f.getItem(g).type){f.removeItem(g);var v=Ot(o),m=ge(v.x+v.width/2,v.y+v.height/2,be(f).matrix),y=m.x,b=m.y,x=p.createSVGTransform();x.setRotate(d,y,b),f.insertItemBefore(x,g);break}}}};r--;)o()},un=this.changeSelectedAttribute=function(e,t,n){n=n||w,h.undoMgr.beginUndoableChange(e,n),cn(e,t,n);var r=h.undoMgr.finishUndoableChange();r.isEmpty()||B(r)};this.deleteSelectedElements=function(){for(var e=new Jn("Delete Elements"),t=w.length,n=[],r=0;r<t;++r){var a=w[r];if(null==a)break;var i=a.parentNode,o=a;H.releaseSelector(o),Xe(o.id),"a"===i.tagName&&1===i.childNodes.length&&(o=i,i=i.parentNode);var s=o.nextSibling,l=i.removeChild(o);n.push(a),e.addSubCommand(new Zn(l,s,i))}w=[],e.isEmpty()||B(e),Q("changed",n),K()},this.cutSelectedElements=function(){h.copySelectedElements(),h.deleteSelectedElements()},this.copySelectedElements=function(){localStorage.setItem("svgedit_clipboard",JSON.stringify(w.map(function(e){return S(e)}))),Xn("#cmenu_canvas").enableContextMenuItems("#paste,#paste_in_place")},this.pasteElements=function(e,t,n){var r=JSON.parse(localStorage.getItem("svgedit_clipboard")),a=r.length;if(a){var i=[],o=new Jn("Paste elements"),s={};for(r.forEach(function e(t){t.attr&&t.attr.id&&(s[t.attr.id]=Y(),t.attr.id=s[t.attr.id]),t.children&&t.children.forEach(e)}),He("IDsUpdated",{elems:r,changes:s},!0).forEach(function(e){e&&"remove"in e&&e.remove.forEach(function(e){r=r.filter(function(t){return t.attr.id!==e})})});a--;){var l=r[a];if(l){var c=k(l);i.push(c),o.addSubCommand(new Kn(c)),he(c)}}if(Je(i),"in_place"!==e){var u=void 0,d=void 0;e?"point"===e&&(u=t,d=n):(u=Fe.x,d=Fe.y);var f=zt(i),p=u-(f.x+f.width/2),g=d-(f.y+f.height/2),v=[],m=[];Xn.each(i,function(e,t){v.push(p),m.push(g)});var _=h.moveSelectedElements(v,m,!1);_&&o.addSubCommand(_)}B(o),Q("changed",i)}},this.groupSelectedElements=function(e,t){e||(e="g");var n="",r=void 0;switch(e){case"a":n="Make hyperlink",r=t||"";break;default:e="g",n="Group Elements"}var a=new Jn(n),i=k({element:e,attr:{id:Y()}});"a"===e&&It(i,r),a.addSubCommand(new Kn(i));for(var o=w.length;o--;){var s=w[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),a.addSubCommand(new Qn(s,l,c))}}a.isEmpty()||B(a),Je([i],!0)};var dn=this.pushGroupProperties=function(e,t){for(var n=e.childNodes,r=n.length,a=e.getAttribute("transform"),i=W(e),o=be(i).matrix,s=new Jn("Push group properties"),l=Yt(e),c=Xn(e).attr(["filter","opacity"]),u=void 0,d=void 0,f=void 0,g=m(),v=0;v<r;v++){var _=n[v];if(1===_.nodeType){if(null!==c.opacity&&1!==c.opacity){var y=Math.round((_.getAttribute("opacity")||1)*c.opacity*100)/100;un("opacity",y,[_])}if(c.filter){var b=this.getBlur(_),x=b;d||(d=this.getBlur(e)),b?b=Number(d)+Number(b):0===b&&(b=d),x?u=Wt(_.getAttribute("filter")):u?(u=g.copyElem(u),Tt().append(u)):u=Wt(c.filter);var w="feGaussianBlur"===u.firstChild.tagName?"blur":"filter";u.id=_.id+"_"+w,un("filter","url(#"+u.id+")",[_]),b&&(un("stdDeviation",b,[u.firstChild]),h.setBlurOffsets(u,b))}var S=W(_);if(_.tagName.includes("Gradient")&&(S=null),S&&"defs"!==_.tagName&&i.numberOfItems){if(l&&1===i.numberOfItems){var k=i.getItem(0).matrix,C=p.createSVGMatrix(),A=Yt(_);A&&(C=S.getItem(0).matrix);var E=Ot(_),G=be(S).matrix,P=ge(E.x+E.width/2,E.y+E.height/2,G),N=l+A,I=p.createSVGTransform();I.setRotate(N,P.x,P.y);var T=me(k,C,I.matrix.inverse());if(A&&S.removeItem(0),N&&(S.numberOfItems?S.insertItemBefore(I,0):S.appendItem(I)),T.e||T.f){var L=p.createSVGTransform();L.setTranslate(T.e,T.f),S.numberOfItems?S.insertItemBefore(L,0):S.appendItem(L)}}else{var M=_.getAttribute("transform");(f={}).transform=M||"";var O=p.createSVGTransform(),j=be(S).matrix,V=j.inverse(),R=me(V,o,j);O.setMatrix(R),S.appendItem(O)}var B=Dn(_);B&&s.addSubCommand(B)}}}if(a&&((f={}).transform=a,e.setAttribute("transform",""),e.removeAttribute("transform"),s.addSubCommand(new $n(e,f))),t&&!s.isEmpty())return s};this.ungroupSelectedElement=function(){var e=w[0];if(e)if(Xn(e).data("gsvg")||Xn(e).data("symbol"))tn(e);else{if("use"===e.tagName){var t=Xt(Nt(e).substr(1));return Xn(e).data("symbol",t).data("ref",t),void tn(e)}var n=Xn(e).parents("a");if(n.length&&(e=n[0]),"g"===e.tagName||"a"===e.tagName){var r=new Jn("Ungroup Elements"),a=dn(e,!0);a&&r.addSubCommand(a);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),r.addSubCommand(new Qn(c,u,d));else{var h=c.nextSibling;r.addSubCommand(new Zn(c,h,d)),c.remove()}}K();var f=e.nextSibling;e=i.removeChild(e),r.addSubCommand(new Zn(e,f,i)),r.isEmpty()||B(r),ne(s)}}},this.moveToTopSelectedElement=function(){var e=l(w,1)[0];if(null!=e){var t=e,n=t.parentNode,r=t.nextSibling;r!==(t=t.parentNode.appendChild(t)).nextSibling&&(B(new Qn(t,r,n,"top")),Q("changed",[t]))}},this.moveToBottomSelectedElement=function(){var e=l(w,1)[0];if(null!=e){var t=e,n=t.parentNode,r=t.nextSibling,a=t.parentNode.firstChild;"title"===a.tagName&&(a=a.nextSibling),"defs"===a.tagName&&(a=a.nextSibling),r!==(t=t.parentNode.insertBefore(t,a)).nextSibling&&(B(new Qn(t,r,n,"bottom")),Q("changed",[t]))}},this.moveUpDownSelected=function(e){var t=w[0];if(t){Ue=[];var n=void 0,r=void 0,a=Xn(ze(zt([t]))).toArray();if("Down"===e&&a.reverse(),Xn.each(a,function(){if(r)return n=this,!1;this===t&&(r=!0)}),n){var i=t,o=i.parentNode,s=i.nextSibling;Xn(n)["Down"===e?"before":"after"](i),s!==i.nextSibling&&(B(new Qn(i,s,o,"Move "+e)),Q("changed",[i]))}}},this.moveSelectedElements=function(e,t,n){e.constructor!==Array&&(e/=_,t/=_),n=n||!0;for(var r=new Jn("position"),a=w.length;a--;){var i=w[a];if(null!=i){var o=p.createSVGTransform(),s=W(i);e.constructor===Array?o.setTranslate(e[a],t[a]):o.setTranslate(e,t),s.numberOfItems?s.insertItemBefore(o,0):s.appendItem(o);var l=Dn(i);l&&r.addSubCommand(l),H.requestSelector(i).resize()}}if(!r.isEmpty())return n&&B(r),Q("changed",w),r},this.cloneSelectedElements=function(e,t){var n=void 0,r=void 0,a=new Jn("Clone Elements"),i=w.length;for(w.sort(function(e,t){return Xn(t).index()-Xn(e).index()}),n=0;n<i&&null!=(r=w[n]);++n);var o=w.slice(0,n);this.clearSelection(!0);var s=m();for(n=o.length;n--;)r=o[n]=s.copyElem(o[n]),(y||s.getCurrentLayer()).append(r),a.addSubCommand(new Kn(r));a.isEmpty()||(ne(o.reverse()),this.moveSelectedElements(e,t,!1),B(a))},this.alignSelectedElements=function(e,t){var n=[],r=w.length;if(r){for(var a=Number.MAX_VALUE,i=Number.MIN_VALUE,o=Number.MAX_VALUE,s=Number.MIN_VALUE,l=Number.MIN_VALUE,c=Number.MIN_VALUE,u=0;u<r&&null!=w[u];++u){var d=w[u];switch(n[u]=zt([d]),t){case"smallest":(("l"===e||"c"===e||"r"===e)&&(l===Number.MIN_VALUE||l>n[u].width)||("t"===e||"m"===e||"b"===e)&&(c===Number.MIN_VALUE||c>n[u].height))&&(a=n[u].x,o=n[u].y,i=n[u].x+n[u].width,s=n[u].y+n[u].height,l=n[u].width,c=n[u].height);break;case"largest":(("l"===e||"c"===e||"r"===e)&&(l===Number.MIN_VALUE||l<n[u].width)||("t"===e||"m"===e||"b"===e)&&(c===Number.MIN_VALUE||c<n[u].height))&&(a=n[u].x,o=n[u].y,i=n[u].x+n[u].width,s=n[u].y+n[u].height,l=n[u].width,c=n[u].height);break;default:n[u].x<a&&(a=n[u].x),n[u].y<o&&(o=n[u].y),n[u].x+n[u].width>i&&(i=n[u].x+n[u].width),n[u].y+n[u].height>s&&(s=n[u].y+n[u].height)}}"page"===t&&(a=0,o=0,i=h.contentW,s=h.contentH);for(var f=new Array(r),p=new Array(r),g=0;g<r&&null!=w[g];++g){var v=n[g];switch(f[g]=0,p[g]=0,e){case"l":f[g]=a-v.x;break;case"c":f[g]=(a+i)/2-(v.x+v.width/2);break;case"r":f[g]=i-(v.x+v.width);break;case"t":p[g]=o-v.y;break;case"m":p[g]=(o+s)/2-(v.y+v.height/2);break;case"b":p[g]=s-(v.y+v.height)}}this.moveSelectedElements(f,p)}},this.contentW=nn().w,this.contentH=nn().h,this.updateCanvas=function(e,t){p.setAttribute("width",e),p.setAttribute("height",t);var n=Xn("#canvasBackground")[0],r=g.getAttribute("x"),a=g.getAttribute("y"),i=e/2-this.contentW*_/2,o=t/2-this.contentH*_/2;Qt(g,{width:this.contentW*_,height:this.contentH*_,x:i,y:o,viewBox:"0 0 "+this.contentW+" "+this.contentH}),Qt(n,{width:g.getAttribute("width"),height:g.getAttribute("height"),x:i,y:o});var s=Xt("background_image");return s&&Qt(s,{width:"100%",height:"100%"}),H.selectorParentGroup.setAttribute("transform","translate("+i+","+o+")"),He("canvasUpdated",{new_x:i,new_y:o,old_x:r,old_y:a,d_x:i-r,d_y:o-a}),{x:i,y:o,old_x:r,old_y:a,d_x:i-r,d_y:o-a}},this.setBackground=function(e,t){var n=Xt("canvasBackground"),r=Xn(n).find("rect")[0],a=Xt("background_image");r.setAttribute("fill",e),t?(a||(a=f.createElementNS(u.SVG,"image"),Qt(a,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})),It(a,t),n.append(a)):a&&a.remove()},this.cycleElement=function(e){var t=void 0,n=w[0],r=!1,a=Ht(y||m().getCurrentLayer());if(a.length){if(null==n)r=a[t=e?a.length-1:0];else for(var i=a.length;i--;)if(a[i]===n){(t=e?i-1:i+1)>=a.length?t=0:t<0&&(t=a.length-1),r=a[t];break}Je([r],!0),Q("selected",w)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:B,BatchCommand:Jn,ChangeElementCommand:$n,decode64:xt,dropXMLInteralSubset:_t,encode64:bt,ffClone:Qe,findDefs:Tt,findDuplicateGradient:on,getElem:Xt,getPathBBox:Lt,getTypeMap:J,getUrlFromAttr:Pt,identifyLayers:Cn,InsertElementCommand:Kn,isChrome:j,isIdentity:ve,isIE:O,logMatrix:Ze,MoveElementCommand:Qn,NS:u,preventClickDefault:$t,RemoveElementCommand:Zn,SVGEditTransformList:q,text2xml:Et,transformBox:ye,transformPoint:ge,walkTree:Gt}}};var rr={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};function ar(e,t){return void 0===t&&(t=0),Math.round(e*Math.pow(10,t))/Math.pow(10,t)}window.console||(window.console={log:function(e){},dir:function(e){}});var ir,or=jQuery,sr=void 0,lr=function(e,t,n){var r=or("#svg_editor").parent();Object.entries(t).forEach(function(t){var a=l(t,2),i=a[0],o=a[1];if(o||console.log(i),n&&(i="#"+i),r.find(i).length){var s=r.find(i)[0];switch(e){case"content":for(var c,u=0;c=s.childNodes[u];u++)if(3===c.nodeType&&c.textContent.trim()){c.textContent=o;break}break;case"title":s.title=o}}else console.log("Missing: "+i)})},cr=void 0,ur=function(){var e=n(regeneratorRuntime.mark(function e(t){var n,r,a,i,o,s,l,c,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,cr.addLangData(sr);case 2:if(n=e.sent,or.each(n,function(e,n){n.data&&(t=or.merge(t,n.data))}),t.tools){e.next=6;break}return e.abrupt("return");case 6:return a=(r=t).tools,i=r.properties,o=r.config,s=r.layers,l=r.common,c=r.ui,lr("content",{curve_segments:i.curve_segments,fitToContent:a.fitToContent,fit_to_all:a.fit_to_all,fit_to_canvas:a.fit_to_canvas,fit_to_layer_content:a.fit_to_layer_content,fit_to_sel:a.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:a.largest_object,layersLabel:s.layers,page:a.page,relativeToLabel:a.relativeTo,selLayerLabel:s.move_elems_to,selectedPredefined:o.select_predefined,selected_objects:a.selected_objects,smallest_object:a.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:a.new_doc,tool_docprops:a.docprops,tool_export:a.export_img,tool_import:a.import_doc,tool_open:a.open_doc,tool_save:a.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={},or.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+'"]']=a[this]}),or.each(["dupe","merge_down","merge_all"],function(){u['#cmenu_layers a[href="#'+this+'"]']=s[this]}),u['#cmenu_layers a[href="#delete"]']=s.del,lr("content",u),lr("title",{align_relative_to:a.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:a.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:a.add_subpath,tool_alignbottom:a.align_bottom,tool_aligncenter:a.align_center,tool_alignleft:a.align_left,tool_alignmiddle:a.align_middle,tool_alignright:a.align_right,tool_aligntop:a.align_top,tool_angle:i.angle,tool_blur:i.blur,tool_bold:i.bold,tool_circle:a.mode_circle,tool_clone:a.clone,tool_clone_multi:a.clone,tool_delete:a.del,tool_delete_multi:a.del,tool_ellipse:a.mode_ellipse,tool_fhellipse:a.mode_fhellipse,tool_fhpath:a.mode_fhpath,tool_fhrect:a.mode_fhrect,tool_font_size:i.font_size,tool_group_elements:a.group_elements,tool_make_link:a.make_link,tool_link_url:a.set_link_url,tool_image:a.mode_image,tool_italic:i.italic,tool_line:a.mode_line,tool_move_bottom:a.move_bottom,tool_move_top:a.move_top,tool_node_clone:a.node_clone,tool_node_delete:a.node_delete,tool_node_link:a.node_link,tool_opacity:i.opacity,tool_openclose_path:a.openclose_path,tool_path:a.mode_path,tool_position:a.align_to_page,tool_rect:a.mode_rect,tool_redo:a.redo,tool_reorient:a.reorient_path,tool_select:a.mode_select,tool_source:a.source_save,tool_square:a.mode_square,tool_text:a.mode_text,tool_topath:a.to_path,tool_undo:a.undo,tool_ungroup:a.ungroup,tool_wireframe:a.wireframe_mode,tool_zoom:a.mode_zoom,url_notice:a.no_embed},!0),e.abrupt("return",{langParam:sr,langData:t});case 15:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),dr=(ir=n(regeneratorRuntime.mark(function e(t,n,r){var a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t?sr=t:((sr=or.pref("lang"))||(navigator.userLanguage?sr=navigator.userLanguage:navigator.language&&(sr=navigator.language)),console.log("Lang: "+sr),n.includes(sr)||"test"===sr||(sr="en")),a=r.langPath+"lang."+sr+".js",e.t0=ur,e.next=5,on(a,{global:"svgEditorLang_"+sr.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)})),function(e,t,n){return ir.apply(this,arguments)});var hr={},fr=[function(e){function t(t){if("string"==typeof t.data){var n=t.handler,r=t.data.toLowerCase().split(" ");t.handler=function(t){if(this===t.target||!/textarea|select/i.test(t.target.nodeName)&&"text"!==t.target.type){var a="keypress"!==t.type&&e.hotkeys.specialKeys[t.which],i=String.fromCharCode(t.which).toLowerCase(),o="",s={};t.altKey&&"alt"!==a&&(o+="alt+"),t.ctrlKey&&"ctrl"!==a&&(o+="ctrl+"),t.metaKey&&!t.ctrlKey&&"meta"!==a&&(o+="meta+"),t.shiftKey&&"shift"!==a&&(o+="shift+"),a?s[o+a]=!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=r.length;l<c;l++)if(s[r[l]])return n.apply(this,arguments)}}}}return e.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:t}}),e},function(e){return function(e,n){var r,a,i,o,s,l,c,u,d=Array.prototype.slice,h=decodeURIComponent,f=e.param,p=e.bbq=e.bbq||{},g=e.event.special,v="hashchange",m="querystring",_="fragment",y="elemUrlAttr",b="location",x="href",w="src",S=/^.*\?|#.*$/g,k=/^.*\#/,C={};function A(e){return"string"==typeof e}function E(e){var t=d.call(arguments,1);return function(){return e.apply(this,t.concat(d.call(arguments)))}}function G(t,a,o,s,l){var c,d,p,g,v;return s!==r?(v=(p=o.match(t?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/))[3]||"",2===l&&A(s)?d=s.replace(t?k:S,""):(g=i(p[2]),s=A(s)?i[t?_:m](s):s,d=2===l?s:1===l?e.extend({},s,g):e.extend({},g,s),d=f(d),t&&(d=d.replace(u,h))),c=p[1]+(t?"#":d||!p[1]?"?":"")+d+v):c=a(o!==r?o:n[b][x]),c}function P(e,t,n){return t===r||"boolean"==typeof t?(n=t,t=f[e?_:m]()):t=A(t)?t.replace(e?k:S,""):t,i(t,n)}function N(n,a,i,o){return A(i)||"object"===(void 0===i?"undefined":t(i))||(o=i,i=a,a=r),this.each(function(){var t=e(this),r=a||c()[(this.nodeName||"").toLowerCase()]||"",s=r&&t.attr(r)||"";t.attr(r,f[n](s,i,o))})}f[m]=E(G,0,function(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}),f[_]=a=E(G,1,function(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}),a.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);u=new RegExp(n.join("|"),"g")},a.noEscape(",/"),e.deparam=i=function(t,n){var a={},i={true:!0,false:!1,null:null};return e.each(t.replace(/\+/g," ").split("&"),function(t,o){var s,l=o.split("="),c=h(l[0]),u=a,d=0,f=c.split("]["),p=f.length-1;if(/\[/.test(f[0])&&/\]$/.test(f[p])?(f[p]=f[p].replace(/\]$/,""),p=(f=f.shift().split("[").concat(f)).length-1):p=0,2===l.length)if(s=h(l[1]),n&&(s=s&&!isNaN(s)?+s:"undefined"===s?r:i[s]!==r?i[s]:s),p)for(;d<=p;d++)u=u[c=""===f[d]?u.length:f[d]]=d<p?u[c]||(f[d+1]&&isNaN(f[d+1])?{}:[]):s;else e.isArray(a[c])?a[c].push(s):a[c]!==r?a[c]=[a[c],s]:a[c]=s;else c&&(a[c]=n?r:"")}),a},i[m]=E(P,0),i[_]=o=E(P,1),e[y]||(e[y]=function(t){return e.extend(C,t)})({a:x,base:x,iframe:w,img:w,input:w,form:"action",link:x,script:w}),c=e[y],e.fn[m]=E(N,m),e.fn[_]=E(N,_),p.pushState=s=function(e,t){A(e)&&/^#/.test(e)&&t===r&&(t=2);var i=e!==r,o=a(n[b][x],i?e:{},i?t:2);n[b][x]=o+(/#/.test(o)?"":"#")},p.getState=l=function(e,t){return e===r||"boolean"==typeof e?o(e):o(t)[e]},p.removeState=function(t){var n={};t!==r&&(n=l(),e.each(e.isArray(t)?t:arguments,function(e,t){delete n[t]})),s(n,2)},g[v]=e.extend(g[v],{add:function(t){var n;function o(e){var t=e[_]=a();e.getState=function(e,n){return e===r||"boolean"==typeof e?i(t,e):i(t,n)[e]},n.apply(this,arguments)}if(e.isFunction(t))return n=t,o;n=t.handler,t.handler=o}})}(e,window),function(e,t,n){var r,a,i,o,s,l,c=e.event.special,u="location",d="hashchange",h="href",f=e.browser,p=document.documentMode,g=f.msie&&(void 0===p||p<8),v="on"+d in t&&!g;function m(e){return(e=e||t[u][h]).replace(/^[^#]*#?(.*)$/,"$1")}e[d+"Delay"]=100,c[d]=e.extend(c[d],{setup:function(){if(v)return!1;e(r.start)},teardown:function(){if(v)return!1;e(r.stop)}}),(l={}).start=function(){if(!a){var n=m();o||(o=s=function(e){return e},g&&(i=e('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow,s=function(){return m(i.document[u][h])},(o=function(e,t){if(e!==t){var n=i.document;n.open().close(),n[u].hash="#"+e}})(m()))),function r(){var i=m(),l=s(n);i!==n?(o(n=i,l),e(t).trigger(d)):l!==n&&(t[u][h]=t[u][h].replace(/#.*/,"")+"#"+l),a=setTimeout(r,e[d+"Delay"])}()}},l.stop=function(){i||(a&&clearTimeout(a),a=0)},r=l}(e,window),e},function(e){var t={},n=void 0;return e.svgIcons=function(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xlink",s=a.w||24,l=a.h||24,c=void 0,u=void 0,d=void 0,h=!1,f=!1,p=0,g=!!window.opera,v="data:image/svg+xml;charset=utf-8;base64,",m=void 0;if(a.svgz){m=e('<object data="'+r+'" type=image/svg+xml>').appendTo("body").hide();try{u=m[0].contentDocument,m.load(y),y(0,!0)}catch(e){k()}}else{var _=new DOMParser;e.ajax({url:r,dataType:"string",success:function(t){t?(u=_.parseFromString(t,"text/xml"),e(function(){y("ajax")})):e(k)},error:function(t){window.opera?e(function(){k()}):t.responseText?((u=_.parseFromString(t.responseText,"text/xml")).childNodes.length||e(k),e(function(){y("ajax")})):e(k)}})}function y(t,n){if("ajax"!==t){if(f)return;var r=(u=m[0].contentDocument)&&u.getElementById("svg_eof");if(!(r||n&&r))return void(++p<50?setTimeout(y,20):(k(),f=!0));f=!0}if(c=e(u.firstChild).children(),a.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()})}}function b(e,t,n,r){if(g&&t.css("visibility","hidden"),a.replace){r&&t.attr("id",n);var i=e.attr("class");i&&t.attr("class","svg_icon "+i),e.replaceWith(t)}else e.append(t);g&&setTimeout(function(){t.removeAttr("style")},1)}var x=void 0;function w(e,n){void 0!==a.id_match&&!1===a.id_match||b(x,e,n,!0),t[n]=e}function S(r,u){if(!h){a.no_img&&(r=!1);var f=void 0;if(r&&(f=e(document.createElement("div"))).hide().appendTo("body"),u){var p=a.fallback_path||"";e.each(u,function(t,n){x=e("#"+t),w(e(new Image).attr({class:"svg_icon",src:p+n,width:s,height:l,alt:"icon"}),t)})}else for(var _=c.length,y=0;y<_;y++){var S=c[y],k=S.id;if("svg_eof"===k)break;x=e("#"+k);var A=document.createElementNS(i,"svg");A.setAttributeNS(null,"viewBox",[0,0,s,l].join(" "));var E=S.getElementsByTagNameNS(i,"svg")[0],G=E.getAttribute("width"),P=E.getAttribute("height");E.removeAttribute("width"),E.removeAttribute("height"),E.getAttribute("viewBox")||E.setAttribute("viewBox",[0,0,G,P].join(" ")),A.setAttribute("xmlns",i),A.setAttribute("width",s),A.setAttribute("height",l),A.setAttribute("xmlns:xlink",o),A.setAttribute("class","svg_icon"),g||(E=E.cloneNode(!0)),A.append(E);var N=void 0;if(r){f.empty().append(A);var I=v+C(unescape(encodeURIComponent((new XMLSerializer).serializeToString(A))));N=e(new Image).attr({class:"svg_icon",src:I})}else N=n(e(A),y);w(N,k)}a.placement&&e.each(a.placement,function(a,i){t[i]&&e(a).each(function(a){var o=t[i].clone();a>0&&!r&&(o=n(o,a,!0)),b(e(this),o,i)})}),u||(r&&f.remove(),m&&m.remove(),d&&d.remove()),a.resize&&e.resizeSvgIcons(a.resize),h=!0,a.callback&&a.callback(t)}}function k(){if(r.includes(".svgz")){var t=r.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg"),e.svgIcons(t,a)}else a.fallback&&S(!1,a.fallback)}function C(e){if(window.btoa)return window.btoa(e);var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=new Array(4*Math.floor((e.length+2)/3)),r=0,a=0;do{var i=e.charCodeAt(r++),o=e.charCodeAt(r++),s=e.charCodeAt(r++),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[a++]=t.charAt(l),n[a++]=t.charAt(c),n[a++]=t.charAt(u),n[a++]=t.charAt(d)}while(r<e.length);return n.join("")}n=function(e,t,n){var r=e.find("defs");if(!r.length)return e;var a=void 0;a=g?r.find("*").filter(function(){return!!this.id}):r.find("[id]");var i=e[0].getElementsByTagName("*"),o=i.length;return a.each(function(e){var n=this.id,r="x"+n+t+e;this.id=r;var a="url(#"+n+")",s="url(#"+r+")";for(e=0;e<o;e++){var l=i[e];l.getAttribute("fill")===a&&l.setAttribute("fill",s),l.getAttribute("stroke")===a&&l.setAttribute("stroke",s),l.getAttribute("filter")===a&&l.setAttribute("filter",s)}}),e}},e.getSvgIcon=function(e,r){var a=t[e];return r&&a&&(a=n(a,0,!0).clone(!0)),a},e.resizeSvgIcons=function(t){var n=!e(".svg_icon:first").length;e.each(t,function(t,r){var a=Array.isArray(r),i=a?r[0]:r,o=a?r[1]:r;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},function(e){e.loadingStylesheets||(e.loadingStylesheets=[]),e.loadingStylesheets.includes("jgraduate/css/jGraduate.css")||e.loadingStylesheets.push("jgraduate/css/jGraduate.css"),e.jGraduate={Paint:function e(t){r(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 n=navigator.userAgent.includes("Gecko/");function a(e,t,r){var a=document.createElementNS(rr.svg,e);return function(e,t){if(n)for(var r in t)e.setAttribute(r,t[r]);else for(var a in t){var i=t[a],o=e[a];o&&"SVGLength"===o.constructor?o.baseVal.value=i:e.setAttribute(a,i)}}(a,t),r&&r.append(a),a}return e.fn.jGraduate=function(n,r,i){return this.each(function(){var o=e(this),s=e.extend(!0,{},e.fn.jGraduateDefaults,n||{}),l=o.attr("id"),c="#"+o.attr("id")+" ";if(c){var u=function(){switch(o.paint.type){case"radialGradient":o.paint.linearGradient=null;break;case"linearGradient":o.paint.radialGradient=null;break;case"solidColor":o.paint.radialGradient=o.paint.linearGradient=null}"function"==typeof o.okCallback&&o.okCallback(o.paint),o.hide()},d=function(){"function"==typeof o.cancelCallback&&o.cancelCallback(),o.hide()};e.extend(!0,o,{paint:new e.jGraduate.Paint({copy:s.paint}),okCallback:"function"==typeof r?r:null,cancelCallback:"function"==typeof i?i:null});var h=null,f=e(window);"none"===o.paint.type&&(o.paint=new e.jGraduate.Paint({solidColor:"ffffff"})),o.addClass("jGraduate_Picker"),o.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="'+l+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var p=e(c+"> .jGraduate_colPick"),g=e(c+"> .jGraduate_gradPick");g.html('<div id="'+l+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+s.window.pickerTitle+'</h2><div id="'+l+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+l+'_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="'+l+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+l+'_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="'+l+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+l+'_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="'+l+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+l+'_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="'+l+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+l+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+l+'_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="'+l+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+l+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+l+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+l+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+l+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+l+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+l+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+l+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+l+'_jGraduate_AngleInput" size="3" value="0"/>deg</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+l+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+l+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+l+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+l+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+l+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var v=256,m=v-0,_=v-0,y={};e(".jGraduate_SliderBar").width(145);var b=e("#"+l+"_jGraduate_GradContainer")[0],x=a("svg",{id:l+"_jgraduate_svg",width:v,height:v,xmlns:rr.svg},b),w=o.paint.type,S=o.paint[w],k=S,C=o.paint.alpha,A="solidColor"===w;switch(w){case"solidColor":case"linearGradient":if(A||(k.id=l+"_lg_jgraduate_grad",S=k=x.appendChild(k)),a("radialGradient",{id:l+"_rg_jgraduate_grad"},x),"linearGradient"===w)break;case"radialGradient":A||(k.id=l+"_rg_jgraduate_grad",S=k=x.appendChild(k)),a("linearGradient",{id:l+"_lg_jgraduate_grad"},x)}var E=void 0;if(A){S=k=e("#"+l+"_lg_jgraduate_grad")[0],Me(0,"#"+(h=o.paint[w]),1);var G=t(s.newstop);if("string"===G)switch(s.newstop){case"same":Me(1,"#"+h,1);break;case"inverse":for(var P="",N=0;N<6;N+=2){var I=(255-parseInt(h.substr(N,2),16)).toString(16);I.length<2&&(I=0+I),P+=I}Me(1,"#"+P,1);break;case"white":Me(1,"#ffffff",1);break;case"black":Me(1,"#000000",1)}else if("object"===G){var T="opac"in s.newstop?s.newstop.opac:1;Me(1,s.newstop.color||"#"+h,T)}}var L=parseFloat(S.getAttribute("x1")||0),M=parseFloat(S.getAttribute("y1")||0),O=parseFloat(S.getAttribute("x2")||1),j=parseFloat(S.getAttribute("y2")||0),V=parseFloat(S.getAttribute("cx")||.5),R=parseFloat(S.getAttribute("cy")||.5),B=parseFloat(S.getAttribute("fx")||V),D=parseFloat(S.getAttribute("fy")||R),U=a("rect",{id:l+"_jgraduate_rect",x:0,y:0,width:m,height:_,fill:"url(#"+l+"_jgraduate_grad)","fill-opacity":C/100},x),F=e("<div/>").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:M*v,left:L*v}).data("coord","start").appendTo(b),H=F.clone().text(2).css({top:j*v,left:O*v}).attr("title","End stop").data("coord","end").appendTo(b),z=e("<div/>").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:R*v,left:V*v}).data("coord","center").appendTo(b),q=z.clone().text("F").css({top:D*v,left:B*v,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(b);q[0].id=l+"_jGraduate_focusCoord";var Y=void 0;e.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(t,n){var r=isNaN(n[1]),a=k.getAttribute(n);a||(a=r?"0.5":"x2"===n?"1.0":"0.0"),y[n]=e("#"+l+"_jGraduate_"+n).val(a).change(function(){isNaN(parseFloat(this.value))||this.value<0?this.value=0:this.value>1&&(this.value=1),("f"!==n[0]||Y)&&(r&&"radialGradient"===w||!r&&"linearGradient"===w)&&k.setAttribute(n,this.value);var e=r?"c"===n[0]?z:q:"1"===n[1]?F:H,t=n.includes("x")?"left":"top";e.css(t,this.value*v)}).change()});var W=e("#"+l+"_jGraduate_StopSlider"),X=void 0,Q=void 0,K=void 0,Z=a("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),$=void 0,J=1,ee=1,te=0,ne=V,re=R,ae=a("svg",{width:"100%",height:45},W[0]),ie=a("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ae),oe=a("image",{width:16,height:16},ie),se=s.images.clientPath+"map-opacity.png";oe.setAttributeNS(rr.xlink,"xlink:href",se),e(ae).click(function(e){if($=W.offset(),"path"!==e.target.tagName){var t=e.pageX-$.left-8;Me((t=t<10?10:t>v+10?v+10:t)/v,0,0,!0),e.stopPropagation()}}),e(ae).mouseover(function(){ae.append(Z)}),E=a("g",{},ae),a("line",{x1:10,y1:15,x2:v+10,y2:15,"stroke-width":2,stroke:"#000"},ae);var le=g.find(".jGraduate_spreadMethod").change(function(){k.setAttribute("spreadMethod",e(this).val())}),ce=null,ue=function(e){var t=e.pageX-pe.left,n=e.pageY-pe.top;t=t<0?0:t>v?v:t,n=n<0?0:n>v?v:n,ce.css("left",t).css("top",n);var r=t/m,a=n/_,i=ce.data("coord"),o=k;switch(i){case"start":y.x1.val(r),y.y1.val(a),o.setAttribute("x1",r),o.setAttribute("y1",a);break;case"end":y.x2.val(r),y.y2.val(a),o.setAttribute("x2",r),o.setAttribute("y2",a);break;case"center":y.cx.val(r),y.cy.val(a),o.setAttribute("cx",r),o.setAttribute("cy",a),ne=r,re=a,Ve();break;case"focus":y.fx.val(r),y.fy.val(a),o.setAttribute("fx",r),o.setAttribute("fy",a),Ve()}e.preventDefault()},de=function e(){ce=null,f.unbind("mousemove",ue).unbind("mouseup",e)},he=(X=k.getElementsByTagNameNS(rr.svg,"stop")).length;if(he<2){for(;he<2;)k.append(document.createElementNS(rr.svg,"stop")),++he;X=k.getElementsByTagNameNS(rr.svg,"stop")}for(var fe=0;fe<he;fe++)Me(0,0,0,0,X[fe]);le.val(k.getAttribute("spreadMethod")||"pad");var pe=void 0;Y=!1,U.setAttribute("fill-opacity",C/100),e("#"+l+" div.grad_coord").mousedown(function(t){t.preventDefault(),ce=e(this),pe=ce.parent().offset(),f.mousemove(ue).mouseup(de)}),e("#"+l+"_jGraduate_Ok").bind("click",function(){o.paint.type=w,o.paint[w]=k.cloneNode(!0),o.paint.solidColor=null,u()}),e("#"+l+"_jGraduate_Cancel").bind("click",function(e){d()}),"radialGradient"===w&&(Y?q.show():(q.hide(),y.fx.val(""),y.fy.val(""))),e("#"+l+"_jGraduate_match_ctr")[0].checked=!Y;var ge=void 0,ve=void 0;if(e("#"+l+"_jGraduate_match_ctr").change(function(){Y=!this.checked,q.toggle(Y),y.fx.val(""),y.fy.val("");var e=k;if(Y){var t=ge||.5,n=ve||.5;e.setAttribute("fx",t),e.setAttribute("fy",n),y.fx.val(t),y.fy.val(n)}else ge=e.getAttribute("fx"),ve=e.getAttribute("fy"),e.removeAttribute("fx"),e.removeAttribute("fy")}),(he=(X=k.getElementsByTagNameNS(rr.svg,"stop")).length)<2){for(;he<2;)k.append(document.createElementNS(rr.svg,"stop")),++he;X=k.getElementsByTagNameNS(rr.svg,"stop")}var me=void 0,_e=0,ye=0;if("radialGradient"===w){var be=k.gradientTransform.baseVal;if(2===be.numberOfItems){var xe=be.getItem(0),we=be.getItem(1);if(2===xe.type&&3===we.type){var Se=we.matrix;1!==Se.a?_e=Math.round(100*-(1-Se.a)):1!==Se.d&&(_e=Math.round(100*(1-Se.d)))}}else if(3===be.numberOfItems){var ke=be.getItem(0),Ce=be.getItem(1),Ae=be.getItem(2);if(4===ke.type&&2===Ce.type&&3===Ae.type){ye=Math.round(ke.angle);var Ee=Ae.matrix;1!==Ee.a?_e=Math.round(100*-(1-Ee.a)):1!==Ee.d&&(_e=Math.round(100*(1-Ee.d)))}}}var Ge={radius:{handle:"#"+l+"_jGraduate_RadiusArrows",input:"#"+l+"_jGraduate_RadiusInput",val:100*(k.getAttribute("r")||.5)},opacity:{handle:"#"+l+"_jGraduate_OpacArrows",input:"#"+l+"_jGraduate_OpacInput",val:o.paint.alpha||100},ellip:{handle:"#"+l+"_jGraduate_EllipArrows",input:"#"+l+"_jGraduate_EllipInput",val:_e},angle:{handle:"#"+l+"_jGraduate_AngleArrows",input:"#"+l+"_jGraduate_AngleInput",val:ye}};e.each(Ge,function(t,n){var r=e(n.handle);r.mousedown(function(a){var i=r.parent();me={type:t,elem:r,input:e(n.input),parent:i,offset:i.offset()},f.mousemove(Pe).mouseup(Ne),a.preventDefault()}),e(n.input).val(n.val).change(function(){var e="radialGradient"===w,n=+this.value,a=0;switch(t){case"radius":e&&k.setAttribute("r",n/100),a=Math.pow(n/100,.4)/2*145;break;case"opacity":o.paint.alpha=n,U.setAttribute("fill-opacity",n/100),a=1.45*n;break;case"ellip":if(J=ee=1,0===n){a=72.5;break}n>99.5&&(n=99.5),n>0?ee=1-n/100:J=-n/100-1,a=(n+100)/2*145/100,e&&Ve();break;case"angle":a=(te=n)/180,a+=.5,a*=145,e&&Ve()}a>145?a=145:a<0&&(a=0),r.css({"margin-left":a-5})}).change()});for(var Pe=function(e){!function(e){var t=me.offset,n=me.parent,r=e.pageX-t.left-parseInt(n.css("border-left-width"));r>145&&(r=145),r<=0&&(r=0);var a=r-5;switch(r/=145,me.type){case"radius":(r=Math.pow(2*r,2.5))>.98&&r<1.02&&(r=1),r<=.01&&(r=.01),k.setAttribute("r",r);break;case"opacity":o.paint.alpha=parseInt(100*r),U.setAttribute("fill-opacity",r);break;case"ellip":J=1,ee=1,r<.5?J=(r/=.5)<=0?.01:r:r>.5&&(ee=(r=2-(r/=.5))<=0?.01:r),Ve(),ee===1+(r-=1)&&(r=Math.abs(r));break;case"angle":r-=.5,te=r*=180,Ve(),r/=100}me.elem.css({"margin-left":a}),r=Math.round(100*r),me.input.val(r)}(e),e.preventDefault()},Ne=function e(t){f.unbind("mousemove",Pe).unbind("mouseup",e),me=null},Ie=(255*o.paint.alpha/100).toString(16);Ie.length<2;)Ie="0"+Ie;Ie=Ie.split(".")[0],h="none"===o.paint.solidColor?"":o.paint.solidColor+Ie,A||(h=X[0].getAttribute("stop-color")),e.extend(e.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),p.jPicker({window:{title:s.window.pickerTitle},images:{clientPath:s.images.clientPath},color:{active:h,alphaSupport:!0}},function(e){o.paint.type="solidColor",o.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,o.paint.solidColor=e.val("hex")?e.val("hex"):"none",o.paint.radialGradient=null,u()},null,function(){d()});var Te=e(c+" .jGraduate_tabs li");Te.click(function(){Te.removeClass("jGraduate_tab_current"),e(this).addClass("jGraduate_tab_current"),e(c+" > div").hide();var t=e(this).attr("data-type");if(e(c+" .jGraduate_gradPick").show(),"rg"===t||"lg"===t){e(".jGraduate_"+t+"_field").show(),e(".jGraduate_"+("lg"===t?"rg":"lg")+"_field").hide(),e("#"+l+"_jgraduate_rect")[0].setAttribute("fill","url(#"+l+"_"+t+"_jgraduate_grad)"),w="lg"===t?"linearGradient":"radialGradient",e("#"+l+"_jGraduate_OpacInput").val(o.paint.alpha).change();var n=e("#"+l+"_"+t+"_jgraduate_grad")[0];if(k!==n){var r=e(k).find("stop");e(n).empty().append(r),k=n;var a=le.val();k.setAttribute("spreadMethod",a)}Y="rg"===t&&null!=k.getAttribute("fx")&&!(V===B&&R===D),e("#"+l+"_jGraduate_focusCoord").toggle(Y),Y&&(e("#"+l+"_jGraduate_match_ctr")[0].checked=!1)}else e(c+" .jGraduate_gradPick").hide(),e(c+" .jGraduate_colPick").show()}),e(c+" > div").hide(),Te.removeClass("jGraduate_tab_current");var Le=void 0;switch(o.paint.type){case"linearGradient":Le=e(c+" .jGraduate_tab_lingrad");break;case"radialGradient":Le=e(c+" .jGraduate_tab_radgrad");break;default:Le=e(c+" .jGraduate_tab_color")}o.show(),setTimeout(function(){Le.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Me(t,n,r,i,o){var c=o||a("stop",{"stop-color":n,"stop-opacity":r,offset:t},k);o?(n=o.getAttribute("stop-color"),r=o.getAttribute("stop-opacity"),t=o.getAttribute("offset")):k.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=a("path",{d:u,fill:"url(#jGraduate_trans)",transform:"translate("+(10+t*v)+", 26)"},E),h=a("path",{d:u,fill:n,"fill-opacity":r,transform:"translate("+(10+t*v)+", 26)",stroke:"#000","stroke-width":1.5},E);return e(h).mousedown(function(e){return Oe(this),K=Q,f.mousemove(Re).mouseup(je),$=W.offset(),e.preventDefault(),!1}).data("stop",c).data("bg",d).dblclick(function(){e("div.jGraduate_LightBox").show();for(var t=this,r=+c.getAttribute("stop-opacity")||1,a=c.getAttribute("stop-color")||1,i=(255*parseFloat(r)).toString(16);i.length<2;)i="0"+i;n=a.substr(1)+i,e("#"+l+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:s.images.clientPath},color:{active:n,alphaSupport:!0}},function(n,i){a=n.val("hex")?"#"+n.val("hex"):"none",r=null!==n.val("a")?n.val("a")/256:1,t.setAttribute("fill",a),t.setAttribute("fill-opacity",r),c.setAttribute("stop-color",a),c.setAttribute("stop-opacity",r),e("div.jGraduate_LightBox").hide(),e("#"+l+"_jGraduate_stopPicker").hide()},null,function(){e("div.jGraduate_LightBox").hide(),e("#"+l+"_jGraduate_stopPicker").hide()})}),e(k).find("stop").each(function(){var r=e(this);if(+this.getAttribute("offset")>t){if(!n){var a=this.getAttribute("stop-color"),i=this.getAttribute("stop-opacity");c.setAttribute("stop-color",a),h.setAttribute("fill",a),c.setAttribute("stop-opacity",null===i?1:i),h.setAttribute("fill-opacity",null===i?1:i)}return r.before(c),!1}}),i&&Oe(h),c}function Oe(e){Q&&Q.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),(Q=e).parentNode.append(Q)}function je(){f.unbind("mousemove",Re),"none"!==Z.getAttribute("display")&&function(){Z.setAttribute("display","none");var t=e(Q),n=t.data("stop"),r=t.data("bg");e([Q,n,r]).remove()}(),K=null}function Ve(){var e=te?"rotate("+te+","+ne+","+re+") ":"";if(1===J&&1===ee)k.removeAttribute("gradientTransform");else{var t=-ne*(J-1),n=-re*(ee-1);k.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+J+","+ee+")")}}function Re(t){var n=t.pageX-$.left,r=t.pageY-$.top,a="translate("+(n=n<10?10:n>v+10?v+10:n)+", 26)";r<-60||r>130?(Z.setAttribute("display","block"),Z.setAttribute("transform",a)):Z.setAttribute("display","none"),K.setAttribute("transform",a),e.data(K,"bg").setAttribute("transform",a);var i=e.data(K,"stop"),o=(n-10)/v;i.setAttribute("offset",o);var s=0;e(k).find("stop").each(function(t){var n=this.getAttribute("offset"),r=e(this);n<s&&(r.prev().before(r),X=e(k).find("stop")),s=n})}})},e},function(e){return e.loadingStylesheets||(e.loadingStylesheets=[]),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 r=document.body,a=t[n];(t=t.offsetParent)&&t!==r;)e.browser.msie&&"relative"===t.currentStyle.position||(a+=t[n]);return a}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(r){var a=r.pageX||r.x,i=r.pageY||r.y,o=r.target,s=t.stateObj.tool_scale||1,l=e(o).height()/2,c=a>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,r=function(){t.adjustValue(t.spinCfg._direction*n)};r(),this.spinCfg._delay=window.setTimeout(function(){r(),t.spinCfg._repeat=window.setInterval(r,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},U,function(e){var t=e(window),n=e(document);return e.extend(e.fn,{contextMenu:function(r,a){return void 0!==r.menu&&(void 0===r.inSpeed&&(r.inSpeed=150),void 0===r.outSpeed&&(r.outSpeed=75),0===r.inSpeed&&(r.inSpeed=-1),0===r.outSpeed&&(r.outSpeed=-1),e(this).each(function(){var i=e(this),o=e(i).offset(),s=e("#"+r.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||r.allowLeft||c.ctrlKey&&V()){if(l.stopPropagation(),e(".contextMenu").hide(),i.hasClass("disabled"))return!1;var d=l.pageX,h=l.pageY,f=t.width()-s.width(),p=t.height()-s.height();d>f-15&&(d=f-15),h>p-30&&(h=p-30),n.unbind("click"),s.css({top:h,left:d}).fadeIn(r.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(),a&&a(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(r.outSpeed),!1})},0)}})}),e.browser.mozilla?e("#"+r.menu).each(function(){e(this).css({MozUserSelect:"none"})}):e.browser.msie?e("#"+r.menu).each(function(){e(this).bind("selectstart.disableTextSelect",function(){return!1})}):e("#"+r.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(","),r=0;r<n.length;r++)e(this).find('A[href="'+n[r]+'"]').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(","),r=0;r<n.length;r++)e(this).find('A[href="'+n[r]+'"]').parent().removeClass("disabled")}),e(this))},disableContextMenu:function(){return e(this).each(function(){e(this).addClass("disabled")}),e(this)},enableContextMenu:function(){return e(this).each(function(){e(this).removeClass("disabled")}),e(this)},destroyContextMenu:function(){return e(this).each(function(){e(this).unbind("mousedown").unbind("mouseup")}),e(this)}}),e},function(e){e.loadingStylesheets||(e.loadingStylesheets=[]);function n(t,n){var r=this;function a(n){var a=t.offset();u={l:0|a.left,t:0|a.top},clearTimeout(d),d=setTimeout(function(){s.call(r,n)},0),e(document).bind("mousemove",i).bind("mouseup",o),n.preventDefault()}function i(e){return clearTimeout(d),d=setTimeout(function(){s.call(r,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,a=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>a&&(o=a),l.call(r,"xy",{x:i/n*v+p,y:o/a*y+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 f;case"xy":default:return{x:h,y:f}}if(null==n||n!==r){var a=!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>g&&(i=g),h!==i&&(h=i,a=!0)),null!=o&&(o<m?o=m:o>_&&(o=_),f!==o&&(f=o,a=!0)),a&&function(e){for(var t=0;t<x.length;t++)x[t].call(r,r,e)}.call(r,n||r)}}function c(e){"function"==typeof e&&x.push(e)}var u=void 0,d=void 0,h=0,f=0,p=0,g=100,v=100,m=0,_=100,y=100,b=t.find("img:first"),x=[];e.extend(!0,r,{val:l,range:function(e,t){if(void 0===t)switch(void 0!==e&&null!=e||(e="all"),e.toLowerCase()){case"minx":return p;case"maxx":return g;case"rangex":return{minX:p,maxX:g,rangeX:v};case"miny":return m;case"maxy":return _;case"rangey":return{minY:m,maxY:_,rangeY:y};case"all":default:return{minX:p,maxX:g,rangeX:v,minY:m,maxY:_,rangeY:y}}var n=void 0,r=void 0,a=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":r=t&&(t.maxX&&0|t.maxX||0|t)||0;break;case"rangex":n=t&&t.minX&&0|t.minX||0,r=t&&t.maxX&&0|t.maxX||0;break;case"miny":a=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":a=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,r=t&&t.maxX&&0|t.maxX||0,a=t&&t.minY&&0|t.minY||0,i=t&&t.maxY&&0|t.maxY||0}null!=n&&p!==n&&(v=g-(p=n)),null!=r&&g!==r&&(v=(g=r)-p),null!=a&&m!==a&&(y=_-(m=a)),null!=i&&_!==i&&(y=(_=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",a),t=null,b=null,x=null}}),b.src=n.arrow&&n.arrow.image,b.w=n.arrow&&n.arrow.width||b.width(),b.h=n.arrow&&n.arrow.height||b.height(),t.w=n.map&&n.map.width||t.width(),t.h=n.map&&n.map.height||t.height(),t.bind("mousedown",a),c.call(r,function(){var e=t.w,n=t.h,r=b.w,a=b.h,i=0,o=0;setTimeout(function(){v>0&&(i=h===g?e:h/v*e|0),y>0&&(o=f===_?n:f/y*n|0),r>=e?i=(e>>1)-(r>>1):i-=r>>1,a>=n?o=(n>>1)-(a>>1):o-=a>>1,b.css({left:i+"px",top:o+"px"})},0)})}function r(t,n,r,a){var i=this,o=t.find("td.Text input");function s(e){if(""!==e.target.value||e.target===b.get(0)||(null==r||e.target===r.get(0))&&null!=r){if(!u(e))return e;switch(e.target){case f.get(0):switch(e.keyCode){case 38:return f.val(d.call(i,1+(f.val()<<0),0,255)),n.val("r",f.val(),e.target),!1;case 40:return f.val(d.call(i,(f.val()<<0)-1,0,255)),n.val("r",f.val(),e.target),!1}break;case p.get(0):switch(e.keyCode){case 38:return p.val(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 g.get(0):switch(e.keyCode){case 38:return g.val(d.call(i,1+(g.val()<<0),0,255)),n.val("b",g.val(),e.target),!1;case 40:return g.val(d.call(i,(g.val()<<0)-1,0,255)),n.val("b",g.val(),e.target),!1}break;case v&&v.get(0):switch(e.keyCode){case 38:return v.val(d.call(i,parseFloat(v.val())+1,0,100)),n.val("a",ar(255*v.val()/100,a),e.target),!1;case 40:return v.val(d.call(i,parseFloat(v.val())-1,0,100)),n.val("a",ar(255*v.val()/100,a),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 y.get(0):switch(e.keyCode){case 38:return y.val(d.call(i,1+(y.val()<<0),0,100)),n.val("v",y.val(),e.target),!1;case 40:return y.val(d.call(i,(y.val()<<0)-1,0,100)),n.val("v",y.val(),e.target),!1}}}}function l(e){if(""!==e.target.value||e.target===b.get(0)||(null==r||e.target===r.get(0))&&null!=r){if(!u(e))return e;switch(e.target){case f.get(0):f.val(d.call(i,f.val(),0,255)),n.val("r",f.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 g.get(0):g.val(d.call(i,g.val(),0,255)),n.val("b",g.val(),e.target);break;case v&&v.get(0):v.val(d.call(i,v.val(),0,100)),n.val("a",ar(255*v.val()/100,a),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 y.get(0):y.val(d.call(i,y.val(),0,100)),n.val("v",y.val(),e.target);break;case b.get(0):b.val(b.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),r&&r.val(b.val()),n.val("hex",""!==b.val()?b.val():null,e.target);break;case r&&r.get(0):r.val(r.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),b.val(r.val()),n.val("hex",""!==r.val()?r.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 f.get(0):f.val(n.val("r"));break;case p.get(0):p.val(n.val("g"));break;case g.get(0):g.val(n.val("b"));break;case v&&v.get(0):v.val(ar(100*n.val("a")/255,a));break;case m.get(0):m.val(n.val("h"));break;case _.get(0):_.val(n.val("s"));break;case y.get(0):y.val(n.val("v"));break;case b.get(0):case r&&r.get(0):b.val(n.val("hex")),r&&r.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!==f.get(0)&&f.val(null!=n?n.r:""),t!==p.get(0)&&p.val(null!=n?n.g:""),t!==g.get(0)&&g.val(null!=n?n.b:""),v&&t!==v.get(0)&&v.val(null!=n?ar(100*n.a/255,a):""),t!==m.get(0)&&m.val(null!=n?n.h:""),t!==_.get(0)&&_.val(null!=n?n.s:""),t!==y.get(0)&&y.val(null!=n?n.v:""),t!==b.get(0)&&(r&&t!==r.get(0)||!r)&&b.val(null!=n?n.hex:""),r&&t!==r.get(0)&&t!==b.get(0)&&r.val(null!=n?n.hex:""),x&&t!==x.get(0)&&x.val(null!=n?n.ahex.substring(6):"")}var f=o.eq(3),p=o.eq(4),g=o.eq(5),v=o.length>7?o.eq(6):null,m=o.eq(0),_=o.eq(1),y=o.eq(2),b=o.eq(o.length>7?7:6),x=o.length>7?o.eq(8):null;e.extend(!0,i,{destroy:function(){f.add(p).add(g).add(v).add(m).add(_).add(y).add(b).add(r).add(x).unbind("keyup",l).unbind("blur",c),f.add(p).add(g).add(v).add(m).add(_).add(y).unbind("keydown",s),n.unbind(h),f=null,p=null,g=null,v=null,m=null,_=null,y=null,b=null,x=null}}),f.add(p).add(g).add(v).add(m).add(_).add(y).add(b).add(r).add(x).bind("keyup",l).bind("blur",c),f.add(p).add(g).add(v).add(m).add(_).add(y).bind("keydown",s),n.bind(h)}e.loadingStylesheets.includes("jgraduate/css/jPicker.css")||e.loadingStylesheets.push("jgraduate/css/jPicker.css"),e.jPicker={List:[],Color:function(t){var n=this;function r(e){for(var t=0;t<f.length;t++)f[t].call(n,n,e)}function a(e,t,f){var p=Boolean(t);if(p&&""===t.ahex&&(t.ahex="00000000"),!p){if(void 0!==e&&null!=e&&""!==e||(e="all"),null==i)return null;switch(e.toLowerCase()){case"ahex":return s.rgbaToHex({r:i,g:o,b:l,a:c});case"hex":return a("ahex").substring(0,6);case"all":return{r:i,g:o,b:l,a:c,h:u,s:d,v:h,hex:a.call(n,"hex"),ahex:a.call(n,"ahex")};default:for(var g={},v=0;v<e.length;v++)switch(e.charAt(v)){case"r":1===e.length?g=i:g.r=i;break;case"g":1===e.length?g=o:g.g=o;break;case"b":1===e.length?g=l:g.b=l;break;case"a":1===e.length?g=c:g.a=c;break;case"h":1===e.length?g=u:g.h=u;break;case"s":1===e.length?g=d:g.s=d;break;case"v":1===e.length?g=h:g.v=h}return e.length?g:a.call(n,"all")}}if(null==f||f!==n){null==e&&(e="");var m=!1;if(null==t)return null!=i&&(i=null,m=!0),null!=o&&(o=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&&r.call(n,f||n));switch(e.toLowerCase()){case"ahex":case"hex":var _=s.hexToRgba(t&&(t.ahex||t.hex)||t||"none");a.call(n,"rgba",{r:_.r,g:_.g,b:_.b,a:"ahex"===e?_.a:null!=c?c:255},f);break;default:if(t&&(null!=t.ahex||null!=t.hex))return void a.call(n,"ahex",t.ahex||t.hex||"00000000",f);var y={},b=!1,x=!1;void 0===t.r||e.includes("r")||(e+="r"),void 0===t.g||e.includes("g")||(e+="g"),void 0===t.b||e.includes("b")||(e+="b"),void 0===t.a||e.includes("a")||(e+="a"),void 0===t.h||e.includes("h")||(e+="h"),void 0===t.s||e.includes("s")||(e+="s"),void 0===t.v||e.includes("v")||(e+="v");for(var w=0;w<e.length;w++)switch(e.charAt(w)){case"r":if(x)continue;b=!0,y.r=t.r&&0|t.r||0|t||0,y.r<0?y.r=0:y.r>255&&(y.r=255),i!==y.r&&(i=y.r,m=!0);break;case"g":if(x)continue;b=!0,y.g=t&&t.g&&0|t.g||t&&0|t||0,y.g<0?y.g=0:y.g>255&&(y.g=255),o!==y.g&&(o=y.g,m=!0);break;case"b":if(x)continue;b=!0,y.b=t&&t.b&&0|t.b||t&&0|t||0,y.b<0?y.b=0:y.b>255&&(y.b=255),l!==y.b&&(l=y.b,m=!0);break;case"a":y.a=t&&null!=t.a?0|t.a:0|t,y.a<0?y.a=0:y.a>255&&(y.a=255),c!==y.a&&(c=y.a,m=!0);break;case"h":if(b)continue;x=!0,y.h=t&&t.h&&0|t.h||t&&0|t||0,y.h<0?y.h=0:y.h>360&&(y.h=360),u!==y.h&&(u=y.h,m=!0);break;case"s":if(b)continue;x=!0,y.s=null!=t.s?0|t.s:0|t,y.s<0?y.s=0:y.s>100&&(y.s=100),d!==y.s&&(d=y.s,m=!0);break;case"v":if(b)continue;x=!0,y.v=null!=t.v?0|t.v:0|t,y.v<0?y.v=0:y.v>100&&(y.v=100),h!==y.v&&(h=y.v,m=!0)}if(m){if(b){i=i||0,o=o||0,l=l||0;var S=s.rgbToHsv({r:i,g:o,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 k=s.hsvToRgb({h:u,s:d,v:h});i=k.r,o=k.g,l=k.b}c=null!=c?c:255,r.call(n,f||n)}}}}var i=void 0,o=void 0,l=void 0,c=void 0,u=void 0,d=void 0,h=void 0,f=[];e.extend(!0,n,{val:a,bind:function(e){"function"==typeof e&&f.push(e)},unbind:function(e){if("function"==typeof e)for(var t=void 0;t=f.includes(e);)f.splice(t,1)},destroy:function(){f=null}}),t&&(null!=t.ahex?a("ahex",t):null!=t.hex?a((null!=t.a?"a":"")+"hex",null!=t.a?{ahex:t.hex+s.intToHex(t.a)}:t):null!=t.r&&null!=t.g&&null!=t.b?a("rgb"+(null!=t.a?"a":""),t):null!=t.h&&null!=t.s&&null!=t.v&&a("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",r="00",a="255";return 6===(e=this.validateHex(e)).length&&(e+="ff"),e.length>6?(t=e.substring(0,2),n=e.substring(2,4),r=e.substring(4,6),a=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&&(r=e.substring(0,e.length))),{r:this.hexToInt(t),g:this.hexToInt(n),b:this.hexToInt(r),a:this.hexToInt(a)}},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,r=e.b/255,a={h:0,s:0,v:0},i=0,o=0;t>=n&&t>=r?(o=t,i=n>r?r:n):n>=r&&n>=t?(o=n,i=t>r?r:t):(o=r,i=n>t?t:n),a.v=o,a.s=o?(o-i)/o:0;var s=void 0;return a.s?(s=o-i,a.h=t===o?(n-r)/s:n===o?2+(r-t)/s:4+(t-n)/s,a.h=parseInt(60*a.h),a.h<0&&(a.h+=360)):a.h=0,a.s=100*a.s|0,a.v=100*a.v|0,a},hsvToRgb:function(e){var t={r:0,g:0,b:0,a:100},n=e.h,r=e.s,a=e.v;if(0===r)t.r=t.g=t.b=0===a?0:255*a/100|0;else{360===n&&(n=0);var i=0|(n/=60),o=n-i,s=(a/=100)*(1-(r/=100)),l=a*(1-r*o),c=a*(1-r*(1-o));switch(i){case 0:t.r=a,t.g=c,t.b=s;break;case 1:t.r=l,t.g=a,t.b=s;break;case 2:t.r=s,t.g=a,t.b=c;break;case 3:t.r=s,t.g=l,t.b=a;break;case 4:t.r=c,t.g=s,t.b=a;break;case 5:t.r=a,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 a=e.jPicker,i=a.Color,o=a.List,s=a.ColorMethods;return e.fn.jPicker=function(a){var l=arguments;return this.each(function(){var c=this,u=e.extend(!0,{},e.fn.jPicker.defaults,a);"input"===e(c).get(0).nodeName.toLowerCase()&&(e.extend(!0,u,{window:{bindToInput:!0,expandable:!0,input:e(c)}}),""===e(c).val()?(u.color.active=new i({hex:null}),u.color.current=new i({hex:null})):s.validateHex(e(c).val())&&(u.color.active=new i({hex:e(c).val(),a:u.color.active.val("a")}),u.color.current=new i({hex:e(c).val(),a:u.color.active.val("a")}))),u.window.expandable?e(c).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>'):u.window.liveUpdate=!1;var d=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function h(e){var t=j.active,n=t.val("hex"),r=void 0,a=void 0;switch(u.color.mode=e,e){case"h":if(setTimeout(function(){v.call(c,F,"transparent"),_.call(c,z,0),y.call(c,z,100),_.call(c,q,260),y.call(c,q,100),v.call(c,H,"transparent"),_.call(c,W,0),y.call(c,W,100),_.call(c,X,260),y.call(c,X,100),_.call(c,Q,260),y.call(c,Q,100),_.call(c,K,260),y.call(c,K,100),_.call(c,$,260),y.call(c,$,100)},0),J.range("all",{minX:0,maxX:100,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:360}),null==t.val("ahex"))break;J.val("xy",{x:t.val("s"),y:100-t.val("v")},J),ee.val("y",360-t.val("h"),ee);break;case"s":if(setTimeout(function(){v.call(c,F,"transparent"),_.call(c,z,-260),_.call(c,q,-520),_.call(c,W,-260),_.call(c,X,-520),_.call(c,$,260),y.call(c,$,100)},0),J.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;J.val("xy",{x:t.val("h"),y:100-t.val("v")},J),ee.val("y",100-t.val("s"),ee);break;case"v":if(setTimeout(function(){v.call(c,F,"000000"),_.call(c,z,-780),_.call(c,q,260),v.call(c,H,n),_.call(c,W,-520),_.call(c,X,260),y.call(c,X,100),_.call(c,$,260),y.call(c,$,100)},0),J.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;J.val("xy",{x:t.val("h"),y:100-t.val("s")},J),ee.val("y",100-t.val("v"),ee);break;case"r":if(r=-1040,a=-780,J.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("b"),y:255-t.val("g")},J),ee.val("y",255-t.val("r"),ee);break;case"g":if(r=-1560,a=-1820,J.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("b"),y:255-t.val("r")},J),ee.val("y",255-t.val("g"),ee);break;case"b":if(r=-2080,a=-2860,J.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("r"),y:255-t.val("g")},J),ee.val("y",255-t.val("b"),ee);break;case"a":if(setTimeout(function(){v.call(c,F,"transparent"),_.call(c,z,-260),_.call(c,q,-520),_.call(c,W,260),_.call(c,X,260),y.call(c,X,100),_.call(c,$,0),y.call(c,$,100)},0),J.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("h"),y:100-t.val("v")},J),ee.val("y",255-t.val("a"),ee);break;default:throw new Error("Invalid Mode")}switch(e){case"h":break;case"s":case"v":case"a":setTimeout(function(){y.call(c,z,100),y.call(c,W,100),_.call(c,Q,260),y.call(c,Q,100),_.call(c,K,260),y.call(c,K,100)},0);break;case"r":case"g":case"b":setTimeout(function(){v.call(c,F,"transparent"),v.call(c,H,"transparent"),y.call(c,W,100),y.call(c,z,100),_.call(c,z,r),_.call(c,q,r-260),_.call(c,W,a-780),_.call(c,X,a-520),_.call(c,Q,a),_.call(c,K,a-260),_.call(c,$,260),y.call(c,$,100)},0)}null!=t.val("ahex")&&f.call(c,t)}function f(e,t){(null==t||t!==ee&&t!==J)&&function(e,t){if(t!==J)switch(u.color.mode){case"h":var n=e.val("sv");J.val("xy",{x:null!=n?n.s:100,y:100-(null!=n?n.v:100)},t);break;case"s":case"a":var r=e.val("hv");J.val("xy",{x:r&&r.h||0,y:100-(null!=r?r.v:100)},t);break;case"v":var a=e.val("hs");J.val("xy",{x:a&&a.h||0,y:100-(null!=a?a.s:100)},t);break;case"r":var i=e.val("bg");J.val("xy",{x:i&&i.b||0,y:255-(i&&i.g||0)},t);break;case"g":var o=e.val("br");J.val("xy",{x:o&&o.b||0,y:255-(o&&o.r||0)},t);break;case"b":var s=e.val("rg");J.val("xy",{x:s&&s.r||0,y:255-(s&&s.g||0)},t)}if(t!==ee)switch(u.color.mode){case"h":ee.val("y",360-(e.val("h")||0),t);break;case"s":var l=e.val("s");ee.val("y",100-(null!=l?l:100),t);break;case"v":var c=e.val("v");ee.val("y",100-(null!=c?c:100),t);break;case"r":ee.val("y",255-(e.val("r")||0),t);break;case"g":ee.val("y",255-(e.val("g")||0),t);break;case"b":ee.val("y",255-(e.val("b")||0),t);break;case"a":var d=e.val("a");ee.val("y",255-(null!=d?d:255),t)}}.call(c,e,t),setTimeout(function(){(function(e){try{var t=e.val("all");ne.css({backgroundColor:t&&"#"+t.hex||"transparent"}),y.call(c,ne,t&&ar(100*t.a/255,4)||0)}catch(e){}}).call(c,e),function(e){switch(u.color.mode){case"h":v.call(c,F,new i({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");y.call(c,q,100-(null!=t?t:100));break;case"v":var n=e.val("v");y.call(c,z,null!=n?n:100);break;case"r":y.call(c,q,ar((e.val("r")||0)/255*100,4));break;case"g":y.call(c,q,ar((e.val("g")||0)/255*100,4));break;case"b":y.call(c,q,ar((e.val("b")||0)/255*100))}var r=e.val("a");y.call(c,Y,ar(100*(255-(r||0))/255,4))}.call(c,e),function(e){switch(u.color.mode){case"h":var t=e.val("a");y.call(c,Z,ar(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),r=new i({h:n&&n.h||0,s:100,v:null!=n?n.v:100});v.call(c,H,r.val("hex")),y.call(c,X,100-(null!=n?n.v:100)),y.call(c,Z,ar(100*(255-(n&&n.a||0))/255,4));break;case"v":var a=e.val("hsa"),o=new i({h:a&&a.h||0,s:null!=a?a.s:100,v:100});v.call(c,H,o.val("hex")),y.call(c,Z,ar(100*(255-(a&&a.a||0))/255,4));break;case"r":case"g":case"b":var s=e.val("rgba"),l=0,d=0;"r"===u.color.mode?(l=s&&s.b||0,d=s&&s.g||0):"g"===u.color.mode?(l=s&&s.b||0,d=s&&s.r||0):"b"===u.color.mode&&(l=s&&s.r||0,d=s&&s.g||0);var h=d>l?l:d;y.call(c,X,l>d?ar((l-d)/(255-d)*100,4):0),y.call(c,Q,d>l?ar((d-l)/(255-l)*100,4):0),y.call(c,K,ar(h/255*100,4)),y.call(c,Z,ar(100*(255-(s&&s.a||0))/255,4));break;case"a":var f=e.val("a");v.call(c,H,e.val("hex")||"000000"),y.call(c,Z,null!=f?0:100),y.call(c,$,null!=f?100:0)}}.call(c,e)},0)}function p(e,t){var n=j.active;if(t===J||null!=n.val()){var r=e.val("all");switch(u.color.mode){case"h":n.val("sv",{s:r.x,v:100-r.y},t);break;case"s":case"a":n.val("hv",{h:r.x,v:100-r.y},t);break;case"v":n.val("hs",{h:r.x,s:100-r.y},t);break;case"r":n.val("gb",{g:255-r.y,b:r.x},t);break;case"g":n.val("rb",{r:255-r.y,b:r.x},t);break;case"b":n.val("rg",{r:r.x,g:255-r.y},t)}}}function g(e,t){var n=j.active;if(t===ee||null!=n.val())switch(u.color.mode){case"h":n.val("h",{h:360-e.val("y")},t);break;case"s":n.val("s",{s:100-e.val("y")},t);break;case"v":n.val("v",{v:100-e.val("y")},t);break;case"r":n.val("r",{r:255-e.val("y")},t);break;case"g":n.val("g",{g:255-e.val("y")},t);break;case"b":n.val("b",{b:255-e.val("y")},t);break;case"a":n.val("a",255-e.val("y"),t)}}function v(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function m(e,t){d&&(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 _(e,t){e.css({top:t+"px"})}function y(e,t){if(e.css({visibility:t>0?"visible":"hidden"}),t>0&&t<100)if(d){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:ar(t/100,4)})}else e.css({opacity:ar(t/100,4)});else if(0===t||100===t)if(d){var r=e.attr("pngSrc");null!=r&&(r.includes("AlphaBar.png")||r.includes("Bars.png")||r.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+r+"', sizingMethod='scale')"}):e.css({opacity:""})}else e.css({opacity:""})}function b(){j.active.val("ahex",j.current.val("ahex"))}function x(t){e(this).parents("tbody:first").find('input:radio[value!="'+t.target.value+'"]').removeAttr("checked"),h.call(c,t.target.value)}function w(){b.call(c)}function S(){b.call(c),u.window.expandable&&L.call(c),"function"==typeof fe&&fe.call(c,j.active,ie)}function k(){(function(){j.current.val("ahex",j.active.val("ahex"))}).call(c),u.window.expandable&&L.call(c),"function"==typeof de&&de.call(c,j.active,ae)}function C(){T.call(c)}function A(e,t){var n=e.val("hex");re.css({backgroundColor:n&&"#"+n||"transparent"}),y.call(c,re,ar(100*(e.val("a")||0)/255,4))}function E(e,t){var n=e.val("hex"),r=e.val("va");se.css({backgroundColor:n&&"#"+n||"transparent"}),y.call(c,le,ar(100*(255-(r&&r.a||0))/255,4)),u.window.bindToInput&&u.window.updateInputColor&&u.window.input.css({backgroundColor:n&&"#"+n||"transparent",color:null==r||r.v>75?"#000000":"#ffffff"})}function G(t){V=parseInt(U.css("left")),R=parseInt(U.css("top")),B=t.pageX,D=t.pageY,e(document).bind("mousemove",P).bind("mouseup",N),t.preventDefault()}function P(t){return U.css({left:V-(B-t.pageX)+"px",top:R-(D-t.pageY)+"px"}),u.window.expandable&&!e.support.boxModel&&U.prev().css({left:U.css("left"),top:U.css("top")}),t.stopPropagation(),t.preventDefault(),!1}function N(t){return e(document).unbind("mousemove",P).unbind("mouseup",N),t.stopPropagation(),t.preventDefault(),!1}function I(t){return t.preventDefault(),t.stopPropagation(),j.active.val("ahex",e(this).attr("title")||null,t.target),!1}function T(){function t(){if(u.window.expandable&&!e.support.boxModel){var t=U.find("table:first");U.before("<iframe/>"),U.prev().css({width:t.width(),height:U.height(),opacity:0,position:"absolute",left:U.css("left"),top:U.css("top")})}}switch(j.current.val("ahex",j.active.val("ahex")),u.window.expandable&&(e(document.body).children("div.jPicker.Container").css({zIndex:10}),U.css({zIndex:20})),u.window.effects.type){case"fade":U.fadeIn(u.window.effects.speed.show,t);break;case"slide":U.slideDown(u.window.effects.speed.show,t);break;case"show":default:U.show(u.window.effects.speed.show,t)}}function L(){function t(){u.window.expandable&&U.css({zIndex:10}),u.window.expandable&&!e.support.boxModel&&U.prev().remove()}switch(u.window.effects.type){case"fade":U.fadeOut(u.window.effects.speed.hide,t);break;case"slide":U.slideUp(u.window.effects.speed.hide,t);break;case"show":default:U.hide(u.window.effects.speed.hide,t)}}var M=u.images,O=u.localization,j={active:"string"===t(u.color.active).toString().toLowerCase()?new i({ahex:!u.window.alphaSupport&&u.color.active?u.color.active.substring(0,6)+"ff":u.color.active}):new i({ahex:!u.window.alphaSupport&&u.color.active.val("ahex")?u.color.active.val("ahex").substring(0,6)+"ff":u.color.active.val("ahex")}),current:"string"===t(u.color.active).toString().toLowerCase()?new i({ahex:!u.window.alphaSupport&&u.color.active?u.color.active.substring(0,6)+"ff":u.color.active}):new i({ahex:!u.window.alphaSupport&&u.color.active.val("ahex")?u.color.active.val("ahex").substring(0,6)+"ff":u.color.active.val("ahex")}),quickList:u.color.quickList},V=null,R=null,B=null,D=null,U=null,F=null,H=null,z=null,q=null,Y=null,W=null,X=null,Q=null,K=null,Z=null,$=null,J=null,ee=null,te=null,ne=null,re=null,ae=null,ie=null,oe=null,se=null,le=null,ce=null,ue=null,de="function"==typeof l[1]?l[1]:null,he="function"==typeof l[2]?l[2]:null,fe="function"==typeof l[3]?l[3]:null;e.extend(!0,c,{commitCallback:de,liveCallback:he,cancelCallback:fe,color:j,show:T,hide:L,destroy:function(){U.find("td.Radio input").unbind("click",x),re.unbind("click",w),ie.unbind("click",S),ae.unbind("click",k),u.window.expandable&&(ce.unbind("click",C),ue.unbind("mousedown",G),c.icon=null),U.find(".QuickColor").unbind("click",I),F=null,H=null,z=null,q=null,Y=null,W=null,X=null,Q=null,K=null,Z=null,$=null,J.destroy(),J=null,ee.destroy(),ee=null,te.destroy(),te=null,ne=null,re=null,ae=null,ie=null,oe=null,de=null,fe=null,he=null,U.html("");for(var e=0;e<o.length;e++)o[e]===c&&o.splice(e,1)}}),o.push(c),setTimeout(function(){(function(){var a=u.window,o=a.expandable?e(c).next().find(".Container:first"):null;(U=a.expandable?e("<div/>"):e(c)).addClass("jPicker Container"),a.expandable&&U.hide(),U.get(0).onselectstart=function(e){if("input"!==e.target.nodeName.toLowerCase())return!1};var s=j.active.val("all");a.alphaPrecision<0?a.alphaPrecision=0:a.alphaPrecision>2&&(a.alphaPrecision=2);var l='<table class="jPicker" cellpadding="0" cellspacing="0">\n <tbody>\n '+(a.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':"")+'\n <tr>\n <td rowspan="9"><h2 class="Title">'+(a.title||O.text.title)+'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+(M.clientPath+M.colorMap.arrow.file)+'" class="Arrow"/></div></td>\n <td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+(M.clientPath+M.colorBar.arrow.file)+'" class="Arrow"/></div></td>\n <td colspan="2" class="Preview">'+O.text.newColor+'<div><span class="Active" title="'+O.tooltips.colors.newColor+'">&nbsp;</span><span class="Current" title="'+O.tooltips.colors.currentColor+'">&nbsp;</span></div>'+O.text.currentColor+'</td>\n <td rowspan="9" class="Button"><input type="button" class="Ok" value="'+O.text.ok+'" title="'+O.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+O.text.cancel+'" title="'+O.tooltips.buttons.cancel+'"/><hr/><div class="Grid">&nbsp;</div></td>\n </tr>\n <tr class="Hue">\n <td class="Radio"><label title="'+O.tooltips.hue.radio+'"><input type="radio" value="h"'+("h"===u.color.mode?' checked="checked"':"")+'/>H:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="'+(null!=s?s.h:"")+'" title="'+O.tooltips.hue.textbox+'"/>&nbsp;&deg;</td>\n </tr>\n <tr class="Saturation">\n <td class="Radio"><label title="'+O.tooltips.saturation.radio+'"><input type="radio" value="s"'+("s"===u.color.mode?' checked="checked"':"")+'/>S:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="'+(null!=s?s.s:"")+'" title="'+O.tooltips.saturation.textbox+'"/>&nbsp;%</td>\n </tr>\n <tr class="Value">\n <td class="Radio"><label title="'+O.tooltips.value.radio+'"><input type="radio" value="v"'+("v"===u.color.mode?' checked="checked"':"")+'/>V:</label><br/><br/></td>\n <td class="Text"><input type="text" maxlength="3" value="'+(null!=s?s.v:"")+'" title="'+O.tooltips.value.textbox+'"/>&nbsp;%<br/><br/></td>\n </tr>\n <tr class="Red">\n <td class="Radio"><label title="'+O.tooltips.red.radio+'"><input type="radio" value="r"'+("r"===u.color.mode?' checked="checked"':"")+'/>R:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="'+(null!=s?s.r:"")+'" title="'+O.tooltips.red.textbox+'"/></td>\n </tr>\n <tr class="Green">\n <td class="Radio"><label title="'+O.tooltips.green.radio+'"><input type="radio" value="g"'+("g"===u.color.mode?' checked="checked"':"")+'/>G:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="'+(null!=s?s.g:"")+'" title="'+O.tooltips.green.textbox+'"/></td>\n </tr>\n <tr class="Blue">\n <td class="Radio"><label title="'+O.tooltips.blue.radio+'"><input type="radio" value="b"'+("b"===u.color.mode?' checked="checked"':"")+'/>B:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="'+(null!=s?s.b:"")+'" title="'+O.tooltips.blue.textbox+'"/></td>\n </tr>\n <tr class="Alpha">\n <td class="Radio">'+(a.alphaSupport?'<label title="'+O.tooltips.alpha.radio+'"><input type="radio" value="a"'+("a"===u.color.mode?' checked="checked"':"")+"/>A:</label>":"&nbsp;")+'</td>\n <td class="Text">'+(a.alphaSupport?'<input type="text" maxlength="'+(3+a.alphaPrecision)+'" value="'+(null!=s?ar(100*s.a/255,a.alphaPrecision):"")+'" title="'+O.tooltips.alpha.textbox+'"/>&nbsp;%':"&nbsp;")+'</td>\n </tr>\n <tr class="Hex">\n <td colspan="2" class="Text"><label title="'+O.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(null!=s?s.hex:"")+'"/></label>'+(a.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(null!=s?s.ahex.substring(6):"")+'" title="'+O.tooltips.hex.alpha+'"/></td>':"&nbsp;")+"\n </tr>\n </tbody></table>";a.expandable?(U.html(l),e(document.body).children("div.jPicker.Container").length?e(document.body).children("div.jPicker.Container:last").after(U):e(document.body).prepend(U),U.mousedown(function(){e(document.body).children("div.jPicker.Container").css({zIndex:10}),U.css({zIndex:20})}),U.css({left:"left"===a.position.x?o.offset().left-530-("center"===a.position.y?25:0)+"px":"center"===a.position.x?o.offset().left-260+"px":"right"===a.position.x?o.offset().left-10+("center"===a.position.y?25:0)+"px":"screenCenter"===a.position.x?(e(document).width()>>1)-260+"px":o.offset().left+parseInt(a.position.x)+"px",position:"absolute",top:"top"===a.position.y?o.offset().top-312+"px":"center"===a.position.y?o.offset().top-156+"px":"bottom"===a.position.y?o.offset().top+25+"px":o.offset().top+parseInt(a.position.y)+"px"})):(U=e(c)).html(l);var d=U.find("tbody:first");F=d.find("div.Map:first"),H=d.find("div.Bar:first");var v=F.find("span"),_=H.find("span");z=v.filter(".Map1:first"),q=v.filter(".Map2:first"),Y=v.filter(".Map3:first"),W=_.filter(".Map1:first"),X=_.filter(".Map2:first"),Q=_.filter(".Map3:first"),K=_.filter(".Map4:first"),Z=_.filter(".Map5:first"),$=_.filter(".Map6:first"),(J=new n(F,{map:{width:M.colorMap.width,height:M.colorMap.height},arrow:{image:M.clientPath+M.colorMap.arrow.file,width:M.colorMap.arrow.width,height:M.colorMap.arrow.height}})).bind(p),(ee=new n(H,{map:{width:M.colorBar.width,height:M.colorBar.height},arrow:{image:M.clientPath+M.colorBar.arrow.file,width:M.colorBar.arrow.width,height:M.colorBar.arrow.height}})).bind(g),te=new r(d,j.active,a.expandable&&a.bindToInput?a.input:null,a.alphaPrecision);var b=null!=s?s.hex:null,P=d.find(".Preview"),N=d.find(".Button");if(ne=P.find(".Active:first").css({backgroundColor:b&&"#"+b||"transparent"}),re=P.find(".Current:first").css({backgroundColor:b&&"#"+b||"transparent"}).bind("click",w),y.call(c,re,ar(100*j.current.val("a")/255,4)),ae=N.find(".Ok:first").bind("click",k),ie=N.find(".Cancel:first").bind("click",S),oe=N.find(".Grid:first"),setTimeout(function(){m.call(c,z,M.clientPath+"Maps.png"),m.call(c,q,M.clientPath+"Maps.png"),m.call(c,Y,M.clientPath+"map-opacity.png"),m.call(c,W,M.clientPath+"Bars.png"),m.call(c,X,M.clientPath+"Bars.png"),m.call(c,Q,M.clientPath+"Bars.png"),m.call(c,K,M.clientPath+"Bars.png"),m.call(c,Z,M.clientPath+"bar-opacity.png"),m.call(c,$,M.clientPath+"AlphaBar.png"),m.call(c,P.find("div:first"),M.clientPath+"preview-opacity.png")},0),d.find("td.Radio input").bind("click",x),j.quickList&&j.quickList.length>0){for(var L="",V=0;V<j.quickList.length;V++){"string"===t(j.quickList[V]).toString().toLowerCase()&&(j.quickList[V]=new i({hex:j.quickList[V]}));var R=j.quickList[V].val("a"),B=j.quickList[V].val("ahex");!a.alphaSupport&&B&&(B=B.substring(0,6)+"ff");var D=j.quickList[V].val("hex");B||(B="00000000"),L+='<span class="QuickColor" title="#'+B+'" style="background-color:'+(D&&"#"+D||"")+";"+(D?"":"background-image:url("+M.clientPath+"NoColor.png)")+(a.alphaSupport&&R&&R<255?";opacity:"+ar(R/255,4)+";filter:Alpha(opacity="+ar(R/2.55,4)+")":"")+'">&nbsp;</span>'}m.call(c,oe,M.clientPath+"bar-opacity.png"),oe.html(L),oe.find(".QuickColor").click(I)}h.call(c,u.color.mode),j.active.bind(f),"function"==typeof he&&j.active.bind(he),j.current.bind(A),a.expandable?(c.icon=o.parents(".Icon:first"),se=c.icon.find(".Color:first").css({backgroundColor:b&&"#"+b||"transparent"}),le=c.icon.find(".Alpha:first"),m.call(c,le,M.clientPath+"bar-opacity.png"),y.call(c,le,ar(100*(255-(null!=s?s.a:0))/255,4)),ce=c.icon.find(".Image:first").css({backgroundImage:"url('"+M.clientPath+M.picker.file+"')"}).bind("click",C),a.bindToInput&&a.updateInputColor&&a.input.css({backgroundColor:b&&"#"+b||"transparent",color:null==s||s.v>75?"#000000":"#ffffff"}),ue=d.find(".Move:first").bind("mousedown",G),j.active.bind(E)):T.call(c)}).call(c)},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 i({ahex:"#ffcc00ff"}),quickList:[new i({h:360,s:33,v:100}),new i({h:360,s:66,v:100}),new i({h:360,s:100,v:100}),new i({h:360,s:100,v:75}),new i({h:360,s:100,v:50}),new i({h:180,s:0,v:100}),new i({h:30,s:33,v:100}),new i({h:30,s:66,v:100}),new i({h:30,s:100,v:100}),new i({h:30,s:100,v:75}),new i({h:30,s:100,v:50}),new i({h:180,s:0,v:90}),new i({h:60,s:33,v:100}),new i({h:60,s:66,v:100}),new i({h:60,s:100,v:100}),new i({h:60,s:100,v:75}),new i({h:60,s:100,v:50}),new i({h:180,s:0,v:80}),new i({h:90,s:33,v:100}),new i({h:90,s:66,v:100}),new i({h:90,s:100,v:100}),new i({h:90,s:100,v:75}),new i({h:90,s:100,v:50}),new i({h:180,s:0,v:70}),new i({h:120,s:33,v:100}),new i({h:120,s:66,v:100}),new i({h:120,s:100,v:100}),new i({h:120,s:100,v:75}),new i({h:120,s:100,v:50}),new i({h:180,s:0,v:60}),new i({h:150,s:33,v:100}),new i({h:150,s:66,v:100}),new i({h:150,s:100,v:100}),new i({h:150,s:100,v:75}),new i({h:150,s:100,v:50}),new i({h:180,s:0,v:50}),new i({h:180,s:33,v:100}),new i({h:180,s:66,v:100}),new i({h:180,s:100,v:100}),new i({h:180,s:100,v:75}),new i({h:180,s:100,v:50}),new i({h:180,s:0,v:40}),new i({h:210,s:33,v:100}),new i({h:210,s:66,v:100}),new i({h:210,s:100,v:100}),new i({h:210,s:100,v:75}),new i({h:210,s:100,v:50}),new i({h:180,s:0,v:30}),new i({h:240,s:33,v:100}),new i({h:240,s:66,v:100}),new i({h:240,s:100,v:100}),new i({h:240,s:100,v:75}),new i({h:240,s:100,v:50}),new i({h:180,s:0,v:20}),new i({h:270,s:33,v:100}),new i({h:270,s:66,v:100}),new i({h:270,s:100,v:100}),new i({h:270,s:100,v:75}),new i({h:270,s:100,v:50}),new i({h:180,s:0,v:10}),new i({h:300,s:33,v:100}),new i({h:300,s:66,v:100}),new i({h:300,s:100,v:100}),new i({h:300,s:100,v:75}),new i({h:300,s:100,v:50}),new i({h:180,s:0,v:0}),new i({h:330,s:33,v:100}),new i({h:330,s:66,v:100}),new i({h:330,s:100,v:100}),new i({h:330,s:100,v:75}),new i({h:330,s:100,v:50}),new i]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:20,height:7}},picker:{file:"picker.gif",width:25,height:24}},localization:{text:{title:"Drag Markers To Pick A Color",newColor:"new",currentColor:"current",ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press &ldquo;OK&rdquo; To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To &ldquo;Hue&rdquo; Color Mode",textbox:"Enter A &ldquo;Hue&rdquo; Value (0-360&deg;)"},saturation:{radio:"Set To &ldquo;Saturation&rdquo; Color Mode",textbox:"Enter A &ldquo;Saturation&rdquo; Value (0-100%)"},value:{radio:"Set To &ldquo;Value&rdquo; Color Mode",textbox:"Enter A &ldquo;Value&rdquo; Value (0-100%)"},red:{radio:"Set To &ldquo;Red&rdquo; Color Mode",textbox:"Enter A &ldquo;Red&rdquo; Value (0-255)"},green:{radio:"Set To &ldquo;Green&rdquo; Color Mode",textbox:"Enter A &ldquo;Green&rdquo; Value (0-255)"},blue:{radio:"Set To &ldquo;Blue&rdquo; Color Mode",textbox:"Enter A &ldquo;Blue&rdquo; Value (0-255)"},alpha:{radio:"Set To &ldquo;Alpha&rdquo; Color Mode",textbox:"Enter A &ldquo;Alpha&rdquo; Value (0-100)"},hex:{textbox:"Enter A &ldquo;Hex&rdquo; Color Value (#000000-#ffffff)",alpha:"Enter A &ldquo;Alpha&rdquo; Value (#00-#ff)"}}}},e}].reduce(function(e,t){return t(e)},jQuery);fr.loadingStylesheets.includes("svg-editor.css")||fr.loadingStylesheets.push("svg-editor.css");fr.loadingStylesheets.some(function(e){return!Array.isArray(e)||"images/logo.png"!==e[0]})&&fr.loadingStylesheets.push(["images/logo.png",{favicon:!0}]),hr.tool_scale=1,hr.exportWindowCt=0,hr.langChanged=!1,hr.showSaveWarning=!1,hr.storagePromptClosed=!1;var pr=[],gr={lang:"",iconsize:"",bkgd_color:"#FFF",bkgd_url:"",img_save:"embed",save_notice_done:!1,export_notice_done:!1},vr=["ext-connector.js","ext-eyedropper.js","ext-grid.js","ext-imagelib.js","ext-markers.js","ext-overview_window.js","ext-panning.js","ext-polygon.js","ext-shapes.js","ext-star.js","ext-storage.js"],mr={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},_r=hr.uiStrings={},yr=void 0,br=void 0,xr=!1,wr=!1,Sr=!1,kr={},Cr={extensions:[],stylesheets:[],allowedOrigins:[]};function Ar(e,t){var n=!1!==yr.setSvgString(e);t=t||fr.noop,n?t(!0):fr.alert(_r.notification.errorLoadingSVG,function(){t(!1)})}function Er(e){var t=e.defaultLang,r=e.defaultName;return function(){var e=n(regeneratorRuntime.mark(function e(){var a,i=(a=n(regeneratorRuntime.mark(function e(t){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=Cr.extPath+"ext-locale/"+l+"/"+t+".js",e.abrupt("return",on(n,{global:"svgEditorExtensionLocale_"+l+"_"+t}));case 2:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)}),o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=o.name,l=void 0===s?r:s,c=o.lang,u=void 0===c?t:c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.abrupt("return",i(u));case 4:return e.prev=4,e.t0=e.catch(0),e.abrupt("return",i("en"));case 7:case"end":return e.stop()}},e,this,[[0,4]])}));return function(){return e.apply(this,arguments)}}()}fr.pref=function(e,t){return t?(kr[e]=t,void(hr.curPrefs=kr)):e in kr?kr[e]:gr[e]},hr.putLocale=dr,hr.readLang=ur,hr.setStrings=lr,hr.loadContentAndPrefs=function(){if(Cr.forceStorage||!Cr.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/)){if(hr.storage&&(Cr.forceStorage||!Cr.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)store=prefsAndContent/))){var e="svgedit-"+Cr.canvasName,t=hr.storage.getItem(e);t&&hr.loadFromString(t)}for(var n in gr)if(gr.hasOwnProperty(n)){var r="svg-edit-"+n;if(hr.storage){var a=hr.storage.getItem(r);a&&(gr[n]=String(a))}else if(window.widget)gr[n]=window.widget.preferenceForKey(r);else{var i=document.cookie.match(new RegExp("(?:^|;\\s*)"+(o=encodeURIComponent(r),String(o).replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&"))+"=([^;]+)"));gr[n]=i?decodeURIComponent(i[1]):""}}var o}},hr.setConfig=function(e,n){function r(e,n,r){e[n]&&"object"===t(e[n])?fr.extend(!0,e[n],r):e[n]=r}n=n||{},fr.each(e,function(a,i){if(e.hasOwnProperty(a))if(gr.hasOwnProperty(a)){if(!1===n.overwrite&&(Cr.preventAllURLConfig||kr.hasOwnProperty(a)))return;!0===n.allowInitialUserOverride?gr[a]=i:fr.pref(a,i)}else if(["extensions","stylesheets","allowedOrigins"].includes(a)){if(!1===n.overwrite&&(Cr.preventAllURLConfig||["allowedOrigins","stylesheets"].includes(a)||"extensions"===a&&Cr.lockExtensions))return;Cr[a]=Cr[a].concat(i)}else if(mr.hasOwnProperty(a)){if(!1===n.overwrite&&(Cr.preventAllURLConfig||Cr.hasOwnProperty(a)))return;if(Cr.hasOwnProperty(a)){if(!1===n.overwrite)return;r(Cr,a,i)}else!0===n.allowInitialUserOverride?r(mr,a,i):mr[a]&&"object"===t(mr[a])?(Cr[a]={},fr.extend(!0,Cr[a],i)):Cr[a]=i}}),hr.curConfig=Cr},hr.setCustomHandlers=function(e){hr.ready(function(){e.open&&(fr('#tool_open > input[type="file"]').remove(),fr("#tool_open").show(),yr.open=e.open),e.save&&(hr.showSaveWarning=!1,yr.bind("saved",e.save)),e.exportImage&&(wr=e.exportImage,yr.bind("exported",wr)),e.exportPDF&&(Sr=e.exportPDF,yr.bind("exportedPDF",Sr))})},hr.randomizeIds=function(e){return yr.randomizeIds(e)},hr.init=function(){!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)||Object.assign(mr,{langPath:"../dist/locale/",extPath:"../dist/extensions/",canvgPath:"../dist/",jspdfPath:"../dist/"});try{"localStorage"in window&&(hr.storage=localStorage)}catch(e){}var e=[];function r(){(Cr=fr.extend(!0,{},mr,Cr)).noDefaultExtensions||(Cr.extensions=Cr.extensions.concat(vr)),["extensions","stylesheets","allowedOrigins"].forEach(function(e){Cr[e]=fr.grep(Cr[e],function(t,n){return n===Cr[e].indexOf(t)})}),hr.curConfig=Cr}fr("#lang_select option").each(function(){e.push(this.value)}),function(){var e=void 0,t=void 0;if(br=fr.deparam.querystring(!0),fr.isEmptyObject(br))r(),hr.loadContentAndPrefs();else{if(br.dimensions&&(br.dimensions=br.dimensions.split(",")),br.bkgd_color&&(br.bkgd_color="#"+br.bkgd_color),br.extensions&&(br.extensions=br.extensions.match(/[:\/\\]/)?"":br.extensions.split(",")),["extPath","imgPath","extIconsPath","canvgPath","langPath","jGraduatePath","jspdfPath"].forEach(function(e){br[e]&&delete br[e]}),hr.setConfig(br,{overwrite:!1}),r(),!Cr.preventURLContentLoading){if(e=br.source,t=fr.param.querystring(),e||t.includes("source=data:")&&(e=t.match(/source=(data:[^&]*)/)[1]),e)return void(e.startsWith("data:")?hr.loadFromDataURI(e):hr.loadFromString(e));if(br.url)return void hr.loadFromURL(br.url)}br.noStorageOnLoad&&!Cr.forceStorage||hr.loadContentAndPrefs()}kr=fr.extend(!0,{},gr,kr),hr.curPrefs=kr}();var a,i=hr.setIcon=function(e,t,n){var r="string"==typeof t?fr.getSvgIcon(t,!0):t.clone();r?fr(e).empty().append(r):console.log("NOTE: Icon image missing: "+t)},o=(a=n(regeneratorRuntime.mark(function t(){var r,a,i,o=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,hr.putLocale(null,e,Cr);case 2:return r=t.sent,a=r.langParam,i=r.langData,_n(a,i),t.prev=6,t.next=9,Promise.all(Cr.extensions.map(function(){var e=n(regeneratorRuntime.mark(function e(t){var n,r,i,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=Cr.extPath+t,e.prev=4,e.next=7,on(r,{global:"svgEditorExtension_"+n[1].replace(/-/g,"_")});case 7:return i=e.sent,s=i.name,l=void 0===s?n[1]:s,c=i.init,u=Er({defaultLang:a,defaultName:l}),e.abrupt("return",hr.addExtension(l,c&&c.bind(hr),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,o,[[4,13]])}));return function(t){return e.apply(this,arguments)}}()));case 9:yr.bind("extensions_added",function(e,t){Gr=!0,hn.setAll(),fr(".flyout_arrow_horiz:empty").each(function(){fr(this).append(fr.getSvgIcon("arrow_right",!0).width(5).height(5))}),Pr.forEach(function(e){yr.call("message",e)})}),yr.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 a.apply(this,arguments)}),s={tool_scale:hr.tool_scale},d=function(){fr(".tools_flyout").each(function(){var e=fr("#"+this.id+"_show"),t=e.offset(),n=t.left,r=t.top,a=e.outerWidth();fr(this).css({left:(n+a)*hr.tool_scale,top:r})})},h=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":""}(),f=hr.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=fr(t),r=1;if("number"==typeof e)r=e;else{r={s:.75,m:1,l:1.25,xl:1.5}[e]}s.tool_scale=hr.tool_scale=r,d();var a=n.parents(":hidden");a.css("visibility","hidden").show(),function(e,t){var n=["top","left","bottom","right"];e.each(function(){for(var e=fr(this),r=e.outerWidth()*(t-1),a=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+=r:"bottom"===o&&(l+=a),e.css("margin-"+o,l)}})}(n,r),a.css("visibility","visible").hide(),fr.pref("iconsize",e),fr("#iconsize").val(e);var i={"#tools_top":{left:50+fr("#main_button").width(),height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}},o=fr("#tool_size_rules");if(o.length?o.empty():o=fr('<style id="tool_size_rules"></style>').appendTo("head"),"m"!==e){var l="";fr.each(i,function(t,n){t="#svg_editor "+t.replace(/,/g,", #svg_editor"),l+=t+"{",fr.each(n,function(t,n){var a=void 0;"number"==typeof n?a=n*r+"px":(n[e]||n.all)&&(a=n[e]||n.all),l+=t+":"+a+";"}),l+="}"});var c="-"+h.toLowerCase()+"-";l+=t+"{"+c+"transform: scale("+r+");} #svg_editor div.toolset .toolset {"+c+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+c+"transform: scale("+1/r+");}",o.text(l)}d()};fr.svgIcons(Cr.imgPath+"svg_edit_icons.svg",{w:24,h:24,id_match:!1,no_img:!L(),fallback_path:Cr.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",square:"square.png",rect:"rect.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png",fh_ellipse:"freehand-circle.png",pencil:"fhpath.png",pen:"line.png",text:"text.png",path:"path.png",add_subpath:"add_subpath.png",close_path:"closepath.png",open_path:"openpath.png",image:"image.png",zoom:"zoom.png",arrow_right:"flyouth.png",arrow_right_big:"arrow_right_big.png",arrow_down:"dropdown.gif",fill:"fill.png",stroke:"stroke.png",opacity:"opacity.png",new_image:"clear.png",save:"save.png",export:"export.png",open:"open.png",import:"import.png",docprops:"document-properties.png",source:"source.png",wireframe:"wireframe.png",undo:"undo.png",redo:"redo.png",clone:"clone.png",delete:"delete.png",go_up:"go-up.png",go_down:"go-down.png",context_menu:"context_menu.png",move_bottom:"move_bottom.png",move_top:"move_top.png",to_path:"to_path.png",link_controls:"link_controls.png",reorient:"reorient.png",group_elements:"shape_group_elements.png",ungroup:"shape_ungroup.png",unlink_use:"unlink_use.png",width:"width.png",height:"height.png",c_radius:"c_radius.png",angle:"angle.png",blur:"blur.png",fontsize:"fontsize.png",align:"align.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",linecap_butt:"linecap_butt.png",linecap_square:"linecap_square.png",linecap_round:"linecap_round.png",linejoin_miter:"linejoin_miter.png",linejoin_bevel:"linejoin_bevel.png",linejoin_round:"linejoin_round.png",eye:"eye.png",no_color:"no_color.png",ok:"save.png",cancel:"cancel.png",warning:"warning.png",node_delete:"node_delete.png",node_clone:"node_clone.png",globe_link:"globe_link.png"},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){fr(".toolbar_button button > svg, .toolbar_button button > img").each(function(){fr(this).parent().prepend(this)});var t=fr("#tools_left"),n=void 0;t.length&&(n=t.offset().top+t.outerHeight());var r=fr.pref("iconsize");function a(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}}hr.setIconSize(r||(fr(window).height()<n?"s":"m")),fr(".tools_flyout").each(function(){var e=fr("#"+this.id+"_show"),t=e.attr("data-curopt");if(!e.children("svg, img").length){var n=fr(t).children().clone();n.length&&(n[0].removeAttribute("style"),e.append(n))}});var i=fr.loadingStylesheets.sort(function(e,t){var n=a(e),r=a(t);return n===r?0:n>r});if(Cr.stylesheets.length){var o,s=(i=[].concat(c(new Set(Cr.stylesheets)))).indexOf("@default");if(s>-1)(o=i).splice.apply(o,[s,1].concat(c(fr.loadingStylesheets)))}(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.before,r=t.after,a=t.favicon,i=t.canvas,o=t.image,s=void 0===o||o,c=t.acceptErrors;return e=Array.isArray(e)?e:[e],Promise.all(e.map(function(e){var t={};if(Array.isArray(e)){var o=l(e,2);e=o[0];var u=o[1];t=void 0===u?{}:u}var d=t.favicon,h=void 0===d?a:d,f=t,p=f.before,g=void 0===p?n:p,v=f.after,m=void 0===v?r:v,_=f.canvas,y=void 0===_?i:_,b=f.image,x=void 0===b?s:b;function w(){g?g.before(S):m?m.after(S):document.head.appendChild(S)}var S=document.createElement("link");return new Promise(function(n,r){var a=r;if(c&&(a="function"==typeof c?function(a){c({error:a,stylesheetURL:e,options:t,resolve:n,reject:r})}:n),e.endsWith(".css")?h=!1:e.endsWith(".ico")&&(h=!0),h){if(S.rel="shortcut icon",S.type="image/x-icon",!1===x)return S.href=e,w(),void n(S);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){r(e)}),s.addEventListener("load",function(){o.drawImage(s,0,0),S.href=y?i.toDataURL("image/x-icon"):e,w(),n(S)}),void(s.src=e)}S.rel="stylesheet",S.type="text/css",S.href=e,w(),S.addEventListener("error",function(e){a(e)}),S.addEventListener("load",function(){n(S)})})}))})(i,{acceptErrors:function(e){var t=e.stylesheetURL,n=e.reject,r=e.resolve;fr.loadingStylesheets.includes(t)?n(new Error("Missing expected stylesheet: "+t)):r()}}).then(function(){fr("#svg_container")[0].style.visibility="visible",hr.runCallbacks()})}}),hr.canvas=yr=new nr(document.getElementById("svgcanvas"),Cr);var p=V()?"meta+":"ctrl+",g=yr.pathActions,v=yr.undoMgr,m=fr("#workarea"),_=fr("#cmenu_canvas"),y={fill:null,stroke:null},b=void 0,x=void 0,w=null,S=Cr.imgPath+"logo.png",k="crosshair",C="crosshair",A="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(){fr("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");var e=fr("#dialog_box"),n=fr("#dialog_buttons"),r=fr("#dialog_content"),a=function(a,i,o,s,l,c,u){r.html("<p>"+i.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt","prompt"===a),n.empty();var d=fr('<input type="button" value="'+_r.common.ok+'">').appendTo(n);"alert"!==a&&fr('<input type="button" value="'+_r.common.cancel+'">').appendTo(n).click(function(){e.hide(),o&&o(!1)});var h=void 0,f=void 0;if("prompt"===a)(h=fr('<input type="text">').prependTo(n)).val(s||""),h.bind("keydown","return",function(){d.click()});else if("select"===a){var p=fr('<div style="text-align:center;">');if(h=fr("<select>").appendTo(p),u){var g=fr("<label>").text(u.label);(f=fr('<input type="checkbox">').appendTo(g)).val(u.value),u.tooltip&&g.attr("title",u.tooltip),f.prop("checked",!!u.checked),p.append(fr("<div>").append(g))}fr.each(l||[],function(e,n){"object"===(void 0===n?"undefined":t(n))?h.append(fr("<option>").val(n.value).html(n.text)):h.append(fr("<option>").html(n))}),r.append(p),s&&h.val(s),c&&h.bind("change","return",c),h.bind("keydown","return",function(){d.click()})}else"process"===a&&d.hide();e.show(),d.click(function(){e.hide();var t="prompt"!==a&&"select"!==a||h.val();o&&(f?o(t,f.prop("checked")):o(t))}).focus(),"prompt"!==a&&"select"!==a||h.focus()};fr.alert=function(e,t){a("alert",e,t)},fr.confirm=function(e,t){a("confirm",e,t)},fr.process_cancel=function(e,t){a("process",e,t)},fr.prompt=function(e,t,n){a("prompt",e,n,t)},fr.select=function(e,t,n,r,i,o){a("select",e,n,i,t,r,o)}}();for(var E=function(){var e=fr(".tool_button_current");e.length&&"tool_select"!==e[0].id&&(e.removeClass("tool_button_current").addClass("tool_button"),fr("#tool_select").addClass("tool_button_current").removeClass("tool_button"),fr("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}")),yr.setMode("select"),m.css("cursor","auto")},G=fr("title:first").text(),P=[],N=.1;N<1e5;N*=10)P.push(N),P.push(2*N),P.push(5*N);var I=function(e){var t=void 0,n=[],r=yr.getCurrentDrawing().getNumLayers();for(t=0;t<r;t++)n[t]=yr.getCurrentDrawing().getLayerName(t);if(e)for(t=0;t<r;++t)n[t]!==e&&yr.getCurrentDrawing().setLayerOpacity(n[t],.5);else for(t=0;t<r;++t)yr.getCurrentDrawing().setLayerOpacity(n[t],1)},T=function(){yr.clearSelection();for(var e=fr("#layerlist tbody").empty(),t=fr("#selLayerNames").empty(),n=yr.getCurrentDrawing(),r=n.getCurrentLayerName(),a=fr.getSvgIcon("eye"),i=yr.getCurrentDrawing().getNumLayers();i--;){var o=n.getLayerName(i),s=fr('<tr class="layer">').toggleClass("layersel",o===r),l=fr('<td class="layervis">').toggleClass("layerinvis",!n.getLayerVisibility(o)),c=fr('<td class="layername">'+o+"</td>");e.append(s.append(l,c)),t.append('<option value="'+o+'">'+o+"</option>")}if(void 0!==a){var u=a.clone();fr("td.layervis",e).append(u),fr.resizeSvgIcons({"td.layervis .svg_icon":14})}fr("#layerlist td.layername").mouseup(function(e){fr("#layerlist tr.layer").removeClass("layersel"),fr(this.parentNode).addClass("layersel"),yr.setCurrentLayer(this.textContent),e.preventDefault()}).mouseover(function(){I(this.textContent)}).mouseout(function(){I()}),fr("#layerlist td.layervis").click(function(){var e=fr(this.parentNode).prevAll().length,t=fr("#layerlist tr.layer:eq("+e+") td.layername").text(),n=fr(this).hasClass("layerinvis");yr.setLayerVisibility(t,n),fr(this).toggleClass("layerinvis")});for(var d=5-fr("#layerlist tr.layer").size();d-- >0;)e.append('<tr><td style="color:white">_</td><td/></tr>')},B=!1,D="",U=function(e,t){B||(B=!0,D=yr.getSvgString(),fr("#save_output_btns").toggle(!!t),fr("#tool_source_back").toggle(!t),fr("#svg_source_textarea").val(D),fr("#svg_source_editor").fadeIn(),fr("#svg_source_textarea").focus())},F=null,H=!1,z=function(){window.opera&&fr("<p/>").hide().appendTo("body").remove()};function q(e,t){var n=e.id,r=n.split("_"),a=r[0],o=r[1];t&&yr.setStrokeAttr("stroke-"+a,o),z(),i("#cur_"+a,n,20),fr(e).addClass("current").siblings().removeClass("current")}var Y=hr.toolButtonClick=function(e,t){if(fr(e).hasClass("disabled"))return!1;if(fr(e).parent().hasClass("tools_flyout"))return!0;return t||fr(".tools_flyout").fadeOut("normal"),fr("#styleoverrides").text(""),m.css("cursor","auto"),fr(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),fr(e).addClass("tool_button_current").removeClass("tool_button"),!0},W=hr.clickSelect=function(){Y("#tool_select")&&(yr.setMode("select"),fr("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}"))},X=hr.setImageURL=function(e){e||(e=S),yr.setImageURL(e),fr("#image_url").val(e),e.startsWith("data:")?(fr("#image_url").hide(),fr("#change_image_url").show()):(yr.embedImage(e,function(t){fr("#url_notice").toggle(!t),S=e}),fr("#image_url").show(),fr("#change_image_url").hide())};function Q(e,t){fr.pref("bkgd_color",e),fr.pref("bkgd_url",t),yr.setBackground(e,t)}function K(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).cancelDeletes,t=void 0!==e&&e,n=yr.getHref(F);n=n.startsWith("data:")?"":n,fr.prompt(_r.notification.enterNewImgURL,n,function(e){e?X(e):t&&yr.deleteSelectedElements()})}function Z(e,t){t||(t=yr.getZoom()),e||(e=fr("#svgcanvas"));var n=void 0,r=void 0,a=yr.getContentElem(),i=J()[Cr.baseUnit];for(n=0;n<2;n++){var o=0===n,s=o?"x":"y",l=o?"width":"height",c=Number(a.getAttribute(s)),u=fr("#ruler_"+s+" canvas:first"),d=u.clone();u.replaceWith(d);var h=d[0],f=e[l](),p=f;h.parentNode.style[l]=p+"px";var g=h.getContext("2d"),v=void 0,m=void 0,_=void 0;if(g.fillStyle="rgb(200,0,0)",g.fillRect(0,0,h.width,h.height),d.siblings().remove(),f>=3e4){_=parseInt(f/3e4,10)+1,(v=[])[0]=g;var y=void 0;for(r=1;r<_;r++)h[l]=3e4,y=h.cloneNode(!0),h.parentNode.append(y),v[r]=y.getContext("2d");y[l]=f%3e4,f=3e4}h[l]=f;var b=i*t,x=50/b,w=1;for(r=0;r<P.length&&(w=m=P[r],!(x<=m));r++);var S=w*b;g.font="9px sans-serif";for(var k=c/b%w*b,C=k-S,A=0;k<p;){C+=S;var E=Math.round(k)+.5;o?(g.moveTo(E,15),g.lineTo(E,0)):(g.moveTo(15,E),g.lineTo(0,E)),m=(C-c)/b;var G=void 0;if(w>=1)G=Math.round(m);else{var N=String(w).split(".")[1].length;G=m.toFixed(N)}if(0!==G&&1e3!==G&&G%1e3==0&&(G=G/1e3+"K"),o)g.fillText(G,k+2,8);else{var I=String(G).split("");for(r=0;r<I.length;r++)g.fillText(I[r],1,k+9+9*r)}var T=S/10;for(r=1;r<10;r++){var L=Math.round(k+T*r)+.5;if(v&&L>f){if(A++,g.stroke(),A>=_){r=10,k=p;continue}g=v[A],k-=3e4,L=Math.round(k+T*r)+.5}var M=r%2?12:10;o?(g.moveTo(L,15),g.lineTo(L,M)):(g.moveTo(15,L),g.lineTo(M,L))}k+=S}g.strokeStyle="#000",g.stroke()}}var $=hr.updateCanvas=function(e,t){var n=yr.getZoom(),r=m,a=fr("#svgcanvas"),i=m.width(),o=m.height(),s=i,l=o,c=r[0].scrollLeft+s/2,u=r[0].scrollTop+l/2,d=Cr.canvas_expansion;i=Math.max(s,yr.contentW*n*d),o=Math.max(l,yr.contentH*n*d),i===s&&o===l?m.css("overflow","hidden"):m.css("overflow","scroll");var h=a.height()/2,f=a.width()/2;a.width(i).height(o);var p=o/2,g=i/2,v=yr.updateCanvas(i,o),_=g/f,y=i/2-s/2,b=o/2-l/2;t?(t.x+=v.x,t.y+=v.y):t={x:g+(c-f)*_,y:p+(u-h)*_};e?yr.contentW>r.width()?(m[0].scrollLeft=v.x-10,m[0].scrollTop=v.y-10):(r[0].scrollLeft=y,r[0].scrollTop=b):(r[0].scrollLeft=t.x-s/2,r[0].scrollTop=t.y-l/2),Cr.showRulers&&(Z(a,n),m.scroll()),!0===br.storagePrompt||hr.storagePromptClosed||fr("#dialog_box").hide()},ee=function(){var e=void 0,t=void 0,n="none"===yr.getColor("fill"),r="none"===yr.getColor("stroke"),a=["#tool_fhpath","#tool_line"],i=["#tools_rect .tool_button","#tools_ellipse .tool_button","#tool_text","#tool_path"];if(r)for(e in a)fr(t=a[e]).hasClass("tool_button_current")&&W(),fr(t).addClass("disabled");else for(e in a)fr(t=a[e]).removeClass("disabled");if(r&&n)for(e in i)fr(t=i[e]).hasClass("tool_button_current")&&W(),fr(t).addClass("disabled");else for(e in i)fr(t=i[e]).removeClass("disabled");yr.runExtensions("toolButtonStateUpdate",{nofill:n,nostroke:r}),fr(".tools_flyout").each(function(){var e=fr("#"+this.id+"_show"),t=!1;fr(this).children().each(function(){fr(this).hasClass("disabled")||(t=!0)}),e.toggleClass("disabled",!t)}),z()},ne=function(){var e=F;null==e||e.parentNode||(e=null);var t=yr.getCurrentDrawing().getCurrentLayerName(),n=yr.getMode(),r="px"!==Cr.baseUnit?Cr.baseUnit:null,a="pathedit"===n,o=fr("#cmenu_canvas li");if(fr("#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=yr.getRotationAngle(e);fr("#angle").val(l);var c=yr.getBlur(e);if(fr("#blur").val(c),fr("#blur_slider").slider("option","value",c),yr.addedNew&&"image"===s&&"image"===yr.getMode()&&(yr.getHref(e).startsWith("data:")||K({cancelDeletes:!0})),a||"pathedit"===n){var u=g.getNodePoint();if(fr("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"),fr("#tool_node_delete").toggleClass("disabled",!g.canDeleteNodes),i("#tool_openclose_path",g.closed_subpath?"open_path":"close_path"),u){var d=fr("#seg_type");r&&(u.x=te(u.x),u.y=te(u.y)),fr("#path_node_x").val(u.x),fr("#path_node_y").val(u.y),u.type?d.val(u.type).removeAttr("disabled"):d.val(4).attr("disabled","disabled")}return}if(fr("#selected_panel").show(),["line","circle","ellipse"].includes(s))fr("#xy_panel").hide();else{var h=void 0,f=void 0;if(["g","polyline","path"].includes(s)){var p=yr.getStrokedBBox([e]);p&&(h=p.x,f=p.y)}else h=e.getAttribute("x"),f=e.getAttribute("y");r&&(h=te(h),f=te(f)),fr("#selected_x").val(h||0),fr("#selected_y").val(f||0),fr("#xy_panel").show()}var m=!["image","text","path","g","use"].includes(s);fr("#tool_topath").toggle(m),fr("#tool_reorient").toggle("path"===s),fr("#tool_reorient").toggleClass("disabled",0===l);var y={g:[],a:[],rect:["rx","width","height"],image:["width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:[],use:[]},b=e.tagName,x=null;if("a"===b&&(x=yr.getHref(e),fr("#g_panel").show()),"a"===e.parentNode.tagName&&(fr(e).siblings().length||(fr("#a_panel").show(),x=yr.getHref(e.parentNode))),fr("#tool_make_link, #tool_make_link").toggle(!x),x&&fr("#link_url").val(x),y[b]){var w=y[b];if(fr("#"+b+"_panel").show(),fr.each(w,function(t,n){var r=e.getAttribute(n);if("px"!==Cr.baseUnit&&e[n]){var a=e[n].baseVal.value;r=te(a)}fr("#"+b+"_"+n).val(r||0)}),"text"===b)fr("#text_panel").css("display","inline"),fr("#tool_font_size").css("display","inline"),yr.getItalic()?fr("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):fr("#tool_italic").removeClass("push_button_pressed").addClass("tool_button"),yr.getBold()?fr("#tool_bold").addClass("push_button_pressed").removeClass("tool_button"):fr("#tool_bold").removeClass("push_button_pressed").addClass("tool_button"),fr("#font_family").val(e.getAttribute("font-family")),fr("#font_size").val(e.getAttribute("font-size")),fr("#text").val(e.textContent),yr.addedNew&&setTimeout(function(){fr("#text").focus().select()},100);else if("image"===b&&"image"===yr.getMode())X(yr.getHref(e));else if("g"===b||"use"===b){fr("#container_panel").show();var S=yr.getTitle(),k=fr("#g_title")[0];k.value=S,function(e){var t=Math.min(Math.max(12+6*e.value.length,50),300);fr(e).width(t)}(k),fr("#g_title").prop("disabled","use"===b)}}o[("g"===b?"en":"dis")+"ableContextMenuItems"]("#ungroup"),o[("g"!==b&&H?"en":"dis")+"ableContextMenuItems"]("#group")}else H?(fr("#multiselected_panel").show(),o.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")):o.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");fr("#tool_undo").toggleClass("disabled",0===v.getUndoStackSize()),fr("#tool_redo").toggleClass("disabled",0===v.getRedoStackSize()),yr.addedNew=!1,e&&!a||H?(fr("#selLayerNames").removeAttr("disabled").val(t),_.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")):fr("#selLayerNames").attr("disabled","disabled")},re=function(){if(!Xt){var e="#workarea.wireframe #svgcontent * { stroke-width: "+1/yr.getZoom()+"px; }";fr("#wireframe_rules").text(m.hasClass("wireframe")?e:"")}},ie="",oe=function(e){e=e||yr.getDocumentTitle();var t=G+(e?": "+e:"");fr("title:first").text(t)};function se(e){return e&&"g"===e.tagName&&dn.CLASS_REGEX.test(e.getAttribute("class"))}var le=function(){re()},ce=yr.zoomChanged=function(e,t,n){var r=m,a=yr.setBBoxZoom(t,r.width()-15,r.height()-15);if(a){var i=a.zoom,o=a.bbox;i<.001?ue({value:.1}):(fr("#zoom").val((100*i).toFixed(1)),n?$():$(!1,{x:o.x*i+o.width*i/2,y:o.y*i+o.height*i/2}),"zoom"===yr.getMode()&&o.width&&E(),le())}},ue=function(e){var t=e.value/100;if(t<.001)e.value=.1;else{var n=yr.getZoom(),r=m;ce(window,{width:0,height:0,x:(r[0].scrollLeft+r.width()/2)/n,y:(r[0].scrollTop+r.height()/2)/n,zoom:t},!0)}};fr("#cur_context_panel").delegate("a","click",function(){var e=fr(this);return e.attr("data-root")?yr.leaveContext():yr.setContext(e.text()),yr.clearSelection(),!1});var de=function(){y.fill.prep(),y.stroke.prep()},he={},fe=function(){fr(".tools_flyout").each(function(){var e=fr("#"+this.id+"_show");if(!e.data("isLibrary")){var t=fr(this).children().map(function(){return this.title}).get();e[0].title=t.join(" / ")}})},pe={},ge=function(e){fr.each(e,function(t,n){var r;pe[t]||(pe[t]=[]),(r=pe[t]).push.apply(r,c(n));var a=fr(t).children().not(".tool_button_evt_handled"),i=t+"_show",o=fr(i),s=!1;a.addClass("tool_button tool_button_evt_handled").unbind("click mousedown mouseup").each(function(){var t="#"+this.getAttribute("id"),r=Object.entries(n).find(function(e){var n=l(e,2);n[0];return n[1].sel===t}),a=l(r,2),c=a[0],u=a[1];he[u.sel]=u.fn,u.isDefault&&(s=c);var d=function(t){var n=u;if("keydown"===t.type){var r=fr(n.parent+"_show").hasClass("tool_button_current"),a=fr(n.parent+"_show").attr("data-curopt");Object.entries(e[u.parent]).some(function(i){var o=l(i,2),s=o[0],c=o[1];if(c.sel===a)return t.shiftKey&&r?(s=parseInt(s,10),n=pe[u.parent][s+1]||e[u.parent][0]):n=c,!0})}if(fr(this).hasClass("disabled"))return!1;Y(i)&&n.fn();var s=void 0;(s=n.icon?fr.getSvgIcon(n.icon,!0):fr(n.sel).children().eq(0).clone())[0].setAttribute("width",o.width()),s[0].setAttribute("height",o.height()),o.children(":not(.flyout_arrow_horiz)").remove(),o.append(s).attr("data-curopt",n.sel)};fr(this).mouseup(d),u.key&&fr(document).bind("keydown",u.key[0]+" shift+"+u.key[0],d)}),s?o.attr("data-curopt",n[s].sel):o.attr("data-curopt")||o.attr("data-curopt",n[0].sel);var u=void 0,d=fr(i).position();o.mousedown(function(e){if(o.hasClass("disabled"))return!1;var n=fr(t),r=d.left+34,a=-1*n.width(),i=n.data("shown_popop")?200:0;u=setTimeout(function(){o.data("isLibrary")?n.css("left",r).show():n.css("left",a).show().animate({left:r},150),n.data("shown_popop",!0)},i),e.preventDefault()}).mouseup(function(e){clearTimeout(u);var t=fr(this).attr("data-curopt");o.data("isLibrary")&&fr(i.replace("_show","")).is(":visible")?Y(i,!0):Y(i)&&he[t]&&he[t]()})}),fe(),d()},ve=function(e,t){return fr("<div>",{class:"tools_flyout",id:e}).appendTo("#svg_editor").append(t)},me=function(e,t,n,r){var a=fr(e),o=r.dropUp;t=fr(t),o&&fr(e).addClass("dropup"),t.find("li").bind("mouseup",function(){r.seticon&&(i("#cur_"+a[0].id,fr(this).children()),fr(this).addClass("current").siblings().removeClass("current")),n.apply(this,arguments)});var s=!1;fr(window).mouseup(function(e){s||(a.removeClass("down"),t.hide(),t.css({top:0,left:0})),s=!1}),a.bind("mousedown",function(){var e=a.offset();o?(e.top-=t.height(),e.left+=8):e.top+=a.height(),t.offset(e),a.hasClass("down")?(t.hide(),t.css({top:0,left:0})):(t.show(),s=!0),a.toggleClass("down")}).hover(function(){s=!0}).mouseout(function(){s=!1}),r.multiclick&&t.mousedown(function(){s=!0})},_e=[];yr.bind("selected",function(e,t){var n=yr.getMode();"select"===n&&E();var r="pathedit"===n;F=1===t.length||null==t[1]?t[0]:null,H=t.length>=2&&null!=t[1],null!=F&&(r||function(){var e=void 0,t=void 0;if(null!=F)switch(F.tagName){case"use":case"image":case"foreignObject":break;case"g":case"a":var n=F.getElementsByTagName("*"),r=null;for(e=0,t=n.length;e<t;e++){var a=n[e].getAttribute("stroke-width");0===e?r=a:r!==a&&(r=null)}fr("#stroke_width").val(null===r?"":r),y.fill.update(!0),y.stroke.update(!0);break;default:y.fill.update(!0),y.stroke.update(!0),fr("#stroke_width").val(F.getAttribute("stroke-width")||1),fr("#stroke_style").val(F.getAttribute("stroke-dasharray")||"none");var i=F.getAttribute("stroke-linejoin")||"miter";fr("#linejoin_"+i).length&&q(fr("#linejoin_"+i)[0]),i=F.getAttribute("stroke-linecap")||"butt",fr("#linecap_"+i).length&&q(fr("#linecap_"+i)[0])}if(null!=F){var o=100*(F.getAttribute("opacity")||1);fr("#group_opacity").val(o),fr("#opac_slider").slider("option","value",o),fr("#elem_id").val(F.id),fr("#elem_class").val(F.getAttribute("class"))}ee()}()),function(e,t){fr("#path_node_panel").toggle(e),fr("#tools_bottom_2,#tools_bottom_3").toggle(!e),e?(fr(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),fr("#tool_select").addClass("tool_button_current").removeClass("tool_button"),i("#tool_select","select_node"),H=!1,t.length&&(F=t[0])):setTimeout(function(){i("#tool_select","select")},1e3)}(r,t),ne(),yr.runExtensions("selectedChanged",{elems:t,selectedElement:F,multiselected:H})}),yr.bind("transition",function(e,t){var n=yr.getMode(),r=t[0];if(r){if(!(H=t.length>=2&&null!=t[1]))switch(n){case"rotate":var a=yr.getRotationAngle(r);fr("#angle").val(a),fr("#tool_reorient").toggleClass("disabled",0===a)}yr.runExtensions("elementTransition",{elems:t})}}),yr.bind("changed",function(e,t){var n=yr.getMode();"select"===n&&E();for(var r=0;r<t.length;++r){var a=t[r],i=a&&"svg"===a.tagName;i||se(a)?(T(),i&&$()):a&&F&&null==F.parentNode&&(F=a)}hr.showSaveWarning=!0,ne(),F&&"select"===n&&(y.fill.update(),y.stroke.update()),yr.runExtensions("elementChanged",{elems:t})}),yr.bind("saved",function(e,t){if(hr.showSaveWarning=!1,t='<?xml version="1.0"?>\n'+t,O())U(0,!0);else{var n=document.createElement("a");n.href="data:image/svg+xml;base64,"+bt(t),n.download="icon.svg",n.click();var r=fr.pref("save_notice_done");if("all"!==r){var a=_r.notification.saveFromBrowser.replace("%s","SVG");M()?t.includes("<defs")?(a+="\n\n"+_r.notification.defsFailOnSave,fr.pref("save_notice_done","all"),r="all"):fr.pref("save_notice_done","part"):fr.pref("save_notice_done","all"),"part"!==r&&alert(a)}}}),yr.bind("exported",function(e,t){var n=t.issues,r=t.exportWindowName;if(r&&(w=window.open(At||"",r)),w&&!w.closed){if(w.location.href=t.bloburl||t.datauri,"all"!==fr.pref("export_notice_done")){var a=_r.notification.saveFromBrowser.replace("%s",t.type);n.length&&(a+="\n\n"+_r.notification.noteTheseIssues+"\n • "+n.join("\n • ")),fr.pref("export_notice_done","all"),w.alert(a)}}else fr.alert(_r.notification.popupWindowBlocked)}),yr.bind("exportedPDF",function(e,t){if(t.output){var n=t.exportWindowName;n&&(w=window.open("",n)),w&&!w.closed?w.location.href=t.output:fr.alert(_r.notification.popupWindowBlocked)}}),yr.bind("zoomed",ce),yr.bind("zoomDone",le),yr.bind("updateCanvas",function(e,t){var n=t.center,r=t.newCtr;$(n,r)}),yr.bind("contextset",function(e,t){var n="";if(t){var r="";n='<a href="#" data-root="y">'+yr.getCurrentDrawing().getCurrentLayerName()+"</a>",fr(t).parentsUntil("#svgcontent > g").andSelf().each(function(){this.id&&(r+=" > "+this.id,n+=this!==t?' > <a href="#">'+this.id+"</a>":" > "+this.id)}),ie=r}else ie=null;fr("#cur_context_panel").toggle(!!t).html(n),oe()}),yr.bind("extension_added",function(e,t){if(t){var n=!1,r=!1;if(t.langReady)if(hr.langChanged){var a=fr.pref("lang");t.langReady({lang:a,uiStrings:_r,importLocale:Er({defaultLang:a,defaultName:t.name})})}else _e.push(t);var i=function(){t.callback&&!n&&(n=!0,t.callback.call(hr))},o=[];t.context_tools&&fr.each(t.context_tools,function(e,t){var n=t.container_id?' id="'+t.container_id+'"':"",r=fr("#"+t.panel);r.length||(r=fr("<div>",{id:t.panel}).appendTo("#tools_top"));var a=void 0;switch(t.type){case"tool_button":a='<div class="tool_button">'+t.id+"</div>";var i=fr(a).appendTo(r);t.events&&fr.each(t.events,function(e,t){fr(i).bind(e,t)});break;case"select":a="<label"+n+'><select id="'+t.id+'">',fr.each(t.options,function(e,n){var r=e===t.defval?" selected":"";a+='<option value="'+e+'"'+r+">"+n+"</option>"});var s=fr(a+="</select></label>").appendTo(r).find("select");fr.each(t.events,function(e,t){fr(s).bind(e,t)});break;case"button-select":a='<div id="'+t.id+'" class="dropdown toolset" title="'+t.title+'"><div id="cur_'+t.id+'" class="icon_label"></div><button></button></div>';var l=fr('<ul id="'+t.id+'_opts"></ul>').appendTo("#option_lists");t.colnum&&l.addClass("optcols"+t.colnum),fr(a).appendTo(r).children(),o.push({elem:"#"+t.id,list:"#"+t.id+"_opts",title:t.title,callback:t.events.change,cur:"#cur_"+t.id});break;case"input":a="<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=fr(a).appendTo(r).find("input");t.spindata&&c.SpinButton(t.spindata),t.events&&fr.each(t.events,function(e,t){c.bind(e,t)})}});var s=t.svgicons;if(t.buttons){var l={},c={},u={};if(fr.each(t.buttons,function(e,t){for(var n=t.id,r=e;fr("#"+n).length;)n=t.id+"_"+ ++r;var a=void 0;if(s){l[n]=t.icon;var i=t.svgicon||t.id;"app_menu"===t.type?c["#"+n+" > div"]=i:c["#"+n]=i}else a=fr('<img src="'+t.icon+'">');var o=void 0,d=void 0;switch(t.type){case"mode_flyout":case"mode":o="tool_button",d="#tools_left";break;case"context":o="tool_button",d="#"+t.panel,fr(d).length||fr("<div>",{id:t.panel}).appendTo("#tools_top");break;case"app_menu":o="",d="#main_menu ul"}var h=void 0,f=void 0,p=void 0,g=void 0,v=fr(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(v.addClass("push_button"),fr("#"+t.list+"_opts").append(v),t.isDefault){fr("#cur_"+t.list).append(v.children().clone());var m=t.svgicon||t.id;c["#cur_"+t.list]=m}}else if(t.includeWith){var _=t.includeWith;h=(g=fr(_.button)).parent();var y=void 0;g.parent().hasClass("tools_flyout")||(y=g[0].id.replace("tool_","tools_"),f=g.clone().attr("id",y+"_show").append(fr("<div>",{class:"flyout_arrow_horiz"})),g.before(f),h=ve(y,g)),p=hn.getButtonData(_.button),_.isDefault&&(c["#"+y+"_show"]=t.id);var b=u["#"+h[0].id]=[{sel:"#"+n,fn:t.events.click,icon:t.id,key:t.key,isDefault:Boolean(t.includeWith&&t.includeWith.isDefault)},p],x="position"in _?_.position:"last",w=h.children().length;!isNaN(x)&&x>=0&&x<w?h.children().eq(x).before(v):(h.append(v),b.reverse())}}else if("position"in t?fr(d).children().eq(t.position).length?fr(d).children().eq(t.position).before(v):fr(d).children().last().before(v):v.appendTo(d),"mode_flyout"===t.type){h=(g=fr(v)).parent();var S=void 0;g.parent().hasClass("tools_flyout")||(S=g[0].id.replace("tool_","tools_"),f=g.clone().attr("id",S+"_show").append(fr("<div>",{class:"flyout_arrow_horiz"})),g.before(f),(h=ve(S,g)).data("isLibrary",!0),f.data("isLibrary",!0)),c["#"+S+"_show"]=t.id,u["#"+h[0].id]=[{sel:"#"+n,fn:t.events.click,icon:t.id,isDefault:!0}]}else"app_menu"===t.type&&v.append("<div>").append(t.title);s||v.append(a),t.list||fr.each(t.events,function(e,n){"click"===e&&"mode"===t.type?(t.includeWith?v.bind(e,n):v.bind(e,function(){Y(v)&&n()}),t.key&&(fr(document).bind("keydown",t.key,n),t.title&&v.attr("title",t.title+" ["+t.key+"]"))):v.bind(e,n)}),ge(u)}),fr.each(o,function(){me(this.elem,this.list,this.callback,{seticon:!0})}),s)return new Promise(function(e,t){fr.svgIcons(s,{w:24,h:24,id_match:!1,no_img:!L(),fallback:l,placement:c,callback:function(t){"m"!==fr.pref("iconsize")&&(b&&(clearTimeout(b),b=null),r||(b=setTimeout(function(){r=!0,f(fr.pref("iconsize"))},50))),i(),e()}})})}return i()}}),yr.textActions.setInputElem(fr("#text")[0]);var ye='<div class="palette_item" data-rgb="none"></div>';fr.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){ye+='<div class="palette_item" style="background-color: '+t+';" data-rgb="'+t+'"></div>'}),fr("#palette").append(ye);ye="",fr.each(["#FFF","#888","#000"],function(){ye+='<div class="color_block" style="background-color:'+this+';"></div>'}),fr("#bg_blocks").append(ye);var be=fr("#bg_blocks div");be.each(function(){fr(this).click(function(){be.removeClass("cur_background"),fr(this).addClass("cur_background")})}),Q(fr.pref("bkgd_color"),fr.pref("bkgd_url")),fr("#image_save_opts input").val([fr.pref("img_save")]);var xe=function(e,t){null==t&&(t=e.value),fr("#group_opacity").val(t),e&&e.handle||fr("#opac_slider").slider("option","value",t),yr.setOpacity(t/100)},we=function(e,t,n){null==t&&(t=e.value),fr("#blur").val(t);var r=!1;e&&e.handle||(fr("#blur_slider").slider("option","value",t),r=!0),n?yr.setBlurNoUndo(t):yr.setBlur(t,r)};fr("#stroke_style").change(function(){yr.setStrokeAttr("stroke-dasharray",fr(this).val()),z()}),fr("#stroke_linejoin").change(function(){yr.setStrokeAttr("stroke-linejoin",fr(this).val()),z()}),fr("select").change(function(){fr(this).blur()});var Se,ke,Ce,Ae,Ee,Ge=!1;fr("#selLayerNames").change(function(){var e=this.options[this.selectedIndex].value,t=_r.notification.QmoveElemsToLayer.replace("%s",e),n=function(t){t&&(Ge=!0,yr.moveSelectedToLayer(e),yr.clearSelection(),T())};e&&(Ge?n(!0):fr.confirm(t,n))}),fr("#font_family").change(function(){yr.setFontFamily(this.value)}),fr("#seg_type").change(function(){yr.setSegType(fr(this).val())}),fr("#text").bind("keyup input",function(){yr.setTextContent(this.value)}),fr("#image_url").change(function(){X(this.value)}),fr("#link_url").change(function(){this.value.length?yr.setLinkURL(this.value):yr.removeHyperlink()}),fr("#g_title").change(function(){yr.setGroupTitle(this.value)}),fr(".attr_changer").change(function(){var e=this.getAttribute("data-attr"),t=this.value;if(!ae(e,t,F))return fr.alert(_r.notification.invalidAttrValGiven),this.value=F.getAttribute(e),!1;if("id"!==e&&"class"!==e)if(isNaN(t))t=yr.convertToNum(e,t);else if("px"!==Cr.baseUnit){var n=J();(F[e]||"pathedit"===yr.getMode()||"x"===e||"y"===e)&&(t*=n[Cr.baseUnit])}if("id"===e){var r=F;yr.clearSelection(),r.id=t,yr.addToSelection([r],!0)}else yr.changeSelectedAttribute(e,t);this.blur()}),fr("#palette").mouseover(function(){var e=fr('<input type="hidden">');fr(this).append(e),e.focus().remove()}),fr(".palette_item").mousedown(function(e){var t=e.shiftKey||2===e.button?"stroke":"fill",n=fr(this).data("rgb"),r=void 0;"none"===n||"transparent"===n||"initial"===n?(n="none",r=new fr.jGraduate.Paint):r=new fr.jGraduate.Paint({alpha:100,solidColor:n.substr(1)}),y[t].setPaint(r),yr.setColor(t,n),"none"!==n&&1!==yr.getPaintOpacity(t)&&yr.setPaintOpacity(t,1),ee()}).bind("contextmenu",function(e){e.preventDefault()}),fr("#toggle_stroke_tools").on("click",function(){fr("#tools_bottom").toggleClass("expanded")}),Se=m[0],ke=null,Ce=null,Ae=!1,Ee=!1,fr("#svgcanvas").bind("mousemove mouseup",function(e){if(!1!==Ae)return Se.scrollLeft-=e.clientX-ke,Se.scrollTop-=e.clientY-Ce,ke=e.clientX,Ce=e.clientY,"mouseup"===e.type&&(Ae=!1),!1}).mousedown(function(e){if(1===e.button||!0===Ee)return Ae=!0,ke=e.clientX,Ce=e.clientY,!1}),fr(window).mouseup(function(){Ae=!1}),fr(document).bind("keydown","space",function(e){yr.spaceKey=Ee=!0,e.preventDefault()}).bind("keyup","space",function(e){e.preventDefault(),yr.spaceKey=Ee=!1}).bind("keydown","shift",function(e){"zoom"===yr.getMode()&&m.css("cursor",C)}).bind("keyup","shift",function(e){"zoom"===yr.getMode()&&m.css("cursor",k)}),hr.setPanning=function(e){yr.spaceKey=Ee=e},function(){var e=fr("#main_icon"),t=fr("#main_icon span"),n=fr("#main_menu"),r=!1,a=0,i=!0,o=!1;fr(window).mouseup(function(t){r||(e.removeClass("buttondown"),"INPUT"!==t.target.tagName?n.fadeOut(200):o||(o=!0,fr(t.target).click(function(){n.css("margin-left","-9999px").show()}))),r=!1}).mousedown(function(e){fr(e.target).closest("div.tools_flyout, .contextMenu").length||fr(".tools_flyout:visible,.contextMenu").fadeOut(250)}),t.bind("mousedown",function(){e.hasClass("buttondown")?n.fadeOut(200):(n.css("margin-left",0).show(),a||(a=n.height()),n.css("height",0).animate({height:a},200),r=!0),e.toggleClass("buttondown buttonup")}).hover(function(){r=!0}).mouseout(function(){r=!1});var s=fr("#main_menu li");s.mouseover(function(){i="rgba(0, 0, 0, 0)"===fr(this).css("background-color"),s.unbind("mouseover"),i&&s.mouseover(function(){this.style.backgroundColor="#FFC"}).mouseout(function(){return this.style.backgroundColor="transparent",!0})})}(),hr.addDropDown=function(e,t,n){if(fr(e).length){var r=fr(e).find("button"),a=fr(e).find("ul").attr("id",fr(e)[0].id+"-list");n?fr(e).addClass("dropup"):fr("#option_lists").append(a),a.find("li").bind("mouseup",t);var i=!1;fr(window).mouseup(function(e){i||(r.removeClass("down"),a.hide()),i=!1}),r.bind("mousedown",function(){if(r.hasClass("down"))a.hide();else{if(!n){var t=fr(e).position();a.css({top:t.top+24,left:t.left-10})}a.show(),i=!0}r.toggleClass("down")}).hover(function(){i=!0}).mouseout(function(){i=!1})}},hr.addDropDown("#font_family_dropdown",function(){fr("#font_family").val(fr(this).text()).change()}),hr.addDropDown("#opacity_dropdown",function(){if(!fr(this).find("div").length){var e=parseInt(fr(this).text().split("%")[0],10);xe(!1,e)}},!0),fr("#opac_slider").slider({start:function(){fr("#opacity_dropdown li:not(.special)").hide()},stop:function(){fr("#opacity_dropdown li").show(),fr(window).mouseup()},slide:function(e,t){xe(t)}}),hr.addDropDown("#blur_dropdown",fr.noop);var Pe,Ne,Ie=!1;fr("#blur_slider").slider({max:10,step:.1,stop:function(e,t){Ie=!1,we(t),fr("#blur_dropdown li").show(),fr(window).mouseup()},start:function(){Ie=!0},slide:function(e,t){we(t,null,Ie)}}),hr.addDropDown("#zoom_dropdown",function(){var e=fr(this),t=e.data("val");t?ce(window,t):ue({value:parseFloat(e.text())})},!0),me("#stroke_linecap","#linecap_opts",function(){q(this,!0)},{dropUp:!0}),me("#stroke_linejoin","#linejoin_opts",function(){q(this,!0)},{dropUp:!0}),me("#tool_position","#position_opts",function(){var e=this.id.replace("tool_pos","").charAt(0);yr.alignSelectedElements(e,"page")},{multiclick:!0}),Pe=void 0,Ne=function(){fr(Pe).blur()},fr("#svg_editor").find("button, select, input:not(#text)").focus(function(){Pe=this,A="toolbars",m.mousedown(Ne)}).blur(function(){A="canvas",m.unbind("mousedown",Ne),"textedit"===yr.getMode()&&fr("#text").focus()});var Te=function(){Y("#tool_fhpath")&&yr.setMode("fhpath")},Le=function(){Y("#tool_line")&&yr.setMode("line")},Me=function(){Y("#tool_square")&&yr.setMode("square")},Oe=function(){Y("#tool_rect")&&yr.setMode("rect")},je=function(){Y("#tool_fhrect")&&yr.setMode("fhrect")},Ve=function(){Y("#tool_circle")&&yr.setMode("circle")},Re=function(){Y("#tool_ellipse")&&yr.setMode("ellipse")},Be=function(){Y("#tool_fhellipse")&&yr.setMode("fhellipse")},De=function(){Y("#tool_image")&&yr.setMode("image")},Ue=function(){Y("#tool_zoom")&&(yr.setMode("zoom"),m.css("cursor",k))},Fe=function(e){var t=yr.getResolution();e=e?t.zoom*e:1,fr("#zoom").val(100*e),yr.setZoom(e),le(),$(!0)},He=function(){Y("#tool_zoom")&&(Fe(),E())},ze=function(){Y("#tool_text")&&yr.setMode("text")},qe=function(){Y("#tool_path")&&yr.setMode("path")},Ye=function(){(null!=F||H)&&yr.deleteSelectedElements()},We=function(){(null!=F||H)&&yr.cutSelectedElements()},Xe=function(){(null!=F||H)&&yr.copySelectedElements()},Qe=function(){var e=yr.getZoom(),t=(m[0].scrollLeft+m.width()/2)/e-yr.contentW,n=(m[0].scrollTop+m.height()/2)/e-yr.contentH;yr.pasteElements("point",t,n)},Ke=function(){null!=F&&yr.moveToTopSelectedElement()},Ze=function(){null!=F&&yr.moveToBottomSelectedElement()},$e=function(e){null!=F&&yr.moveUpDownSelected(e)},Je=function(){null!=F&&yr.convertToPath()},et=function(){null!=F&&g.reorient()},tt=function(){(null!=F||H)&&fr.prompt(_r.notification.enterNewLinkURL,"http://",function(e){e&&yr.makeHyperlink(e)})},nt=function(e,t){if(null!=F||H){if(Cr.gridSnapping){var n=yr.getZoom()*Cr.snappingStep;e*=n,t*=n}yr.moveSelectedElements(e,t)}},rt=function(){fr("#tool_node_link").toggleClass("push_button_pressed tool_button");var e=fr("#tool_node_link").hasClass("push_button_pressed");g.linkControlPoints(e)},at=function(){g.getNodePoint()&&g.clonePathNode()},it=function(){g.getNodePoint()&&g.deletePathNode()},ot=function(){var e=fr("#tool_add_subpath"),t=!e.hasClass("push_button_pressed");e.toggleClass("push_button_pressed tool_button"),g.addSubPath(t)},st=function(){g.opencloseSubPath()},lt=function(){yr.cycleElement(1)},ct=function(){yr.cycleElement(0)},ut=function(e,t){if(null!=F&&!H){e||(t*=-1);var n=parseFloat(fr("#angle").val())+t;yr.setRotationAngle(n),ne()}},dt=function(){var e=l(Cr.dimensions,2),t=e[0],n=e[1];fr.confirm(_r.notification.QwantToClear,function(e){e&&(E(),yr.clear(),yr.setResolution(t,n),$(!0),Fe(),T(),ne(),de(),yr.runExtensions("onNewDocument"))})},ht=function(){return yr.setBold(!yr.getBold()),ne(),!1},ft=function(){return yr.setItalic(!yr.getItalic()),ne(),!1},pt=void 0,gt=function(){var e;fr.select("Select an image type for export: ",["PNG","JPEG","BMP","WEBP","PDF"],(e=n(regeneratorRuntime.mark(function e(t){var n,r,a,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=function(){var e=_r.notification.loadingImage;"new"===Cr.exportWindowType&&hr.exportWindowCt++,n=Cr.canvasName+hr.exportWindowCt;var t=void 0,r=void 0;if(pt)r=pt;else{if(t='<!DOCTYPE html><html>\n <head>\n <meta charset="utf-8">\n <title>'+e+"</title>\n </head>\n <body><h1>"+e+"</h1></body>\n <html>","undefined"!=typeof URL&&URL.createObjectURL){var a=new Blob([t],{type:"text/html"});r=URL.createObjectURL(a)}else r="data:text/html;base64;charset=utf-8,"+bt(t);pt=r}w=window.open(r,n)},t){e.next=3;break}return e.abrupt("return");case 3:if(n=void 0,a=j(),"PDF"!==t){e.next=10;break}Sr||a||r(),yr.exportPDF(n,a?"save":void 0),e.next=14;break;case 10:return wr||r(),i=parseInt(fr("#image-slider").val(),10)/100,e.next=14,yr.rasterExport(t,i,n);case 14:case"end":return e.stop()}},e,this)})),function(t){return e.apply(this,arguments)}),function(){var e=fr(this);"JPEG"===e.val()||"WEBP"===e.val()?fr("#image-slider").length||fr("<div><label>"+_r.ui.quality+'\n <input id="image-slider"\n type="range" min="1" max="100" value="92" />\n </label></div>').appendTo(e.parent()):fr("#image-slider").parent().remove()})},vt=function(){yr.open()},mt=function(){},_t=function(){v.getUndoStackSize()>0&&(v.undo(),T())},yt=function(){v.getRedoStackSize()>0&&(v.redo(),T())},xt=function(){H?yr.groupSelectedElements():F&&yr.ungroupSelectedElement()},wt=function(){yr.cloneSelectedElements(20,20)},St=function(){var e=this.id.replace("tool_align","").charAt(0);yr.alignSelectedElements(e,fr("#align_relative_to").val())},kt=function(){if(fr("#tool_wireframe").toggleClass("push_button_pressed tool_button"),m.toggleClass("wireframe"),!Xt){var e=fr("#wireframe_rules");e.length?e.empty():fr('<style id="wireframe_rules"></style>').appendTo("head"),re()}};fr("#svg_docprops_container, #svg_prefs_container").draggable({cancel:"button,fieldset",containment:"window"}).css("position","absolute");var Ct,Et,Gt=!1,Pt=!1,Nt=function(){if(!Gt){Gt=!0,fr("#image_save_opts input").val([fr.pref("img_save")]);var e=yr.getResolution();"px"!==Cr.baseUnit&&(e.w=te(e.w)+Cr.baseUnit,e.h=te(e.h)+Cr.baseUnit),fr("#canvas_width").val(e.w),fr("#canvas_height").val(e.h),fr("#canvas_title").val(yr.getDocumentTitle()),fr("#svg_docprops").show()}},It=function(){fr("#svg_source_editor").hide(),B=!1,fr("#svg_source_textarea").blur()},Tt=function(){if(B){var e=function(){yr.clearSelection(),It(),Fe(),T(),oe(),de()};yr.setSvgString(fr("#svg_source_textarea").val())?e():fr.confirm(_r.notification.QerrorsRevertToSource,function(t){if(!t)return!1;e()}),E()}},Lt=function(){fr("#svg_docprops").hide(),fr("#canvas_width,#canvas_height").removeAttr("disabled"),fr("#resolution")[0].selectedIndex=0,fr("#image_save_opts input").val([fr.pref("img_save")]),Gt=!1},Mt=function(){fr("#svg_prefs").hide(),Pt=!1},Ot=function(){var e=fr("#canvas_title").val();oe(e),yr.setDocumentTitle(e);var t=fr("#canvas_width"),n=t.val(),r=fr("#canvas_height"),a=r.val();return"fit"===n||ae("width",n)?(t.parent().removeClass("error"),"fit"===a||ae("height",a)?(r.parent().removeClass("error"),yr.setResolution(n,a)?(fr.pref("img_save",fr("#image_save_opts :checked").val()),$(),void Lt()):(fr.alert(_r.notification.noContentToFitTo),!1)):(fr.alert(_r.notification.invalidAttrValGiven),r.parent().addClass("error"),!1)):(fr.alert(_r.notification.invalidAttrValGiven),t.parent().addClass("error"),!1)},jt=hr.savePreferences=function(){Q(fr("#bg_blocks div.cur_background").css("background-color")||"#FFF",fr("#canvas_bg_url").val());var t=fr("#lang_select").val();t!==fr.pref("lang")&&hr.putLocale(t,e,Cr),f(fr("#iconsize").val()),Cr.gridSnapping=fr("#grid_snapping_on")[0].checked,Cr.snappingStep=fr("#grid_snapping_step").val(),Cr.gridColor=fr("#grid_color").val(),Cr.showRulers=fr("#show_rulers")[0].checked,fr("#rulers").toggle(Cr.showRulers),Cr.showRulers&&Z(),Cr.baseUnit=fr("#base_unit").val(),yr.setConfig(Cr),$(),Mt()},Vt=fr.noop,Rt=function(){fr("#dialog_box").hide(),B||Gt||Pt?(B?D!==fr("#svg_source_textarea").val()?fr.confirm(_r.notification.QignoreSourceChanges,function(e){e&&It()}):It():Gt?Lt():Pt&&Mt(),Vt()):ie&&yr.leaveContext()},Bt={width:fr(window).width(),height:fr(window).height()};if(O()&&(Vt=function(){0===m[0].scrollLeft&&0===m[0].scrollTop&&(m[0].scrollLeft=x.left,m[0].scrollTop=x.top)},x={left:m[0].scrollLeft,top:m[0].scrollTop},fr(window).resize(Vt),hr.ready(function(){setTimeout(function(){Vt()},500)}),m.scroll(function(){x={left:m[0].scrollLeft,top:m[0].scrollTop}})),fr(window).resize(function(e){fr.each(Bt,function(e,t){var n=fr(window)[e]();m[0]["scroll"+("width"===e?"Left":"Top")]-=(n-t)/2,Bt[e]=n}),d()}),m.scroll(function(){fr("#ruler_x").length&&(fr("#ruler_x")[0].scrollLeft=m[0].scrollLeft),fr("#ruler_y").length&&(fr("#ruler_y")[0].scrollTop=m[0].scrollTop)}),fr("#url_notice").click(function(){fr.alert(this.title)}),fr("#change_image_url").click(K),Ct="tool_button_current",Et="",fr.each(["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],function(e,t){Et+=(e?",":"")+"#tool_"+t}),fr(Et).mousedown(function(){fr(this).addClass(Ct)}).bind("mousedown mouseout",function(){fr(this).removeClass(Ct)}),fr("#tool_undo, #tool_redo").mousedown(function(){fr(this).hasClass("disabled")||fr(this).addClass(Ct)}).bind("mousedown mouseout",function(){fr(this).removeClass(Ct)}),V()&&!window.opera)for(var Dt=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"],Ut=Dt.length;Ut--;){var Ft=document.getElementById(Dt[Ut]);if(Ft){var Ht=Ft.title,zt=Ht.indexOf("Ctrl+");Ft.title=[Ht.substr(0,zt),"Cmd+",Ht.substr(zt+5)].join("")}}var qt=function(e){var t="stroke_color"===e.attr("id")?"stroke":"fill",n="stroke"===t?_r.ui.pick_stroke_paint_opacity:_r.ui.pick_fill_paint_opacity,r=e.offset(),a=y[t].paint;fr("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(Cr.colorPickerCSS||{left:r.left-140,bottom:40}).jGraduate({paint:a,window:{pickerTitle:n},images:{clientPath:Cr.jGraduatePath},newstop:"inverse"},function(e){a=new fr.jGraduate.Paint(e),y[t].setPaint(a),yr.setPaint(t,a),fr("#color_picker").hide()},function(){fr("#color_picker").hide()})},Yt=function(e,t){var n=void 0,r=void 0,a=Cr["fill"===t?"initFill":"initStroke"],i=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg">\n <rect width="16.5" height="16.5"\n fill="#'+a.color+'" opacity="'+a.opacity+'"/>\n <defs><linearGradient id="gradbox_"/></defs>\n </svg>',"text/xml").documentElement;(i=fr(e)[0].appendChild(document.importNode(i,!0))).setAttribute("width",16.5),this.rect=i.firstElementChild,this.defs=i.getElementsByTagName("defs")[0],this.grad=this.defs.firstElementChild,this.paint=new fr.jGraduate.Paint({solidColor:a.color}),this.type=t,this.setPaint=function(e,t){this.paint=e;var a=e.type,i=e.alpha/100,o="none";switch(a){case"solidColor":o="none"!==e[a]?"#"+e[a]:e[a];break;case"linearGradient":case"radialGradient":this.grad.remove(),this.grad=this.defs.appendChild(e[a]),o="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",o),this.rect.setAttribute("opacity",i),t&&(yr.setColor(this.type,n,!0),yr.setPaintOpacity(this.type,r,!0))},this.update=function(e){if(F){var t=this.type;switch(F.tagName){case"use":case"image":case"foreignObject":return;case"g":case"a":for(var a=F.getElementsByTagName("*"),i=null,o=0,s=a.length;o<s;o++){var l=a[o].getAttribute(t);if(0===o)i=l;else if(i!==l){i=null;break}}if(null===i)return void(n=null);n=i,r=1;break;default:r=parseFloat(F.getAttribute(t+"-opacity")),isNaN(r)&&(r=1);var c="fill"===t?"black":"none";n=F.getAttribute(t)||c}e&&(yr.setColor(t,n,!0),yr.setPaintOpacity(t,r,!0));var u=function(e,t,n){var r={alpha:t};if(e.startsWith("url(#")){var a=yr.getRefElem(e);r[(a=a?a.cloneNode(!0):fr("#"+n+"_color defs *")[0]).tagName]=a}else e.startsWith("#")?r.solidColor=e.substr(1):r.solidColor="none";return new fr.jGraduate.Paint(r)}(n,r*=100,t);this.setPaint(u)}},this.prep=function(){switch(this.paint.type){case"linearGradient":case"radialGradient":var e=new fr.jGraduate.Paint({copy:this.paint});yr.setPaint(t,e)}}};y.fill=new Yt("#fill_color","fill"),y.stroke=new Yt("#stroke_color","stroke"),fr("#stroke_width").val(Cr.initStroke.width),fr("#group_opacity").val(100*Cr.initOpacity);var Wt=y.fill.rect.cloneNode(!1);Wt.setAttribute("style","vector-effect:non-scaling-stroke");var Xt="non-scaling-stroke"===Wt.style.vectorEffect;Wt.removeAttribute("style");var Qt,Kt,Zt=y.fill.rect.ownerDocument.createElementNS(u.SVG,"feGaussianBlur");function $t(){yr.deleteCurrentLayer()&&(ne(),T(),fr("#layerlist tr.layer").removeClass("layersel"),fr("#layerlist tr.layer:first").addClass("layersel"))}function Jt(e){var t=yr.getCurrentDrawing().getNumLayers(),n=fr("#layerlist tr.layersel").index();(n>0||n<t-1)&&(n+=e,yr.setCurrentLayerPosition(t-n-1),T())}void 0===Zt.stdDeviationX&&fr("#tool_blur").hide(),fr(Zt).remove(),Qt="-"+h.toLowerCase()+"-zoom-",Kt=Qt+"in",m.css("cursor",Kt),m.css("cursor")===Kt&&(k=Kt,C=Qt+"out"),m.css("cursor","auto"),setTimeout(function(){yr.embedImage("images/logo.png",function(e){e||(fr("#image_save_opts [value=embed]").attr("disabled","disabled"),fr("#image_save_opts input").val(["ref"]),fr.pref("img_save","ref"),fr("#image_opt_embed").css("color","#666").attr("title",_r.notification.featNotSupported))})},1e3),fr("#fill_color, #tool_fill .icon_label").click(function(){qt(fr("#fill_color")),ee()}),fr("#stroke_color, #tool_stroke .icon_label").click(function(){qt(fr("#stroke_color")),ee()}),fr("#group_opacityLabel").click(function(){fr("#opacity_dropdown button").mousedown(),fr(window).mouseup()}),fr("#zoomLabel").click(function(){fr("#zoom_dropdown button").mousedown(),fr(window).mouseup()}),fr("#tool_move_top").mousedown(function(e){fr("#tools_stacking").show(),e.preventDefault()}),fr(".layer_button").mousedown(function(){fr(this).addClass("layer_buttonpressed")}).mouseout(function(){fr(this).removeClass("layer_buttonpressed")}).mouseup(function(){fr(this).removeClass("layer_buttonpressed")}),fr(".push_button").mousedown(function(){fr(this).hasClass("disabled")||fr(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){fr(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){fr(this).removeClass("push_button_pressed").addClass("push_button")}),fr("#layer_new").click(function(){var e=void 0,t=yr.getCurrentDrawing().getNumLayers();do{e=_r.layers.layer+" "+ ++t}while(yr.getCurrentDrawing().hasLayer(e));fr.prompt(_r.notification.enterUniqueLayerName,e,function(e){e&&(yr.getCurrentDrawing().hasLayer(e)?fr.alert(_r.notification.dupeLayerName):(yr.createLayer(e),ne(),T()))})}),fr("#layer_delete").click($t),fr("#layer_up").click(function(){Jt(-1)}),fr("#layer_down").click(function(){Jt(1)}),fr("#layer_rename").click(function(){var e=fr("#layerlist tr.layersel td.layername").text();fr.prompt(_r.notification.enterNewLayerName,"",function(t){t&&(e===t||yr.getCurrentDrawing().hasLayer(t)?fr.alert(_r.notification.layerHasThatName):(yr.renameCurrentLayer(t),T()))})});var tn=-1,nn=!1,rn=!1,an=function(e){var t=fr("#ruler_x");fr("#sidepanels").width("+="+e),fr("#layerpanel").width("+="+e),t.css("right",parseInt(t.css("right"),10)+e),m.css("right",parseInt(m.css("right"),10)+e),yr.runExtensions("workareaResized")},sn=function(e){if(rn&&-1!==tn){nn=!0;var t=tn-e.pageX,n=fr("#sidepanels").width();n+t>300?t=300-n:n+t<2&&(t=2-n),0!==t&&(tn-=t,an(t))}},ln=function(e){var t=fr("#sidepanels").width();an((t>2||e?2:150)-t)};fr("#sidepanel_handle").mousedown(function(e){tn=e.pageX,fr(window).mousemove(sn),rn=!1,setTimeout(function(){rn=!0},20)}).mouseup(function(e){nn||ln(),tn=-1,nn=!1}),fr(window).mouseup(function(){tn=-1,nn=!1,fr("#svg_editor").unbind("mousemove",sn)}),T();fr(window).bind("load resize",function(){m.css("line-height",m.height()+"px")}),fr("#resolution").change(function(){var e=fr("#canvas_width,#canvas_height");if(this.selectedIndex)if("content"===this.value)e.val("fit").attr("disabled","disabled");else{var t=this.value.split("x");fr("#canvas_width").val(t[0]),fr("#canvas_height").val(t[1]),e.removeAttr("disabled")}else"fit"===fr("#canvas_width").val()&&e.removeAttr("disabled").val(100)}),fr("input,select").attr("autocomplete","off");var cn,un,hn=(cn=[{sel:"#tool_select",fn:W,evt:"click",key:["V",!0]},{sel:"#tool_fhpath",fn:Te,evt:"click",key:["Q",!0]},{sel:"#tool_line",fn:Le,evt:"click",key:["L",!0],parent:"#tools_line",prepend:!0},{sel:"#tool_rect",fn:Oe,evt:"mouseup",key:["R",!0],parent:"#tools_rect",icon:"rect"},{sel:"#tool_square",fn:Me,evt:"mouseup",parent:"#tools_rect",icon:"square"},{sel:"#tool_fhrect",fn:je,evt:"mouseup",parent:"#tools_rect",icon:"fh_rect"},{sel:"#tool_ellipse",fn:Re,evt:"mouseup",key:["E",!0],parent:"#tools_ellipse",icon:"ellipse"},{sel:"#tool_circle",fn:Ve,evt:"mouseup",parent:"#tools_ellipse",icon:"circle"},{sel:"#tool_fhellipse",fn:Be,evt:"mouseup",parent:"#tools_ellipse",icon:"fh_ellipse"},{sel:"#tool_path",fn:qe,evt:"click",key:["P",!0]},{sel:"#tool_text",fn:ze,evt:"click",key:["T",!0]},{sel:"#tool_image",fn:De,evt:"mouseup"},{sel:"#tool_zoom",fn:Ue,evt:"mouseup",key:["Z",!0]},{sel:"#tool_clear",fn:dt,evt:"mouseup",key:["N",!0]},{sel:"#tool_save",fn:function(){var e;B?Tt():(e={images:fr.pref("img_save"),round_digits:6},yr.save(e))},evt:"mouseup",key:["S",!0]},{sel:"#tool_export",fn:gt,evt:"mouseup"},{sel:"#tool_open",fn:vt,evt:"mouseup",key:["O",!0]},{sel:"#tool_import",fn:mt,evt:"mouseup"},{sel:"#tool_source",fn:U,evt:"click",key:["U",!0]},{sel:"#tool_wireframe",fn:kt,evt:"click",key:["F",!0]},{sel:"#tool_source_cancel,.overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Rt,evt:"click",key:["esc",!1,!1],hidekey:!0},{sel:"#tool_source_save",fn:Tt,evt:"click"},{sel:"#tool_docprops_save",fn:Ot,evt:"click"},{sel:"#tool_docprops",fn:Nt,evt:"mouseup"},{sel:"#tool_prefs_save",fn:jt,evt:"click"},{sel:"#tool_prefs_option",fn:function(){return function(){if(!Pt){Pt=!0,fr("#main_menu").hide();var e=fr("#bg_blocks div"),t="cur_background",n=kr.bkgd_color,r=fr.pref("bkgd_url");e.each(function(){var e=fr(this),r=e.css("background-color")===n;e.toggleClass(t,r),r&&fr("#canvas_bg_url").removeClass(t)}),n||e.eq(0).addClass(t),r&&fr("#canvas_bg_url").val(r),fr("#grid_snapping_on").prop("checked",Cr.gridSnapping),fr("#grid_snapping_step").attr("value",Cr.snappingStep),fr("#grid_color").attr("value",Cr.gridColor),fr("#svg_prefs").show()}}(),!1},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:Ye,evt:"click",key:["del/backspace",!0]},{sel:"#tool_reorient",fn:et,evt:"click"},{sel:"#tool_node_link",fn:rt,evt:"click"},{sel:"#tool_node_clone",fn:at,evt:"click"},{sel:"#tool_node_delete",fn:it,evt:"click"},{sel:"#tool_openclose_path",fn:st,evt:"click"},{sel:"#tool_add_subpath",fn:ot,evt:"click"},{sel:"#tool_move_top",fn:Ke,evt:"click",key:"ctrl+shift+]"},{sel:"#tool_move_bottom",fn:Ze,evt:"click",key:"ctrl+shift+["},{sel:"#tool_topath",fn:Je,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:tt,evt:"click"},{sel:"#tool_undo",fn:_t,evt:"click"},{sel:"#tool_redo",fn:yt,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:wt,evt:"click",key:["D",!0]},{sel:"#tool_group_elements",fn:xt,evt:"click",key:["G",!0]},{sel:"#tool_ungroup",fn:xt,evt:"click"},{sel:"#tool_unlink_use",fn:xt,evt:"click"},{sel:"[id^=tool_align]",fn:St,evt:"click"},{sel:"#tool_bold",fn:ht,evt:"mousedown"},{sel:"#tool_italic",fn:ft,evt:"mousedown"},{sel:"#sidepanel_handle",fn:ln,key:["X"]},{sel:"#copy_save_done",fn:Rt,evt:"click"},{key:"ctrl+left",fn:function(){ut(0,1)}},{key:"ctrl+right",fn:function(){ut(1,1)}},{key:"ctrl+shift+left",fn:function(){ut(0,5)}},{key:"ctrl+shift+right",fn:function(){ut(1,5)}},{key:"shift+O",fn:ct},{key:"shift+P",fn:lt},{key:[p+"up",!0],fn:function(){Fe(2)}},{key:[p+"down",!0],fn:function(){Fe(.5)}},{key:[p+"]",!0],fn:function(){$e("Up")}},{key:[p+"[",!0],fn:function(){$e("Down")}},{key:["up",!0],fn:function(){nt(0,-1)}},{key:["down",!0],fn:function(){nt(0,1)}},{key:["left",!0],fn:function(){nt(-1,0)}},{key:["right",!0],fn:function(){nt(1,0)}},{key:"shift+up",fn:function(){nt(0,-10)}},{key:"shift+down",fn:function(){nt(0,10)}},{key:"shift+left",fn:function(){nt(-10,0)}},{key:"shift+right",fn:function(){nt(10,0)}},{key:["alt+up",!0],fn:function(){yr.cloneSelectedElements(0,-1)}},{key:["alt+down",!0],fn:function(){yr.cloneSelectedElements(0,1)}},{key:["alt+left",!0],fn:function(){yr.cloneSelectedElements(-1,0)}},{key:["alt+right",!0],fn:function(){yr.cloneSelectedElements(1,0)}},{key:["alt+shift+up",!0],fn:function(){yr.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",!0],fn:function(){yr.cloneSelectedElements(0,10)}},{key:["alt+shift+left",!0],fn:function(){yr.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",!0],fn:function(){yr.cloneSelectedElements(10,0)}},{key:"A",fn:function(){yr.selectAllInCurrentLayer()}},{key:p+"z",fn:_t},{key:p+"shift+z",fn:yt},{key:p+"y",fn:yt},{key:p+"x",fn:We},{key:p+"c",fn:Xe},{key:p+"v",fn:Qe}],un={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"},{setAll:function(){var e={};fr.each(cn,function(t,n){var r=void 0;if(n.sel){if(!(r=fr(n.sel)).length)return!0;if(n.evt&&(R()&&"click"===n.evt&&(n.evt="mousedown"),r[n.evt](n.fn)),n.parent&&fr(n.parent+"_show").length){var a=fr(n.parent);a.length||(a=ve(n.parent.substr(1))),n.prepend&&(r[0].style.margin="initial"),a[n.prepend?"prepend":"append"](r),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(fr.each(i.split("/"),function(e,t){fr(document).bind("keydown",t,function(e){return s(),o&&e.preventDefault(),!1})}),n.sel&&!n.hidekey&&r.attr("title")){var l=r.attr("title").split("[")[0]+" ("+i+")";un[i]=n.sel,r.parents("#main_menu").length||r.attr("title",l)}}}),ge(e),fr(".attr_changer, #image_url").bind("keydown","return",function(e){fr(this).change(),e.preventDefault()}),fr(window).bind("keydown","tab",function(e){"canvas"===A&&(e.preventDefault(),lt())}).bind("keydown","shift+tab",function(e){"canvas"===A&&(e.preventDefault(),ct())}),fr("#tool_zoom").dblclick(He)},setTitles:function(){fr.each(un,function(e,t){var n=fr(t).parents("#main_menu").length;fr(t).each(function(){var t=void 0;t=n?fr(this).text().split(" [")[0]:this.title.split(" [")[0];var r="";fr.each(e.split("/"),function(e,t){var n=t.split("+"),a="";n.length>1&&(a=n[0]+"+",t=n[1]),r+=(e?"/":"")+a+(_r["key_"+t]||t)}),n?this.lastChild.textContent=t+" ["+r+"]":this.title=t+" ["+r+"]"})})},getButtonData:function(e){return Object.values(cn).find(function(t){return t.sel===e})}});hr.ready(function(){var e=Cr.initTool,t=fr("#tools_left, #svg_editor .tools_flyout"),n=t.find("#tool_"+e),r=t.find("#"+e);(n.length?n:r.length?r:fr("#tool_select")).click().mouseup(),Cr.wireframe&&fr("#tool_wireframe").click(),Cr.showlayers&&ln(),fr("#rulers").toggle(!!Cr.showRulers),Cr.showRulers&&(fr("#show_rulers")[0].checked=!0),Cr.baseUnit&&fr("#base_unit").val(Cr.baseUnit),Cr.gridSnapping&&(fr("#grid_snapping_on")[0].checked=!0),Cr.snappingStep&&fr("#grid_snapping_step").val(Cr.snappingStep),Cr.gridColor&&fr("#grid_color").val(Cr.gridColor)}),fr("#rect_rx").SpinButton({min:0,max:1e3,stateObj:s,callback:function(e){yr.setRectRadius(e.value)}}),fr("#stroke_width").SpinButton({min:0,max:99,smallStep:.1,stateObj:s,callback:function(e){var t=e.value;0===t&&F&&["line","polyline"].includes(F.nodeName)&&(t=e.value=1),yr.setStrokeWidth(t)}}),fr("#angle").SpinButton({min:-180,max:180,step:5,stateObj:s,callback:function(e){yr.setRotationAngle(e.value),fr("#tool_reorient").toggleClass("disabled",0===parseInt(e.value,10))}}),fr("#font_size").SpinButton({min:.001,stepfunc:function(e,t){var n=Number(e.value),r=n+t,a=r>=n;return 0===t?n:n>=24?a?Math.round(1.1*n):Math.round(n/1.1):n<=1?a?2*n:n/2:r},stateObj:s,callback:function(e){yr.setFontSize(e.value)}}),fr("#group_opacity").SpinButton({min:0,max:100,step:5,stateObj:s,callback:xe}),fr("#blur").SpinButton({min:0,max:10,step:.1,stateObj:s,callback:we}),fr("#zoom").SpinButton({min:.001,max:1e4,step:50,stepfunc:function(e,t){var n=Number(e.value);if(0===n)return 100;var r=n+t;return 0===t?n:n>=100?r:r>=n?2*n:n/2},stateObj:s,callback:ue}).val(100*yr.getZoom()),fr("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(e,t,n){switch(e){case"delete":Ye();break;case"cut":We();break;case"copy":Xe();break;case"paste":yr.pasteElements();break;case"paste_in_place":yr.pasteElements("in_place");break;case"group":case"group_elements":yr.groupSelectedElements();break;case"ungroup":yr.ungroupSelectedElement();break;case"move_front":Ke();break;case"move_up":$e("Up");break;case"move_down":$e("Down");break;case"move_back":Ze();break;default:Boolean(en[e])&&function(e){return en[e].action}(e).call()}});var fn=function(e,t,n){switch(e){case"dupe":r=yr.getCurrentDrawing().getCurrentLayerName()+" copy",fr.prompt(_r.notification.enterUniqueLayerName,r,function(e){e&&(yr.getCurrentDrawing().hasLayer(e)?fr.alert(_r.notification.dupeLayerName):(yr.cloneLayer(e),ne(),T()))});break;case"delete":$t();break;case"merge_down":fr("#layerlist tr.layersel").index()!==yr.getCurrentDrawing().getNumLayers()-1&&(yr.mergeLayer(),ne(),T());break;case"merge_all":yr.mergeAllLayers(),ne(),T()}var r};function pn(){var e=void 0;try{e=localStorage.getItem("svgedit_clipboard")}catch(e){}_[(e?"en":"dis")+"ableContextMenuItems"]("#paste,#paste_in_place")}if(fr("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},fn),fr("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:!0},fn),fr(".contextMenu li").mousedown(function(e){e.preventDefault()}),fr("#cmenu_canvas li").disableContextMenu(),_.enableContextMenuItems("#delete,#cut,#copy"),pn(),window.addEventListener("storage",function(e){"svgedit_clipboard"===e.key&&pn()}),window.addEventListener("beforeunload",function(e){if(0===v.getUndoStackSize()&&(hr.showSaveWarning=!1),!Cr.no_save_warning&&hr.showSaveWarning)return e.returnValue=_r.notification.unsavedChanges,_r.notification.unsavedChanges},!1),hr.canvas.getUIStrings=function(){return _r},hr.openPrep=function(e){fr("#main_menu").hide(),0===v.getUndoStackSize()?e(!0):fr.confirm(_r.notification.QwantToOpen,e)},window.FileReader){var gn=function(e){fr.process_cancel(_r.notification.loadingImage),e.stopPropagation(),e.preventDefault(),fr("#workarea").removeAttr("style"),fr("#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=yr.importSvgString(e.target.result,!0);yr.ungroupSelectedElement(),yr.ungroupSelectedElement(),yr.groupSelectedElements(),yr.alignSelectedElements("m","page"),yr.alignSelectedElements("c","page"),yr.selectOnly([t]),fr("#dialog_box").hide()},n.readAsText(t)):((n=new FileReader).onloadend=function(e){var t=e.target.result,n=100,r=100,a=new Image;a.style.opacity=0,a.onload=function(){var e,i,o;n=a.offsetWidth||a.naturalWidth||a.width,r=a.offsetHeight||a.naturalHeight||a.height,e=n,i=r,o=yr.addSVGElementFromJson({element:"image",attr:{x:0,y:0,width:e,height:i,id:yr.getNextId(),style:"pointer-events:inherit"}}),yr.setHref(o,t),yr.selectOnly([o]),yr.alignSelectedElements("m","page"),yr.alignSelectedElements("c","page"),ne(),fr("#dialog_box").hide()},a.src=t},n.readAsDataURL(t))}}else fr("#dialog_box").hide()};m[0].addEventListener("dragenter",function(e){e.stopPropagation(),e.preventDefault()},!1),m[0].addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault()},!1),m[0].addEventListener("dragleave",function(e){e.stopPropagation(),e.preventDefault()},!1),m[0].addEventListener("drop",gn,!1);var vn=fr('<input type="file">').change(function(){var e=this;hr.openPrep(function(t){if(t&&(yr.clear(),1===e.files.length)){fr.process_cancel(_r.notification.loadingImage);var n=new FileReader;n.onloadend=function(e){Ar(e.target.result),$()},n.readAsText(e.files[0])}})});fr("#tool_open").show().prepend(vn);var mn=fr('<input type="file">').change(gn);fr("#tool_import").show().prepend(mn)}$(!0);var _n=hr.setLang=function(e,t){if(hr.langChanged=!0,fr.pref("lang",e),fr("#lang_select").val(e),t){fr.extend(_r,t);var n=fr("#layerlist tr.layersel td.layername").text()===_r.common.layer+" 1";if(yr.setUiStrings(t),hn.setTitles(),n&&(yr.renameCurrentLayer(_r.common.layer+" 1"),T()),_e.length)for(;_e.length;){var r=_e.shift();r.langReady({lang:e,uiStrings:_r,importLocale:Er({defaultLang:e,defaultName:r.name})})}else yr.runExtensions("langReady",{lang:e,uiStrings:_r});yr.runExtensions("langChanged",e),fe();fr.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){fr(t).attr("title",fr(e)[0].title)}),fr("#multiselected_panel div[id^=tool_align]").each(function(){fr("#tool_pos"+this.id.substr(10))[0].title=this.title})}};!function(e){cr=e}({addLangData:function(e){return yr.runExtensions("addLangData",function(t){return{lang:e,importLocale:Er({defaultLang:e,defaultName:t})}},!0)},curConfig:Cr}),"file:"===document.location.protocol?setTimeout(o,100):o()},hr.ready=function(e){xr?e():pr.push(e)},hr.runCallbacks=function(){pr.forEach(function(e){e()}),xr=!0},hr.loadFromString=function(e){hr.ready(function(){Ar(e)})},hr.disableUI=function(e){},hr.loadFromURL=function(e,t){t||(t={});var n=t,r=n.cache,a=n.callback;hr.ready(function(){fr.ajax({url:e,dataType:"text",cache:!!r,beforeSend:function(){fr.process_cancel(_r.notification.loadingImage)},success:function(e){Ar(e,a)},error:function(e,t,n){404!==e.status&&e.responseText?Ar(e.responseText,a):fr.alert(_r.notification.URLloadFail+": \n"+n,a)},complete:function(){fr("#dialog_box").hide()}})})},hr.loadFromDataURI=function(e){hr.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 r=e.slice(n.length);Ar(t?xt(r):decodeURIComponent(r))})},hr.addExtension=function(e,t,n){if(!yr)throw new Error("Extension added too early");return yr.addExtension.call(this,e,t,n)},hr.ready(function(){!function(){for(var e in en)tn(en[e])}()});var Gr=!1,Pr=[];return window.addEventListener("message",function(e){var t={data:e.data,origin:e.origin};Gr?yr.call("message",t):Pr.push(t)}),Promise.resolve().then(function(){hr.init()}),hr});
//# sourceMappingURL=index-umd.min.js.map