143 lines
352 KiB
JavaScript
143 lines
352 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,n,r,a,i,o){try{var s=e[i](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(a,i){var o=e.apply(n,r);function s(e){t(o,a,i,s,l,"next",e)}function l(e){t(o,a,i,s,l,"throw",e)}s(void 0)}))}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 i(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}function o(){return(o=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 s(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&&c(e,t)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(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 d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return u(this,n)}}function h(e,t,n){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(r){var a=Object.getOwnPropertyDescriptor(r,t);return a.get?a.get.call(n):a.value}})(e,t,n||e)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(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)||g(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||g(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=g(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function y(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",y,!0),document.addEventListener("touchmove",y,!0),document.addEventListener("touchend",y,!0),document.addEventListener("touchcancel",y,!0);
|
|
/**
|
|
* Namespaces or tools therefor.
|
|
* @module namespaces
|
|
* @license MIT
|
|
*/
|
|
var _={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/"},b=function(){var e={};return Object.entries(_).forEach((function(t){var n=f(t,2),r=n[0],a=n[1];e[a]=r.toLowerCase()})),e};!function(){if(!("SVGPathSeg"in window)){var e=function(){function e(t,n,a){r(this,e),this.pathSegType=t,this.pathSegTypeAsLetter=n,this._owningPathSegList=a}return i(e,[{key:"_segmentChanged",value:function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)}}]),e}();e.prototype.classname="SVGPathSeg",e.PATHSEG_UNKNOWN=0,e.PATHSEG_CLOSEPATH=1,e.PATHSEG_MOVETO_ABS=2,e.PATHSEG_MOVETO_REL=3,e.PATHSEG_LINETO_ABS=4,e.PATHSEG_LINETO_REL=5,e.PATHSEG_CURVETO_CUBIC_ABS=6,e.PATHSEG_CURVETO_CUBIC_REL=7,e.PATHSEG_CURVETO_QUADRATIC_ABS=8,e.PATHSEG_CURVETO_QUADRATIC_REL=9,e.PATHSEG_ARC_ABS=10,e.PATHSEG_ARC_REL=11,e.PATHSEG_LINETO_HORIZONTAL_ABS=12,e.PATHSEG_LINETO_HORIZONTAL_REL=13,e.PATHSEG_LINETO_VERTICAL_ABS=14,e.PATHSEG_LINETO_VERTICAL_REL=15,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19;var t=function(t){s(a,t);var n=d(a);function a(t){return r(this,a),n.call(this,e.PATHSEG_CLOSEPATH,"z",t)}return i(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),n=function(t){s(a,t);var n=d(a);function a(t,i,o){var s;return r(this,a),(s=n.call(this,e.PATHSEG_MOVETO_ABS,"M",t))._x=i,s._y=o,s}return i(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(n.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var a=function(t){s(a,t);var n=d(a);function a(t,i,o){var s;return r(this,a),(s=n.call(this,e.PATHSEG_MOVETO_REL,"m",t))._x=i,s._y=o,s}return i(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(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 o=function(t){s(a,t);var n=d(a);function a(t,i,o){var s;return r(this,a),(s=n.call(this,e.PATHSEG_LINETO_ABS,"L",t))._x=i,s._y=o,s}return i(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(o.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var l=function(t){s(a,t);var n=d(a);function a(t,i,o){var s;return r(this,a),(s=n.call(this,e.PATHSEG_LINETO_REL,"l",t))._x=i,s._y=o,s}return i(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(l.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var c=function(t){s(a,t);var n=d(a);function a(t,i,o,s,l,c,u){var d;return r(this,a),(d=n.call(this,e.PATHSEG_CURVETO_CUBIC_ABS,"C",t))._x=i,d._y=o,d._x1=s,d._y1=l,d._x2=c,d._y2=u,d}return i(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(c.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var u=function(t){s(a,t);var n=d(a);function a(t,i,o,s,l,c,u){var d;return r(this,a),(d=n.call(this,e.PATHSEG_CURVETO_CUBIC_REL,"c",t))._x=i,d._y=o,d._x1=s,d._y1=l,d._x2=c,d._y2=u,d}return i(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(u.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var h=function(t){s(a,t);var n=d(a);function a(t,i,o,s,l){var c;return r(this,a),(c=n.call(this,e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t))._x=i,c._y=o,c._x1=s,c._y1=l,c}return i(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(h.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var f=function(t){s(a,t);var n=d(a);function a(t,i,o,s,l){var c;return r(this,a),(c=n.call(this,e.PATHSEG_CURVETO_QUADRATIC_REL,"q",t))._x=i,c._y=o,c._x1=s,c._y1=l,c}return i(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 p=function(t){s(a,t);var n=d(a);function a(t,i,o,s,l,c,u,d){var h;return r(this,a),(h=n.call(this,e.PATHSEG_ARC_ABS,"A",t))._x=i,h._y=o,h._r1=s,h._r2=l,h._angle=c,h._largeArcFlag=u,h._sweepFlag=d,h}return i(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(p.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var g=function(t){s(a,t);var n=d(a);function a(t,i,o,s,l,c,u,d){var h;return r(this,a),(h=n.call(this,e.PATHSEG_ARC_REL,"a",t))._x=i,h._y=o,h._r1=s,h._r2=l,h._angle=c,h._largeArcFlag=u,h._sweepFlag=d,h}return i(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(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(t){s(a,t);var n=d(a);function a(t,i){var o;return r(this,a),(o=n.call(this,e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t))._x=i,o}return i(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(m.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var v=function(t){s(a,t);var n=d(a);function a(t,i){var o;return r(this,a),(o=n.call(this,e.PATHSEG_LINETO_HORIZONTAL_REL,"h",t))._x=i,o}return i(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(v.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var y=function(t){s(a,t);var n=d(a);function a(t,i){var o;return r(this,a),(o=n.call(this,e.PATHSEG_LINETO_VERTICAL_ABS,"V",t))._y=i,o}return i(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(y.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var _=function(t){s(a,t);var n=d(a);function a(t,i){var o;return r(this,a),(o=n.call(this,e.PATHSEG_LINETO_VERTICAL_REL,"v",t))._y=i,o}return i(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(_.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var b=function(t){s(a,t);var n=d(a);function a(t,i,o,s,l){var c;return r(this,a),(c=n.call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t))._x=i,c._y=o,c._x2=s,c._y2=l,c}return i(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(b.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var x=function(t){s(a,t);var n=d(a);function a(t,i,o,s,l){var c;return r(this,a),(c=n.call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t))._x=i,c._y=o,c._x2=s,c._y2=l,c}return i(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(x.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var w=function(t){s(a,t);var n=d(a);function a(t,i,o){var s;return r(this,a),(s=n.call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t))._x=i,s._y=o,s}return i(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(w.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var S=function(t){s(a,t);var n=d(a);function a(t,i,o){var s;return r(this,a),(s=n.call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t))._x=i,s._y=o,s}return i(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(S.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}}),SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new t(void 0)},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(e,t){return new n(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(e,t){return new a(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new o(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new l(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,r,a,i){return new c(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,r,a,i){return new u(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,r){return new h(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(e,t,n,r){return new f(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(e,t,n,r,a,i,o){return new p(void 0,e,t,n,r,a,i,o)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,r,a,i,o){return new g(void 0,e,t,n,r,a,i,o)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(e){return new m(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(e){return new v(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new y(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new _(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,r){return new b(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,r){return new x(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new w(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new S(void 0,e,t)},"getPathSegAtLength"in SVGPathElement.prototype||(SVGPathElement.prototype.getPathSegAtLength=function(e){if(void 0===e||!isFinite(e))throw new Error("Invalid arguments.");var t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",this.getAttribute("d"));var n=t.pathSegList.numberOfItems-1;if(n<=0)return 0;do{if(t.pathSegList.removeItem(n),e>t.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=a,window.SVGPathSegLinetoAbs=o,window.SVGPathSegLinetoRel=l,window.SVGPathSegCurvetoCubicAbs=c,window.SVGPathSegCurvetoCubicRel=u,window.SVGPathSegCurvetoQuadraticAbs=h,window.SVGPathSegCurvetoQuadraticRel=f,window.SVGPathSegArcAbs=p,window.SVGPathSegArcRel=g,window.SVGPathSegLinetoHorizontalAbs=m,window.SVGPathSegLinetoHorizontalRel=v,window.SVGPathSegLinetoVerticalAbs=y,window.SVGPathSegLinetoVerticalRel=_,window.SVGPathSegCurvetoCubicSmoothAbs=b,window.SVGPathSegCurvetoCubicSmoothRel=x,window.SVGPathSegCurvetoQuadraticSmoothAbs=w,window.SVGPathSegCurvetoQuadraticSmoothRel=S}if(!("SVGPathSegList"in window)||!("appendItem"in window.SVGPathSegList.prototype)){var k=function(){function e(t){r(this,e),this._pathElement=t,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}return i(e,[{key:"_checkPathSynchronizedToList",value:function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())}},{key:"_updateListFromPathMutations",value:function(e){if(this._pathElement){var t=!1;e.forEach((function(e){"d"===e.attributeName&&(t=!0)})),t&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}}},{key:"_writeListToPath",value:function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",e._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}},{key:"segmentChanged",value:function(e){this._writeListToPath()}},{key:"clear",value:function(){this._checkPathSynchronizedToList(),this._list.forEach((function(e){e._owningPathSegList=null})),this._list=[],this._writeListToPath()}},{key:"initialize",value:function(e){return this._checkPathSynchronizedToList(),this._list=[e],e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_checkValidIndex",value:function(e){if(isNaN(e)||e<0||e>=this.numberOfItems)throw new Error("INDEX_SIZE_ERR")}},{key:"getItem",value:function(e){return this._checkPathSynchronizedToList(),this._checkValidIndex(e),this._list[e]}},{key:"insertItemBefore",value:function(e,t){return this._checkPathSynchronizedToList(),t>this.numberOfItems&&(t=this.numberOfItems),e._owningPathSegList&&(e=e.clone()),this._list.splice(t,0,e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"replaceItem",value:function(e,t){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._checkValidIndex(t),this._list[t]=e,e._owningPathSegList=this,this._writeListToPath(),e}},{key:"removeItem",value:function(e){this._checkPathSynchronizedToList(),this._checkValidIndex(e);var t=this._list[e];return this._list.splice(e,1),this._writeListToPath(),t}},{key:"appendItem",value:function(e){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._list.push(e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_parsePath",value:function(e){if(!e||!e.length)return[];var t=this,n=function(){function e(){r(this,e),this.pathSegList=[]}return i(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),a=function(){function e(t){r(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return i(e,[{key:"_isCurrentSpace",value:function(){var e=this._string[this._currentIndex];return e<=" "&&(" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e)}},{key:"_skipOptionalSpaces",value:function(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex++;return this._currentIndex<this._endIndex}},{key:"_skipOptionalSpacesOrDelimiter",value:function(){return!(this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&","!==this._string.charAt(this._currentIndex))&&(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&","===this._string.charAt(this._currentIndex)&&(this._currentIndex++,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)}},{key:"hasMoreData",value:function(){return this._currentIndex<this._endIndex}},{key:"peekSegmentType",value:function(){var e=this._string[this._currentIndex];return this._pathSegTypeFromChar(e)}},{key:"_pathSegTypeFromChar",value:function(e){switch(e){case"Z":case"z":return SVGPathSeg.PATHSEG_CLOSEPATH;case"M":return SVGPathSeg.PATHSEG_MOVETO_ABS;case"m":return SVGPathSeg.PATHSEG_MOVETO_REL;case"L":return SVGPathSeg.PATHSEG_LINETO_ABS;case"l":return SVGPathSeg.PATHSEG_LINETO_REL;case"C":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS;case"c":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL;case"Q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;case"q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;case"A":return SVGPathSeg.PATHSEG_ARC_ABS;case"a":return SVGPathSeg.PATHSEG_ARC_REL;case"H":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;case"h":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;case"V":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;case"v":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;case"S":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;case"s":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;case"T":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;case"t":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;default:return SVGPathSeg.PATHSEG_UNKNOWN}}},{key:"_nextCommandHelper",value:function(e,t){return("+"===e||"-"===e||"."===e||e>="0"&&e<="9")&&t!==SVGPathSeg.PATHSEG_CLOSEPATH?t===SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:t===SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:t:SVGPathSeg.PATHSEG_UNKNOWN}},{key:"initialCommandIsMoveTo",value:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===SVGPathSeg.PATHSEG_MOVETO_ABS||e===SVGPathSeg.PATHSEG_MOVETO_REL}},{key:"_parseNumber",value:function(){var e=0,t=0,n=1,r=0,a=1,i=1,o=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex<this._endIndex&&"+"===this._string.charAt(this._currentIndex)?this._currentIndex++:this._currentIndex<this._endIndex&&"-"===this._string.charAt(this._currentIndex)&&(this._currentIndex++,a=-1),!(this._currentIndex===this._endIndex||(this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")&&"."!==this._string.charAt(this._currentIndex))){for(var s=this._currentIndex;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==s)for(var l=this._currentIndex-1,c=1;l>=s;)t+=c*(this._string.charAt(l--)-"0"),c*=10;if(this._currentIndex<this._endIndex&&"."===this._string.charAt(this._currentIndex)){if(this._currentIndex++,this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)n*=10,r+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==o&&this._currentIndex+1<this._endIndex&&("e"===this._string.charAt(this._currentIndex)||"E"===this._string.charAt(this._currentIndex))&&"x"!==this._string.charAt(this._currentIndex+1)&&"m"!==this._string.charAt(this._currentIndex+1)){if(this._currentIndex++,"+"===this._string.charAt(this._currentIndex)?this._currentIndex++:"-"===this._string.charAt(this._currentIndex)&&(this._currentIndex++,i=-1),this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)e*=10,e+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var u=t+r;if(u*=a,e&&(u*=Math.pow(10,i*e)),o!==this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),u}}},{key:"_parseArcFlag",value:function(){if(!(this._currentIndex>=this._endIndex)){var e=!1,t=this._string.charAt(this._currentIndex++);if("0"===t)e=!1;else{if("1"!==t)return;e=!0}return this._skipOptionalSpacesOrDelimiter(),e}}},{key:"parseSegment",value:function(){var e=this._string[this._currentIndex],n=this._pathSegTypeFromChar(e);if(n===SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand===SVGPathSeg.PATHSEG_UNKNOWN)return null;if((n=this._nextCommandHelper(e,this._previousCommand))===SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=n,n){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(t);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,a.x,a.y,a.x1,a.y1,a.x2,a.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:var i={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(t,i.x,i.y,i.x2,i.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:var o={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,o.x,o.y,o.x2,o.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var s={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,s.x,s.y,s.x1,s.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:var l={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(t,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:var c={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(t,c.x,c.y,c.x1,c.y1,c.arcAngle,c.arcLarge,c.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:var u={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(t,u.x,u.y,u.x1,u.y1,u.arcAngle,u.arcLarge,u.arcSweep);default:throw new Error("Unknown path seg type.")}}}]),e}(),o=new n,s=new a(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}();k.prototype.classname="SVGPathSegList",Object.defineProperty(k.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 k(this)),this._pathSegList},enumerable:!0},normalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedNormalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0}}),window.SVGPathSegList=k}}();var x,w=jQuery,S=(Boolean(document.createElementNS&&document.createElementNS(_.SVG,"svg").createSVGRect),navigator.userAgent),k=document.createElementNS(_.SVG,"svg"),C=Boolean(window.opera),A=S.includes("AppleWebKit"),E=S.includes("Gecko/"),G=S.includes("MSIE"),N=S.includes("Chrome/"),P=(S.includes("Windows"),S.includes("Macintosh")),I="ontouchstart"in window,T=Boolean(k.querySelector),L=Boolean(document.evaluate),M=function(){var e=document.createElementNS(_.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}(),O=function(){var e=document.createElementNS(_.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}(),j=function(){var e=document.createElementNS(_.SVG,"svg"),t=document.createElementNS(_.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(_.SVG,"text");n.textContent="a",t.append(n);try{return 0===n.getStartPositionOfChar(0).x}catch(e){return!1}finally{e.remove()}}(),V=function(){var e=document.createElementNS(_.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(_.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}(),R=function(){var e=document.createElementNS(_.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(_.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(_.SVG,"path");n.setAttribute("d","M5,0 15,0");var r=document.createElementNS(_.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.width}(),B=(function(){var e=document.createElementNS(_.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");t||w.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.')}(),(x=document.createElementNS(_.SVG,"rect")).setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===x.style.vectorEffect),D=function(){var t=document.createElementNS(_.SVG,"rect").transform.baseVal,n=k.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}(),U=function(){return A},F=function(){return E},z=function(){return G},H=function(){return N},q=function(){return P},W=function(){return I},X=function(){return B};
|
|
/**
|
|
* A jQuery module to work with SVG attributes.
|
|
* @module jQueryAttr
|
|
* @license MIT
|
|
*/
|
|
function Y(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 c=t[l],u=o.getAttribute(c);(u||"0"===u)&&(u=isNaN(u)?u:u-0),s[c]=u}return s}if("object"!==e(t)){var d=o.getAttribute(t);return(d||"0"===d)&&(d=isNaN(d)?d:d-0),d}for(var h=0,p=Object.entries(t);h<p.length;h++){var g=f(p[h],2),m=g[0],v=g[1];o.setAttribute(m,v)}}return this},t}var Q=document.createElementNS(_.SVG,"svg");function K(e){var t=e.matrix,n="";switch(e.type){case 1:n="matrix("+[t.a,t.b,t.c,t.d,t.e,t.f].join(",")+")";break;case 2:n="translate("+t.e+","+t.f+")";break;case 3:n=t.a===t.d?"scale("+t.a+")":"scale("+t.a+","+t.d+")";break;case 4:var r=0,a=0;if(0!==e.angle){var i=1-t.a;a=(i*t.f+t.b*t.e)/(i*i+t.b*t.b),r=(t.e-t.b*a)/i}n="rotate("+e.angle+" "+r+","+a+")"}return n}var Z,$={},J=function(){function e(t){r(this,e),this._elem=t||null,this._xforms=[],this._update=function(){for(var e="",t=0;t<this.numberOfItems;++t){e+=K(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=Q.createSVGMatrix();Object.values(i).forEach((function(e,t){i[t]=Number.parseFloat(e),"matrix"===n&&(s[o[t]]=i[t])}));var l=Q.createSVGTransform(),c="set"+n.charAt(0).toUpperCase()+n.slice(1),u="matrix"===n?[s]:i;"scale"===n&&1===u.length?u.push(u[0]):"translate"===n&&1===u.length?u.push(0):"rotate"===n&&1===u.length&&u.push(0,0),l[c].apply(l,p(u)),e._list.appendItem(l)}()},this._removeFromOtherLists=function(e){e&&Object.values($).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 i(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}(),ee=function(e){e.id&&$[e.id]&&delete $[e.id]},te=function(e){if(!D){var t=e.id||"temp",n=$[t];return n&&"temp"!==t||($[t]=new J(e),$[t]._init(),n=$[t]),n}return e.transform?e.transform.baseVal:e.gradientTransform?e.gradientTransform.baseVal:e.patternTransform?e.patternTransform.baseVal:null},ne=["x","x1","cx","rx","width"],re=["y","y1","cy","ry","height"],ae=["r","radius"].concat(ne,re),ie={},oe=function(){return ie},se=function e(t){var n=Z.getRoundDigits();return isNaN(t)?Array.isArray(t)?e(t[0])+","+e(t[1]):Number.parseFloat(t).toFixed(n)-0:Number(Number(t).toFixed(n))},le=function(e,t){return t=t||Z.getBaseUnit(),se(e/ie[t])},ce=function(e,t,n){e.setAttribute(t,n)},ue=function(e,t){if(!isNaN(t))return t-0;if("%"===t.substr(-1)){var n=t.substr(0,t.length-1)/100,r=Z.getWidth(),a=Z.getHeight();return ne.includes(e)?n*r:re.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)*ie[i]},de=function(e,t,n){if(ae.includes(e))return!isNaN(t)||(t=t.toLowerCase(),Object.keys(ie).some((function(e){return new RegExp("^-?[\\d\\.]+"+e+"$").test(t)})));if("id"===e){var r=!1;try{var a=Z.getElement(t);r=!a||a===n}catch(e){}return r}return!0},he=document.createElementNS(_.SVG,"svg"),fe=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},pe=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},ge=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},me=function(e){if(!e)return!1;for(var t=e.numberOfItems;t--;){var n=e.getItem(t);if(1===n.type&&!pe(n.matrix))return!0}return!1},ve=function(e,t,n,r,a){var i=fe(e,t,a),o=fe(e+n,t,a),s=fe(e,t+r,a),l=fe(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}}},ye=function(e,t,n){if(!e)return he.createSVGTransformFromMatrix(he.createSVGMatrix());if(t=t||0,n=n||e.numberOfItems-1,(t=Number.parseInt(t))>(n=Number.parseInt(n))){var r=n;n=t,t=r}for(var a=he.createSVGMatrix(),i=t;i<=n;++i){var o=i>=0&&i<e.numberOfItems?e.getItem(i).matrix:he.createSVGMatrix();a=ge(a,o)}return he.createSVGTransformFromMatrix(a)},_e=function(e){var t=te(e);return ye(t).matrix},be=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}},xe=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},we=Y(jQuery),Se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ke="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use,clipPath".split(","),Ce=null,Ae=null,Ee=null,Ge=null,Ne=function(e){return e.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?]>)/,"$1$2")},Pe=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")};function Ie(e){if(e=Me(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;Number.isNaN(i)?(c=64,u=64):Number.isNaN(o)&&(u=64),t[r++]=Se.charAt(s),t[r++]=Se.charAt(l),t[r++]=Se.charAt(c),t[r++]=Se.charAt(u)}while(n<e.length);return t.join("")}function Te(e){if(window.atob)return Le(window.atob(e));e=e.replace(/[^A-Za-z\d+/=]/g,"");var t="",n=0;do{var r=Se.indexOf(e.charAt(n++)),a=Se.indexOf(e.charAt(n++)),i=Se.indexOf(e.charAt(n++)),o=Se.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 Le(t)}function Le(e){return decodeURIComponent(escape(e))}var Me=function(e){return unescape(encodeURIComponent(e))},Oe=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)},je=function(e){return e&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(e):""},Ve=function(){if("undefined"==typeof Blob)return"";var e=new Blob(["<html><head><title>SVG-edit</title></head><body> </body></html>"],{type:"text/html"});return je(e)}(),Re=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},Be=function e(t,n){if(t&&1===t.nodeType){n(t);for(var r=t.childNodes.length;r--;)e(t.childNodes.item(r),n)}},De=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},Ue=function(e){return e.getAttributeNS(_.XLINK,"href")},Fe=function(e,t){e.setAttributeNS(_.XLINK,"xlink:href",t)},ze=function(){var e=Ce.getSVGContent(),t=e.getElementsByTagNameNS(_.SVG,"defs");return t.length>0?t=t[0]:(t=e.ownerDocument.createElementNS(_.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.append(t)),t},He=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 f=o(h,c,u,d),p=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(p,2)-4*m*g;if(!(v<0)){var y=(-p+Math.sqrt(v))/(2*g);y>0&&y<1&&r[h].push(f(y));var _=(-p-Math.sqrt(v))/(2*g);_>0&&_<1&&r[h].push(f(_))}}else{if(0===p)continue;var b=-m/p;b>0&&b<1&&r[h].push(f(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 qe(e){if(R)try{return e.getBBox()}catch(e){}var t,n,r=we.data(e,"ref"),a=null;r?(n=we(r).children().clone().attr("visibility","hidden"),we(Ge).append(n),a=n.filter("line, path")):a=we(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:we(e).children();t=Je(o)}else t=e.getBBox();else t=e.getBBox();return r&&n.remove(),t}var We=function(e){var t=e||Ce.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":V?t.getBBox&&(a=t.getBBox()):a=He(t);break;case"g":case"a":a=qe(t);break;default:if("use"===r&&(a=qe(t)),"use"===r||"foreignObject"===r&&U()){if(a||(a=t.getBBox()),!U()){var i=a,o=i.x,s=i.y;a={width:i.width,height:i.height,x:o+Number.parseFloat(t.getAttribute("x")||0),y:s+Number.parseFloat(t.getAttribute("y")||0)}}}else if(ke.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=we(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},Xe=function(e){var t="";return we.each(e,(function(e,n){var r=f(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},Ye=function(e){var t,n,r,a,i=1.81;switch(e.tagName){case"ellipse":case"circle":var o=n=we(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=we(e).attr("r")),t=Xe([["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=we(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=we(e).attr(["rx","ry"]);r=u.rx,a=u.ry;var d=e.getBBox(),h=d.x,f=d.y,p=d.width,g=d.height;i=4-i,t=Xe(r||a?[["M",[h,f+a]],["C",[h,f+a/i,h+r/i,f,h+r,f]],["L",[h+p-r,f]],["C",[h+p-r/i,f,h+p,f+a/i,h+p,f+a]],["L",[h+p,f+g-a]],["C",[h+p,f+g-a/i,h+p-r/i,f+g,h+p-r,f+g]],["L",[h+r,f+g]],["C",[h+r/i,f+g,h,f+g-a/i,h,f+g-a]],["L",[h,f+a]],["Z",[]]]:[["M",[h,f]],["L",[h+p,f]],["L",[h+p,f+g]],["L",[h,f+g]],["L",[h,f]],["Z",[]]])}return t},Qe=function(e){var t={};return we.each(["marker-start","marker-end","marker-mid","filter","clip-path"],(function(){var n=e.getAttribute(this);n&&(t[this]=n)})),t},Ke=function(e,t,n){var r=t({element:"path",attr:Qe(e)}),a=e.getAttribute("transform");a&&r.setAttribute("transform",a);var i=e.parentNode;e.nextSibling?e.before(r):i.append(r);var o=Ye(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 Ze=function(e,t,n){var r=We(e);if(!r)return null;var a=te(e),i=nt(a),o=me(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=Ke(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(r=s=Ke(e,t,n))}}if(!s){var u=ye(a).matrix;r=ve(r.x,r.y,r.width,r.height,u).aabox}}return r};function $e(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var Je=function(e,t,n){if(!e||!e.length)return!1;var r;if(we.each(e,(function(){r||this.parentNode&&(r=Ze(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=$e(e[0]);o-=l,s-=l,a+=l,i+=l}else we.each(e,(function(e,r){var l=Ze(r,t,n);if(l){var c=$e(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},et=function(e){e||(e=we(Ce.getSVGContent()).children());var t=[];return we(e).children().each((function(e,n){n.getBBox&&t.push(n)})),t.reverse()},tt=function(e){return e||(e=et()),Je(e,Ce.addSVGElementFromJson,Ce.pathActions)},nt=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},rt=function(e,t){var n=e||Ce.getSelectedElements()[0],r=te(n);return nt(r,t)},at=function(e){return it(De(e).substr(1))},it=T?function(e){return Ge.querySelector("#"+e)}:L?function(e){return Ae.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+e+'"]',Ee,(function(){return _.SVG}),9,null).singleNodeValue}:function(e){return we(Ge).find("[id=".concat(e,"]"))[0]},ot=function(e,t,n,r){for(var a=0,i=Object.entries(t);a<i.length;a++){var o=f(i[a],2),s=o[0],l=o[1],c="xml:"===s.substr(0,4)?_.XML:"xlink:"===s.substr(0,6)?_.XLINK:null;ut(l)?c?e.removeAttributeNS(c,s):e.removeAttribute(s):c?e.setAttributeNS(c,s,l):r?ce(e,s,l):e.setAttribute(s,l)}},st=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=f(t,2),r=n[0],a=n[1];e.getAttribute(r)===String(a)&&e.removeAttribute(r)}))},lt=function(e){var t=Ce.getBaseUnit(),n=Ce.getSnappingStep();return"px"!==t&&(n*=oe()[t]),e=Math.round(e/n)*n},ct=function(e){we(e).click((function(e){e.preventDefault()}))},ut=function(e){return null==e},dt=jQuery,ht={},ft=function(){Object.values(ht).forEach((function(e){!function(e){Object.keys(ht).length||dt("#cmenu_canvas").append("<li class='separator'>");var t=e.shortcut||"";dt("#cmenu_canvas").append("<li class='disabled'><a href='#"+e.id+"'>"+e.label+"<span class='shortcut'>"+t+"</span></a></li>")}(e)}))};
|
|
/**
|
|
* Adapted from {@link https://github.com/uupaa/dynamic-import-polyfill/blob/master/importModule.js}.
|
|
* @module importModule
|
|
* @license MIT
|
|
*/
|
|
function pt(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}function gt(e,t){["id","class","type"].forEach((function(n){n in t&&(e[n]=t[n])}))}function mt(e,t){return vt(e,o({},t,{returnDefault:!0}))}function vt(e,t){return yt.apply(this,arguments)}function yt(){return(yt=n(regeneratorRuntime.mark((function e(t,n){var r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.global,a=n.returnDefault,!(!("svgEditor"in window)||!window.svgEditor||!1!==window.svgEditor.modules)){e.next=4;break}return e.abrupt("return",bt(t,void 0,{returnDefault:a}));case 4:return e.next=6,_t(t);case 6:return e.abrupt("return",window[r]);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _t(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?Promise.all(e.map((function(e){return _t(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",gt(a,t),a.addEventListener("error",i),a.addEventListener("load",o),a.src=e,document.head.append(a)}))}function bt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.returnDefault,a=void 0!==r&&r;return Array.isArray(e)?Promise.all(e.map((function(e){return bt(e,t)}))):new Promise((function(n,r){var i="$importModule$"+Math.random().toString(32).slice(2),o=document.createElement("script");function s(){r(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=""};gt(o,t),o.defer="defer",o.type="module",o.addEventListener("error",s),o.addEventListener("load",l);var u=pt(e),d="import * as m from '".concat(u.replace(/'/g,"\\'"),"'; window.").concat(i," = ").concat(a?"m.default || ":"","m;"),h=new Blob([d],{type:"text/javascript"});o.src=URL.createObjectURL(h),document.head.append(o)}))}var xt={true:!0,false:!1,null:null};function wt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.ok,a=void 0===r?"Ok":r,i=n.cancel,o=void 0===i?"Cancel":i;t("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");var s=t("#dialog_box"),l=t("#dialog_buttons"),c=t("#dialog_content");function u(n,r,i,u,d,h){c.html("<p>"+r.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt","prompt"===n),l.empty();var f=t('<input type="button" data-ok="" value="'+a+'">').appendTo(l);return new Promise((function(a,p){var g,m;if("alert"!==n&&t('<input type="button" value="'+o+'">').appendTo(l).click((function(){s.hide(),a(!1)})),"prompt"===n)(g=t('<input type="text">').prependTo(l)).val(i||""),g.bind("keydown","return",(function(){f.click()}));else if("select"===n){var v=t('<div style="text-align:center;">');if(g=t('<select aria-label="'.concat(r,'">')).appendTo(v),h){var y=t("<label>").text(h.label);(m=t('<input type="checkbox">').appendTo(y)).val(h.value),h.tooltip&&y.attr("title",h.tooltip),m.prop("checked",Boolean(h.checked)),v.append(t("<div>").append(y))}t.each(u||[],(function(n,r){"object"===e(r)?g.append(t("<option>").val(r.value).html(r.text)):g.append(t("<option>").html(r))})),c.append(v),i&&g.val(i),d&&g.bind("change","return",d),g.bind("keydown","return",(function(){f.click()}))}else"process"===n&&f.hide();s.show(),f.click((function(){s.hide();var e="prompt"!==n&&"select"!==n||g.val();a(m?{response:e,checked:m.prop("checked")}:e)})).focus(),"prompt"!==n&&"select"!==n||g.focus()}))}return t.alert=function(e){return u("alert",e)},t.confirm=function(e){return u("confirm",e)},t.process_cancel=function(e){return u("process",e)},t.prompt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return u("prompt",e,t)},t.select=function(e,t,n,r,a){return u("select",e,r,t,n,a)},t}var St,kt,Ct,At,Et,Gt={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"},Nt=function(){function e(){r(this,e)}return i(e,[{key:"getText",value:function(){return this.text}},{key:"apply",value:function(e,t){e&&e.handleHistoryEvent(Gt.BEFORE_APPLY,this),t(e),e&&e.handleHistoryEvent(Gt.AFTER_APPLY,this)}},{key:"unapply",value:function(e,t){e&&e.handleHistoryEvent(Gt.BEFORE_UNAPPLY,this),t(),e&&e.handleHistoryEvent(Gt.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}},{key:"type",value:function(){return this.constructor.name}}]),e}(),Pt=function(e){s(n,Nt);var t=d(n);function n(e,a,i,o){var s;return r(this,n),(s=t.call(this)).elem=e,s.text=o?"Move "+e.tagName+" to "+o:"Move "+e.tagName,s.oldNextSibling=a,s.oldParent=i,s.newNextSibling=e.nextSibling,s.newParent=e.parentNode,s}return i(n,[{key:"apply",value:function(e){var t=this;h(l(n.prototype),"apply",this).call(this,e,(function(){t.elem=t.newParent.insertBefore(t.elem,t.newNextSibling)}))}},{key:"unapply",value:function(e){var t=this;h(l(n.prototype),"unapply",this).call(this,e,(function(){t.elem=t.oldParent.insertBefore(t.elem,t.oldNextSibling)}))}}]),n}(),It=function(e){s(n,Nt);var t=d(n);function n(e,a){var i;return r(this,n),(i=t.call(this)).elem=e,i.text=a||"Create "+e.tagName,i.parent=e.parentNode,i.nextSibling=i.elem.nextSibling,i}return i(n,[{key:"apply",value:function(e){var t=this;h(l(n.prototype),"apply",this).call(this,e,(function(){t.elem=t.parent.insertBefore(t.elem,t.nextSibling)}))}},{key:"unapply",value:function(e){var t=this;h(l(n.prototype),"unapply",this).call(this,e,(function(){t.parent=t.elem.parentNode,t.elem.remove()}))}}]),n}(),Tt=function(e){s(n,Nt);var t=d(n);function n(e,a,i,o){var s;return r(this,n),(s=t.call(this)).elem=e,s.text=o||"Delete "+e.tagName,s.nextSibling=a,s.parent=i,ee(e),s}return i(n,[{key:"apply",value:function(e){var t=this;h(l(n.prototype),"apply",this).call(this,e,(function(){ee(t.elem),t.parent=t.elem.parentNode,t.elem.remove()}))}},{key:"unapply",value:function(e){var t=this;h(l(n.prototype),"unapply",this).call(this,e,(function(){ee(t.elem),ut(t.nextSibling)&&window.console&&console.error("Reference element was lost"),t.parent.insertBefore(t.elem,t.nextSibling)}))}}]),n}(),Lt=function(e){s(n,Nt);var t=d(n);function n(e,a,i){var o;for(var s in r(this,n),(o=t.call(this)).elem=e,o.text=i?"Change "+e.tagName+" "+i:"Change "+e.tagName,o.newValues={},o.oldValues=a,a)o.newValues[s]="#text"===s?e.textContent:"#href"===s?Ue(e):e.getAttribute(s);return o}return i(n,[{key:"apply",value:function(e){var t=this;h(l(n.prototype),"apply",this).call(this,e,(function(){var e=!1;if(Object.entries(t.newValues).forEach((function(n){var r=f(n,2),a=r[0],i=r[1];i?"#text"===a?t.elem.textContent=i:"#href"===a?Fe(t.elem,i):t.elem.setAttribute(a,i):"#text"===a?t.elem.textContent="":(t.elem.setAttribute(a,""),t.elem.removeAttribute(a)),"transform"===a&&(e=!0)})),!e){var n=rt(t.elem);if(n){var r=t.elem.getBBox(),a=["rotate(",n," ",r.x+r.width/2,",",r.y+r.height/2,")"].join("");a!==t.elem.getAttribute("transform")&&t.elem.setAttribute("transform",a)}}}))}},{key:"unapply",value:function(e){var t=this;h(l(n.prototype),"unapply",this).call(this,e,(function(){var e=!1;if(Object.entries(t.oldValues).forEach((function(n){var r=f(n,2),a=r[0],i=r[1];i?"#text"===a?t.elem.textContent=i:"#href"===a?Fe(t.elem,i):t.elem.setAttribute(a,i):"#text"===a?t.elem.textContent="":t.elem.removeAttribute(a),"transform"===a&&(e=!0)})),!e){var n=rt(t.elem);if(n){var r=t.elem.getBBox(),a=["rotate(",n," ",r.x+r.width/2,",",r.y+r.height/2,")"].join("");a!==t.elem.getAttribute("transform")&&t.elem.setAttribute("transform",a)}}ee(t.elem)}))}}]),n}(),Mt=function(e){s(n,Nt);var t=d(n);function n(e){var a;return r(this,n),(a=t.call(this)).text=e||"Batch Command",a.stack=[],a}return i(n,[{key:"apply",value:function(e){var t=this;h(l(n.prototype),"apply",this).call(this,e,(function(){t.stack.forEach((function(t){console.assert(t,"stack item should not be null"),t&&t.apply(e)}))}))}},{key:"unapply",value:function(e){var t=this;h(l(n.prototype),"unapply",this).call(this,e,(function(){t.stack.reverse().forEach((function(t){console.assert(t,"stack item should not be null"),t&&t.unapply(e)}))}))}},{key:"elements",value:function(){for(var e=[],t=this.stack.length;t--;)if(this.stack[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){console.assert(null!==e,"cmd should not be null"),this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),n}(),Ot=function(){function e(t){r(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return i(e,[{key:"resetUndoStack",value:function(){this.undoStack=[],this.undoStackPointer=0}},{key:"getUndoStackSize",value:function(){return this.undoStackPointer}},{key:"getRedoStackSize",value:function(){return this.undoStack.length-this.undoStackPointer}},{key:"getNextUndoCommandText",value:function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():""}},{key:"getNextRedoCommandText",value:function(){return this.undoStackPointer<this.undoStack.length?this.undoStack[this.undoStackPointer].getText():""}},{key:"undo",value:function(){this.undoStackPointer>0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}},{key:"redo",value:function(){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}},{key:"addCommandToHistory",value:function(e){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&(this.undoStack=this.undoStack.splice(0,this.undoStackPointer)),this.undoStack.push(e),this.undoStackPointer=this.undoStack.length}},{key:"beginUndoableChange",value:function(e,t){for(var n=++this.undoChangeStackPointer,r=t.length,a=new Array(r),i=new Array(r);r--;){var o=t[r];ut(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 Mt("Change "+n),a=t.elements.length;a--;){var i=t.elements[a];if(!ut(i)){var o={};o[n]=t.oldValues[a],o[n]!==i.getAttribute(n)&&r.addSubCommand(new Lt(i,o,n))}}return this.undoableChangeStack[e]=null,r}}]),e}(),jt=Object.freeze({__proto__:null,HistoryEventTypes:Gt,Command:Nt,MoveElementCommand:Pt,InsertElementCommand:It,RemoveElementCommand:Tt,ChangeElementCommand:Lt,BatchCommand:Mt,UndoManager:Ot}),Vt=jQuery,Rt={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"]},Bt={},Dt=function(e){Object.assign(Bt,e.ui)},Ut=[],Ft=!0,zt={},Ht=null,qt=null,Wt=function(e){qt=e,Ut=[0,"ClosePath"];Vt.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],(function(e,t){Ut.push(t+"Abs"),Ut.push(t+"Rel")}))},Xt=function(e,t,n){var r=e.pathSegList;if(O)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])}},Yt=function(e,t){return Rt[e].map((function(e){return t[e]}))},Qt=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=fe(r.x,r.y,n.matrix));var a=qt.getCurrentZoom();return r.x*=a,r.y*=a,r},Kt=function(e,t){var n={x:e.x,y:e.y};t.matrix&&(e=fe(n.x,n.y,t.imatrix),n.x=e.x,n.y=e.y);var r=qt.getCurrentZoom();return n.x/=r,n.y/=r,n},Zt=function(e,t,n){var r=$t(),a=it("pathpointgrip_"+e);if(!a){a=document.createElementNS(_.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 Bt&&(i["xlink:title"]=Bt.pathNodeTooltip),ot(a,i),a=r.appendChild(a),Vt("#pathpointgrip_"+e).dblclick((function(){Ht&&Ht.setSegType()}))}return t&&n&&ot(a,{cx:t,cy:n,display:"inline"}),a},$t=function(){var e=it("pathpointgrip_container");e||((e=it("selectorParentGroup").appendChild(document.createElementNS(_.SVG,"g"))).id="pathpointgrip_container");return e},Jt=function(e){var t=it("ctrlpointgrip_"+e);if(t)return t;t=document.createElementNS(_.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 Bt&&(n["xlink:title"]=Bt.pathCtrlPtTooltip),ot(t,n),$t().append(t),t},en=function(e){var t=it("ctrlLine_"+e);return t||(t=document.createElementNS(_.SVG,"line"),ot(t,{id:"ctrlLine_"+e,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),$t().append(t),t)},tn=function(e){var t=e.item,n=e.index;if(!("x1"in t)||!("x2"in t))return null;var r={};$t();for(var a=[Ht.segs[n-1].item,t],i=1;i<3;i++){var o=n+"c"+i,s=r["c"+i+"_line"]=en(o),l=Qt(e,{x:t["x"+i],y:t["y"+i]}),c=Qt(e,{x:a[i-1].x,y:a[i-1].y});ot(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]=Jt(o);ot(u,{cx:l.x,cy:l.y,display:"inline"}),r["c"+i]=u}return r},nn=function(e,t,n,r){var a=r||Ht.elem,i=a["createSVGPathSeg"+Ut[e]].apply(a,p(n));if(M)a.pathSegList.replaceItem(i,t);else{for(var o=a.pathSegList,s=o.numberOfItems,l=[],c=0;c<s;c++){var u=o.getItem(c);l.push(u)}o.clear();for(var d=0;d<s;d++)d===t?o.appendItem(i):o.appendItem(l[d])}},rn=function(e,t){var n=e.index,r=it("segline_"+n);if(!r){var a=$t();r=document.createElementNS(_.SVG,"path"),ot(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=Qt(i);nn(2,0,[o.x,o.y],r);for(var s=Yt(e.type,e.item),l=0;l<s.length;l+=2){var c=Qt(e,{x:s[l],y:s[l+1]});s[l]=c.x,s[l+1]=c.y}nn(e.type,1,s,r)}return r},an=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=qt.getSVGRoot().createSVGPoint(),u=qt.getSVGRoot().createSVGPoint(),d=Math.atan2(a,r),h=Math.atan2(o,i);d<0&&(d+=2*Math.PI),h<0&&(h+=2*Math.PI);var f,p,g=Math.abs(d-h),m=Math.abs(Math.PI-g)/2;return d-h>0?(f=g<Math.PI?d+m:d-m,p=g<Math.PI?h-m:h+m):(f=g<Math.PI?d-m:d+m,p=g<Math.PI?h+m:h-m),c.x=s*Math.cos(f)+n.x,c.y=s*Math.sin(f)+n.y,u.x=l*Math.cos(p)+n.x,u.y=l*Math.sin(p)+n.y,[c,u]}},on=function(){function e(t,n){r(this,e),this.selected=!1,this.index=t,this.item=n,this.type=n.pathSegType,this.ctrlpts=[],this.ptgrip=null,this.segsel=null}return i(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){Vt("#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=Zt(n);if(t){var a=Qt(e);ot(r,{cx:a.x,cy:a.y,display:"inline"})}return r}(this,!0),this.ctrlpts=tn(this),this.segsel=rn(this,!0)}},{key:"update",value:function(e){if(this.ptgrip){var t=Qt(this);ot(this.ptgrip,{cx:t.x,cy:t.y}),rn(this,!0),this.ctrlpts&&(e&&(this.item=Ht.elem.pathSegList.getItem(this.index),this.type=this.item.pathSegType),tn(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(nn(this.type,this.index,10===this.type?Yt(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];nn(this.next.type,this.next.index,i)}if(this.mate){var o=this.mate.item,s=[o.x+=e,o.y+=t];nn(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];nn(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];nn(this.type,this.index,a),this.update(!0)}},{key:"setType",value:function(e,t){nn(e,this.index,t),this.type=e,this.item=Ht.elem.pathSegList.getItem(this.index),this.showCtrlPts(6===e),this.ctrlpts=tn(this),this.update(!0)}}]),e}(),sn=function(){function e(t){if(r(this,e),!t||"path"!==t.tagName)throw new Error("svgedit.path.Path constructed without a <path> element");this.elem=t,this.segs=[],this.selected_pts=[],Ht=this,this.init()}return i(e,[{key:"init",value:function(){Vt($t()).find("*").each((function(){Vt(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 on(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(),ut(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,f=(t.item.y2+t.item.y)/2,p=(d+h)/2,g=(h+f)/2;a=(p+g)/2,n=this.elem.createSVGPathSegCurvetoCubicAbs(r,a,o,d,c,p);var m=[t.item.x,t.item.y,u,g,l,f];nn(t.type,e,m)}Xt(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];nn(2,r.index,a),nn(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];nn(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),Ft&&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,f=s-c;u=[o,s,l+h/3,c+f/3,o-h/3,s-f/3]}break;case 4:u=[o,s],a.olditem=a.item}a.setType(e,u)}}Ht.endChanges(t)}},{key:"selectPt",value:function(e,t){this.clearSelection(),ut(e)&&this.eachSeg((function(t){this.prev&&(e=t)})),this.addPtsToSelection(e),t&&(this.dragctrl=t,Ft&&this.segs[e].setLinked(t))}},{key:"update",value:function(){var e=this.elem;return rt(e)?(this.matrix=_e(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){U()&&qt.resetD(this.elem);var t=new Lt(this.elem,{d:this.last_d},e);qt.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]);qt.addPtsToSelection({grips:a,closedSubpath:s})}}],[{key:"subpathIsClosed",value:function(e){var t=!1;return Ht.eachSeg((function(n){return n<=e||2!==this.type&&(1!==this.type||(t=!0,!1))})),t}}]),e}(),ln=function(e){var t=zt[e.id];return t||(t=zt[e.id]=new sn(e)),t},cn=function(e){e in zt&&delete zt[e]},un=function(e,t){var n=e-Ct,r=t-At,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)+Et;return n=a*Math.cos(i)+Ct,r=a*Math.sin(i)+At,n-=St,r-=kt,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)-Et,{x:a*Math.cos(i)+St,y:a*Math.sin(i)+kt}},dn=function(){var e=Ht.elem;if(Et=rt(e,!0)){var t=Ht.oldbbox;Ct=t.x+t.width/2,At=t.y+t.height/2;var n=We(e);St=n.x+n.width/2,kt=n.y+n.height/2;var r=St-Ct,a=kt-At,i=Math.sqrt(r*r+a*a),o=Math.atan2(a,r)+Et;St=i*Math.cos(o)+Ct,kt=i*Math.sin(o)+At;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var c=s.getItem(l),u=c.pathSegType;if(1!==u){var d=un(c.x,c.y),h=[d.x,d.y];if(!ut(c.x1)&&!ut(c.x2)){var f=un(c.x1,c.y1),p=un(c.x2,c.y2);h.splice(h.length,0,f.x,f.y,p.x,p.y)}nn(u,l,h)}}We(e);var g=qt.getSVGRoot().createSVGTransform(),m=te(e);g.setRotate(180*Et/Math.PI,St,kt),m.replaceItem(g,0)}},hn=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],fn=function(e,t){for(var n=e.pathSegList,r=n.numberOfItems,a=0,i=0,o="",s=null,l=0;l<r;++l){var c=n.getItem(l),u=c.x||0,d=c.y||0,h=c.x1||0,f=c.y1||0,p=c.x2||0,g=c.y2||0,m=c.pathSegType,v=hn[m][t?"toLowerCase":"toUpperCase"]();switch(m){case 1:o+="z",s&&!t&&(a=s[0],i=s[1]);break;case 12:u-=a;case 13:t?(d=0,a+=u,v="l"):(d=i,a=u+=a,v="L"),o+=pn(v,[[u,d]]);break;case 14:d-=i;case 15:t?(u=0,i+=d,v="l"):(u=a,i=d+=i,v="L"),o+=pn(v,[[u,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+=pn(v,[[u,d]]);break;case 6:u-=a,h-=a,p-=a,d-=i,f-=i,g-=i;case 7:t?(a+=u,i+=d):(h+=a,p+=a,f+=i,g+=i,a=u+=a,i=d+=i),o+=pn(v,[[h,f],[p,g],[u,d]]);break;case 8:u-=a,h-=a,d-=i,f-=i;case 9:t?(a+=u,i+=d):(h+=a,f+=i,a=u+=a,i=d+=i),o+=pn(v,[[h,f],[u,d]]);break;case 10:u-=a,d-=i;case 11:t?(a+=u,i+=d):(a=u+=a,i=d+=i),o+=pn(v,[[c.r1,c.r2]],[c.angle,c.largeArcFlag?1:0,c.sweepFlag?1:0],[u,d]);break;case 16:u-=a,p-=a,d-=i,g-=i;case 17:t?(a+=u,i+=d):(p+=a,g+=i,a=u+=a,i=d+=i),o+=pn(v,[[p,g],[u,d]])}}return o};function pn(e,t,n,r){Vt.each(t,(function(e,n){t[e]=se(n)}));var a=e+t.join(" ");return n&&(a+=" "+n.join(" ")),r&&(a+=" "+se(r)),a}var gn,mn,vn,yn,_n,bn=(vn=!1,yn=null,_n=!1,{mouseDown:function(e,t,n,r){var a;if("path"!==qt.getCurrentMode()){if(Ht){var i;if(Ht.storeD(),"pathpointgrip_"===(a=e.target.id).substr(0,14)){i=Ht.cur_pt=Number.parseInt(a.substr(14)),Ht.dragging=[n,r];var o=Ht.segs[i];e.shiftKey?o.selected?Ht.removePtFromSelection(i):Ht.addPtsToSelection(i):((Ht.selected_pts.length<=1||!o.selected)&&Ht.clearSelection(),Ht.addPtsToSelection(i))}else if(a.startsWith("ctrlpointgrip_")){Ht.dragging=[n,r];var s=a.split("_")[1].split("c");i=Number(s[0]);var l=Number(s[1]);Ht.selectPt(i,l)}if(!Ht.dragging){var c=qt.getRubberBox();ut(c)&&(c=qt.setRubberBox(qt.selectorManager.getRubberBandBox())),u=qt.getCurrentZoom(),ot(c,{x:n*u,y:r*u,width:0,height:0,display:"inline"})}}}else{var u,d=n,h=r,f=d/(u=qt.getCurrentZoom()),p=h/u,g=it("path_stretch_line");gn=[f,p],qt.getGridSnapping()&&(f=lt(f),p=lt(p),d=lt(d),h=lt(h)),g||(g=document.createElementNS(_.SVG,"path"),ot(g,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}),g=it("selectorParentGroup").appendChild(g)),g.setAttribute("display","inline");var m,v=qt.getDrawnPath();if(v){for(var y=v.pathSegList,b=y.numberOfItems,x=6/u,w=!1;b;){b--;var S=y.getItem(b),k=S.x,C=S.y;if(f>=k-x&&f<=k+x&&p>=C-x&&p<=C+x){w=!0;break}}a=qt.getId(),cn(a);var A,E,G=it(a),N=y.numberOfItems;if(w){if(b<=1&&N>=2){var P=y.getItem(0).x,I=y.getItem(0).y;A=4===(E=g.pathSegList.getItem(1)).pathSegType?v.createSVGPathSegLinetoAbs(P,I):v.createSVGPathSegCurvetoCubicAbs(P,I,E.x1/u,E.y1/u,P,I);var T=v.createSVGPathSegClosePath();y.appendItem(A),y.appendItem(T)}else if(N<3)return!1;if(Vt(g).remove(),qt.setDrawnPath(null),qt.setStarted(!1),vn){Ht.matrix&&qt.remapElement(G,{},Ht.matrix.inverse());var L=G.getAttribute("d"),M=Vt(Ht.elem).attr("d");return Vt(Ht.elem).attr("d",M+L),Vt(G).remove(),Ht.matrix&&dn(),Wt(),bn.toEditMode(Ht.elem),Ht.selectPt(),!1}}else{if(!Vt.contains(qt.getContainer(),qt.getMouseTarget(e)))return!1;var O=v.pathSegList.numberOfItems,j=v.pathSegList.getItem(O-1),V=j.x,R=j.y;if(e.shiftKey){var B=be(V,R,f,p);f=B.x,p=B.y}A=4===(E=g.pathSegList.getItem(1)).pathSegType?v.createSVGPathSegLinetoAbs(qt.round(f),qt.round(p)):v.createSVGPathSegCurvetoCubicAbs(qt.round(f),qt.round(p),E.x1/u,E.y1/u,E.x2/u,E.y2/u),v.pathSegList.appendItem(A),f*=u,p*=u,g.setAttribute("d",["M",f,p,f,p].join(" ")),m=O,vn&&(m+=Ht.segs.length),Zt(m,f,p)}}else{var D="M"+f+","+p+" ";qt.setDrawnPath(qt.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:D,id:qt.getNextId(),opacity:qt.getOpacity()/2}})),g.setAttribute("d",["M",d,h,d,h].join(" ")),m=vn?Ht.segs.length:0,Zt(m,d,h)}}},mouseMove:function(e,t){var n=qt.getCurrentZoom();_n=!0;var r=qt.getDrawnPath();if("path"!==qt.getCurrentMode())if(Ht.dragging){var a=Kt({x:Ht.dragging[0],y:Ht.dragging[1]},Ht),i=Kt({x:e,y:t},Ht),o=i.x-a.x,s=i.y-a.y;Ht.dragging=[e,t],Ht.dragctrl?Ht.moveCtrl(o,s):Ht.movePts(o,s)}else Ht.selected_pts=[],Ht.eachSeg((function(e){if(this.next||this.prev){var t=qt.getRubberBox().getBBox(),n=Qt(this),r={x:n.x,y:n.y,width:0,height:0},a=xe(t,r);this.select(a),a&&Ht.selected_pts.push(this.index)}}));else{if(!r)return;var l=r.pathSegList,c=l.numberOfItems-1;if(gn){var u=Jt("1c1"),d=Jt("0c2");u.setAttribute("cx",e),u.setAttribute("cy",t),u.setAttribute("display","inline");var h=gn[0],f=gn[1],p=h+(h-e/n),g=f+(f-t/n);d.setAttribute("cx",p*n),d.setAttribute("cy",g*n),d.setAttribute("display","inline");var m=en(1);if(ot(m,{x1:e,y1:t,x2:p*n,y2:g*n,display:"inline"}),0===c)mn=[e,t];else{var v=l.getItem(c-1),y=v.x,_=v.y;6===v.pathSegType?(y+=y-v.x2,_+=_-v.y2):mn&&(y=mn[0]/n,_=mn[1]/n),nn(6,c,[h,f,y,_,p,g],r)}}else{var b=it("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);nn(6,1,[e,t,w*n,S*n,e,t],b)}else mn?nn(6,1,[e,t,mn[0],mn[1],e,t],b):nn(4,1,[e,t],b)}}}},mouseUp:function(e,t,n,r){var a=qt.getDrawnPath();if("path"===qt.getCurrentMode())return gn=null,a||(t=it(qt.getId()),qt.setStarted(!1),mn=null),{keep:!0,element:t};var i=qt.getRubberBox();if(Ht.dragging){var o=Ht.cur_pt;Ht.dragging=!1,Ht.dragctrl=!1,Ht.update(),_n&&Ht.endChanges("Move path point(s)"),e.shiftKey||_n||Ht.selectPt(o)}else i&&"none"!==i.getAttribute("display")?(i.setAttribute("display","none"),i.getAttribute("width")<=2&&i.getAttribute("height")<=2&&bn.toSelectMode(e.target)):bn.toSelectMode(e.target);_n=!1},toEditMode:function(e){Ht=ln(e),qt.setCurrentMode("pathedit"),qt.clearSelection(),Ht.show(!0).update(),Ht.oldbbox=We(Ht.elem),vn=!1},toSelectMode:function(e){var t=e===Ht.elem;qt.setCurrentMode("select"),Ht.show(!1),yn=!1,qt.clearSelection(),Ht.matrix&&dn(),t&&(qt.call("selected",[e]),qt.addToSelection([e],!0))},addSubPath:function(e){e?(qt.setCurrentMode("path"),vn=!0):(bn.clear(!0),bn.toEditMode(Ht.elem))},select:function(e){yn===e?(bn.toEditMode(e),qt.setCurrentMode("pathedit")):yn=e},reorient:function(){var e=qt.getSelectedElements()[0];if(e&&0!==rt(e)){var t=new Mt("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new Lt(e,n)),qt.clearSelection(),this.resetOrientation(e),qt.addCommandToHistory(t),ln(e).show(!1).matrix=null,this.clear(),qt.addToSelection([e],!0),qt.call("changed",qt.getSelectedElements())}},clear:function(e){var t=qt.getDrawnPath();if(yn=null,t){var n=it(qt.getId());Vt(it("path_stretch_line")).remove(),Vt(n).remove(),Vt(it("pathpointgrip_container")).find("*").attr("display","none"),mn=null,qt.setDrawnPath(null),qt.setStarted(!1)}else"pathedit"===qt.getCurrentMode()&&this.toSelectMode();Ht&&Ht.init().show(!1)},resetOrientation:function(e){if(ut(e)||"path"!==e.nodeName)return!1;var t=te(e),n=ye(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=[];Vt.each(["",1,2],(function(e,t){var r=a["x"+t],i=a["y"+t];if(void 0!==r&&void 0!==i){var s=fe(r,i,n);o.splice(o.length,0,s.x,s.y)}})),nn(i,t,o,e)},o=0;o<a;++o)i(o);!function(e,t){for(var n=We(e),r=0;r<2;r++){var a=0===r?"fill":"stroke",i=e.getAttribute(a);if(i&&i.startsWith("url(")){var o=at(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=fe(s,l,t),h=fe(c,u,t),f={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},p=o.cloneNode(!0);Vt(p).attr(f),p.id=qt.getNextId(),ze().append(p),e.setAttribute(a,"url(#"+p.id+")")}}}}(e,n)},zoomChange:function(){"pathedit"===qt.getCurrentMode()&&Ht.update()},getNodePoint:function(){var e=Ht.selected_pts.length?Ht.selected_pts[0]:1,t=Ht.segs[e];return{x:t.item.x,y:t.item.y,type:t.type}},linkControlPoints:function(e){Ft=e},clonePathNode:function(){Ht.storeD();for(var e=Ht.selected_pts,t=e.length,n=[];t--;){var r=e[t];Ht.addSeg(r),n.push(r+t),n.push(r+t+1)}Ht.init().addPtsToSelection(n),Ht.endChanges("Clone path node(s)")},opencloseSubPath:function(){var e=Ht.selected_pts;if(1===e.length){var t,n,r=Ht.elem,a=r.pathSegList,i=e[0],o=null,s=null;if(Ht.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))})),ut(o)&&(o=Ht.segs.length-1),!1!==o){var l=r.createSVGPathSegLinetoAbs(s.x,s.y),c=r.createSVGPathSegClosePath();return o===Ht.segs.length-1?(a.appendItem(l),a.appendItem(c)):(Xt(r,c,o),Xt(r,l,o)),void Ht.init().selectPt(o+1)}if(Ht.segs[i].mate)return a.removeItem(i),a.removeItem(i),void Ht.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--;)Xt(r,a.getItem(t),n);var f=a.getItem(t);nn(2,t,[f.x,f.y]),Ht.init().selectPt(0)}},deletePathNode:function(){if(bn.canDeleteNodes){Ht.storeD();for(var e=Ht.selected_pts,t=e.length;t--;){var n=e[t];Ht.deleteSeg(n)}if(function e(){var t=Ht.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}(),Ht.elem.pathSegList.numberOfItems<=1)return bn.toSelectMode(Ht.elem),void qt.canvas.deleteSelectedElements();if(Ht.init(),Ht.clearSelection(),window.opera){var r=Vt(Ht.elem);r.attr("d",r.attr("d"))}Ht.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=an(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=qt.addSVGElementFromJson({element:"path",curStyles:!0,attr:{id:qt.getId(),d:o,fill:"none"}})}return e},setSegType:function(e){Ht.setSegType(e)},moveNode:function(e,t){var n=Ht.selected_pts;if(n.length){Ht.storeD();var r=Ht.segs[n[0]],a={x:0,y:0};a[e]=t-r.item[e],r.move(a.x,a.y),Ht.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);Xt(e,s,a),bn.fixEnd(e);break}}}U()&&qt.resetD(e)},convertPath:fn}),xn=jQuery,wn=function(){function e(t,n,a){if(r(this,e),this.name_=t,this.group_=a?null:n,a){var i=a.ownerDocument;this.group_=i.createElementNS(_.SVG,"g");var o=i.createElementNS(_.SVG,"title");o.textContent=t,this.group_.append(o),n?xn(n).after(this.group_):a.append(this.group_)}Sn(this.group_),Be(this.group_,(function(e){e.setAttribute("style","pointer-events:inherit")})),this.group_.setAttribute("style",a?"pointer-events:all":"pointer-events:none")}return i(e,[{key:"getName",value:function(){return this.name_}},{key:"getGroup",value:function(){return this.group_}},{key:"activate",value:function(){this.group_.setAttribute("style","pointer-events:all")}},{key:"deactivate",value:function(){this.group_.setAttribute("style","pointer-events:none")}},{key:"setVisible",value:function(e){var t=void 0===e||e?"inline":"none";this.group_.getAttribute("display")!==t&&this.group_.setAttribute("display",t)}},{key:"isVisible",value:function(){return"none"!==this.group_.getAttribute("display")}},{key:"getOpacity",value:function(){var e=this.group_.getAttribute("opacity");return ut(e)?1:Number.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,n=v(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.group_.append(r)}}catch(e){n.e(e)}finally{n.f()}}},{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=Pe(e);var r=this.getTitleElement();return r?(xn(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_;return this.group_.remove(),this.group_=void 0,e}}]),e}();function Sn(e){var t=e.getAttribute("class");ut(t)||!t.length?e.setAttribute("class",wn.CLASS_NAME):wn.CLASS_REGEX.test(t)||e.setAttribute("class",t+" "+wn.CLASS_NAME)}wn.CLASS_NAME="layer",wn.CLASS_REGEX=new RegExp("(\\s|^)"+wn.CLASS_NAME+"(\\s|$)");var kn=function(){function e(t){r(this,e),this.undoManager_=t,this.currentBatchCommand_=null,this.batchCommandStack_=[]}return i(e,[{key:"startBatchCommand",value:function(e){return this.undoManager_?(this.currentBatchCommand_=new Mt(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 Pt(e,t,n,r)),this):this}},{key:"insertElement",value:function(e,t){return this.undoManager_?(this.addCommand_(new It(e,t)),this):this}},{key:"removeElement",value:function(e,t,n,r){return this.undoManager_?(this.addCommand_(new Tt(e,t,n,r)),this):this}},{key:"changeElement",value:function(e,t,n){return this.undoManager_?(this.addCommand_(new Lt(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}();kn.NO_HISTORY=new kn;var Cn=Y(jQuery),An=jQuery,En="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),Gn=1,Nn=2,Pn=0,In=[];function Tn(e){return e||new kn(On.undoMgr)}function Ln(e){return An("title",e).text()||(C&&e.querySelectorAll?An(e.querySelectorAll("title")).text():"")}function Mn(e){for(var t=1;e.includes("Layer "+t);)t++;return"Layer "+t}var On,jn=function(){function e(t,n){if(r(this,e),!t||!t.tagName||!t.namespaceURI||"svg"!==t.tagName||t.namespaceURI!==_.SVG)throw new Error("Error: svgedit.draw.Drawing instance initialized without a <svg> element");this.svgElem_=t,this.obj_num=0,this.idPrefix=n||"svg_",this.releasedNums=[],this.all_layers=[],this.layer_map={},this.current_layer=null,this.nonce_="";var a=this.svgElem_.getAttributeNS(_.SE,"nonce");a&&Pn!==Nn?this.nonce_=a:Pn===Gn&&this.setNonce(Math.floor(100001*Math.random()))}return i(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):An(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(_.XMLNS,"xmlns:se",_.SE),this.svgElem_.setAttributeNS(_.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=Number.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=An(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=this.svgElem_.childNodes.length,t=[],n=[],r=null,a=!1,i=0;i<e;++i){var o=this.svgElem_.childNodes.item(i);if(o&&1===o.nodeType)if("g"===o.tagName){a=!0;var s=Ln(o);s?(n.push(s),r=new wn(s,o),this.all_layers.push(r),this.layer_map[s]=r):t.push(o)}else En.includes(o.nodeName)&&t.push(o)}t.length>0||!a?((r=new wn(Mn(n),null,this.svgElem_)).appendChildren(t),this.all_layers.push(r),this.layer_map[name]=r):r.activate(),this.current_layer=r}},{key:"createLayer",value:function(e,t){this.current_layer&&this.current_layer.deactivate(),(null==e||""===e||this.layer_map[e])&&(e=Mn(Object.keys(this.layer_map)));var n=new wn(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=Mn(Object.keys(this.layer_map)));var r=this.current_layer.getGroup(),a=new wn(e,r,this.svgElem_),i=a.getGroup();p(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(Cn.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(),U()&&"path"===t.nodeName){var a=fn(t);r.setAttribute("d",a)}if(Cn.each(t.childNodes,(function(t,a){switch(a.nodeType){case 1:r.append(e(a,n));break;case 3:r.textContent=a.nodeValue}})),Cn(t).data("gsvg"))Cn(r).data("gsvg",r.firstChild);else if(Cn(t).data("symbol")){var i=Cn(t).data("symbol");Cn(r).data("ref",i).data("symbol",i)}else"image"===r.tagName&&ct(r);return r}(e,(function(){return t.getNextId()}))}}]),e}(),Vn=function(e,t){(Pn=!1===e?Nn:Gn)!==Gn||t.getNonce()?Pn===Nn&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},Rn=function(){Qn(),On.getCurrentDrawing().identifyLayers()},Bn=function(e,t){var n=On.getCurrentDrawing().createLayer(e,Tn(t));On.clearSelection(),On.call("changed",[n])},Dn=function(e,t){var n=On.getCurrentDrawing().cloneLayer(e,Tn(t));On.clearSelection(),Qn(),On.call("changed",[n])},Un=function(){var e=On.getCurrentDrawing().getCurrentLayer(),t=e.nextSibling,n=e.parentNode;if(e=On.getCurrentDrawing().deleteCurrentLayer()){var r=new Mt("Delete Layer");return r.addSubCommand(new Tt(e,t,n)),On.addCommandToHistory(r),On.clearSelection(),On.call("changed",[n]),!0}return!1},Fn=function(e){var t=On.getCurrentDrawing().setCurrentLayer(Pe(e));return t&&On.clearSelection(),t},zn=function(e){var t=On.getCurrentDrawing(),n=t.getCurrentLayer();if(n&&t.setCurrentLayerName(e,Tn()))return On.call("changed",[n]),!0;return!1},Hn=function(e){var t=On.getCurrentDrawing().setCurrentLayerPosition(e);return!!t&&(On.addCommandToHistory(new Pt(t.currentGroup,t.oldNextSibling,On.getSVGContent())),!0)},qn=function(e,t){var n=On.getCurrentDrawing(),r=n.getLayerVisibility(e),a=n.setLayerVisibility(e,t);if(!a)return!1;var i=r?"inline":"none";return On.addCommandToHistory(new Lt(a,{display:i},"Layer Visibility")),a===n.getCurrentLayer()&&(On.clearSelection(),On.pathActions.clear()),!0},Wn=function(e){var t=On.getCurrentDrawing().getLayerByName(e);if(!t)return!1;for(var n=new Mt("Move Elements to Layer"),r=On.getSelectedElements(),a=r.length;a--;){var i=r[a];if(i){var o=i.nextSibling,s=i.parentNode;t.append(i),n.addSubCommand(new Pt(i,o,s))}}return On.addCommandToHistory(n),!0},Xn=function(e){On.getCurrentDrawing().mergeLayer(Tn(e)),On.clearSelection(),Qn(),On.changeSVGContent()},Yn=function(e){On.getCurrentDrawing().mergeAllLayers(Tn(e)),On.clearSelection(),Qn(),On.changeSVGContent()},Qn=function(){var e=In.length;if(e){for(var t=0;t<e;t++){var n=In[t],r=On.elData(n,"orig_opac");1!==r?n.setAttribute("opacity",r):n.removeAttribute("opacity"),n.setAttribute("style","pointer-events: inherit")}In=[],On.clearSelection(!0),On.call("contextset",null)}On.setCurrentGroup(null)},Kn=function(e){Qn(),"string"==typeof e&&(e=it(e)),On.setCurrentGroup(e),An(e).parentsUntil("#svgcontent").andSelf().siblings().each((function(){var e=this.getAttribute("opacity")||1;On.elData(this,"orig_opac",e),this.setAttribute("opacity",.33*e),this.setAttribute("style","pointer-events: none"),In.push(this)})),On.clearSelection(),On.call("contextset",On.getCurrentGroup())},Zn=b(),$n={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:[]},Jn={};Object.entries($n).forEach((function(e){var t=f(e,2),n=t[0],r=t[1],a={};Object.entries(r).forEach((function(e){var t=f(e,2),n=(t[0],t[1]);if(n.includes(":")){var r=n.split(":");a[r[1]]=_[r[0].toUpperCase()]}else a[n]="xmlns"===n?_.XMLNS:null})),Jn[n]=a}));var er,tr,nr,rr,ar=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=$n[t.nodeName],i=Jn[t.nodeName];if(void 0!==a){for(var o=[],s=t.attributes.length;s--;){var l=t.attributes.item(s),c=l.nodeName,u=l.localName,d=l.namespaceURI;if({}.hasOwnProperty.call(i,u)&&d===i[u]&&d!==_.XMLNS||d===_.XMLNS&&Zn[l.value]||((c.startsWith("se:")||c.startsWith("data-"))&&o.push([c,l.value]),t.removeAttributeNS(d,u)),F())switch(c){case"transform":case"gradientTransform":case"patternTransform":var h=l.value.replace(/(\d)-/g,"$1 -");t.setAttribute(c,h)}if("style"===c){for(var p=l.value.split(";"),g=p.length;g--;){var m=f(p[g].split(":"),2),v=m[0],y=m[1],b=(v||"").trim(),x=(y||"").trim();a.includes(b)&&t.setAttribute(b,x)}t.removeAttribute("style")}}Object.values(o).forEach((function(e){var n=f(e,2),r=n[0],a=n[1];t.setAttributeNS(_.SE,r,a)}));var w=Ue(t);if(w&&["filter","linearGradient","pattern","radialGradient","textPath","use"].includes(t.nodeName)&&"#"!==w[0]&&(Fe(t,""),t.removeAttributeNS(_.XLINK,"href")),"use"===t.nodeName&&!Ue(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=De(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])}}}},ir=jQuery,or=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],sr=null,lr=function(e,t,n){for(var r=function(e,t){return fe(e,t,n)},a=function(e){return n.a*e},i=function(e){return n.d*e},o=sr.getGridSnapping()&&"svg"===e.parentNode.parentNode.localName,s=function(){o&&Object.entries(t).forEach((function(e){var n=f(e,2),r=n[0],a=n[1];t[r]=lt(a)})),ot(e,t,0,!0)},l=We(e),c=0;c<2;c++){var u=0===c?"fill":"stroke",d=e.getAttribute(u);if(d&&d.startsWith("url(")&&(n.a<0||n.d<0)){var h=at(d).cloneNode(!0);if(n.a<0){var p=h.getAttribute("x1"),g=h.getAttribute("x2");h.setAttribute("x1",-(p-1)),h.setAttribute("x2",-(g-1))}if(n.d<0){var m=h.getAttribute("y1"),v=h.getAttribute("y2");h.setAttribute("y1",-(m-1)),h.setAttribute("y2",-(v-1))}h.id=sr.getDrawing().getNextId(),ze().append(h),e.setAttribute(u,"url(#"+h.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 _=te(e),b=sr.getSVGRoot().createSVGTransform();b.setMatrix(ge(ye(_).matrix,n)),_.clear(),_.appendItem(b)}else{var x=ye(e).matrix,w=ge(x.inverse(),n,x);t.x=Number.parseFloat(t.x)+w.e,t.y=Number.parseFloat(t.y)+w.f}switch(y){case"foreignObject":case"rect":case"image":if("image"===y&&(n.a<0||n.d<0)){var S=te(e),k=sr.getSVGRoot().createSVGTransform();k.setMatrix(ge(ye(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=ve(l.x,l.y,l.width,l.height,n),N=G.tr.x-G.tl.x,P=G.bl.y-G.tl.y;t.r=Math.min(N/2,P/2),t.r&&(t.r=Math.abs(t.r)),s();break;case"line":var I=r(t.x1,t.y1),T=r(t.x2,t.y2);t.x1=I.x,t.y1=I.y,t.x2=T.x,t.y2=T.y;case"text":case"tspan":case"use":s();break;case"g":var L=ir(e).data("gsvg");L&&ot(L,t,0,!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 z=e.pathSegList,H=z.numberOfItems;t.d=[];for(var q=0;q<H;++q){var W=z.getItem(q);t.d[q]={type:W.pathSegType,x:W.x,y:W.y,x1:W.x1,y1:W.y1,x2:W.x2,y2:W.y2,r1:W.r1,r2:W.r2,angle:W.angle,largeArcFlag:W.largeArcFlag,sweepFlag:W.sweepFlag}}H=t.d.length;var X=t.d[0],Y=r(X.x,X.y);t.d[0].x=Y.x,t.d[0].y=Y.y;for(var Q=1;Q<H;++Q){var K=t.d[Q];if(K.type%2==0){var Z=r(void 0!==K.x?K.x:Y.x,void 0!==K.y?K.y:Y.y),$=r(K.x1,K.y1),J=r(K.x2,K.y2);K.x=Z.x,K.y=Z.y,K.x1=$.x,K.y1=$.y,K.x2=J.x,K.y2=J.y,K.r1=a(K.r1),K.r2=i(K.r2)}else K.x=a(K.x),K.y=i(K.y),K.x1=a(K.x1),K.y1=i(K.y1),K.x2=a(K.x2),K.y2=i(K.y2),K.r1=a(K.r1),K.r2=i(K.r2)}var ee="";H=t.d.length;for(var ne=0;ne<H;++ne){var re=t.d[ne],ae=re.type;switch(ee+=or[ae],ae){case 13:case 12:ee+=re.x+" ";break;case 15:case 14:ee+=re.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:ee+=re.x+","+re.y+" ";break;case 7:case 6:ee+=re.x1+","+re.y1+" "+re.x2+","+re.y2+" "+re.x+","+re.y+" ";break;case 9:case 8:ee+=re.x1+","+re.y1+" "+re.x+","+re.y+" ";break;case 11:case 10:ee+=re.r1+","+re.r2+" "+re.angle+" "+Number(re.largeArcFlag)+" "+Number(re.sweepFlag)+" "+re.x+","+re.y+" ";break;case 17:case 16:ee+=re.x2+","+re.y2+" "+re.x+","+re.y+" "}}e.setAttribute("d",ee)}},cr=Y(jQuery),ur=function(e,t,n){var r=at(e).firstChild,a=te(r),i=er.getSVGRoot().createSVGTransform();i.setTranslate(t,n),a.appendItem(i),dr(r)},dr=function e(t){if(ut(t))return null;if("svg"===t.nodeName&&navigator.userAgent.includes("Firefox/20"))return null;var n=er.getSVGRoot(),r=te(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(pe(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&&rt(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(ge(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(),h=ge(r.getItem(l-2).matrix,r.getItem(l-1).matrix);d.setMatrix(h),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,p,g=cr(t).data("gsvg"),m=new Mt("Transform"),v={},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":(y={}).points=t.getAttribute("points");var x=t.points,w=x.numberOfItems;v.points=new Array(w);for(var S=0;S<w;++S){var k=x.getItem(S);v.points[S]={x:k.x,y:k.y}}break;case"path":(y={}).d=t.getAttribute("d"),v.d=t.getAttribute("d")}if(b.length?(v=cr(t).attr(b),cr.each(v,(function(e,t){v[e]=ue(e,t)}))):g&&(v={x:cr(g).attr("x")||0,y:cr(g).attr("y")||0}),ut(y)&&(y=cr.extend(!0,{},v),cr.each(y,(function(e,t){y[e]=ue(e,t)}))),y.transform=er.getStartTransform()||"","g"===t.tagName&&!g||"a"===t.tagName){var C=We(t);f={x:C.x+C.width/2,y:C.y+C.height/2},p=fe(C.x+C.width/2,C.y+C.height/2,ye(r).matrix);var A=rt(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 N=0;N<r.numberOfItems;++N){var P=r.getItem(N);if(4===P.type){var I=P.matrix;f.y=(E*I.e+I.f)/2,f.x=(I.e-E*I.f)/2,r.removeItem(N);break}}}var T,L,M=r.numberOfItems,O=0,j=0,V=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){V=3;for(var R=r.getItem(M-3).matrix,B=r.getItem(M-2).matrix,D=r.getItem(M-1).matrix,F=t.childNodes,z=F.length;z--;){var H=F.item(z);if(O=0,j=0,1===H.nodeType){var q=te(H);if(!q)continue;var W=ye(q).matrix,X=rt(H);if(L=er.getStartTransform(),er.setStartTransform(H.getAttribute("transform")),X||me(q)){var Y=n.createSVGTransform();Y.setMatrix(ge(R,B,D,W)),q.clear(),q.appendItem(Y)}else{var Q=ge(W.inverse(),D,W),K=n.createSVGMatrix();K.e=-Q.e,K.f=-Q.f;var Z=ge(K.inverse(),W.inverse(),R,B,D,W,Q.inverse()),$=n.createSVGTransform(),J=n.createSVGTransform(),ee=n.createSVGTransform();$.setTranslate(Q.e,Q.f),J.setScale(Z.a,Z.d),ee.setTranslate(K.e,K.f),q.appendItem(ee),q.appendItem(J),q.appendItem($)}m.addSubCommand(e(H)),er.setStartTransform(L)}}r.removeItem(M-1),r.removeItem(M-2),r.removeItem(M-3)}else if(M>=3&&1===r.getItem(M-1).type){V=3;var ne=ye(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){V=2;var ae=ye(r).matrix;r.removeItem(0);var ie=ye(r).matrix.inverse(),oe=ge(ie,ae);if(O=oe.e,j=oe.f,0!==O||0!==j){for(var se=t.childNodes,le=se.length,ce=[];le--;){var de=se.item(le);if(1===de.nodeType){if(de.getAttribute("clip-path")){var he=de.getAttribute("clip-path");ce.includes(he)||(ur(he,O,j),ce.push(he))}L=er.getStartTransform(),er.setStartTransform(de.getAttribute("transform"));var ve=te(de);if(ve){var _e=n.createSVGTransform();_e.setTranslate(O,j),ve.numberOfItems?ve.insertItemBefore(_e,0):ve.appendItem(_e),m.addSubCommand(e(de));for(var be=t.getElementsByTagNameNS(_.SVG,"use"),xe="#"+de.id,we=be.length;we--;){var Se=be.item(we);if(xe===Ue(Se)){var ke=n.createSVGTransform();ke.setTranslate(-O,-j),te(Se).insertItemBefore(ke,0),m.addSubCommand(e(Se))}}er.setStartTransform(L)}}}er.setStartTransform(L)}}else{if(1!==M||1!==r.getItem(0).type||A){if(A){var Ce=n.createSVGTransform();Ce.setRotate(A,p.x,p.y),r.numberOfItems?r.insertItemBefore(Ce,0):r.appendItem(Ce)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}V=1;for(var Ae=r.getItem(0).matrix,Ee=t.childNodes,Ge=Ee.length;Ge--;){var Ne=Ee.item(Ge);if(1===Ne.nodeType){L=er.getStartTransform(),er.setStartTransform(Ne.getAttribute("transform"));var Pe=te(Ne);if(!Pe)continue;var Ie=ge(Ae,ye(Pe).matrix),Te=n.createSVGTransform();Te.setMatrix(Ie),Pe.clear(),Pe.appendItem(Te,0),m.addSubCommand(e(Ne)),er.setStartTransform(L);var Le=Ne.getAttribute("stroke-width");if("none"!==Ne.getAttribute("stroke")&&!isNaN(Le)){var Me=(Math.abs(Ie.a)+Math.abs(Ie.d))/2;Ne.setAttribute("stroke-width",Le*Me)}}}r.clear()}if(2===V){if(A){p={x:f.x+T.e,y:f.y+T.f};var Oe=n.createSVGTransform();Oe.setRotate(A,p.x,p.y),r.numberOfItems?r.insertItemBefore(Oe,0):r.appendItem(Oe)}}else if(3===V){var je=ye(r).matrix,Ve=n.createSVGTransform();Ve.setRotate(A,f.x,f.y);var Re=Ve.matrix,Be=n.createSVGTransform();Be.setRotate(A,p.x,p.y);var De=Be.matrix.inverse(),Fe=je.inverse(),ze=ge(Fe,De,Re,je);if(O=ze.e,j=ze.f,0!==O||0!==j)for(var He=t.childNodes,qe=He.length;qe--;){var Xe=He.item(qe);if(1===Xe.nodeType){L=er.getStartTransform(),er.setStartTransform(Xe.getAttribute("transform"));var Ye=te(Xe),Qe=n.createSVGTransform();Qe.setTranslate(O,j),Ye.numberOfItems?Ye.insertItemBefore(Qe,0):Ye.appendItem(Qe),m.addSubCommand(e(Xe)),er.setStartTransform(L)}}A&&(r.numberOfItems?r.insertItemBefore(Be,0):r.appendItem(Be))}}else{var Ke,Ze=We(t);if(!Ze&&"path"!==t.tagName)return null;var $e=rt(t);if($e){f={x:Ze.x+Ze.width/2,y:Ze.y+Ze.height/2},p=fe(Ze.x+Ze.width/2,Ze.y+Ze.height/2,ye(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 it=nt.matrix;f.y=(et*it.e+it.f)/2,f.x=(it.e-et*it.f)/2,r.removeItem(tt);break}}}var ot=0,st=r.numberOfItems;if(!U()){var lt=t.getAttribute("fill");if(lt&<.startsWith("url(")){var ct=at(lt),dt="pattern";if(ct.tagName!==dt&&(dt="gradient"),"userSpaceOnUse"===ct.getAttribute(dt+"Units")){Ke=ye(r).matrix;var ht=te(ct),ft=ye(ht).matrix,pt="matrix("+[(Ke=ge(Ke,ft)).a,Ke.b,Ke.c,Ke.d,Ke.e,Ke.f].join(",")+")";ct.setAttribute(dt+"Transform",pt)}}}if(st>=3&&3===r.getItem(st-2).type&&2===r.getItem(st-3).type&&2===r.getItem(st-1).type)ot=3,Ke=ye(r,st-3,st-1).matrix,r.removeItem(st-1),r.removeItem(st-2),r.removeItem(st-3);else if(4===st&&1===r.getItem(st-1).type){ot=3,Ke=ye(r).matrix;var gt=n.createSVGTransform();gt.setMatrix(Ke),r.clear(),r.appendItem(gt),Ke=n.createSVGMatrix()}else if((1===st||st>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){ot=2;var mt=r.getItem(0).matrix,vt=ye(r,1).matrix,yt=vt.inverse();Ke=ge(yt,mt,vt),r.removeItem(0)}else{if(1!==st||1!==r.getItem(0).type||$e){if($e){var _t=n.createSVGTransform();_t.setRotate($e,p.x,p.y),r.numberOfItems?r.insertItemBefore(_t,0):r.appendItem(_t)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}switch(Ke=ye(r).matrix,t.tagName){case"line":v=cr(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(v.points=t.getAttribute("points"),v.points){var bt=t.points,xt=bt.numberOfItems;v.points=new Array(xt);for(var wt=0;wt<xt;++wt){var St=bt.getItem(wt);v.points[wt]={x:St.x,y:St.y}}}case"path":v.d=t.getAttribute("d"),ot=1,r.clear()}}if(1!==ot&&2!==ot&&3!==ot||lr(t,v,Ke),2===ot){if($e){me(r)||(p={x:f.x+Ke.e,y:f.y+Ke.f});var kt=n.createSVGTransform();kt.setRotate($e,p.x,p.y),r.numberOfItems?r.insertItemBefore(kt,0):r.appendItem(kt)}if("text"===t.tagName)for(var Ct=t.childNodes,At=Ct.length;At--;){var Et=Ct.item(At);if("tspan"===Et.tagName){var Gt={x:cr(Et).attr("x")||0,y:cr(Et).attr("y")||0};lr(Et,Gt,Ke)}}}else if(3===ot&&$e){var Nt=ye(r).matrix,Pt=n.createSVGTransform();Pt.setRotate($e,f.x,f.y);var It=Pt.matrix,Tt=n.createSVGTransform();Tt.setRotate($e,p.x,p.y);var Ot=Tt.matrix.inverse(),jt=Nt.inverse(),Vt=ge(jt,Ot,It,Nt);lr(t,v,Vt),$e&&(r.numberOfItems?r.insertItemBefore(Tt,0):r.appendItem(Tt))}}return 0===r.numberOfItems&&t.removeAttribute("transform"),m.addSubCommand(new Lt(t,y)),m},hr=jQuery,fr=W()?10:4,pr=function(){function e(t,n,a){r(this,e),this.id=t,this.selectedElement=n,this.locked=!0,this.selectorGroup=tr.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}}),this.selectorRect=this.selectorGroup.appendChild(tr.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 i(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";rr.selectorGripsGroup.setAttribute("display",n);var r=this.selectedElement;this.hasGrips=t,r&&t&&(this.selectorGroup.append(rr.selectorGripsGroup),e.updateGripCursors(rt(r)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=rr,r=n.selectorGrips,a=this.selectedElement,i=a.getAttribute("stroke-width"),o=tr.getCurrentZoom(),s=1/o;"none"===a.getAttribute("stroke")||isNaN(i)||(s+=i/2);var l=a.tagName;"text"===l&&(s+=2/o);var c=te(a),u=ye(c).matrix;if(u.e*=o,u.f*=o,e||(e=We(a)),"g"===l&&!hr.data(a,"gsvg")){var d=Je([a.childNodes]);d&&(e=d)}var h=e.x,p=e.y,g=e.width,m=e.height;s*=o;var v=ve(h*o,p*o,g*o,m*o,u),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=rt(a);if(C){var A=tr.svgRoot().createSVGTransform();A.setRotate(-C,S,k);var E=A.matrix;v.tl=fe(v.tl.x,v.tl.y,E),v.tr=fe(v.tr.x,v.tr.y,E),v.bl=fe(v.bl.x,v.bl.y,E),v.br=fe(v.br.x,v.br.y,E);var G=v.tl,N=G.x,P=G.y,I=G.x,T=G.y,L=Math.min,M=Math.max;_=N=L(N,L(v.tr.x,L(v.bl.x,v.br.x)))-s,b=P=L(P,L(v.tr.y,L(v.bl.y,v.br.y)))-s,x=(I=M(I,M(v.tr.x,M(v.bl.x,v.br.x)))+s)-N,w=(T=M(T,M(v.tr.y,M(v.bl.y,v.br.y)))+s)-P}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=f(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*fr),n.rotateGrip.setAttribute("cx",_+x/2),n.rotateGrip.setAttribute("cy",b-5*fr)}}],[{key:"updateGripCursors",value:function(e){var t=Object.keys(rr.selectorGrips),n=Math.round(e/45);for(n<0&&(n+=8);n>0;)t.push(t.shift()),n--;Object.values(rr.selectorGrips).forEach((function(e,n){e.setAttribute("style","cursor:"+t[n]+"-resize")}))}}]),e}(),gr=function(){function t(){r(this,t),this.selectorParentGroup=null,this.rubberBandBox=null,this.selectors=[],this.selectorMap={},this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null},this.selectorGripsGroup=null,this.rotateGripConnector=null,this.rotateGrip=null,this.initGroup()}return i(t,[{key:"initGroup",value:function(){var e=this;if(this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.remove(),this.selectorParentGroup=tr.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=tr.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.append(this.selectorGripsGroup),tr.svgRoot().append(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,Object.keys(this.selectorGrips).forEach((function(t){var n=tr.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+t,fill:"#22C",r:fr,style:"cursor:"+t+"-resize","stroke-width":2,"pointer-events":"all"}});hr.data(n,"dir",t),hr.data(n,"type","resize"),e.selectorGrips[t]=e.selectorGripsGroup.appendChild(n)})),this.rotateGripConnector=this.selectorGripsGroup.appendChild(tr.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(tr.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:fr,stroke:"#22C","stroke-width":2,style:"cursor:url("+nr.imgPath+"rotate.png) 12 12, auto;"}})),hr.data(this.rotateGrip,"type","rotate"),!hr("#canvasBackground").length){var t=f(nr.dimensions,2),n=t[0],r=t[1],a=tr.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:n,height:r,x:0,y:0,overflow:U()?"none":"visible",style:"pointer-events:none"}}),i=tr.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),tr.svgRoot().insertBefore(a,tr.svgContent())}}},{key:"requestSelector",value:function(t,n){if(ut(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 pr(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(!ut(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(tr.createSVGElement({element:"rect",attr:{id:"selectorRubberBand",fill:"#22C","fill-opacity":.15,stroke:"#22C","stroke-width":.5,display:"none",style:"pointer-events:none"}}))),this.rubberBandBox}}]),t}(),mr=Y(jQuery),vr=Pt,yr=It,_r=Tt,br=Lt,xr=Mt,wr=Ot,Sr=Gt;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 kr=function t(a,i){r(this,t);var o={show_outside_canvas:!0,selectNew:!0,dimensions:[640,480]};i&&mr.extend(o,i);var s=o.dimensions,l=this,c=a.ownerDocument,u=c.importNode(Re('<svg id="svgroot" xmlns="'+_.SVG+'" xlinkns="'+_.XLINK+'" width="'+s[0]+'" height="'+s[1]+'" x="'+s[0]+'" y="'+s[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement,!0);a.append(u);var d=c.createElementNS(_.SVG,"svg");(l.clearSvgContentElement=function(){mr(d).empty(),mr(d).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:o.show_outside_canvas?"visible":"hidden",xmlns:_.SVG,"xmlns:se":_.SE,"xmlns:xlink":_.XLINK}).appendTo(u);var e=c.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");d.append(e)})();var h="svg_";l.setIdPrefix=function(e){h=e},l.current_drawing_=new jn(d,h);var g=l.getCurrentDrawing=function(){return l.current_drawing_},m=1,y=null,x={shape:{fill:("none"===o.initFill.color?"":"#")+o.initFill.color,fill_paint:null,fill_opacity:o.initFill.opacity,stroke:"#"+o.initStroke.color,stroke_paint:null,stroke_opacity:o.initStroke.opacity,stroke_width:o.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:o.initOpacity}};x.text=mr.extend(!0,{},x.shape),mr.extend(x.text,{fill:"#000000",stroke_width:o.text&&o.text.stroke_width,font_size:o.text&&o.text.font_size,font_family:o.text&&o.text.font_family});var w=x.shape,S=[],k=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]=k(a);return n},C=this.addSVGElementFromJson=function(e){if("string"==typeof e)return c.createTextNode(e);var t=it(e.attr.id),n=g().getCurrentLayer();if(t&&e.element!==t.tagName&&(t.remove(),t=null),!t){var r=e.namespace||_.SVG;t=c.createElementNS(r,e.element),n&&(y||n).append(t)}return e.curStyles&&ot(t,{fill:w.fill,stroke:w.stroke,"stroke-width":w.stroke_width,"stroke-dasharray":w.stroke_dasharray,"stroke-linejoin":w.stroke_linejoin,"stroke-linecap":w.stroke_linecap,"stroke-opacity":w.stroke_opacity,"fill-opacity":w.fill_opacity,opacity:w.opacity/2,style:"pointer-events:inherit"}),ot(t,e.attr),st(t),e.children&&e.children.forEach((function(e){t.append(C(e))})),t};l.getTransformList=te,l.matrixMultiply=ge,l.hasMatrixTransform=me,l.transformListToTransform=ye;var A=function(){return o.baseUnit};!function(e){Z=e;var t=document.createElementNS(_.SVG,"svg");document.body.append(t);var n=document.createElementNS(_.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;ie={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:A,getElement:it,getHeight:function(){return d.getAttribute("height")/m},getWidth:function(){return d.getAttribute("width")/m},getRoundDigits:function(){return ke.round_digits}}),l.convertToNum=ue;var E,G=function(){return d},N=this.getSelectedElems=function(){return S},P=bn,I=function(){return u};Ce=E={pathActions:P,getSVGContent:G,addSVGElementFromJson:C,getSelectedElements:N,getDOMDocument:function(){return c},getDOMContainer:function(){return a},getSVGRoot:I,getBaseUnit:A,getSnappingStep:function(){return o.snappingStep}},Ae=E.getDOMDocument(),Ee=E.getDOMContainer(),Ge=E.getSVGRoot(),l.findDefs=ze,l.getUrlFromAttr=De,l.getHref=Ue,l.setHref=Fe,l.getBBox=We,l.getRotationAngle=rt,l.getElem=it,l.getRefElem=at,l.assignAttributes=ot,this.cleanupElement=st;var T=function(){return o.gridSnapping};!function(e){sr=e}({getDrawing:function(){return g()},getSVGRoot:I,getGridSnapping:T}),this.remapElement=lr,function(e){er=e}({getSVGRoot:I,getStartTransform:function(){return $e},setStartTransform:function(e){$e=e}}),this.recalculateDimensions=dr;var L=b();l.sanitizeSvg=ar;var M=l.undoMgr=new wr({handleHistoryEvent:function(e,t){var n=Sr;if(e===n.BEFORE_UNAPPLY||e===n.BEFORE_APPLY)l.clearSelection();else if(e===n.AFTER_APPLY||e===n.AFTER_UNAPPLY){var r=t.elements();l.pathActions.clear(),W("changed",r);var a=t.type(),i=e===n.AFTER_APPLY;if("MoveElementCommand"===a)(i?t.newParent:t.oldParent)===d&&Rn();else if("InsertElementCommand"===a||"RemoveElementCommand"===a)t.parent===d&&Rn(),"InsertElementCommand"===a?i&&he(t.elem):i||he(t.elem),t.elem&&"use"===t.elem.tagName&&tn(t.elem);else if("ChangeElementCommand"===a){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===d&&Rn();var o=i?t.newValues:t.oldValues;o.stdDeviation&&l.setBlurOffsets(t.elem.parentNode,o.stdDeviation)}}}}),O=function(e){l.undoMgr.addCommandToHistory(e)},V=this.getZoom=function(){return m},R=this.round=function(e){return Number.parseInt(e*m)/m};!function(e,t){nr=e,tr=t,rr=new gr}(o,{createSVGElement:function(e){return l.addSVGElementFromJson(e)},svgRoot:function(){return u},svgContent:function(){return d},getCurrentZoom:V});var B=this.selectorManager=rr,D=l.getNextId=function(){return g().getNextId()},q=l.getId=function(){return g().getId()},W=function(e,t){if(St[e])return St[e](window,t)},Y=this.clearSelection=function(e){S.forEach((function(e){ut(e)||B.releaseSelector(e)})),S=[],e||W("selected",S)},Q=this.addToSelection=function(e,t){if(e.length){for(var n=0;n<S.length&&!ut(S[n]);)++n;for(var r=e.length;r--;){var a=e[r];if(a){var i=We(a);if(i&&("a"===a.tagName&&1===a.childNodes.length&&(a=a.firstChild),!S.includes(a))){S[n]=a,n++;var o=B.requestSelector(a,i);S.length>1&&o.showGrips(!1)}}}if(S.length)for(W("selected",S),1===S.length&&B.requestSelector(S[0]).showGrips(t),S.sort((function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):ut(e)?1:0}));ut(S[0]);)S.shift(0)}},K=function(){return w.opacity},ee=this.getMouseTarget=function(e){if(ut(e))return null;var t=e.target;if(t.correspondingUseElement&&(t=t.correspondingUseElement),[_.MATH,_.HTML].includes(t.namespaceURI)&&"svgcanvas"!==t.id)for(;"foreignObject"!==t.nodeName;)if(!(t=t.parentNode))return u;var n=g().getCurrentLayer();if([u,a,d,n].includes(t))return u;if(mr(t).closest("#selectorParentGroup").length)return B.selectorParentGroup;for(;t.parentNode!==(y||n);)t=t.parentNode;return t};l.pathActions=P,Wt({selectorManager:B,canvas:l,call:W,resetD:function(e){e.setAttribute("d",P.convertPath(e))},round:R,clearSelection:Y,addToSelection:Q,addCommandToHistory:O,remapElement:lr,addSVGElementFromJson:C,getGridSnapping:T,getOpacity:K,getSelectedElements:N,getContainer:function(){return a},setStarted:function(e){Ze=e},getRubberBox:function(){return ft},setRubberBox:function(e){return ft=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;P.canDeleteNodes=!0,P.closed_subpath=t,W("pointsAdded",{closedSubpath:t,grips:n}),W("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;O(t),W("changed",[n])},getCurrentZoom:V,getId:q,getNextId:D,getMouseTarget:ee,getCurrentMode:function(){return Je},setCurrentMode:function(e){return Je=e},getDrawnPath:function(){return Qt},setDrawnPath:function(e){return Qt=e},getSVGRoot:I});var ne={},re="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",ae=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],ce=mr.data,de=document.createElementNS(_.SVG,"animate");mr(de).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(u);var he=function e(t){var n=mr(t).attr(ae);Object.values(n).forEach((function(e){if(e&&e.startsWith("url(")){var t=De(e).substr(1);it(t)||(ze().append(qe[t]),delete qe[t])}}));var r=t.getElementsByTagName("*");if(r.length)for(var a=0,i=r.length;a<i;a++)e(r[a])},Se={},ke={round_digits:5},Le={},Me=x.text,Ve={},qe={},Xe=o.imgPath+"logo.png",Ze=!1,$e=null,Je="select",nt="none",dt=w,ht=null,ft=null,pt=[],gt=null;this.runExtension=function(e,t,n){return this.runExtensions(t,n,!1,(function(t){return t===e}))};var mt=this.runExtensions=function(e,t,n,r){var a=!!n&&[];return mr.each(Ve,(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(){var e=n(regeneratorRuntime.mark((function e(t,n,r){var a,i,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=r.$,i=r.importLocale,"function"==typeof n){e.next=3;break}throw new TypeError("Function argument expected for `svgcanvas.addExtension`");case 3:if(!(t in Ve)){e.next=5;break}throw new Error('Cannot add extension "'+t+'", an extension by that name already exists.');case 5:return o=mr.extend(l.getPrivateMethods(),{$:a,importLocale:i,svgroot:u,svgcontent:d,nonce:g().getNonce(),selectorManager:B}),e.next=8,n(o);case 8:return(s=e.sent)&&(s.name=t),Ve[t]=s,e.abrupt("return",W("extension_added",s));case 12:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}();var yt=this.getIntersectionList=function(e){if(ut(ft))return null;var t,n=y||g().getCurrentLayer();if(e)(t=d.createSVGRect()).x=e.x,t.y=e.y,t.width=e.width,t.height=e.height;else{t=ft.getBBox();var r=d.createSVGRect();["x","y","width","height","top","right","bottom","left"].forEach((function(e){r[e]=t[e]/m})),t=r}var a=null;if(z()||"function"==typeof u.getIntersectionList&&(t.x+=Number.parseInt(d.getAttribute("x")),t.y+=Number.parseInt(d.getAttribute("y")),a=u.getIntersectionList(t,n)),ut(a)||"function"!=typeof a.item){a=[],pt.length||(pt=bt(n));for(var i=pt.length;i--;)t.width&&xe(t,pt[i].bbox)&&a.push(pt[i].elem)}return a};this.getStrokedBBox=tt,this.getVisibleElements=et;var bt=this.getVisibleElementsAndBBoxes=function(e){e||(e=mr(d).children());var t=[];return mr(e).children().each((function(e,n){n.getBBox&&t.push({elem:n,bbox:tt([n])})})),t.reverse()},xt=this.groupSvgElem=function(e){var t=document.createElementNS(_.SVG,"g");e.replaceWith(t),mr(t).append(e).data("gsvg",e)[0].id=D()},St={};l.call=W,l.bind=function(e,t){var n=St[e];return St[e]=t,n},this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement),p(e.getElementsByTagNameNS(_.SVG,"path")).forEach((function(e){e.setAttribute("d",P.convertPath(e)),P.fixEnd(e)}))};var kt=function(e){if(!F())return e;var t=e.cloneNode(!0);return e.before(t),e.remove(),B.releaseSelector(e),S[0]=t,B.requestSelector(t).showGrips(!0),t};this.setRotationAngle=function(e,t){e=Number.parseFloat(e);var n=S[0],r=n.getAttribute("transform"),a=We(n),i=a.x+a.width/2,o=a.y+a.height/2,s=te(n);s.numberOfItems>0&&(4===s.getItem(0).type&&s.removeItem(0));if(0!==e){var l=fe(i,o,ye(s).matrix),c=u.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 d=n.getAttribute("transform");n.setAttribute("transform",r),hn("transform",d,S),W("changed",S)}B.requestSelector(S[0]).resize(),pr.updateGripCursors(e)};var Ct=this.recalculateAllSelectedDimensions=function(){for(var e=new xr("none"===nt?"position":"size"),t=S.length;t--;){var n=S[t],r=dr(n);r&&e.addSubCommand(r)}e.isEmpty()||(O(e),W("changed",S))},At=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Et=null,Gt=this.selectOnly=function(e,t){Y(!0),Q(e,t)};this.removeFromSelection=function(e){if(!ut(S[0])&&e.length){for(var t=[],n=S.length,r=0;r<n;++r){var a=S[r];a&&(e.includes(a)?B.releaseSelector(a):t.push(a))}S=t}},this.selectAllInCurrentLayer=function(){var e=g().getCurrentLayer();e&&(Je="select",Gt(mr(y||e).children()))};var Nt,Pt,It,Tt,Lt,Mt,Ot,Vt,Rt,Bt,Ut,Ft,qt,Xt,Yt,Qt=null;Pt={minx:null,miny:null,maxx:null,maxy:null},It=null,Tt=null,Lt=null,Mt=null,Ot={},Vt=0,Rt={x:0,y:0},Bt={x:0,y:0},Ut={x:0,y:0},Ft={x:0,y:0},qt={x:0,y:0},Xt={x:0,y:0},Yt=function(e){var t={x:0,y:0},n=Rt,r=Bt,a=Ut,i=Ft,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}},mr(a).mousedown((function(e){if(!l.spaceKey&&1!==e.button){var t=2===e.button;e.altKey&&l.cloneSelectedElements(0,0),Et=mr("#svgcontent g")[0].getScreenCTM().inverse();var n=fe(e.pageX,e.pageY,Et),r=n.x*m,a=n.y*m;e.preventDefault(),t&&(Je="select",gt=n);var i=r/m,s=a/m,c=ee(e);"a"===c.tagName&&1===c.childNodes.length&&(c=c.firstChild);var d=i;Lt=It=i;var h=s;if(Mt=Tt=s,o.gridSnapping&&(i=lt(i),s=lt(s),It=lt(It),Tt=lt(Tt)),c===B.selectorParentGroup&&!ut(S[0])){var f=e.target,p=ce(f,"type");"rotate"===p?Je="rotate":"resize"===p&&(Je="resize",nt=ce(f,"dir")),c=S[0]}$e=c.getAttribute("transform");var g=te(c);switch(Je){case"select":if(Ze=!0,nt="none",t&&(Ze=!1),c!==u){if(S.includes(c)||(e.shiftKey||Y(!0),Q([c]),ht=c,P.clear()),!t){var y,_=v(S);try{for(_.s();!(y=_.n()).done;){var b=y.value;if(!ut(b)){var x=te(b);x.numberOfItems?x.insertItemBefore(u.createSVGTransform(),0):x.appendItem(u.createSVGTransform())}}}catch(e){_.e(e)}finally{_.f()}}}else t||(Y(),Je="multiselect",ut(ft)&&(ft=B.getRubberBandBox()),ot(ft,{x:Lt*=m,y:Mt*=m,width:0,height:0,display:"inline"}));break;case"zoom":Ze=!0,ut(ft)&&(ft=B.getRubberBandBox()),ot(ft,{x:d*m,y:d*m,width:0,height:0,display:"inline"});break;case"resize":Ze=!0,It=i,Tt=s,Ot=We(mr("#selectedBox0")[0]);var k={};mr.each(Ot,(function(e,t){k[e]=t/m})),Ot=k;var A=rt(c)?1:0;if(me(g))g.insertItemBefore(u.createSVGTransform(),A),g.insertItemBefore(u.createSVGTransform(),A),g.insertItemBefore(u.createSVGTransform(),A);else if(g.appendItem(u.createSVGTransform()),g.appendItem(u.createSVGTransform()),g.appendItem(u.createSVGTransform()),X()){var E,G=U();G&&(E=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",G&&E(c);for(var N=c.getElementsByTagName("*"),I=N.length,T=0;T<I;T++)N[T].style&&(N[T].style.vectorEffect="non-scaling-stroke",G&&E(N[T]))}break;case"fhellipse":case"fhrect":case"fhpath":Ut.x=d,Ut.y=h,Bt={x:0,y:0},Rt={x:0,y:0},Ze=!0,C({element:"polyline",curStyles:!0,attr:{points:d+","+h+" ",id:D(),fill:"none",opacity:w.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}}),Pt.minx=d,Pt.maxx=d,Pt.miny=h,Pt.maxy=h;break;case"image":Ze=!0;var L=C({element:"image",attr:{x:i,y:s,width:0,height:0,id:D(),opacity:w.opacity/2,style:"pointer-events:inherit"}});Fe(L,Xe),ct(L);break;case"square":case"rect":Ze=!0,It=i,Tt=s,C({element:"rect",curStyles:!0,attr:{x:i,y:s,width:0,height:0,id:D(),opacity:w.opacity/2}});break;case"line":Ze=!0;var M=0===Number(w.stroke_width)?1:w.stroke_width;C({element:"line",curStyles:!0,attr:{x1:i,y1:s,x2:i,y2:s,id:D(),stroke:w.stroke,"stroke-width":M,"stroke-dasharray":w.stroke_dasharray,"stroke-linejoin":w.stroke_linejoin,"stroke-linecap":w.stroke_linecap,"stroke-opacity":w.stroke_opacity,fill:"none",opacity:w.opacity/2,style:"pointer-events:none"}});break;case"circle":Ze=!0,C({element:"circle",curStyles:!0,attr:{cx:i,cy:s,r:0,id:D(),opacity:w.opacity/2}});break;case"ellipse":Ze=!0,C({element:"ellipse",curStyles:!0,attr:{cx:i,cy:s,rx:0,ry:0,id:D(),opacity:w.opacity/2}});break;case"text":Ze=!0,C({element:"text",curStyles:!0,attr:{x:i,y:s,id:D(),fill:Me.fill,"stroke-width":Me.stroke_width,"font-size":Me.font_size,"font-family":Me.font_family,"text-anchor":"middle","xml:space":"preserve",opacity:w.opacity}});break;case"path":case"pathedit":It*=m,Tt*=m,P.mouseDown(e,c,It,Tt),Ze=!0;break;case"textedit":It*=m,Tt*=m,Zt.mouseDown(e,c,It,Tt),Ze=!0;break;case"rotate":Ze=!0,l.undoMgr.beginUndoableChange("transform",S)}var O=mt("mouseDown",{event:e,start_x:It,start_y:Tt,selectedElements:S},!0);mr.each(O,(function(e,t){t&&t.started&&(Ze=!0)}))}})).mousemove((function(e){if(Ze&&1!==e.button&&!l.spaceKey){var t,n,r,a,i,s,c,h,f,p,g=S[0],v=fe(e.pageX,e.pageY,Et),y=v.x*m,_=v.y*m,b=it(q()),x=y/m,w=x,k=_/m,C=k;switch(o.gridSnapping&&(w=lt(w),C=lt(C)),e.preventDefault(),Je){case"select":if(null!==S[0]&&(i=w-It,s=C-Tt,o.gridSnapping&&(i=lt(i),s=lt(s)),0!==i||0!==s)){for(c=S.length,t=0;t<c&&(g=S[t],!ut(g));++t){var A=u.createSVGTransform();p=te(g),A.setTranslate(i,s),p.numberOfItems?p.replaceItem(A,0):p.appendItem(A),B.requestSelector(g).resize()}W("transition",S)}break;case"multiselect":x*=m,k*=m,ot(ft,{x:Math.min(Lt,x),y:Math.min(Mt,k),width:Math.abs(x-Lt),height:Math.abs(k-Mt)});var E=S.slice(),G=[],N=yt();for(c=N.length,t=0;t<c;++t){var I=N[t];S.includes(I)||G.push(I);var T=E.indexOf(I);-1!==T&&E.splice(T,1)}E.length>0&&l.removeFromSelection(E),G.length>0&&l.addToSelection(G);break;case"resize":p=te(g);var L=me(p),M=(f=L?Ot:We(g)).x,O=f.y,j=f,V=j.width,R=j.height;if(i=w-It,s=C-Tt,o.gridSnapping&&(i=lt(i),s=lt(s),R=lt(R),V=lt(V)),h=rt(g)){var D=Math.sqrt(i*i+s*s),U=Math.atan2(s,i)-h*Math.PI/180;i=D*Math.cos(U),s=D*Math.sin(U)}nt.includes("n")||nt.includes("s")||(s=0),nt.includes("e")||nt.includes("w")||(i=0);var F=0,z=0,H=R?(R+s)/R:1,X=V?(V+i)/V:1;nt.includes("n")&&(H=R?(R-s)/R:1,z=R),nt.includes("w")&&(X=V?(V-i)/V:1,F=V);var Y=u.createSVGTransform(),Q=u.createSVGTransform(),K=u.createSVGTransform();if(o.gridSnapping&&(M=lt(M),F=lt(F),O=lt(O),z=lt(z)),Y.setTranslate(-(M+F),-(O+z)),e.shiftKey&&(1===X?X=H:H=X),Q.setScale(X,H),K.setTranslate(M+F,O+z),L){var Z=h?1:0;p.replaceItem(Y,2+Z),p.replaceItem(Q,1+Z),p.replaceItem(K,Number(Z))}else{var $=p.numberOfItems;p.replaceItem(K,$-3),p.replaceItem(Q,$-2),p.replaceItem(Y,$-1)}B.requestSelector(g).resize(),W("transition",S);break;case"zoom":x*=m,k*=m,ot(ft,{x:Math.min(Lt*m,x),y:Math.min(Mt*m,k),width:Math.abs(x-Lt*m),height:Math.abs(k-Mt*m)});break;case"text":ot(b,{x:w,y:C});break;case"line":o.gridSnapping&&(w=lt(w),C=lt(C));var J=w,ee=C;e.shiftKey&&(J=(n=be(It,Tt,J,ee)).x,ee=n.y),b.setAttribute("x2",J),b.setAttribute("y2",ee);break;case"foreignObject":case"square":case"rect":case"image":var ne,re,ae="square"===Je||e.shiftKey,ie=Math.abs(w-It),oe=Math.abs(C-Tt);ae?(ie=oe=Math.max(ie,oe),ne=It<w?It:It-ie,re=Tt<C?Tt:Tt-oe):(ne=Math.min(It,w),re=Math.min(Tt,C)),o.gridSnapping&&(ie=lt(ie),oe=lt(oe),ne=lt(ne),re=lt(re)),ot(b,{width:ie,height:oe,x:ne,y:re});break;case"circle":var se=mr(b).attr(["cx","cy"]);r=se.cx,a=se.cy;var le=Math.sqrt((w-r)*(w-r)+(C-a)*(C-a));o.gridSnapping&&(le=lt(le)),b.setAttribute("r",le);break;case"ellipse":var ce=mr(b).attr(["cx","cy"]);r=ce.cx,a=ce.cy,o.gridSnapping&&(w=lt(w),r=lt(r),C=lt(C),a=lt(a)),b.setAttribute("rx",Math.abs(w-r));var ue=Math.abs(e.shiftKey?w-r:C-a);b.setAttribute("ry",ue);break;case"fhellipse":case"fhrect":Pt.minx=Math.min(x,Pt.minx),Pt.maxx=Math.max(x,Pt.maxx),Pt.miny=Math.min(k,Pt.miny),Pt.maxy=Math.max(k,Pt.maxy);case"fhpath":if(Ft.x=x,Ft.y=k,Rt.x&&Rt.y)for(t=0;t<9;t++)if(Nt=t/10,qt=Yt((t+1)/10),Xt=qt,qt=Yt(Nt),(Vt+=Math.sqrt((Xt.x-qt.x)*(Xt.x-qt.x)+(Xt.y-qt.y)*(Xt.y-qt.y)))>.8){Vt-=.8;var de=d.createSVGPoint();de.x=qt.x,de.y=qt.y,b.points.appendItem(de)}Rt={x:Bt.x,y:Bt.y},Bt={x:Ut.x,y:Ut.y},Ut={x:Ft.x,y:Ft.y};break;case"path":case"pathedit":if(w*=m,C*=m,o.gridSnapping&&(w=lt(w),C=lt(C),It=lt(It),Tt=lt(Tt)),e.shiftKey){var he,pe,ge=Ht;ge?(he=ge.dragging?ge.dragging[0]:It,pe=ge.dragging?ge.dragging[1]:Tt):(he=It,pe=Tt);var ve=n=be(he,pe,w,C);w=ve.x,C=ve.y}ft&&"none"!==ft.getAttribute("display")&&(x*=m,k*=m,ot(ft,{x:Math.min(Lt*m,x),y:Math.min(Mt*m,k),width:Math.abs(x-Lt*m),height:Math.abs(k-Mt*m)})),P.mouseMove(w,C);break;case"textedit":w*=m,C*=m,Zt.mouseMove(y,_);break;case"rotate":r=(f=We(g)).x+f.width/2,a=f.y+f.height/2;var ye=_e(g),xe=fe(r,a,ye);r=xe.x,a=xe.y,h=(Math.atan2(a-C,r-w)*(180/Math.PI)-90)%360,o.gridSnapping&&(h=lt(h)),e.shiftKey&&(h=45*Math.round(h/45)),l.setRotationAngle(h<-180?360+h:h,!0),W("transition",S)}mt("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,n=ee(e),r=n.tagName;if("text"===r&&"textedit"!==Je){var a=fe(e.pageX,e.pageY,Et);Zt.select(n,a.x,a.y)}t!==y&&("g"!==r&&"a"!==r||!rt(n)||(gn(n),n=S[0],Y(!0)),y&&Qn(),"g"!==t.tagName&&"a"!==t.tagName||t===g().getCurrentLayer()||n===B.selectorParentGroup||Kn(n))})).mouseup((function(e){if(2!==e.button){var t=ht;if(ht=null,Ze){var n,r,a=fe(e.pageX,e.pageY,Et),i=a.x*m,s=a.y*m,c=i/m,u=s/m,d=it(q()),h=!1,f=c,p=u;switch(Ze=!1,Je){case"resize":case"multiselect":ut(ft)||(ft.setAttribute("display","none"),pt=[]),Je="select";case"select":if(!ut(S[0])){if(ut(S[1])){var v=S[0];switch(v.tagName){case"g":case"use":case"image":case"foreignObject":break;default:dt.fill=v.getAttribute("fill"),dt.fill_opacity=v.getAttribute("fill-opacity"),dt.stroke=v.getAttribute("stroke"),dt.stroke_opacity=v.getAttribute("stroke-opacity"),dt.stroke_width=v.getAttribute("stroke-width"),dt.stroke_dasharray=v.getAttribute("stroke-dasharray"),dt.stroke_linejoin=v.getAttribute("stroke-linejoin"),dt.stroke_linecap=v.getAttribute("stroke-linecap")}"text"===v.tagName&&(Me.font_size=v.getAttribute("font-size"),Me.font_family=v.getAttribute("font-family")),B.requestSelector(v).showGrips(!0)}if(Ct(),f!==Lt||p!==Mt)for(var y=S.length,_=0;_<y&&!ut(S[_]);++_)S[_].firstChild||B.requestSelector(S[_]).resize();else r=e.target,"path"===S[0].nodeName&&ut(S[1])?P.select(S[0]):e.shiftKey&&t!==r&&l.removeFromSelection([r]);if(X()){var b=S[0];b&&(b.removeAttribute("style"),Be(b,(function(e){e.removeAttribute("style")})))}}return;case"zoom":ut(ft)||ft.setAttribute("display","none");var x=e.shiftKey?.5:2;return void W("zoomed",{x:Math.min(Lt,f),y:Math.min(Mt,p),width:Math.abs(f-Lt),height:Math.abs(p-Mt),factor:x});case"fhpath":Vt=0,Rt={x:0,y:0},Bt={x:0,y:0},Ut={x:0,y:0},Ft={x:0,y:0};var k=d.getAttribute("points"),A=k.indexOf(",");(h=A>=0?k.includes(",",A+1):k.includes(" ",k.indexOf(" ")+1))&&(d=P.smoothPolylineIntoPath(d));break;case"line":n=mr(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=mr(d).attr(["width","height"]),h=n.width||n.height||"image"===Je;break;case"circle":h="0"!==d.getAttribute("r");break;case"ellipse":n=mr(d).attr(["rx","ry"]),h=n.rx||n.ry;break;case"fhellipse":Pt.maxx-Pt.minx>0&&Pt.maxy-Pt.miny>0&&(d=C({element:"ellipse",curStyles:!0,attr:{cx:(Pt.minx+Pt.maxx)/2,cy:(Pt.miny+Pt.maxy)/2,rx:(Pt.maxx-Pt.minx)/2,ry:(Pt.maxy-Pt.miny)/2,id:q()}}),W("changed",[d]),h=!0);break;case"fhrect":Pt.maxx-Pt.minx>0&&Pt.maxy-Pt.miny>0&&(d=C({element:"rect",curStyles:!0,attr:{x:Pt.minx,y:Pt.miny,width:Pt.maxx-Pt.minx,height:Pt.maxy-Pt.miny,id:q()}}),W("changed",[d]),h=!0);break;case"text":h=!0,Gt([d]),Zt.start(d);break;case"path":d=null,Ze=!0;var E=P.mouseUp(e,d,i,s);d=E.element,h=E.keep;break;case"pathedit":h=!0,d=null,P.mouseUp(e);break;case"textedit":h=!1,d=null,Zt.mouseUp(e,i,s);break;case"rotate":h=!0,d=null,Je="select";var G=l.undoMgr.finishUndoableChange();G.isEmpty()||O(G),Ct(),W("changed",S)}var N=mt("mouseUp",{event:e,mouse_x:i,mouse_y:s},!0);if(mr.each(N,(function(e,t){t&&(h=t.keep||h,d=t.element,Ze=t.started||Ze)})),h||ut(d)){if(!ut(d)){l.addedNew=!0;var I,T=.2;if(de.beginElement&&Number.parseFloat(d.getAttribute("opacity"))!==w.opacity){I=mr(de).clone().attr({to:w.opacity,dur:T}).appendTo(d);try{I[0].beginElement()}catch(e){}}else T=0;setTimeout((function(){I&&I.remove(),d.setAttribute("opacity",w.opacity),d.setAttribute("style","pointer-events:inherit"),st(d),"path"===Je?P.toEditMode(d):o.selectNew&&Gt([d],!0),O(new yr(d)),W("changed",[d])}),1e3*T)}}else{for(g().releaseId(q()),d.remove(),d=null,r=e.target;r&&r.parentNode&&r.parentNode.parentNode&&"g"===r.parentNode.parentNode.tagName;)r=r.parentNode;"path"===Je&&Qt||!r||!r.parentNode||"selectorParentGroup"===r.parentNode.id||"svgcanvas"===r.id||"svgroot"===r.id||(l.setMode("select"),Gt([r],!0))}$e=null}}})),mr(a).bind("mousewheel DOMMouseScroll",(function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;Et=mr("#svgcontent g")[0].getScreenCTM().inverse();var n=mr("#workarea"),r=o.showRulers?16:0,a=fe(t.pageX,t.pageY,Et),i=n.width(),s=n.height(),c=i-15-r,u=s-15-r,d=c*Et.a,h=u*Et.d,f=n.offset(),p=f.left+r,g=f.top+r,v=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(v){var y,_,b=Math.max(3/4,Math.min(4/3,v));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)))!==m){b=x/m;var w=fe(p,g,Et),S={x:(a.x-(a.x-w.x)/b)*x-r+i/2,y:(a.y-(a.y-w.y)/b)*x-r+s/2};l.setZoom(x),mr("#zoom").val((100*x).toFixed(1)),W("updateCanvas",{center:!1,newCtr:S}),W("zoomDone")}}}}));var Kt,Zt=l.textActions=function(){var e,t,n,r,a,i,o,s,c,d,h=[];function f(e){var o=""===t.value;if(mr(t).focus(),!arguments.length)if(o)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var s=h[e];o||t.setSelectionRange(e,e),(n=it("text_cursor"))||(n=document.createElementNS(_.SVG,"line"),ot(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=it("selectorParentGroup").appendChild(n)),a||(a=setInterval((function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")}),600));var l=x(s.x,i.y),c=x(s.x,i.y+i.height);ot(n,{x1:l.x,y1:l.y,x2:c.x,y2:c.y,visibility:"visible",display:"inline"}),r&&r.setAttribute("d","")}function p(e,a,o){if(e!==a){o||t.setSelectionRange(e,a),(r=it("text_selectblock"))||(r=document.createElementNS(_.SVG,"path"),ot(r,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),it("selectorParentGroup").append(r));var s=h[e],l=h[a];n.setAttribute("visibility","hidden");var c=x(s.x,i.y),u=x(s.x+(l.x-s.x),i.y),d=x(s.x,i.y+i.height),p=x(s.x+(l.x-s.x),i.y+i.height),g="M"+c.x+","+c.y+" L"+u.x+","+u.y+" "+p.x+","+p.y+" "+d.x+","+d.y+"z";ot(r,{d:g,display:"inline"})}else f(a)}function g(t,n){var r=u.createSVGPoint();if(r.x=t,r.y=n,1===h.length)return 0;var a=e.getCharNumAtPosition(r);a<0?(a=h.length-2,t<=h[0].x&&(a=0)):a>=h.length-2&&(a=h.length-2);var i=h[a];return t>i.x+i.width/2&&a++,a}function v(e,t){f(g(e,t))}function y(e,n,r){var a=t.selectionStart,i=g(e,n);p(Math.min(a,i),Math.max(a,i),!r)}function b(e,t){var n={x:e,y:t};if(n.x/=m,n.y/=m,o){var r=fe(n.x,n.y,o.inverse());n.x=r.x,n.y=r.y}return n}function x(e,t){var n={x:e,y:t};if(o){var r=fe(n.x,n.y,o);n.x=r.x,n.y=r.y}return n.x*=m,n.y*=m,n}function w(t){p(0,e.textContent.length),mr(this).unbind(t)}function k(t){if(d&&e){var n=fe(t.pageX,t.pageY,Et),r=b(n.x*m,n.y*m),a=g(r.x,r.y),i=e.textContent,o=i.substr(0,a).replace(/[a-z\d]+$/i,"").length,s=i.substr(a).match(/^[a-z\d]+/i);p(o,(s?s[0].length:0)+a),mr(t.target).click(w),setTimeout((function(){mr(t.target).unbind("click",w)}),300)}}return{select:function(t,n,r){e=t,Zt.toEditMode(n,r)},start:function(t){e=t,Zt.toEditMode()},mouseDown:function(e,n,r,a){var i=b(r,a);t.focus(),v(i.x,i.y),s=r,c=a},mouseMove:function(e,t){var n=b(e,t);y(n.x,n.y)},mouseUp:function(t,n,r){var a=b(n,r);y(a.x,a.y,!0),t.target!==e&&n<s+2&&n>s-2&&r<c+2&&r>c-2&&Zt.toSelectMode(!0)},setCursor:f,toEditMode:function(t,n){if(d=!1,Je="textedit",B.requestSelector(e).showGrips(!1),B.requestSelector(e),Zt.init(),mr(e).css("cursor","text"),arguments.length){var r=b(t,n);v(r.x,r.y)}else f();setTimeout((function(){d=!0}),300)},toSelectMode:function(i){Je="select",clearInterval(a),a=null,r&&mr(r).attr("display","none"),n&&mr(n).attr("visibility","hidden"),mr(e).css("cursor","move"),i&&(Y(),mr(e).css("cursor","move"),W("selected",[e]),Q([e],!0)),e&&!e.textContent.length&&l.deleteSelectedElements(),mr(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===Je&&Zt.toSelectMode()},init:function(n){if(e){var r,a;e.parentNode||(e=S[0],B.requestSelector(e).showGrips(!1));var s=e.textContent.length,c=e.getAttribute("transform");for(i=We(e),o=c?_e(e):null,(h=[]).length=s,t.focus(),mr(e).unbind("dblclick",k).dblclick(k),s||(a={x:i.x+i.width/2,width:0}),r=0;r<s;r++){var u=e.getStartPositionOfChar(r);if(a=e.getEndPositionOfChar(r),!j){var d=l.contentW*m;u.x-=d,a.x-=d,u.x/=m,a.x/=m}h[r]={x:u.x,y:i.y,width:a.x-u.x,height:i.height}}h.push({x:a.x,width:0}),p(t.selectionStart,t.selectionEnd,!0)}}}}(),$t=this.removeUnusedDefElems=function(){var e=d.getElementsByTagNameNS(_.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=d.getElementsByTagNameNS(_.SVG,"*"),l=s.length;for(t=0;t<l;t++){var c=s[t];for(n=0;n<o;n++){var u=De(c.getAttribute(i[n]));u&&r.push(u.substr(1))}var h=Ue(c);h&&h.startsWith("#")&&r.push(h.substr(1))}var f=mr(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");for(t=f.length;t--;){var p=f[t],g=p.id;r.includes(g)||(qe[g]=p,p.remove(),a++)}return a};function Jt(){Y();var e=[],t=[],n={feGaussianBlur:ne.exportNoBlur,foreignObject:ne.exportNoforeignObject,"[stroke-dasharray]":ne.exportNoDashArray},r=mr(d);return"font"in mr("<canvas>")[0].getContext("2d")||(n.text=ne.exportNoText),mr.each(n,(function(n,a){r.find(n).length&&(t.push(n),e.push(a))})),{issues:e,issueCodes:t}}this.svgCanvasToString=function(){for(;$t()>0;);P.clear(!0),mr.each(d.childNodes,(function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&d.firstChild.before(t)})),y&&(Qn(),Gt([y]));var e=[];mr(d).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),mr(this).replaceWith(a)}}));var t=this.svgToString(d,0);return e.length&&mr(e).each((function(){xt(this)})),t},this.svgToString=function(e,t){var n=[],r=o.baseUnit,a=new RegExp("^-?[\\d\\.]+"+r+"$");if(e){st(e);var i=p(e.attributes),s=e.childNodes;i.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=on();"px"!==r&&(c.w=le(c.w,r)+r,c.h=le(c.h,r)+r),n.push(' width="'+c.w+'" height="'+c.h+'" xmlns="'+_.SVG+'"');var u={};mr(e).find("*").andSelf().each((function(){var e=this.namespaceURI;e&&!u[e]&&L[e]&&"xmlns"!==L[e]&&"xml"!==L[e]&&(u[e]=!0,n.push(" xmlns:"+L[e]+'="'+e+'"')),mr.each(this.attributes,(function(e,t){var r=t.namespaceURI;r&&!u[r]&&"xmlns"!==L[r]&&"xml"!==L[r]&&(u[r]=!0,n.push(" xmlns:"+L[r]+'="'+r+'"'))}))}));for(var d=i.length,h=["width","height","xmlns","x","y","viewBox","id","overflow"];d--;){var f=i[d],g=Pe(f.value);f.nodeName.startsWith("xmlns:")||(""===g||h.includes(f.localName)||f.namespaceURI&&!L[f.namespaceURI]||(n.push(" "),n.push(f.nodeName),n.push('="'),n.push(g),n.push('"')))}}else{if("defs"===e.nodeName&&!e.firstChild)return"";for(var m=["-moz-math-font-style","_moz-math-font-style"],v=i.length-1;v>=0;v--){var y=i[v],b=Pe(y.value);if(!m.includes(y.localName)){if("null"===b){var x=y.localName.replace(/-[a-z]/g,(function(e){return e[1].toUpperCase()}));if(Object.prototype.hasOwnProperty.call(e.style,x))continue}if(""!==b){if(b.startsWith("pointer-events"))continue;if("class"===y.localName&&b.startsWith("se_"))continue;if(n.push(" "),"d"===y.localName&&(b=P.convertPath(e,!0)),isNaN(b)?a.test(b)&&(b=se(b)+r):b=se(b),ke.apply&&"image"===e.nodeName&&"href"===y.localName&&ke.images&&"embed"===ke.images){var w=Se[b];w&&(b=w)}y.namespaceURI&&y.namespaceURI!==_.SVG&&!L[y.namespaceURI]||(n.push(y.nodeName),n.push('="'),n.push(b),n.push('"'))}}}}if(e.hasChildNodes()){n.push(">"),t++;for(var S=!1,k=0;k<s.length;k++){var C=s.item(k);switch(C.nodeType){case 1:n.push("\n"),n.push(this.svgToString(C,t));break;case 3:var A=C.nodeValue.replace(/^\s+|\s+$/g,"");""!==A&&(S=!0,n.push(String(Pe(A))));break;case 4:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("<![CDATA["),n.push(C.nodeValue),n.push("]]>");break;case 8:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("\x3c!--"),n.push(C.data),n.push("--\x3e")}}if(t--,!S){n.push("\n");for(var E=0;E<t;E++)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){mr(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"),Se[e]=s}catch(t){Se[e]=!1}Xe=e,t(Se[e])}else n(new Error("Error loading image: "+i.status+" "+i.statusText))})).attr("src",e)}))},this.setGoodImage=function(e){Xe=e},this.open=function(){},this.save=function(e){Y(),e&&mr.extend(ke,e),ke.apply=!0;var t=this.svgCanvasToString();W("saved",t)},this.rasterExport=function(){var e=n(regeneratorRuntime.mark((function e(t,n,r){var a,i,s,c,u,d,h,f,p,g=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=g.length>3&&void 0!==g[3]?g[3]:{},s="image/"+(i="ICO"===t?"BMP":t||"PNG").toLowerCase(),c=Jt(),u=c.issues,d=c.issueCodes,h=this.svgCanvasToString(),Kt){e.next=10;break}return e.next=8,vt(o.canvgPath+"canvg.js",{global:"canvg"});case 8:f=e.sent,Kt=f.canvg;case 10:return mr("#export_canvas").length||mr("<canvas>",{id:"export_canvas"}).hide().appendTo("body"),(p=mr("#export_canvas")[0]).width=l.contentW,p.height=l.contentH,e.next=16,Kt(p,h);case 16:return e.abrupt("return",new Promise((function(e,o){var l,c=i.toLowerCase(),f=n?p.toDataURL("image/"+c,n):p.toDataURL("image/"+c);function g(){var i={datauri:f,bloburl:l,svg:h,issues:u,issueCodes:d,type:t,mimeType:s,quality:n,exportWindowName:r};a.avoidEvent||W("exported",i),e(i)}p.toBlob?p.toBlob((function(e){l=je(e),g()}),s,n):(l=Oe(f),g())})));case 17:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),this.exportPDF=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,a,i,s,l,c,u,d,h,f,p,g=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=g.length>1&&void 0!==g[1]?g[1]:H()?"save":void 0,window.jsPDF){e.next=7;break}return e.next=4,_t(["jspdf/underscore-min.js","../../svgedit-myfix/editor/jspdf/jspdf-1.0.150.debug.js"]);case 4:return r=!("svgEditor"in window)||!window.svgEditor||!1!==window.svgEditor.modules,e.next=7,_t(o.jspdfPath+"jspdf.plugin.svgToPdf.js",{type:r?"module":"text/javascript"});case 7:return a=on(),i=a.w>a.h?"landscape":"portrait",s="pt",l=jsPDF({orientation:i,unit:s,format:[a.w,a.h]}),c=sn(),l.setProperties({title:c}),u=Jt(),d=u.issues,h=u.issueCodes,f=this.svgCanvasToString(),l.addSVG(f,0,0),(p={svg:f,issues:d,issueCodes:h,exportWindowName:t,outputType:n=n||"dataurlstring"}).output=l.output(n,"save"===n?t||"svg.pdf":void 0),W("exportedPDF",p),e.abrupt("return",p);case 21:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),this.getSvgString=function(){return ke.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){Vn(!(arguments.length>0&&!1===e),g())};var en=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var r in Be(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),mr.each(ae,(function(n,r){var a=e.getAttributeNode(r);if(a){var i=De(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=Ue(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=D();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];Fe(d,"#"+i)}}}},tn=this.setUseData=function(e){var t=mr(e);"use"!==e.tagName&&(t=t.find("use")),t.each((function(){var e=Ue(this).substr(1),t=it(e);t&&(mr(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||mr(this).data("symbol",t).data("ref",t))}))},nn=this.convertGradients=function(e){var t=mr(e).find("linearGradient, radialGradient");!t.length&&U()&&(t=mr(e).find("*").filter((function(){return this.tagName.includes("Gradient")}))),t.each((function(){if("userSpaceOnUse"===mr(this).attr("gradientUnits")){var e=mr(d).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=We(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=mr(this).attr(["x1","y1","x2","y2"]),r=this.gradientTransform.baseVal;if(r&&r.numberOfItems>0){var a=ye(r).matrix,i=fe(n.x1,n.y1,a),o=fe(n.x2,n.y2,a);n.x1=i.x,n.y1=i.y,n.x2=o.x,n.y2=o.y,this.removeAttribute("gradientTransform")}mr(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")}}}))},rn=this.convertToGroup=function(e){e||(e=S[0]);var t,n=mr(e),r=new xr;if(n.data("gsvg")){var a=e.firstChild,i=mr(a).attr(["x","y"]);mr(e.firstChild.firstChild).unwrap(),mr(e).removeData("gsvg");var o=te(e),s=u.createSVGTransform();s.setTranslate(i.x,i.y),o.appendItem(s),dr(e),W("selected",[e])}else if(n.data("symbol")){e=n.data("symbol"),t=n.attr("transform");var l=n.attr(["x","y"]),h=e.getAttribute("viewBox");if(h){var f=h.split(" ");l.x-=Number(f[0]),l.y-=Number(f[1])}t+=" translate("+(l.x||0)+","+(l.y||0)+")";var p=n.prev();r.addSubCommand(new _r(n[0],n[0].nextSibling,n[0].parentNode)),n.remove();var g,m=mr(d).find("use:data(symbol)").length,v=c.createElementNS(_.SVG,"g"),y=e.childNodes;for(g=0;g<y.length;g++)v.append(y[g].cloneNode(!0));if(F()){var b=mr(ze()).children("linearGradient,radialGradient,pattern").clone();mr(v).append(b)}t&&v.setAttribute("transform",t);var x=e.parentNode;if(en(v),F()&&mr(ze()).append(mr(v).find("linearGradient,radialGradient,pattern")),v.id=D(),p.after(v),x){if(!m){var w=e.nextSibling;e.remove(),r.addSubCommand(new _r(e,w,x))}r.addSubCommand(new yr(v))}tn(v),F()?nn(ze()):nn(v),function(e,t){if(e&&1===e.nodeType){for(var n=e.childNodes.length;n--;)Be(e.childNodes.item(n),t);t(e)}}(v,(function(e){try{dr(e)}catch(e){console.log(e)}})),mr(v).find(re).each((function(){this.id||(this.id=D())})),Gt([v]);var k=gn(v,!0);k&&r.addSubCommand(k),O(r)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e,t){try{var n=Re(e);if(n.firstElementChild&&n.firstElementChild.namespaceURI!==_.SVG)return!1;this.prepareSvg(n);var r=new xr("Change Source"),a=d.nextSibling;d.remove();var i=d;r.addSubCommand(new _r(i,a,u)),d=c.adoptNode?c.adoptNode(n.documentElement):c.importNode(n.documentElement,!0),u.append(d);var s=mr(d);l.current_drawing_=new jn(d,h);var f=g().getNonce();f?W("setnonce",f):W("unsetnonce"),s.find("image").each((function(){var e=this;ct(e);var t=Ue(this);if(t){if(t.startsWith("data:")){var n=t.match(/svgedit_url=(.*?);/);if(n){var r=decodeURIComponent(n[1]);mr(new Image).load((function(){e.setAttributeNS(_.XLINK,"xlink:href",r)})).attr("src",r)}}l.embedImage(t)}})),s.find("svg").each((function(){if(!mr(this).closest("defs").length){en(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?(mr(e).data("gsvg",this),e.id=e.id||D()):xt(this)}})),F()&&s.find("linearGradient, radialGradient, pattern").appendTo(ze()),tn(s),nn(s[0]);var p={id:"svgcontent",overflow:o.show_outside_canvas?"visible":"hidden"},v=!1;if(s.attr("viewBox")){var y=s.attr("viewBox").split(" ");p.width=y[2],p.height=y[3]}else mr.each(["width","height"],(function(e,t){var n=s.attr(t)||"100%";"%"===String(n).substr(-1)?v=!0:p[t]=ue(t,n)}));if(Rn(),s.children().find(re).each((function(){this.id||(this.id=D())})),v){var b=tt();p.width=b.width+b.x,p.height=b.height+b.y}p.width<=0&&(p.width=100),p.height<=0&&(p.height=100),s.attr(p),this.contentW=p.width,this.contentH=p.height,r.addSubCommand(new yr(d));var x=s.attr(["width","height"]);r.addSubCommand(new br(u,x)),m=1,$={},Y(),zt={},u.append(B.selectorParentGroup),t||O(r),W("changed",[d])}catch(e){return console.log(e),!1}return!0},this.importSvgString=function(e){var t,n,r;try{var a=Ie(e.length+e).substr(0,32),i=!1;Le[a]&&mr(Le[a].symbol).parents("#svgroot").length&&(i=!0);var o,s=new xr("Import Image");if(i)o=Le[a].symbol,n=Le[a].xform;else{var l,u=Re(e);this.prepareSvg(u),l=c.adoptNode?c.adoptNode(u.documentElement):c.importNode(u.documentElement,!0),en(l);var h=ue("width",l.getAttribute("width")),f=ue("height",l.getAttribute("height")),p=l.getAttribute("viewBox"),m=p?p.split(" "):[0,0,h,f];for(t=0;t<4;++t)m[t]=Number(m[t]);var b=Number(d.getAttribute("height"));n="translate(0) "+(n=f>h?"scale("+b/3/m[3]+")":"scale("+b/3/m[2]+")")+" translate(0)",o=c.createElementNS(_.SVG,"symbol");var x=ze();for(F()&&mr(l).find("linearGradient, radialGradient, pattern").appendTo(x);l.firstChild;){var w=l.firstChild;o.append(w)}var S,k=v(l.attributes);try{for(k.s();!(S=k.n()).done;){var C=S.value;o.setAttribute(C.nodeName,C.value)}}catch(e){k.e(e)}finally{k.f()}o.id=D(),Le[a]={symbol:o,xform:n},ze().append(o),s.addSubCommand(new yr(o))}(r=c.createElementNS(_.SVG,"use")).id=D(),Fe(r,"#"+o.id),(y||g().getCurrentLayer()).append(r),s.addSubCommand(new yr(r)),Y(),r.setAttribute("transform",n),dr(r),mr(r).data("symbol",o).data("ref",o),Q([r]),O(s),W("changed",[d])}catch(e){return console.log(e),null}return r};var an={identifyLayers:Rn,createLayer:Bn,cloneLayer:Dn,deleteCurrentLayer:Un,setCurrentLayer:Fn,renameCurrentLayer:zn,setCurrentLayerPosition:Hn,setLayerVisibility:qn,moveSelectedToLayer:Wn,mergeLayer:Xn,mergeAllLayers:Yn,leaveContext:Qn,setContext:Kn};Object.entries(an).forEach((function(e){var t=f(e,2),n=t[0],r=t[1];l[n]=r})),function(e){On=e}({pathActions:P,getCurrentGroup:function(){return y},setCurrentGroup:function(e){y=e},getSelectedElements:N,getSVGContent:G,undoMgr:M,elData:ce,getCurrentDrawing:g,clearSelection:Y,call:W,addCommandToHistory:O,changeSVGContent:function(){W("changed",[d])}}),this.clear=function(){P.clear(),Y(),l.clearSvgContentElement(),l.current_drawing_=new jn(d),l.createLayer("Layer 1"),l.undoMgr.resetUndoStack(),B.initGroup(),ft=B.getRubberBandBox(),W("cleared")},this.linkControlPoints=P.linkControlPoints,this.getContentElem=function(){return d},this.getRootElem=function(){return u};var on=this.getResolution=function(){return{w:d.getAttribute("width")/m,h:d.getAttribute("height")/m,zoom:m}};this.getSnapToGrid=function(){return o.gridSnapping},this.getVersion=function(){return"svgcanvas.js ($Rev$)"},this.setUiStrings=function(e){Object.assign(ne,e.notification),mr=wt(mr,e.common),Dt(e)},this.setConfig=function(e){Object.assign(o,e)},this.getTitle=function(e){if(e=e||S[0]){var t,n=v((e=mr(e).data("gsvg")||mr(e).data("symbol")||e).childNodes);try{for(n.s();!(t=n.n()).done;){var r=t.value;if("title"===r.nodeName)return r.textContent}}catch(e){n.e(e)}finally{n.f()}return""}},this.setGroupTitle=function(e){var t=S[0];t=mr(t).data("gsvg")||t;var n,r=mr(t).children("title"),a=new xr("Set Label");if(e.length)r.length?(n=r[0],a.addSubCommand(new br(n,{"#text":n.textContent})),n.textContent=e):((n=c.createElementNS(_.SVG,"title")).textContent=e,mr(t).prepend(n),a.addSubCommand(new yr(n)));else{var i=r.nextSibling;a.addSubCommand(new _r(r[0],i,t)),r.remove()}O(a)};var sn=this.getDocumentTitle=function(){return l.getTitle(d)};this.setDocumentTitle=function(e){var t,n=d.childNodes,r=!1,a="",i=new xr("Change Image Title"),o=v(n);try{for(o.s();!(t=o.n()).done;){var s=t.value;if("title"===s.nodeName){a=(r=s).textContent;break}}}catch(e){o.e(e)}finally{o.f()}r||(r=c.createElementNS(_.SVG,"title"),d.insertBefore(r,d.firstChild)),e.length?r.textContent=e:r.remove(),i.addSubCommand(new br(r,{"#text":a})),O(i)},this.getEditorNS=function(e){return e&&d.setAttribute("xmlns:se",_.SE),_.SE},this.setResolution=function(e,t){var n,r=on(),a=r.w,i=r.h;if("fit"===e){var o=tt();if(!o)return!1;n=new xr("Fit Canvas to Content");var s=et();Q(s);var c=[],u=[];mr.each(s,(function(e,t){c.push(-1*o.x),u.push(-1*o.y)}));var h=l.moveSelectedElements(c,u,!0);n.addSubCommand(h),Y(),e=Math.round(o.width),t=Math.round(o.height)}return e===a&&t===i||(n||(n=new xr("Change Image Dimensions")),e=ue("width",e),t=ue("height",t),d.setAttribute("width",e),d.setAttribute("height",t),this.contentW=e,this.contentH=t,n.addSubCommand(new br(d,{width:a,height:i})),d.setAttribute("viewBox",[0,0,e/m,t/m].join(" ")),n.addSubCommand(new br(d,{viewBox:["0 0",a,i].join(" ")})),O(n),W("changed",[d])),!0},this.getOffset=function(){return mr(d).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 l.setZoom(o),{zoom:o,bbox:e}};if("object"===e(t)){if(0===(a=t).width||0===a.height){var s=a.zoom?a.zoom:m*a.factor;return l.setZoom(s),{zoom:m,bbox:a}}return o(a)}switch(t){case"selection":if(!S[0])return;var c=mr.map(S,(function(e){if(e)return e}));a=tt(c);break;case"canvas":var u=on();i=.95,a={width:u.w,height:u.h,x:0,y:0};break;case"content":a=tt();break;case"layer":a=tt(et(g().getCurrentLayer()));break;default:return}return o(a)},this.setZoom=function(e){var t=on();d.setAttribute("viewBox","0 0 "+t.w/e+" "+t.h/e),m=e,mr.each(S,(function(e,t){t&&B.requestSelector(t).resize()})),P.zoomChange(),mt("zoomChanged",e)},this.getMode=function(){return Je},this.setMode=function(e){P.clear(!0),Zt.clear(),dt=S[0]&&"text"===S[0].nodeName?Me:w,Je=e},this.getColor=function(e){return dt[e]},this.setColor=function(e,t,n){w[e]=t,dt[e+"_paint"]={type:"solidColor"};var r=[];function a(e){"g"!==e.nodeName&&r.push(e)}for(var i=S.length;i--;){var o=S[i];o&&("g"===o.tagName?Be(o,a):"fill"===e?"polyline"!==o.tagName&&"line"!==o.tagName&&r.push(o):r.push(o))}r.length>0&&(n?dn(e,t,r):(hn(e,t,r),W("changed",r)))};var ln=this.setGradient=function(e){if(dt[e+"_paint"]&&"solidColor"!==dt[e+"_paint"].type){var t=l[e+"Grad"],n=un(t),r=ze();n?t=n:(t=r.appendChild(c.importNode(t,!0))).id=D(),l.setColor(e,"url(#"+t.id+")")}},un=function(e){for(var t=ze(),n=mr(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=mr(e).attr(a),n=mr(i).attr(a),r=!1;if(mr.each(a,(function(e,a){t[a]!==n[a]&&(r=!0)})),r)return"continue"}())continue;var o=e.getElementsByTagNameNS(_.SVG,"stop"),s=i.getElementsByTagNameNS(_.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 mr.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),dt[e+"_paint"]=n,n.type){case"solidColor":this.setColor(e,"none"!==n.solidColor?"#"+n.solidColor:"none");break;case"linearGradient":case"radialGradient":l[e+"Grad"]=n[n.type],ln(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return dt.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(Je))l.setStrokeWidth(1);else{dt.stroke_width=e;for(var t=[],n=S.length;n--;){var r=S[n];r&&("g"===r.tagName?Be(r,a):t.push(r))}t.length>0&&(hn("stroke-width",e,t),W("changed",S))}function a(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){w[e.replace("-","_")]=t;for(var n=[],r=S.length;r--;){var a=S[r];a&&("g"===a.tagName?Be(a,(function(e){"g"!==e.nodeName&&n.push(e)})):n.push(a))}n.length>0&&(hn(e,t,n),W("changed",S))},this.getStyle=function(){return w},this.getOpacity=K,this.setOpacity=function(e){w.opacity=e,hn("opacity",e)},this.getFillOpacity=function(){return w.fill_opacity},this.getStrokeOpacity=function(){return w.stroke_opacity},this.setPaintOpacity=function(e,t,n){w[e+"_opacity"]=t,n?dn(e+"-opacity",t):hn(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=it(e.id+"_blur");n&&(t=n.firstChild.getAttribute("stdDeviation"))}return t},function(){var e=null,t=null,n=!1;function r(){var n=l.undoMgr.finishUndoableChange();e.addSubCommand(n),O(e),e=null,t=null}l.setBlurNoUndo=function(e){if(t)if(0===e)dn("filter",""),n=!0;else{var r=S[0];n&&dn("filter","url(#"+r.id+"_blur)"),U()&&(r.removeAttribute("filter"),r.setAttribute("filter","url(#"+r.id+"_blur)")),dn("stdDeviation",e,[t.firstChild]),l.setBlurOffsets(t,e)}else l.setBlur(e)},l.setBlurOffsets=function(e,t){t>3?ot(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"}):U()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},l.setBlur=function(n,a){if(e)r();else{var i=S[0],o=i.id;t=it(o+"_blur"),n-=0;var s=new xr;if(t)0===n&&(t=null);else{var c=C({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=C({element:"filter",attr:{id:o+"_blur"}})).append(c),ze().append(t),s.addSubCommand(new yr(t))}var u={filter:i.getAttribute("filter")};if(0===n)return i.removeAttribute("filter"),void s.addSubCommand(new br(i,u));hn("filter","url(#"+o+"_blur)"),s.addSubCommand(new br(i,u)),l.setBlurOffsets(t,n),e=s,l.undoMgr.beginUndoableChange("stdDeviation",[t?t.firstChild:null]),a&&(l.setBlurNoUndo(n),r())}}}(),this.getBold=function(){var e=S[0];return!(ut(e)||"text"!==e.tagName||!ut(S[1]))&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=S[0];!ut(t)&&"text"===t.tagName&&ut(S[1])&&hn("font-weight",e?"bold":"normal"),S[0].textContent||Zt.setCursor()},this.getItalic=function(){var e=S[0];return!(ut(e)||"text"!==e.tagName||!ut(S[1]))&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=S[0];!ut(t)&&"text"===t.tagName&&ut(S[1])&&hn("font-style",e?"italic":"normal"),S[0].textContent||Zt.setCursor()},this.getFontFamily=function(){return Me.font_family},this.setFontFamily=function(e){Me.font_family=e,hn("font-family",e),S[0]&&!S[0].textContent&&Zt.setCursor()},this.setFontColor=function(e){Me.fill=e,hn("fill",e)},this.getFontColor=function(){return Me.fill},this.getFontSize=function(){return Me.font_size},this.setFontSize=function(e){Me.font_size=e,hn("font-size",e),S[0].textContent||Zt.setCursor()},this.getText=function(){var e=S[0];return ut(e)?"":e.textContent},this.setTextContent=function(e){hn("#text",e),Zt.init(e),Zt.setCursor()},this.setImageURL=function(e){var t=S[0];if(t){var n=mr(t).attr(["width","height"]),r=!n.width||!n.height,a=Ue(t);if(a!==e||r){var i=new xr("Change Image URL");Fe(t,e),i.addSubCommand(new br(t,{"#href":a})),mr(new Image).load((function(){var e=mr(t).attr(["width","height"]);mr(t).attr({width:this.width,height:this.height}),B.requestSelector(t).resize(),i.addSubCommand(new br(t,e)),O(i),W("changed",[t])})).attr("src",e)}}},this.setLinkURL=function(e){var t=S[0];if(t){if("a"!==t.tagName){var n=mr(t).parents("a");if(!n.length)return;t=n[0]}var r=Ue(t);if(r!==e){var a=new xr("Change Link URL");Fe(t,e),a.addSubCommand(new br(t,{"#href":r})),O(a)}}},this.setRectRadius=function(e){var t=S[0];if(!ut(t)&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),O(new br(t,{rx:n,ry:n},"Radius")),W("changed",[t]))}},this.makeHyperlink=function(e){l.groupSelectedElements("a",e)},this.removeHyperlink=function(){l.ungroupSelectedElement()},this.setSegType=function(e){P.setSegType(e)},this.convertToPath=function(e,t){if(!ut(e))return t?Ke(e,C,P):function(e,t,n,r,a,i,o,s){var l=new o.BatchCommand("Convert element to Path"),c=n({element:"path",attr:t=we.extend({},t,Qe(e))}),u=e.getAttribute("transform");u&&c.setAttribute("transform",u);var d=e.id,h=e.parentNode;e.nextSibling?e.before(c):h.append(c);var f=Ye(e);if(f){if(c.setAttribute("d",f),u){var p=te(c);me(p)&&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:w.fill,"fill-opacity":w.fill_opacity,stroke:w.stroke,"stroke-width":w.stroke_width,"stroke-dasharray":w.stroke_dasharray,"stroke-linejoin":w.stroke_linejoin,"stroke-linecap":w.stroke_linecap,"stroke-opacity":w.stroke_opacity,opacity:w.opacity,visibility:"hidden"},C,P,Y,Q,jt,O);var n=S;mr.each(n,(function(e,t){t&&l.convertToPath(t)}))};var dn=function(e,t,n){"pathedit"===Je&&P.moveNode(e,t);for(var r=(n=n||S).length,a=["g","polyline","path"],i=function(){var i=n[r];if(ut(i))return"continue";if(("x"===e||"y"===e)&&a.includes(i.tagName)){var o=tt([i]),s="x"===e?t-o.x:0,c="y"===e?t-o.y:0;return l.moveSelectedElements(s*m,c*m,!0),"continue"}var d="#text"===e?i.textContent:i.getAttribute(e);if(ut(d)&&(d=""),d!==String(t)){"#text"===e?(i.textContent=t,/rotate/.test(i.getAttribute("transform"))&&(i=kt(i))):"#href"===e?Fe(i,t):i.setAttribute(e,t),"textedit"===Je&&"#text"!==e&&i.textContent.length&&Zt.toSelectMode(i),F()&&"text"===i.nodeName&&/rotate/.test(i.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&i.textContent)&&(i=kt(i)),S.includes(i)&&setTimeout((function(){i.parentNode&&B.requestSelector(i).resize()}),0);var h=rt(i);if(0!==h&&"transform"!==e)for(var f=te(i),p=f.numberOfItems;p--;){if(4===f.getItem(p).type){f.removeItem(p);var g=We(i),v=fe(g.x+g.width/2,g.y+g.height/2,ye(f).matrix),y=v.x,_=v.y,b=u.createSVGTransform();b.setRotate(h,y,_),f.insertItemBefore(b,p);break}}}};r--;)i()},hn=this.changeSelectedAttribute=function(e,t,n){n=n||S,l.undoMgr.beginUndoableChange(e,n),dn(e,t,n);var r=l.undoMgr.finishUndoableChange();r.isEmpty()||O(r)};this.deleteSelectedElements=function(){for(var e=new xr("Delete Elements"),t=S.length,n=[],r=0;r<t;++r){var a=S[r];if(ut(a))break;var i=a.parentNode,o=a;B.releaseSelector(o),cn(o.id),"a"===i.tagName&&1===i.childNodes.length&&(o=i,i=i.parentNode);var s=o.nextSibling;o.remove();var l=o;n.push(a),e.addSubCommand(new _r(l,s,i))}S=[],e.isEmpty()||O(e),W("changed",n),Y()},this.cutSelectedElements=function(){l.copySelectedElements(),l.deleteSelectedElements()};var fn="svgedit_clipboard";function pn(){var e=sessionStorage.getItem(fn);localStorage.setItem(fn,e),setTimeout((function(){localStorage.removeItem(fn)}),1)}window.addEventListener("storage",(function(e){e.newValue&&(e.key===fn+"_startup"?(localStorage.removeItem(fn+"_startup"),pn()):e.key===fn&&sessionStorage.setItem(fn,e.newValue))}),!1),localStorage.setItem(fn+"_startup",Math.random()),this.copySelectedElements=function(){var e=JSON.stringify(S.map((function(e){return k(e)})));sessionStorage.setItem(fn,e),pn();var t=mr("#cmenu_canvas");t.enableContextMenuItems&&t.enableContextMenuItems("#paste,#paste_in_place")},this.pasteElements=function(e,t,n){var r=JSON.parse(sessionStorage.getItem(fn));if(r){var a=r.length;if(a){var i=[],o=new xr("Paste elements"),s={};for(r.forEach((function(e){return function e(t){t.attr&&t.attr.id&&(s[t.attr.id]=D(),t.attr.id=s[t.attr.id]),t.children&&t.children.forEach((function(t){return e(t)}))}(e)})),mt("IDsUpdated",{elems:r,changes:s},!0).forEach((function(e){e&&"remove"in e&&e.remove.forEach((function(e){r=r.filter((function(t){return t.attr.id!==e}))}))}));a--;){var c=r[a];if(c){var u=C(c);i.push(u),o.addSubCommand(new yr(u)),he(u)}}if(Gt(i),"in_place"!==e){var d,h;e?"point"===e&&(d=t,h=n):(d=gt.x,h=gt.y);var f=tt(i),p=d-(f.x+f.width/2),g=h-(f.y+f.height/2),m=[],v=[];mr.each(i,(function(e,t){m.push(p),v.push(g)}));var y=l.moveSelectedElements(m,v,!1);y&&o.addSubCommand(y)}O(o),W("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 xr(r),i=C({element:e,attr:{id:D()}});"a"===e&&Fe(i,n),a.addSubCommand(new yr(i));for(var o=S.length;o--;){var s=S[o];if(!ut(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 vr(s,l,c))}}a.isEmpty()||O(a),Gt([i],!0)};var gn=this.pushGroupProperties=function(e,t){for(var n,r,a,i=e.childNodes,o=i.length,s=e.getAttribute("transform"),c=te(e),d=ye(c).matrix,h=new xr("Push group properties"),f=rt(e),p=mr(e).attr(["filter","opacity"]),m=g(),v=0;v<o;v++){var y=i[v];if(1===y.nodeType){if(null!==p.opacity&&1!==p.opacity){var _=Math.round((y.getAttribute("opacity")||1)*p.opacity*100)/100;hn("opacity",_,[y])}if(p.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=at(y.getAttribute("filter")):n?(n=m.copyElem(n),ze().append(n)):n=at(p.filter);var w="feGaussianBlur"===n.firstChild.tagName?"blur":"filter";n.id=y.id+"_"+w,hn("filter","url(#"+n.id+")",[y]),b&&(hn("stdDeviation",b,[n.firstChild]),l.setBlurOffsets(n,b))}var S=te(y);if(y.tagName.includes("Gradient")&&(S=null),S&&"defs"!==y.tagName&&c.numberOfItems){if(f&&1===c.numberOfItems){var k=c.getItem(0).matrix,C=u.createSVGMatrix(),A=rt(y);A&&(C=S.getItem(0).matrix);var E=We(y),G=ye(S).matrix,N=fe(E.x+E.width/2,E.y+E.height/2,G),P=f+A,I=u.createSVGTransform();I.setRotate(P,N.x,N.y);var T=ge(k,C,I.matrix.inverse());if(A&&S.removeItem(0),P&&(S.numberOfItems?S.insertItemBefore(I,0):S.appendItem(I)),T.e||T.f){var L=u.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=u.createSVGTransform(),j=ye(S).matrix,V=j.inverse(),R=ge(V,d,j);O.setMatrix(R),S.appendItem(O)}var B=dr(y);B&&h.addSubCommand(B)}}}if(s&&((a={}).transform=s,e.setAttribute("transform",""),e.removeAttribute("transform"),h.addSubCommand(new br(e,a))),t&&!h.isEmpty())return h};this.ungroupSelectedElement=function(){var e=S[0];if(e)if(mr(e).data("gsvg")||mr(e).data("symbol"))rn(e);else{if("use"===e.tagName){var t=it(Ue(e).substr(1));return mr(e).data("symbol",t).data("ref",t),void rn(e)}var n=mr(e).parents("a");if(n.length&&(e=n[0]),"g"===e.tagName||"a"===e.tagName){var r=new xr("Ungroup Elements"),a=gn(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)o?o.before(c):e.after(c),s[l++]=c,r.addSubCommand(new vr(c,u,d));else{var h=c.nextSibling;r.addSubCommand(new _r(c,h,d)),c.remove()}}Y();var f=e.nextSibling;e.remove(),r.addSubCommand(new _r(e,f,i)),r.isEmpty()||O(r),Q(s)}}},this.moveToTopSelectedElement=function(){var e=f(S,1)[0];if(!ut(e)){var t=e,n=t.parentNode,r=t.nextSibling;r!==(t=t.parentNode.appendChild(t)).nextSibling&&(O(new vr(t,r,n,"top")),W("changed",[t]))}},this.moveToBottomSelectedElement=function(){var e=f(S,1)[0];if(!ut(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&&(O(new vr(t,r,n,"bottom")),W("changed",[t]))}},this.moveUpDownSelected=function(e){var t=S[0];if(t){var n,r;pt=[];var a=mr(yt(tt([t]))).toArray();if("Down"===e&&a.reverse(),mr.each(a,(function(){return r?(n=this,!1):(this===t&&(r=!0),!0)})),n){var i=t,o=i.parentNode,s=i.nextSibling;mr(n)["Down"===e?"before":"after"](i),s!==i.nextSibling&&(O(new vr(i,s,o,"Move "+e)),W("changed",[i]))}}},this.moveSelectedElements=function(e,t,n){e.constructor!==Array&&(e/=m,t/=m),n=n||!0;for(var r=new xr("position"),a=S.length;a--;){var i=S[a];if(!ut(i)){var o=u.createSVGTransform(),s=te(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=dr(i);l&&r.addSubCommand(l),B.requestSelector(i).resize()}}if(!r.isEmpty())return n&&O(r),W("changed",S),r},this.cloneSelectedElements=function(e,t){var n,r,a=new xr("Clone Elements"),i=S.length;for(S.sort((function(e,t){return mr(t).index()-mr(e).index()})),n=0;n<i&&(r=S[n],!ut(r));++n);var o=S.slice(0,n);this.clearSelection(!0);var s=g();for(n=o.length;n--;)r=o[n]=s.copyElem(o[n]),(y||s.getCurrentLayer()).append(r),a.addSubCommand(new yr(r));a.isEmpty()||(Q(o.reverse()),this.moveSelectedElements(e,t,!1),O(a))},this.alignSelectedElements=function(e,t){var n=[],r=S.length;if(r){for(var a=Number.MAX_VALUE,i=Number.MIN_VALUE,o=Number.MAX_VALUE,s=Number.MIN_VALUE,c=Number.MIN_VALUE,u=Number.MIN_VALUE,d=0;d<r&&!ut(S[d]);++d){var h=S[d];switch(n[d]=tt([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,s=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,s=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>s&&(s=n[d].y+n[d].height)}}"page"===t&&(a=0,o=0,i=l.contentW,s=l.contentH);for(var f=new Array(r),p=new Array(r),g=0;g<r&&!ut(S[g]);++g){var m=n[g];switch(f[g]=0,p[g]=0,e){case"l":f[g]=a-m.x;break;case"c":f[g]=(a+i)/2-(m.x+m.width/2);break;case"r":f[g]=i-(m.x+m.width);break;case"t":p[g]=o-m.y;break;case"m":p[g]=(o+s)/2-(m.y+m.height/2);break;case"b":p[g]=s-(m.y+m.height)}}this.moveSelectedElements(f,p)}},this.contentW=on().w,this.contentH=on().h,this.updateCanvas=function(e,t){u.setAttribute("width",e),u.setAttribute("height",t);var n=mr("#canvasBackground")[0],r=d.getAttribute("x"),a=d.getAttribute("y"),i=(e-this.contentW*m)/2,o=(t-this.contentH*m)/2;ot(d,{width:this.contentW*m,height:this.contentH*m,x:i,y:o,viewBox:"0 0 "+this.contentW+" "+this.contentH}),ot(n,{width:d.getAttribute("width"),height:d.getAttribute("height"),x:i,y:o});var s=it("background_image");return s&&ot(s,{width:"100%",height:"100%"}),B.selectorParentGroup.setAttribute("transform","translate("+i+","+o+")"),mt("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=it("canvasBackground"),r=mr(n).find("rect")[0],a=it("background_image"),i=it("background_pattern");if(r.setAttribute("fill","chessboard"===e?"#fff":e),"chessboard"===e){if(!i){i=c.createElementNS(_.SVG,"foreignObject"),ot(i,{id:"background_pattern",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"});var o=document.createElement("div");ot(o,{style:"pointer-events:none;width:100%;height:100%;background-image:url(data:image/gif;base64,R0lGODlhEAAQAIAAAP///9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjG+gq4jM3IFLJgpswNly/XkcBpIiVaInlLJr9FZWAQA7);"}),i.appendChild(o),n.append(i)}}else i&&i.remove();t?(a||(a=c.createElementNS(_.SVG,"image"),ot(a,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})),Fe(a,t),n.append(a)):a&&a.remove()},this.cycleElement=function(e){var t,n=S[0],r=!1,a=et(y||g().getCurrentLayer());if(a.length){if(ut(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}Gt([r],!0),W("selected",S)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:O,BatchCommand:xr,ChangeElementCommand:br,decode64:Te,dropXMLInternalSubset:Ne,encode64:Ie,ffClone:kt,findDefs:ze,findDuplicateGradient:un,getElem:it,getPathBBox:He,getTypeMap:oe,getUrlFromAttr:De,identifyLayers:Rn,InsertElementCommand:yr,isChrome:H,isIdentity:pe,isIE:z,logMatrix:At,MoveElementCommand:vr,NS:_,preventClickDefault:ct,RemoveElementCommand:_r,SVGEditTransformList:J,text2xml:Re,transformBox:ve,transformPoint:fe,walkTree:Be}}};
|
|
/**
|
|
* @file SVG Icon Loader 2.0
|
|
*
|
|
* jQuery Plugin for loading SVG icons from a single file
|
|
*
|
|
* Adds {@link external:jQuery.svgIcons}, {@link external:jQuery.getSvgIcon}, {@link external:jQuery.resizeSvgIcons}
|
|
*
|
|
* How to use:
|
|
|
|
1. Create the SVG master file that includes all icons:
|
|
|
|
The master SVG icon-containing file is an SVG file that contains
|
|
`<g>` elements. Each `<g>` element should contain the markup of an SVG
|
|
icon. The `<g>` element has an ID that should
|
|
correspond with the ID of the HTML element used on the page that should contain
|
|
or optionally be replaced by the icon. Additionally, one empty element should be
|
|
added at the end with id "svg_eof".
|
|
|
|
2. Optionally create fallback raster images for each SVG icon.
|
|
|
|
3. Include the jQuery and the SVG Icon Loader scripts on your page.
|
|
|
|
4. Run `$.svgIcons()` when the document is ready. See its signature
|
|
|
|
5. To access an icon at a later point without using the callback, use this:
|
|
`$.getSvgIcon(id (string), uniqueClone (boolean))`;
|
|
|
|
This will return the icon (as jQuery object) with a given ID.
|
|
|
|
6. To resize icons at a later point without using the callback, use this:
|
|
`$.resizeSvgIcons(resizeOptions)` (use the same way as the "resize" parameter)
|
|
*
|
|
* @module jQuerySVGIcons
|
|
* @license MIT
|
|
* @copyright (c) 2009 Alexis Deveria
|
|
* {@link http://a.deveria.com}
|
|
* @example
|
|
$(function () {
|
|
$.svgIcons('my_icon_set.svg'); // The SVG file that contains all icons
|
|
// No options have been set, so all icons will automatically be inserted
|
|
// into HTML elements that match the same IDs.
|
|
});
|
|
|
|
* @example
|
|
$(function () {
|
|
// The SVG file that contains all icons
|
|
$.svgIcons('my_icon_set.svg', {
|
|
callback (icons) { // Custom callback function that sets click
|
|
// events for each icon
|
|
$.each(icons, function (id, icon) {
|
|
icon.click(function () {
|
|
alert('You clicked on the icon with id ' + id);
|
|
});
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
* @example
|
|
$(function () {
|
|
// The SVGZ file that contains all icons
|
|
$.svgIcons('my_icon_set.svgz', {
|
|
w: 32, // All icons will be 32px wide
|
|
h: 32, // All icons will be 32px high
|
|
fallback_path: 'icons/', // All fallback files can be found here
|
|
fallback: {
|
|
'#open_icon': 'open.png', // The "open.png" will be appended to the
|
|
// HTML element with ID "open_icon"
|
|
'#close_icon': 'close.png',
|
|
'#save_icon': 'save.png'
|
|
},
|
|
placement: {'.open_icon': 'open'}, // The "open" icon will be added
|
|
// to all elements with class "open_icon"
|
|
resize: {
|
|
'#save_icon .svg_icon': 64 // The "save" icon will be resized to 64 x 64px
|
|
},
|
|
|
|
callback (icons) { // Sets background color for "close" icon
|
|
icons.close.css('background', 'red');
|
|
},
|
|
|
|
svgz: true // Indicates that an SVGZ file is being used
|
|
});
|
|
});
|
|
*/
|
|
var Cr=Boolean(window.opera),Ar=function(e,t,n){var r,a=e.find("defs");if(!a.length)return e;r=Cr?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};
|
|
/**
|
|
* @file jGraduate 0.4
|
|
*
|
|
* jQuery Plugin for a gradient picker
|
|
*
|
|
* @module jGraduate
|
|
* @copyright 2010 Jeff Schiller {@link http://blog.codedread.com/}, 2010 Alexis Deveria {@link http://a.deveria.com/}
|
|
*
|
|
* @license Apache-2.0
|
|
* @example
|
|
* // The Paint object is described below.
|
|
* $.jGraduate.Paint(); // constructs a 'none' color
|
|
* @example $.jGraduate.Paint({copy: o}); // creates a copy of the paint o
|
|
* @example $.jGraduate.Paint({hex: '#rrggbb'}); // creates a solid color paint with hex = "#rrggbb"
|
|
* @example $.jGraduate.Paint({linearGradient: o, a: 50}); // creates a linear gradient paint with opacity=0.5
|
|
* @example $.jGraduate.Paint({radialGradient: o, a: 7}); // creates a radial gradient paint with opacity=0.07
|
|
* @example $.jGraduate.Paint({hex: '#rrggbb', linearGradient: o}); // throws an exception?
|
|
*/
|
|
var Er="http://www.w3.org/2000/svg",Gr="http://www.w3.org/1999/xlink";
|
|
/**
|
|
* @file jPicker (Adapted from version 1.1.6)
|
|
*
|
|
* jQuery Plugin for Photoshop style color picker
|
|
*
|
|
* @module jPicker
|
|
* @copyright (c) 2010 Christopher T. Tillman
|
|
* Digital Magic Productions, Inc. ({@link http://www.digitalmagicpro.com/})
|
|
* FREE to use, alter, copy, sell, and especially ENHANCE
|
|
* @license MIT
|
|
*
|
|
* Painstakingly ported from John Dyers' excellent work on his own color picker based on the Prototype framework.
|
|
*
|
|
* John Dyers' website: {@link http://johndyer.name}
|
|
* Color Picker page: {@link http://johndyer.name/photoshop-like-javascript-color-picker/}
|
|
*/
|
|
function Nr(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 Pr,Ir,Tr=function(e){return null==e},Lr=jQuery,Mr=function(e,t,n){var r=Lr("#svg_editor").parent();Object.entries(t).forEach((function(t){var a=f(t,2),i=a[0],o=a[1];if(o){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":p(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)}else console.log(i)}))},Or=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,a,i,o,s,l,c,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ir.addLangData(Pr);case 2:if(n=e.sent,Lr.each(n,(function(e,n){n.data&&(t=Lr.merge(t,n.data))})),t.tools){e.next=6;break}return e.abrupt("return",void 0);case 6:return a=(r=t).tools,i=r.properties,o=r.config,s=r.layers,l=r.common,c=r.ui,Mr("content",{curve_segments:i.curve_segments,fitToContent:a.fitToContent,fit_to_all:a.fit_to_all,fit_to_canvas:a.fit_to_canvas,fit_to_layer_content:a.fit_to_layer_content,fit_to_sel:a.fit_to_sel,icon_large:o.icon_large,icon_medium:o.icon_medium,icon_small:o.icon_small,icon_xlarge:o.icon_xlarge,image_opt_embed:o.image_opt_embed,image_opt_ref:o.image_opt_ref,includedImages:o.included_images,largest_object:a.largest_object,layersLabel:s.layers,page:a.page,relativeToLabel:a.relativeTo,selLayerLabel:s.move_elems_to,selectedPredefined:o.select_predefined,selected_objects:a.selected_objects,smallest_object:a.smallest_object,straight_segments:i.straight_segments,svginfo_bg_url:o.editor_img_url+":",svginfo_bg_note:o.editor_bg_note,svginfo_change_background:o.background,svginfo_dim:o.doc_dims,svginfo_editor_prefs:o.editor_prefs,svginfo_height:l.height,svginfo_icons:o.icon_size,svginfo_image_props:o.image_props,svginfo_lang:o.language,svginfo_title:o.doc_title,svginfo_width:l.width,tool_docprops_cancel:l.cancel,tool_docprops_save:l.ok,tool_source_cancel:l.cancel,tool_source_save:l.ok,tool_prefs_cancel:l.cancel,tool_prefs_save:l.ok,sidepanel_handle:s.layers.split("").join(" "),tool_clear:a.new_doc,tool_docprops:a.docprops,tool_export:a.export_img,tool_import:a.import_doc,tool_open:a.open_doc,tool_save:a.save_doc,tool_editor_prefs:o.editor_prefs,tool_editor_homepage:a.editor_homepage,svginfo_units_rulers:o.units_and_rulers,svginfo_rulers_onoff:o.show_rulers,svginfo_unit:o.base_unit,svginfo_grid_settings:o.grid,svginfo_snap_onoff:o.snapping_onoff,svginfo_snap_step:o.snapping_stepsize,svginfo_grid_color:o.grid_color},!0),u={},["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+'"]']=a[e]})),["dupe","merge_down","merge_all"].forEach((function(e){u['#cmenu_layers a[href="#'+e+'"]']=s[e]})),u['#cmenu_layers a[href="#delete"]']=s.del,Mr("content",u),d={},Object.entries({tool_blur:i.blur,tool_position:a.align_to_page,tool_font_family:i.font_family,zoom_panel:c.zoom_level,stroke_linejoin:i.linejoin_miter,stroke_linecap:i.linecap_butt,tool_opacity:i.opacity}).forEach((function(e){var t=f(e,2),n=t[0],r=t[1];d["#"+n+" button"]=r})),Object.entries({group_opacity:i.opacity,zoom:c.zoom_level}).forEach((function(e){var t=f(e,2),n=t[0],r=t[1];d["#"+n]=r})),Mr("aria-label",d),Mr("title",{align_relative_to:a.align_relative_to,circle_cx:i.circle_cx,circle_cy:i.circle_cy,circle_r:i.circle_r,cornerRadiusLabel:i.corner_radius,ellipse_cx:i.ellipse_cx,ellipse_cy:i.ellipse_cy,ellipse_rx:i.ellipse_rx,ellipse_ry:i.ellipse_ry,fill_color:i.fill_color,font_family:i.font_family,idLabel:i.id,image_height:i.image_height,image_url:i.image_url,image_width:i.image_width,layer_delete:s.del,layer_down:s.move_down,layer_new:s.new,layer_rename:s.rename,layer_moreopts:l.more_opts,layer_up:s.move_up,line_x1:i.line_x1,line_x2:i.line_x2,line_y1:i.line_y1,line_y2:i.line_y2,linecap_butt:i.linecap_butt,linecap_round:i.linecap_round,linecap_square:i.linecap_square,linejoin_bevel:i.linejoin_bevel,linejoin_miter:i.linejoin_miter,linejoin_round:i.linejoin_round,main_icon:a.main_menu,palette:c.palette_info,zoom_panel:c.zoom_level,path_node_x:i.node_x,path_node_y:i.node_y,rect_height_tool:i.rect_height,rect_width_tool:i.rect_width,seg_type:i.seg_type,selLayerNames:s.move_selected,selected_x:i.pos_x,selected_y:i.pos_y,stroke_color:i.stroke_color,stroke_style:i.stroke_style,stroke_width:i.stroke_width,svginfo_title:o.doc_title,text:i.text_contents,toggle_stroke_tools:c.toggle_stroke_tools,tool_add_subpath:a.add_subpath,tool_alignbottom:a.align_bottom,tool_aligncenter:a.align_center,tool_alignleft:a.align_left,tool_alignmiddle:a.align_middle,tool_alignright:a.align_right,tool_aligntop:a.align_top,tool_angle:i.angle,tool_blur:i.blur,tool_bold:i.bold,tool_circle:a.mode_circle,tool_clone:a.clone,tool_clone_multi:a.clone,tool_delete:a.del,tool_delete_multi:a.del,tool_ellipse:a.mode_ellipse,tool_fhellipse:a.mode_fhellipse,tool_fhpath:a.mode_fhpath,tool_fhrect:a.mode_fhrect,tool_font_size:i.font_size,tool_group_elements:a.group_elements,tool_make_link:a.make_link,tool_link_url:a.set_link_url,tool_image:a.mode_image,tool_italic:i.italic,tool_line:a.mode_line,tool_move_bottom:a.move_bottom,tool_move_top:a.move_top,tool_node_clone:a.node_clone,tool_node_delete:a.node_delete,tool_node_link:a.node_link,tool_opacity:i.opacity,tool_openclose_path:a.openclose_path,tool_path:a.mode_path,tool_position:a.align_to_page,tool_rect:a.mode_rect,tool_redo:a.redo,tool_reorient:a.reorient_path,tool_select:a.mode_select,tool_source:a.source_save,tool_square:a.mode_square,tool_text:a.mode_text,tool_topath:a.to_path,tool_undo:a.undo,tool_ungroup:a.ungroup,tool_wireframe:a.wireframe_mode,tool_zoom:a.mode_zoom,url_notice:a.no_embed},!0),e.abrupt("return",{langParam:Pr,langData:t});case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),jr=function(){var e=n(regeneratorRuntime.mark((function e(t,n,r){var a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t?Pr=t:navigator.userLanguage?Pr=navigator.userLanguage:navigator.language&&(Pr=navigator.language),console.log("Lang: "+Pr),n.includes(Pr)||"test"===Pr||(Pr="en"),a=r.langPath+"lang."+Pr+".js",e.t0=Or,e.next=7,mt(a,{global:"svgEditorLang_"+Pr.replace(/-/g,"_")});case 7:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1));case 9:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}();function Vr(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 Rr(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;function c(e){var t={};if(Array.isArray(e)){var o=Vr(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,f=h.before,p=void 0===f?n:f,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(){p?p.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)}))}))}return e=Array.isArray(e)?e:[e],Promise.all(e.map((function(e){return c(e)})))}var Br=function(e){return document.querySelector(e)},Dr={},Ur=[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(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,f=!1,p=!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(p)return;var s=(a=o[0].contentDocument)&&a.getElementById("svg_eof");if(!(s||n&&s))return void(++g<50?setTimeout(y,20):(w(),p=!0));p=!0}if(r=e(a.firstChild).children(),l.no_img)setTimeout((function(){f||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(Cr&&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);Cr&&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(!f){var p;if(l.no_img&&(n=!1),n&&(p=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");var E=k.getAttribute("viewBox");E||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"),Cr||(k=k.cloneNode(!0)),S.append(k);var G=void 0;if(n){p.empty().append(S);var N=m+Ie(unescape(encodeURIComponent((new XMLSerializer).serializeToString(S)))),P="icon";l.alts&&(P=l.alts[w]||P),G=e(new Image).attr({class:"svg_icon",src:N,alt:P})}else G=Ar(e(S),y);b(G,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=Ar(i,r)),_(e(this),i,a)}))})),a||(n&&p.remove(),o&&o.remove(),i&&i.remove()),l.resize&&e.resizeSvgIcons(l.resize),f=!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=Ar(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(t){t.loadingStylesheets||(t.loadingStylesheets=[]),t.loadingStylesheets.includes("jgraduate/css/jGraduate.css")||t.loadingStylesheets.push("jgraduate/css/jGraduate.css"),t.jGraduate={Paint:function e(t){r(this,e);var n=t||{};if(this.alpha=isNaN(n.alpha)?100:n.alpha,n.copy)switch(this.type=n.copy.type,this.alpha=n.copy.alpha,this.solidColor=null,this.linearGradient=null,this.radialGradient=null,this.type){case"none":break;case"solidColor":this.solidColor=n.copy.solidColor;break;case"linearGradient":this.linearGradient=n.copy.linearGradient.cloneNode(!0);break;case"radialGradient":this.radialGradient=n.copy.radialGradient.cloneNode(!0)}else n.linearGradient?(this.type="linearGradient",this.solidColor=null,this.radialGradient=null,this.linearGradient=n.linearGradient.cloneNode(!0)):n.radialGradient?(this.type="radialGradient",this.solidColor=null,this.linearGradient=null,this.radialGradient=n.radialGradient.cloneNode(!0)):n.solidColor?(this.type="solidColor",this.solidColor=n.solidColor):(this.type="none",this.solidColor=null,this.linearGradient=null,this.radialGradient=null)}},t.fn.jGraduateDefaults={paint:new t.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var n=navigator.userAgent.includes("Gecko/");function a(e,t,r){var a=document.createElementNS(Er,e);return function(e,t){n?Object.entries(t).forEach((function(t){var n=f(t,2),r=n[0],a=n[1];e.setAttribute(r,a)})):Object.entries(t).forEach((function(t){var n=f(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),r&&r.append(a),a}return t.fn.jGraduate=function(n,r,i){return this.each((function(){var o=t(this),s=t.extend(!0,{},t.fn.jGraduateDefaults,n||{}),l=o.attr("id"),c="#"+o.attr("id")+" ";if(c){var u=function(){switch(o.paint.type){case"radialGradient":o.paint.linearGradient=null;break;case"linearGradient":o.paint.radialGradient=null;break;case"solidColor":o.paint.radialGradient=o.paint.linearGradient=null}"function"==typeof o.okCallback&&o.okCallback(o.paint),o.hide()},d=function(){"function"==typeof o.cancelCallback&&o.cancelCallback(),o.hide()};t.extend(!0,o,{paint:new t.jGraduate.Paint({copy:s.paint}),okCallback:"function"==typeof r?r:null,cancelCallback:"function"==typeof i?i:null});var h=null,f=t(window);"none"===o.paint.type&&(o.paint=new t.jGraduate.Paint({solidColor:"ffffff"})),o.addClass("jGraduate_Picker"),o.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+l+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var p=t(c+"> .jGraduate_colPick"),g=t(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={};t(".jGraduate_SliderBar").width(145);var v,y=t("#"+l+"_jGraduate_GradContainer")[0],_=a("svg",{id:l+"_jgraduate_svg",width:256,height:256,xmlns:Er},y),b=o.paint.type,x=o.paint[b],w=x,S=o.paint.alpha,k="solidColor"===b;switch(b){case"solidColor":case"linearGradient":if(k||(w.id=l+"_lg_jgraduate_grad",x=w=_.appendChild(w)),a("radialGradient",{id:l+"_rg_jgraduate_grad"},_),"linearGradient"===b)break;case"radialGradient":k||(w.id=l+"_rg_jgraduate_grad",x=w=_.appendChild(w)),a("linearGradient",{id:l+"_lg_jgraduate_grad"},_)}if(k){x=w=t("#"+l+"_lg_jgraduate_grad")[0],Ie(0,"#"+(h=o.paint[b]),1);var C=e(s.newstop);if("string"===C)switch(s.newstop){case"same":Ie(1,"#"+h,1);break;case"inverse":for(var A="",E=0;E<6;E+=2){var G=(255-Number.parseInt(h.substr(E,2),16)).toString(16);G.length<2&&(G=0+G),A+=G}Ie(1,"#"+A,1);break;case"white":Ie(1,"#ffffff",1);break;case"black":Ie(1,"#000000",1)}else if("object"===C){var N="opac"in s.newstop?s.newstop.opac:1;Ie(1,s.newstop.color||"#"+h,N)}}var P,I=Number.parseFloat(x.getAttribute("x1")||0),T=Number.parseFloat(x.getAttribute("y1")||0),L=Number.parseFloat(x.getAttribute("x2")||1),M=Number.parseFloat(x.getAttribute("y2")||0),O=Number.parseFloat(x.getAttribute("cx")||.5),j=Number.parseFloat(x.getAttribute("cy")||.5),V=Number.parseFloat(x.getAttribute("fx")||O),R=Number.parseFloat(x.getAttribute("fy")||j),B=a("rect",{id:l+"_jgraduate_rect",x:0,y:0,width:256,height:256,fill:"url(#"+l+"_jgraduate_grad)","fill-opacity":S/100},_),D=t("<div/>").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:256*T,left:256*I}).data("coord","start").appendTo(y),U=D.clone().text(2).css({top:256*M,left:256*L}).attr("title","End stop").data("coord","end").appendTo(y),F=t("<div/>").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:256*j,left:256*O}).data("coord","center").appendTo(y),z=F.clone().text("F").css({top:256*R,left:256*V,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(y);z[0].id=l+"_jGraduate_focusCoord",t.each(["x1","y1","x2","y2","cx","cy","fx","fy"],(function(e,n){var r=isNaN(n[1]),a=w.getAttribute(n);a||(a=r?"0.5":"x2"===n?"1.0":"0.0"),m[n]=t("#"+l+"_jGraduate_"+n).val(a).change((function(){isNaN(Number.parseFloat(this.value))||this.value<0?this.value=0:this.value>1&&(this.value=1),("f"!==n[0]||P)&&(r&&"radialGradient"===b||!r&&"linearGradient"===b)&&w.setAttribute(n,this.value);var e=r?"c"===n[0]?F:z:"1"===n[1]?D:U,t=n.includes("x")?"left":"top";e.css(t,256*this.value)})).change()}));var H,q,W,X,Y=t("#"+l+"_jGraduate_StopSlider"),Q=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),K=1,Z=1,$=0,J=O,ee=j,te=a("svg",{width:"100%",height:45},Y[0]),ne=a("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},te),re=a("image",{width:16,height:16},ne),ae=s.images.clientPath+"map-opacity.png";re.setAttributeNS(Gr,"xlink:href",ae),t(te).click((function(e){if(X=Y.offset(),"path"!==e.target.tagName){var t=e.pageX-X.left-8;Ie((t=t<10?10:t>266?266:t)/256,0,0,!0),e.stopPropagation()}})),t(te).mouseover((function(){te.append(Q)})),v=a("g",{},te),a("line",{x1:10,y1:15,x2:266,y2:15,"stroke-width":2,stroke:"#000"},te);var ie,oe,se,le,ce=g.find(".jGraduate_spreadMethod").change((function(){w.setAttribute("spreadMethod",t(this).val())})),ue=null,de=function(e){var t=e.pageX-ie.left,n=e.pageY-ie.top;t=t<0?0:t>256?256:t,n=n<0?0:n>256?256:n,ue.css("left",t).css("top",n);var r=t/256,a=n/256,i=ue.data("coord"),o=w;switch(i){case"start":m.x1.val(r),m.y1.val(a),o.setAttribute("x1",r),o.setAttribute("y1",a);break;case"end":m.x2.val(r),m.y2.val(a),o.setAttribute("x2",r),o.setAttribute("y2",a);break;case"center":m.cx.val(r),m.cy.val(a),o.setAttribute("cx",r),o.setAttribute("cy",a),J=r,ee=a,Me();break;case"focus":m.fx.val(r),m.fy.val(a),o.setAttribute("fx",r),o.setAttribute("fy",a),Me()}e.preventDefault()},he=function e(){ue=null,f.unbind("mousemove",de).unbind("mouseup",e)},fe=(H=w.getElementsByTagNameNS(Er,"stop")).length;if(fe<2){for(;fe<2;)w.append(document.createElementNS(Er,"stop")),++fe;H=w.getElementsByTagNameNS(Er,"stop")}for(var pe=0;pe<fe;pe++)Ie(0,0,0,0,H[pe]);if(ce.val(w.getAttribute("spreadMethod")||"pad"),P=!1,B.setAttribute("fill-opacity",S/100),t("#"+l+" div.grad_coord").mousedown((function(e){e.preventDefault(),ue=t(this),ie=ue.parent().offset(),f.mousemove(de).mouseup(he)})),t("#"+l+"_jGraduate_Ok").bind("click",(function(){o.paint.type=b,o.paint[b]=w.cloneNode(!0),o.paint.solidColor=null,u()})),t("#"+l+"_jGraduate_Cancel").bind("click",(function(e){d()})),"radialGradient"===b&&(P?z.show():(z.hide(),m.fx.val(""),m.fy.val(""))),t("#"+l+"_jGraduate_match_ctr")[0].checked=!P,t("#"+l+"_jGraduate_match_ctr").change((function(){P=!this.checked,z.toggle(P),m.fx.val(""),m.fy.val("");var e=w;if(P){var t=oe||.5,n=se||.5;e.setAttribute("fx",t),e.setAttribute("fy",n),m.fx.val(t),m.fy.val(n)}else oe=e.getAttribute("fx"),se=e.getAttribute("fy"),e.removeAttribute("fx"),e.removeAttribute("fy")})),(fe=(H=w.getElementsByTagNameNS(Er,"stop")).length)<2){for(;fe<2;)w.append(document.createElementNS(Er,"stop")),++fe;H=w.getElementsByTagNameNS(Er,"stop")}var ge=0,me=0;if("radialGradient"===b){var ve=w.gradientTransform.baseVal;if(2===ve.numberOfItems){var ye=ve.getItem(0),_e=ve.getItem(1);if(2===ye.type&&3===_e.type){var be=_e.matrix;1!==be.a?ge=Math.round(100*-(1-be.a)):1!==be.d&&(ge=Math.round(100*(1-be.d)))}}else if(3===ve.numberOfItems){var xe=ve.getItem(0),we=ve.getItem(1),Se=ve.getItem(2);if(4===xe.type&&2===we.type&&3===Se.type){me=Math.round(xe.angle);var ke=Se.matrix;1!==ke.a?ge=Math.round(100*-(1-ke.a)):1!==ke.d&&(ge=Math.round(100*(1-ke.d)))}}}var Ce={radius:{handle:"#"+l+"_jGraduate_RadiusArrows",input:"#"+l+"_jGraduate_RadiusInput",val:100*(w.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:ge},angle:{handle:"#"+l+"_jGraduate_AngleArrows",input:"#"+l+"_jGraduate_AngleInput",val:me}};t.each(Ce,(function(e,n){var r=t(n.handle);r.mousedown((function(a){var i=r.parent();le={type:e,elem:r,input:t(n.input),parent:i,offset:i.offset()},f.mousemove(Ae).mouseup(Ee),a.preventDefault()})),t(n.input).val(n.val).change((function(){var t="radialGradient"===b,n=Number(this.value),a=0;switch(e){case"radius":t&&w.setAttribute("r",n/100),a=Math.pow(n/100,.4)/2*145;break;case"opacity":o.paint.alpha=n,B.setAttribute("fill-opacity",n/100),a=1.45*n;break;case"ellip":if(K=Z=1,0===n){a=72.5;break}n>99.5&&(n=99.5),n>0?Z=1-n/100:K=-n/100-1,a=(n+100)/2*145/100,t&&Me();break;case"angle":a=($=n)/180,a+=.5,a*=145,t&&Me()}a>145?a=145:a<0&&(a=0),r.css({"margin-left":a-5})})).change()}));for(var Ae=function(e){!function(e){var t=le.offset.left,n=le.parent,r=e.pageX-t-Number.parseInt(n.css("border-left-width"));r>145&&(r=145),r<=0&&(r=0);var a=r-5;switch(r/=145,le.type){case"radius":(r=Math.pow(2*r,2.5))>.98&&r<1.02&&(r=1),r<=.01&&(r=.01),w.setAttribute("r",r);break;case"opacity":o.paint.alpha=Number.parseInt(100*r),B.setAttribute("fill-opacity",r);break;case"ellip":K=1,Z=1,r<.5?K=(r/=.5)<=0?.01:r:r>.5&&(Z=(r=2-(r/=.5))<=0?.01:r),Me(),Z===(r-=1)+1&&(r=Math.abs(r));break;case"angle":r-=.5,$=r*=180,Me(),r/=100}le.elem.css({"margin-left":a}),r=Math.round(100*r),le.input.val(r)}(e),e.preventDefault()},Ee=function e(t){f.unbind("mousemove",Ae).unbind("mouseup",e),le=null},Ge=(255*o.paint.alpha/100).toString(16);Ge.length<2;)Ge="0"+Ge;Ge=Ge.split(".")[0],h="none"===o.paint.solidColor?"":o.paint.solidColor+Ge,k||(h=H[0].getAttribute("stop-color")),t.extend(t.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),p.jPicker({window:{title:s.window.pickerTitle},images:{clientPath:s.images.clientPath},color:{active:h,alphaSupport:!0}},(function(e){o.paint.type="solidColor",o.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,o.paint.solidColor=e.val("hex")?e.val("hex"):"none",o.paint.radialGradient=null,u()}),null,(function(){d()}));var Ne,Pe=t(c+" .jGraduate_tabs li");switch(Pe.click((function(){Pe.removeClass("jGraduate_tab_current"),t(this).addClass("jGraduate_tab_current"),t(c+" > div").hide();var e=t(this).attr("data-type");if(t(c+" .jGraduate_gradPick").show(),"rg"===e||"lg"===e){t(".jGraduate_"+e+"_field").show(),t(".jGraduate_"+("lg"===e?"rg":"lg")+"_field").hide(),t("#"+l+"_jgraduate_rect")[0].setAttribute("fill","url(#"+l+"_"+e+"_jgraduate_grad)"),b="lg"===e?"linearGradient":"radialGradient",t("#"+l+"_jGraduate_OpacInput").val(o.paint.alpha).change();var n=t("#"+l+"_"+e+"_jgraduate_grad")[0];if(w!==n){var r=t(w).find("stop");t(n).empty().append(r),w=n;var a=ce.val();w.setAttribute("spreadMethod",a)}P="rg"===e&&null!==w.getAttribute("fx")&&!(O===V&&j===R),t("#"+l+"_jGraduate_focusCoord").toggle(P),P&&(t("#"+l+"_jGraduate_match_ctr")[0].checked=!1)}else t(c+" .jGraduate_gradPick").hide(),t(c+" .jGraduate_colPick").show()})),t(c+" > div").hide(),Pe.removeClass("jGraduate_tab_current"),o.paint.type){case"linearGradient":Ne=t(c+" .jGraduate_tab_lingrad");break;case"radialGradient":Ne=t(c+" .jGraduate_tab_radgrad");break;default:Ne=t(c+" .jGraduate_tab_color")}o.show(),setTimeout((function(){Ne.addClass("jGraduate_tab_current").click()}),10)}else t.alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Ie(e,n,r,i,o){var c=o||a("stop",{"stop-color":n,"stop-opacity":r,offset:e},w);o?(n=o.getAttribute("stop-color"),r=o.getAttribute("stop-opacity"),e=o.getAttribute("offset")):w.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+256*e)+", 26)"},v),h=a("path",{d:u,fill:n,"fill-opacity":r,transform:"translate("+(10+256*e)+", 26)",stroke:"#000","stroke-width":1.5},v);return t(h).mousedown((function(e){return Te(this),W=q,f.mousemove(Oe).mouseup(Le),X=Y.offset(),e.preventDefault(),!1})).data("stop",c).data("bg",d).dblclick((function(){t("div.jGraduate_LightBox").show();for(var e=this,r=Number(c.getAttribute("stop-opacity"))||1,a=c.getAttribute("stop-color")||1,i=(255*Number.parseFloat(r)).toString(16);i.length<2;)i="0"+i;n=a.substr(1)+i,t("#"+l+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:s.images.clientPath},color:{active:n,alphaSupport:!0}},(function(n,i){a=n.val("hex")?"#"+n.val("hex"):"none",r=null!==n.val("a")?n.val("a")/256:1,e.setAttribute("fill",a),e.setAttribute("fill-opacity",r),c.setAttribute("stop-color",a),c.setAttribute("stop-opacity",r),t("div.jGraduate_LightBox").hide(),t("#"+l+"_jGraduate_stopPicker").hide()}),null,(function(){t("div.jGraduate_LightBox").hide(),t("#"+l+"_jGraduate_stopPicker").hide()}))})),t(w).find("stop").each((function(){var r=t(this);if(Number(this.getAttribute("offset"))>e){if(!n){var a=this.getAttribute("stop-color"),i=this.getAttribute("stop-opacity");c.setAttribute("stop-color",a),h.setAttribute("fill",a),c.setAttribute("stop-opacity",null===i?1:i),h.setAttribute("fill-opacity",null===i?1:i)}return r.before(c),!1}return!0})),i&&Te(h),c}function Te(e){q&&q.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),q=e}function Le(){f.unbind("mousemove",Oe),"none"!==Q.getAttribute("display")&&function(){Q.setAttribute("display","none");var e=t(q),n=e.data("stop"),r=e.data("bg");t([q,n,r]).remove()}(),W=null}function Me(){var e=$?"rotate("+$+","+J+","+ee+") ":"";if(1===K&&1===Z)w.removeAttribute("gradientTransform");else{var t=-J*(K-1),n=-ee*(Z-1);w.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+K+","+Z+")")}}function Oe(e){var n=e.pageX-X.left,r=e.pageY-X.top,a="translate("+(n=n<10?10:n>266?266:n)+", 26)";r<-60||r>130?(Q.setAttribute("display","block"),Q.setAttribute("transform",a)):Q.setAttribute("display","none"),W.setAttribute("transform",a),t.data(W,"bg").setAttribute("transform",a);var i=(n-10)/256;t.data(W,"stop").setAttribute("offset",i);var o=0;t(w).find("stop").each((function(e){var n=this.getAttribute("offset"),r=t(this);n<o&&(r.prev().before(r),H=t(w).find("stop")),o=n}))}}))},t},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(Number.parseFloat(t.min))?null:Number(t.min),max:isNaN(Number.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},Y,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&&q()){if(c.stopPropagation(),e(".contextMenu").hide(),i.hasClass("disabled"))return!1;var d=c.pageX,h=c.pageY,f=t.width()-s.width(),p=t.height()-s.height();d>f-15&&(d=f-15),h>p-30&&(h=p-30),n.unbind("click"),s.css({top:h,left:d}).fadeIn(r.inSpeed),s.find("A").mouseover((function(){s.find("LI.hover").removeClass("hover"),e(this).parent().addClass("hover")})).mouseout((function(){s.find("LI.hover").removeClass("hover")})),n.keypress((function(e){switch(e.keyCode){case 38:s.find("LI.hover").length?(s.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"),s.find("LI.hover").length||s.find("LI:last").addClass("hover")):s.find("LI:last").addClass("hover");break;case 40:s.find("LI.hover").length?(s.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover"),s.find("LI.hover").length||s.find("LI:first").addClass("hover")):s.find("LI:first").addClass("hover");break;case 13:s.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}})),s.find("A").unbind("mouseup"),s.find("LI:not(.disabled) A").mouseup((function(){return n.unbind("click").unbind("keypress"),e(".contextMenu").hide(),a&&a(e(this).attr("href").substr(1),e(u),{x:d-o.left,y:h-o.top,docX:d,docY:h}),!1})),setTimeout((function(){n.click((function(){return n.unbind("click").unbind("keypress"),s.fadeOut(r.outSpeed),!1}))}),0)}}))})),e.browser.mozilla?e("#"+r.menu).each((function(){e(this).css({MozUserSelect:"none"})})):e.browser.msie?e("#"+r.menu).each((function(){e(this).bind("selectstart.disableTextSelect",(function(){return!1}))})):e("#"+r.menu).each((function(){e(this).bind("mousedown.disableTextSelect",(function(){return!1}))})),e(i).add(e("UL.contextMenu")).bind("contextmenu",(function(){return!1}))})),e(this))},disableContextMenuItems:function(t){return void 0===t?(e(this).find("LI").addClass("disabled"),e(this)):(e(this).each((function(){if(void 0!==t){var n,r=v(t.split(","));try{for(r.s();!(n=r.n()).done;){var a=n.value;e(this).find('A[href="'+a+'"]').parent().addClass("disabled")}}catch(e){r.e(e)}finally{r.f()}}})),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,r=v(t.split(","));try{for(r.s();!(n=r.n()).done;){var a=n.value;e(this).find('A[href="'+a+'"]').parent().removeClass("disabled")}}catch(e){r.e(e)}finally{r.f()}}})),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(t){t.loadingStylesheets||(t.loadingStylesheets=[]);t.loadingStylesheets.includes("jgraduate/css/jPicker.css")||t.loadingStylesheets.push("jgraduate/css/jPicker.css");var n=function e(n,a){r(this,e);var i=this;function o(e){k.forEach((function(t){t.call(i,i,e)}))}function s(e){var r=n.offset();f={l:0|r.left,t:0|r.top},clearTimeout(p),p=setTimeout((function(){u.call(i,e)}),0),t(document).bind("mousemove",l).bind("mouseup",c),e.preventDefault()}function l(e){return clearTimeout(p),p=setTimeout((function(){u.call(i,e)}),0),e.stopPropagation(),e.preventDefault(),!1}function c(e){return t(document).unbind("mouseup",c).unbind("mousemove",l),e.stopPropagation(),e.preventDefault(),!1}function u(e){var t=n.w,r=n.h,a=e.pageX-f.l,o=e.pageY-f.t;a<0?a=0:a>t&&(a=t),o<0?o=0:o>r&&(o=r),d.call(i,"xy",{x:a/t*_+v,y:o/r*w+b})}function d(e,t,n){if(!(void 0!==t))switch(Tr(e)&&(e="xy"),e.toLowerCase()){case"x":return g;case"y":return m;case"xy":default:return{x:g,y:m}}if(Tr(n)||n!==i){var r,a,s=!1;switch(Tr(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}Tr(r)||(r<v?r=v:r>y&&(r=y),g!==r&&(g=r,s=!0)),Tr(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 f,p,g=0,m=0,v=0,y=100,_=100,b=0,x=100,w=100,S=n.find("img:first"),k=[];t.extend(!0,i,{val:d,range:function(e,t){var n,r,a,i;if(!(void 0!==t))switch(Tr(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(Tr(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}Tr(n)||v===n||(_=y-(v=n)),Tr(r)||y===r||(_=(y=r)-v),Tr(a)||b===a||(w=x-(b=a)),Tr(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(){t(document).unbind("mouseup",c).unbind("mousemove",l),n.unbind("mousedown",s),n=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(),n.w=a.map&&a.map.width||n.width(),n.h=a.map&&a.map.height||n.height(),n.bind("mousedown",s),h.call(i,(function(){var e=n.w,t=n.h,r=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),r>=e?i=(e>>1)-(r>>1):i-=r>>1,a>=t?o=(t>>1)-(a>>1):o-=a>>1,S.css({left:i+"px",top:o+"px"})}))}))},a=function e(n,a,i,o){r(this,e);var s=this,l=n.find("td.Text input");function c(e){if(""!==e.target.value||e.target===w.get(0)||(Tr(i)||e.target===i.get(0))&&!Tr(i)){if(!h(e))return e;switch(e.target){case g.get(0):switch(e.keyCode){case 38:return g.val(f.call(s,1+(g.val()<<0),0,255)),a.val("r",g.val(),e.target),!1;case 40:return g.val(f.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(f.call(s,1+(m.val()<<0),0,255)),a.val("g",m.val(),e.target),!1;case 40:return m.val(f.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(f.call(s,1+(v.val()<<0),0,255)),a.val("b",v.val(),e.target),!1;case 40:return v.val(f.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(f.call(s,Number.parseFloat(y.val())+1,0,100)),a.val("a",Nr(255*y.val()/100,o),e.target),!1;case 40:return y.val(f.call(s,Number.parseFloat(y.val())-1,0,100)),a.val("a",Nr(255*y.val()/100,o),e.target),!1}break;case _.get(0):switch(e.keyCode){case 38:return _.val(f.call(s,1+(_.val()<<0),0,360)),a.val("h",_.val(),e.target),!1;case 40:return _.val(f.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(f.call(s,1+(b.val()<<0),0,100)),a.val("s",b.val(),e.target),!1;case 40:return b.val(f.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(f.call(s,1+(x.val()<<0),0,100)),a.val("v",x.val(),e.target),!1;case 40:return x.val(f.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)||(Tr(i)||e.target===i.get(0))&&!Tr(i)){if(!h(e))return e;switch(e.target){case g.get(0):g.val(f.call(s,g.val(),0,255)),a.val("r",g.val(),e.target);break;case m.get(0):m.val(f.call(s,m.val(),0,255)),a.val("g",m.val(),e.target);break;case v.get(0):v.val(f.call(s,v.val(),0,255)),a.val("b",v.val(),e.target);break;case y&&y.get(0):y.val(f.call(s,y.val(),0,100)),a.val("a",Nr(255*y.val()/100,o),e.target);break;case _.get(0):_.val(f.call(s,_.val(),0,360)),a.val("h",_.val(),e.target);break;case b.get(0):b.val(f.call(s,b.val(),0,100)),a.val("s",b.val(),e.target);break;case x.get(0):x.val(f.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-F\d]/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-F\d]/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-F\d]/g,"").toLowerCase().substring(0,2)),a.val("a",Tr(S.val())?null:Number.parseInt(S.val(),16),e.target)}}}function d(e){if(!Tr(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(Nr(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 f(e,t,n){return""===e||isNaN(e)?t:e>n?n:e<t?t:e}function p(e,t){var n=e.val("all");t!==g.get(0)&&g.val(Tr(n)?"":n.r),t!==m.get(0)&&m.val(Tr(n)?"":n.g),t!==v.get(0)&&v.val(Tr(n)?"":n.b),y&&t!==y.get(0)&&y.val(Tr(n)?"":Nr(100*n.a/255,o)),t!==_.get(0)&&_.val(Tr(n)?"":n.h),t!==b.get(0)&&b.val(Tr(n)?"":n.s),t!==x.get(0)&&x.val(Tr(n)?"":n.v),t!==w.get(0)&&(i&&t!==i.get(0)||!i)&&w.val(Tr(n)?"":n.hex),i&&t!==i.get(0)&&t!==w.get(0)&&i.val(Tr(n)?"":n.hex),S&&t!==S.get(0)&&S.val(Tr(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;t.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(p),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(p)};t.jPicker={List:[],Color:function(n){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((Tr(t)||""===t)&&(t="all"),Tr(o))return null;switch(t.toLowerCase()){case"ahex":return l.rgbaToHex({r:o,g:s,b:c,a:u});case"hex":return i("ahex").substring(0,6);case"all":return{r:o,g:s,b:c,a:u,h:d,s:h,v:f,hex:i.call(r,"hex"),ahex:i.call(r,"ahex")};default:v={};var y=t.length;p(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=u:v.a=u;break;case"h":1===y?v=d:v.h=d;break;case"s":1===y?v=h:v.s=h;break;case"v":1===y?v=f:v.v=f}}))}return"object"!==e(v)||Object.keys(v).length?v:i.call(r,"all")}if(Tr(g)||g!==r){Tr(t)&&(t="");var _=!1;if(Tr(n))return Tr(o)||(o=null,_=!0),Tr(s)||(s=null,_=!0),Tr(c)||(c=null,_=!0),Tr(u)||(u=null,_=!0),Tr(d)||(d=null,_=!0),Tr(h)||(h=null,_=!0),Tr(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:Tr(u)?255:u},g);break;default:if(n&&(!Tr(n.ahex)||!Tr(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"),p(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&&!Tr(n.a)?0|n.a:0|n,x.a<0?x.a=0:x.a>255&&(x.a=255),u!==x.a&&(u=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),d!==x.h&&(d=x.h,_=!0);break;case"s":if(w)return;S=!0,x.s=Tr(n.s)?0|n:0|n.s,x.s<0?x.s=0:x.s>100&&(x.s=100),h!==x.s&&(h=x.s,_=!0);break;case"v":if(w)return;S=!0,x.v=Tr(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});d=k.h,h=k.s,f=k.v}else if(S){d=d||0,h=Tr(h)?100:h,f=Tr(f)?100:f;var C=l.hsvToRgb({h:d,s:h,v:f});o=C.r,s=C.g,c=C.b}u=Tr(u)?255:u,a.call(r,g||r)}}}}var o,s,c,u,d,h,f,g=[];t.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}}),n&&(Tr(n.ahex)?Tr(n.hex)?Tr(n.r)||Tr(n.g)||Tr(n.b)?Tr(n.h)||Tr(n.s)||Tr(n.v)||i("hsv"+(Tr(n.a)?"":"a"),n):i("rgb"+(Tr(n.a)?"":"a"),n):i((Tr(n.a)?"":"a")+"hex",Tr(n.a)?n:{ahex:n.hex+l.intToHex(n.a)}):i("ahex",n))},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-f\d]/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 Number.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=Number.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=t.jPicker,o=i.Color,s=i.List,l=i.ColorMethods;return t.fn.jPicker=function(r,i,c,u){return this.each((function(){var d=this,h=t.extend(!0,{},t.fn.jPicker.defaults,r);"input"===t(d).get(0).nodeName.toLowerCase()&&(t.extend(!0,h,{window:{bindToInput:!0,expandable:!0,input:t(d)}}),""===t(d).val()?(h.color.active=new o({hex:null}),h.color.current=new o({hex:null})):l.validateHex(t(d).val())&&(h.color.active=new o({hex:t(d).val(),a:h.color.active.val("a")}),h.color.current=new o({hex:t(d).val(),a:h.color.active.val("a")}))),h.window.expandable?t(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 f=Number.parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function p(e){var t,n,r=H.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}),Tr(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}),Tr(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}),Tr(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}),Tr(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}),Tr(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}),Tr(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}),Tr(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)}Tr(r.val("ahex"))||g.call(d,r)}function g(e,t){(Tr(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=H.active;if(t===se||!Tr(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=H.active;if(t===le||!Tr(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:Tr(n)?100:n.s,y:100-(Tr(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-(Tr(r)?100:r.v)},t);break;case"v":var a=e.val("hs");se.val("xy",{x:a&&a.h||0,y:100-(Tr(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-(Tr(l)?100:l),t);break;case"v":var c=e.val("v");le.val("y",100-(Tr(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-(Tr(u)?255:u),t)}}function _(e){try{var t=e.val("all");ue.css({backgroundColor:t&&"#"+t.hex||"transparent"}),C.call(d,ue,t&&Nr(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-(Tr(t)?100:t));break;case"v":var n=e.val("v");C.call(d,$,Tr(n)?100:n);break;case"r":C.call(d,J,Nr((e.val("r")||0)/255*100,4));break;case"g":C.call(d,J,Nr((e.val("g")||0)/255*100,4));break;case"b":C.call(d,J,Nr((e.val("b")||0)/255*100))}var r=e.val("a");C.call(d,ee,Nr(100*(255-(r||0))/255,4))}function x(e){switch(h.color.mode){case"h":var t=e.val("a");C.call(d,ie,Nr(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:Tr(n)?100:n.v});w.call(d,Z,r.val("hex")),C.call(d,ne,100-(Tr(n)?100:n.v)),C.call(d,ie,Nr(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:Tr(a)?100:a.s,v:100});w.call(d,Z,i.val("hex")),C.call(d,ie,Nr(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?Nr((l-c)/(255-c)*100,4):0),C.call(d,re,c>l?Nr((c-l)/(255-l)*100,4):0),C.call(d,ae,Nr(u/255*100,4)),C.call(d,ie,Nr(100*(255-(s&&s.a||0))/255,4));break;case"a":var f=e.val("a");w.call(d,Z,e.val("hex")||"000000"),C.call(d,ie,Tr(f)?100:0),C.call(d,oe,Tr(f)?0:100)}}function w(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function S(e,t){f&&(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(f){var n=e.attr("pngSrc");!Tr(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:Nr(t/100,4)})}else e.css({opacity:Nr(t/100,4)});else if(0===t||100===t)if(f){var r=e.attr("pngSrc");!Tr(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(){H.active.val("ahex",H.current.val("ahex"))}function E(){H.current.val("ahex",H.active.val("ahex"))}function G(e){t(this).parents("tbody:first").find('input:radio[value!="'+e.target.value+'"]').removeAttr("checked"),p.call(d,e.target.value)}function N(){A.call(d)}function P(){A.call(d),h.window.expandable&&D.call(d),"function"==typeof u&&u.call(d,H.active,fe)}function I(){E.call(d),h.window.expandable&&D.call(d),"function"==typeof i&&i.call(d,H.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,Nr(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,Nr(100*(255-(n&&n.a||0))/255,4)),h.window.bindToInput&&h.window.updateInputColor&&h.window.input.css({backgroundColor:t&&"#"+t||"transparent",color:Tr(n)||n.v>75?"#000000":"#ffffff"})}function O(e){q=Number.parseInt(Q.css("left")),W=Number.parseInt(Q.css("top")),X=e.pageX,Y=e.pageY,t(document).bind("mousemove",j).bind("mouseup",V),e.preventDefault()}function j(e){return Q.css({left:q-(X-e.pageX)+"px",top:W-(Y-e.pageY)+"px"}),h.window.expandable&&!t.support.boxModel&&Q.prev().css({left:Q.css("left"),top:Q.css("top")}),e.stopPropagation(),e.preventDefault(),!1}function V(e){return t(document).unbind("mousemove",j).unbind("mouseup",V),e.stopPropagation(),e.preventDefault(),!1}function R(e){return e.preventDefault(),e.stopPropagation(),H.active.val("ahex",t(this).attr("title")||null,e.target),!1}function B(){function e(){if(h.window.expandable&&!t.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(H.current.val("ahex",H.active.val("ahex")),h.window.expandable&&(t(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&&!t.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 r=h.window,i=r.expandable?t(d).next().find(".Container:first"):null;(Q=r.expandable?t("<div/>"):t(d)).addClass("jPicker Container"),r.expandable&&Q.hide(),Q.get(0).onselectstart=function(e){return"input"===e.target.nodeName.toLowerCase()};var s=H.active.val("all");r.alphaPrecision<0?r.alphaPrecision=0:r.alphaPrecision>2&&(r.alphaPrecision=2);var l='<table class="jPicker" cellpadding="0" cellspacing="0">\n <tbody>\n '.concat(r.expandable?'<tr><td class="Move" colspan="5"> </td></tr>':"",'\n <tr>\n <td rowspan="9"><h2 class="Title">').concat(r.title||z.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(z.text.newColor,'<div><span class="Active" title="').concat(z.tooltips.colors.newColor,'"> </span><span class="Current" title="').concat(z.tooltips.colors.currentColor,'"> </span></div>').concat(z.text.currentColor,'</td>\n <td rowspan="9" class="Button"><input type="button" class="Ok" value="').concat(z.text.ok,'" title="').concat(z.tooltips.buttons.ok,'"/><input type="button" class="Cancel" value="').concat(z.text.cancel,'" title="').concat(z.tooltips.buttons.cancel,'"/><hr/><div class="Grid"> </div></td>\n </tr>\n <tr class="Hue">\n <td class="Radio"><label title="').concat(z.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(Tr(s)?"":s.h,'" title="').concat(z.tooltips.hue.textbox,'"/> °</td>\n </tr>\n <tr class="Saturation">\n <td class="Radio"><label title="').concat(z.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(Tr(s)?"":s.s,'" title="').concat(z.tooltips.saturation.textbox,'"/> %</td>\n </tr>\n <tr class="Value">\n <td class="Radio"><label title="').concat(z.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(Tr(s)?"":s.v,'" title="').concat(z.tooltips.value.textbox,'"/> %<br/><br/></td>\n </tr>\n <tr class="Red">\n <td class="Radio"><label title="').concat(z.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(Tr(s)?"":s.r,'" title="').concat(z.tooltips.red.textbox,'"/></td>\n </tr>\n <tr class="Green">\n <td class="Radio"><label title="').concat(z.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(Tr(s)?"":s.g,'" title="').concat(z.tooltips.green.textbox,'"/></td>\n </tr>\n <tr class="Blue">\n <td class="Radio"><label title="').concat(z.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(Tr(s)?"":s.b,'" title="').concat(z.tooltips.blue.textbox,'"/></td>\n </tr>\n <tr class="Alpha">\n <td class="Radio">').concat(r.alphaSupport?'<label title="'.concat(z.tooltips.alpha.radio,'"><input type="radio" value="a"').concat("a"===h.color.mode?' checked="checked"':"","/>A:</label>"):" ",'</td>\n <td class="Text">').concat(r.alphaSupport?'<input type="text" maxlength="'.concat(3+r.alphaPrecision,'" value="').concat(Tr(s)?"":Nr(100*s.a/255,r.alphaPrecision),'" title="').concat(z.tooltips.alpha.textbox,'"/> %'):" ",'</td>\n </tr>\n <tr class="Hex">\n <td colspan="2" class="Text"><label title="').concat(z.tooltips.hex.textbox,'">#:<input type="text" maxlength="6" class="Hex" value="').concat(Tr(s)?"":s.hex,'"/></label>').concat(r.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'.concat(Tr(s)?"":s.ahex.substring(6),'" title="').concat(z.tooltips.hex.alpha,'"/></td>'):" ","\n </tr>\n </tbody></table>");r.expandable?(Q.html(l),t(document.body).children("div.jPicker.Container").length?t(document.body).children("div.jPicker.Container:last").after(Q):t(document.body).prepend(Q),Q.mousedown((function(){t(document.body).children("div.jPicker.Container").css({zIndex:10}),Q.css({zIndex:20})})),Q.css({left:"left"===r.position.x?i.offset().left-530-("center"===r.position.y?25:0)+"px":"center"===r.position.x?i.offset().left-260+"px":"right"===r.position.x?i.offset().left-10+("center"===r.position.y?25:0)+"px":"screenCenter"===r.position.x?(t(document).width()>>1)-260+"px":i.offset().left+Number.parseInt(r.position.x)+"px",position:"absolute",top:"top"===r.position.y?i.offset().top-312+"px":"center"===r.position.y?i.offset().top-156+"px":"bottom"===r.position.y?i.offset().top+25+"px":i.offset().top+Number.parseInt(r.position.y)+"px"})):(Q=t(d)).html(l);var u=Q.find("tbody:first");K=u.find("div.Map:first"),Z=u.find("div.Bar:first");var f=K.find("span"),y=Z.find("span");$=f.filter(".Map1:first"),J=f.filter(".Map2:first"),ee=f.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 n(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 n(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,H.active,r.expandable&&r.bindToInput?r.input:null,r.alphaPrecision);var _=Tr(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",N),C.call(d,de,Nr(100*H.current.val("a")/255,4)),he=x.find(".Ok:first").bind("click",I),fe=x.find(".Cancel:first").bind("click",P),pe=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),H.quickList&&H.quickList.length>0){for(var w="",k=0;k<H.quickList.length;k++){"string"===e(H.quickList[k]).toString().toLowerCase()&&(H.quickList[k]=new o({hex:H.quickList[k]}));var A=H.quickList[k].val("a"),E=H.quickList[k].val("ahex");!r.alphaSupport&&E&&(E=E.substring(0,6)+"ff");var j=H.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)")+(r.alphaSupport&&A&&A<255?";opacity:"+Nr(A/255,4)+";filter:Alpha(opacity="+Nr(A/2.55,4)+")":"")+'"> </span>'}S.call(d,pe,F.clientPath+"bar-opacity.png"),pe.html(w),pe.find(".QuickColor").click(R)}p.call(d,h.color.mode),H.active.bind(g),"function"==typeof c&&H.active.bind(c),H.current.bind(L),r.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,Nr(100*(255-(Tr(s)?0:s.a))/255,4)),ve=d.icon.find(".Image:first").css({backgroundImage:"url('"+F.clientPath+F.picker.file+"')"}).bind("click",T),r.bindToInput&&r.updateInputColor&&r.input.css({backgroundColor:_&&"#"+_||"transparent",color:Tr(s)||s.v>75?"#000000":"#ffffff"}),ye=u.find(".Move:first").bind("mousedown",O),H.active.bind(M)):B.call(d)}var F=h.images,z=h.localization,H={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,W=null,X=null,Y=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,fe=null,pe=null,ge=null,me=null,ve=null,ye=null;t.extend(!0,d,{commitCallback:i,liveCallback:c,cancelCallback:u,color:H,show:B,hide:D,destroy:function(){Q.find("td.Radio input").unbind("click",G),de.unbind("click",N),fe.unbind("click",P),he.unbind("click",I),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,fe=null,pe=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)}))},t.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)"}}}},t}].reduce((function(e,t){return t(e)}),jQuery);Ur.loadingStylesheets.includes("svg-editor.css")||Ur.loadingStylesheets.push("svg-editor.css");Ur.loadingStylesheets.some((function(e){return!Array.isArray(e)||"images/logo.png"!==e[0]}))&&Ur.loadingStylesheets.push(["images/logo.png",{favicon:!0}]),Dr.tool_scale=1,Dr.exportWindowCt=0,Dr.langChanged=!1,Dr.showSaveWarning=!1,Dr.storagePromptState="ignore";var Fr,zr=[],Hr={lang:"",iconsize:"",bkgd_color:"#FFF",bkgd_url:"",img_save:"embed",save_notice_done:!1,export_notice_done:!1},qr=["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"],Wr={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},Xr=Dr.uiStrings={},Yr={},Qr=!1,Kr=!1,Zr=!1,$r={},Jr={extensions:[],stylesheets:[],allowedOrigins:[]};function ea(e){return ta.apply(this,arguments)}function ta(){return(ta=n(regeneratorRuntime.mark((function e(t){var n,r,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>1&&void 0!==a[1]?a[1]:{},r=n.noAlert,!(!1!==Fr.setSvgString(t))){e.next=4;break}return e.abrupt("return");case 4:if(r){e.next=8;break}return e.next=7,Ur.alert(Xr.notification.errorLoadingSVG);case 7:return e.abrupt("return");case 8:throw new Error("Error loading SVG");case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function na(e){var t=e.defaultLang,r=e.defaultName;return function(){var e=n(regeneratorRuntime.mark((function e(){var n,a,i,o,s,l,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=function(e){return mt("".concat(Jr.extPath,"ext-locale/").concat(i,"/").concat(e,".js"),{global:"svgEditorExtensionLocale_".concat(i,"_").concat(e.replace(/-/g,"_"))})},n=c.length>0&&void 0!==c[0]?c[0]:{},a=n.name,i=void 0===a?r:a,o=n.lang,s=void 0===o?t:o,e.prev=2,e.next=5,l(s);case 5:return e.abrupt("return",e.sent);case 8:return e.prev=8,e.t0=e.catch(2),e.abrupt("return",l("en"));case 11:case"end":return e.stop()}}),e,null,[[2,8]])})));return function(){return e.apply(this,arguments)}}()}Dr.pref=function(e,t,n){return n||t?($r[e]=t,void(Dr.curPrefs=$r)):e in $r?$r[e]:Hr[e]},Dr.putLocale=jr,Dr.readLang=Or,Dr.setStrings=Mr,Dr.loadContentAndPrefs=function(){if(Jr.forceStorage||!Jr.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/)){if(Dr.storage&&(Jr.forceStorage||!Jr.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)svgeditstore=prefsAndContent/))){var e="svgedit-"+Jr.canvasName,t=Dr.storage.getItem(e);t&&Dr.loadFromString(t)}Object.keys(Hr).forEach((function(e){var t,n="svg-edit-"+e;if(Dr.storage){var r=Dr.storage.getItem(n);r&&(Hr[e]=String(r))}else if(window.widget)Hr[e]=window.widget.preferenceForKey(n);else{var a=document.cookie.match(new RegExp("(?:^|;\\s*)"+(t=encodeURIComponent(n),String(t).replace(/[.\\+*?[^\]$(){}=!<>|:-]/g,"\\$&")+"=([^;]+)")));Hr[e]=a?decodeURIComponent(a[1]):""}}))}},Dr.setConfig=function(t,n){function r(t,n,r){t[n]&&"object"===e(t[n])?Ur.extend(!0,t[n],r):t[n]=r}n=n||{},Object.entries(t).forEach((function(t){var a=f(t,2),i=a[0],o=a[1];if({}.hasOwnProperty.call(Hr,i)){if(!1===n.overwrite&&(Jr.preventAllURLConfig||{}.hasOwnProperty.call($r,i)))return;!0===n.allowInitialUserOverride?Hr[i]=o:Dr.pref(i,o)}else if(["extensions","stylesheets","allowedOrigins"].includes(i)){if(!1===n.overwrite&&(Jr.preventAllURLConfig||["allowedOrigins","stylesheets"].includes(i)||"extensions"===i&&Jr.lockExtensions))return;Jr[i]=Jr[i].concat(o)}else if({}.hasOwnProperty.call(Wr,i)){if(!1===n.overwrite&&(Jr.preventAllURLConfig||{}.hasOwnProperty.call(Jr,i)))return;if({}.hasOwnProperty.call(Jr,i)){if(!1===n.overwrite)return;r(Jr,i,o)}else!0===n.allowInitialUserOverride?r(Wr,i,o):Wr[i]&&"object"===e(Wr[i])?(Jr[i]=Array.isArray(Wr[i])?[]:{},Ur.extend(!0,Jr[i],o)):Jr[i]=o}})),Dr.curConfig=Jr},Dr.setCustomHandlers=function(e){return Dr.ready((function(){e.open&&(Ur('#tool_open > input[type="file"]').remove(),Ur("#tool_open").show(),Fr.open=e.open),e.save&&(Dr.showSaveWarning=!1,Fr.bind("saved",e.save)),e.exportImage&&(Kr=e.exportImage,Fr.bind("exported",Kr)),e.exportPDF&&(Zr=e.exportPDF,Fr.bind("exportedPDF",Zr))}))},Dr.randomizeIds=function(e){Fr.randomizeIds(e)},Dr.init=function(){!("svgEditor"in window)||!window.svgEditor||!1!==window.svgEditor.modules||Object.assign(Wr,{langPath:"../../dist/locale/",extPath:"../../dist/extensions/",canvgPath:"../../dist/",jspdfPath:"../../dist/"});try{"localStorage"in window&&(Dr.storage=localStorage)}catch(e){}var e=[];function t(){(Jr=Ur.extend(!0,{},Wr,Jr)).noDefaultExtensions||(Jr.extensions=Jr.extensions.concat(qr)),["extensions","stylesheets","allowedOrigins"].forEach((function(e){Jr[e]=Ur.grep(Jr[e],(function(t,n){return n===Jr[e].indexOf(t)}))})),Dr.curConfig=Jr}Ur("#lang_select option").each((function(){e.push(this.value)})),function(){var e,n,r,a=new URL(location),i=a.search,o=a.searchParams;if(i){if(e=o.toString(),n=!0,r={},e.replace(/\+/g," ").split("&").forEach((function(e){var t=e.split("="),a=decodeURIComponent(t[0]),i=a.split("]["),o=i.length-1;if(/\[/.test(i[0])&&/\]$/.test(i[o])?(i[o]=i[o].replace(/\]$/,""),o=(i=i.shift().split("[").concat(i)).length-1):o=0,t.length>=2){var s=decodeURIComponent(t.slice(1).join("="));if(n&&(s=s&&!isNaN(s)?+s:"undefined"===s?void 0:void 0!==xt[s]?xt[s]:s),o)for(var l=r,c=0;c<=o;c++)l=l[a=""===i[c]?l.length:i[c]]=c<o?l[a]||(i[c+1]&&isNaN(i[c+1])?{}:[]):s;else Array.isArray(r[a])?r[a].push(s):void 0!==r[a]?r[a]=[r[a],s]:r[a]=s}else a&&(r[a]=n?void 0:"")})),Yr=r,["initStroke","initFill"].forEach((function(e){o.has("".concat(e,"[color]"))&&(Yr[e].color=o.get("".concat(e,"[color]")))})),o.has("bkgd_color")&&(Yr.bkgd_color="#"+o.get("bkgd_color")),Yr.dimensions&&(Yr.dimensions=Yr.dimensions.split(",")),Yr.extensions&&(Yr.extensions=Yr.extensions.match(/[:/\\]/)?"":Yr.extensions.split(",")),["langPath","extPath","canvgPath","jspdfPath","imgPath","jGraduatePath","extIconsPath"].forEach((function(e){Yr[e]&&delete Yr[e]})),Dr.setConfig(Yr,{overwrite:!1}),t(),!Jr.preventURLContentLoading){var s=Yr.source;if(!s){var l=o.get("source");l&&l.startsWith("data:")&&(s=l)}if(s)return void(s.startsWith("data:")?Dr.loadFromDataURI(s):Dr.loadFromString(s));if(Yr.url)return void Dr.loadFromURL(Yr.url)}Yr.noStorageOnLoad&&!Jr.forceStorage||Dr.loadContentAndPrefs()}else t(),Dr.loadContentAndPrefs()}(),$r=Ur.extend(!0,{},Hr,$r),Dr.curPrefs=$r;var a=Dr.setIcon=function(e,t,n){var r="string"==typeof t?Ur.getSvgIcon(t,!0):t.clone();r?Ur(e).empty().append(r):console.log("NOTE: Icon image missing: "+t)},o=function(){var t=n(regeneratorRuntime.mark((function t(){var r,a,i,o,s,l;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Dr.putLocale(Dr.pref("lang"),e,Jr);case 2:return r=t.sent,a=r.langParam,i=r.langData,t.next=7,Gn(a,i);case 7:return o=Xr.common,s=o.ok,l=o.cancel,wt(Ur,{ok:s,cancel:l}),Ur.svgIcons(Jr.imgPath+"svg_edit_icons.svg",{w:24,h:24,id_match:!1,no_img:!U(),fallback_path:Jr.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",config:"config.png"},placement:{"#logo":"logo","#tool_clear div,#layer_new":"new_image","#tool_save div":"save","#tool_export div":"export","#tool_open div":"open","#tool_import div":"import","#tool_source":"source","#tool_docprops > div":"docprops","#tool_editor_prefs > div":"config","#tool_editor_homepage > div":"globe_link","#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){return n(regeneratorRuntime.mark((function e(){var t,n,r,a,i,o,s;return regeneratorRuntime.wrap((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}},Ur(".toolbar_button button > svg, .toolbar_button button > img").each((function(){Ur(this).parent().prepend(this)})),(t=Ur("#tools_left")).length&&(n=t.offset().top+t.outerHeight()),r=Dr.pref("iconsize"),Dr.setIconSize(r||(Ur(window).height()<n?"s":"m")),Ur(".tools_flyout").each((function(){var e=Ur("#"+this.id+"_show"),t=e.attr("data-curopt");if(!e.children("svg, img").length){var n=Ur(t).children().clone();n.length&&(n[0].removeAttribute("style"),e.append(n))}})),i=Ur.loadingStylesheets.sort((function(e,t){var n=a(e),r=a(t);return n===r?0:n>r})),Jr.stylesheets.length&&(i=p(new Set(Jr.stylesheets)),(o=i.indexOf("@default"))>-1&&(s=i).splice.apply(s,[o,1].concat(p(Ur.loadingStylesheets)))),e.next=11,Rr(i,{acceptErrors:function(e){var t=e.stylesheetURL,n=e.reject,r=e.resolve;Ur.loadingStylesheets.includes(t)?n(new Error("Missing expected stylesheet: ".concat(t))):r()}});case 11:return Ur("#svg_container")[0].style.visibility="visible",e.next=14,Dr.runCallbacks();case 14:case"end":return e.stop()}}),e)})))()}}),t.prev=10,t.next=13,Promise.all(Jr.extensions.map(function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i,o,s,l,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.match(/^ext-(.+)\.js/)){e.next=3;break}return e.abrupt("return",void 0);case 3:return r=Jr.extPath+t,e.prev=4,e.next=7,mt(r,{global:"svgEditorExtension_"+n[1].replace(/-/g,"_")});case 7:return i=e.sent,o=i.name,s=void 0===o?n[1]:o,l=i.init,c=na({defaultLang:a,defaultName:s}),e.abrupt("return",Dr.addExtension(s,l&&l.bind(Dr),{$:Ur,importLocale:c}));case 13:return e.prev=13,e.t0=e.catch(4),console.log(e.t0),console.error("Extension failed to load: "+t+"; "+e.t0),e.abrupt("return",void 0);case 18:case"end":return e.stop()}}),e,null,[[4,13]])})));return function(t){return e.apply(this,arguments)}}()));case 13:Fr.bind("extensions_added",(function(e,t){ra=!0,bn.setAll(),Ur(".flyout_arrow_horiz:empty").each((function(){Ur(this).append(Ur.getSvgIcon("arrow_right",!0).width(5).height(5))})),"ignore"===Dr.storagePromptState&&J(!0),aa.forEach((function(e){Fr.call("message",e)}))})),Fr.call("extensions_added"),t.next=20;break;case 17:t.prev=17,t.t0=t.catch(10),console.log(t.t0);case 20:case"end":return t.stop()}}),t,null,[[10,17]])})));return function(){return t.apply(this,arguments)}}(),s={tool_scale:Dr.tool_scale},l=function(){Ur(".tools_flyout").each((function(){var e=Ur("#"+this.id+"_show"),t=e.offset(),n=t.left,r=t.top,a=e.outerWidth();Ur(this).css({left:(n+a)*Dr.tool_scale,top:r})}))},c=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":""}(),u=Dr.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=Ur(t),r=1;if("number"==typeof e)r=e;else{r={s:.75,m:1,l:1.25,xl:1.5}[e]}s.tool_scale=Dr.tool_scale=r,l();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=Ur(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);ut(s)&&(s=Number.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(),Dr.pref("iconsize",e),Ur("#iconsize").val(e);var i={"#tools_top":{left:50+Ur("#main_button").width(),height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}},o=Ur("#tool_size_rules");if(o.length?o.empty():o=Ur('<style id="tool_size_rules"></style>').appendTo("head"),"m"!==e){var u="";Ur.each(i,(function(t,n){t="#svg_editor "+t.replace(/,/g,", #svg_editor"),u+=t+"{",Ur.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="-"+c.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+");}",o.text(u)}l()};Dr.canvas=Fr=new kr(document.getElementById("svgcanvas"),Jr);var d,h,g=q()?"meta+":"ctrl+",m=Fr.pathActions,v=Fr.undoMgr,y=Ur("#workarea"),b=Ur("#cmenu_canvas"),x={fill:null,stroke:null},w=null,S=Jr.imgPath+"logo.png",k="crosshair",C="crosshair",A="toolbars";!function(){var e=window.opener||window.parent;if(e)try{var t=new e.CustomEvent("svgEditorReady",{bubbles:!0,cancelable:!0});e.document.documentElement.dispatchEvent(t)}catch(e){}}();for(var E=function(){var e=Ur(".tool_button_current");e.length&&"tool_select"!==e[0].id&&(e.removeClass("tool_button_current").addClass("tool_button"),Ur("#tool_select").addClass("tool_button_current").removeClass("tool_button"),Ur("#styleoverrides").text("\n #svgcanvas svg * {\n cursor: move;\n pointer-events: all;\n }\n #svgcanvas svg {\n cursor: default;\n }\n ")),Fr.setMode("select"),y.css("cursor","auto")},G=Ur("title:first").text(),N=[],P=.1;P<1e5;P*=10)N.push(P),N.push(2*P),N.push(5*P);var I=function(e){var t,n=[],r=Fr.getCurrentDrawing().getNumLayers();for(t=0;t<r;t++)n[t]=Fr.getCurrentDrawing().getLayerName(t);e?n.forEach((function(t){t!==e&&Fr.getCurrentDrawing().setLayerOpacity(t,.5)})):n.forEach((function(e){Fr.getCurrentDrawing().setLayerOpacity(e,1)}))},T=function(){Fr.clearSelection();for(var e=Ur("#layerlist tbody").empty(),t=Ur("#selLayerNames").empty(),n=Fr.getCurrentDrawing(),r=n.getCurrentLayerName(),a=Ur.getSvgIcon("eye"),i=Fr.getCurrentDrawing().getNumLayers();i--;){var o=n.getLayerName(i),s=Ur('<tr class="layer">').toggleClass("layersel",o===r),l=Ur('<td class="layervis">').toggleClass("layerinvis",!n.getLayerVisibility(o)),c=Ur('<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();Ur("td.layervis",e).append(u),Ur.resizeSvgIcons({"td.layervis .svg_icon":14})}Ur("#layerlist td.layername").mouseup((function(e){Ur("#layerlist tr.layer").removeClass("layersel"),Ur(this.parentNode).addClass("layersel"),Fr.setCurrentLayer(this.textContent),e.preventDefault()})).mouseover((function(){I(this.textContent)})).mouseout((function(){I()})),Ur("#layerlist td.layervis").click((function(){var e=Ur(this.parentNode).prevAll().length,t=Ur("#layerlist tr.layer:eq("+e+") td.layername").text(),n=Ur(this).hasClass("layerinvis");Fr.setLayerVisibility(t,n),Ur(this).toggleClass("layerinvis")}));for(var d=5-Ur("#layerlist tr.layer").size();d-- >0;)e.append('<tr><td style="color:white">_</td><td/></tr>')},L=!1,M="",O=function(e,t){L||(L=!0,M=Fr.getSvgString(),Ur("#save_output_btns").toggle(Boolean(t)),Ur("#tool_source_back").toggle(!t),Ur("#svg_source_textarea").val(M),Ur("#svg_source_editor").fadeIn(),Ur("#svg_source_textarea").focus())},j=null,V=!1,R=function(){window.opera&&Ur("<p/>").hide().appendTo("body").remove()};function B(e,t){var n=e.id,r=f(n.split("_"),2),i=r[0],o=r[1];t&&Fr.setStrokeAttr("stroke-"+i,o),R(),a("#cur_"+i,n,20),Ur(e).addClass("current").siblings().removeClass("current")}var D=Dr.toolButtonClick=function(e,t){if(Ur(e).hasClass("disabled"))return!1;if(Ur(e).parent().hasClass("tools_flyout"))return!0;return t||Ur(".tools_flyout").fadeOut("normal"),Ur("#styleoverrides").text(""),y.css("cursor","auto"),Ur(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),Ur(e).addClass("tool_button_current").removeClass("tool_button"),!0},X=Dr.clickSelect=function(){D("#tool_select")&&(Fr.setMode("select"),Ur("#styleoverrides").text("\n #svgcanvas svg * {\n cursor: move;\n pointer-events: all;\n }\n #svgcanvas svg {\n cursor: default;\n }\n "))},Y=Dr.setImageURL=function(e){e||(e=S),Fr.setImageURL(e),Ur("#image_url").val(e),e.startsWith("data:")?(Ur("#image_url").hide(),Ur("#change_image_url").show()):(Fr.embedImage(e,(function(t){Ur("#url_notice").toggle(!t),S=e})),Ur("#image_url").show(),Ur("#change_image_url").hide())};function Q(e,t){Dr.pref("bkgd_color",e),Dr.pref("bkgd_url",t,!0),Fr.setBackground(e,t)}function K(){return Z.apply(this,arguments)}function Z(){return(Z=n(regeneratorRuntime.mark((function e(){var t,n,r,a,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},n=t.cancelDeletes,r=void 0!==n&&n,a=(a=Fr.getHref(j)).startsWith("data:")?"":a,e.next=5,Ur.prompt(Xr.notification.enterNewImgURL,a);case 5:(i=e.sent)?Y(i):r&&Fr.deleteSelectedElements();case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $(e,t){var n,r;t||(t=Fr.getZoom()),e||(e=Ur("#svgcanvas"));var a=Fr.getContentElem(),i=oe()[Jr.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=Ur("#ruler_"+s+" canvas:first"),d=u.clone();u.replaceWith(d);var h=d[0],f=e[l](),p=f;h.parentNode.style[l]=p+"px";var g=h.getContext("2d"),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(),f>=3e4){y=Number.parseInt(f/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]=f%3e4,f=3e4}h[l]=f;var b=i*t,x=50/b,w=1;for(r=0;r<N.length&&(w=v=N[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<p;){C+=S;var E=Math.round(k)+.5;o?(g.moveTo(E,15),g.lineTo(E,0)):(g.moveTo(15,E),g.lineTo(0,E)),v=(C-c)/b;var G=void 0;if(w>=1)G=Math.round(v);else{var P=String(w).split(".")[1].length;G=v.toFixed(P)}if(0!==G&&1e3!==G&&G%1e3==0&&(G=G/1e3+"K"),o)g.fillText(G,k+2,8);else{var I=String(G).split("");for(r=0;r<I.length;r++)g.fillText(I[r],1,k+9+9*r)}var T=S/10;for(r=1;r<10;r++){var L=Math.round(k+T*r)+.5;if(m&&L>f){if(A++,g.stroke(),A>=y){r=10,k=p;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 J=Dr.updateCanvas=function(e,t){var n=Fr.getZoom(),r=y,a=Ur("#svgcanvas"),i=y.width(),o=y.height(),s=i,l=o,c=r[0].scrollLeft+s/2,u=r[0].scrollTop+l/2,d=Jr.canvas_expansion;i=Math.max(s,Fr.contentW*n*d),o=Math.max(l,Fr.contentH*n*d),i===s&&o===l?y.css("overflow","hidden"):y.css("overflow","scroll");var h=a.height()/2,f=a.width()/2;a.width(i).height(o);var p=o/2,g=i/2,m=Fr.updateCanvas(i,o),v=g/f,_=i/2-s/2,b=o/2-l/2;t?(t.x+=m.x,t.y+=m.y):t={x:g+(c-f)*v,y:p+(u-h)*v};e?Fr.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),Jr.showRulers&&($(a,n),y.scroll()),!0!==Yr.storagePrompt&&"ignore"===Dr.storagePromptState&&Ur("#dialog_box").hide()},ee=function(){var e="none"===Fr.getColor("fill"),t="none"===Fr.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){Ur(e).hasClass("tool_button_current")&&X(),Ur(e).addClass("disabled")})):n.forEach((function(e){Ur(e).removeClass("disabled")})),t&&e?r.forEach((function(e){Ur(e).hasClass("tool_button_current")&&X(),Ur(e).addClass("disabled")})):r.forEach((function(e){Ur(e).removeClass("disabled")})),Fr.runExtensions("toolButtonStateUpdate",{nofill:e,nostroke:t}),Ur(".tools_flyout").each((function(){var e=Ur("#"+this.id+"_show"),t=!1;Ur(this).children().each((function(){Ur(this).hasClass("disabled")||(t=!0)})),e.toggleClass("disabled",!t)})),R()},te=function(){var e=j;ut(e)||e.parentNode||(e=null);var t=Fr.getCurrentDrawing().getCurrentLayerName(),n=Fr.getMode(),r="px"!==Jr.baseUnit?Jr.baseUnit:null,i="pathedit"===n,o=Ur("#cmenu_canvas li");if(Ur("#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(),ut(e))V?(Ur("#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=Fr.getRotationAngle(e);Ur("#angle").val(l);var c=Fr.getBlur(e);if(Ur("#blur").val(c),Ur("#blur_slider").slider("option","value",c),Fr.addedNew&&"image"===s&&"image"===Fr.getMode()&&(Fr.getHref(e).startsWith("data:")||K({cancelDeletes:!0})),i||"pathedit"===n){var u=m.getNodePoint();if(Ur("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"),Ur("#tool_node_delete").toggleClass("disabled",!m.canDeleteNodes),a("#tool_openclose_path",m.closed_subpath?"open_path":"close_path"),u){var d=Ur("#seg_type");r&&(u.x=le(u.x),u.y=le(u.y)),Ur("#path_node_x").val(u.x),Ur("#path_node_y").val(u.y),u.type?d.val(u.type).removeAttr("disabled"):d.val(4).attr("disabled","disabled")}return}if(Ur("#selected_panel").show(),["line","circle","ellipse"].includes(s))Ur("#xy_panel").hide();else{var h,f;if(["g","polyline","path"].includes(s)){var p=Fr.getStrokedBBox([e]);p&&(h=p.x,f=p.y)}else h=e.getAttribute("x"),f=e.getAttribute("y");r&&(h=le(h),f=le(f)),Ur("#selected_x").val(h||0),Ur("#selected_y").val(f||0),Ur("#xy_panel").show()}var g=!["image","text","path","g","use"].includes(s);Ur("#tool_topath").toggle(g),Ur("#tool_reorient").toggle("path"===s),Ur("#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:[]},_=e.tagName,x=null;if("a"===_&&(x=Fr.getHref(e),Ur("#g_panel").show()),"a"===e.parentNode.tagName&&(Ur(e).siblings().length||(Ur("#a_panel").show(),x=Fr.getHref(e.parentNode))),Ur("#tool_make_link, #tool_make_link").toggle(!x),x&&Ur("#link_url").val(x),y[_]){var w=y[_];if(Ur("#"+_+"_panel").show(),Ur.each(w,(function(t,n){var r=e.getAttribute(n);if("px"!==Jr.baseUnit&&e[n]){var a=e[n].baseVal.value;r=le(a)}Ur("#"+_+"_"+n).val(r||0)})),"text"===_)Ur("#text_panel").css("display","inline"),Ur("#tool_font_size").css("display","inline"),Fr.getItalic()?Ur("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):Ur("#tool_italic").removeClass("push_button_pressed").addClass("tool_button"),Fr.getBold()?Ur("#tool_bold").addClass("push_button_pressed").removeClass("tool_button"):Ur("#tool_bold").removeClass("push_button_pressed").addClass("tool_button"),Ur("#font_family").val(e.getAttribute("font-family")),Ur("#font_size").val(e.getAttribute("font-size")),Ur("#text").val(e.textContent),Fr.addedNew&&setTimeout((function(){Ur("#text").focus().select()}),100);else if("image"===_&&"image"===Fr.getMode())Y(Fr.getHref(e));else if("g"===_||"use"===_){Ur("#container_panel").show();var S=Fr.getTitle(),k=Ur("#g_title")[0];k.value=S,function(e){var t=Math.min(Math.max(12+6*e.value.length,50),300);Ur(e).width(t)}(k),Ur("#g_title").prop("disabled","use"===_)}}o[("g"===_?"en":"dis")+"ableContextMenuItems"]("#ungroup"),o[("g"!==_&&V?"en":"dis")+"ableContextMenuItems"]("#group")}Ur("#tool_undo").toggleClass("disabled",0===v.getUndoStackSize()),Ur("#tool_redo").toggleClass("disabled",0===v.getRedoStackSize()),Fr.addedNew=!1,e&&!i||V?(Ur("#selLayerNames").removeAttr("disabled").val(t),b.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")):Ur("#selLayerNames").attr("disabled","disabled")},ne=function(){if(!rn){var e="\n #workarea.wireframe #svgcontent * {\n stroke-width: ".concat(1/Fr.getZoom(),"px;\n }\n ");Ur("#wireframe_rules").text(y.hasClass("wireframe")?e:"")}},re="",ae=function(e){e=e||Fr.getDocumentTitle();var t=G+(e?": "+e:"");Ur("title:first").text(t)};var ie=function(){ne()},se=Fr.zoomChanged=function(e,t,n){var r=y,a=Fr.setBBoxZoom(t,r.width()-15,r.height()-15);if(a){var i=a.zoom,o=a.bbox;i<.001?ce({value:.1}):(Ur("#zoom").val((100*i).toFixed(1)),n?J():J(!1,{x:o.x*i+o.width*i/2,y:o.y*i+o.height*i/2}),"zoom"===Fr.getMode()&&o.width&&E(),ie())}},ce=function(e){var t=e.value/100;if(t<.001)e.value=.1;else{var n=Fr.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)}};Ur("#cur_context_panel").delegate("a","click",(function(){var e=Ur(this);return e.attr("data-root")?Fr.leaveContext():Fr.setContext(e.text()),Fr.clearSelection(),!1}));var ue=function(){x.fill.prep(),x.stroke.prep()},he={},fe=function(){Ur(".tools_flyout").each((function(){var e=Ur("#"+this.id+"_show");if(!e.data("isLibrary")){var t=Ur(this).children().map((function(){return this.title})).get();e[0].title=t.join(" / ")}}))},pe={},ge=function(e){Ur.each(e,(function(t,n){var r;pe[t]||(pe[t]=[]),(r=pe[t]).push.apply(r,p(n));var a,i=Ur(t).children().not(".tool_button_evt_handled"),o=t+"_show",s=Ur(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=f(e,2);n[0];return n[1].sel===t})),a=f(r,2),i=a[0],c=a[1];he[c.sel]=c.fn,c.isDefault&&(l=i);var u=function(t){var n,r=c;if("keydown"===t.type){var a=Ur(r.parent+"_show").hasClass("tool_button_current"),i=Ur(r.parent+"_show").attr("data-curopt");Object.entries(e[c.parent]).some((function(n){var o=f(n,2),s=o[0],l=o[1];return l.sel===i&&(t.shiftKey&&a?(s=Number.parseInt(s),r=pe[c.parent][s+1]||e[c.parent][0]):r=l,!0)}))}return!Ur(this).hasClass("disabled")&&(D(o)&&r.fn(),(n=r.icon?Ur.getSvgIcon(r.icon,!0):Ur(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 Ur(this).mouseup(u),c.key&&Ur(document).bind("keydown",c.key[0]+" shift+"+c.key[0],u),!0})),l?s.attr("data-curopt",n[l].sel):s.attr("data-curopt")||s.attr("data-curopt",n[0].sel),s.mousedown((function(e){if(s.hasClass("disabled"))return!1;var n=Ur(t),r=Ur(o).position().left+34,i=-1*n.width(),l=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)}),l),e.preventDefault(),!0})).mouseup((function(e){clearTimeout(a);var t=Ur(this).attr("data-curopt");s.data("isLibrary")&&Ur(o.replace("_show","")).is(":visible")?D(o,!0):D(o)&&he[t]&&he[t]()}))})),fe(),l()},me=function(e,t){return Ur("<div>",{class:"tools_flyout",id:e}).appendTo("#svg_editor").append(t)},ve=function(e,t,n,r){var i=Ur(e),o=r.dropUp,s=Ur(t);o&&Ur(e).addClass("dropup"),s.find("li").bind("mouseup",(function(){r.seticon&&(a("#cur_"+i[0].id,Ur(this).children()),Ur(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;Ur(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}))},ye=[],_e=function(){var e=n(regeneratorRuntime.mark((function e(t,n){var r,a,i,o,s,l,c,h,f,p,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=function(){d&&(clearTimeout(d),d=null),a||(d=setTimeout((function(){a=!0,u(Dr.pref("iconsize"))}),50))},n){e.next=3;break}return e.abrupt("return",void 0);case 3:if(r=!1,a=!1,!n.langReady){e.next=14;break}if(!Dr.langChanged){e.next=13;break}return i=Dr.pref("lang"),e.next=10,n.langReady({lang:i,uiStrings:Xr,importLocale:na({defaultLang:i,defaultName:n.name})});case 10:En.push(n.name),e.next=14;break;case 13:ye.push(n);case 14:if(s=function(){n.callback&&!r&&(r=!0,n.callback.call(Dr))},l=[],n.context_tools&&Ur.each(n.context_tools,(function(e,t){var n,r=t.container_id?' id="'+t.container_id+'"':"",a=Ur("#"+t.panel);switch(a.length||(a=Ur("<div>",{id:t.panel}).appendTo("#tools_top")),t.type){case"tool_button":n='<div class="tool_button">'+t.id+"</div>";var i=Ur(n).appendTo(a);t.events&&Ur.each(t.events,(function(e,t){Ur(i).bind(e,t)}));break;case"select":n="<label"+r+'><select id="'+t.id+'">',Ur.each(t.options,(function(e,r){var a=e===t.defval?" selected":"";n+='<option value="'+e+'"'+a+">"+r+"</option>"}));var o=Ur(n+="</select></label>").appendTo(a).find("select");Ur.each(t.events,(function(e,t){Ur(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 s=Ur('<ul id="'+t.id+'_opts"></ul>').appendTo("#option_lists");t.colnum&&s.addClass("optcols"+t.colnum),Ur(n).appendTo(a).children(),l.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=Ur(n).appendTo(a).find("input");t.spindata&&c.SpinButton(t.spindata),t.events&&Ur.each(t.events,(function(e,t){c.bind(e,t)}))}})),c=n.svgicons,!n.buttons){e.next=24;break}if(h={},f={},p={},g={},Ur.each(n.buttons,(function(e,t){for(var n,r,a,i,o,s,l,u=t.id,d=e;Ur("#"+u).length;)u=t.id+"_"+ ++d;if(c){h[u]=t.icon,f[u]=t.title;var m=t.svgicon||t.id;"app_menu"===t.type?p["#"+u+" > div"]=m:p["#"+u]=m}else n=Ur('<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,Ur(a).length||Ur("<div>",{id:t.panel}).appendTo("#tools_top");break;case"app_menu":r="",a="#main_menu ul"}var v,y=Ur(t.list||"app_menu"===t.type?"<li/>":"<div/>").attr("id",u).attr("title",t.title).addClass(r);if(t.includeWith||t.list){if(t.list){if(y.addClass("push_button"),Ur("#"+t.list+"_opts").append(y),t.isDefault){Ur("#cur_"+t.list).append(y.children().clone());var _=t.svgicon||t.id;p["#cur_"+t.list]=_}}else if(t.includeWith){var b,x=t.includeWith;i=(l=Ur(x.button)).parent(),l.parent().hasClass("tools_flyout")||(b=l[0].id.replace("tool_","tools_"),o=l.clone().attr("id",b+"_show").append(Ur("<div>",{class:"flyout_arrow_horiz"})),l.before(o),i=me(b,l)),s=bn.getButtonData(x.button),x.isDefault&&(p["#"+b+"_show"]=t.id);var w=g["#"+i[0].id]=[{sel:"#"+u,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?Ur(a).children().eq(t.position).length?Ur(a).children().eq(t.position).before(y):Ur(a).children().last().after(y):y.appendTo(a),"mode_flyout"===t.type?(i=(l=Ur(y)).parent(),l.parent().hasClass("tools_flyout")||(v=l[0].id.replace("tool_","tools_"),o=l.clone().attr("id",v+"_show").append(Ur("<div>",{class:"flyout_arrow_horiz"})),l.before(o),(i=me(v,l)).data("isLibrary",!0),o.data("isLibrary",!0)),p["#"+v+"_show"]=t.id,g["#"+i[0].id]=[{sel:"#"+u,fn:t.events.click,icon:t.id,isDefault:!0}]):"app_menu"===t.type&&y.append("<div>").append(t.title);c||y.append(n),t.list||Ur.each(t.events,(function(e,n){"click"===e&&"mode"===t.type?(W()&&"click"===e&&(e="mousedown"),t.includeWith?y.bind(e,n):y.bind(e,(function(){D(y)&&n()})),t.key&&(Ur(document).bind("keydown",t.key,n),t.title&&y.attr("title",t.title+" ["+t.key+"]"))):y.bind(e,n)})),ge(g)})),Ur.each(l,(function(){ve(this.elem,this.list,this.callback,{seticon:!0})})),!c){e.next=24;break}return e.abrupt("return",new Promise((function(e,t){Ur.svgIcons(c,{w:24,h:24,id_match:!1,no_img:!U(),fallback:h,placement:p,callback:function(t){"m"!==Dr.pref("iconsize")&&o(),s(),e()}})})));case 24:return e.abrupt("return",s());case 25:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();Fr.bind("selected",(function(e,t){var n=Fr.getMode();"select"===n&&E();var r="pathedit"===n;j=1===t.length||ut(t[1])?t[0]:null,V=t.length>=2&&!ut(t[1]),ut(j)||r||function(){var e,t;if(!ut(j))switch(j.tagName){case"use":case"image":case"foreignObject":break;case"g":case"a":var n=j.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)}Ur("#stroke_width").val(null===r?"":r),x.fill.update(!0),x.stroke.update(!0);break;default:x.fill.update(!0),x.stroke.update(!0),Ur("#stroke_width").val(j.getAttribute("stroke-width")||1),Ur("#stroke_style").val(j.getAttribute("stroke-dasharray")||"none");var i=j.getAttribute("stroke-linejoin")||"miter";Ur("#linejoin_"+i).length&&B(Ur("#linejoin_"+i)[0]),i=j.getAttribute("stroke-linecap")||"butt",Ur("#linecap_"+i).length&&B(Ur("#linecap_"+i)[0])}if(!ut(j)){var o=100*(j.getAttribute("opacity")||1);Ur("#group_opacity").val(o),Ur("#opac_slider").slider("option","value",o),Ur("#elem_id").val(j.id),Ur("#elem_class").val(j.getAttribute("class"))}ee()}(),function(e,t){Ur("#path_node_panel").toggle(e),Ur("#tools_bottom_2,#tools_bottom_3").toggle(!e),e?(Ur(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),Ur("#tool_select").addClass("tool_button_current").removeClass("tool_button"),a("#tool_select","select_node"),V=!1,t.length&&(j=t[0])):setTimeout((function(){a("#tool_select","select")}),1e3)}(r,t),te(),Fr.runExtensions("selectedChanged",{elems:t,selectedElement:j,multiselected:V})})),Fr.bind("transition",(function(e,t){var n=Fr.getMode(),r=t[0];if(r){if(!(V=t.length>=2&&!ut(t[1])))switch(n){case"rotate":var a=Fr.getRotationAngle(r);Ur("#angle").val(a),Ur("#tool_reorient").toggleClass("disabled",0===a)}Fr.runExtensions("elementTransition",{elems:t})}})),Fr.bind("changed",(function(e,t){var n=Fr.getMode();"select"===n&&E(),t.forEach((function(e){var t=e&&"svg"===e.tagName;t||function(e){return e&&"g"===e.tagName&&wn.CLASS_REGEX.test(e.getAttribute("class"))}(e)?(T(),t&&J()):e&&j&&ut(j.parentNode)&&(j=e)})),Dr.showSaveWarning=!0,te(),j&&"select"===n&&(x.fill.update(),x.stroke.update()),Fr.runExtensions("elementChanged",{elems:t})})),Fr.bind("saved",(function(e,t){if(Dr.showSaveWarning=!1,t='<?xml version="1.0"?>\n'+t,z())O(0,!0);else{var n=document.createElement("a");n.href="data:image/svg+xml;base64,"+Ie(t),n.download="icon.svg",n.style.display="none",document.body.append(n),n.click();var r=Dr.pref("save_notice_done");if("all"!==r){var a=Xr.notification.saveFromBrowser.replace("%s","SVG");F()?t.includes("<defs")?(a+="\n\n"+Xr.notification.defsFailOnSave,Dr.pref("save_notice_done","all"),r="all"):Dr.pref("save_notice_done","part"):Dr.pref("save_notice_done","all"),"part"!==r&&Ur.alert(a)}}})),Fr.bind("exported",(function(e,t){var n=t.issues,r=t.exportWindowName;if((w=window.open(Ve||"",r))&&!w.closed){if(w.location.href=t.bloburl||t.datauri,"all"!==Dr.pref("export_notice_done")){var a=Xr.notification.saveFromBrowser.replace("%s",t.type);if(n.length){a+="\n\n"+Xr.notification.noteTheseIssues+"\n • "+n.join("\n • ")}Dr.pref("export_notice_done","all"),w.alert(a)}}else Ur.alert(Xr.notification.popupWindowBlocked)})),Fr.bind("exportedPDF",(function(e,t){if(t.output){var n=t.exportWindowName;n&&(w=window.open("",n)),w&&!w.closed?w.location.href=t.output:Ur.alert(Xr.notification.popupWindowBlocked)}})),Fr.bind("zoomed",se),Fr.bind("zoomDone",ie),Fr.bind("updateCanvas",(function(e,t){var n=t.center,r=t.newCtr;J(n,r)})),Fr.bind("contextset",(function(e,t){var n="";if(t){var r="";n='<a href="#" data-root="y">'+Fr.getCurrentDrawing().getCurrentLayerName()+"</a>",Ur(t).parentsUntil("#svgcontent > g").andSelf().each((function(){this.id&&(r+=" > "+this.id,n+=this!==t?' > <a href="#">'+this.id+"</a>":" > "+this.id)})),re=r}else re=null;Ur("#cur_context_panel").toggle(Boolean(t)).html(n),ae()})),Fr.bind("extension_added",_e),Fr.textActions.setInputElem(Ur("#text")[0]);var be='<div class="palette_item" data-rgb="none"></div>';Ur.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){be+='<div class="palette_item" style="background-color: '+t+';" data-rgb="'+t+'"></div>'})),Ur("#palette").append(be);be="",Ur.each(["#FFF","#888","#000","chessboard"],(function(e,t){be+="chessboard"===t?'<div class="color_block" data-bgcolor="'+t+'" style="background-image:url(data:image/gif;base64,R0lGODlhEAAQAIAAAP///9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjG+gq4jM3IFLJgpswNly/XkcBpIiVaInlLJr9FZWAQA7);"></div>':'<div class="color_block" data-bgcolor="'+t+'" style="background-color:'+t+';"></div>'})),Ur("#bg_blocks").append(be);var xe=Ur("#bg_blocks div"),we="cur_background";xe.each((function(){Ur(this).click((function(){xe.removeClass(we),Ur(this).addClass(we)}))})),Q(Dr.pref("bkgd_color"),Dr.pref("bkgd_url")),Ur("#image_save_opts input").val([Dr.pref("img_save")]);var Se=function(e,t){ut(t)&&(t=e.value),Ur("#group_opacity").val(t),e&&e.handle||Ur("#opac_slider").slider("option","value",t),Fr.setOpacity(t/100)},ke=function(e,t,n){ut(t)&&(t=e.value),Ur("#blur").val(t);var r=!1;e&&e.handle||(Ur("#blur_slider").slider("option","value",t),r=!0),n?Fr.setBlurNoUndo(t):Fr.setBlur(t,r)};Ur("#stroke_style").change((function(){Fr.setStrokeAttr("stroke-dasharray",Ur(this).val()),R()})),Ur("#stroke_linejoin").change((function(){Fr.setStrokeAttr("stroke-linejoin",Ur(this).val()),R()})),Ur("select").change((function(){Ur(this).blur()}));var Ce,Ae,Ee,Ge,Ne,Pe=!1;Ur("#selLayerNames").change(n(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.options[this.selectedIndex].value,n=Xr.notification.QmoveElemsToLayer.replace("%s",t),r=function(e){e&&(Pe=!0,Fr.moveSelectedToLayer(t),Fr.clearSelection(),T())},!t){e.next=14;break}if(!Pe){e.next=8;break}r(!0),e.next=14;break;case 8:return e.next=10,Ur.confirm(n);case 10:if(e.sent){e.next=13;break}return e.abrupt("return");case 13:r(!0);case 14:case"end":return e.stop()}}),e,this)})))),Ur("#font_family").change((function(){Fr.setFontFamily(this.value)})),Ur("#seg_type").change((function(){Fr.setSegType(Ur(this).val())})),Ur("#text").bind("keyup input",(function(){Fr.setTextContent(this.value)})),Ur("#image_url").change((function(){Y(this.value)})),Ur("#link_url").change((function(){this.value.length?Fr.setLinkURL(this.value):Fr.removeHyperlink()})),Ur("#g_title").change((function(){Fr.setGroupTitle(this.value)})),Ur(".attr_changer").change((function(){var e=this.getAttribute("data-attr"),t=this.value;if(!de(e,t,j))return this.value=j.getAttribute(e),Ur.alert(Xr.notification.invalidAttrValGiven),!1;if("id"!==e&&"class"!==e)if(isNaN(t))t=Fr.convertToNum(e,t);else if("px"!==Jr.baseUnit){var n=oe();(j[e]||"pathedit"===Fr.getMode()||"x"===e||"y"===e)&&(t*=n[Jr.baseUnit])}if("id"===e){var r=j;Fr.clearSelection(),r.id=t,Fr.addToSelection([r],!0)}else Fr.changeSelectedAttribute(e,t);return this.blur(),!0})),Ur("#palette").mouseover((function(){var e=Ur('<input type="hidden">');Ur(this).append(e),e.focus().remove()})),Ur(".palette_item").mousedown((function(e){var t,n=e.shiftKey||2===e.button?"stroke":"fill",r=Ur(this).data("rgb");"none"===r||"transparent"===r||"initial"===r?(r="none",t=new Ur.jGraduate.Paint):t=new Ur.jGraduate.Paint({alpha:100,solidColor:r.substr(1)}),x[n].setPaint(t),Fr.setColor(n,r),"none"!==r&&1!==Fr.getPaintOpacity(n)&&Fr.setPaintOpacity(n,1),ee()})).bind("contextmenu",(function(e){e.preventDefault()})),Ur("#toggle_stroke_tools").on("click",(function(){Ur("#tools_bottom").toggleClass("expanded")})),Ce=y[0],Ae=null,Ee=null,Ge=!1,Ne=!1,Ur("#svgcanvas").bind("mousemove mouseup",(function(e){return!1===Ge||(Ce.scrollLeft-=e.clientX-Ae,Ce.scrollTop-=e.clientY-Ee,Ae=e.clientX,Ee=e.clientY,"mouseup"===e.type&&(Ge=!1),!1)})).mousedown((function(e){return 1!==e.button&&!0!==Ne||(Ge=!0,Ae=e.clientX,Ee=e.clientY,!1)})),Ur(window).mouseup((function(){Ge=!1})),Ur(document).bind("keydown","space",(function(e){Fr.spaceKey=Ne=!0,e.preventDefault()})).bind("keyup","space",(function(e){e.preventDefault(),Fr.spaceKey=Ne=!1})).bind("keydown","shift",(function(e){"zoom"===Fr.getMode()&&y.css("cursor",C)})).bind("keyup","shift",(function(e){"zoom"===Fr.getMode()&&y.css("cursor",k)})),Dr.setPanning=function(e){Fr.spaceKey=Ne=e},function(){var e=Ur("#main_icon"),t=Ur("#main_icon span"),n=Ur("#main_menu"),r=!1,a=0,i=!0,o=!1;Ur(window).mouseup((function(t){r||(e.removeClass("buttondown"),"INPUT"!==t.target.tagName?n.fadeOut(200):o||(o=!0,Ur(t.target).click((function(){n.css("margin-left","-9999px").show()})))),r=!1})).mousedown((function(e){Ur(e.target).closest("div.tools_flyout, .contextMenu").length||Ur(".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=Ur("#main_menu li");s.mouseover((function(){i="rgba(0, 0, 0, 0)"===Ur(this).css("background-color"),s.unbind("mouseover"),i&&s.mouseover((function(){this.style.backgroundColor="#FFC"})).mouseout((function(){return this.style.backgroundColor="transparent",!0}))}))}(),Dr.addDropDown=function(e,t,n){if(Ur(e).length){var r=Ur(e).find("button"),a=Ur(e).find("ul").attr("id",Ur(e)[0].id+"-list");n?Ur(e).addClass("dropup"):Ur("#option_lists").append(a),a.find("li").bind("mouseup",t);var i=!1;Ur(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=Ur(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}))}},Dr.addDropDown("#font_family_dropdown",(function(){Ur("#font_family").val(Ur(this).text()).change()})),Dr.addDropDown("#opacity_dropdown",(function(){if(!Ur(this).find("div").length){var e=Number.parseInt(Ur(this).text().split("%")[0]);Se(!1,e)}}),!0),Ur("#opac_slider").slider({start:function(){Ur("#opacity_dropdown li:not(.special)").hide()},stop:function(){Ur("#opacity_dropdown li").show(),Ur(window).mouseup()},slide:function(e,t){Se(t)}}),Dr.addDropDown("#blur_dropdown",Ur.noop);var Te,Le,Me=!1;Ur("#blur_slider").slider({max:10,step:.1,stop:function(e,t){Me=!1,ke(t),Ur("#blur_dropdown li").show(),Ur(window).mouseup()},start:function(){Me=!0},slide:function(e,t){ke(t,null,Me)}}),Dr.addDropDown("#zoom_dropdown",(function(){var e=Ur(this),t=e.data("val");t?se(window,t):ce({value:Number.parseFloat(e.text())})}),!0),ve("#stroke_linecap","#linecap_opts",(function(){B(this,!0)}),{dropUp:!0}),ve("#stroke_linejoin","#linejoin_opts",(function(){B(this,!0)}),{dropUp:!0}),ve("#tool_position","#position_opts",(function(){var e=this.id.replace("tool_pos","").charAt(0);Fr.alignSelectedElements(e,"page")}),{multiclick:!0}),Le=function(){Ur(Te).blur()},Ur("#svg_editor").find("button, select, input:not(#text)").focus((function(){Te=this,A="toolbars",y.mousedown(Le)})).blur((function(){A="canvas",y.unbind("mousedown",Le),"textedit"===Fr.getMode()&&Ur("#text").focus()}));var Oe,je=function(){D("#tool_fhpath")&&Fr.setMode("fhpath")},Re=function(){D("#tool_line")&&Fr.setMode("line")},Be=function(){D("#tool_square")&&Fr.setMode("square")},De=function(){D("#tool_rect")&&Fr.setMode("rect")},Ue=function(){D("#tool_fhrect")&&Fr.setMode("fhrect")},Fe=function(){D("#tool_circle")&&Fr.setMode("circle")},ze=function(){D("#tool_ellipse")&&Fr.setMode("ellipse")},He=function(){D("#tool_fhellipse")&&Fr.setMode("fhellipse")},qe=function(){D("#tool_image")&&Fr.setMode("image")},We=function(){D("#tool_zoom")&&(Fr.setMode("zoom"),y.css("cursor",k))},Xe=function(e){var t=Fr.getResolution();e=e?t.zoom*e:1,Ur("#zoom").val(100*e),Fr.setZoom(e),ie(),J(!0)},Ye=function(){D("#tool_zoom")&&(Xe(),E())},Qe=function(){D("#tool_text")&&Fr.setMode("text")},Ke=function(){D("#tool_path")&&Fr.setMode("path")},Ze=function(){ut(j)&&!V||Fr.deleteSelectedElements()},$e=function(){ut(j)&&!V||Fr.cutSelectedElements()},Je=function(){ut(j)&&!V||Fr.copySelectedElements()},et=function(){var e=Fr.getZoom(),t=(y[0].scrollLeft+y.width()/2)/e-Fr.contentW,n=(y[0].scrollTop+y.height()/2)/e-Fr.contentH;Fr.pasteElements("point",t,n)},tt=function(){ut(j)||Fr.moveToTopSelectedElement()},nt=function(){ut(j)||Fr.moveToBottomSelectedElement()},rt=function(e){ut(j)||Fr.moveUpDownSelected(e)},at=function(){ut(j)||Fr.convertToPath()},it=function(){ut(j)||m.reorient()},ot=function(){var e=n(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ut(j)&&!V){e.next=5;break}return e.next=3,Ur.prompt(Xr.notification.enterNewLinkURL,"http://");case 3:(t=e.sent)&&Fr.makeHyperlink(t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),st=function(e,t){if(!ut(j)||V){if(Jr.gridSnapping){var n=Fr.getZoom()*Jr.snappingStep;e*=n,t*=n}Fr.moveSelectedElements(e,t)}},lt=function(){Ur("#tool_node_link").toggleClass("push_button_pressed tool_button");var e=Ur("#tool_node_link").hasClass("push_button_pressed");m.linkControlPoints(e)},ct=function(){m.getNodePoint()&&m.clonePathNode()},dt=function(){m.getNodePoint()&&m.deletePathNode()},ft=function(){var e=Ur("#tool_add_subpath"),t=!e.hasClass("push_button_pressed");e.toggleClass("push_button_pressed tool_button"),m.addSubPath(t)},pt=function(){m.opencloseSubPath()},gt=function(){Fr.cycleElement(1)},vt=function(){Fr.cycleElement(0)},yt=function(e,t){if(!ut(j)&&!V){e||(t*=-1);var n=Number.parseFloat(Ur("#angle").val())+t;Fr.setRotationAngle(n),te()}},_t=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=f(Jr.dimensions,2),n=t[0],r=t[1],e.next=3,Ur.confirm(Xr.notification.QwantToClear);case 3:if(e.sent){e.next=6;break}return e.abrupt("return");case 6:E(),Fr.clear(),Fr.setResolution(n,r),J(!0),Xe(),T(),te(),ue(),Fr.runExtensions("onNewDocument");case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),bt=function(){return Fr.setBold(!Fr.getBold()),te(),!1},St=function(){return Fr.setItalic(!Fr.getItalic()),te(),!1},kt=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,r,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=function(){var e,t,r=Xr.notification.loadingImage;if("new"===Jr.exportWindowType&&Dr.exportWindowCt++,n=Jr.canvasName+Dr.exportWindowCt,Oe)t=Oe;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"});t=URL.createObjectURL(a)}else t="data:text/html;base64;charset=utf-8,"+Ie(e);Oe=t}w=window.open(t,n)},e.next=3,Ur.select("Select an image type for export: ",["PNG","JPEG","BMP","WEBP","PDF"],(function(){var e=Ur(this);"JPEG"===e.val()||"WEBP"===e.val()?Ur("#image-slider").length||Ur("<div><label>".concat(Xr.ui.quality,'\n <input id="image-slider"\n type="range" min="1" max="100" value="92" />\n </label></div>')).appendTo(e.parent()):Ur("#image-slider").parent().remove()}));case 3:if(t=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(a=H(),"PDF"!==t){e.next=12;break}Zr||a||r(),Fr.exportPDF(n),e.next=16;break;case 12:return Kr||r(),i=Number.parseInt(Ur("#image-slider").val())/100,e.next=16,Fr.rasterExport(t,i,n);case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ct=function(){Fr.open()},At=function(){},Et=function(){v.getUndoStackSize()>0&&(v.undo(),T())},Gt=function(){v.getRedoStackSize()>0&&(v.redo(),T())},Nt=function(){V?Fr.groupSelectedElements():j&&Fr.ungroupSelectedElement()},Pt=function(){Fr.cloneSelectedElements(20,20)},It=function(){var e=this.id.replace("tool_align","").charAt(0);Fr.alignSelectedElements(e,Ur("#align_relative_to").val())},Tt=function(){if(Ur("#tool_wireframe").toggleClass("push_button_pressed tool_button"),y.toggleClass("wireframe"),!rn){var e=Ur("#wireframe_rules");e.length?e.empty():Ur('<style id="wireframe_rules"></style>').appendTo("head"),ne()}};Ur("#svg_docprops_container, #svg_prefs_container").draggable({cancel:"button,fieldset",containment:"window"}).css("position","absolute");var Lt,Mt,Ot=!1,jt=!1,Vt=function(){if(!Ot){Ot=!0,Ur("#image_save_opts input").val([Dr.pref("img_save")]);var e=Fr.getResolution();"px"!==Jr.baseUnit&&(e.w=le(e.w)+Jr.baseUnit,e.h=le(e.h)+Jr.baseUnit),Ur("#canvas_width").val(e.w),Ur("#canvas_height").val(e.h),Ur("#canvas_title").val(Fr.getDocumentTitle()),Ur("#svg_docprops").show()}},Rt=function(){if(!jt){jt=!0,Ur("#main_menu").hide();var e=$r.bkgd_color,t=Dr.pref("bkgd_url");xe.each((function(){var t=Ur(this),n=t.data("bgcolor")===e;t.toggleClass(we,n)})),e||xe.eq(0).addClass(we),t&&Ur("#canvas_bg_url").val(t),Ur("#grid_snapping_on").prop("checked",Jr.gridSnapping),Ur("#grid_snapping_step").attr("value",Jr.snappingStep),Ur("#grid_color").attr("value",Jr.gridColor),Ur("#svg_prefs").show()}},Bt=function(){window.open("https://github.com/SVG-Edit/svgedit","_blank")},Dt=function(){Ur("#svg_source_editor").hide(),L=!1,Ur("#svg_source_textarea").blur()},Ut=function(){var e=n(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(L){e.next=2;break}return e.abrupt("return");case 2:if(t=function(){Fr.clearSelection(),Dt(),Xe(),T(),ae(),ue()},Fr.setSvgString(Ur("#svg_source_textarea").val())){e.next=11;break}return e.next=6,Ur.confirm(Xr.notification.QerrorsRevertToSource);case 6:if(e.sent){e.next=9;break}return e.abrupt("return");case 9:return t(),e.abrupt("return");case 11:t(),E();case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ft=function(){Ur("#svg_docprops").hide(),Ur("#canvas_width,#canvas_height").removeAttr("disabled"),Ur("#resolution")[0].selectedIndex=0,Ur("#image_save_opts input").val([Dr.pref("img_save")]),Ot=!1},zt=function(){Ur("#svg_prefs").hide(),jt=!1},Ht=function(){var e=Ur("#canvas_title").val();ae(e),Fr.setDocumentTitle(e);var t=Ur("#canvas_width"),n=t.val(),r=Ur("#canvas_height"),a=r.val();return"fit"===n||de("width",n)?(t.parent().removeClass("error"),"fit"===a||de("height",a)?(r.parent().removeClass("error"),Fr.setResolution(n,a)?(Dr.pref("img_save",Ur("#image_save_opts :checked").val()),J(),Ft(),!0):(Ur.alert(Xr.notification.noContentToFitTo),!1)):(r.parent().addClass("error"),Ur.alert(Xr.notification.invalidAttrValGiven),!1)):(t.parent().addClass("error"),Ur.alert(Xr.notification.invalidAttrValGiven),!1)},qt=Dr.savePreferences=n(regeneratorRuntime.mark((function t(){var n,r,a,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Q(Ur("#bg_blocks div.cur_background").data("bgcolor")||"#FFF",Ur("#canvas_bg_url").val()),!(n=Ur("#lang_select").val())||n===Dr.pref("lang")){t.next=11;break}return t.next=6,Dr.putLocale(n,e,Jr);case 6:return r=t.sent,a=r.langParam,i=r.langData,t.next=11,Gn(a,i);case 11:u(Ur("#iconsize").val()),Jr.gridSnapping=Ur("#grid_snapping_on")[0].checked,Jr.snappingStep=Ur("#grid_snapping_step").val(),Jr.gridColor=Ur("#grid_color").val(),Jr.showRulers=Ur("#show_rulers")[0].checked,Ur("#rulers").toggle(Jr.showRulers),Jr.showRulers&&$(),Jr.baseUnit=Ur("#base_unit").val(),Fr.setConfig(Jr),J(),zt();case 22:case"end":return t.stop()}}),t)}))),Wt=Ur.noop,Xt=function(){var e=n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ur("#dialog_box").hide(),L||Ot||jt){e.next=4;break}return re&&Fr.leaveContext(),e.abrupt("return");case 4:if(!L){e.next=15;break}if(M===Ur("#svg_source_textarea").val()){e.next=12;break}return e.next=8,Ur.confirm(Xr.notification.QignoreSourceChanges);case 8:e.sent&&Dt(),e.next=13;break;case 12:Dt();case 13:e.next=16;break;case 15:Ot?Ft():jt&&zt();case 16:Wt();case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Yt={width:Ur(window).width(),height:Ur(window).height()};if(z()&&(Wt=function(){0===y[0].scrollLeft&&0===y[0].scrollTop&&(y[0].scrollLeft=h.left,y[0].scrollTop=h.top)},h={left:y[0].scrollLeft,top:y[0].scrollTop},Ur(window).resize(Wt),Dr.ready((function(){return new Promise((function(e,t){setTimeout((function(){Wt(),e()}),500)}))})),y.scroll((function(){h={left:y[0].scrollLeft,top:y[0].scrollTop}}))),Ur(window).resize((function(e){Ur.each(Yt,(function(e,t){var n=Ur(window)[e]();y[0]["scroll"+("width"===e?"Left":"Top")]-=(n-t)/2,Yt[e]=n})),l()})),y.scroll((function(){Ur("#ruler_x").length&&(Ur("#ruler_x")[0].scrollLeft=y[0].scrollLeft),Ur("#ruler_y").length&&(Ur("#ruler_y")[0].scrollTop=y[0].scrollTop)})),Ur("#url_notice").click((function(){Ur.alert(this.title)})),Ur("#change_image_url").click(K),Lt="tool_button_current",Mt="",Ur.each(["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],(function(e,t){Mt+=(e?",":"")+"#tool_"+t})),Ur(Mt).mousedown((function(){Ur(this).addClass(Lt)})).bind("mousedown mouseout",(function(){Ur(this).removeClass(Lt)})),Ur("#tool_undo, #tool_redo").mousedown((function(){Ur(this).hasClass("disabled")||Ur(this).addClass(Lt)})).bind("mousedown mouseout",(function(){Ur(this).removeClass(Lt)})),q()&&!window.opera)for(var Qt=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"],Kt=Qt.length;Kt--;){var Zt=document.getElementById(Qt[Kt]);if(Zt){var $t=Zt.title,Jt=$t.indexOf("Ctrl+");Zt.title=[$t.substr(0,Jt),"Cmd+",$t.substr(Jt+5)].join("")}}var en=function(e){var t="stroke_color"===e.attr("id")?"stroke":"fill",n="stroke"===t?Xr.ui.pick_stroke_paint_opacity:Xr.ui.pick_fill_paint_opacity,r=e.offset(),a=x[t].paint;Ur("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(Jr.colorPickerCSS||{left:r.left-140,bottom:40}).jGraduate({paint:a,window:{pickerTitle:n},images:{clientPath:Jr.jGraduatePath},newstop:"inverse"},(function(e){a=new Ur.jGraduate.Paint(e),x[t].setPaint(a),Fr.setPaint(t,a),Ur("#color_picker").hide()}),(function(){Ur("#color_picker").hide()}))},tn=function(){function e(t,n){r(this,e);var a=Jr["fill"===n?"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_').concat(e.ctr++,'"/></defs>\n </svg>'),"text/xml").documentElement;(i=Ur(t)[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 Ur.jGraduate.Paint({solidColor:a.color}),this.type=n}return i(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&&(Fr.setColor(this.type,this._paintColor,!0),Fr.setPaintOpacity(this.type,this._paintOpacity,!0))}},{key:"update",value:function(e){if(j){var t=this.type;switch(j.tagName){case"use":case"image":case"foreignObject":return;case"g":case"a":for(var n=j.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=Number.parseFloat(j.getAttribute(t+"-opacity")),Number.isNaN(this._paintOpacity)&&(this._paintOpacity=1);var s="fill"===t?"black":"none";this._paintColor=j.getAttribute(t)||s}e&&(Fr.setColor(t,this._paintColor,!0),Fr.setPaintOpacity(t,this._paintOpacity,!0)),this._paintOpacity*=100;var l=function(e,t,n){var r={alpha:t};if(e.startsWith("url(#")){var a=Fr.getRefElem(e);r[(a=a?a.cloneNode(!0):Ur("#"+n+"_color defs *")[0]).tagName]=a}else e.startsWith("#")?r.solidColor=e.substr(1):r.solidColor="none";return new Ur.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 Ur.jGraduate.Paint({copy:this.paint});Fr.setPaint(this.type,e)}}}]),e}();tn.ctr=0,x.fill=new tn("#fill_color","fill"),x.stroke=new tn("#stroke_color","stroke"),Ur("#stroke_width").val(Jr.initStroke.width),Ur("#group_opacity").val(100*Jr.initOpacity);var nn=x.fill.rect.cloneNode(!1);nn.setAttribute("style","vector-effect:non-scaling-stroke");var rn="non-scaling-stroke"===nn.style.vectorEffect;nn.removeAttribute("style");var an,on,sn=x.fill.rect.ownerDocument.createElementNS(_.SVG,"feGaussianBlur");function ln(){Fr.deleteCurrentLayer()&&(te(),T(),Ur("#layerlist tr.layer").removeClass("layersel"),Ur("#layerlist tr.layer:first").addClass("layersel"))}function cn(){return(cn=n(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Fr.getCurrentDrawing().getCurrentLayerName()+" copy",e.next=3,Ur.prompt(Xr.notification.enterUniqueLayerName,t);case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(!Fr.getCurrentDrawing().hasLayer(n)){e.next=9;break}return Ur.alert(Xr.notification.dupeLayerName),e.abrupt("return");case 9:Fr.cloneLayer(n),te(),T();case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function un(e){var t=Fr.getCurrentDrawing().getNumLayers(),n=Ur("#layerlist tr.layersel").index();(n>0||n<t-1)&&(n+=e,Fr.setCurrentLayerPosition(t-n-1),T())}void 0===sn.stdDeviationX&&Ur("#tool_blur").hide(),Ur(sn).remove(),an="-"+c.toLowerCase()+"-zoom-",on=an+"in",y.css("cursor",on),y.css("cursor")===on&&(k=on,C=an+"out"),y.css("cursor","auto"),setTimeout((function(){Fr.embedImage("images/logo.png",(function(e){e||(Ur("#image_save_opts [value=embed]").attr("disabled","disabled"),Ur("#image_save_opts input").val(["ref"]),Dr.pref("img_save","ref"),Ur("#image_opt_embed").css("color","#666").attr("title",Xr.notification.featNotSupported))}))}),1e3),Ur("#fill_color, #tool_fill .icon_label").click((function(){en(Ur("#fill_color")),ee()})),Ur("#stroke_color, #tool_stroke .icon_label").click((function(){en(Ur("#stroke_color")),ee()})),Ur("#group_opacityLabel").click((function(){Ur("#opacity_dropdown button").mousedown(),Ur(window).mouseup()})),Ur("#zoomLabel").click((function(){Ur("#zoom_dropdown button").mousedown(),Ur(window).mouseup()})),Ur("#tool_move_top").mousedown((function(e){Ur("#tools_stacking").show(),e.preventDefault()})),Ur(".layer_button").mousedown((function(){Ur(this).addClass("layer_buttonpressed")})).mouseout((function(){Ur(this).removeClass("layer_buttonpressed")})).mouseup((function(){Ur(this).removeClass("layer_buttonpressed")})),Ur(".push_button").mousedown((function(){Ur(this).hasClass("disabled")||Ur(this).addClass("push_button_pressed").removeClass("push_button")})).mouseout((function(){Ur(this).removeClass("push_button_pressed").addClass("push_button")})).mouseup((function(){Ur(this).removeClass("push_button_pressed").addClass("push_button")})),Ur("#layer_new").click(n(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Fr.getCurrentDrawing().getNumLayers();do{t=Xr.layers.layer+" "+ ++n}while(Fr.getCurrentDrawing().hasLayer(t));return e.next=4,Ur.prompt(Xr.notification.enterUniqueLayerName,t);case 4:if(r=e.sent){e.next=7;break}return e.abrupt("return");case 7:if(!Fr.getCurrentDrawing().hasLayer(r)){e.next=10;break}return Ur.alert(Xr.notification.dupeLayerName),e.abrupt("return");case 10:Fr.createLayer(r),te(),T();case 13:case"end":return e.stop()}}),e)})))),Ur("#layer_delete").click(ln),Ur("#layer_up").click((function(){un(-1)})),Ur("#layer_down").click((function(){un(1)})),Ur("#layer_rename").click(n(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Ur("#layerlist tr.layersel td.layername").text(),e.next=3,Ur.prompt(Xr.notification.enterNewLayerName,"");case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(t!==n&&!Fr.getCurrentDrawing().hasLayer(n)){e.next=9;break}return Ur.alert(Xr.notification.layerHasThatName),e.abrupt("return");case 9:Fr.renameCurrentLayer(n),T();case 11:case"end":return e.stop()}}),e)}))));var dn=-1,hn=!1,fn=!1,pn=function(e){var t=Ur("#ruler_x");Ur("#sidepanels").width("+="+e),Ur("#layerpanel").width("+="+e),t.css("right",Number.parseInt(t.css("right"))+e),y.css("right",Number.parseInt(y.css("right"))+e),Fr.runExtensions("workareaResized")},gn=function(e){if(fn&&-1!==dn){hn=!0;var t=dn-e.pageX,n=Ur("#sidepanels").width();n+t>300?t=300-n:n+t<2&&(t=2-n),0!==t&&(dn-=t,pn(t))}},mn=function(e){var t=window.devicePixelRatio||1,n=Ur("#sidepanels").width();pn(((t<1?n:n/t)>2||e?0:150*(t<1?1:t))-n)};Ur("#sidepanel_handle").mousedown((function(e){dn=e.pageX,Ur(window).mousemove(gn),fn=!1,setTimeout((function(){fn=!0}),20)})).mouseup((function(e){hn||mn(),dn=-1,hn=!1})),Ur(window).mouseup((function(){dn=-1,hn=!1,Ur("#svg_editor").unbind("mousemove",gn)})),T();Ur(window).bind("load resize",(function(){y.css("line-height",y.height()+"px")})),Ur("#resolution").change((function(){var e=Ur("#canvas_width,#canvas_height");if(this.selectedIndex)if("content"===this.value)e.val("fit").attr("disabled","disabled");else{var t=this.value.split("x");Ur("#canvas_width").val(t[0]),Ur("#canvas_height").val(t[1]),e.removeAttr("disabled")}else"fit"===Ur("#canvas_width").val()&&e.removeAttr("disabled").val(100)})),Ur("input,select").attr("autocomplete","off");var vn,yn,_n=["#tool_source_cancel","#tool_docprops_cancel","#tool_prefs_cancel",".overlay"],bn=(vn=[{sel:"#tool_select",fn:X,evt:"click",key:["V",!0]},{sel:"#tool_fhpath",fn:je,evt:"click",key:["Q",!0]},{sel:"#tool_line",fn:Re,evt:"click",key:["L",!0],parent:"#tools_line",prepend:!0},{sel:"#tool_rect",fn:De,evt:"mouseup",key:["R",!0],parent:"#tools_rect",icon:"rect"},{sel:"#tool_square",fn:Be,evt:"mouseup",parent:"#tools_rect",icon:"square"},{sel:"#tool_fhrect",fn:Ue,evt:"mouseup",parent:"#tools_rect",icon:"fh_rect"},{sel:"#tool_ellipse",fn:ze,evt:"mouseup",key:["E",!0],parent:"#tools_ellipse",icon:"ellipse"},{sel:"#tool_circle",fn:Fe,evt:"mouseup",parent:"#tools_ellipse",icon:"circle"},{sel:"#tool_fhellipse",fn:He,evt:"mouseup",parent:"#tools_ellipse",icon:"fh_ellipse"},{sel:"#tool_path",fn:Ke,evt:"click",key:["P",!0]},{sel:"#tool_text",fn:Qe,evt:"click",key:["T",!0]},{sel:"#tool_image",fn:qe,evt:"mouseup"},{sel:"#tool_zoom",fn:We,evt:"mouseup",key:["Z",!0]},{sel:"#tool_clear",fn:_t,evt:"mouseup",key:["N",!0]},{sel:"#tool_save",fn:function(){var e;L?Ut():(e={images:Dr.pref("img_save"),round_digits:6},Fr.save(e))},evt:"mouseup",key:["S",!0]},{sel:"#tool_export",fn:kt,evt:"mouseup"},{sel:"#tool_open",fn:Ct,evt:"mouseup",key:["O",!0]},{sel:"#tool_import",fn:At,evt:"mouseup"},{sel:"#tool_source",fn:O,evt:"click",key:["U",!0]},{sel:"#tool_wireframe",fn:Tt,evt:"click",key:["F",!0]},{key:["esc",!1,!1],fn:function(){_n.every((function(e){return Ur(e+":hidden").length}))&&Fr.clearSelection()},hidekey:!0},{sel:_n.join(","),fn:Xt,evt:"click",key:["esc",!1,!1],hidekey:!0},{sel:"#tool_source_save",fn:Ut,evt:"click"},{sel:"#tool_docprops_save",fn:Ht,evt:"click"},{sel:"#tool_docprops",fn:Vt,evt:"click"},{sel:"#tool_prefs_save",fn:qt,evt:"click"},{sel:"#tool_editor_prefs",fn:Rt,evt:"click"},{sel:"#tool_editor_homepage",fn:Bt,evt:"click"},{sel:"#tool_open",fn:function(){window.dispatchEvent(new CustomEvent("openImage"))},evt:"click"},{sel:"#tool_import",fn:function(){window.dispatchEvent(new CustomEvent("importImage"))},evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:Ze,evt:"click",key:["del/backspace",!0]},{sel:"#tool_reorient",fn:it,evt:"click"},{sel:"#tool_node_link",fn:lt,evt:"click"},{sel:"#tool_node_clone",fn:ct,evt:"click"},{sel:"#tool_node_delete",fn:dt,evt:"click"},{sel:"#tool_openclose_path",fn:pt,evt:"click"},{sel:"#tool_add_subpath",fn:ft,evt:"click"},{sel:"#tool_move_top",fn:tt,evt:"click",key:"ctrl+shift+]"},{sel:"#tool_move_bottom",fn:nt,evt:"click",key:"ctrl+shift+["},{sel:"#tool_topath",fn:at,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ot,evt:"click"},{sel:"#tool_undo",fn:Et,evt:"click"},{sel:"#tool_redo",fn:Gt,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Pt,evt:"click",key:["D",!0]},{sel:"#tool_group_elements",fn:Nt,evt:"click",key:["G",!0]},{sel:"#tool_ungroup",fn:Nt,evt:"click"},{sel:"#tool_unlink_use",fn:Nt,evt:"click"},{sel:"[id^=tool_align]",fn:It,evt:"click"},{sel:"#tool_bold",fn:bt,evt:"mousedown"},{sel:"#tool_italic",fn:St,evt:"mousedown"},{sel:"#sidepanel_handle",fn:mn,key:["X"]},{sel:"#copy_save_done",fn:Xt,evt:"click"},{key:"ctrl+left",fn:function(){yt(0,1)}},{key:"ctrl+right",fn:function(){yt(1,1)}},{key:"ctrl+shift+left",fn:function(){yt(0,5)}},{key:"ctrl+shift+right",fn:function(){yt(1,5)}},{key:"shift+O",fn:vt},{key:"shift+P",fn:gt},{key:[g+"up",!0],fn:function(){Xe(2)}},{key:[g+"down",!0],fn:function(){Xe(.5)}},{key:[g+"]",!0],fn:function(){rt("Up")}},{key:[g+"[",!0],fn:function(){rt("Down")}},{key:["up",!0],fn:function(){st(0,-1)}},{key:["down",!0],fn:function(){st(0,1)}},{key:["left",!0],fn:function(){st(-1,0)}},{key:["right",!0],fn:function(){st(1,0)}},{key:"shift+up",fn:function(){st(0,-10)}},{key:"shift+down",fn:function(){st(0,10)}},{key:"shift+left",fn:function(){st(-10,0)}},{key:"shift+right",fn:function(){st(10,0)}},{key:["alt+up",!0],fn:function(){Fr.cloneSelectedElements(0,-1)}},{key:["alt+down",!0],fn:function(){Fr.cloneSelectedElements(0,1)}},{key:["alt+left",!0],fn:function(){Fr.cloneSelectedElements(-1,0)}},{key:["alt+right",!0],fn:function(){Fr.cloneSelectedElements(1,0)}},{key:["alt+shift+up",!0],fn:function(){Fr.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",!0],fn:function(){Fr.cloneSelectedElements(0,10)}},{key:["alt+shift+left",!0],fn:function(){Fr.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",!0],fn:function(){Fr.cloneSelectedElements(10,0)}},{key:"a",fn:function(){Fr.selectAllInCurrentLayer()}},{key:g+"a",fn:function(){Fr.selectAllInCurrentLayer()}},{key:g+"z",fn:Et},{key:g+"shift+z",fn:Gt},{key:g+"y",fn:Gt},{key:g+"x",fn:$e},{key:g+"c",fn:Je},{key:g+"v",fn:et}],yn={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"},{setAll:function(){var e={},t={};vn.forEach((function(n){var r;if(n.sel){if(null===(r=Br(n.sel)))return!0;if(n.evt&&(W()&&"click"===n.evt&&(n.evt="mousedown"),r.addEventListener(n.evt,n.fn)),n.parent&&Ur(n.parent+"_show").length){var a=Ur(n.parent);a.length||(a=me(n.parent.substr(1))),n.prepend&&(r.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=n.key,o=!1;Array.isArray(n.key)&&(i=n.key[0],n.key.length>1&&(o=n.key[1])),i=String(i);var s=n.fn;if(i.split("/").forEach((function(e){t[e]={fn:s,pd:o}})),n.sel&&!n.hidekey&&r.title){var l="".concat(r.title.split("[")[0]," (").concat(i,")");yn[i]=n.sel,null===r.closest("#main_menu")&&(r.title=l)}}return!0})),document.addEventListener("keydown",(function(e){if("BODY"===e.target.nodeName){var n="".concat(e.metaKey?"meta+":"").concat(e.ctrlKey?"ctrl+":"").concat(e.key.toLowerCase());t[n]&&(t[n].fn(),t[n].pd&&e.preventDefault())}})),ge(e),Ur(".attr_changer, #image_url").bind("keydown","return",(function(e){Ur(this).change(),e.preventDefault()})),Ur(window).bind("keydown","tab",(function(e){"canvas"===A&&(e.preventDefault(),gt())})).bind("keydown","shift+tab",(function(e){"canvas"===A&&(e.preventDefault(),vt())})),Ur("#tool_zoom").dblclick(Ye)},setTitles:function(){Ur.each(yn,(function(e,t){var n=Ur(t).parents("#main_menu").length;Ur(t).each((function(){var t;t=n?Ur(this).text().split(" [")[0]:this.title.split(" [")[0];var r="";Ur.each(e.split("/"),(function(e,t){var n=t.split("+"),a="";n.length>1&&(a=n[0]+"+",t=n[1]),r+=(e?"/":"")+a+(Xr["key_"+t]||t)})),n?this.lastChild.textContent=t+" ["+r+"]":this.title=t+" ["+r+"]"}))}))},getButtonData:function(e){return Object.values(vn).find((function(t){return t.sel===e}))}});Dr.ready((function(){var e=Jr.initTool,t=Ur("#tools_left, #svg_editor .tools_flyout"),n=t.find("#tool_"+e),r=t.find("#"+e);(n.length?n:r.length?r:Ur("#tool_select")).click().mouseup(),Jr.wireframe&&Ur("#tool_wireframe").click(),Jr.showlayers&&mn(),Ur("#rulers").toggle(Boolean(Jr.showRulers)),Jr.showRulers&&(Ur("#show_rulers")[0].checked=!0),Jr.baseUnit&&Ur("#base_unit").val(Jr.baseUnit),Jr.gridSnapping&&(Ur("#grid_snapping_on")[0].checked=!0),Jr.snappingStep&&Ur("#grid_snapping_step").val(Jr.snappingStep),Jr.gridColor&&Ur("#grid_color").val(Jr.gridColor)})),Ur("#rect_rx").SpinButton({min:0,max:1e3,stateObj:s,callback:function(e){Fr.setRectRadius(e.value)}}),Ur("#stroke_width").SpinButton({min:0,max:99,smallStep:.1,stateObj:s,callback:function(e){var t=e.value;0===t&&j&&["line","polyline"].includes(j.nodeName)&&(t=e.value=1),Fr.setStrokeWidth(t)}}),Ur("#angle").SpinButton({min:-180,max:180,step:5,stateObj:s,callback:function(e){Fr.setRotationAngle(e.value),Ur("#tool_reorient").toggleClass("disabled",0===Number.parseInt(e.value))}}),Ur("#font_size").SpinButton({min:.001,stepfunc:function(e,t){var n=Number(e.value),r=n+t,a=r>=n;return 0===t?n:n>=24?a?Math.round(1.1*n):Math.round(n/1.1):n<=1?a?2*n:n/2:r},stateObj:s,callback:function(e){Fr.setFontSize(e.value)}}),Ur("#group_opacity").SpinButton({min:0,max:100,step:5,stateObj:s,callback:Se}),Ur("#blur").SpinButton({min:0,max:10,step:.1,stateObj:s,callback:ke}),Ur("#zoom").SpinButton({min:.001,max:1e4,step:50,stepfunc:function(e,t){var n=Number(e.value);if(0===n)return 100;var r=n+t;return 0===t?n:n>=100?r:r>=n?2*n:n/2},stateObj:s,callback:ce}).val(100*Fr.getZoom()),Ur("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},(function(e,t,n){switch(e){case"delete":Ze();break;case"cut":$e();break;case"copy":Je();break;case"paste":Fr.pasteElements();break;case"paste_in_place":Fr.pasteElements("in_place");break;case"group":case"group_elements":Fr.groupSelectedElements();break;case"ungroup":Fr.ungroupSelectedElement();break;case"move_front":tt();break;case"move_up":rt("Up");break;case"move_down":rt("Down");break;case"move_back":nt();break;default:Boolean(ht[e])&&function(e){return ht[e].action}(e).call()}}));var xn=function(e,t,n){switch(e){case"dupe":!function(){cn.apply(this,arguments)}();break;case"delete":ln();break;case"merge_down":Ur("#layerlist tr.layersel").index()!==Fr.getCurrentDrawing().getNumLayers()-1&&(Fr.mergeLayer(),te(),T());break;case"merge_all":Fr.mergeAllLayers(),te(),T()}};function Sn(){var e;try{e=localStorage.getItem("svgedit_clipboard")}catch(e){}b[(e?"en":"dis")+"ableContextMenuItems"]("#paste,#paste_in_place")}if(Ur("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},xn),Ur("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:!0},xn),Ur(".contextMenu li").mousedown((function(e){e.preventDefault()})),Ur("#cmenu_canvas li").disableContextMenu(),b.enableContextMenuItems("#delete,#cut,#copy"),Sn(),window.addEventListener("storage",(function(e){"svgedit_clipboard"===e.key&&Sn()})),window.addEventListener("beforeunload",(function(e){return 0===v.getUndoStackSize()&&(Dr.showSaveWarning=!1),!(!Jr.no_save_warning&&Dr.showSaveWarning)||(e.returnValue=Xr.notification.unsavedChanges,Xr.notification.unsavedChanges)})),Dr.canvas.getUIStrings=function(){return Xr},Dr.openPrep=function(){return Ur("#main_menu").hide(),0===v.getUndoStackSize()||Ur.confirm(Xr.notification.QwantToOpen)},window.FileReader){var kn=function(e){Ur.process_cancel(Xr.notification.loadingImage),e.stopPropagation(),e.preventDefault(),Ur("#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=Fr.importSvgString(e.target.result,!0);Fr.ungroupSelectedElement(),Fr.ungroupSelectedElement(),Fr.groupSelectedElements(),Fr.alignSelectedElements("m","page"),Fr.alignSelectedElements("c","page"),Fr.selectOnly([t]),Ur("#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=Fr.addSVGElementFromJson({element:"image",attr:{x:0,y:0,width:e,height:i,id:Fr.getNextId(),style:"pointer-events:inherit"}}),Fr.setHref(o,t),Fr.selectOnly([o]),Fr.alignSelectedElements("m","page"),Fr.alignSelectedElements("c","page"),te(),Ur("#dialog_box").hide()})),a.src=t},t.readAsDataURL(n))):Ur("#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",kn);var Cn=Ur('<input type="file">').change(function(){var e=n(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dr.openPrep();case 2:if(e.sent){e.next=5;break}return e.abrupt("return");case 5:Fr.clear(),1===this.files.length&&(Ur.process_cancel(Xr.notification.loadingImage),(r=new FileReader).onloadend=function(){var e=n(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.target,e.next=3,ea(n.result);case 3:J();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.readAsText(this.files[0]));case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}());Ur("#tool_open").show(),Ur(window).on("openImage",(function(){return Cn.click()}));var An=Ur('<input type="file">').change(kn);Ur("#tool_import").show(),Ur(window).on("importImage",(function(){return An.click()}))}J(!0);var En=[],Gn=Dr.setLang=function(){var e=n(regeneratorRuntime.mark((function e(t,n){var r,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Dr.langChanged=!0,Dr.pref("lang",t),Ur("#lang_select").val(t),n){e.next=5;break}return e.abrupt("return");case 5:if(document.documentElement.lang=n.lang,Ur.extend(Xr,n),r=Ur("#layerlist tr.layersel td.layername").text(),a=r===Xr.common.layer+" 1",Fr.setUiStrings(n),bn.setTitles(),a&&(Fr.renameCurrentLayer(Xr.common.layer+" 1"),T()),!ye.length){e.next=18;break}return e.next=15,Promise.all(ye.map((function(e){return En.push(e.name),e.langReady({lang:t,uiStrings:Xr,importLocale:na({defaultLang:t,defaultName:e.name})})})));case 15:ye.length=0,e.next=19;break;case 18:En.forEach((function(e){Fr.runExtension(e,"langReady",{lang:t,uiStrings:Xr,importLocale:na({defaultLang:t,defaultName:e})})}));case 19:Fr.runExtensions("langChanged",t),fe(),i={"#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"},Ur.each(i,(function(e,t){Ur(t).attr("title",Ur(e)[0].title)})),Ur("#multiselected_panel div[id^=tool_align]").each((function(){Ur("#tool_pos"+this.id.substr(10))[0].title=this.title}));case 24:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();!function(e){Ir=e}({addLangData:function(e){return Fr.runExtensions("addLangData",(function(t){return{lang:e,importLocale:na({defaultLang:e,defaultName:t})}}),!0)},curConfig:Jr}),"file:"===document.location.protocol?setTimeout(o,100):o()},Dr.ready=function(e){return new Promise((function(t,n){Qr?t(e()):zr.push([e,t,n])}))},Dr.runCallbacks=n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Promise.all(zr.map((function(e){return(0,f(e,1)[0])()})));case 3:e.next=9;break;case 5:throw e.prev=5,e.t0=e.catch(0),zr.forEach((function(e){(0,f(e,3)[2])()})),e.t0;case 9:zr.forEach((function(e){(0,f(e,2)[1])()})),Qr=!0;case 11:case"end":return e.stop()}}),e,null,[[0,5]])}))),Dr.loadFromString=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.noAlert;return Dr.ready(n(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,ea(e,{noAlert:r});case 3:t.next=9;break;case 5:if(t.prev=5,t.t0=t.catch(0),!r){t.next=9;break}throw t.t0;case 9:case"end":return t.stop()}}),t,null,[[0,5]])}))))},Dr.disableUI=function(e){},Dr.loadFromURL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.cache,r=t.noAlert;return Dr.ready((function(){return new Promise((function(t,a){Ur.ajax({url:e,dataType:"text",cache:Boolean(n),beforeSend:function(){Ur.process_cancel(Xr.notification.loadingImage)},success:function(e){t(ea(e,{noAlert:r}))},error:function(e,n,i){404!==e.status&&e.responseText?t(ea(e.responseText,{noAlert:r})):r?a(new Error("URLLoadFail")):(Ur.alert(Xr.notification.URLLoadFail+": \n"+i),t())},complete:function(){Ur("#dialog_box").hide()}})}))}))},Dr.loadFromDataURI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.noAlert;return Dr.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 ea(t?Te(a):decodeURIComponent(a),{noAlert:n})}))},Dr.addExtension=function(e,t,n){if(!Fr)throw new Error("Extension added too early");return Fr.addExtension.call(this,e,t,n)},Dr.ready((function(){ft()}));var ra=!1,aa=[];window.addEventListener("message",(function(e){var t={data:e.data,origin:e.origin};ra?Fr.call("message",t):aa.push(t)})),n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Promise.resolve();case 3:Dr.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()}}),e,null,[[0,6]])})))();export default Dr;
|
|
//# sourceMappingURL=index-es.min.js.map
|