diff --git a/CHANGES.md b/CHANGES.md index f4fda875..b2f67fd3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,9 +5,12 @@ - Fix: Delay icon setting until locales available (fixes #323) - Fix: Extension with no `placement` to be added to end; for #326 (@sjernigan) +- Fix: Error on dragging control point of arc; fixes #268 (@cuixiping) - Optimization fix: Properly run code conditionally on browser check; fixes #312 (@ianli-sc) - Enhancement: Add CAD Placemark extension (@NeiroNx) +- Testing (UI Refactoring): Abstract out to helper file functions +- npm: Update devDeps; update nested deps for security audit ## 4.2.0 diff --git a/dist/canvg.js b/dist/canvg.js index f9c3c748..59c48112 100644 --- a/dist/canvg.js +++ b/dist/canvg.js @@ -4579,7 +4579,7 @@ var canvg = (function (exports) { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return function (_x2, _x3) { diff --git a/dist/extensions/ext-arrows.js b/dist/extensions/ext-arrows.js index ce286777..289bbaaa 100644 --- a/dist/extensions/ext-arrows.js +++ b/dist/extensions/ext-arrows.js @@ -349,7 +349,7 @@ var svgEditorExtension_arrows = (function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); function addLangData(_x2) { diff --git a/dist/extensions/ext-foreignobject.js b/dist/extensions/ext-foreignobject.js index 88c7acc0..17d9da32 100644 --- a/dist/extensions/ext-foreignobject.js +++ b/dist/extensions/ext-foreignobject.js @@ -267,7 +267,7 @@ var svgEditorExtension_foreignobject = (function () { return _context.stop(); } } - }, _callee, this); + }, _callee); }))); /* const cancel = */ diff --git a/dist/extensions/ext-imagelib.js b/dist/extensions/ext-imagelib.js index aa2a2307..026b7cdf 100644 --- a/dist/extensions/ext-imagelib.js +++ b/dist/extensions/ext-imagelib.js @@ -533,7 +533,7 @@ var svgEditorExtension_imagelib = (function () { return _context.stop(); } } - }, _callee, this, [[3, 20]]); + }, _callee, null, [[3, 20]]); })); return function (_x2) { diff --git a/dist/extensions/ext-markers.js b/dist/extensions/ext-markers.js index 1c42bdda..abf6d261 100644 --- a/dist/extensions/ext-markers.js +++ b/dist/extensions/ext-markers.js @@ -212,7 +212,7 @@ var svgEditorExtension_markers = (function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return _showTextPrompt.apply(this, arguments); }; diff --git a/dist/extensions/ext-mathjax.js b/dist/extensions/ext-mathjax.js index c3e1a95d..a804e18f 100644 --- a/dist/extensions/ext-mathjax.js +++ b/dist/extensions/ext-mathjax.js @@ -306,7 +306,7 @@ var svgEditorExtension_mathjax = (function () { return _context.stop(); } } - }, _callee, this, [[7, 13]]); + }, _callee, null, [[7, 13]]); })); function click() { diff --git a/dist/extensions/ext-server_moinsave.js b/dist/extensions/ext-server_moinsave.js index a6f5973c..0ad29a02 100644 --- a/dist/extensions/ext-server_moinsave.js +++ b/dist/extensions/ext-server_moinsave.js @@ -4579,7 +4579,7 @@ var svgEditorExtension_server_moinsave = (function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return function (_x2, _x3) { @@ -4935,7 +4935,7 @@ var svgEditorExtension_server_moinsave = (function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); function save(_x2, _x3) { diff --git a/dist/extensions/ext-server_opensave.js b/dist/extensions/ext-server_opensave.js index 0c00a533..171bf053 100644 --- a/dist/extensions/ext-server_opensave.js +++ b/dist/extensions/ext-server_opensave.js @@ -4579,7 +4579,7 @@ var svgEditorExtension_server_opensave = (function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return function (_x2, _x3) { @@ -4909,7 +4909,7 @@ var svgEditorExtension_server_opensave = (function () { return _context4.stop(); } } - }, _callee4, this); + }, _callee4); })); return _submit.apply(this, arguments); } @@ -4948,7 +4948,7 @@ var svgEditorExtension_server_opensave = (function () { return _context2.stop(); } } - }, _callee2, this); + }, _callee2); }))); } else { inp.change( @@ -4968,7 +4968,7 @@ var svgEditorExtension_server_opensave = (function () { return _context3.stop(); } } - }, _callee3, this); + }, _callee3); }))); } }; @@ -5114,7 +5114,7 @@ var svgEditorExtension_server_opensave = (function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); function exportImage(_x2, _x3) { diff --git a/dist/extensions/ext-storage.js b/dist/extensions/ext-storage.js index 5e818bf5..7a13155b 100644 --- a/dist/extensions/ext-storage.js +++ b/dist/extensions/ext-storage.js @@ -412,7 +412,7 @@ var svgEditorExtension_storage = (function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); function langReady(_x) { diff --git a/dist/extensions/imagelib/openclipart.js b/dist/extensions/imagelib/openclipart.js index a6aad9ba..6f49990a 100644 --- a/dist/extensions/imagelib/openclipart.js +++ b/dist/extensions/imagelib/openclipart.js @@ -3220,7 +3220,7 @@ return _context3.stop(); } } - }, _callee3, this); + }, _callee3); })); return _processResults.apply(this, arguments); } @@ -3253,7 +3253,7 @@ return _context.stop(); } } - }, _callee, this); + }, _callee); })); function $submit() { diff --git a/dist/index-es.js b/dist/index-es.js index a383acaa..d9d8796c 100644 --- a/dist/index-es.js +++ b/dist/index-es.js @@ -5714,7 +5714,8 @@ function () { value: function move(dx, dy) { var item = this.item; var curPts = this.ctrlpts ? [item.x += dx, item.y += dy, item.x1, item.y1, item.x2 += dx, item.y2 += dy] : [item.x += dx, item.y += dy]; - replacePathSeg(this.type, this.index, curPts); + replacePathSeg(this.type, this.index, // type 10 means ARC + this.type === 10 ? ptObjToArr(this.type, item) : curPts); if (this.next && this.next.ctrlpts) { var next = this.next.item; @@ -9445,7 +9446,7 @@ function _importSetGlobal() { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return _importSetGlobal.apply(this, arguments); } @@ -14727,7 +14728,7 @@ function SvgCanvas(container, config) { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return function (_x, _x2, _x3) { @@ -28299,7 +28300,7 @@ function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return function readLang(_x) { @@ -28372,7 +28373,7 @@ function () { return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); return function putLocale(_x2, _x3, _x4) { @@ -28867,7 +28868,7 @@ function _loadSvgString() { return _context23.stop(); } } - }, _callee23, this); + }, _callee23); })); return _loadSvgString.apply(this, arguments); } @@ -28926,7 +28927,7 @@ function getImportLocale(_ref) { return _context.stop(); } } - }, _callee, this, [[2, 8]]); + }, _callee, null, [[2, 8]]); })); function importLocaleDefaulting() { @@ -29489,7 +29490,7 @@ editor.init = function () { return _context2.stop(); } } - }, _callee2, this, [[4, 13]]); + }, _callee2, null, [[4, 13]]); })); return function (_x2) { @@ -29541,7 +29542,7 @@ editor.init = function () { return _context3.stop(); } } - }, _callee3, this, [[10, 17]]); + }, _callee3, null, [[10, 17]]); })); return function extAndLocaleFunc() { @@ -30132,7 +30133,7 @@ editor.init = function () { return _context4.stop(); } } - }, _callee4, this); + }, _callee4); })); function callback(_x3) { @@ -30639,7 +30640,7 @@ editor.init = function () { return _context18.stop(); } } - }, _callee18, this); + }, _callee18); })); return _promptImgURL.apply(this, arguments); } @@ -32356,7 +32357,7 @@ editor.init = function () { return _context5.stop(); } } - }, _callee5, this); + }, _callee5); })); return function extAdded(_x4, _x5) { @@ -33346,7 +33347,7 @@ editor.init = function () { return _context7.stop(); } } - }, _callee7, this); + }, _callee7); })); return function makeHyperlink() { @@ -33512,7 +33513,7 @@ editor.init = function () { return _context8.stop(); } } - }, _callee8, this); + }, _callee8); })); return function clickClear() { @@ -33660,7 +33661,7 @@ editor.init = function () { return _context9.stop(); } } - }, _callee9, this); + }, _callee9); })); return function clickExport() { @@ -33917,7 +33918,7 @@ editor.init = function () { return _context10.stop(); } } - }, _callee10, this); + }, _callee10); })); return function saveSourceEditor() { @@ -34059,7 +34060,7 @@ editor.init = function () { return _context11.stop(); } } - }, _callee11, this); + }, _callee11); })); var resetScrollPos = $$b.noop; @@ -34138,7 +34139,7 @@ editor.init = function () { return _context12.stop(); } } - }, _callee12, this); + }, _callee12); })); return function cancelOverlays() { @@ -34560,7 +34561,7 @@ editor.init = function () { return _context13.stop(); } } - }, _callee13, this); + }, _callee13); }))); /** * @@ -34636,7 +34637,7 @@ editor.init = function () { return _context19.stop(); } } - }, _callee19, this); + }, _callee19); })); return _cloneLayer.apply(this, arguments); } @@ -34718,7 +34719,7 @@ editor.init = function () { return _context14.stop(); } } - }, _callee14, this); + }, _callee14); }))); var SIDEPANEL_MAXWIDTH = 300; var SIDEPANEL_OPENWIDTH = 150; @@ -35967,7 +35968,7 @@ editor.init = function () { return _context15.stop(); } } - }, _callee15, this); + }, _callee15); })); return function (_x6) { @@ -36106,7 +36107,7 @@ editor.init = function () { return _context17.stop(); } } - }, _callee17, this); + }, _callee17); })); return function (_x7, _x8) { @@ -36240,7 +36241,7 @@ regeneratorRuntime.mark(function _callee20() { return _context20.stop(); } } - }, _callee20, this, [[0, 5]]); + }, _callee20, null, [[0, 5]]); })); /** * @param {string} str The SVG string to load @@ -36288,7 +36289,7 @@ editor.loadFromString = function (str) { return _context21.stop(); } } - }, _callee21, this, [[0, 5]]); + }, _callee21, null, [[0, 5]]); }))); }; /** @@ -36478,7 +36479,7 @@ regeneratorRuntime.mark(function _callee22() { return _context22.stop(); } } - }, _callee22, this, [[0, 6]]); + }, _callee22, null, [[0, 6]]); }))(); export default editor; diff --git a/dist/index-es.min.js b/dist/index-es.min.js index e12eef00..ff0275b5 100644 --- a/dist/index-es.min.js +++ b/dist/index-es.min.js @@ -1,2 +1,2 @@ -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;nt.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=c,window.SVGPathSegCurvetoCubicAbs=d,window.SVGPathSegCurvetoCubicRel=h,window.SVGPathSegCurvetoQuadraticAbs=p,window.SVGPathSegCurvetoQuadraticRel=f,window.SVGPathSegArcAbs=g,window.SVGPathSegArcRel=m,window.SVGPathSegLinetoHorizontalAbs=v,window.SVGPathSegLinetoHorizontalRel=_,window.SVGPathSegLinetoVerticalAbs=y,window.SVGPathSegLinetoVerticalRel=b,window.SVGPathSegCurvetoCubicSmoothAbs=x,window.SVGPathSegCurvetoCubicSmoothRel=w,window.SVGPathSegCurvetoQuadraticSmoothAbs=S,window.SVGPathSegCurvetoQuadraticSmoothRel=k}if(!("SVGPathSegList"in window&&"appendItem"in window.SVGPathSegList.prototype)){var C=function(){function e(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="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"9")&&"."!==this._string.charAt(this._currentIndex))){for(var s=this._currentIndex;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)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;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||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;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}}]),e}();C.prototype.classname="SVGPathSegList",Object.defineProperty(C.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),C._pathSegArrayAsString=function(e){var t="",n=!0;return e.forEach(function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()}),t},Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new C(this)),this._pathSegList},enumerable:!0},normalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedNormalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0}}),window.SVGPathSegList=C}}();var m,v=jQuery,_=(Boolean(document.createElementNS&&document.createElementNS(f.SVG,"svg").createSVGRect),navigator.userAgent),y=document.createElementNS(f.SVG,"svg"),b=Boolean(window.opera),x=_.includes("AppleWebKit"),w=_.includes("Gecko/"),S=_.includes("MSIE"),k=_.includes("Chrome/"),C=(_.includes("Windows"),_.includes("Macintosh")),A="ontouchstart"in window,E=Boolean(y.querySelector),G=Boolean(document.evaluate),P=function(){var e=document.createElementNS(f.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}(),I=function(){var e=document.createElementNS(f.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}(),N=function(){var e=document.createElementNS(f.SVG,"svg"),t=document.createElementNS(f.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(f.SVG,"text");n.textContent="a",t.append(n);try{return 0===n.getStartPositionOfChar(0).x}catch(e){return!1}finally{e.remove()}}(),T=function(){var e=document.createElementNS(f.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(f.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}(),L=function(){var e=document.createElementNS(f.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(f.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(f.SVG,"path");n.setAttribute("d","M5,0 15,0");var r=document.createElementNS(f.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.width}(),M=(function(){var e=document.createElementNS(f.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");t||v.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the latest version in which the problems have been fixed.')}(),(m=document.createElementNS(f.SVG,"rect")).setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===m.style.vectorEffect),O=function(){var t=document.createElementNS(f.SVG,"rect").transform.baseVal,n=y.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}(),j=function(){return b},V=function(){return x},R=function(){return w},B=function(){return S},D=function(){return k},U=function(){return C},F=function(){return A},H=function(){return L},z=function(){return M};function q(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=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=0&&(this._removeFromOtherLists(e),this._xforms[t]=e,n=e,this._list._update()),n}},{key:"removeItem",value:function(e){if(e=0){var t,n=this._xforms[e],r=new Array(this.numberOfItems-1);for(t=0;t=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(ce.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){for(var e=[],t=this.stack.length;t--;)for(var n=this.stack[t].elements(),r=n.length;r--;)e.includes(n[r])||e.push(n[r]);return e}},{key:"addSubCommand",value:function(e){this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),t}();ge.type=ge.prototype.type;var me=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.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}},{key:"redo",value:function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}},{key:"addCommandToHistory",value:function(e){this.undoStackPointer0&&(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];rn(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 ge("Change "+n),a=t.elements.length;a--;){var i=t.elements[a];if(!rn(i)){var o={};o[n]=t.oldValues[a],o[n]!==i.getAttribute(n)&&r.addSubCommand(new fe(i,o,n))}}return this.undoableChangeStack[e]=null,r}}]),e}(),ve=Object.freeze({HistoryEventTypes:ce,MoveElementCommand:de,InsertElementCommand:he,RemoveElementCommand:pe,ChangeElementCommand:fe,BatchCommand:ge,UndoManager:me}),_e=document.createElementNS(f.SVG,"svg"),ye=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},be=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},xe=function(){for(var e=arguments.length,t=new Array(e),n=0;n(n=parseInt(n))){var r=n;n=t,t=r}for(var a=_e.createSVGMatrix(),i=t;i<=n;++i){var o=i>=0&&ie.x&&t.ye.y},Ge=jQuery,Pe={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"]},Ie={},Ne=function(e){Object.assign(Ie,e.ui)},Te=[],Le=!0,Me={},Oe=null,je=null,Ve=function(e){je=e,Te=[0,"ClosePath"];Ge.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(e,t){Te.push(t+"Abs"),Te.push(t+"Rel")})},Re=function(e,t,n){var r=e.pathSegList;if(I)r.insertItemBefore(t,n);else{for(var a=r.numberOfItems,i=[],o=0;o0?(p=g element");this.elem=t,this.segs=[],this.selected_pts=[],Oe=this,this.init()}return i(e,[{key:"init",value:function(){Ge(Fe()).find("*").each(function(){Ge(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?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(),rn(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=0&&this.selected_pts.push(r)}this.selected_pts.sort();var a=this.selected_pts.length,i=[];for(i.length=a;a--;){var o=this.selected_pts[a],s=this.segs[o];s.select(!0),i[a]=s.ptgrip}var l=e.subpathIsClosed(this.selected_pts[0]);je.addPtsToSelection({grips:i,closedSubpath:l})}}]),e}();Ke.subpathIsClosed=function(e){var t=!1;return Oe.eachSeg(function(n){return n<=e||2!==this.type&&(1!==this.type||(t=!0,!1))}),t};var Ze,$e,Je,et,tt,nt=function(e){var t=Me[e.id];return t||(t=Me[e.id]=new Ke(e)),t},rt=function(e){e in Me&&delete Me[e]},at=function(e,t){var n=e-Je,r=t-et,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)+tt;return n=a*Math.cos(i)+Je,r=a*Math.sin(i)+et,n-=Ze,r-=$e,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)-tt,{x:a*Math.cos(i)+Ze,y:a*Math.sin(i)+$e}},it=function(){var e=Oe.elem;if(tt=Kt(e,!0)){var t=Oe.oldbbox;Je=t.x+t.width/2,et=t.y+t.height/2;var n=Bt(e);Ze=n.x+n.width/2,$e=n.y+n.height/2;var r=Ze-Je,a=$e-et,i=Math.sqrt(r*r+a*a),o=Math.atan2(a,r)+tt;Ze=i*Math.cos(o)+Je,$e=i*Math.sin(o)+et;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var c=s.getItem(l),u=c.pathSegType;if(1!==u){var d=at(c.x,c.y),h=[d.x,d.y];if(!rn(c.x1)&&!rn(c.x2)){var p=at(c.x1,c.y1),f=at(c.x2,c.y2);h.splice(h.length,0,p.x,p.y,f.x,f.y)}Ye(u,l,h)}}Bt(e);var g=je.getSVGRoot().createSVGTransform(),m=$(e);g.setRotate(180*tt/Math.PI,Ze,$e),m.replaceItem(g,0)}},ot=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],st=function(e,t){for(var n=e.pathSegList,r=n.numberOfItems,a=0,i=0,o="",s=null,l=0;l=C-w&&g<=C+w&&m>=A-w&&m<=A+w){S=!0;break}}a=je.getId(),rt(a);var E,G,P=$t(a),I=b.numberOfItems;if(S){if(x<=1&&I>=2){var N=b.getItem(0).x,T=b.getItem(0).y;E=4===(G=v.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(N,T):y.createSVGPathSegCurvetoCubicAbs(N,T,G.x1/p,G.y1/p,N,T);var L=y.createSVGPathSegClosePath();b.appendItem(E),b.appendItem(L)}else if(I<3)return!1;if(Ge(v).remove(),je.setDrawnPath(null),je.setStarted(!1),dt){Oe.matrix&&je.remapElement(P,{},Oe.matrix.inverse());var M=P.getAttribute("d"),O=Ge(Oe.elem).attr("d");return Ge(Oe.elem).attr("d",O+M),Ge(P).remove(),Oe.matrix&&it(),Ve(),ft.toEditMode(Oe.elem),Oe.selectPt(),!1}}else{if(!Ge.contains(je.getContainer(),je.getMouseTarget(e)))return!1;var j=y.pathSegList.numberOfItems,V=y.pathSegList.getItem(j-1),R=V.x,B=V.y;if(e.shiftKey){var D=Ae(R,B,g,m);g=D.x,m=D.y}E=4===(G=v.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(je.round(g),je.round(m)):y.createSVGPathSegCurvetoCubicAbs(je.round(g),je.round(m),G.x1/p,G.y1/p,G.x2/p,G.y2/p),y.pathSegList.appendItem(E),g*=p,m*=p,v.setAttribute("d",["M",g,m,g,m].join(" ")),_=j,dt&&(_+=Oe.segs.length),Ue(_,g,m)}}else{var U="M"+g+","+m+" ";je.setDrawnPath(je.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:U,id:je.getNextId(),opacity:je.getOpacity()/2}})),v.setAttribute("d",["M",d,h,d,h].join(" ")),_=dt?Oe.segs.length:0,Ue(_,d,h)}}},mouseMove:function(e,t){var n=je.getCurrentZoom();pt=!0;var r=je.getDrawnPath();if("path"!==je.getCurrentMode())if(Oe.dragging){var a=De({x:Oe.dragging[0],y:Oe.dragging[1]},Oe),i=De({x:e,y:t},Oe),o=i.x-a.x,s=i.y-a.y;Oe.dragging=[e,t],Oe.dragctrl?Oe.moveCtrl(o,s):Oe.movePts(o,s)}else Oe.selected_pts=[],Oe.eachSeg(function(e){if(this.next||this.prev){var t=je.getRubberBox().getBBox(),n=Be(this),r={x:n.x,y:n.y,width:0,height:0},a=Ee(t,r);this.select(a),a&&Oe.selected_pts.push(this.index)}});else{if(!r)return;var l=r.pathSegList,c=l.numberOfItems-1;if(ct){var u=He("1c1"),d=He("0c2");u.setAttribute("cx",e),u.setAttribute("cy",t),u.setAttribute("display","inline");var h=ct[0],p=ct[1],f=h+(h-e/n),g=p+(p-t/n);d.setAttribute("cx",f*n),d.setAttribute("cy",g*n),d.setAttribute("display","inline");var m=ze(1);if(Jt(m,{x1:e,y1:t,x2:f*n,y2:g*n,display:"inline"}),0===c)ut=[e,t];else{var v=l.getItem(c-1),_=v.x,y=v.y;6===v.pathSegType?(_+=_-v.x2,y+=y-v.y2):ut&&(_=ut[0]/n,y=ut[1]/n),Ye(6,c,[h,p,_,y,f,g],r)}}else{var b=$t("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);Ye(6,1,[e,t,w*n,S*n,e,t],b)}else ut?Ye(6,1,[e,t,ut[0],ut[1],e,t],b):Ye(4,1,[e,t],b)}}}},mouseUp:function(e,t,n,r){var a=je.getDrawnPath();if("path"===je.getCurrentMode())return ct=null,a||(t=$t(je.getId()),je.setStarted(!1),ut=null),{keep:!0,element:t};var i=je.getRubberBox();if(Oe.dragging){var o=Oe.cur_pt;Oe.dragging=!1,Oe.dragctrl=!1,Oe.update(),pt&&Oe.endChanges("Move path point(s)"),e.shiftKey||pt||Oe.selectPt(o)}else i&&"none"!==i.getAttribute("display")?(i.setAttribute("display","none"),i.getAttribute("width")<=2&&i.getAttribute("height")<=2&&ft.toSelectMode(e.target)):ft.toSelectMode(e.target);pt=!1},toEditMode:function(e){Oe=nt(e),je.setCurrentMode("pathedit"),je.clearSelection(),Oe.show(!0).update(),Oe.oldbbox=Bt(Oe.elem),dt=!1},toSelectMode:function(e){var t=e===Oe.elem;je.setCurrentMode("select"),Oe.show(!1),ht=!1,je.clearSelection(),Oe.matrix&&it(),t&&(je.call("selected",[e]),je.addToSelection([e],!0))},addSubPath:function(e){e?(je.setCurrentMode("path"),dt=!0):(ft.clear(!0),ft.toEditMode(Oe.elem))},select:function(e){ht===e?(ft.toEditMode(e),je.setCurrentMode("pathedit")):ht=e},reorient:function(){var e=je.getSelectedElements()[0];if(e&&0!==Kt(e)){var t=new ge("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new fe(e,n)),je.clearSelection(),this.resetOrientation(e),je.addCommandToHistory(t),nt(e).show(!1).matrix=null,this.clear(),je.addToSelection([e],!0),je.call("changed",je.getSelectedElements())}},clear:function(e){var t=je.getDrawnPath();if(ht=null,t){var n=$t(je.getId());Ge($t("path_stretch_line")).remove(),Ge(n).remove(),Ge($t("pathpointgrip_container")).find("*").attr("display","none"),ut=null,je.setDrawnPath(null),je.setStarted(!1)}else"pathedit"===je.getCurrentMode()&&this.toSelectMode();Oe&&Oe.init().show(!1)},resetOrientation:function(e){if(rn(e)||"path"!==e.nodeName)return!1;var t=$(e),n=ke(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=[];Ge.each(["",1,2],function(e,t){var r=a["x"+t],i=a["y"+t];if(void 0!==r&&void 0!==i){var s=ye(r,i,n);o.splice(o.length,0,s.x,s.y)}}),Ye(i,t,o,e)},o=0;o0){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}(),Oe.elem.pathSegList.numberOfItems<=1)return ft.toSelectMode(Oe.elem),void je.canvas.deleteSelectedElements();if(Oe.init(),Oe.clearSelection(),window.opera){var r=Ge(Oe.elem);r.attr("d",r.attr("d"))}Oe.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=Xe(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)/,"$1$2")},St=function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")};function kt(e){if(e=Et(e),window.btoa)return window.btoa(e);var t=new Array(4*Math.floor((e.length+2)/3)),n=0,r=0;do{var a=e.charCodeAt(n++),i=e.charCodeAt(n++),o=e.charCodeAt(n++),s=a>>2,l=(3&a)<<4|i>>4,c=(15&i)<<2|o>>6,u=63&o;isNaN(i)?(c=64,u=64):isNaN(o)&&(u=64),t[r++]=mt.charAt(s),t[r++]=mt.charAt(l),t[r++]=mt.charAt(c),t[r++]=mt.charAt(u)}while(n>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(nSVG-edit "],{type:"text/html"});return Pt(e)}(),Nt=function(e){var t,n;e.includes("0?t=t[0]:(t=e.ownerDocument.createElementNS(f.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.append(t)),t},Vt=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;s0&&_<1&&r[h].push(p(_));var y=(-f-Math.sqrt(v))/(2*g);y>0&&y<1&&r[h].push(p(y))}}else{if(0===f)continue;var b=-m/f;b>0&&b<1&&r[h].push(p(b))}}i=d}else r[0].push(l.x),r[1].push(l.y)}var x=Math.min.apply(null,r[0]),w=Math.max.apply(null,r[0])-x,S=Math.min.apply(null,r[1]);return{x:x,y:S,width:w,height:Math.max.apply(null,r[1])-S}};function Rt(e){if(H())try{return e.getBBox()}catch(e){}var t,n,r=gt.data(e,"ref"),a=null;r?(n=gt(r).children().clone().attr("visibility","hidden"),gt(xt).append(n),a=n.filter("line, path")):a=gt(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:gt(e).children();t=Yt(o)}else t=e.getBBox();else t=e.getBBox();return r&&n.remove(),t}var Bt=function(e){var t=e||_t.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":T?t.getBBox&&(a=t.getBBox()):a=Vt(t);break;case"g":case"a":a=Rt(t);break;default:if("use"===r&&(a=Rt(t)),"use"===r||"foreignObject"===r&&V()){if(a||(a=t.getBBox()),!V()){var i={};i.width=a.width,i.height=a.height,i.x=a.x+parseFloat(t.getAttribute("x")||0),i.y=a.y+parseFloat(t.getAttribute("y")||0),a=i}}else if(vt.includes(r))if(t)try{a=t.getBBox()}catch(e){var o=t.getExtentOfChar(0),s=t.getComputedTextLength();a={x:o.x,y:o.y,width:s,height:o.height}}else{var l=gt(t).closest("foreignObject");l.length&&l[0].getBBox&&(a=l[0].getBBox())}}return a&&(a={x:(n=a).x,y:n.y,width:n.width,height:n.height}),a},Dt=function(e){var t="";return gt.each(e,function(e,n){var r=d(n,2),a=r[0],i=r[1];t+=a;for(var o=0;o-.001&&n<.001||n<-89.99||n>89.99)}(i,o)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))r=s=Ht(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(r=s=Ht(e,t,n))}}if(!s){var u=ke(a).matrix;r=Se(r.x,r.y,r.width,r.height,u).aabox}}return r};function qt(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var Yt=function(e,t,n){if(!e||!e.length)return!1;var r;if(gt.each(e,function(){r||this.parentNode&&(r=zt(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=qt(e[0]);o-=l,s-=l,a+=l,i+=l}else gt.each(e,function(e,r){var l=zt(r,t,n);if(l){var c=qt(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},Wt=function(e){e||(e=gt(_t.getSVGContent()).children());var t=[];return gt(e).children().each(function(e,n){n.getBBox&&t.push(n)}),t.reverse()},Xt=function(e){return e||(e=Wt()),Yt(e,_t.addSVGElementFromJson,_t.pathActions)},Qt=function(e,t){if(!e)return 0;for(var n=e.numberOfItems,r=0;r");var t=e.shortcut||"";an("#cmenu_canvas").append("
  • "+e.label+""+t+"
  • ")}(e)})};function ln(e,t){["id","class","type"].forEach(function(n){n in t&&(e[n]=t[n])})}function cn(e,t){return un(e,o({},t,{returnDefault:!0}))}function un(e,t){return dn.apply(this,arguments)}function dn(){return(dn=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",pn(t,void 0,{returnDefault:a}));case 4:return e.next=6,hn(t);case 6:return e.abrupt("return",window[r]);case 7:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function hn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?Promise.all(e.map(function(e){return hn(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",ln(a,t),a.addEventListener("error",i),a.addEventListener("load",o),a.src=e,document.head.append(a)})}function pn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).returnDefault,r=void 0!==n&&n;return Array.isArray(e)?Promise.all(e.map(function(e){return pn(e,t)})):new Promise(function(n,a){var i="$importModule$"+Math.random().toString(32).slice(2),o=document.createElement("script");function s(){a(new Error("Failed to import: ".concat(e))),c()}function l(){n(window[i]),c()}var c=function(){delete window[i],o.removeEventListener("error",s),o.removeEventListener("load",l),o.remove(),URL.revokeObjectURL(o.src),o.src=""};ln(o,t),o.defer="defer",o.type="module",o.addEventListener("error",s),o.addEventListener("load",l);var u=function(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}(e),d="import * as m from '".concat(u.replace(/'/g,"\\'"),"'; window.").concat(i," = ").concat(r?"m.default || ":"","m;"),h=new Blob([d],{type:"text/javascript"});o.src=URL.createObjectURL(h),document.head.append(o)})}function fn(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ok:"Ok",cancel:"Cancel"};t("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");var r=t("#dialog_box"),a=t("#dialog_buttons"),i=t("#dialog_content");function o(o,s,l,c,u,d){i.html("

    "+s.replace(/\n/g,"

    ")+"

    ").toggleClass("prompt","prompt"===o),a.empty();var h=t('').appendTo(a);return new Promise(function(s,p){var f,g;if("alert"!==o&&t('').appendTo(a).click(function(){r.hide(),s(!1)}),"prompt"===o)(f=t('').prependTo(a)).val(l||""),f.bind("keydown","return",function(){h.click()});else if("select"===o){var m=t('
    ');if(f=t("').appendTo(v)).val(d.value),d.tooltip&&v.attr("title",d.tooltip),g.prop("checked",Boolean(d.checked)),m.append(t("
    ").append(v))}t.each(c||[],function(n,r){"object"===e(r)?f.append(t("