diff --git a/dist/index-es.js b/dist/index-es.js
index fa7eb943..6230f7a4 100644
--- a/dist/index-es.js
+++ b/dist/index-es.js
@@ -9607,6 +9607,94 @@ function importModule(url) {
});
}
+/**
+ * Created by alexey2baranov on 28.01.17.
+ */
+
+/*
+ An extraction of the deparam method from Ben Alman's jQuery BBQ
+ http://benalman.com/projects/jquery-bbq-plugin/
+ */
+var coerce_types = {
+ 'true': !0,
+ 'false': !1,
+ 'null': null
+};
+
+function deparam(params, coerce) {
+ // console.log(params)
+ var obj = {}; // Iterate over all name=value pairs.
+
+ params.replace(/\+/g, ' ').split('&').forEach(function (v) {
+ var param = v.split('=');
+ var key = decodeURIComponent(param[0]),
+ // If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it
+ // into its component parts.
+ keys = key.split(']['),
+ keys_last = keys.length - 1; // If the first keys part contains [ and the last ends with ], then []
+ // are correctly balanced.
+
+ if (/\[/.test(keys[0]) && /\]$/.test(keys[keys_last])) {
+ // Remove the trailing ] from the last keys part.
+ keys[keys_last] = keys[keys_last].replace(/\]$/, ''); // Split first keys part into two parts on the [ and add them back onto
+ // the beginning of the keys array.
+
+ keys = keys.shift().split('[').concat(keys);
+ keys_last = keys.length - 1;
+ } else {
+ // Basic 'foo' style key.
+ keys_last = 0;
+ } // Are we dealing with a name=value pair, or just a name?
+
+
+ if (param.length >= 2) {
+ var val = decodeURIComponent(param.slice(1).join('=')); // Coerce values.
+
+ if (coerce) {
+ val = val && !isNaN(val) ? +val // number
+ : val === 'undefined' ? undefined // undefined
+ : coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
+ : val; // string
+ }
+
+ if (keys_last) {
+ var cur = obj; // Complex key, build deep object structure based on a few rules:
+ // * The 'cur' pointer starts at the object top-level.
+ // * [] = array push (n is set to array length), [n] = array if n is
+ // numeric, otherwise object.
+ // * If at the last keys part, set the value.
+ // * For each keys part, if the current level is undefined create an
+ // object or array based on the type of the next keys part.
+ // * Move the 'cur' pointer to the next level.
+ // * Rinse & repeat.
+
+ for (var i = 0; i <= keys_last; i++) {
+ key = keys[i] === '' ? cur.length : keys[i];
+ cur = cur[key] = i < keys_last ? cur[key] || (keys[i + 1] && isNaN(keys[i + 1]) ? {} : []) : val;
+ }
+ } else {
+ // Simple key, even simpler rules, since only scalars and shallow
+ // arrays are allowed.
+ if (Array.isArray(obj[key])) {
+ // val is already an array, so push on the next value.
+ obj[key].push(val);
+ } else if (obj[key] !== undefined) {
+ // val isn't an array, but since a second value has been specified,
+ // convert val into an array.
+ obj[key] = [obj[key], val];
+ } else {
+ // val is a scalar.
+ obj[key] = val;
+ }
+ }
+ } else if (key) {
+ // No value was defined, so set something meaningful.
+ obj[key] = coerce ? undefined : '';
+ }
+ });
+ return obj;
+}
+
/**
* @module jQueryPluginDBox
*/
@@ -21961,366 +22049,6 @@ function jQueryPluginJSHotkeys (b) {
return b;
}
-/*
- * Todo: Update to latest at https://github.com/cowboy/jquery-bbq ?
- * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
- * http://benalman.com/projects/jquery-bbq-plugin/
- *
- * Copyright (c) 2010 "Cowboy" Ben Alman
- * Dual licensed under the MIT and GPL licenses.
- * http://benalman.com/about/license/
- */
-// For sake of modules, added this wrapping export and changed `this` to `window`
-function jQueryPluginBBQ (jQuery) {
- (function ($, p) {
- var i,
- m = Array.prototype.slice,
- r = decodeURIComponent,
- a = $.param,
- c,
- l,
- v,
- b = $.bbq = $.bbq || {},
- q,
- u,
- j,
- e = $.event.special,
- d = "hashchange",
- A = "querystring",
- D = "fragment",
- y = "elemUrlAttr",
- g = "location",
- k = "href",
- t = "src",
- x = /^.*\?|#.*$/g,
- w = /^.*\#/,
- h,
- C = {};
-
- function E(F) {
- return typeof F === "string";
- }
-
- function B(G) {
- var F = m.call(arguments, 1);
- return function () {
- return G.apply(this, F.concat(m.call(arguments)));
- };
- }
-
- function n(F) {
- return F.replace(/^[^#]*#?(.*)$/, "$1");
- }
-
- function o(F) {
- return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/, "$1");
- }
-
- function f(H, M, F, I, G) {
- var O, L, K, N, J;
-
- if (I !== i) {
- K = F.match(H ? /^([^#]*)\#?(.*)$/ : /^([^#?]*)\??([^#]*)(#?.*)/);
- J = K[3] || "";
-
- if (G === 2 && E(I)) {
- L = I.replace(H ? w : x, "");
- } else {
- N = l(K[2]);
- I = E(I) ? l[H ? D : A](I) : I;
- L = G === 2 ? I : G === 1 ? $.extend({}, I, N) : $.extend({}, N, I);
- L = a(L);
-
- if (H) {
- L = L.replace(h, r);
- }
- }
-
- O = K[1] + (H ? "#" : L || !K[1] ? "?" : "") + L + J;
- } else {
- O = M(F !== i ? F : p[g][k]);
- }
-
- return O;
- }
-
- a[A] = B(f, 0, o);
- a[D] = c = B(f, 1, n);
-
- c.noEscape = function (G) {
- G = G || "";
- var F = $.map(G.split(""), encodeURIComponent);
- h = new RegExp(F.join("|"), "g");
- };
-
- c.noEscape(",/");
-
- $.deparam = l = function l(I, F) {
- var H = {},
- G = {
- "true": !0,
- "false": !1,
- "null": null
- };
- $.each(I.replace(/\+/g, " ").split("&"), function (L, Q) {
- var K = Q.split("="),
- P = r(K[0]),
- J,
- O = H,
- M = 0,
- R = P.split("]["),
- N = R.length - 1;
-
- if (/\[/.test(R[0]) && /\]$/.test(R[N])) {
- R[N] = R[N].replace(/\]$/, "");
- R = R.shift().split("[").concat(R);
- N = R.length - 1;
- } else {
- N = 0;
- }
-
- if (K.length === 2) {
- J = r(K[1]);
-
- if (F) {
- J = J && !isNaN(J) ? +J : J === "undefined" ? i : G[J] !== i ? G[J] : J;
- }
-
- if (N) {
- for (; M <= N; M++) {
- P = R[M] === "" ? O.length : R[M];
- O = O[P] = M < N ? O[P] || (R[M + 1] && isNaN(R[M + 1]) ? {} : []) : J;
- }
- } else {
- if ($.isArray(H[P])) {
- H[P].push(J);
- } else {
- if (H[P] !== i) {
- H[P] = [H[P], J];
- } else {
- H[P] = J;
- }
- }
- }
- } else {
- if (P) {
- H[P] = F ? i : "";
- }
- }
- });
- return H;
- };
-
- function z(H, F, G) {
- if (F === i || typeof F === "boolean") {
- G = F;
- F = a[H ? D : A]();
- } else {
- F = E(F) ? F.replace(H ? w : x, "") : F;
- }
-
- return l(F, G);
- }
-
- l[A] = B(z, 0);
- l[D] = v = B(z, 1);
- $[y] || ($[y] = function (F) {
- return $.extend(C, F);
- })({
- a: k,
- base: k,
- iframe: t,
- img: t,
- input: t,
- form: "action",
- link: k,
- script: t
- });
- j = $[y];
-
- function s(I, G, H, F) {
- if (!E(H) && _typeof(H) !== "object") {
- F = H;
- H = G;
- G = i;
- }
-
- return this.each(function () {
- var L = $(this),
- J = G || j()[(this.nodeName || "").toLowerCase()] || "",
- K = J && L.attr(J) || "";
- L.attr(J, a[I](K, H, F));
- });
- }
-
- $.fn[A] = B(s, A);
- $.fn[D] = B(s, D);
-
- b.pushState = q = function q(I, F) {
- if (E(I) && /^#/.test(I) && F === i) {
- F = 2;
- }
-
- var H = I !== i,
- G = c(p[g][k], H ? I : {}, H ? F : 2);
- p[g][k] = G + (/#/.test(G) ? "" : "#");
- };
-
- b.getState = u = function u(F, G) {
- return F === i || typeof F === "boolean" ? v(F) : v(G)[F];
- };
-
- b.removeState = function (F) {
- var G = {};
-
- if (F !== i) {
- G = u();
- $.each($.isArray(F) ? F : arguments, function (I, H) {
- delete G[H];
- });
- }
-
- q(G, 2);
- };
-
- e[d] = $.extend(e[d], {
- add: function add(F) {
- var H;
-
- function G(J) {
- var I = J[D] = c();
-
- J.getState = function (K, L) {
- return K === i || typeof K === "boolean" ? l(I, K) : l(I, L)[K];
- };
-
- H.apply(this, arguments);
- }
-
- if ($.isFunction(F)) {
- H = F;
- return G;
- } else {
- H = F.handler;
- F.handler = G;
- }
- }
- });
- })(jQuery, window);
- /*
- * jQuery hashchange event - v1.2 - 2/11/2010
- * http://benalman.com/projects/jquery-hashchange-plugin/
- *
- * Copyright (c) 2010 "Cowboy" Ben Alman
- * Dual licensed under the MIT and GPL licenses.
- * http://benalman.com/about/license/
- */
-
-
- (function ($, i, b) {
- var j,
- k = $.event.special,
- c = "location",
- d = "hashchange",
- l = "href",
- f = $.browser,
- g = document.documentMode,
- h = f.msie && (g === b || g < 8),
- e = "on" + d in i && !h;
-
- function a(m) {
- m = m || i[c][l];
- return m.replace(/^[^#]*#?(.*)$/, "$1");
- }
-
- $[d + "Delay"] = 100;
- k[d] = $.extend(k[d], {
- setup: function setup() {
- if (e) {
- return false;
- }
-
- $(j.start);
- },
- teardown: function teardown() {
- if (e) {
- return false;
- }
-
- $(j.stop);
- }
- });
-
- j = function () {
- var m = {},
- r,
- n,
- o,
- q;
-
- function p() {
- o = q = function q(s) {
- return s;
- };
-
- if (h) {
- n = $('').hide().insertAfter("body")[0].contentWindow;
-
- q = function q() {
- return a(n.document[c][l]);
- };
-
- o = function o(u, s) {
- if (u !== s) {
- var t = n.document;
- t.open().close();
- t[c].hash = "#" + u;
- }
- };
-
- o(a());
- }
- }
-
- m.start = function () {
- if (r) {
- return;
- }
-
- var t = a();
- o || p();
-
- (function s() {
- var v = a(),
- u = q(t);
-
- if (v !== t) {
- o(t = v, u);
- $(i).trigger(d);
- } else {
- if (u !== t) {
- i[c][l] = i[c][l].replace(/#.*/, "") + "#" + u;
- }
- }
-
- r = setTimeout(s, $[d + "Delay"]);
- })();
- };
-
- m.stop = function () {
- if (!n) {
- r && clearTimeout(r);
- r = 0;
- }
- };
-
- return m;
- }();
- })(jQuery, window);
-
- return jQuery;
-}
-
/**
* @file SVG Icon Loader 2.0
*
@@ -28816,7 +28544,7 @@ function loadStylesheets(stylesheets) {
}
var editor = {};
-var $$b = [jQueryPluginJSHotkeys, jQueryPluginBBQ, jQueryPluginSVGIcons, jQueryPluginJGraduate, jQueryPluginSpinButton, jQueryPluginSVG, jQueryContextMenu, jPicker].reduce(function (jq, func) {
+var $$b = [jQueryPluginJSHotkeys, jQueryPluginSVGIcons, jQueryPluginJGraduate, jQueryPluginSpinButton, jQueryPluginSVG, jQueryContextMenu, jPicker].reduce(function (jq, func) {
return func(jq);
}, jQuery);
/*
@@ -29084,7 +28812,7 @@ defaultConfig = {
*/
uiStrings$1 = editor.uiStrings = {};
var svgCanvas,
- urldata,
+ urldata = {},
isReady = false,
customExportImage = false,
customExportPDF = false,
@@ -29141,7 +28869,7 @@ function _loadSvgString() {
_loadSvgString = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee23(str) {
- var _ref47,
+ var _ref49,
noAlert,
success,
_args23 = arguments;
@@ -29150,7 +28878,7 @@ function _loadSvgString() {
while (1) {
switch (_context23.prev = _context23.next) {
case 0:
- _ref47 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref47.noAlert;
+ _ref49 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, noAlert = _ref49.noAlert;
success = svgCanvas.setSvgString(str) !== false;
if (!success) {
@@ -29386,12 +29114,12 @@ editor.setConfig = function (opts, cfgCfg) {
}
}
- $$b.each(opts, function (key, val) {
- if (!{}.hasOwnProperty.call(opts, key)) {
- return;
- } // Only allow prefs defined in defaultPrefs
-
+ Object.entries(opts).forEach(function (_ref4) {
+ var _ref5 = _slicedToArray(_ref4, 2),
+ key = _ref5[0],
+ val = _ref5[1];
+ // Only allow prefs defined in defaultPrefs or...
if ({}.hasOwnProperty.call(defaultPrefs, key)) {
if (cfgCfg.overwrite === false && (curConfig.preventAllURLConfig || {}.hasOwnProperty.call(curPrefs, key))) {
return;
@@ -29612,19 +29340,31 @@ editor.init = function () {
(function () {
// Load config/data from URL if given
- urldata = $$b.deparam.querystring(true);
+ var _ref6 = new URL(location),
+ search = _ref6.search,
+ searchParams = _ref6.searchParams;
+
+ if (search) {
+ urldata = deparam(searchParams.toString(), true);
+ ['initStroke', 'initFill'].forEach(function (prop) {
+ if (searchParams.has("".concat(prop, "[color]"))) {
+ // Restore back to original non-deparamed value to avoid color
+ // strings being converted to numbers
+ urldata[prop].color = searchParams.get("".concat(prop, "[color]"));
+ }
+ });
+
+ if (searchParams.has('bkgd_color')) {
+ urldata.bkgd_color = '#' + searchParams.get('bkgd_color');
+ }
- if (!$$b.isEmptyObject(urldata)) {
if (urldata.dimensions) {
urldata.dimensions = urldata.dimensions.split(',');
}
- if (urldata.bkgd_color) {
- urldata.bkgd_color = '#' + urldata.bkgd_color;
- }
-
if (urldata.extensions) {
- // For security reasons, disallow cross-domain or cross-folder extensions via URL
+ // For security reasons, disallow cross-domain or cross-folder
+ // extensions via URL
urldata.extensions = urldata.extensions.match(/[:/\\]/) ? '' : urldata.extensions.split(',');
} // Disallowing extension paths via URL for
// security reasons, even for same-domain
@@ -29636,11 +29376,12 @@ editor.init = function () {
if (urldata[pathConfig]) {
delete urldata[pathConfig];
}
- });
+ }); // Note: `source` and `url` (as with `storagePrompt` later) are not
+ // set on config but are used below
+
editor.setConfig(urldata, {
overwrite: false
- }); // Note: source and url (as with storagePrompt later) are not set on config but are used below
-
+ });
setupCurConfig();
if (!curConfig.preventURLContentLoading) {
@@ -29649,12 +29390,9 @@ editor.init = function () {
if (!source) {
// urldata.source may have been null if it ended with '='
- var _ref4 = new URL(location),
- searchParams = _ref4.searchParams;
-
var src = searchParams.get('source');
- if (src.startsWith('data:')) {
+ if (src && src.startsWith('data:')) {
source = src;
}
}
@@ -29682,9 +29420,9 @@ editor.init = function () {
setupCurConfig();
editor.loadContentAndPrefs();
}
-
- setupCurPrefs();
})();
+
+ setupCurPrefs();
/**
* Called internally.
* @param {string|Element|external:jQuery} elem
@@ -29693,7 +29431,6 @@ editor.init = function () {
* @returns {void}
*/
-
var setIcon = editor.setIcon = function (elem, iconId, forcedSize) {
var icon = typeof iconId === 'string' ? $$b.getSvgIcon(iconId, true) : iconId.clone();
@@ -29718,10 +29455,10 @@ editor.init = function () {
var extAndLocaleFunc =
/*#__PURE__*/
function () {
- var _ref5 = _asyncToGenerator(
+ var _ref7 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee3() {
- var _ref6, langParam, langData, _uiStrings$common, ok, cancel;
+ var _ref8, langParam, langData, _uiStrings$common, ok, cancel;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
@@ -29731,9 +29468,9 @@ editor.init = function () {
return editor.putLocale(editor.pref('lang'), goodLangs, curConfig);
case 2:
- _ref6 = _context3.sent;
- langParam = _ref6.langParam;
- langData = _ref6.langData;
+ _ref8 = _context3.sent;
+ langParam = _ref8.langParam;
+ langData = _ref8.langData;
_context3.next = 7;
return setLang(langParam, langData);
@@ -29750,7 +29487,7 @@ editor.init = function () {
return Promise.all(curConfig.extensions.map(
/*#__PURE__*/
function () {
- var _ref7 = _asyncToGenerator(
+ var _ref9 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee2(extname) {
var extName, url, imported, _imported$name, _name2, init, importLocale;
@@ -29818,7 +29555,7 @@ editor.init = function () {
}));
return function (_x2) {
- return _ref7.apply(this, arguments);
+ return _ref9.apply(this, arguments);
};
}()));
@@ -29870,7 +29607,7 @@ editor.init = function () {
}));
return function extAndLocaleFunc() {
- return _ref5.apply(this, arguments);
+ return _ref7.apply(this, arguments);
};
}();
@@ -30364,7 +30101,7 @@ editor.init = function () {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
- getStylesheetPriority = function _ref9(stylesheetFile) {
+ getStylesheetPriority = function _ref11(stylesheetFile) {
switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css':
return 1;
@@ -30439,10 +30176,10 @@ editor.init = function () {
_context4.next = 11;
return loadStylesheets(stylesheets, {
- acceptErrors: function acceptErrors(_ref8) {
- var stylesheetURL = _ref8.stylesheetURL,
- reject = _ref8.reject,
- resolve = _ref8.resolve;
+ acceptErrors: function acceptErrors(_ref10) {
+ var stylesheetURL = _ref10.stylesheetURL,
+ reject = _ref10.reject,
+ resolve = _ref10.resolve;
if ($$b.loadingStylesheets.includes(stylesheetURL)) {
reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL)));
@@ -30940,8 +30677,8 @@ editor.init = function () {
_promptImgURL = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee18() {
- var _ref33,
- _ref33$cancelDeletes,
+ var _ref35,
+ _ref35$cancelDeletes,
cancelDeletes,
curhref,
url,
@@ -30951,7 +30688,7 @@ editor.init = function () {
while (1) {
switch (_context18.prev = _context18.next) {
case 0:
- _ref33 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref33$cancelDeletes = _ref33.cancelDeletes, cancelDeletes = _ref33$cancelDeletes === void 0 ? false : _ref33$cancelDeletes;
+ _ref35 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, _ref35$cancelDeletes = _ref35.cancelDeletes, cancelDeletes = _ref35$cancelDeletes === void 0 ? false : _ref35$cancelDeletes;
curhref = svgCanvas.getHref(selectedElement);
curhref = curhref.startsWith('data:') ? '' : curhref;
_context18.next = 5;
@@ -31959,10 +31696,10 @@ editor.init = function () {
// Get this button's options
var idSel = '#' + this.getAttribute('id');
- var _Object$entries$find = Object.entries(btnOpts).find(function (_ref10) {
- var _ref11 = _slicedToArray(_ref10, 2),
- _ = _ref11[0],
- sel = _ref11[1].sel;
+ var _Object$entries$find = Object.entries(btnOpts).find(function (_ref12) {
+ var _ref13 = _slicedToArray(_ref12, 2),
+ _ = _ref13[0],
+ sel = _ref13[1].sel;
return sel === idSel;
}),
@@ -31989,10 +31726,10 @@ editor.init = function () {
if (ev.type === 'keydown') {
var flyoutIsSelected = $$b(options.parent + '_show').hasClass('tool_button_current');
var currentOperation = $$b(options.parent + '_show').attr('data-curopt');
- Object.entries(holders[opts.parent]).some(function (_ref12) {
- var _ref13 = _slicedToArray(_ref12, 2),
- j = _ref13[0],
- tool = _ref13[1];
+ Object.entries(holders[opts.parent]).some(function (_ref14) {
+ var _ref15 = _slicedToArray(_ref14, 2),
+ j = _ref15[0],
+ tool = _ref15[1];
if (tool.sel !== currentOperation) {
return false;
@@ -32205,7 +31942,7 @@ editor.init = function () {
var extAdded =
/*#__PURE__*/
function () {
- var _ref14 = _asyncToGenerator(
+ var _ref16 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee5(win, ext) {
var cbCalled, resizeDone, lang, prepResize, runCallback, btnSelects, svgicons, fallbackObj, altsObj, placementObj, holders;
@@ -32213,7 +31950,7 @@ editor.init = function () {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
- prepResize = function _ref15() {
+ prepResize = function _ref17() {
if (resizeTimer) {
clearTimeout(resizeTimer);
resizeTimer = null;
@@ -32688,7 +32425,7 @@ editor.init = function () {
}));
return function extAdded(_x4, _x5) {
- return _ref14.apply(this, arguments);
+ return _ref16.apply(this, arguments);
};
}();
/**
@@ -32763,9 +32500,9 @@ editor.init = function () {
* @listens module:svgcanvas.SvgCanvas#event:updateCanvas
* @returns {void}
*/
- function (win, _ref16) {
- var center = _ref16.center,
- newCtr = _ref16.newCtr;
+ function (win, _ref18) {
+ var center = _ref18.center,
+ newCtr = _ref18.newCtr;
updateCanvas(center, newCtr);
});
svgCanvas.bind('contextset', contextChanged);
@@ -33646,7 +33383,7 @@ editor.init = function () {
var makeHyperlink =
/*#__PURE__*/
function () {
- var _ref18 = _asyncToGenerator(
+ var _ref20 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee7() {
var url;
@@ -33678,7 +33415,7 @@ editor.init = function () {
}));
return function makeHyperlink() {
- return _ref18.apply(this, arguments);
+ return _ref20.apply(this, arguments);
};
}();
/**
@@ -33801,7 +33538,7 @@ editor.init = function () {
var clickClear =
/*#__PURE__*/
function () {
- var _ref19 = _asyncToGenerator(
+ var _ref21 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee8() {
var _curConfig$dimensions, x, y, ok;
@@ -33844,7 +33581,7 @@ editor.init = function () {
}));
return function clickClear() {
- return _ref19.apply(this, arguments);
+ return _ref21.apply(this, arguments);
};
}();
/**
@@ -33893,7 +33630,7 @@ editor.init = function () {
var clickExport =
/*#__PURE__*/
function () {
- var _ref20 = _asyncToGenerator(
+ var _ref22 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee9() {
var imgType, exportWindowName, openExportWindow, chrome, quality;
@@ -33901,7 +33638,7 @@ editor.init = function () {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
- openExportWindow = function _ref21() {
+ openExportWindow = function _ref23() {
var loadingImage = uiStrings$1.notification.loadingImage;
if (curConfig.exportWindowType === 'new') {
@@ -33992,7 +33729,7 @@ editor.init = function () {
}));
return function clickExport() {
- return _ref20.apply(this, arguments);
+ return _ref22.apply(this, arguments);
};
}();
/**
@@ -34198,7 +33935,7 @@ editor.init = function () {
var saveSourceEditor =
/*#__PURE__*/
function () {
- var _ref22 = _asyncToGenerator(
+ var _ref24 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee10() {
var saveChanges, ok;
@@ -34258,7 +33995,7 @@ editor.init = function () {
}));
return function saveSourceEditor() {
- return _ref22.apply(this, arguments);
+ return _ref24.apply(this, arguments);
};
}();
/**
@@ -34345,7 +34082,7 @@ editor.init = function () {
_asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee11() {
- var color, lang, _ref24, langParam, langData;
+ var color, lang, _ref26, langParam, langData;
return regeneratorRuntime.wrap(function _callee11$(_context11) {
while (1) {
@@ -34366,9 +34103,9 @@ editor.init = function () {
return editor.putLocale(lang, goodLangs, curConfig);
case 6:
- _ref24 = _context11.sent;
- langParam = _ref24.langParam;
- langData = _ref24.langData;
+ _ref26 = _context11.sent;
+ langParam = _ref26.langParam;
+ langData = _ref26.langData;
_context11.next = 11;
return setLang(langParam, langData);
@@ -34408,7 +34145,7 @@ editor.init = function () {
var cancelOverlays =
/*#__PURE__*/
function () {
- var _ref25 = _asyncToGenerator(
+ var _ref27 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee12() {
var ok;
@@ -34479,7 +34216,7 @@ editor.init = function () {
}));
return function cancelOverlays() {
- return _ref25.apply(this, arguments);
+ return _ref27.apply(this, arguments);
};
}();
@@ -36221,8 +35958,8 @@ editor.init = function () {
// bitmap handling
reader = new FileReader();
- reader.onloadend = function (_ref28) {
- var result = _ref28.target.result;
+ reader.onloadend = function (_ref30) {
+ var result = _ref30.target.result;
/**
* Insert the new image until we know its dimensions.
@@ -36274,7 +36011,7 @@ editor.init = function () {
var open = $$b('').change(
/*#__PURE__*/
function () {
- var _ref29 = _asyncToGenerator(
+ var _ref31 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee16(e) {
var ok, reader;
@@ -36305,15 +36042,15 @@ editor.init = function () {
reader.onloadend =
/*#__PURE__*/
function () {
- var _ref31 = _asyncToGenerator(
+ var _ref33 = _asyncToGenerator(
/*#__PURE__*/
- regeneratorRuntime.mark(function _callee15(_ref30) {
+ regeneratorRuntime.mark(function _callee15(_ref32) {
var target;
return regeneratorRuntime.wrap(function _callee15$(_context15) {
while (1) {
switch (_context15.prev = _context15.next) {
case 0:
- target = _ref30.target;
+ target = _ref32.target;
_context15.next = 3;
return loadSvgString(target.result);
@@ -36329,7 +36066,7 @@ editor.init = function () {
}));
return function (_x7) {
- return _ref31.apply(this, arguments);
+ return _ref33.apply(this, arguments);
};
}();
@@ -36345,7 +36082,7 @@ editor.init = function () {
}));
return function (_x6) {
- return _ref29.apply(this, arguments);
+ return _ref31.apply(this, arguments);
};
}());
$$b('#tool_open').show();
@@ -36376,7 +36113,7 @@ editor.init = function () {
var setLang = editor.setLang =
/*#__PURE__*/
function () {
- var _ref32 = _asyncToGenerator(
+ var _ref34 = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee17(lang, allStrings) {
var oldLayerName, renameLayer, elems;
@@ -36484,7 +36221,7 @@ editor.init = function () {
}));
return function (_x8, _x9) {
- return _ref32.apply(this, arguments);
+ return _ref34.apply(this, arguments);
};
}();
@@ -36578,9 +36315,9 @@ regeneratorRuntime.mark(function _callee20() {
case 0:
_context20.prev = 0;
_context20.next = 3;
- return Promise.all(callbacks.map(function (_ref35) {
- var _ref36 = _slicedToArray(_ref35, 1),
- cb = _ref36[0];
+ return Promise.all(callbacks.map(function (_ref37) {
+ var _ref38 = _slicedToArray(_ref37, 1),
+ cb = _ref38[0];
return cb(); // eslint-disable-line promise/prefer-await-to-callbacks
}));
@@ -36592,18 +36329,18 @@ regeneratorRuntime.mark(function _callee20() {
case 5:
_context20.prev = 5;
_context20.t0 = _context20["catch"](0);
- callbacks.forEach(function (_ref37) {
- var _ref38 = _slicedToArray(_ref37, 3),
- reject = _ref38[2];
+ callbacks.forEach(function (_ref39) {
+ var _ref40 = _slicedToArray(_ref39, 3),
+ reject = _ref40[2];
reject();
});
throw _context20.t0;
case 9:
- callbacks.forEach(function (_ref39) {
- var _ref40 = _slicedToArray(_ref39, 2),
- resolve = _ref40[1];
+ callbacks.forEach(function (_ref41) {
+ var _ref42 = _slicedToArray(_ref41, 2),
+ resolve = _ref42[1];
resolve();
});
@@ -36624,8 +36361,8 @@ regeneratorRuntime.mark(function _callee20() {
*/
editor.loadFromString = function (str) {
- var _ref41 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- noAlert = _ref41.noAlert;
+ var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
+ noAlert = _ref43.noAlert;
return editor.ready(
/*#__PURE__*/
@@ -36695,9 +36432,9 @@ editor.disableUI = function (featList) {// $(function () {
editor.loadFromURL = function (url) {
- var _ref43 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- cache = _ref43.cache,
- noAlert = _ref43.noAlert;
+ var _ref45 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
+ cache = _ref45.cache,
+ noAlert = _ref45.noAlert;
return editor.ready(function () {
return new Promise(function (resolve, reject) {
@@ -36746,8 +36483,8 @@ editor.loadFromURL = function (url) {
editor.loadFromDataURI = function (str) {
- var _ref44 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- noAlert = _ref44.noAlert;
+ var _ref46 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
+ noAlert = _ref46.noAlert;
return editor.ready(function () {
var base64 = false;
@@ -36804,9 +36541,9 @@ var messageQueue = [];
* @returns {void}
*/
-var messageListener = function messageListener(_ref45) {
- var data = _ref45.data,
- origin = _ref45.origin;
+var messageListener = function messageListener(_ref47) {
+ var data = _ref47.data,
+ origin = _ref47.origin;
// eslint-disable-line no-shadow
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
var messageObj = {
diff --git a/dist/index-es.min.js b/dist/index-es.min.js
index b457a046..309455dd 100644
--- a/dist/index-es.min.js
+++ b/dist/index-es.min.js
@@ -1,22 +1,22 @@
-function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t,n,r,a,i,o){try{var s=e[i](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(a,i){var o=e.apply(n,r);function s(e){t(o,a,i,s,l,"next",e)}function l(e){t(o,a,i,s,l,"throw",e)}s(void 0)}))}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;nt.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=a,window.SVGPathSegLinetoAbs=o,window.SVGPathSegLinetoRel=c,window.SVGPathSegCurvetoCubicAbs=d,window.SVGPathSegCurvetoCubicRel=h,window.SVGPathSegCurvetoQuadraticAbs=f,window.SVGPathSegCurvetoQuadraticRel=p,window.SVGPathSegArcAbs=g,window.SVGPathSegArcRel=m,window.SVGPathSegLinetoHorizontalAbs=v,window.SVGPathSegLinetoHorizontalRel=y,window.SVGPathSegLinetoVerticalAbs=_,window.SVGPathSegLinetoVerticalRel=b,window.SVGPathSegCurvetoCubicSmoothAbs=x,window.SVGPathSegCurvetoCubicSmoothRel=w,window.SVGPathSegCurvetoQuadraticSmoothAbs=S,window.SVGPathSegCurvetoQuadraticSmoothRel=k}if(!("SVGPathSegList"in window&&"appendItem"in window.SVGPathSegList.prototype)){var C=function(){function e(t){r(this,e),this._pathElement=t,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}return i(e,[{key:"_checkPathSynchronizedToList",value:function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())}},{key:"_updateListFromPathMutations",value:function(e){if(this._pathElement){var t=!1;e.forEach((function(e){"d"===e.attributeName&&(t=!0)})),t&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}}},{key:"_writeListToPath",value:function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",e._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}},{key:"segmentChanged",value:function(e){this._writeListToPath()}},{key:"clear",value:function(){this._checkPathSynchronizedToList(),this._list.forEach((function(e){e._owningPathSegList=null})),this._list=[],this._writeListToPath()}},{key:"initialize",value:function(e){return this._checkPathSynchronizedToList(),this._list=[e],e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_checkValidIndex",value:function(e){if(isNaN(e)||e<0||e>=this.numberOfItems)throw new Error("INDEX_SIZE_ERR")}},{key:"getItem",value:function(e){return this._checkPathSynchronizedToList(),this._checkValidIndex(e),this._list[e]}},{key:"insertItemBefore",value:function(e,t){return this._checkPathSynchronizedToList(),t>this.numberOfItems&&(t=this.numberOfItems),e._owningPathSegList&&(e=e.clone()),this._list.splice(t,0,e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"replaceItem",value:function(e,t){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._checkValidIndex(t),this._list[t]=e,e._owningPathSegList=this,this._writeListToPath(),e}},{key:"removeItem",value:function(e){this._checkPathSynchronizedToList(),this._checkValidIndex(e);var t=this._list[e];return this._list.splice(e,1),this._writeListToPath(),t}},{key:"appendItem",value:function(e){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._list.push(e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_parsePath",value:function(e){if(!e||!e.length)return[];var t=this,n=function(){function e(){r(this,e),this.pathSegList=[]}return i(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),a=function(){function e(t){r(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return i(e,[{key:"_isCurrentSpace",value:function(){var e=this._string[this._currentIndex];return e<=" "&&(" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e)}},{key:"_skipOptionalSpaces",value:function(){for(;this._currentIndex="0"&&e<="9")&&t!==SVGPathSeg.PATHSEG_CLOSEPATH?t===SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:t===SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:t:SVGPathSeg.PATHSEG_UNKNOWN}},{key:"initialCommandIsMoveTo",value:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===SVGPathSeg.PATHSEG_MOVETO_ABS||e===SVGPathSeg.PATHSEG_MOVETO_REL}},{key:"_parseNumber",value:function(){var e=0,t=0,n=1,r=0,a=1,i=1,o=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!==this._string.charAt(this._currentIndex))){for(var s=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==s)for(var l=this._currentIndex-1,c=1;l>=s;)t+=c*(this._string.charAt(l--)-"0"),c*=10;if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)n*=10,r+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==o&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)e*=10,e+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var u=t+r;if(u*=a,e&&(u*=Math.pow(10,i*e)),o!==this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),u}}},{key:"_parseArcFlag",value:function(){if(!(this._currentIndex>=this._endIndex)){var e=!1,t=this._string.charAt(this._currentIndex++);if("0"===t)e=!1;else{if("1"!==t)return;e=!0}return this._skipOptionalSpacesOrDelimiter(),e}}},{key:"parseSegment",value:function(){var e=this._string[this._currentIndex],n=this._pathSegTypeFromChar(e);if(n===SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand===SVGPathSeg.PATHSEG_UNKNOWN)return null;if((n=this._nextCommandHelper(e,this._previousCommand))===SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=n,n){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(t);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,a.x,a.y,a.x1,a.y1,a.x2,a.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:var i={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(t,i.x,i.y,i.x2,i.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:var o={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,o.x,o.y,o.x2,o.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var s={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,s.x,s.y,s.x1,s.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:var l={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(t,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:var c={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(t,c.x,c.y,c.x1,c.y1,c.arcAngle,c.arcLarge,c.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:var u={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(t,u.x,u.y,u.x1,u.y1,u.arcAngle,u.arcLarge,u.arcSweep);default:throw new Error("Unknown path seg type.")}}}]),e}(),o=new n,s=new a(e);if(!s.initialCommandIsMoveTo())return[];for(;s.hasMoreData();){var l=s.parseSegment();if(!l)return[];o.appendSegment(l)}return o.pathSegList}}],[{key:"_pathSegArrayAsString",value:function(e){var t="",n=!0;return e.forEach((function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()})),t}}]),e}();C.prototype.classname="SVGPathSegList",Object.defineProperty(C.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new C(this)),this._pathSegList},enumerable:!0},normalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedNormalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0}}),window.SVGPathSegList=C}}();var m,v=jQuery,y=(Boolean(document.createElementNS&&document.createElementNS(p.SVG,"svg").createSVGRect),navigator.userAgent),_=document.createElementNS(p.SVG,"svg"),b=Boolean(window.opera),x=y.includes("AppleWebKit"),w=y.includes("Gecko/"),S=y.includes("MSIE"),k=y.includes("Chrome/"),C=(y.includes("Windows"),y.includes("Macintosh")),A="ontouchstart"in window,E=Boolean(_.querySelector),G=Boolean(document.evaluate),P=function(){var e=document.createElementNS(p.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.replaceItem(n,1),!0}catch(e){}return!1}(),I=function(){var e=document.createElementNS(p.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.insertItemBefore(n,1),!0}catch(e){}return!1}(),N=function(){var e=document.createElementNS(p.SVG,"svg"),t=document.createElementNS(p.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(p.SVG,"text");n.textContent="a",t.append(n);try{return 0===n.getStartPositionOfChar(0).x}catch(e){return!1}finally{e.remove()}}(),T=function(){var e=document.createElementNS(p.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(p.SVG,"path");t.setAttribute("d","M0,0 C0,0 10,10 10,0"),e.append(t);var n=t.getBBox();return e.remove(),n.height>4&&n.height<5}(),L=function(){var e=document.createElementNS(p.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(p.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(p.SVG,"path");n.setAttribute("d","M5,0 15,0");var r=document.createElementNS(p.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.width}(),M=(function(){var e=document.createElementNS(p.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");t||v.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the latest version in which the problems have been fixed.')}(),(m=document.createElementNS(p.SVG,"rect")).setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===m.style.vectorEffect),O=function(){var t=document.createElementNS(p.SVG,"rect").transform.baseVal,n=_.createSVGTransform();t.appendItem(n);var r=t.getItem(0),a=function(t){return t&&"object"===e(t)&&"function"==typeof t.setMatrix&&"angle"in t};return a(r)&&a(n)&&r.type===n.type&&r.angle===n.angle&&r.matrix.a===n.matrix.a&&r.matrix.b===n.matrix.b&&r.matrix.c===n.matrix.c&&r.matrix.d===n.matrix.d&&r.matrix.e===n.matrix.e&&r.matrix.f===n.matrix.f}(),j=function(){return b},V=function(){return x},R=function(){return w},B=function(){return S},D=function(){return k},U=function(){return C},F=function(){return A},H=function(){return L},z=function(){return M};
+var f={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/"},g=function(){var e={};return Object.entries(f).forEach((function(t){var n=d(t,2),r=n[0],a=n[1];e[a]=r.toLowerCase()})),e};!function(){if(!("SVGPathSeg"in window)){var e=function(){function e(t,n,a){r(this,e),this.pathSegType=t,this.pathSegTypeAsLetter=n,this._owningPathSegList=a}return i(e,[{key:"_segmentChanged",value:function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)}}]),e}();e.prototype.classname="SVGPathSeg",e.PATHSEG_UNKNOWN=0,e.PATHSEG_CLOSEPATH=1,e.PATHSEG_MOVETO_ABS=2,e.PATHSEG_MOVETO_REL=3,e.PATHSEG_LINETO_ABS=4,e.PATHSEG_LINETO_REL=5,e.PATHSEG_CURVETO_CUBIC_ABS=6,e.PATHSEG_CURVETO_CUBIC_REL=7,e.PATHSEG_CURVETO_QUADRATIC_ABS=8,e.PATHSEG_CURVETO_QUADRATIC_REL=9,e.PATHSEG_ARC_ABS=10,e.PATHSEG_ARC_REL=11,e.PATHSEG_LINETO_HORIZONTAL_ABS=12,e.PATHSEG_LINETO_HORIZONTAL_REL=13,e.PATHSEG_LINETO_VERTICAL_ABS=14,e.PATHSEG_LINETO_VERTICAL_REL=15,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19;var t=function(t){function n(t){return r(this,n),u(this,l(n).call(this,e.PATHSEG_CLOSEPATH,"z",t))}return s(n,t),i(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}(e),n=function(t){function n(t,a,i){var o;return r(this,n),(o=u(this,l(n).call(this,e.PATHSEG_MOVETO_ABS,"M",t)))._x=a,o._y=i,o}return s(n,t),i(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}(e);Object.defineProperties(n.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var a=function(t){function n(t,a,i){var o;return r(this,n),(o=u(this,l(n).call(this,e.PATHSEG_MOVETO_REL,"m",t)))._x=a,o._y=i,o}return s(n,t),i(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}(e);Object.defineProperties(a.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var o=function(t){function n(t,a,i){var o;return r(this,n),(o=u(this,l(n).call(this,e.PATHSEG_LINETO_ABS,"L",t)))._x=a,o._y=i,o}return s(n,t),i(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}(e);Object.defineProperties(o.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var c=function(t){function n(t,a,i){var o;return r(this,n),(o=u(this,l(n).call(this,e.PATHSEG_LINETO_REL,"l",t)))._x=a,o._y=i,o}return s(n,t),i(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}(e);Object.defineProperties(c.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var d=function(t){function n(t,a,i,o,s,c,d){var h;return r(this,n),(h=u(this,l(n).call(this,e.PATHSEG_CURVETO_CUBIC_ABS,"C",t)))._x=a,h._y=i,h._x1=o,h._y1=s,h._x2=c,h._y2=d,h}return s(n,t),i(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}(e);Object.defineProperties(d.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var h=function(t){function n(t,a,i,o,s,c,d){var h;return r(this,n),(h=u(this,l(n).call(this,e.PATHSEG_CURVETO_CUBIC_REL,"c",t)))._x=a,h._y=i,h._x1=o,h._y1=s,h._x2=c,h._y2=d,h}return s(n,t),i(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}(e);Object.defineProperties(h.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var p=function(t){function n(t,a,i,o,s){var c;return r(this,n),(c=u(this,l(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t)))._x=a,c._y=i,c._x1=o,c._y1=s,c}return s(n,t),i(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}(e);Object.defineProperties(p.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var f=function(t){function n(t,a,i,o,s){var c;return r(this,n),(c=u(this,l(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_REL,"q",t)))._x=a,c._y=i,c._x1=o,c._y1=s,c}return s(n,t),i(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}(e);Object.defineProperties(f.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var g=function(t){function n(t,a,i,o,s,c,d,h){var p;return r(this,n),(p=u(this,l(n).call(this,e.PATHSEG_ARC_ABS,"A",t)))._x=a,p._y=i,p._r1=o,p._r2=s,p._angle=c,p._largeArcFlag=d,p._sweepFlag=h,p}return s(n,t),i(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}(e);Object.defineProperties(g.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var m=function(t){function n(t,a,i,o,s,c,d,h){var p;return r(this,n),(p=u(this,l(n).call(this,e.PATHSEG_ARC_REL,"a",t)))._x=a,p._y=i,p._r1=o,p._r2=s,p._angle=c,p._largeArcFlag=d,p._sweepFlag=h,p}return s(n,t),i(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}(e);Object.defineProperties(m.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var v=function(t){function n(t,a){var i;return r(this,n),(i=u(this,l(n).call(this,e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t)))._x=a,i}return s(n,t),i(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}(e);Object.defineProperty(v.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var _=function(t){function n(t,a){var i;return r(this,n),(i=u(this,l(n).call(this,e.PATHSEG_LINETO_HORIZONTAL_REL,"h",t)))._x=a,i}return s(n,t),i(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}(e);Object.defineProperty(_.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var y=function(t){function n(t,a){var i;return r(this,n),(i=u(this,l(n).call(this,e.PATHSEG_LINETO_VERTICAL_ABS,"V",t)))._y=a,i}return s(n,t),i(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}(e);Object.defineProperty(y.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var b=function(t){function n(t,a){var i;return r(this,n),(i=u(this,l(n).call(this,e.PATHSEG_LINETO_VERTICAL_REL,"v",t)))._y=a,i}return s(n,t),i(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}(e);Object.defineProperty(b.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var x=function(t){function n(t,a,i,o,s){var c;return r(this,n),(c=u(this,l(n).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t)))._x=a,c._y=i,c._x2=o,c._y2=s,c}return s(n,t),i(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}(e);Object.defineProperties(x.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var w=function(t){function n(t,a,i,o,s){var c;return r(this,n),(c=u(this,l(n).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t)))._x=a,c._y=i,c._x2=o,c._y2=s,c}return s(n,t),i(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}(e);Object.defineProperties(w.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var S=function(t){function n(t,a,i){var o;return r(this,n),(o=u(this,l(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t)))._x=a,o._y=i,o}return s(n,t),i(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}(e);Object.defineProperties(S.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var k=function(t){function n(t,a,i){var o;return r(this,n),(o=u(this,l(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t)))._x=a,o._y=i,o}return s(n,t),i(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}(e);Object.defineProperties(k.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}}),SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new t(void 0)},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(e,t){return new n(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(e,t){return new a(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new o(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new c(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,r,a,i){return new d(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,r,a,i){return new h(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,r){return new p(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(e,t,n,r){return new f(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(e,t,n,r,a,i,o){return new g(void 0,e,t,n,r,a,i,o)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,r,a,i,o){return new m(void 0,e,t,n,r,a,i,o)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(e){return new v(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(e){return new _(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new y(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new b(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,r){return new x(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,r){return new w(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new S(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new k(void 0,e,t)},"getPathSegAtLength"in SVGPathElement.prototype||(SVGPathElement.prototype.getPathSegAtLength=function(e){if(void 0===e||!isFinite(e))throw new Error("Invalid arguments.");var t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",this.getAttribute("d"));var n=t.pathSegList.numberOfItems-1;if(n<=0)return 0;do{if(t.pathSegList.removeItem(n),e>t.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=a,window.SVGPathSegLinetoAbs=o,window.SVGPathSegLinetoRel=c,window.SVGPathSegCurvetoCubicAbs=d,window.SVGPathSegCurvetoCubicRel=h,window.SVGPathSegCurvetoQuadraticAbs=p,window.SVGPathSegCurvetoQuadraticRel=f,window.SVGPathSegArcAbs=g,window.SVGPathSegArcRel=m,window.SVGPathSegLinetoHorizontalAbs=v,window.SVGPathSegLinetoHorizontalRel=_,window.SVGPathSegLinetoVerticalAbs=y,window.SVGPathSegLinetoVerticalRel=b,window.SVGPathSegCurvetoCubicSmoothAbs=x,window.SVGPathSegCurvetoCubicSmoothRel=w,window.SVGPathSegCurvetoQuadraticSmoothAbs=S,window.SVGPathSegCurvetoQuadraticSmoothRel=k}if(!("SVGPathSegList"in window&&"appendItem"in window.SVGPathSegList.prototype)){var C=function(){function e(t){r(this,e),this._pathElement=t,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}return i(e,[{key:"_checkPathSynchronizedToList",value:function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())}},{key:"_updateListFromPathMutations",value:function(e){if(this._pathElement){var t=!1;e.forEach((function(e){"d"===e.attributeName&&(t=!0)})),t&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}}},{key:"_writeListToPath",value:function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",e._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}},{key:"segmentChanged",value:function(e){this._writeListToPath()}},{key:"clear",value:function(){this._checkPathSynchronizedToList(),this._list.forEach((function(e){e._owningPathSegList=null})),this._list=[],this._writeListToPath()}},{key:"initialize",value:function(e){return this._checkPathSynchronizedToList(),this._list=[e],e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_checkValidIndex",value:function(e){if(isNaN(e)||e<0||e>=this.numberOfItems)throw new Error("INDEX_SIZE_ERR")}},{key:"getItem",value:function(e){return this._checkPathSynchronizedToList(),this._checkValidIndex(e),this._list[e]}},{key:"insertItemBefore",value:function(e,t){return this._checkPathSynchronizedToList(),t>this.numberOfItems&&(t=this.numberOfItems),e._owningPathSegList&&(e=e.clone()),this._list.splice(t,0,e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"replaceItem",value:function(e,t){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._checkValidIndex(t),this._list[t]=e,e._owningPathSegList=this,this._writeListToPath(),e}},{key:"removeItem",value:function(e){this._checkPathSynchronizedToList(),this._checkValidIndex(e);var t=this._list[e];return this._list.splice(e,1),this._writeListToPath(),t}},{key:"appendItem",value:function(e){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._list.push(e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_parsePath",value:function(e){if(!e||!e.length)return[];var t=this,n=function(){function e(){r(this,e),this.pathSegList=[]}return i(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),a=function(){function e(t){r(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return i(e,[{key:"_isCurrentSpace",value:function(){var e=this._string[this._currentIndex];return e<=" "&&(" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e)}},{key:"_skipOptionalSpaces",value:function(){for(;this._currentIndex="0"&&e<="9")&&t!==SVGPathSeg.PATHSEG_CLOSEPATH?t===SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:t===SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:t:SVGPathSeg.PATHSEG_UNKNOWN}},{key:"initialCommandIsMoveTo",value:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===SVGPathSeg.PATHSEG_MOVETO_ABS||e===SVGPathSeg.PATHSEG_MOVETO_REL}},{key:"_parseNumber",value:function(){var e=0,t=0,n=1,r=0,a=1,i=1,o=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!==this._string.charAt(this._currentIndex))){for(var s=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==s)for(var l=this._currentIndex-1,c=1;l>=s;)t+=c*(this._string.charAt(l--)-"0"),c*=10;if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)n*=10,r+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==o&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)e*=10,e+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var u=t+r;if(u*=a,e&&(u*=Math.pow(10,i*e)),o!==this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),u}}},{key:"_parseArcFlag",value:function(){if(!(this._currentIndex>=this._endIndex)){var e=!1,t=this._string.charAt(this._currentIndex++);if("0"===t)e=!1;else{if("1"!==t)return;e=!0}return this._skipOptionalSpacesOrDelimiter(),e}}},{key:"parseSegment",value:function(){var e=this._string[this._currentIndex],n=this._pathSegTypeFromChar(e);if(n===SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand===SVGPathSeg.PATHSEG_UNKNOWN)return null;if((n=this._nextCommandHelper(e,this._previousCommand))===SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=n,n){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(t);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,a.x,a.y,a.x1,a.y1,a.x2,a.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:var i={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(t,i.x,i.y,i.x2,i.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:var o={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,o.x,o.y,o.x2,o.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var s={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,s.x,s.y,s.x1,s.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:var l={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(t,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:var c={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(t,c.x,c.y,c.x1,c.y1,c.arcAngle,c.arcLarge,c.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:var u={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(t,u.x,u.y,u.x1,u.y1,u.arcAngle,u.arcLarge,u.arcSweep);default:throw new Error("Unknown path seg type.")}}}]),e}(),o=new n,s=new a(e);if(!s.initialCommandIsMoveTo())return[];for(;s.hasMoreData();){var l=s.parseSegment();if(!l)return[];o.appendSegment(l)}return o.pathSegList}}],[{key:"_pathSegArrayAsString",value:function(e){var t="",n=!0;return e.forEach((function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()})),t}}]),e}();C.prototype.classname="SVGPathSegList",Object.defineProperty(C.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new C(this)),this._pathSegList},enumerable:!0},normalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedNormalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0}}),window.SVGPathSegList=C}}();var m,v=jQuery,_=(Boolean(document.createElementNS&&document.createElementNS(f.SVG,"svg").createSVGRect),navigator.userAgent),y=document.createElementNS(f.SVG,"svg"),b=Boolean(window.opera),x=_.includes("AppleWebKit"),w=_.includes("Gecko/"),S=_.includes("MSIE"),k=_.includes("Chrome/"),C=(_.includes("Windows"),_.includes("Macintosh")),A="ontouchstart"in window,E=Boolean(y.querySelector),G=Boolean(document.evaluate),P=function(){var e=document.createElementNS(f.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.replaceItem(n,1),!0}catch(e){}return!1}(),I=function(){var e=document.createElementNS(f.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.insertItemBefore(n,1),!0}catch(e){}return!1}(),N=function(){var e=document.createElementNS(f.SVG,"svg"),t=document.createElementNS(f.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(f.SVG,"text");n.textContent="a",t.append(n);try{return 0===n.getStartPositionOfChar(0).x}catch(e){return!1}finally{e.remove()}}(),T=function(){var e=document.createElementNS(f.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(f.SVG,"path");t.setAttribute("d","M0,0 C0,0 10,10 10,0"),e.append(t);var n=t.getBBox();return e.remove(),n.height>4&&n.height<5}(),L=function(){var e=document.createElementNS(f.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(f.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(f.SVG,"path");n.setAttribute("d","M5,0 15,0");var r=document.createElementNS(f.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.width}(),M=(function(){var e=document.createElementNS(f.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");t||v.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the latest version in which the problems have been fixed.')}(),(m=document.createElementNS(f.SVG,"rect")).setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===m.style.vectorEffect),O=function(){var t=document.createElementNS(f.SVG,"rect").transform.baseVal,n=y.createSVGTransform();t.appendItem(n);var r=t.getItem(0),a=function(t){return t&&"object"===e(t)&&"function"==typeof t.setMatrix&&"angle"in t};return a(r)&&a(n)&&r.type===n.type&&r.angle===n.angle&&r.matrix.a===n.matrix.a&&r.matrix.b===n.matrix.b&&r.matrix.c===n.matrix.c&&r.matrix.d===n.matrix.d&&r.matrix.e===n.matrix.e&&r.matrix.f===n.matrix.f}(),j=function(){return b},V=function(){return x},R=function(){return w},B=function(){return S},D=function(){return k},U=function(){return C},F=function(){return A},H=function(){return L},z=function(){return M};
/**
* A jQuery module to work with SVG attributes.
* @module jQueryAttr
* @license MIT
*/
-function q(t){var n=t.fn.attr;return t.fn.attr=function(t,r){var a=this.length;if(!a)return n.call(this,t,r);for(var i=0;i=0)return this._xforms[e];var t=new Error("DOMException with code=INDEX_SIZE_ERR");throw t.code=1,t}},{key:"insertItemBefore",value:function(e,t){var n=null;if(t>=0)if(t=0&&(this._removeFromOtherLists(e),this._xforms[t]=e,n=e,this._list._update()),n}},{key:"removeItem",value:function(e){if(e=0){var t,n=this._xforms[e],r=new Array(this.numberOfItems-1);for(t=0;t=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(ce.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){for(var e=[],t=this.stack.length;t--;)for(var n=this.stack[t].elements(),r=n.length;r--;)e.includes(n[r])||e.push(n[r]);return e}},{key:"addSubCommand",value:function(e){this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),t}();ge.type=ge.prototype.type;var me,ve,ye,_e,be,xe=function(){function e(t){r(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return i(e,[{key:"resetUndoStack",value:function(){this.undoStack=[],this.undoStackPointer=0}},{key:"getUndoStackSize",value:function(){return this.undoStackPointer}},{key:"getRedoStackSize",value:function(){return this.undoStack.length-this.undoStackPointer}},{key:"getNextUndoCommandText",value:function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():""}},{key:"getNextRedoCommandText",value:function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}},{key:"redo",value:function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}},{key:"addCommandToHistory",value:function(e){this.undoStackPointer0&&(this.undoStack=this.undoStack.splice(0,this.undoStackPointer)),this.undoStack.push(e),this.undoStackPointer=this.undoStack.length}},{key:"beginUndoableChange",value:function(e,t){for(var n=++this.undoChangeStackPointer,r=t.length,a=new Array(r),i=new Array(r);r--;){var o=t[r];an(o)||(i[r]=o,a[r]=o.getAttribute(e))}this.undoableChangeStack[n]={attrName:e,oldValues:a,elements:i}}},{key:"finishUndoableChange",value:function(){for(var e=this.undoChangeStackPointer--,t=this.undoableChangeStack[e],n=t.attrName,r=new ge("Change "+n),a=t.elements.length;a--;){var i=t.elements[a];if(!an(i)){var o={};o[n]=t.oldValues[a],o[n]!==i.getAttribute(n)&&r.addSubCommand(new pe(i,o,n))}}return this.undoableChangeStack[e]=null,r}}]),e}(),we=Object.freeze({__proto__:null,HistoryEventTypes:ce,MoveElementCommand:de,InsertElementCommand:he,RemoveElementCommand:fe,ChangeElementCommand:pe,BatchCommand:ge,UndoManager:xe}),Se=document.createElementNS(p.SVG,"svg"),ke=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},Ce=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},Ae=function(){for(var e=arguments.length,t=new Array(e),n=0;n(n=parseInt(n))){var r=n;n=t,t=r}for(var a=Se.createSVGMatrix(),i=t;i<=n;++i){var o=i>=0&&ie.x&&t.ye.y},Le=jQuery,Me={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"]},Oe={},je=function(e){Object.assign(Oe,e.ui)},Ve=[],Re=!0,Be={},De=null,Ue=null,Fe=function(e){Ue=e,Ve=[0,"ClosePath"];Le.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],(function(e,t){Ve.push(t+"Abs"),Ve.push(t+"Rel")}))},He=function(e,t,n){var r=e.pathSegList;if(I)r.insertItemBefore(t,n);else{for(var a=r.numberOfItems,i=[],o=0;o0?(f=g element");this.elem=t,this.segs=[],this.selected_pts=[],De=this,this.init()}return i(e,[{key:"init",value:function(){Le(Xe()).find("*").each((function(){Le(this).attr("display","none")}));var e=this.elem.pathSegList,t=e.numberOfItems;this.segs=[],this.selected_pts=[],this.first_seg=null;for(var n=0;n=t?null:i[s+1],u=s-1<0?null:i[s-1];if(2===l.type){if(u&&1!==u.type){var d=i[o];d.next=i[o+1],d.next.prev=d,d.addGrip()}o=s}else if(c&&1===c.type)l.next=i[o+1],l.next.prev=l,l.mate=i[o],l.addGrip(),an(this.first_seg)&&(this.first_seg=l);else if(c)1!==l.type&&(l.addGrip(),c&&2!==c.type&&(l.next=c,l.next.prev=l));else if(1!==l.type){var h=i[o];h.next=i[o+1],h.next.prev=h,h.addGrip(),l.addGrip(),this.first_seg||(this.first_seg=i[o])}}return this}},{key:"eachSeg",value:function(e){for(var t=this.segs.length,n=0;n=0&&n.selected_pts.push(e)})),this.selected_pts.sort();var r=this.selected_pts.length,a=[];for(a.length=r;r--;){var i=this.selected_pts[r],o=this.segs[i];o.select(!0),a[r]=o.ptgrip}var s=e.subpathIsClosed(this.selected_pts[0]);Ue.addPtsToSelection({grips:a,closedSubpath:s})}}],[{key:"subpathIsClosed",value:function(e){var t=!1;return De.eachSeg((function(n){return n<=e||2!==this.type&&(1!==this.type||(t=!0,!1))})),t}}]),e}(),rt=function(e){var t=Be[e.id];return t||(t=Be[e.id]=new nt(e)),t},at=function(e){e in Be&&delete Be[e]},it=function(e,t){var n=e-ye,r=t-_e,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)+be;return n=a*Math.cos(i)+ye,r=a*Math.sin(i)+_e,n-=me,r-=ve,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)-be,{x:a*Math.cos(i)+me,y:a*Math.sin(i)+ve}},ot=function(){var e=De.elem;if(be=Zt(e,!0)){var t=De.oldbbox;ye=t.x+t.width/2,_e=t.y+t.height/2;var n=Dt(e);me=n.x+n.width/2,ve=n.y+n.height/2;var r=me-ye,a=ve-_e,i=Math.sqrt(r*r+a*a),o=Math.atan2(a,r)+be;me=i*Math.cos(o)+ye,ve=i*Math.sin(o)+_e;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var c=s.getItem(l),u=c.pathSegType;if(1!==u){var d=it(c.x,c.y),h=[d.x,d.y];if(!an(c.x1)&&!an(c.x2)){var f=it(c.x1,c.y1),p=it(c.x2,c.y2);h.splice(h.length,0,f.x,f.y,p.x,p.y)}$e(u,l,h)}}Dt(e);var g=Ue.getSVGRoot().createSVGTransform(),m=$(e);g.setRotate(180*be/Math.PI,me,ve),m.replaceItem(g,0)}},st=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],lt=function(e,t){for(var n=e.pathSegList,r=n.numberOfItems,a=0,i=0,o="",s=null,l=0;l=C-w&&g<=C+w&&m>=A-w&&m<=A+w){S=!0;break}}a=Ue.getId(),at(a);var E,G,P=Jt(a),I=b.numberOfItems;if(S){if(x<=1&&I>=2){var N=b.getItem(0).x,T=b.getItem(0).y;E=4===(G=v.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(N,T):_.createSVGPathSegCurvetoCubicAbs(N,T,G.x1/f,G.y1/f,N,T);var L=_.createSVGPathSegClosePath();b.appendItem(E),b.appendItem(L)}else if(I<3)return!1;if(Le(v).remove(),Ue.setDrawnPath(null),Ue.setStarted(!1),ht){De.matrix&&Ue.remapElement(P,{},De.matrix.inverse());var M=P.getAttribute("d"),O=Le(De.elem).attr("d");return Le(De.elem).attr("d",O+M),Le(P).remove(),De.matrix&&ot(),Fe(),gt.toEditMode(De.elem),De.selectPt(),!1}}else{if(!Le.contains(Ue.getContainer(),Ue.getMouseTarget(e)))return!1;var j=_.pathSegList.numberOfItems,V=_.pathSegList.getItem(j-1),R=V.x,B=V.y;if(e.shiftKey){var D=Ne(R,B,g,m);g=D.x,m=D.y}E=4===(G=v.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(Ue.round(g),Ue.round(m)):_.createSVGPathSegCurvetoCubicAbs(Ue.round(g),Ue.round(m),G.x1/f,G.y1/f,G.x2/f,G.y2/f),_.pathSegList.appendItem(E),g*=f,m*=f,v.setAttribute("d",["M",g,m,g,m].join(" ")),y=j,ht&&(y+=De.segs.length),We(y,g,m)}}else{var U="M"+g+","+m+" ";Ue.setDrawnPath(Ue.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:U,id:Ue.getNextId(),opacity:Ue.getOpacity()/2}})),v.setAttribute("d",["M",d,h,d,h].join(" ")),y=ht?De.segs.length:0,We(y,d,h)}}},mouseMove:function(e,t){var n=Ue.getCurrentZoom();pt=!0;var r=Ue.getDrawnPath();if("path"!==Ue.getCurrentMode())if(De.dragging){var a=Ye({x:De.dragging[0],y:De.dragging[1]},De),i=Ye({x:e,y:t},De),o=i.x-a.x,s=i.y-a.y;De.dragging=[e,t],De.dragctrl?De.moveCtrl(o,s):De.movePts(o,s)}else De.selected_pts=[],De.eachSeg((function(e){if(this.next||this.prev){var t=Ue.getRubberBox().getBBox(),n=qe(this),r={x:n.x,y:n.y,width:0,height:0},a=Te(t,r);this.select(a),a&&De.selected_pts.push(this.index)}}));else{if(!r)return;var l=r.pathSegList,c=l.numberOfItems-1;if(ut){var u=Qe("1c1"),d=Qe("0c2");u.setAttribute("cx",e),u.setAttribute("cy",t),u.setAttribute("display","inline");var h=ut[0],f=ut[1],p=h+(h-e/n),g=f+(f-t/n);d.setAttribute("cx",p*n),d.setAttribute("cy",g*n),d.setAttribute("display","inline");var m=Ke(1);if(en(m,{x1:e,y1:t,x2:p*n,y2:g*n,display:"inline"}),0===c)dt=[e,t];else{var v=l.getItem(c-1),y=v.x,_=v.y;6===v.pathSegType?(y+=y-v.x2,_+=_-v.y2):dt&&(y=dt[0]/n,_=dt[1]/n),$e(6,c,[h,f,y,_,p,g],r)}}else{var b=Jt("path_stretch_line");if(b){var x=l.getItem(c);if(6===x.pathSegType){var w=x.x+(x.x-x.x2),S=x.y+(x.y-x.y2);$e(6,1,[e,t,w*n,S*n,e,t],b)}else dt?$e(6,1,[e,t,dt[0],dt[1],e,t],b):$e(4,1,[e,t],b)}}}},mouseUp:function(e,t,n,r){var a=Ue.getDrawnPath();if("path"===Ue.getCurrentMode())return ut=null,a||(t=Jt(Ue.getId()),Ue.setStarted(!1),dt=null),{keep:!0,element:t};var i=Ue.getRubberBox();if(De.dragging){var o=De.cur_pt;De.dragging=!1,De.dragctrl=!1,De.update(),pt&&De.endChanges("Move path point(s)"),e.shiftKey||pt||De.selectPt(o)}else i&&"none"!==i.getAttribute("display")?(i.setAttribute("display","none"),i.getAttribute("width")<=2&&i.getAttribute("height")<=2&>.toSelectMode(e.target)):gt.toSelectMode(e.target);pt=!1},toEditMode:function(e){De=rt(e),Ue.setCurrentMode("pathedit"),Ue.clearSelection(),De.show(!0).update(),De.oldbbox=Dt(De.elem),ht=!1},toSelectMode:function(e){var t=e===De.elem;Ue.setCurrentMode("select"),De.show(!1),ft=!1,Ue.clearSelection(),De.matrix&&ot(),t&&(Ue.call("selected",[e]),Ue.addToSelection([e],!0))},addSubPath:function(e){e?(Ue.setCurrentMode("path"),ht=!0):(gt.clear(!0),gt.toEditMode(De.elem))},select:function(e){ft===e?(gt.toEditMode(e),Ue.setCurrentMode("pathedit")):ft=e},reorient:function(){var e=Ue.getSelectedElements()[0];if(e&&0!==Zt(e)){var t=new ge("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new pe(e,n)),Ue.clearSelection(),this.resetOrientation(e),Ue.addCommandToHistory(t),rt(e).show(!1).matrix=null,this.clear(),Ue.addToSelection([e],!0),Ue.call("changed",Ue.getSelectedElements())}},clear:function(e){var t=Ue.getDrawnPath();if(ft=null,t){var n=Jt(Ue.getId());Le(Jt("path_stretch_line")).remove(),Le(n).remove(),Le(Jt("pathpointgrip_container")).find("*").attr("display","none"),dt=null,Ue.setDrawnPath(null),Ue.setStarted(!1)}else"pathedit"===Ue.getCurrentMode()&&this.toSelectMode();De&&De.init().show(!1)},resetOrientation:function(e){if(an(e)||"path"!==e.nodeName)return!1;var t=$(e),n=Pe(t).matrix;t.clear(),e.removeAttribute("transform");for(var r=e.pathSegList,a=r.numberOfItems,i=function(t){var a=r.getItem(t),i=a.pathSegType;if(1===i)return"continue";var o=[];Le.each(["",1,2],(function(e,t){var r=a["x"+t],i=a["y"+t];if(void 0!==r&&void 0!==i){var s=ke(r,i,n);o.splice(o.length,0,s.x,s.y)}})),$e(i,t,o,e)},o=0;o0){var s=t.getItem(n-1).pathSegType;if(2===s){r(n-1,1),e();break}if(1===s&&t.numberOfItems-1===n){r(n,1),e();break}}}return!1}(),De.elem.pathSegList.numberOfItems<=1)return gt.toSelectMode(De.elem),void Ue.canvas.deleteSelectedElements();if(De.init(),De.clearSelection(),window.opera){var r=Le(De.elem);r.attr("d",r.attr("d"))}De.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t,n=e.points,r=n.numberOfItems;if(r>=4){var a=n.getItem(0),i=null,o=[];for(o.push(["M",a.x,",",a.y," C"].join("")),t=1;t<=r-4;t+=3){var s=n.getItem(t),l=n.getItem(t+1),c=n.getItem(t+2);if(i){var u=et(i,s,a);if(u&&2===u.length){var d=o[o.length-1].split(",");d[2]=u[0].x,d[3]=u[0].y,o[o.length-1]=d.join(","),s=u[1]}}o.push([s.x,s.y,l.x,l.y,c.x,c.y].join(",")),a=c,i=l}for(o.push("L");t)/,"$1$2")},kt=function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")};function Ct(e){if(e=Gt(e),window.btoa)return window.btoa(e);var t=new Array(4*Math.floor((e.length+2)/3)),n=0,r=0;do{var a=e.charCodeAt(n++),i=e.charCodeAt(n++),o=e.charCodeAt(n++),s=a>>2,l=(3&a)<<4|i>>4,c=(15&i)<<2|o>>6,u=63&o;isNaN(i)?(c=64,u=64):isNaN(o)&&(u=64),t[r++]=vt.charAt(s),t[r++]=vt.charAt(l),t[r++]=vt.charAt(c),t[r++]=vt.charAt(u)}while(n>4,l=(15&a)<<4|i>>2,c=(3&i)<<6|o;t+=String.fromCharCode(s),64!==i&&(t+=String.fromCharCode(l)),64!==o&&(t+=String.fromCharCode(c))}while(nSVG-edit