3 lines
346 KiB
JavaScript
3 lines
346 KiB
JavaScript
function e(t){return(e="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})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function a(){return(a=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}).apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;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||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function u(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function d(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",d,!0),document.addEventListener("touchmove",d,!0),document.addEventListener("touchend",d,!0),document.addEventListener("touchcancel",d,!0);var h={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/"},p=function(){var e={};return Object.entries(h).forEach((function(t){var n=c(t,2),r=n[0],a=n[1];e[a]=r.toLowerCase()})),e};!function(){if(!("SVGPathSeg"in window)){var e=function(){function e(n,r,a){t(this,e),this.pathSegType=n,this.pathSegTypeAsLetter=r,this._owningPathSegList=a}return r(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 n=function(n){function a(n){return t(this,a),l(this,o(a).call(this,e.PATHSEG_CLOSEPATH,"z",n))}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegClosePath]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter}},{key:"clone",value:function(){return new a(void 0)}}]),a}(e),a=function(n){function a(n,r,i){var s;return t(this,a),(s=l(this,o(a).call(this,e.PATHSEG_MOVETO_ABS,"M",n)))._x=r,s._y=i,s}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegMovetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new a(void 0,this._x,this._y)}}]),a}(e);Object.defineProperties(a.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var s=function(n){function a(n,r,i){var s;return t(this,a),(s=l(this,o(a).call(this,e.PATHSEG_MOVETO_REL,"m",n)))._x=r,s._y=i,s}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegMovetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new a(void 0,this._x,this._y)}}]),a}(e);Object.defineProperties(s.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var c=function(n){function a(n,r,i){var s;return t(this,a),(s=l(this,o(a).call(this,e.PATHSEG_LINETO_ABS,"L",n)))._x=r,s._y=i,s}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegLinetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new a(void 0,this._x,this._y)}}]),a}(e);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(n){function a(n,r,i){var s;return t(this,a),(s=l(this,o(a).call(this,e.PATHSEG_LINETO_REL,"l",n)))._x=r,s._y=i,s}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegLinetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new a(void 0,this._x,this._y)}}]),a}(e);Object.defineProperties(u.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var d=function(n){function a(n,r,i,s,c,u,d){var h;return t(this,a),(h=l(this,o(a).call(this,e.PATHSEG_CURVETO_CUBIC_ABS,"C",n)))._x=r,h._y=i,h._x1=s,h._y1=c,h._x2=u,h._y2=d,h}return i(a,n),r(a,[{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 a(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),a}(e);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(n){function a(n,r,i,s,c,u,d){var h;return t(this,a),(h=l(this,o(a).call(this,e.PATHSEG_CURVETO_CUBIC_REL,"c",n)))._x=r,h._y=i,h._x1=s,h._y1=c,h._x2=u,h._y2=d,h}return i(a,n),r(a,[{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 a(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),a}(e);Object.defineProperties(h.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var p=function(n){function a(n,r,i,s,c){var u;return t(this,a),(u=l(this,o(a).call(this,e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",n)))._x=r,u._y=i,u._x1=s,u._y1=c,u}return i(a,n),r(a,[{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 a(void 0,this._x,this._y,this._x1,this._y1)}}]),a}(e);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},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(n){function a(n,r,i,s,c){var u;return t(this,a),(u=l(this,o(a).call(this,e.PATHSEG_CURVETO_QUADRATIC_REL,"q",n)))._x=r,u._y=i,u._x1=s,u._y1=c,u}return i(a,n),r(a,[{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 a(void 0,this._x,this._y,this._x1,this._y1)}}]),a}(e);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 g=function(n){function a(n,r,i,s,c,u,d,h){var p;return t(this,a),(p=l(this,o(a).call(this,e.PATHSEG_ARC_ABS,"A",n)))._x=r,p._y=i,p._r1=s,p._r2=c,p._angle=u,p._largeArcFlag=d,p._sweepFlag=h,p}return i(a,n),r(a,[{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 a(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),a}(e);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 m=function(n){function a(n,r,i,s,c,u,d,h){var p;return t(this,a),(p=l(this,o(a).call(this,e.PATHSEG_ARC_REL,"a",n)))._x=r,p._y=i,p._r1=s,p._r2=c,p._angle=u,p._largeArcFlag=d,p._sweepFlag=h,p}return i(a,n),r(a,[{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 a(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),a}(e);Object.defineProperties(m.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},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(n){function a(n,r){var i;return t(this,a),(i=l(this,o(a).call(this,e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",n)))._x=r,i}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new a(void 0,this._x)}}]),a}(e);Object.defineProperty(v.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var y=function(n){function a(n,r){var i;return t(this,a),(i=l(this,o(a).call(this,e.PATHSEG_LINETO_HORIZONTAL_REL,"h",n)))._x=r,i}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new a(void 0,this._x)}}]),a}(e);Object.defineProperty(y.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var _=function(n){function a(n,r){var i;return t(this,a),(i=l(this,o(a).call(this,e.PATHSEG_LINETO_VERTICAL_ABS,"V",n)))._y=r,i}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new a(void 0,this._y)}}]),a}(e);Object.defineProperty(_.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var b=function(n){function a(n,r){var i;return t(this,a),(i=l(this,o(a).call(this,e.PATHSEG_LINETO_VERTICAL_REL,"v",n)))._y=r,i}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new a(void 0,this._y)}}]),a}(e);Object.defineProperty(b.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var x=function(n){function a(n,r,i,s,c){var u;return t(this,a),(u=l(this,o(a).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",n)))._x=r,u._y=i,u._x2=s,u._y2=c,u}return i(a,n),r(a,[{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 a(void 0,this._x,this._y,this._x2,this._y2)}}]),a}(e);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(n){function a(n,r,i,s,c){var u;return t(this,a),(u=l(this,o(a).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",n)))._x=r,u._y=i,u._x2=s,u._y2=c,u}return i(a,n),r(a,[{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 a(void 0,this._x,this._y,this._x2,this._y2)}}]),a}(e);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},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var S=function(n){function a(n,r,i){var s;return t(this,a),(s=l(this,o(a).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",n)))._x=r,s._y=i,s}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new a(void 0,this._x,this._y)}}]),a}(e);Object.defineProperties(S.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var k=function(n){function a(n,r,i){var s;return t(this,a),(s=l(this,o(a).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",n)))._x=r,s._y=i,s}return i(a,n),r(a,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new a(void 0,this._x,this._y)}}]),a}(e);Object.defineProperties(k.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 n(void 0)},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(e,t){return new a(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(e,t){return new s(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new c(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new u(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,r,a,i){return new d(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,r,a,i){return new h(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,r){return new p(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 g(void 0,e,t,n,r,a,i,o)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,r,a,i,o){return new m(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 y(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new _(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new b(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,r){return new x(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,r){return new w(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new S(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new k(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=n,window.SVGPathSegMovetoAbs=a,window.SVGPathSegMovetoRel=s,window.SVGPathSegLinetoAbs=c,window.SVGPathSegLinetoRel=u,window.SVGPathSegCurvetoCubicAbs=d,window.SVGPathSegCurvetoCubicRel=h,window.SVGPathSegCurvetoQuadraticAbs=p,window.SVGPathSegCurvetoQuadraticRel=f,window.SVGPathSegArcAbs=g,window.SVGPathSegArcRel=m,window.SVGPathSegLinetoHorizontalAbs=v,window.SVGPathSegLinetoHorizontalRel=y,window.SVGPathSegLinetoVerticalAbs=_,window.SVGPathSegLinetoVerticalRel=b,window.SVGPathSegCurvetoCubicSmoothAbs=x,window.SVGPathSegCurvetoCubicSmoothRel=w,window.SVGPathSegCurvetoQuadraticSmoothAbs=S,window.SVGPathSegCurvetoQuadraticSmoothRel=k}if(!("SVGPathSegList"in window&&"appendItem"in window.SVGPathSegList.prototype)){var C=function(){function e(n){t(this,e),this._pathElement=n,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 r(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 n=this,a=function(){function e(){t(this,e),this.pathSegList=[]}return r(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),i=function(){function e(n){t(this,e),this._string=n,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return r(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],t=this._pathSegTypeFromChar(e);if(t===SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand===SVGPathSeg.PATHSEG_UNKNOWN)return null;if((t=this._nextCommandHelper(e,this._previousCommand))===SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=t,t){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(n,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(n,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(n,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(n,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(n,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(n,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(n,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(n,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(n);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(n,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(n,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(n,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(n,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(n,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(n,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(n,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(n,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(n,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(n,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 a,s=new i(e);if(!s.initialCommandIsMoveTo())return[];for(;s.hasMoreData();){var l=s.parseSegment();if(!l)return[];o.appendSegment(l)}return o.pathSegList}}],[{key:"_pathSegArrayAsString",value:function(e){var t="",n=!0;return e.forEach((function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()})),t}}]),e}();C.prototype.classname="SVGPathSegList",Object.defineProperty(C.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new C(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=C}}();var f,g=jQuery,m=(Boolean(document.createElementNS&&document.createElementNS(h.SVG,"svg").createSVGRect),navigator.userAgent),v=document.createElementNS(h.SVG,"svg"),y=Boolean(window.opera),_=m.includes("AppleWebKit"),b=m.includes("Gecko/"),x=m.includes("MSIE"),w=m.includes("Chrome/"),S=(m.includes("Windows"),m.includes("Macintosh")),k="ontouchstart"in window,C=Boolean(v.querySelector),A=Boolean(document.evaluate),E=function(){var e=document.createElementNS(h.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}(),G=function(){var e=document.createElementNS(h.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}(),P=function(){var e=document.createElementNS(h.SVG,"svg"),t=document.createElementNS(h.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(h.SVG,"text");n.textContent="a",t.append(n);try{return 0===n.getStartPositionOfChar(0).x}catch(e){return!1}finally{e.remove()}}(),I=function(){var e=document.createElementNS(h.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(h.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}(),N=function(){var e=document.createElementNS(h.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(h.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(h.SVG,"path");n.setAttribute("d","M5,0 15,0");var r=document.createElementNS(h.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.width}(),T=(function(){var e=document.createElementNS(h.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");t||g.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.')}(),(f=document.createElementNS(h.SVG,"rect")).setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===f.style.vectorEffect),L=function(){var t=document.createElementNS(h.SVG,"rect").transform.baseVal,n=v.createSVGTransform();t.appendItem(n);var r=t.getItem(0),a=function(t){return t&&"object"===e(t)&&"function"==typeof t.setMatrix&&"angle"in t};return a(r)&&a(n)&&r.type===n.type&&r.angle===n.angle&&r.matrix.a===n.matrix.a&&r.matrix.b===n.matrix.b&&r.matrix.c===n.matrix.c&&r.matrix.d===n.matrix.d&&r.matrix.e===n.matrix.e&&r.matrix.f===n.matrix.f}(),M=function(){return y},O=function(){return _},j=function(){return b},V=function(){return x},R=function(){return w},B=function(){return S},D=function(){return k},U=function(){return N},F=function(){return T};function H(t){var n=t.fn.attr;return t.fn.attr=function(t,r){var a=this.length;if(!a)return n.call(this,t,r);for(var i=0;i<a;++i){var o=this[i];if("http://www.w3.org/2000/svg"!==o.namespaceURI)return n.call(this,t,r);if(void 0!==r)o.setAttribute(t,r);else if(Array.isArray(t)){for(var s={},l=t.length;l--;){var u=t[l],d=o.getAttribute(u);(d||"0"===d)&&(d=isNaN(d)?d:d-0),s[u]=d}return s}if("object"!==e(t)){var h=o.getAttribute(t);return(h||"0"===h)&&(h=isNaN(h)?h:h-0),h}for(var p=0,f=Object.entries(t);p<f.length;p++){var g=c(f[p],2),m=g[0],v=g[1];o.setAttribute(m,v)}}return this},t}var z=document.createElementNS(h.SVG,"svg");function q(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 Y,W={},X=function(){function e(n){t(this,e),this._elem=n||null,this._xforms=[],this._update=function(){for(var e="",t=0;t<this.numberOfItems;++t){e+=q(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=z.createSVGMatrix();Object.values(i).forEach((function(e,t){i[t]=parseFloat(e),"matrix"===n&&(s[o[t]]=i[t])}));var l=z.createSVGTransform(),c="set"+n.charAt(0).toUpperCase()+n.slice(1),d="matrix"===n?[s]:i;"scale"===n&&1===d.length?d.push(d[0]):"translate"===n&&1===d.length?d.push(0):"rotate"===n&&1===d.length&&d.push(0,0),l[c].apply(l,u(d)),e._list.appendItem(l)}()},this._removeFromOtherLists=function(e){e&&Object.values(W).some((function(t){for(var n=0,r=t._xforms.length;n<r;++n)if(t._xforms[n]===e)return t.removeItem(n),!0;return!1}))},this.numberOfItems=0}return r(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,a=new Array(this.numberOfItems+1);for(r=0;r<t;++r)a[r]=this._xforms[r];a[r]=e;for(var i=r+1;r<this.numberOfItems;++i,++r)a[i]=this._xforms[r];this.numberOfItems++,this._xforms=a,n=e,this._list._update()}else n=this._list.appendItem(e);return n}},{key:"replaceItem",value:function(e,t){var n=null;return t<this.numberOfItems&&t>=0&&(this._removeFromOtherLists(e),this._xforms[t]=e,n=e,this._list._update()),n}},{key:"removeItem",value:function(e){if(e<this.numberOfItems&&e>=0){var t,n=this._xforms[e],r=new Array(this.numberOfItems-1);for(t=0;t<e;++t)r[t]=this._xforms[t];for(var a=t;a<this.numberOfItems-1;++a,++t)r[a]=this._xforms[t+1];return this.numberOfItems--,this._xforms=r,this._list._update(),n}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}(),Q=function(e){e.id&&W[e.id]&&delete W[e.id]},K=function(e){if(!L){var t=e.id||"temp",n=W[t];return n&&"temp"!==t||(W[t]=new X(e),W[t]._init(),n=W[t]),n}return e.transform?e.transform.baseVal:e.gradientTransform?e.gradientTransform.baseVal:e.patternTransform?e.patternTransform.baseVal:null},Z=["x","x1","cx","rx","width"],$=["y","y1","cy","ry","height"],J=["r","radius"].concat(Z,$),ee={},te=function(){return ee},ne=function e(t){var n=Y.getRoundDigits();return isNaN(t)?Array.isArray(t)?e(t[0])+","+e(t[1]):parseFloat(t).toFixed(n)-0:Number(Number(t).toFixed(n))},re=function(e,t){return t=t||Y.getBaseUnit(),ne(e/ee[t])},ae=function(e,t,n){e.setAttribute(t,n)},ie=function(e,t){if(!isNaN(t))return t-0;if("%"===t.substr(-1)){var n=t.substr(0,t.length-1)/100,r=Y.getWidth(),a=Y.getHeight();return Z.includes(e)?n*r:$.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)*ee[i]},oe=function(e,t,n){if(J.includes(e))return!isNaN(t)||(t=t.toLowerCase(),Object.keys(ee).some((function(e){return new RegExp("^-?[\\d\\.]+"+e+"$").test(t)})));if("id"===e){var r=!1;try{var a=Y.getElement(t);r=nn(a)||a===n}catch(e){}return r}return!0},se={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"},le=function(){function e(){t(this,e)}return r(e,[{key:"getText",value:function(){return this.text}}]),e}(),ce=function(e){function n(e,r,a,i){var s;return t(this,n),(s=l(this,o(n).call(this))).elem=e,s.text=i?"Move "+e.tagName+" to "+i:"Move "+e.tagName,s.oldNextSibling=r,s.oldParent=a,s.newNextSibling=e.nextSibling,s.newParent=e.parentNode,s}return i(n,le),r(n,[{key:"type",value:function(){return"svgedit.history.MoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(se.BEFORE_APPLY,this),this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling),e&&e.handleHistoryEvent(se.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(se.BEFORE_UNAPPLY,this),this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling),e&&e.handleHistoryEvent(se.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),n}();ce.type=ce.prototype.type;var ue=function(e){function n(e,r){var a;return t(this,n),(a=l(this,o(n).call(this))).elem=e,a.text=r||"Create "+e.tagName,a.parent=e.parentNode,a.nextSibling=a.elem.nextSibling,a}return i(n,le),r(n,[{key:"type",value:function(){return"svgedit.history.InsertElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(se.BEFORE_APPLY,this),this.elem=this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(se.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(se.BEFORE_UNAPPLY,this),this.parent=this.elem.parentNode,this.elem=this.elem.parentNode.removeChild(this.elem),e&&e.handleHistoryEvent(se.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),n}();ue.type=ue.prototype.type;var de=function(e){function n(e,r,a,i){var s;return t(this,n),(s=l(this,o(n).call(this))).elem=e,s.text=i||"Delete "+e.tagName,s.nextSibling=r,s.parent=a,Q(e),s}return i(n,le),r(n,[{key:"type",value:function(){return"svgedit.history.RemoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(se.BEFORE_APPLY,this),Q(this.elem),this.parent=this.elem.parentNode,this.elem=this.parent.removeChild(this.elem),e&&e.handleHistoryEvent(se.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(se.BEFORE_UNAPPLY,this),Q(this.elem),nn(this.nextSibling)&&window.console&&console.log("Error: reference element was lost"),this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(se.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),n}();de.type=de.prototype.type;var he=function(e){function n(e,r,a){var i;for(var s in t(this,n),(i=l(this,o(n).call(this))).elem=e,i.text=a?"Change "+e.tagName+" "+a:"Change "+e.tagName,i.newValues={},i.oldValues=r,r)i.newValues[s]="#text"===s?e.textContent:"#href"===s?Lt(e):e.getAttribute(s);return i}return i(n,le),r(n,[{key:"type",value:function(){return"svgedit.history.ChangeElementCommand"}},{key:"apply",value:function(e){var t=this;e&&e.handleHistoryEvent(se.BEFORE_APPLY,this);var n=!1;if(Object.entries(this.newValues).forEach((function(e){var r=c(e,2),a=r[0],i=r[1];i?"#text"===a?t.elem.textContent=i:"#href"===a?Mt(t.elem,i):t.elem.setAttribute(a,i):"#text"===a?t.elem.textContent="":(t.elem.setAttribute(a,""),t.elem.removeAttribute(a)),"transform"===a&&(n=!0)})),!n){var r=Qt(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(se.AFTER_APPLY,this),!0}},{key:"unapply",value:function(e){var t=this;e&&e.handleHistoryEvent(se.BEFORE_UNAPPLY,this);var n=!1;if(Object.entries(this.oldValues).forEach((function(e){var r=c(e,2),a=r[0],i=r[1];i?"#text"===a?t.elem.textContent=i:"#href"===a?Mt(t.elem,i):t.elem.setAttribute(a,i):"#text"===a?t.elem.textContent="":t.elem.removeAttribute(a),"transform"===a&&(n=!0)})),!n){var r=Qt(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 Q(this.elem),e&&e.handleHistoryEvent(se.AFTER_UNAPPLY,this),!0}},{key:"elements",value:function(){return[this.elem]}}]),n}();he.type=he.prototype.type;var pe=function(e){function n(e){var r;return t(this,n),(r=l(this,o(n).call(this))).text=e||"Batch Command",r.stack=[],r}return i(n,le),r(n,[{key:"type",value:function(){return"svgedit.history.BatchCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(se.BEFORE_APPLY,this);for(var t=this.stack.length,n=0;n<t;++n)this.stack[n].apply(e);e&&e.handleHistoryEvent(se.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(se.BEFORE_UNAPPLY,this);for(var t=this.stack.length-1;t>=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(se.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}}]),n}();pe.type=pe.prototype.type;var fe,ge,me,ve,ye,_e=function(){function e(n){t(this,e),this.handler_=n||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return r(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];nn(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 pe("Change "+n),a=t.elements.length;a--;){var i=t.elements[a];if(!nn(i)){var o={};o[n]=t.oldValues[a],o[n]!==i.getAttribute(n)&&r.addSubCommand(new he(i,o,n))}}return this.undoableChangeStack[e]=null,r}}]),e}(),be=Object.freeze({__proto__:null,HistoryEventTypes:se,MoveElementCommand:ce,InsertElementCommand:ue,RemoveElementCommand:de,ChangeElementCommand:he,BatchCommand:pe,UndoManager:_e}),xe=document.createElementNS(h.SVG,"svg"),we=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},Se=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},ke=function(){for(var e=arguments.length,t=new 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},Ce=function(e){if(!e)return!1;for(var t=e.numberOfItems;t--;){var n=e.getItem(t);if(1===n.type&&!Se(n.matrix))return!0}return!1},Ae=function(e,t,n,r,a){var i=we(e,t,a),o=we(e+n,t,a),s=we(e,t+r,a),l=we(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}}},Ee=function(e,t,n){if(nn(e))return xe.createSVGTransformFromMatrix(xe.createSVGMatrix());if(t=t||0,n=n||e.numberOfItems-1,(t=parseInt(t))>(n=parseInt(n))){var r=n;n=t,t=r}for(var a=xe.createSVGMatrix(),i=t;i<=n;++i){var o=i>=0&&i<e.numberOfItems?e.getItem(i).matrix:xe.createSVGMatrix();a=ke(a,o)}return xe.createSVGTransformFromMatrix(a)},Ge=function(e){var t=K(e);return Ee(t).matrix},Pe=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}},Ie=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},Ne=jQuery,Te={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"]},Le={},Me=function(e){Object.assign(Le,e.ui)},Oe=[],je=!0,Ve={},Re=null,Be=null,De=function(e){Be=e,Oe=[0,"ClosePath"];Ne.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],(function(e,t){Oe.push(t+"Abs"),Oe.push(t+"Rel")}))},Ue=function(e,t,n){var r=e.pathSegList;if(G)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])}},Fe=function(e,t){return Te[e].map((function(e){return t[e]}))},He=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=we(r.x,r.y,n.matrix));var a=Be.getCurrentZoom();return r.x*=a,r.y*=a,r},ze=function(e,t){var n={x:e.x,y:e.y};t.matrix&&(e=we(n.x,n.y,t.imatrix),n.x=e.x,n.y=e.y);var r=Be.getCurrentZoom();return n.x/=r,n.y/=r,n},qe=function(e,t,n){var r=Ye(),a=Zt("pathpointgrip_"+e);if(!a){a=document.createElementNS(h.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 Le&&(i["xlink:title"]=Le.pathNodeTooltip),$t(a,i),a=r.appendChild(a),Ne("#pathpointgrip_"+e).dblclick((function(){Re&&Re.setSegType()}))}return t&&n&&$t(a,{cx:t,cy:n,display:"inline"}),a},Ye=function(){var e=Zt("pathpointgrip_container");e||((e=Zt("selectorParentGroup").appendChild(document.createElementNS(h.SVG,"g"))).id="pathpointgrip_container");return e},We=function(e){var t=Zt("ctrlpointgrip_"+e);if(t)return t;t=document.createElementNS(h.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 Le&&(n["xlink:title"]=Le.pathCtrlPtTooltip),$t(t,n),Ye().append(t),t},Xe=function(e){var t=Zt("ctrlLine_"+e);return t||(t=document.createElementNS(h.SVG,"line"),$t(t,{id:"ctrlLine_"+e,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),Ye().append(t),t)},Qe=function(e){var t=e.item,n=e.index;if(!("x1"in t&&"x2"in t))return null;var r={};Ye();for(var a=[Re.segs[n-1].item,t],i=1;i<3;i++){var o=n+"c"+i,s=r["c"+i+"_line"]=Xe(o),l=He(e,{x:t["x"+i],y:t["y"+i]}),c=He(e,{x:a[i-1].x,y:a[i-1].y});$t(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]=We(o);$t(u,{cx:l.x,cy:l.y,display:"inline"}),r["c"+i]=u}return r},Ke=function(e,t,n,r){var a=r||Re.elem,i=a["createSVGPathSeg"+Oe[e]].apply(a,u(n));if(E)a.pathSegList.replaceItem(i,t);else{for(var o=a.pathSegList,s=o.numberOfItems,l=[],c=0;c<s;c++){var d=o.getItem(c);l.push(d)}o.clear();for(var h=0;h<s;h++)h===t?o.appendItem(i):o.appendItem(l[h])}},Ze=function(e,t){var n=e.index,r=Zt("segline_"+n);if(!r){var a=Ye();r=document.createElementNS(h.SVG,"path"),$t(r,{id:"segline_"+n,display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"}),a.append(r)}if(t){var i=e.prev;if(!i)return r.setAttribute("display","none"),r;var o=He(i);Ke(2,0,[o.x,o.y],r);for(var s=Fe(e.type,e.item),l=0;l<s.length;l+=2){var c=He(e,{x:s[l],y:s[l+1]});s[l]=c.x,s[l+1]=c.y}Ke(e.type,1,s,r)}return r},$e=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=Be.getSVGRoot().createSVGPoint(),u=Be.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 p,f,g=Math.abs(d-h),m=Math.abs(Math.PI-g)/2;return d-h>0?(p=g<Math.PI?d+m:d-m,f=g<Math.PI?h-m:h+m):(p=g<Math.PI?d-m:d+m,f=g<Math.PI?h+m:h-m),c.x=s*Math.cos(p)+n.x,c.y=s*Math.sin(p)+n.y,u.x=l*Math.cos(f)+n.x,u.y=l*Math.sin(f)+n.y,[c,u]}},Je=function(){function e(n,r){t(this,e),this.selected=!1,this.index=n,this.item=r,this.type=r.pathSegType,this.ctrlpts=[],this.ptgrip=null,this.segsel=null}return r(e,[{key:"showCtrlPts",value:function(e){for(var t in this.ctrlpts)({}).hasOwnProperty.call(this.ctrlpts,t)&&this.ctrlpts[t].setAttribute("display",e?"inline":"none")}},{key:"selectCtrls",value:function(e){Ne("#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=qe(n);if(t){var a=He(e);$t(r,{cx:a.x,cy:a.y,display:"inline"})}return r}(this,!0),this.ctrlpts=Qe(this),this.segsel=Ze(this,!0)}},{key:"update",value:function(e){if(this.ptgrip){var t=He(this);$t(this.ptgrip,{cx:t.x,cy:t.y}),Ze(this,!0),this.ctrlpts&&(e&&(this.item=Re.elem.pathSegList.getItem(this.index),this.type=this.item.pathSegType),Qe(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(Ke(this.type,this.index,10===this.type?Fe(this.type,n):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];Ke(this.next.type,this.next.index,i)}if(this.mate){var o=this.mate.item,s=[o.x+=e,o.y+=t];Ke(this.mate.type,this.mate.index,s)}this.update(!0),this.next&&this.next.update(!0)}},{key:"setLinked",value:function(e){var t,n,r;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];Ke(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];Ke(this.type,this.index,a),this.update(!0)}},{key:"setType",value:function(e,t){Ke(e,this.index,t),this.type=e,this.item=Re.elem.pathSegList.getItem(this.index),this.showCtrlPts(6===e),this.ctrlpts=Qe(this),this.update(!0)}}]),e}(),et=function(){function e(n){if(t(this,e),!n||"path"!==n.tagName)throw new Error("svgedit.path.Path constructed without a <path> element");this.elem=n,this.segs=[],this.selected_pts=[],Re=this,this.init()}return r(e,[{key:"init",value:function(){Ne(Ye()).find("*").each((function(){Ne(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 Je(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(),nn(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,r,a,i=t.prev;switch(t.item.pathSegType){case 4:r=(t.item.x+i.item.x)/2,a=(t.item.y+i.item.y)/2,n=this.elem.createSVGPathSegLinetoAbs(r,a);break;case 6:var o=(i.item.x+t.item.x1)/2,s=(t.item.x1+t.item.x2)/2,l=(t.item.x2+t.item.x)/2,c=(o+s)/2,u=(s+l)/2;r=(c+u)/2;var d=(i.item.y+t.item.y1)/2,h=(t.item.y1+t.item.y2)/2,p=(t.item.y2+t.item.y)/2,f=(d+h)/2,g=(h+p)/2;a=(f+g)/2,n=this.elem.createSVGPathSegCurvetoCubicAbs(r,a,o,d,c,f);var m=[t.item.x,t.item.y,u,g,l,p];Ke(t.type,e,m)}Ue(this.elem,n,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];Ke(2,r.index,a),Ke(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];Ke(2,t.next.index,i),n.removeItem(e)}}},{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),je&&n.setLinked(this.dragctrl)}},{key:"setSegType",value:function(e){this.storeD();for(var t,n=this.selected_pts.length;n--;){var r=this.selected_pts[n],a=this.segs[r],i=a.prev;if(i){if(!e)t="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,p=s-c;u=[o,s,l+h/3,c+p/3,o-h/3,s-p/3]}break;case 4:u=[o,s],a.olditem=a.item}a.setType(e,u)}}Re.endChanges(t)}},{key:"selectPt",value:function(e,t){this.clearSelection(),nn(e)&&this.eachSeg((function(t){this.prev&&(e=t)})),this.addPtsToSelection(e),t&&(this.dragctrl=t,je&&this.segs[e].setLinked(t))}},{key:"update",value:function(){var e=this.elem;return Qt(e)?(this.matrix=Ge(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){O()&&Be.resetD(this.elem);var t=new he(this.elem,{d:this.last_d},e);Be.endChanges({cmd:t,elem:this.elem})}},{key:"addPtsToSelection",value:function(t){var n=this;Array.isArray(t)||(t=[t]),t.forEach((function(e){n.segs[e].ptgrip&&!n.selected_pts.includes(e)&&e>=0&&n.selected_pts.push(e)})),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=e.subpathIsClosed(this.selected_pts[0]);Be.addPtsToSelection({grips:a,closedSubpath:s})}}],[{key:"subpathIsClosed",value:function(e){var t=!1;return Re.eachSeg((function(n){return n<=e||2!==this.type&&(1!==this.type||(t=!0,!1))})),t}}]),e}(),tt=function(e){var t=Ve[e.id];return t||(t=Ve[e.id]=new et(e)),t},nt=function(e){e in Ve&&delete Ve[e]},rt=function(e,t){var n=e-me,r=t-ve,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)+ye;return n=a*Math.cos(i)+me,r=a*Math.sin(i)+ve,n-=fe,r-=ge,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)-ye,{x:a*Math.cos(i)+fe,y:a*Math.sin(i)+ge}},at=function(){var e=Re.elem;if(ye=Qt(e,!0)){var t=Re.oldbbox;me=t.x+t.width/2,ve=t.y+t.height/2;var n=Rt(e);fe=n.x+n.width/2,ge=n.y+n.height/2;var r=fe-me,a=ge-ve,i=Math.sqrt(r*r+a*a),o=Math.atan2(a,r)+ye;fe=i*Math.cos(o)+me,ge=i*Math.sin(o)+ve;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var c=s.getItem(l),u=c.pathSegType;if(1!==u){var d=rt(c.x,c.y),h=[d.x,d.y];if(!nn(c.x1)&&!nn(c.x2)){var p=rt(c.x1,c.y1),f=rt(c.x2,c.y2);h.splice(h.length,0,p.x,p.y,f.x,f.y)}Ke(u,l,h)}}Rt(e);var g=Be.getSVGRoot().createSVGTransform(),m=K(e);g.setRotate(180*ye/Math.PI,fe,ge),m.replaceItem(g,0)}},it=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],ot=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,p=c.y1||0,f=c.x2||0,g=c.y2||0,m=c.pathSegType,v=it[m]["to"+(t?"Lower":"Upper")+"Case"]();switch(m){case 1:o+="z",s&&!t&&(a=s[0],i=s[1]);break;case 12:u-=a;case 13:t?(a+=u,v="l"):(a=u+=a,v="L"),o+=st(v,[[u,i]]);break;case 14:d-=i;case 15:t?(i+=d,v="l"):(i=d+=i,v="L"),o+=st(v,[[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!==m&&3!==m||(s=[a,i]),o+=st(v,[[u,d]]);break;case 6:u-=a,h-=a,f-=a,d-=i,p-=i,g-=i;case 7:t?(a+=u,i+=d):(h+=a,f+=a,p+=i,g+=i,a=u+=a,i=d+=i),o+=st(v,[[h,p],[f,g],[u,d]]);break;case 8:u-=a,h-=a,d-=i,p-=i;case 9:t?(a+=u,i+=d):(h+=a,p+=i,a=u+=a,i=d+=i),o+=st(v,[[h,p],[u,d]]);break;case 10:u-=a,d-=i;case 11:t?(a+=u,i+=d):(a=u+=a,i=d+=i),o+=st(v,[[c.r1,c.r2]],[c.angle,c.largeArcFlag?1:0,c.sweepFlag?1:0],[u,d]);break;case 16:u-=a,f-=a,d-=i,g-=i;case 17:t?(a+=u,i+=d):(f+=a,g+=i,a=u+=a,i=d+=i),o+=st(v,[[f,g],[u,d]])}}return o};function st(e,t,n,r){Ne.each(t,(function(e,n){t[e]=ne(n)}));var a=e+t.join(" ");return n&&(a+=" "+n.join(" ")),r&&(a+=" "+ne(r)),a}var lt,ct,ut,dt,ht,pt=(ut=!1,dt=null,ht=!1,{mouseDown:function(e,t,n,r){var a;if("path"!==Be.getCurrentMode()){if(Re){var i;if(Re.storeD(),"pathpointgrip_"===(a=e.target.id).substr(0,14)){i=Re.cur_pt=parseInt(a.substr(14)),Re.dragging=[n,r];var o=Re.segs[i];e.shiftKey?o.selected?Re.removePtFromSelection(i):Re.addPtsToSelection(i):((Re.selected_pts.length<=1||!o.selected)&&Re.clearSelection(),Re.addPtsToSelection(i))}else if(a.startsWith("ctrlpointgrip_")){Re.dragging=[n,r];var s=a.split("_")[1].split("c");i=Number(s[0]);var l=Number(s[1]);Re.selectPt(i,l)}if(!Re.dragging){var c=Be.getRubberBox();nn(c)&&(c=Be.setRubberBox(Be.selectorManager.getRubberBandBox()));var u=Be.getCurrentZoom();$t(c,{x:n*u,y:r*u,width:0,height:0,display:"inline"})}}}else{var d=n,p=r,f=Be.getCurrentZoom(),g=d/f,m=p/f,v=Zt("path_stretch_line");lt=[g,m],Be.getGridSnapping()&&(g=en(g),m=en(m),d=en(d),p=en(p)),v||(v=document.createElementNS(h.SVG,"path"),$t(v,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}),v=Zt("selectorParentGroup").appendChild(v)),v.setAttribute("display","inline");var y,_=Be.getDrawnPath();if(_){for(var b=_.pathSegList,x=b.numberOfItems,w=6/f,S=!1;x;){x--;var k=b.getItem(x),C=k.x,A=k.y;if(g>=C-w&&g<=C+w&&m>=A-w&&m<=A+w){S=!0;break}}a=Be.getId(),nt(a);var E,G,P=Zt(a),I=b.numberOfItems;if(S){if(x<=1&&I>=2){var N=b.getItem(0).x,T=b.getItem(0).y;E=4===(G=v.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(N,T):_.createSVGPathSegCurvetoCubicAbs(N,T,G.x1/f,G.y1/f,N,T);var L=_.createSVGPathSegClosePath();b.appendItem(E),b.appendItem(L)}else if(I<3)return!1;if(Ne(v).remove(),Be.setDrawnPath(null),Be.setStarted(!1),ut){Re.matrix&&Be.remapElement(P,{},Re.matrix.inverse());var M=P.getAttribute("d"),O=Ne(Re.elem).attr("d");return Ne(Re.elem).attr("d",O+M),Ne(P).remove(),Re.matrix&&at(),De(),pt.toEditMode(Re.elem),Re.selectPt(),!1}}else{if(!Ne.contains(Be.getContainer(),Be.getMouseTarget(e)))return!1;var j=_.pathSegList.numberOfItems,V=_.pathSegList.getItem(j-1),R=V.x,B=V.y;if(e.shiftKey){var D=Pe(R,B,g,m);g=D.x,m=D.y}E=4===(G=v.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(Be.round(g),Be.round(m)):_.createSVGPathSegCurvetoCubicAbs(Be.round(g),Be.round(m),G.x1/f,G.y1/f,G.x2/f,G.y2/f),_.pathSegList.appendItem(E),g*=f,m*=f,v.setAttribute("d",["M",g,m,g,m].join(" ")),y=j,ut&&(y+=Re.segs.length),qe(y,g,m)}}else{var U="M"+g+","+m+" ";Be.setDrawnPath(Be.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:U,id:Be.getNextId(),opacity:Be.getOpacity()/2}})),v.setAttribute("d",["M",d,p,d,p].join(" ")),y=ut?Re.segs.length:0,qe(y,d,p)}}},mouseMove:function(e,t){var n=Be.getCurrentZoom();ht=!0;var r=Be.getDrawnPath();if("path"!==Be.getCurrentMode())if(Re.dragging){var a=ze({x:Re.dragging[0],y:Re.dragging[1]},Re),i=ze({x:e,y:t},Re),o=i.x-a.x,s=i.y-a.y;Re.dragging=[e,t],Re.dragctrl?Re.moveCtrl(o,s):Re.movePts(o,s)}else Re.selected_pts=[],Re.eachSeg((function(e){if(this.next||this.prev){var t=Be.getRubberBox().getBBox(),n=He(this),r={x:n.x,y:n.y,width:0,height:0},a=Ie(t,r);this.select(a),a&&Re.selected_pts.push(this.index)}}));else{if(!r)return;var l=r.pathSegList,c=l.numberOfItems-1;if(lt){var u=We("1c1"),d=We("0c2");u.setAttribute("cx",e),u.setAttribute("cy",t),u.setAttribute("display","inline");var h=lt[0],p=lt[1],f=h+(h-e/n),g=p+(p-t/n);d.setAttribute("cx",f*n),d.setAttribute("cy",g*n),d.setAttribute("display","inline");var m=Xe(1);if($t(m,{x1:e,y1:t,x2:f*n,y2:g*n,display:"inline"}),0===c)ct=[e,t];else{var v=l.getItem(c-1),y=v.x,_=v.y;6===v.pathSegType?(y+=y-v.x2,_+=_-v.y2):ct&&(y=ct[0]/n,_=ct[1]/n),Ke(6,c,[h,p,y,_,f,g],r)}}else{var b=Zt("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);Ke(6,1,[e,t,w*n,S*n,e,t],b)}else ct?Ke(6,1,[e,t,ct[0],ct[1],e,t],b):Ke(4,1,[e,t],b)}}}},mouseUp:function(e,t,n,r){var a=Be.getDrawnPath();if("path"===Be.getCurrentMode())return lt=null,a||(t=Zt(Be.getId()),Be.setStarted(!1),ct=null),{keep:!0,element:t};var i=Be.getRubberBox();if(Re.dragging){var o=Re.cur_pt;Re.dragging=!1,Re.dragctrl=!1,Re.update(),ht&&Re.endChanges("Move path point(s)"),e.shiftKey||ht||Re.selectPt(o)}else i&&"none"!==i.getAttribute("display")?(i.setAttribute("display","none"),i.getAttribute("width")<=2&&i.getAttribute("height")<=2&&pt.toSelectMode(e.target)):pt.toSelectMode(e.target);ht=!1},toEditMode:function(e){Re=tt(e),Be.setCurrentMode("pathedit"),Be.clearSelection(),Re.show(!0).update(),Re.oldbbox=Rt(Re.elem),ut=!1},toSelectMode:function(e){var t=e===Re.elem;Be.setCurrentMode("select"),Re.show(!1),dt=!1,Be.clearSelection(),Re.matrix&&at(),t&&(Be.call("selected",[e]),Be.addToSelection([e],!0))},addSubPath:function(e){e?(Be.setCurrentMode("path"),ut=!0):(pt.clear(!0),pt.toEditMode(Re.elem))},select:function(e){dt===e?(pt.toEditMode(e),Be.setCurrentMode("pathedit")):dt=e},reorient:function(){var e=Be.getSelectedElements()[0];if(e&&0!==Qt(e)){var t=new pe("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new he(e,n)),Be.clearSelection(),this.resetOrientation(e),Be.addCommandToHistory(t),tt(e).show(!1).matrix=null,this.clear(),Be.addToSelection([e],!0),Be.call("changed",Be.getSelectedElements())}},clear:function(e){var t=Be.getDrawnPath();if(dt=null,t){var n=Zt(Be.getId());Ne(Zt("path_stretch_line")).remove(),Ne(n).remove(),Ne(Zt("pathpointgrip_container")).find("*").attr("display","none"),ct=null,Be.setDrawnPath(null),Be.setStarted(!1)}else"pathedit"===Be.getCurrentMode()&&this.toSelectMode();Re&&Re.init().show(!1)},resetOrientation:function(e){if(nn(e)||"path"!==e.nodeName)return!1;var t=K(e),n=Ee(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=[];Ne.each(["",1,2],(function(e,t){var r=a["x"+t],i=a["y"+t];if(void 0!==r&&void 0!==i){var s=we(r,i,n);o.splice(o.length,0,s.x,s.y)}})),Ke(i,t,o,e)},o=0;o<a;++o)i(o);!function(e,t){for(var n=Rt(e),r=0;r<2;r++){var a=0===r?"fill":"stroke",i=e.getAttribute(a);if(i&&i.startsWith("url(")){var o=Kt(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=we(s,l,t),h=we(c,u,t),p={x1:(d.x-n.x)/n.width,y1:(d.y-n.y)/n.height,x2:(h.x-n.x)/n.width,y2:(h.y-n.y)/n.height},f=o.cloneNode(!0);Ne(f).attr(p),f.id=Be.getNextId(),Ot().append(f),e.setAttribute(a,"url(#"+f.id+")")}}}}(e,n)},zoomChange:function(){"pathedit"===Be.getCurrentMode()&&Re.update()},getNodePoint:function(){var e=Re.selected_pts.length?Re.selected_pts[0]:1,t=Re.segs[e];return{x:t.item.x,y:t.item.y,type:t.type}},linkControlPoints:function(e){je=e},clonePathNode:function(){Re.storeD();for(var e=Re.selected_pts,t=e.length,n=[];t--;){var r=e[t];Re.addSeg(r),n.push(r+t),n.push(r+t+1)}Re.init().addPtsToSelection(n),Re.endChanges("Clone path node(s)")},opencloseSubPath:function(){var e=Re.selected_pts;if(1===e.length){var t,n,r=Re.elem,a=r.pathSegList,i=e[0],o=null,s=null;if(Re.eachSeg((function(e){return 2===this.type&&e<=i&&(s=this.item),e<=i||(2===this.type?(o=e,!1):1!==this.type||(o=!1,!1))})),nn(o)&&(o=Re.segs.length-1),!1!==o){var l=r.createSVGPathSegLinetoAbs(s.x,s.y),c=r.createSVGPathSegClosePath();return o===Re.segs.length-1?(a.appendItem(l),a.appendItem(c)):(Ue(r,c,o),Ue(r,l,o)),void Re.init().selectPt(o+1)}if(Re.segs[i].mate)return a.removeItem(i),a.removeItem(i),void Re.init().selectPt(i-1);for(var u=0;u<a.numberOfItems;u++){var d=a.getItem(u);if(2===d.pathSegType)t=u;else if(u===i)a.removeItem(t);else if(1===d.pathSegType&&i<u){n=u-1,a.removeItem(u);break}}for(var h=i-t-1;h--;)Ue(r,a.getItem(t),n);var p=a.getItem(t);Ke(2,t,[p.x,p.y]),Re.init().selectPt(0)}},deletePathNode:function(){if(pt.canDeleteNodes){Re.storeD();for(var e=Re.selected_pts,t=e.length;t--;){var n=e[t];Re.deleteSeg(n)}if(function e(){var t=Re.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}(),Re.elem.pathSegList.numberOfItems<=1)return pt.toSelectMode(Re.elem),void Be.canvas.deleteSelectedElements();if(Re.init(),Re.clearSelection(),window.opera){var r=Ne(Re.elem);r.attr("d",r.attr("d"))}Re.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t,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=$e(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=Be.addSVGElementFromJson({element:"path",curStyles:!0,attr:{id:Be.getId(),d:o,fill:"none"}})}return e},setSegType:function(e){Re.setSegType(e)},moveNode:function(e,t){var n=Re.selected_pts;if(n.length){Re.storeD();var r=Re.segs[n[0]],a={x:0,y:0};a[e]=t-r.item[e],r.move(a.x,a.y),Re.endChanges("Move path point")}},fixEnd:function(e){for(var t,n=e.pathSegList,r=n.numberOfItems,a=0;a<r;++a){var i=n.getItem(a);if(2===i.pathSegType&&(t=i),1===i.pathSegType){var o=n.getItem(a-1);if(o.x!==t.x||o.y!==t.y){var s=e.createSVGPathSegLinetoAbs(t.x,t.y);Ue(e,s,a),pt.fixEnd(e);break}}}O()&&Be.resetD(e)},convertPath:ot}),ft=H(jQuery),gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",mt="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),vt=null,yt=null,_t=null,bt=null,xt=function(e){return e.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/,"$1$2")},wt=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")};function St(e){if(e=At(e),window.btoa)return window.btoa(e);var t=new Array(4*Math.floor((e.length+2)/3)),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=64,u=64):isNaN(o)&&(u=64),t[r++]=gt.charAt(s),t[r++]=gt.charAt(l),t[r++]=gt.charAt(c),t[r++]=gt.charAt(u)}while(n<e.length);return t.join("")}function kt(e){if(window.atob)return Ct(window.atob(e));e=e.replace(/[^A-Za-z0-9+\/=]/g,"");var t="",n=0;do{var r=gt.indexOf(e.charAt(n++)),a=gt.indexOf(e.charAt(n++)),i=gt.indexOf(e.charAt(n++)),o=gt.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 Ct(t)}function Ct(e){return decodeURIComponent(escape(e))}var At=function(e){return unescape(encodeURIComponent(e))},Et=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)},Gt=function(e){return e&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(e):""},Pt=function(){if("undefined"==typeof Blob)return"";var e=new Blob(["<html><head><title>SVG-edit</title></head><body> </body></html>"],{type:"text/html"});return Gt(e)}(),It=function(e){var t,n;e.includes("<svg:svg")&&(e=e.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns"));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},Nt=function e(t,n){if(t&&1===t.nodeType){n(t);for(var r=t.childNodes.length;r--;)e(t.childNodes.item(r),n)}},Tt=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},Lt=function(e){return e.getAttributeNS(h.XLINK,"href")},Mt=function(e,t){e.setAttributeNS(h.XLINK,"xlink:href",t)},Ot=function(){var e=vt.getSVGContent(),t=e.getElementsByTagNameNS(h.SVG,"defs");return t.length>0?t=t[0]:(t=e.ownerDocument.createElementNS(h.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.append(t)),t},jt=function(e){for(var t=e.pathSegList,n=t.numberOfItems,r=[[],[]],a=t.getItem(0),i=[a.x,a.y],o=function(e,t,n,r){return function(a){return 1-Math.pow(a,3)*i[e]+3-Math.pow(a,2)*a*t[e]+3*(1-a)*Math.pow(a,2)*n[e]+Math.pow(a,3)*r[e]}},s=0;s<n;s++){var l=t.getItem(s);if(void 0!==l.x)if(r[0].push(i[0]),r[1].push(i[1]),l.x1){for(var c=[l.x1,l.y1],u=[l.x2,l.y2],d=[l.x,l.y],h=0;h<2;h++){var p=o(h,c,u,d),f=6*i[h]-12*c[h]+6*u[h],g=-3*i[h]+9*c[h]-9*u[h]+3*d[h],m=3*c[h]-3*i[h];if(0!==g){var v=Math.pow(f,2)-4*m*g;if(!(v<0)){var y=(-f+Math.sqrt(v))/(2*g);y>0&&y<1&&r[h].push(p(y));var _=(-f-Math.sqrt(v))/(2*g);_>0&&_<1&&r[h].push(p(_))}}else{if(0===f)continue;var b=-m/f;b>0&&b<1&&r[h].push(p(b))}}i=d}else r[0].push(l.x),r[1].push(l.y)}var x=Math.min.apply(null,r[0]),w=Math.max.apply(null,r[0])-x,S=Math.min.apply(null,r[1]);return{x:x,y:S,width:w,height:Math.max.apply(null,r[1])-S}};function Vt(e){if(U())try{return e.getBBox()}catch(e){}var t,n,r=ft.data(e,"ref"),a=null;r?(n=ft(r).children().clone().attr("visibility","hidden"),ft(bt).append(n),a=n.filter("line, path")):a=ft(e).find("line, path");var i=!1;if(a.length)if(a.each((function(){var e=this.getBBox();e.width&&e.height||(i=!0)})),i){var o=r?n:ft(e).children();t=qt(o)}else t=e.getBBox();else t=e.getBBox();return r&&n.remove(),t}var Rt=function(e){var t=e||vt.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":I?t.getBBox&&(a=t.getBBox()):a=jt(t);break;case"g":case"a":a=Vt(t);break;default:if("use"===r&&(a=Vt(t)),"use"===r||"foreignObject"===r&&O()){if(a||(a=t.getBBox()),!O()){var i=a,o=i.x,s=i.y;a={width:i.width,height:i.height,x:o+parseFloat(t.getAttribute("x")||0),y:s+parseFloat(t.getAttribute("y")||0)}}}else if(mt.includes(r))if(t)try{a=t.getBBox()}catch(e){var l=t.getExtentOfChar(0),c=t.getComputedTextLength();a={x:l.x,y:l.y,width:c,height:l.height}}else{var u=ft(t).closest("foreignObject");u.length&&u[0].getBBox&&(a=u[0].getBBox())}}return a&&(a={x:(n=a).x,y:n.y,width:n.width,height:n.height}),a},Bt=function(e){var t="";return ft.each(e,(function(e,n){var r=c(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},Dt=function(e){var t,n,r,a,i=1.81;switch(e.tagName){case"ellipse":case"circle":var o=n=ft(e).attr(["rx","ry","cx","cy"]),s=o.cx,l=o.cy,c=n;r=c.rx,a=c.ry,"circle"===e.tagName&&(r=a=ft(e).attr("r")),t=Bt([["M",[s-r,l]],["C",[s-r,l-a/i,s-r/i,l-a,s,l-a]],["C",[s+r/i,l-a,s+r,l-a/i,s+r,l]],["C",[s+r,l+a/i,s+r/i,l+a,s,l+a]],["C",[s-r/i,l+a,s-r,l+a/i,s-r,l]],["Z",[]]]);break;case"path":t=e.getAttribute("d");break;case"line":t="M"+(n=ft(e).attr(["x1","y1","x2","y2"])).x1+","+n.y1+"L"+n.x2+","+n.y2;break;case"polyline":t="M"+e.getAttribute("points");break;case"polygon":t="M"+e.getAttribute("points")+" Z";break;case"rect":var u=ft(e).attr(["rx","ry"]);r=u.rx,a=u.ry;var d=e.getBBox(),h=d.x,p=d.y,f=d.width,g=d.height;i=4-i,t=Bt(r||a?[["M",[h,p+a]],["C",[h,p+a/i,h+r/i,p,h+r,p]],["L",[h+f-r,p]],["C",[h+f-r/i,p,h+f,p+a/i,h+f,p+a]],["L",[h+f,p+g-a]],["C",[h+f,p+g-a/i,h+f-r/i,p+g,h+f-r,p+g]],["L",[h+r,p+g]],["C",[h+r/i,p+g,h,p+g-a/i,h,p+g-a]],["L",[h,p+a]],["Z",[]]]:[["M",[h,p]],["L",[h+f,p]],["L",[h+f,p+g]],["L",[h,p+g]],["L",[h,p]],["Z",[]]])}return t},Ut=function(e){var t={};return ft.each(["marker-start","marker-end","marker-mid","filter","clip-path"],(function(){var n=e.getAttribute(this);n&&(t[this]=n)})),t},Ft=function(e,t,n){var r=t({element:"path",attr:Ut(e)}),a=e.getAttribute("transform");a&&r.setAttribute("transform",a);var i=e.parentNode;e.nextSibling?e.before(r):i.append(r);var o=Dt(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 Ht=function(e,t,n){var r=Rt(e);if(!r)return null;var a=K(e),i=Xt(a),o=Ce(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=Ft(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(r=s=Ft(e,t,n))}}if(!s){var u=Ee(a).matrix;r=Ae(r.x,r.y,r.width,r.height,u).aabox}}return r};function zt(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var qt=function(e,t,n){if(!e||!e.length)return!1;var r;if(ft.each(e,(function(){r||this.parentNode&&(r=Ht(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=zt(e[0]);o-=l,s-=l,a+=l,i+=l}else ft.each(e,(function(e,r){var l=Ht(r,t,n);if(l){var c=zt(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},Yt=function(e){e||(e=ft(vt.getSVGContent()).children());var t=[];return ft(e).children().each((function(e,n){n.getBBox&&t.push(n)})),t.reverse()},Wt=function(e){return e||(e=Yt()),qt(e,vt.addSVGElementFromJson,vt.pathActions)},Xt=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},Qt=function(e,t){var n=e||vt.getSelectedElements()[0],r=K(n);return Xt(r,t)},Kt=function(e){return Zt(Tt(e).substr(1))},Zt=C?function(e){return bt.querySelector("#"+e)}:A?function(e){return yt.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+e+'"]',_t,(function(){return h.SVG}),9,null).singleNodeValue}:function(e){return ft(bt).find("[id="+e+"]")[0]},$t=function(e,t,n,r){for(var a=0,i=Object.entries(t);a<i.length;a++){var o=c(i[a],2),s=o[0],l=o[1],u="xml:"===s.substr(0,4)?h.XML:"xlink:"===s.substr(0,6)?h.XLINK:null;u?e.setAttributeNS(u,s,l):r?ae(e,s,l):e.setAttribute(s,l)}},Jt=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};"ellipse"===e.nodeName&&(delete t.rx,delete t.ry),Object.entries(t).forEach((function(t){var n=c(t,2),r=n[0],a=n[1];e.getAttribute(r)===String(a)&&e.removeAttribute(r)}))},en=function(e){var t=vt.getBaseUnit(),n=vt.getSnappingStep();return"px"!==t&&(n*=te()[t]),e=Math.round(e/n)*n},tn=function(e){ft(e).click((function(e){e.preventDefault()}))},nn=function(e){return null==e},rn=jQuery,an={},on=function(){Object.values(an).forEach((function(e){!function(e){Object.keys(an).length||rn("#cmenu_canvas").append("<li class='separator'>");var t=e.shortcut||"";rn("#cmenu_canvas").append("<li class='disabled'><a href='#"+e.id+"'>"+e.label+"<span class='shortcut'>"+t+"</span></a></li>")}(e)}))};function sn(e,t){["id","class","type"].forEach((function(n){n in t&&(e[n]=t[n])}))}function ln(e,t){return cn(e,a({},t,{returnDefault:!0}))}function cn(e,t){var n,r;return regeneratorRuntime.async((function(a){for(;;)switch(a.prev=a.next){case 0:if(n=t.global,r=t.returnDefault,!!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)){a.next=4;break}return a.abrupt("return",dn(e,void 0,{returnDefault:r}));case 4:return a.next=6,regeneratorRuntime.awrap(un(e));case 6:return a.abrupt("return",window[n]);case 7:case"end":return a.stop()}}))}function un(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?Promise.all(e.map((function(e){return un(e,t)}))):new Promise((function(n,r){var a=document.createElement("script");function i(){r(new Error("Failed to import: ".concat(e))),s()}function o(){n(),s()}var s=function(){a.removeEventListener("error",i),a.removeEventListener("load",o),a.remove(),a.src=""};a.defer="defer",sn(a,t),a.addEventListener("error",i),a.addEventListener("load",o),a.src=e,document.head.append(a)}))}function dn(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 dn(e,t)}))):new Promise((function(n,a){var i="$importModule$"+Math.random().toString(32).slice(2),o=document.createElement("script");function s(){a(new Error("Failed to import: ".concat(e))),c()}function l(){n(window[i]),c()}var c=function(){delete window[i],o.removeEventListener("error",s),o.removeEventListener("load",l),o.remove(),URL.revokeObjectURL(o.src),o.src=""};sn(o,t),o.defer="defer",o.type="module",o.addEventListener("error",s),o.addEventListener("load",l);var u=function(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}(e),d="import * as m from '".concat(u.replace(/'/g,"\\'"),"'; window.").concat(i," = ").concat(r?"m.default || ":"","m;"),h=new Blob([d],{type:"text/javascript"});o.src=URL.createObjectURL(h),document.head.append(o)}))}function hn(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ok:"Ok",cancel:"Cancel"};t("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");var r=t("#dialog_box"),a=t("#dialog_buttons"),i=t("#dialog_content");function o(o,s,l,c,u,d){i.html("<p>"+s.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt","prompt"===o),a.empty();var h=t('<input type="button" data-ok="" value="'+n.ok+'">').appendTo(a);return new Promise((function(p,f){var g,m;if("alert"!==o&&t('<input type="button" value="'+n.cancel+'">').appendTo(a).click((function(){r.hide(),p(!1)})),"prompt"===o)(g=t('<input type="text">').prependTo(a)).val(l||""),g.bind("keydown","return",(function(){h.click()}));else if("select"===o){var v=t('<div style="text-align:center;">');if(g=t('<select aria-label="'.concat(s,'">')).appendTo(v),d){var y=t("<label>").text(d.label);(m=t('<input type="checkbox">').appendTo(y)).val(d.value),d.tooltip&&y.attr("title",d.tooltip),m.prop("checked",Boolean(d.checked)),v.append(t("<div>").append(y))}t.each(c||[],(function(n,r){"object"===e(r)?g.append(t("<option>").val(r.value).html(r.text)):g.append(t("<option>").html(r))})),i.append(v),l&&g.val(l),u&&g.bind("change","return",u),g.bind("keydown","return",(function(){h.click()}))}else"process"===o&&h.hide();r.show(),h.click((function(){r.hide();var e="prompt"!==o&&"select"!==o||g.val();p(m?{response:e,checked:m.prop("checked")}:e)})).focus(),"prompt"!==o&&"select"!==o||g.focus()}))}return t.alert=function(e){return o("alert",e)},t.confirm=function(e){return o("confirm",e)},t.process_cancel=function(e){return o("process",e)},t.prompt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return o("prompt",e,t)},t.select=function(e,t,n,r,a){return o("select",e,r,t,n,a)},t}var pn=jQuery,fn=function(){function e(n,r,a){if(t(this,e),this.name_=n,this.group_=a?null:r,a){var i=a.ownerDocument;this.group_=i.createElementNS(h.SVG,"g");var o=i.createElementNS(h.SVG,"title");o.textContent=n,this.group_.append(o),r?pn(r).after(this.group_):a.append(this.group_)}gn(this.group_),Nt(this.group_,(function(e){e.setAttribute("style","pointer-events:inherit")})),this.group_.setAttribute("style",a?"pointer-events:all":"pointer-events:none")}return r(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 nn(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){var t=!0,n=!1,r=void 0;try{for(var a,i=e[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;this.group_.append(o)}}catch(e){n=!0,r=e}finally{try{t||null==i.return||i.return()}finally{if(n)throw r}}}},{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=wt(e);var r=this.getTitleElement();return r?(pn(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 gn(e){var t=e.getAttribute("class");nn(t)||!t.length?e.setAttribute("class",fn.CLASS_NAME):fn.CLASS_REGEX.test(t)||e.setAttribute("class",t+" "+fn.CLASS_NAME)}fn.CLASS_NAME="layer",fn.CLASS_REGEX=new RegExp("(\\s|^)"+fn.CLASS_NAME+"(\\s|$)");var mn=function(){function e(n){t(this,e),this.undoManager_=n,this.currentBatchCommand_=null,this.batchCommandStack_=[]}return r(e,[{key:"startBatchCommand",value:function(e){return this.undoManager_?(this.currentBatchCommand_=new pe(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 ce(e,t,n,r)),this):this}},{key:"insertElement",value:function(e,t){return this.undoManager_?(this.addCommand_(new ue(e,t)),this):this}},{key:"removeElement",value:function(e,t,n,r){return this.undoManager_?(this.addCommand_(new de(e,t,n,r)),this):this}},{key:"changeElement",value:function(e,t,n){return this.undoManager_?(this.addCommand_(new he(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}();mn.NO_HISTORY=new mn;var vn=jQuery,yn="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),_n={LET_DOCUMENT_DECIDE:0,ALWAYS_RANDOMIZE:1,NEVER_RANDOMIZE:2},bn=_n.LET_DOCUMENT_DECIDE,xn=[];function wn(e){return e||new mn(kn.undoMgr)}function Sn(e){for(var t=1;e.includes("Layer "+t);)t++;return"Layer "+t}var kn,Cn=function(){function e(n,r){if(t(this,e),!n||!n.tagName||!n.namespaceURI||"svg"!==n.tagName||n.namespaceURI!==h.SVG)throw new Error("Error: svgedit.draw.Drawing instance initialized without a <svg> element");this.svgElem_=n,this.obj_num=0,this.idPrefix=r||"svg_",this.releasedNums=[],this.all_layers=[],this.layer_map={},this.current_layer=null,this.nonce_="";var a=this.svgElem_.getAttributeNS(h.SE,"nonce");a&&bn!==_n.NEVER_RANDOMIZE?this.nonce_=a:bn===_n.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(100001*Math.random()))}return r(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):vn(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(h.XMLNS,"xmlns:se",h.SE),this.svgElem_.setAttributeNS(h.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));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,n=this.getNumLayers();if(!this.current_layer||e<0||e>=n)return null;for(t=0;t<n&&this.all_layers[t]!==this.current_layer;++t);if(t===n)return null;if(t!==e){var r=this.current_layer.getGroup(),a=r.nextSibling,i=null;return e>t?e<n-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=vn(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=vn("title",e=s).text()||(M()&&e.querySelectorAll?vn(e.querySelectorAll("title")).text():"");l?(r.push(l),a=new fn(l,s),this.all_layers.push(a),this.layer_map[l]=a):n.push(s)}else yn.includes(s.nodeName)&&n.push(s)}n.length>0||!i?((a=new fn(Sn(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=Sn(Object.keys(this.layer_map)));var n=new fn(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){var n=this;if(!this.current_layer)return null;this.current_layer.deactivate(),(null==e||""===e||this.layer_map[e])&&(e=Sn(Object.keys(this.layer_map)));var r=this.current_layer.getGroup(),a=new fn(e,r,this.svgElem_),i=a.getGroup();u(r.childNodes).forEach((function(e){"title"!==e.localName&&i.append(n.copyElem(e))})),t&&(t.startBatchCommand("Duplicate Layer"),t.insertElement(i),t.endBatchCommand());var o=this.all_layers.indexOf(this.current_layer);return o>=0?this.all_layers.splice(o+1,0,a):this.all_layers.push(a),this.layer_map[e]=a,this.current_layer=a,i}},{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(ft.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(),O()&&"path"===t.nodeName){var a=ot(t);r.setAttribute("d",a)}if(ft.each(t.childNodes,(function(t,a){switch(a.nodeType){case 1:r.append(e(a,n));break;case 3:r.textContent=a.nodeValue}})),ft(t).data("gsvg"))ft(r).data("gsvg",r.firstChild);else if(ft(t).data("symbol")){var i=ft(t).data("symbol");ft(r).data("ref",i).data("symbol",i)}else"image"===r.tagName&&tn(r);return r}(e,(function(){return t.getNextId()}))}}]),e}(),An=function(e,t){(bn=!1===e?_n.NEVER_RANDOMIZE:_n.ALWAYS_RANDOMIZE)!==_n.ALWAYS_RANDOMIZE||t.getNonce()?bn===_n.NEVER_RANDOMIZE&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},En=function(){Rn(),kn.getCurrentDrawing().identifyLayers()},Gn=function(e,t){var n=kn.getCurrentDrawing().createLayer(e,wn(t));kn.clearSelection(),kn.call("changed",[n])},Pn=function(e,t){var n=kn.getCurrentDrawing().cloneLayer(e,wn(t));kn.clearSelection(),Rn(),kn.call("changed",[n])},In=function(){var e=kn.getCurrentDrawing().getCurrentLayer(),t=e.nextSibling,n=e.parentNode;if(e=kn.getCurrentDrawing().deleteCurrentLayer()){var r=new pe("Delete Layer");return r.addSubCommand(new de(e,t,n)),kn.addCommandToHistory(r),kn.clearSelection(),kn.call("changed",[n]),!0}return!1},Nn=function(e){var t=kn.getCurrentDrawing().setCurrentLayer(wt(e));return t&&kn.clearSelection(),t},Tn=function(e){var t=kn.getCurrentDrawing(),n=t.getCurrentLayer();if(n&&t.setCurrentLayerName(e,wn()))return kn.call("changed",[n]),!0;return!1},Ln=function(e){var t=kn.getCurrentDrawing().setCurrentLayerPosition(e);return!!t&&(kn.addCommandToHistory(new ce(t.currentGroup,t.oldNextSibling,kn.getSVGContent())),!0)},Mn=function(e,t){var n=kn.getCurrentDrawing(),r=n.getLayerVisibility(e),a=n.setLayerVisibility(e,t);if(!a)return!1;var i=r?"inline":"none";return kn.addCommandToHistory(new he(a,{display:i},"Layer Visibility")),a===n.getCurrentLayer()&&(kn.clearSelection(),kn.pathActions.clear()),!0},On=function(e){var t=kn.getCurrentDrawing().getLayerByName(e);if(!t)return!1;for(var n=new pe("Move Elements to Layer"),r=kn.getSelectedElements(),a=r.length;a--;){var i=r[a];if(i){var o=i.nextSibling,s=i.parentNode;t.append(i),n.addSubCommand(new ce(i,o,s))}}return kn.addCommandToHistory(n),!0},jn=function(e){kn.getCurrentDrawing().mergeLayer(wn(e)),kn.clearSelection(),Rn(),kn.changeSVGContent()},Vn=function(e){kn.getCurrentDrawing().mergeAllLayers(wn(e)),kn.clearSelection(),Rn(),kn.changeSVGContent()},Rn=function(){var e=xn.length;if(e){for(var t=0;t<e;t++){var n=xn[t],r=kn.elData(n,"orig_opac");1!==r?n.setAttribute("opacity",r):n.removeAttribute("opacity"),n.setAttribute("style","pointer-events: inherit")}xn=[],kn.clearSelection(!0),kn.call("contextset",null)}kn.setCurrentGroup(null)},Bn=function(e){Rn(),"string"==typeof e&&(e=Zt(e)),kn.setCurrentGroup(e),vn(e).parentsUntil("#svgcontent").andSelf().siblings().each((function(){var e=this.getAttribute("opacity")||1;kn.elData(this,"orig_opac",e),this.setAttribute("opacity",.33*e),this.setAttribute("style","pointer-events: none"),xn.push(this)})),kn.clearSelection(),kn.call("contextset",kn.getCurrentGroup())},Dn=p(),Un={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"],feMorphology:["class","in","operator","radius"],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:[]},Fn={};Object.entries(Un).forEach((function(e){var t=c(e,2),n=t[0],r=t[1],a={};Object.entries(r).forEach((function(e){var t=c(e,2),n=(t[0],t[1]);if(n.includes(":")){var r=n.split(":");a[r[1]]=h[r[0].toUpperCase()]}else a[n]="xmlns"===n?h.XMLNS:null})),Fn[n]=a}));var Hn,zn,qn,Yn,Wn=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=Un[t.nodeName],i=Fn[t.nodeName];if(void 0!==a){for(var o=[],s=t.attributes.length;s--;){var l=t.attributes.item(s),u=l.nodeName,d=l.localName,p=l.namespaceURI;if({}.hasOwnProperty.call(i,d)&&p===i[d]&&p!==h.XMLNS||p===h.XMLNS&&Dn[l.value]||((u.startsWith("se:")||u.startsWith("data-"))&&o.push([u,l.value]),t.removeAttributeNS(p,d)),j())switch(u){case"transform":case"gradientTransform":case"patternTransform":var f=l.value.replace(/(\d)-/g,"$1 -");t.setAttribute(u,f)}if("style"===u){for(var g=l.value.split(";"),m=g.length;m--;){var v=c(g[m].split(":"),2),y=v[0],_=v[1],b=(y||"").trim(),x=(_||"").trim();a.includes(b)&&t.setAttribute(b,x)}t.removeAttribute("style")}}Object.values(o).forEach((function(e){var n=c(e,2),r=n[0],a=n[1];t.setAttributeNS(h.SE,r,a)}));var w=Lt(t);if(w&&["filter","linearGradient","pattern","radialGradient","textPath","use"].includes(t.nodeName)&&"#"!==w[0]&&(Mt(t,""),t.removeAttributeNS(h.XLINK,"href")),"use"===t.nodeName&&!Lt(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=Tt(n))&&"#"!==n[0]&&(t.setAttribute(e,""),t.removeAttribute(e))})),s=t.childNodes.length;s--;)e(t.childNodes.item(s))}else{for(var S=[];t.hasChildNodes();)S.push(r.insertBefore(t.firstChild,t));t.remove();for(var k=S.length;k--;)e(S[k])}}}},Xn=jQuery,Qn=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Kn=null,Zn=function(e,t,n){for(var r=function(e,t){return we(e,t,n)},a=function(e){return n.a*e},i=function(e){return n.d*e},o=Kn.getGridSnapping()&&"svg"===e.parentNode.parentNode.localName,s=function(){o&&Object.entries(t).forEach((function(e){var n=c(e,2),r=n[0],a=n[1];t[r]=en(a)})),$t(e,t,1e3,!0)},l=Rt(e),u=0;u<2;u++){var d=0===u?"fill":"stroke",h=e.getAttribute(d);if(h&&h.startsWith("url(")&&(n.a<0||n.d<0)){var p=Kt(h).cloneNode(!0);if(n.a<0){var f=p.getAttribute("x1"),g=p.getAttribute("x2");p.setAttribute("x1",-(f-1)),p.setAttribute("x2",-(g-1))}if(n.d<0){var m=p.getAttribute("y1"),v=p.getAttribute("y2");p.setAttribute("y1",-(m-1)),p.setAttribute("y2",-(v-1))}p.id=Kn.getDrawing().getNextId(),Ot().append(p),e.setAttribute(d,"url(#"+p.id+")")}}var y=e.tagName;if("g"===y||"text"===y||"tspan"===y||"use"===y)if(1!==n.a||0!==n.b||0!==n.c||1!==n.d||0===n.e&&0===n.f){var _=K(e),b=Kn.getSVGRoot().createSVGTransform();b.setMatrix(ke(Ee(_).matrix,n)),_.clear(),_.appendItem(b)}else{var x=Ee(e).matrix,w=ke(x.inverse(),n,x);t.x=parseFloat(t.x)+w.e,t.y=parseFloat(t.y)+w.f}switch(y){case"foreignObject":case"rect":case"image":if("image"===y&&(n.a<0||n.d<0)){var S=K(e),k=Kn.getSVGRoot().createSVGTransform();k.setMatrix(ke(Ee(S).matrix,n)),S.clear(),S.appendItem(k)}else{var C=r(t.x,t.y);t.width=a(t.width),t.height=i(t.height),t.x=C.x+Math.min(0,t.width),t.y=C.y+Math.min(0,t.height),t.width=Math.abs(t.width),t.height=Math.abs(t.height)}s();break;case"ellipse":var A=r(t.cx,t.cy);t.cx=A.x,t.cy=A.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 E=r(t.cx,t.cy);t.cx=E.x,t.cy=E.y;var G=Ae(l.x,l.y,l.width,l.height,n),P=G.tr.x-G.tl.x,I=G.bl.y-G.tl.y;t.r=Math.min(P/2,I/2),t.r&&(t.r=Math.abs(t.r)),s();break;case"line":var N=r(t.x1,t.y1),T=r(t.x2,t.y2);t.x1=N.x,t.y1=N.y,t.x2=T.x,t.y2=T.y;case"text":case"tspan":case"use":s();break;case"g":var L=Xn(e).data("gsvg");L&&$t(L,t,1e3,!0);break;case"polyline":case"polygon":for(var M=t.points.length,O=0;O<M;++O){var j=t.points[O],V=r(j.x,j.y),R=V.x,B=V.y;t.points[O].x=R,t.points[O].y=B}for(var D="",U=0;U<M;++U){var F=t.points[U];D+=F.x+","+F.y+" "}e.setAttribute("points",D);break;case"path":var H=e.pathSegList,z=H.numberOfItems;t.d=[];for(var q=0;q<z;++q){var Y=H.getItem(q);t.d[q]={type:Y.pathSegType,x:Y.x,y:Y.y,x1:Y.x1,y1:Y.y1,x2:Y.x2,y2:Y.y2,r1:Y.r1,r2:Y.r2,angle:Y.angle,largeArcFlag:Y.largeArcFlag,sweepFlag:Y.sweepFlag}}z=t.d.length;var W=t.d[0],X=r(W.x,W.y);t.d[0].x=X.x,t.d[0].y=X.y;for(var Q=1;Q<z;++Q){var Z=t.d[Q];if(Z.type%2==0){var $=r(void 0!==Z.x?Z.x:X.x,void 0!==Z.y?Z.y:X.y),J=r(Z.x1,Z.y1),ee=r(Z.x2,Z.y2);Z.x=$.x,Z.y=$.y,Z.x1=J.x,Z.y1=J.y,Z.x2=ee.x,Z.y2=ee.y,Z.r1=a(Z.r1),Z.r2=i(Z.r2)}else Z.x=a(Z.x),Z.y=i(Z.y),Z.x1=a(Z.x1),Z.y1=i(Z.y1),Z.x2=a(Z.x2),Z.y2=i(Z.y2),Z.r1=a(Z.r1),Z.r2=i(Z.r2)}var te="";z=t.d.length;for(var ne=0;ne<z;++ne){var re=t.d[ne],ae=re.type;switch(te+=Qn[ae],ae){case 13:case 12:te+=re.x+" ";break;case 15:case 14:te+=re.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:te+=re.x+","+re.y+" ";break;case 7:case 6:te+=re.x1+","+re.y1+" "+re.x2+","+re.y2+" "+re.x+","+re.y+" ";break;case 9:case 8:te+=re.x1+","+re.y1+" "+re.x+","+re.y+" ";break;case 11:case 10:te+=re.r1+","+re.r2+" "+re.angle+" "+Number(re.largeArcFlag)+" "+Number(re.sweepFlag)+" "+re.x+","+re.y+" ";break;case 17:case 16:te+=re.x2+","+re.y2+" "+re.x+","+re.y+" "}}e.setAttribute("d",te)}},$n=H(jQuery),Jn=function(e,t,n){var r=Kt(e).firstChild,a=K(r),i=Hn.getSVGRoot().createSVGTransform();i.setTranslate(t,n),a.appendItem(i),er(r)},er=function e(t){if(nn(t))return null;if("svg"===t.nodeName&&navigator.userAgent.includes("Firefox/20"))return null;var n=Hn.getSVGRoot(),r=K(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(Se(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&&Qt(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 u=n.createSVGTransformFromMatrix(ke(s[1][0],s[0][0]));r.removeItem(s[0][1]),r.removeItem(s[1][1]),r.insertItemBefore(u,s[1][1])}if((l=r.numberOfItems)>=2&&1===r.getItem(l-2).type&&2===r.getItem(l-1).type){var d=n.createSVGTransform(),p=ke(r.getItem(l-2).matrix,r.getItem(l-1).matrix);d.setMatrix(p),r.removeItem(l-2),r.removeItem(l-2),r.appendItem(d)}}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 f,g,m=$n(t).data("gsvg"),v=new pe("Transform"),y={},_=null,b=[];switch(t.tagName){case"line":b=["x1","y1","x2","y2"];break;case"circle":b=["cx","cy","r"];break;case"ellipse":b=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":b=["width","height","x","y"];break;case"use":case"text":case"tspan":b=["x","y"];break;case"polygon":case"polyline":(_={}).points=t.getAttribute("points");var x=t.points,w=x.numberOfItems;y.points=new Array(w);for(var S=0;S<w;++S){var k=x.getItem(S);y.points[S]={x:k.x,y:k.y}}break;case"path":(_={}).d=t.getAttribute("d"),y.d=t.getAttribute("d")}if(b.length?(y=$n(t).attr(b),$n.each(y,(function(e,t){y[e]=ie(e,t)}))):m&&(y={x:$n(m).attr("x")||0,y:$n(m).attr("y")||0}),nn(_)&&(_=$n.extend(!0,{},y),$n.each(_,(function(e,t){_[e]=ie(e,t)}))),_.transform=Hn.getStartTransform()||"","g"===t.tagName&&!m||"a"===t.tagName){var C=Rt(t);f={x:C.x+C.width/2,y:C.y+C.height/2},g=we(C.x+C.width/2,C.y+C.height/2,Ee(r).matrix);var A=Qt(t);if(A){var E,G=A*Math.PI/180;E=Math.abs(G)>1e-10?Math.sin(G)/(1-Math.cos(G)):2/G;for(var P=0;P<r.numberOfItems;++P){var I=r.getItem(P);if(4===I.type){var N=I.matrix;f.y=(E*N.e+N.f)/2,f.x=(N.e-E*N.f)/2,r.removeItem(P);break}}}var T,L,M=r.numberOfItems,j=0,V=0,R=0;if(M&&(T=r.getItem(0).matrix),M>=3&&3===r.getItem(M-2).type&&2===r.getItem(M-3).type&&2===r.getItem(M-1).type){R=3;for(var B=r.getItem(M-3).matrix,D=r.getItem(M-2).matrix,U=r.getItem(M-1).matrix,F=t.childNodes,H=F.length;H--;){var z=F.item(H);if(j=0,V=0,1===z.nodeType){var q=K(z);if(!q)continue;var Y=Ee(q).matrix,W=Qt(z);if(L=Hn.getStartTransform(),Hn.setStartTransform(z.getAttribute("transform")),W||Ce(q)){var X=n.createSVGTransform();X.setMatrix(ke(B,D,U,Y)),q.clear(),q.appendItem(X)}else{var Q=ke(Y.inverse(),U,Y),Z=n.createSVGMatrix();Z.e=-Q.e,Z.f=-Q.f;var $=ke(Z.inverse(),Y.inverse(),B,D,U,Y,Q.inverse()),J=n.createSVGTransform(),ee=n.createSVGTransform(),te=n.createSVGTransform();J.setTranslate(Q.e,Q.f),ee.setScale($.a,$.d),te.setTranslate(Z.e,Z.f),q.appendItem(te),q.appendItem(ee),q.appendItem(J)}v.addSubCommand(e(z)),Hn.setStartTransform(L)}}r.removeItem(M-1),r.removeItem(M-2),r.removeItem(M-3)}else if(M>=3&&1===r.getItem(M-1).type){R=3;var ne=Ee(r).matrix,re=n.createSVGTransform();re.setMatrix(ne),r.clear(),r.appendItem(re)}else if((1===M||M>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){R=2;var ae=Ee(r).matrix;r.removeItem(0);var oe=Ee(r).matrix.inverse(),se=ke(oe,ae);if(j=se.e,V=se.f,0!==j||0!==V){for(var le=t.childNodes,ce=le.length,ue=[];ce--;){var de=le.item(ce);if(1===de.nodeType){if(de.getAttribute("clip-path")){var fe=de.getAttribute("clip-path");ue.includes(fe)||(Jn(fe,j,V),ue.push(fe))}L=Hn.getStartTransform(),Hn.setStartTransform(de.getAttribute("transform"));var ge=K(de);if(ge){var me=n.createSVGTransform();me.setTranslate(j,V),ge.numberOfItems?ge.insertItemBefore(me,0):ge.appendItem(me),v.addSubCommand(e(de));for(var ve=t.getElementsByTagNameNS(h.SVG,"use"),ye="#"+de.id,_e=ve.length;_e--;){var be=ve.item(_e);if(ye===Lt(be)){var xe=n.createSVGTransform();xe.setTranslate(-j,-V),K(be).insertItemBefore(xe,0),v.addSubCommand(e(be))}}Hn.setStartTransform(L)}}}Hn.setStartTransform(L)}}else{if(1!==M||1!==r.getItem(0).type||A){if(A){var Ae=n.createSVGTransform();Ae.setRotate(A,g.x,g.y),r.numberOfItems?r.insertItemBefore(Ae,0):r.appendItem(Ae)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}R=1;for(var Ge=r.getItem(0).matrix,Pe=t.childNodes,Ie=Pe.length;Ie--;){var Ne=Pe.item(Ie);if(1===Ne.nodeType){L=Hn.getStartTransform(),Hn.setStartTransform(Ne.getAttribute("transform"));var Te=K(Ne);if(!Te)continue;var Le=ke(Ge,Ee(Te).matrix),Me=n.createSVGTransform();Me.setMatrix(Le),Te.clear(),Te.appendItem(Me,0),v.addSubCommand(e(Ne)),Hn.setStartTransform(L);var Oe=Ne.getAttribute("stroke-width");if("none"!==Ne.getAttribute("stroke")&&!isNaN(Oe)){var je=(Math.abs(Le.a)+Math.abs(Le.d))/2;Ne.setAttribute("stroke-width",Oe*je)}}}r.clear()}if(2===R){if(A){g={x:f.x+T.e,y:f.y+T.f};var Ve=n.createSVGTransform();Ve.setRotate(A,g.x,g.y),r.numberOfItems?r.insertItemBefore(Ve,0):r.appendItem(Ve)}}else if(3===R){var Re=Ee(r).matrix,Be=n.createSVGTransform();Be.setRotate(A,f.x,f.y);var De=Be.matrix,Ue=n.createSVGTransform();Ue.setRotate(A,g.x,g.y);var Fe=Ue.matrix.inverse(),He=Re.inverse(),ze=ke(He,Fe,De,Re);if(j=ze.e,V=ze.f,0!==j||0!==V)for(var qe=t.childNodes,Ye=qe.length;Ye--;){var We=qe.item(Ye);if(1===We.nodeType){L=Hn.getStartTransform(),Hn.setStartTransform(We.getAttribute("transform"));var Xe=K(We),Qe=n.createSVGTransform();Qe.setTranslate(j,V),Xe.numberOfItems?Xe.insertItemBefore(Qe,0):Xe.appendItem(Qe),v.addSubCommand(e(We)),Hn.setStartTransform(L)}}A&&(r.numberOfItems?r.insertItemBefore(Ue,0):r.appendItem(Ue))}}else{var Ke,Ze=Rt(t);if(!Ze&&"path"!==t.tagName)return null;var $e=Qt(t);if($e){f={x:Ze.x+Ze.width/2,y:Ze.y+Ze.height/2},g=we(Ze.x+Ze.width/2,Ze.y+Ze.height/2,Ee(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;f.y=(et*rt.e+rt.f)/2,f.x=(rt.e-et*rt.f)/2,r.removeItem(tt);break}}}var at=0,it=r.numberOfItems;if(!O()){var ot=t.getAttribute("fill");if(ot&&ot.startsWith("url(")){var st=Kt(ot),lt="pattern";if(st.tagName!==lt&&(lt="gradient"),"userSpaceOnUse"===st.getAttribute(lt+"Units")){Ke=Ee(r).matrix;var ct=K(st),ut=Ee(ct).matrix,dt="matrix("+[(Ke=ke(Ke,ut)).a,Ke.b,Ke.c,Ke.d,Ke.e,Ke.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,Ke=Ee(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,Ke=Ee(r).matrix;var ht=n.createSVGTransform();ht.setMatrix(Ke),r.clear(),r.appendItem(ht),Ke=n.createSVGMatrix()}else if((1===it||it>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){at=2;var pt=r.getItem(0).matrix,ft=Ee(r,1).matrix,gt=ft.inverse();Ke=ke(gt,pt,ft),r.removeItem(0)}else{if(1!==it||1!==r.getItem(0).type||$e){if($e){var mt=n.createSVGTransform();mt.setRotate($e,g.x,g.y),r.numberOfItems?r.insertItemBefore(mt,0):r.appendItem(mt)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}switch(Ke=Ee(r).matrix,t.tagName){case"line":y=$n(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(y.points=t.getAttribute("points"),y.points){var vt=t.points,yt=vt.numberOfItems;y.points=new Array(yt);for(var _t=0;_t<yt;++_t){var bt=vt.getItem(_t);y.points[_t]={x:bt.x,y:bt.y}}}case"path":y.d=t.getAttribute("d"),at=1,r.clear()}}if(1!==at&&2!==at&&3!==at||Zn(t,y,Ke),2===at){if($e){Ce(r)||(g={x:f.x+Ke.e,y:f.y+Ke.f});var xt=n.createSVGTransform();xt.setRotate($e,g.x,g.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:$n(kt).attr("x")||0,y:$n(kt).attr("y")||0};Zn(kt,Ct,Ke)}}}else if(3===at&&$e){var At=Ee(r).matrix,Et=n.createSVGTransform();Et.setRotate($e,f.x,f.y);var Gt=Et.matrix,Pt=n.createSVGTransform();Pt.setRotate($e,g.x,g.y);var It=Pt.matrix.inverse(),Nt=At.inverse(),Tt=ke(Nt,It,Gt,At);Zn(t,y,Tt),$e&&(r.numberOfItems?r.insertItemBefore(Pt,0):r.appendItem(Pt))}}return 0===r.numberOfItems&&t.removeAttribute("transform"),v.addSubCommand(new he(t,_)),v},tr=jQuery,nr=D()?10:4,rr=function(){function e(n,r,a){t(this,e),this.id=n,this.selectedElement=r,this.locked=!0,this.selectorGroup=zn.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}}),this.selectorRect=this.selectorGroup.appendChild(zn.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 r(e,[{key:"reset",value:function(e,t){this.locked=!0,this.selectedElement=e,this.resize(t),this.selectorGroup.setAttribute("display","inline")}},{key:"showGrips",value:function(t){var n=t?"inline":"none";Yn.selectorGripsGroup.setAttribute("display",n);var r=this.selectedElement;this.hasGrips=t,r&&t&&(this.selectorGroup.append(Yn.selectorGripsGroup),e.updateGripCursors(Qt(r)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=Yn,r=n.selectorGrips,a=this.selectedElement,i=a.getAttribute("stroke-width"),o=zn.getCurrentZoom(),s=1/o;"none"===a.getAttribute("stroke")||isNaN(i)||(s+=i/2);var l=a.tagName;"text"===l&&(s+=2/o);var u=K(a),d=Ee(u).matrix;if(d.e*=o,d.f*=o,e||(e=Rt(a)),"g"===l&&!tr.data(a,"gsvg")){var h=qt([a.childNodes]);h&&(e=h)}var p=e.x,f=e.y,g=e.width,m=e.height;s*=o;var v=Ae(p*o,f*o,g*o,m*o,d),y=v.aabox,_=y.x-s,b=y.y-s,x=y.width+2*s,w=y.height+2*s,S=_+x/2,k=b+w/2,C=Qt(a);if(C){var A=zn.svgRoot().createSVGTransform();A.setRotate(-C,S,k);var E=A.matrix;v.tl=we(v.tl.x,v.tl.y,E),v.tr=we(v.tr.x,v.tr.y,E),v.bl=we(v.bl.x,v.bl.y,E),v.br=we(v.br.x,v.br.y,E);var G=v.tl,P=G.x,I=G.y,N=G.x,T=G.y,L=Math.min,M=Math.max;_=P=L(P,L(v.tr.x,L(v.bl.x,v.br.x)))-s,b=I=L(I,L(v.tr.y,L(v.bl.y,v.br.y)))-s,x=(N=M(N,M(v.tr.x,M(v.bl.x,v.br.x)))+s)-P,w=(T=M(T,M(v.tr.y,M(v.bl.y,v.br.y)))+s)-I}var O="M"+_+","+b+" L"+(_+x)+","+b+" "+(_+x)+","+(b+w)+" "+_+","+(b+w)+"z";t.setAttribute("d",O);var j=C?"rotate("+[C,S,k].join(",")+")":"";this.selectorGroup.setAttribute("transform",j),this.gripCoords={nw:[_,b],ne:[_+x,b],sw:[_,b+w],se:[_+x,b+w],n:[_+x/2,b],w:[_,b+w/2],e:[_+x,b+w/2],s:[_+x/2,b+w]},Object.entries(this.gripCoords).forEach((function(e){var t=c(e,2),n=t[0],a=t[1];r[n].setAttribute("cx",a[0]),r[n].setAttribute("cy",a[1])})),n.rotateGripConnector.setAttribute("x1",_+x/2),n.rotateGripConnector.setAttribute("y1",b),n.rotateGripConnector.setAttribute("x2",_+x/2),n.rotateGripConnector.setAttribute("y2",b-5*nr),n.rotateGrip.setAttribute("cx",_+x/2),n.rotateGrip.setAttribute("cy",b-5*nr)}}],[{key:"updateGripCursors",value:function(e){var t=Object.keys(Yn.selectorGrips),n=Math.round(e/45);for(n<0&&(n+=8);n>0;)t.push(t.shift()),n--;Object.values(Yn.selectorGrips).forEach((function(e,n){e.setAttribute("style","cursor:"+t[n]+"-resize")}))}}]),e}(),ar=function(){function n(){t(this,n),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 r(n,[{key:"initGroup",value:function(){var e=this;if(this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.remove(),this.selectorParentGroup=zn.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=zn.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.append(this.selectorGripsGroup),zn.svgRoot().append(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,Object.keys(this.selectorGrips).forEach((function(t){var n=zn.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+t,fill:"#22C",r:nr,style:"cursor:"+t+"-resize","stroke-width":2,"pointer-events":"all"}});tr.data(n,"dir",t),tr.data(n,"type","resize"),e.selectorGrips[t]=e.selectorGripsGroup.appendChild(n)})),this.rotateGripConnector=this.selectorGripsGroup.appendChild(zn.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(zn.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:nr,stroke:"#22C","stroke-width":2,style:"cursor:url("+qn.imgPath+"rotate.png) 12 12, auto;"}})),tr.data(this.rotateGrip,"type","rotate"),!tr("#canvasBackground").length){var t=c(qn.dimensions,2),n=t[0],r=t[1],a=zn.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:n,height:r,x:0,y:0,overflow:O()?"none":"visible",style:"pointer-events:none"}}),i=zn.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});a.append(i),zn.svgRoot().insertBefore(a,zn.svgContent())}}},{key:"requestSelector",value:function(t,n){if(nn(t))return null;var r=this.selectors.length;if("object"===e(this.selectorMap[t.id]))return this.selectorMap[t.id].locked=!0,this.selectorMap[t.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(t,n),this.selectorMap[t.id]=this.selectors[a],this.selectors[a];return this.selectors[r]=new rr(r,t,n),this.selectorParentGroup.append(this.selectors[r].selectorGroup),this.selectorMap[t.id]=this.selectors[r],this.selectors[r]}},{key:"releaseSelector",value:function(e){if(!nn(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(zn.createSVGElement({element:"rect",attr:{id:"selectorRubberBand",fill:"#22C","fill-opacity":.15,stroke:"#22C","stroke-width":.5,display:"none",style:"pointer-events:none"}}))),this.rubberBandBox}}]),n}(),ir=H(jQuery),or=ce,sr=ue,lr=de,cr=he,ur=pe,dr=_e,hr=se;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 pr=function n(r,a){t(this,n);var i={show_outside_canvas:!0,selectNew:!0,dimensions:[640,480]};a&&ir.extend(i,a);var o=i.dimensions,s=this,l=r.ownerDocument,d=l.importNode(It('<svg id="svgroot" xmlns="'+h.SVG+'" xlinkns="'+h.XLINK+'" width="'+o[0]+'" height="'+o[1]+'" x="'+o[0]+'" y="'+o[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement,!0);r.append(d);var f=l.createElementNS(h.SVG,"svg");(s.clearSvgContentElement=function(){ir(f).empty(),ir(f).attr({id:"svgcontent",width:o[0],height:o[1],x:o[0],y:o[1],overflow:i.show_outside_canvas?"visible":"hidden",xmlns:h.SVG,"xmlns:se":h.SE,"xmlns:xlink":h.XLINK}).appendTo(d);var e=l.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");f.append(e)})();var g="svg_";s.setIdPrefix=function(e){g=e},s.current_drawing_=new Cn(f,g);var m=s.getCurrentDrawing=function(){return s.current_drawing_},v=1,y=null,_={shape:{fill:("none"===i.initFill.color?"":"#")+i.initFill.color,fill_paint:null,fill_opacity:i.initFill.opacity,stroke:"#"+i.initStroke.color,stroke_paint:null,stroke_opacity:i.initStroke.opacity,stroke_width:i.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:i.initOpacity}};_.text=ir.extend(!0,{},_.shape),ir.extend(_.text,{fill:"#000000",stroke_width:i.text&&i.text.stroke_width,font_size:i.text&&i.text.font_size,font_family:i.text&&i.text.font_family});var b=_.shape,x=[],w=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]=w(a);return n},S=this.addSVGElementFromJson=function(e){if("string"==typeof e)return l.createTextNode(e);var t=Zt(e.attr.id),n=m().getCurrentLayer();if(t&&e.element!==t.tagName&&(t.remove(),t=null),!t){var r=e.namespace||h.SVG;t=l.createElementNS(r,e.element),n&&(y||n).append(t)}return e.curStyles&&$t(t,{fill:b.fill,stroke:b.stroke,"stroke-width":b.stroke_width,"stroke-dasharray":b.stroke_dasharray,"stroke-linejoin":b.stroke_linejoin,"stroke-linecap":b.stroke_linecap,"stroke-opacity":b.stroke_opacity,"fill-opacity":b.fill_opacity,opacity:b.opacity/2,style:"pointer-events:inherit"}),$t(t,e.attr),Jt(t),e.children&&e.children.forEach((function(e){t.append(S(e))})),t};s.getTransformList=K,s.matrixMultiply=ke,s.hasMatrixTransform=Ce,s.transformListToTransform=Ee;var k=function(){return i.baseUnit};!function(e){Y=e;var t=document.createElementNS(h.SVG,"svg");document.body.append(t);var n=document.createElementNS(h.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;ee={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:k,getElement:Zt,getHeight:function(){return f.getAttribute("height")/v},getWidth:function(){return f.getAttribute("width")/v},getRoundDigits:function(){return he.round_digits}}),s.convertToNum=ie;var C,A=function(){return f},E=this.getSelectedElems=function(){return x},G=pt,I=function(){return d};vt=C={pathActions:G,getSVGContent:A,addSVGElementFromJson:S,getSelectedElements:E,getDOMDocument:function(){return l},getDOMContainer:function(){return r},getSVGRoot:I,getBaseUnit:k,getSnappingStep:function(){return i.snappingStep}},yt=C.getDOMDocument(),_t=C.getDOMContainer(),bt=C.getSVGRoot(),s.findDefs=Ot,s.getUrlFromAttr=Tt,s.getHref=Lt,s.setHref=Mt,s.getBBox=Rt,s.getRotationAngle=Qt,s.getElem=Zt,s.getRefElem=Kt,s.assignAttributes=$t,this.cleanupElement=Jt;var N=function(){return i.gridSnapping};!function(e){Kn=e}({getDrawing:function(){return m()},getSVGRoot:I,getGridSnapping:N}),this.remapElement=Zn,function(e){Hn=e}({getSVGRoot:I,getStartTransform:function(){return _e},setStartTransform:function(e){_e=e}}),this.recalculateDimensions=er;var T=p();s.sanitizeSvg=Wn;var L=s.undoMgr=new dr({handleHistoryEvent:function(e,t){var n=hr;if(e===n.BEFORE_UNAPPLY||e===n.BEFORE_APPLY)s.clearSelection();else if(e===n.AFTER_APPLY||e===n.AFTER_UNAPPLY){var r=t.elements();s.pathActions.clear(),q("changed",r);var a=t.type(),i=e===n.AFTER_APPLY;if(a===or.type())(i?t.newParent:t.oldParent)===f&&En();else if(a===sr.type()||a===lr.type())t.parent===f&&En(),a===sr.type()?i&&ue(t.elem):i||ue(t.elem),"use"===t.elem.tagName&&Bt(t.elem);else if(a===cr.type()){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===f&&En();var o=i?t.newValues:t.oldValues;o.stdDeviation&&s.setBlurOffsets(t.elem.parentNode,o.stdDeviation)}}}}),M=function(e){s.undoMgr.addCommandToHistory(e)},B=this.getZoom=function(){return v},D=this.round=function(e){return parseInt(e*v)/v};!function(e,t){qn=e,zn=t,Yn=new ar}(i,{createSVGElement:function(e){return s.addSVGElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return f},getCurrentZoom:B});var U=this.selectorManager=Yn,H=s.getNextId=function(){return m().getNextId()},z=s.getId=function(){return m().getId()},q=function(e,t){if(qe[e])return qe[e](window,t)},Q=this.clearSelection=function(e){x.forEach((function(e){nn(e)||U.releaseSelector(e)})),x=[],e||q("selected",x)},Z=this.addToSelection=function(e,t){if(e.length){for(var n=0;n<x.length&&!nn(x[n]);)++n;for(var r=e.length;r--;){var a=e[r];if(a){var i=Rt(a);if(i&&("a"===a.tagName&&1===a.childNodes.length&&(a=a.firstChild),!x.includes(a))){x[n]=a,n++;var o=U.requestSelector(a,i);x.length>1&&o.showGrips(!1)}}}for(q("selected",x),t||1===x.length?U.requestSelector(x[0]).showGrips(!0):U.requestSelector(x[0]).showGrips(!1),x.sort((function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):nn(e)?1:0}));nn(x[0]);)x.shift(0)}},$=function(){return b.opacity},J=this.getMouseTarget=function(e){if(nn(e))return null;var t=e.target;if(t.correspondingUseElement&&(t=t.correspondingUseElement),[h.MATH,h.HTML].includes(t.namespaceURI)&&"svgcanvas"!==t.id)for(;"foreignObject"!==t.nodeName;)if(!(t=t.parentNode))return d;var n=m().getCurrentLayer();if([d,r,f,n].includes(t))return d;if(ir(t).closest("#selectorParentGroup").length)return U.selectorParentGroup;for(;t.parentNode!==(y||n);)t=t.parentNode;return t};s.pathActions=G,De({selectorManager:U,canvas:s,call:q,resetD:function(e){e.setAttribute("d",G.convertPath(e))},round:D,clearSelection:Q,addToSelection:Z,addCommandToHistory:M,remapElement:Zn,addSVGElementFromJson:S,getGridSnapping:N,getOpacity:$,getSelectedElements:E,getContainer:function(){return r},setStarted:function(e){ye=e},getRubberBox:function(){return Oe},setRubberBox:function(e){return Oe=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;G.canDeleteNodes=!0,G.closed_subpath=t,q("pointsAdded",{closedSubpath:t,grips:n}),q("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;M(t),q("changed",[n])},getCurrentZoom:B,getId:z,getNextId:H,getMouseTarget:J,getCurrentMode:function(){return xe},setCurrentMode:function(e){return xe=e},getDrawnPath:function(){return gt},setDrawnPath:function(e){return gt=e},getSVGRoot:I});var ae={},oe="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",se=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],le=ir.data,ce=document.createElementNS(h.SVG,"animate");ir(ce).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(d);var ue=function e(t){var n=ir(t).attr(se);Object.values(n).forEach((function(e){if(e&&e.startsWith("url(")){var t=Tt(e).substr(1);Zt(t)||(Ot().append(me[t]),delete me[t])}}));var r=t.getElementsByTagName("*");if(r.length)for(var a=0,i=r.length;a<i;a++)e(r[a])},de={},he={round_digits:5},pe={},fe=_.text,ge={},me={},ve=i.imgPath+"logo.png",ye=!1,_e=null,xe="select",Ne="none",Te=b,Le=null,Oe=null,je=[],Be=null;this.runExtension=function(e,t,n){return this.runExtensions(t,n,!1,(function(t){return t===e}))};var Ue=this.runExtensions=function(e,t,n,r){var a=!!n&&[];return ir.each(ge,(function(i,o){r&&!r(i)||o&&e in o&&("function"==typeof t&&(t=t(i)),n?a.push(o[e](t)):a=o[e](t))})),a};this.addExtension=function(e,t,n){var r,a,i,o;return regeneratorRuntime.async((function(l){for(;;)switch(l.prev=l.next){case 0:if(r=n.$,a=n.importLocale,"function"==typeof t){l.next=3;break}throw new TypeError("Function argument expected for `svgcanvas.addExtension`");case 3:if(!(e in ge)){l.next=5;break}throw new Error('Cannot add extension "'+e+'", an extension by that name already exists.');case 5:return i=ir.extend(s.getPrivateMethods(),{$:r,importLocale:a,svgroot:d,svgcontent:f,nonce:m().getNonce(),selectorManager:U}),l.next=8,regeneratorRuntime.awrap(t(i));case 8:return(o=l.sent)&&(o.name=e),ge[e]=o,l.abrupt("return",q("extension_added",o));case 12:case"end":return l.stop()}}))};var Fe=this.getIntersectionList=function(e){if(nn(Oe))return null;var t,n=y||m().getCurrentLayer();if(e)(t=f.createSVGRect()).x=e.x,t.y=e.y,t.width=e.width,t.height=e.height;else{t=Oe.getBBox();var r=f.createSVGRect();["x","y","width","height","top","right","bottom","left"].forEach((function(e){r[e]=t[e]/v})),t=r}var a=null;if(V()||"function"==typeof d.getIntersectionList&&(t.x+=parseInt(f.getAttribute("x")),t.y+=parseInt(f.getAttribute("y")),a=d.getIntersectionList(t,n)),nn(a)||"function"!=typeof a.item){a=[],je.length||(je=He(n));for(var i=je.length;i--;)t.width&&Ie(t,je[i].bbox)&&a.push(je[i].elem)}return a};this.getStrokedBBox=Wt,this.getVisibleElements=Yt;var He=this.getVisibleElementsAndBBoxes=function(e){e||(e=ir(f).children());var t=[];return ir(e).children().each((function(e,n){n.getBBox&&t.push({elem:n,bbox:Wt([n])})})),t.reverse()},ze=this.groupSvgElem=function(e){var t=document.createElementNS(h.SVG,"g");e.replaceWith(t),ir(t).append(e).data("gsvg",e)[0].id=H()},qe={};s.call=q,s.bind=function(e,t){var n=qe[e];return qe[e]=t,n},this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement),u(e.getElementsByTagNameNS(h.SVG,"path")).forEach((function(e){e.setAttribute("d",G.convertPath(e)),G.fixEnd(e)}))};var Ye=function(e){if(!j())return e;var t=e.cloneNode(!0);return e.before(t),e.remove(),U.releaseSelector(e),x[0]=t,U.requestSelector(t).showGrips(!0),t};this.setRotationAngle=function(e,t){e=parseFloat(e);var n=x[0],r=n.getAttribute("transform"),a=Rt(n),i=a.x+a.width/2,o=a.y+a.height/2,s=K(n);s.numberOfItems>0&&(4===s.getItem(0).type&&s.removeItem(0));if(0!==e){var l=we(i,o,Ee(s).matrix),c=d.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),ln("transform",u,x),q("changed",x)}U.requestSelector(x[0]).resize(),rr.updateGripCursors(e)};var We=this.recalculateAllSelectedDimensions=function(){for(var e=new ur("none"===Ne?"position":"size"),t=x.length;t--;){var n=x[t],r=er(n);r&&e.addSubCommand(r)}e.isEmpty()||(M(e),q("changed",x))},Xe=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Qe=null,Ke=this.selectOnly=function(e,t){Q(!0),Z(e,t)};this.removeFromSelection=function(e){if(!nn(x[0])&&e.length){for(var t=[],n=x.length,r=0;r<n;++r){var a=x[r];a&&(e.includes(a)?U.releaseSelector(a):t.push(a))}x=t}},this.selectAllInCurrentLayer=function(){var e=m().getCurrentLayer();e&&(xe="select",Ke(ir(y||e).children()))};var Ze,$e,Je,et,tt,rt,at,it,ot,st,lt,ct,ut,dt,ht,gt=null;$e={minx:null,miny:null,maxx:null,maxy:null},Je=null,et=null,tt=null,rt=null,at={},it=0,ot={x:0,y:0},st={x:0,y:0},lt={x:0,y:0},ct={x:0,y:0},ut={x:0,y:0},dt={x:0,y:0},ht=function(e){var t={x:0,y:0},n=ot,r=st,a=lt,i=ct,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}},ir(r).mousedown((function(e){if(!s.spaceKey&&1!==e.button){var t=2===e.button;e.altKey&&s.cloneSelectedElements(0,0),Qe=ir("#svgcontent g")[0].getScreenCTM().inverse();var n=we(e.pageX,e.pageY,Qe),r=n.x*v,a=n.y*v;e.preventDefault(),t&&(xe="select",Be=n);var o=r/v,l=a/v,c=J(e);"a"===c.tagName&&1===c.childNodes.length&&(c=c.firstChild);var u=o;tt=Je=o;var h=l;if(rt=et=l,i.gridSnapping&&(o=en(o),l=en(l),Je=en(Je),et=en(et)),c===U.selectorParentGroup&&!nn(x[0])){var p=e.target,f=le(p,"type");"rotate"===f?xe="rotate":"resize"===f&&(xe="resize",Ne=le(p,"dir")),c=x[0]}_e=c.getAttribute("transform");var g=K(c);switch(xe){case"select":if(ye=!0,Ne="none",t&&(ye=!1),c!==d){if(x.includes(c)||(e.shiftKey||Q(!0),Z([c]),Le=c,G.clear()),!t){var m=!0,y=!1,_=void 0;try{for(var w,k=x[Symbol.iterator]();!(m=(w=k.next()).done);m=!0){var C=w.value;if(!nn(C)){var A=K(C);A.numberOfItems?A.insertItemBefore(d.createSVGTransform(),0):A.appendItem(d.createSVGTransform())}}}catch(e){y=!0,_=e}finally{try{m||null==k.return||k.return()}finally{if(y)throw _}}}}else t||(Q(),xe="multiselect",nn(Oe)&&(Oe=U.getRubberBandBox()),$t(Oe,{x:tt*=v,y:rt*=v,width:0,height:0,display:"inline"}));break;case"zoom":ye=!0,nn(Oe)&&(Oe=U.getRubberBandBox()),$t(Oe,{x:u*v,y:u*v,width:0,height:0,display:"inline"});break;case"resize":ye=!0,Je=o,et=l,at=Rt(ir("#selectedBox0")[0]);var E={};ir.each(at,(function(e,t){E[e]=t/v})),at=E;var P=Qt(c)?1:0;if(Ce(g))g.insertItemBefore(d.createSVGTransform(),P),g.insertItemBefore(d.createSVGTransform(),P),g.insertItemBefore(d.createSVGTransform(),P);else if(g.appendItem(d.createSVGTransform()),g.appendItem(d.createSVGTransform()),g.appendItem(d.createSVGTransform()),F()){var I,N=O();N&&(I=function(e){var t=e.getAttribute("stroke");e.removeAttribute("stroke"),null!==t&&setTimeout((function(){e.setAttribute("stroke",t)}),0)}),c.style.vectorEffect="non-scaling-stroke",N&&I(c);for(var T=c.getElementsByTagName("*"),L=T.length,M=0;M<L;M++)T[M].style&&(T[M].style.vectorEffect="non-scaling-stroke",N&&I(T[M]))}break;case"fhellipse":case"fhrect":case"fhpath":lt.x=u,lt.y=h,ye=!0,S({element:"polyline",curStyles:!0,attr:{points:u+","+h+" ",id:H(),fill:"none",opacity:b.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}}),$e.minx=u,$e.maxx=u,$e.miny=h,$e.maxy=h;break;case"image":ye=!0;var j=S({element:"image",attr:{x:o,y:l,width:0,height:0,id:H(),opacity:b.opacity/2,style:"pointer-events:inherit"}});Mt(j,ve),tn(j);break;case"square":case"rect":ye=!0,Je=o,et=l,S({element:"rect",curStyles:!0,attr:{x:o,y:l,width:0,height:0,id:H(),opacity:b.opacity/2}});break;case"line":ye=!0;var V=0===Number(b.stroke_width)?1:b.stroke_width;S({element:"line",curStyles:!0,attr:{x1:o,y1:l,x2:o,y2:l,id:H(),stroke:b.stroke,"stroke-width":V,"stroke-dasharray":b.stroke_dasharray,"stroke-linejoin":b.stroke_linejoin,"stroke-linecap":b.stroke_linecap,"stroke-opacity":b.stroke_opacity,fill:"none",opacity:b.opacity/2,style:"pointer-events:none"}});break;case"circle":ye=!0,S({element:"circle",curStyles:!0,attr:{cx:o,cy:l,r:0,id:H(),opacity:b.opacity/2}});break;case"ellipse":ye=!0,S({element:"ellipse",curStyles:!0,attr:{cx:o,cy:l,rx:0,ry:0,id:H(),opacity:b.opacity/2}});break;case"text":ye=!0,S({element:"text",curStyles:!0,attr:{x:o,y:l,id:H(),fill:fe.fill,"stroke-width":fe.stroke_width,"font-size":fe.font_size,"font-family":fe.font_family,"text-anchor":"middle","xml:space":"preserve",opacity:b.opacity}});break;case"path":case"pathedit":Je*=v,et*=v,G.mouseDown(e,c,Je,et),ye=!0;break;case"textedit":Je*=v,et*=v,Ct.mouseDown(e,c,Je,et),ye=!0;break;case"rotate":ye=!0,s.undoMgr.beginUndoableChange("transform",x)}var R=Ue("mouseDown",{event:e,start_x:Je,start_y:et,selectedElements:x},!0);ir.each(R,(function(e,t){t&&t.started&&(ye=!0)}))}})).mousemove((function(e){if(ye&&1!==e.button&&!s.spaceKey){var t,n,r,a,o,l,c,u,h,p,g=x[0],m=we(e.pageX,e.pageY,Qe),y=m.x*v,_=m.y*v,b=Zt(z()),w=y/v,S=w,k=_/v,C=k;switch(i.gridSnapping&&(S=en(S),C=en(C)),e.preventDefault(),xe){case"select":if(null!==x[0]&&(o=S-Je,l=C-et,i.gridSnapping&&(o=en(o),l=en(l)),0!==o||0!==l)){for(c=x.length,t=0;t<c&&(g=x[t],!nn(g));++t){var A=d.createSVGTransform();p=K(g),A.setTranslate(o,l),p.numberOfItems?p.replaceItem(A,0):p.appendItem(A),U.requestSelector(g).resize()}q("transition",x)}break;case"multiselect":w*=v,k*=v,$t(Oe,{x:Math.min(tt,w),y:Math.min(rt,k),width:Math.abs(w-tt),height:Math.abs(k-rt)});var E=x.slice(),P=[],I=Fe();for(c=I.length,t=0;t<c;++t){var N=I[t];x.includes(N)||P.push(N);var T=E.indexOf(N);-1!==T&&E.splice(T,1)}E.length>0&&s.removeFromSelection(E),P.length>0&&s.addToSelection(P);break;case"resize":p=K(g);var L=Ce(p),M=(h=L?at:Rt(g)).x,O=h.y,j=h,V=j.width,R=j.height;if(o=S-Je,l=C-et,i.gridSnapping&&(o=en(o),l=en(l),R=en(R),V=en(V)),u=Qt(g)){var B=Math.sqrt(o*o+l*l),D=Math.atan2(l,o)-u*Math.PI/180;o=B*Math.cos(D),l=B*Math.sin(D)}Ne.includes("n")||Ne.includes("s")||(l=0),Ne.includes("e")||Ne.includes("w")||(o=0);var F=0,H=0,Y=R?(R+l)/R:1,W=V?(V+o)/V:1;Ne.includes("n")&&(Y=R?(R-l)/R:1,H=R),Ne.includes("w")&&(W=V?(V-o)/V:1,F=V);var X=d.createSVGTransform(),Q=d.createSVGTransform(),Z=d.createSVGTransform();if(i.gridSnapping&&(M=en(M),F=en(F),O=en(O),H=en(H)),X.setTranslate(-(M+F),-(O+H)),e.shiftKey&&(1===W?W=Y:Y=W),Q.setScale(W,Y),Z.setTranslate(M+F,O+H),L){var $=u?1:0;p.replaceItem(X,2+$),p.replaceItem(Q,1+$),p.replaceItem(Z,Number($))}else{var J=p.numberOfItems;p.replaceItem(Z,J-3),p.replaceItem(Q,J-2),p.replaceItem(X,J-1)}U.requestSelector(g).resize(),q("transition",x);break;case"zoom":w*=v,k*=v,$t(Oe,{x:Math.min(tt*v,w),y:Math.min(rt*v,k),width:Math.abs(w-tt*v),height:Math.abs(k-rt*v)});break;case"text":$t(b,{x:S,y:C});break;case"line":i.gridSnapping&&(S=en(S),C=en(C));var ee=S,te=C;e.shiftKey&&(ee=(n=Pe(Je,et,ee,te)).x,te=n.y),b.setAttribute("x2",ee),b.setAttribute("y2",te);break;case"foreignObject":case"square":case"rect":case"image":var ne,re,ae="square"===xe||e.shiftKey,ie=Math.abs(S-Je),oe=Math.abs(C-et);ae?(ie=oe=Math.max(ie,oe),ne=Je<S?Je:Je-ie,re=et<C?et:et-oe):(ne=Math.min(Je,S),re=Math.min(et,C)),i.gridSnapping&&(ie=en(ie),oe=en(oe),ne=en(ne),re=en(re)),$t(b,{width:ie,height:oe,x:ne,y:re});break;case"circle":var se=ir(b).attr(["cx","cy"]);r=se.cx,a=se.cy;var le=Math.sqrt((S-r)*(S-r)+(C-a)*(C-a));i.gridSnapping&&(le=en(le)),b.setAttribute("r",le);break;case"ellipse":var ce=ir(b).attr(["cx","cy"]);r=ce.cx,a=ce.cy,i.gridSnapping&&(S=en(S),r=en(r),C=en(C),a=en(a)),b.setAttribute("rx",Math.abs(S-r));var ue=Math.abs(e.shiftKey?S-r:C-a);b.setAttribute("ry",ue);break;case"fhellipse":case"fhrect":$e.minx=Math.min(w,$e.minx),$e.maxx=Math.max(w,$e.maxx),$e.miny=Math.min(k,$e.miny),$e.maxy=Math.max(k,$e.maxy);case"fhpath":if(ct.x=w,ct.y=k,ot.x&&ot.y)for(t=0;t<9;t++)if(Ze=t/10,ut=ht((t+1)/10),dt=ut,ut=ht(Ze),(it+=Math.sqrt((dt.x-ut.x)*(dt.x-ut.x)+(dt.y-ut.y)*(dt.y-ut.y)))>.8){it-=.8;var de=f.createSVGPoint();de.x=ut.x,de.y=ut.y,b.points.appendItem(de)}ot={x:st.x,y:st.y},st={x:lt.x,y:lt.y},lt={x:ct.x,y:ct.y};break;case"path":case"pathedit":if(S*=v,C*=v,i.gridSnapping&&(S=en(S),C=en(C),Je=en(Je),et=en(et)),e.shiftKey){var he,pe,fe=Re;fe?(he=fe.dragging?fe.dragging[0]:Je,pe=fe.dragging?fe.dragging[1]:et):(he=Je,pe=et);var ge=n=Pe(he,pe,S,C);S=ge.x,C=ge.y}Oe&&"none"!==Oe.getAttribute("display")&&(w*=v,k*=v,$t(Oe,{x:Math.min(tt*v,w),y:Math.min(rt*v,k),width:Math.abs(w-tt*v),height:Math.abs(k-rt*v)})),G.mouseMove(S,C);break;case"textedit":S*=v,C*=v,Ct.mouseMove(y,_);break;case"rotate":r=(h=Rt(g)).x+h.width/2,a=h.y+h.height/2;var me=Ge(g),ve=we(r,a,me);r=ve.x,a=ve.y,u=(Math.atan2(a-C,r-S)*(180/Math.PI)-90)%360,i.gridSnapping&&(u=en(u)),e.shiftKey&&(u=45*Math.round(u/45)),s.setRotationAngle(u<-180?360+u:u,!0),q("transition",x)}Ue("mouseMove",{event:e,mouse_x:y,mouse_y:_,selected:g})}})).click((function(e){return e.preventDefault(),!1})).dblclick((function(e){var t=e.target.parentNode;if(t!==y){var n=J(e),r=n.tagName;if("text"===r&&"textedit"!==xe){var a=we(e.pageX,e.pageY,Qe);Ct.select(n,a.x,a.y)}"g"!==r&&"a"!==r||!Qt(n)||(dn(n),n=x[0],Q(!0)),y&&Rn(),"g"!==t.tagName&&"a"!==t.tagName||t===m().getCurrentLayer()||n===U.selectorParentGroup||Bn(n)}})).mouseup((function(e){if(2!==e.button){var t=Le;if(Le=null,ye){var n,r,a=we(e.pageX,e.pageY,Qe),o=a.x*v,l=a.y*v,c=o/v,u=l/v,d=Zt(z()),h=!1,p=c,f=u;switch(ye=!1,xe){case"resize":case"multiselect":nn(Oe)||(Oe.setAttribute("display","none"),je=[]),xe="select";case"select":if(!nn(x[0])){if(nn(x[1])){var g=x[0];switch(g.tagName){case"g":case"use":case"image":case"foreignObject":break;default:Te.fill=g.getAttribute("fill"),Te.fill_opacity=g.getAttribute("fill-opacity"),Te.stroke=g.getAttribute("stroke"),Te.stroke_opacity=g.getAttribute("stroke-opacity"),Te.stroke_width=g.getAttribute("stroke-width"),Te.stroke_dasharray=g.getAttribute("stroke-dasharray"),Te.stroke_linejoin=g.getAttribute("stroke-linejoin"),Te.stroke_linecap=g.getAttribute("stroke-linecap")}"text"===g.tagName&&(fe.font_size=g.getAttribute("font-size"),fe.font_family=g.getAttribute("font-family")),U.requestSelector(g).showGrips(!0)}if(We(),p!==tt||f!==rt)for(var y=x.length,_=0;_<y&&!nn(x[_]);++_)x[_].firstChild||U.requestSelector(x[_]).resize();else r=e.target,"path"===x[0].nodeName&&nn(x[1])?G.select(x[0]):e.shiftKey&&t!==r&&s.removeFromSelection([r]);if(F()){var w=x[0];w&&(w.removeAttribute("style"),Nt(w,(function(e){e.removeAttribute("style")})))}}return;case"zoom":nn(Oe)||Oe.setAttribute("display","none");var k=e.shiftKey?.5:2;return void q("zoomed",{x:Math.min(tt,p),y:Math.min(rt,f),width:Math.abs(p-tt),height:Math.abs(f-rt),factor:k});case"fhpath":it=0,ot={x:0,y:0},st={x:0,y:0},lt={x:0,y:0},ct={x:0,y:0};var C=d.getAttribute("points"),A=C.indexOf(",");(h=A>=0?C.includes(",",A+1):C.includes(" ",C.indexOf(" ")+1))&&(d=G.smoothPolylineIntoPath(d));break;case"line":n=ir(d).attr(["x1","x2","y1","y2"]),h=n.x1!==n.x2||n.y1!==n.y2;break;case"foreignObject":case"square":case"rect":case"image":n=ir(d).attr(["width","height"]),h=n.width||n.height||"image"===xe;break;case"circle":h="0"!==d.getAttribute("r");break;case"ellipse":n=ir(d).attr(["rx","ry"]),h=n.rx||n.ry;break;case"fhellipse":$e.maxx-$e.minx>0&&$e.maxy-$e.miny>0&&(d=S({element:"ellipse",curStyles:!0,attr:{cx:($e.minx+$e.maxx)/2,cy:($e.miny+$e.maxy)/2,rx:($e.maxx-$e.minx)/2,ry:($e.maxy-$e.miny)/2,id:z()}}),q("changed",[d]),h=!0);break;case"fhrect":$e.maxx-$e.minx>0&&$e.maxy-$e.miny>0&&(d=S({element:"rect",curStyles:!0,attr:{x:$e.minx,y:$e.miny,width:$e.maxx-$e.minx,height:$e.maxy-$e.miny,id:z()}}),q("changed",[d]),h=!0);break;case"text":h=!0,Ke([d]),Ct.start(d);break;case"path":d=null,ye=!0;var E=G.mouseUp(e,d,o,l);d=E.element,h=E.keep;break;case"pathedit":h=!0,d=null,G.mouseUp(e);break;case"textedit":h=!1,d=null,Ct.mouseUp(e,o,l);break;case"rotate":h=!0,d=null,xe="select";var P=s.undoMgr.finishUndoableChange();P.isEmpty()||M(P),We(),q("changed",x)}var I=Ue("mouseUp",{event:e,mouse_x:o,mouse_y:l},!0);if(ir.each(I,(function(e,t){t&&(h=t.keep||h,d=t.element,ye=t.started||ye)})),h||nn(d)){if(!nn(d)){s.addedNew=!0;var N,T=.2;if(ce.beginElement&&parseFloat(d.getAttribute("opacity"))!==b.opacity){N=ir(ce).clone().attr({to:b.opacity,dur:T}).appendTo(d);try{N[0].beginElement()}catch(e){}}else T=0;setTimeout((function(){N&&N.remove(),d.setAttribute("opacity",b.opacity),d.setAttribute("style","pointer-events:inherit"),Jt(d),"path"===xe?G.toEditMode(d):i.selectNew&&Ke([d],!0),M(new sr(d)),q("changed",[d])}),1e3*T)}}else{for(m().releaseId(z()),d.remove(),d=null,r=e.target;r&&r.parentNode&&r.parentNode.parentNode&&"g"===r.parentNode.parentNode.tagName;)r=r.parentNode;"path"===xe&>||!r||!r.parentNode||"selectorParentGroup"===r.parentNode.id||"svgcanvas"===r.id||"svgroot"===r.id||(s.setMode("select"),Ke([r],!0))}_e=null}}})),ir(r).bind("mousewheel DOMMouseScroll",(function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;Qe=ir("#svgcontent g")[0].getScreenCTM().inverse();var n=ir("#workarea"),r=i.showRulers?16:0,a=we(t.pageX,t.pageY,Qe),o=n.width(),l=n.height(),c=o-15-r,u=l-15-r,d=c*Qe.a,h=u*Qe.d,p=n.offset(),f=p.left+r,g=p.top+r,m=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(m){var y,_,b=Math.max(.75,Math.min(4/3,m));b>1?(y=Math.ceil(c/d*b*100)/100,_=Math.ceil(u/h*b*100)/100):(y=Math.floor(c/d*b*100)/100,_=Math.floor(u/h*b*100)/100);var x=Math.min(y,_);if((x=Math.min(10,Math.max(.01,x)))!==v){b=x/v;var w=we(f,g,Qe),S={x:(a.x-(a.x-w.x)/b)*x-r+o/2,y:(a.y-(a.y-w.y)/b)*x-r+l/2};s.setZoom(x),ir("#zoom").val((100*x).toFixed(1)),q("updateCanvas",{center:!1,newCtr:S}),q("zoomDone")}}}}));var mt,Ct=s.textActions=function(){var e,t,n,r,a,i,o,l,c,u,p=[];function f(e){var o=""===t.value;if(ir(t).focus(),!arguments.length)if(o)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var s=p[e];o||t.setSelectionRange(e,e),(n=Zt("text_cursor"))||(n=document.createElementNS(h.SVG,"line"),$t(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=Zt("selectorParentGroup").appendChild(n)),a||(a=setInterval((function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")}),600));var l=w(s.x,i.y),c=w(s.x,i.y+i.height);$t(n,{x1:l.x,y1:l.y,x2:c.x,y2:c.y,visibility:"visible",display:"inline"}),r&&r.setAttribute("d","")}function g(e,a,o){if(e!==a){o||t.setSelectionRange(e,a),(r=Zt("text_selectblock"))||(r=document.createElementNS(h.SVG,"path"),$t(r,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),Zt("selectorParentGroup").append(r));var s=p[e],l=p[a];n.setAttribute("visibility","hidden");var c=w(s.x,i.y),u=w(s.x+(l.x-s.x),i.y),d=w(s.x,i.y+i.height),g=w(s.x+(l.x-s.x),i.y+i.height),m="M"+c.x+","+c.y+" L"+u.x+","+u.y+" "+g.x+","+g.y+" "+d.x+","+d.y+"z";$t(r,{d:m,display:"inline"})}else f(a)}function m(t,n){var r=d.createSVGPoint();if(r.x=t,r.y=n,1===p.length)return 0;var a=e.getCharNumAtPosition(r);a<0?(a=p.length-2,t<=p[0].x&&(a=0)):a>=p.length-2&&(a=p.length-2);var i=p[a];return t>i.x+i.width/2&&a++,a}function y(e,t){f(m(e,t))}function _(e,n,r){var a=t.selectionStart,i=m(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/=v,n.y/=v,o){var r=we(n.x,n.y,o.inverse());n.x=r.x,n.y=r.y}return n}function w(e,t){var n={x:e,y:t};if(o){var r=we(n.x,n.y,o);n.x=r.x,n.y=r.y}return n.x*=v,n.y*=v,n}function S(t){g(0,e.textContent.length),ir(this).unbind(t)}function k(t){if(u&&e){var n=we(t.pageX,t.pageY,Qe),r=b(n.x*v,n.y*v),a=m(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),ir(t.target).click(S),setTimeout((function(){ir(t.target).unbind("click",S)}),300)}}return{select:function(t,n,r){e=t,Ct.toEditMode(n,r)},start:function(t){e=t,Ct.toEditMode()},mouseDown:function(e,n,r,a){var i=b(r,a);t.focus(),y(i.x,i.y),l=r,c=a},mouseMove:function(e,t){var n=b(e,t);_(n.x,n.y)},mouseUp:function(t,n,r){var a=b(n,r);_(a.x,a.y,!0),t.target!==e&&n<l+2&&n>l-2&&r<c+2&&r>c-2&&Ct.toSelectMode(!0)},setCursor:f,toEditMode:function(t,n){if(u=!1,xe="textedit",U.requestSelector(e).showGrips(!1),U.requestSelector(e),Ct.init(),ir(e).css("cursor","text"),arguments.length){var r=b(t,n);y(r.x,r.y)}else f();setTimeout((function(){u=!0}),300)},toSelectMode:function(i){xe="select",clearInterval(a),a=null,r&&ir(r).attr("display","none"),n&&ir(n).attr("visibility","hidden"),ir(e).css("cursor","move"),i&&(Q(),ir(e).css("cursor","move"),q("selected",[e]),Z([e],!0)),e&&!e.textContent.length&&s.deleteSelectedElements(),ir(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===xe&&Ct.toSelectMode()},init:function(n){if(e){var r,a;e.parentNode||(e=x[0],U.requestSelector(e).showGrips(!1));var l=e.textContent.length,c=e.getAttribute("transform");for(i=Rt(e),o=c?Ge(e):null,(p=[]).length=l,t.focus(),ir(e).unbind("dblclick",k).dblclick(k),l||(a={x:i.x+i.width/2,width:0}),r=0;r<l;r++){var u=e.getStartPositionOfChar(r);if(a=e.getEndPositionOfChar(r),!P){var d=s.contentW*v;u.x-=d,a.x-=d,u.x/=v,a.x/=v}p[r]={x:u.x,y:i.y,width:a.x-u.x,height:i.height}}p.push({x:a.x,width:0}),g(t.selectionStart,t.selectionEnd,!0)}}}}(),At=this.removeUnusedDefElems=function(){var e=f.getElementsByTagNameNS(h.SVG,"defs");if(!e||!e.length)return 0;var t,n,r=[],a=0,i=["fill","stroke","filter","marker-start","marker-mid","marker-end"],o=i.length,s=f.getElementsByTagNameNS(h.SVG,"*"),l=s.length;for(t=0;t<l;t++){var c=s[t];for(n=0;n<o;n++){var u=Tt(c.getAttribute(i[n]));u&&r.push(u.substr(1))}var d=Lt(c);d&&d.startsWith("#")&&r.push(d.substr(1))}var p=ir(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");for(t=p.length;t--;){var g=p[t],m=g.id;r.includes(m)||(me[m]=g,g.remove(),a++)}return a};function Pt(){Q();var e=[],t=[],n={feGaussianBlur:ae.exportNoBlur,foreignObject:ae.exportNoforeignObject,"[stroke-dasharray]":ae.exportNoDashArray},r=ir(f);return"font"in ir("<canvas>")[0].getContext("2d")||(n.text=ae.exportNoText),ir.each(n,(function(n,a){r.find(n).length&&(t.push(n),e.push(a))})),{issues:e,issueCodes:t}}this.svgCanvasToString=function(){for(;At()>0;);G.clear(!0),ir.each(f.childNodes,(function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&f.firstChild.before(t)})),y&&(Rn(),Ke([y]));var e=[];ir(f).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),ir(this).replaceWith(a)}}));var t=this.svgToString(f,0);return e.length&&ir(e).each((function(){ze(this)})),t},this.svgToString=function(e,t){var n=[],r=i.baseUnit,a=new RegExp("^-?[\\d\\.]+"+r+"$");if(e){Jt(e);var o=u(e.attributes),s=e.childNodes;o.sort((function(e,t){return e.name>t.name?-1:1}));for(var l=0;l<t;l++)n.push(" ");if(n.push("<"),n.push(e.nodeName),"svgcontent"===e.id){var c=Xt();"px"!==r&&(c.w=re(c.w,r)+r,c.h=re(c.h,r)+r),n.push(' width="'+c.w+'" height="'+c.h+'" xmlns="'+h.SVG+'"');var d={};ir(e).find("*").andSelf().each((function(){var e=this.namespaceURI;e&&!d[e]&&T[e]&&"xmlns"!==T[e]&&"xml"!==T[e]&&(d[e]=!0,n.push(" xmlns:"+T[e]+'="'+e+'"')),ir.each(this.attributes,(function(e,t){var r=t.namespaceURI;r&&!d[r]&&"xmlns"!==T[r]&&"xml"!==T[r]&&(d[r]=!0,n.push(" xmlns:"+T[r]+'="'+r+'"'))}))}));for(var p=o.length,f=["width","height","xmlns","x","y","viewBox","id","overflow"];p--;){var g=o[p],m=wt(g.value);g.nodeName.startsWith("xmlns:")||(""===m||f.includes(g.localName)||g.namespaceURI&&!T[g.namespaceURI]||(n.push(" "),n.push(g.nodeName),n.push('="'),n.push(m),n.push('"')))}}else{if("defs"===e.nodeName&&!e.firstChild)return"";for(var v=["-moz-math-font-style","_moz-math-font-style"],y=o.length-1;y>=0;y--){var _=o[y],b=wt(_.value);if(!v.includes(_.localName)&&""!==b){if(b.startsWith("pointer-events"))continue;if("class"===_.localName&&b.startsWith("se_"))continue;if(n.push(" "),"d"===_.localName&&(b=G.convertPath(e,!0)),isNaN(b)?a.test(b)&&(b=ne(b)+r):b=ne(b),he.apply&&"image"===e.nodeName&&"href"===_.localName&&he.images&&"embed"===he.images){var x=de[b];x&&(b=x)}_.namespaceURI&&_.namespaceURI!==h.SVG&&!T[_.namespaceURI]||(n.push(_.nodeName),n.push('="'),n.push(b),n.push('"'))}}}if(e.hasChildNodes()){n.push(">"),t++;for(var w=!1,S=0;S<s.length;S++){var k=s.item(S);switch(k.nodeType){case 1:n.push("\n"),n.push(this.svgToString(s.item(S),t));break;case 3:var C=k.nodeValue.replace(/^\s+|\s+$/g,"");""!==C&&(w=!0,n.push(String(wt(C))));break;case 4:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("<![CDATA["),n.push(k.nodeValue),n.push("]]>");break;case 8:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("\x3c!--"),n.push(k.data),n.push("--\x3e")}}if(t--,!w){n.push("\n");for(var A=0;A<t;A++)n.push(" ")}n.push("</"),n.push(e.nodeName),n.push(">")}else n.push("/>")}return n.join("")},this.embedImage=function(e){return new Promise((function(t,n){ir(new Image).load((function(r,a,i){if("error"!==a){var o=document.createElement("canvas");o.width=this.width,o.height=this.height,o.getContext("2d").drawImage(this,0,0);try{var s=";svgedit_url="+encodeURIComponent(e);s=o.toDataURL().replace(";base64",s+";base64"),de[e]=s}catch(t){de[e]=!1}ve=e,t(de[e])}else n(new Error("Error loading image: "+i.status+" "+i.statusText))})).attr("src",e)}))},this.setGoodImage=function(e){ve=e},this.open=function(){},this.save=function(e){Q(),e&&ir.extend(he,e),he.apply=!0;var t=this.svgCanvasToString();q("saved",t)},this.rasterExport=function(e,t,n){var r,a,o,l,c,u,d,h,p,f=arguments;return regeneratorRuntime.async((function(g){for(;;)switch(g.prev=g.next){case 0:if(r=f.length>3&&void 0!==f[3]?f[3]:{},o="image/"+(a="ICO"===e?"BMP":e||"PNG").toLowerCase(),l=Pt(),c=l.issues,u=l.issueCodes,d=this.svgCanvasToString(),mt){g.next=10;break}return g.next=8,regeneratorRuntime.awrap(cn(i.canvgPath+"canvg.js",{global:"canvg"}));case 8:h=g.sent,mt=h.canvg;case 10:return ir("#export_canvas").length||ir("<canvas>",{id:"export_canvas"}).hide().appendTo("body"),(p=ir("#export_canvas")[0]).width=s.contentW,p.height=s.contentH,g.next=16,regeneratorRuntime.awrap(mt(p,d));case 16:return g.abrupt("return",new Promise((function(i,s){var l,h=a.toLowerCase(),f=t?p.toDataURL("image/"+h,t):p.toDataURL("image/"+h);function g(){var a={datauri:f,bloburl:l,svg:d,issues:c,issueCodes:u,type:e,mimeType:o,quality:t,exportWindowName:n};r.avoidEvent||q("exported",a),i(a)}p.toBlob?p.toBlob((function(e){l=Gt(e),g()}),o,t):(l=Et(f),g())})));case 17:case"end":return g.stop()}}),null,this)},this.exportPDF=function(e){var t,n,r,a,o,s,l,c,u,d,h,p,f=arguments;return regeneratorRuntime.async((function(g){for(;;)switch(g.prev=g.next){case 0:if(t=f.length>1&&void 0!==f[1]?f[1]:R()?"save":void 0,window.jsPDF){g.next=7;break}return g.next=4,regeneratorRuntime.awrap(un(["jspdf/underscore-min.js","jspdf/jspdf.min.js"]));case 4:return n=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules),g.next=7,regeneratorRuntime.awrap(un(i.jspdfPath+"jspdf.plugin.svgToPdf.js",{type:n?"module":"text/javascript"}));case 7:return r=Xt(),a=r.w>r.h?"landscape":"portrait",o="pt",s=jsPDF({orientation:a,unit:o,format:[r.w,r.h]}),l=rn(),s.setProperties({title:l}),c=Pt(),u=c.issues,d=c.issueCodes,h=this.svgCanvasToString(),s.addSVG(h,0,0),(p={svg:h,issues:u,issueCodes:d,exportWindowName:e,outputType:t=t||"dataurlstring"}).output=s.output(t,"save"===t?e||"svg.pdf":void 0),q("exportedPDF",p),g.abrupt("return",p);case 21:case"end":return g.stop()}}),null,this)},this.getSvgString=function(){return he.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?An(!1,m()):An(!0,m())};var Vt=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var r in Nt(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),ir.each(se,(function(n,r){var a=e.getAttributeNode(r);if(a){var i=Tt(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=Lt(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=H();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];Mt(d,"#"+i)}}}},Bt=this.setUseData=function(e){var t=ir(e);"use"!==e.tagName&&(t=t.find("use")),t.each((function(){var e=Lt(this).substr(1),t=Zt(e);t&&(ir(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||ir(this).data("symbol",t).data("ref",t))}))},Ht=this.convertGradients=function(e){var t=ir(e).find("linearGradient, radialGradient");!t.length&&O()&&(t=ir(e).find("*").filter((function(){return this.tagName.includes("Gradient")}))),t.each((function(){if("userSpaceOnUse"===ir(this).attr("gradientUnits")){var e=ir(f).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=Rt(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=ir(this).attr(["x1","y1","x2","y2"]),r=this.gradientTransform.baseVal;if(r&&r.numberOfItems>0){var a=Ee(r).matrix,i=we(n.x1,n.y1,a),o=we(n.x2,n.y2,a);n.x1=i.x,n.y1=i.y,n.x2=o.x,n.y2=o.y,this.removeAttribute("gradientTransform")}ir(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")}}}))},zt=this.convertToGroup=function(e){e||(e=x[0]);var t,n=ir(e),r=new ur;if(n.data("gsvg")){var a=e.firstChild,i=ir(a).attr(["x","y"]);ir(e.firstChild.firstChild).unwrap(),ir(e).removeData("gsvg");var o=K(e),s=d.createSVGTransform();s.setTranslate(i.x,i.y),o.appendItem(s),er(e),q("selected",[e])}else if(n.data("symbol")){e=n.data("symbol"),t=n.attr("transform");var c=n.attr(["x","y"]),u=e.getAttribute("viewBox");if(u){var p=u.split(" ");c.x-=Number(p[0]),c.y-=Number(p[1])}t+=" translate("+(c.x||0)+","+(c.y||0)+")";var g=n.prev();r.addSubCommand(new lr(n[0],n[0].nextSibling,n[0].parentNode)),n.remove();var m,v=ir(f).find("use:data(symbol)").length,y=l.createElementNS(h.SVG,"g"),_=e.childNodes;for(m=0;m<_.length;m++)y.append(_[m].cloneNode(!0));if(j()){var b=ir(Ot()).children("linearGradient,radialGradient,pattern").clone();ir(y).append(b)}t&&y.setAttribute("transform",t);var w=e.parentNode;if(Vt(y),j()&&ir(Ot()).append(ir(y).find("linearGradient,radialGradient,pattern")),y.id=H(),g.after(y),w){if(!v){var S=e.nextSibling;e.remove(),r.addSubCommand(new lr(e,S,w))}r.addSubCommand(new sr(y))}Bt(y),j()?Ht(Ot()):Ht(y),function(e,t){if(e&&1===e.nodeType){for(var n=e.childNodes.length;n--;)Nt(e.childNodes.item(n),t);t(e)}}(y,(function(e){try{er(e)}catch(e){console.log(e)}})),ir(y).find(oe).each((function(){this.id||(this.id=H())})),Ke([y]);var k=dn(y,!0);k&&r.addSubCommand(k),M(r)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e,t){try{var n=It(e);if(n.firstElementChild&&n.firstElementChild.namespaceURI!==h.SVG)return!1;this.prepareSvg(n);var r=new ur("Change Source"),a=f.nextSibling,o=d.removeChild(f);r.addSubCommand(new lr(o,a,d)),f=l.adoptNode?l.adoptNode(n.documentElement):l.importNode(n.documentElement,!0),d.append(f);var c=ir(f);s.current_drawing_=new Cn(f,g);var u=m().getNonce();u?q("setnonce",u):q("unsetnonce"),c.find("image").each((function(){var e=this;tn(e);var t=Lt(this);if(t){if(t.startsWith("data:")){var n=t.match(/svgedit_url=(.*?);/);if(n){var r=decodeURIComponent(n[1]);ir(new Image).load((function(){e.setAttributeNS(h.XLINK,"xlink:href",r)})).attr("src",r)}}s.embedImage(t)}})),c.find("svg").each((function(){if(!ir(this).closest("defs").length){Vt(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?(ir(e).data("gsvg",this),e.id=e.id||H()):ze(this)}})),j()&&c.find("linearGradient, radialGradient, pattern").appendTo(Ot()),Bt(c),Ht(c[0]);var p={id:"svgcontent",overflow:i.show_outside_canvas?"visible":"hidden"},y=!1;if(c.attr("viewBox")){var _=c.attr("viewBox").split(" ");p.width=_[2],p.height=_[3]}else ir.each(["width","height"],(function(e,t){var n=c.attr(t)||"100%";"%"===String(n).substr(-1)?y=!0:p[t]=ie(t,n)}));if(En(),c.children().find(oe).each((function(){this.id||(this.id=H())})),y){var b=Wt();p.width=b.width+b.x,p.height=b.height+b.y}p.width<=0&&(p.width=100),p.height<=0&&(p.height=100),c.attr(p),this.contentW=p.width,this.contentH=p.height,r.addSubCommand(new sr(f));var x=c.attr(["width","height"]);r.addSubCommand(new cr(d,x)),v=1,W={},Q(),Ve={},d.append(U.selectorParentGroup),t||M(r),q("changed",[f])}catch(e){return console.log(e),!1}return!0},this.importSvgString=function(e){var t,n,r;try{var a=St(e.length+e).substr(0,32),i=!1;pe[a]&&ir(pe[a].symbol).parents("#svgroot").length&&(i=!0);var o,s=new ur("Import Image");if(i)o=pe[a].symbol,n=pe[a].xform;else{var c,u=It(e);this.prepareSvg(u),c=l.adoptNode?l.adoptNode(u.documentElement):l.importNode(u.documentElement,!0),Vt(c);var d=ie("width",c.getAttribute("width")),p=ie("height",c.getAttribute("height")),g=c.getAttribute("viewBox"),v=g?g.split(" "):[0,0,d,p];for(t=0;t<4;++t)v[t]=Number(v[t]);var _=Number(f.getAttribute("height"));n="translate(0) "+(n=p>d?"scale("+_/3/v[3]+")":"scale("+_/3/v[2]+")")+" translate(0)",o=l.createElementNS(h.SVG,"symbol");var b=Ot();for(j()&&ir(c).find("linearGradient, radialGradient, pattern").appendTo(b);c.firstChild;){var x=c.firstChild;o.append(x)}var w=c.attributes,S=!0,k=!1,C=void 0;try{for(var A,E=w[Symbol.iterator]();!(S=(A=E.next()).done);S=!0){var G=A.value;o.setAttribute(G.nodeName,G.value)}}catch(e){k=!0,C=e}finally{try{S||null==E.return||E.return()}finally{if(k)throw C}}o.id=H(),pe[a]={symbol:o,xform:n},Ot().append(o),s.addSubCommand(new sr(o))}(r=l.createElementNS(h.SVG,"use")).id=H(),Mt(r,"#"+o.id),(y||m().getCurrentLayer()).append(r),s.addSubCommand(new sr(r)),Q(),r.setAttribute("transform",n),er(r),ir(r).data("symbol",o).data("ref",o),Z([r]),M(s),q("changed",[f])}catch(e){return console.log(e),null}return r};var qt={identifyLayers:En,createLayer:Gn,cloneLayer:Pn,deleteCurrentLayer:In,setCurrentLayer:Nn,renameCurrentLayer:Tn,setCurrentLayerPosition:Ln,setLayerVisibility:Mn,moveSelectedToLayer:On,mergeLayer:jn,mergeAllLayers:Vn,leaveContext:Rn,setContext:Bn};Object.entries(qt).forEach((function(e){var t=c(e,2),n=t[0],r=t[1];s[n]=r})),function(e){kn=e}({pathActions:G,getCurrentGroup:function(){return y},setCurrentGroup:function(e){y=e},getSelectedElements:E,getSVGContent:A,undoMgr:L,elData:le,getCurrentDrawing:m,clearSelection:Q,call:q,addCommandToHistory:M,changeSVGContent:function(){q("changed",[f])}}),this.clear=function(){G.clear(),Q(),s.clearSvgContentElement(),s.current_drawing_=new Cn(f),s.createLayer("Layer 1"),s.undoMgr.resetUndoStack(),U.initGroup(),Oe=U.getRubberBandBox(),q("cleared")},this.linkControlPoints=G.linkControlPoints,this.getContentElem=function(){return f},this.getRootElem=function(){return d};var Xt=this.getResolution=function(){return{w:f.getAttribute("width")/v,h:f.getAttribute("height")/v,zoom:v}};this.getSnapToGrid=function(){return i.gridSnapping},this.getVersion=function(){return"svgcanvas.js ($Rev$)"},this.setUiStrings=function(e){Object.assign(ae,e.notification),ir=hn(ir,e.common),Me(e)},this.setConfig=function(e){Object.assign(i,e)},this.getTitle=function(e){if(e=e||x[0]){var t=(e=ir(e).data("gsvg")||ir(e).data("symbol")||e).childNodes,n=!0,r=!1,a=void 0;try{for(var i,o=t[Symbol.iterator]();!(n=(i=o.next()).done);n=!0){var s=i.value;if("title"===s.nodeName)return s.textContent}}catch(e){r=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw a}}return""}},this.setGroupTitle=function(e){var t=x[0];t=ir(t).data("gsvg")||t;var n,r=ir(t).children("title"),a=new ur("Set Label");if(e.length)r.length?(n=r[0],a.addSubCommand(new cr(n,{"#text":n.textContent})),n.textContent=e):((n=l.createElementNS(h.SVG,"title")).textContent=e,ir(t).prepend(n),a.addSubCommand(new sr(n)));else{var i=r.nextSibling;a.addSubCommand(new lr(r[0],i,t)),r.remove()}M(a)};var rn=this.getDocumentTitle=function(){return s.getTitle(f)};this.setDocumentTitle=function(e){var t=f.childNodes,n=!1,r="",a=new ur("Change Image Title"),i=!0,o=!1,s=void 0;try{for(var c,u=t[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var d=c.value;if("title"===d.nodeName){r=(n=d).textContent;break}}}catch(e){o=!0,s=e}finally{try{i||null==u.return||u.return()}finally{if(o)throw s}}n||(n=l.createElementNS(h.SVG,"title"),f.insertBefore(n,f.firstChild)),e.length?n.textContent=e:n.remove(),a.addSubCommand(new cr(n,{"#text":r})),M(a)},this.getEditorNS=function(e){return e&&f.setAttribute("xmlns:se",h.SE),h.SE},this.setResolution=function(e,t){var n,r=Xt(),a=r.w,i=r.h;if("fit"===e){var o=Wt();if(!o)return!1;n=new ur("Fit Canvas to Content");var l=Yt();Z(l);var c=[],u=[];ir.each(l,(function(e,t){c.push(-1*o.x),u.push(-1*o.y)}));var d=s.moveSelectedElements(c,u,!0);n.addSubCommand(d),Q(),e=Math.round(o.width),t=Math.round(o.height)}return e===a&&t===i||(n||(n=new ur("Change Image Dimensions")),e=ie("width",e),t=ie("height",t),f.setAttribute("width",e),f.setAttribute("height",t),this.contentW=e,this.contentH=t,n.addSubCommand(new cr(f,{width:a,height:i})),f.setAttribute("viewBox",[0,0,e/v,t/v].join(" ")),n.addSubCommand(new cr(f,{viewBox:["0 0",a,i].join(" ")})),M(n),q("changed",[f])),!0},this.getOffset=function(){return ir(f).attr(["x","y"])},this.setBBoxZoom=function(t,n,r){var a,i=.85,o=function(e){if(!e)return!1;var t=Math.round(n/e.width*100*i)/100,a=Math.round(r/e.height*100*i)/100,o=Math.min(t,a);return s.setZoom(o),{zoom:o,bbox:e}};if("object"===e(t)){if(0===(a=t).width||0===a.height){var l=a.zoom?a.zoom:v*a.factor;return s.setZoom(l),{zoom:v,bbox:a}}return o(a)}switch(t){case"selection":if(!x[0])return;var c=ir.map(x,(function(e){if(e)return e}));a=Wt(c);break;case"canvas":var u=Xt();i=.95,a={width:u.w,height:u.h,x:0,y:0};break;case"content":a=Wt();break;case"layer":a=Wt(Yt(m().getCurrentLayer()));break;default:return}return o(a)},this.setZoom=function(e){var t=Xt();f.setAttribute("viewBox","0 0 "+t.w/e+" "+t.h/e),v=e,ir.each(x,(function(e,t){t&&U.requestSelector(t).resize()})),G.zoomChange(),Ue("zoomChanged",e)},this.getMode=function(){return xe},this.setMode=function(e){G.clear(!0),Ct.clear(),Te=x[0]&&"text"===x[0].nodeName?fe:b,xe=e},this.getColor=function(e){return Te[e]},this.setColor=function(e,t,n){b[e]=t,Te[e+"_paint"]={type:"solidColor"};var r=[];function a(e){"g"!==e.nodeName&&r.push(e)}for(var i=x.length;i--;){var o=x[i];o&&("g"===o.tagName?Nt(o,a):"fill"===e?"polyline"!==o.tagName&&"line"!==o.tagName&&r.push(o):r.push(o))}r.length>0&&(n?sn(e,t,r):(ln(e,t,r),q("changed",r)))};var an=this.setGradient=function(e){if(Te[e+"_paint"]&&"solidColor"!==Te[e+"_paint"].type){var t=s[e+"Grad"],n=on(t),r=Ot();n?t=n:(t=r.appendChild(l.importNode(t,!0))).id=H(),s.setColor(e,"url(#"+t.id+")")}},on=function(e){for(var t=Ot(),n=ir(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=ir(e).attr(a),n=ir(i).attr(a),r=!1;if(ir.each(a,(function(e,a){t[a]!==n[a]&&(r=!0)})),r)return"continue"}())continue;var o=e.getElementsByTagNameNS(h.SVG,"stop"),s=i.getElementsByTagNameNS(h.SVG,"stop");if(o.length===s.length){for(var l=o.length;l--;){var c=o[l],u=s[l];if(c.getAttribute("offset")!==u.getAttribute("offset")||c.getAttribute("stop-opacity")!==u.getAttribute("stop-opacity")||c.getAttribute("stop-color")!==u.getAttribute("stop-color"))break}if(-1===l)return i}}return null};this.setPaint=function(e,t){var n=new ir.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),Te[e+"_paint"]=n,n.type){case"solidColor":this.setColor(e,"none"!==n.solidColor?"#"+n.solidColor:"none");break;case"linearGradient":case"radialGradient":s[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 Te.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(xe))s.setStrokeWidth(1);else{Te.stroke_width=e;for(var t=[],n=x.length;n--;){var r=x[n];r&&("g"===r.tagName?Nt(r,a):t.push(r))}t.length>0&&(ln("stroke-width",e,t),q("changed",x))}function a(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){b[e.replace("-","_")]=t;for(var n=[],r=x.length;r--;){var a=x[r];a&&("g"===a.tagName?Nt(a,(function(e){"g"!==e.nodeName&&n.push(e)})):n.push(a))}n.length>0&&(ln(e,t,n),q("changed",x))},this.getStyle=function(){return b},this.getOpacity=$,this.setOpacity=function(e){b.opacity=e,ln("opacity",e)},this.getFillOpacity=function(){return b.fill_opacity},this.getStrokeOpacity=function(){return b.stroke_opacity},this.setPaintOpacity=function(e,t,n){b[e+"_opacity"]=t,n?sn(e+"-opacity",t):ln(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=Zt(e.id+"_blur");n&&(t=n.firstChild.getAttribute("stdDeviation"))}return t},function(){var e=null,t=null,n=!1;function r(){var n=s.undoMgr.finishUndoableChange();e.addSubCommand(n),M(e),e=null,t=null}s.setBlurNoUndo=function(e){if(t)if(0===e)sn("filter",""),n=!0;else{var r=x[0];n&&sn("filter","url(#"+r.id+"_blur)"),O()&&(r.removeAttribute("filter"),r.setAttribute("filter","url(#"+r.id+"_blur)")),sn("stdDeviation",e,[t.firstChild]),s.setBlurOffsets(t,e)}else s.setBlur(e)},s.setBlurOffsets=function(e,t){t>3?$t(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"}):O()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},s.setBlur=function(n,a){if(e)r();else{var i=x[0],o=i.id;t=Zt(o+"_blur"),n-=0;var l=new ur;if(t)0===n&&(t=null);else{var c=S({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=S({element:"filter",attr:{id:o+"_blur"}})).append(c),Ot().append(t),l.addSubCommand(new sr(t))}var u={filter:i.getAttribute("filter")};if(0===n)return i.removeAttribute("filter"),void l.addSubCommand(new cr(i,u));ln("filter","url(#"+o+"_blur)"),l.addSubCommand(new cr(i,u)),s.setBlurOffsets(t,n),e=l,s.undoMgr.beginUndoableChange("stdDeviation",[t?t.firstChild:null]),a&&(s.setBlurNoUndo(n),r())}}}(),this.getBold=function(){var e=x[0];return!(nn(e)||"text"!==e.tagName||!nn(x[1]))&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=x[0];!nn(t)&&"text"===t.tagName&&nn(x[1])&&ln("font-weight",e?"bold":"normal"),x[0].textContent||Ct.setCursor()},this.getItalic=function(){var e=x[0];return!(nn(e)||"text"!==e.tagName||!nn(x[1]))&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=x[0];!nn(t)&&"text"===t.tagName&&nn(x[1])&&ln("font-style",e?"italic":"normal"),x[0].textContent||Ct.setCursor()},this.getFontFamily=function(){return fe.font_family},this.setFontFamily=function(e){fe.font_family=e,ln("font-family",e),x[0]&&!x[0].textContent&&Ct.setCursor()},this.setFontColor=function(e){fe.fill=e,ln("fill",e)},this.getFontColor=function(){return fe.fill},this.getFontSize=function(){return fe.font_size},this.setFontSize=function(e){fe.font_size=e,ln("font-size",e),x[0].textContent||Ct.setCursor()},this.getText=function(){var e=x[0];return nn(e)?"":e.textContent},this.setTextContent=function(e){ln("#text",e),Ct.init(e),Ct.setCursor()},this.setImageURL=function(e){var t=x[0];if(t){var n=ir(t).attr(["width","height"]),r=!n.width||!n.height,a=Lt(t);if(a!==e||r){var i=new ur("Change Image URL");Mt(t,e),i.addSubCommand(new cr(t,{"#href":a})),ir(new Image).load((function(){var e=ir(t).attr(["width","height"]);ir(t).attr({width:this.width,height:this.height}),U.requestSelector(t).resize(),i.addSubCommand(new cr(t,e)),M(i),q("changed",[t])})).attr("src",e)}}},this.setLinkURL=function(e){var t=x[0];if(t){if("a"!==t.tagName){var n=ir(t).parents("a");if(!n.length)return;t=n[0]}var r=Lt(t);if(r!==e){var a=new ur("Change Link URL");Mt(t,e),a.addSubCommand(new cr(t,{"#href":r})),M(a)}}},this.setRectRadius=function(e){var t=x[0];if(!nn(t)&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),M(new cr(t,{rx:n,ry:n},"Radius")),q("changed",[t]))}},this.makeHyperlink=function(e){s.groupSelectedElements("a",e)},this.removeHyperlink=function(){s.ungroupSelectedElement()},this.setSegType=function(e){G.setSegType(e)},this.convertToPath=function(e,t){if(!nn(e))return t?Ft(e,S,G):function(e,t,n,r,a,i,o,s){var l=new o.BatchCommand("Convert element to Path"),c=n({element:"path",attr:t=ft.extend({},t,Ut(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 p=Dt(e);if(p){if(c.setAttribute("d",p),u){var f=K(c);Ce(f)&&r.resetOrientation(c)}var g=e.nextSibling;return l.addSubCommand(new o.RemoveElementCommand(e,g,parent)),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:b.fill,"fill-opacity":b.fill_opacity,stroke:b.stroke,"stroke-width":b.stroke_width,"stroke-dasharray":b.stroke_dasharray,"stroke-linejoin":b.stroke_linejoin,"stroke-linecap":b.stroke_linecap,"stroke-opacity":b.stroke_opacity,opacity:b.opacity,visibility:"hidden"},S,G,Q,Z,be,M);var n=x;ir.each(n,(function(e,t){t&&s.convertToPath(t)}))};var sn=function(e,t,n){"pathedit"===xe&&G.moveNode(e,t);for(var r=(n=n||x).length,a=["g","polyline","path"],i=function(){var i=n[r];if(nn(i))return"continue";if(("x"===e||"y"===e)&&a.includes(i.tagName)){var o=Wt([i]),l="x"===e?t-o.x:0,c="y"===e?t-o.y:0;return s.moveSelectedElements(l*v,c*v,!0),"continue"}var u="#text"===e?i.textContent:i.getAttribute(e);if(nn(u)&&(u=""),u!==String(t)){"#text"===e?(i.textContent=t,/rotate/.test(i.getAttribute("transform"))&&(i=Ye(i))):"#href"===e?Mt(i,t):i.setAttribute(e,t),"textedit"===xe&&"#text"!==e&&i.textContent.length&&Ct.toSelectMode(i),j()&&"text"===i.nodeName&&/rotate/.test(i.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&i.textContent)&&(i=Ye(i)),x.includes(i)&&setTimeout((function(){i.parentNode&&U.requestSelector(i).resize()}),0);var h=Qt(i);if(0!==h&&"transform"!==e)for(var p=K(i),f=p.numberOfItems;f--;){if(4===p.getItem(f).type){p.removeItem(f);var g=Rt(i),m=we(g.x+g.width/2,g.y+g.height/2,Ee(p).matrix),y=m.x,_=m.y,b=d.createSVGTransform();b.setRotate(h,y,_),p.insertItemBefore(b,f);break}}}};r--;)i()},ln=this.changeSelectedAttribute=function(e,t,n){n=n||x,s.undoMgr.beginUndoableChange(e,n),sn(e,t,n);var r=s.undoMgr.finishUndoableChange();r.isEmpty()||M(r)};this.deleteSelectedElements=function(){for(var e=new ur("Delete Elements"),t=x.length,n=[],r=0;r<t;++r){var a=x[r];if(nn(a))break;var i=a.parentNode,o=a;U.releaseSelector(o),nt(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 lr(l,s,i))}x=[],e.isEmpty()||M(e),q("changed",n),Q()},this.cutSelectedElements=function(){s.copySelectedElements(),s.deleteSelectedElements()},this.copySelectedElements=function(){localStorage.setItem("svgedit_clipboard",JSON.stringify(x.map((function(e){return w(e)})))),ir("#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 ur("Paste elements"),l={};for(r.forEach((function e(t){t.attr&&t.attr.id&&(l[t.attr.id]=H(),t.attr.id=l[t.attr.id]),t.children&&t.children.forEach(e)})),Ue("IDsUpdated",{elems:r,changes:l},!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 c=r[a];if(c){var u=S(c);i.push(u),o.addSubCommand(new sr(u)),ue(u)}}if(Ke(i),"in_place"!==e){var d,h;e?"point"===e&&(d=t,h=n):(d=Be.x,h=Be.y);var p=Wt(i),f=d-(p.x+p.width/2),g=h-(p.y+p.height/2),m=[],v=[];ir.each(i,(function(e,t){m.push(f),v.push(g)}));var y=s.moveSelectedElements(m,v,!1);y&&o.addSubCommand(y)}M(o),q("changed",i)}},this.groupSelectedElements=function(e,t){e||(e="g");var n,r="";switch(e){case"a":r="Make hyperlink",n=t||"";break;default:e="g",r="Group Elements"}var a=new ur(r),i=S({element:e,attr:{id:H()}});"a"===e&&Mt(i,n),a.addSubCommand(new sr(i));for(var o=x.length;o--;){var s=x[o];if(!nn(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 or(s,l,c))}}a.isEmpty()||M(a),Ke([i],!0)};var dn=this.pushGroupProperties=function(e,t){for(var n,r,a,i=e.childNodes,o=i.length,l=e.getAttribute("transform"),c=K(e),u=Ee(c).matrix,h=new ur("Push group properties"),p=Qt(e),f=ir(e).attr(["filter","opacity"]),g=m(),v=0;v<o;v++){var y=i[v];if(1===y.nodeType){if(null!==f.opacity&&1!==f.opacity){var _=Math.round((y.getAttribute("opacity")||1)*f.opacity*100)/100;ln("opacity",_,[y])}if(f.filter){var b=this.getBlur(y),x=b;r||(r=this.getBlur(e)),b?b=Number(r)+Number(b):0===b&&(b=r),x?n=Kt(y.getAttribute("filter")):n?(n=g.copyElem(n),Ot().append(n)):n=Kt(f.filter);var w="feGaussianBlur"===n.firstChild.tagName?"blur":"filter";n.id=y.id+"_"+w,ln("filter","url(#"+n.id+")",[y]),b&&(ln("stdDeviation",b,[n.firstChild]),s.setBlurOffsets(n,b))}var S=K(y);if(y.tagName.includes("Gradient")&&(S=null),S&&"defs"!==y.tagName&&c.numberOfItems){if(p&&1===c.numberOfItems){var k=c.getItem(0).matrix,C=d.createSVGMatrix(),A=Qt(y);A&&(C=S.getItem(0).matrix);var E=Rt(y),G=Ee(S).matrix,P=we(E.x+E.width/2,E.y+E.height/2,G),I=p+A,N=d.createSVGTransform();N.setRotate(I,P.x,P.y);var T=ke(k,C,N.matrix.inverse());if(A&&S.removeItem(0),I&&(S.numberOfItems?S.insertItemBefore(N,0):S.appendItem(N)),T.e||T.f){var L=d.createSVGTransform();L.setTranslate(T.e,T.f),S.numberOfItems?S.insertItemBefore(L,0):S.appendItem(L)}}else{var M=y.getAttribute("transform");(a={}).transform=M||"";var O=d.createSVGTransform(),j=Ee(S).matrix,V=j.inverse(),R=ke(V,u,j);O.setMatrix(R),S.appendItem(O)}var B=er(y);B&&h.addSubCommand(B)}}}if(l&&((a={}).transform=l,e.setAttribute("transform",""),e.removeAttribute("transform"),h.addSubCommand(new cr(e,a))),t&&!h.isEmpty())return h};this.ungroupSelectedElement=function(){var e=x[0];if(e)if(ir(e).data("gsvg")||ir(e).data("symbol"))zt(e);else{if("use"===e.tagName){var t=Zt(Lt(e).substr(1));return ir(e).data("symbol",t).data("ref",t),void zt(e)}var n=ir(e).parents("a");if(n.length&&(e=n[0]),"g"===e.tagName||"a"===e.tagName){var r=new ur("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 or(c,u,d));else{var h=c.nextSibling;r.addSubCommand(new lr(c,h,d)),c.remove()}}Q();var p=e.nextSibling;e=i.removeChild(e),r.addSubCommand(new lr(e,p,i)),r.isEmpty()||M(r),Z(s)}}},this.moveToTopSelectedElement=function(){var e=c(x,1)[0];if(!nn(e)){var t=e,n=t.parentNode,r=t.nextSibling;r!==(t=t.parentNode.appendChild(t)).nextSibling&&(M(new or(t,r,n,"top")),q("changed",[t]))}},this.moveToBottomSelectedElement=function(){var e=c(x,1)[0];if(!nn(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&&(M(new or(t,r,n,"bottom")),q("changed",[t]))}},this.moveUpDownSelected=function(e){var t=x[0];if(t){var n,r;je=[];var a=ir(Fe(Wt([t]))).toArray();if("Down"===e&&a.reverse(),ir.each(a,(function(){return r?(n=this,!1):(this===t&&(r=!0),!0)})),n){var i=t,o=i.parentNode,s=i.nextSibling;ir(n)["Down"===e?"before":"after"](i),s!==i.nextSibling&&(M(new or(i,s,o,"Move "+e)),q("changed",[i]))}}},this.moveSelectedElements=function(e,t,n){e.constructor!==Array&&(e/=v,t/=v),n=n||!0;for(var r=new ur("position"),a=x.length;a--;){var i=x[a];if(!nn(i)){var o=d.createSVGTransform(),s=K(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=er(i);l&&r.addSubCommand(l),U.requestSelector(i).resize()}}if(!r.isEmpty())return n&&M(r),q("changed",x),r},this.cloneSelectedElements=function(e,t){var n,r,a=new ur("Clone Elements"),i=x.length;for(x.sort((function(e,t){return ir(t).index()-ir(e).index()})),n=0;n<i&&(r=x[n],!nn(r));++n);var o=x.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 sr(r));a.isEmpty()||(Z(o.reverse()),this.moveSelectedElements(e,t,!1),M(a))},this.alignSelectedElements=function(e,t){var n=[],r=x.length;if(r){for(var a=Number.MAX_VALUE,i=Number.MIN_VALUE,o=Number.MAX_VALUE,l=Number.MIN_VALUE,c=Number.MIN_VALUE,u=Number.MIN_VALUE,d=0;d<r&&!nn(x[d]);++d){var h=x[d];switch(n[d]=Wt([h]),t){case"smallest":(("l"===e||"c"===e||"r"===e)&&(c===Number.MIN_VALUE||c>n[d].width)||("t"===e||"m"===e||"b"===e)&&(u===Number.MIN_VALUE||u>n[d].height))&&(a=n[d].x,o=n[d].y,i=n[d].x+n[d].width,l=n[d].y+n[d].height,c=n[d].width,u=n[d].height);break;case"largest":(("l"===e||"c"===e||"r"===e)&&(c===Number.MIN_VALUE||c<n[d].width)||("t"===e||"m"===e||"b"===e)&&(u===Number.MIN_VALUE||u<n[d].height))&&(a=n[d].x,o=n[d].y,i=n[d].x+n[d].width,l=n[d].y+n[d].height,c=n[d].width,u=n[d].height);break;default:n[d].x<a&&(a=n[d].x),n[d].y<o&&(o=n[d].y),n[d].x+n[d].width>i&&(i=n[d].x+n[d].width),n[d].y+n[d].height>l&&(l=n[d].y+n[d].height)}}"page"===t&&(a=0,o=0,i=s.contentW,l=s.contentH);for(var p=new Array(r),f=new Array(r),g=0;g<r&&!nn(x[g]);++g){var m=n[g];switch(p[g]=0,f[g]=0,e){case"l":p[g]=a-m.x;break;case"c":p[g]=(a+i)/2-(m.x+m.width/2);break;case"r":p[g]=i-(m.x+m.width);break;case"t":f[g]=o-m.y;break;case"m":f[g]=(o+l)/2-(m.y+m.height/2);break;case"b":f[g]=l-(m.y+m.height)}}this.moveSelectedElements(p,f)}},this.contentW=Xt().w,this.contentH=Xt().h,this.updateCanvas=function(e,t){d.setAttribute("width",e),d.setAttribute("height",t);var n=ir("#canvasBackground")[0],r=f.getAttribute("x"),a=f.getAttribute("y"),i=(e-this.contentW*v)/2,o=(t-this.contentH*v)/2;$t(f,{width:this.contentW*v,height:this.contentH*v,x:i,y:o,viewBox:"0 0 "+this.contentW+" "+this.contentH}),$t(n,{width:f.getAttribute("width"),height:f.getAttribute("height"),x:i,y:o});var s=Zt("background_image");return s&&$t(s,{width:"100%",height:"100%"}),U.selectorParentGroup.setAttribute("transform","translate("+i+","+o+")"),Ue("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=Zt("canvasBackground"),r=ir(n).find("rect")[0],a=Zt("background_image");r.setAttribute("fill",e),t?(a||(a=l.createElementNS(h.SVG,"image"),$t(a,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})),Mt(a,t),n.append(a)):a&&a.remove()},this.cycleElement=function(e){var t,n=x[0],r=!1,a=Yt(y||m().getCurrentLayer());if(a.length){if(nn(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}Ke([r],!0),q("selected",x)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:M,BatchCommand:ur,ChangeElementCommand:cr,decode64:kt,dropXMLInteralSubset:xt,encode64:St,ffClone:Ye,findDefs:Ot,findDuplicateGradient:on,getElem:Zt,getPathBBox:jt,getTypeMap:te,getUrlFromAttr:Tt,identifyLayers:En,InsertElementCommand:sr,isChrome:R,isIdentity:Se,isIE:V,logMatrix:Xe,MoveElementCommand:or,NS:h,preventClickDefault:tn,RemoveElementCommand:lr,SVGEditTransformList:X,text2xml:It,transformBox:Ae,transformPoint:we,walkTree:Nt}}};var fr=Boolean(window.opera),gr=function(e,t,n){var r,a=e.find("defs");if(!a.length)return e;r=fr?a.find("*").filter((function(){return Boolean(this.id)})):a.find("[id]");var i=e[0].getElementsByTagName("*"),o=i.length;return r.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};var mr={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};function vr(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 yr,_r,br=function(e){return null==e},xr=jQuery,wr=function(e,t,n){var r=xr("#svg_editor").parent();Object.entries(t).forEach((function(t){var a=c(t,2),i=a[0],o=a[1];o||console.log(i),n&&(i="#"+i);var s=r.find(i);if(s.length){var l=s[0];switch(e){case"aria-label":l.setAttribute("aria-label",o);break;case"content":u(l.childNodes).some((function(e){return!(3!==e.nodeType||!e.textContent.trim())&&(e.textContent=o,!0)}));break;case"title":l.title=o}}else console.log("Missing element for localization: "+i)}))},Sr=function(e){var t,n,r,a,i,o,s,l,u,d;return regeneratorRuntime.async((function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,regeneratorRuntime.awrap(_r.addLangData(yr));case 2:if(t=h.sent,xr.each(t,(function(t,n){n.data&&(e=xr.merge(e,n.data))})),e.tools){h.next=6;break}return h.abrupt("return",void 0);case 6:return r=(n=e).tools,a=n.properties,i=n.config,o=n.layers,s=n.common,l=n.ui,wr("content",{curve_segments:a.curve_segments,fitToContent:r.fitToContent,fit_to_all:r.fit_to_all,fit_to_canvas:r.fit_to_canvas,fit_to_layer_content:r.fit_to_layer_content,fit_to_sel:r.fit_to_sel,icon_large:i.icon_large,icon_medium:i.icon_medium,icon_small:i.icon_small,icon_xlarge:i.icon_xlarge,image_opt_embed:i.image_opt_embed,image_opt_ref:i.image_opt_ref,includedImages:i.included_images,largest_object:r.largest_object,layersLabel:o.layers,page:r.page,relativeToLabel:r.relativeTo,selLayerLabel:o.move_elems_to,selectedPredefined:i.select_predefined,selected_objects:r.selected_objects,smallest_object:r.smallest_object,straight_segments:a.straight_segments,svginfo_bg_url:i.editor_img_url+":",svginfo_bg_note:i.editor_bg_note,svginfo_change_background:i.background,svginfo_dim:i.doc_dims,svginfo_editor_prefs:i.editor_prefs,svginfo_height:s.height,svginfo_icons:i.icon_size,svginfo_image_props:i.image_props,svginfo_lang:i.language,svginfo_title:i.doc_title,svginfo_width:s.width,tool_docprops_cancel:s.cancel,tool_docprops_save:s.ok,tool_source_cancel:s.cancel,tool_source_save:s.ok,tool_prefs_cancel:s.cancel,tool_prefs_save:s.ok,sidepanel_handle:o.layers.split("").join(" "),tool_clear:r.new_doc,tool_docprops:r.docprops,tool_export:r.export_img,tool_import:r.import_doc,tool_open:r.open_doc,tool_save:r.save_doc,svginfo_units_rulers:i.units_and_rulers,svginfo_rulers_onoff:i.show_rulers,svginfo_unit:i.base_unit,svginfo_grid_settings:i.grid,svginfo_snap_onoff:i.snapping_onoff,svginfo_snap_step:i.snapping_stepsize,svginfo_grid_color:i.grid_color},!0),u={},["cut","copy","paste","paste_in_place","delete","group","ungroup","move_front","move_up","move_down","move_back"].forEach((function(e){u['#cmenu_canvas a[href="#'+e+'"]']=r[e]})),["dupe","merge_down","merge_all"].forEach((function(e){u['#cmenu_layers a[href="#'+e+'"]']=o[e]})),u['#cmenu_layers a[href="#delete"]']=o.del,wr("content",u),d={},Object.entries({tool_blur:a.blur,tool_position:r.align_to_page,tool_font_family:a.font_family,zoom_panel:l.zoom_level,stroke_linejoin:a.linejoin_miter,stroke_linecap:a.linecap_butt,tool_opacity:a.opacity}).forEach((function(e){var t=c(e,2),n=t[0],r=t[1];d["#"+n+" button"]=r})),Object.entries({group_opacity:a.opacity,zoom:l.zoom_level}).forEach((function(e){var t=c(e,2),n=t[0],r=t[1];d["#"+n]=r})),wr("aria-label",d),wr("title",{align_relative_to:r.align_relative_to,circle_cx:a.circle_cx,circle_cy:a.circle_cy,circle_r:a.circle_r,cornerRadiusLabel:a.corner_radius,ellipse_cx:a.ellipse_cx,ellipse_cy:a.ellipse_cy,ellipse_rx:a.ellipse_rx,ellipse_ry:a.ellipse_ry,fill_color:a.fill_color,font_family:a.font_family,idLabel:a.id,image_height:a.image_height,image_url:a.image_url,image_width:a.image_width,layer_delete:o.del,layer_down:o.move_down,layer_new:o.new,layer_rename:o.rename,layer_moreopts:s.more_opts,layer_up:o.move_up,line_x1:a.line_x1,line_x2:a.line_x2,line_y1:a.line_y1,line_y2:a.line_y2,linecap_butt:a.linecap_butt,linecap_round:a.linecap_round,linecap_square:a.linecap_square,linejoin_bevel:a.linejoin_bevel,linejoin_miter:a.linejoin_miter,linejoin_round:a.linejoin_round,main_icon:r.main_menu,palette:l.palette_info,zoom_panel:l.zoom_level,path_node_x:a.node_x,path_node_y:a.node_y,rect_height_tool:a.rect_height,rect_width_tool:a.rect_width,seg_type:a.seg_type,selLayerNames:o.move_selected,selected_x:a.pos_x,selected_y:a.pos_y,stroke_color:a.stroke_color,stroke_style:a.stroke_style,stroke_width:a.stroke_width,svginfo_title:i.doc_title,text:a.text_contents,toggle_stroke_tools:l.toggle_stroke_tools,tool_add_subpath:r.add_subpath,tool_alignbottom:r.align_bottom,tool_aligncenter:r.align_center,tool_alignleft:r.align_left,tool_alignmiddle:r.align_middle,tool_alignright:r.align_right,tool_aligntop:r.align_top,tool_angle:a.angle,tool_blur:a.blur,tool_bold:a.bold,tool_circle:r.mode_circle,tool_clone:r.clone,tool_clone_multi:r.clone,tool_delete:r.del,tool_delete_multi:r.del,tool_ellipse:r.mode_ellipse,tool_fhellipse:r.mode_fhellipse,tool_fhpath:r.mode_fhpath,tool_fhrect:r.mode_fhrect,tool_font_size:a.font_size,tool_group_elements:r.group_elements,tool_make_link:r.make_link,tool_link_url:r.set_link_url,tool_image:r.mode_image,tool_italic:a.italic,tool_line:r.mode_line,tool_move_bottom:r.move_bottom,tool_move_top:r.move_top,tool_node_clone:r.node_clone,tool_node_delete:r.node_delete,tool_node_link:r.node_link,tool_opacity:a.opacity,tool_openclose_path:r.openclose_path,tool_path:r.mode_path,tool_position:r.align_to_page,tool_rect:r.mode_rect,tool_redo:r.redo,tool_reorient:r.reorient_path,tool_select:r.mode_select,tool_source:r.source_save,tool_square:r.mode_square,tool_text:r.mode_text,tool_topath:r.to_path,tool_undo:r.undo,tool_ungroup:r.ungroup,tool_wireframe:r.wireframe_mode,tool_zoom:r.mode_zoom,url_notice:r.no_embed},!0),h.abrupt("return",{langParam:yr,langData:e});case 19:case"end":return h.stop()}}))};function kr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;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||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Cr(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,l=t.acceptErrors;return e=Array.isArray(e)?e:[e],Promise.all(e.map((function(e){return function(e){var t={};if(Array.isArray(e)){var o=kr(e,2);e=o[0];var c=o[1];t=void 0===c?{}:c}var u=t.favicon,d=void 0===u?a:u,h=t,p=h.before,f=void 0===p?n:p,g=h.after,m=void 0===g?r:g,v=h.canvas,y=void 0===v?i:v,_=h.image,b=void 0===_?s:_;function x(){f?f.before(w):m?m.after(w):document.head.appendChild(w)}var w=document.createElement("link");return new Promise((function(n,r){var a=r;if(l&&(a="function"==typeof l?function(a){l({error:a,stylesheetURL:e,options:t,resolve:n,reject:r})}:n),e.endsWith(".css")?d=!1:e.endsWith(".ico")&&(d=!0),d){if(w.rel="shortcut icon",w.type="image/x-icon",!1===b)return w.href=e,x(),void n(w);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),w.href=y?i.toDataURL("image/x-icon"):e,x(),n(w)})),void(s.src=e)}w.rel="stylesheet",w.type="text/css",w.href=e,x(),w.addEventListener("error",(function(e){a(e)})),w.addEventListener("load",(function(){n(w)}))}))}(e)})))}var Ar={},Er=[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||27===t.which||!/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(t){return function(t,n){var r,a,i,o,s,l,c,u,d=Array.prototype.slice,h=decodeURIComponent,p=t.param,f=t.bbq=t.bbq||{},g=t.event.special,m="hashchange",v="querystring",y="fragment",_="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(e,a,o,s,l){var c,d,f,g,m;return s!==r?(m=(f=o.match(e?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/))[3]||"",2===l&&A(s)?d=s.replace(e?k:S,""):(g=i(f[2]),s=A(s)?i[e?y:v](s):s,d=2===l?s:1===l?t.extend({},s,g):t.extend({},g,s),d=p(d),e&&(d=d.replace(u,h))),c=f[1]+(e?"#":d||!f[1]?"?":"")+d+m):c=a(o!==r?o:n[b][x]),c}function P(e,t,n){return t===r||"boolean"==typeof t?(n=t,t=p[e?y:v]()):t=A(t)?t.replace(e?k:S,""):t,i(t,n)}function I(n,a,i,o){return A(i)||"object"===e(i)||(o=i,i=a,a=r),this.each((function(){var e=t(this),r=a||c()[(this.nodeName||"").toLowerCase()]||"",s=r&&e.attr(r)||"";e.attr(r,p[n](s,i,o))}))}p[v]=E(G,0,(function(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")})),p[y]=a=E(G,1,(function(e){return e.replace(/^[^#]*#?(.*)$/,"$1")})),a.noEscape=function(e){e=e||"";var n=t.map(e.split(""),encodeURIComponent);u=new RegExp(n.join("|"),"g")},a.noEscape(",/"),t.deparam=i=function(e,n){var a={},i={true:!0,false:!1,null:null};return t.each(e.replace(/\+/g," ").split("&"),(function(e,o){var s,l=o.split("="),c=h(l[0]),u=a,d=0,p=c.split("]["),f=p.length-1;if(/\[/.test(p[0])&&/\]$/.test(p[f])?(p[f]=p[f].replace(/\]$/,""),f=(p=p.shift().split("[").concat(p)).length-1):f=0,2===l.length)if(s=h(l[1]),n&&(s=s&&!isNaN(s)?+s:"undefined"===s?r:i[s]!==r?i[s]:s),f)for(;d<=f;d++)u=u[c=""===p[d]?u.length:p[d]]=d<f?u[c]||(p[d+1]&&isNaN(p[d+1])?{}:[]):s;else t.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[v]=E(P,0),i[y]=o=E(P,1),t[_]||(t[_]=function(e){return t.extend(C,e)})({a:x,base:x,iframe:w,img:w,input:w,form:"action",link:x,script:w}),c=t[_],t.fn[v]=E(I,v),t.fn[y]=E(I,y),f.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)?"":"#")},f.getState=l=function(e,t){return e===r||"boolean"==typeof e?o(e):o(t)[e]},f.removeState=function(e){var n={};e!==r&&(n=l(),t.each(t.isArray(e)?e:arguments,(function(e,t){delete n[t]}))),s(n,2)},g[m]=t.extend(g[m],{add:function(e){var n;function o(e){var t=e[y]=a();e.getState=function(e,n){return e===r||"boolean"==typeof e?i(t,e):i(t,n)[e]},n.apply(this,arguments)}if(t.isFunction(e))return n=e,o;n=e.handler,e.handler=o}})}(t,window),function(e,t,n){var r,a,i,o,s,l,c=e.event.special,u="location",d="hashchange",h="href",p=e.browser,f=document.documentMode,g=p.msie&&(void 0===f||f<8),m="on"+d in t&&!g;function v(e){return(e=e||t[u][h]).replace(/^[^#]*#?(.*)$/,"$1")}e[d+"Delay"]=100,c[d]=e.extend(c[d],{setup:function(){if(m)return!1;e(r.start)},teardown:function(){if(m)return!1;e(r.stop)}}),(l={}).start=function(){if(!a){var n=v();o||(o=s=function(e){return e},g&&(i=e('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow,s=function(){return v(i.document[u][h])},(o=function(e,t){if(e!==t){var n=i.document;n.open().close(),n[u].hash="#"+e}})(v()))),function r(){var i=v(),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}(t,window),t},function(e){var t={};return e.svgIcons=function(n){var r,a,i,o,s,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",d=l.w||24,h=l.h||24,p=!1,f=!1,g=0,m="data:image/svg+xml;charset=utf-8;base64,";if(l.svgz){o=e('<object data="'+n+'" type=image/svg+xml>').appendTo("body").hide();try{a=o[0].contentDocument,o.load(y),y(0,!0)}catch(e){w()}}else{var v=new DOMParser;e.ajax({url:n,dataType:"string",success:function(t){t?(a=v.parseFromString(t,"text/xml"),e((function(){y("ajax")}))):e(w)},error:function(t){window.opera?e((function(){w()})):t.responseText?((a=v.parseFromString(t.responseText,"text/xml")).childNodes.length||e(w),e((function(){y("ajax")}))):e(w)}})}function y(t,n){if("ajax"!==t){if(f)return;var s=(a=o[0].contentDocument)&&a.getElementById("svg_eof");if(!(s||n&&s))return void(++g<50?setTimeout(y,20):(w(),f=!0));f=!0}if(r=e(a.firstChild).children(),l.no_img)setTimeout((function(){p||x()}),500);else{var c=m+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";i=e(new Image).attr({src:c,width:0,height:0,alt:l.testIconAlt||"icon"}).appendTo("body").load((function(){x(!0)})).error((function(){x()}))}}function _(e,t,n,r){if(fr&&t.css("visibility","hidden"),l.replace){r&&t.attr("id",n);var a=e.attr("class");if(a&&t.attr("class","svg_icon "+a),!e.alt){var i="icon";l.alts&&(i=l.alts[n]||i),t.attr("alt",i)}e.replaceWith(t)}else e.append(t);fr&&setTimeout((function(){t.removeAttr("style")}),1)}function b(e,n){void 0!==l.id_match&&!1===l.id_match||_(s,e,n,!0),t[n]=e}function x(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!p){var f;if(l.no_img&&(n=!1),n&&(f=e(document.createElement("div"))).hide().appendTo("body"),a){var g=l.fallback_path||"";e.each(a,(function(t,n){s=e("#"+t);var r="icon";l.alts&&(r=l.alts[t]||r),b(e(new Image).attr({class:"svg_icon",src:g+n,width:d,height:h,alt:r}),t)}))}else for(var v=r.length,y=0;y<v;y++){var x=r[y],w=x.id;if("svg_eof"===w)break;s=e("#"+w);var S=document.createElementNS(c,"svg");S.setAttribute("viewBox",[0,0,d,h].join(" "));var k=x.getElementsByTagNameNS(c,"svg")[0],C=k.getAttribute("width"),A=k.getAttribute("height");k.removeAttribute("width"),k.removeAttribute("height"),k.getAttribute("viewBox")||k.setAttribute("viewBox",[0,0,C,A].join(" ")),S.setAttribute("xmlns",c),S.setAttribute("width",d),S.setAttribute("height",h),S.setAttribute("xmlns:xlink",u),S.setAttribute("class","svg_icon"),fr||(k=k.cloneNode(!0)),S.append(k);var E=void 0;if(n){f.empty().append(S);var G=m+St(unescape(encodeURIComponent((new XMLSerializer).serializeToString(S)))),P="icon";l.alts&&(P=l.alts[w]||P),E=e(new Image).attr({class:"svg_icon",src:G,alt:P})}else E=gr(e(S),y);b(E,w)}l.placement&&e.each(l.placement,(function(r,a){t[a]&&e(r).each((function(r){var i=t[a].clone();r>0&&!n&&(i=gr(i,r)),_(e(this),i,a)}))})),a||(n&&f.remove(),o&&o.remove(),i&&i.remove()),l.resize&&e.resizeSvgIcons(l.resize),p=!0,l.callback&&l.callback(t)}}function w(){if(n.includes(".svgz")){var t=n.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg"),e.svgIcons(t,l)}else l.fallback&&x(!1,l.fallback)}},e.getSvgIcon=function(e,n){var r=t[e];return n&&r&&(r=gr(r,0).clone(!0)),r},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(n){n.loadingStylesheets||(n.loadingStylesheets=[]),n.loadingStylesheets.includes("jgraduate/css/jGraduate.css")||n.loadingStylesheets.push("jgraduate/css/jGraduate.css"),n.jGraduate={Paint:function e(n){t(this,e);var r=n||{};if(this.alpha=isNaN(r.alpha)?100:r.alpha,r.copy)switch(this.type=r.copy.type,this.alpha=r.copy.alpha,this.solidColor=null,this.linearGradient=null,this.radialGradient=null,this.type){case"none":break;case"solidColor":this.solidColor=r.copy.solidColor;break;case"linearGradient":this.linearGradient=r.copy.linearGradient.cloneNode(!0);break;case"radialGradient":this.radialGradient=r.copy.radialGradient.cloneNode(!0)}else r.linearGradient?(this.type="linearGradient",this.solidColor=null,this.radialGradient=null,this.linearGradient=r.linearGradient.cloneNode(!0)):r.radialGradient?(this.type="radialGradient",this.solidColor=null,this.linearGradient=null,this.radialGradient=r.radialGradient.cloneNode(!0)):r.solidColor?(this.type="solidColor",this.solidColor=r.solidColor):(this.type="none",this.solidColor=null,this.linearGradient=null,this.radialGradient=null)}},n.fn.jGraduateDefaults={paint:new n.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var r=navigator.userAgent.includes("Gecko/");function a(e,t,n){var a=document.createElementNS(mr.svg,e);return function(e,t){r?Object.entries(t).forEach((function(t){var n=c(t,2),r=n[0],a=n[1];e.setAttribute(r,a)})):Object.entries(t).forEach((function(t){var n=c(t,2),r=n[0],a=n[1],i=e[r];i&&"SVGLength"===i.constructor?i.baseVal.value=a:e.setAttribute(r,a)}))}(a,t),n&&n.append(a),a}return n.fn.jGraduate=function(t,r,i){return this.each((function(){var o=n(this),s=n.extend(!0,{},n.fn.jGraduateDefaults,t||{}),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()};n.extend(!0,o,{paint:new n.jGraduate.Paint({copy:s.paint}),okCallback:"function"==typeof r?r:null,cancelCallback:"function"==typeof i?i:null});var h=null,p=n(window);"none"===o.paint.type&&(o.paint=new n.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 f=n(c+"> .jGraduate_colPick"),g=n(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 m=256,v=m-0,y=m-0,_={};n(".jGraduate_SliderBar").width(145);var b,x=n("#"+l+"_jGraduate_GradContainer")[0],w=a("svg",{id:l+"_jgraduate_svg",width:m,height:m,xmlns:mr.svg},x),S=o.paint.type,k=o.paint[S],C=k,A=o.paint.alpha,E="solidColor"===S;switch(S){case"solidColor":case"linearGradient":if(E||(C.id=l+"_lg_jgraduate_grad",k=C=w.appendChild(C)),a("radialGradient",{id:l+"_rg_jgraduate_grad"},w),"linearGradient"===S)break;case"radialGradient":E||(C.id=l+"_rg_jgraduate_grad",k=C=w.appendChild(C)),a("linearGradient",{id:l+"_lg_jgraduate_grad"},w)}if(E){k=C=n("#"+l+"_lg_jgraduate_grad")[0],Me(0,"#"+(h=o.paint[S]),1);var G=e(s.newstop);if("string"===G)switch(s.newstop){case"same":Me(1,"#"+h,1);break;case"inverse":for(var P="",I=0;I<6;I+=2){var N=(255-parseInt(h.substr(I,2),16)).toString(16);N.length<2&&(N=0+N),P+=N}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,M=parseFloat(k.getAttribute("x1")||0),O=parseFloat(k.getAttribute("y1")||0),j=parseFloat(k.getAttribute("x2")||1),V=parseFloat(k.getAttribute("y2")||0),R=parseFloat(k.getAttribute("cx")||.5),B=parseFloat(k.getAttribute("cy")||.5),D=parseFloat(k.getAttribute("fx")||R),U=parseFloat(k.getAttribute("fy")||B),F=a("rect",{id:l+"_jgraduate_rect",x:0,y:0,width:v,height:y,fill:"url(#"+l+"_jgraduate_grad)","fill-opacity":A/100},w),H=n("<div/>").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:O*m,left:M*m}).data("coord","start").appendTo(x),z=H.clone().text(2).css({top:V*m,left:j*m}).attr("title","End stop").data("coord","end").appendTo(x),q=n("<div/>").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:B*m,left:R*m}).data("coord","center").appendTo(x),Y=q.clone().text("F").css({top:U*m,left:D*m,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(x);Y[0].id=l+"_jGraduate_focusCoord",n.each(["x1","y1","x2","y2","cx","cy","fx","fy"],(function(e,t){var r=isNaN(t[1]),a=C.getAttribute(t);a||(a=r?"0.5":"x2"===t?"1.0":"0.0"),_[t]=n("#"+l+"_jGraduate_"+t).val(a).change((function(){isNaN(parseFloat(this.value))||this.value<0?this.value=0:this.value>1&&(this.value=1),("f"!==t[0]||L)&&(r&&"radialGradient"===S||!r&&"linearGradient"===S)&&C.setAttribute(t,this.value);var e=r?"c"===t[0]?q:Y:"1"===t[1]?H:z,n=t.includes("x")?"left":"top";e.css(n,this.value*m)})).change()}));var W,X,Q,K,Z=n("#"+l+"_jGraduate_StopSlider"),$=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),J=1,ee=1,te=0,ne=R,re=B,ae=a("svg",{width:"100%",height:45},Z[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(mr.xlink,"xlink:href",se),n(ae).click((function(e){if(K=Z.offset(),"path"!==e.target.tagName){var t=e.pageX-K.left-8;Me((t=t<10?10:t>m+10?m+10:t)/m,0,0,!0),e.stopPropagation()}})),n(ae).mouseover((function(){ae.append($)})),b=a("g",{},ae),a("line",{x1:10,y1:15,x2:m+10,y2:15,"stroke-width":2,stroke:"#000"},ae);var le,ce,ue,de,he=g.find(".jGraduate_spreadMethod").change((function(){C.setAttribute("spreadMethod",n(this).val())})),pe=null,fe=function(e){var t=e.pageX-le.left,n=e.pageY-le.top;t=t<0?0:t>m?m:t,n=n<0?0:n>m?m:n,pe.css("left",t).css("top",n);var r=t/v,a=n/y,i=pe.data("coord"),o=C;switch(i){case"start":_.x1.val(r),_.y1.val(a),o.setAttribute("x1",r),o.setAttribute("y1",a);break;case"end":_.x2.val(r),_.y2.val(a),o.setAttribute("x2",r),o.setAttribute("y2",a);break;case"center":_.cx.val(r),_.cy.val(a),o.setAttribute("cx",r),o.setAttribute("cy",a),ne=r,re=a,Ve();break;case"focus":_.fx.val(r),_.fy.val(a),o.setAttribute("fx",r),o.setAttribute("fy",a),Ve()}e.preventDefault()},ge=function e(){pe=null,p.unbind("mousemove",fe).unbind("mouseup",e)},me=(W=C.getElementsByTagNameNS(mr.svg,"stop")).length;if(me<2){for(;me<2;)C.append(document.createElementNS(mr.svg,"stop")),++me;W=C.getElementsByTagNameNS(mr.svg,"stop")}for(var ve=0;ve<me;ve++)Me(0,0,0,0,W[ve]);if(he.val(C.getAttribute("spreadMethod")||"pad"),L=!1,F.setAttribute("fill-opacity",A/100),n("#"+l+" div.grad_coord").mousedown((function(e){e.preventDefault(),pe=n(this),le=pe.parent().offset(),p.mousemove(fe).mouseup(ge)})),n("#"+l+"_jGraduate_Ok").bind("click",(function(){o.paint.type=S,o.paint[S]=C.cloneNode(!0),o.paint.solidColor=null,u()})),n("#"+l+"_jGraduate_Cancel").bind("click",(function(e){d()})),"radialGradient"===S&&(L?Y.show():(Y.hide(),_.fx.val(""),_.fy.val(""))),n("#"+l+"_jGraduate_match_ctr")[0].checked=!L,n("#"+l+"_jGraduate_match_ctr").change((function(){L=!this.checked,Y.toggle(L),_.fx.val(""),_.fy.val("");var e=C;if(L){var t=ce||.5,n=ue||.5;e.setAttribute("fx",t),e.setAttribute("fy",n),_.fx.val(t),_.fy.val(n)}else ce=e.getAttribute("fx"),ue=e.getAttribute("fy"),e.removeAttribute("fx"),e.removeAttribute("fy")})),(me=(W=C.getElementsByTagNameNS(mr.svg,"stop")).length)<2){for(;me<2;)C.append(document.createElementNS(mr.svg,"stop")),++me;W=C.getElementsByTagNameNS(mr.svg,"stop")}var ye=0,_e=0;if("radialGradient"===S){var be=C.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?ye=Math.round(100*-(1-Se.a)):1!==Se.d&&(ye=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){_e=Math.round(ke.angle);var Ee=Ae.matrix;1!==Ee.a?ye=Math.round(100*-(1-Ee.a)):1!==Ee.d&&(ye=Math.round(100*(1-Ee.d)))}}}var Ge={radius:{handle:"#"+l+"_jGraduate_RadiusArrows",input:"#"+l+"_jGraduate_RadiusInput",val:100*(C.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:ye},angle:{handle:"#"+l+"_jGraduate_AngleArrows",input:"#"+l+"_jGraduate_AngleInput",val:_e}};n.each(Ge,(function(e,t){var r=n(t.handle);r.mousedown((function(a){var i=r.parent();de={type:e,elem:r,input:n(t.input),parent:i,offset:i.offset()},p.mousemove(Pe).mouseup(Ie),a.preventDefault()})),n(t.input).val(t.val).change((function(){var t="radialGradient"===S,n=Number(this.value),a=0;switch(e){case"radius":t&&C.setAttribute("r",n/100),a=Math.pow(n/100,.4)/2*145;break;case"opacity":o.paint.alpha=n,F.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,t&&Ve();break;case"angle":a=(te=n)/180,a+=.5,a*=145,t&&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=de.offset.left,n=de.parent,r=e.pageX-t-parseInt(n.css("border-left-width"));r>145&&(r=145),r<=0&&(r=0);var a=r-5;switch(r/=145,de.type){case"radius":(r=Math.pow(2*r,2.5))>.98&&r<1.02&&(r=1),r<=.01&&(r=.01),C.setAttribute("r",r);break;case"opacity":o.paint.alpha=parseInt(100*r),F.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===(r-=1)+1&&(r=Math.abs(r));break;case"angle":r-=.5,te=r*=180,Ve(),r/=100}de.elem.css({"margin-left":a}),r=Math.round(100*r),de.input.val(r)}(e),e.preventDefault()},Ie=function e(t){p.unbind("mousemove",Pe).unbind("mouseup",e),de=null},Ne=(255*o.paint.alpha/100).toString(16);Ne.length<2;)Ne="0"+Ne;Ne=Ne.split(".")[0],h="none"===o.paint.solidColor?"":o.paint.solidColor+Ne,E||(h=W[0].getAttribute("stop-color")),n.extend(n.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),f.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,Le=n(c+" .jGraduate_tabs li");switch(Le.click((function(){Le.removeClass("jGraduate_tab_current"),n(this).addClass("jGraduate_tab_current"),n(c+" > div").hide();var e=n(this).attr("data-type");if(n(c+" .jGraduate_gradPick").show(),"rg"===e||"lg"===e){n(".jGraduate_"+e+"_field").show(),n(".jGraduate_"+("lg"===e?"rg":"lg")+"_field").hide(),n("#"+l+"_jgraduate_rect")[0].setAttribute("fill","url(#"+l+"_"+e+"_jgraduate_grad)"),S="lg"===e?"linearGradient":"radialGradient",n("#"+l+"_jGraduate_OpacInput").val(o.paint.alpha).change();var t=n("#"+l+"_"+e+"_jgraduate_grad")[0];if(C!==t){var r=n(C).find("stop");n(t).empty().append(r),C=t;var a=he.val();C.setAttribute("spreadMethod",a)}L="rg"===e&&null!==C.getAttribute("fx")&&!(R===D&&B===U),n("#"+l+"_jGraduate_focusCoord").toggle(L),L&&(n("#"+l+"_jGraduate_match_ctr")[0].checked=!1)}else n(c+" .jGraduate_gradPick").hide(),n(c+" .jGraduate_colPick").show()})),n(c+" > div").hide(),Le.removeClass("jGraduate_tab_current"),o.paint.type){case"linearGradient":Te=n(c+" .jGraduate_tab_lingrad");break;case"radialGradient":Te=n(c+" .jGraduate_tab_radgrad");break;default:Te=n(c+" .jGraduate_tab_color")}o.show(),setTimeout((function(){Te.addClass("jGraduate_tab_current").click()}),10)}else n.alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Me(e,t,r,i,o){var c=o||a("stop",{"stop-color":t,"stop-opacity":r,offset:e},C);o?(t=o.getAttribute("stop-color"),r=o.getAttribute("stop-opacity"),e=o.getAttribute("offset")):C.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+e*m)+", 26)"},b),h=a("path",{d:u,fill:t,"fill-opacity":r,transform:"translate("+(10+e*m)+", 26)",stroke:"#000","stroke-width":1.5},b);return n(h).mousedown((function(e){return Oe(this),Q=X,p.mousemove(Re).mouseup(je),K=Z.offset(),e.preventDefault(),!1})).data("stop",c).data("bg",d).dblclick((function(){n("div.jGraduate_LightBox").show();for(var e=this,r=Number(c.getAttribute("stop-opacity"))||1,a=c.getAttribute("stop-color")||1,i=(255*parseFloat(r)).toString(16);i.length<2;)i="0"+i;t=a.substr(1)+i,n("#"+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:t,alphaSupport:!0}},(function(t,i){a=t.val("hex")?"#"+t.val("hex"):"none",r=null!==t.val("a")?t.val("a")/256:1,e.setAttribute("fill",a),e.setAttribute("fill-opacity",r),c.setAttribute("stop-color",a),c.setAttribute("stop-opacity",r),n("div.jGraduate_LightBox").hide(),n("#"+l+"_jGraduate_stopPicker").hide()}),null,(function(){n("div.jGraduate_LightBox").hide(),n("#"+l+"_jGraduate_stopPicker").hide()}))})),n(C).find("stop").each((function(){var r=n(this);if(Number(this.getAttribute("offset"))>e){if(!t){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}return!0})),i&&Oe(h),c}function Oe(e){X&&X.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),X=e}function je(){p.unbind("mousemove",Re),"none"!==$.getAttribute("display")&&function(){$.setAttribute("display","none");var e=n(X),t=e.data("stop"),r=e.data("bg");n([X,t,r]).remove()}(),Q=null}function Ve(){var e=te?"rotate("+te+","+ne+","+re+") ":"";if(1===J&&1===ee)C.removeAttribute("gradientTransform");else{var t=-ne*(J-1),n=-re*(ee-1);C.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+J+","+ee+")")}}function Re(e){var t=e.pageX-K.left,r=e.pageY-K.top,a="translate("+(t=t<10?10:t>m+10?m+10:t)+", 26)";r<-60||r>130?($.setAttribute("display","block"),$.setAttribute("transform",a)):$.setAttribute("display","none"),Q.setAttribute("transform",a),n.data(Q,"bg").setAttribute("transform",a);var i=n.data(Q,"stop"),o=(t-10)/m;i.setAttribute("offset",o);var s=0;n(C).find("stop").each((function(e){var t=this.getAttribute("offset"),r=n(this);t<s&&(r.prev().before(r),W=n(C).find("stop")),s=t}))}}))},n},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;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()}))}))},e},H,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){e(this).mouseup((function(c){var u=e(this);if(u.unbind("mouseup"),2===l.button||r.allowLeft||l.ctrlKey&&B()){if(c.stopPropagation(),e(".contextMenu").hide(),i.hasClass("disabled"))return!1;var d=c.pageX,h=c.pageY,p=t.width()-s.width(),f=t.height()-s.height();d>p-15&&(d=p-15),h>f-30&&(h=f-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){var n=t.split(","),r=!0,a=!1,i=void 0;try{for(var o,s=n[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value;e(this).find('A[href="'+l+'"]').parent().addClass("disabled")}}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}}})),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){var n=t.split(","),r=!0,a=!1,i=void 0;try{for(var o,s=n[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value;e(this).find('A[href="'+l+'"]').parent().removeClass("disabled")}}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}}})),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(n){n.loadingStylesheets||(n.loadingStylesheets=[]);n.loadingStylesheets.includes("jgraduate/css/jPicker.css")||n.loadingStylesheets.push("jgraduate/css/jPicker.css");var r=function e(r,a){t(this,e);var i=this;function o(e){k.forEach((function(t){t.call(i,i,e)}))}function s(e){var t=r.offset();p={l:0|t.left,t:0|t.top},clearTimeout(f),f=setTimeout((function(){u.call(i,e)}),0),n(document).bind("mousemove",l).bind("mouseup",c),e.preventDefault()}function l(e){return clearTimeout(f),f=setTimeout((function(){u.call(i,e)}),0),e.stopPropagation(),e.preventDefault(),!1}function c(e){return n(document).unbind("mouseup",c).unbind("mousemove",l),e.stopPropagation(),e.preventDefault(),!1}function u(e){var t=r.w,n=r.h,a=e.pageX-p.l,o=e.pageY-p.t;a<0?a=0:a>t&&(a=t),o<0?o=0:o>n&&(o=n),d.call(i,"xy",{x:a/t*_+v,y:o/n*w+b})}function d(e,t,n){if(!(void 0!==t))switch(br(e)&&(e="xy"),e.toLowerCase()){case"x":return g;case"y":return m;case"xy":default:return{x:g,y:m}}if(br(n)||n!==i){var r,a,s=!1;switch(br(e)&&(e="xy"),e.toLowerCase()){case"x":r=t&&(t.x&&0|t.x||0|t)||0;break;case"y":a=t&&(t.y&&0|t.y||0|t)||0;break;case"xy":default:r=t&&t.x&&0|t.x||0,a=t&&t.y&&0|t.y||0}br(r)||(r<v?r=v:r>y&&(r=y),g!==r&&(g=r,s=!0)),br(a)||(a<b?a=b:a>x&&(a=x),m!==a&&(m=a,s=!0)),s&&o.call(i,n||i)}}function h(e){"function"==typeof e&&k.push(e)}var p,f,g=0,m=0,v=0,y=100,_=100,b=0,x=100,w=100,S=r.find("img:first"),k=[];n.extend(!0,i,{val:d,range:function(e,t){var n,r,a,i;if(!(void 0!==t))switch(br(e)&&(e="all"),e.toLowerCase()){case"minx":return v;case"maxx":return y;case"rangex":return{minX:v,maxX:y,rangeX:_};case"miny":return b;case"maxy":return x;case"rangey":return{minY:b,maxY:x,rangeY:w};case"all":default:return{minX:v,maxX:y,rangeX:_,minY:b,maxY:x,rangeY:w}}switch(br(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}br(n)||v===n||(_=y-(v=n)),br(r)||y===r||(_=(y=r)-v),br(a)||b===a||(w=x-(b=a)),br(i)||x===i||(w=(x=i)-b)},bind:h,unbind:function(e){if("function"==typeof e)for(var t;t=k.includes(e);)k.splice(t,1)},destroy:function(){n(document).unbind("mouseup",c).unbind("mousemove",l),r.unbind("mousedown",s),r=null,S=null,k=null}}),S.src=a.arrow&&a.arrow.image,S.w=a.arrow&&a.arrow.width||S.width(),S.h=a.arrow&&a.arrow.height||S.height(),r.w=a.map&&a.map.width||r.width(),r.h=a.map&&a.map.height||r.height(),r.bind("mousedown",s),h.call(i,(function(){var e=r.w,t=r.h,n=S.w,a=S.h,i=0,o=0;setTimeout((function(){_>0&&(i=g===y?e:g/_*e|0),w>0&&(o=m===x?t:m/w*t|0),n>=e?i=(e>>1)-(n>>1):i-=n>>1,a>=t?o=(t>>1)-(a>>1):o-=a>>1,S.css({left:i+"px",top:o+"px"})}))}))},a=function e(r,a,i,o){t(this,e);var s=this,l=r.find("td.Text input");function c(e){if(""!==e.target.value||e.target===w.get(0)||(br(i)||e.target===i.get(0))&&!br(i)){if(!h(e))return e;switch(e.target){case g.get(0):switch(e.keyCode){case 38:return g.val(p.call(s,1+(g.val()<<0),0,255)),a.val("r",g.val(),e.target),!1;case 40:return g.val(p.call(s,(g.val()<<0)-1,0,255)),a.val("r",g.val(),e.target),!1}break;case m.get(0):switch(e.keyCode){case 38:return m.val(p.call(s,1+(m.val()<<0),0,255)),a.val("g",m.val(),e.target),!1;case 40:return m.val(p.call(s,(m.val()<<0)-1,0,255)),a.val("g",m.val(),e.target),!1}break;case v.get(0):switch(e.keyCode){case 38:return v.val(p.call(s,1+(v.val()<<0),0,255)),a.val("b",v.val(),e.target),!1;case 40:return v.val(p.call(s,(v.val()<<0)-1,0,255)),a.val("b",v.val(),e.target),!1}break;case y&&y.get(0):switch(e.keyCode){case 38:return y.val(p.call(s,parseFloat(y.val())+1,0,100)),a.val("a",vr(255*y.val()/100,o),e.target),!1;case 40:return y.val(p.call(s,parseFloat(y.val())-1,0,100)),a.val("a",vr(255*y.val()/100,o),e.target),!1}break;case _.get(0):switch(e.keyCode){case 38:return _.val(p.call(s,1+(_.val()<<0),0,360)),a.val("h",_.val(),e.target),!1;case 40:return _.val(p.call(s,(_.val()<<0)-1,0,360)),a.val("h",_.val(),e.target),!1}break;case b.get(0):switch(e.keyCode){case 38:return b.val(p.call(s,1+(b.val()<<0),0,100)),a.val("s",b.val(),e.target),!1;case 40:return b.val(p.call(s,(b.val()<<0)-1,0,100)),a.val("s",b.val(),e.target),!1}break;case x.get(0):switch(e.keyCode){case 38:return x.val(p.call(s,1+(x.val()<<0),0,100)),a.val("v",x.val(),e.target),!1;case 40:return x.val(p.call(s,(x.val()<<0)-1,0,100)),a.val("v",x.val(),e.target),!1}}}}function u(e){if(""!==e.target.value||e.target===w.get(0)||(br(i)||e.target===i.get(0))&&!br(i)){if(!h(e))return e;switch(e.target){case g.get(0):g.val(p.call(s,g.val(),0,255)),a.val("r",g.val(),e.target);break;case m.get(0):m.val(p.call(s,m.val(),0,255)),a.val("g",m.val(),e.target);break;case v.get(0):v.val(p.call(s,v.val(),0,255)),a.val("b",v.val(),e.target);break;case y&&y.get(0):y.val(p.call(s,y.val(),0,100)),a.val("a",vr(255*y.val()/100,o),e.target);break;case _.get(0):_.val(p.call(s,_.val(),0,360)),a.val("h",_.val(),e.target);break;case b.get(0):b.val(p.call(s,b.val(),0,100)),a.val("s",b.val(),e.target);break;case x.get(0):x.val(p.call(s,x.val(),0,100)),a.val("v",x.val(),e.target);break;case w.get(0):w.val(w.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),i&&i.val(w.val()),a.val("hex",""!==w.val()?w.val():null,e.target);break;case i&&i.get(0):i.val(i.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),w.val(i.val()),a.val("hex",""!==i.val()?i.val():null,e.target);break;case S&&S.get(0):S.val(S.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2)),a.val("a",br(S.val())?null:parseInt(S.val(),16),e.target)}}}function d(e){if(!br(a.val()))switch(e.target){case g.get(0):g.val(a.val("r"));break;case m.get(0):m.val(a.val("g"));break;case v.get(0):v.val(a.val("b"));break;case y&&y.get(0):y.val(vr(100*a.val("a")/255,o));break;case _.get(0):_.val(a.val("h"));break;case b.get(0):b.val(a.val("s"));break;case x.get(0):x.val(a.val("v"));break;case w.get(0):case i&&i.get(0):w.val(a.val("hex")),i&&i.val(a.val("hex"));break;case S&&S.get(0):S.val(a.val("ahex").substring(6))}}function h(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 p(e,t,n){return""===e||isNaN(e)?t:e>n?n:e<t?t:e}function f(e,t){var n=e.val("all");t!==g.get(0)&&g.val(br(n)?"":n.r),t!==m.get(0)&&m.val(br(n)?"":n.g),t!==v.get(0)&&v.val(br(n)?"":n.b),y&&t!==y.get(0)&&y.val(br(n)?"":vr(100*n.a/255,o)),t!==_.get(0)&&_.val(br(n)?"":n.h),t!==b.get(0)&&b.val(br(n)?"":n.s),t!==x.get(0)&&x.val(br(n)?"":n.v),t!==w.get(0)&&(i&&t!==i.get(0)||!i)&&w.val(br(n)?"":n.hex),i&&t!==i.get(0)&&t!==w.get(0)&&i.val(br(n)?"":n.hex),S&&t!==S.get(0)&&S.val(br(n)?"":n.ahex.substring(6))}var g=l.eq(3),m=l.eq(4),v=l.eq(5),y=l.length>7?l.eq(6):null,_=l.eq(0),b=l.eq(1),x=l.eq(2),w=l.eq(l.length>7?7:6),S=l.length>7?l.eq(8):null;n.extend(!0,s,{destroy:function(){g.add(m).add(v).add(y).add(_).add(b).add(x).add(w).add(i).add(S).unbind("keyup",u).unbind("blur",d),g.add(m).add(v).add(y).add(_).add(b).add(x).unbind("keydown",c),a.unbind(f),g=null,m=null,v=null,y=null,_=null,b=null,x=null,w=null,S=null}}),g.add(m).add(v).add(y).add(_).add(b).add(x).add(w).add(i).add(S).bind("keyup",u).bind("blur",d),g.add(m).add(v).add(y).add(_).add(b).add(x).bind("keydown",c),a.bind(f)};n.jPicker={List:[],Color:function(t){var r=this;function a(e){for(var t=0;t<g.length;t++)g[t].call(r,r,e)}function i(t,n,g){var m=Boolean(n);if(m&&""===n.ahex&&(n.ahex="00000000"),!m){var v;if((br(t)||""===t)&&(t="all"),br(o))return null;switch(t.toLowerCase()){case"ahex":return l.rgbaToHex({r:o,g:s,b:c,a:d});case"hex":return i("ahex").substring(0,6);case"all":return{r:o,g:s,b:c,a:d,h:h,s:p,v:f,hex:i.call(r,"hex"),ahex:i.call(r,"ahex")};default:v={};var y=t.length;u(t).forEach((function(e){switch(e){case"r":1===y?v=o:v.r=o;break;case"g":1===y?v=s:v.g=s;break;case"b":1===y?v=c:v.b=c;break;case"a":1===y?v=d:v.a=d;break;case"h":1===y?v=h:v.h=h;break;case"s":1===y?v=p:v.s=p;break;case"v":1===y?v=f:v.v=f}}))}return"object"!==e(v)||Object.keys(v).length?v:i.call(r,"all")}if(br(g)||g!==r){br(t)&&(t="");var _=!1;if(br(n))return br(o)||(o=null,_=!0),br(s)||(s=null,_=!0),br(c)||(c=null,_=!0),br(d)||(d=null,_=!0),br(h)||(h=null,_=!0),br(p)||(p=null,_=!0),br(f)||(f=null,_=!0),void(_&&a.call(r,g||r));switch(t.toLowerCase()){case"ahex":case"hex":var b=l.hexToRgba(n&&(n.ahex||n.hex)||n||"none");i.call(r,"rgba",{r:b.r,g:b.g,b:b.b,a:"ahex"===t?b.a:br(d)?255:d},g);break;default:if(n&&(!br(n.ahex)||!br(n.hex)))return void i.call(r,"ahex",n.ahex||n.hex||"00000000",g);var x={},w=!1,S=!1;if(void 0===n.r||t.includes("r")||(t+="r"),void 0===n.g||t.includes("g")||(t+="g"),void 0===n.b||t.includes("b")||(t+="b"),void 0===n.a||t.includes("a")||(t+="a"),void 0===n.h||t.includes("h")||(t+="h"),void 0===n.s||t.includes("s")||(t+="s"),void 0===n.v||t.includes("v")||(t+="v"),u(t).forEach((function(e){switch(e){case"r":if(S)return;w=!0,x.r=n.r&&0|n.r||0|n||0,x.r<0?x.r=0:x.r>255&&(x.r=255),o!==x.r&&(o=x.r,_=!0);break;case"g":if(S)return;w=!0,x.g=n&&n.g&&0|n.g||n&&0|n||0,x.g<0?x.g=0:x.g>255&&(x.g=255),s!==x.g&&(s=x.g,_=!0);break;case"b":if(S)return;w=!0,x.b=n&&n.b&&0|n.b||n&&0|n||0,x.b<0?x.b=0:x.b>255&&(x.b=255),c!==x.b&&(c=x.b,_=!0);break;case"a":x.a=n&&!br(n.a)?0|n.a:0|n,x.a<0?x.a=0:x.a>255&&(x.a=255),d!==x.a&&(d=x.a,_=!0);break;case"h":if(w)return;S=!0,x.h=n&&n.h&&0|n.h||n&&0|n||0,x.h<0?x.h=0:x.h>360&&(x.h=360),h!==x.h&&(h=x.h,_=!0);break;case"s":if(w)return;S=!0,x.s=br(n.s)?0|n:0|n.s,x.s<0?x.s=0:x.s>100&&(x.s=100),p!==x.s&&(p=x.s,_=!0);break;case"v":if(w)return;S=!0,x.v=br(n.v)?0|n:0|n.v,x.v<0?x.v=0:x.v>100&&(x.v=100),f!==x.v&&(f=x.v,_=!0)}})),_){if(w){o=o||0,s=s||0,c=c||0;var k=l.rgbToHsv({r:o,g:s,b:c});h=k.h,p=k.s,f=k.v}else if(S){h=h||0,p=br(p)?100:p,f=br(f)?100:f;var C=l.hsvToRgb({h:h,s:p,v:f});o=C.r,s=C.g,c=C.b}d=br(d)?255:d,a.call(r,g||r)}}}}var o,s,c,d,h,p,f,g=[];n.extend(!0,r,{val:i,bind:function(e){"function"==typeof e&&g.push(e)},unbind:function(e){if("function"==typeof e)for(var t;t=g.includes(e);)g.splice(t,1)},destroy:function(){g=null}}),t&&(br(t.ahex)?br(t.hex)?br(t.r)||br(t.g)||br(t.b)?br(t.h)||br(t.s)||br(t.v)||i("hsv"+(br(t.a)?"":"a"),t):i("rgb"+(br(t.a)?"":"a"),t):i((br(t.a)?"":"a")+"hex",br(t.a)?t:{ahex:t.hex+l.intToHex(t.a)}):i("ahex",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,n=e.r/255,r=e.g/255,a=e.b/255,i={h:0,s:0,v:0},o=0,s=0;return n>=r&&n>=a?(s=n,o=r>a?a:r):r>=a&&r>=n?(s=r,o=n>a?a:n):(s=a,o=r>n?n:r),i.v=s,i.s=s?(s-o)/s:0,i.s?(t=s-o,i.h=n===s?(r-a)/t:r===s?2+(a-n)/t:4+(n-r)/t,i.h=parseInt(60*i.h),i.h<0&&(i.h+=360)):i.h=0,i.s=100*i.s|0,i.v=100*i.v|0,i},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 i=n.jPicker,o=i.Color,s=i.List,l=i.ColorMethods;return n.fn.jPicker=function(t,i,c,u){return this.each((function(){var d=this,h=n.extend(!0,{},n.fn.jPicker.defaults,t);"input"===n(d).get(0).nodeName.toLowerCase()&&(n.extend(!0,h,{window:{bindToInput:!0,expandable:!0,input:n(d)}}),""===n(d).val()?(h.color.active=new o({hex:null}),h.color.current=new o({hex:null})):l.validateHex(n(d).val())&&(h.color.active=new o({hex:n(d).val(),a:h.color.active.val("a")}),h.color.current=new o({hex:n(d).val(),a:h.color.active.val("a")}))),h.window.expandable?n(d).after('<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>'):h.window.liveUpdate=!1;var p=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function f(e){var t,n,r=z.active,a=r.val("hex");switch(h.color.mode=e,e){case"h":if(setTimeout((function(){w.call(d,K,"transparent"),k.call(d,$,0),C.call(d,$,100),k.call(d,J,260),C.call(d,J,100),w.call(d,Z,"transparent"),k.call(d,te,0),C.call(d,te,100),k.call(d,ne,260),C.call(d,ne,100),k.call(d,re,260),C.call(d,re,100),k.call(d,ae,260),C.call(d,ae,100),k.call(d,oe,260),C.call(d,oe,100)}),0),se.range("all",{minX:0,maxX:100,minY:0,maxY:100}),le.range("rangeY",{minY:0,maxY:360}),br(r.val("ahex")))break;se.val("xy",{x:r.val("s"),y:100-r.val("v")},se),le.val("y",360-r.val("h"),le);break;case"s":if(setTimeout((function(){w.call(d,K,"transparent"),k.call(d,$,-260),k.call(d,J,-520),k.call(d,te,-260),k.call(d,ne,-520),k.call(d,oe,260),C.call(d,oe,100)}),0),se.range("all",{minX:0,maxX:360,minY:0,maxY:100}),le.range("rangeY",{minY:0,maxY:100}),br(r.val("ahex")))break;se.val("xy",{x:r.val("h"),y:100-r.val("v")},se),le.val("y",100-r.val("s"),le);break;case"v":if(setTimeout((function(){w.call(d,K,"000000"),k.call(d,$,-780),k.call(d,J,260),w.call(d,Z,a),k.call(d,te,-520),k.call(d,ne,260),C.call(d,ne,100),k.call(d,oe,260),C.call(d,oe,100)}),0),se.range("all",{minX:0,maxX:360,minY:0,maxY:100}),le.range("rangeY",{minY:0,maxY:100}),br(r.val("ahex")))break;se.val("xy",{x:r.val("h"),y:100-r.val("s")},se),le.val("y",100-r.val("v"),le);break;case"r":if(t=-1040,n=-780,se.range("all",{minX:0,maxX:255,minY:0,maxY:255}),le.range("rangeY",{minY:0,maxY:255}),br(r.val("ahex")))break;se.val("xy",{x:r.val("b"),y:255-r.val("g")},se),le.val("y",255-r.val("r"),le);break;case"g":if(t=-1560,n=-1820,se.range("all",{minX:0,maxX:255,minY:0,maxY:255}),le.range("rangeY",{minY:0,maxY:255}),br(r.val("ahex")))break;se.val("xy",{x:r.val("b"),y:255-r.val("r")},se),le.val("y",255-r.val("g"),le);break;case"b":if(t=-2080,n=-2860,se.range("all",{minX:0,maxX:255,minY:0,maxY:255}),le.range("rangeY",{minY:0,maxY:255}),br(r.val("ahex")))break;se.val("xy",{x:r.val("r"),y:255-r.val("g")},se),le.val("y",255-r.val("b"),le);break;case"a":if(setTimeout((function(){w.call(d,K,"transparent"),k.call(d,$,-260),k.call(d,J,-520),k.call(d,te,260),k.call(d,ne,260),C.call(d,ne,100),k.call(d,oe,0),C.call(d,oe,100)}),0),se.range("all",{minX:0,maxX:360,minY:0,maxY:100}),le.range("rangeY",{minY:0,maxY:255}),br(r.val("ahex")))break;se.val("xy",{x:r.val("h"),y:100-r.val("v")},se),le.val("y",255-r.val("a"),le);break;default:throw new Error("Invalid Mode")}switch(e){case"h":break;case"s":case"v":case"a":setTimeout((function(){C.call(d,$,100),C.call(d,te,100),k.call(d,re,260),C.call(d,re,100),k.call(d,ae,260),C.call(d,ae,100)}),0);break;case"r":case"g":case"b":setTimeout((function(){w.call(d,K,"transparent"),w.call(d,Z,"transparent"),C.call(d,te,100),C.call(d,$,100),k.call(d,$,t),k.call(d,J,t-260),k.call(d,te,n-780),k.call(d,ne,n-520),k.call(d,re,n),k.call(d,ae,n-260),k.call(d,oe,260),C.call(d,oe,100)}),0)}br(r.val("ahex"))||g.call(d,r)}function g(e,t){(br(t)||t!==le&&t!==se)&&y.call(d,e,t),setTimeout((function(){_.call(d,e),b.call(d,e),x.call(d,e)}),0)}function m(e,t){var n=z.active;if(t===se||!br(n.val())){var r=e.val("all");switch(h.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 v(e,t){var n=z.active;if(t===le||!br(n.val()))switch(h.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 y(e,t){if(t!==se)switch(h.color.mode){case"h":var n=e.val("sv");se.val("xy",{x:br(n)?100:n.s,y:100-(br(n)?100:n.v)},t);break;case"s":case"a":var r=e.val("hv");se.val("xy",{x:r&&r.h||0,y:100-(br(r)?100:r.v)},t);break;case"v":var a=e.val("hs");se.val("xy",{x:a&&a.h||0,y:100-(br(a)?100:a.s)},t);break;case"r":var i=e.val("bg");se.val("xy",{x:i&&i.b||0,y:255-(i&&i.g||0)},t);break;case"g":var o=e.val("br");se.val("xy",{x:o&&o.b||0,y:255-(o&&o.r||0)},t);break;case"b":var s=e.val("rg");se.val("xy",{x:s&&s.r||0,y:255-(s&&s.g||0)},t)}if(t!==le)switch(h.color.mode){case"h":le.val("y",360-(e.val("h")||0),t);break;case"s":var l=e.val("s");le.val("y",100-(br(l)?100:l),t);break;case"v":var c=e.val("v");le.val("y",100-(br(c)?100:c),t);break;case"r":le.val("y",255-(e.val("r")||0),t);break;case"g":le.val("y",255-(e.val("g")||0),t);break;case"b":le.val("y",255-(e.val("b")||0),t);break;case"a":var u=e.val("a");le.val("y",255-(br(u)?255:u),t)}}function _(e){try{var t=e.val("all");ue.css({backgroundColor:t&&"#"+t.hex||"transparent"}),C.call(d,ue,t&&vr(100*t.a/255,4)||0)}catch(e){}}function b(e){switch(h.color.mode){case"h":w.call(d,K,new o({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");C.call(d,J,100-(br(t)?100:t));break;case"v":var n=e.val("v");C.call(d,$,br(n)?100:n);break;case"r":C.call(d,J,vr((e.val("r")||0)/255*100,4));break;case"g":C.call(d,J,vr((e.val("g")||0)/255*100,4));break;case"b":C.call(d,J,vr((e.val("b")||0)/255*100))}var r=e.val("a");C.call(d,ee,vr(100*(255-(r||0))/255,4))}function x(e){switch(h.color.mode){case"h":var t=e.val("a");C.call(d,ie,vr(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),r=new o({h:n&&n.h||0,s:100,v:br(n)?100:n.v});w.call(d,Z,r.val("hex")),C.call(d,ne,100-(br(n)?100:n.v)),C.call(d,ie,vr(100*(255-(n&&n.a||0))/255,4));break;case"v":var a=e.val("hsa"),i=new o({h:a&&a.h||0,s:br(a)?100:a.s,v:100});w.call(d,Z,i.val("hex")),C.call(d,ie,vr(100*(255-(a&&a.a||0))/255,4));break;case"r":case"g":case"b":var s=e.val("rgba"),l=0,c=0;"r"===h.color.mode?(l=s&&s.b||0,c=s&&s.g||0):"g"===h.color.mode?(l=s&&s.b||0,c=s&&s.r||0):"b"===h.color.mode&&(l=s&&s.r||0,c=s&&s.g||0);var u=c>l?l:c;C.call(d,ne,l>c?vr((l-c)/(255-c)*100,4):0),C.call(d,re,c>l?vr((c-l)/(255-l)*100,4):0),C.call(d,ae,vr(u/255*100,4)),C.call(d,ie,vr(100*(255-(s&&s.a||0))/255,4));break;case"a":var p=e.val("a");w.call(d,Z,e.val("hex")||"000000"),C.call(d,ie,br(p)?100:0),C.call(d,oe,br(p)?0:100)}}function w(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function S(e,t){p&&(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 k(e,t){e.css({top:t+"px"})}function C(e,t){if(e.css({visibility:t>0?"visible":"hidden"}),t>0&&t<100)if(p){var n=e.attr("pngSrc");!br(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:vr(t/100,4)})}else e.css({opacity:vr(t/100,4)});else if(0===t||100===t)if(p){var r=e.attr("pngSrc");!br(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 A(){z.active.val("ahex",z.current.val("ahex"))}function E(){z.current.val("ahex",z.active.val("ahex"))}function G(e){n(this).parents("tbody:first").find('input:radio[value!="'+e.target.value+'"]').removeAttr("checked"),f.call(d,e.target.value)}function P(){A.call(d)}function I(){A.call(d),h.window.expandable&&D.call(d),"function"==typeof u&&u.call(d,z.active,pe)}function N(){E.call(d),h.window.expandable&&D.call(d),"function"==typeof i&&i.call(d,z.active,he)}function T(){B.call(d)}function L(e){var t=e.val("hex");de.css({backgroundColor:t&&"#"+t||"transparent"}),C.call(d,de,vr(100*(e.val("a")||0)/255,4))}function M(e){var t=e.val("hex"),n=e.val("va");ge.css({backgroundColor:t&&"#"+t||"transparent"}),C.call(d,me,vr(100*(255-(n&&n.a||0))/255,4)),h.window.bindToInput&&h.window.updateInputColor&&h.window.input.css({backgroundColor:t&&"#"+t||"transparent",color:br(n)||n.v>75?"#000000":"#ffffff"})}function O(e){q=parseInt(Q.css("left")),Y=parseInt(Q.css("top")),W=e.pageX,X=e.pageY,n(document).bind("mousemove",j).bind("mouseup",V),e.preventDefault()}function j(e){return Q.css({left:q-(W-e.pageX)+"px",top:Y-(X-e.pageY)+"px"}),h.window.expandable&&!n.support.boxModel&&Q.prev().css({left:Q.css("left"),top:Q.css("top")}),e.stopPropagation(),e.preventDefault(),!1}function V(e){return n(document).unbind("mousemove",j).unbind("mouseup",V),e.stopPropagation(),e.preventDefault(),!1}function R(e){return e.preventDefault(),e.stopPropagation(),z.active.val("ahex",n(this).attr("title")||null,e.target),!1}function B(){function e(){if(h.window.expandable&&!n.support.boxModel){var e=Q.find("table:first");Q.before("<iframe/>"),Q.prev().css({width:e.width(),height:Q.height(),opacity:0,position:"absolute",left:Q.css("left"),top:Q.css("top")})}}switch(z.current.val("ahex",z.active.val("ahex")),h.window.expandable&&(n(document.body).children("div.jPicker.Container").css({zIndex:10}),Q.css({zIndex:20})),h.window.effects.type){case"fade":Q.fadeIn(h.window.effects.speed.show,e);break;case"slide":Q.slideDown(h.window.effects.speed.show,e);break;case"show":default:Q.show(h.window.effects.speed.show,e)}}function D(){function e(){h.window.expandable&&Q.css({zIndex:10}),h.window.expandable&&!n.support.boxModel&&Q.prev().remove()}switch(h.window.effects.type){case"fade":Q.fadeOut(h.window.effects.speed.hide,e);break;case"slide":Q.slideUp(h.window.effects.speed.hide,e);break;case"show":default:Q.hide(h.window.effects.speed.hide,e)}}function U(){var t=h.window,i=t.expandable?n(d).next().find(".Container:first"):null;(Q=t.expandable?n("<div/>"):n(d)).addClass("jPicker Container"),t.expandable&&Q.hide(),Q.get(0).onselectstart=function(e){return"input"===e.target.nodeName.toLowerCase()};var s=z.active.val("all");t.alphaPrecision<0?t.alphaPrecision=0:t.alphaPrecision>2&&(t.alphaPrecision=2);var l='<table class="jPicker" cellpadding="0" cellspacing="0">\n <tbody>\n '.concat(t.expandable?'<tr><td class="Move" colspan="5"> </td></tr>':"",'\n <tr>\n <td rowspan="9"><h2 class="Title">').concat(t.title||H.text.title,'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="').concat(F.clientPath+F.colorMap.arrow.file,'" class="Arrow"/></div></td>\n <td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="').concat(F.clientPath+F.colorBar.arrow.file,'" class="Arrow"/></div></td>\n <td colspan="2" class="Preview">').concat(H.text.newColor,'<div><span class="Active" title="').concat(H.tooltips.colors.newColor,'"> </span><span class="Current" title="').concat(H.tooltips.colors.currentColor,'"> </span></div>').concat(H.text.currentColor,'</td>\n <td rowspan="9" class="Button"><input type="button" class="Ok" value="').concat(H.text.ok,'" title="').concat(H.tooltips.buttons.ok,'"/><input type="button" class="Cancel" value="').concat(H.text.cancel,'" title="').concat(H.tooltips.buttons.cancel,'"/><hr/><div class="Grid"> </div></td>\n </tr>\n <tr class="Hue">\n <td class="Radio"><label title="').concat(H.tooltips.hue.radio,'"><input type="radio" value="h"').concat("h"===h.color.mode?' checked="checked"':"",'/>H:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(br(s)?"":s.h,'" title="').concat(H.tooltips.hue.textbox,'"/> °</td>\n </tr>\n <tr class="Saturation">\n <td class="Radio"><label title="').concat(H.tooltips.saturation.radio,'"><input type="radio" value="s"').concat("s"===h.color.mode?' checked="checked"':"",'/>S:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(br(s)?"":s.s,'" title="').concat(H.tooltips.saturation.textbox,'"/> %</td>\n </tr>\n <tr class="Value">\n <td class="Radio"><label title="').concat(H.tooltips.value.radio,'"><input type="radio" value="v"').concat("v"===h.color.mode?' checked="checked"':"",'/>V:</label><br/><br/></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(br(s)?"":s.v,'" title="').concat(H.tooltips.value.textbox,'"/> %<br/><br/></td>\n </tr>\n <tr class="Red">\n <td class="Radio"><label title="').concat(H.tooltips.red.radio,'"><input type="radio" value="r"').concat("r"===h.color.mode?' checked="checked"':"",'/>R:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(br(s)?"":s.r,'" title="').concat(H.tooltips.red.textbox,'"/></td>\n </tr>\n <tr class="Green">\n <td class="Radio"><label title="').concat(H.tooltips.green.radio,'"><input type="radio" value="g"').concat("g"===h.color.mode?' checked="checked"':"",'/>G:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(br(s)?"":s.g,'" title="').concat(H.tooltips.green.textbox,'"/></td>\n </tr>\n <tr class="Blue">\n <td class="Radio"><label title="').concat(H.tooltips.blue.radio,'"><input type="radio" value="b"').concat("b"===h.color.mode?' checked="checked"':"",'/>B:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(br(s)?"":s.b,'" title="').concat(H.tooltips.blue.textbox,'"/></td>\n </tr>\n <tr class="Alpha">\n <td class="Radio">').concat(t.alphaSupport?'<label title="'.concat(H.tooltips.alpha.radio,'"><input type="radio" value="a"').concat("a"===h.color.mode?' checked="checked"':"","/>A:</label>"):" ",'</td>\n <td class="Text">').concat(t.alphaSupport?'<input type="text" maxlength="'.concat(3+t.alphaPrecision,'" value="').concat(br(s)?"":vr(100*s.a/255,t.alphaPrecision),'" title="').concat(H.tooltips.alpha.textbox,'"/> %'):" ",'</td>\n </tr>\n <tr class="Hex">\n <td colspan="2" class="Text"><label title="').concat(H.tooltips.hex.textbox,'">#:<input type="text" maxlength="6" class="Hex" value="').concat(br(s)?"":s.hex,'"/></label>').concat(t.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'.concat(br(s)?"":s.ahex.substring(6),'" title="').concat(H.tooltips.hex.alpha,'"/></td>'):" ","\n </tr>\n </tbody></table>");t.expandable?(Q.html(l),n(document.body).children("div.jPicker.Container").length?n(document.body).children("div.jPicker.Container:last").after(Q):n(document.body).prepend(Q),Q.mousedown((function(){n(document.body).children("div.jPicker.Container").css({zIndex:10}),Q.css({zIndex:20})})),Q.css({left:"left"===t.position.x?i.offset().left-530-("center"===t.position.y?25:0)+"px":"center"===t.position.x?i.offset().left-260+"px":"right"===t.position.x?i.offset().left-10+("center"===t.position.y?25:0)+"px":"screenCenter"===t.position.x?(n(document).width()>>1)-260+"px":i.offset().left+parseInt(t.position.x)+"px",position:"absolute",top:"top"===t.position.y?i.offset().top-312+"px":"center"===t.position.y?i.offset().top-156+"px":"bottom"===t.position.y?i.offset().top+25+"px":i.offset().top+parseInt(t.position.y)+"px"})):(Q=n(d)).html(l);var u=Q.find("tbody:first");K=u.find("div.Map:first"),Z=u.find("div.Bar:first");var p=K.find("span"),y=Z.find("span");$=p.filter(".Map1:first"),J=p.filter(".Map2:first"),ee=p.filter(".Map3:first"),te=y.filter(".Map1:first"),ne=y.filter(".Map2:first"),re=y.filter(".Map3:first"),ae=y.filter(".Map4:first"),ie=y.filter(".Map5:first"),oe=y.filter(".Map6:first"),(se=new r(K,{map:{width:F.colorMap.width,height:F.colorMap.height},arrow:{image:F.clientPath+F.colorMap.arrow.file,width:F.colorMap.arrow.width,height:F.colorMap.arrow.height}})).bind(m),(le=new r(Z,{map:{width:F.colorBar.width,height:F.colorBar.height},arrow:{image:F.clientPath+F.colorBar.arrow.file,width:F.colorBar.arrow.width,height:F.colorBar.arrow.height}})).bind(v),ce=new a(u,z.active,t.expandable&&t.bindToInput?t.input:null,t.alphaPrecision);var _=br(s)?null:s.hex,b=u.find(".Preview"),x=u.find(".Button");if(ue=b.find(".Active:first").css({backgroundColor:_&&"#"+_||"transparent"}),de=b.find(".Current:first").css({backgroundColor:_&&"#"+_||"transparent"}).bind("click",P),C.call(d,de,vr(100*z.current.val("a")/255,4)),he=x.find(".Ok:first").bind("click",N),pe=x.find(".Cancel:first").bind("click",I),fe=x.find(".Grid:first"),setTimeout((function(){S.call(d,$,F.clientPath+"Maps.png"),S.call(d,J,F.clientPath+"Maps.png"),S.call(d,ee,F.clientPath+"map-opacity.png"),S.call(d,te,F.clientPath+"Bars.png"),S.call(d,ne,F.clientPath+"Bars.png"),S.call(d,re,F.clientPath+"Bars.png"),S.call(d,ae,F.clientPath+"Bars.png"),S.call(d,ie,F.clientPath+"bar-opacity.png"),S.call(d,oe,F.clientPath+"AlphaBar.png"),S.call(d,b.find("div:first"),F.clientPath+"preview-opacity.png")}),0),u.find("td.Radio input").bind("click",G),z.quickList&&z.quickList.length>0){for(var w="",k=0;k<z.quickList.length;k++){"string"===e(z.quickList[k]).toString().toLowerCase()&&(z.quickList[k]=new o({hex:z.quickList[k]}));var A=z.quickList[k].val("a"),E=z.quickList[k].val("ahex");!t.alphaSupport&&E&&(E=E.substring(0,6)+"ff");var j=z.quickList[k].val("hex");E||(E="00000000"),w+='<span class="QuickColor" title="#'+E+'" style="background-color:'+(j&&"#"+j||"")+";"+(j?"":"background-image:url("+F.clientPath+"NoColor.png)")+(t.alphaSupport&&A&&A<255?";opacity:"+vr(A/255,4)+";filter:Alpha(opacity="+vr(A/2.55,4)+")":"")+'"> </span>'}S.call(d,fe,F.clientPath+"bar-opacity.png"),fe.html(w),fe.find(".QuickColor").click(R)}f.call(d,h.color.mode),z.active.bind(g),"function"==typeof c&&z.active.bind(c),z.current.bind(L),t.expandable?(d.icon=i.parents(".Icon:first"),ge=d.icon.find(".Color:first").css({backgroundColor:_&&"#"+_||"transparent"}),me=d.icon.find(".Alpha:first"),S.call(d,me,F.clientPath+"bar-opacity.png"),C.call(d,me,vr(100*(255-(br(s)?0:s.a))/255,4)),ve=d.icon.find(".Image:first").css({backgroundImage:"url('"+F.clientPath+F.picker.file+"')"}).bind("click",T),t.bindToInput&&t.updateInputColor&&t.input.css({backgroundColor:_&&"#"+_||"transparent",color:br(s)||s.v>75?"#000000":"#ffffff"}),ye=u.find(".Move:first").bind("mousedown",O),z.active.bind(M)):B.call(d)}var F=h.images,H=h.localization,z={active:"string"===e(h.color.active).toString().toLowerCase()?new o({ahex:!h.window.alphaSupport&&h.color.active?h.color.active.substring(0,6)+"ff":h.color.active}):new o({ahex:!h.window.alphaSupport&&h.color.active.val("ahex")?h.color.active.val("ahex").substring(0,6)+"ff":h.color.active.val("ahex")}),current:"string"===e(h.color.active).toString().toLowerCase()?new o({ahex:!h.window.alphaSupport&&h.color.active?h.color.active.substring(0,6)+"ff":h.color.active}):new o({ahex:!h.window.alphaSupport&&h.color.active.val("ahex")?h.color.active.val("ahex").substring(0,6)+"ff":h.color.active.val("ahex")}),quickList:h.color.quickList};"function"!=typeof i&&(i=null),"function"!=typeof c&&(c=null),"function"!=typeof u&&(u=null);var 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=null,he=null,pe=null,fe=null,ge=null,me=null,ve=null,ye=null;n.extend(!0,d,{commitCallback:i,liveCallback:c,cancelCallback:u,color:z,show:B,hide:D,destroy:function(){Q.find("td.Radio input").unbind("click",G),de.unbind("click",P),pe.unbind("click",I),he.unbind("click",N),h.window.expandable&&(ve.unbind("click",T),ye.unbind("mousedown",O),d.icon=null),Q.find(".QuickColor").unbind("click",R),K=null,Z=null,$=null,J=null,ee=null,te=null,ne=null,re=null,ae=null,ie=null,oe=null,se.destroy(),se=null,le.destroy(),le=null,ce.destroy(),ce=null,ue=null,de=null,he=null,pe=null,fe=null,i=null,u=null,c=null,Q.html("");for(var e=0;e<s.length;e++)s[e]===d&&(s.splice(e,1),e--)}}),s.push(d),setTimeout((function(){U.call(d)}),0)}))},n.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 o({ahex:"#ffcc00ff"}),quickList:[new o({h:360,s:33,v:100}),new o({h:360,s:66,v:100}),new o({h:360,s:100,v:100}),new o({h:360,s:100,v:75}),new o({h:360,s:100,v:50}),new o({h:180,s:0,v:100}),new o({h:30,s:33,v:100}),new o({h:30,s:66,v:100}),new o({h:30,s:100,v:100}),new o({h:30,s:100,v:75}),new o({h:30,s:100,v:50}),new o({h:180,s:0,v:90}),new o({h:60,s:33,v:100}),new o({h:60,s:66,v:100}),new o({h:60,s:100,v:100}),new o({h:60,s:100,v:75}),new o({h:60,s:100,v:50}),new o({h:180,s:0,v:80}),new o({h:90,s:33,v:100}),new o({h:90,s:66,v:100}),new o({h:90,s:100,v:100}),new o({h:90,s:100,v:75}),new o({h:90,s:100,v:50}),new o({h:180,s:0,v:70}),new o({h:120,s:33,v:100}),new o({h:120,s:66,v:100}),new o({h:120,s:100,v:100}),new o({h:120,s:100,v:75}),new o({h:120,s:100,v:50}),new o({h:180,s:0,v:60}),new o({h:150,s:33,v:100}),new o({h:150,s:66,v:100}),new o({h:150,s:100,v:100}),new o({h:150,s:100,v:75}),new o({h:150,s:100,v:50}),new o({h:180,s:0,v:50}),new o({h:180,s:33,v:100}),new o({h:180,s:66,v:100}),new o({h:180,s:100,v:100}),new o({h:180,s:100,v:75}),new o({h:180,s:100,v:50}),new o({h:180,s:0,v:40}),new o({h:210,s:33,v:100}),new o({h:210,s:66,v:100}),new o({h:210,s:100,v:100}),new o({h:210,s:100,v:75}),new o({h:210,s:100,v:50}),new o({h:180,s:0,v:30}),new o({h:240,s:33,v:100}),new o({h:240,s:66,v:100}),new o({h:240,s:100,v:100}),new o({h:240,s:100,v:75}),new o({h:240,s:100,v:50}),new o({h:180,s:0,v:20}),new o({h:270,s:33,v:100}),new o({h:270,s:66,v:100}),new o({h:270,s:100,v:100}),new o({h:270,s:100,v:75}),new o({h:270,s:100,v:50}),new o({h:180,s:0,v:10}),new o({h:300,s:33,v:100}),new o({h:300,s:66,v:100}),new o({h:300,s:100,v:100}),new o({h:300,s:100,v:75}),new o({h:300,s:100,v:50}),new o({h:180,s:0,v:0}),new o({h:330,s:33,v:100}),new o({h:330,s:66,v:100}),new o({h:330,s:100,v:100}),new o({h:330,s:100,v:75}),new o({h:330,s:100,v:50}),new o]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:20,height:7}},picker:{file:"picker.gif",width:25,height:24}},localization:{text:{title:"Drag Markers To Pick A Color",newColor:"new",currentColor:"current",ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press “OK” To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To “Hue” Color Mode",textbox:"Enter A “Hue” Value (0-360°)"},saturation:{radio:"Set To “Saturation” Color Mode",textbox:"Enter A “Saturation” Value (0-100%)"},value:{radio:"Set To “Value” Color Mode",textbox:"Enter A “Value” Value (0-100%)"},red:{radio:"Set To “Red” Color Mode",textbox:"Enter A “Red” Value (0-255)"},green:{radio:"Set To “Green” Color Mode",textbox:"Enter A “Green” Value (0-255)"},blue:{radio:"Set To “Blue” Color Mode",textbox:"Enter A “Blue” Value (0-255)"},alpha:{radio:"Set To “Alpha” Color Mode",textbox:"Enter A “Alpha” Value (0-100)"},hex:{textbox:"Enter A “Hex” Color Value (#000000-#ffffff)",alpha:"Enter A “Alpha” Value (#00-#ff)"}}}},n}].reduce((function(e,t){return t(e)}),jQuery);Er.loadingStylesheets.includes("svg-editor.css")||Er.loadingStylesheets.push("svg-editor.css");Er.loadingStylesheets.some((function(e){return!Array.isArray(e)||"images/logo.png"!==e[0]}))&&Er.loadingStylesheets.push(["images/logo.png",{favicon:!0}]),Ar.tool_scale=1,Ar.exportWindowCt=0,Ar.langChanged=!1,Ar.showSaveWarning=!1,Ar.storagePromptState="ignore";var Gr,Pr,Ir=[],Nr={lang:"",iconsize:"",bkgd_color:"#FFF",bkgd_url:"",img_save:"embed",save_notice_done:!1,export_notice_done:!1},Tr=["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"],Lr={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,langPath:"locale/",extPath:"extensions/",canvgPath:"canvg/",jspdfPath:"jspdf/",imgPath:"images/",jGraduatePath:"jgraduate/images/",extIconsPath:"extensions/",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,avoidClientSide:!1,avoidClientSideDownload:!1,avoidClientSideOpen:!1},Mr=Ar.uiStrings={},Or=!1,jr=!1,Vr=!1,Rr={},Br={extensions:[],stylesheets:[],allowedOrigins:[]};function Dr(e){var t,n,r=arguments;return regeneratorRuntime.async((function(a){for(;;)switch(a.prev=a.next){case 0:if(t=r.length>1&&void 0!==r[1]?r[1]:{},n=t.noAlert,!(!1!==Gr.setSvgString(e))){a.next=4;break}return a.abrupt("return");case 4:if(n){a.next=8;break}return a.next=7,regeneratorRuntime.awrap(Er.alert(Mr.notification.errorLoadingSVG));case 7:return a.abrupt("return");case 8:throw new Error("Error loading SVG");case 9:case"end":return a.stop()}}))}function Ur(e){var t=e.defaultLang,n=e.defaultName;return function(){var e,r,a,i,o,s,l=arguments;return regeneratorRuntime.async((function(c){for(;;)switch(c.prev=c.next){case 0:return s=function(e){return ln("".concat(Br.extPath,"ext-locale/").concat(a,"/").concat(e,".js"),{global:"svgEditorExtensionLocale_".concat(a,"_").concat(e.replace(/-/g,"_"))})},e=l.length>0&&void 0!==l[0]?l[0]:{},r=e.name,a=void 0===r?n:r,i=e.lang,o=void 0===i?t:i,c.prev=2,c.next=5,regeneratorRuntime.awrap(s(o));case 5:return c.abrupt("return",c.sent);case 8:return c.prev=8,c.t0=c.catch(2),c.abrupt("return",s("en"));case 11:case"end":return c.stop()}}),null,null,[[2,8]])}}Er.pref=function(e,t){return t?(Rr[e]=t,void(Ar.curPrefs=Rr)):e in Rr?Rr[e]:Nr[e]},Ar.putLocale=function(e,t,n){var r;return regeneratorRuntime.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e?yr=e:((yr=xr.pref("lang"))||(navigator.userLanguage?yr=navigator.userLanguage:navigator.language&&(yr=navigator.language)),console.log("Lang: "+yr),t.includes(yr)||"test"===yr||(yr="en")),r=n.langPath+"lang."+yr+".js",a.t0=Sr,a.next=5,regeneratorRuntime.awrap(ln(r,{global:"svgEditorLang_"+yr.replace(/-/g,"_")}));case 5:return a.t1=a.sent,a.abrupt("return",(0,a.t0)(a.t1));case 7:case"end":return a.stop()}}))},Ar.readLang=Sr,Ar.setStrings=wr,Ar.loadContentAndPrefs=function(){if(Br.forceStorage||!Br.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/)){if(Ar.storage&&(Br.forceStorage||!Br.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)svgeditstore=prefsAndContent/))){var e="svgedit-"+Br.canvasName,t=Ar.storage.getItem(e);t&&Ar.loadFromString(t)}Object.keys(Nr).forEach((function(e){var t,n="svg-edit-"+e;if(Ar.storage){var r=Ar.storage.getItem(n);r&&(Nr[e]=String(r))}else if(window.widget)Nr[e]=window.widget.preferenceForKey(n);else{var a=document.cookie.match(new RegExp("(?:^|;\\s*)"+(t=encodeURIComponent(n),String(t).replace(/[.\\+*?[^\]$(){}=!<>|:-]/g,"\\$&"))+"=([^;]+)"));Nr[e]=a?decodeURIComponent(a[1]):""}}))}},Ar.setConfig=function(t,n){function r(t,n,r){t[n]&&"object"===e(t[n])?Er.extend(!0,t[n],r):t[n]=r}n=n||{},Er.each(t,(function(a,i){if({}.hasOwnProperty.call(t,a))if({}.hasOwnProperty.call(Nr,a)){if(!1===n.overwrite&&(Br.preventAllURLConfig||{}.hasOwnProperty.call(Rr,a)))return;!0===n.allowInitialUserOverride?Nr[a]=i:Er.pref(a,i)}else if(["extensions","stylesheets","allowedOrigins"].includes(a)){if(!1===n.overwrite&&(Br.preventAllURLConfig||["allowedOrigins","stylesheets"].includes(a)||"extensions"===a&&Br.lockExtensions))return;Br[a]=Br[a].concat(i)}else if({}.hasOwnProperty.call(Lr,a)){if(!1===n.overwrite&&(Br.preventAllURLConfig||{}.hasOwnProperty.call(Br,a)))return;if({}.hasOwnProperty.call(Br,a)){if(!1===n.overwrite)return;r(Br,a,i)}else!0===n.allowInitialUserOverride?r(Lr,a,i):Lr[a]&&"object"===e(Lr[a])?(Br[a]=Array.isArray(Lr[a])?[]:{},Er.extend(!0,Br[a],i)):Br[a]=i}})),Ar.curConfig=Br},Ar.setCustomHandlers=function(e){return Ar.ready((function(){e.open&&(Er('#tool_open > input[type="file"]').remove(),Er("#tool_open").show(),Gr.open=e.open),e.save&&(Ar.showSaveWarning=!1,Gr.bind("saved",e.save)),e.exportImage&&(jr=e.exportImage,Gr.bind("exported",jr)),e.exportPDF&&(Vr=e.exportPDF,Gr.bind("exportedPDF",Vr))}))},Ar.randomizeIds=function(e){Gr.randomizeIds(e)},Ar.init=function(){!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)||Object.assign(Lr,{langPath:"../dist/locale/",extPath:"../dist/extensions/",canvgPath:"../dist/",jspdfPath:"../dist/"});try{"localStorage"in window&&(Ar.storage=localStorage)}catch(e){}var e=[];function n(){(Br=Er.extend(!0,{},Lr,Br)).noDefaultExtensions||(Br.extensions=Br.extensions.concat(Tr)),["extensions","stylesheets","allowedOrigins"].forEach((function(e){Br[e]=Er.grep(Br[e],(function(t,n){return n===Br[e].indexOf(t)}))})),Ar.curConfig=Br}Er("#lang_select option").each((function(){e.push(this.value)})),function(){var e,t;if(Pr=Er.deparam.querystring(!0),Er.isEmptyObject(Pr))n(),Ar.loadContentAndPrefs();else{if(Pr.dimensions&&(Pr.dimensions=Pr.dimensions.split(",")),Pr.bkgd_color&&(Pr.bkgd_color="#"+Pr.bkgd_color),Pr.extensions&&(Pr.extensions=Pr.extensions.match(/[:\/\\]/)?"":Pr.extensions.split(",")),["langPath","extPath","canvgPath","jspdfPath","imgPath","jGraduatePath","extIconsPath"].forEach((function(e){Pr[e]&&delete Pr[e]})),Ar.setConfig(Pr,{overwrite:!1}),n(),!Br.preventURLContentLoading){if(e=Pr.source,t=Er.param.querystring(),e||t.includes("source=data:")&&(e=t.match(/source=(data:[^&]*)/)[1]),e)return void(e.startsWith("data:")?Ar.loadFromDataURI(e):Ar.loadFromString(e));if(Pr.url)return void Ar.loadFromURL(Pr.url)}Pr.noStorageOnLoad&&!Br.forceStorage||Ar.loadContentAndPrefs()}Rr=Er.extend(!0,{},Nr,Rr),Ar.curPrefs=Rr}();var a=Ar.setIcon=function(e,t,n){var r="string"==typeof t?Er.getSvgIcon(t,!0):t.clone();r?Er(e).empty().append(r):console.log("NOTE: Icon image missing: "+t)},i=function(){var t,n,r,a,i,o;return regeneratorRuntime.async((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,regeneratorRuntime.awrap(Ar.putLocale(null,e,Br));case 2:return t=s.sent,n=t.langParam,r=t.langData,s.next=7,regeneratorRuntime.awrap(xn(n,r));case 7:return a=Mr.common,i=a.ok,o=a.cancel,hn(Er,{ok:i,cancel:o}),Er.svgIcons(Br.imgPath+"svg_edit_icons.svg",{w:24,h:24,id_match:!1,no_img:!O(),fallback_path:Br.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){var t,n,r,a,i,o,s;return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(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}},Er(".toolbar_button button > svg, .toolbar_button button > img").each((function(){Er(this).parent().prepend(this)})),(t=Er("#tools_left")).length&&(n=t.offset().top+t.outerHeight()),r=Er.pref("iconsize"),Ar.setIconSize(r||(Er(window).height()<n?"s":"m")),Er(".tools_flyout").each((function(){var e=Er("#"+this.id+"_show"),t=e.attr("data-curopt");if(!e.children("svg, img").length){var n=Er(t).children().clone();n.length&&(n[0].removeAttribute("style"),e.append(n))}})),i=Er.loadingStylesheets.sort((function(e,t){var n=a(e),r=a(t);return n===r?0:n>r})),Br.stylesheets.length&&(i=u(new Set(Br.stylesheets)),(o=i.indexOf("@default"))>-1&&(s=i).splice.apply(s,[o,1].concat(u(Er.loadingStylesheets)))),e.next=11,regeneratorRuntime.awrap(Cr(i,{acceptErrors:function(e){var t=e.stylesheetURL,n=e.reject,r=e.resolve;Er.loadingStylesheets.includes(t)?n(new Error("Missing expected stylesheet: ".concat(t))):r()}}));case 11:return Er("#svg_container")[0].style.visibility="visible",e.next=14,regeneratorRuntime.awrap(Ar.runCallbacks());case 14:case"end":return e.stop()}}))}}),s.prev=10,s.next=13,regeneratorRuntime.awrap(Promise.all(Br.extensions.map((function(e){var t,r,a,i,o,s,l;return regeneratorRuntime.async((function(c){for(;;)switch(c.prev=c.next){case 0:if(t=e.match(/^ext-(.+)\.js/)){c.next=3;break}return c.abrupt("return",void 0);case 3:return r=Br.extPath+e,c.prev=4,c.next=7,regeneratorRuntime.awrap(ln(r,{global:"svgEditorExtension_"+t[1].replace(/-/g,"_")}));case 7:return a=c.sent,i=a.name,o=void 0===i?t[1]:i,s=a.init,l=Ur({defaultLang:n,defaultName:o}),c.abrupt("return",Ar.addExtension(o,s&&s.bind(Ar),{$:Er,importLocale:l}));case 13:return c.prev=13,c.t0=c.catch(4),console.log(c.t0),console.error("Extension failed to load: "+e+"; "+c.t0),c.abrupt("return",void 0);case 18:case"end":return c.stop()}}),null,null,[[4,13]])}))));case 13:Gr.bind("extensions_added",(function(e,t){Fr=!0,pn.setAll(),Er(".flyout_arrow_horiz:empty").each((function(){Er(this).append(Er.getSvgIcon("arrow_right",!0).width(5).height(5))})),"ignore"===Ar.storagePromptState&&Z(!0),Hr.forEach((function(e){Gr.call("message",e)}))})),Gr.call("extensions_added"),s.next=20;break;case 17:s.prev=17,s.t0=s.catch(10),console.log(s.t0);case 20:case"end":return s.stop()}}),null,null,[[10,17]])},o={tool_scale:Ar.tool_scale},s=function(){Er(".tools_flyout").each((function(){var e=Er("#"+this.id+"_show"),t=e.offset(),n=t.left,r=t.top,a=e.outerWidth();Er(this).css({left:(n+a)*Ar.tool_scale,top:r})}))},l=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":""}(),d=Ar.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=Er(t),r=1;if("number"==typeof e)r=e;else{r={s:.75,m:1,l:1.25,xl:1.5}[e]}o.tool_scale=Ar.tool_scale=r,s();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=Er(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);nn(s)&&(s=parseInt(e.css("margin-"+o)),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(),Er.pref("iconsize",e),Er("#iconsize").val(e);var i={"#tools_top":{left:50+Er("#main_button").width(),height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}},c=Er("#tool_size_rules");if(c.length?c.empty():c=Er('<style id="tool_size_rules"></style>').appendTo("head"),"m"!==e){var u="";Er.each(i,(function(t,n){t="#svg_editor "+t.replace(/,/g,", #svg_editor"),u+=t+"{",Er.each(n,(function(t,n){var a;"number"==typeof n?a=n*r+"px":(n[e]||n.all)&&(a=n[e]||n.all),u+=t+":"+a+";"})),u+="}"}));var d="-"+l.toLowerCase()+"-";u+=t+"{"+d+"transform: scale("+r+");} #svg_editor div.toolset .toolset {"+d+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+d+"transform: scale("+1/r+");}",c.text(u)}s()};Ar.canvas=Gr=new pr(document.getElementById("svgcanvas"),Br);var p,f,g=B()?"meta+":"ctrl+",m=Gr.pathActions,v=Gr.undoMgr,y=Er("#workarea"),_=Er("#cmenu_canvas"),b={fill:null,stroke:null},x=null,w=Br.imgPath+"logo.png",S="crosshair",k="crosshair",C="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){}}();for(var A=function(){var e=Er(".tool_button_current");e.length&&"tool_select"!==e[0].id&&(e.removeClass("tool_button_current").addClass("tool_button"),Er("#tool_select").addClass("tool_button_current").removeClass("tool_button"),Er("#styleoverrides").text("\n #svgcanvas svg * {\n cursor: move;\n pointer-events: all;\n }\n #svgcanvas svg {\n cursor: default;\n }\n ")),Gr.setMode("select"),y.css("cursor","auto")},E=Er("title:first").text(),G=[],P=.1;P<1e5;P*=10)G.push(P),G.push(2*P),G.push(5*P);var I=function(e){var t,n=[],r=Gr.getCurrentDrawing().getNumLayers();for(t=0;t<r;t++)n[t]=Gr.getCurrentDrawing().getLayerName(t);e?n.forEach((function(t){t!==e&&Gr.getCurrentDrawing().setLayerOpacity(t,.5)})):n.forEach((function(e){Gr.getCurrentDrawing().setLayerOpacity(e,1)}))},N=function(){Gr.clearSelection();for(var e=Er("#layerlist tbody").empty(),t=Er("#selLayerNames").empty(),n=Gr.getCurrentDrawing(),r=n.getCurrentLayerName(),a=Er.getSvgIcon("eye"),i=Gr.getCurrentDrawing().getNumLayers();i--;){var o=n.getLayerName(i),s=Er('<tr class="layer">').toggleClass("layersel",o===r),l=Er('<td class="layervis">').toggleClass("layerinvis",!n.getLayerVisibility(o)),c=Er('<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();Er("td.layervis",e).append(u),Er.resizeSvgIcons({"td.layervis .svg_icon":14})}Er("#layerlist td.layername").mouseup((function(e){Er("#layerlist tr.layer").removeClass("layersel"),Er(this.parentNode).addClass("layersel"),Gr.setCurrentLayer(this.textContent),e.preventDefault()})).mouseover((function(){I(this.textContent)})).mouseout((function(){I()})),Er("#layerlist td.layervis").click((function(){var e=Er(this.parentNode).prevAll().length,t=Er("#layerlist tr.layer:eq("+e+") td.layername").text(),n=Er(this).hasClass("layerinvis");Gr.setLayerVisibility(t,n),Er(this).toggleClass("layerinvis")}));for(var d=5-Er("#layerlist tr.layer").size();d-- >0;)e.append('<tr><td style="color:white">_</td><td/></tr>')},T=!1,L="",M=function(e,t){T||(T=!0,L=Gr.getSvgString(),Er("#save_output_btns").toggle(Boolean(t)),Er("#tool_source_back").toggle(!t),Er("#svg_source_textarea").val(L),Er("#svg_source_editor").fadeIn(),Er("#svg_source_textarea").focus())},U=null,F=!1,H=function(){window.opera&&Er("<p/>").hide().appendTo("body").remove()};function z(e,t){var n=e.id,r=c(n.split("_"),2),i=r[0],o=r[1];t&&Gr.setStrokeAttr("stroke-"+i,o),H(),a("#cur_"+i,n,20),Er(e).addClass("current").siblings().removeClass("current")}var q=Ar.toolButtonClick=function(e,t){if(Er(e).hasClass("disabled"))return!1;if(Er(e).parent().hasClass("tools_flyout"))return!0;return t||Er(".tools_flyout").fadeOut("normal"),Er("#styleoverrides").text(""),y.css("cursor","auto"),Er(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),Er(e).addClass("tool_button_current").removeClass("tool_button"),!0},Y=Ar.clickSelect=function(){q("#tool_select")&&(Gr.setMode("select"),Er("#styleoverrides").text("\n #svgcanvas svg * {\n cursor: move;\n pointer-events: all;\n }\n #svgcanvas svg {\n cursor: default;\n }\n "))},W=Ar.setImageURL=function(e){e||(e=w),Gr.setImageURL(e),Er("#image_url").val(e),e.startsWith("data:")?(Er("#image_url").hide(),Er("#change_image_url").show()):(Gr.embedImage(e,(function(t){Er("#url_notice").toggle(!t),w=e})),Er("#image_url").show(),Er("#change_image_url").hide())};function X(e,t){Er.pref("bkgd_color",e),Er.pref("bkgd_url",t),Gr.setBackground(e,t)}function Q(){var e,t,n,r,a,i=arguments;return regeneratorRuntime.async((function(o){for(;;)switch(o.prev=o.next){case 0:return e=i.length>0&&void 0!==i[0]?i[0]:{},t=e.cancelDeletes,n=void 0!==t&&t,r=(r=Gr.getHref(U)).startsWith("data:")?"":r,o.next=5,regeneratorRuntime.awrap(Er.prompt(Mr.notification.enterNewImgURL,r));case 5:(a=o.sent)?W(a):n&&Gr.deleteSelectedElements();case 7:case"end":return o.stop()}}))}function K(e,t){var n,r;t||(t=Gr.getZoom()),e||(e=Er("#svgcanvas"));var a=Gr.getContentElem(),i=te()[Br.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=Er("#ruler_"+s+" canvas:first"),d=u.clone();u.replaceWith(d);var h=d[0],p=e[l](),f=p;h.parentNode.style[l]=f+"px";var g=h.getContext("2d"),m=void 0,v=void 0,y=void 0;if(g.fillStyle="rgb(200,0,0)",g.fillRect(0,0,h.width,h.height),d.siblings().remove(),p>=3e4){y=parseInt(p/3e4)+1,(m=[])[0]=g;var _=void 0;for(r=1;r<y;r++)h[l]=3e4,_=h.cloneNode(!0),h.parentNode.append(_),m[r]=_.getContext("2d");_[l]=p%3e4,p=3e4}h[l]=p;var b=i*t,x=50/b,w=1;for(r=0;r<G.length&&(w=v=G[r],!(x<=v));r++);var S=w*b;g.font="9px sans-serif";for(var k=c/b%w*b,C=k-S,A=0;k<f;){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)),v=(C-c)/b;var P=void 0;if(w>=1)P=Math.round(v);else{var I=String(w).split(".")[1].length;P=v.toFixed(I)}if(0!==P&&1e3!==P&&P%1e3==0&&(P=P/1e3+"K"),o)g.fillText(P,k+2,8);else{var N=String(P).split("");for(r=0;r<N.length;r++)g.fillText(N[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(m&&L>p){if(A++,g.stroke(),A>=y){r=10,k=f;continue}g=m[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 Z=Ar.updateCanvas=function(e,t){var n=Gr.getZoom(),r=y,a=Er("#svgcanvas"),i=y.width(),o=y.height(),s=i,l=o,c=r[0].scrollLeft+s/2,u=r[0].scrollTop+l/2,d=Br.canvas_expansion;i=Math.max(s,Gr.contentW*n*d),o=Math.max(l,Gr.contentH*n*d),i===s&&o===l?y.css("overflow","hidden"):y.css("overflow","scroll");var h=a.height()/2,p=a.width()/2;a.width(i).height(o);var f=o/2,g=i/2,m=Gr.updateCanvas(i,o),v=g/p,_=i/2-s/2,b=o/2-l/2;t?(t.x+=m.x,t.y+=m.y):t={x:g+(c-p)*v,y:f+(u-h)*v};e?Gr.contentW>r.width()?(y[0].scrollLeft=m.x-10,y[0].scrollTop=m.y-10):(r[0].scrollLeft=_,r[0].scrollTop=b):(r[0].scrollLeft=t.x-s/2,r[0].scrollTop=t.y-l/2),Br.showRulers&&(K(a,n),y.scroll()),!0!==Pr.storagePrompt&&"ignore"===Ar.storagePromptState&&Er("#dialog_box").hide()},$=function(){var e="none"===Gr.getColor("fill"),t="none"===Gr.getColor("stroke"),n=["#tool_fhpath","#tool_line"],r=["#tools_rect .tool_button","#tools_ellipse .tool_button","#tool_text","#tool_path"];t?n.forEach((function(e){Er(e).hasClass("tool_button_current")&&Y(),Er(e).addClass("disabled")})):n.forEach((function(e){Er(e).removeClass("disabled")})),t&&e?r.forEach((function(e){Er(e).hasClass("tool_button_current")&&Y(),Er(e).addClass("disabled")})):r.forEach((function(e){Er(e).removeClass("disabled")})),Gr.runExtensions("toolButtonStateUpdate",{nofill:e,nostroke:t}),Er(".tools_flyout").each((function(){var e=Er("#"+this.id+"_show"),t=!1;Er(this).children().each((function(){Er(this).hasClass("disabled")||(t=!0)})),e.toggleClass("disabled",!t)})),H()},J=function(){var e=U;nn(e)||e.parentNode||(e=null);var t=Gr.getCurrentDrawing().getCurrentLayerName(),n=Gr.getMode(),r="px"!==Br.baseUnit?Br.baseUnit:null,i="pathedit"===n,o=Er("#cmenu_canvas li");if(Er("#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(),nn(e))F?(Er("#multiselected_panel").show(),o.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")):o.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");else{var s=e.nodeName,l=Gr.getRotationAngle(e);Er("#angle").val(l);var c=Gr.getBlur(e);if(Er("#blur").val(c),Er("#blur_slider").slider("option","value",c),Gr.addedNew&&"image"===s&&"image"===Gr.getMode()&&(Gr.getHref(e).startsWith("data:")||Q({cancelDeletes:!0})),i||"pathedit"===n){var u=m.getNodePoint();if(Er("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"),Er("#tool_node_delete").toggleClass("disabled",!m.canDeleteNodes),a("#tool_openclose_path",m.closed_subpath?"open_path":"close_path"),u){var d=Er("#seg_type");r&&(u.x=re(u.x),u.y=re(u.y)),Er("#path_node_x").val(u.x),Er("#path_node_y").val(u.y),u.type?d.val(u.type).removeAttr("disabled"):d.val(4).attr("disabled","disabled")}return}if(Er("#selected_panel").show(),["line","circle","ellipse"].includes(s))Er("#xy_panel").hide();else{var h,p;if(["g","polyline","path"].includes(s)){var f=Gr.getStrokedBBox([e]);f&&(h=f.x,p=f.y)}else h=e.getAttribute("x"),p=e.getAttribute("y");r&&(h=re(h),p=re(p)),Er("#selected_x").val(h||0),Er("#selected_y").val(p||0),Er("#xy_panel").show()}var g=!["image","text","path","g","use"].includes(s);Er("#tool_topath").toggle(g),Er("#tool_reorient").toggle("path"===s),Er("#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=Gr.getHref(e),Er("#g_panel").show()),"a"===e.parentNode.tagName&&(Er(e).siblings().length||(Er("#a_panel").show(),x=Gr.getHref(e.parentNode))),Er("#tool_make_link, #tool_make_link").toggle(!x),x&&Er("#link_url").val(x),y[b]){var w=y[b];if(Er("#"+b+"_panel").show(),Er.each(w,(function(t,n){var r=e.getAttribute(n);if("px"!==Br.baseUnit&&e[n]){var a=e[n].baseVal.value;r=re(a)}Er("#"+b+"_"+n).val(r||0)})),"text"===b)Er("#text_panel").css("display","inline"),Er("#tool_font_size").css("display","inline"),Gr.getItalic()?Er("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):Er("#tool_italic").removeClass("push_button_pressed").addClass("tool_button"),Gr.getBold()?Er("#tool_bold").addClass("push_button_pressed").removeClass("tool_button"):Er("#tool_bold").removeClass("push_button_pressed").addClass("tool_button"),Er("#font_family").val(e.getAttribute("font-family")),Er("#font_size").val(e.getAttribute("font-size")),Er("#text").val(e.textContent),Gr.addedNew&&setTimeout((function(){Er("#text").focus().select()}),100);else if("image"===b&&"image"===Gr.getMode())W(Gr.getHref(e));else if("g"===b||"use"===b){Er("#container_panel").show();var S=Gr.getTitle(),k=Er("#g_title")[0];k.value=S,function(e){var t=Math.min(Math.max(12+6*e.value.length,50),300);Er(e).width(t)}(k),Er("#g_title").prop("disabled","use"===b)}}o[("g"===b?"en":"dis")+"ableContextMenuItems"]("#ungroup"),o[("g"!==b&&F?"en":"dis")+"ableContextMenuItems"]("#group")}Er("#tool_undo").toggleClass("disabled",0===v.getUndoStackSize()),Er("#tool_redo").toggleClass("disabled",0===v.getRedoStackSize()),Gr.addedNew=!1,e&&!i||F?(Er("#selLayerNames").removeAttr("disabled").val(t),_.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")):Er("#selLayerNames").attr("disabled","disabled")},ee=function(){if(!Wt){var e="\n #workarea.wireframe #svgcontent * {\n stroke-width: ".concat(1/Gr.getZoom(),"px;\n }\n ");Er("#wireframe_rules").text(y.hasClass("wireframe")?e:"")}},ne="",ae=function(e){e=e||Gr.getDocumentTitle();var t=E+(e?": "+e:"");Er("title:first").text(t)};var ie=function(){ee()},se=Gr.zoomChanged=function(e,t,n){var r=y,a=Gr.setBBoxZoom(t,r.width()-15,r.height()-15);if(a){var i=a.zoom,o=a.bbox;i<.001?le({value:.1}):(Er("#zoom").val((100*i).toFixed(1)),n?Z():Z(!1,{x:o.x*i+o.width*i/2,y:o.y*i+o.height*i/2}),"zoom"===Gr.getMode()&&o.width&&A(),ie())}},le=function(e){var t=e.value/100;if(t<.001)e.value=.1;else{var n=Gr.getZoom(),r=y;se(window,{width:0,height:0,x:(r[0].scrollLeft+r.width()/2)/n,y:(r[0].scrollTop+r.height()/2)/n,zoom:t},!0)}};Er("#cur_context_panel").delegate("a","click",(function(){var e=Er(this);return e.attr("data-root")?Gr.leaveContext():Gr.setContext(e.text()),Gr.clearSelection(),!1}));var ce=function(){b.fill.prep(),b.stroke.prep()},ue={},de=function(){Er(".tools_flyout").each((function(){var e=Er("#"+this.id+"_show");if(!e.data("isLibrary")){var t=Er(this).children().map((function(){return this.title})).get();e[0].title=t.join(" / ")}}))},he={},pe=function(e){Er.each(e,(function(t,n){var r;he[t]||(he[t]=[]),(r=he[t]).push.apply(r,u(n));var a,i=Er(t).children().not(".tool_button_evt_handled"),o=t+"_show",s=Er(o),l=!1;i.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=c(e,2);n[0];return n[1].sel===t})),a=c(r,2),i=a[0],u=a[1];ue[u.sel]=u.fn,u.isDefault&&(l=i);var d=function(t){var n,r=u;if("keydown"===t.type){var a=Er(r.parent+"_show").hasClass("tool_button_current"),i=Er(r.parent+"_show").attr("data-curopt");Object.entries(e[u.parent]).some((function(n){var o=c(n,2),s=o[0],l=o[1];return l.sel===i&&(t.shiftKey&&a?(s=parseInt(s),r=he[u.parent][s+1]||e[u.parent][0]):r=l,!0)}))}return!Er(this).hasClass("disabled")&&(q(o)&&r.fn(),(n=r.icon?Er.getSvgIcon(r.icon,!0):Er(r.sel).children().eq(0).clone())[0].setAttribute("width",s.width()),n[0].setAttribute("height",s.height()),s.children(":not(.flyout_arrow_horiz)").remove(),s.append(n).attr("data-curopt",r.sel),!0)};return Er(this).mouseup(d),u.key&&Er(document).bind("keydown",u.key[0]+" shift+"+u.key[0],d),!0})),l?s.attr("data-curopt",n[l].sel):s.attr("data-curopt")||s.attr("data-curopt",n[0].sel);var d=Er(o).position();s.mousedown((function(e){if(s.hasClass("disabled"))return!1;var n=Er(t),r=d.left+34,i=-1*n.width(),o=n.data("shown_popop")?200:0;return a=setTimeout((function(){s.data("isLibrary")?n.css("left",r).show():n.css("left",i).show().animate({left:r},150),n.data("shown_popop",!0)}),o),e.preventDefault(),!0})).mouseup((function(e){clearTimeout(a);var t=Er(this).attr("data-curopt");s.data("isLibrary")&&Er(o.replace("_show","")).is(":visible")?q(o,!0):q(o)&&ue[t]&&ue[t]()}))})),de(),s()},fe=function(e,t){return Er("<div>",{class:"tools_flyout",id:e}).appendTo("#svg_editor").append(t)},ge=function(e,t,n,r){var i=Er(e),o=r.dropUp,s=Er(t);o&&Er(e).addClass("dropup"),s.find("li").bind("mouseup",(function(){r.seticon&&(a("#cur_"+i[0].id,Er(this).children()),Er(this).addClass("current").siblings().removeClass("current"));for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];n.apply.apply(n,[this].concat(t))}));var l=!1;Er(window).mouseup((function(e){l||(i.removeClass("down"),s.hide(),s.css({top:0,left:0})),l=!1})),i.bind("mousedown",(function(){var e=i.offset();o?(e.top-=s.height(),e.left+=8):e.top+=i.height(),s.offset(e),i.hasClass("down")?(s.hide(),s.css({top:0,left:0})):(s.show(),l=!0),i.toggleClass("down")})).hover((function(){l=!0})).mouseout((function(){l=!1})),r.multiclick&&s.mousedown((function(){l=!0}))},me=[];Gr.bind("selected",(function(e,t){var n=Gr.getMode();"select"===n&&A();var r="pathedit"===n;U=1===t.length||nn(t[1])?t[0]:null,F=t.length>=2&&!nn(t[1]),nn(U)||r||function(){var e,t;if(!nn(U))switch(U.tagName){case"use":case"image":case"foreignObject":break;case"g":case"a":var n=U.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)}Er("#stroke_width").val(null===r?"":r),b.fill.update(!0),b.stroke.update(!0);break;default:b.fill.update(!0),b.stroke.update(!0),Er("#stroke_width").val(U.getAttribute("stroke-width")||1),Er("#stroke_style").val(U.getAttribute("stroke-dasharray")||"none");var i=U.getAttribute("stroke-linejoin")||"miter";Er("#linejoin_"+i).length&&z(Er("#linejoin_"+i)[0]),i=U.getAttribute("stroke-linecap")||"butt",Er("#linecap_"+i).length&&z(Er("#linecap_"+i)[0])}if(!nn(U)){var o=100*(U.getAttribute("opacity")||1);Er("#group_opacity").val(o),Er("#opac_slider").slider("option","value",o),Er("#elem_id").val(U.id),Er("#elem_class").val(U.getAttribute("class"))}$()}(),function(e,t){Er("#path_node_panel").toggle(e),Er("#tools_bottom_2,#tools_bottom_3").toggle(!e),e?(Er(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),Er("#tool_select").addClass("tool_button_current").removeClass("tool_button"),a("#tool_select","select_node"),F=!1,t.length&&(U=t[0])):setTimeout((function(){a("#tool_select","select")}),1e3)}(r,t),J(),Gr.runExtensions("selectedChanged",{elems:t,selectedElement:U,multiselected:F})})),Gr.bind("transition",(function(e,t){var n=Gr.getMode(),r=t[0];if(r){if(!(F=t.length>=2&&!nn(t[1])))switch(n){case"rotate":var a=Gr.getRotationAngle(r);Er("#angle").val(a),Er("#tool_reorient").toggleClass("disabled",0===a)}Gr.runExtensions("elementTransition",{elems:t})}})),Gr.bind("changed",(function(e,t){var n=Gr.getMode();"select"===n&&A(),t.forEach((function(e){var t=e&&"svg"===e.tagName;t||function(e){return e&&"g"===e.tagName&&fn.CLASS_REGEX.test(e.getAttribute("class"))}(e)?(N(),t&&Z()):e&&U&&nn(U.parentNode)&&(U=e)})),Ar.showSaveWarning=!0,J(),U&&"select"===n&&(b.fill.update(),b.stroke.update()),Gr.runExtensions("elementChanged",{elems:t})})),Gr.bind("saved",(function(e,t){if(Ar.showSaveWarning=!1,t='<?xml version="1.0"?>\n'+t,V())M(0,!0);else{var n=document.createElement("a");n.href="data:image/svg+xml;base64,"+St(t),n.download="icon.svg",n.style.display="none",document.body.append(n),n.click();var r=Er.pref("save_notice_done");if("all"!==r){var a=Mr.notification.saveFromBrowser.replace("%s","SVG");j()?t.includes("<defs")?(a+="\n\n"+Mr.notification.defsFailOnSave,Er.pref("save_notice_done","all"),r="all"):Er.pref("save_notice_done","part"):Er.pref("save_notice_done","all"),"part"!==r&&Er.alert(a)}}})),Gr.bind("exported",(function(e,t){var n=t.issues,r=t.exportWindowName;if((x=window.open(Pt||"",r))&&!x.closed){if(x.location.href=t.bloburl||t.datauri,"all"!==Er.pref("export_notice_done")){var a=Mr.notification.saveFromBrowser.replace("%s",t.type);if(n.length){a+="\n\n"+Mr.notification.noteTheseIssues+"\n • "+n.join("\n • ")}Er.pref("export_notice_done","all"),x.alert(a)}}else Er.alert(Mr.notification.popupWindowBlocked)})),Gr.bind("exportedPDF",(function(e,t){if(t.output){var n=t.exportWindowName;n&&(x=window.open("",n)),x&&!x.closed?x.location.href=t.output:Er.alert(Mr.notification.popupWindowBlocked)}})),Gr.bind("zoomed",se),Gr.bind("zoomDone",ie),Gr.bind("updateCanvas",(function(e,t){var n=t.center,r=t.newCtr;Z(n,r)})),Gr.bind("contextset",(function(e,t){var n="";if(t){var r="";n='<a href="#" data-root="y">'+Gr.getCurrentDrawing().getCurrentLayerName()+"</a>",Er(t).parentsUntil("#svgcontent > g").andSelf().each((function(){this.id&&(r+=" > "+this.id,n+=this!==t?' > <a href="#">'+this.id+"</a>":" > "+this.id)})),ne=r}else ne=null;Er("#cur_context_panel").toggle(Boolean(t)).html(n),ae()})),Gr.bind("extension_added",(function(e,t){var n,r,a,i,o,s,l,c,u,h,f;return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=function(){p&&(clearTimeout(p),p=null),r||(p=setTimeout((function(){r=!0,d(Er.pref("iconsize"))}),50))},t){e.next=3;break}return e.abrupt("return",void 0);case 3:if(n=!1,r=!1,!t.langReady){e.next=14;break}if(!Ar.langChanged){e.next=13;break}return a=Er.pref("lang"),e.next=10,regeneratorRuntime.awrap(t.langReady({lang:a,uiStrings:Mr,importLocale:Ur({defaultLang:a,defaultName:t.name})}));case 10:bn.push(t.name),e.next=14;break;case 13:me.push(t);case 14:if(o=function(){t.callback&&!n&&(n=!0,t.callback.call(Ar))},s=[],t.context_tools&&Er.each(t.context_tools,(function(e,t){var n,r=t.container_id?' id="'+t.container_id+'"':"",a=Er("#"+t.panel);switch(a.length||(a=Er("<div>",{id:t.panel}).appendTo("#tools_top")),t.type){case"tool_button":n='<div class="tool_button">'+t.id+"</div>";var i=Er(n).appendTo(a);t.events&&Er.each(t.events,(function(e,t){Er(i).bind(e,t)}));break;case"select":n="<label"+r+'><select id="'+t.id+'">',Er.each(t.options,(function(e,r){var a=e===t.defval?" selected":"";n+='<option value="'+e+'"'+a+">"+r+"</option>"}));var o=Er(n+="</select></label>").appendTo(a).find("select");Er.each(t.events,(function(e,t){Er(o).bind(e,t)}));break;case"button-select":n='<div id="'+t.id+'" class="dropdown toolset" title="'+t.title+'"><div id="cur_'+t.id+'" class="icon_label"></div><button></button></div>';var l=Er('<ul id="'+t.id+'_opts"></ul>').appendTo("#option_lists");t.colnum&&l.addClass("optcols"+t.colnum),Er(n).appendTo(a).children(),s.push({elem:"#"+t.id,list:"#"+t.id+"_opts",title:t.title,callback:t.events.change,cur:"#cur_"+t.id});break;case"input":n="<label"+r+'><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=Er(n).appendTo(a).find("input");t.spindata&&c.SpinButton(t.spindata),t.events&&Er.each(t.events,(function(e,t){c.bind(e,t)}))}})),l=t.svgicons,!t.buttons){e.next=24;break}if(c={},u={},h={},f={},Er.each(t.buttons,(function(e,t){for(var n,r,a,i,o,s,d,p=t.id,g=e;Er("#"+p).length;)p=t.id+"_"+ ++g;if(l){c[p]=t.icon,u[p]=t.title;var m=t.svgicon||t.id;"app_menu"===t.type?h["#"+p+" > div"]=m:h["#"+p]=m}else n=Er('<img src="'+t.icon+(t.title?'" alt="'+t.title:"")+'">');switch(t.type){case"mode_flyout":case"mode":r="tool_button",a="#tools_left";break;case"context":r="tool_button",a="#"+t.panel,Er(a).length||Er("<div>",{id:t.panel}).appendTo("#tools_top");break;case"app_menu":r="",a="#main_menu ul"}var v,y=Er(t.list||"app_menu"===t.type?"<li/>":"<div/>").attr("id",p).attr("title",t.title).addClass(r);if(t.includeWith||t.list){if(t.list){if(y.addClass("push_button"),Er("#"+t.list+"_opts").append(y),t.isDefault){Er("#cur_"+t.list).append(y.children().clone());var _=t.svgicon||t.id;h["#cur_"+t.list]=_}}else if(t.includeWith){var b,x=t.includeWith;i=(d=Er(x.button)).parent(),d.parent().hasClass("tools_flyout")||(b=d[0].id.replace("tool_","tools_"),o=d.clone().attr("id",b+"_show").append(Er("<div>",{class:"flyout_arrow_horiz"})),d.before(o),i=fe(b,d)),s=pn.getButtonData(x.button),x.isDefault&&(h["#"+b+"_show"]=t.id);var w=f["#"+i[0].id]=[{sel:"#"+p,fn:t.events.click,icon:t.id,key:t.key,isDefault:Boolean(t.includeWith&&t.includeWith.isDefault)},s],S="position"in x?x.position:"last",k=i.children().length;!isNaN(S)&&S>=0&&S<k?i.children().eq(S).before(y):(i.append(y),w.reverse())}}else"position"in t?Er(a).children().eq(t.position).length?Er(a).children().eq(t.position).before(y):Er(a).children().last().after(y):y.appendTo(a),"mode_flyout"===t.type?(i=(d=Er(y)).parent(),d.parent().hasClass("tools_flyout")||(v=d[0].id.replace("tool_","tools_"),o=d.clone().attr("id",v+"_show").append(Er("<div>",{class:"flyout_arrow_horiz"})),d.before(o),(i=fe(v,d)).data("isLibrary",!0),o.data("isLibrary",!0)),h["#"+v+"_show"]=t.id,f["#"+i[0].id]=[{sel:"#"+p,fn:t.events.click,icon:t.id,isDefault:!0}]):"app_menu"===t.type&&y.append("<div>").append(t.title);l||y.append(n),t.list||Er.each(t.events,(function(e,n){"click"===e&&"mode"===t.type?(D()&&"click"===e&&(e="mousedown"),t.includeWith?y.bind(e,n):y.bind(e,(function(){q(y)&&n()})),t.key&&(Er(document).bind("keydown",t.key,n),t.title&&y.attr("title",t.title+" ["+t.key+"]"))):y.bind(e,n)})),pe(f)})),Er.each(s,(function(){ge(this.elem,this.list,this.callback,{seticon:!0})})),!l){e.next=24;break}return e.abrupt("return",new Promise((function(e,t){Er.svgIcons(l,{w:24,h:24,id_match:!1,no_img:!O(),fallback:c,placement:h,callback:function(t){"m"!==Er.pref("iconsize")&&i(),o(),e()}})})));case 24:return e.abrupt("return",o());case 25:case"end":return e.stop()}}))})),Gr.textActions.setInputElem(Er("#text")[0]);var ve='<div class="palette_item" data-rgb="none"></div>';Er.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){ve+='<div class="palette_item" style="background-color: '+t+';" data-rgb="'+t+'"></div>'})),Er("#palette").append(ve);ve="",Er.each(["#FFF","#888","#000"],(function(){ve+='<div class="color_block" style="background-color:'+this+';"></div>'})),Er("#bg_blocks").append(ve);var ye=Er("#bg_blocks div"),_e="cur_background";ye.each((function(){Er(this).click((function(){ye.removeClass(_e),Er(this).addClass(_e)}))})),X(Er.pref("bkgd_color"),Er.pref("bkgd_url")),Er("#image_save_opts input").val([Er.pref("img_save")]);var be=function(e,t){nn(t)&&(t=e.value),Er("#group_opacity").val(t),e&&e.handle||Er("#opac_slider").slider("option","value",t),Gr.setOpacity(t/100)},xe=function(e,t,n){nn(t)&&(t=e.value),Er("#blur").val(t);var r=!1;e&&e.handle||(Er("#blur_slider").slider("option","value",t),r=!0),n?Gr.setBlurNoUndo(t):Gr.setBlur(t,r)};Er("#stroke_style").change((function(){Gr.setStrokeAttr("stroke-dasharray",Er(this).val()),H()})),Er("#stroke_linejoin").change((function(){Gr.setStrokeAttr("stroke-linejoin",Er(this).val()),H()})),Er("select").change((function(){Er(this).blur()}));var we,Se,ke,Ce,Ae,Ee=!1;Er("#selLayerNames").change((function(){var e,t,n;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=this.options[this.selectedIndex].value,t=Mr.notification.QmoveElemsToLayer.replace("%s",e),n=function(t){t&&(Ee=!0,Gr.moveSelectedToLayer(e),Gr.clearSelection(),N())},!e){r.next=14;break}if(!Ee){r.next=8;break}n(!0),r.next=14;break;case 8:return r.next=10,regeneratorRuntime.awrap(Er.confirm(t));case 10:if(r.sent){r.next=13;break}return r.abrupt("return");case 13:n(!0);case 14:case"end":return r.stop()}}),null,this)})),Er("#font_family").change((function(){Gr.setFontFamily(this.value)})),Er("#seg_type").change((function(){Gr.setSegType(Er(this).val())})),Er("#text").bind("keyup input",(function(){Gr.setTextContent(this.value)})),Er("#image_url").change((function(){W(this.value)})),Er("#link_url").change((function(){this.value.length?Gr.setLinkURL(this.value):Gr.removeHyperlink()})),Er("#g_title").change((function(){Gr.setGroupTitle(this.value)})),Er(".attr_changer").change((function(){var e=this.getAttribute("data-attr"),t=this.value;if(!oe(e,t,U))return this.value=U.getAttribute(e),Er.alert(Mr.notification.invalidAttrValGiven),!1;if("id"!==e&&"class"!==e)if(isNaN(t))t=Gr.convertToNum(e,t);else if("px"!==Br.baseUnit){var n=te();(U[e]||"pathedit"===Gr.getMode()||"x"===e||"y"===e)&&(t*=n[Br.baseUnit])}if("id"===e){var r=U;Gr.clearSelection(),r.id=t,Gr.addToSelection([r],!0)}else Gr.changeSelectedAttribute(e,t);return this.blur(),!0})),Er("#palette").mouseover((function(){var e=Er('<input type="hidden">');Er(this).append(e),e.focus().remove()})),Er(".palette_item").mousedown((function(e){var t,n=e.shiftKey||2===e.button?"stroke":"fill",r=Er(this).data("rgb");"none"===r||"transparent"===r||"initial"===r?(r="none",t=new Er.jGraduate.Paint):t=new Er.jGraduate.Paint({alpha:100,solidColor:r.substr(1)}),b[n].setPaint(t),Gr.setColor(n,r),"none"!==r&&1!==Gr.getPaintOpacity(n)&&Gr.setPaintOpacity(n,1),$()})).bind("contextmenu",(function(e){e.preventDefault()})),Er("#toggle_stroke_tools").on("click",(function(){Er("#tools_bottom").toggleClass("expanded")})),we=y[0],Se=null,ke=null,Ce=!1,Ae=!1,Er("#svgcanvas").bind("mousemove mouseup",(function(e){return!1===Ce||(we.scrollLeft-=e.clientX-Se,we.scrollTop-=e.clientY-ke,Se=e.clientX,ke=e.clientY,"mouseup"===e.type&&(Ce=!1),!1)})).mousedown((function(e){return 1!==e.button&&!0!==Ae||(Ce=!0,Se=e.clientX,ke=e.clientY,!1)})),Er(window).mouseup((function(){Ce=!1})),Er(document).bind("keydown","space",(function(e){Gr.spaceKey=Ae=!0,e.preventDefault()})).bind("keyup","space",(function(e){e.preventDefault(),Gr.spaceKey=Ae=!1})).bind("keydown","shift",(function(e){"zoom"===Gr.getMode()&&y.css("cursor",k)})).bind("keyup","shift",(function(e){"zoom"===Gr.getMode()&&y.css("cursor",S)})),Ar.setPanning=function(e){Gr.spaceKey=Ae=e},function(){var e=Er("#main_icon"),t=Er("#main_icon span"),n=Er("#main_menu"),r=!1,a=0,i=!0,o=!1;Er(window).mouseup((function(t){r||(e.removeClass("buttondown"),"INPUT"!==t.target.tagName?n.fadeOut(200):o||(o=!0,Er(t.target).click((function(){n.css("margin-left","-9999px").show()})))),r=!1})).mousedown((function(e){Er(e.target).closest("div.tools_flyout, .contextMenu").length||Er(".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=Er("#main_menu li");s.mouseover((function(){i="rgba(0, 0, 0, 0)"===Er(this).css("background-color"),s.unbind("mouseover"),i&&s.mouseover((function(){this.style.backgroundColor="#FFC"})).mouseout((function(){return this.style.backgroundColor="transparent",!0}))}))}(),Ar.addDropDown=function(e,t,n){if(Er(e).length){var r=Er(e).find("button"),a=Er(e).find("ul").attr("id",Er(e)[0].id+"-list");n?Er(e).addClass("dropup"):Er("#option_lists").append(a),a.find("li").bind("mouseup",t);var i=!1;Er(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=Er(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}))}},Ar.addDropDown("#font_family_dropdown",(function(){Er("#font_family").val(Er(this).text()).change()})),Ar.addDropDown("#opacity_dropdown",(function(){if(!Er(this).find("div").length){var e=parseInt(Er(this).text().split("%")[0]);be(!1,e)}}),!0),Er("#opac_slider").slider({start:function(){Er("#opacity_dropdown li:not(.special)").hide()},stop:function(){Er("#opacity_dropdown li").show(),Er(window).mouseup()},slide:function(e,t){be(t)}}),Ar.addDropDown("#blur_dropdown",Er.noop);var Ge,Pe,Ie=!1;Er("#blur_slider").slider({max:10,step:.1,stop:function(e,t){Ie=!1,xe(t),Er("#blur_dropdown li").show(),Er(window).mouseup()},start:function(){Ie=!0},slide:function(e,t){xe(t,null,Ie)}}),Ar.addDropDown("#zoom_dropdown",(function(){var e=Er(this),t=e.data("val");t?se(window,t):le({value:parseFloat(e.text())})}),!0),ge("#stroke_linecap","#linecap_opts",(function(){z(this,!0)}),{dropUp:!0}),ge("#stroke_linejoin","#linejoin_opts",(function(){z(this,!0)}),{dropUp:!0}),ge("#tool_position","#position_opts",(function(){var e=this.id.replace("tool_pos","").charAt(0);Gr.alignSelectedElements(e,"page")}),{multiclick:!0}),Pe=function(){Er(Ge).blur()},Er("#svg_editor").find("button, select, input:not(#text)").focus((function(){Ge=this,C="toolbars",y.mousedown(Pe)})).blur((function(){C="canvas",y.unbind("mousedown",Pe),"textedit"===Gr.getMode()&&Er("#text").focus()}));var Ne,Te=function(){q("#tool_fhpath")&&Gr.setMode("fhpath")},Le=function(){q("#tool_line")&&Gr.setMode("line")},Me=function(){q("#tool_square")&&Gr.setMode("square")},Oe=function(){q("#tool_rect")&&Gr.setMode("rect")},je=function(){q("#tool_fhrect")&&Gr.setMode("fhrect")},Ve=function(){q("#tool_circle")&&Gr.setMode("circle")},Re=function(){q("#tool_ellipse")&&Gr.setMode("ellipse")},Be=function(){q("#tool_fhellipse")&&Gr.setMode("fhellipse")},De=function(){q("#tool_image")&&Gr.setMode("image")},Ue=function(){q("#tool_zoom")&&(Gr.setMode("zoom"),y.css("cursor",S))},Fe=function(e){var t=Gr.getResolution();e=e?t.zoom*e:1,Er("#zoom").val(100*e),Gr.setZoom(e),ie(),Z(!0)},He=function(){q("#tool_zoom")&&(Fe(),A())},ze=function(){q("#tool_text")&&Gr.setMode("text")},qe=function(){q("#tool_path")&&Gr.setMode("path")},Ye=function(){nn(U)&&!F||Gr.deleteSelectedElements()},We=function(){nn(U)&&!F||Gr.cutSelectedElements()},Xe=function(){nn(U)&&!F||Gr.copySelectedElements()},Qe=function(){var e=Gr.getZoom(),t=(y[0].scrollLeft+y.width()/2)/e-Gr.contentW,n=(y[0].scrollTop+y.height()/2)/e-Gr.contentH;Gr.pasteElements("point",t,n)},Ke=function(){nn(U)||Gr.moveToTopSelectedElement()},Ze=function(){nn(U)||Gr.moveToBottomSelectedElement()},$e=function(e){nn(U)||Gr.moveUpDownSelected(e)},Je=function(){nn(U)||Gr.convertToPath()},et=function(){nn(U)||m.reorient()},tt=function(){var e;return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:if(nn(U)&&!F){t.next=5;break}return t.next=3,regeneratorRuntime.awrap(Er.prompt(Mr.notification.enterNewLinkURL,"http://"));case 3:(e=t.sent)&&Gr.makeHyperlink(e);case 5:case"end":return t.stop()}}))},nt=function(e,t){if(!nn(U)||F){if(Br.gridSnapping){var n=Gr.getZoom()*Br.snappingStep;e*=n,t*=n}Gr.moveSelectedElements(e,t)}},rt=function(){Er("#tool_node_link").toggleClass("push_button_pressed tool_button");var e=Er("#tool_node_link").hasClass("push_button_pressed");m.linkControlPoints(e)},at=function(){m.getNodePoint()&&m.clonePathNode()},it=function(){m.getNodePoint()&&m.deletePathNode()},ot=function(){var e=Er("#tool_add_subpath"),t=!e.hasClass("push_button_pressed");e.toggleClass("push_button_pressed tool_button"),m.addSubPath(t)},st=function(){m.opencloseSubPath()},lt=function(){Gr.cycleElement(1)},ct=function(){Gr.cycleElement(0)},ut=function(e,t){if(!nn(U)&&!F){e||(t*=-1);var n=parseFloat(Er("#angle").val())+t;Gr.setRotationAngle(n),J()}},dt=function(){var e,t,n;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:return e=c(Br.dimensions,2),t=e[0],n=e[1],r.next=3,regeneratorRuntime.awrap(Er.confirm(Mr.notification.QwantToClear));case 3:if(r.sent){r.next=6;break}return r.abrupt("return");case 6:A(),Gr.clear(),Gr.setResolution(t,n),Z(!0),Fe(),N(),J(),ce(),Gr.runExtensions("onNewDocument");case 15:case"end":return r.stop()}}))},ht=function(){return Gr.setBold(!Gr.getBold()),J(),!1},pt=function(){return Gr.setItalic(!Gr.getItalic()),J(),!1},ft=function(){var e,t,n,r,a;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:return n=function(){var e,n,r=Mr.notification.loadingImage;if("new"===Br.exportWindowType&&Ar.exportWindowCt++,t=Br.canvasName+Ar.exportWindowCt,Ne)n=Ne;else{if(e='<!DOCTYPE html><html>\n <head>\n <meta charset="utf-8">\n <title>'.concat(r,"</title>\n </head>\n <body><h1>").concat(r,"</h1></body>\n <html>"),"undefined"!=typeof URL&&URL.createObjectURL){var a=new Blob([e],{type:"text/html"});n=URL.createObjectURL(a)}else n="data:text/html;base64;charset=utf-8,"+St(e);Ne=n}x=window.open(n,t)},i.next=3,regeneratorRuntime.awrap(Er.select("Select an image type for export: ",["PNG","JPEG","BMP","WEBP","PDF"],(function(){var e=Er(this);"JPEG"===e.val()||"WEBP"===e.val()?Er("#image-slider").length||Er("<div><label>".concat(Mr.ui.quality,'\n <input id="image-slider"\n type="range" min="1" max="100" value="92" />\n </label></div>')).appendTo(e.parent()):Er("#image-slider").parent().remove()})));case 3:if(e=i.sent){i.next=6;break}return i.abrupt("return");case 6:if(r=R(),"PDF"!==e){i.next=12;break}Vr||r||n(),Gr.exportPDF(t),i.next=16;break;case 12:return jr||n(),a=parseInt(Er("#image-slider").val())/100,i.next=16,regeneratorRuntime.awrap(Gr.rasterExport(e,a,t));case 16:case"end":return i.stop()}}))},gt=function(){Gr.open()},mt=function(){},vt=function(){v.getUndoStackSize()>0&&(v.undo(),N())},yt=function(){v.getRedoStackSize()>0&&(v.redo(),N())},_t=function(){F?Gr.groupSelectedElements():U&&Gr.ungroupSelectedElement()},bt=function(){Gr.cloneSelectedElements(20,20)},xt=function(){var e=this.id.replace("tool_align","").charAt(0);Gr.alignSelectedElements(e,Er("#align_relative_to").val())},wt=function(){if(Er("#tool_wireframe").toggleClass("push_button_pressed tool_button"),y.toggleClass("wireframe"),!Wt){var e=Er("#wireframe_rules");e.length?e.empty():Er('<style id="wireframe_rules"></style>').appendTo("head"),ee()}};Er("#svg_docprops_container, #svg_prefs_container").draggable({cancel:"button,fieldset",containment:"window"}).css("position","absolute");var kt,Ct,At=!1,Et=!1,Gt=function(){if(!At){At=!0,Er("#image_save_opts input").val([Er.pref("img_save")]);var e=Gr.getResolution();"px"!==Br.baseUnit&&(e.w=re(e.w)+Br.baseUnit,e.h=re(e.h)+Br.baseUnit),Er("#canvas_width").val(e.w),Er("#canvas_height").val(e.h),Er("#canvas_title").val(Gr.getDocumentTitle()),Er("#svg_docprops").show()}},It=function(){Er("#svg_source_editor").hide(),T=!1,Er("#svg_source_textarea").blur()},Nt=function(){var e;return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:if(T){t.next=2;break}return t.abrupt("return");case 2:if(e=function(){Gr.clearSelection(),It(),Fe(),N(),ae(),ce()},Gr.setSvgString(Er("#svg_source_textarea").val())){t.next=11;break}return t.next=6,regeneratorRuntime.awrap(Er.confirm(Mr.notification.QerrorsRevertToSource));case 6:if(t.sent){t.next=9;break}return t.abrupt("return");case 9:return e(),t.abrupt("return");case 11:e(),A();case 13:case"end":return t.stop()}}))},Tt=function(){Er("#svg_docprops").hide(),Er("#canvas_width,#canvas_height").removeAttr("disabled"),Er("#resolution")[0].selectedIndex=0,Er("#image_save_opts input").val([Er.pref("img_save")]),At=!1},Lt=function(){Er("#svg_prefs").hide(),Et=!1},Mt=function(){var e=Er("#canvas_title").val();ae(e),Gr.setDocumentTitle(e);var t=Er("#canvas_width"),n=t.val(),r=Er("#canvas_height"),a=r.val();return"fit"===n||oe("width",n)?(t.parent().removeClass("error"),"fit"===a||oe("height",a)?(r.parent().removeClass("error"),Gr.setResolution(n,a)?(Er.pref("img_save",Er("#image_save_opts :checked").val()),Z(),Tt(),!0):(Er.alert(Mr.notification.noContentToFitTo),!1)):(r.parent().addClass("error"),Er.alert(Mr.notification.invalidAttrValGiven),!1)):(t.parent().addClass("error"),Er.alert(Mr.notification.invalidAttrValGiven),!1)},Ot=Ar.savePreferences=function(){var t,n,r,a;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:if(X(Er("#bg_blocks div.cur_background").css("background-color")||"#FFF",Er("#canvas_bg_url").val()),(t=Er("#lang_select").val())===Er.pref("lang")){i.next=11;break}return i.next=6,regeneratorRuntime.awrap(Ar.putLocale(t,e,Br));case 6:return n=i.sent,r=n.langParam,a=n.langData,i.next=11,regeneratorRuntime.awrap(xn(r,a));case 11:d(Er("#iconsize").val()),Br.gridSnapping=Er("#grid_snapping_on")[0].checked,Br.snappingStep=Er("#grid_snapping_step").val(),Br.gridColor=Er("#grid_color").val(),Br.showRulers=Er("#show_rulers")[0].checked,Er("#rulers").toggle(Br.showRulers),Br.showRulers&&K(),Br.baseUnit=Er("#base_unit").val(),Gr.setConfig(Br),Z(),Lt();case 22:case"end":return i.stop()}}))},jt=Er.noop,Vt=function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:if(Er("#dialog_box").hide(),T||At||Et){e.next=4;break}return ne&&Gr.leaveContext(),e.abrupt("return");case 4:if(!T){e.next=15;break}if(L===Er("#svg_source_textarea").val()){e.next=12;break}return e.next=8,regeneratorRuntime.awrap(Er.confirm(Mr.notification.QignoreSourceChanges));case 8:e.sent&&It(),e.next=13;break;case 12:It();case 13:e.next=16;break;case 15:At?Tt():Et&&Lt();case 16:jt();case 17:case"end":return e.stop()}}))},Rt={width:Er(window).width(),height:Er(window).height()};if(V()&&(jt=function(){0===y[0].scrollLeft&&0===y[0].scrollTop&&(y[0].scrollLeft=f.left,y[0].scrollTop=f.top)},f={left:y[0].scrollLeft,top:y[0].scrollTop},Er(window).resize(jt),Ar.ready((function(){return new Promise((function(e,t){setTimeout((function(){jt(),e()}),500)}))})),y.scroll((function(){f={left:y[0].scrollLeft,top:y[0].scrollTop}}))),Er(window).resize((function(e){Er.each(Rt,(function(e,t){var n=Er(window)[e]();y[0]["scroll"+("width"===e?"Left":"Top")]-=(n-t)/2,Rt[e]=n})),s()})),y.scroll((function(){Er("#ruler_x").length&&(Er("#ruler_x")[0].scrollLeft=y[0].scrollLeft),Er("#ruler_y").length&&(Er("#ruler_y")[0].scrollTop=y[0].scrollTop)})),Er("#url_notice").click((function(){Er.alert(this.title)})),Er("#change_image_url").click(Q),kt="tool_button_current",Ct="",Er.each(["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],(function(e,t){Ct+=(e?",":"")+"#tool_"+t})),Er(Ct).mousedown((function(){Er(this).addClass(kt)})).bind("mousedown mouseout",(function(){Er(this).removeClass(kt)})),Er("#tool_undo, #tool_redo").mousedown((function(){Er(this).hasClass("disabled")||Er(this).addClass(kt)})).bind("mousedown mouseout",(function(){Er(this).removeClass(kt)})),B()&&!window.opera)for(var Bt=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"],Dt=Bt.length;Dt--;){var Ut=document.getElementById(Bt[Dt]);if(Ut){var Ft=Ut.title,Ht=Ft.indexOf("Ctrl+");Ut.title=[Ft.substr(0,Ht),"Cmd+",Ft.substr(Ht+5)].join("")}}var zt=function(e){var t="stroke_color"===e.attr("id")?"stroke":"fill",n="stroke"===t?Mr.ui.pick_stroke_paint_opacity:Mr.ui.pick_fill_paint_opacity,r=e.offset(),a=b[t].paint;Er("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(Br.colorPickerCSS||{left:r.left-140,bottom:40}).jGraduate({paint:a,window:{pickerTitle:n},images:{clientPath:Br.jGraduatePath},newstop:"inverse"},(function(e){a=new Er.jGraduate.Paint(e),b[t].setPaint(a),Gr.setPaint(t,a),Er("#color_picker").hide()}),(function(){Er("#color_picker").hide()}))},qt=function(){function e(n,r){t(this,e);var a=Br["fill"===r?"initFill":"initStroke"],i=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg">\n <rect width="16.5" height="16.5"\n fill="#'.concat(a.color,'" opacity="').concat(a.opacity,'"/>\n <defs><linearGradient id="gradbox_"/></defs>\n </svg>'),"text/xml").documentElement;(i=Er(n)[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 Er.jGraduate.Paint({solidColor:a.color}),this.type=r}return r(e,[{key:"setPaint",value:function(e,t){this.paint=e;var n=e.type,r=e.alpha/100,a="none";switch(n){case"solidColor":a="none"!==e[n]?"#"+e[n]:e[n];break;case"linearGradient":case"radialGradient":this.grad.remove(),this.grad=this.defs.appendChild(e[n]),a="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",a),this.rect.setAttribute("opacity",r),t&&(Gr.setColor(this.type,this._paintColor,!0),Gr.setPaintOpacity(this.type,this._paintOpacity,!0))}},{key:"update",value:function(e){if(U){var t=this.type;switch(U.tagName){case"use":case"image":case"foreignObject":return;case"g":case"a":for(var n=U.getElementsByTagName("*"),r=null,a=0,i=n.length;a<i;a++){var o=n[a].getAttribute(t);if(0===a)r=o;else if(r!==o){r=null;break}}if(null===r)return void(this._paintColor=null);this._paintColor=r,this._paintOpacity=1;break;default:this._paintOpacity=parseFloat(U.getAttribute(t+"-opacity")),isNaN(this._paintOpacity)&&(this._paintOpacity=1);var s="fill"===t?"black":"none";this._paintColor=U.getAttribute(t)||s}e&&(Gr.setColor(t,this._paintColor,!0),Gr.setPaintOpacity(t,this._paintOpacity,!0)),this._paintOpacity*=100;var l=function(e,t,n){var r={alpha:t};if(e.startsWith("url(#")){var a=Gr.getRefElem(e);r[(a=a?a.cloneNode(!0):Er("#"+n+"_color defs *")[0]).tagName]=a}else e.startsWith("#")?r.solidColor=e.substr(1):r.solidColor="none";return new Er.jGraduate.Paint(r)}(this._paintColor,this._paintOpacity,t);this.setPaint(l)}}},{key:"prep",value:function(){switch(this.paint.type){case"linearGradient":case"radialGradient":var e=new Er.jGraduate.Paint({copy:this.paint});Gr.setPaint(this.type,e)}}}]),e}();b.fill=new qt("#fill_color","fill"),b.stroke=new qt("#stroke_color","stroke"),Er("#stroke_width").val(Br.initStroke.width),Er("#group_opacity").val(100*Br.initOpacity);var Yt=b.fill.rect.cloneNode(!1);Yt.setAttribute("style","vector-effect:non-scaling-stroke");var Wt="non-scaling-stroke"===Yt.style.vectorEffect;Yt.removeAttribute("style");var Xt,Qt,Kt=b.fill.rect.ownerDocument.createElementNS(h.SVG,"feGaussianBlur");function Zt(){Gr.deleteCurrentLayer()&&(J(),N(),Er("#layerlist tr.layer").removeClass("layersel"),Er("#layerlist tr.layer:first").addClass("layersel"))}function $t(e){var t=Gr.getCurrentDrawing().getNumLayers(),n=Er("#layerlist tr.layersel").index();(n>0||n<t-1)&&(n+=e,Gr.setCurrentLayerPosition(t-n-1),N())}void 0===Kt.stdDeviationX&&Er("#tool_blur").hide(),Er(Kt).remove(),Xt="-"+l.toLowerCase()+"-zoom-",Qt=Xt+"in",y.css("cursor",Qt),y.css("cursor")===Qt&&(S=Qt,k=Xt+"out"),y.css("cursor","auto"),setTimeout((function(){Gr.embedImage("images/logo.png",(function(e){e||(Er("#image_save_opts [value=embed]").attr("disabled","disabled"),Er("#image_save_opts input").val(["ref"]),Er.pref("img_save","ref"),Er("#image_opt_embed").css("color","#666").attr("title",Mr.notification.featNotSupported))}))}),1e3),Er("#fill_color, #tool_fill .icon_label").click((function(){zt(Er("#fill_color")),$()})),Er("#stroke_color, #tool_stroke .icon_label").click((function(){zt(Er("#stroke_color")),$()})),Er("#group_opacityLabel").click((function(){Er("#opacity_dropdown button").mousedown(),Er(window).mouseup()})),Er("#zoomLabel").click((function(){Er("#zoom_dropdown button").mousedown(),Er(window).mouseup()})),Er("#tool_move_top").mousedown((function(e){Er("#tools_stacking").show(),e.preventDefault()})),Er(".layer_button").mousedown((function(){Er(this).addClass("layer_buttonpressed")})).mouseout((function(){Er(this).removeClass("layer_buttonpressed")})).mouseup((function(){Er(this).removeClass("layer_buttonpressed")})),Er(".push_button").mousedown((function(){Er(this).hasClass("disabled")||Er(this).addClass("push_button_pressed").removeClass("push_button")})).mouseout((function(){Er(this).removeClass("push_button_pressed").addClass("push_button")})).mouseup((function(){Er(this).removeClass("push_button_pressed").addClass("push_button")})),Er("#layer_new").click((function(){var e,t,n;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:t=Gr.getCurrentDrawing().getNumLayers();do{e=Mr.layers.layer+" "+ ++t}while(Gr.getCurrentDrawing().hasLayer(e));return r.next=4,regeneratorRuntime.awrap(Er.prompt(Mr.notification.enterUniqueLayerName,e));case 4:if(n=r.sent){r.next=7;break}return r.abrupt("return");case 7:if(!Gr.getCurrentDrawing().hasLayer(n)){r.next=10;break}return Er.alert(Mr.notification.dupeLayerName),r.abrupt("return");case 10:Gr.createLayer(n),J(),N();case 13:case"end":return r.stop()}}))})),Er("#layer_delete").click(Zt),Er("#layer_up").click((function(){$t(-1)})),Er("#layer_down").click((function(){$t(1)})),Er("#layer_rename").click((function(){var e,t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=Er("#layerlist tr.layersel td.layername").text(),n.next=3,regeneratorRuntime.awrap(Er.prompt(Mr.notification.enterNewLayerName,""));case 3:if(t=n.sent){n.next=6;break}return n.abrupt("return");case 6:if(e!==t&&!Gr.getCurrentDrawing().hasLayer(t)){n.next=9;break}return Er.alert(Mr.notification.layerHasThatName),n.abrupt("return");case 9:Gr.renameCurrentLayer(t),N();case 11:case"end":return n.stop()}}))}));var Jt=-1,en=!1,tn=!1,rn=function(e){var t=Er("#ruler_x");Er("#sidepanels").width("+="+e),Er("#layerpanel").width("+="+e),t.css("right",parseInt(t.css("right"))+e),y.css("right",parseInt(y.css("right"))+e),Gr.runExtensions("workareaResized")},on=function(e){if(tn&&-1!==Jt){en=!0;var t=Jt-e.pageX,n=Er("#sidepanels").width();n+t>300?t=300-n:n+t<2&&(t=2-n),0!==t&&(Jt-=t,rn(t))}},sn=function(e){var t=window.devicePixelRatio||1,n=Er("#sidepanels").width();rn(((t<1?n:n/t)>2||e?0:150*(t<1?1:t))-n)};Er("#sidepanel_handle").mousedown((function(e){Jt=e.pageX,Er(window).mousemove(on),tn=!1,setTimeout((function(){tn=!0}),20)})).mouseup((function(e){en||sn(),Jt=-1,en=!1})),Er(window).mouseup((function(){Jt=-1,en=!1,Er("#svg_editor").unbind("mousemove",on)})),N();Er(window).bind("load resize",(function(){y.css("line-height",y.height()+"px")})),Er("#resolution").change((function(){var e=Er("#canvas_width,#canvas_height");if(this.selectedIndex)if("content"===this.value)e.val("fit").attr("disabled","disabled");else{var t=this.value.split("x");Er("#canvas_width").val(t[0]),Er("#canvas_height").val(t[1]),e.removeAttr("disabled")}else"fit"===Er("#canvas_width").val()&&e.removeAttr("disabled").val(100)})),Er("input,select").attr("autocomplete","off");var cn,un,dn=["#tool_source_cancel","#tool_docprops_cancel","#tool_prefs_cancel",".overlay"],pn=(cn=[{sel:"#tool_select",fn:Y,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;T?Nt():(e={images:Er.pref("img_save"),round_digits:6},Gr.save(e))},evt:"mouseup",key:["S",!0]},{sel:"#tool_export",fn:ft,evt:"mouseup"},{sel:"#tool_open",fn:gt,evt:"mouseup",key:["O",!0]},{sel:"#tool_import",fn:mt,evt:"mouseup"},{sel:"#tool_source",fn:M,evt:"click",key:["U",!0]},{sel:"#tool_wireframe",fn:wt,evt:"click",key:["F",!0]},{key:["esc",!1,!1],fn:function(){dn.every((function(e){return Er(e+":hidden").length}))&&Gr.clearSelection()},hidekey:!0},{sel:dn.join(","),fn:Vt,evt:"click",key:["esc",!1,!1],hidekey:!0},{sel:"#tool_source_save",fn:Nt,evt:"click"},{sel:"#tool_docprops_save",fn:Mt,evt:"click"},{sel:"#tool_docprops",fn:Gt,evt:"mouseup"},{sel:"#tool_prefs_save",fn:Ot,evt:"click"},{sel:"#tool_prefs_option",fn:function(){return function(){if(!Et){Et=!0,Er("#main_menu").hide();var e=Rr.bkgd_color,t=Er.pref("bkgd_url");ye.each((function(){var t=Er(this),n=t.css("background-color")===e;t.toggleClass(_e,n),n&&Er("#canvas_bg_url").removeClass(_e)})),e||ye.eq(0).addClass(_e),t&&Er("#canvas_bg_url").val(t),Er("#grid_snapping_on").prop("checked",Br.gridSnapping),Er("#grid_snapping_step").attr("value",Br.snappingStep),Er("#grid_color").attr("value",Br.gridColor),Er("#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:vt,evt:"click"},{sel:"#tool_redo",fn:yt,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:bt,evt:"click",key:["D",!0]},{sel:"#tool_group_elements",fn:_t,evt:"click",key:["G",!0]},{sel:"#tool_ungroup",fn:_t,evt:"click"},{sel:"#tool_unlink_use",fn:_t,evt:"click"},{sel:"[id^=tool_align]",fn:xt,evt:"click"},{sel:"#tool_bold",fn:ht,evt:"mousedown"},{sel:"#tool_italic",fn:pt,evt:"mousedown"},{sel:"#sidepanel_handle",fn:sn,key:["X"]},{sel:"#copy_save_done",fn:Vt,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:[g+"up",!0],fn:function(){Fe(2)}},{key:[g+"down",!0],fn:function(){Fe(.5)}},{key:[g+"]",!0],fn:function(){$e("Up")}},{key:[g+"[",!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(){Gr.cloneSelectedElements(0,-1)}},{key:["alt+down",!0],fn:function(){Gr.cloneSelectedElements(0,1)}},{key:["alt+left",!0],fn:function(){Gr.cloneSelectedElements(-1,0)}},{key:["alt+right",!0],fn:function(){Gr.cloneSelectedElements(1,0)}},{key:["alt+shift+up",!0],fn:function(){Gr.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",!0],fn:function(){Gr.cloneSelectedElements(0,10)}},{key:["alt+shift+left",!0],fn:function(){Gr.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",!0],fn:function(){Gr.cloneSelectedElements(10,0)}},{key:"a",fn:function(){Gr.selectAllInCurrentLayer()}},{key:g+"a",fn:function(){Gr.selectAllInCurrentLayer()}},{key:g+"z",fn:vt},{key:g+"shift+z",fn:yt},{key:g+"y",fn:yt},{key:g+"x",fn:We},{key:g+"c",fn:Xe},{key:g+"v",fn:Qe}],un={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"},{setAll:function(){var e={};Er.each(cn,(function(t,n){var r;if(n.sel){if(!(r=Er(n.sel)).length)return!0;if(n.evt&&(D()&&"click"===n.evt&&(n.evt="mousedown"),r[n.evt](n.fn)),n.parent&&Er(n.parent+"_show").length){var a=Er(n.parent);a.length||(a=fe(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,o=!1;Array.isArray(n.key)?(i=n.key[0],n.key.length>1&&(o=n.key[1])):i=n.key,i=String(i);var s=n.fn;if(Er.each(i.split("/"),(function(e,t){Er(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)}}return!0})),pe(e),Er(".attr_changer, #image_url").bind("keydown","return",(function(e){Er(this).change(),e.preventDefault()})),Er(window).bind("keydown","tab",(function(e){"canvas"===C&&(e.preventDefault(),lt())})).bind("keydown","shift+tab",(function(e){"canvas"===C&&(e.preventDefault(),ct())})),Er("#tool_zoom").dblclick(He)},setTitles:function(){Er.each(un,(function(e,t){var n=Er(t).parents("#main_menu").length;Er(t).each((function(){var t;t=n?Er(this).text().split(" [")[0]:this.title.split(" [")[0];var r="";Er.each(e.split("/"),(function(e,t){var n=t.split("+"),a="";n.length>1&&(a=n[0]+"+",t=n[1]),r+=(e?"/":"")+a+(Mr["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}))}});Ar.ready((function(){var e=Br.initTool,t=Er("#tools_left, #svg_editor .tools_flyout"),n=t.find("#tool_"+e),r=t.find("#"+e);(n.length?n:r.length?r:Er("#tool_select")).click().mouseup(),Br.wireframe&&Er("#tool_wireframe").click(),Br.showlayers&&sn(),Er("#rulers").toggle(Boolean(Br.showRulers)),Br.showRulers&&(Er("#show_rulers")[0].checked=!0),Br.baseUnit&&Er("#base_unit").val(Br.baseUnit),Br.gridSnapping&&(Er("#grid_snapping_on")[0].checked=!0),Br.snappingStep&&Er("#grid_snapping_step").val(Br.snappingStep),Br.gridColor&&Er("#grid_color").val(Br.gridColor)})),Er("#rect_rx").SpinButton({min:0,max:1e3,stateObj:o,callback:function(e){Gr.setRectRadius(e.value)}}),Er("#stroke_width").SpinButton({min:0,max:99,smallStep:.1,stateObj:o,callback:function(e){var t=e.value;0===t&&U&&["line","polyline"].includes(U.nodeName)&&(t=e.value=1),Gr.setStrokeWidth(t)}}),Er("#angle").SpinButton({min:-180,max:180,step:5,stateObj:o,callback:function(e){Gr.setRotationAngle(e.value),Er("#tool_reorient").toggleClass("disabled",0===parseInt(e.value))}}),Er("#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:o,callback:function(e){Gr.setFontSize(e.value)}}),Er("#group_opacity").SpinButton({min:0,max:100,step:5,stateObj:o,callback:be}),Er("#blur").SpinButton({min:0,max:10,step:.1,stateObj:o,callback:xe}),Er("#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:o,callback:le}).val(100*Gr.getZoom()),Er("#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":Gr.pasteElements();break;case"paste_in_place":Gr.pasteElements("in_place");break;case"group":case"group_elements":Gr.groupSelectedElements();break;case"ungroup":Gr.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(an[e])&&function(e){return an[e].action}(e).call()}}));var gn=function(e,t,n){switch(e){case"dupe":!function(){var e,t;regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=Gr.getCurrentDrawing().getCurrentLayerName()+" copy",n.next=3,regeneratorRuntime.awrap(Er.prompt(Mr.notification.enterUniqueLayerName,e));case 3:if(t=n.sent){n.next=6;break}return n.abrupt("return");case 6:if(!Gr.getCurrentDrawing().hasLayer(t)){n.next=9;break}return Er.alert(Mr.notification.dupeLayerName),n.abrupt("return");case 9:Gr.cloneLayer(t),J(),N();case 12:case"end":return n.stop()}}))}();break;case"delete":Zt();break;case"merge_down":Er("#layerlist tr.layersel").index()!==Gr.getCurrentDrawing().getNumLayers()-1&&(Gr.mergeLayer(),J(),N());break;case"merge_all":Gr.mergeAllLayers(),J(),N()}};function mn(){var e;try{e=localStorage.getItem("svgedit_clipboard")}catch(e){}_[(e?"en":"dis")+"ableContextMenuItems"]("#paste,#paste_in_place")}if(Er("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},gn),Er("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:!0},gn),Er(".contextMenu li").mousedown((function(e){e.preventDefault()})),Er("#cmenu_canvas li").disableContextMenu(),_.enableContextMenuItems("#delete,#cut,#copy"),mn(),window.addEventListener("storage",(function(e){"svgedit_clipboard"===e.key&&mn()})),window.addEventListener("beforeunload",(function(e){return 0===v.getUndoStackSize()&&(Ar.showSaveWarning=!1),!(!Br.no_save_warning&&Ar.showSaveWarning)||(e.returnValue=Mr.notification.unsavedChanges,Mr.notification.unsavedChanges)})),Ar.canvas.getUIStrings=function(){return Mr},Ar.openPrep=function(){return Er("#main_menu").hide(),0===v.getUndoStackSize()||Er.confirm(Mr.notification.QwantToOpen)},window.FileReader){var vn=function(e){Er.process_cancel(Mr.notification.loadingImage),e.stopPropagation(),e.preventDefault(),Er("#workarea").removeAttr("style"),Er("#main_menu").hide();var t,n="drop"===e.type?e.dataTransfer.files[0]:this.files[0];n?n.type.includes("image")&&(n.type.includes("svg")?((t=new FileReader).onloadend=function(e){var t=Gr.importSvgString(e.target.result,!0);Gr.ungroupSelectedElement(),Gr.ungroupSelectedElement(),Gr.groupSelectedElements(),Gr.alignSelectedElements("m","page"),Gr.alignSelectedElements("c","page"),Gr.selectOnly([t]),Er("#dialog_box").hide()},t.readAsText(n)):((t=new FileReader).onloadend=function(e){var t=e.target.result,n=100,r=100,a=new Image;a.style.opacity=0,a.addEventListener("load",(function(){var e,i,o;n=a.offsetWidth||a.naturalWidth||a.width,r=a.offsetHeight||a.naturalHeight||a.height,e=n,i=r,o=Gr.addSVGElementFromJson({element:"image",attr:{x:0,y:0,width:e,height:i,id:Gr.getNextId(),style:"pointer-events:inherit"}}),Gr.setHref(o,t),Gr.selectOnly([o]),Gr.alignSelectedElements("m","page"),Gr.alignSelectedElements("c","page"),J(),Er("#dialog_box").hide()})),a.src=t},t.readAsDataURL(n))):Er("#dialog_box").hide()};y[0].addEventListener("dragenter",(function(e){e.stopPropagation(),e.preventDefault()})),y[0].addEventListener("dragover",(function(e){e.stopPropagation(),e.preventDefault()})),y[0].addEventListener("dragleave",(function(e){e.stopPropagation(),e.preventDefault()})),y[0].addEventListener("drop",vn);var yn=Er('<input type="file">').change((function(e){var t;return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,regeneratorRuntime.awrap(Ar.openPrep());case 2:if(e.sent){e.next=5;break}return e.abrupt("return");case 5:Gr.clear(),1===this.files.length&&(Er.process_cancel(Mr.notification.loadingImage),(t=new FileReader).onloadend=function(e){var t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:return t=e.target,n.next=3,regeneratorRuntime.awrap(Dr(t.result));case 3:Z();case 4:case"end":return n.stop()}}))},t.readAsText(this.files[0]));case 7:case"end":return e.stop()}}),null,this)}));Er("#tool_open").show().prepend(yn);var _n=Er('<input type="file">').change(vn);Er("#tool_import").show().prepend(_n)}Z(!0);var bn=[],xn=Ar.setLang=function(e,t){var n,r,a;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:if(Ar.langChanged=!0,Er.pref("lang",e),Er("#lang_select").val(e),t){i.next=5;break}return i.abrupt("return");case 5:if(document.documentElement.lang=t.lang,Er.extend(Mr,t),n=Er("#layerlist tr.layersel td.layername").text(),r=n===Mr.common.layer+" 1",Gr.setUiStrings(t),pn.setTitles(),r&&(Gr.renameCurrentLayer(Mr.common.layer+" 1"),N()),!me.length){i.next=18;break}return i.next=15,regeneratorRuntime.awrap(Promise.all(me.map((function(t){return bn.push(t.name),t.langReady({lang:e,uiStrings:Mr,importLocale:Ur({defaultLang:e,defaultName:t.name})})}))));case 15:me.length=0,i.next=19;break;case 18:bn.forEach((function(t){Gr.runExtension(t,"langReady",{lang:e,uiStrings:Mr,importLocale:Ur({defaultLang:e,defaultName:t})})}));case 19:Gr.runExtensions("langChanged",e),de(),a={"#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"},Er.each(a,(function(e,t){Er(t).attr("title",Er(e)[0].title)})),Er("#multiselected_panel div[id^=tool_align]").each((function(){Er("#tool_pos"+this.id.substr(10))[0].title=this.title}));case 24:case"end":return i.stop()}}))};!function(e){_r=e}({addLangData:function(e){return Gr.runExtensions("addLangData",(function(t){return{lang:e,importLocale:Ur({defaultLang:e,defaultName:t})}}),!0)},curConfig:Br}),"file:"===document.location.protocol?setTimeout(i,100):i()},Ar.ready=function(e){return new Promise((function(t,n){Or?t(e()):Ir.push([e,t,n])}))},Ar.runCallbacks=function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,regeneratorRuntime.awrap(Promise.all(Ir.map((function(e){return(0,c(e,1)[0])()}))));case 3:e.next=9;break;case 5:throw e.prev=5,e.t0=e.catch(0),Ir.forEach((function(e){(0,c(e,3)[2])()})),e.t0;case 9:Ir.forEach((function(e){(0,c(e,2)[1])()})),Or=!0;case 11:case"end":return e.stop()}}),null,null,[[0,5]])},Ar.loadFromString=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.noAlert;return Ar.ready((function(){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,regeneratorRuntime.awrap(Dr(e,{noAlert:n}));case 3:t.next=9;break;case 5:if(t.prev=5,t.t0=t.catch(0),!n){t.next=9;break}throw t.t0;case 9:case"end":return t.stop()}}),null,null,[[0,5]])}))},Ar.disableUI=function(e){},Ar.loadFromURL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.cache,r=t.noAlert;return Ar.ready((function(){return new Promise((function(t,a){Er.ajax({url:e,dataType:"text",cache:Boolean(n),beforeSend:function(){Er.process_cancel(Mr.notification.loadingImage)},success:function(e){t(Dr(e,{noAlert:r}))},error:function(e,n,i){404!==e.status&&e.responseText?t(Dr(e.responseText,{noAlert:r})):r?a(new Error("URLLoadFail")):(Er.alert(Mr.notification.URLLoadFail+": \n"+i),t())},complete:function(){Er("#dialog_box").hide()}})}))}))},Ar.loadFromDataURI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.noAlert;return Ar.ready((function(){var t=!1,r=e.match(/^data:image\/svg\+xml;base64,/);r?t=!0:r=e.match(/^data:image\/svg\+xml(?:;|;utf8)?,/),r&&(r=r[0]);var a=e.slice(r.length);return Dr(t?kt(a):decodeURIComponent(a),{noAlert:n})}))},Ar.addExtension=function(e,t,n){if(!Gr)throw new Error("Extension added too early");return Gr.addExtension.call(this,e,t,n)},Ar.ready((function(){on()}));var Fr=!1,Hr=[];window.addEventListener("message",(function(e){var t={data:e.data,origin:e.origin};Fr?Gr.call("message",t):Hr.push(t)})),regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,regeneratorRuntime.awrap(Promise.resolve());case 3:Ar.init(),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.error(e.t0);case 9:case"end":return e.stop()}}),null,null,[[0,6]]);export default Ar;
|
|
//# sourceMappingURL=index-es.min.js.map
|