From 76db126ec747f701099424f7a786b24c9ab6f464 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 29 May 2018 21:40:03 +0800 Subject: [PATCH] - Update `dist` files --- dist/extensions/ext-connector.js | 12 +- dist/extensions/ext-foreignobject.js | 15 +- dist/extensions/ext-markers.js | 8 +- dist/extensions/ext-mathjax.js | 2 +- dist/extensions/ext-shapes.js | 2 +- dist/index-es.js | 1682 +++++++++++++------------- dist/index-es.min.js | 2 +- dist/index-es.min.js.map | 2 +- dist/index-umd.js | 1680 ++++++++++++------------- dist/index-umd.min.js | 2 +- dist/index-umd.min.js.map | 2 +- 11 files changed, 1733 insertions(+), 1676 deletions(-) diff --git a/dist/extensions/ext-connector.js b/dist/extensions/ext-connector.js index bfec9742..56c085a2 100644 --- a/dist/extensions/ext-connector.js +++ b/dist/extensions/ext-connector.js @@ -17,7 +17,6 @@ var svgroot = S.svgroot, getNextId = S.getNextId, getElem = S.getElem, - curConfig = S.curConfig, addElem = S.addSvgElementFromJson, selManager = S.selectorManager, connSel = '.se_connector', @@ -60,7 +59,7 @@ if (slope < bb.height / bb.width) { ratio = bb.width / 2 / Math.abs(lenX); } else { - ratio = bb.height / 2 / Math.abs(lenY); + ratio = lenY ? bb.height / 2 / Math.abs(lenY) : 0; } return { @@ -340,6 +339,9 @@ startX = opts.start_x; startY = opts.start_y; var mode = svgCanvas.getMode(); + var _svgEditor = svgEditor, + initStroke = _svgEditor.curConfig.initStroke; + if (mode === 'connector') { if (started) { @@ -368,10 +370,10 @@ attr: { id: getNextId(), points: x + ',' + y + ' ' + x + ',' + y + ' ' + startX + ',' + startY, - stroke: '#' + curConfig.initStroke.color, - 'stroke-width': !startElem.stroke_width || startElem.stroke_width === 0 ? curConfig.initStroke.width : startElem.stroke_width, + stroke: '#' + initStroke.color, + 'stroke-width': !startElem.stroke_width || startElem.stroke_width === 0 ? initStroke.width : startElem.stroke_width, fill: 'none', - opacity: curConfig.initStroke.opacity, + opacity: initStroke.opacity, style: 'pointer-events:none' } }); diff --git a/dist/extensions/ext-foreignobject.js b/dist/extensions/ext-foreignobject.js index 77f12a8a..d8e65921 100644 --- a/dist/extensions/ext-foreignobject.js +++ b/dist/extensions/ext-foreignobject.js @@ -48,15 +48,12 @@ newFO = void 0, editingforeign = false; - // Function: setForeignString(xmlString, elt) - // This function sets the content of element elt to the input XML. - // - // Parameters: - // xmlString - The XML text. - // elt - the parent element to append to - // - // Returns: - // This function returns false if the set was unsuccessful, true otherwise. + /** + * This function sets the content of element elt to the input XML. + * @param {String} xmlString - The XML text. + * @param elt - the parent element to append to + * @returns {Boolean} This function returns false if the set was unsuccessful, true otherwise. + */ function setForeignString(xmlString) { var elt = selElems[0]; try { diff --git a/dist/extensions/ext-markers.js b/dist/extensions/ext-markers.js index 44c0ab8f..a7439111 100644 --- a/dist/extensions/ext-markers.js +++ b/dist/extensions/ext-markers.js @@ -73,9 +73,11 @@ markerTypes[v + '_o'] = markerTypes[v]; }); - // elem = a graphic element will have an attribute like marker-start - // attr - marker-start, marker-mid, or marker-end - // returns the marker element that is linked to the graphic element + /** + * @param elem - A graphic element will have an attribute like marker-start + * @param attr - marker-start, marker-mid, or marker-end + * @returns The marker element that is linked to the graphic element + */ function getLinked(elem, attr) { var str = elem.getAttribute(attr); if (!str) { diff --git a/dist/extensions/ext-mathjax.js b/dist/extensions/ext-mathjax.js index a45c15bc..9bfcb80d 100644 --- a/dist/extensions/ext-mathjax.js +++ b/dist/extensions/ext-mathjax.js @@ -158,7 +158,7 @@ s.src = curConfig.extPath + mathjaxSrcSecure; // See `executeAfterLoads` in `svgutils.js` */ - $.getScript(mathjaxSrcSecure).done(function (script, textStatus) { + $.getScript(svgEditor.curConfig.extIconsPath + mathjaxSrcSecure).done(function (script, textStatus) { // When MathJax is loaded get the div where the math will be rendered. MathJax.Hub.queue.Push(function () { math = MathJax.Hub.getAllJax('#mathjax_creator')[0]; diff --git a/dist/extensions/ext-shapes.js b/dist/extensions/ext-shapes.js index 92512abe..b8579c99 100644 --- a/dist/extensions/ext-shapes.js +++ b/dist/extensions/ext-shapes.js @@ -124,7 +124,7 @@ if (!lib) { $('#shape_buttons').html('Loading...'); - $.getJSON(svgEditor.curConfig.extPath + 'shapelib/' + catId + '.json', function (result) { + $.getJSON(svgEditor.curConfig.extIconsPath + 'shapelib/' + catId + '.json', function (result) { curLib = library[catId] = { data: result.data, size: result.size, diff --git a/dist/index-es.js b/dist/index-es.js index e85a8ab7..9c967dfd 100644 --- a/dist/index-es.js +++ b/dist/index-es.js @@ -2911,11 +2911,10 @@ var removeElementFromListMap = function removeElementFromListMap(elem) { } }; -// Function: getTransformList -// Returns an object that behaves like a SVGTransformList for the given DOM element -// -// Parameters: -// elem - DOM element to get a transformlist from +/** +* Returns an object that behaves like a SVGTransformList for the given DOM element +* @param elem - DOM element to get a transformlist from +*/ var getTransformList = function getTransformList(elem) { if (!supportsNativeTransformLists()) { var id = elem.id || 'temp'; @@ -3017,7 +3016,9 @@ var init = function init(elementContainer) { }; }; -// Group: Unit conversion functions +/** +* Group: Unit conversion functions +*/ /** * @returns The unit object with values for each unit @@ -3185,7 +3186,9 @@ var isValidUnit = function isValidUnit(attr, val, selectedElement) { * Copyright(c) 2010 Jeff Schiller */ -// Group: Undo/Redo history management +/** +* Group: Undo/Redo history management +*/ var HistoryEventTypes = { BEFORE_APPLY: 'before_apply', AFTER_APPLY: 'after_apply', @@ -3251,7 +3254,7 @@ var MoveElementCommand = function () { /** * Re-positions the element - * @param {handleHistoryEvent: function} + * @param {{handleHistoryEvent: function}} handler */ }, { @@ -3271,7 +3274,7 @@ var MoveElementCommand = function () { /** * Positions the element back to its original location - * @param {handleHistoryEvent: function} + * @param {{handleHistoryEvent: function}} handler */ }, { @@ -3288,7 +3291,9 @@ var MoveElementCommand = function () { } } - // Returns array with element associated with this command + /** + * @returns {Array} Array with element associated with this command + */ }, { key: 'elements', @@ -3300,12 +3305,13 @@ var MoveElementCommand = function () { }(); MoveElementCommand.type = MoveElementCommand.prototype.type; -// implements svgedit.history.HistoryCommand -// History command for an element that was added to the DOM -// -// Parameters: -// elem - The newly added DOM element -// text - An optional string visible to user related to this change +/** +* @implements svgedit.history.HistoryCommand +* History command for an element that was added to the DOM +* +* @param elem - The newly added DOM element +* @param text - An optional string visible to user related to this change +*/ var InsertElementCommand = function () { function InsertElementCommand(elem, text) { classCallCheck(this, InsertElementCommand); @@ -3360,7 +3366,9 @@ var InsertElementCommand = function () { } } - // Returns array with element associated with this command + /** + * @returns {Array} Array with element associated with this command + */ }, { key: 'elements', @@ -3372,14 +3380,14 @@ var InsertElementCommand = function () { }(); InsertElementCommand.type = InsertElementCommand.prototype.type; -// implements svgedit.history.HistoryCommand -// History command for an element removed from the DOM -// -// Parameters: -// elem - The removed DOM element -// oldNextSibling - the DOM element's nextSibling when it was in the DOM -// oldParent - The DOM element's parent -// text - An optional string visible to user related to this change +/** +* @implements svgedit.history.HistoryCommand +* History command for an element removed from the DOM +* @param elem - The removed DOM element +* @param oldNextSibling - The DOM element's nextSibling when it was in the DOM +* @param oldParent - The DOM element's parent +* @param {String} [text] - An optional string visible to user related to this change +*/ var RemoveElementCommand = function () { function RemoveElementCommand(elem, oldNextSibling, oldParent, text) { classCallCheck(this, RemoveElementCommand); @@ -3444,8 +3452,9 @@ var RemoveElementCommand = function () { } } - // Function: RemoveElementCommand.elements - // Returns array with element associated with this command + /** + * @returns {Array} Array with element associated with this command + */ }, { key: 'elements', @@ -3457,14 +3466,14 @@ var RemoveElementCommand = function () { }(); RemoveElementCommand.type = RemoveElementCommand.prototype.type; -// implements svgedit.history.HistoryCommand -// History command to make a change to an element. -// Usually an attribute change, but can also be textcontent. -// -// Parameters: -// elem - The DOM element that was changed -// attrs - An object with the attributes to be changed and the values they had *before* the change -// text - An optional string visible to user related to this change +/** +* @implements svgedit.history.HistoryCommand +* History command to make a change to an element. +* Usually an attribute change, but can also be textcontent. +* @param elem - The DOM element that was changed +* @param attrs - An object with the attributes to be changed and the values they had *before* the change +* @param {String} text - An optional string visible to user related to this change +*/ var ChangeElementCommand = function () { function ChangeElementCommand(elem, attrs, text) { classCallCheck(this, ChangeElementCommand); @@ -3603,7 +3612,9 @@ var ChangeElementCommand = function () { return true; } - // Returns array with element associated with this command + /** + * @returns {Array} Array with element associated with this command + */ }, { key: 'elements', @@ -3619,11 +3630,11 @@ ChangeElementCommand.type = ChangeElementCommand.prototype.type; // if a new Typing command is created and the top command on the stack is also a Typing // and they both affect the same element, then collapse the two commands into one -// implements svgedit.history.HistoryCommand -// History command that can contain/execute multiple other commands -// -// Parameters: -// text - An optional string visible to user related to this change +/** +* @implements svgedit.history.HistoryCommand +* History command that can contain/execute multiple other commands +* @param {String} [text] - An optional string visible to user related to this change +*/ var BatchCommand = function () { function BatchCommand(text) { classCallCheck(this, BatchCommand); @@ -3699,10 +3710,10 @@ var BatchCommand = function () { return elems; } - // Adds a given command to the history stack - // - // Parameters: - // cmd - The undo command object to add + /** + * Adds a given command to the history stack + * @param cmd - The undo command object to add + */ }, { key: 'addSubCommand', @@ -3710,7 +3721,9 @@ var BatchCommand = function () { this.stack.push(cmd); } - // Returns a boolean indicating whether or not the batch command is empty + /** + * @returns {Boolean} Indicates whether or not the batch command is empty + */ }, { key: 'isEmpty', @@ -3722,9 +3735,10 @@ var BatchCommand = function () { }(); BatchCommand.type = BatchCommand.prototype.type; -// Parameters: -// historyEventHandler - an object that conforms to the HistoryEventHandler interface -// (see above) +/** +* @param historyEventHandler - an object that conforms to the HistoryEventHandler interface +* (see above) +*/ var UndoManager = function () { function UndoManager(historyEventHandler) { classCallCheck(this, UndoManager); @@ -3749,8 +3763,9 @@ var UndoManager = function () { this.undoStackPointer = 0; } - // Returns: - // Integer with the current size of the undo history stack + /** + * @returns {Number} Integer with the current size of the undo history stack + */ }, { key: 'getUndoStackSize', @@ -3758,8 +3773,9 @@ var UndoManager = function () { return this.undoStackPointer; } - // Returns: - // Integer with the current size of the redo history stack + /** + * @returns {Number} Integer with the current size of the redo history stack + */ }, { key: 'getRedoStackSize', @@ -3767,8 +3783,9 @@ var UndoManager = function () { return this.undoStack.length - this.undoStackPointer; } - // Returns: - // String associated with the next undo command + /** + * @returns {String} String associated with the next undo command + */ }, { key: 'getNextUndoCommandText', @@ -3776,8 +3793,9 @@ var UndoManager = function () { return this.undoStackPointer > 0 ? this.undoStack[this.undoStackPointer - 1].getText() : ''; } - // Returns: - // String associated with the next redo command + /** + * @returns {String} String associated with the next redo command + */ }, { key: 'getNextRedoCommandText', @@ -3829,15 +3847,15 @@ var UndoManager = function () { this.undoStackPointer = this.undoStack.length; } - // This function tells the canvas to remember the old values of the - // attrName attribute for each element sent in. The elements and values - // are stored on a stack, so the next call to finishUndoableChange() will - // pop the elements and old values off the stack, gets the current values - // from the DOM and uses all of these to construct the undo-able command. - // - // Parameters: - // attrName - The name of the attribute being changed - // elems - Array of DOM elements being changed + /** + * This function tells the canvas to remember the old values of the + * attrName attribute for each element sent in. The elements and values + * are stored on a stack, so the next call to finishUndoableChange() will + * pop the elements and old values off the stack, gets the current values + * from the DOM and uses all of these to construct the undo-able command. + * @param attrName - The name of the attribute being changed + * @param elems - Array of DOM elements being changed + */ }, { key: 'beginUndoableChange', @@ -3861,12 +3879,12 @@ var UndoManager = function () { }; } - // This function returns a BatchCommand object which summarizes the - // change since beginUndoableChange was called. The command can then - // be added to the command history - // - // Returns: - // Batch command object with resulting changes + /** + * This function returns a BatchCommand object which summarizes the + * change since beginUndoableChange was called. The command can then + * be added to the command history + * @returns Batch command object with resulting changes + */ }, { key: 'finishUndoableChange', @@ -4477,16 +4495,13 @@ var getSegSelector = function getSegSelector(seg, update) { return segLine; }; -// Function: smoothControlPoints -// Takes three points and creates a smoother line based on them -// -// Parameters: -// ct1 - Object with x and y values (first control point) -// ct2 - Object with x and y values (second control point) -// pt - Object with x and y values (third point) -// -// Returns: -// Array of two "smoothed" point objects +/** +* Takes three points and creates a smoother line based on them +* @param ct1 - Object with x and y values (first control point) +* @param ct2 - Object with x and y values (second control point) +* @param pt - Object with x and y values (third point) +* @returns Array of two "smoothed" point objects +*/ var smoothControlPoints = function smoothControlPoints(ct1, ct2, pt) { // each point must not be the origin var x1 = ct1.x - pt.x, @@ -5484,8 +5499,10 @@ function pathDSegment(letter, points, morePoints, lastPoint) { return segment; } -// Group: Path edit functions -// Functions relating to editing path elements +/** +* Group: Path edit functions +* Functions relating to editing path elements +*/ var pathActions = function () { var subpath = false; var newPoint = void 0, @@ -6435,15 +6452,12 @@ var init$2 = function init$$1(editorContext) { svgroot_ = editorContext.getSVGRoot(); }; -// Converts characters in a string to XML-friendly entities. -// -// Example: '&' becomes '&' -// -// Parameters: -// str - The string to be converted -// -// Returns: -// The converted string +/** +* Converts characters in a string to XML-friendly entities. +* @example: '&' becomes '&' +* @param str - The string to be converted +* @returns {String} The converted string +*/ var toXml = function toXml(str) { // ' is ok in XML, but not HTML // > does not normally need escaping, though it can if within a CDATA expression (and preceded by "]]") @@ -6610,13 +6624,11 @@ var text2xml = function text2xml(sXML) { return out; }; -// Converts a SVGRect into an object. -// -// Parameters: -// bbox - a SVGRect -// -// Returns: -// An object with properties names x, y, width, height. +/** +* Converts a SVGRect into an object. +* @param bbox - a SVGRect +* @returns An object with properties names x, y, width, height. +*/ var bboxToObj = function bboxToObj(bbox) { return { x: bbox.x, @@ -6626,11 +6638,11 @@ var bboxToObj = function bboxToObj(bbox) { }; }; -// Walks the tree and executes the callback on each element in a top-down fashion -// -// Parameters: -// elem - DOM element to traverse -// cbFn - Callback function to run on each element +/** +* Walks the tree and executes the callback on each element in a top-down fashion +* @param elem - DOM element to traverse +* @param {Function} cbFn - Callback function to run on each element +*/ var walkTree = function walkTree(elem, cbFn) { if (elem && elem.nodeType === 1) { cbFn(elem); @@ -6641,12 +6653,12 @@ var walkTree = function walkTree(elem, cbFn) { } }; -// Walks the tree and executes the callback on each element in a depth-first fashion -// TODO: FIXME: Shouldn't this be calling walkTreePost? -// -// Parameters: -// elem - DOM element to traverse -// cbFn - Callback function to run on each element +/** +* Walks the tree and executes the callback on each element in a depth-first fashion +* @todo FIXME: Shouldn't this be calling walkTreePost? +* @param elem - DOM element to traverse +* @param {Function} cbFn - Callback function to run on each element +*/ var walkTreePost = function walkTreePost(elem, cbFn) { if (elem && elem.nodeType === 1) { var i = elem.childNodes.length; @@ -6657,17 +6669,15 @@ var walkTreePost = function walkTreePost(elem, cbFn) { } }; -// Extracts the URL from the url(...) syntax of some attributes. -// Three variants: -// * -// * -// * -// -// Parameters: -// attrVal - The attribute value as a string -// -// Returns: -// String with just the URL, like someFile.svg#foo +/** +* Extracts the URL from the url(...) syntax of some attributes. +* Three variants: +* - +* - +* - +* @param attrVal - The attribute value as a string +* @returns {String} String with just the URL, like "someFile.svg#foo" +*/ var getUrlFromAttr = function getUrlFromAttr(attrVal) { if (attrVal) { // url("#somegrad") @@ -6685,18 +6695,25 @@ var getUrlFromAttr = function getUrlFromAttr(attrVal) { return null; }; -// Returns the given element's xlink:href value +/** +* @returns The given element's xlink:href value +*/ var getHref = function getHref(elem) { return elem.getAttributeNS(NS.XLINK, 'href'); }; -// Sets the given element's xlink:href value +/** +* Sets the given element's xlink:href value +* @param elem +* @param {String} val +*/ var setHref = function setHref(elem, val) { elem.setAttributeNS(NS.XLINK, 'xlink:href', val); }; -// Returns: -// The document's element, create it first if necessary +/** +* @returns The document's <defs> element, create it first if necessary +*/ var findDefs = function findDefs() { var svgElement = editorContext_$1.getSVGContent(); var defs = svgElement.getElementsByTagNameNS(NS.SVG, 'defs'); @@ -6716,15 +6733,13 @@ var findDefs = function findDefs() { // TODO(codedread): Consider moving the next to functions to bbox.js -// Get correct BBox for a path in Webkit -// Converted from code found here: -// http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html -// -// Parameters: -// path - The path DOM element to get the BBox for -// -// Returns: -// A BBox-like object +/** +* Get correct BBox for a path in Webkit +* Converted from code found here: +* http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html +* @param path - The path DOM element to get the BBox for +* @returns A BBox-like object +*/ var getPathBBox = function getPathBBox(path$$1) { var seglist = path$$1.pathSegList; var tot = seglist.numberOfItems; @@ -6808,13 +6823,14 @@ var getPathBBox = function getPathBBox(path$$1) { }; }; -// Get the given/selected element's bounding box object, checking for -// horizontal/vertical lines (see issue 717) -// Note that performance is currently terrible, so some way to improve would -// be great. -// -// Parameters: -// selected - Container or DOM element +/** +* Get the given/selected element's bounding box object, checking for +* horizontal/vertical lines (see issue 717) +* Note that performance is currently terrible, so some way to improve would +* be great. +* @param selected - Container or <use> DOM element +* @returns Bounding box object +*/ function groupBBFix(selected) { if (supportsHVLineContainerBBox()) { try { @@ -6857,11 +6873,12 @@ function groupBBFix(selected) { return ret; } -// Get the given/selected element's bounding box object, convert it to be more -// usable when necessary -// -// Parameters: -// elem - Optional DOM element to get the BBox for +/** +* Get the given/selected element's bounding box object, convert it to be more +* usable when necessary +* @param elem - Optional DOM element to get the BBox for +* @returns Bounding box object +*/ var getBBox = function getBBox(elem) { var selected = elem || editorContext_$1.geSelectedElements()[0]; if (elem.nodeType !== 1) { @@ -6950,14 +6967,12 @@ var getBBox = function getBBox(elem) { return ret; }; -// Create a path 'd' attribute from path segments. -// Each segment is an array of the form: [singleChar, [x,y, x,y, ...]] -// -// Parameters: -// pathSegments - An array of path segments to be converted -// -// Returns: -// The converted path d attribute. +/** +* Create a path 'd' attribute from path segments. +* Each segment is an array of the form: [singleChar, [x,y, x,y, ...]] +* @param pathSegments - An array of path segments to be converted +* @returns The converted path d attribute. +*/ var getPathDFromSegments = function getPathDFromSegments(pathSegments) { var d = ''; @@ -6972,13 +6987,11 @@ var getPathDFromSegments = function getPathDFromSegments(pathSegments) { return d; }; -// Make a path 'd' attribute from a simple SVG element shape. -// -// Parameters: -// elem - The element to be converted -// -// Returns: -// The path d attribute or `undefined` if the element type is unknown. +/** +* Make a path 'd' attribute from a simple SVG element shape. +* @param elem - The element to be converted +* @returns The path d attribute or `undefined` if the element type is unknown. +*/ var getPathDFromElement = function getPathDFromElement(elem) { // Possibly the cubed root of 6, but 1.81 works best var num = 1.81; @@ -7043,13 +7056,11 @@ var getPathDFromElement = function getPathDFromElement(elem) { return d; }; -// Get a set of attributes from an element that is useful for convertToPath. -// -// Parameters: -// elem - The element to be probed -// -// Returns: -// An object with attributes. +/** +* Get a set of attributes from an element that is useful for convertToPath. +* @param elem - The element to be probed +* @returns {Object} An object with attributes. +*/ var getExtraAttributesForConvertToPath = function getExtraAttributesForConvertToPath(elem) { var attrs = {}; // TODO: make this list global so that we can properly maintain it @@ -7063,15 +7074,13 @@ var getExtraAttributesForConvertToPath = function getExtraAttributesForConvertTo return attrs; }; -// Get the BBox of an element-as-path -// -// Parameters: -// elem - The DOM element to be probed -// addSvgElementFromJson - Function to add the path element to the current layer. See canvas.addSvgElementFromJson -// pathActions - If a transform exists, pathActions.resetOrientation() is used. See: canvas.pathActions. -// -// Returns: -// The resulting path's bounding box object. +/** +* Get the BBox of an element-as-path +* @param elem - The DOM element to be probed +* @param addSvgElementFromJson - Function to add the path element to the current layer. See canvas.addSvgElementFromJson +* @param pathActions - If a transform exists, `pathActions.resetOrientation()` is used. See: canvas.pathActions. +* @returns The resulting path's bounding box object. +*/ var getBBoxOfElementAsPath = function getBBoxOfElementAsPath(elem, addSvgElementFromJson, pathActions$$1) { var path$$1 = addSvgElementFromJson({ element: 'path', @@ -7105,20 +7114,18 @@ var getBBoxOfElementAsPath = function getBBoxOfElementAsPath(elem, addSvgElement return bb; }; -// Convert selected element to a path. -// -// Parameters: -// elem - The DOM element to be converted -// attrs - Apply attributes to new path. see canvas.convertToPath -// addSvgElementFromJson - Function to add the path element to the current layer. See canvas.addSvgElementFromJson -// pathActions - If a transform exists, pathActions.resetOrientation() is used. See: canvas.pathActions. -// clearSelection - see canvas.clearSelection -// addToSelection - see canvas.addToSelection -// history - see svgedit.history -// addCommandToHistory - see canvas.addCommandToHistory -// -// Returns: -// The converted path element or null if the DOM element was not recognized. +/** +* Convert selected element to a path. +* @param elem - The DOM element to be converted +* @param attrs - Apply attributes to new path. see canvas.convertToPath +* @param addSvgElementFromJson - Function to add the path element to the current layer. See canvas.addSvgElementFromJson +* @param pathActions - If a transform exists, pathActions.resetOrientation() is used. See: canvas.pathActions. +* @param clearSelection - see canvas.clearSelection +* @param addToSelection - see canvas.addToSelection +* @param history - see svgedit.history +* @param addCommandToHistory - see canvas.addCommandToHistory +* @returns The converted path element or null if the DOM element was not recognized. +*/ var convertToPath = function convertToPath(elem, attrs, addSvgElementFromJson, pathActions$$1, clearSelection, addToSelection, history, addCommandToHistory) { var batchCmd = new history.BatchCommand('Convert element to Path'); @@ -7179,27 +7186,26 @@ var convertToPath = function convertToPath(elem, attrs, addSvgElementFromJson, p } }; -// Can the bbox be optimized over the native getBBox? The optimized bbox is the same as the native getBBox when -// the rotation angle is a multiple of 90 degrees and there are no complex transforms. -// Getting an optimized bbox can be dramatically slower, so we want to make sure it's worth it. -// -// The best example for this is a circle rotate 45 degrees. The circle doesn't get wider or taller when rotated -// about it's center. -// -// The standard, unoptimized technique gets the native bbox of the circle, rotates the box 45 degrees, uses -// that width and height, and applies any transforms to get the final bbox. This means the calculated bbox -// is much wider than the original circle. If the angle had been 0, 90, 180, etc. both techniques render the -// same bbox. -// -// The optimization is not needed if the rotation is a multiple 90 degrees. The default technique is to call -// getBBox then apply the angle and any transforms. -// -// Parameters: -// angle - The rotation angle in degrees -// hasMatrixTransform - True if there is a matrix transform -// -// Returns: -// True if the bbox can be optimized. +/** +* Can the bbox be optimized over the native getBBox? The optimized bbox is the same as the native getBBox when +* the rotation angle is a multiple of 90 degrees and there are no complex transforms. +* Getting an optimized bbox can be dramatically slower, so we want to make sure it's worth it. +* +* The best example for this is a circle rotate 45 degrees. The circle doesn't get wider or taller when rotated +* about it's center. +* +* The standard, unoptimized technique gets the native bbox of the circle, rotates the box 45 degrees, uses +* that width and height, and applies any transforms to get the final bbox. This means the calculated bbox +* is much wider than the original circle. If the angle had been 0, 90, 180, etc. both techniques render the +* same bbox. +* +* The optimization is not needed if the rotation is a multiple 90 degrees. The default technique is to call +* getBBox then apply the angle and any transforms. +* +* @param angle - The rotation angle in degrees +* @param {Boolean} hasMatrixTransform - True if there is a matrix transform +* @returns {Boolean} True if the bbox can be optimized. +*/ function bBoxCanBeOptimizedOverNativeGetBBox(angle, hasMatrixTransform$$1) { var angleModulo90 = angle % 90; var closeTo90 = angleModulo90 < -89.99 || angleModulo90 > 89.99; @@ -7344,7 +7350,7 @@ var getStrokedBBox = function getStrokedBBox(elems, addSvgElementFromJson, pathA }; /** -* Get all elements that have a BBox (excludes , , etc). +* Get all elements that have a BBox (excludes `<defs>`, `<title>`, etc). * Note that 0-opacity, off-screen etc elements are still considered "visible" * for this function * @param parent - The parent DOM element to search within @@ -7376,14 +7382,12 @@ var getStrokedBBoxDefaultVisible = function getStrokedBBoxDefaultVisible(elems) return getStrokedBBox(elems, editorContext_$1.addSvgElementFromJson, editorContext_$1.pathActions); }; -// Get the rotation angle of the given transform list. -// -// Parameters: -// tlist - List of transforms -// toRad - Boolean that when true returns the value in radians rather than degrees -// -// Returns: -// Float with the angle in degrees or radians +/** +* Get the rotation angle of the given transform list. +* @param tlist - List of transforms +* @param {Boolean} toRad - When true returns the value in radians rather than degrees +* @returns {Number} Float with the angle in degrees or radians +*/ var getRotationAngleFromTransformList = function getRotationAngleFromTransformList(tlist, toRad) { if (!tlist) { return 0; @@ -7398,14 +7402,12 @@ var getRotationAngleFromTransformList = function getRotationAngleFromTransformLi return 0.0; }; -// Get the rotation angle of the given/selected DOM element -// -// Parameters: -// elem - Optional DOM element to get the angle for -// toRad - Boolean that when true returns the value in radians rather than degrees -// -// Returns: -// Float with the angle in degrees or radians +/** +* Get the rotation angle of the given/selected DOM element +* @param elem - Optional DOM element to get the angle for +* @param {Boolean} toRad - When true returns the value in radians rather than degrees +* @returns {Number} Float with the angle in degrees or radians +*/ var getRotationAngle = function getRotationAngle(elem, toRad) { var selected = elem || editorContext_$1.getSelectedElements()[0]; // find the rotation transform (if any) and set it @@ -7413,19 +7415,19 @@ var getRotationAngle = function getRotationAngle(elem, toRad) { return getRotationAngleFromTransformList(tlist, toRad); }; -// Function getRefElem -// Get the reference element associated with the given attribute value -// -// Parameters: -// attrVal - The attribute value as a string +/** +* Get the reference element associated with the given attribute value +* @param {String} attrVal - The attribute value as a string +* @returns Reference element +*/ var getRefElem = function getRefElem(attrVal) { return getElem(getUrlFromAttr(attrVal).substr(1)); }; -// Get a DOM element by ID within the SVG root element. -// -// Parameters: -// id - String with the element's new ID +/** +* Get a DOM element by ID within the SVG root element. +* @param {String} id - String with the element's new ID +*/ var getElem = supportsSelectors() ? function (id) { // querySelector lookup return svgroot_.querySelector('#' + id); @@ -7439,13 +7441,13 @@ var getElem = supportsSelectors() ? function (id) { return $$2(svgroot_).find('[id=' + id + ']')[0]; }; -// Assigns multiple attributes to an element. -// -// Parameters: -// node - DOM element to apply new attribute values to -// attrs - Object with attribute keys/values -// suspendLength - Optional integer of milliseconds to suspend redraw -// unitCheck - Boolean to indicate the need to use svgedit.units.setUnitAttr +/** +* Assigns multiple attributes to an element. +* @param node - DOM element to apply new attribute values to +* @param {Object} attrs - Object with attribute keys/values +* @param {Number} suspendLength - Optional integer of milliseconds to suspend redraw +* @param {Boolean} unitCheck - Boolean to indicate the need to use svgedit.units.setUnitAttr +*/ var assignAttributes = function assignAttributes(node, attrs, suspendLength, unitCheck) { for (var i in attrs) { var ns = i.substr(0, 4) === 'xml:' ? NS.XML : i.substr(0, 6) === 'xlink:' ? NS.XLINK : null; @@ -7460,10 +7462,10 @@ var assignAttributes = function assignAttributes(node, attrs, suspendLength, uni } }; -// Remove unneeded (default) attributes, makes resulting SVG smaller -// -// Parameters: -// element - DOM element to clean up +/** +* Remove unneeded (default) attributes, makes resulting SVG smaller +* @param element - DOM element to clean up +*/ var cleanupElement = function cleanupElement(element) { var defaults = { 'fill-opacity': 1, @@ -11213,7 +11215,7 @@ var Layer = function () { Layer.CLASS_NAME = 'layer'; /** - * @property {RegExp} CLASS_REGEX Used to test presence of class Layer.CLASS_NAME + * @property {RegExp} CLASS_REGEX - Used to test presence of class Layer.CLASS_NAME */ Layer.CLASS_REGEX = new RegExp('(\\s|^)' + Layer.CLASS_NAME + '(\\s|$)'); @@ -12180,7 +12182,9 @@ var randomizeIds = function randomizeIds(enableRandomization, currentDrawing) { // Layer API Functions -// Group: Layers +/** +* Group: Layers +*/ var canvas_ = void 0; var init$3 = function init(canvas) { @@ -12547,7 +12551,6 @@ Object.entries(svgWhiteList_).forEach(function (_ref) { svgWhiteListNS_[elt] = attNS; }); -// Function: svgedit.sanitize.sanitizeSvg /** * Sanitizes the input node and its children * It only keeps what is allowed from our whitelist defined above @@ -13030,12 +13033,12 @@ var init$5 = function init$$1(editorContext) { context_ = editorContext; }; -// Updates a <clipPath>s values based on the given translation of an element -// -// Parameters: -// attr - The clip-path attribute value with the clipPath's ID -// tx - The translation's x value -// ty - The translation's y value +/** +* Updates a <clipPath>s values based on the given translation of an element +* @param attr - The clip-path attribute value with the clipPath's ID +* @param tx - The translation's x value +* @param ty - The translation's y value +*/ var updateClipPath = function updateClipPath(attr, tx, ty) { var path = getRefElem(attr).firstChild; var cpXform = getTransformList(path); @@ -13048,13 +13051,11 @@ var updateClipPath = function updateClipPath(attr, tx, ty) { recalculateDimensions(path); }; -// Decides the course of action based on the element's transform list -// -// Parameters: -// selected - The DOM element to recalculate -// -// Returns: -// Undo command object with the resulting change +/** +* Decides the course of action based on the element's transform list +* @param selected - The DOM element to recalculate +* @returns Undo command object with the resulting change +*/ var recalculateDimensions = function recalculateDimensions(selected) { if (selected == null) { return null; @@ -13809,12 +13810,12 @@ var config_ = void 0; var selectorManager_ = void 0; // A Singleton var gripRadius = isTouch() ? 10 : 4; -// Private class for DOM element selection boxes -// -// Parameters: -// id - integer to internally indentify the selector -// elem - DOM element associated with this selector -// bbox - Optional bbox to use for initialization (prevents duplicate getBBox call). +/** +* Private class for DOM element selection boxes +* @param id - integer to internally indentify the selector +* @param elem - DOM element associated with this selector +* @param bbox - Optional bbox to use for initialization (prevents duplicate getBBox call). +*/ var Selector = function () { function Selector(id, elem, bbox) { classCallCheck(this, Selector); @@ -13863,11 +13864,11 @@ var Selector = function () { this.reset(this.selectedElement, bbox); } - // Used to reset the id and element that the selector is attached to - // - // Parameters: - // e - DOM element associated with this selector - // bbox - Optional bbox to use for reset (prevents duplicate getBBox call). + /** + * Used to reset the id and element that the selector is attached to + * @param e - DOM element associated with this selector + * @param bbox - Optional bbox to use for reset (prevents duplicate getBBox call). + */ createClass(Selector, [{ @@ -13879,10 +13880,10 @@ var Selector = function () { this.selectorGroup.setAttribute('display', 'inline'); } - // Updates cursors for corner grips on rotation so arrows point the right way - // - // Parameters: - // angle - Float indicating current rotation angle in degrees + /** + * Updates cursors for corner grips on rotation so arrows point the right way + * @param {Number} angle - Float indicating current rotation angle in degrees + */ }, { key: 'updateGripCursors', @@ -14377,12 +14378,11 @@ if (window.opera) { window.console.dir = function (str) {}; } -// Class: SvgCanvas -// The main SvgCanvas class that manages all SVG-related functions -// -// Parameters: -// container - The container HTML element that should hold the SVG root element -// config - An object that contains configuration data +/** +* The main SvgCanvas class that manages all SVG-related functions +* @param container - The container HTML element that should hold the SVG root element +* @param {Object} config - An object that contains configuration data +*/ var _class = function _class(container, config) { classCallCheck(this, _class); @@ -14444,11 +14444,10 @@ var _class = function _class(container, config) { // Prefix string for element IDs var idprefix = 'svg_'; - // Function: setIdPrefix - // Changes the ID prefix to the given value - // - // Parameters: - // p - String with the new prefix + /** + * Changes the ID prefix to the given value + * @param {String} p - String with the new prefix + */ canvas.setIdPrefix = function (p) { idprefix = p; }; @@ -14457,9 +14456,10 @@ var _class = function _class(container, config) { // @type {svgedit.draw.Drawing} canvas.current_drawing_ = new Drawing(svgcontent, idprefix); - // Function: getCurrentDrawing - // Returns the current Drawing. - // @return {svgedit.draw.Drawing} + /** + * Returns the current Drawing. + * @returns {svgedit.draw.Drawing} + */ var getCurrentDrawing = canvas.getCurrentDrawing = function () { return canvas.current_drawing_; }; @@ -14531,10 +14531,11 @@ var _class = function _class(container, config) { * The element will be ran through cleanupElement before being returned * * @param data - Object with the following keys/values: - * @param data.element - tag name of the SVG element to create - * @paramdata.attr - Object with attributes key-values to assign to the new element - * @param data.curStyles - Boolean indicating that current style attributes should be applied first - * @param data.children - Optional array with data objects to be added recursively as children + * @param {String} data.element - tag name of the SVG element to create + * @param {Object} data.attr - Has key-value attributes to assign to the new element + * @param {Boolean} [data.curStyles] - Indicates whether current style attributes should be applied first + * @param {Array} [data.children] - Data objects to be added recursively as children + * @param {String} [data.namespace="http://www.w3.org/2000/svg"] - Indicate a (non-SVG) namespace * * @returns The new element */ @@ -14549,7 +14550,8 @@ var _class = function _class(container, config) { shape = null; } if (!shape) { - shape = svgdoc.createElementNS(NS.SVG, data.element); + var ns = data.namespace || NS.SVG; + shape = svgdoc.createElementNS(ns, data.element); if (currentLayer) { (currentGroup || currentLayer).appendChild(shape); } @@ -14612,7 +14614,9 @@ var _class = function _class(container, config) { return svgcontent; }; - // Returns the array with selected DOM elements + /** + * @returns {Array} the array with selected DOM elements + */ var getSelectedElements = this.getSelectedElems = function () { return selectedElements; }; @@ -14751,7 +14755,9 @@ var _class = function _class(container, config) { canvas.undoMgr.addCommandToHistory(cmd); }; - // Returns the current zoom level + /** + * @returns The current zoom level + */ var getCurrentZoom = this.getZoom = function () { return currentZoom; }; @@ -14785,14 +14791,14 @@ var _class = function _class(container, config) { return getCurrentDrawing().getId(); }; - // Run the callback function associated with the given event - // - // Parameters: - // event - String with the event name - // arg - Argument to pass through to the callback function - var call = function call(event, arg) { - if (events[event]) { - return events[event](window, arg); + /** + * Run the callback function associated with the given event + * @param ev - String with the event name + * @param arg - Argument to pass through to the callback function + */ + var call = function call(ev, arg) { + if (events[ev]) { + return events[ev](window, arg); } }; @@ -14813,11 +14819,11 @@ var _class = function _class(container, config) { } }; - // Adds a list of elements to the selection. The 'selected' handler is then called. - // - // Parameters: - // elemsToAdd - an array of DOM elements to add to the selection - // showGrips - a boolean flag indicating whether the resize grips should be shown + /** + * Adds a list of elements to the selection. The 'selected' handler is then called. + * @param {Array} elemsToAdd - An array of DOM elements to add to the selection + * @param {Boolean} showGrips - Indicates whether the resize grips should be shown + */ var addToSelection = function addToSelection(elemsToAdd, showGrips) { if (!elemsToAdd.length) { return; @@ -14893,13 +14899,11 @@ var _class = function _class(container, config) { return curShape.opacity; }; - // Gets the desired element from a mouse event - // - // Parameters: - // evt - Event object from the mouse event - // - // Returns: - // DOM element we want + /** + * Gets the desired element from a mouse event + * @param evt - Event object from the mouse event + * @returns DOM element we want + */ var getMouseTarget = this.getMouseTarget = function (evt) { if (evt == null) { return null; @@ -15158,12 +15162,11 @@ var _class = function _class(container, config) { return result; }; - // Function: addExtension - // Add an extension to the editor - // - // Parameters: - // name - String with the ID of the extension - // extFunc - Function supplied by the extension with its data + /** + * Add an extension to the editor + * @param {String} name - String with the ID of the extension + * @param {Function} extFunc - Function supplied by the extension with its data + */ this.addExtension = function (name, extFunc) { var ext = void 0; if (!(name in extensions)) { @@ -15259,18 +15262,15 @@ var _class = function _class(container, config) { this.getVisibleElements = getVisibleElements; - // Function: getVisibleElementsAndBBoxes - // Get all elements that have a BBox (excludes <defs>, <title>, etc). - // Note that 0-opacity, off-screen etc elements are still considered "visible" - // for this function - // - // Parameters: - // parent - The parent DOM element to search within - // - // Returns: - // An array with objects that include: - // * elem - The element - // * bbox - The element's BBox as retrieved from getStrokedBBoxDefaultVisible + /** + * Get all elements that have a BBox (excludes <defs>, <title>, etc). + * Note that 0-opacity, off-screen etc elements are still considered "visible" + * for this function + * @param parent - The parent DOM element to search within + * @returns {Array} An array with objects that include: + * - elem - The element + * - bbox - The element's BBox as retrieved from `getStrokedBBoxDefaultVisible` + */ var getVisibleElementsAndBBoxes = this.getVisibleElementsAndBBoxes = function (parent) { if (!parent) { parent = $$9(svgcontent).children(); // Prevent layers from being included @@ -15284,11 +15284,10 @@ var _class = function _class(container, config) { return contentElems.reverse(); }; - // Function: groupSvgElem - // Wrap an SVG element into a group element, mark the group as 'gsvg' - // - // Parameters: - // elem - SVG element to wrap + /** + * Wrap an SVG element into a group element, mark the group as 'gsvg' + * @param elem - SVG element to wrap + */ var groupSvgElem = this.groupSvgElem = function (elem) { var g = document.createElementNS(NS.SVG, 'g'); elem.parentNode.replaceChild(g, elem); @@ -15302,26 +15301,22 @@ var _class = function _class(container, config) { canvas.call = call; - // Function: bind - // Attaches a callback function to an event - // - // Parameters: - // event - String indicating the name of the event - // f - The callback function to bind to the event - // - // Return: - // The previous event - canvas.bind = function (event, f) { - var old = events[event]; - events[event] = f; + /** + * Attaches a callback function to an event + * @param {String} ev - String indicating the name of the event + * @param {Function} f - The callback function to bind to the event + * @returns The previous event + */ + canvas.bind = function (ev, f) { + var old = events[ev]; + events[ev] = f; return old; }; - // Function: canvas.prepareSvg - // Runs the SVG Document through the sanitizer and then updates its paths. - // - // Parameters: - // newDoc - The SVG DOM document + /** + * Runs the SVG Document through the sanitizer and then updates its paths. + * @param newDoc - The SVG DOM document + */ this.prepareSvg = function (newDoc) { this.sanitizeSvg(newDoc.documentElement); @@ -15334,15 +15329,15 @@ var _class = function _class(container, config) { } }; - // Function: ffClone - // Hack for Firefox bugs where text element features aren't updated or get - // messed up. See issue 136 and issue 137. - // This function clones the element and re-selects it - // TODO: Test for this bug on load and add it to "support" object instead of - // browser sniffing - // - // Parameters: - // elem - The (text) DOM element to clone + /** + * Hack for Firefox bugs where text element features aren't updated or get + * messed up. See issue 136 and issue 137. + * This function clones the element and re-selects it + * @todo Test for this bug on load and add it to "support" object instead of + * browser sniffing + * @param elem - The (text) DOM element to clone + * @returns Cloned element + */ var ffClone = function ffClone(elem) { if (!isGecko()) { return elem; @@ -15363,13 +15358,12 @@ var _class = function _class(container, config) { // $(svgroot).children().each(cb); // }; - // Function: setRotationAngle - // Removes any old rotations if present, prepends a new rotation at the - // transformed center - // - // Parameters: - // val - The new rotation angle in degrees - // preventUndo - Boolean indicating whether the action should be undoable or not + /** + * Removes any old rotations if present, prepends a new rotation at the + * transformed center + * @param val - The new rotation angle in degrees + * @param {Boolean} preventUndo - Indicates whether the action should be undoable or not + */ this.setRotationAngle = function (val, preventUndo) { // ensure val is the proper type val = parseFloat(val); @@ -15418,7 +15412,6 @@ var _class = function _class(container, config) { selector.updateGripCursors(val); }; - // Function: recalculateAllSelectedDimensions // Runs recalculateDimensions on the selected elements, // adding the changes to a single batch command var recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function () { @@ -15449,7 +15442,9 @@ var _class = function _class(container, config) { // Root Current Transformation Matrix in user units var rootSctm = null; - // Group: Selection + /** + * Group: Selection + */ this.clearSelection = clearSelection; @@ -15457,11 +15452,10 @@ var _class = function _class(container, config) { this.addToSelection = addToSelection; - // Function: selectOnly() - // Selects only the given elements, shortcut for clearSelection(); addToSelection() - // - // Parameters: - // elems - an array of DOM elements to be selected + /** + * Selects only the given elements, shortcut for clearSelection(); addToSelection() + * @param {Array} elems - an array of DOM elements to be selected + */ var selectOnly = this.selectOnly = function (elems, showGrips) { clearSelection(true); addToSelection(elems, showGrips); @@ -15470,11 +15464,10 @@ var _class = function _class(container, config) { // TODO: could use slice here to make this faster? // TODO: should the 'selected' handler - // Function: removeFromSelection - // Removes elements from the selection. - // - // Parameters: - // elemsToRemove - an array of elements to remove from selection + /** + * Removes elements from the selection. + * @param {Array} elemsToRemove - an array of elements to remove from selection + */ /* const removeFromSelection = */this.removeFromSelection = function (elemsToRemove) { if (selectedElements[0] == null) { return; @@ -15505,7 +15498,6 @@ var _class = function _class(container, config) { selectedElements = newSelectedItems; }; - // Function: selectAllInCurrentLayer // Clears the selection, then adds all elements in the current layer to the selection. this.selectAllInCurrentLayer = function () { var currentLayer = getCurrentDrawing().getCurrentLayer(); @@ -16876,8 +16868,10 @@ var _class = function _class(container, config) { }); })(); - // Group: Text edit functions - // Functions relating to editing text elements + /** + * Group: Text edit functions + * Functions relating to editing text elements + */ var textActions = canvas.textActions = function () { var curtext = void 0; var textinput = void 0; @@ -17281,14 +17275,15 @@ var _class = function _class(container, config) { }; }(); - // Group: Serialization + /** + * Group: Serialization + */ - // Function: removeUnusedDefElems - // Looks at DOM elements inside the <defs> to see if they are referred to, - // removes them from the DOM if they are not. - // - // Returns: - // The amount of elements that were removed + /** + * Looks at DOM elements inside the <defs> to see if they are referred to, + * removes them from the DOM if they are not. + * @returns The amount of elements that were removed + */ var removeUnusedDefElems = this.removeUnusedDefElems = function () { var defs = svgcontent.getElementsByTagNameNS(NS.SVG, 'defs'); if (!defs || !defs.length) { @@ -17340,11 +17335,10 @@ var _class = function _class(container, config) { return numRemoved; }; - // Function: svgCanvasToString - // Main function to set up the SVG content for output - // - // Returns: - // String containing the SVG image for output + /** + * Main function to set up the SVG content for output + * @returns {String} The SVG image for output + */ this.svgCanvasToString = function () { // keep calling it until there are none to remove while (removeUnusedDefElems() > 0) {} @@ -17394,15 +17388,12 @@ var _class = function _class(container, config) { return output; }; - // Function: svgToString - // Sub function ran on each SVG element to convert it to a string as desired - // - // Parameters: - // elem - The SVG element to convert - // indent - Integer with the amount of spaces to indent this tag - // - // Returns: - // String with the given element as an SVG tag + /** + * Sub function ran on each SVG element to convert it to a string as desired + * @param elem - The SVG element to convert + * @param {Number} indent - Integer with the amount of spaces to indent this tag + * @returns {String} The given element as an SVG tag + */ this.svgToString = function (elem, indent) { var out = []; var unit = curConfig.baseUnit; @@ -17587,13 +17578,12 @@ var _class = function _class(container, config) { return out.join(''); }; // end svgToString() - // Function: embedImage - // Converts a given image file to a data URL when possible, then runs a given callback - // - // Parameters: - // val - String with the path/URL of the image - // callback - Optional function to run when image data is found, supplies the - // result (data URL or false) as first parameter. + /** + * Converts a given image file to a data URL when possible, then runs a given callback + * @param {String} val - String with the path/URL of the image + * @param {Function} callback - Optional function to run when image data is found, supplies the + * result (data URL or false) as first parameter. + */ this.embedImage = function (val, callback) { // load in the image and once it's loaded, get the dimensions $$9(new Image()).load(function () { @@ -17618,23 +17608,25 @@ var _class = function _class(container, config) { }).attr('src', val); }; - // Function: setGoodImage - // Sets a given URL to be a "last good image" URL + /** + * Sets a given URL to be a "last good image" URL + */ this.setGoodImage = function (val) { lastGoodImgUrl = val; }; + /** + * + */ this.open = function () { // Nothing by default, handled by optional widget/extension }; - // Function: save - // Serializes the current drawing into SVG XML text and returns it to the 'saved' handler. - // This function also includes the XML prolog. Clients of the SvgCanvas bind their save - // function to the 'saved' event. - // - // Returns: - // Nothing + /** + * Serializes the current drawing into SVG XML text and returns it to the 'saved' handler. + * This function also includes the XML prolog. Clients of the SvgCanvas bind their save + * function to the 'saved' event. + */ this.save = function (opts) { // remove the selected outline before serializing clearSelection(); @@ -17684,7 +17676,6 @@ var _class = function _class(container, config) { return issues; } - // Function: rasterExport // Generates a Data URL based on the current image, then calls "exported" // with an object including the string, image information, and any issues found this.rasterExport = function (imgType, quality, exportWindowName) { @@ -17756,27 +17747,24 @@ var _class = function _class(container, config) { })(); }; - // Function: getSvgString - // Returns the current drawing as raw SVG XML text. - // - // Returns: - // The current drawing as raw SVG XML text. + /** + * Returns the current drawing as raw SVG XML text. + * @returns The current drawing as raw SVG XML text. + */ this.getSvgString = function () { saveOptions.apply = false; return this.svgCanvasToString(); }; - // Function: randomizeIds - // This function determines whether to use a nonce in the prefix, when - // generating IDs for future documents in SVG-Edit. - // - // Parameters: - // an optional boolean, which, if true, adds a nonce to the prefix. Thus - // svgCanvas.randomizeIds() <==> svgCanvas.randomizeIds(true) - // - // if you're controlling SVG-Edit externally, and want randomized IDs, call - // this BEFORE calling svgCanvas.setSvgString - // + /** + * This function determines whether to use a nonce in the prefix, when + * generating IDs for future documents in SVG-Edit. + * @param {Boolean} [enableRandomization] If true, adds a nonce to the prefix. Thus + * svgCanvas.randomizeIds() <==> svgCanvas.randomizeIds(true) + * + * if you're controlling SVG-Edit externally, and want randomized IDs, call + * this BEFORE calling svgCanvas.setSvgString + */ this.randomizeIds = function (enableRandomization) { if (arguments.length > 0 && enableRandomization === false) { randomizeIds(false, getCurrentDrawing()); @@ -17785,11 +17773,10 @@ var _class = function _class(container, config) { } }; - // Function: uniquifyElems - // Ensure each element has a unique ID - // - // Parameters: - // g - The parent element of the tree to give unique IDs + /** + * Ensure each element has a unique ID + * @param g - The parent element of the tree to give unique IDs + */ var uniquifyElems = this.uniquifyElems = function (g) { var ids = {}; // TODO: Handle markers and connectors. These are not yet re-identified properly @@ -17882,8 +17869,9 @@ var _class = function _class(container, config) { } }; - // Function setUseData - // Assigns reference data for each use element + /** + * Assigns reference data for each use element + */ var setUseData = this.setUseData = function (parent) { var elems = $$9(parent); @@ -17904,8 +17892,10 @@ var _class = function _class(container, config) { }); }; - // Function convertGradients - // Converts gradients from userSpaceOnUse to objectBoundingBox + /** + * Converts gradients from userSpaceOnUse to objectBoundingBox + * @param elem + */ var convertGradients = this.convertGradients = function (elem) { var elems = $$9(elem).find('linearGradient, radialGradient'); if (!elems.length && isWebkit()) { @@ -17982,8 +17972,10 @@ var _class = function _class(container, config) { }); }; - // Function: convertToGroup - // Converts selected/given <use> or child SVG element to a group + /** + * Converts selected/given <use> or child SVG element to a group + * @param elem + */ var convertToGroup = this.convertToGroup = function (elem) { if (!elem) { elem = selectedElements[0]; @@ -18114,22 +18106,22 @@ var _class = function _class(container, config) { } }; - // - // Function: setSvgString - // This function sets the current drawing as the input SVG XML. - // - // Parameters: - // xmlString - The SVG as XML text. - // preventUndo - Boolean (defaults to false) indicating if we want to do the - // changes without adding them to the undo stack - e.g. for initializing a - // drawing on page load. - // - // Returns: - // This function returns false if the set was unsuccessful, true otherwise. + /** + * This function sets the current drawing as the input SVG XML. + * @param {String} xmlString - The SVG as XML text. + * @param {Boolean} [preventUndo=false] - Indicates if we want to do the + * changes without adding them to the undo stack - e.g. for initializing a + * drawing on page load. + * @returns {Boolean} This function returns false if the set was + * unsuccessful, true otherwise. + */ this.setSvgString = function (xmlString, preventUndo) { try { // convert string into XML document var newDoc = text2xml(xmlString); + if (newDoc.firstElementChild && newDoc.firstElementChild.namespaceURI !== NS.SVG) { + return false; + } this.prepareSvg(newDoc); @@ -18296,22 +18288,19 @@ var _class = function _class(container, config) { return true; }; - // Function: importSvgString - // This function imports the input SVG XML as a <symbol> in the <defs>, then adds a - // <use> to the current layer. - // - // Parameters: - // xmlString - The SVG as XML text. - // - // Returns: - // This function returns null if the import was unsuccessful, or the element otherwise. - // TODO: - // * properly handle if namespace is introduced by imported content (must add to svgcontent - // and update all prefixes in the imported node) - // * properly handle recalculating dimensions, recalculateDimensions() doesn't handle - // arbitrary transform lists, but makes some assumptions about how the transform list - // was obtained - // * import should happen in top-left of current zoomed viewport + /** + * This function imports the input SVG XML as a <symbol> in the <defs>, then adds a + * <use> to the current layer. + * @param {String} xmlString - The SVG as XML text. + * @returns This function returns null if the import was unsuccessful, or the element otherwise. + * @todo + * - properly handle if namespace is introduced by imported content (must add to svgcontent + * and update all prefixes in the imported node) + * - properly handle recalculating dimensions, recalculateDimensions() doesn't handle + * arbitrary transform lists, but makes some assumptions about how the transform list + * was obtained + * - import should happen in top-left of current zoomed viewport + */ this.importSvgString = function (xmlString) { var j = void 0, ts = void 0, @@ -18461,10 +18450,13 @@ var _class = function _class(container, config) { } }); - // Group: Document functions + /** + * Group: Document functions + */ - // Function: clear - // Clears the current document. This is not an undoable action. + /** + * Clears the current document. This is not an undoable action. + */ this.clear = function () { pathActions$$1.clear(); @@ -18491,24 +18483,28 @@ var _class = function _class(container, config) { call('cleared'); }; - // Function: linkControlPoints - // Alias function + /** + * Alias function + */ this.linkControlPoints = pathActions$$1.linkControlPoints; - // Function: getContentElem - // Returns the content DOM element + /** + * @returns The content DOM element + */ this.getContentElem = function () { return svgcontent; }; - // Function: getRootElem - // Returns the root DOM element + /** + * @returns The root DOM element + */ this.getRootElem = function () { return svgroot; }; - // Function: getResolution - // Returns the current dimensions and zoom level in an object + /** + * @returns {Object} The current dimensions and zoom level in an object + */ var getResolution = this.getResolution = function () { // const vb = svgcontent.getAttribute('viewBox').split(' '); // return {w:vb[2], h:vb[3], zoom: currentZoom}; @@ -18523,14 +18519,16 @@ var _class = function _class(container, config) { }; }; - // Function: getSnapToGrid - // Returns the current snap to grid setting + /** + * @returns The current snap to grid setting + */ this.getSnapToGrid = function () { return curConfig.gridSnapping; }; - // Function: getVersion - // Returns a string which describes the revision number of SvgCanvas. + /** + * @returns {String} A string which describes the revision number of SvgCanvas. + */ this.getVersion = function () { return 'svgcanvas.js ($Rev$)'; }; @@ -18544,17 +18542,18 @@ var _class = function _class(container, config) { setUiStrings(strs); }; - // Function: setConfig - // Update configuration options with given values - // - // Parameters: - // opts - Object with options (see curConfig for examples) + /** + * Update configuration options with given values + * @param {Object} opts - Object with options (see curConfig for examples) + */ this.setConfig = function (opts) { Object.assign(curConfig, opts); }; - // Function: getTitle - // Returns the current group/SVG's title contents + /** + * @param elem + * @returns {String|undefined} the current group/SVG's title contents + */ this.getTitle = function (elem) { elem = elem || selectedElements[0]; if (!elem) { @@ -18570,9 +18569,11 @@ var _class = function _class(container, config) { return ''; }; - // Function: setGroupTitle - // Sets the group/SVG's title content - // TODO: Combine this with setDocumentTitle + /** + * Sets the group/SVG's title content + * @param val + * @todo Combine this with `setDocumentTitle` + */ this.setGroupTitle = function (val) { var elem = selectedElements[0]; elem = $$9(elem).data('gsvg') || elem; @@ -18603,18 +18604,18 @@ var _class = function _class(container, config) { addCommandToHistory(batchCmd); }; - // Function: getDocumentTitle - // Returns the current document title or an empty string if not found + /** + * @returns {String|undefined} The current document title or an empty string if not found + */ var getDocumentTitle = this.getDocumentTitle = function () { return canvas.getTitle(svgcontent); }; - // Function: setDocumentTitle - // Adds/updates a title element for the document with the given name. - // This is an undoable action - // - // Parameters: - // newtitle - String with the new title + /** + * Adds/updates a title element for the document with the given name. + * This is an undoable action + * @param {String} newtitle - String with the new title + */ this.setDocumentTitle = function (newtitle) { var childs = svgcontent.childNodes; var docTitle = false, @@ -18644,11 +18645,11 @@ var _class = function _class(container, config) { addCommandToHistory(batchCmd); }; - // Function: getEditorNS - // Returns the editor's namespace URL, optionally adds it to root element - // - // Parameters: - // add - Boolean to indicate whether or not to add the namespace value + /** + * Returns the editor's namespace URL, optionally adds it to root element + * @param {Boolean} add - Indicates whether or not to add the namespace value + * @returns {String} The editor's namespace URL + */ this.getEditorNS = function (add) { if (add) { svgcontent.setAttribute('xmlns:se', NS.SE); @@ -18656,17 +18657,14 @@ var _class = function _class(container, config) { return NS.SE; }; - // Function: setResolution - // Changes the document's dimensions to the given size - // - // Parameters: - // x - Number with the width of the new dimensions in user units. - // Can also be the string "fit" to indicate "fit to content" - // y - Number with the height of the new dimensions in user units. - // - // Returns: - // Boolean to indicate if resolution change was succesful. - // It will fail on "fit to content" option with no content to fit to. + /** + * Changes the document's dimensions to the given size + * @param x - Number with the width of the new dimensions in user units. + * Can also be the string "fit" to indicate "fit to content" + * @param y - Number with the height of the new dimensions in user units. + * @returns {Boolean} Indicates if resolution change was succesful. + * It will fail on "fit to content" option with no content to fit to. + */ this.setResolution = function (x, y) { var res = getResolution(); var w = res.w, @@ -18723,20 +18721,21 @@ var _class = function _class(container, config) { return true; }; - // Function: getOffset - // Returns an object with x, y values indicating the svgcontent element's - // position in the editor's canvas. + /** + * @returns An object with x, y values indicating the svgcontent element's + * position in the editor's canvas. + */ this.getOffset = function () { return $$9(svgcontent).attr(['x', 'y']); }; - // Function: setBBoxZoom - // Sets the zoom level on the canvas-side based on the given value - // - // Parameters: - // val - Bounding box object to zoom to or string indicating zoom option - // editorW - Integer with the editor's workarea box's width - // editorH - Integer with the editor's workarea box's height + /** + * Sets the zoom level on the canvas-side based on the given value + * @param val - Bounding box object to zoom to or string indicating zoom option + * @param {Number} editorW - Integer with the editor's workarea box's width + * @param {Number} editorH - Integer with the editor's workarea box's height + * @returns {Object|undefined} + */ this.setBBoxZoom = function (val, editorW, editorH) { var spacer = 0.85; var bb = void 0; @@ -18790,11 +18789,10 @@ var _class = function _class(container, config) { return calcZoom(bb); }; - // Function: setZoom - // Sets the zoom to the given level - // - // Parameters: - // zoomlevel - Float indicating the zoom level to change to + /** + * Sets the zoom to the given level + * @param {Number} zoomlevel - Float indicating the zoom level to change to + */ this.setZoom = function (zoomlevel) { var res = getResolution(); svgcontent.setAttribute('viewBox', '0 0 ' + res.w / zoomlevel + ' ' + res.h / zoomlevel); @@ -18809,17 +18807,17 @@ var _class = function _class(container, config) { runExtensions('zoomChanged', zoomlevel); }; - // Function: getMode - // Returns the current editor mode string + /** + * @returns {String} The current editor mode string + */ this.getMode = function () { return currentMode; }; - // Function: setMode - // Sets the editor's mode to the given string - // - // Parameters: - // name - String with the new mode to change to + /** + * Sets the editor's mode to the given string + * @param {String} name - String with the new mode to change to + */ this.setMode = function (name) { pathActions$$1.clear(true); textActions.clear(); @@ -18827,21 +18825,23 @@ var _class = function _class(container, config) { currentMode = name; }; - // Group: Element Styling + /** + * Group: Element Styling + */ - // Function: getColor - // Returns the current fill/stroke option + /** + * @returns The current fill/stroke option + */ this.getColor = function (type) { return curProperties[type]; }; - // Function: setColor - // Change the current stroke/fill color/gradient value - // - // Parameters: - // type - String indicating fill or stroke - // val - The value to set the stroke attribute to - // preventUndo - Boolean indicating whether or not this should be and undoable option + /** + * Change the current stroke/fill color/gradient value + * @param {String} type - String indicating fill or stroke + * @param val - The value to set the stroke attribute to + * @param {Boolean} preventUndo - Boolean indicating whether or not this should be and undoable option + */ this.setColor = function (type, val, preventUndo) { curShape[type] = val; curProperties[type + '_paint'] = { type: 'solidColor' }; @@ -18878,7 +18878,6 @@ var _class = function _class(container, config) { } }; - // Function: setGradient // Apply the current gradient to selected element's fill or stroke // // Parameters @@ -18904,14 +18903,11 @@ var _class = function _class(container, config) { canvas.setColor(type, 'url(#' + grad.id + ')'); }; - // Function: findDuplicateGradient - // Check if exact gradient already exists - // - // Parameters: - // grad - The gradient DOM element to compare to others - // - // Returns: - // The existing gradient if found, null if not + /** + * Check if exact gradient already exists + * @param grad - The gradient DOM element to compare to others + * @returns The existing gradient if found, null if not + */ var findDuplicateGradient = function findDuplicateGradient(grad) { var defs = findDefs(); var existingGrads = $$9(defs).find('linearGradient, radialGradient'); @@ -18969,12 +18965,11 @@ var _class = function _class(container, config) { return null; }; - // Function: setPaint - // Set a color/gradient to a fill/stroke - // - // Parameters: - // type - String with "fill" or "stroke" - // paint - The jGraduate paint object to apply + /** + * Set a color/gradient to a fill/stroke + * @param {"fill"|"stroke"} type - String with "fill" or "stroke" + * @param paint - The jGraduate paint object to apply + */ this.setPaint = function (type, paint) { // make a copy var p = new $$9.jGraduate.Paint(paint); @@ -19003,18 +18998,18 @@ var _class = function _class(container, config) { this.setPaint('fill', paint); }; - // Function: getStrokeWidth - // Returns the current stroke-width value + /** + * @returns The current stroke-width value + */ this.getStrokeWidth = function () { return curProperties.stroke_width; }; - // Function: setStrokeWidth - // Sets the stroke width for the current selected elements - // When attempting to set a line's width to 0, this changes it to 1 instead - // - // Parameters: - // val - A Float indicating the new stroke width value + /** + * Sets the stroke width for the current selected elements + * When attempting to set a line's width to 0, this changes it to 1 instead + * @param {Number} val - A Float indicating the new stroke width value + */ this.setStrokeWidth = function (val) { if (val === 0 && ['line', 'path'].includes(currentMode)) { canvas.setStrokeWidth(1); @@ -19045,12 +19040,11 @@ var _class = function _class(container, config) { } }; - // Function: setStrokeAttr - // Set the given stroke-related attribute the given value for selected elements - // - // Parameters: - // attr - String with the attribute name - // val - String or number with the attribute value + /** + * Set the given stroke-related attribute the given value for selected elements + * @param {String} attr - String with the attribute name + * @param {String|Number} val - String or number with the attribute value + */ this.setStrokeAttr = function (attr, val) { curShape[attr.replace('-', '_')] = val; var elems = []; @@ -19076,41 +19070,47 @@ var _class = function _class(container, config) { } }; - // Function: getStyle - // Returns current style options + /** + * @returns current style options + */ this.getStyle = function () { return curShape; }; - // Returns the current opacity + /** + * @returns the current opacity + */ this.getOpacity = getOpacity; - // Function: setOpacity - // Sets the given opacity to the current selected elements + /** + * Sets the given opacity to the current selected elements + * @param val + */ this.setOpacity = function (val) { curShape.opacity = val; changeSelectedAttribute('opacity', val); }; - // Function: getOpacity - // Returns the current fill opacity + /** + * @returns the current fill opacity + */ this.getFillOpacity = function () { return curShape.fill_opacity; }; - // Function: getStrokeOpacity - // Returns the current stroke opacity + /** + * @returns the current stroke opacity + */ this.getStrokeOpacity = function () { return curShape.stroke_opacity; }; - // Function: setPaintOpacity - // Sets the current fill/stroke opacity - // - // Parameters: - // type - String with "fill" or "stroke" - // val - Float with the new opacity value - // preventUndo - Boolean indicating whether or not this should be an undoable action + /** + * Sets the current fill/stroke opacity + * @param {String} type - String with "fill" or "stroke" + * @param {Number} val - Float with the new opacity value + * @param {Boolean} preventUndo - Indicates whether or not this should be an undoable action + */ this.setPaintOpacity = function (type, val, preventUndo) { curShape[type + '_opacity'] = val; if (!preventUndo) { @@ -19120,20 +19120,20 @@ var _class = function _class(container, config) { } }; - // Function: getPaintOpacity - // Gets the current fill/stroke opacity - // - // Parameters: - // type - String with "fill" or "stroke" + /** + * Gets the current fill/stroke opacity + * @param {"fill"|"stroke"} type - String with "fill" or "stroke" + * @returns Fill/stroke opacity + */ this.getPaintOpacity = function (type) { return type === 'fill' ? this.getFillOpacity() : this.getStrokeOpacity(); }; - // Function: getBlur - // Gets the stdDeviation blur value of the given element - // - // Parameters: - // elem - The element to check the blur value for + /** + * Gets the stdDeviation blur value of the given element + * @param elem - The element to check the blur value for + * @returns stdDeviation blur attribute value + */ this.getBlur = function (elem) { var val = 0; // const elem = selectedElements[0]; @@ -19155,11 +19155,10 @@ var _class = function _class(container, config) { var filter = null; var filterHidden = false; - // Function: setBlurNoUndo - // Sets the stdDeviation blur value on the selected element without being undoable - // - // Parameters: - // val - The new stdDeviation value + /** + * Sets the stdDeviation blur value on the selected element without being undoable + * @param val - The new stdDeviation value + */ canvas.setBlurNoUndo = function (val) { if (!filter) { canvas.setBlur(val); @@ -19193,13 +19192,12 @@ var _class = function _class(container, config) { filter = null; } - // Function: setBlurOffsets - // Sets the x, y, with, height values of the filter element in order to - // make the blur not be clipped. Removes them if not neeeded - // - // Parameters: - // filter - The filter DOM element to update - // stdDev - The standard deviation value on which to base the offset size + /** + * Sets the x, y, with, height values of the filter element in order to + * make the blur not be clipped. Removes them if not neeeded + * @param filter - The filter DOM element to update + * @param stdDev - The standard deviation value on which to base the offset size + */ canvas.setBlurOffsets = function (filter, stdDev) { if (stdDev > 3) { // TODO: Create algorithm here where size is based on expected blur @@ -19220,12 +19218,11 @@ var _class = function _class(container, config) { } }; - // Function: setBlur - // Adds/updates the blur filter to the selected element - // - // Parameters: - // val - Float with the new stdDeviation blur value - // complete - Boolean indicating whether or not the action should be completed (to add to the undo manager) + /** + * Adds/updates the blur filter to the selected element + * @param {Number} val - Float with the new stdDeviation blur value + * @param {Boolean} complete - Boolean indicating whether or not the action should be completed (to add to the undo manager) + */ canvas.setBlur = function (val, complete) { if (curCommand) { finishChange(); @@ -19288,11 +19285,10 @@ var _class = function _class(container, config) { }; })(); - // Function: getBold - // Check whether selected element is bold or not - // - // Returns: - // Boolean indicating whether or not element is bold + /** + * Check whether selected element is bold or not + * @returns {Boolean} Indicates whether or not element is bold + */ this.getBold = function () { // should only have one element selected var selected = selectedElements[0]; @@ -19302,11 +19298,10 @@ var _class = function _class(container, config) { return false; }; - // Function: setBold - // Make the selected element bold or normal - // - // Parameters: - // b - Boolean indicating bold (true) or normal (false) + /** + * Make the selected element bold or normal + * @param {Boolean} b - Indicates bold (true) or normal (false) + */ this.setBold = function (b) { var selected = selectedElements[0]; if (selected != null && selected.tagName === 'text' && selectedElements[1] == null) { @@ -19317,11 +19312,10 @@ var _class = function _class(container, config) { } }; - // Function: getItalic - // Check whether selected element is italic or not - // - // Returns: - // Boolean indicating whether or not element is italic + /** + * Check whether selected element is italic or not + * @returns {Boolean} Indicates whether or not element is italic + */ this.getItalic = function () { var selected = selectedElements[0]; if (selected != null && selected.tagName === 'text' && selectedElements[1] == null) { @@ -19330,11 +19324,10 @@ var _class = function _class(container, config) { return false; }; - // Function: setItalic - // Make the selected element italic or normal - // - // Parameters: - // b - Boolean indicating italic (true) or normal (false) + /** + * Make the selected element italic or normal + * @param {Boolean} b - Indicates italic (true) or normal (false) + */ this.setItalic = function (i) { var selected = selectedElements[0]; if (selected != null && selected.tagName === 'text' && selectedElements[1] == null) { @@ -19345,17 +19338,17 @@ var _class = function _class(container, config) { } }; - // Function: getFontFamily - // Returns the current font family + /** + * @returns The current font family + */ this.getFontFamily = function () { return curText.font_family; }; - // Function: setFontFamily - // Set the new font family - // - // Parameters: - // val - String with the new font family + /** + * Set the new font family + * @param {String} val - String with the new font family + */ this.setFontFamily = function (val) { curText.font_family = val; changeSelectedAttribute('font-family', val); @@ -19364,33 +19357,33 @@ var _class = function _class(container, config) { } }; - // Function: setFontColor - // Set the new font color - // - // Parameters: - // val - String with the new font color + /** + * Set the new font color + * @param {String} val - String with the new font color + */ this.setFontColor = function (val) { curText.fill = val; changeSelectedAttribute('fill', val); }; - // Function: getFontColor - // Returns the current font color + /** + * @returns The current font color + */ this.getFontColor = function () { return curText.fill; }; - // Function: getFontSize - // Returns the current font size + /** + * Returns the current font size + */ this.getFontSize = function () { return curText.font_size; }; - // Function: setFontSize - // Applies the given font size to the selected element - // - // Parameters: - // val - Float with the new font size + /** + * Applies the given font size to the selected element + * @param {Number} val - Float with the new font size + */ this.setFontSize = function (val) { curText.font_size = val; changeSelectedAttribute('font-size', val); @@ -19399,8 +19392,9 @@ var _class = function _class(container, config) { } }; - // Function: getText - // Returns the current text (textContent) of the selected element + /** + * @returns The current text (textContent) of the selected element + */ this.getText = function () { var selected = selectedElements[0]; if (selected == null) { @@ -19409,23 +19403,21 @@ var _class = function _class(container, config) { return selected.textContent; }; - // Function: setTextContent - // Updates the text element with the given string - // - // Parameters: - // val - String with the new text + /** + * Updates the text element with the given string + * @param {String} val - String with the new text + */ this.setTextContent = function (val) { changeSelectedAttribute('#text', val); textActions.init(val); textActions.setCursor(); }; - // Function: setImageURL - // Sets the new image URL for the selected image element. Updates its size if - // a new URL is given - // - // Parameters: - // val - String with the image URL/path + /** + * Sets the new image URL for the selected image element. Updates its size if + * a new URL is given + * @param {String} val - String with the image URL/path + */ this.setImageURL = function (val) { var elem = selectedElements[0]; if (!elem) { @@ -19471,11 +19463,10 @@ var _class = function _class(container, config) { } }; - // Function: setLinkURL - // Sets the new link URL for the selected anchor element. - // - // Parameters: - // val - String with the link URL/path + /** + * Sets the new link URL for the selected anchor element. + * @param {String} val - String with the link URL/path + */ this.setLinkURL = function (val) { var elem = selectedElements[0]; if (!elem) { @@ -19507,11 +19498,10 @@ var _class = function _class(container, config) { addCommandToHistory(batchCmd); }; - // Function: setRectRadius - // Sets the rx & ry values to the selected rect element to change its corner radius - // - // Parameters: - // val - The new radius + /** + * Sets the rx & ry values to the selected rect element to change its corner radius + * @param val - The new radius + */ this.setRectRadius = function (val) { var selected = selectedElements[0]; if (selected != null && selected.tagName === 'rect') { @@ -19525,8 +19515,10 @@ var _class = function _class(container, config) { } }; - // Function: makeHyperlink - // Wraps the selected element(s) in an anchor element or converts group to one + /** + * Wraps the selected element(s) in an anchor element or converts group to one + * @param url + */ this.makeHyperlink = function (url) { canvas.groupSelectedElements('a', url); @@ -19534,34 +19526,34 @@ var _class = function _class(container, config) { // if (selectedElements.length > 1 && selectedElements[1]) { }; - // Function: removeHyperlink + /** + * + */ this.removeHyperlink = function () { canvas.ungroupSelectedElement(); }; - // Group: Element manipulation + /** + * Group: Element manipulation + */ - // Function: setSegType - // Sets the new segment type to the selected segment(s). - // - // Parameters: - // new_type - Integer with the new segment type - // See https://www.w3.org/TR/SVG/paths.html#InterfaceSVGPathSeg for list + /** + * Sets the new segment type to the selected segment(s). + * @param {Number} newType - Integer with the new segment type + * See https://www.w3.org/TR/SVG/paths.html#InterfaceSVGPathSeg for list + */ this.setSegType = function (newType) { pathActions$$1.setSegType(newType); }; - // TODO(codedread): Remove the getBBox argument and split this function into two. - // Function: convertToPath - // Convert selected element to a path, or get the BBox of an element-as-path - // - // Parameters: - // elem - The DOM element to be converted - // getBBox - Boolean on whether or not to only return the path's BBox - // - // Returns: - // If the getBBox flag is true, the resulting path's bounding box object. - // Otherwise the resulting path element is returned. + /** + * @todo (codedread): Remove the getBBox argument and split this function into two. + * Convert selected element to a path, or get the BBox of an element-as-path + * @param elem - The DOM element to be converted + * @param getBBox - Boolean on whether or not to only return the path's BBox + * @returns If the getBBox flag is true, the resulting path's bounding box object. + * Otherwise the resulting path element is returned. + */ this.convertToPath = function (elem, getBBox$$1) { if (elem == null) { var elems = selectedElements; @@ -19593,14 +19585,13 @@ var _class = function _class(container, config) { } }; - // Function: changeSelectedAttributeNoUndo - // This function makes the changes to the elements. It does not add the change - // to the history stack. - // - // Parameters: - // attr - String with the attribute name - // newValue - String or number with the new attribute value - // elems - The DOM elements to apply the change to + /** + * This function makes the changes to the elements. It does not add the change + * to the history stack. + * @param {String} attr - Attribute name + * @param {String|Number} newValue - String or number with the new attribute value + * @param elems - The DOM elements to apply the change to + */ var changeSelectedAttributeNoUndo = function changeSelectedAttributeNoUndo(attr, newValue, elems) { if (currentMode === 'pathedit') { // Editing node @@ -19728,16 +19719,15 @@ var _class = function _class(container, config) { } // for each elem }; - // Function: changeSelectedAttribute - // Change the given/selected element and add the original value to the history stack - // If you want to change all selectedElements, ignore the elems argument. - // If you want to change only a subset of selectedElements, then send the - // subset to this function in the elems argument. - // - // Parameters: - // attr - String with the attribute name - // newValue - String or number with the new attribute value - // elems - The DOM elements to apply the change to + /** + * Change the given/selected element and add the original value to the history stack + * If you want to change all selectedElements, ignore the elems argument. + * If you want to change only a subset of selectedElements, then send the + * subset to this function in the elems argument. + * @param {String} attr - String with the attribute name + * @param {String|Number} newValue - String or number with the new attribute value + * @param elems - The DOM elements to apply the change to + */ var changeSelectedAttribute = this.changeSelectedAttribute = function (attr, val, elems) { elems = elems || selectedElements; canvas.undoMgr.beginUndoableChange(attr, elems); @@ -19751,7 +19741,6 @@ var _class = function _class(container, config) { } }; - // Function: deleteSelectedElements // Removes all selected elements from the DOM and adds the change to the // history stack this.deleteSelectedElements = function () { @@ -19896,11 +19885,10 @@ var _class = function _class(container, config) { call('changed', pasted); }; - // Function: groupSelectedElements - // Wraps all the selected elements in a group (g) element - - // Parameters: - // type - type of element to group into, defaults to <g> + /** + * Wraps all the selected elements in a group (g) element + * @param type - type of element to group into, defaults to <g> + */ this.groupSelectedElements = function (type, urlArg) { if (!type) { type = 'g'; @@ -19964,7 +19952,6 @@ var _class = function _class(container, config) { selectOnly([g], true); }; - // Function: pushGroupProperties // Pushes all appropriate parent group properties down to its children, then // removes them from the group var pushGroupProperties = this.pushGroupProperties = function (g, undoable) { @@ -20161,9 +20148,10 @@ var _class = function _class(container, config) { } }; - // Function: ungroupSelectedElement - // Unwraps all the elements in a selected group (g) element. This requires - // significant recalculations to apply group's transforms, etc to its children + /** + * Unwraps all the elements in a selected group (g) element. This requires + * significant recalculations to apply group's transforms, etc to its children + */ this.ungroupSelectedElement = function () { var g = selectedElements[0]; if (!g) { @@ -20235,9 +20223,10 @@ var _class = function _class(container, config) { } }; - // Function: moveToTopSelectedElement - // Repositions the selected element to the bottom in the DOM to appear on top of - // other elements + /** + * Repositions the selected element to the bottom in the DOM to appear on top of + * other elements + */ this.moveToTopSelectedElement = function () { var selected = selectedElements[0]; if (selected != null) { @@ -20254,9 +20243,10 @@ var _class = function _class(container, config) { } }; - // Function: moveToBottomSelectedElement - // Repositions the selected element to the top in the DOM to appear under - // other elements + /** + * Repositions the selected element to the top in the DOM to appear under + * other elements + */ this.moveToBottomSelectedElement = function () { var selected = selectedElements[0]; if (selected != null) { @@ -20283,12 +20273,11 @@ var _class = function _class(container, config) { } }; - // Function: moveUpDownSelected - // Moves the select element up or down the stack, based on the visibly - // intersecting elements - // - // Parameters: - // dir - String that's either 'Up' or 'Down' + /** + * Moves the select element up or down the stack, based on the visibly + * intersecting elements + * @param {"Up"|"Down"} dir - String that's either 'Up' or 'Down' + */ this.moveUpDownSelected = function (dir) { var selected = selectedElements[0]; if (!selected) { @@ -20330,16 +20319,13 @@ var _class = function _class(container, config) { } }; - // Function: moveSelectedElements - // Moves selected elements on the X/Y axis - // - // Parameters: - // dx - Float with the distance to move on the x-axis - // dy - Float with the distance to move on the y-axis - // undoable - Boolean indicating whether or not the action should be undoable - // - // Returns: - // Batch command for the move + /** + * Moves selected elements on the X/Y axis + * @param {Number} dx - Float with the distance to move on the x-axis + * @param {Number} dy - Float with the distance to move on the y-axis + * @param {Boolean} undoable - Boolean indicating whether or not the action should be undoable + * @returns Batch command for the move + */ this.moveSelectedElements = function (dx, dy, undoable) { // if undoable is not sent, default to true // if single values, scale them to the zoom @@ -20401,9 +20387,10 @@ var _class = function _class(container, config) { } }; - // Function: cloneSelectedElements - // Create deep DOM copies (clones) of all selected elements and move them slightly - // from their originals + /** + * Create deep DOM copies (clones) of all selected elements and move them slightly + * from their originals + */ this.cloneSelectedElements = function (x, y) { var i = void 0, elem = void 0; @@ -20441,13 +20428,11 @@ var _class = function _class(container, config) { } }; - // Function: alignSelectedElements - // Aligns selected elements - // - // Parameters: - // type - String with single character indicating the alignment type - // relativeTo - String that must be one of the following: - // "selected", "largest", "smallest", "page" + /** + * Aligns selected elements + * @param {String} type - String with single character indicating the alignment type + * @param {"selected"|"largest"|"smallest"|"page"} relativeTo + */ this.alignSelectedElements = function (type, relativeTo) { var bboxes = []; // angles = []; var len = selectedElements.length; @@ -20554,26 +20539,25 @@ var _class = function _class(container, config) { this.moveSelectedElements(dx, dy); }; - // Group: Additional editor tools + /** + * Group: Additional editor tools + */ this.contentW = getResolution().w; this.contentH = getResolution().h; - // Function: updateCanvas - // Updates the editor canvas width/height/position after a zoom has occurred - // - // Parameters: - // w - Float with the new width - // h - Float with the new height - // - // Returns: - // Object with the following values: - // * x - The canvas' new x coordinate - // * y - The canvas' new y coordinate - // * oldX - The canvas' old x coordinate - // * oldY - The canvas' old y coordinate - // * d_x - The x position difference - // * d_y - The y position difference + /** + * Updates the editor canvas width/height/position after a zoom has occurred + * @param {Number} w - Float with the new width + * @param {Number} h - Float with the new height + * @returns Object with the following values: + * - x - The canvas' new x coordinate + * - y - The canvas' new y coordinate + * - oldX - The canvas' old x coordinate + * - oldY - The canvas' old y coordinate + * - d_x - The x position difference + * - d_y - The y position difference + */ this.updateCanvas = function (w, h) { svgroot.setAttribute('width', w); svgroot.setAttribute('height', h); @@ -20611,12 +20595,11 @@ var _class = function _class(container, config) { return { x: x, y: y, old_x: oldX, old_y: oldY, d_x: x - oldX, d_y: y - oldY }; }; - // Function: setBackground - // Set the background of the editor (NOT the actual document) - // - // Parameters: - // color - String with fill color to apply - // url - URL or path to image to use + /** + * Set the background of the editor (NOT the actual document) + * @param {String} color - String with fill color to apply + * @param url - URL or path to image to use + */ this.setBackground = function (color, url) { var bg = getElem('canvasBackground'); var border = $$9(bg).find('rect')[0]; @@ -20640,11 +20623,10 @@ var _class = function _class(container, config) { } }; - // Function: cycleElement - // Select the next/previous element within the current layer - // - // Parameters: - // next - Boolean where true = next and false = previous element + /** + * Select the next/previous element within the current layer + * @param {Boolean} next - true = next and false = previous element + */ this.cycleElement = function (next) { var num = void 0; var curElem = selectedElements[0]; @@ -20677,14 +20659,16 @@ var _class = function _class(container, config) { this.clear(); - // DEPRECATED: getPrivateMethods - // Since all methods are/should be public somehow, this function should be removed; - // we might require `import` in place of this in the future once ES6 Modules - // widespread - - // Being able to access private methods publicly seems wrong somehow, - // but currently appears to be the best way to allow testing and provide - // access to them to plugins. + /** + * @deprecated getPrivateMethods + * Since all methods are/should be public somehow, this function should be removed; + * we might require `import` in place of this in the future once ES6 Modules + * widespread + + * Being able to access private methods publicly seems wrong somehow, + * but currently appears to be the best way to allow testing and provide + * access to them to plugins. + */ this.getPrivateMethods = function () { var obj = { addCommandToHistory: addCommandToHistory, @@ -25217,7 +25201,8 @@ function loadStylesheets(stylesheets) { faviconDefault = _ref.favicon, canvasDefault = _ref.canvas, _ref$image = _ref.image, - imageDefault = _ref$image === undefined ? true : _ref$image; + imageDefault = _ref$image === undefined ? true : _ref$image, + acceptErrors = _ref.acceptErrors; stylesheets = Array.isArray(stylesheets) ? stylesheets : [stylesheets]; @@ -25257,6 +25242,11 @@ function loadStylesheets(stylesheets) { var link = document.createElement('link'); return new Promise(function (resolve, reject) { + if (acceptErrors) { + reject = typeof acceptErrors === 'function' ? function (error) { + acceptErrors({ error: error, stylesheetURL: stylesheetURL, options: options, resolve: resolve, reject: reject }); + } : resolve; + } if (stylesheetURL.endsWith('.css')) { favicon = false; } else if (stylesheetURL.endsWith('.ico')) { @@ -26248,7 +26238,28 @@ editor.init = function () { } }); - var stylesheets = $$b.loadingStylesheets; + function getStylesheetPriority(stylesheet) { + switch (stylesheet) { + case 'jgraduate/css/jPicker.css': + return 1; + case 'jgraduate/css/jgraduate.css': + return 2; + case 'svg-editor.css': + return 3; + case 'spinbtn/JQuerySpinBtn.css': + return 4; + default: + return Infinity; + } + } + var stylesheets = $$b.loadingStylesheets.sort(function (a, b) { + var priorityA = getStylesheetPriority(a); + var priorityB = getStylesheetPriority(b); + if (priorityA === priorityB) { + return 0; + } + return priorityA > priorityB; + }); if (curConfig.stylesheets.length) { // Ensure a copy with unique items stylesheets = [].concat(toConsumableArray(new Set(curConfig.stylesheets))); @@ -26259,7 +26270,18 @@ editor.init = function () { (_stylesheets = stylesheets).splice.apply(_stylesheets, [idx, 1].concat(toConsumableArray($$b.loadingStylesheets))); } } - loadStylesheets(stylesheets).then(function () { + loadStylesheets(stylesheets, { acceptErrors: function acceptErrors(_ref) { + var stylesheetURL = _ref.stylesheetURL, + reject = _ref.reject, + resolve = _ref.resolve; + + if ($$b.loadingStylesheets.includes(stylesheetURL)) { + reject(new Error('Missing expected stylesheet: ' + stylesheetURL)); + return; + } + resolve(); + } }).then(function () { + $$b('#svg_container')[0].style.visibility = 'visible'; editor.runCallbacks(); setTimeout(function () { @@ -26708,11 +26730,17 @@ editor.init = function () { } function promptImgURL() { + var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref2$cancelDeletes = _ref2.cancelDeletes, + cancelDeletes = _ref2$cancelDeletes === undefined ? false : _ref2$cancelDeletes; + var curhref = svgCanvas.getHref(selectedElement); curhref = curhref.startsWith('data:') ? '' : curhref; $$b.prompt(uiStrings$1.notification.enterNewImgURL, curhref, function (url) { if (url) { setImageURL(url); + } else if (cancelDeletes) { + svgCanvas.deleteSelectedElements(); } }); } @@ -27110,7 +27138,7 @@ editor.init = function () { if (elname === 'image' && svgCanvas.getMode() === 'image') { // Prompt for URL if not a data URL if (!svgCanvas.getHref(elem).startsWith('data:')) { - promptImgURL(); + promptImgURL({ cancelDeletes: true }); } } /* else if (elname == 'text') { @@ -28161,9 +28189,9 @@ editor.init = function () { }); svgCanvas.bind('zoomed', zoomChanged); svgCanvas.bind('zoomDone', zoomDone); - svgCanvas.bind('updateCanvas', function (win, _ref) { - var center = _ref.center, - newCtr = _ref.newCtr; + svgCanvas.bind('updateCanvas', function (win, _ref3) { + var center = _ref3.center, + newCtr = _ref3.newCtr; updateCanvas(center, newCtr); }); diff --git a/dist/index-es.min.js b/dist/index-es.min.js index 83d61f55..a1ab5dfb 100644 --- a/dist/index-es.min.js +++ b/dist/index-es.min.js @@ -1,2 +1,2 @@ -function touchHandler(e){var t=e.changedTouches,n=t[0],a="";switch(e.type){case"touchstart":a="mousedown";break;case"touchmove":a="mousemove";break;case"touchend":a="mouseup";break;default:return}var r=document.createEvent("MouseEvent");r.initMouseEvent(a,!0,!0,window,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),t.length<2&&(n.target.dispatchEvent(r),e.preventDefault())}document.addEventListener("touchstart",touchHandler,!0),document.addEventListener("touchmove",touchHandler,!0),document.addEventListener("touchend",touchHandler,!0),document.addEventListener("touchcancel",touchHandler,!0);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},slicedToArray=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],a=!0,r=!1,i=void 0;try{for(var s,o=e[Symbol.iterator]();!(a=(s=o.next()).done)&&(n.push(s.value),!t||n.length!==t);a=!0);}catch(e){r=!0,i=e}finally{try{!a&&o.return&&o.return()}finally{if(r)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},NS={HTML:"http://www.w3.org/1999/xhtml",MATH:"http://www.w3.org/1998/Math/MathML",SE:"http://svg-edit.googlecode.com",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"},getReverseNS=function(){var e={};return Object.entries(NS).forEach(function(t){var n=slicedToArray(t,2),a=n[0],r=n[1];e[r]=a.toLowerCase()}),e};!function(){if(!("SVGPathSeg"in window)){var e=function(){function e(t,n,a){classCallCheck(this,e),this.pathSegType=t,this.pathSegTypeAsLetter=n,this._owningPathSegList=a}return createClass(e,[{key:"_segmentChanged",value:function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)}}]),e}();e.prototype.classname="SVGPathSeg",e.PATHSEG_UNKNOWN=0,e.PATHSEG_CLOSEPATH=1,e.PATHSEG_MOVETO_ABS=2,e.PATHSEG_MOVETO_REL=3,e.PATHSEG_LINETO_ABS=4,e.PATHSEG_LINETO_REL=5,e.PATHSEG_CURVETO_CUBIC_ABS=6,e.PATHSEG_CURVETO_CUBIC_REL=7,e.PATHSEG_CURVETO_QUADRATIC_ABS=8,e.PATHSEG_CURVETO_QUADRATIC_REL=9,e.PATHSEG_ARC_ABS=10,e.PATHSEG_ARC_REL=11,e.PATHSEG_LINETO_HORIZONTAL_ABS=12,e.PATHSEG_LINETO_HORIZONTAL_REL=13,e.PATHSEG_LINETO_VERTICAL_ABS=14,e.PATHSEG_LINETO_VERTICAL_REL=15,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19;var t=function(t){function n(t){return classCallCheck(this,n),possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CLOSEPATH,"z",t))}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegClosePath]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter}},{key:"clone",value:function(){return new n(void 0)}}]),n}(),n=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_MOVETO_ABS,"M",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegMovetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(n.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var a=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_MOVETO_REL,"m",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegMovetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(a.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var r=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_ABS,"L",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(r.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var i=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_REL,"l",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(i.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var s=function(t){function n(t,a,r,i,s,o,l){classCallCheck(this,n);var u=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_ABS,"C",t));return u._x=a,u._y=r,u._x1=i,u._y1=s,u._x2=o,u._y2=l,u}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),n}();Object.defineProperties(s.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var o=function(t){function n(t,a,r,i,s,o,l){classCallCheck(this,n);var u=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_REL,"c",t));return u._x=a,u._y=r,u._x1=i,u._y1=s,u._x2=o,u._y2=l,u}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),n}();Object.defineProperties(o.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var l=function(t){function n(t,a,r,i,s){classCallCheck(this,n);var o=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t));return o._x=a,o._y=r,o._x1=i,o._y1=s,o}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x1,this._y1)}}]),n}();Object.defineProperties(l.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var u=function(t){function n(t,a,r,i,s){classCallCheck(this,n);var o=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_REL,"q",t));return o._x=a,o._y=r,o._x1=i,o._y1=s,o}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x1,this._y1)}}]),n}();Object.defineProperties(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}});var c=function(t){function n(t,a,r,i,s,o,l,u){classCallCheck(this,n);var c=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_ARC_ABS,"A",t));return c._x=a,c._y=r,c._r1=i,c._r2=s,c._angle=o,c._largeArcFlag=l,c._sweepFlag=u,c}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegArcAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),n}();Object.defineProperties(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},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var h=function(t){function n(t,a,r,i,s,o,l,u){classCallCheck(this,n);var c=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_ARC_REL,"a",t));return c._x=a,c._y=r,c._r1=i,c._r2=s,c._angle=o,c._largeArcFlag=l,c._sweepFlag=u,c}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegArcRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),n}();Object.defineProperties(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},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var d=function(t){function n(t,a){classCallCheck(this,n);var r=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t));return r._x=a,r}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new n(void 0,this._x)}}]),n}();Object.defineProperty(d.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var f=function(t){function n(t,a){classCallCheck(this,n);var r=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_HORIZONTAL_REL,"h",t));return r._x=a,r}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new n(void 0,this._x)}}]),n}();Object.defineProperty(f.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var p=function(t){function n(t,a){classCallCheck(this,n);var r=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_VERTICAL_ABS,"V",t));return r._y=a,r}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._y)}}]),n}();Object.defineProperty(p.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var g=function(t){function n(t,a){classCallCheck(this,n);var r=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_LINETO_VERTICAL_REL,"v",t));return r._y=a,r}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._y)}}]),n}();Object.defineProperty(g.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var v=function(t){function n(t,a,r,i,s){classCallCheck(this,n);var o=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t));return o._x=a,o._y=r,o._x2=i,o._y2=s,o}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x2,this._y2)}}]),n}();Object.defineProperties(v.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var m=function(t){function n(t,a,r,i,s){classCallCheck(this,n);var o=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t));return o._x=a,o._y=r,o._x2=i,o._y2=s,o}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x2,this._y2)}}]),n}();Object.defineProperties(m.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var y=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(y.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var b=function(t){function n(t,a,r){classCallCheck(this,n);var i=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t));return i._x=a,i._y=r,i}return inherits(n,e),createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(b.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}}),SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new t(void 0)},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(e,t){return new n(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(e,t){return new a(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new r(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new i(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,a,r,i){return new s(void 0,e,t,n,a,r,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,a,r,i){return new o(void 0,e,t,n,a,r,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,a){return new l(void 0,e,t,n,a)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(e,t,n,a){return new u(void 0,e,t,n,a)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(e,t,n,a,r,i,s){return new c(void 0,e,t,n,a,r,i,s)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,a,r,i,s){return new h(void 0,e,t,n,a,r,i,s)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(e){return new d(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(e){return new f(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new p(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new g(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,a){return new v(void 0,e,t,n,a)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,a){return new m(void 0,e,t,n,a)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new y(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new b(void 0,e,t)},"getPathSegAtLength"in SVGPathElement.prototype||(SVGPathElement.prototype.getPathSegAtLength=function(e){if(void 0===e||!isFinite(e))throw new Error("Invalid arguments.");var t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",this.getAttribute("d"));var n=t.pathSegList.numberOfItems-1;if(n<=0)return 0;do{if(t.pathSegList.removeItem(n),e>t.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=a,window.SVGPathSegLinetoAbs=r,window.SVGPathSegLinetoRel=i,window.SVGPathSegCurvetoCubicAbs=s,window.SVGPathSegCurvetoCubicRel=o,window.SVGPathSegCurvetoQuadraticAbs=l,window.SVGPathSegCurvetoQuadraticRel=u,window.SVGPathSegArcAbs=c,window.SVGPathSegArcRel=h,window.SVGPathSegLinetoHorizontalAbs=d,window.SVGPathSegLinetoHorizontalRel=f,window.SVGPathSegLinetoVerticalAbs=p,window.SVGPathSegLinetoVerticalRel=g,window.SVGPathSegCurvetoCubicSmoothAbs=v,window.SVGPathSegCurvetoCubicSmoothRel=m,window.SVGPathSegCurvetoQuadraticSmoothAbs=y,window.SVGPathSegCurvetoQuadraticSmoothRel=b}if(!("SVGPathSegList"in window&&"appendItem"in SVGPathSegList.prototype)){var _=function(){function e(t){classCallCheck(this,e),this._pathElement=t,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}return createClass(e,[{key:"_checkPathSynchronizedToList",value:function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())}},{key:"_updateListFromPathMutations",value:function(e){if(this._pathElement){var t=!1;e.forEach(function(e){"d"===e.attributeName&&(t=!0)}),t&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}}},{key:"_writeListToPath",value:function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",e._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}},{key:"segmentChanged",value:function(e){this._writeListToPath()}},{key:"clear",value:function(){this._checkPathSynchronizedToList(),this._list.forEach(function(e){e._owningPathSegList=null}),this._list=[],this._writeListToPath()}},{key:"initialize",value:function(e){return this._checkPathSynchronizedToList(),this._list=[e],e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_checkValidIndex",value:function(e){if(isNaN(e)||e<0||e>=this.numberOfItems)throw new Error("INDEX_SIZE_ERR")}},{key:"getItem",value:function(e){return this._checkPathSynchronizedToList(),this._checkValidIndex(e),this._list[e]}},{key:"insertItemBefore",value:function(e,t){return this._checkPathSynchronizedToList(),t>this.numberOfItems&&(t=this.numberOfItems),e._owningPathSegList&&(e=e.clone()),this._list.splice(t,0,e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"replaceItem",value:function(e,t){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._checkValidIndex(t),this._list[t]=e,e._owningPathSegList=this,this._writeListToPath(),e}},{key:"removeItem",value:function(e){this._checkPathSynchronizedToList(),this._checkValidIndex(e);var t=this._list[e];return this._list.splice(e,1),this._writeListToPath(),t}},{key:"appendItem",value:function(e){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._list.push(e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_parsePath",value:function(e){if(!e||!e.length)return[];var t=this,n=function(){function e(){classCallCheck(this,e),this.pathSegList=[]}return createClass(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),a=function(){function e(t){classCallCheck(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return createClass(e,[{key:"_isCurrentSpace",value:function(){var e=this._string[this._currentIndex];return e<=" "&&(" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e)}},{key:"_skipOptionalSpaces",value:function(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex++;return this._currentIndex<this._endIndex}},{key:"_skipOptionalSpacesOrDelimiter",value:function(){return!(this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&","!==this._string.charAt(this._currentIndex))&&(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&","===this._string.charAt(this._currentIndex)&&(this._currentIndex++,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)}},{key:"hasMoreData",value:function(){return this._currentIndex<this._endIndex}},{key:"peekSegmentType",value:function(){var e=this._string[this._currentIndex];return this._pathSegTypeFromChar(e)}},{key:"_pathSegTypeFromChar",value:function(e){switch(e){case"Z":case"z":return SVGPathSeg.PATHSEG_CLOSEPATH;case"M":return SVGPathSeg.PATHSEG_MOVETO_ABS;case"m":return SVGPathSeg.PATHSEG_MOVETO_REL;case"L":return SVGPathSeg.PATHSEG_LINETO_ABS;case"l":return SVGPathSeg.PATHSEG_LINETO_REL;case"C":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS;case"c":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL;case"Q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;case"q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;case"A":return SVGPathSeg.PATHSEG_ARC_ABS;case"a":return SVGPathSeg.PATHSEG_ARC_REL;case"H":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;case"h":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;case"V":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;case"v":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;case"S":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;case"s":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;case"T":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;case"t":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;default:return SVGPathSeg.PATHSEG_UNKNOWN}}},{key:"_nextCommandHelper",value:function(e,t){return("+"===e||"-"===e||"."===e||e>="0"&&e<="9")&&t!==SVGPathSeg.PATHSEG_CLOSEPATH?t===SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:t===SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:t:SVGPathSeg.PATHSEG_UNKNOWN}},{key:"initialCommandIsMoveTo",value:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===SVGPathSeg.PATHSEG_MOVETO_ABS||e===SVGPathSeg.PATHSEG_MOVETO_REL}},{key:"_parseNumber",value:function(){var e=0,t=0,n=1,a=0,r=1,i=1,s=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex<this._endIndex&&"+"===this._string.charAt(this._currentIndex)?this._currentIndex++:this._currentIndex<this._endIndex&&"-"===this._string.charAt(this._currentIndex)&&(this._currentIndex++,r=-1),!(this._currentIndex===this._endIndex||(this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")&&"."!==this._string.charAt(this._currentIndex))){for(var o=this._currentIndex;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==o)for(var l=this._currentIndex-1,u=1;l>=o;)t+=u*(this._string.charAt(l--)-"0"),u*=10;if(this._currentIndex<this._endIndex&&"."===this._string.charAt(this._currentIndex)){if(this._currentIndex++,this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)n*=10,a+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==s&&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 c=t+a;if(c*=r,e&&(c*=Math.pow(10,i*e)),s!==this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),c}}},{key:"_parseArcFlag",value:function(){if(!(this._currentIndex>=this._endIndex)){var e=!1,t=this._string.charAt(this._currentIndex++);if("0"===t)e=!1;else{if("1"!==t)return;e=!0}return this._skipOptionalSpacesOrDelimiter(),e}}},{key:"parseSegment",value:function(){var e=this._string[this._currentIndex],n=this._pathSegTypeFromChar(e);if(n===SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand===SVGPathSeg.PATHSEG_UNKNOWN)return null;if((n=this._nextCommandHelper(e,this._previousCommand))===SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=n,n){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(t);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,a.x,a.y,a.x1,a.y1,a.x2,a.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:var i={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(t,i.x,i.y,i.x2,i.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:var s={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,s.x,s.y,s.x2,s.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var o={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,o.x,o.y,o.x1,o.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 u={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,u.x,u.y,u.x1,u.y1,u.arcAngle,u.arcLarge,u.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS: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 SVGPathSegArcAbs(t,c.x,c.y,c.x1,c.y1,c.arcAngle,c.arcLarge,c.arcSweep);default:throw new Error("Unknown path seg type.")}}}]),e}(),r=new n,i=new a(e);if(!i.initialCommandIsMoveTo())return[];for(;i.hasMoreData();){var s=i.parseSegment();if(!s)return[];r.appendSegment(s)}return r.pathSegList}}]),e}();_.prototype.classname="SVGPathSegList",Object.defineProperty(_.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),_._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 _(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=_}}();var $=jQuery,supportsSvg_=!!document.createElementNS&&!!document.createElementNS(NS.SVG,"svg").createSVGRect,_navigator=navigator,userAgent=_navigator.userAgent,svg=document.createElementNS(NS.SVG,"svg"),isOpera_=!!window.opera,isWebkit_=userAgent.includes("AppleWebKit"),isGecko_=userAgent.includes("Gecko/"),isIE_=userAgent.includes("MSIE"),isChrome_=userAgent.includes("Chrome/"),isWindows_=userAgent.includes("Windows"),isMac_=userAgent.includes("Macintosh"),isTouch_="ontouchstart"in window,supportsSelectors_=!!svg.querySelector,supportsXpath_=!!document.evaluate,supportsPathReplaceItem_=function(){var e=document.createElementNS(NS.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.replaceItem(n,1),!0}catch(e){}return!1}(),supportsPathInsertItemBefore_=function(){var e=document.createElementNS(NS.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.insertItemBefore(n,1),!0}catch(e){}return!1}(),supportsGoodTextCharPos_=function(){var e=document.createElementNS(NS.SVG,"svg"),t=document.createElementNS(NS.SVG,"svg");document.documentElement.appendChild(e),t.setAttribute("x",5),e.appendChild(t);var n=document.createElementNS(NS.SVG,"text");n.textContent="a",t.appendChild(n);var a=n.getStartPositionOfChar(0).x;return document.documentElement.removeChild(e),0===a}(),supportsPathBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.appendChild(e);var t=document.createElementNS(NS.SVG,"path");t.setAttribute("d","M0,0 C0,0 10,10 10,0"),e.appendChild(t);var n=t.getBBox();return document.documentElement.removeChild(e),n.height>4&&n.height<5}(),supportsHVLineContainerBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.appendChild(e);var t=document.createElementNS(NS.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(NS.SVG,"path");n.setAttribute("d","M5,0 15,0");var a=document.createElementNS(NS.SVG,"g");a.appendChild(t),a.appendChild(n),e.appendChild(a);var r=a.getBBox();return document.documentElement.removeChild(e),15===r.width}(),supportsGoodDecimals_=function(){var e=document.createElementNS(NS.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");return t||$.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the <a href="http://opera.com">latest version</a> in which the problems have been fixed.'),t}(),supportsNonScalingStroke_=function(){var e=document.createElementNS(NS.SVG,"rect");return e.setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===e.style.vectorEffect}(),supportsNativeSVGTransformLists_=function(){var e=document.createElementNS(NS.SVG,"rect").transform.baseVal,t=svg.createSVGTransform();e.appendItem(t);var n=e.getItem(0);return n instanceof SVGTransform&&t instanceof SVGTransform&&n.type===t.type&&n.angle===t.angle&&n.matrix.a===t.matrix.a&&n.matrix.b===t.matrix.b&&n.matrix.c===t.matrix.c&&n.matrix.d===t.matrix.d&&n.matrix.e===t.matrix.e&&n.matrix.f===t.matrix.f}(),isOpera=function(){return isOpera_},isWebkit=function(){return isWebkit_},isGecko=function(){return isGecko_},isIE=function(){return isIE_},isChrome=function(){return isChrome_},isMac=function(){return isMac_},isTouch=function(){return isTouch_},supportsSelectors=function(){return supportsSelectors_},supportsXpath=function(){return supportsXpath_},supportsPathReplaceItem=function(){return supportsPathReplaceItem_},supportsPathInsertItemBefore=function(){return supportsPathInsertItemBefore_},supportsPathBBox=function(){return supportsPathBBox_},supportsHVLineContainerBBox=function(){return supportsHVLineContainerBBox_},supportsGoodTextCharPos=function(){return supportsGoodTextCharPos_},supportsNonScalingStroke=function(){return supportsNonScalingStroke_},supportsNativeTransformLists=function(){return supportsNativeSVGTransformLists_};function RGBColor(e){this.ok=!1,"#"===e.charAt(0)&&(e=e.substr(1,6)),e=(e=e.replace(/ /g,"")).toLowerCase();var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var n in t)t.hasOwnProperty(n)&&e===n&&(e=t[n]);for(var a=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(e){return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],r=0;r<a.length;r++){var i=a[r].re,s=a[r].process,o=i.exec(e);if(o){var l=s(o);this.r=l[0],this.g=l[1],this.b=l[2],this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var e=this.r.toString(16),t=this.g.toString(16),n=this.b.toString(16);return 1===e.length&&(e="0"+e),1===t.length&&(t="0"+t),1===n.length&&(n="0"+n),"#"+e+t+n},this.getHelpXML=function(){for(var e=[],n=0;n<a.length;n++)for(var r=a[n].example,i=0;i<r.length;i++)e[e.length]=r[i];for(var s in t)t.hasOwnProperty(s)&&(e[e.length]=s);var o=document.createElement("ul");o.setAttribute("id","rgbcolor-examples");for(var l=0;l<e.length;l++)try{var u=document.createElement("li"),c=new RGBColor(e[l]),h=document.createElement("div");h.style.cssText="margin: 3px; border: 1px solid black; background:"+c.toHex()+"; color:"+c.toHex(),h.appendChild(document.createTextNode("test"));var d=document.createTextNode(" "+e[l]+" -> "+c.toRGB()+" -> "+c.toHex());u.appendChild(h),u.appendChild(d),o.appendChild(u)}catch(e){}return o}}function jqPluginSVG(e){var t=e.fn.attr;return e.fn.attr=function(e,n){var a=this.length;if(!a)return t.apply(this,arguments);for(var r=0;r<a;++r){var i=this[r];if("http://www.w3.org/2000/svg"!==i.namespaceURI)return t.apply(this,arguments);if(void 0!==n)i.setAttribute(e,n);else if(Array.isArray(e)){for(var s={},o=e.length;o--;){var l=e[o],u=i.getAttribute(l);(u||"0"===u)&&(u=isNaN(u)?u:u-0),s[l]=u}return s}if("object"!==(void 0===e?"undefined":_typeof(e))){var c=i.getAttribute(e);return(c||"0"===c)&&(c=isNaN(c)?c:c-0),c}for(var h in e)i.setAttribute(h,e[h])}return this},e}function toAbsoluteURL(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}function importScript(e){return new Promise(function(t,n){var a=document.createElement("script"),r=function(){a.onerror=null,a.onload=null,a.remove(),a.src=""};a.defer="defer",a.onerror=function(){n(new Error("Failed to import: "+e)),r()},a.onload=function(){t(),r()},a.src=e,document.head.appendChild(a)})}function importModule(e){return new Promise(function(t,n){var a="$importModule$"+Math.random().toString(32).slice(2),r=document.createElement("script"),i=function(){delete window[a],r.onerror=null,r.onload=null,r.remove(),URL.revokeObjectURL(r.src),r.src=""};r.defer="defer",r.type="module",r.onerror=function(){n(new Error("Failed to import: "+e)),i()},r.onload=function(){t(window[a]),i()};var s=toAbsoluteURL(e),o=new Blob(['import * as m from "'+s+'"; window.'+a+" = m;"],{type:"text/javascript"});r.src=URL.createObjectURL(o),document.head.appendChild(r)})}var svgroot=document.createElementNS(NS.SVG,"svg");function transformToString(e){var t=e.matrix,n="";switch(e.type){case 1:n="matrix("+[t.a,t.b,t.c,t.d,t.e,t.f].join(",")+")";break;case 2:n="translate("+t.e+","+t.f+")";break;case 3:n=t.a===t.d?"scale("+t.a+")":"scale("+t.a+","+t.d+")";break;case 4:var a=0,r=0;if(0!==e.angle){var i=1-t.a;r=(i*t.f+t.b*t.e)/(i*i+t.b*t.b),a=(t.e-t.b*r)/i}n="rotate("+e.angle+" "+a+","+r+")"}return n}var listMap_={},SVGTransformList=function e(t){classCallCheck(this,e),this._elem=t||null,this._xforms=[],this._update=function(){var e="";svgroot.createSVGMatrix();for(var t=0;t<this.numberOfItems;++t){e+=transformToString(this._list.getItem(t))+" "}this._elem.setAttribute("transform",e)},this._list=this,this._init=function(){var e=this,t=this._elem.getAttribute("transform");if(t)for(var n=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,a=!0;a;)a=t.match(n),t=t.replace(n,""),a&&a[1]&&function(){var t=a[1].split(/\s*\(/),n=t[0],r=t[1].match(/\s*(.*?)\s*\)/);r[1]=r[1].replace(/(\d)-/g,"$1 -");var i=r[1].split(/[, ]+/),s="abcdef".split(""),o=svgroot.createSVGMatrix();Object.values(i).forEach(function(e,t){i[t]=parseFloat(e),"matrix"===n&&(o[s[t]]=i[t])});var l=svgroot.createSVGTransform(),u="set"+n.charAt(0).toUpperCase()+n.slice(1),c="matrix"===n?[o]:i;"scale"===n&&1===c.length?c.push(c[0]):"translate"===n&&1===c.length?c.push(0):"rotate"===n&&1===c.length&&c.push(0,0),l[u].apply(l,c),e._list.appendItem(l)}()},this._removeFromOtherLists=function(e){if(e){var t=!1;for(var n in listMap_){for(var a=listMap_[n],r=0,i=a._xforms.length;r<i;++r)if(a._xforms[r]===e){t=!0,a.removeItem(r);break}if(t)break}}},this.numberOfItems=0,this.clear=function(){this.numberOfItems=0,this._xforms=[]},this.initialize=function(e){this.numberOfItems=1,this._removeFromOtherLists(e),this._xforms=[e]},this.getItem=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},this.insertItemBefore=function(e,t){var n=null;if(t>=0)if(t<this.numberOfItems){this._removeFromOtherLists(e);var a=new Array(this.numberOfItems+1),r=void 0;for(r=0;r<t;++r)a[r]=this._xforms[r];a[r]=e;for(var i=r+1;r<this.numberOfItems;++i,++r)a[i]=this._xforms[r];this.numberOfItems++,this._xforms=a,n=e,this._list._update()}else n=this._list.appendItem(e);return n},this.replaceItem=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},this.removeItem=function(e){if(e<this.numberOfItems&&e>=0){var t=this._xforms[e],n=new Array(this.numberOfItems-1),a=void 0;for(a=0;a<e;++a)n[a]=this._xforms[a];for(var r=a;r<this.numberOfItems-1;++r,++a)n[r]=this._xforms[a+1];return this.numberOfItems--,this._xforms=n,this._list._update(),t}var i=new Error("DOMException with code=INDEX_SIZE_ERR");throw i.code=1,i},this.appendItem=function(e){return this._removeFromOtherLists(e),this._xforms.push(e),this.numberOfItems++,this._list._update(),e}},resetListMap=function(){listMap_={}},removeElementFromListMap=function(e){e.id&&listMap_[e.id]&&delete listMap_[e.id]},getTransformList=function(e){if(!supportsNativeTransformLists()){var t=e.id||"temp",n=listMap_[t];return n&&"temp"!==t||(listMap_[t]=new SVGTransformList(e),listMap_[t]._init(),n=listMap_[t]),n}return e.transform?e.transform.baseVal:e.gradientTransform?e.gradientTransform.baseVal:e.patternTransform?e.patternTransform.baseVal:null},wAttrs=["x","x1","cx","rx","width"],hAttrs=["y","y1","cy","ry","height"],unitAttrs=["r","radius"].concat(wAttrs,hAttrs),elementContainer_=void 0,typeMap_={},init=function(e){elementContainer_=e;var t=document.createElementNS(NS.SVG,"svg");document.body.appendChild(t);var n=document.createElementNS(NS.SVG,"rect");n.setAttribute("width","1em"),n.setAttribute("height","1ex"),n.setAttribute("x","1in"),t.appendChild(n);var a=n.getBBox();document.body.removeChild(t);var r=a.x;typeMap_={em:a.width,ex:a.height,in:r,cm:r/2.54,mm:r/25.4,pt:r/72,pc:r/6,px:1,"%":0}},getTypeMap=function(){return typeMap_},shortFloat=function e(t){var n=elementContainer_.getRoundDigits();return isNaN(t)?Array.isArray(t)?e(t[0])+","+e(t[1]):parseFloat(t).toFixed(n)-0:+(+t).toFixed(n)},convertUnit=function(e,t){return t=t||elementContainer_.getBaseUnit(),shortFloat(e/typeMap_[t])},setUnitAttr=function(e,t,n){e.setAttribute(t,n)},convertToNum=function(e,t){if(!isNaN(t))return t-0;if("%"===t.substr(-1)){var n=t.substr(0,t.length-1)/100,a=elementContainer_.getWidth(),r=elementContainer_.getHeight();return wAttrs.includes(e)?n*a:hAttrs.includes(e)?n*r:n*Math.sqrt(a*a+r*r)/Math.sqrt(2)}var i=t.substr(-2);return t.substr(0,t.length-2)*typeMap_[i]},isValidUnit=function(e,t,n){var a=!1;if(unitAttrs.includes(e))isNaN(t)?(t=t.toLowerCase(),Object.keys(typeMap_).forEach(function(e){a||new RegExp("^-?[\\d\\.]+"+e+"$").test(t)&&(a=!0)})):a=!0;else if("id"===e){var r=!1;try{var i=elementContainer_.getElement(t);r=null==i||i===n}catch(e){}return r}return a=!0},HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"},MoveElementCommand=function(){function e(t,n,a,r){classCallCheck(this,e),this.elem=t,this.text=r?"Move "+t.tagName+" to "+r:"Move "+t.tagName,this.oldNextSibling=n,this.oldParent=a,this.newNextSibling=t.nextSibling,this.newParent=t.parentNode}return createClass(e,[{key:"getText",value:function(){return this.text}},{key:"type",value:function(){return"svgedit.history.MoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this),this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this),this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),e}();MoveElementCommand.type=MoveElementCommand.prototype.type;var InsertElementCommand=function(){function e(t,n){classCallCheck(this,e),this.elem=t,this.text=n||"Create "+t.tagName,this.parent=t.parentNode,this.nextSibling=this.elem.nextSibling}return createClass(e,[{key:"type",value:function(){return"svgedit.history.InsertElementCommand"}},{key:"getText",value:function(){return this.text}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this),this.elem=this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this),this.parent=this.elem.parentNode,this.elem=this.elem.parentNode.removeChild(this.elem),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),e}();InsertElementCommand.type=InsertElementCommand.prototype.type;var RemoveElementCommand=function(){function e(t,n,a,r){classCallCheck(this,e),this.elem=t,this.text=r||"Delete "+t.tagName,this.nextSibling=n,this.parent=a,removeElementFromListMap(t)}return createClass(e,[{key:"type",value:function(){return"svgedit.history.RemoveElementCommand"}},{key:"getText",value:function(){return this.text}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this),removeElementFromListMap(this.elem),this.parent=this.elem.parentNode,this.elem=this.parent.removeChild(this.elem),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this),removeElementFromListMap(this.elem),null==this.nextSibling&&window.console&&console.log("Error: reference element was lost"),this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),e}();RemoveElementCommand.type=RemoveElementCommand.prototype.type;var ChangeElementCommand=function(){function e(t,n,a){for(var r in classCallCheck(this,e),this.elem=t,this.text=a?"Change "+t.tagName+" "+a:"Change "+t.tagName,this.newValues={},this.oldValues=n,n)this.newValues[r]="#text"===r?t.textContent:"#href"===r?getHref(t):t.getAttribute(r)}return createClass(e,[{key:"type",value:function(){return"svgedit.history.ChangeElementCommand"}},{key:"getText",value:function(){return this.text}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this);var t=!1;for(var n in this.newValues)this.newValues[n]?"#text"===n?this.elem.textContent=this.newValues[n]:"#href"===n?setHref(this.elem,this.newValues[n]):this.elem.setAttribute(n,this.newValues[n]):"#text"===n?this.elem.textContent="":(this.elem.setAttribute(n,""),this.elem.removeAttribute(n)),"transform"===n&&(t=!0);if(!t){var a=getRotationAngle(this.elem);if(a){var r=this.elem.getBBox(),i=["rotate(",a," ",r.x+r.width/2,",",r.y+r.height/2,")"].join("");i!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",i)}}return e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this),!0}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this);var t=!1;for(var n in this.oldValues)this.oldValues[n]?"#text"===n?this.elem.textContent=this.oldValues[n]:"#href"===n?setHref(this.elem,this.oldValues[n]):this.elem.setAttribute(n,this.oldValues[n]):"#text"===n?this.elem.textContent="":this.elem.removeAttribute(n),"transform"===n&&(t=!0);if(!t){var a=getRotationAngle(this.elem);if(a){var r=this.elem.getBBox(),i=["rotate(",a," ",r.x+r.width/2,",",r.y+r.height/2,")"].join("");i!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",i)}}return removeElementFromListMap(this.elem),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this),!0}},{key:"elements",value:function(){return[this.elem]}}]),e}();ChangeElementCommand.type=ChangeElementCommand.prototype.type;var BatchCommand=function(){function e(t){classCallCheck(this,e),this.text=t||"Batch Command",this.stack=[]}return createClass(e,[{key:"type",value:function(){return"svgedit.history.BatchCommand"}},{key:"getText",value:function(){return this.text}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this);for(var t=this.stack.length,n=0;n<t;++n)this.stack[n].apply(e);e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this);for(var t=this.stack.length-1;t>=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){for(var e=[],t=this.stack.length;t--;)for(var n=this.stack[t].elements(),a=n.length;a--;)e.includes(n[a])||e.push(n[a]);return e}},{key:"addSubCommand",value:function(e){this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),e}();BatchCommand.type=BatchCommand.prototype.type;var UndoManager=function(){function e(t){classCallCheck(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return createClass(e,[{key:"resetUndoStack",value:function(){this.undoStack=[],this.undoStackPointer=0}},{key:"getUndoStackSize",value:function(){return this.undoStackPointer}},{key:"getRedoStackSize",value:function(){return this.undoStack.length-this.undoStackPointer}},{key:"getNextUndoCommandText",value:function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():""}},{key:"getNextRedoCommandText",value:function(){return this.undoStackPointer<this.undoStack.length?this.undoStack[this.undoStackPointer].getText():""}},{key:"undo",value:function(){this.undoStackPointer>0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}},{key:"redo",value:function(){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}},{key:"addCommandToHistory",value:function(e){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&(this.undoStack=this.undoStack.splice(0,this.undoStackPointer)),this.undoStack.push(e),this.undoStackPointer=this.undoStack.length}},{key:"beginUndoableChange",value:function(e,t){for(var n=++this.undoChangeStackPointer,a=t.length,r=new Array(a),i=new Array(a);a--;){var s=t[a];null!=s&&(i[a]=s,r[a]=s.getAttribute(e))}this.undoableChangeStack[n]={attrName:e,oldValues:r,elements:i}}},{key:"finishUndoableChange",value:function(){for(var e=this.undoChangeStackPointer--,t=this.undoableChangeStack[e],n=t.attrName,a=new BatchCommand("Change "+n),r=t.elements.length;r--;){var i=t.elements[r];if(null!=i){var s={};s[n]=t.oldValues[r],s[n]!==i.getAttribute(n)&&a.addSubCommand(new ChangeElementCommand(i,s,n))}}return this.undoableChangeStack[e]=null,a}}]),e}(),history=Object.freeze({HistoryEventTypes:HistoryEventTypes,MoveElementCommand:MoveElementCommand,InsertElementCommand:InsertElementCommand,RemoveElementCommand:RemoveElementCommand,ChangeElementCommand:ChangeElementCommand,BatchCommand:BatchCommand,UndoManager:UndoManager}),NEAR_ZERO=1e-14,svg$1=document.createElementNS(NS.SVG,"svg"),transformPoint=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},isIdentity=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},matrixMultiply=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=t.reduceRight(function(e,t){return t.multiply(e)});return Math.abs(a.a)<NEAR_ZERO&&(a.a=0),Math.abs(a.b)<NEAR_ZERO&&(a.b=0),Math.abs(a.c)<NEAR_ZERO&&(a.c=0),Math.abs(a.d)<NEAR_ZERO&&(a.d=0),Math.abs(a.e)<NEAR_ZERO&&(a.e=0),Math.abs(a.f)<NEAR_ZERO&&(a.f=0),a},hasMatrixTransform=function(e){if(!e)return!1;for(var t=e.numberOfItems;t--;){var n=e.getItem(t);if(1===n.type&&!isIdentity(n.matrix))return!0}return!1},transformBox=function(e,t,n,a,r){var i=transformPoint(e,t,r),s=transformPoint(e+n,t,r),o=transformPoint(e,t+a,r),l=transformPoint(e+n,t+a,r),u=Math.min(i.x,s.x,o.x,l.x),c=Math.max(i.x,s.x,o.x,l.x),h=Math.min(i.y,s.y,o.y,l.y);return{tl:i,tr:s,bl:o,br:l,aabox:{x:u,y:h,width:c-u,height:Math.max(i.y,s.y,o.y,l.y)-h}}},transformListToTransform=function(e,t,n){if(null==e)return svg$1.createSVGTransformFromMatrix(svg$1.createSVGMatrix());if(t=t||0,n=n||e.numberOfItems-1,(t=parseInt(t,10))>(n=parseInt(n,10))){var a=n;n=t,t=a}for(var r=svg$1.createSVGMatrix(),i=t;i<=n;++i){var s=i>=0&&i<e.numberOfItems?e.getItem(i).matrix:svg$1.createSVGMatrix();r=matrixMultiply(r,s)}return svg$1.createSVGTransformFromMatrix(r)},getMatrix=function(e){var t=getTransformList(e);return transformListToTransform(t).matrix},snapToAngle=function(e,t,n,a){var r=Math.PI/4,i=n-e,s=a-t,o=Math.atan2(s,i),l=Math.sqrt(i*i+s*s),u=Math.round(o/r)*r;return{x:e+l*Math.cos(u),y:t+l*Math.sin(u),a:u}},rectsIntersect=function(e,t){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y},$$1=jQuery,segData={2:["x","y"],4:["x","y"],6:["x","y","x1","y1","x2","y2"],8:["x","y","x1","y1"],10:["x","y","r1","r2","angle","largeArcFlag","sweepFlag"],12:["x"],14:["y"],16:["x","y","x2","y2"],18:["x","y"]},uiStrings={},setUiStrings=function(e){Object.assign(uiStrings,e.ui)},pathFuncs=[],linkControlPts=!0,pathData={},setLinkControlPoints=function(e){linkControlPts=e},path=null,editorContext_=null,init$1=function(e){editorContext_=e,pathFuncs=[0,"ClosePath"];$$1.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(e,t){pathFuncs.push(t+"Abs"),pathFuncs.push(t+"Rel")})},insertItemBefore=function(e,t,n){var a=e.pathSegList;if(supportsPathInsertItemBefore())a.insertItemBefore(t,n);else{for(var r=a.numberOfItems,i=[],s=0;s<r;s++){var o=a.getItem(s);i.push(o)}a.clear();for(var l=0;l<r;l++)l===n&&a.appendItem(t),a.appendItem(i[l])}},ptObjToArr=function(e,t){for(var n=segData[e],a=n.length,r=[],i=0;i<a;i++)r[i]=t[n[i]];return r},getGripPt=function(e,t){var n=e.path,a={x:t?t.x:e.item.x,y:t?t.y:e.item.y};n.matrix&&(a=transformPoint(a.x,a.y,n.matrix));var r=editorContext_.getCurrentZoom();return a.x*=r,a.y*=r,a},getPointFromGrip=function(e,t){var n={x:e.x,y:e.y};t.matrix&&(e=transformPoint(n.x,n.y,t.imatrix),n.x=e.x,n.y=e.y);var a=editorContext_.getCurrentZoom();return n.x/=a,n.y/=a,n},addPointGrip=function(e,t,n){var a=getGripContainer(),r=getElem("pathpointgrip_"+e);if(!r){r=document.createElementNS(NS.SVG,"circle");var i={id:"pathpointgrip_"+e,display:"none",r:4,fill:"#0FF",stroke:"#00F","stroke-width":2,cursor:"move",style:"pointer-events:all"};"pathNodeTooltip"in uiStrings&&(i["xlink:title"]=uiStrings.pathNodeTooltip),assignAttributes(r,i),r=a.appendChild(r),$$1("#pathpointgrip_"+e).dblclick(function(){path&&path.setSegType()})}return t&&n&&assignAttributes(r,{cx:t,cy:n,display:"inline"}),r},getGripContainer=function(){var e=getElem("pathpointgrip_container");e||((e=getElem("selectorParentGroup").appendChild(document.createElementNS(NS.SVG,"g"))).id="pathpointgrip_container");return e},addCtrlGrip=function(e){var t=getElem("ctrlpointgrip_"+e);if(t)return t;t=document.createElementNS(NS.SVG,"circle");var n={id:"ctrlpointgrip_"+e,display:"none",r:4,fill:"#0FF",stroke:"#55F","stroke-width":1,cursor:"move",style:"pointer-events:all"};return"pathCtrlPtTooltip"in uiStrings&&(n["xlink:title"]=uiStrings.pathCtrlPtTooltip),assignAttributes(t,n),getGripContainer().appendChild(t),t},getCtrlLine=function(e){var t=getElem("ctrlLine_"+e);return t||(t=document.createElementNS(NS.SVG,"line"),assignAttributes(t,{id:"ctrlLine_"+e,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),getGripContainer().appendChild(t),t)},getPointGrip=function(e,t){var n=e.index,a=addPointGrip(n);if(t){var r=getGripPt(e);assignAttributes(a,{cx:r.x,cy:r.y,display:"inline"})}return a},getControlPoints=function(e){var t=e.item,n=e.index;if(!("x1"in t&&"x2"in t))return null;var a={};getGripContainer();for(var r=[path.segs[n-1].item,t],i=1;i<3;i++){var s=n+"c"+i,o=a["c"+i+"_line"]=getCtrlLine(s),l=getGripPt(e,{x:t["x"+i],y:t["y"+i]}),u=getGripPt(e,{x:r[i-1].x,y:r[i-1].y});assignAttributes(o,{x1:l.x,y1:l.y,x2:u.x,y2:u.y,display:"inline"}),a["c"+i+"_line"]=o;var c=a["c"+i]=addCtrlGrip(s);assignAttributes(c,{cx:l.x,cy:l.y,display:"inline"}),a["c"+i]=c}return a},replacePathSeg=function(e,t,n,a){var r=a||path.elem,i=r["createSVGPathSeg"+pathFuncs[e]].apply(r,n);if(supportsPathReplaceItem())r.pathSegList.replaceItem(i,t);else{for(var s=r.pathSegList,o=s.numberOfItems,l=[],u=0;u<o;u++){var c=s.getItem(u);l.push(c)}s.clear();for(var h=0;h<o;h++)h===t?s.appendItem(i):s.appendItem(l[h])}},getSegSelector=function(e,t){var n=e.index,a=getElem("segline_"+n);if(!a){var r=getGripContainer();a=document.createElementNS(NS.SVG,"path"),assignAttributes(a,{id:"segline_"+n,display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"}),r.appendChild(a)}if(t){var i=e.prev;if(!i)return a.setAttribute("display","none"),a;var s=getGripPt(i);replacePathSeg(2,0,[s.x,s.y],a);for(var o=ptObjToArr(e.type,e.item,!0),l=0;l<o.length;l+=2){var u=getGripPt(e,{x:o[l],y:o[l+1]});o[l]=u.x,o[l+1]=u.y}replacePathSeg(e.type,1,o,a)}return a},smoothControlPoints=function(e,t,n){var a=e.x-n.x,r=e.y-n.y,i=t.x-n.x,s=t.y-n.y;if(!(0===a&&0===r||0===i&&0===s)){var o=Math.sqrt(a*a+r*r),l=Math.sqrt(i*i+s*s),u=editorContext_.getSVGRoot().createSVGPoint(),c=editorContext_.getSVGRoot().createSVGPoint(),h=Math.atan2(r,a),d=Math.atan2(s,i);h<0&&(h+=2*Math.PI),d<0&&(d+=2*Math.PI);var f=Math.abs(h-d),p=Math.abs(Math.PI-f)/2,g=void 0,v=void 0;return h-d>0?(g=f<Math.PI?h+p:h-p,v=f<Math.PI?d-p:d+p):(g=f<Math.PI?h-p:h+p,v=f<Math.PI?d+p:d-p),u.x=o*Math.cos(g)+n.x,u.y=o*Math.sin(g)+n.y,c.x=l*Math.cos(v)+n.x,c.y=l*Math.sin(v)+n.y,[u,c]}},Segment=function(){function e(t,n){classCallCheck(this,e),this.selected=!1,this.index=t,this.item=n,this.type=n.pathSegType,this.ctrlpts=[],this.ptgrip=null,this.segsel=null}return createClass(e,[{key:"showCtrlPts",value:function(e){for(var t in this.ctrlpts)this.ctrlpts.hasOwnProperty(t)&&this.ctrlpts[t].setAttribute("display",e?"inline":"none")}},{key:"selectCtrls",value:function(e){$$1("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill",e?"#0FF":"#EEE")}},{key:"show",value:function(e){this.ptgrip&&(this.ptgrip.setAttribute("display",e?"inline":"none"),this.segsel.setAttribute("display",e?"inline":"none"),this.showCtrlPts(e))}},{key:"select",value:function(e){this.ptgrip&&(this.ptgrip.setAttribute("stroke",e?"#0FF":"#00F"),this.segsel.setAttribute("display",e?"inline":"none"),this.ctrlpts&&this.selectCtrls(e),this.selected=e)}},{key:"addGrip",value:function(){this.ptgrip=getPointGrip(this,!0),this.ctrlpts=getControlPoints(this,!0),this.segsel=getSegSelector(this,!0)}},{key:"update",value:function(e){if(this.ptgrip){var t=getGripPt(this);assignAttributes(this.ptgrip,{cx:t.x,cy:t.y}),getSegSelector(this,!0),this.ctrlpts&&(e&&(this.item=path.elem.pathSegList.getItem(this.index),this.type=this.item.pathSegType),getControlPoints(this))}}},{key:"move",value:function(e,t){var n=this.item,a=this.ctrlpts?[n.x+=e,n.y+=t,n.x1,n.y1,n.x2+=e,n.y2+=t]:[n.x+=e,n.y+=t];if(replacePathSeg(this.type,this.index,a),this.next&&this.next.ctrlpts){var r=this.next.item,i=[r.x,r.y,r.x1+=e,r.y1+=t,r.x2,r.y2];replacePathSeg(this.next.type,this.next.index,i)}if(this.mate){var s=this.mate.item,o=[s.x+=e,s.y+=t];replacePathSeg(this.mate.type,this.mate.index,o)}this.update(!0),this.next&&this.next.update(!0)}},{key:"setLinked",value:function(e){var t=void 0,n=void 0,a=void 0;if(2===e){if(n=1,!(t=this.next))return;a=this.item}else{if(n=2,!(t=this.prev))return;a=t.item}var r=t.item;r["x"+n]=a.x+(a.x-this.item["x"+e]),r["y"+n]=a.y+(a.y-this.item["y"+e]);var i=[r.x,r.y,r.x1,r.y1,r.x2,r.y2];replacePathSeg(t.type,t.index,i),t.update(!0)}},{key:"moveCtrl",value:function(e,t,n){var a=this.item;a["x"+e]+=t,a["y"+e]+=n;var r=[a.x,a.y,a.x1,a.y1,a.x2,a.y2];replacePathSeg(this.type,this.index,r),this.update(!0)}},{key:"setType",value:function(e,t){replacePathSeg(e,this.index,t),this.type=e,this.item=path.elem.pathSegList.getItem(this.index),this.showCtrlPts(6===e),this.ctrlpts=getControlPoints(this),this.update(!0)}}]),e}(),Path=function(){function e(t){if(classCallCheck(this,e),!t||"path"!==t.tagName)throw new Error("svgedit.path.Path constructed without a <path> element");this.elem=t,this.segs=[],this.selected_pts=[],path=this,this.init()}return createClass(e,[{key:"init",value:function(){$$1(getGripContainer()).find("*").each(function(){$$1(this).attr("display","none")});var e=this.elem.pathSegList,t=e.numberOfItems;this.segs=[],this.selected_pts=[],this.first_seg=null;for(var n=0;n<t;n++){var a=e.getItem(n),r=new Segment(n,a);r.path=this,this.segs.push(r)}for(var i=this.segs,s=null,o=0;o<t;o++){var l=i[o],u=o+1>=t?null:i[o+1],c=o-1<0?null:i[o-1];if(2===l.type){if(c&&1!==c.type){var h=i[s];h.next=i[s+1],h.next.prev=h,h.addGrip()}s=o}else if(u&&1===u.type)l.next=i[s+1],l.next.prev=l,l.mate=i[s],l.addGrip(),null==this.first_seg&&(this.first_seg=l);else if(u)1!==l.type&&(l.addGrip(),u&&2!==u.type&&(l.next=u,l.next.prev=l));else if(1!==l.type){var d=i[s];d.next=i[s+1],d.next.prev=d,d.addGrip(),l.addGrip(),this.first_seg||(this.first_seg=i[s])}}return this}},{key:"eachSeg",value:function(e){for(var t=this.segs.length,n=0;n<t;n++){if(!1===e.call(this.segs[n],n))break}}},{key:"addSeg",value:function(e){var t=this.segs[e];if(t.prev){var n=t.prev,a=void 0,r=void 0,i=void 0;switch(t.item.pathSegType){case 4:r=(t.item.x+n.item.x)/2,i=(t.item.y+n.item.y)/2,a=this.elem.createSVGPathSegLinetoAbs(r,i);break;case 6:var s=(n.item.x+t.item.x1)/2,o=(t.item.x1+t.item.x2)/2,l=(t.item.x2+t.item.x)/2,u=(s+o)/2,c=(o+l)/2;r=(u+c)/2;var h=(n.item.y+t.item.y1)/2,d=(t.item.y1+t.item.y2)/2,f=(t.item.y2+t.item.y)/2,p=(h+d)/2,g=(d+f)/2;i=(p+g)/2,a=this.elem.createSVGPathSegCurvetoCubicAbs(r,i,s,h,u,p);var v=[t.item.x,t.item.y,c,g,l,f];replacePathSeg(t.type,e,v)}insertItemBefore(this.elem,a,e)}}},{key:"deleteSeg",value:function(e){var t=this.segs[e],n=this.elem.pathSegList;t.show(!1);var a=t.next;if(t.mate){var r=[a.item.x,a.item.y];replacePathSeg(2,a.index,r),replacePathSeg(4,t.index,r),n.removeItem(t.mate.index)}else if(t.prev)n.removeItem(e);else{var i=[a.item.x,a.item.y];replacePathSeg(2,t.next.index,i),n.removeItem(e)}}},{key:"subpathIsClosed",value:function(e){var t=!1;return path.eachSeg(function(n){return n<=e||2!==this.type&&(1===this.type?(t=!0,!1):void 0)}),t}},{key:"removePtFromSelection",value:function(e){var t=this.selected_pts.indexOf(e);-1!==t&&(this.segs[e].select(!1),this.selected_pts.splice(t,1))}},{key:"clearSelection",value:function(){this.eachSeg(function(){this.select(!1)}),this.selected_pts=[]}},{key:"storeD",value:function(){this.last_d=this.elem.getAttribute("d")}},{key:"show",value:function(e){return this.eachSeg(function(){this.show(e)}),e&&this.selectPt(this.first_seg.index),this}},{key:"movePts",value:function(e,t){for(var n=this.selected_pts.length;n--;){this.segs[this.selected_pts[n]].move(e,t)}}},{key:"moveCtrl",value:function(e,t){var n=this.segs[this.selected_pts[0]];n.moveCtrl(this.dragctrl,e,t),linkControlPts&&n.setLinked(this.dragctrl)}},{key:"setSegType",value:function(e){this.storeD();for(var t=this.selected_pts.length,n=void 0;t--;){var a=this.selected_pts[t],r=this.segs[a],i=r.prev;if(i){if(!e)n="Toggle Path Segment Type",e=6===r.type?4:6;e=Number(e);var s=r.item.x,o=r.item.y,l=i.item.x,u=i.item.y,c=void 0;switch(e){case 6:if(r.olditem){var h=r.olditem;c=[s,o,h.x1,h.y1,h.x2,h.y2]}else{var d=s-l,f=o-u;c=[s,o,l+d/3,u+f/3,s-d/3,o-f/3]}break;case 4:c=[s,o],r.olditem=r.item}r.setType(e,c)}}path.endChanges(n)}},{key:"selectPt",value:function(e,t){this.clearSelection(),null==e&&this.eachSeg(function(t){this.prev&&(e=t)}),this.addPtsToSelection(e),t&&(this.dragctrl=t,linkControlPts&&this.segs[e].setLinked(t))}},{key:"update",value:function(){var e=this.elem;return getRotationAngle(e)?(this.matrix=getMatrix(e),this.imatrix=this.matrix.inverse()):(this.matrix=null,this.imatrix=null),this.eachSeg(function(t){this.item=e.pathSegList.getItem(t),this.update()}),this}},{key:"endChanges",value:function(e){isWebkit()&&editorContext_.resetD(this.elem);var t=new ChangeElementCommand(this.elem,{d:this.last_d},e);editorContext_.endChanges({cmd:t,elem:this.elem})}},{key:"addPtsToSelection",value:function(e){Array.isArray(e)||(e=[e]);for(var t=0;t<e.length;t++){var n=e[t];this.segs[n].ptgrip&&!this.selected_pts.includes(n)&&n>=0&&this.selected_pts.push(n)}this.selected_pts.sort();var a=this.selected_pts.length,r=[];for(r.length=a;a--;){var i=this.selected_pts[a],s=this.segs[i];s.select(!0),r[a]=s.ptgrip}var o=this.subpathIsClosed(this.selected_pts[0]);editorContext_.addPtsToSelection({grips:r,closedSubpath:o})}}]),e}(),getPath_=function(e){var t=pathData[e.id];return t||(t=pathData[e.id]=new Path(e)),t},removePath_=function(e){e in pathData&&delete pathData[e]},newcx=void 0,newcy=void 0,oldcx=void 0,oldcy=void 0,angle=void 0,getRotVals=function(e,t){var n=e-oldcx,a=t-oldcy,r=Math.sqrt(n*n+a*a),i=Math.atan2(a,n)+angle;return n=r*Math.cos(i)+oldcx,a=r*Math.sin(i)+oldcy,n-=newcx,a-=newcy,r=Math.sqrt(n*n+a*a),i=Math.atan2(a,n)-angle,{x:r*Math.cos(i)+newcx,y:r*Math.sin(i)+newcy}},recalcRotatedPath=function(){var e=path.elem;if(angle=getRotationAngle(e,!0)){var t=path.oldbbox;oldcx=t.x+t.width/2,oldcy=t.y+t.height/2;var n=getBBox(e);newcx=n.x+n.width/2,newcy=n.y+n.height/2;var a=newcx-oldcx,r=newcy-oldcy,i=Math.sqrt(a*a+r*r),s=Math.atan2(r,a)+angle;newcx=i*Math.cos(s)+oldcx,newcy=i*Math.sin(s)+oldcy;for(var o=e.pathSegList,l=o.numberOfItems;l;){l-=1;var u=o.getItem(l),c=u.pathSegType;if(1!==c){var h=getRotVals(u.x,u.y),d=[h.x,h.y];if(null!=u.x1&&null!=u.x2){var f=getRotVals(u.x1,u.y1),p=getRotVals(u.x2,u.y2);d.splice(d.length,0,f.x,f.y,p.x,p.y)}replacePathSeg(c,l,d)}}n=getBBox(e);var g=editorContext_.getSVGRoot().createSVGTransform(),v=getTransformList(e);g.setRotate(180*angle/Math.PI,newcx,newcy),v.replaceItem(g,0)}},clearData=function(){pathData={}},reorientGrads=function(e,t){for(var n=getBBox(e),a=0;a<2;a++){var r=0===a?"fill":"stroke",i=e.getAttribute(r);if(i&&i.startsWith("url(")){var s=getRefElem(i);if("linearGradient"===s.tagName){var o=s.getAttribute("x1")||0,l=s.getAttribute("y1")||0,u=s.getAttribute("x2")||1,c=s.getAttribute("y2")||0;o=n.width*o+n.x,l=n.height*l+n.y,u=n.width*u+n.x,c=n.height*c+n.y;var h=transformPoint(o,l,t),d=transformPoint(u,c,t),f={};f.x1=(h.x-n.x)/n.width,f.y1=(h.y-n.y)/n.height,f.x2=(d.x-n.x)/n.width,f.y2=(d.y-n.y)/n.height;var p=s.cloneNode(!0);$$1(p).attr(f),p.id=editorContext_.getNextId(),findDefs().appendChild(p),e.setAttribute(r,"url(#"+p.id+")")}}}},pathMap=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],convertPath=function(e,t){for(var n=e.pathSegList,a=n.numberOfItems,r=0,i=0,s="",o=null,l=0;l<a;++l){var u=n.getItem(l),c=u.x||0,h=u.y||0,d=u.x1||0,f=u.y1||0,p=u.x2||0,g=u.y2||0,v=u.pathSegType,m=pathMap[v]["to"+(t?"Lower":"Upper")+"Case"]();switch(v){case 1:s+="z",o&&!t&&(r=o[0],i=o[1]);break;case 12:c-=r;case 13:t?(r+=c,m="l"):(r=c+=r,m="L"),s+=pathDSegment(m,[[c,i]]);break;case 14:h-=i;case 15:t?(i+=h,m="l"):(i=h+=i,m="L"),s+=pathDSegment(m,[[r,h]]);break;case 2:case 4:case 18:c-=r,h-=i;case 5:case 3:case 19:t?(r+=c,i+=h):(r=c+=r,i=h+=i),2!==v&&3!==v||(o=[r,i]),s+=pathDSegment(m,[[c,h]]);break;case 6:c-=r,d-=r,p-=r,h-=i,f-=i,g-=i;case 7:t?(r+=c,i+=h):(d+=r,p+=r,f+=i,g+=i,r=c+=r,i=h+=i),s+=pathDSegment(m,[[d,f],[p,g],[c,h]]);break;case 8:c-=r,d-=r,h-=i,f-=i;case 9:t?(r+=c,i+=h):(d+=r,f+=i,r=c+=r,i=h+=i),s+=pathDSegment(m,[[d,f],[c,h]]);break;case 10:c-=r,h-=i;case 11:t?(r+=c,i+=h):(r=c+=r,i=h+=i),s+=pathDSegment(m,[[u.r1,u.r2]],[u.angle,u.largeArcFlag?1:0,u.sweepFlag?1:0],[c,h]);break;case 16:c-=r,p-=r,h-=i,g-=i;case 17:t?(r+=c,i+=h):(p+=r,g+=i,r=c+=r,i=h+=i),s+=pathDSegment(m,[[p,g],[c,h]])}}return s};function pathDSegment(e,t,n,a){$$1.each(t,function(e,n){t[e]=shortFloat(n)});var r=e+t.join(" ");return n&&(r+=" "+n.join(" ")),a&&(r+=" "+shortFloat(a)),r}var pathActions=function(){var e=!1,t=void 0,n=void 0,a=null,r=!1;return{mouseDown:function(n,a,r,i){var s=void 0;if("path"!==editorContext_.getCurrentMode()){if(path){path.storeD();var o=void 0;if("pathpointgrip_"===(s=n.target.id).substr(0,14)){o=path.cur_pt=parseInt(s.substr(14),10),path.dragging=[r,i];var l=path.segs[o];n.shiftKey?l.selected?path.removePtFromSelection(o):path.addPtsToSelection(o):((path.selected_pts.length<=1||!l.selected)&&path.clearSelection(),path.addPtsToSelection(o))}else if(s.startsWith("ctrlpointgrip_")){path.dragging=[r,i];var u=s.split("_")[1].split("c");o=Number(u[0]);var c=Number(u[1]);path.selectPt(o,c)}if(!path.dragging){var h=editorContext_.getRubberBox();null==h&&(h=editorContext_.setRubberBox(editorContext_.selectorManager.getRubberBandBox()));var d=editorContext_.getCurrentZoom();assignAttributes(h,{x:r*d,y:i*d,width:0,height:0,display:"inline"},100)}}}else{var f=r,p=i,g=editorContext_.getCurrentZoom(),v=f/g,m=p/g,y=getElem("path_stretch_line");t=[v,m],editorContext_.getGridSnapping()&&(v=snapToGrid(v),m=snapToGrid(m),f=snapToGrid(f),p=snapToGrid(p)),y||(y=document.createElementNS(NS.SVG,"path"),assignAttributes(y,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}),y=getElem("selectorParentGroup").appendChild(y)),y.setAttribute("display","inline");var b=void 0,_=editorContext_.getDrawnPath();if(_){for(var x=_.pathSegList,C=x.numberOfItems,S=6/g,w=!1;C;){C--;var k=x.getItem(C),$=k.x,P=k.y;if(v>=$-S&&v<=$+S&&m>=P-S&&m<=P+S){w=!0;break}}s=editorContext_.getId(),removePath_(s);var E=getElem(s),A=void 0,T=void 0,N=x.numberOfItems;if(w){if(C<=1&&N>=2){var G=x.getItem(0).x,L=x.getItem(0).y;A=4===(T=y.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(G,L):_.createSVGPathSegCurvetoCubicAbs(G,L,T.x1/g,T.y1/g,G,L);var I=_.createSVGPathSegClosePath();x.appendItem(A),x.appendItem(I)}else if(N<3)return!1;if($$1(y).remove(),_=editorContext_.setDrawnPath(null),editorContext_.setStarted(!1),e){path.matrix&&editorContext_.remapElement(E,{},path.matrix.inverse());var M=E.getAttribute("d"),B=$$1(path.elem).attr("d");return $$1(path.elem).attr("d",B+M),$$1(E).remove(),path.matrix&&recalcRotatedPath(),init$1(),pathActions.toEditMode(path.elem),path.selectPt(),!1}}else{if(!$$1.contains(editorContext_.getContainer(),editorContext_.getMouseTarget(n)))return console.log("Clicked outside canvas"),!1;var O=_.pathSegList.numberOfItems,V=_.pathSegList.getItem(O-1),R=V.x,j=V.y;if(n.shiftKey){var D=snapToAngle(R,j,v,m);v=D.x,m=D.y}A=4===(T=y.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(editorContext_.round(v),editorContext_.round(m)):_.createSVGPathSegCurvetoCubicAbs(editorContext_.round(v),editorContext_.round(m),T.x1/g,T.y1/g,T.x2/g,T.y2/g),_.pathSegList.appendItem(A),v*=g,m*=g,y.setAttribute("d",["M",v,m,v,m].join(" ")),b=O,e&&(b+=path.segs.length),addPointGrip(b,v,m)}}else{var F="M"+v+","+m+" ";_=editorContext_.setDrawnPath(editorContext_.addSvgElementFromJson({element:"path",curStyles:!0,attr:{d:F,id:editorContext_.getNextId(),opacity:editorContext_.getOpacity()/2}})),y.setAttribute("d",["M",f,p,f,p].join(" ")),b=e?path.segs.length:0,addPointGrip(b,f,p)}}},mouseMove:function(e,a){var i=editorContext_.getCurrentZoom();r=!0;var s=editorContext_.getDrawnPath();if("path"!==editorContext_.getCurrentMode())if(path.dragging){var o=getPointFromGrip({x:path.dragging[0],y:path.dragging[1]},path),l=getPointFromGrip({x:e,y:a},path),u=l.x-o.x,c=l.y-o.y;path.dragging=[e,a],path.dragctrl?path.moveCtrl(u,c):path.movePts(u,c)}else path.selected_pts=[],path.eachSeg(function(e){if(this.next||this.prev){var t=editorContext_.getRubberBox().getBBox(),n=getGripPt(this),a={x:n.x,y:n.y,width:0,height:0},r=rectsIntersect(t,a);this.select(r),r&&path.selected_pts.push(this.index)}});else{if(!s)return;var h=s.pathSegList,d=h.numberOfItems-1;if(t){var f=addCtrlGrip("1c1"),p=addCtrlGrip("0c2");f.setAttribute("cx",e),f.setAttribute("cy",a),f.setAttribute("display","inline");var g=t[0],v=t[1],m=g+(g-e/i),y=v+(v-a/i);p.setAttribute("cx",m*i),p.setAttribute("cy",y*i),p.setAttribute("display","inline");var b=getCtrlLine(1);if(assignAttributes(b,{x1:e,y1:a,x2:m*i,y2:y*i,display:"inline"}),0===d)n=[e,a];else{var _=h.getItem(d-1),x=_.x,C=_.y;6===_.pathSegType?(x+=x-_.x2,C+=C-_.y2):n&&(x=n[0]/i,C=n[1]/i),replacePathSeg(6,d,[g,v,x,C,m,y],s)}}else{var S=getElem("path_stretch_line");if(S){var w=h.getItem(d);if(6===w.pathSegType){var k=w.x+(w.x-w.x2),$=w.y+(w.y-w.y2);replacePathSeg(6,1,[e,a,k*i,$*i,e,a],S)}else n?replacePathSeg(6,1,[e,a,n[0],n[1],e,a],S):replacePathSeg(4,1,[e,a],S)}}}},mouseUp:function(e,a,i,s){var o=editorContext_.getDrawnPath();if("path"===editorContext_.getCurrentMode())return t=null,o||(a=getElem(editorContext_.getId()),editorContext_.setStarted(!1),n=null),{keep:!0,element:a};var l=editorContext_.getRubberBox();if(path.dragging){var u=path.cur_pt;path.dragging=!1,path.dragctrl=!1,path.update(),r&&path.endChanges("Move path point(s)"),e.shiftKey||r||path.selectPt(u)}else l&&"none"!==l.getAttribute("display")?(l.setAttribute("display","none"),l.getAttribute("width")<=2&&l.getAttribute("height")<=2&&pathActions.toSelectMode(e.target)):pathActions.toSelectMode(e.target);r=!1},toEditMode:function(t){path=getPath_(t),editorContext_.setCurrentMode("pathedit"),editorContext_.clearSelection(),path.show(!0).update(),path.oldbbox=getBBox(path.elem),e=!1},toSelectMode:function(e){var t=e===path.elem;editorContext_.setCurrentMode("select"),path.show(!1),a=!1,editorContext_.clearSelection(),path.matrix&&recalcRotatedPath(),t&&(editorContext_.call("selected",[e]),editorContext_.addToSelection([e],!0))},addSubPath:function(t){t?(editorContext_.setCurrentMode("path"),e=!0):(pathActions.clear(!0),pathActions.toEditMode(path.elem))},select:function(e){a===e?(pathActions.toEditMode(e),editorContext_.setCurrentMode("pathedit")):a=e},reorient:function(){var e=editorContext_.getSelectedElements()[0];if(e&&0!==getRotationAngle(e)){var t=new BatchCommand("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new ChangeElementCommand(e,n)),editorContext_.clearSelection(),this.resetOrientation(e),editorContext_.addCommandToHistory(t),getPath_(e).show(!1).matrix=null,this.clear(),editorContext_.addToSelection([e],!0),editorContext_.call("changed",editorContext_.getSelectedElements())}},clear:function(e){var t=editorContext_.getDrawnPath();if(a=null,t){var r=getElem(editorContext_.getId());$$1(getElem("path_stretch_line")).remove(),$$1(r).remove(),$$1(getElem("pathpointgrip_container")).find("*").attr("display","none"),n=null,editorContext_.setDrawnPath(null),editorContext_.setStarted(!1)}else"pathedit"===editorContext_.getCurrentMode()&&this.toSelectMode();path&&path.init().show(!1)},resetOrientation:function(e){if(null==e||"path"!==e.nodeName)return!1;var t=getTransformList(e),n=transformListToTransform(t).matrix;t.clear(),e.removeAttribute("transform");for(var a=e.pathSegList,r=a.numberOfItems,i=function(t){var r=a.getItem(t),i=r.pathSegType;if(1===i)return"continue";var s=[];$$1.each(["",1,2],function(e,t){var a=r["x"+t],i=r["y"+t];if(void 0!==a&&void 0!==i){var o=transformPoint(a,i,n);s.splice(s.length,0,o.x,o.y)}}),replacePathSeg(i,t,s,e)},s=0;s<r;++s)i(s);reorientGrads(e,n)},zoomChange:function(){"pathedit"===editorContext_.getCurrentMode()&&path.update()},getNodePoint:function(){var e=path.selected_pts.length?path.selected_pts[0]:1,t=path.segs[e];return{x:t.item.x,y:t.item.y,type:t.type}},linkControlPoints:function(e){setLinkControlPoints(e)},clonePathNode:function(){path.storeD();for(var e=path.selected_pts,t=e.length,n=[];t--;){var a=e[t];path.addSeg(a),n.push(a+t),n.push(a+t+1)}path.init().addPtsToSelection(n),path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var e=path.selected_pts;if(1===e.length){var t=path.elem,n=t.pathSegList,a=e[0],r=null,i=null;if(path.eachSeg(function(e){return 2===this.type&&e<=a&&(i=this.item),e<=a||(2===this.type?(r=e,!1):1===this.type?(r=!1,!1):void 0)}),null==r&&(r=path.segs.length-1),!1!==r){var s=t.createSVGPathSegLinetoAbs(i.x,i.y),o=t.createSVGPathSegClosePath();return r===path.segs.length-1?(n.appendItem(s),n.appendItem(o)):(insertItemBefore(t,o,r),insertItemBefore(t,s,r)),void path.init().selectPt(r+1)}if(path.segs[a].mate)return n.removeItem(a),n.removeItem(a),void path.init().selectPt(a-1);for(var l=void 0,u=void 0,c=0;c<n.numberOfItems;c++){var h=n.getItem(c);if(2===h.pathSegType)l=c;else if(c===a)n.removeItem(l);else if(1===h.pathSegType&&a<c){u=c-1,n.removeItem(c);break}}for(var d=a-l-1;d--;)insertItemBefore(t,n.getItem(l),u);var f=n.getItem(l);replacePathSeg(2,l,[f.x,f.y]),path.init().selectPt(0)}},deletePathNode:function(){if(pathActions.canDeleteNodes){path.storeD();for(var e=path.selected_pts,t=e.length;t--;){var n=e[t];path.deleteSeg(n)}if(function e(){var t=path.elem.pathSegList,n=t.numberOfItems,a=function(e,n){for(;n--;)t.removeItem(e)};if(n<=1)return!0;for(;n--;){var r=t.getItem(n);if(1===r.pathSegType){var i=t.getItem(n-1),s=t.getItem(n-2);if(2===i.pathSegType){a(n-1,2),e();break}if(2===s.pathSegType){a(n-2,3),e();break}}else if(2===r.pathSegType&&n>0){var o=t.getItem(n-1).pathSegType;if(2===o){a(n-1,1),e();break}if(1===o&&t.numberOfItems-1===n){a(n,1),e();break}}}return!1}(),path.elem.pathSegList.numberOfItems<=1)return pathActions.toSelectMode(path.elem),void editorContext_.canvas.deleteSelectedElements();if(path.init(),path.clearSelection(),window.opera){var a=$$1(path.elem);a.attr("d",a.attr("d"))}path.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t=void 0,n=e.points,a=n.numberOfItems;if(a>=4){var r=n.getItem(0),i=null,s=[];for(s.push(["M",r.x,",",r.y," C"].join("")),t=1;t<=a-4;t+=3){var o=n.getItem(t),l=n.getItem(t+1),u=n.getItem(t+2);if(i){var c=smoothControlPoints(i,o,r);if(c&&2===c.length){var h=s[s.length-1].split(",");h[2]=c[0].x,h[3]=c[0].y,s[s.length-1]=h.join(","),o=c[1]}}s.push([o.x,o.y,l.x,l.y,u.x,u.y].join(",")),r=u,i=l}for(s.push("L");t<a;){var d=n.getItem(t);s.push([d.x,d.y].join(",")),t++}s=s.join(" "),e=editorContext_.addSvgElementFromJson({element:"path",curStyles:!0,attr:{id:editorContext_.getId(),d:s,fill:"none"}})}return e},setSegType:function(e){path.setSegType(e)},moveNode:function(e,t){var n=path.selected_pts;if(n.length){path.storeD();var a=path.segs[n[0]],r={x:0,y:0};r[e]=t-a.item[e],a.move(r.x,r.y),path.endChanges("Move path point")}},fixEnd:function(e){for(var t=e.pathSegList,n=t.numberOfItems,a=void 0,r=0;r<n;++r){var i=t.getItem(r);if(2===i.pathSegType&&(a=i),1===i.pathSegType){var s=t.getItem(r-1);if(s.x!==a.x||s.y!==a.y){var o=e.createSVGPathSegLinetoAbs(a.x,a.y);insertItemBefore(e,o,r),pathActions.fixEnd(e);break}}}isWebkit()&&editorContext_.resetD(e)},convertPath:convertPath}}(),$$2=jqPluginSVG(jQuery),KEYSTR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",visElems="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",visElemsArr=visElems.split(","),editorContext_$1=null,domdoc_=null,domcontainer_=null,svgroot_=null,init$2=function(e){editorContext_$1=e,domdoc_=e.getDOMDocument(),domcontainer_=e.getDOMContainer(),svgroot_=e.getSVGRoot()},toXml=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/,"'")},encode64=function(e){if(e=encodeUTF8(e),window.btoa)return window.btoa(e);var t=[];t.length=4*Math.floor((e.length+2)/3);var n=0,a=0;do{var r=e.charCodeAt(n++),i=e.charCodeAt(n++),s=e.charCodeAt(n++),o=r>>2,l=(3&r)<<4|i>>4,u=(15&i)<<2|s>>6,c=63&s;isNaN(i)?u=c=64:isNaN(s)&&(c=64),t[a++]=KEYSTR.charAt(o),t[a++]=KEYSTR.charAt(l),t[a++]=KEYSTR.charAt(u),t[a++]=KEYSTR.charAt(c)}while(n<e.length);return t.join("")},decode64=function(e){if(window.atob)return decodeUTF8(window.atob(e));e=e.replace(/[^A-Za-z0-9+/=]/g,"");var t="",n=0;do{var a=KEYSTR.indexOf(e.charAt(n++)),r=KEYSTR.indexOf(e.charAt(n++)),i=KEYSTR.indexOf(e.charAt(n++)),s=KEYSTR.indexOf(e.charAt(n++)),o=a<<2|r>>4,l=(15&r)<<4|i>>2,u=(3&i)<<6|s;t+=String.fromCharCode(o),64!==i&&(t+=String.fromCharCode(l)),64!==s&&(t+=String.fromCharCode(u))}while(n<e.length);return decodeUTF8(t)},decodeUTF8=function(e){return decodeURIComponent(escape(e))},encodeUTF8=function(e){return unescape(encodeURIComponent(e))},dataURLToObjectURL=function(e){if("undefined"==typeof Uint8Array||"undefined"==typeof Blob||"undefined"==typeof URL||!URL.createObjectURL)return"";for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],a=atob(t[1]),r=a.length,i=new Uint8Array(r);r--;)i[r]=a.charCodeAt(r);var s=new Blob([i],{type:n});return URL.createObjectURL(s)},createObjectURL=function(e){return e&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(e):""},blankPageObjectURL=function(){if("undefined"==typeof Blob)return"";var e=new Blob(["<html><head><title>SVG-edit "],{type:"text/html"});return createObjectURL(e)}(),text2xml=function(e){e.includes("0?t=t[0]:(t=e.ownerDocument.createElementNS(NS.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.appendChild(t)),t},getPathBBox=function(e){for(var t=e.pathSegList,n=t.numberOfItems,a=[[],[]],r=t.getItem(0),i=[r.x,r.y],s=0;s0&&c<1&&a[r].push(s(c)),"continue"}var h=Math.pow(o,2)-4*u*l;if(h<0)return"continue";var d=(-o+Math.sqrt(h))/(2*l);d>0&&d<1&&a[r].push(s(d));var f=(-o-Math.sqrt(h))/(2*l);f>0&&f<1&&a[r].push(s(f))},s=0;s<2;s++)r(s);i=n}():(a[0].push(o.x),a[1].push(o.y)))}var l=Math.min.apply(null,a[0]),u=Math.max.apply(null,a[0])-l,c=Math.min.apply(null,a[1]);return{x:l,y:c,width:u,height:Math.max.apply(null,a[1])-c}};function groupBBFix(e){if(supportsHVLineContainerBBox())try{return e.getBBox()}catch(e){}var t=$$2.data(e,"ref"),n=null,a=void 0,r=void 0;t?(r=$$2(t).children().clone().attr("visibility","hidden"),$$2(svgroot_).append(r),n=r.filter("line, path")):n=$$2(e).find("line, path");var i=!1;if(n.length)if(n.each(function(){var e=this.getBBox();e.width&&e.height||(i=!0)}),i){var s=t?r:$$2(e).children();a=getStrokedBBox(s)}else a=e.getBBox();else a=e.getBBox();return t&&r.remove(),a}var getBBox=function(e){var t=e||editorContext_$1.geSelectedElements()[0];if(1!==e.nodeType)return null;var n=t.nodeName,a=null;switch(n){case"text":""===t.textContent?(t.textContent="a",a=t.getBBox(),t.textContent=""):t.getBBox&&(a=t.getBBox());break;case"path":supportsPathBBox()?t.getBBox&&(a=t.getBBox()):a=getPathBBox(t);break;case"g":case"a":a=groupBBFix(t);break;default:if("use"===n&&(a=groupBBFix(t,!0)),"use"===n||"foreignObject"===n&&isWebkit()){if(a||(a=t.getBBox()),!isWebkit()){var r={};r.width=a.width,r.height=a.height,r.x=a.x+parseFloat(t.getAttribute("x")||0),r.y=a.y+parseFloat(t.getAttribute("y")||0),a=r}}else if(visElemsArr.includes(n))if(t)try{a=t.getBBox()}catch(e){var i=t.getExtentOfChar(0),s=t.getComputedTextLength();a={x:i.x,y:i.y,width:s,height:i.height}}else{var o=$$2(t).closest("foreignObject");o.length&&o[0].getBBox&&(a=o[0].getBBox())}}return a&&(a=bboxToObj(a)),a},getPathDFromSegments=function(e){var t="";return $$2.each(e,function(e,n){var a=n[1];t+=n[0];for(var r=0;r-.001&&n<.001||(n<-89.99||n>89.99))}var getBBoxWithTransform=function(e,t,n){var a=getBBox(e);if(!a)return null;var r=getTransformList(e),i=getRotationAngleFromTransformList(r),s=hasMatrixTransform(r);if(i||s){var o=!1;if(bBoxCanBeOptimizedOverNativeGetBBox(i,s)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))a=o=getBBoxOfElementAsPath(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),u=e.getAttribute("ry");(l||u)&&(a=o=getBBoxOfElementAsPath(e,t,n))}}if(!o){var c=transformListToTransform(r).matrix;a=transformBox(a.x,a.y,a.width,a.height,c).aabox}}return a};function getStrokeOffsetForBBox(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var getStrokedBBox=function(e,t,n){if(!e||!e.length)return!1;var a=void 0;if($$2.each(e,function(){a||this.parentNode&&(a=getBBoxWithTransform(this,t,n))}),void 0===a)return null;var r=a.x+a.width,i=a.y+a.height,s=a.x,o=a.y;if(1===e.length){var l=getStrokeOffsetForBBox(e[0]);s-=l,o-=l,r+=l,i+=l}else $$2.each(e,function(e,a){var l=getBBoxWithTransform(a,t,n);if(l){var u=getStrokeOffsetForBBox(a);s=Math.min(s,l.x-u),o=Math.min(o,l.y-u),1===a.nodeType&&(r=Math.max(r,l.x+l.width+u),i=Math.max(i,l.y+l.height+u))}});return a.x=s,a.y=o,a.width=r-s,a.height=i-o,a},getVisibleElements=function(e){e||(e=$$2(editorContext_$1.getSVGContent()).children());var t=[];return $$2(e).children().each(function(e,n){n.getBBox&&t.push(n)}),t.reverse()},getStrokedBBoxDefaultVisible=function(e){return e||(e=getVisibleElements()),getStrokedBBox(e,editorContext_$1.addSvgElementFromJson,editorContext_$1.pathActions)},getRotationAngleFromTransformList=function(e,t){if(!e)return 0;for(var n=e.numberOfItems,a=0;a|:\\"+(t||"")+"-]","g"),"\\$&")},loadedScripts={},executeAfterLoads=function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{globals:!1};return function(){var r=arguments;function i(){n.apply(null,r)}var s=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules);if(!0===loadedScripts[e])i();else if(Array.isArray(loadedScripts[e]))loadedScripts[e].push(i);else{loadedScripts[e]=[];var o=s&&!a.globals?importModule:importScript;t.reduce(function(e,t){return e.then(function(){return o(t)})},Promise.resolve()).then(function(){i(),loadedScripts[e].forEach(function(e){e()}),loadedScripts[e]=!0})()}}},buildCanvgCallback=function(e){return executeAfterLoads("canvg",["canvg/rgbcolor.js","canvg/canvg.js"],e)},buildJSPDFCallback=function(e){return executeAfterLoads("RGBColor",["canvg/rgbcolor.js"],function(){var t=[];RGBColor&&void 0!==RGBColor.ok||t.push("canvg/rgbcolor.js"),executeAfterLoads("jsPDF",[].concat(t,["jspdf/underscore-min.js","jspdf/jspdf.min.js","jspdf/jspdf.plugin.svgToPdf.js"]),e,{globals:!0})()})},preventClickDefault=function(e){$$2(e).click(function(e){e.preventDefault()})},copyElem=function e(t,n){var a=document.createElementNS(t.namespaceURI,t.nodeName);if($$2.each(t.attributes,function(e,t){"-moz-math-font-style"!==t.localName&&a.setAttributeNS(t.namespaceURI,t.nodeName,t.value)}),a.removeAttribute("id"),a.id=n(),isWebkit()&&"path"===t.nodeName){var r=convertPath(t);a.setAttribute("d",r)}if($$2.each(t.childNodes,function(t,r){switch(r.nodeType){case 1:a.appendChild(e(r,n));break;case 3:a.textContent=r.nodeValue}}),$$2(t).data("gsvg"))$$2(a).data("gsvg",a.firstChild);else if($$2(t).data("symbol")){var i=$$2(t).data("symbol");$$2(a).data("ref",i).data("symbol",i)}else"image"===a.tagName&&preventClickDefault(a);return a},$$3=jQuery,contextMenuExtensions={},hasCustomHandler=function(e){return Boolean(contextMenuExtensions[e])},getCustomHandler=function(e){return contextMenuExtensions[e].action},injectExtendedContextMenuItemIntoDom=function(e){Object.keys(contextMenuExtensions).length||$$3("#cmenu_canvas").append("
  • ");var t=e.shortcut||"";$$3("#cmenu_canvas").append("
  • "+e.label+""+t+"
  • ")},injectExtendedContextMenuItemsIntoDom=function(){for(var e in contextMenuExtensions)injectExtendedContextMenuItemIntoDom(contextMenuExtensions[e])};function canvg(e,t,n){if(null!=e||null!=t||null!=n){"string"==typeof e&&(e=document.getElementById(e)),null!=e.svg&&e.svg.stop();var a=build(n||{});1===e.childNodes.length&&"OBJECT"===e.childNodes[0].nodeName||(e.svg=a);var r=e.getContext("2d");void 0!==t.documentElement?a.loadXmlDoc(r,t):"<"===t.substr(0,1)?a.loadXml(r,t):a.load(r,t)}else for(var i=document.querySelectorAll("svg"),s=0;s]*>/,"");var t=new ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t};var n={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};return t.Property=function(){function e(t,n){classCallCheck(this,e),this.name=t,this.value=n}return createClass(e,[{key:"getValue",value:function(){return this.value}},{key:"hasValue",value:function(){return null!=this.value&&""!==this.value}},{key:"numValue",value:function(){if(!this.hasValue())return 0;var e=parseFloat(this.value);return(this.value+"").match(/%$/)&&(e/=100),e}},{key:"valueOrDefault",value:function(e){return this.hasValue()?this.value:e}},{key:"numValueOrDefault",value:function(e){return this.hasValue()?this.numValue():e}},{key:"addOpacity",value:function(e){var n=this.value;if(null!=e.value&&""!==e.value&&"string"==typeof this.value){var a=new RGBColor(this.value);a.ok&&(n="rgba("+a.r+", "+a.g+", "+a.b+", "+e.numValue()+")")}return new t.Property(this.name,n)}},{key:"getDefinition",value:function(){var e=this.value.match(/#([^)'"]+)/);return e&&(e=e[1]),e||(e=this.value),t.Definitions[e]}},{key:"isUrlDefinition",value:function(){return this.value.startsWith("url(")}},{key:"getFillStyleDefinition",value:function(e,n){var a=this.getDefinition();if(null!=a&&a.createGradient)return a.createGradient(t.ctx,e,n);if(null!=a&&a.createPattern){if(a.getHrefAttribute().hasValue()){var r=a.attribute("patternTransform");a=a.getHrefAttribute().getDefinition(),r.hasValue()&&(a.attribute("patternTransform",!0).value=r.value)}return a.createPattern(t.ctx,e)}return null}},{key:"getDPI",value:function(e){return 96}},{key:"getEM",value:function(e){var n=12,a=new t.Property("fontSize",t.Font.Parse(t.ctx.font).fontSize);return a.hasValue()&&(n=a.toPixels(e)),n}},{key:"getUnits",value:function(){return(this.value+"").replace(/[0-9.-]/g,"")}},{key:"toPixels",value:function(e,n){if(!this.hasValue())return 0;var a=this.value+"";if(a.match(/em$/))return this.numValue()*this.getEM(e);if(a.match(/ex$/))return this.numValue()*this.getEM(e)/2;if(a.match(/px$/))return this.numValue();if(a.match(/pt$/))return this.numValue()*this.getDPI(e)*(1/72);if(a.match(/pc$/))return 15*this.numValue();if(a.match(/cm$/))return this.numValue()*this.getDPI(e)/2.54;if(a.match(/mm$/))return this.numValue()*this.getDPI(e)/25.4;if(a.match(/in$/))return this.numValue()*this.getDPI(e);if(a.match(/%$/))return this.numValue()*t.ViewPort.ComputeSize(e);var r=this.numValue();return n&&r<1?r*t.ViewPort.ComputeSize(e):r}},{key:"toMilliseconds",value:function(){if(!this.hasValue())return 0;var e=this.value+"";return e.match(/s$/)?1e3*this.numValue():(e.match(/ms$/),this.numValue())}},{key:"toRadians",value:function(){if(!this.hasValue())return 0;var e=this.value+"";return e.match(/deg$/)?this.numValue()*(Math.PI/180):e.match(/grad$/)?this.numValue()*(Math.PI/200):e.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)}},{key:"toTextBaseline",value:function(){return this.hasValue()?n[this.value]:null}}]),e}(),t.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(e,n,a,r,i,s){var o=null!=s?this.Parse(s):this.CreateFont("","","","","",t.ctx.font);return{fontFamily:i||o.fontFamily,fontSize:r||o.fontSize,fontStyle:e||o.fontStyle,fontWeight:a||o.fontWeight,fontVariant:n||o.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var e=this;this.Parse=function(n){for(var a={},r=t.trim(t.compressSpaces(n||"")).split(" "),i={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},s="",o=0;othis.x2&&(this.x2=e)),null!=t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),tthis.y2&&(this.y2=t))},this.addX=function(e){this.addPoint(e,null)},this.addY=function(e){this.addPoint(null,e)},this.addBoundingBox=function(e){this.addPoint(e.x1,e.y1),this.addPoint(e.x2,e.y2)},this.addQuadraticCurve=function(e,t,n,a,r,i){var s=e+2/3*(n-e),o=t+2/3*(a-t),l=s+1/3*(r-e),u=o+1/3*(i-t);this.addBezierCurve(e,t,s,l,o,u,r,i)},this.addBezierCurve=function(e,t,n,a,r,i,s,o){var l=this,u=[e,t],c=[n,a],h=[r,i],d=[s,o];this.addPoint(u[0],u[1]),this.addPoint(d[0],d[1]);for(var f=function(e){var t=function(t){return Math.pow(1-t,3)*u[e]+3*Math.pow(1-t,2)*t*c[e]+3*(1-t)*Math.pow(t,2)*h[e]+Math.pow(t,3)*d[e]},n=6*u[e]-12*c[e]+6*h[e],a=-3*u[e]+9*c[e]-9*h[e]+3*d[e],r=3*c[e]-3*u[e];if(0===a){if(0===n)return"continue";var i=-r/n;return i>0&&i<1&&(0===e&&l.addX(t(i)),1===e&&l.addY(t(i))),"continue"}var s=Math.pow(n,2)-4*r*a;if(s<0)return"continue";var o=(-n+Math.sqrt(s))/(2*a);o>0&&o<1&&(0===e&&l.addX(t(o)),1===e&&l.addY(t(o)));var f=(-n-Math.sqrt(s))/(2*a);f>0&&f<1&&(0===e&&l.addX(t(f)),1===e&&l.addY(t(f)))},p=0;p<=1;p++)f(p)},this.isPointInBox=function(e,t){return this.x1<=e&&e<=this.x2&&this.y1<=t&&t<=this.y2},this.addPoint(e,t),this.addPoint(n,a)},t.Transform=function(e){this.Type={},this.Type.translate=function(e){this.p=t.CreatePoint(e),this.apply=function(e){e.translate(this.p.x||0,this.p.y||0)},this.unapply=function(e){e.translate(-1*this.p.x||0,-1*this.p.y||0)},this.applyToPoint=function(e){e.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0])}},this.Type.rotate=function(e){var n=t.ToNumberArray(e);this.angle=new t.Property("angle",n[0]),this.cx=n[1]||0,this.cy=n[2]||0,this.apply=function(e){e.translate(this.cx,this.cy),e.rotate(this.angle.toRadians()),e.translate(-this.cx,-this.cy)},this.unapply=function(e){e.translate(this.cx,this.cy),e.rotate(-1*this.angle.toRadians()),e.translate(-this.cx,-this.cy)},this.applyToPoint=function(e){var t=this.angle.toRadians();e.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]),e.applyTransform([Math.cos(t),Math.sin(t),-Math.sin(t),Math.cos(t),0,0]),e.applyTransform([1,0,0,1,-this.p.x||0,-this.p.y||0])}},this.Type.scale=function(e){this.p=t.CreatePoint(e),this.apply=function(e){e.scale(this.p.x||1,this.p.y||this.p.x||1)},this.unapply=function(e){e.scale(1/this.p.x||1,1/this.p.y||this.p.x||1)},this.applyToPoint=function(e){e.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}},this.Type.matrix=function(e){this.m=t.ToNumberArray(e),this.apply=function(e){e.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])},this.applyToPoint=function(e){e.applyTransform(this.m)}},this.Type.SkewBase=function(e){function n(e){classCallCheck(this,n);var a=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return a.angle=new t.Property("angle",e),a}return inherits(n,e),n}(this.Type.matrix),this.Type.skewX=function(e){function t(e){classCallCheck(this,t);var n=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.m=[1,0,Math.tan(n.angle.toRadians()),1,0,0],n}return inherits(t,e),t}(this.Type.SkewBase),this.Type.skewY=function(e){function t(e){classCallCheck(this,t);var n=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.m=[1,Math.tan(n.angle.toRadians()),0,1,0,0],n}return inherits(t,e),t}(this.Type.SkewBase),this.transforms=[],this.apply=function(e){for(var t=0;t=0;t--)this.transforms[t].unapply(e)},this.applyToPoint=function(e){for(var t=0;t=this.tokens.length-1},this.isCommandOrEnd=function(){return!!this.isEnd()||null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var e=new t.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(e)},this.getAsControlPoint=function(){var e=this.getPoint();return this.control=e,e},this.getAsCurrentPoint=function(){var e=this.getPoint();return this.current=e,e},this.getReflectedControlPoint=function(){return"c"!==this.previousCommand.toLowerCase()&&"s"!==this.previousCommand.toLowerCase()&&"q"!==this.previousCommand.toLowerCase()&&"t"!==this.previousCommand.toLowerCase()?this.current:new t.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},this.makeAbsolute=function(e){return this.isRelativeCommand()&&(e.x+=this.current.x,e.y+=this.current.y),e},this.addMarker=function(e,t,n){null!=n&&this.angles.length>0&&null==this.angles[this.angles.length-1]&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(n)),this.addMarkerAngle(e,null==t?null:t.angleTo(e))},this.addMarkerAngle=function(e,t){this.points.push(e),this.angles.push(t)},this.getMarkerPoints=function(){return this.points},this.getMarkerAngles=function(){for(var e=0;e1&&(i*=Math.sqrt(d),s*=Math.sqrt(d));var f=(l===u?-1:1)*Math.sqrt((Math.pow(i,2)*Math.pow(s,2)-Math.pow(i,2)*Math.pow(h.y,2)-Math.pow(s,2)*Math.pow(h.x,2))/(Math.pow(i,2)*Math.pow(h.y,2)+Math.pow(s,2)*Math.pow(h.x,2)));isNaN(f)&&(f=0);var p=new t.Point(f*i*h.y/s,f*-s*h.x/i),g=new t.Point((r.x+c.x)/2+Math.cos(o)*p.x-Math.sin(o)*p.y,(r.y+c.y)/2+Math.sin(o)*p.x+Math.cos(o)*p.y),v=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2))},m=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(v(e)*v(t))},y=function(e,t){return(e[0]*t[1]=1&&(C=0);var S=1-u?1:-1,w=b+S*(C/2),k=new t.Point(g.x+i*Math.cos(w),g.y+s*Math.sin(w));if(n.addMarkerAngle(k,w-S*Math.PI/2),n.addMarkerAngle(c,w-S*Math.PI),a.addPoint(c.x,c.y),null!=e){var $=i>s?i:s,P=i>s?1:i/s,E=i>s?s/i:1;e.translate(g.x,g.y),e.rotate(o),e.scale(P,E),e.arc(0,0,$,b,b+C,1-u),e.scale(1/P,1/E),e.rotate(-o),e.translate(-g.x,-g.y)}};!n.isCommandOrEnd();)w();break;case"Z":case"z":null!=e&&e.closePath(),n.current=n.start}return a},a.getMarkers=function(){for(var e=this.PathParser.getMarkerPoints(),t=this.PathParser.getMarkerAngles(),n=[],a=0;a1&&(n.offset=1);var a=n.style("stop-color");return n.style("stop-opacity").hasValue()&&(a=a.addOpacity(n.style("stop-opacity"))),n.color=a.value,n}return inherits(t,e),t}(t.Element.ElementBase),t.Element.AnimateBase=function(e){function n(e){classCallCheck(this,n);var a=possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.Animations.push(a),a.duration=0,a.begin=a.attribute("begin").toMilliseconds(),a.maxDuration=a.begin+a.attribute("dur").toMilliseconds(),a.getProperty=function(){var e=this.attribute("attributeType").value,t=this.attribute("attributeName").value;return"CSS"===e?this.parent.style(t,!0):this.parent.attribute(t,!0)},a.initialValue=null,a.initialUnits="",a.removed=!1,a.calcValue=function(){return""},a.update=function(e){if(null==this.initialValue&&(this.initialValue=this.getProperty().value,this.initialUnits=this.getProperty().getUnits()),this.duration>this.maxDuration){if("indefinite"===this.attribute("repeatCount").value||"indefinite"===this.attribute("repeatDur").value)this.duration=0;else if("freeze"!==this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"===this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration=this.duration+e;var t=!1;if(this.beginn&&s.attribute("x").hasValue())break;r+=s.measureTextRecursive(e)}return-1*("end"===a?r:r/2)}return 0},a.renderChild=function(e,t,n){var a=t.children[n];a.attribute("x").hasValue()?(a.x=a.attribute("x").toPixels("x")+this.getAnchorDelta(e,t,n),a.attribute("dx").hasValue()&&(a.x+=a.attribute("dx").toPixels("x"))):(this.attribute("dx").hasValue()&&(this.x+=this.attribute("dx").toPixels("x")),a.attribute("dx").hasValue()&&(this.x+=a.attribute("dx").toPixels("x")),a.x=this.x),this.x=a.x+a.measureText(e),a.attribute("y").hasValue()?(a.y=a.attribute("y").toPixels("y"),a.attribute("dy").hasValue()&&(a.y+=a.attribute("dy").toPixels("y"))):(this.attribute("dy").hasValue()&&(this.y+=this.attribute("dy").toPixels("y")),a.attribute("dy").hasValue()&&(this.y+=a.attribute("dy").toPixels("y")),a.y=this.y),this.y=a.y,a.render(e);for(var r=0;r0&&" "!==t[n-1]&&n0&&" "!==t[n-1]&&(n===t.length-1||" "===t[n+1])&&(i="initial"),void 0!==e.glyphs[a]&&null==(r=e.glyphs[a][i])&&"glyph"===e.glyphs[a].type&&(r=e.glyphs[a])}else r=e.glyphs[a];return null==r&&(r=e.missingGlyph),r},a.renderChildren=function(e){var n=this.parent.style("font-family").getDefinition();if(null==n)""!==e.fillStyle&&e.fillText(t.compressSpaces(this.getText()),this.x,this.y),""!==e.strokeStyle&&e.strokeText(t.compressSpaces(this.getText()),this.x,this.y);else{var a=this.parent.style("font-size").numValueOrDefault(t.Font.Parse(t.ctx.font).fontSize),r=this.parent.style("font-style").valueOrDefault(t.Font.Parse(t.ctx.font).fontStyle),i=this.getText();n.isRTL&&(i=i.split("").reverse().join(""));for(var s=t.ToNumberArray(this.parent.attribute("dx").value),o=0;o=0&&e<=1&&this.group_.setAttribute("opacity",e)}},{key:"appendChildren",value:function(e){for(var t=0;t element");this.svgElem_=t,this.obj_num=0,this.idPrefix=n||"svg_",this.releasedNums=[],this.all_layers=[],this.layer_map={},this.current_layer=null,this.nonce_="";var a=this.svgElem_.getAttributeNS(NS.SE,"nonce");a&&randIds!==RandomizeModes.NEVER_RANDOMIZE?this.nonce_=a:randIds===RandomizeModes.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(100001*Math.random()))}return createClass(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):$$5(this.svgElem_).find("[id="+e+"]")[0]}},{key:"getSvgElem",value:function(){return this.svgElem_}},{key:"getNonce",value:function(){return this.nonce_}},{key:"setNonce",value:function(e){this.svgElem_.setAttributeNS(NS.XMLNS,"xmlns:se",NS.SE),this.svgElem_.setAttributeNS(NS.SE,"se:nonce",e),this.nonce_=e}},{key:"clearNonce",value:function(){this.nonce_=""}},{key:"getId",value:function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num}},{key:"getNextId",value:function(){var e=this.obj_num,t=!1;this.releasedNums.length>0?(this.obj_num=this.releasedNums.pop(),t=!0):this.obj_num++;for(var n=this.getId();this.getElem_(n);)t&&(this.obj_num=e,t=!1),this.obj_num++,n=this.getId();return t&&(this.obj_num=e),n}},{key:"releaseId",value:function(e){var t=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if("string"!=typeof e||!e.startsWith(t))return!1;var n=parseInt(e.substr(t.length),10);return!("number"!=typeof n||n<=0||this.releasedNums.includes(n))&&(this.releasedNums.push(n),!0)}},{key:"getNumLayers",value:function(){return this.all_layers.length}},{key:"hasLayer",value:function(e){return void 0!==this.layer_map[e]}},{key:"getLayerName",value:function(e){return e>=0&&e=t)return null;var n=void 0;for(n=0;nn?e0){var o=this.current_layer.getName();this.current_layer=this.all_layers[s-1],this.all_layers.splice(s,1),delete this.layer_map[o]}e.endBatchCommand()}}},{key:"mergeAllLayers",value:function(e){for(this.current_layer=this.all_layers[this.all_layers.length-1],e.startBatchCommand("Merge all Layers");this.all_layers.length>1;)this.mergeLayer(e);e.endBatchCommand()}},{key:"setCurrentLayer",value:function(e){var t=this.layer_map[e];return!!t&&(this.current_layer&&this.current_layer.deactivate(),this.current_layer=t,this.current_layer.activate(),!0)}},{key:"deleteCurrentLayer",value:function(){if(this.current_layer&&this.getNumLayers()>1){var e=this.current_layer.removeGroup();return this.identifyLayers(),e}return null}},{key:"identifyLayers",value:function(){this.all_layers=[],this.layer_map={};for(var e=this.svgElem_.childNodes.length,t=[],n=[],a=null,r=!1,i=0;i0||!r?((a=new Layer(getNewLayerName(n),null,this.svgElem_)).appendChildren(t),this.all_layers.push(a),this.layer_map[name]=a):a.activate(),this.current_layer=a}},{key:"createLayer",value:function(e,t){this.current_layer&&this.current_layer.deactivate(),(void 0===e||null===e||""===e||this.layer_map[e])&&(e=getNewLayerName(Object.keys(this.layer_map)));var n=new Layer(e,null,this.svgElem_);return t&&(t.startBatchCommand("Create Layer"),t.insertElement(n.getGroup()),t.endBatchCommand()),this.all_layers.push(n),this.layer_map[e]=n,this.current_layer=n,n.getGroup()}},{key:"cloneLayer",value:function(e,t){if(!this.current_layer)return null;this.current_layer.deactivate(),(void 0===e||null===e||""===e||this.layer_map[e])&&(e=getNewLayerName(Object.keys(this.layer_map)));for(var n=this.current_layer.getGroup(),a=new Layer(e,n,this.svgElem_),r=a.getGroup(),i=n.childNodes,s=0;s=0?this.all_layers.splice(l+1,0,a):this.all_layers.push(a),this.layer_map[e]=a,this.current_layer=a,r}},{key:"getLayerVisibility",value:function(e){var t=this.layer_map[e];return!!t&&t.isVisible()}},{key:"setLayerVisibility",value:function(e,t){if("boolean"!=typeof t)return null;var n=this.layer_map[e];return n?(n.setVisible(t),n.getGroup()):null}},{key:"getLayerOpacity",value:function(e){var t=this.layer_map[e];return t?t.getOpacity():null}},{key:"setLayerOpacity",value:function(e,t){if(!("number"!=typeof t||t<0||t>1)){var n=this.layer_map[e];n&&n.setOpacity(t)}}},{key:"copyElem",value:function(e){var t=this;return copyElem(e,function(){return t.getNextId()})}}]),e}(),randomizeIds=function(e,t){(randIds=!1===e?RandomizeModes.NEVER_RANDOMIZE:RandomizeModes.ALWAYS_RANDOMIZE)!==RandomizeModes.ALWAYS_RANDOMIZE||t.getNonce()?randIds===RandomizeModes.NEVER_RANDOMIZE&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},canvas_=void 0,init$3=function(e){canvas_=e},identifyLayers=function(){leaveContext(),canvas_.getCurrentDrawing().identifyLayers()},createLayer=function(e,t){var n=canvas_.getCurrentDrawing().createLayer(e,historyRecordingService(t));canvas_.clearSelection(),canvas_.call("changed",[n])},cloneLayer=function(e,t){var n=canvas_.getCurrentDrawing().cloneLayer(e,historyRecordingService(t));canvas_.clearSelection(),leaveContext(),canvas_.call("changed",[n])},deleteCurrentLayer=function(){var e=canvas_.getCurrentDrawing().getCurrentLayer(),t=e.nextSibling,n=e.parentNode;if(e=canvas_.getCurrentDrawing().deleteCurrentLayer()){var a=new BatchCommand("Delete Layer");return a.addSubCommand(new RemoveElementCommand(e,t,n)),canvas_.addCommandToHistory(a),canvas_.clearSelection(),canvas_.call("changed",[n]),!0}return!1},setCurrentLayer=function(e){var t=canvas_.getCurrentDrawing().setCurrentLayer(toXml(e));return t&&canvas_.clearSelection(),t},renameCurrentLayer=function(e){var t=canvas_.getCurrentDrawing(),n=t.getCurrentLayer();if(n&&t.setCurrentLayerName(e,historyRecordingService()))return canvas_.call("changed",[n]),!0;return!1},setCurrentLayerPosition=function(e){var t=canvas_.getCurrentDrawing().setCurrentLayerPosition(e);return!!t&&(canvas_.addCommandToHistory(new MoveElementCommand(t.currentGroup,t.oldNextSibling,canvas_.getSVGContent())),!0)},setLayerVisibility=function(e,t){var n=canvas_.getCurrentDrawing(),a=n.getLayerVisibility(e),r=n.setLayerVisibility(e,t);if(!r)return!1;var i=a?"inline":"none";return canvas_.addCommandToHistory(new ChangeElementCommand(r,{display:i},"Layer Visibility")),r===n.getCurrentLayer()&&(canvas_.clearSelection(),canvas_.pathActions.clear()),!0},moveSelectedToLayer=function(e){var t=canvas_.getCurrentDrawing().getLayerByName(e);if(!t)return!1;for(var n=new BatchCommand("Move Elements to Layer"),a=canvas_.getSelectedElements(),r=a.length;r--;){var i=a[r];if(i){var s=i.nextSibling,o=i.parentNode;t.appendChild(i),n.addSubCommand(new MoveElementCommand(i,s,o))}}return canvas_.addCommandToHistory(n),!0},mergeLayer=function(e){canvas_.getCurrentDrawing().mergeLayer(historyRecordingService(e)),canvas_.clearSelection(),leaveContext(),canvas_.changeSvgcontent()},mergeAllLayers=function(e){canvas_.getCurrentDrawing().mergeAllLayers(historyRecordingService(e)),canvas_.clearSelection(),leaveContext(),canvas_.changeSvgcontent()},leaveContext=function(){var e=disabledElems.length;if(e){for(var t=0;t0){for(var r=a.numberOfItems,i=r;r--;){var s=a.getItem(r);if(0===s.type)a.removeItem(r);else if(1===s.type){if(isIdentity(s.matrix)){if(1===i)return t.removeAttribute("transform"),null;a.removeItem(r)}}else 4===s.type&&0===s.angle&&a.removeItem(r)}if(1===a.numberOfItems&&getRotationAngle(t))return null}if(!a||0===a.numberOfItems)return t.setAttribute("transform",""),t.removeAttribute("transform"),null;if(a){for(var o=[],l=a.numberOfItems;l--;){var u=a.getItem(l);1===u.type?o.push([u.matrix,l]):o.length&&(o=[])}if(2===o.length){var c=n.createSVGTransformFromMatrix(matrixMultiply(o[1][0],o[0][0]));a.removeItem(o[0][1]),a.removeItem(o[1][1]),a.insertItemBefore(c,o[1][1])}if((l=a.numberOfItems)>=2&&1===a.getItem(l-2).type&&2===a.getItem(l-1).type){var h=n.createSVGTransform(),d=matrixMultiply(a.getItem(l-2).matrix,a.getItem(l-1).matrix);h.setMatrix(d),a.removeItem(l-2),a.removeItem(l-2),a.appendItem(h)}}switch(t.tagName){case"line":case"polyline":case"polygon":case"path":break;default:if(1===a.numberOfItems&&1===a.getItem(0).type||2===a.numberOfItems&&1===a.getItem(0).type&&4===a.getItem(0).type)return null}var f=$$7(t).data("gsvg"),p=new BatchCommand("Transform"),g={},v=null,m=[];switch(t.tagName){case"line":m=["x1","y1","x2","y2"];break;case"circle":m=["cx","cy","r"];break;case"ellipse":m=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":m=["width","height","x","y"];break;case"use":case"text":case"tspan":m=["x","y"];break;case"polygon":case"polyline":(v={}).points=t.getAttribute("points");var y=t.points,b=y.numberOfItems;g.points=new Array(b);for(var _=0;_1e-10?Math.sin(P)/(1-Math.cos(P)):2/P;for(var A=0;A=3&&3===a.getItem(G-2).type&&2===a.getItem(G-3).type&&2===a.getItem(G-1).type){M=3;for(var V=a.getItem(G-3).matrix,R=a.getItem(G-2).matrix,j=a.getItem(G-1).matrix,D=t.childNodes,F=D.length;F--;){var U=D.item(F);if(L=0,I=0,1===U.nodeType){var H=getTransformList(U);if(!H)continue;var z=transformListToTransform(H).matrix,q=getRotationAngle(U);if(O=context_.getStartTransform(),context_.setStartTransform(U.getAttribute("transform")),q||hasMatrixTransform(H)){var X=n.createSVGTransform();X.setMatrix(matrixMultiply(V,R,j,z)),H.clear(),H.appendItem(X)}else{var W=matrixMultiply(z.inverse(),j,z),Y=n.createSVGMatrix();Y.e=-W.e,Y.f=-W.f;var Q=matrixMultiply(Y.inverse(),z.inverse(),V,R,j,z,W.inverse()),Z=n.createSVGTransform(),K=n.createSVGTransform(),J=n.createSVGTransform();Z.setTranslate(W.e,W.f),K.setScale(Q.a,Q.d),J.setTranslate(Y.e,Y.f),H.appendItem(J),H.appendItem(K),H.appendItem(Z)}p.addSubCommand(e(U)),context_.setStartTransform(O)}}a.removeItem(G-1),a.removeItem(G-2),a.removeItem(G-3)}else if(G>=3&&1===a.getItem(G-1).type){M=3,k=transformListToTransform(a).matrix;var ee=n.createSVGTransform();ee.setMatrix(k),a.clear(),a.appendItem(ee)}else if((1===G||G>1&&3!==a.getItem(1).type)&&2===a.getItem(0).type){M=2;var te=transformListToTransform(a).matrix;a.removeItem(0);var ne=transformListToTransform(a).matrix.inverse(),ae=matrixMultiply(ne,te);if(L=ae.e,I=ae.f,0!==L||0!==I){for(var re=t.childNodes,ie=re.length,se=[];ie--;){var oe=re.item(ie);if(1===oe.nodeType){if(oe.getAttribute("clip-path")){var le=oe.getAttribute("clip-path");se.includes(le)||(updateClipPath(le,L,I),se.push(le))}O=context_.getStartTransform(),context_.setStartTransform(oe.getAttribute("transform"));var ue=getTransformList(oe);if(ue){var ce=n.createSVGTransform();ce.setTranslate(L,I),ue.numberOfItems?ue.insertItemBefore(ce,0):ue.appendItem(ce),p.addSubCommand(e(oe));for(var he=t.getElementsByTagNameNS(NS.SVG,"use"),de="#"+oe.id,fe=he.length;fe--;){var pe=he.item(fe);if(de===getHref(pe)){var ge=n.createSVGTransform();ge.setTranslate(-L,-I),getTransformList(pe).insertItemBefore(ge,0),p.addSubCommand(e(pe))}}context_.setStartTransform(O)}}}se=[],context_.setStartTransform(O)}}else{if(1!==G||1!==a.getItem(0).type||$){if($){var ve=n.createSVGTransform();ve.setRotate($,S.x,S.y),a.numberOfItems?a.insertItemBefore(ve,0):a.appendItem(ve)}return 0===a.numberOfItems&&t.removeAttribute("transform"),null}M=1;for(var me=a.getItem(0).matrix,ye=t.childNodes,be=ye.length;be--;){var _e=ye.item(be);if(1===_e.nodeType){O=context_.getStartTransform(),context_.setStartTransform(_e.getAttribute("transform"));var xe=getTransformList(_e);if(!xe)continue;var Ce=matrixMultiply(me,transformListToTransform(xe).matrix),Se=n.createSVGTransform();Se.setMatrix(Ce),xe.clear(),xe.appendItem(Se,0),p.addSubCommand(e(_e)),context_.setStartTransform(O);var we=_e.getAttribute("stroke-width");if("none"!==_e.getAttribute("stroke")&&!isNaN(we)){var ke=(Math.abs(Ce.a)+Math.abs(Ce.d))/2;_e.setAttribute("stroke-width",we*ke)}}}a.clear()}if(2===M){if($){S={x:C.x+B.e,y:C.y+B.f};var $e=n.createSVGTransform();$e.setRotate($,S.x,S.y),a.numberOfItems?a.insertItemBefore($e,0):a.appendItem($e)}}else if(3===M){var Pe=transformListToTransform(a).matrix,Ee=n.createSVGTransform();Ee.setRotate($,C.x,C.y);var Ae=Ee.matrix,Te=n.createSVGTransform();Te.setRotate($,S.x,S.y);var Ne=Te.matrix.inverse(),Ge=Pe.inverse(),Le=matrixMultiply(Ge,Ne,Ae,Pe);if(L=Le.e,I=Le.f,0!==L||0!==I)for(var Ie=t.childNodes,Me=Ie.length;Me--;){var Be=Ie.item(Me);if(1===Be.nodeType){O=context_.getStartTransform(),context_.setStartTransform(Be.getAttribute("transform"));var Oe=getTransformList(Be),Ve=n.createSVGTransform();Ve.setTranslate(L,I),Oe.numberOfItems?Oe.insertItemBefore(Ve,0):Oe.appendItem(Ve),p.addSubCommand(e(Be)),context_.setStartTransform(O)}}$&&(a.numberOfItems?a.insertItemBefore(Te,0):a.appendItem(Te))}}else{var Re=getBBox(t);if(!Re&&"path"!==t.tagName)return null;var je=n.createSVGMatrix(),De=getRotationAngle(t);if(De){C={x:Re.x+Re.width/2,y:Re.y+Re.height/2},S=transformPoint(Re.x+Re.width/2,Re.y+Re.height/2,transformListToTransform(a).matrix);for(var Fe=De*Math.PI/180,Ue=Math.abs(Fe)>1e-10?Math.sin(Fe)/(1-Math.cos(Fe)):2/Fe,He=0;He=3&&3===a.getItem(We-2).type&&2===a.getItem(We-3).type&&2===a.getItem(We-1).type)Xe=3,je=transformListToTransform(a,We-3,We-1).matrix,a.removeItem(We-1),a.removeItem(We-2),a.removeItem(We-3);else if(4===We&&1===a.getItem(We-1).type){Xe=3,je=transformListToTransform(a).matrix;var tt=n.createSVGTransform();tt.setMatrix(je),a.clear(),a.appendItem(tt),je=n.createSVGMatrix()}else if((1===We||We>1&&3!==a.getItem(1).type)&&2===a.getItem(0).type){Xe=2;var nt=a.getItem(0).matrix,at=transformListToTransform(a,1).matrix,rt=at.inverse();je=matrixMultiply(rt,nt,at),a.removeItem(0)}else{if(1!==We||1!==a.getItem(0).type||De){if(Xe=4,De){var it=n.createSVGTransform();it.setRotate(De,S.x,S.y),a.numberOfItems?a.insertItemBefore(it,0):a.appendItem(it)}return 0===a.numberOfItems&&t.removeAttribute("transform"),null}switch(je=transformListToTransform(a).matrix,t.tagName){case"line":g=$$7(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(g.points=t.getAttribute("points"),g.points){var st=t.points,ot=st.numberOfItems;g.points=new Array(ot);for(var lt=0;lt0;)n.push(n.shift()),a--;var r=0;for(t in selectorManager_.selectorGrips)selectorManager_.selectorGrips[t].setAttribute("style","cursor:"+n[r]+"-resize"),r++}},{key:"showGrips",value:function(e){var t=e?"inline":"none";selectorManager_.selectorGripsGroup.setAttribute("display",t);var n=this.selectedElement;this.hasGrips=e,n&&e&&(this.selectorGroup.appendChild(selectorManager_.selectorGripsGroup),this.updateGripCursors(getRotationAngle(n)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=selectorManager_,a=n.selectorGrips,r=this.selectedElement,i=r.getAttribute("stroke-width"),s=svgFactory_.getCurrentZoom(),o=1/s;"none"===r.getAttribute("stroke")||isNaN(i)||(o+=i/2);var l=r.tagName;"text"===l&&(o+=2/s);var u=getTransformList(r),c=transformListToTransform(u).matrix;if(c.e*=s,c.f*=s,e||(e=getBBox(r)),"g"===l&&!$$8.data(r,"gsvg")){var h=getStrokedBBox([r.childNodes]);h&&(e=h)}var d=e.x,f=e.y,p=e.width,g=e.height;e={x:d,y:f,width:p,height:g},o*=s;var v=transformBox(d*s,f*s,p*s,g*s,c),m=v.aabox,y=m.x-o,b=m.y-o,_=m.width+2*o,x=m.height+2*o,C=y+_/2,S=b+x/2,w=getRotationAngle(r);if(w){var k=svgFactory_.svgRoot().createSVGTransform();k.setRotate(-w,C,S);var $=k.matrix;v.tl=transformPoint(v.tl.x,v.tl.y,$),v.tr=transformPoint(v.tr.x,v.tr.y,$),v.bl=transformPoint(v.bl.x,v.bl.y,$),v.br=transformPoint(v.br.x,v.br.y,$);var P=v.tl,E=P.x,A=P.y,T=P.x,N=P.y,G=Math.min,L=Math.max;y=E=G(E,G(v.tr.x,G(v.bl.x,v.br.x)))-o,b=A=G(A,G(v.tr.y,G(v.bl.y,v.br.y)))-o,_=(T=L(T,L(v.tr.x,L(v.bl.x,v.br.x)))+o)-E,x=(N=L(N,L(v.tr.y,L(v.bl.y,v.br.y)))+o)-A}var I="M"+y+","+b+" L"+(y+_)+","+b+" "+(y+_)+","+(b+x)+" "+y+","+(b+x)+"z";t.setAttribute("d",I);var M=w?"rotate("+[w,C,S].join(",")+")":"";for(var B in this.selectorGroup.setAttribute("transform",M),this.gripCoords={nw:[y,b],ne:[y+_,b],sw:[y,b+x],se:[y+_,b+x],n:[y+_/2,b],w:[y,b+x/2],e:[y+_,b+x/2],s:[y+_/2,b+x]},this.gripCoords){var O=this.gripCoords[B];a[B].setAttribute("cx",O[0]),a[B].setAttribute("cy",O[1])}n.rotateGripConnector.setAttribute("x1",y+_/2),n.rotateGripConnector.setAttribute("y1",b),n.rotateGripConnector.setAttribute("x2",y+_/2),n.rotateGripConnector.setAttribute("y2",b-5*gripRadius),n.rotateGrip.setAttribute("cx",y+_/2),n.rotateGrip.setAttribute("cy",b-5*gripRadius)}}]),e}(),SelectorManager=function(){function e(){classCallCheck(this,e),this.selectorParentGroup=null,this.rubberBandBox=null,this.selectors=[],this.selectorMap={},this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null},this.selectorGripsGroup=null,this.rotateGripConnector=null,this.rotateGrip=null,this.initGroup()}return createClass(e,[{key:"initGroup",value:function(){for(var e in this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup),this.selectorParentGroup=svgFactory_.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=svgFactory_.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.appendChild(this.selectorGripsGroup),svgFactory_.svgRoot().appendChild(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,this.selectorGrips){var t=svgFactory_.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+e,fill:"#22C",r:gripRadius,style:"cursor:"+e+"-resize","stroke-width":2,"pointer-events":"all"}});$$8.data(t,"dir",e),$$8.data(t,"type","resize"),this.selectorGrips[e]=this.selectorGripsGroup.appendChild(t)}if(this.rotateGripConnector=this.selectorGripsGroup.appendChild(svgFactory_.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(svgFactory_.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:gripRadius,stroke:"#22C","stroke-width":2,style:"cursor:url("+config_.imgPath+"rotate.png) 12 12, auto;"}})),$$8.data(this.rotateGrip,"type","rotate"),!$$8("#canvasBackground").length){var n=config_.dimensions,a=svgFactory_.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:n[0],height:n[1],x:0,y:0,overflow:isWebkit()?"none":"visible",style:"pointer-events:none"}}),r=svgFactory_.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});a.appendChild(r),svgFactory_.svgRoot().insertBefore(a,svgFactory_.svgContent())}}},{key:"requestSelector",value:function(e,t){if(null==e)return null;var n=this.selectors.length;if("object"===_typeof(this.selectorMap[e.id]))return this.selectorMap[e.id].locked=!0,this.selectorMap[e.id];for(var a=0;a').documentElement,!0);t.appendChild(o);var l=s.createElementNS(NS.SVG,"svg");(i.clearSvgContentElement=function(){$$9(l).empty(),$$9(l).attr({id:"svgcontent",width:r[0],height:r[1],x:r[0],y:r[1],overflow:a.show_outside_canvas?"visible":"hidden",xmlns:NS.SVG,"xmlns:se":NS.SE,"xmlns:xlink":NS.XLINK}).appendTo(o);var e=s.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");l.appendChild(e)})();var u="svg_";i.setIdPrefix=function(e){u=e},i.current_drawing_=new Drawing(l,u);var c=i.getCurrentDrawing=function(){return i.current_drawing_},h=1,d=null,f={shape:{fill:("none"===a.initFill.color?"":"#")+a.initFill.color,fill_paint:null,fill_opacity:a.initFill.opacity,stroke:"#"+a.initStroke.color,stroke_paint:null,stroke_opacity:a.initStroke.opacity,stroke_width:a.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:a.initOpacity}};f.text=$$9.extend(!0,{},f.shape),$$9.extend(f.text,{fill:"#000000",stroke_width:a.text&&a.text.stroke_width,font_size:a.text&&a.text.font_size,font_family:a.text&&a.text.font_family});var p=f.shape,g=[],v=this.getJsonFromSvgElement=function(e){if(3===e.nodeType)return e.nodeValue;for(var t,n={element:e.tagName,attr:{},children:[]},a=0;t=e.attributes[a];a++)n.attr[t.name]=t.value;for(var r,i=0;r=e.childNodes[i];i++)n.children[i]=v(r);return n},m=this.addSvgElementFromJson=function(e){if("string"==typeof e)return s.createTextNode(e);var t=getElem(e.attr.id),n=c().getCurrentLayer();return t&&e.element!==t.tagName&&(n.removeChild(t),t=null),t||(t=s.createElementNS(NS.SVG,e.element),n&&(d||n).appendChild(t)),e.curStyles&&assignAttributes(t,{fill:p.fill,stroke:p.stroke,"stroke-width":p.stroke_width,"stroke-dasharray":p.stroke_dasharray,"stroke-linejoin":p.stroke_linejoin,"stroke-linecap":p.stroke_linecap,"stroke-opacity":p.stroke_opacity,"fill-opacity":p.fill_opacity,opacity:p.opacity/2,style:"pointer-events:inherit"},100),assignAttributes(t,e.attr,100),cleanupElement(t),e.children&&e.children.forEach(function(e){t.appendChild(m(e))}),t};i.getTransformList=getTransformList,i.matrixMultiply=matrixMultiply,i.hasMatrixTransform=hasMatrixTransform,i.transformListToTransform=transformListToTransform,init({getBaseUnit:function(){return a.baseUnit},getElement:getElem,getHeight:function(){return l.getAttribute("height")/h},getWidth:function(){return l.getAttribute("width")/h},getRoundDigits:function(){return F.round_digits}}),i.convertToNum=convertToNum;var y=function(){return l},b=this.getSelectedElems=function(){return g},_=pathActions;init$2({pathActions:_,getSVGContent:y,addSvgElementFromJson:m,getSelectedElements:b,getDOMDocument:function(){return s},getDOMContainer:function(){return t},getSVGRoot:function(){return o},getBaseUnit:function(){return a.baseUnit},getSnappingStep:function(){return a.snappingStep}}),i.findDefs=findDefs,i.getUrlFromAttr=getUrlFromAttr,i.getHref=getHref,i.setHref=setHref,i.getBBox=getBBox,i.getRotationAngle=getRotationAngle,i.getElem=getElem,i.getRefElem=getRefElem,i.assignAttributes=assignAttributes,this.cleanupElement=cleanupElement;var x=function(){return a.gridSnapping};init$4({getDrawing:function(){return c()},getSVGRoot:function(){return o},getGridSnapping:x}),this.remapElement=remapElement,init$5({getSVGRoot:function(){return o},getStartTransform:function(){return Y},setStartTransform:function(e){Y=e}}),this.recalculateDimensions=recalculateDimensions;var C=getReverseNS();i.sanitizeSvg=sanitizeSvg;var S=i.undoMgr=new UndoManager$1({handleHistoryEvent:function(e,t){var n=HistoryEventTypes$1;if(e===n.BEFORE_UNAPPLY||e===n.BEFORE_APPLY)i.clearSelection();else if(e===n.AFTER_APPLY||e===n.AFTER_UNAPPLY){var a=t.elements();i.pathActions.clear(),T("changed",a);var r=t.type(),s=e===n.AFTER_APPLY;if(r===MoveElementCommand$1.type())(s?t.newParent:t.oldParent)===l&&identifyLayers();else if(r===InsertElementCommand$1.type()||r===RemoveElementCommand$1.type())t.parent===l&&identifyLayers(),r===InsertElementCommand$1.type()?s&&j(t.elem):s||j(t.elem),"use"===t.elem.tagName&&Ie(t.elem);else if(r===ChangeElementCommand$1.type()){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===l&&identifyLayers();var o=s?t.newValues:t.oldValues;o.stdDeviation&&i.setBlurOffsets(t.elem.parentNode,o.stdDeviation)}}}}),w=function(e){i.undoMgr.addCommandToHistory(e)},k=this.getZoom=function(){return h},$=this.round=function(e){return parseInt(e*h,10)/h};init$6(a,{createSVGElement:function(e){return i.addSvgElementFromJson(e)},svgRoot:function(){return o},svgContent:function(){return l},getCurrentZoom:k});var P=this.selectorManager=getSelectorManager(),E=i.getNextId=function(){return c().getNextId()},A=i.getId=function(){return c().getId()},T=function(e,t){if(oe[e])return oe[e](window,t)},N=function(e){g.map(function(e){null!=e&&P.releaseSelector(e)}),g=[],e||T("selected",g)},G=function(e,t){if(e.length){for(var n=0;n1&&s.showGrips(!1)}}}for(T("selected",g),t||1===g.length?P.requestSelector(g[0]).showGrips(!0):P.requestSelector(g[0]).showGrips(!1),g.sort(function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):null==e?1:void 0});null==g[0];)g.shift(0)}},L=function(){return p.opacity},I=this.getMouseTarget=function(e){if(null==e)return null;var n=e.target;if(n.correspondingUseElement&&(n=n.correspondingUseElement),[NS.MATH,NS.HTML].includes(n.namespaceURI)&&"svgcanvas"!==n.id)for(;"foreignObject"!==n.nodeName;)if(!(n=n.parentNode))return o;var a=c().getCurrentLayer();if([o,t,l,a].includes(n))return o;if($$9(n).closest("#selectorParentGroup").length)return P.selectorParentGroup;for(;n.parentNode!==(d||a);)n=n.parentNode;return n};i.pathActions=_,init$1({selectorManager:P,canvas:i,call:T,resetD:function(e){e.setAttribute("d",_.convertPath(e))},round:$,clearSelection:N,addToSelection:G,addCommandToHistory:w,remapElement:remapElement,addSvgElementFromJson:m,getGridSnapping:x,getOpacity:L,getSelectedElements:b,getContainer:function(){return t},setStarted:function(e){W=e},getRubberBox:function(){return ee},setRubberBox:function(e){return ee=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;_.canDeleteNodes=!0,_.closed_subpath=t,T("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;w(t),T("changed",[n])},getCurrentZoom:k,getId:A,getNextId:E,getMouseTarget:I,getCurrentMode:function(){return Q},setCurrentmode:function(e){return Q=e},getDrawnPath:function(){return Ae},setDrawnPath:function(e){return Ae=e},getSVGRoot:function(){return o}});var M={},B="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",O=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],V=$$9.data,R=document.createElementNS(NS.SVG,"animate");$$9(R).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(o);var j=function e(t){var n=$$9(t).attr(O);for(var a in n){var r=n[a];if(r&&r.startsWith("url(")){var i=getUrlFromAttr(r).substr(1);getElem(i)||(findDefs().appendChild(q[i]),delete q[i])}}var s=t.getElementsByTagName("*");if(s.length)for(var o=0,l=s.length;o0&&(4===l.getItem(0).type&&l.removeItem(0));if(0!==e){var u=transformPoint(i,s,transformListToTransform(l).matrix),c=o.createSVGTransform();c.setRotate(e,u.x,u.y),l.numberOfItems?l.insertItemBefore(c,0):l.appendItem(c)}else 0===l.numberOfItems&&n.removeAttribute("transform");if(!t){var h=n.getAttribute("transform");n.setAttribute("transform",a),Fe("transform",h,g),T("changed",g)}var d=P.requestSelector(g[0]);d.resize(),d.updateGripCursors(e)};var ue=this.recalculateAllSelectedDimensions=function(){for(var e=new BatchCommand$1("none"===Z?"position":"size"),t=g.length;t--;){var n=g[t],a=recalculateDimensions(n);a&&e.addSubCommand(a)}e.isEmpty()||(w(e),T("changed",g))},ce=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},he=null;this.clearSelection=N,this.addToSelection=G;var de=this.selectOnly=function(e,t){N(!0),G(e,t)};this.removeFromSelection=function(e){if(null!=g[0]&&e.length){var t=0,n=[],a=g.length;n.length=a;for(var r=0;r0&&i.removeFromSelection(N),G.length>0&&i.addToSelection(G);break;case"resize":k=getTransformList(p);var B=hasMatrixTransform(k),O=(f=B?be:getBBox(p)).x,V=f.y,R=f,j=R.width,D=R.height;if(l=C-ge,u=w-ve,a.gridSnapping&&(l=snapToGrid(l),u=snapToGrid(u),D=snapToGrid(D),j=snapToGrid(j)),d=getRotationAngle(p)){var F=Math.sqrt(l*l+u*u),U=Math.atan2(u,l)-d*Math.PI/180;l=F*Math.cos(U),u=F*Math.sin(U)}Z.includes("n")||Z.includes("s")||(u=0),Z.includes("e")||Z.includes("w")||(l=0);var H=0,z=0,q=D?(D+u)/D:1,X=j?(j+l)/j:1;Z.includes("n")&&(q=D?(D-u)/D:1,z=D),Z.includes("w")&&(X=j?(j-l)/j:1,H=j);var Y=o.createSVGTransform(),K=o.createSVGTransform(),J=o.createSVGTransform();if(a.gridSnapping&&(O=snapToGrid(O),H=snapToGrid(H),V=snapToGrid(V),z=snapToGrid(z)),Y.setTranslate(-(O+H),-(V+z)),e.shiftKey&&(1===X?X=q:q=X),K.setScale(X,q),J.setTranslate(O+H,V+z),B){var te=d?1:0;k.replaceItem(Y,2+te),k.replaceItem(K,1+te),k.replaceItem(J,Number(te))}else{var ne=k.numberOfItems;k.replaceItem(J,ne-3),k.replaceItem(K,ne-2),k.replaceItem(Y,ne-1)}P.requestSelector(p).resize(),T("transition",g);break;case"zoom":x*=h,S*=h,assignAttributes(ee,{x:Math.min(me*h,x),y:Math.min(ye*h,S),width:Math.abs(x-me*h),height:Math.abs(S-ye*h)},100);break;case"text":assignAttributes(b,{x:C,y:w},1e3);break;case"line":a.gridSnapping&&(C=snapToGrid(C),w=snapToGrid(w));var ie=C,se=w;e.shiftKey&&(ie=(n=snapToAngle(ge,ve,ie,se)).x,se=n.y),b.setAttributeNS(null,"x2",ie),b.setAttributeNS(null,"y2",se);break;case"foreignObject":case"square":case"rect":case"image":var oe="square"===Q||e.shiftKey,le=Math.abs(C-ge),ue=Math.abs(w-ve),ce=void 0,de=void 0;oe?(le=ue=Math.max(le,ue),ce=ge.8&&(pe+=+ke.x+","+ke.y+" ",b.setAttributeNS(null,"points",pe),_e-=.8);xe={x:Ce.x,y:Ce.y},Ce={x:Se.x,y:Se.y},Se={x:we.x,y:we.y};break;case"path":case"pathedit":if(C*=h,w*=h,a.gridSnapping&&(C=snapToGrid(C),w=snapToGrid(w),ge=snapToGrid(ge),ve=snapToGrid(ve)),e.shiftKey){var Ie=path,Me=void 0,Be=void 0;Ie?(Me=Ie.dragging?Ie.dragging[0]:ge,Be=Ie.dragging?Ie.dragging[1]:ve):(Me=ge,Be=ve);var Oe=n=snapToAngle(Me,Be,C,w);C=Oe.x,w=Oe.y}ee&&"none"!==ee.getAttribute("display")&&(x*=h,S*=h,assignAttributes(ee,{x:Math.min(me*h,x),y:Math.min(ye*h,S),width:Math.abs(x-me*h),height:Math.abs(S-ye*h)},100)),_.mouseMove(C,w);break;case"textedit":C*=h,w*=h,Te.mouseMove(m,y);break;case"rotate":r=(f=getBBox(p)).x+f.width/2,s=f.y+f.height/2;var Ve=getMatrix(p),Re=transformPoint(r,s,Ve);r=Re.x,s=Re.y,d=(Math.atan2(s-w,r-C)*(180/Math.PI)-90)%360,a.gridSnapping&&(d=snapToGrid(d)),e.shiftKey&&(d=45*Math.round(d/45)),i.setRotationAngle(d<-180?360+d:d,!0),T("transition",g)}ae("mouseMove",{event:e,mouse_x:m,mouse_y:y,selected:p})}}).click(function(e){return e.preventDefault(),!1}).dblclick(function(e){var t=e.target.parentNode;if(t!==d){var n=I(e),a=n.tagName;if("text"===a&&"textedit"!==Q){var r=transformPoint(e.pageX,e.pageY,he);Te.select(n,r.x,r.y)}"g"!==a&&"a"!==a||!getRotationAngle(n)||(Ue(n),n=g[0],N(!0)),d&&leaveContext(),"g"!==t.tagName&&"a"!==t.tagName||t===c().getCurrentLayer()||n===P.selectorParentGroup||setContext(n)}}).mouseup(function(e){if(2!==e.button){var t=J;if(J=null,W){var n=transformPoint(e.pageX,e.pageY,he),r=n.x*h,s=n.y*h,o=r/h,l=s/h,u=getElem(A()),d=!1,f=o,v=l;W=!1;var y=void 0,b=void 0;switch(Q){case"resize":case"multiselect":null!=ee&&(ee.setAttribute("display","none"),te=[]),Q="select";case"select":if(null!=g[0]){if(null==g[1]){var x=g[0];switch(x.tagName){case"g":case"use":case"image":case"foreignObject":break;default:K.fill=x.getAttribute("fill"),K.fill_opacity=x.getAttribute("fill-opacity"),K.stroke=x.getAttribute("stroke"),K.stroke_opacity=x.getAttribute("stroke-opacity"),K.stroke_width=x.getAttribute("stroke-width"),K.stroke_dasharray=x.getAttribute("stroke-dasharray"),K.stroke_linejoin=x.getAttribute("stroke-linejoin"),K.stroke_linecap=x.getAttribute("stroke-linecap")}"text"===x.tagName&&(H.font_size=x.getAttribute("font-size"),H.font_family=x.getAttribute("font-family")),P.requestSelector(x).showGrips(!0)}if(ue(),f!==me||v!==ye)for(var C=g.length,S=0;S=0?E.indexOf(",",N+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)&&(u=_.smoothPolylineIntoPath(u));break;case"line":y=$$9(u).attr(["x1","x2","y1","y2"]),d=y.x1!==y.x2||y.y1!==y.y2;break;case"foreignObject":case"square":case"rect":case"image":y=$$9(u).attr(["width","height"]),d="0"!==y.width||"0"!==y.height||"image"===Q;break;case"circle":d="0"!==u.getAttribute("r");break;case"ellipse":y=$$9(u).attr(["rx","ry"]),d=null!=y.rx||null!=y.ry;break;case"fhellipse":fe.maxx-fe.minx>0&&fe.maxy-fe.miny>0&&(u=m({element:"ellipse",curStyles:!0,attr:{cx:(fe.minx+fe.maxx)/2,cy:(fe.miny+fe.maxy)/2,rx:(fe.maxx-fe.minx)/2,ry:(fe.maxy-fe.miny)/2,id:A()}}),T("changed",[u]),d=!0);break;case"fhrect":fe.maxx-fe.minx>0&&fe.maxy-fe.miny>0&&(u=m({element:"rect",curStyles:!0,attr:{x:fe.minx,y:fe.miny,width:fe.maxx-fe.minx,height:fe.maxy-fe.miny,id:A()}}),T("changed",[u]),d=!0);break;case"text":d=!0,de([u]),Te.start(u);break;case"path":u=null,W=!0;var G=_.mouseUp(e,u,r,s);u=G.element,d=G.keep;break;case"pathedit":d=!0,u=null,_.mouseUp(e);break;case"textedit":d=!1,u=null,Te.mouseUp(e,r,s);break;case"rotate":d=!0,u=null,Q="select";var L=i.undoMgr.finishUndoableChange();L.isEmpty()||w(L),ue(),T("changed",g)}var I=ae("mouseUp",{event:e,mouse_x:r,mouse_y:s},!0);if($$9.each(I,function(e,t){t&&(d=t.keep||d,u=t.element,W=t.started||W)}),d||null==u){if(null!=u){i.addedNew=!0;var M=.2,B=void 0;if(R.beginElement&&parseFloat(u.getAttribute("opacity"))!==p.opacity){B=$$9(R).clone().attr({to:p.opacity,dur:M}).appendTo(u);try{B[0].beginElement()}catch(e){}}else M=0;setTimeout(function(){B&&B.remove(),u.setAttribute("opacity",p.opacity),u.setAttribute("style","pointer-events:inherit"),cleanupElement(u),"path"===Q?_.toEditMode(u):a.selectNew&&de([u],!0),w(new InsertElementCommand$1(u)),T("changed",[u])},1e3*M)}}else{for(c().releaseId(A()),u.parentNode.removeChild(u),u=null,b=e.target;b&&b.parentNode&&b.parentNode.parentNode&&"g"===b.parentNode.parentNode.tagName;)b=b.parentNode;"path"===Q&&Ae||!b||!b.parentNode||"selectorParentGroup"===b.parentNode.id||"svgcanvas"===b.id||"svgroot"===b.id||(i.setMode("select"),de([b],!0))}Y=null}}}),$$9(t).bind("mousewheel DOMMouseScroll",function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;he=$$9("#svgcontent g")[0].getScreenCTM().inverse();var n=$$9("#workarea"),r=a.showRulers?16:0,s=transformPoint(t.pageX,t.pageY,he),o=n.width(),l=n.height(),u=o-15-r,c=l-15-r,d=u*he.a,f=c*he.d,p=n.offset(),g=p.left+r,v=p.top+r,m=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(m){var y=Math.max(.75,Math.min(4/3,m)),b=void 0,_=void 0;y>1?(b=Math.ceil(u/d*y*100)/100,_=Math.ceil(c/f*y*100)/100):(b=Math.floor(u/d*y*100)/100,_=Math.floor(c/f*y*100)/100);var x=Math.min(b,_);if((x=Math.min(10,Math.max(.01,x)))!==h){y=x/h;var C=transformPoint(g,v,he),S={x:(s.x-(s.x-C.x)/y)*x-r+o/2,y:(s.y-(s.y-C.y)/y)*x-r+l/2};i.setZoom(x),$$9("#zoom").val((100*x).toFixed(1)),T("updateCanvas",{center:!1,newCtr:S}),T("zoomDone")}}}});var Te=i.textActions=function(){var e=void 0,t=void 0,n=void 0,a=void 0,r=void 0,s=[],l=void 0,u=void 0,c=void 0,d=void 0,f=void 0;function p(e){var i=""===t.value;if($$9(t).focus(),!arguments.length)if(i)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var o=s[e];i||t.setSelectionRange(e,e),(n=getElem("text_cursor"))||(n=document.createElementNS(NS.SVG,"line"),assignAttributes(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=getElem("selectorParentGroup").appendChild(n)),r||(r=setInterval(function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")},600));var u=x(o.x,l.y),c=x(o.x,l.y+l.height);assignAttributes(n,{x1:u.x,y1:u.y,x2:c.x,y2:c.y,visibility:"visible",display:"inline"}),a&&a.setAttribute("d","")}function v(e,r,i){if(e!==r){i||t.setSelectionRange(e,r),(a=getElem("text_selectblock"))||(a=document.createElementNS(NS.SVG,"path"),assignAttributes(a,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),getElem("selectorParentGroup").appendChild(a));var o=s[e],u=s[r];n.setAttribute("visibility","hidden");var c=x(o.x,l.y),h=x(o.x+(u.x-o.x),l.y),d=x(o.x,l.y+l.height),f=x(o.x+(u.x-o.x),l.y+l.height),g="M"+c.x+","+c.y+" L"+h.x+","+h.y+" "+f.x+","+f.y+" "+d.x+","+d.y+"z";assignAttributes(a,{d:g,display:"inline"})}else p(r)}function m(t,n){var a=o.createSVGPoint();if(a.x=t,a.y=n,1===s.length)return 0;var r=e.getCharNumAtPosition(a);r<0?(r=s.length-2,t<=s[0].x&&(r=0)):r>=s.length-2&&(r=s.length-2);var i=s[r];return t>i.x+i.width/2&&r++,r}function y(e,t){p(m(e,t))}function b(e,n,a){var r=t.selectionStart,i=m(e,n);v(Math.min(r,i),Math.max(r,i),!a)}function _(e,t){var n={x:e,y:t};if(n.x/=h,n.y/=h,u){var a=transformPoint(n.x,n.y,u.inverse());n.x=a.x,n.y=a.y}return n}function x(e,t){var n={x:e,y:t};if(u){var a=transformPoint(n.x,n.y,u);n.x=a.x,n.y=a.y}return n.x*=h,n.y*=h,n}function C(t){v(0,e.textContent.length),$$9(this).unbind(t)}function S(t){if(f&&e){var n=transformPoint(t.pageX,t.pageY,he),a=_(n.x*h,n.y*h),r=m(a.x,a.y),i=e.textContent,s=i.substr(0,r).replace(/[a-z0-9]+$/i,"").length,o=i.substr(r).match(/^[a-z0-9]+/i);v(s,(o?o[0].length:0)+r),$$9(t.target).click(C),setTimeout(function(){$$9(t.target).unbind("click",C)},300)}}return{select:function(t,n,a){e=t,Te.toEditMode(n,a)},start:function(t){e=t,Te.toEditMode()},mouseDown:function(e,n,a,r){var i=_(a,r);t.focus(),y(i.x,i.y),c=a,d=r},mouseMove:function(e,t){var n=_(e,t);b(n.x,n.y)},mouseUp:function(t,n,a){var r=_(n,a);b(r.x,r.y,!0),t.target!==e&&nc-2&&ad-2&&Te.toSelectMode(!0)},setCursor:p,toEditMode:function(t,n){if(f=!1,Q="textedit",P.requestSelector(e).showGrips(!1),P.requestSelector(e),Te.init(),$$9(e).css("cursor","text"),arguments.length){var a=_(t,n);y(a.x,a.y)}else p();setTimeout(function(){f=!0},300)},toSelectMode:function(s){Q="select",clearInterval(r),r=null,a&&$$9(a).attr("display","none"),n&&$$9(n).attr("visibility","hidden"),$$9(e).css("cursor","move"),s&&(N(),$$9(e).css("cursor","move"),T("selected",[e]),G([e],!0)),e&&!e.textContent.length&&i.deleteSelectedElements(),$$9(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===Q&&Te.toSelectMode()},init:function(n){if(e){var a=void 0,r=void 0;e.parentNode||(e=g[0],P.requestSelector(e).showGrips(!1));var o=e.textContent.length,c=e.getAttribute("transform");for(l=getBBox(e),u=c?getMatrix(e):null,(s=[]).length=o,t.focus(),$$9(e).unbind("dblclick",S).dblclick(S),o||(r={x:l.x+l.width/2,width:0}),a=0;a0&&void 0!==arguments[0]?arguments[0]:{}).codesOnly,t=void 0!==e&&e;N();var n=[],a={feGaussianBlur:M.exportNoBlur,foreignObject:M.exportNoforeignObject,"[stroke-dasharray]":M.exportNoDashArray},r=$$9(l);return"font"in $$9("")[0].getContext("2d")||(a.text=M.exportNoText),$$9.each(a,function(e,a){r.find(e).length&&n.push(t?e:a)}),n}this.svgCanvasToString=function(){for(;Ne()>0;);_.clear(!0),$$9.each(l.childNodes,function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&l.insertBefore(t,l.firstChild)}),d&&(leaveContext(),de([d]));var e=[];$$9(l).find("g:data(gsvg)").each(function(){for(var t=this.attributes,n=t.length,a=0;a=0;l--){o=s.item(l);var g=toXml(o.value);if(!p.includes(o.localName)&&""!==g){if(g.startsWith("pointer-events"))continue;if("class"===o.localName&&g.startsWith("se_"))continue;if(n.push(" "),"d"===o.localName&&(g=_.convertPath(e,!0)),isNaN(g)?i.test(g)&&(g=shortFloat(g)+r):g=shortFloat(g),F.apply&&"image"===e.nodeName&&"href"===o.localName&&F.images&&"embed"===F.images){var v=D[g];v&&(g=v)}o.namespaceURI&&o.namespaceURI!==NS.SVG&&!C[o.namespaceURI]||(n.push(o.nodeName),n.push('="'),n.push(g),n.push('"'))}}}if(e.hasChildNodes()){n.push(">"),t++;var m=!1;for(l=0;l");break;case 8:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("\x3c!--"),n.push(y.data),n.push("--\x3e")}}if(t--,!m)for(n.push("\n"),l=0;l")}else n.push("/>")}return n.join("")},this.embedImage=function(e,t){$$9(new Image).load(function(){var n=document.createElement("canvas");n.width=this.width,n.height=this.height,n.getContext("2d").drawImage(this,0,0);try{var a=";svgedit_url="+encodeURIComponent(e);a=n.toDataURL().replace(";base64",a+";base64"),D[e]=a}catch(t){D[e]=!1}X=e,t&&t(D[e])}).attr("src",e)},this.setGoodImage=function(e){X=e},this.open=function(){},this.save=function(e){N(),e&&$$9.extend(F,e),F.apply=!0;var t=this.svgCanvasToString();T("saved",t)},this.rasterExport=function(e,t,n){var a="image/"+e.toLowerCase(),r=Ge(),s=Ge({codesOnly:!0}),o=this.svgCanvasToString();buildCanvgCallback(function(){var l=e||"PNG";$$9("#export_canvas").length||$$9("",{id:"export_canvas"}).hide().appendTo("body");var u=$$9("#export_canvas")[0];u.width=i.contentW,u.height=i.contentH,canvg(u,o,{renderCallback:function(){var i=("ICO"===l?"BMP":l).toLowerCase(),c=t?u.toDataURL("image/"+i,t):u.toDataURL("image/"+i);if(u.toBlob)u.toBlob(function(i){var l=createObjectURL(i);T("exported",{datauri:c,bloburl:l,svg:o,issues:r,issueCodes:s,type:e,mimeType:a,quality:t,exportWindowName:n})},a,t);else{var h=dataURLToObjectURL(c);T("exported",{datauri:c,bloburl:h,svg:o,issues:r,issueCodes:s,type:e,mimeType:a,quality:t,exportWindowName:n})}}})})()},this.exportPDF=function(e,t){var n=this;buildJSPDFCallback(function(){var a=Oe(),r=a.w>a.h?"landscape":"portrait",i=jsPDF({orientation:r,unit:"pt",format:[a.w,a.h]}),s=Ve();i.setProperties({title:s});var o=Ge(),l=Ge({codesOnly:!0}),u=n.svgCanvasToString();i.addSVG(u,0,0);var c={svg:u,issues:o,issueCodes:l,exportWindowName:e},h=t||"dataurlstring";c[h]=i.output(h),T("exportedPDF",c)})()},this.getSvgString=function(){return F.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?randomizeIds(!1,c()):randomizeIds(!0,c())};var Le=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var a in walkTree(e,function(e){if(1===e.nodeType){e.id&&(e.id in t||(t[e.id]={elem:null,attrs:[],hrefs:[]}),t[e.id].elem=e),$$9.each(O,function(n,a){var r=e.getAttributeNode(a);if(r){var i=getUrlFromAttr(r.value),s=i?i.substr(1):null;s&&(s in t||(t[s]={elem:null,attrs:[],hrefs:[]}),t[s].attrs.push(r))}});var a=getHref(e);if(a&&n.includes(e.nodeName)){var r=a.substr(1);r&&(r in t||(t[r]={elem:null,attrs:[],hrefs:[]}),t[r].hrefs.push(e))}}}),t)if(a){var r=t[a].elem;if(r){var i=E();r.id=i;for(var s=t[a].attrs,o=s.length;o--;){var l=s[o];l.ownerElement.setAttribute(l.name,"url(#"+i+")")}for(var u=t[a].hrefs,c=u.length;c--;){var h=u[c];setHref(h,"#"+i)}}}},Ie=this.setUseData=function(e){var t=$$9(e);"use"!==e.tagName&&(t=t.find("use")),t.each(function(){var e=getHref(this).substr(1),t=getElem(e);t&&($$9(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||$$9(this).data("symbol",t).data("ref",t))})},Me=this.convertGradients=function(e){var t=$$9(e).find("linearGradient, radialGradient");!t.length&&isWebkit()&&(t=$$9(e).find("*").filter(function(){return this.tagName.includes("Gradient")})),t.each(function(){if("userSpaceOnUse"===$$9(this).attr("gradientUnits")){var e=$$9(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=getBBox(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=$$9(this).attr(["x1","y1","x2","y2"]),a=this.gradientTransform.baseVal;if(a&&a.numberOfItems>0){var r=transformListToTransform(a).matrix,i=transformPoint(n.x1,n.y1,r),s=transformPoint(n.x2,n.y2,r);n.x1=i.x,n.y1=i.y,n.x2=s.x,n.y2=s.y,this.removeAttribute("gradientTransform")}$$9(this).attr({x1:(n.x1-t.x)/t.width,y1:(n.y1-t.y)/t.height,x2:(n.x2-t.x)/t.width,y2:(n.y2-t.y)/t.height}),this.removeAttribute("gradientUnits")}}})},Be=this.convertToGroup=function(e){e||(e=g[0]);var t=$$9(e),n=new BatchCommand$1,a=void 0;if(t.data("gsvg")){var r=e.firstChild,i=$$9(r).attr(["x","y"]);$$9(e.firstChild.firstChild).unwrap(),$$9(e).removeData("gsvg");var u=getTransformList(e),c=o.createSVGTransform();c.setTranslate(i.x,i.y),u.appendItem(c),recalculateDimensions(e),T("selected",[e])}else if(t.data("symbol")){e=t.data("symbol"),a=t.attr("transform");var h=t.attr(["x","y"]),d=e.getAttribute("viewBox");if(d){var f=d.split(" ");h.x-=+f[0],h.y-=+f[1]}a+=" translate("+(h.x||0)+","+(h.y||0)+")";var p=t.prev();n.addSubCommand(new RemoveElementCommand$1(t[0],t[0].nextSibling,t[0].parentNode)),t.remove();var v=$$9(l).find("use:data(symbol)").length,m=s.createElementNS(NS.SVG,"g"),y=e.childNodes,b=void 0;for(b=0;bp?"scale("+y/3/m[3]+")":"scale("+y/3/m[2]+")")+" translate(0)",u=s.createElementNS(NS.SVG,"symbol");var b=findDefs();for(isGecko()&&$$9(f).find("linearGradient, radialGradient, pattern").appendTo(b);f.firstChild;){var _=f.firstChild;u.appendChild(_)}for(var x=f.attributes,C=0;C0&&(n?De(e,t,a):(Fe(e,t,a),T("changed",a)))};var Re=this.setGradient=function(e){if(K[e+"_paint"]&&"solidColor"!==K[e+"_paint"].type){var t=i[e+"Grad"],n=je(t),a=findDefs();n?t=n:(t=a.appendChild(s.importNode(t,!0))).id=E(),i.setColor(e,"url(#"+t.id+")")}},je=function(e){for(var t=findDefs(),n=$$9(t).find("linearGradient, radialGradient"),a=n.length,r=["r","cx","cy","fx","fy"];a--;){var i=n[a];if("linearGradient"===e.tagName){if(e.getAttribute("x1")!==i.getAttribute("x1")||e.getAttribute("y1")!==i.getAttribute("y1")||e.getAttribute("x2")!==i.getAttribute("x2")||e.getAttribute("y2")!==i.getAttribute("y2"))continue}else if("continue"===function(){var t=$$9(e).attr(r),n=$$9(i).attr(r),a=!1;if($$9.each(r,function(e,r){t[r]!==n[r]&&(a=!0)}),a)return"continue"}())continue;var s=e.getElementsByTagNameNS(NS.SVG,"stop"),o=i.getElementsByTagNameNS(NS.SVG,"stop");if(s.length===o.length){for(var l=s.length;l--;){var u=s[l],c=o[l];if(u.getAttribute("offset")!==c.getAttribute("offset")||u.getAttribute("stop-opacity")!==c.getAttribute("stop-opacity")||u.getAttribute("stop-color")!==c.getAttribute("stop-color"))break}if(-1===l)return i}}return null};this.setPaint=function(e,t){var n=new $$9.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),K[e+"_paint"]=n,n.type){case"solidColor":this.setColor(e,"none"!==n.solidColor?"#"+n.solidColor:"none");break;case"linearGradient":case"radialGradient":i[e+"Grad"]=n[n.type],Re(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return K.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(Q))i.setStrokeWidth(1);else{K.stroke_width=e;for(var t=[],n=g.length;n--;){var a=g[n];a&&("g"===a.tagName?walkTree(a,r):t.push(a))}t.length>0&&(Fe("stroke-width",e,t),T("changed",g))}function r(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){p[e.replace("-","_")]=t;for(var n=[],a=g.length;a--;){var r=g[a];r&&("g"===r.tagName?walkTree(r,function(e){"g"!==e.nodeName&&n.push(e)}):n.push(r))}n.length>0&&(Fe(e,t,n),T("changed",g))},this.getStyle=function(){return p},this.getOpacity=L,this.setOpacity=function(e){p.opacity=e,Fe("opacity",e)},this.getFillOpacity=function(){return p.fill_opacity},this.getStrokeOpacity=function(){return p.stroke_opacity},this.setPaintOpacity=function(e,t,n){p[e+"_opacity"]=t,n?De(e+"-opacity",t):Fe(e+"-opacity",t)},this.getPaintOpacity=function(e){return"fill"===e?this.getFillOpacity():this.getStrokeOpacity()},this.getBlur=function(e){var t=0;if(e&&e.getAttribute("filter")){var n=getElem(e.id+"_blur");n&&(t=n.firstChild.getAttribute("stdDeviation"))}return t},function(){var e=null,t=null,n=!1;function a(){var n=i.undoMgr.finishUndoableChange();e.addSubCommand(n),w(e),e=null,t=null}i.setBlurNoUndo=function(e){if(t)if(0===e)De("filter",""),n=!0;else{var a=g[0];n&&De("filter","url(#"+a.id+"_blur)"),isWebkit()&&(console.log("e",a),a.removeAttribute("filter"),a.setAttribute("filter","url(#"+a.id+"_blur)")),De("stdDeviation",e,[t.firstChild]),i.setBlurOffsets(t,e)}else i.setBlur(e)},i.setBlurOffsets=function(e,t){t>3?assignAttributes(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100):isWebkit()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},i.setBlur=function(n,r){if(e)a();else{var s=g[0],o=s.id;t=getElem(o+"_blur"),n-=0;var l=new BatchCommand$1;if(t)0===n&&(t=null);else{var u=m({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=m({element:"filter",attr:{id:o+"_blur"}})).appendChild(u),findDefs().appendChild(t),l.addSubCommand(new InsertElementCommand$1(t))}var c={filter:s.getAttribute("filter")};if(0===n)return s.removeAttribute("filter"),void l.addSubCommand(new ChangeElementCommand$1(s,c));Fe("filter","url(#"+o+"_blur)"),l.addSubCommand(new ChangeElementCommand$1(s,c)),i.setBlurOffsets(t,n),e=l,i.undoMgr.beginUndoableChange("stdDeviation",[t?t.firstChild:null]),r&&(i.setBlurNoUndo(n),a())}}}(),this.getBold=function(){var e=g[0];return null!=e&&"text"===e.tagName&&null==g[1]&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=g[0];null!=t&&"text"===t.tagName&&null==g[1]&&Fe("font-weight",e?"bold":"normal"),g[0].textContent||Te.setCursor()},this.getItalic=function(){var e=g[0];return null!=e&&"text"===e.tagName&&null==g[1]&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=g[0];null!=t&&"text"===t.tagName&&null==g[1]&&Fe("font-style",e?"italic":"normal"),g[0].textContent||Te.setCursor()},this.getFontFamily=function(){return H.font_family},this.setFontFamily=function(e){H.font_family=e,Fe("font-family",e),g[0]&&!g[0].textContent&&Te.setCursor()},this.setFontColor=function(e){H.fill=e,Fe("fill",e)},this.getFontColor=function(){return H.fill},this.getFontSize=function(){return H.font_size},this.setFontSize=function(e){H.font_size=e,Fe("font-size",e),g[0].textContent||Te.setCursor()},this.getText=function(){var e=g[0];return null==e?"":e.textContent},this.setTextContent=function(e){Fe("#text",e),Te.init(e),Te.setCursor()},this.setImageURL=function(e){var t=g[0];if(t){var n=$$9(t).attr(["width","height"]),a=!n.width||!n.height,r=getHref(t);if(r!==e)a=!0;else if(!a)return;var i=new BatchCommand$1("Change Image URL");setHref(t,e),i.addSubCommand(new ChangeElementCommand$1(t,{"#href":r})),a?$$9(new Image).load(function(){var e=$$9(t).attr(["width","height"]);$$9(t).attr({width:this.width,height:this.height}),P.requestSelector(t).resize(),i.addSubCommand(new ChangeElementCommand$1(t,e)),w(i),T("changed",[t])}).attr("src",e):w(i)}},this.setLinkURL=function(e){var t=g[0];if(t){if("a"!==t.tagName){var n=$$9(t).parents("a");if(!n.length)return;t=n[0]}var a=getHref(t);if(a!==e){var r=new BatchCommand$1("Change Link URL");setHref(t,e),r.addSubCommand(new ChangeElementCommand$1(t,{"#href":a})),w(r)}}},this.setRectRadius=function(e){var t=g[0];if(null!=t&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),w(new ChangeElementCommand$1(t,{rx:n,ry:n},"Radius")),T("changed",[t]))}},this.makeHyperlink=function(e){i.groupSelectedElements("a",e)},this.removeHyperlink=function(){i.ungroupSelectedElement()},this.setSegType=function(e){_.setSegType(e)},this.convertToPath=function(e,t){if(null!=e){if(t)return getBBoxOfElementAsPath(e,m,_);var n={fill:p.fill,"fill-opacity":p.fill_opacity,stroke:p.stroke,"stroke-width":p.stroke_width,"stroke-dasharray":p.stroke_dasharray,"stroke-linejoin":p.stroke_linejoin,"stroke-linecap":p.stroke_linecap,"stroke-opacity":p.stroke_opacity,opacity:p.opacity,visibility:"hidden"};return convertToPath(e,n,m,_,N,G,history,w)}var a=g;$$9.each(a,function(e,t){t&&i.convertToPath(t)})};var De=function(e,t,n){"pathedit"===Q&&_.moveNode(e,t);for(var a=(n=n||g).length,r=["g","polyline","path"],s=["transform","opacity","filter"],l=function(){var l=n[a];if(null==l)return"continue";if(("x"===e||"y"===e)&&r.includes(l.tagName)){var u=getStrokedBBoxDefaultVisible([l]),c="x"===e?t-u.x:0,d="y"===e?t-u.y:0;return i.moveSelectedElements(c*h,d*h,!0),"continue"}"g"===l.tagName&&s.includes(e);var f="#text"===e?l.textContent:l.getAttribute(e);if(null==f&&(f=""),f!==String(t)){"#text"===e?(l.textContent=t,/rotate/.test(l.getAttribute("transform"))&&(l=le(l))):"#href"===e?setHref(l,t):l.setAttribute(e,t),"textedit"===Q&&"#text"!==e&&l.textContent.length&&Te.toSelectMode(l),isGecko()&&"text"===l.nodeName&&/rotate/.test(l.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&l.textContent)&&(l=le(l)),g.includes(l)&&setTimeout(function(){l.parentNode&&P.requestSelector(l).resize()},0);var p=getRotationAngle(l);if(0!==p&&"transform"!==e)for(var v=getTransformList(l),m=v.numberOfItems;m--;){if(4===v.getItem(m).type){v.removeItem(m);var y=getBBox(l),b=transformPoint(y.x+y.width/2,y.y+y.height/2,transformListToTransform(v).matrix),_=b.x,x=b.y,C=o.createSVGTransform();C.setRotate(p,_,x),v.insertItemBefore(C,m);break}}}};a--;)l()},Fe=this.changeSelectedAttribute=function(e,t,n){n=n||g,i.undoMgr.beginUndoableChange(e,n),De(e,t,n);var a=i.undoMgr.finishUndoableChange();a.isEmpty()||w(a)};this.deleteSelectedElements=function(){for(var e=new BatchCommand$1("Delete Elements"),t=g.length,n=[],a=0;a1&&(a=t);break;default:e="g",n="Group Elements"}var r=new BatchCommand$1(n),i=m({element:e,attr:{id:E()}});"a"===e&&setHref(i,a),r.addSubCommand(new InsertElementCommand$1(i));for(var s=g.length;s--;){var o=g[s];if(null!=o){"a"===o.parentNode.tagName&&1===o.parentNode.childNodes.length&&(o=o.parentNode);var l=o.nextSibling,u=o.parentNode;i.appendChild(o),r.addSubCommand(new MoveElementCommand$1(o,l,u))}}r.isEmpty()||w(r),de([i],!0)};var Ue=this.pushGroupProperties=function(e,t){for(var n=e.childNodes,a=n.length,r=e.getAttribute("transform"),s=getTransformList(e),l=transformListToTransform(s).matrix,u=new BatchCommand$1("Push group properties"),h=getRotationAngle(e),d=$$9(e).attr(["filter","opacity"]),f=void 0,p=void 0,g=void 0,v=c(),m=0;mn[h].width)||("t"===e||"m"===e||"b"===e)&&(c===Number.MIN_VALUE||c>n[h].height))&&(r=n[h].x,o=n[h].y,s=n[h].x+n[h].width,l=n[h].y+n[h].height,u=n[h].width,c=n[h].height);break;case"largest":(("l"===e||"c"===e||"r"===e)&&(u===Number.MIN_VALUE||us&&(s=n[h].x+n[h].width),n[h].y+n[h].height>l&&(l=n[h].y+n[h].height)}}"page"===t&&(r=0,o=0,s=i.contentW,l=i.contentH);for(var f=new Array(a),p=new Array(a),v=0;v=r.length?t=0:t<0&&(t=r.length-1),a=r[t];break}de([a],!0),T("selected",g)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:w,setGradient:Re,addSvgElementFromJson:m,assignAttributes:assignAttributes,BatchCommand:BatchCommand$1,buildCanvgCallback:buildCanvgCallback,call:T,canvg:canvg,ChangeElementCommand:ChangeElementCommand$1,copyElem:function(e){return c().copyElem(e)},decode64:decode64,encode64:encode64,executeAfterLoads:executeAfterLoads,ffClone:le,findDefs:findDefs,findDuplicateGradient:je,getElem:getElem,getId:A,getIntersectionList:re,getMouseTarget:I,getNextId:E,getPathBBox:getPathBBox,getTypeMap:getTypeMap,getUrlFromAttr:getUrlFromAttr,hasMatrixTransform:hasMatrixTransform,identifyLayers:identifyLayers,InsertElementCommand:InsertElementCommand$1,isChrome:isChrome,isIdentity:isIdentity,isIE:isIE,logMatrix:ce,matrixMultiply:matrixMultiply,MoveElementCommand:MoveElementCommand$1,NS:NS,preventClickDefault:preventClickDefault,recalculateAllSelectedDimensions:ue,recalculateDimensions:recalculateDimensions,remapElement:remapElement,RemoveElementCommand:RemoveElementCommand$1,removeUnusedDefElems:Ne,round:$,runExtensions:ae,sanitizeSvg:sanitizeSvg,SVGEditTransformList:SVGTransformList,text2xml:text2xml,toString:toString,transformBox:transformBox,transformListToTransform:transformListToTransform,transformPoint:transformPoint,walkTree:walkTree}}};function jqPluginJSHotkeys(e){function t(t){if("string"==typeof t.data){var n=t.handler,a=t.data.toLowerCase().split(" ");t.handler=function(t){if(this===t.target||!/textarea|select/i.test(t.target.nodeName)&&"text"!==t.target.type){var r="keypress"!==t.type&&e.hotkeys.specialKeys[t.which],i=String.fromCharCode(t.which).toLowerCase(),s="",o={};t.altKey&&"alt"!==r&&(s+="alt+"),t.ctrlKey&&"ctrl"!==r&&(s+="ctrl+"),t.metaKey&&!t.ctrlKey&&"meta"!==r&&(s+="meta+"),t.shiftKey&&"shift"!==r&&(s+="shift+"),r?o[s+r]=!0:(o[s+i]=!0,o[s+e.hotkeys.shiftNums[i]]=!0,"shift+"===s&&(o[e.hotkeys.shiftNums[i]]=!0));for(var l=0,u=a.length;l","/":"?","\\":"|"}},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:t}}),e}function jqPluginBBQ(e){return function(e,t){var n,a,r,i,s,o,l,u,c=Array.prototype.slice,h=decodeURIComponent,d=e.param,f=e.bbq=e.bbq||{},p=e.event.special,g="hashchange",v="querystring",m="fragment",y="elemUrlAttr",b="location",_="href",x="src",C=/^.*\?|#.*$/g,S=/^.*\#/,w={};function k(e){return"string"==typeof e}function $(e){var t=c.call(arguments,1);return function(){return e.apply(this,t.concat(c.call(arguments)))}}function P(a,i,s,o,l){var c,f,p,g,y;return o!==n?(y=(p=s.match(a?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/))[3]||"",2===l&&k(o)?f=o.replace(a?S:C,""):(g=r(p[2]),o=k(o)?r[a?m:v](o):o,f=2===l?o:1===l?e.extend({},o,g):e.extend({},g,o),f=d(f),a&&(f=f.replace(u,h))),c=p[1]+(a?"#":f||!p[1]?"?":"")+f+y):c=i(s!==n?s:t[b][_]),c}function E(e,t,a){return t===n||"boolean"==typeof t?(a=t,t=d[e?m:v]()):t=k(t)?t.replace(e?S:C,""):t,r(t,a)}function A(t,a,r,i){return k(r)||"object"===(void 0===r?"undefined":_typeof(r))||(i=r,r=a,a=n),this.each(function(){var n=e(this),s=a||l()[(this.nodeName||"").toLowerCase()]||"",o=s&&n.attr(s)||"";n.attr(s,d[t](o,r,i))})}d[v]=$(P,0,function(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}),d[m]=a=$(P,1,function(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}),a.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);u=new RegExp(n.join("|"),"g")},a.noEscape(",/"),e.deparam=r=function(t,a){var r={},i={true:!0,false:!1,null:null};return e.each(t.replace(/\+/g," ").split("&"),function(t,s){var o,l=s.split("="),u=h(l[0]),c=r,d=0,f=u.split("]["),p=f.length-1;if(/\[/.test(f[0])&&/\]$/.test(f[p])?(f[p]=f[p].replace(/\]$/,""),p=(f=f.shift().split("[").concat(f)).length-1):p=0,2===l.length)if(o=h(l[1]),a&&(o=o&&!isNaN(o)?+o:"undefined"===o?n:i[o]!==n?i[o]:o),p)for(;d<=p;d++)c=c[u=""===f[d]?c.length:f[d]]=d').hide().insertAfter("body")[0].contentWindow,l=function(){return d(a.document[i][o])},(r=function(e,t){if(e!==t){var n=a.document;n.open().close(),n[i].hash="#"+e}})(d()))),function a(){var c=d(),h=l(u);c!==u?(r(u=c,h),e(t).trigger(s)):h!==u&&(t[i][o]=t[i][o].replace(/#.*/,"")+"#"+h),n=setTimeout(a,e[s+"Delay"])}()}},u.stop=function(){a||(n&&clearTimeout(n),n=0)},u}()}(e,window),e}function jqPluginSVGIcons(e){var t={},n=void 0;return e.svgIcons=function(a,r){var i="http://www.w3.org/2000/svg",s="http://www.w3.org/1999/xlink",o=r.w||24,l=r.h||24,u=void 0,c=void 0,h=void 0,d=!1,f=!1,p=0,g=!!window.opera,v="data:image/svg+xml;charset=utf-8;base64,",m=void 0;if(r.svgz){m=e('').appendTo("body").hide();try{c=m[0].contentDocument,m.load(b),b(0,!0)}catch(e){w()}}else{var y=new DOMParser;e.ajax({url:a,dataType:"string",success:function(t){t?(c=y.parseFromString(t,"text/xml"),e(function(){b("ajax")})):e(w)},error:function(t){window.opera?e(function(){w()}):t.responseText?((c=y.parseFromString(t.responseText,"text/xml")).childNodes.length||e(w),e(function(){b("ajax")})):e(w)}})}function b(t,n){if("ajax"!==t){if(f)return;var a=(c=m[0].contentDocument)&&c.getElementById("svg_eof");if(!(a||n&&a))return void(++p<50?setTimeout(b,20):(w(),f=!0));f=!0}if(u=e(c.firstChild).children(),r.no_img)setTimeout(function(){d||S()},500);else{var i=v+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";h=e(new Image).attr({src:i,width:0,height:0}).appendTo("body").load(function(){S(!0)}).error(function(){S()})}}var _=function(e,t,n,a){if(g&&t.css("visibility","hidden"),r.replace){a&&t.attr("id",n);var i=e.attr("class");i&&t.attr("class","svg_icon "+i),e.replaceWith(t)}else e.append(t);g&&setTimeout(function(){t.removeAttr("style")},1)},x=void 0,C=function(e,n){void 0!==r.id_match&&!1===r.id_match||_(x,e,n,!0),t[n]=e};function S(a,c){if(!d){r.no_img&&(a=!1);var f=void 0;if(a&&(f=e(document.createElement("div"))).hide().appendTo("body"),c){var p=r.fallback_path||"";e.each(c,function(t,n){x=e("#"+t);var a=e(new Image).attr({class:"svg_icon",src:p+n,width:o,height:l,alt:"icon"});C(a,t)})}else for(var y=u.length,b=0;b0&&!a&&(s=n(s,r,!0)),_(e(this),s,i)})}),c||(a&&f.remove(),m&&m.remove(),h&&h.remove()),r.resize&&e.resizeSvgIcons(r.resize),d=!0,r.callback&&r.callback(t)}}function w(){if(a.includes(".svgz")){var t=a.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg"),e.svgIcons(t,r)}else r.fallback&&S(!1,r.fallback)}function k(e){if(window.btoa)return window.btoa(e);var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=new Array(4*Math.floor((e.length+2)/3)),a=0,r=0;do{var i=e.charCodeAt(a++),s=e.charCodeAt(a++),o=e.charCodeAt(a++),l=i>>2,u=(3&i)<<4|s>>4,c=(15&s)<<2|o>>6,h=63&o;isNaN(s)?c=h=64:isNaN(o)&&(h=64),n[r++]=t.charAt(l),n[r++]=t.charAt(u),n[r++]=t.charAt(c),n[r++]=t.charAt(h)}while(a
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var d=e(o+"> .jGraduate_colPick"),f=e(o+"> .jGraduate_gradPick");f.html('

    '+i.window.pickerTitle+'


    ');var p=256,g=p-0,v=p-0,m={};e(".jGraduate_SliderBar").width(145);var y=e("#"+s+"_jGraduate_GradContainer")[0],b=n("svg",{id:s+"_jgraduate_svg",width:p,height:p,xmlns:ns.svg},y),_=r.paint.type,x=r.paint[_],C=x,S=r.paint.alpha,w="solidColor"===_;switch(_){case"solidColor":case"linearGradient":if(w||(C.id=s+"_lg_jgraduate_grad",x=C=b.appendChild(C)),n("radialGradient",{id:s+"_rg_jgraduate_grad"},b),"linearGradient"===_)break;case"radialGradient":w||(C.id=s+"_rg_jgraduate_grad",x=C=b.appendChild(C)),n("linearGradient",{id:s+"_lg_jgraduate_grad"},b)}var k=void 0;if(w){x=C=e("#"+s+"_lg_jgraduate_grad")[0],Ne(0,"#"+(c=r.paint[_]),1);var $=_typeof(i.newstop);if("string"===$)switch(i.newstop){case"same":Ne(1,"#"+c,1);break;case"inverse":for(var P="",E=0;E<6;E+=2){var A=(255-parseInt(c.substr(E,2),16)).toString(16);A.length<2&&(A=0+A),P+=A}Ne(1,"#"+P,1);break;case"white":Ne(1,"#ffffff",1);break;case"black":Ne(1,"#000000",1)}else if("object"===$){var T="opac"in i.newstop?i.newstop.opac:1;Ne(1,i.newstop.color||"#"+c,T)}}var N=parseFloat(x.getAttribute("x1")||0),G=parseFloat(x.getAttribute("y1")||0),L=parseFloat(x.getAttribute("x2")||1),I=parseFloat(x.getAttribute("y2")||0),M=parseFloat(x.getAttribute("cx")||.5),B=parseFloat(x.getAttribute("cy")||.5),O=parseFloat(x.getAttribute("fx")||M),V=parseFloat(x.getAttribute("fy")||B),R=n("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:g,height:v,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":S/100},b),j=e("
    ").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:G*p,left:N*p}).data("coord","start").appendTo(y),D=j.clone().text(2).css({top:I*p,left:L*p}).attr("title","End stop").data("coord","end").appendTo(y),F=e("
    ").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:B*p,left:M*p}).data("coord","center").appendTo(y),U=F.clone().text("F").css({top:V*p,left:O*p,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(y);U[0].id=s+"_jGraduate_focusCoord";var H=void 0;e.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(t,n){var a=isNaN(n[1]),r=C.getAttribute(n);r||(r=a?"0.5":"x2"===n?"1.0":"0.0"),m[n]=e("#"+s+"_jGraduate_"+n).val(r).change(function(){isNaN(parseFloat(this.value))||this.value<0?this.value=0:this.value>1&&(this.value=1),("f"!==n[0]||H)&&(a&&"radialGradient"===_||!a&&"linearGradient"===_)&&C.setAttribute(n,this.value);var e=a?"c"===n[0]?F:U:"1"===n[1]?j:D,t=n.includes("x")?"left":"top";e.css(t,this.value*p)}).change()});var z=e("#"+s+"_jGraduate_StopSlider"),q=void 0,X=void 0,W=void 0,Y=n("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},void 0),Q=void 0,Z=1,K=1,J=0,ee=M,te=B,ne=n("svg",{width:"100%",height:45},z[0]),ae=n("image",{width:16,height:16},n("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ne)),re=i.images.clientPath+"map-opacity.png";ae.setAttributeNS(ns.xlink,"xlink:href",re),e(ne).click(function(e){if(Q=z.offset(),"path"!==e.target.tagName){var t=e.pageX-Q.left-8;Ne((t=t<10?10:t>p+10?p+10:t)/p,0,0,!0),e.stopPropagation()}}),e(ne).mouseover(function(){ne.appendChild(Y)}),k=n("g",{},ne),n("line",{x1:10,y1:15,x2:p+10,y2:15,"stroke-width":2,stroke:"#000"},ne);var ie=f.find(".jGraduate_spreadMethod").change(function(){C.setAttribute("spreadMethod",e(this).val())}),se=null,oe=function(e){var t=e.pageX-he.left,n=e.pageY-he.top;t=t<0?0:t>p?p:t,n=n<0?0:n>p?p:n,se.css("left",t).css("top",n);var a=t/g,r=n/v,i=se.data("coord"),s=C;switch(i){case"start":m.x1.val(a),m.y1.val(r),s.setAttribute("x1",a),s.setAttribute("y1",r);break;case"end":m.x2.val(a),m.y2.val(r),s.setAttribute("x2",a),s.setAttribute("y2",r);break;case"center":m.cx.val(a),m.cy.val(r),s.setAttribute("cx",a),s.setAttribute("cy",r),ee=a,te=r,Ie();break;case"focus":m.fx.val(a),m.fy.val(r),s.setAttribute("fx",a),s.setAttribute("fy",r),Ie()}e.preventDefault()},le=function e(){se=null,h.unbind("mousemove",oe).unbind("mouseup",e)},ue=(q=C.getElementsByTagNameNS(ns.svg,"stop")).length;if(ue<2){for(;ue<2;)C.appendChild(document.createElementNS(ns.svg,"stop")),++ue;q=C.getElementsByTagNameNS(ns.svg,"stop")}for(var ce=0;ce99.5&&(n=99.5),n>0?K=1-n/100:Z=-n/100-1,i=(n+100)/2*145/100,e&&Ie();break;case"angle":i=(J=n)/180,i+=.5,i*=145,e&&Ie()}i>145?i=145:i<0&&(i=0),a.css({"margin-left":i-5})}).change()});for(var $e=function(e){!function(e){var t=pe.offset,n=pe.parent,a=e.pageX-t.left-parseInt(n.css("border-left-width"));a>145&&(a=145),a<=0&&(a=0);var i=a-5;switch(a/=145,pe.type){case"radius":(a=Math.pow(2*a,2.5))>.98&&a<1.02&&(a=1),a<=.01&&(a=.01),C.setAttribute("r",a);break;case"opacity":r.paint.alpha=parseInt(100*a),R.setAttribute("fill-opacity",a);break;case"ellip":Z=1,K=1,a<.5?Z=(a/=.5)<=0?.01:a:a>.5&&(K=(a=2-(a/=.5))<=0?.01:a),Ie(),K===1+(a-=1)&&(a=Math.abs(a));break;case"angle":a-=.5,J=a*=180,Ie(),a/=100}pe.elem.css({"margin-left":i}),a=Math.round(100*a),pe.input.val(a)}(e),e.preventDefault()},Pe=function e(t){h.unbind("mousemove",$e).unbind("mouseup",e),pe=null},Ee=(255*r.paint.alpha/100).toString(16);Ee.length<2;)Ee="0"+Ee;Ee=Ee.split(".")[0],c="none"===r.paint.solidColor?"":r.paint.solidColor+Ee,w||(c=q[0].getAttribute("stop-color")),e.extend(e.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),d.jPicker({window:{title:i.window.pickerTitle},images:{clientPath:i.images.clientPath},color:{active:c,alphaSupport:!0}},function(e){r.paint.type="solidColor",r.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,r.paint.solidColor=e.val("hex")?e.val("hex"):"none",r.paint.radialGradient=null,l()},null,function(){u()});var Ae=e(o+" .jGraduate_tabs li");Ae.click(function(){Ae.removeClass("jGraduate_tab_current"),e(this).addClass("jGraduate_tab_current"),e(o+" > div").hide();var t=e(this).attr("data-type");if(e(o+" .jGraduate_gradPick").show(),"rg"===t||"lg"===t){e(".jGraduate_"+t+"_field").show(),e(".jGraduate_"+("lg"===t?"rg":"lg")+"_field").hide(),e("#"+s+"_jgraduate_rect")[0].setAttribute("fill","url(#"+s+"_"+t+"_jgraduate_grad)"),_="lg"===t?"linearGradient":"radialGradient",e("#"+s+"_jGraduate_OpacInput").val(r.paint.alpha).change();var n=e("#"+s+"_"+t+"_jgraduate_grad")[0];if(C!==n){var a=e(C).find("stop");e(n).empty().append(a),C=n;var i=ie.val();C.setAttribute("spreadMethod",i)}H="rg"===t&&null!=C.getAttribute("fx")&&!(M===O&&B===V),e("#"+s+"_jGraduate_focusCoord").toggle(H),H&&(e("#"+s+"_jGraduate_match_ctr")[0].checked=!1)}else e(o+" .jGraduate_gradPick").hide(),e(o+" .jGraduate_colPick").show()}),e(o+" > div").hide(),Ae.removeClass("jGraduate_tab_current");var Te=void 0;switch(r.paint.type){case"linearGradient":Te=e(o+" .jGraduate_tab_lingrad");break;case"radialGradient":Te=e(o+" .jGraduate_tab_radgrad");break;default:Te=e(o+" .jGraduate_tab_color")}r.show(),setTimeout(function(){Te.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Ne(t,a,r,o,l){var u=l||n("stop",{"stop-color":a,"stop-opacity":r,offset:t},C);l?(a=l.getAttribute("stop-color"),r=l.getAttribute("stop-opacity"),t=l.getAttribute("offset")):C.appendChild(u),null===r&&(r=1);var c="M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",d=n("path",{d:c,fill:"url(#jGraduate_trans)",transform:"translate("+(10+t*p)+", 26)"},k),f=n("path",{d:c,fill:a,"fill-opacity":r,transform:"translate("+(10+t*p)+", 26)",stroke:"#000","stroke-width":1.5},k);return e(f).mousedown(function(e){return Ge(this),W=X,h.mousemove(Me).mouseup(Le),Q=z.offset(),e.preventDefault(),!1}).data("stop",u).data("bg",d).dblclick(function(){e("div.jGraduate_LightBox").show();for(var t=this,n=+u.getAttribute("stop-opacity")||1,r=u.getAttribute("stop-color")||1,o=(255*parseFloat(n)).toString(16);o.length<2;)o="0"+o;a=r.substr(1)+o,e("#"+s+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:i.images.clientPath},color:{active:a,alphaSupport:!0}},function(a,i){r=a.val("hex")?"#"+a.val("hex"):"none",n=null!==a.val("a")?a.val("a")/256:1,t.setAttribute("fill",r),t.setAttribute("fill-opacity",n),u.setAttribute("stop-color",r),u.setAttribute("stop-opacity",n),e("div.jGraduate_LightBox").hide(),e("#"+s+"_jGraduate_stopPicker").hide()},null,function(){e("div.jGraduate_LightBox").hide(),e("#"+s+"_jGraduate_stopPicker").hide()})}),e(C).find("stop").each(function(){var n=e(this);if(+this.getAttribute("offset")>t){if(!a){var r=this.getAttribute("stop-color"),i=this.getAttribute("stop-opacity");u.setAttribute("stop-color",r),f.setAttribute("fill",r),u.setAttribute("stop-opacity",null===i?1:i),f.setAttribute("fill-opacity",null===i?1:i)}return n.before(u),!1}}),o&&Ge(f),u}function Ge(e){X&&X.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),(X=e).parentNode.appendChild(X)}function Le(){h.unbind("mousemove",Me),"none"!==Y.getAttribute("display")&&function(){Y.setAttribute("display","none");var t=e(X),n=t.data("stop"),a=t.data("bg");e([X,n,a]).remove()}(),W=null}function Ie(){var e=J?"rotate("+J+","+ee+","+te+") ":"";if(1===Z&&1===K)C.removeAttribute("gradientTransform");else{var t=-ee*(Z-1),n=-te*(K-1);C.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+Z+","+K+")")}}function Me(t){var n=t.pageX-Q.left,a=t.pageY-Q.top,r="translate("+(n=n<10?10:n>p+10?p+10:n)+", 26)";a<-60||a>130?(Y.setAttribute("display","block"),Y.setAttribute("transform",r)):Y.setAttribute("display","none"),W.setAttribute("transform",r),e.data(W,"bg").setAttribute("transform",r);var i=e.data(W,"stop"),s=(n-10)/p;i.setAttribute("offset",s);var o=0;e(C).find("stop").each(function(t){var n=this.getAttribute("offset"),a=e(this);nn(s,"offsetLeft")+s.offsetWidth*o-this.spinCfg._btn_width?i=120?this.adjustValue(this.spinCfg.step):e.wheelDelta<=-120&&this.adjustValue(-this.spinCfg.step),e.preventDefault()}).change(function(e){this.adjustValue(0)}),this.addEventListener&&this.addEventListener("DOMMouseScroll",function(e){e.detail>0?this.adjustValue(-this.spinCfg.step):e.detail<0&&this.adjustValue(this.spinCfg.step),e.preventDefault()},!1)})},e}function jqPluginContextMenu(e){var t=e(window),n=e(document);return e.extend(e.fn,{contextMenu:function(a,r){return void 0!==a.menu&&(void 0===a.inSpeed&&(a.inSpeed=150),void 0===a.outSpeed&&(a.outSpeed=75),0===a.inSpeed&&(a.inSpeed=-1),0===a.outSpeed&&(a.outSpeed=-1),e(this).each(function(){var i=e(this),s=e(i).offset(),o=e("#"+a.menu);o.addClass("contextMenu"),e(this).bind("mousedown",function(l){var u=l;e(this).mouseup(function(l){var c=e(this);if(c.unbind("mouseup"),2===u.button||a.allowLeft||u.ctrlKey&&isMac()){if(l.stopPropagation(),e(".contextMenu").hide(),i.hasClass("disabled"))return!1;var h=l.pageX,d=l.pageY,f=t.width()-o.width(),p=t.height()-o.height();h>f-15&&(h=f-15),d>p-30&&(d=p-30),n.unbind("click"),o.css({top:d,left:h}).fadeIn(a.inSpeed),o.find("A").mouseover(function(){o.find("LI.hover").removeClass("hover"),e(this).parent().addClass("hover")}).mouseout(function(){o.find("LI.hover").removeClass("hover")}),n.keypress(function(e){switch(e.keyCode){case 38:o.find("LI.hover").length?(o.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"),o.find("LI.hover").length||o.find("LI:last").addClass("hover")):o.find("LI:last").addClass("hover");break;case 40:o.find("LI.hover").length?(o.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover"),o.find("LI.hover").length||o.find("LI:first").addClass("hover")):o.find("LI:first").addClass("hover");break;case 13:o.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}}),o.find("A").unbind("mouseup"),o.find("LI:not(.disabled) A").mouseup(function(){return n.unbind("click").unbind("keypress"),e(".contextMenu").hide(),r&&r(e(this).attr("href").substr(1),e(c),{x:h-s.left,y:d-s.top,docX:h,docY:d}),!1}),setTimeout(function(){n.click(function(){return n.unbind("click").unbind("keypress"),o.fadeOut(a.outSpeed),!1})},0)}})}),e.browser.mozilla?e("#"+a.menu).each(function(){e(this).css({MozUserSelect:"none"})}):e.browser.msie?e("#"+a.menu).each(function(){e(this).bind("selectstart.disableTextSelect",function(){return!1})}):e("#"+a.menu).each(function(){e(this).bind("mousedown.disableTextSelect",function(){return!1})}),e(i).add(e("UL.contextMenu")).bind("contextmenu",function(){return!1})}),e(this))},disableContextMenuItems:function(t){return void 0===t?(e(this).find("LI").addClass("disabled"),e(this)):(e(this).each(function(){if(void 0!==t)for(var n=t.split(","),a=0;an&&(i=n),s<0?s=0:s>r&&(s=r),l.call(a,"xy",{x:i/n*v+p,y:s/r*b+m})}function l(e,t,n){if(!(void 0!==t))switch(void 0!==e&&null!=e||(e="xy"),e.toLowerCase()){case"x":return d;case"y":return f;case"xy":default:return{x:d,y:f}}if(null==n||n!==a){var r=!1,i=void 0,s=void 0;switch(null==e&&(e="xy"),e.toLowerCase()){case"x":i=t&&(t.x&&0|t.x||0|t)||0;break;case"y":s=t&&(t.y&&0|t.y||0|t)||0;break;case"xy":default:i=t&&t.x&&0|t.x||0,s=t&&t.y&&0|t.y||0}null!=i&&(ig&&(i=g),d!==i&&(d=i,r=!0)),null!=s&&(sy&&(s=y),f!==s&&(f=s,r=!0)),r&&function(e){for(var t=0;t0&&(i=d===g?e:d/v*e|0),b>0&&(s=f===y?n:f/b*n|0),a>=e?i=(e>>1)-(a>>1):i-=a>>1,r>=n?s=(n>>1)-(r>>1):s-=r>>1,_.css({left:i+"px",top:s+"px"})},0)})}e.loadingStylesheets.includes("jgraduate/css/jPicker.css")||e.loadingStylesheets.push("jgraduate/css/jPicker.css"),e.jPicker={List:[],Color:function t(n){classCallCheck(this,t);var a=this;function r(e){for(var t=0;t255&&(b.r=255),o!==b.r&&(o=b.r,m=!0);break;case"g":if(x)continue;_=!0,b.g=t&&t.g&&0|t.g||t&&0|t||0,b.g<0?b.g=0:b.g>255&&(b.g=255),l!==b.g&&(l=b.g,m=!0);break;case"b":if(x)continue;_=!0,b.b=t&&t.b&&0|t.b||t&&0|t||0,b.b<0?b.b=0:b.b>255&&(b.b=255),u!==b.b&&(u=b.b,m=!0);break;case"a":b.a=t&&null!=t.a?0|t.a:null!=t?0|t:255,b.a<0?b.a=0:b.a>255&&(b.a=255),c!==b.a&&(c=b.a,m=!0);break;case"h":if(_)continue;x=!0,b.h=t&&t.h&&0|t.h||t&&0|t||0,b.h<0?b.h=0:b.h>360&&(b.h=360),h!==b.h&&(h=b.h,m=!0);break;case"s":if(_)continue;x=!0,b.s=t&&null!=t.s?0|t.s:null!=t?0|t:100,b.s<0?b.s=0:b.s>100&&(b.s=100),d!==b.s&&(d=b.s,m=!0);break;case"v":if(_)continue;x=!0,b.v=t&&null!=t.v?0|t.v:null!=t?0|t:100,b.v<0?b.v=0:b.v>100&&(b.v=100),f!==b.v&&(f=b.v,m=!0)}if(m){if(_){o=o||0,l=l||0,u=u||0;var S=i.rgbToHsv({r:o,g:l,b:u});h=S.h,d=S.s,f=S.v}else if(x){h=h||0,d=null!=d?d:100,f=null!=f?f:100;var w=i.hsvToRgb({h:h,s:d,v:f});o=w.r,l=w.g,u=w.b}c=null!=c?c:255,r.call(a,n||a)}}}}var o=void 0,l=void 0,u=void 0,c=void 0,h=void 0,d=void 0,f=void 0,p=[];e.extend(!0,a,{val:s,bind:function(e){"function"==typeof e&&p.push(e)},unbind:function(e){if("function"==typeof e)for(var t=void 0;t=p.includes(e);)p.splice(t,1)},destroy:function(){p=null}}),n&&(null!=n.ahex?s("ahex",n):null!=n.hex?s((null!=n.a?"a":"")+"hex",null!=n.a?{ahex:n.hex+i.intToHex(n.a)}:n):null!=n.r&&null!=n.g&&null!=n.b?s("rgb"+(null!=n.a?"a":""),n):null!=n.h&&null!=n.s&&null!=n.v&&s("hsv"+(null!=n.a?"a":""),n))},ColorMethods:{hexToRgba:function(e){if(""===e||"none"===e)return{r:null,g:null,b:null,a:null};var t="00",n="00",a="00",r="255";return 6===(e=this.validateHex(e)).length&&(e+="ff"),e.length>6?(t=e.substring(0,2),n=e.substring(2,4),a=e.substring(4,6),r=e.substring(6,e.length)):(e.length>4&&(t=e.substring(4,e.length),e=e.substring(0,4)),e.length>2&&(n=e.substring(2,e.length),e=e.substring(0,2)),e.length>0&&(a=e.substring(0,e.length))),{r:this.hexToInt(t),g:this.hexToInt(n),b:this.hexToInt(a),a:this.hexToInt(r)}},validateHex:function(e){return(e=e.toLowerCase().replace(/[^a-f0-9]/g,"")).length>8&&(e=e.substring(0,8)),e},rgbaToHex:function(e){return this.intToHex(e.r)+this.intToHex(e.g)+this.intToHex(e.b)+this.intToHex(e.a)},intToHex:function(e){var t=(0|e).toString(16);return 1===t.length&&(t="0"+t),t.toLowerCase()},hexToInt:function(e){return parseInt(e,16)},rgbToHsv:function(e){var t=e.r/255,n=e.g/255,a=e.b/255,r={h:0,s:0,v:0},i=0,s=0;t>=n&&t>=a?(s=t,i=n>a?a:n):n>=a&&n>=t?(s=n,i=t>a?a:t):(s=a,i=n>t?t:n),r.v=s,r.s=s?(s-i)/s:0;var o=void 0;return r.s?(o=s-i,r.h=t===s?(n-a)/o:n===s?2+(a-t)/o:4+(t-n)/o,r.h=parseInt(60*r.h),r.h<0&&(r.h+=360)):r.h=0,r.s=100*r.s|0,r.v=100*r.v|0,r},hsvToRgb:function(e){var t={r:0,g:0,b:0,a:100},n=e.h,a=e.s,r=e.v;if(0===a)t.r=t.g=t.b=0===r?0:255*r/100|0;else{360===n&&(n=0);var i=0|(n/=60),s=n-i,o=(r/=100)*(1-(a/=100)),l=r*(1-a*s),u=r*(1-a*(1-s));switch(i){case 0:t.r=r,t.g=u,t.b=o;break;case 1:t.r=l,t.g=r,t.b=o;break;case 2:t.r=o,t.g=r,t.b=u;break;case 3:t.r=o,t.g=l,t.b=r;break;case 4:t.r=u,t.g=o,t.b=r;break;case 5:t.r=r,t.g=o,t.b=l}t.r=255*t.r|0,t.g=255*t.g|0,t.b=255*t.b|0}return t}}};var n=e.jPicker,a=n.Color,r=n.List,i=n.ColorMethods;return e.fn.jPicker=function(n){var s=arguments;return this.each(function(){var o=this,l=e.extend(!0,{},e.fn.jPicker.defaults,n);"input"===e(o).get(0).nodeName.toLowerCase()&&(e.extend(!0,l,{window:{bindToInput:!0,expandable:!0,input:e(o)}}),""===e(o).val()?(l.color.active=new a({hex:null}),l.color.current=new a({hex:null})):i.validateHex(e(o).val())&&(l.color.active=new a({hex:e(o).val(),a:l.color.active.val("a")}),l.color.current=new a({hex:e(o).val(),a:l.color.active.val("a")}))),l.window.expandable?e(o).after('    '):l.window.liveUpdate=!1;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function c(e){var t=M.active,n=t.val("hex"),a=void 0,r=void 0;switch(l.color.mode=e,e){case"h":if(setTimeout(function(){p.call(o,D,"transparent"),v.call(o,U,0),m.call(o,U,100),v.call(o,H,260),m.call(o,H,100),p.call(o,F,"transparent"),v.call(o,q,0),m.call(o,q,100),v.call(o,X,260),m.call(o,X,100),v.call(o,W,260),m.call(o,W,100),v.call(o,Y,260),m.call(o,Y,100),v.call(o,Z,260),m.call(o,Z,100)},0),K.range("all",{minX:0,maxX:100,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:360}),null==t.val("ahex"))break;K.val("xy",{x:t.val("s"),y:100-t.val("v")},K),J.val("y",360-t.val("h"),J);break;case"s":if(setTimeout(function(){p.call(o,D,"transparent"),v.call(o,U,-260),v.call(o,H,-520),v.call(o,q,-260),v.call(o,X,-520),v.call(o,Z,260),m.call(o,Z,100)},0),K.range("all",{minX:0,maxX:360,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;K.val("xy",{x:t.val("h"),y:100-t.val("v")},K),J.val("y",100-t.val("s"),J);break;case"v":if(setTimeout(function(){p.call(o,D,"000000"),v.call(o,U,-780),v.call(o,H,260),p.call(o,F,n),v.call(o,q,-520),v.call(o,X,260),m.call(o,X,100),v.call(o,Z,260),m.call(o,Z,100)},0),K.range("all",{minX:0,maxX:360,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;K.val("xy",{x:t.val("h"),y:100-t.val("s")},K),J.val("y",100-t.val("v"),J);break;case"r":if(a=-1040,r=-780,K.range("all",{minX:0,maxX:255,minY:0,maxY:255}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;K.val("xy",{x:t.val("b"),y:255-t.val("g")},K),J.val("y",255-t.val("r"),J);break;case"g":if(a=-1560,r=-1820,K.range("all",{minX:0,maxX:255,minY:0,maxY:255}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;K.val("xy",{x:t.val("b"),y:255-t.val("r")},K),J.val("y",255-t.val("g"),J);break;case"b":if(a=-2080,r=-2860,K.range("all",{minX:0,maxX:255,minY:0,maxY:255}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;K.val("xy",{x:t.val("r"),y:255-t.val("g")},K),J.val("y",255-t.val("b"),J);break;case"a":if(setTimeout(function(){p.call(o,D,"transparent"),v.call(o,U,-260),v.call(o,H,-520),v.call(o,q,260),v.call(o,X,260),m.call(o,X,100),v.call(o,Z,0),m.call(o,Z,100)},0),K.range("all",{minX:0,maxX:360,minY:0,maxY:100}),J.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;K.val("xy",{x:t.val("h"),y:100-t.val("v")},K),J.val("y",255-t.val("a"),J);break;default:throw new Error("Invalid Mode")}switch(e){case"h":break;case"s":case"v":case"a":setTimeout(function(){m.call(o,U,100),m.call(o,q,100),v.call(o,W,260),m.call(o,W,100),v.call(o,Y,260),m.call(o,Y,100)},0);break;case"r":case"g":case"b":setTimeout(function(){p.call(o,D,"transparent"),p.call(o,F,"transparent"),m.call(o,q,100),m.call(o,U,100),v.call(o,U,a),v.call(o,H,a-260),v.call(o,q,r-780),v.call(o,X,r-520),v.call(o,W,r),v.call(o,Y,r-260),v.call(o,Z,260),m.call(o,Z,100)},0)}null!=t.val("ahex")&&h.call(o,t)}function h(e,t){(null==t||t!==J&&t!==K)&&function(e,t){if(t!==K)switch(l.color.mode){case"h":var n=e.val("sv");K.val("xy",{x:null!=n?n.s:100,y:100-(null!=n?n.v:100)},t);break;case"s":case"a":var a=e.val("hv");K.val("xy",{x:a&&a.h||0,y:100-(null!=a?a.v:100)},t);break;case"v":var r=e.val("hs");K.val("xy",{x:r&&r.h||0,y:100-(null!=r?r.s:100)},t);break;case"r":var i=e.val("bg");K.val("xy",{x:i&&i.b||0,y:255-(i&&i.g||0)},t);break;case"g":var s=e.val("br");K.val("xy",{x:s&&s.b||0,y:255-(s&&s.r||0)},t);break;case"b":var o=e.val("rg");K.val("xy",{x:o&&o.r||0,y:255-(o&&o.g||0)},t)}if(t!==J)switch(l.color.mode){case"h":J.val("y",360-(e.val("h")||0),t);break;case"s":var u=e.val("s");J.val("y",100-(null!=u?u:100),t);break;case"v":var c=e.val("v");J.val("y",100-(null!=c?c:100),t);break;case"r":J.val("y",255-(e.val("r")||0),t);break;case"g":J.val("y",255-(e.val("g")||0),t);break;case"b":J.val("y",255-(e.val("b")||0),t);break;case"a":var h=e.val("a");J.val("y",255-(null!=h?h:255),t)}}.call(o,e,t),setTimeout(function(){(function(e){try{var t=e.val("all");te.css({backgroundColor:t&&"#"+t.hex||"transparent"}),m.call(o,te,t&&Math.precision(100*t.a/255,4)||0)}catch(e){}}).call(o,e),function(e){switch(l.color.mode){case"h":p.call(o,D,new a({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");m.call(o,H,100-(null!=t?t:100));break;case"v":var n=e.val("v");m.call(o,U,null!=n?n:100);break;case"r":m.call(o,H,Math.precision((e.val("r")||0)/255*100,4));break;case"g":m.call(o,H,Math.precision((e.val("g")||0)/255*100,4));break;case"b":m.call(o,H,Math.precision((e.val("b")||0)/255*100))}var r=e.val("a");m.call(o,z,Math.precision(100*(255-(r||0))/255,4))}.call(o,e),function(e){switch(l.color.mode){case"h":var t=e.val("a");m.call(o,Q,Math.precision(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),r=new a({h:n&&n.h||0,s:100,v:null!=n?n.v:100});p.call(o,F,r.val("hex")),m.call(o,X,100-(null!=n?n.v:100)),m.call(o,Q,Math.precision(100*(255-(n&&n.a||0))/255,4));break;case"v":var i=e.val("hsa"),s=new a({h:i&&i.h||0,s:null!=i?i.s:100,v:100});p.call(o,F,s.val("hex")),m.call(o,Q,Math.precision(100*(255-(i&&i.a||0))/255,4));break;case"r":case"g":case"b":var u=e.val("rgba"),c=0,h=0;"r"===l.color.mode?(c=u&&u.b||0,h=u&&u.g||0):"g"===l.color.mode?(c=u&&u.b||0,h=u&&u.r||0):"b"===l.color.mode&&(c=u&&u.r||0,h=u&&u.g||0);var d=h>c?c:h;m.call(o,X,c>h?Math.precision((c-h)/(255-h)*100,4):0),m.call(o,W,h>c?Math.precision((h-c)/(255-c)*100,4):0),m.call(o,Y,Math.precision(d/255*100,4)),m.call(o,Q,Math.precision(100*(255-(u&&u.a||0))/255,4));break;case"a":var f=e.val("a");p.call(o,F,e.val("hex")||"000000"),m.call(o,Q,null!=f?0:100),m.call(o,Z,null!=f?100:0)}}.call(o,e)},0)}function d(e,t){var n=M.active;if(t===K||null!=n.val()){var a=e.val("all");switch(l.color.mode){case"h":n.val("sv",{s:a.x,v:100-a.y},t);break;case"s":case"a":n.val("hv",{h:a.x,v:100-a.y},t);break;case"v":n.val("hs",{h:a.x,s:100-a.y},t);break;case"r":n.val("gb",{g:255-a.y,b:a.x},t);break;case"g":n.val("rb",{r:255-a.y,b:a.x},t);break;case"b":n.val("rg",{r:a.x,g:255-a.y},t)}}}function f(e,t){var n=M.active;if(t===J||null!=n.val())switch(l.color.mode){case"h":n.val("h",{h:360-e.val("y")},t);break;case"s":n.val("s",{s:100-e.val("y")},t);break;case"v":n.val("v",{v:100-e.val("y")},t);break;case"r":n.val("r",{r:255-e.val("y")},t);break;case"g":n.val("g",{g:255-e.val("y")},t);break;case"b":n.val("b",{b:255-e.val("y")},t);break;case"a":n.val("a",255-e.val("y"),t)}}function p(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function g(e,t){u&&(t.includes("AlphaBar.png")||t.includes("Bars.png")||t.includes("Maps.png"))?(e.attr("pngSrc",t),e.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+t+"', sizingMethod='scale')"})):e.css({backgroundImage:"url('"+t+"')"})}function v(e,t){e.css({top:t+"px"})}function m(e,t){if(e.css({visibility:t>0?"visible":"hidden"}),t>0&&t<100)if(u){var n=e.attr("pngSrc");null!=n&&(n.includes("AlphaBar.png")||n.includes("Bars.png")||n.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+n+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+t+")"}):e.css({opacity:Math.precision(t/100,4)})}else e.css({opacity:Math.precision(t/100,4)});else if(0===t||100===t)if(u){var a=e.attr("pngSrc");null!=a&&(a.includes("AlphaBar.png")||a.includes("Bars.png")||a.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a+"', sizingMethod='scale')"}):e.css({opacity:""})}else e.css({opacity:""})}function y(){M.active.val("ahex",M.current.val("ahex"))}function b(t){e(this).parents("tbody:first").find('input:radio[value!="'+t.target.value+'"]').removeAttr("checked"),c.call(o,t.target.value)}function _(){y.call(o)}function x(){y.call(o),l.window.expandable&&N.call(o),"function"==typeof de&&de.call(o,M.active,re)}function C(){(function(){M.current.val("ahex",M.active.val("ahex"))}).call(o),l.window.expandable&&N.call(o),"function"==typeof ce&&ce.call(o,M.active,ae)}function S(){T.call(o)}function w(e,t){var n=e.val("hex");ne.css({backgroundColor:n&&"#"+n||"transparent"}),m.call(o,ne,Math.precision(100*(e.val("a")||0)/255,4))}function k(e,t){var n=e.val("hex"),a=e.val("va");se.css({backgroundColor:n&&"#"+n||"transparent"}),m.call(o,oe,Math.precision(100*(255-(a&&a.a||0))/255,4)),l.window.bindToInput&&l.window.updateInputColor&&l.window.input.css({backgroundColor:n&&"#"+n||"transparent",color:null==a||a.v>75?"#000000":"#ffffff"})}function $(t){B=parseInt(j.css("left")),O=parseInt(j.css("top")),V=t.pageX,R=t.pageY,e(document).bind("mousemove",P).bind("mouseup",E),t.preventDefault()}function P(t){return j.css({left:B-(V-t.pageX)+"px",top:O-(R-t.pageY)+"px"}),l.window.expandable&&!e.support.boxModel&&j.prev().css({left:j.css("left"),top:j.css("top")}),t.stopPropagation(),t.preventDefault(),!1}function E(t){return e(document).unbind("mousemove",P).unbind("mouseup",E),t.stopPropagation(),t.preventDefault(),!1}function A(t){return t.preventDefault(),t.stopPropagation(),M.active.val("ahex",e(this).attr("title")||null,t.target),!1}function T(){function t(){if(l.window.expandable&&!e.support.boxModel){var t=j.find("table:first");j.before("