diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-28 12:57:52 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-28 12:57:52 +0100 |
commit | 58fd0d68bc8b46b23f8cdc65190f08d4e524eb57 (patch) | |
tree | 04247b959cb0517eb4a891c6afbabb734bb892bb | |
parent | 08b27426fa631a6200a5423161770acab50403bd (diff) | |
download | svg.js-58fd0d68bc8b46b23f8cdc65190f08d4e524eb57.tar.gz svg.js-58fd0d68bc8b46b23f8cdc65190f08d4e524eb57.zip |
Fix build chain so that we now have multiple builds. Details below:
- svg.js: The esm bundle
- svg.min.js: The bundle for all browsers for maximum support
- svg.node.js: The bundle for node
- polyfill.js: Using svg.min.js requires this polyfill in case the Browser does not understand all of ./config/polyfillList.js
- polyfillIE.js: This is required when you use IE11 (polyfill.js still required)
Please note, that not all test pass for IE11 due to its rounding issues and wrong calculation of bbox.
Also note, that `defaultPrevented` is not working for CustomEvents in IE11.
34 files changed, 12734 insertions, 6383 deletions
diff --git a/.config/karma.conf.common.js b/.config/karma.conf.common.js index 56c249f..a89c8e6 100644 --- a/.config/karma.conf.common.js +++ b/.config/karma.conf.common.js @@ -31,7 +31,7 @@ module.exports = function (config) { included: false, served: true }, - 'dist/svg.js', + 'dist/svg.min.js', 'spec/spec/*.js' ], @@ -61,6 +61,6 @@ module.exports = function (config) { concurrency: cpuCount || Infinity, // list of files to exclude - exclude: [], + exclude: [] } } diff --git a/.config/karma.conf.js b/.config/karma.conf.js index 57cf14f..ccda070 100644 --- a/.config/karma.conf.js +++ b/.config/karma.conf.js @@ -23,7 +23,7 @@ module.exports = function (config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { - 'dist/svg.js': ['coverage'] + 'dist/svg.min.js': ['coverage'] }, // this specifies which plugins karma should load @@ -35,7 +35,7 @@ module.exports = function (config) { 'karma-chrome-launcher', 'karma-coverage', 'karma-firefox-launcher', - 'karma-jasmine', + 'karma-jasmine' ], // test results reporter to use @@ -48,15 +48,15 @@ module.exports = function (config) { // Specify a reporter type. type: 'lcov', dir: 'coverage/', - subdir: function(browser) { + subdir: function (browser) { // normalization process to keep a consistent browser name accross different OS - return browser.toLowerCase().split(/[ /-]/)[0]; // output the results into: './coverage/firefox/' + return browser.toLowerCase().split(/[ /-]/)[0] // output the results into: './coverage/firefox/' } }, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: [chromeBin, 'FirefoxHeadless'], + browsers: [chromeBin, 'FirefoxHeadless'] }) ) } diff --git a/.config/karma.conf.saucelabs.js b/.config/karma.conf.saucelabs.js index 922d749..089f25a 100644 --- a/.config/karma.conf.saucelabs.js +++ b/.config/karma.conf.saucelabs.js @@ -9,8 +9,8 @@ const karmaCommon = require('./karma.conf.common.js') const SauceLabsLaunchers = { /** Real mobile devices are not available * Your account does not have access to Android devices. - * Please contact sales@saucelabs.com to add this feature to your account.*/ - /*sl_android_chrome: { + * Please contact sales@saucelabs.com to add this feature to your account. */ + /* sl_android_chrome: { base: 'SauceLabs', appiumVersion: '1.5.3', deviceName: 'Samsung Galaxy S7 Device', @@ -18,13 +18,13 @@ const SauceLabsLaunchers = { browserName: 'Chrome', platformVersion: '6.0', platformName: 'Android' - },*/ + }, */ /* sl_android: { base: 'SauceLabs', browserName: 'Android', deviceName: 'Android Emulator', deviceOrientation: 'portrait' - },*/ + }, */ SL_firefox_latest: { base: 'SauceLabs', browserName: 'firefox', @@ -39,7 +39,7 @@ const SauceLabsLaunchers = { base: 'SauceLabs', browserName: 'internet explorer', version: '11.0' - },/* + }/* sl_windows_edge: { base: 'SauceLabs', browserName: 'MicrosoftEdge', @@ -83,12 +83,10 @@ const SauceLabsLaunchers = { } */ } - -module.exports = function(config) { - +module.exports = function (config) { if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) { - console.error("SAUCE_USERNAME and SAUCE_ACCESS_KEY must be provided as environment variables.") - console.warn("Aborting Sauce Labs test") + console.error('SAUCE_USERNAME and SAUCE_ACCESS_KEY must be provided as environment variables.') + console.warn('Aborting Sauce Labs test') process.exit(1) } const settings = Object.assign(karmaCommon(config), { @@ -104,7 +102,7 @@ module.exports = function(config) { // get possible karma plugins by `ls node_modules | grep 'karma-*'` plugins: [ 'karma-jasmine', - 'karma-sauce-launcher', + 'karma-sauce-launcher' ], // logLevel: config.LOG_DEBUG, @@ -119,15 +117,15 @@ module.exports = function(config) { // start these browsers browsers: Object.keys(SauceLabsLaunchers), sauceLabs: { - testName: 'SVG.js Unit Tests', - // connectOptions: { - // noSslBumpDomains: "all" - // }, - // connectOptions: { - // port: 5757, - // logfile: 'sauce_connect.log' - // }, - }, + testName: 'SVG.js Unit Tests' + // connectOptions: { + // noSslBumpDomains: "all" + // }, + // connectOptions: { + // port: 5757, + // logfile: 'sauce_connect.log' + // }, + } // The number of disconnections tolerated. // browserDisconnectTolerance: 0, // well, sometimes it helps to just restart @@ -144,5 +142,4 @@ module.exports = function(config) { console.log(settings) config.set(settings) - } diff --git a/.config/polyfillList.js b/.config/polyfillList.js index 34ef4b6..37f80bd 100644 --- a/.config/polyfillList.js +++ b/.config/polyfillList.js @@ -1,11 +1,8 @@ -import 'core-js/modules/es6.function.name' +import 'core-js/modules/es6.object.assign' import 'core-js/modules/es6.object.keys' +import 'core-js/modules/es6.function.name' import 'core-js/modules/es6.symbol' import 'core-js/modules/es6.set' import 'core-js/modules/es7.array.includes' import 'core-js/modules/es6.string.includes' -import 'core-js/modules/es6.array.iterator' -import 'core-js/modules/es7.object.entries' -import 'core-js/modules/es6.object.assign' -import CustomEventPolyfill from '@target/custom-event-polyfill' -CustomEventPolyfill() +import 'core-js/modules/es6.array.from' diff --git a/.config/polyfillListIE.js b/.config/polyfillListIE.js new file mode 100644 index 0000000..dbffbc5 --- /dev/null +++ b/.config/polyfillListIE.js @@ -0,0 +1,31 @@ +/* global SVGElement */ +/* eslint no-new-object: "off" */ + +import CustomEventPolyfill from '@target/custom-event-polyfill/src/index.js6' +import children from '../src/polyfills/children.js' + +/* IE 11 has no innerHTML on SVGElement */ +import '../src/polyfills/innerHTML.js' + +/* IE 11 has no correct CustomEvent implementation */ +CustomEventPolyfill() + +/* IE 11 has no children on SVGElement */ +try { + if (!SVGElement.prototype.children) { + Object.defineProperty(SVGElement.prototype, 'children', { + get: function () { return children(this) } + }) + } +} catch (e) {} + +/* IE 11 cannot handle getPrototypeOf(not_obj) */ +try { + delete Object.getPrototypeOf('test') +} catch (e) { + var old = Object.getPrototypeOf + Object.getPrototypeOf = function (o) { + if (typeof o !== 'object') o = new Object(o) + return old.call(this, o) + } +} diff --git a/.config/pretest.js b/.config/pretest.js index 834e8d8..23b989e 100644 --- a/.config/pretest.js +++ b/.config/pretest.js @@ -1,20 +1,20 @@ +/* global XMLHttpRequest */ 'use strict' -function get(uri) { - var xhr = new XMLHttpRequest() - xhr.open('GET', uri, false) - xhr.send() - if(xhr.status !== 200) - console.error('SVG.js fixture could not be loaded. Tests will fail.') - return xhr.responseText +function get (uri) { + var xhr = new XMLHttpRequest() + xhr.open('GET', uri, false) + xhr.send() + if (xhr.status !== 200) { console.error('SVG.js fixture could not be loaded. Tests will fail.') } + return xhr.responseText } -function main() { - var style = document.createElement("style") - document.head.appendChild(style) - style.sheet.insertRule( get('/fixtures/fixture.css'), 0 ) +function main () { + var style = document.createElement('style') + document.head.appendChild(style) + style.sheet.insertRule(get('/fixtures/fixture.css'), 0) - document.body.innerHTML = get('/fixtures/fixture.svg') + document.body.innerHTML = get('/fixtures/fixture.svg') } main() diff --git a/.config/rollup.config.js b/.config/rollup.config.js index b7ad5d8..32096e5 100644 --- a/.config/rollup.config.js +++ b/.config/rollup.config.js @@ -1,7 +1,10 @@ import babel from 'rollup-plugin-babel' import * as pkg from '../package.json' -// import filesize from 'rollup-plugin-filesize' -import { terser } from 'rollup-plugin-terser' +import filesize from 'rollup-plugin-filesize' +// import { terser } from 'rollup-plugin-terser' +import resolve from 'rollup-plugin-node-resolve' +import commonjs from 'rollup-plugin-commonjs' +import { uglify } from 'rollup-plugin-uglify' const buildDate = Date() @@ -18,94 +21,97 @@ const headerLong = `/*! const headerShort = `/*! ${pkg.name} v${pkg.version} ${pkg.license}*/;` +const getBabelConfig = (esm, targets = { esmodules: true }, corejs = false) => babel({ + include: 'src/**', + runtimeHelpers: true, + babelrc: false, + presets: [['@babel/preset-env', { + modules: false, + targets: esm ? targets : pkg.browserslist, + useBuiltIns: 'usage' + }]], + plugins: [['@babel/plugin-transform-runtime', { + corejs: corejs, + helpers: true, + useESModules: true + }]] +}) + +// When few of these get mangled nothing works anymore +// We loose literally nothing by let these unmangled +const classes = [ + 'A', + 'ClipPath', + 'Defs', + 'Element', + 'G', + 'Image', + 'Marker', + 'Path', + 'Polygon', + 'Rect', + 'Stop', + 'Svg', + 'Text', + 'Tspan', + 'Circle', + 'Container', + 'Dom', + 'Ellipse', + 'Gradient', + 'Line', + 'Mask', + 'Pattern', + 'Polyline', + 'Shape', + 'Style', + 'Symbol', + 'TextPath', + 'Use' +] + const config = esm => ({ - input: './src/svg.js', + input: esm ? './src/main.js' : './src/svg.js', output: { file: esm ? './dist/svg.js' : './dist/svg.min.js', name: 'SVG', - sourceMap: !esm, + sourcemap: 'external', format: esm ? 'esm' : 'iife', - banner: esm ? headerShort : headerLong, - plugins: - esm - ? [] - : [ - babel({ - include: 'src/**', - runtimeHelpers: true, - babelrc: false, - presets: [["@babel/preset-env", { - modules: false, - targets: { - ie: 9, - chrome: 49, - edge: 14, - firefox: 45, - safari: 10 - }, - useBuiltIns: 'usage' - }]] - }), - terser() - ] - } + banner: esm ? headerLong : headerShort + }, + plugins: [ + resolve({ browser: true }), + commonjs(), + getBabelConfig(esm), + filesize(), + esm ? {} : uglify({ + mangle: { + reserved: classes + }, + output: { + preamble: headerShort + } + }) + ] }) -const modes = [true, false] +const nodeConfig = () => ({ + input: './src/main.js', + output: { + file: './dist/svg.node.js', + name: 'SVG', + sourcemap: 'external', + format: 'cjs', + banner: headerLong + }, + plugins: [ + resolve(), + commonjs(), + getBabelConfig(true, 'maintained node versions'), + filesize() + ] +}) -// console.log(modes.map(config)) -export default modes.map(config) +const modes = [true, false] -// export default [ -// { -// input: './src/svg.js', -// output: { -// file: 'dist/svg.js', -// name: 'SVG', -// sourceMap: true, -// format: 'iife', -// banner: headerLong -// }, -// plugins: [ -// // resolve({browser: true}), -// // commonjs(), -// babel({ -// include: 'src/**', -// runtimeHelpers: true, -// babelrc: false, -// presets: [["@babel/preset-env", { -// modules: false, -// targets: { -// ie: "9" -// }, -// useBuiltIns: 'usage' -// }]], -// }), -// filesize() -// ] -// },{ -// input: './.config/polyfills.js', -// output: { -// file: 'dist/polyfills.js', -// name: 'SVG', -// sourceMap: true, -// format: 'umd', -// banner: headerLong -// }, -// treeshake: false, -// plugins: [ -// // babel({ -// // runtimeHelpers: true, -// // babelrc: false, -// // presets: [["@babel/preset-env", { -// // modules: false, -// // targets: { -// // ie: "11" -// // }, -// // useBuiltIns: 'usage' -// // }]], -// // }), -// filesize() -// ] -// }, -// ] +export default modes.map(config).concat(nodeConfig()) diff --git a/.config/rollup.polyfills.js b/.config/rollup.polyfills.js index 810db91..1df059a 100644 --- a/.config/rollup.polyfills.js +++ b/.config/rollup.polyfills.js @@ -1,20 +1,22 @@ -import { uglify } from "rollup-plugin-uglify" import resolve from 'rollup-plugin-node-resolve' import commonjs from 'rollup-plugin-commonjs' +import { terser } from 'rollup-plugin-terser' +import filesize from 'rollup-plugin-filesize' -export default [ - { - input: './.config/polyfillList.js', - output: { - file: 'dist/polyfills.js', - name: 'polyfills', - sourceMap: 'external', - format: 'iife' - }, - plugins: [ - resolve({browser: true}), - commonjs(), - uglify() - ] - } -] +// We dont need babel. All polyfills are compatible +const config = (ie) => ({ + input: ie ? './.config/polyfillListIE.js' : './.config/polyfillList.js', + output: { + file: ie ? 'dist/polyfillsIE.js' : 'dist/polyfills.js', + sourceMap: false, + format: 'iife' + }, + plugins: [ + resolve({ browser: true }), + commonjs(), + terser(), + filesize() + ] +}) + +export default [false, true].map(config) diff --git a/.travis.yml b/.travis.yml index 9b7ad70..2a833bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,12 @@ node_js: - "stable" script: - npm run build - - npm run test:ci + - npm run test +# - npm run test:ci # - cat coverage/firefox/lcov.info | node_modules/.bin/coveralls addons: -# firefox: "latest" -# chrome: "stable" + firefox: "latest" + chrome: "stable" # hosts: # - karmalocal.com before_install: @@ -7,7 +7,7 @@ "Jon Ege Ronnenberg <jon.ronnenberg+svgjs@gmail.com>" ], "description": "A lightweight library for manipulating and animating SVG", - "main": "dist/svg.js", + "main": "dist/svg.min.js", "keywords": [ "svg", "vector", "graphics" ], @@ -18,4 +18,4 @@ "src/", "gulpfile.js" ] -}
\ No newline at end of file +} @@ -4,7 +4,9 @@ <head> <meta charset="utf-8"> <title></title> - <script type="text/javascript" src="dist/svg.js"></script> + <script type="text/javascript" src="dist/polyfills.js"></script> + <script type="text/javascript" src="dist/polyfillsIE.js"></script> + <script type="text/javascript" src="dist/svg.min.js"></script> @@ -29,27 +31,30 @@ <button name="play">Play</button> <button name="reverse">Reverse</button> <span id="displayText"></span> +<br> <!-- Making the svg --> -<svg width=1000px height=1000px id="canvas" viewbox="-1000 -2000 5000 5000"> +<svg width=1000px height=500px id="canvas"> <rect x=50 y=100 width=200 height=100 stroke=none stroke-width=2 /> </svg> <!-- Modifying the svg --> -<script type="module"> +<script type="text/javascript"> // import SVG from './src/svg.js' // // window.SVG = SVG -let rect = SVG('rect').hide() -let {sin, PI: pi, round, sqrt} = Math +var rect = SVG('rect').hide() +var sin = Math.sin +var pi = Math.PI +var round = Math.round function getColor(t) { - let a = round(80 * sin(2 * pi * t / 0.5 + 0.01) + 150) - let b = round(50 * sin(2 * pi * t / 0.5 + 4.6) + 200) - let c = round(100 * sin(2 * pi * t / 0.5 + 2.3) + 150) - let color = `rgb(${a}, ${b}, ${c})` + var a = round(80 * sin(2 * pi * t / 0.5 + 0.01) + 150) + var b = round(50 * sin(2 * pi * t / 0.5 + 4.6) + 200) + var c = round(100 * sin(2 * pi * t / 0.5 + 2.3) + 150) + var color = 'rgb('+ a +','+ b +','+ c +')' return color } @@ -115,7 +120,7 @@ function getColor(t) { // } // } -let canvas = SVG('#canvas') +var canvas = SVG('#canvas') canvas.attr('viewBox', null) @@ -133,7 +138,7 @@ r.schedule(t, 200) var schedule = t.schedule() -schedule.forEach((s, i) => { +schedule.forEach(function (s, i) { var rect = canvas.rect(s.duration / 10, 25) .move(100 + s.start/10, 100 + i*30) .attr('fill', '#000') @@ -151,61 +156,63 @@ var mover = canvas.line(100, 100, 100, 300).attr('stroke', 'black') mover.clone().insertAfter(mover) canvas.line(100, 300, 800, 300).attr('stroke', 'black') -const text = SVG('#displayText') +var text = SVG('#displayText') t.on('time', function (e) { mover.x(100 + e.detail/10) text.node.textContent = e.detail }) -t.on('finished', () => { +t.on('finished', function (e) { console.log('finished') }) -SVG('button[name="back100"]').on('click', () => { +SVG('button[name="back100"]').on('click', function (e) { t.seek(-100) }) -SVG('button[name="back1000"]').on('click', () => { +SVG('button[name="back1000"]').on('click', function (e) { t.seek(-1000) }) -SVG('button[name="forth100"]').on('click', () => { +SVG('button[name="forth100"]').on('click', function (e) { t.seek(100) }) -SVG('button[name="forth1000"]').on('click', () => { +SVG('button[name="forth1000"]').on('click', function (e) { t.seek(1000) }) -SVG('button[name="speed2"]').on('click', () => { +SVG('button[name="speed2"]').on('click', function (e) { t.speed(2) }) -SVG('button[name="speed05"]').on('click', () => { +SVG('button[name="speed05"]').on('click', function (e) { t.speed(0.5) }) -SVG('button[name="pause"]').on('click', () => { +SVG('button[name="pause"]').on('click', function (e) { t.pause() }) -SVG('button[name="play"]').on('click', () => { +SVG('button[name="play"]').on('click', function (e) { t.play() }) -SVG('button[name="stop"]').on('click', () => { +SVG('button[name="stop"]').on('click', function (e) { t.stop() }) -SVG('button[name="finish"]').on('click', () => { +SVG('button[name="finish"]').on('click', function (e) { t.finish() }) -SVG('button[name="reverse"]').on('click', () => { +SVG('button[name="reverse"]').on('click', function (e) { t.reverse() }) -canvas.rect(100, 100).on('click', (e) => { - e.target.instance.animate().move(Math.random()*1000, Math.random()*750).timeline().on('finished', () => { +canvas.rect(100, 100).on('click', function (e) { + e.target.instance.animate() + .move(Math.random()*1000, Math.random()*750) + .timeline().on('finished', function (e) { console.log('rect finished') }) }) diff --git a/dist/polyfills.js b/dist/polyfills.js index 10b88bf..96dd143 100644 --- a/dist/polyfills.js +++ b/dist/polyfills.js @@ -1 +1 @@ -!function(){"use strict";var b=function(t){return"object"==typeof t?null!==t:"function"==typeof t},h=function(t){if(!b(t))throw TypeError(t+" is not an object!");return t},m=function(t){try{return!!t()}catch(t){return!0}},u=!m(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a});function t(t,e){return t(e={exports:{}},e.exports),e.exports}var g=t(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),e=g.document,n=b(e)&&b(e.createElement),r=function(t){return n?e.createElement(t):{}},o=!u&&!m(function(){return 7!=Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a}),i=function(t,e){if(!b(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!b(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!b(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!b(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},c=Object.defineProperty,f={f:u?Object.defineProperty:function(t,e,n){if(h(t),e=i(e,!0),h(n),o)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},a=f.f,s=Function.prototype,l=/^\s*function ([^ (]*)/,p="name";p in s||u&&a(s,p,{configurable:!0,get:function(){try{return(""+this).match(l)[1]}catch(t){return""}}});var v=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},y=function(t){return Object(v(t))},d={}.hasOwnProperty,E=function(t,e){return d.call(t,e)},w={}.toString,_=function(t){return w.call(t).slice(8,-1)},O=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==_(t)?t.split(""):Object(t)},S=function(t){return O(v(t))},j=Math.ceil,k=Math.floor,P=function(t){return isNaN(t=+t)?0:(0<t?k:j)(t)},F=Math.min,T=function(t){return 0<t?F(P(t),9007199254740991):0},x=Math.max,A=Math.min,N=function(a){return function(t,e,n){var r,o,i,u=S(t),c=T(u.length),f=(o=c,(r=P(r=n))<0?x(r+o,0):A(r,o));if(a&&e!=e){for(;f<c;)if((i=u[f++])!=i)return!0}else for(;f<c;f++)if((a||f in u)&&u[f]===e)return a||f||0;return!a&&-1}},C=t(function(t){var e=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=e)}),I=(C.version,t(function(t){var e="__core-js_shared__",n=g[e]||(g[e]={});(t.exports=function(t,e){return n[t]||(n[t]=void 0!==e?e:{})})("versions",[]).push({version:C.version,mode:"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})})),M=0,D=Math.random(),W=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++M+D).toString(36))},L=I("keys"),B=function(t){return L[t]||(L[t]=W(t))},R=N(!1),K=B("IE_PROTO"),z=function(t,e){var n,r=S(t),o=0,i=[];for(n in r)n!=K&&E(r,n)&&i.push(n);for(;e.length>o;)E(r,n=e[o++])&&(~R(i,n)||i.push(n));return i},Y="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),G=Object.keys||function(t){return z(t,Y)},J=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},U=u?function(t,e,n){return f.f(t,e,J(1,n))}:function(t,e,n){return t[e]=n,t},X=t(function(t){var i=W("src"),e="toString",n=Function[e],u=(""+n).split(e);C.inspectSource=function(t){return n.call(t)},(t.exports=function(t,e,n,r){var o="function"==typeof n;o&&(E(n,"name")||U(n,"name",e)),t[e]!==n&&(o&&(E(n,i)||U(n,i,t[e]?""+t[e]:u.join(String(e)))),t===g?t[e]=n:r?t[e]?t[e]=n:U(t,e,n):(delete t[e],U(t,e,n)))})(Function.prototype,e,function(){return"function"==typeof this&&this[i]||n.call(this)})}),q=function(r,o,t){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(r),void 0===o)return r;switch(t){case 1:return function(t){return r.call(o,t)};case 2:return function(t,e){return r.call(o,t,e)};case 3:return function(t,e,n){return r.call(o,t,e,n)}}return function(){return r.apply(o,arguments)}},Q="prototype",V=function(t,e,n){var r,o,i,u,c=t&V.F,f=t&V.G,a=t&V.S,s=t&V.P,l=t&V.B,p=f?g:a?g[e]||(g[e]={}):(g[e]||{})[Q],v=f?C:C[e]||(C[e]={}),y=v[Q]||(v[Q]={});for(r in f&&(n=e),n)i=((o=!c&&p&&void 0!==p[r])?p:n)[r],u=l&&o?q(i,g):s&&"function"==typeof i?q(Function.call,i):i,p&&X(p,r,i,t&V.U),v[r]!=i&&U(v,r,u),s&&y[r]!=i&&(y[r]=i)};g.core=C,V.F=1,V.G=2,V.S=4,V.P=8,V.B=16,V.W=32,V.U=64,V.R=128;var H,Z,$,tt,et=V;H="keys",Z=function(){return function(t){return G(y(t))}},$=(C.Object||{})[H]||Object[H],(tt={})[H]=Z($),et(et.S+et.F*m(function(){$(1)}),"Object",tt);var nt,rt,ot=t(function(t){var n=W("meta"),e=f.f,r=0,o=Object.isExtensible||function(){return!0},i=!m(function(){return o(Object.preventExtensions({}))}),u=function(t){e(t,n,{value:{i:"O"+ ++r,w:{}}})},c=t.exports={KEY:n,NEED:!1,fastKey:function(t,e){if(!b(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!E(t,n)){if(!o(t))return"F";if(!e)return"E";u(t)}return t[n].i},getWeak:function(t,e){if(!E(t,n)){if(!o(t))return!0;if(!e)return!1;u(t)}return t[n].w},onFreeze:function(t){return i&&c.NEED&&o(t)&&!E(t,n)&&u(t),t}}}),it=(ot.KEY,ot.NEED,ot.fastKey,ot.getWeak,ot.onFreeze,t(function(t){var e=I("wks"),n=g.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:W)("Symbol."+t))}).store=e})),ut=f.f,ct=it("toStringTag"),ft=function(t,e,n){t&&!E(t=n?t:t.prototype,ct)&&ut(t,ct,{configurable:!0,value:e})},at={f:it},st=f.f,lt={f:Object.getOwnPropertySymbols},pt={f:{}.propertyIsEnumerable},vt=Array.isArray||function(t){return"Array"==_(t)},yt=u?Object.defineProperties:function(t,e){h(t);for(var n,r=G(e),o=r.length,i=0;i<o;)f.f(t,n=r[i++],e[n]);return t},ht=g.document,dt=ht&&ht.documentElement,bt=B("IE_PROTO"),mt=function(){},gt="prototype",Et=function(){var t,e=r("iframe"),n=Y.length;for(e.style.display="none",dt.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),Et=t.F;n--;)delete Et[gt][Y[n]];return Et()},wt=Object.create||function(t,e){var n;return null!==t?(mt[gt]=h(t),n=new mt,mt[gt]=null,n[bt]=t):n=Et(),void 0===e?n:yt(n,e)},_t=Y.concat("length","prototype"),Ot={f:Object.getOwnPropertyNames||function(t){return z(t,_t)}},St=Ot.f,jt={}.toString,kt="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Pt={f:function(t){return kt&&"[object Window]"==jt.call(t)?function(t){try{return St(t)}catch(t){return kt.slice()}}(t):St(S(t))}},Ft=Object.getOwnPropertyDescriptor,Tt={f:u?Ft:function(t,e){if(t=S(t),e=i(e,!0),o)try{return Ft(t,e)}catch(t){}if(E(t,e))return J(!pt.f.call(t,e),t[e])}},xt=ot.KEY,At=Tt.f,Nt=f.f,Ct=Pt.f,It=g.Symbol,Mt=g.JSON,Dt=Mt&&Mt.stringify,Wt="prototype",Lt=it("_hidden"),Bt=it("toPrimitive"),Rt={}.propertyIsEnumerable,Kt=I("symbol-registry"),zt=I("symbols"),Yt=I("op-symbols"),Gt=Object[Wt],Jt="function"==typeof It,Ut=g.QObject,Xt=!Ut||!Ut[Wt]||!Ut[Wt].findChild,qt=u&&m(function(){return 7!=wt(Nt({},"a",{get:function(){return Nt(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=At(Gt,e);r&&delete Gt[e],Nt(t,e,n),r&&t!==Gt&&Nt(Gt,e,r)}:Nt,Qt=function(t){var e=zt[t]=wt(It[Wt]);return e._k=t,e},Vt=Jt&&"symbol"==typeof It.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof It},Ht=function(t,e,n){return t===Gt&&Ht(Yt,e,n),h(t),e=i(e,!0),h(n),E(zt,e)?(n.enumerable?(E(t,Lt)&&t[Lt][e]&&(t[Lt][e]=!1),n=wt(n,{enumerable:J(0,!1)})):(E(t,Lt)||Nt(t,Lt,J(1,{})),t[Lt][e]=!0),qt(t,e,n)):Nt(t,e,n)},Zt=function(t,e){h(t);for(var n,r=function(t){var e=G(t),n=lt.f;if(n)for(var r,o=n(t),i=pt.f,u=0;o.length>u;)i.call(t,r=o[u++])&&e.push(r);return e}(e=S(e)),o=0,i=r.length;o<i;)Ht(t,n=r[o++],e[n]);return t},$t=function(t){var e=Rt.call(this,t=i(t,!0));return!(this===Gt&&E(zt,t)&&!E(Yt,t))&&(!(e||!E(this,t)||!E(zt,t)||E(this,Lt)&&this[Lt][t])||e)},te=function(t,e){if(t=S(t),e=i(e,!0),t!==Gt||!E(zt,e)||E(Yt,e)){var n=At(t,e);return!n||!E(zt,e)||E(t,Lt)&&t[Lt][e]||(n.enumerable=!0),n}},ee=function(t){for(var e,n=Ct(S(t)),r=[],o=0;n.length>o;)E(zt,e=n[o++])||e==Lt||e==xt||r.push(e);return r},ne=function(t){for(var e,n=t===Gt,r=Ct(n?Yt:S(t)),o=[],i=0;r.length>i;)!E(zt,e=r[i++])||n&&!E(Gt,e)||o.push(zt[e]);return o};Jt||(X((It=function(){if(this instanceof It)throw TypeError("Symbol is not a constructor!");var e=W(0<arguments.length?arguments[0]:void 0),n=function(t){this===Gt&&n.call(Yt,t),E(this,Lt)&&E(this[Lt],e)&&(this[Lt][e]=!1),qt(this,e,J(1,t))};return u&&Xt&&qt(Gt,e,{configurable:!0,set:n}),Qt(e)})[Wt],"toString",function(){return this._k}),Tt.f=te,f.f=Ht,Ot.f=Pt.f=ee,pt.f=$t,lt.f=ne,u&&X(Gt,"propertyIsEnumerable",$t,!0),at.f=function(t){return Qt(it(t))}),et(et.G+et.W+et.F*!Jt,{Symbol:It});for(var re="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),oe=0;re.length>oe;)it(re[oe++]);for(var ie=G(it.store),ue=0;ie.length>ue;)nt=ie[ue++],void 0,rt=C.Symbol||(C.Symbol=g.Symbol||{}),"_"==nt.charAt(0)||nt in rt||st(rt,nt,{value:at.f(nt)});et(et.S+et.F*!Jt,"Symbol",{for:function(t){return E(Kt,t+="")?Kt[t]:Kt[t]=It(t)},keyFor:function(t){if(!Vt(t))throw TypeError(t+" is not a symbol!");for(var e in Kt)if(Kt[e]===t)return e},useSetter:function(){Xt=!0},useSimple:function(){Xt=!1}}),et(et.S+et.F*!Jt,"Object",{create:function(t,e){return void 0===e?wt(t):Zt(wt(t),e)},defineProperty:Ht,defineProperties:Zt,getOwnPropertyDescriptor:te,getOwnPropertyNames:ee,getOwnPropertySymbols:ne}),Mt&&et(et.S+et.F*(!Jt||m(function(){var t=It();return"[null]"!=Dt([t])||"{}"!=Dt({a:t})||"{}"!=Dt(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=e=r[1],(b(e)||void 0!==t)&&!Vt(t))return vt(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!Vt(e))return e}),r[1]=e,Dt.apply(Mt,r)}}),It[Wt][Bt]||U(It[Wt],Bt,It[Wt].valueOf),ft(It,"Symbol"),ft(Math,"Math",!0),ft(g.JSON,"JSON",!0);var ce=function(t,e,n){for(var r in e)X(t,r,e[r],n);return t},fe=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t},ae=function(e,t,n,r){try{return r?t(h(n)[0],n[1]):t(n)}catch(t){var o=e.return;throw void 0!==o&&h(o.call(e)),t}},se={},le=it("iterator"),pe=Array.prototype,ve=it("toStringTag"),ye="Arguments"==_(function(){return arguments}()),he=it("iterator"),de=C.getIteratorMethod=function(t){if(null!=t)return t[he]||t["@@iterator"]||se[(e=t,void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(n=Object(e),ve))?r:ye?_(n):"Object"==(o=_(n))&&"function"==typeof n.callee?"Arguments":o)];var e,n,r,o},be=t(function(t){var v={},y={},e=t.exports=function(t,e,n,r,o){var i,u,c,f,a,s=o?function(){return t}:de(t),l=q(n,r,e?2:1),p=0;if("function"!=typeof s)throw TypeError(t+" is not iterable!");if(void 0===(a=s)||se.Array!==a&&pe[le]!==a){for(c=s.call(t);!(u=c.next()).done;)if((f=ae(c,l,u.value,e))===v||f===y)return f}else for(i=T(t.length);p<i;p++)if((f=e?l(h(u=t[p])[0],u[1]):l(t[p]))===v||f===y)return f};e.BREAK=v,e.RETURN=y}),me={};U(me,it("iterator"),function(){return this});var ge=B("IE_PROTO"),Ee=Object.prototype,we=Object.getPrototypeOf||function(t){return t=y(t),E(t,ge)?t[ge]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Ee:null},_e=it("iterator"),Oe=!([].keys&&"next"in[].keys()),Se="values",je=function(){return this},ke=function(t,e,n,r,o,i,u){var c,f,a;f=e,a=r,(c=n).prototype=wt(me,{next:J(1,a)}),ft(c,f+" Iterator");var s,l,p,v=function(t){if(!Oe&&t in b)return b[t];switch(t){case"keys":case Se:return function(){return new n(this,t)}}return function(){return new n(this,t)}},y=e+" Iterator",h=o==Se,d=!1,b=t.prototype,m=b[_e]||b["@@iterator"]||o&&b[o],g=m||v(o),E=o?h?v("entries"):g:void 0,w="Array"==e&&b.entries||m;if(w&&(p=we(w.call(new t)))!==Object.prototype&&p.next&&(ft(p,y,!0),"function"!=typeof p[_e]&&U(p,_e,je)),h&&m&&m.name!==Se&&(d=!0,g=function(){return m.call(this)}),(Oe||d||!b[_e])&&U(b,_e,g),se[e]=g,se[y]=je,o)if(s={values:h?g:v(Se),keys:i?g:v("keys"),entries:E},u)for(l in s)l in b||X(b,l,s[l]);else et(et.P+et.F*(Oe||d),e,s);return s},Pe=function(t,e){return{value:e,done:!!t}},Fe=it("species"),Te=function(t,e){if(!b(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t},xe=f.f,Ae=ot.fastKey,Ne=u?"_s":"size",Ce=function(t,e){var n,r=Ae(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n},Ie={getConstructor:function(t,i,n,r){var o=t(function(t,e){fe(t,o,i,"_i"),t._t=i,t._i=wt(null),t._f=void 0,t._l=void 0,t[Ne]=0,null!=e&&be(e,n,t[r],t)});return ce(o.prototype,{clear:function(){for(var t=Te(this,i),e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[Ne]=0},delete:function(t){var e=Te(this,i),n=Ce(e,t);if(n){var r=n.n,o=n.p;delete e._i[n.i],n.r=!0,o&&(o.n=r),r&&(r.p=o),e._f==n&&(e._f=r),e._l==n&&(e._l=o),e[Ne]--}return!!n},forEach:function(t){Te(this,i);for(var e,n=q(t,1<arguments.length?arguments[1]:void 0,3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!Ce(Te(this,i),t)}}),u&&xe(o.prototype,"size",{get:function(){return Te(this,i)[Ne]}}),o},def:function(t,e,n){var r,o,i=Ce(t,e);return i?i.v=n:(t._l=i={i:o=Ae(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=i),r&&(r.n=i),t[Ne]++,"F"!==o&&(t._i[o]=i)),t},getEntry:Ce,setStrong:function(t,n,e){var r;ke(t,n,function(t,e){this._t=Te(t,n),this._k=e,this._l=void 0},function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?Pe(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,Pe(1))},e?"entries":"values",!e,!0),r=g[n],u&&r&&!r[Fe]&&f.f(r,Fe,{configurable:!0,get:function(){return this}})}},Me=it("iterator"),De=!1;try{[7][Me]().return=function(){De=!0}}catch(t){}var We=function(t,e){if(h(t),!b(e)&&null!==e)throw TypeError(e+": can't set as prototype!")},Le={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=q(Function.call,Tt.f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return We(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:We}.set,Be=(function(c,t,e,n,f,r){var a=g[c],s=a,l=f?"set":"add",o=s&&s.prototype,i={},u=function(t){var n=o[t];X(o,t,"delete"==t?function(t){return!(r&&!b(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(r&&!b(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return r&&!b(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,e){return n.call(this,0===t?0:t,e),this})};if("function"==typeof s&&(r||o.forEach&&!m(function(){(new s).entries().next()}))){var p=new s,v=p[l](r?{}:-0,1)!=p,y=m(function(){p.has(1)}),h=function(t,e){if(!e&&!De)return!1;var n=!1;try{var r=[7],o=r[Me]();o.next=function(){return{done:n=!0}},r[Me]=function(){return o},t(r)}catch(t){}return n}(function(t){new s(t)}),d=!r&&m(function(){for(var t=new s,e=5;e--;)t[l](e,e);return!t.has(-0)});h||(((s=t(function(t,e){fe(t,s,c);var n,r,o,i,u=(n=new a,r=s,(i=t.constructor)!==r&&"function"==typeof i&&(o=i.prototype)!==r.prototype&&b(o)&&Le&&Le(n,o),n);return null!=e&&be(e,f,u[l],u),u})).prototype=o).constructor=s),(y||d)&&(u("delete"),u("has"),f&&u("get")),(d||v)&&u(l),r&&o.clear&&delete o.clear}else s=n.getConstructor(t,c,f,l),ce(s.prototype,e),ot.NEED=!0;ft(s,c),i[c]=s,et(et.G+et.W+et.F*(s!=a),i),r||n.setStrong(s,c,f)}("Set",function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function(t){return Ie.def(Te(this,"Set"),t=0===t?0:t,t)}},Ie),it("unscopables")),Re=Array.prototype;null==Re[Be]&&U(Re,Be,{});var Ke=function(t){Re[Be][t]=!0},ze=N(!0);et(et.P,"Array",{includes:function(t){return ze(this,t,1<arguments.length?arguments[1]:void 0)}}),Ke("includes");var Ye=it("match"),Ge=function(t,e,n){if(b(r=e)&&(void 0!==(o=r[Ye])?o:"RegExp"==_(r)))throw TypeError("String#"+n+" doesn't accept regex!");var r,o;return String(v(t))},Je=it("match"),Ue="includes";et(et.P+et.F*function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[Je]=!1,!"/./"[e](n)}catch(t){}}return!0}(Ue),"String",{includes:function(t){return!!~Ge(this,t,Ue).indexOf(t,1<arguments.length?arguments[1]:void 0)}});ke(Array,"Array",function(t,e){this._t=S(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,Pe(1)):Pe(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");se.Arguments=se.Array,Ke("keys"),Ke("values"),Ke("entries");var Xe,qe=pt.f,Qe=(Xe=!0,function(t){for(var e,n=S(t),r=G(n),o=r.length,i=0,u=[];i<o;)qe.call(n,e=r[i++])&&u.push(Xe?[e,n[e]]:n[e]);return u});et(et.S,"Object",{entries:function(t){return Qe(t)}});var Ve=Object.assign,He=!Ve||m(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=Ve({},t)[n]||Object.keys(Ve({},e)).join("")!=r})?function(t,e){for(var n=y(t),r=arguments.length,o=1,i=lt.f,u=pt.f;o<r;)for(var c,f=O(arguments[o++]),a=i?G(f).concat(i(f)):G(f),s=a.length,l=0;l<s;)u.call(f,c=a[l++])&&(n[c]=f[c]);return n}:Ve;et(et.S+et.F,"Object",{assign:He}),function(i){(function(t){if(!("Event"in t))return!1;if("function"==typeof t.Event)return!0;try{return new Event("click"),!0}catch(t){return!1}})(this)||function(){var n={click:1,dblclick:1,keyup:1,keypress:1,keydown:1,mousedown:1,mouseup:1,mousemove:1,mouseover:1,mouseenter:1,mouseleave:1,mouseout:1,storage:1,storagecommit:1,textinput:1};function c(t,e){for(var n=-1,r=t.length;++n<r;)if(n in t&&t[n]===e)return n;return-1}var t=window.Event&&window.Event.prototype||null;window.Event=Window.prototype.Event=function(t,e){if(!t)throw new Error("Not enough arguments");if("createEvent"in document){var n=document.createEvent("Event"),r=!(!e||e.bubbles===i)&&e.bubbles,o=!(!e||e.cancelable===i)&&e.cancelable;return n.initEvent(t,r,o),n}return(n=document.createEventObject()).type=t,n.bubbles=!(!e||e.bubbles===i)&&e.bubbles,n.cancelable=!(!e||e.cancelable===i)&&e.cancelable,n},t&&Object.defineProperty(window.Event,"prototype",{configurable:!1,enumerable:!1,writable:!0,value:t}),"createEvent"in document||(window.addEventListener=Window.prototype.addEventListener=Document.prototype.addEventListener=Element.prototype.addEventListener=function(){var u=this,t=arguments[0],e=arguments[1];if(u===window&&t in n)throw new Error("In IE8 the event: "+t+" is not available on the window object.");u._events||(u._events={}),u._events[t]||(u._events[t]=function(t){var e,n=u._events[t.type].list,r=n.slice(),o=-1,i=r.length;for(t.preventDefault=function(){!1!==t.cancelable&&(t.returnValue=!1)},t.stopPropagation=function(){t.cancelBubble=!0},t.stopImmediatePropagation=function(){t.cancelBubble=!0,t.cancelImmediate=!0},t.currentTarget=u,t.relatedTarget=t.fromElement||null,t.target=t.target||t.srcElement||u,t.timeStamp=(new Date).getTime(),t.clientX&&(t.pageX=t.clientX+document.documentElement.scrollLeft,t.pageY=t.clientY+document.documentElement.scrollTop);++o<i&&!t.cancelImmediate;)o in r&&-1!==c(n,e=r[o])&&"function"==typeof e&&e.call(u,t)},u._events[t].list=[],u.attachEvent&&u.attachEvent("on"+t,u._events[t])),u._events[t].list.push(e)},window.removeEventListener=Window.prototype.removeEventListener=Document.prototype.removeEventListener=Element.prototype.removeEventListener=function(){var t,e=this,n=arguments[0],r=arguments[1];e._events&&e._events[n]&&e._events[n].list&&-1!==(t=c(e._events[n].list,r))&&(e._events[n].list.splice(t,1),e._events[n].list.length||(e.detachEvent&&e.detachEvent("on"+n,e._events[n]),delete e._events[n]))},window.dispatchEvent=Window.prototype.dispatchEvent=Document.prototype.dispatchEvent=Element.prototype.dispatchEvent=function(e){if(!arguments.length)throw new Error("Not enough arguments");if(!e||"string"!=typeof e.type)throw new Error("DOM Events Exception 0");var n=this,r=e.type;try{if(!e.bubbles){e.cancelBubble=!0;var o=function(t){t.cancelBubble=!0,(n||window).detachEvent("on"+r,o)};this.attachEvent("on"+r,o)}this.fireEvent("on"+r,e)}catch(t){for(e.target=n;"_events"in(e.currentTarget=n)&&"function"==typeof n._events[r]&&n._events[r].call(n,e),"function"==typeof n["on"+r]&&n["on"+r].call(n,e),(n=9===n.nodeType?n.parentWindow:n.parentNode)&&!e.cancelBubble;);}return!0},document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&document.dispatchEvent(new Event("DOMContentLoaded",{bubbles:!0}))}))}(),"CustomEvent"in this&&("function"==typeof this.CustomEvent||-1<this.CustomEvent.toString().indexOf("CustomEventConstructor"))||(this.CustomEvent=function(e,n){if(!e)throw Error('TypeError: Failed to construct "CustomEvent": An event name must be provided.');var r;if(n=n||{bubbles:!1,cancelable:!1,detail:null},"createEvent"in document)try{(r=document.createEvent("CustomEvent")).initCustomEvent(e,n.bubbles,n.cancelable,n.detail)}catch(t){(r=document.createEvent("Event")).initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail}else(r=new Event(e,n)).detail=n&&n.detail||null;return r},CustomEvent.prototype=Event.prototype)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{})}(); +!function(){"use strict";function t(t,n){return t(n={exports:{}},n.exports),n.exports}var n=t(function(t){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)}),r=t(function(t){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)}),e=(r.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),o=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t},i=function(t){try{return!!t()}catch(t){return!0}},u=!i(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),c=n.document,f=e(c)&&e(c.createElement),a=function(t){return f?c.createElement(t):{}},s=!u&&!i(function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}),l=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")},p=Object.defineProperty,y={f:u?Object.defineProperty:function(t,n,r){if(o(t),n=l(n,!0),o(r),s)try{return p(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},h=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}},v=u?function(t,n,r){return y.f(t,n,h(1,r))}:function(t,n,r){return t[n]=r,t},d={}.hasOwnProperty,g=function(t,n){return d.call(t,n)},b=0,_=Math.random(),m=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++b+_).toString(36))},O=t(function(t){var e=m("src"),o=Function.toString,i=(""+o).split("toString");r.inspectSource=function(t){return o.call(t)},(t.exports=function(t,r,o,u){var c="function"==typeof o;c&&(g(o,"name")||v(o,"name",r)),t[r]!==o&&(c&&(g(o,e)||v(o,e,t[r]?""+t[r]:i.join(String(r)))),t===n?t[r]=o:u?t[r]?t[r]=o:v(t,r,o):(delete t[r],v(t,r,o)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[e]||o.call(this)})}),w=function(t,n,r){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}},S=function(t,e,o){var i,u,c,f,a=t&S.F,s=t&S.G,l=t&S.S,p=t&S.P,y=t&S.B,h=s?n:l?n[e]||(n[e]={}):(n[e]||{}).prototype,d=s?r:r[e]||(r[e]={}),g=d.prototype||(d.prototype={});for(i in s&&(o=e),o)c=((u=!a&&h&&void 0!==h[i])?h:o)[i],f=y&&u?w(c,n):p&&"function"==typeof c?w(Function.call,c):c,h&&O(h,i,c,t&S.U),d[i]!=c&&v(d,i,f),p&&g[i]!=c&&(g[i]=c)};n.core=r,S.F=1,S.G=2,S.S=4,S.P=8,S.B=16,S.W=32,S.U=64,S.R=128;var j=S,E={}.toString,P=function(t){return E.call(t).slice(8,-1)},k=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==P(t)?t.split(""):Object(t)},F=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},x=function(t){return k(F(t))},T=Math.ceil,A=Math.floor,N=function(t){return isNaN(t=+t)?0:(t>0?A:T)(t)},I=Math.min,M=function(t){return t>0?I(N(t),9007199254740991):0},R=Math.max,C=Math.min,D=function(t){return function(n,r,e){var o,i=x(n),u=M(i.length),c=function(t,n){return(t=N(t))<0?R(t+n,0):C(t,n)}(e,u);if(t&&r!=r){for(;u>c;)if((o=i[c++])!=o)return!0}else for(;u>c;c++)if((t||c in i)&&i[c]===r)return t||c||0;return!t&&-1}},K=t(function(t){var e=n["__core-js_shared__"]||(n["__core-js_shared__"]={});(t.exports=function(t,n){return e[t]||(e[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})}),W=K("keys"),z=function(t){return W[t]||(W[t]=m(t))},G=D(!1),J=z("IE_PROTO"),U=function(t,n){var r,e=x(t),o=0,i=[];for(r in e)r!=J&&g(e,r)&&i.push(r);for(;n.length>o;)g(e,r=n[o++])&&(~G(i,r)||i.push(r));return i},B="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Y=Object.keys||function(t){return U(t,B)},q={f:Object.getOwnPropertySymbols},L={f:{}.propertyIsEnumerable},Q=function(t){return Object(F(t))},H=Object.assign,V=!H||i(function(){var t={},n={},r=Symbol(),e="abcdefghijklmnopqrst";return t[r]=7,e.split("").forEach(function(t){n[t]=t}),7!=H({},t)[r]||Object.keys(H({},n)).join("")!=e})?function(t,n){for(var r=Q(t),e=arguments.length,o=1,i=q.f,u=L.f;e>o;)for(var c,f=k(arguments[o++]),a=i?Y(f).concat(i(f)):Y(f),s=a.length,l=0;s>l;)u.call(f,c=a[l++])&&(r[c]=f[c]);return r}:H;j(j.S+j.F,"Object",{assign:V});var X,Z,$,tt;X="keys",Z=function(){return function(t){return Y(Q(t))}},$=(r.Object||{})[X]||Object[X],(tt={})[X]=Z($),j(j.S+j.F*i(function(){$(1)}),"Object",tt);var nt=y.f,rt=Function.prototype,et=/^\s*function ([^ (]*)/;"name"in rt||u&&nt(rt,"name",{configurable:!0,get:function(){try{return(""+this).match(et)[1]}catch(t){return""}}});var ot=t(function(t){var n=m("meta"),r=y.f,o=0,u=Object.isExtensible||function(){return!0},c=!i(function(){return u(Object.preventExtensions({}))}),f=function(t){r(t,n,{value:{i:"O"+ ++o,w:{}}})},a=t.exports={KEY:n,NEED:!1,fastKey:function(t,r){if(!e(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!g(t,n)){if(!u(t))return"F";if(!r)return"E";f(t)}return t[n].i},getWeak:function(t,r){if(!g(t,n)){if(!u(t))return!0;if(!r)return!1;f(t)}return t[n].w},onFreeze:function(t){return c&&a.NEED&&u(t)&&!g(t,n)&&f(t),t}}}),it=(ot.KEY,ot.NEED,ot.fastKey,ot.getWeak,ot.onFreeze,t(function(t){var r=K("wks"),e=n.Symbol,o="function"==typeof e;(t.exports=function(t){return r[t]||(r[t]=o&&e[t]||(o?e:m)("Symbol."+t))}).store=r})),ut=y.f,ct=it("toStringTag"),ft=function(t,n,r){t&&!g(t=r?t:t.prototype,ct)&&ut(t,ct,{configurable:!0,value:n})},at={f:it},st=y.f,lt=function(t){var e=r.Symbol||(r.Symbol=n.Symbol||{});"_"==t.charAt(0)||t in e||st(e,t,{value:at.f(t)})},pt=Array.isArray||function(t){return"Array"==P(t)},yt=u?Object.defineProperties:function(t,n){o(t);for(var r,e=Y(n),i=e.length,u=0;i>u;)y.f(t,r=e[u++],n[r]);return t},ht=n.document,vt=ht&&ht.documentElement,dt=z("IE_PROTO"),gt=function(){},bt=function(){var t,n=a("iframe"),r=B.length;for(n.style.display="none",vt.appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),bt=t.F;r--;)delete bt.prototype[B[r]];return bt()},_t=Object.create||function(t,n){var r;return null!==t?(gt.prototype=o(t),r=new gt,gt.prototype=null,r[dt]=t):r=bt(),void 0===n?r:yt(r,n)},mt=B.concat("length","prototype"),Ot={f:Object.getOwnPropertyNames||function(t){return U(t,mt)}},wt=Ot.f,St={}.toString,jt="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Et={f:function(t){return jt&&"[object Window]"==St.call(t)?function(t){try{return wt(t)}catch(t){return jt.slice()}}(t):wt(x(t))}},Pt=Object.getOwnPropertyDescriptor,kt={f:u?Pt:function(t,n){if(t=x(t),n=l(n,!0),s)try{return Pt(t,n)}catch(t){}if(g(t,n))return h(!L.f.call(t,n),t[n])}},Ft=ot.KEY,xt=kt.f,Tt=y.f,At=Et.f,Nt=n.Symbol,It=n.JSON,Mt=It&&It.stringify,Rt=it("_hidden"),Ct=it("toPrimitive"),Dt={}.propertyIsEnumerable,Kt=K("symbol-registry"),Wt=K("symbols"),zt=K("op-symbols"),Gt=Object.prototype,Jt="function"==typeof Nt,Ut=n.QObject,Bt=!Ut||!Ut.prototype||!Ut.prototype.findChild,Yt=u&&i(function(){return 7!=_t(Tt({},"a",{get:function(){return Tt(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=xt(Gt,n);e&&delete Gt[n],Tt(t,n,r),e&&t!==Gt&&Tt(Gt,n,e)}:Tt,qt=function(t){var n=Wt[t]=_t(Nt.prototype);return n._k=t,n},Lt=Jt&&"symbol"==typeof Nt.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof Nt},Qt=function(t,n,r){return t===Gt&&Qt(zt,n,r),o(t),n=l(n,!0),o(r),g(Wt,n)?(r.enumerable?(g(t,Rt)&&t[Rt][n]&&(t[Rt][n]=!1),r=_t(r,{enumerable:h(0,!1)})):(g(t,Rt)||Tt(t,Rt,h(1,{})),t[Rt][n]=!0),Yt(t,n,r)):Tt(t,n,r)},Ht=function(t,n){o(t);for(var r,e=function(t){var n=Y(t),r=q.f;if(r)for(var e,o=r(t),i=L.f,u=0;o.length>u;)i.call(t,e=o[u++])&&n.push(e);return n}(n=x(n)),i=0,u=e.length;u>i;)Qt(t,r=e[i++],n[r]);return t},Vt=function(t){var n=Dt.call(this,t=l(t,!0));return!(this===Gt&&g(Wt,t)&&!g(zt,t))&&(!(n||!g(this,t)||!g(Wt,t)||g(this,Rt)&&this[Rt][t])||n)},Xt=function(t,n){if(t=x(t),n=l(n,!0),t!==Gt||!g(Wt,n)||g(zt,n)){var r=xt(t,n);return!r||!g(Wt,n)||g(t,Rt)&&t[Rt][n]||(r.enumerable=!0),r}},Zt=function(t){for(var n,r=At(x(t)),e=[],o=0;r.length>o;)g(Wt,n=r[o++])||n==Rt||n==Ft||e.push(n);return e},$t=function(t){for(var n,r=t===Gt,e=At(r?zt:x(t)),o=[],i=0;e.length>i;)!g(Wt,n=e[i++])||r&&!g(Gt,n)||o.push(Wt[n]);return o};Jt||(O((Nt=function(){if(this instanceof Nt)throw TypeError("Symbol is not a constructor!");var t=m(arguments.length>0?arguments[0]:void 0),n=function(r){this===Gt&&n.call(zt,r),g(this,Rt)&&g(this[Rt],t)&&(this[Rt][t]=!1),Yt(this,t,h(1,r))};return u&&Bt&&Yt(Gt,t,{configurable:!0,set:n}),qt(t)}).prototype,"toString",function(){return this._k}),kt.f=Xt,y.f=Qt,Ot.f=Et.f=Zt,L.f=Vt,q.f=$t,u&&O(Gt,"propertyIsEnumerable",Vt,!0),at.f=function(t){return qt(it(t))}),j(j.G+j.W+j.F*!Jt,{Symbol:Nt});for(var tn="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nn=0;tn.length>nn;)it(tn[nn++]);for(var rn=Y(it.store),en=0;rn.length>en;)lt(rn[en++]);j(j.S+j.F*!Jt,"Symbol",{for:function(t){return g(Kt,t+="")?Kt[t]:Kt[t]=Nt(t)},keyFor:function(t){if(!Lt(t))throw TypeError(t+" is not a symbol!");for(var n in Kt)if(Kt[n]===t)return n},useSetter:function(){Bt=!0},useSimple:function(){Bt=!1}}),j(j.S+j.F*!Jt,"Object",{create:function(t,n){return void 0===n?_t(t):Ht(_t(t),n)},defineProperty:Qt,defineProperties:Ht,getOwnPropertyDescriptor:Xt,getOwnPropertyNames:Zt,getOwnPropertySymbols:$t}),It&&j(j.S+j.F*(!Jt||i(function(){var t=Nt();return"[null]"!=Mt([t])||"{}"!=Mt({a:t})||"{}"!=Mt(Object(t))})),"JSON",{stringify:function(t){for(var n,r,o=[t],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=n=o[1],(e(n)||void 0!==t)&&!Lt(t))return pt(n)||(n=function(t,n){if("function"==typeof r&&(n=r.call(this,t,n)),!Lt(n))return n}),o[1]=n,Mt.apply(It,o)}}),Nt.prototype[Ct]||v(Nt.prototype,Ct,Nt.prototype.valueOf),ft(Nt,"Symbol"),ft(Math,"Math",!0),ft(n.JSON,"JSON",!0);var on=function(t,n,r){for(var e in n)O(t,e,n[e],r);return t},un=function(t,n,r,e){if(!(t instanceof n)||void 0!==e&&e in t)throw TypeError(r+": incorrect invocation!");return t},cn=function(t,n,r,e){try{return e?n(o(r)[0],r[1]):n(r)}catch(n){var i=t.return;throw void 0!==i&&o(i.call(t)),n}},fn={},an=it("iterator"),sn=Array.prototype,ln=function(t){return void 0!==t&&(fn.Array===t||sn[an]===t)},pn=it("toStringTag"),yn="Arguments"==P(function(){return arguments}()),hn=it("iterator"),vn=r.getIteratorMethod=function(t){if(null!=t)return t[hn]||t["@@iterator"]||fn[function(t){var n,r,e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),pn))?r:yn?P(n):"Object"==(e=P(n))&&"function"==typeof n.callee?"Arguments":e}(t)]},dn=t(function(t){var n={},r={},e=t.exports=function(t,e,i,u,c){var f,a,s,l,p=c?function(){return t}:vn(t),y=w(i,u,e?2:1),h=0;if("function"!=typeof p)throw TypeError(t+" is not iterable!");if(ln(p)){for(f=M(t.length);f>h;h++)if((l=e?y(o(a=t[h])[0],a[1]):y(t[h]))===n||l===r)return l}else for(s=p.call(t);!(a=s.next()).done;)if((l=cn(s,y,a.value,e))===n||l===r)return l};e.BREAK=n,e.RETURN=r}),gn={};v(gn,it("iterator"),function(){return this});var bn=function(t,n,r){t.prototype=_t(gn,{next:h(1,r)}),ft(t,n+" Iterator")},_n=z("IE_PROTO"),mn=Object.prototype,On=Object.getPrototypeOf||function(t){return t=Q(t),g(t,_n)?t[_n]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?mn:null},wn=it("iterator"),Sn=!([].keys&&"next"in[].keys()),jn=function(){return this},En=function(t,n){return{value:n,done:!!t}},Pn=it("species"),kn=function(t,n){if(!e(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t},Fn=y.f,xn=ot.fastKey,Tn=u?"_s":"size",An=function(t,n){var r,e=xn(n);if("F"!==e)return t._i[e];for(r=t._f;r;r=r.n)if(r.k==n)return r},Nn={getConstructor:function(t,n,r,e){var o=t(function(t,i){un(t,o,n,"_i"),t._t=n,t._i=_t(null),t._f=void 0,t._l=void 0,t[Tn]=0,null!=i&&dn(i,r,t[e],t)});return on(o.prototype,{clear:function(){for(var t=kn(this,n),r=t._i,e=t._f;e;e=e.n)e.r=!0,e.p&&(e.p=e.p.n=void 0),delete r[e.i];t._f=t._l=void 0,t[Tn]=0},delete:function(t){var r=kn(this,n),e=An(r,t);if(e){var o=e.n,i=e.p;delete r._i[e.i],e.r=!0,i&&(i.n=o),o&&(o.p=i),r._f==e&&(r._f=o),r._l==e&&(r._l=i),r[Tn]--}return!!e},forEach:function(t){kn(this,n);for(var r,e=w(t,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(e(r.v,r.k,this);r&&r.r;)r=r.p},has:function(t){return!!An(kn(this,n),t)}}),u&&Fn(o.prototype,"size",{get:function(){return kn(this,n)[Tn]}}),o},def:function(t,n,r){var e,o,i=An(t,n);return i?i.v=r:(t._l=i={i:o=xn(n,!0),k:n,v:r,p:e=t._l,n:void 0,r:!1},t._f||(t._f=i),e&&(e.n=i),t[Tn]++,"F"!==o&&(t._i[o]=i)),t},getEntry:An,setStrong:function(t,r,e){!function(t,n,r,e,o,i,u){bn(r,n,e);var c,f,a,s=function(t){if(!Sn&&t in h)return h[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},l=n+" Iterator",p="values"==o,y=!1,h=t.prototype,d=h[wn]||h["@@iterator"]||o&&h[o],g=d||s(o),b=o?p?s("entries"):g:void 0,_="Array"==n&&h.entries||d;if(_&&(a=On(_.call(new t)))!==Object.prototype&&a.next&&(ft(a,l,!0),"function"!=typeof a[wn]&&v(a,wn,jn)),p&&d&&"values"!==d.name&&(y=!0,g=function(){return d.call(this)}),(Sn||y||!h[wn])&&v(h,wn,g),fn[n]=g,fn[l]=jn,o)if(c={values:p?g:s("values"),keys:i?g:s("keys"),entries:b},u)for(f in c)f in h||O(h,f,c[f]);else j(j.P+j.F*(Sn||y),n,c)}(t,r,function(t,n){this._t=kn(t,r),this._k=n,this._l=void 0},function(){for(var t=this._k,n=this._l;n&&n.r;)n=n.p;return this._t&&(this._l=n=n?n.n:this._t._f)?En(0,"keys"==t?n.k:"values"==t?n.v:[n.k,n.v]):(this._t=void 0,En(1))},e?"entries":"values",!e,!0),function(t){var r=n[t];u&&r&&!r[Pn]&&y.f(r,Pn,{configurable:!0,get:function(){return this}})}(r)}},In=it("iterator"),Mn=!1;try{[7][In]().return=function(){Mn=!0}}catch(t){}var Rn=function(t,n){if(!n&&!Mn)return!1;var r=!1;try{var e=[7],o=e[In]();o.next=function(){return{done:r=!0}},e[In]=function(){return o},t(e)}catch(t){}return r},Cn=function(t,n){if(o(t),!e(n)&&null!==n)throw TypeError(n+": can't set as prototype!")},Dn={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=w(Function.call,kt.f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return Cn(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:Cn}.set,Kn=(function(t,r,o,u,c,f){var a=n[t],s=a,l=c?"set":"add",p=s&&s.prototype,y={},h=function(t){var n=p[t];O(p,t,"delete"==t?function(t){return!(f&&!e(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(f&&!e(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return f&&!e(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,r){return n.call(this,0===t?0:t,r),this})};if("function"==typeof s&&(f||p.forEach&&!i(function(){(new s).entries().next()}))){var v=new s,d=v[l](f?{}:-0,1)!=v,g=i(function(){v.has(1)}),b=Rn(function(t){new s(t)}),_=!f&&i(function(){for(var t=new s,n=5;n--;)t[l](n,n);return!t.has(-0)});b||((s=r(function(n,r){un(n,s,t);var o=function(t,n,r){var o,i=n.constructor;return i!==r&&"function"==typeof i&&(o=i.prototype)!==r.prototype&&e(o)&&Dn&&Dn(t,o),t}(new a,n,s);return null!=r&&dn(r,c,o[l],o),o})).prototype=p,p.constructor=s),(g||_)&&(h("delete"),h("has"),c&&h("get")),(_||d)&&h(l),f&&p.clear&&delete p.clear}else s=u.getConstructor(r,t,c,l),on(s.prototype,o),ot.NEED=!0;ft(s,t),y[t]=s,j(j.G+j.W+j.F*(s!=a),y),f||u.setStrong(s,t,c)}("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return Nn.def(kn(this,"Set"),t=0===t?0:t,t)}},Nn),it("unscopables")),Wn=Array.prototype;null==Wn[Kn]&&v(Wn,Kn,{});var zn,Gn=D(!0);j(j.P,"Array",{includes:function(t){return Gn(this,t,arguments.length>1?arguments[1]:void 0)}}),zn="includes",Wn[Kn][zn]=!0;var Jn=it("match"),Un=function(t,n,r){if(e(o=n)&&(void 0!==(i=o[Jn])?i:"RegExp"==P(o)))throw TypeError("String#"+r+" doesn't accept regex!");var o,i;return String(F(t))},Bn=it("match");j(j.P+j.F*function(t){var n=/./;try{"/./"[t](n)}catch(r){try{return n[Bn]=!1,!"/./"[t](n)}catch(t){}}return!0}("includes"),"String",{includes:function(t){return!!~Un(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}});var Yn=function(t,n,r){n in t?y.f(t,n,h(0,r)):t[n]=r};j(j.S+j.F*!Rn(function(t){}),"Array",{from:function(t){var n,r,e,o,i=Q(t),u="function"==typeof this?this:Array,c=arguments.length,f=c>1?arguments[1]:void 0,a=void 0!==f,s=0,l=vn(i);if(a&&(f=w(f,c>2?arguments[2]:void 0,2)),null==l||u==Array&&ln(l))for(r=new u(n=M(i.length));n>s;s++)Yn(r,s,a?f(i[s],s):i[s]);else for(o=l.call(i),r=new u;!(e=o.next()).done;s++)Yn(r,s,a?cn(o,f,[e.value,s],!0):e.value);return r.length=s,r}})}(); diff --git a/dist/polyfillsIE.js b/dist/polyfillsIE.js new file mode 100644 index 0000000..ac7a28c --- /dev/null +++ b/dist/polyfillsIE.js @@ -0,0 +1 @@ +!function(){"use strict";!function(){try{if(SVGElement.prototype.innerHTML)return}catch(e){return}var e=function(t,n){var o=t.nodeType;3===o?n.push(t.textContent.replace(/&/,"&").replace(/</,"<").replace(">",">")):1===o?(n.push("<",t.tagName),t.hasAttributes()&&[].forEach.call(t.attributes,function(e){n.push(" ",e.name,"='",e.value,"'")}),t.hasChildNodes()?(n.push(">"),[].forEach.call(t.childNodes,function(t){e(t,n)}),n.push("</",t.tagName,">")):n.push("/>")):8===o&&n.push("\x3c!--",t.nodeValue,"--\x3e")};Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){for(var t=[],n=this.firstChild;n;)e(n,t),n=n.nextSibling;return t.join("")},set:function(e){for(;this.firstChild;)this.removeChild(this.firstChild);try{var t=new DOMParser;t.async=!1;for(var n="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+e+"</svg>",o=t.parseFromString(n,"text/xml").documentElement.firstChild;o;)this.appendChild(this.ownerDocument.importNode(o,!0)),o=o.nextSibling}catch(e){throw new Error("Can not set innerHTML on node")}}}),Object.defineProperty(SVGElement.prototype,"outerHTML",{get:function(){var t=[];return e(this,t),t.join("")},set:function(e){for(;this.firstChild;)this.removeChild(this.firstChild);try{var t=new DOMParser;t.async=!1;for(var n="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+e+"</svg>",o=t.parseFromString(n,"text/xml").documentElement.firstChild;o;)this.parentNode.insertBefore(this.ownerDocument.importNode(o,!0),this),o=o.nextSibling}catch(e){throw new Error("Can not set outerHTML on node")}}})}(),function(e){(function(e){if(!("Event"in e))return!1;if("function"==typeof e.Event)return!0;try{return new Event("click"),!0}catch(e){return!1}})(this)||function(){var t={click:1,dblclick:1,keyup:1,keypress:1,keydown:1,mousedown:1,mouseup:1,mousemove:1,mouseover:1,mouseenter:1,mouseleave:1,mouseout:1,storage:1,storagecommit:1,textinput:1};function n(e,t){for(var n=-1,o=e.length;++n<o;)if(n in e&&e[n]===t)return n;return-1}var o=window.Event&&window.Event.prototype||null;window.Event=Window.prototype.Event=function(t,n){if(!t)throw new Error("Not enough arguments");if("createEvent"in document){var o=document.createEvent("Event"),r=!(!n||n.bubbles===e)&&n.bubbles,i=!(!n||n.cancelable===e)&&n.cancelable;return o.initEvent(t,r,i),o}return(o=document.createEventObject()).type=t,o.bubbles=!(!n||n.bubbles===e)&&n.bubbles,o.cancelable=!(!n||n.cancelable===e)&&n.cancelable,o},o&&Object.defineProperty(window.Event,"prototype",{configurable:!1,enumerable:!1,writable:!0,value:o}),"createEvent"in document||(window.addEventListener=Window.prototype.addEventListener=Document.prototype.addEventListener=Element.prototype.addEventListener=function(){var e=this,o=arguments[0],r=arguments[1];if(e===window&&o in t)throw new Error("In IE8 the event: "+o+" is not available on the window object.");e._events||(e._events={}),e._events[o]||(e._events[o]=function(t){var o,r=e._events[t.type].list,i=r.slice(),c=-1,s=i.length;for(t.preventDefault=function(){!1!==t.cancelable&&(t.returnValue=!1)},t.stopPropagation=function(){t.cancelBubble=!0},t.stopImmediatePropagation=function(){t.cancelBubble=!0,t.cancelImmediate=!0},t.currentTarget=e,t.relatedTarget=t.fromElement||null,t.target=t.target||t.srcElement||e,t.timeStamp=(new Date).getTime(),t.clientX&&(t.pageX=t.clientX+document.documentElement.scrollLeft,t.pageY=t.clientY+document.documentElement.scrollTop);++c<s&&!t.cancelImmediate;)c in i&&-1!==n(r,o=i[c])&&"function"==typeof o&&o.call(e,t)},e._events[o].list=[],e.attachEvent&&e.attachEvent("on"+o,e._events[o])),e._events[o].list.push(r)},window.removeEventListener=Window.prototype.removeEventListener=Document.prototype.removeEventListener=Element.prototype.removeEventListener=function(){var e,t=arguments[0],o=arguments[1];this._events&&this._events[t]&&this._events[t].list&&-1!==(e=n(this._events[t].list,o))&&(this._events[t].list.splice(e,1),this._events[t].list.length||(this.detachEvent&&this.detachEvent("on"+t,this._events[t]),delete this._events[t]))},window.dispatchEvent=Window.prototype.dispatchEvent=Document.prototype.dispatchEvent=Element.prototype.dispatchEvent=function(e){if(!arguments.length)throw new Error("Not enough arguments");if(!e||"string"!=typeof e.type)throw new Error("DOM Events Exception 0");var t=this,n=e.type;try{if(!e.bubbles){e.cancelBubble=!0;var o=function(e){e.cancelBubble=!0,(t||window).detachEvent("on"+n,o)};this.attachEvent("on"+n,o)}this.fireEvent("on"+n,e)}catch(o){e.target=t;do{e.currentTarget=t,"_events"in t&&"function"==typeof t._events[n]&&t._events[n].call(t,e),"function"==typeof t["on"+n]&&t["on"+n].call(t,e),t=9===t.nodeType?t.parentWindow:t.parentNode}while(t&&!e.cancelBubble)}return!0},document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&document.dispatchEvent(new Event("DOMContentLoaded",{bubbles:!0}))}))}(),"CustomEvent"in this&&("function"==typeof this.CustomEvent||this.CustomEvent.toString().indexOf("CustomEventConstructor")>-1)||(this.CustomEvent=function(e,t){if(!e)throw Error('TypeError: Failed to construct "CustomEvent": An event name must be provided.');var n;if(t=t||{bubbles:!1,cancelable:!1,detail:null},"createEvent"in document)try{(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail)}catch(o){(n=document.createEvent("Event")).initEvent(e,t.bubbles,t.cancelable),n.detail=t.detail}else(n=new Event(e,t)).detail=t&&t.detail||null;return n},CustomEvent.prototype=Event.prototype)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{});try{SVGElement.prototype.children||Object.defineProperty(SVGElement.prototype,"children",{get:function(){return function(e,t){var n,o=e.length,r=[];for(n=0;n<o;n++)t(e[n])&&r.push(e[n]);return r}(this.childNodes,function(e){return 1===e.nodeType})}})}catch(e){}try{Object.getPrototypeOf("test")}catch(t){var e=Object.getPrototypeOf;Object.getPrototypeOf=function(t){return"object"!=typeof t&&(t=new Object(t)),e.call(this,t)}}}(); diff --git a/dist/svg.js b/dist/svg.js index 3406d4a..c9b9022 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,7120 +6,6848 @@ * @copyright Wout Fierens <wout@mick-wout.com> * @license MIT * -* BUILT: Mon Nov 26 2018 22:45:55 GMT+0100 (GMT+01:00) +* BUILT: Wed Nov 28 2018 12:47:10 GMT+0100 (GMT+01:00) */; -var SVG = (function () { - 'use strict'; - - function _typeof(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +var _core = createCommonjsModule(function (module) { +var core = module.exports = { version: '2.5.7' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef +}); +var _core_1 = _core.version; + +var _global = createCommonjsModule(function (module) { +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef +}); + +var _library = false; + +var _shared = createCommonjsModule(function (module) { +var SHARED = '__core-js_shared__'; +var store = _global[SHARED] || (_global[SHARED] = {}); + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: _core.version, + mode: _library ? 'pure' : 'global', + copyright: '© 2018 Denis Pushkarev (zloirock.ru)' +}); +}); + +var id = 0; +var px = Math.random(); +var _uid = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + +var _wks = createCommonjsModule(function (module) { +var store = _shared('wks'); + +var Symbol = _global.Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name)); +}; + +$exports.store = store; +}); + +var _isObject = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + +var _anObject = function (it) { + if (!_isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + +var _fails = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; } - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } +}; + +// Thank's IE8 for his funny defineProperty +var _descriptors = !_fails(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); + +var document$1 = _global.document; +// typeof document.createElement is 'object' in old IE +var is = _isObject(document$1) && _isObject(document$1.createElement); +var _domCreate = function (it) { + return is ? document$1.createElement(it) : {}; +}; + +var _ie8DomDefine = !_descriptors && !_fails(function () { + return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + +// 7.1.1 ToPrimitive(input [, PreferredType]) + +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +var _toPrimitive = function (it, S) { + if (!_isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + +var dP = Object.defineProperty; + +var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { + _anObject(O); + P = _toPrimitive(P, true); + _anObject(Attributes); + if (_ie8DomDefine) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + +var _objectDp = { + f: f +}; + +var _propertyDesc = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + +var _hide = _descriptors ? function (object, key, value) { + return _objectDp.f(object, key, _propertyDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; + +// 22.1.3.31 Array.prototype[@@unscopables] +var UNSCOPABLES = _wks('unscopables'); +var ArrayProto = Array.prototype; +if (ArrayProto[UNSCOPABLES] == undefined) _hide(ArrayProto, UNSCOPABLES, {}); +var _addToUnscopables = function (key) { + ArrayProto[UNSCOPABLES][key] = true; +}; + +var _iterStep = function (done, value) { + return { value: value, done: !!done }; +}; + +var _iterators = {}; + +var toString = {}.toString; + +var _cof = function (it) { + return toString.call(it).slice(8, -1); +}; + +// fallback for non-array-like ES3 and non-enumerable old V8 strings + +// eslint-disable-next-line no-prototype-builtins +var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return _cof(it) == 'String' ? it.split('') : Object(it); +}; + +// 7.2.1 RequireObjectCoercible(argument) +var _defined = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + +// to indexed object, toObject with fallback for non-array-like ES3 strings + + +var _toIobject = function (it) { + return _iobject(_defined(it)); +}; + +var hasOwnProperty = {}.hasOwnProperty; +var _has = function (it, key) { + return hasOwnProperty.call(it, key); +}; + +var _redefine = createCommonjsModule(function (module) { +var SRC = _uid('src'); +var TO_STRING = 'toString'; +var $toString = Function[TO_STRING]; +var TPL = ('' + $toString).split(TO_STRING); + +_core.inspectSource = function (it) { + return $toString.call(it); +}; + +(module.exports = function (O, key, val, safe) { + var isFunction = typeof val == 'function'; + if (isFunction) _has(val, 'name') || _hide(val, 'name', key); + if (O[key] === val) return; + if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); + if (O === _global) { + O[key] = val; + } else if (!safe) { + delete O[key]; + _hide(O, key, val); + } else if (O[key]) { + O[key] = val; + } else { + _hide(O, key, val); + } +// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative +})(Function.prototype, TO_STRING, function toString() { + return typeof this == 'function' && this[SRC] || $toString.call(this); +}); +}); + +var _aFunction = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + +// optional / simple context binding + +var _ctx = function (fn, that, length) { + _aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; +}; + +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; + var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); + var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); + var key, own, out, exp; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + // export native or passed + out = (own ? target : source)[key]; + // bind timers to global for call from export context + exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; + // extend global + if (target) _redefine(target, key, out, type & $export.U); + // export + if (exports[key] != out) _hide(exports, key, exp); + if (IS_PROTO && expProto[key] != out) expProto[key] = out; + } +}; +_global.core = _core; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +var _export = $export; + +// 7.1.4 ToInteger +var ceil = Math.ceil; +var floor = Math.floor; +var _toInteger = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; + +// 7.1.15 ToLength + +var min = Math.min; +var _toLength = function (it) { + return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; + +var max = Math.max; +var min$1 = Math.min; +var _toAbsoluteIndex = function (index, length) { + index = _toInteger(index); + return index < 0 ? max(index + length, 0) : min$1(index, length); +}; + +// false -> Array#indexOf +// true -> Array#includes + + + +var _arrayIncludes = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = _toIobject($this); + var length = _toLength(O.length); + var index = _toAbsoluteIndex(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; +}; + +var shared = _shared('keys'); + +var _sharedKey = function (key) { + return shared[key] || (shared[key] = _uid(key)); +}; + +var arrayIndexOf = _arrayIncludes(false); +var IE_PROTO = _sharedKey('IE_PROTO'); + +var _objectKeysInternal = function (object, names) { + var O = _toIobject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (_has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; +}; - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); +// IE 8- don't enum bug keys +var _enumBugKeys = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); + +// 19.1.2.14 / 15.2.3.14 Object.keys(O) + + + +var _objectKeys = Object.keys || function keys(O) { + return _objectKeysInternal(O, _enumBugKeys); +}; + +var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) { + _anObject(O); + var keys = _objectKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]); + return O; +}; + +var document$2 = _global.document; +var _html = document$2 && document$2.documentElement; + +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + + + +var IE_PROTO$1 = _sharedKey('IE_PROTO'); +var Empty = function () { /* empty */ }; +var PROTOTYPE$1 = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = _domCreate('iframe'); + var i = _enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + _html.appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]]; + return createDict(); +}; + +var _objectCreate = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE$1] = _anObject(O); + result = new Empty(); + Empty[PROTOTYPE$1] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO$1] = O; + } else result = createDict(); + return Properties === undefined ? result : _objectDps(result, Properties); +}; + +var def = _objectDp.f; + +var TAG = _wks('toStringTag'); + +var _setToStringTag = function (it, tag, stat) { + if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; + +var IteratorPrototype = {}; + +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +_hide(IteratorPrototype, _wks('iterator'), function () { return this; }); + +var _iterCreate = function (Constructor, NAME, next) { + Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) }); + _setToStringTag(Constructor, NAME + ' Iterator'); +}; + +// 7.1.13 ToObject(argument) + +var _toObject = function (it) { + return Object(_defined(it)); +}; + +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) + + +var IE_PROTO$2 = _sharedKey('IE_PROTO'); +var ObjectProto = Object.prototype; + +var _objectGpo = Object.getPrototypeOf || function (O) { + O = _toObject(O); + if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; +}; + +var ITERATOR = _wks('iterator'); +var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function () { return this; }; + +var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + _iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = _objectGpo($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + _setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); } } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + _hide(proto, ITERATOR, $default); + } + // Plug for library + _iterators[NAME] = $default; + _iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) _redefine(proto, key, methods[key]); + } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) { + this._t = _toIobject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function () { + var O = this._t; + var kind = this._k; + var index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return _iterStep(1); + } + if (kind == 'keys') return _iterStep(0, index); + if (kind == 'values') return _iterStep(0, O[index]); + return _iterStep(0, [index, O[index]]); +}, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +_iterators.Arguments = _iterators.Array; + +_addToUnscopables('keys'); +_addToUnscopables('values'); +_addToUnscopables('entries'); + +var ITERATOR$1 = _wks('iterator'); +var TO_STRING_TAG = _wks('toStringTag'); +var ArrayValues = _iterators.Array; + +var DOMIterables = { + CSSRuleList: true, // TODO: Not spec compliant, should be false. + CSSStyleDeclaration: false, + CSSValueList: false, + ClientRectList: false, + DOMRectList: false, + DOMStringList: false, + DOMTokenList: true, + DataTransferItemList: false, + FileList: false, + HTMLAllCollection: false, + HTMLCollection: false, + HTMLFormElement: false, + HTMLSelectElement: false, + MediaList: true, // TODO: Not spec compliant, should be false. + MimeTypeArray: false, + NamedNodeMap: false, + NodeList: true, + PaintRequestList: false, + Plugin: false, + PluginArray: false, + SVGLengthList: false, + SVGNumberList: false, + SVGPathSegList: false, + SVGPointList: false, + SVGStringList: false, + SVGTransformList: false, + SourceBufferList: false, + StyleSheetList: true, // TODO: Not spec compliant, should be false. + TextTrackCueList: false, + TextTrackList: false, + TouchList: false +}; + +for (var collections = _objectKeys(DOMIterables), i = 0; i < collections.length; i++) { + var NAME = collections[i]; + var explicit = DOMIterables[NAME]; + var Collection = _global[NAME]; + var proto = Collection && Collection.prototype; + var key; + if (proto) { + if (!proto[ITERATOR$1]) _hide(proto, ITERATOR$1, ArrayValues); + if (!proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME); + _iterators[NAME] = ArrayValues; + if (explicit) for (key in es6_array_iterator) if (!proto[key]) _redefine(proto, key, es6_array_iterator[key], true); + } +} + +const methods = {}; +const names = []; +function registerMethods(name, m) { + if (Array.isArray(name)) { + for (let _name of name) { + registerMethods(_name, m); + } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; + return; } - function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; + if (typeof name === 'object') { + for (let _name in name) { + registerMethods(_name, name[_name]); } - return obj; + return; } - function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } + addMethodNames(Object.keys(m)); + methods[name] = Object.assign(methods[name] || {}, m); +} +function getMethodsFor(name) { + return methods[name] || {}; +} +function getMethodNames() { + return [...new Set(names)]; +} +function addMethodNames(_names) { + names.push(..._names); +} + +var _fixReWks = function (KEY, length, exec) { + var SYMBOL = _wks(KEY); + var fns = exec(_defined, SYMBOL, ''[KEY]); + var strfn = fns[0]; + var rxfn = fns[1]; + if (_fails(function () { + var O = {}; + O[SYMBOL] = function () { return 7; }; + return ''[KEY](O) != 7; + })) { + _redefine(String.prototype, KEY, strfn); + _hide(RegExp.prototype, SYMBOL, length == 2 + // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) + // 21.2.5.11 RegExp.prototype[@@split](string, limit) + ? function (string, arg) { return rxfn.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function (string) { return rxfn.call(string, this); } + ); + } +}; + +// @@replace logic +_fixReWks('replace', 2, function (defined, REPLACE, $replace) { + // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) + return [function replace(searchValue, replaceValue) { + var O = defined(this); + var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; + return fn !== undefined + ? fn.call(searchValue, O, replaceValue) + : $replace.call(String(O), searchValue, replaceValue); + }, $replace]; +}); + +// Map function +function map(array, block) { + var i; + var il = array.length; + var result = []; + + for (i = 0; i < il; i++) { + result.push(block(array[i])); + } - ownKeys.forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } + return result; +} // Filter function - return target; - } +function filter(array, block) { + var i; + var il = array.length; + var result = []; - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + for (i = 0; i < il; i++) { + if (block(array[i])) { + result.push(array[i]); } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) _setPrototypeOf(subClass, superClass); } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); - } + return result; +} // Degrees to radians - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; +function radians(d) { + return d % 360 * Math.PI / 180; +} // Radians to degrees - return _setPrototypeOf(o, p); - } +function degrees(r) { + return r * 180 / Math.PI % 360; +} // Convert dash-separated-string to camelCase - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } +function camelCase(s) { + return s.toLowerCase().replace(/-(.)/g, function (m, g) { + return g.toUpperCase(); + }); +} // Convert camel cased string to string seperated - return self; - } +function unCamelCase(s) { + return s.replace(/([A-Z])/g, function (m, g) { + return '-' + g.toLowerCase(); + }); +} // Capitalize first letter of a string - function _possibleConstructorReturn(self, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } +function capitalize(s) { + return s.charAt(0).toUpperCase() + s.slice(1); +} // Calculate proportional width and height values when necessary - return _assertThisInitialized(self); - } +function proportionalSize(element, width, height) { + if (width == null || height == null) { + var box = element.bbox(); - function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = _getPrototypeOf(object); - if (object === null) break; + if (width == null) { + width = box.width / box.height * height; + } else if (height == null) { + height = box.height / box.width * width; } - - return object; } - function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get; - } else { - _get = function _get(target, property, receiver) { - var base = _superPropBase(target, property); + return { + width: width, + height: height + }; +} +function getOrigin(o, element) { + // Allow origin or around as the names + let origin = o.origin; // o.around == null ? o.origin : o.around - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); + let ox, oy; // Allow the user to pass a string to rotate around a given point - if (desc.get) { - return desc.get.call(receiver); - } + if (typeof origin === 'string' || origin == null) { + // Get the bounding box of the element with no transformations applied + const string = (origin || 'center').toLowerCase().trim(); + + const _element$bbox = element.bbox(), + height = _element$bbox.height, + width = _element$bbox.width, + x = _element$bbox.x, + y = _element$bbox.y; // Calculate the transformed x and y coordinates - return desc.value; - }; - } - return _get(target, property, receiver || target); + let bx = string.includes('left') ? x : string.includes('right') ? x + width : x + width / 2; + let by = string.includes('top') ? y : string.includes('bottom') ? y + height : y + height / 2; // Set the bounds eg : "bottom-left", "Top right", "middle" etc... + + ox = o.ox != null ? o.ox : bx; + oy = o.oy != null ? o.oy : by; + } else { + ox = origin[0]; + oy = origin[1]; + } // Return the origin as it is if it wasn't a string + + + return [ox, oy]; +} + +var utils = /*#__PURE__*/Object.freeze({ + map: map, + filter: filter, + radians: radians, + degrees: degrees, + camelCase: camelCase, + unCamelCase: unCamelCase, + capitalize: capitalize, + proportionalSize: proportionalSize, + getOrigin: getOrigin +}); + +// Default namespaces +let ns = 'http://www.w3.org/2000/svg'; +let xmlns = 'http://www.w3.org/2000/xmlns/'; +let xlink = 'http://www.w3.org/1999/xlink'; +let svgjs = 'http://svgjs.com/svgjs'; + +var namespaces = /*#__PURE__*/Object.freeze({ + ns: ns, + xmlns: xmlns, + xlink: xlink, + svgjs: svgjs +}); + +const globals = { + window: typeof window === 'undefined' ? null : window, + document: typeof document === 'undefined' ? null : document +}; +function registerWindow(win = null, doc = null) { + globals.window = win; + globals.document = doc; +} + +class Base {// constructor (node/*, {extensions = []} */) { + // // this.tags = [] + // // + // // for (let extension of extensions) { + // // extension.setup.call(this, node) + // // this.tags.push(extension.name) + // // } + // } +} + +const elements = {}; +const root = '___SYMBOL___ROOT___'; // Method for element creation + +function makeNode(name) { + // create element + return globals.document.createElementNS(ns, name); +} +function makeInstance(element) { + if (element instanceof Base) return element; + + if (typeof element === 'object') { + return adopt(element); } - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); + if (element == null) { + return new elements[root](); } - function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); + if (typeof element === 'string' && element.charAt(0) !== '<') { + return adopt(globals.document.querySelector(element)); } - function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + var node = makeNode('svg'); + node.innerHTML = element; // We can use firstChild here because we know, + // that the first char is < and thus an element - return arr2; - } + element = adopt(node.firstChild); + return element; +} +function nodeOrNew(name, node) { + return node instanceof globals.window.Node ? node : makeNode(name); +} // Adopt existing svg elements + +function adopt(node) { + // check for presence of node + if (!node) return null; // make sure a node isn't already adopted + + if (node.instance instanceof Base) return node.instance; // initialize variables + + var className = capitalize(node.nodeName); // Make sure that gradients are adopted correctly + + if (className === 'LinearGradient' || className === 'RadialGradient') { + className = 'Gradient'; // Fallback to Dom if element is not known + } else if (!elements[className]) { + className = 'Dom'; } - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; + return new elements[className](node); +} +function register(element, name = element.name, asRoot = false) { + elements[name] = element; + if (asRoot) elements[root] = element; + addMethodNames(Object.keys(element.prototype)); + return element; +} +function getClass(name) { + return elements[name]; +} // Element id sequence + +let did = 1000; // Get next named element id + +function eid(name) { + return 'Svgjs' + capitalize(name) + did++; +} // Deep new id assignment + +function assignNewId(node) { + // do the same for SVG child nodes as well + for (var i = node.children.length - 1; i >= 0; i--) { + assignNewId(node.children[i]); } - function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); + if (node.id) { + return adopt(node).id(eid(node.nodeName)); } - function _iterableToArrayLimit(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; + return adopt(node); +} // Method for extending objects - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); +function extend(modules, methods, attrCheck) { + var key, i; + modules = Array.isArray(modules) ? modules : [modules]; - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; + for (i = modules.length - 1; i >= 0; i--) { + for (key in methods) { + let method = methods[key]; + + if (attrCheck) { + method = wrapWithAttrCheck(methods[key]); } - } - return _arr; + modules[i].prototype[key] = method; + } } +} +function extendWithAttrCheck(...args) { + extend(...args, true); +} +function wrapWithAttrCheck(fn) { + return function (...args) { + let o = args[args.length - 1]; + + if (o && o.constructor === Object && !(o instanceof Array)) { + return fn.apply(this, args.slice(0, -1)).attr(o); + } else { + return fn.apply(this, args); + } + }; +} - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); - } +function siblings() { + return this.parent().children(); +} // Get the curent position siblings - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } +function position() { + return this.parent().index(this); +} // Get the next element (will return null if there is none) - var methods = {}; - var names = []; - function registerMethods(name, m) { - if (Array.isArray(name)) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; +function next() { + return this.siblings()[this.position() + 1]; +} // Get the next element (will return null if there is none) - try { - for (var _iterator = name[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var _name = _step.value; - registerMethods(_name, m); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } +function prev() { + return this.siblings()[this.position() - 1]; +} // Send given element one step forward - return; - } +function forward() { + var i = this.position() + 1; + var p = this.parent(); // move node one step forward - if (_typeof(name) === 'object') { - var _arr = Object.entries(name); + p.removeElement(this).add(this, i); // make sure defs node is always at the top - for (var _i = 0; _i < _arr.length; _i++) { - var _arr$_i = _slicedToArray(_arr[_i], 2), - _name2 = _arr$_i[0], - _m = _arr$_i[1]; + if (typeof p.isRoot === 'function' && p.isRoot()) { + p.node.appendChild(p.defs().node); + } - registerMethods(_name2, _m); - } + return this; +} // Send given element one step backward - return; - } +function backward() { + var i = this.position(); - addMethodNames(Object.keys(m)); - methods[name] = Object.assign(methods[name] || {}, m); + if (i > 0) { + this.parent().removeElement(this).add(this, i - 1); } - function getMethodsFor(name) { - return methods[name] || {}; + + return this; +} // Send given element all the way to the front + +function front() { + var p = this.parent(); // Move node forward + + p.node.appendChild(this.node); // Make sure defs node is always at the top + + if (typeof p.isRoot === 'function' && p.isRoot()) { + p.node.appendChild(p.defs().node); } - function getMethodNames() { - return _toConsumableArray(new Set(names)); + + return this; +} // Send given element all the way to the back + +function back() { + if (this.position() > 0) { + this.parent().removeElement(this).add(this, 0); } - function addMethodNames(_names) { - names.push.apply(names, _toConsumableArray(_names)); + + return this; +} // Inserts a given element before the targeted element + +function before(element) { + element = makeInstance(element); + element.remove(); + var i = this.position(); + this.parent().add(element, i); + return this; +} // Inserts a given element after the targeted element + +function after(element) { + element = makeInstance(element); + element.remove(); + var i = this.position(); + this.parent().add(element, i + 1); + return this; +} +function insertBefore(element) { + element = makeInstance(element); + element.before(this); +} +function insertAfter(element) { + element = makeInstance(element); + element.after(this); +} +registerMethods('Dom', { + siblings, + position, + next, + prev, + forward, + backward, + front, + back, + before, + after, + insertBefore, + insertAfter +}); + +// 7.2.8 IsRegExp(argument) + + +var MATCH = _wks('match'); +var _isRegexp = function (it) { + var isRegExp; + return _isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : _cof(it) == 'RegExp'); +}; + +// @@split logic +_fixReWks('split', 2, function (defined, SPLIT, $split) { + var isRegExp = _isRegexp; + var _split = $split; + var $push = [].push; + var $SPLIT = 'split'; + var LENGTH = 'length'; + var LAST_INDEX = 'lastIndex'; + if ( + 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || + 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || + 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || + '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || + '.'[$SPLIT](/()()/)[LENGTH] > 1 || + ''[$SPLIT](/.?/)[LENGTH] + ) { + var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group + // based on es5-shim implementation, need to rework it + $split = function (separator, limit) { + var string = String(this); + if (separator === undefined && limit === 0) return []; + // If `separator` is not a regex, use native split + if (!isRegExp(separator)) return _split.call(string, separator, limit); + var output = []; + var flags = (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + + (separator.sticky ? 'y' : ''); + var lastLastIndex = 0; + var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; + // Make `global` and avoid `lastIndex` issues by working with a copy + var separatorCopy = new RegExp(separator.source, flags + 'g'); + var separator2, match, lastIndex, lastLength, i; + // Doesn't need flags gy, but they don't hurt + if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); + while (match = separatorCopy.exec(string)) { + // `separatorCopy.lastIndex` is not reliable cross-browser + lastIndex = match.index + match[0][LENGTH]; + if (lastIndex > lastLastIndex) { + output.push(string.slice(lastLastIndex, match.index)); + // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG + // eslint-disable-next-line no-loop-func + if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () { + for (i = 1; i < arguments[LENGTH] - 2; i++) if (arguments[i] === undefined) match[i] = undefined; + }); + if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); + lastLength = match[0][LENGTH]; + lastLastIndex = lastIndex; + if (output[LENGTH] >= splitLimit) break; + } + if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop + } + if (lastLastIndex === string[LENGTH]) { + if (lastLength || !separatorCopy.test('')) output.push(''); + } else output.push(string.slice(lastLastIndex)); + return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; + }; + // Chakra, V8 + } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { + $split = function (separator, limit) { + return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); + }; } + // 21.1.3.17 String.prototype.split(separator, limit) + return [function split(separator, limit) { + var O = defined(this); + var fn = separator == undefined ? undefined : separator[SPLIT]; + return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); + }, $split]; +}); - // Map function - function map(array, block) { - var i; - var il = array.length; - var result = []; +// Parse unit value +let numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; // Parse hex value - for (i = 0; i < il; i++) { - result.push(block(array[i])); - } +let hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; // Parse rgb value - return result; - } // Filter function +let rgb = /rgb\((\d+),(\d+),(\d+)\)/; // Parse reference id - function filter(array, block) { - var i; - var il = array.length; - var result = []; +let reference = /(#[a-z0-9\-_]+)/i; // splits a transformation chain - for (i = 0; i < il; i++) { - if (block(array[i])) { - result.push(array[i]); - } - } +let transforms = /\)\s*,?\s*/; // Whitespace - return result; - } // Degrees to radians +let whitespace = /\s/g; // Test hex value - function radians(d) { - return d % 360 * Math.PI / 180; - } // Radians to degrees +let isHex = /^#[a-f0-9]{3,6}$/i; // Test rgb value - function degrees(r) { - return r * 180 / Math.PI % 360; - } // Convert dash-separated-string to camelCase +let isRgb = /^rgb\(/; // Test css declaration - function camelCase(s) { - return s.toLowerCase().replace(/-(.)/g, function (m, g) { - return g.toUpperCase(); - }); - } // Convert camel cased string to string seperated +let isCss = /[^:]+:[^;]+;?/; // Test for blank string - function unCamelCase(s) { - return s.replace(/([A-Z])/g, function (m, g) { - return '-' + g.toLowerCase(); - }); - } // Capitalize first letter of a string +let isBlank = /^(\s+)?$/; // Test for numeric string - function capitalize(s) { - return s.charAt(0).toUpperCase() + s.slice(1); - } // Calculate proportional width and height values when necessary +let isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; // Test for percent value - function proportionalSize(element, width, height) { - if (width == null || height == null) { - var box = element.bbox(); +let isPercent = /^-?[\d.]+%$/; // Test for image url - if (width == null) { - width = box.width / box.height * height; - } else if (height == null) { - height = box.height / box.width * width; - } - } +let isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; // split at whitespace and comma - return { - width: width, - height: height - }; - } - function getOrigin(o, element) { - // Allow origin or around as the names - var origin = o.origin; // o.around == null ? o.origin : o.around +let delimiter = /[\s,]+/; // The following regex are used to parse the d attribute of a path +// Matches all hyphens which are not after an exponent - var ox, oy; // Allow the user to pass a string to rotate around a given point +let hyphen = /([^e])-/gi; // Replaces and tests for all path letters - if (typeof origin === 'string' || origin == null) { - // Get the bounding box of the element with no transformations applied - var string = (origin || 'center').toLowerCase().trim(); +let pathLetters = /[MLHVCSQTAZ]/gi; // yes we need this one, too - var _element$bbox = element.bbox(), - height = _element$bbox.height, - width = _element$bbox.width, - x = _element$bbox.x, - y = _element$bbox.y; // Calculate the transformed x and y coordinates +let isPathLetter = /[MLHVCSQTAZ]/i; // matches 0.154.23.45 +let numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi; // matches . - var bx = string.includes('left') ? x : string.includes('right') ? x + width : x + width / 2; - var by = string.includes('top') ? y : string.includes('bottom') ? y + height : y + height / 2; // Set the bounds eg : "bottom-left", "Top right", "middle" etc... +let dots = /\./g; - ox = o.ox != null ? o.ox : bx; - oy = o.oy != null ? o.oy : by; - } else { - ox = origin[0]; - oy = origin[1]; - } // Return the origin as it is if it wasn't a string +var regex = /*#__PURE__*/Object.freeze({ + numberAndUnit: numberAndUnit, + hex: hex, + rgb: rgb, + reference: reference, + transforms: transforms, + whitespace: whitespace, + isHex: isHex, + isRgb: isRgb, + isCss: isCss, + isBlank: isBlank, + isNumber: isNumber, + isPercent: isPercent, + isImage: isImage, + delimiter: delimiter, + hyphen: hyphen, + pathLetters: pathLetters, + isPathLetter: isPathLetter, + numbersWithDots: numbersWithDots, + dots: dots +}); + +function classes() { + var attr = this.attr('class'); + return attr == null ? [] : attr.trim().split(delimiter); +} // Return true if class exists on the node, false otherwise +function hasClass(name) { + return this.classes().indexOf(name) !== -1; +} // Add class to the node - return [ox, oy]; +function addClass(name) { + if (!this.hasClass(name)) { + var array = this.classes(); + array.push(name); + this.attr('class', array.join(' ')); } - var utils = /*#__PURE__*/Object.freeze({ - map: map, - filter: filter, - radians: radians, - degrees: degrees, - camelCase: camelCase, - unCamelCase: unCamelCase, - capitalize: capitalize, - proportionalSize: proportionalSize, - getOrigin: getOrigin - }); + return this; +} // Remove class from the node - // Default namespaces - var ns = 'http://www.w3.org/2000/svg'; - var xmlns = 'http://www.w3.org/2000/xmlns/'; - var xlink = 'http://www.w3.org/1999/xlink'; - var svgjs = 'http://svgjs.com/svgjs'; - - var namespaces = /*#__PURE__*/Object.freeze({ - ns: ns, - xmlns: xmlns, - xlink: xlink, - svgjs: svgjs - }); +function removeClass(name) { + if (this.hasClass(name)) { + this.attr('class', this.classes().filter(function (c) { + return c !== name; + }).join(' ')); + } - var globals = { - window: typeof window === 'undefined' ? null : window, - document: typeof document === 'undefined' ? null : document - }; - function registerWindow() { - var win = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var doc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - globals.window = win; - globals.document = doc; + return this; +} // Toggle the presence of a class on the node + +function toggleClass(name) { + return this.hasClass(name) ? this.removeClass(name) : this.addClass(name); +} +registerMethods('Dom', { + classes, + hasClass, + addClass, + removeClass, + toggleClass +}); + +function css(style, val) { + let ret = {}; + + if (arguments.length === 0) { + // get full style as object + this.node.style.cssText.split(/\s*;\s*/).filter(function (el) { + return !!el.length; + }).forEach(function (el) { + let t = el.split(/\s*:\s*/); + ret[t[0]] = t[1]; + }); + return ret; } - var Base = function Base() { - _classCallCheck(this, Base); - }; + if (arguments.length < 2) { + // get style properties in the array + if (Array.isArray(style)) { + for (let name of style) { + let cased = camelCase(name); + ret[cased] = this.node.style[cased]; + } - var elements = {}; - var root = Symbol('root'); // Method for element creation + return ret; + } // get style for property - function makeNode(name) { - // create element - return globals.document.createElementNS(ns, name); - } - function makeInstance(element) { - if (element instanceof Base) return element; - if (_typeof(element) === 'object') { - return adopt(element); + if (typeof style === 'string') { + return this.node.style[camelCase(style)]; + } // set styles in object + + + if (typeof style === 'object') { + for (let name in style) { + // set empty string if null/undefined/'' was given + this.node.style[camelCase(name)] = style[name] == null || isBlank.test(style[name]) ? '' : style[name]; + } } + } // set style for property - if (element == null) { - return new elements[root](); + + if (arguments.length === 2) { + this.node.style[camelCase(style)] = val == null || isBlank.test(val) ? '' : val; + } + + return this; +} // Show element + +function show() { + return this.css('display', ''); +} // Hide element + +function hide() { + return this.css('display', 'none'); +} // Is element visible? + +function visible() { + return this.css('display') !== 'none'; +} +registerMethods('Dom', { + css, + show, + hide, + visible +}); + +function data(a, v, r) { + if (typeof a === 'object') { + for (v in a) { + this.data(v, a[v]); + } + } else if (arguments.length < 2) { + try { + return JSON.parse(this.attr('data-' + a)); + } catch (e) { + return this.attr('data-' + a); } + } else { + this.attr('data-' + a, v === null ? null : r === true || typeof v === 'string' || typeof v === 'number' ? v : JSON.stringify(v)); + } - if (typeof element === 'string' && element.charAt(0) !== '<') { - return adopt(globals.document.querySelector(element)); + return this; +} +registerMethods('Dom', { + data +}); + +function remember(k, v) { + // remember every item in an object individually + if (typeof arguments[0] === 'object') { + for (var key in k) { + this.remember(key, k[key]); } + } else if (arguments.length === 1) { + // retrieve memory + return this.memory()[k]; + } else { + // store memory + this.memory()[k] = v; + } - var node = makeNode('svg'); - node.innerHTML = element; // We can use firstChild here because we know, - // that the first char is < and thus an element + return this; +} // Erase a given memory - element = adopt(node.firstChild); - return element; +function forget() { + if (arguments.length === 0) { + this._memory = {}; + } else { + for (var i = arguments.length - 1; i >= 0; i--) { + delete this.memory()[arguments[i]]; + } } - function nodeOrNew(name, node) { - return node instanceof globals.window.Node ? node : makeNode(name); - } // Adopt existing svg elements - function adopt(node) { - // check for presence of node - if (!node) return null; // make sure a node isn't already adopted + return this; +} // This triggers creation of a new hidden class which is not performant +// However, this function is not rarely used so it will not happen frequently +// Return local memory object - if (node.instance instanceof Base) return node.instance; // initialize variables +function memory() { + return this._memory = this._memory || {}; +} +registerMethods('Dom', { + remember, + forget, + memory +}); - var className = capitalize(node.nodeName); // Make sure that gradients are adopted correctly +let listenerId = 0; - if (className === 'LinearGradient' || className === 'RadialGradient') { - className = 'Gradient'; // Fallback to Dom if element is not known - } else if (!elements[className]) { - className = 'Dom'; - } +function getEvents(node) { + const n = makeInstance(node).getEventHolder(); + if (!n.events) n.events = {}; + return n.events; +} - return new elements[className](node); - } - function register(element) { - var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : element.name; - var asRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - elements[name] = element; - if (asRoot) elements[root] = element; - addMethodNames(Object.keys(element.prototype)); - return element; - } - function getClass(name) { - return elements[name]; - } // Element id sequence +function getEventTarget(node) { + return makeInstance(node).getEventTarget(); +} - var did = 1000; // Get next named element id +function clearEvents(node) { + const n = makeInstance(node).getEventHolder(); + if (n.events) n.events = {}; +} // Add event binder in the SVG namespace - function eid(name) { - return 'Svgjs' + capitalize(name) + did++; - } // Deep new id assignment - function assignNewId(node) { - // do the same for SVG child nodes as well - for (var i = node.children.length - 1; i >= 0; i--) { - assignNewId(node.children[i]); - } +function on(node, events, listener, binding, options) { + var l = listener.bind(binding || node); + var bag = getEvents(node); + var n = getEventTarget(node); // events can be an array of events or a string of events - if (node.id) { - return adopt(node).id(eid(node.nodeName)); - } + events = Array.isArray(events) ? events : events.split(delimiter); // add id to listener - return adopt(node); - } // Method for extending objects + if (!listener._svgjsListenerId) { + listener._svgjsListenerId = ++listenerId; + } - function extend(modules, methods, attrCheck) { - var key, i; - modules = Array.isArray(modules) ? modules : [modules]; + events.forEach(function (event) { + var ev = event.split('.')[0]; + var ns = event.split('.')[1] || '*'; // ensure valid object - for (i = modules.length - 1; i >= 0; i--) { - for (key in methods) { - var method = methods[key]; + bag[ev] = bag[ev] || {}; + bag[ev][ns] = bag[ev][ns] || {}; // reference listener - if (attrCheck) { - method = wrapWithAttrCheck(methods[key]); + bag[ev][ns][listener._svgjsListenerId] = l; // add listener + + n.addEventListener(ev, l, options || false); + }); +} // Add event unbinder in the SVG namespace + +function off(node, events, listener, options) { + var bag = getEvents(node); + var n = getEventTarget(node); // listener can be a function or a number + + if (typeof listener === 'function') { + listener = listener._svgjsListenerId; + if (!listener) return; + } // events can be an array of events or a string or undefined + + + events = Array.isArray(events) ? events : (events || '').split(delimiter); + events.forEach(function (event) { + var ev = event && event.split('.')[0]; + var ns = event && event.split('.')[1]; + var namespace, l; + + if (listener) { + // remove listener reference + if (bag[ev] && bag[ev][ns || '*']) { + // removeListener + n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false); + delete bag[ev][ns || '*'][listener]; + } + } else if (ev && ns) { + // remove all listeners for a namespaced event + if (bag[ev] && bag[ev][ns]) { + for (l in bag[ev][ns]) { + off(n, [ev, ns].join('.'), l); + } + + delete bag[ev][ns]; + } + } else if (ns) { + // remove all listeners for a specific namespace + for (event in bag) { + for (namespace in bag[event]) { + if (ns === namespace) { + off(n, [event, ns].join('.')); + } + } + } + } else if (ev) { + // remove all listeners for the event + if (bag[ev]) { + for (namespace in bag[ev]) { + off(n, [ev, namespace].join('.')); } - modules[i].prototype[key] = method; + delete bag[ev]; + } + } else { + // remove all listeners on a given node + for (event in bag) { + off(n, event); } + + clearEvents(node); } + }); +} +function dispatch(node, event, data) { + var n = getEventTarget(node); // Dispatch event + + if (event instanceof globals.window.Event) { + n.dispatchEvent(event); + } else { + event = new globals.window.CustomEvent(event, { + detail: data, + cancelable: true + }); + n.dispatchEvent(event); } - function extendWithAttrCheck() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - extend.apply(void 0, args.concat([true])); + return event; +} + +// 21.2.5.3 get RegExp.prototype.flags + +var _flags = function () { + var that = _anObject(this); + var result = ''; + if (that.global) result += 'g'; + if (that.ignoreCase) result += 'i'; + if (that.multiline) result += 'm'; + if (that.unicode) result += 'u'; + if (that.sticky) result += 'y'; + return result; +}; + +// 21.2.5.3 get RegExp.prototype.flags() +if (_descriptors && /./g.flags != 'g') _objectDp.f(RegExp.prototype, 'flags', { + configurable: true, + get: _flags +}); + +var TO_STRING = 'toString'; +var $toString = /./[TO_STRING]; + +var define = function (fn) { + _redefine(RegExp.prototype, TO_STRING, fn, true); +}; + +// 21.2.5.14 RegExp.prototype.toString() +if (_fails(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { + define(function toString() { + var R = _anObject(this); + return '/'.concat(R.source, '/', + 'flags' in R ? R.flags : !_descriptors && R instanceof RegExp ? _flags.call(R) : undefined); + }); +// FF44- RegExp#toString has a wrong name +} else if ($toString.name != TO_STRING) { + define(function toString() { + return $toString.call(this); + }); +} + +function fullHex(hex$$1) { + return hex$$1.length === 4 ? ['#', hex$$1.substring(1, 2), hex$$1.substring(1, 2), hex$$1.substring(2, 3), hex$$1.substring(2, 3), hex$$1.substring(3, 4), hex$$1.substring(3, 4)].join('') : hex$$1; +} // Component to hex value + + +function compToHex(comp) { + var hex$$1 = comp.toString(16); + return hex$$1.length === 1 ? '0' + hex$$1 : hex$$1; +} + +class Color { + constructor(...args) { + this.init(...args); } - function wrapWithAttrCheck(fn) { - return function () { - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - var o = args[args.length - 1]; + init(color, g, b) { + let match; // initialize defaults + + this.r = 0; + this.g = 0; + this.b = 0; + if (!color) return; // parse color + + if (typeof color === 'string') { + if (isRgb.test(color)) { + // get rgb values + match = rgb.exec(color.replace(whitespace, '')); // parse numeric values + + this.r = parseInt(match[1]); + this.g = parseInt(match[2]); + this.b = parseInt(match[3]); + } else if (isHex.test(color)) { + // get hex values + match = hex.exec(fullHex(color)); // parse numeric values + + this.r = parseInt(match[1], 16); + this.g = parseInt(match[2], 16); + this.b = parseInt(match[3], 16); + } + } else if (Array.isArray(color)) { + this.r = color[0]; + this.g = color[1]; + this.b = color[2]; + } else if (typeof color === 'object') { + this.r = color.r; + this.g = color.g; + this.b = color.b; + } else if (arguments.length === 3) { + this.r = color; + this.g = g; + this.b = b; + } - if (o && o.constructor === Object && !(o instanceof Array)) { - return fn.apply(this, args.slice(0, -1)).attr(o); - } else { - return fn.apply(this, args); - } - }; + return this; + } // Default to hex conversion + + + toString() { + return this.toHex(); } - function siblings() { - return this.parent().children(); - } // Get the curent position siblings + toArray() { + return [this.r, this.g, this.b]; + } // Build hex value - function position() { - return this.parent().index(this); - } // Get the next element (will return null if there is none) - function next() { - return this.siblings()[this.position() + 1]; - } // Get the next element (will return null if there is none) + toHex() { + return '#' + compToHex(Math.round(this.r)) + compToHex(Math.round(this.g)) + compToHex(Math.round(this.b)); + } // Build rgb value - function prev() { - return this.siblings()[this.position() - 1]; - } // Send given element one step forward - function forward() { - var i = this.position() + 1; - var p = this.parent(); // move node one step forward + toRgb() { + return 'rgb(' + [this.r, this.g, this.b].join() + ')'; + } // Calculate true brightness - p.removeElement(this).add(this, i); // make sure defs node is always at the top - if (typeof p.isRoot === 'function' && p.isRoot()) { - p.node.appendChild(p.defs().node); - } + brightness() { + return this.r / 255 * 0.30 + this.g / 255 * 0.59 + this.b / 255 * 0.11; + } // Testers + // Test if given value is a color string - return this; - } // Send given element one step backward - function backward() { - var i = this.position(); + static test(color) { + color += ''; + return isHex.test(color) || isRgb.test(color); + } // Test if given value is a rgb object - if (i > 0) { - this.parent().removeElement(this).add(this, i - 1); - } - return this; - } // Send given element all the way to the front + static isRgb(color) { + return color && typeof color.r === 'number' && typeof color.g === 'number' && typeof color.b === 'number'; + } // Test if given value is a color + - function front() { - var p = this.parent(); // Move node forward + static isColor(color) { + return this.isRgb(color) || this.test(color); + } - p.node.appendChild(this.node); // Make sure defs node is always at the top +} + +// @@match logic +_fixReWks('match', 1, function (defined, MATCH, $match) { + // 21.1.3.11 String.prototype.match(regexp) + return [function match(regexp) { + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[MATCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); + }, $match]; +}); + +class Point { + // Initialize + constructor(...args) { + this.init(...args); + } - if (typeof p.isRoot === 'function' && p.isRoot()) { - p.node.appendChild(p.defs().node); - } + init(x, y) { + let source; + let base = { + x: 0, + y: 0 // ensure source as object + }; + source = Array.isArray(x) ? { + x: x[0], + y: x[1] + } : typeof x === 'object' ? { + x: x.x, + y: x.y + } : { + x: x, + y: y // merge source + + }; + this.x = source.x == null ? base.x : source.x; + this.y = source.y == null ? base.y : source.y; return this; - } // Send given element all the way to the back + } // Clone point + + + clone() { + return new Point(this); + } // transform point with matrix + - function back() { - if (this.position() > 0) { - this.parent().removeElement(this).add(this, 0); + transform(m) { + // Perform the matrix multiplication + var x = m.a * this.x + m.c * this.y + m.e; + var y = m.b * this.x + m.d * this.y + m.f; // Return the required point + + return new Point(x, y); + } + + toArray() { + return [this.x, this.y]; + } + +} +function point(x, y) { + return new Point(x, y).transform(this.screenCTM().inverse()); +} + +function parser() { + // Reuse cached element if possible + if (!parser.nodes) { + let svg = makeInstance().size(2, 0); + svg.node.cssText = ['opacity: 0', 'position: absolute', 'left: -100%', 'top: -100%', 'overflow: hidden'].join(';'); + let path = svg.path().node; + parser.nodes = { + svg, + path + }; + } + + if (!parser.nodes.svg.node.parentNode) { + let b = globals.document.body || globals.document.documentElement; + parser.nodes.svg.addTo(b); + } + + return parser.nodes; +} + +function isNulledBox(box) { + return !box.w && !box.h && !box.x && !box.y; +} + +function domContains(node) { + return (globals.document.documentElement.contains || function (node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode) { + node = node.parentNode; } - return this; - } // Inserts a given element before the targeted element + return node === document; + }).call(globals.document.documentElement, node); +} - function before(element) { - element = makeInstance(element); - element.remove(); - var i = this.position(); - this.parent().add(element, i); +class Box { + constructor(...args) { + this.init(...args); + } + + init(source) { + var base = [0, 0, 0, 0]; + source = typeof source === 'string' ? source.split(delimiter).map(parseFloat) : Array.isArray(source) ? source : typeof source === 'object' ? [source.left != null ? source.left : source.x, source.top != null ? source.top : source.y, source.width, source.height] : arguments.length === 4 ? [].slice.call(arguments) : base; + this.x = source[0] || 0; + this.y = source[1] || 0; + this.width = this.w = source[2] || 0; + this.height = this.h = source[3] || 0; // Add more bounding box properties + + this.x2 = this.x + this.w; + this.y2 = this.y + this.h; + this.cx = this.x + this.w / 2; + this.cy = this.y + this.h / 2; return this; - } // Inserts a given element after the targeted element + } // Merge rect box with another, return a new instance - function after(element) { - element = makeInstance(element); - element.remove(); - var i = this.position(); - this.parent().add(element, i + 1); + + merge(box) { + let x = Math.min(this.x, box.x); + let y = Math.min(this.y, box.y); + let width = Math.max(this.x + this.width, box.x + box.width) - x; + let height = Math.max(this.y + this.height, box.y + box.height) - y; + return new Box(x, y, width, height); + } + + transform(m) { + let xMin = Infinity; + let xMax = -Infinity; + let yMin = Infinity; + let yMax = -Infinity; + let pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)]; + pts.forEach(function (p) { + p = p.transform(m); + xMin = Math.min(xMin, p.x); + xMax = Math.max(xMax, p.x); + yMin = Math.min(yMin, p.y); + yMax = Math.max(yMax, p.y); + }); + return new Box(xMin, yMin, xMax - xMin, yMax - yMin); + } + + addOffset() { + // offset by window scroll position, because getBoundingClientRect changes when window is scrolled + this.x += globals.window.pageXOffset; + this.y += globals.window.pageYOffset; return this; } - function insertBefore(element) { - element = makeInstance(element); - element.before(this); + + toString() { + return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height; } - function insertAfter(element) { - element = makeInstance(element); - element.after(this); - } - registerMethods('Dom', { - siblings: siblings, - position: position, - next: next, - prev: prev, - forward: forward, - backward: backward, - front: front, - back: back, - before: before, - after: after, - insertBefore: insertBefore, - insertAfter: insertAfter - }); - // Parse unit value - var numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; // Parse hex value + toArray() { + return [this.x, this.y, this.width, this.height]; + } - var hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; // Parse rgb value + isNulled() { + return isNulledBox(this); + } - var rgb = /rgb\((\d+),(\d+),(\d+)\)/; // Parse reference id +} - var reference = /(#[a-z0-9\-_]+)/i; // splits a transformation chain +function getBox(cb) { + let box; - var transforms = /\)\s*,?\s*/; // Whitespace + try { + box = cb(this.node); - var whitespace = /\s/g; // Test hex value + if (isNulledBox(box) && !domContains(this.node)) { + throw new Error('Element not in the dom'); + } + } catch (e) { + try { + let clone = this.clone().addTo(parser().svg).show(); + box = cb(clone.node); + clone.remove(); + } catch (e) { + throw new Error('Getting a bounding box of element "' + this.node.nodeName + '" is not possible'); + } + } - var isHex = /^#[a-f0-9]{3,6}$/i; // Test rgb value + return box; +} + +function bbox() { + return new Box(getBox.call(this, node => node.getBBox())); +} +function rbox(el) { + let box = new Box(getBox.call(this, node => node.getBoundingClientRect())); + if (el) return box.transform(el.screenCTM().inverse()); + return box.addOffset(); +} +registerMethods({ + viewbox: { + viewbox(x, y, width, height) { + // act as getter + if (x == null) return new Box(this.attr('viewBox')); // act as setter + + return this.attr('viewBox', new Box(x, y, width, height)); + } - var isRgb = /^rgb\(/; // Test css declaration + } +}); - var isCss = /[^:]+:[^;]+;?/; // Test for blank string +function closeEnough(a, b, threshold) { + return Math.abs(b - a) < (threshold || 1e-6); +} - var isBlank = /^(\s+)?$/; // Test for numeric string +class Matrix { + constructor(...args) { + this.init(...args); + } // Initialize - var isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; // Test for percent value - var isPercent = /^-?[\d.]+%$/; // Test for image url + init(source) { + var base = Matrix.fromArray([1, 0, 0, 1, 0, 0]); // ensure source as object - var isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; // split at whitespace and comma + source = source instanceof Element ? source.matrixify() : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat)) : Array.isArray(source) ? Matrix.fromArray(source) : typeof source === 'object' && Matrix.isMatrixLike(source) ? source : typeof source === 'object' ? new Matrix().transform(source) : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments)) : base; // Merge the source matrix with the base matrix - var delimiter = /[\s,]+/; // The following regex are used to parse the d attribute of a path - // Matches all hyphens which are not after an exponent + this.a = source.a != null ? source.a : base.a; + this.b = source.b != null ? source.b : base.b; + this.c = source.c != null ? source.c : base.c; + this.d = source.d != null ? source.d : base.d; + this.e = source.e != null ? source.e : base.e; + this.f = source.f != null ? source.f : base.f; + return this; + } // Clones this matrix - var hyphen = /([^e])-/gi; // Replaces and tests for all path letters - var pathLetters = /[MLHVCSQTAZ]/gi; // yes we need this one, too + clone() { + return new Matrix(this); + } // Transform a matrix into another matrix by manipulating the space - var isPathLetter = /[MLHVCSQTAZ]/i; // matches 0.154.23.45 - var numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi; // matches . + transform(o) { + // Check if o is a matrix and then left multiply it directly + if (Matrix.isMatrixLike(o)) { + var matrix = new Matrix(o); + return matrix.multiplyO(this); + } // Get the proposed transformations and the current transformations - var dots = /\./g; - var regex = /*#__PURE__*/Object.freeze({ - numberAndUnit: numberAndUnit, - hex: hex, - rgb: rgb, - reference: reference, - transforms: transforms, - whitespace: whitespace, - isHex: isHex, - isRgb: isRgb, - isCss: isCss, - isBlank: isBlank, - isNumber: isNumber, - isPercent: isPercent, - isImage: isImage, - delimiter: delimiter, - hyphen: hyphen, - pathLetters: pathLetters, - isPathLetter: isPathLetter, - numbersWithDots: numbersWithDots, - dots: dots - }); + var t = Matrix.formatTransforms(o); + var current = this; - function classes() { - var attr = this.attr('class'); - return attr == null ? [] : attr.trim().split(delimiter); - } // Return true if class exists on the node, false otherwise + let _transform = new Point(t.ox, t.oy).transform(current), + ox = _transform.x, + oy = _transform.y; // Construct the resulting matrix - function hasClass(name) { - return this.classes().indexOf(name) !== -1; - } // Add class to the node - function addClass(name) { - if (!this.hasClass(name)) { - var array = this.classes(); - array.push(name); - this.attr('class', array.join(' ')); - } + var transformer = new Matrix().translateO(t.rx, t.ry).lmultiplyO(current).translateO(-ox, -oy).scaleO(t.scaleX, t.scaleY).skewO(t.skewX, t.skewY).shearO(t.shear).rotateO(t.theta).translateO(ox, oy); // If we want the origin at a particular place, we force it there - return this; - } // Remove class from the node + if (isFinite(t.px) || isFinite(t.py)) { + const origin = new Point(ox, oy).transform(transformer); // TODO: Replace t.px with isFinite(t.px) - function removeClass(name) { - if (this.hasClass(name)) { - this.attr('class', this.classes().filter(function (c) { - return c !== name; - }).join(' ')); - } + const dx = t.px ? t.px - origin.x : 0; + const dy = t.py ? t.py - origin.y : 0; + transformer.translateO(dx, dy); + } // Translate now after positioning - return this; - } // Toggle the presence of a class on the node - function toggleClass(name) { - return this.hasClass(name) ? this.removeClass(name) : this.addClass(name); - } - registerMethods('Dom', { - classes: classes, - hasClass: hasClass, - addClass: addClass, - removeClass: removeClass, - toggleClass: toggleClass - }); + transformer.translateO(t.tx, t.ty); + return transformer; + } // Applies a matrix defined by its affine parameters - function css(style, val) { - var ret = {}; - if (arguments.length === 0) { - // get full style as object - this.node.style.cssText.split(/\s*;\s*/).filter(function (el) { - return !!el.length; - }).forEach(function (el) { - var t = el.split(/\s*:\s*/); - ret[t[0]] = t[1]; - }); - return ret; - } + compose(o) { + if (o.origin) { + o.originX = o.origin[0]; + o.originY = o.origin[1]; + } // Get the parameters - if (arguments.length < 2) { - // get style properties in the array - if (Array.isArray(style)) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = style[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var name = _step.value; - var cased = camelCase(name); - ret[cased] = this.node.style[cased]; - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - return ret; - } // get style for property + var ox = o.originX || 0; + var oy = o.originY || 0; + var sx = o.scaleX || 1; + var sy = o.scaleY || 1; + var lam = o.shear || 0; + var theta = o.rotate || 0; + var tx = o.translateX || 0; + var ty = o.translateY || 0; // Apply the standard matrix + var result = new Matrix().translateO(-ox, -oy).scaleO(sx, sy).shearO(lam).rotateO(theta).translateO(tx, ty).lmultiplyO(this).translateO(ox, oy); + return result; + } // Decomposes this matrix into its affine parameters - if (typeof style === 'string') { - return this.node.style[camelCase(style)]; - } // set styles in object + decompose(cx = 0, cy = 0) { + // Get the parameters from the matrix + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var e = this.e; + var f = this.f; // Figure out if the winding direction is clockwise or counterclockwise - if (_typeof(style) === 'object') { - for (var _name in style) { - // set empty string if null/undefined/'' was given - this.node.style[camelCase(_name)] = style[_name] == null || isBlank.test(style[_name]) ? '' : style[_name]; - } - } - } // set style for property + var determinant = a * d - b * c; + var ccw = determinant > 0 ? 1 : -1; // Since we only shear in x, we can use the x basis to get the x scale + // and the rotation of the resulting matrix + var sx = ccw * Math.sqrt(a * a + b * b); + var thetaRad = Math.atan2(ccw * b, ccw * a); + var theta = 180 / Math.PI * thetaRad; + var ct = Math.cos(thetaRad); + var st = Math.sin(thetaRad); // We can then solve the y basis vector simultaneously to get the other + // two affine parameters directly from these parameters - if (arguments.length === 2) { - this.node.style[camelCase(style)] = val == null || isBlank.test(val) ? '' : val; - } + var lam = (a * c + b * d) / determinant; + var sy = c * sx / (lam * a - b) || d * sx / (lam * b + a); // Use the translations - return this; - } // Show element + let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); + let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); // Construct the decomposition and return it - function show() { - return this.css('display', ''); - } // Hide element + return { + // Return the affine parameters + scaleX: sx, + scaleY: sy, + shear: lam, + rotate: theta, + translateX: tx, + translateY: ty, + originX: cx, + originY: cy, + // Return the matrix parameters + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } // Left multiplies by the given matrix - function hide() { - return this.css('display', 'none'); - } // Is element visible? - function visible() { - return this.css('display') !== 'none'; + multiply(matrix) { + return this.clone().multiplyO(matrix); } - registerMethods('Dom', { - css: css, - show: show, - hide: hide, - visible: visible - }); - function data(a, v, r) { - if (_typeof(a) === 'object') { - for (v in a) { - this.data(v, a[v]); - } - } else if (arguments.length < 2) { - try { - return JSON.parse(this.attr('data-' + a)); - } catch (e) { - return this.attr('data-' + a); - } - } else { - this.attr('data-' + a, v === null ? null : r === true || typeof v === 'string' || typeof v === 'number' ? v : JSON.stringify(v)); - } + multiplyO(matrix) { + // Get the matrices + var l = this; + var r = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } + + lmultiply(matrix) { + return this.clone().lmultiplyO(matrix); + } + lmultiplyO(matrix) { + var r = this; + var l = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } // Inverses matrix + + + inverseO() { + // Get the current parameters out of the matrix + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var e = this.e; + var f = this.f; // Invert the 2x2 matrix in the top left + + var det = a * d - b * c; + if (!det) throw new Error('Cannot invert ' + this); // Calculate the top 2x2 matrix + + var na = d / det; + var nb = -b / det; + var nc = -c / det; + var nd = a / det; // Apply the inverted matrix to the top right + + var ne = -(na * e + nc * f); + var nf = -(nb * e + nd * f); // Construct the inverted matrix + + this.a = na; + this.b = nb; + this.c = nc; + this.d = nd; + this.e = ne; + this.f = nf; return this; } - registerMethods('Dom', { - data: data - }); - function remember(k, v) { - // remember every item in an object individually - if (_typeof(arguments[0]) === 'object') { - for (var key in k) { - this.remember(key, k[key]); - } - } else if (arguments.length === 1) { - // retrieve memory - return this.memory()[k]; - } else { - // store memory - this.memory()[k] = v; - } + inverse() { + return this.clone().inverseO(); + } // Translate matrix - return this; - } // Erase a given memory - function forget() { - if (arguments.length === 0) { - this._memory = {}; - } else { - for (var i = arguments.length - 1; i >= 0; i--) { - delete this.memory()[arguments[i]]; - } - } + translate(x, y) { + return this.clone().translateO(x, y); + } + translateO(x, y) { + this.e += x || 0; + this.f += y || 0; return this; - } // This triggers creation of a new hidden class which is not performant - // However, this function is not rarely used so it will not happen frequently - // Return local memory object + } // Scale matrix - function memory() { - return this._memory = this._memory || {}; + + scale(x, y, cx, cy) { + return this.clone().scaleO(...arguments); } - registerMethods('Dom', { - remember: remember, - forget: forget, - memory: memory - }); - var listenerId = 0; + scaleO(x, y = x, cx = 0, cy = 0) { + // Support uniform scaling + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + let a = this.a, + b = this.b, + c = this.c, + d = this.d, + e = this.e, + f = this.f; + this.a = a * x; + this.b = b * y; + this.c = c * x; + this.d = d * y; + this.e = e * x - cx * x + cx; + this.f = f * y - cy * y + cy; + return this; + } // Rotate matrix - function getEvents(node) { - var n = makeInstance(node).getEventHolder(); - if (!n.events) n.events = {}; - return n.events; - } - function getEventTarget(node) { - return makeInstance(node).getEventTarget(); + rotate(r, cx, cy) { + return this.clone().rotateO(r, cx, cy); } - function clearEvents(node) { - var n = makeInstance(node).getEventHolder(); - if (n.events) n.events = {}; - } // Add event binder in the SVG namespace + rotateO(r, cx = 0, cy = 0) { + // Convert degrees to radians + r = radians(r); + let cos = Math.cos(r); + let sin = Math.sin(r); + let a = this.a, + b = this.b, + c = this.c, + d = this.d, + e = this.e, + f = this.f; + this.a = a * cos - b * sin; + this.b = b * cos + a * sin; + this.c = c * cos - d * sin; + this.d = d * cos + c * sin; + this.e = e * cos - f * sin + cy * sin - cx * cos + cx; + this.f = f * cos + e * sin - cx * sin - cy * cos + cy; + return this; + } // Flip matrix on x or y, at a given offset - function on(node, events, listener, binding, options) { - var l = listener.bind(binding || node); - var bag = getEvents(node); - var n = getEventTarget(node); // events can be an array of events or a string of events + flip(axis, around) { + return this.clone().flipO(axis, around); + } - events = Array.isArray(events) ? events : events.split(delimiter); // add id to listener + flipO(axis, around) { + return axis === 'x' ? this.scaleO(-1, 1, around, 0) : axis === 'y' ? this.scaleO(1, -1, 0, around) : this.scaleO(-1, -1, axis, around || axis); // Define an x, y flip point + } // Shear matrix - if (!listener._svgjsListenerId) { - listener._svgjsListenerId = ++listenerId; - } - events.forEach(function (event) { - var ev = event.split('.')[0]; - var ns = event.split('.')[1] || '*'; // ensure valid object + shear(a, cx, cy) { + return this.clone().shearO(a, cx, cy); + } - bag[ev] = bag[ev] || {}; - bag[ev][ns] = bag[ev][ns] || {}; // reference listener + shearO(lx, cx = 0, cy = 0) { + let a = this.a, + b = this.b, + c = this.c, + d = this.d, + e = this.e, + f = this.f; + this.a = a + b * lx; + this.c = c + d * lx; + this.e = e + f * lx - cy * lx; + return this; + } // Skew Matrix - bag[ev][ns][listener._svgjsListenerId] = l; // add listener - n.addEventListener(ev, l, options || false); - }); - } // Add event unbinder in the SVG namespace - - function off(node, events, listener, options) { - var bag = getEvents(node); - var n = getEventTarget(node); // listener can be a function or a number - - if (typeof listener === 'function') { - listener = listener._svgjsListenerId; - if (!listener) return; - } // events can be an array of events or a string or undefined - - - events = Array.isArray(events) ? events : (events || '').split(delimiter); - events.forEach(function (event) { - var ev = event && event.split('.')[0]; - var ns = event && event.split('.')[1]; - var namespace, l; - - if (listener) { - // remove listener reference - if (bag[ev] && bag[ev][ns || '*']) { - // removeListener - n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false); - delete bag[ev][ns || '*'][listener]; - } - } else if (ev && ns) { - // remove all listeners for a namespaced event - if (bag[ev] && bag[ev][ns]) { - for (l in bag[ev][ns]) { - off(n, [ev, ns].join('.'), l); - } + skew(x, y, cx, cy) { + return this.clone().skewO(...arguments); + } - delete bag[ev][ns]; - } - } else if (ns) { - // remove all listeners for a specific namespace - for (event in bag) { - for (namespace in bag[event]) { - if (ns === namespace) { - off(n, [event, ns].join('.')); - } - } - } - } else if (ev) { - // remove all listeners for the event - if (bag[ev]) { - for (namespace in bag[ev]) { - off(n, [ev, namespace].join('.')); - } + skewO(x, y = x, cx = 0, cy = 0) { + // support uniformal skew + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } // Convert degrees to radians + + + x = radians(x); + y = radians(y); + let lx = Math.tan(x); + let ly = Math.tan(y); + let a = this.a, + b = this.b, + c = this.c, + d = this.d, + e = this.e, + f = this.f; + this.a = a + b * lx; + this.b = b + a * ly; + this.c = c + d * lx; + this.d = d + c * ly; + this.e = e + f * lx - cy * lx; + this.f = f + e * ly - cx * ly; + return this; + } // SkewX - delete bag[ev]; - } - } else { - // remove all listeners on a given node - for (event in bag) { - off(n, event); - } - clearEvents(node); - } - }); + skewX(x, cx, cy) { + return this.skew(x, 0, cx, cy); } - function dispatch(node, event, data) { - var n = getEventTarget(node); // Dispatch event - if (event instanceof globals.window.Event) { - n.dispatchEvent(event); - } else { - event = new globals.window.CustomEvent(event, { - detail: data, - cancelable: true - }); - n.dispatchEvent(event); - } + skewXO(x, cx, cy) { + return this.skewO(x, 0, cx, cy); + } // SkewY + - return event; + skewY(y, cx, cy) { + return this.skew(0, y, cx, cy); } - function fullHex(hex$$1) { - return hex$$1.length === 4 ? ['#', hex$$1.substring(1, 2), hex$$1.substring(1, 2), hex$$1.substring(2, 3), hex$$1.substring(2, 3), hex$$1.substring(3, 4), hex$$1.substring(3, 4)].join('') : hex$$1; - } // Component to hex value + skewYO(y, cx, cy) { + return this.skewO(0, y, cx, cy); + } // Transform around a center point - function compToHex(comp) { - var hex$$1 = comp.toString(16); - return hex$$1.length === 1 ? '0' + hex$$1 : hex$$1; + aroundO(cx, cy, matrix) { + var dx = cx || 0; + var dy = cy || 0; + return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy); } - var Color = - /*#__PURE__*/ - function () { - function Color() { - _classCallCheck(this, Color); + around(cx, cy, matrix) { + return this.clone().aroundO(cx, cy, matrix); + } // Check if two matrices are equal - this.init.apply(this, arguments); - } - _createClass(Color, [{ - key: "init", - value: function init(color, g, b) { - var match; // initialize defaults - - this.r = 0; - this.g = 0; - this.b = 0; - if (!color) return; // parse color - - if (typeof color === 'string') { - if (isRgb.test(color)) { - // get rgb values - match = rgb.exec(color.replace(whitespace, '')); // parse numeric values - - this.r = parseInt(match[1]); - this.g = parseInt(match[2]); - this.b = parseInt(match[3]); - } else if (isHex.test(color)) { - // get hex values - match = hex.exec(fullHex(color)); // parse numeric values - - this.r = parseInt(match[1], 16); - this.g = parseInt(match[2], 16); - this.b = parseInt(match[3], 16); - } - } else if (Array.isArray(color)) { - this.r = color[0]; - this.g = color[1]; - this.b = color[2]; - } else if (_typeof(color) === 'object') { - this.r = color.r; - this.g = color.g; - this.b = color.b; - } else if (arguments.length === 3) { - this.r = color; - this.g = g; - this.b = b; - } + equals(other) { + var comp = new Matrix(other); + return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f); + } // Convert matrix to string - return this; - } // Default to hex conversion - }, { - key: "toString", - value: function toString() { - return this.toHex(); - } - }, { - key: "toArray", - value: function toArray() { - return [this.r, this.g, this.b]; - } // Build hex value - - }, { - key: "toHex", - value: function toHex() { - return '#' + compToHex(Math.round(this.r)) + compToHex(Math.round(this.g)) + compToHex(Math.round(this.b)); - } // Build rgb value - - }, { - key: "toRgb", - value: function toRgb() { - return 'rgb(' + [this.r, this.g, this.b].join() + ')'; - } // Calculate true brightness - - }, { - key: "brightness", - value: function brightness() { - return this.r / 255 * 0.30 + this.g / 255 * 0.59 + this.b / 255 * 0.11; - } // Testers - // Test if given value is a color string - - }], [{ - key: "test", - value: function test(color) { - color += ''; - return isHex.test(color) || isRgb.test(color); - } // Test if given value is a rgb object - - }, { - key: "isRgb", - value: function isRgb$$1(color) { - return color && typeof color.r === 'number' && typeof color.g === 'number' && typeof color.b === 'number'; - } // Test if given value is a color - - }, { - key: "isColor", - value: function isColor(color) { - return this.isRgb(color) || this.test(color); - } - }]); + toString() { + return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'; + } - return Color; - }(); + toArray() { + return [this.a, this.b, this.c, this.d, this.e, this.f]; + } - var Point = - /*#__PURE__*/ - function () { - // Initialize - function Point() { - _classCallCheck(this, Point); + valueOf() { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } - this.init.apply(this, arguments); - } + static fromArray(a) { + return { + a: a[0], + b: a[1], + c: a[2], + d: a[3], + e: a[4], + f: a[5] + }; + } - _createClass(Point, [{ - key: "init", - value: function init(x, y) { - var source; - var base = { - x: 0, - y: 0 // ensure source as object - - }; - source = Array.isArray(x) ? { - x: x[0], - y: x[1] - } : _typeof(x) === 'object' ? { - x: x.x, - y: x.y - } : { - x: x, - y: y // merge source - - }; - this.x = source.x == null ? base.x : source.x; - this.y = source.y == null ? base.y : source.y; - return this; - } // Clone point - - }, { - key: "clone", - value: function clone() { - return new Point(this); - } // transform point with matrix - - }, { - key: "transform", - value: function transform(m) { - // Perform the matrix multiplication - var x = m.a * this.x + m.c * this.y + m.e; - var y = m.b * this.x + m.d * this.y + m.f; // Return the required point - - return new Point(x, y); - } - }, { - key: "toArray", - value: function toArray() { - return [this.x, this.y]; - } - }]); - - return Point; - }(); - function point(x, y) { - return new Point(x, y).transform(this.screenCTM().inverse()); - } - - function parser() { - // Reuse cached element if possible - if (!parser.nodes) { - var svg = makeInstance().size(2, 0); - svg.node.cssText = ['opacity: 0', 'position: absolute', 'left: -100%', 'top: -100%', 'overflow: hidden'].join(';'); - var path = svg.path().node; - parser.nodes = { - svg: svg, - path: path - }; - } + static isMatrixLike(o) { + return o.a != null || o.b != null || o.c != null || o.d != null || o.e != null || o.f != null; + } - if (!parser.nodes.svg.node.parentNode) { - var b = globals.document.body || globals.document.documentElement; - parser.nodes.svg.addTo(b); - } + static formatTransforms(o) { + // Get all of the parameters required to form the matrix + var flipBoth = o.flip === 'both' || o.flip === true; + var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; + var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; + var skewX = o.skew && o.skew.length ? o.skew[0] : isFinite(o.skew) ? o.skew : isFinite(o.skewX) ? o.skewX : 0; + var skewY = o.skew && o.skew.length ? o.skew[1] : isFinite(o.skew) ? o.skew : isFinite(o.skewY) ? o.skewY : 0; + var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX : isFinite(o.scale) ? o.scale * flipX : isFinite(o.scaleX) ? o.scaleX * flipX : flipX; + var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY : isFinite(o.scale) ? o.scale * flipY : isFinite(o.scaleY) ? o.scaleY * flipY : flipY; + var shear = o.shear || 0; + var theta = o.rotate || o.theta || 0; + var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); + var ox = origin.x; + var oy = origin.y; + var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY); + var px = position.x; + var py = position.y; + var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); + var tx = translate.x; + var ty = translate.y; + var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); + var rx = relative.x; + var ry = relative.y; // Populate all of the values - return parser.nodes; + return { + scaleX, + scaleY, + skewX, + skewY, + shear, + theta, + rx, + ry, + tx, + ty, + ox, + oy, + px, + py + }; + } // left matrix, right matrix, target matrix which is overwritten + + + static matrixMultiply(l, r, o) { + // Work out the product directly + var a = l.a * r.a + l.c * r.b; + var b = l.b * r.a + l.d * r.b; + var c = l.a * r.c + l.c * r.d; + var d = l.b * r.c + l.d * r.d; + var e = l.e + l.a * r.e + l.c * r.f; + var f = l.f + l.b * r.e + l.d * r.f; // make sure to use local variables because l/r and o could be the same + + o.a = a; + o.b = b; + o.c = c; + o.d = d; + o.e = e; + o.f = f; + return o; } - function isNulledBox(box) { - return !box.w && !box.h && !box.x && !box.y; +} +function ctm() { + return new Matrix(this.node.getCTM()); +} +function screenCTM() { + /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 + This is needed because FF does not return the transformation matrix + for the inner coordinate system when getScreenCTM() is called on nested svgs. + However all other Browsers do that */ + if (typeof this.isRoot === 'function' && !this.isRoot()) { + var rect = this.rect(1, 1); + var m = rect.node.getScreenCTM(); + rect.remove(); + return new Matrix(m); } - function domContains(node) { - return (globals.document.documentElement.contains || function (node) { - // This is IE - it does not support contains() for top-level SVGs - while (node.parentNode) { - node = node.parentNode; - } + return new Matrix(this.node.getScreenCTM()); +} + +/* eslint no-new-func: "off" */ +const subClassArray = function () { + try { + // try es6 subclassing + return Function('name', 'baseClass', '_constructor', ['baseClass = baseClass || Array', 'return {', ' [name]: class extends baseClass {', ' constructor (...args) {', ' super(...args)', ' _constructor && _constructor.apply(this, args)', ' }', ' }', '}[name]'].join('\n')); + } catch (e) { + // Use es5 approach + return (name, baseClass = Array, _constructor) => { + const Arr = function Arr() { + baseClass.apply(this, arguments); + _constructor && _constructor.apply(this, arguments); + }; - return node === document; - }).call(globals.document.documentElement, node); - } + Arr.prototype = Object.create(baseClass.prototype); + Arr.prototype.constructor = Arr; - var Box = - /*#__PURE__*/ - function () { - function Box() { - _classCallCheck(this, Box); + Arr.prototype.map = function (fn) { + const arr = new Arr(); + arr.push.apply(arr, Array.prototype.map.call(this, fn)); + return arr; + }; - this.init.apply(this, arguments); + return Arr; + }; + } +}(); + +const List = subClassArray('List', Array, function (arr = []) { + // This catches the case, that native map tries to create an array with new Array(1) + if (typeof arr === 'number') return this; + this.length = 0; + this.push(...arr); +}); +extend(List, { + each(fnOrMethodName, ...args) { + if (typeof fnOrMethodName === 'function') { + this.forEach(el => { + fnOrMethodName.call(el, el); + }); + } else { + return this.map(el => { + return el[fnOrMethodName](...args); + }); } - _createClass(Box, [{ - key: "init", - value: function init(source) { - var base = [0, 0, 0, 0]; - source = typeof source === 'string' ? source.split(delimiter).map(parseFloat) : Array.isArray(source) ? source : _typeof(source) === 'object' ? [source.left != null ? source.left : source.x, source.top != null ? source.top : source.y, source.width, source.height] : arguments.length === 4 ? [].slice.call(arguments) : base; - this.x = source[0] || 0; - this.y = source[1] || 0; - this.width = this.w = source[2] || 0; - this.height = this.h = source[3] || 0; // Add more bounding box properties - - this.x2 = this.x + this.w; - this.y2 = this.y + this.h; - this.cx = this.x + this.w / 2; - this.cy = this.y + this.h / 2; - return this; - } // Merge rect box with another, return a new instance - - }, { - key: "merge", - value: function merge(box) { - var x = Math.min(this.x, box.x); - var y = Math.min(this.y, box.y); - var width = Math.max(this.x + this.width, box.x + box.width) - x; - var height = Math.max(this.y + this.height, box.y + box.height) - y; - return new Box(x, y, width, height); - } - }, { - key: "transform", - value: function transform(m) { - var xMin = Infinity; - var xMax = -Infinity; - var yMin = Infinity; - var yMax = -Infinity; - var pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)]; - pts.forEach(function (p) { - p = p.transform(m); - xMin = Math.min(xMin, p.x); - xMax = Math.max(xMax, p.x); - yMin = Math.min(yMin, p.y); - yMax = Math.max(yMax, p.y); - }); - return new Box(xMin, yMin, xMax - xMin, yMax - yMin); - } - }, { - key: "addOffset", - value: function addOffset() { - // offset by window scroll position, because getBoundingClientRect changes when window is scrolled - this.x += globals.window.pageXOffset; - this.y += globals.window.pageYOffset; - return this; - } - }, { - key: "toString", - value: function toString() { - return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height; - } - }, { - key: "toArray", - value: function toArray() { - return [this.x, this.y, this.width, this.height]; - } - }, { - key: "isNulled", - value: function isNulled() { - return isNulledBox(this); - } - }]); + return this; + }, - return Box; - }(); + toArray() { + return Array.prototype.concat.apply([], this); + } - function getBox(cb) { - var box; +}); - try { - box = cb(this.node); +List.extend = function (methods) { + methods = methods.reduce((obj, name) => { + obj[name] = function (...attrs) { + return this.each(name, ...attrs); + }; - if (isNulledBox(box) && !domContains(this.node)) { - throw new Error('Element not in the dom'); - } - } catch (e) { - try { - var clone = this.clone().addTo(parser().svg).show(); - box = cb(clone.node); - clone.remove(); - } catch (e) { - throw new Error('Getting a bounding box of element "' + this.node.nodeName + '" is not possible'); - } - } + return obj; + }, {}); + extend(List, methods); +}; - return box; +function baseFind(query, parent) { + return new List(map((parent || globals.document).querySelectorAll(query), function (node) { + return adopt(node); + })); +} // Scoped find method + +function find(query) { + return baseFind(query, this.node); +} + +class EventTarget extends Base { + constructor({ + events = {} + } = {}) { + super(); + this.events = events; } - function bbox() { - return new Box(getBox.call(this, function (node) { - return node.getBBox(); - })); - } - function rbox(el) { - var box = new Box(getBox.call(this, function (node) { - return node.getBoundingClientRect(); - })); - if (el) return box.transform(el.screenCTM().inverse()); - return box.addOffset(); + addEventListener() {} + + dispatch(event, data) { + return dispatch(this, event, data); } - registerMethods({ - viewbox: { - viewbox: function viewbox(x, y, width, height) { - // act as getter - if (x == null) return new Box(this.attr('viewBox')); // act as setter - return this.attr('viewBox', new Box(x, y, width, height)); + dispatchEvent(event) { + const bag = this.getEventHolder().events; + if (!bag) return true; + const events = bag[event.type]; + + for (let i in events) { + for (let j in events[i]) { + events[i][j](event); } } - }); - function closeEnough(a, b, threshold) { - return Math.abs(b - a) < (threshold || 1e-6); - } - - var Matrix = - /*#__PURE__*/ - function () { - function Matrix() { - _classCallCheck(this, Matrix); - - this.init.apply(this, arguments); - } // Initialize - - - _createClass(Matrix, [{ - key: "init", - value: function init(source) { - var base = Matrix.fromArray([1, 0, 0, 1, 0, 0]); // ensure source as object - - source = source instanceof Element ? source.matrixify() : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat)) : Array.isArray(source) ? Matrix.fromArray(source) : _typeof(source) === 'object' && Matrix.isMatrixLike(source) ? source : _typeof(source) === 'object' ? new Matrix().transform(source) : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments)) : base; // Merge the source matrix with the base matrix - - this.a = source.a != null ? source.a : base.a; - this.b = source.b != null ? source.b : base.b; - this.c = source.c != null ? source.c : base.c; - this.d = source.d != null ? source.d : base.d; - this.e = source.e != null ? source.e : base.e; - this.f = source.f != null ? source.f : base.f; - return this; - } // Clones this matrix - - }, { - key: "clone", - value: function clone() { - return new Matrix(this); - } // Transform a matrix into another matrix by manipulating the space - - }, { - key: "transform", - value: function transform(o) { - // Check if o is a matrix and then left multiply it directly - if (Matrix.isMatrixLike(o)) { - var matrix = new Matrix(o); - return matrix.multiplyO(this); - } // Get the proposed transformations and the current transformations - - - var t = Matrix.formatTransforms(o); - var current = this; - - var _transform = new Point(t.ox, t.oy).transform(current), - ox = _transform.x, - oy = _transform.y; // Construct the resulting matrix - - - var transformer = new Matrix().translateO(t.rx, t.ry).lmultiplyO(current).translateO(-ox, -oy).scaleO(t.scaleX, t.scaleY).skewO(t.skewX, t.skewY).shearO(t.shear).rotateO(t.theta).translateO(ox, oy); // If we want the origin at a particular place, we force it there - - if (isFinite(t.px) || isFinite(t.py)) { - var origin = new Point(ox, oy).transform(transformer); // TODO: Replace t.px with isFinite(t.px) - - var dx = t.px ? t.px - origin.x : 0; - var dy = t.py ? t.py - origin.y : 0; - transformer.translateO(dx, dy); - } // Translate now after positioning - - - transformer.translateO(t.tx, t.ty); - return transformer; - } // Applies a matrix defined by its affine parameters - - }, { - key: "compose", - value: function compose(o) { - if (o.origin) { - o.originX = o.origin[0]; - o.originY = o.origin[1]; - } // Get the parameters - - - var ox = o.originX || 0; - var oy = o.originY || 0; - var sx = o.scaleX || 1; - var sy = o.scaleY || 1; - var lam = o.shear || 0; - var theta = o.rotate || 0; - var tx = o.translateX || 0; - var ty = o.translateY || 0; // Apply the standard matrix - - var result = new Matrix().translateO(-ox, -oy).scaleO(sx, sy).shearO(lam).rotateO(theta).translateO(tx, ty).lmultiplyO(this).translateO(ox, oy); - return result; - } // Decomposes this matrix into its affine parameters - - }, { - key: "decompose", - value: function decompose() { - var cx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - var cy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - // Get the parameters from the matrix - var a = this.a; - var b = this.b; - var c = this.c; - var d = this.d; - var e = this.e; - var f = this.f; // Figure out if the winding direction is clockwise or counterclockwise - - var determinant = a * d - b * c; - var ccw = determinant > 0 ? 1 : -1; // Since we only shear in x, we can use the x basis to get the x scale - // and the rotation of the resulting matrix - - var sx = ccw * Math.sqrt(a * a + b * b); - var thetaRad = Math.atan2(ccw * b, ccw * a); - var theta = 180 / Math.PI * thetaRad; - var ct = Math.cos(thetaRad); - var st = Math.sin(thetaRad); // We can then solve the y basis vector simultaneously to get the other - // two affine parameters directly from these parameters - - var lam = (a * c + b * d) / determinant; - var sy = c * sx / (lam * a - b) || d * sx / (lam * b + a); // Use the translations - - var tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); - var ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); // Construct the decomposition and return it - - return { - // Return the affine parameters - scaleX: sx, - scaleY: sy, - shear: lam, - rotate: theta, - translateX: tx, - translateY: ty, - originX: cx, - originY: cy, - // Return the matrix parameters - a: this.a, - b: this.b, - c: this.c, - d: this.d, - e: this.e, - f: this.f - }; - } // Left multiplies by the given matrix - - }, { - key: "multiply", - value: function multiply(matrix) { - return this.clone().multiplyO(matrix); - } - }, { - key: "multiplyO", - value: function multiplyO(matrix) { - // Get the matrices - var l = this; - var r = matrix instanceof Matrix ? matrix : new Matrix(matrix); - return Matrix.matrixMultiply(l, r, this); - } - }, { - key: "lmultiply", - value: function lmultiply(matrix) { - return this.clone().lmultiplyO(matrix); - } - }, { - key: "lmultiplyO", - value: function lmultiplyO(matrix) { - var r = this; - var l = matrix instanceof Matrix ? matrix : new Matrix(matrix); - return Matrix.matrixMultiply(l, r, this); - } // Inverses matrix - - }, { - key: "inverseO", - value: function inverseO() { - // Get the current parameters out of the matrix - var a = this.a; - var b = this.b; - var c = this.c; - var d = this.d; - var e = this.e; - var f = this.f; // Invert the 2x2 matrix in the top left - - var det = a * d - b * c; - if (!det) throw new Error('Cannot invert ' + this); // Calculate the top 2x2 matrix - - var na = d / det; - var nb = -b / det; - var nc = -c / det; - var nd = a / det; // Apply the inverted matrix to the top right - - var ne = -(na * e + nc * f); - var nf = -(nb * e + nd * f); // Construct the inverted matrix - - this.a = na; - this.b = nb; - this.c = nc; - this.d = nd; - this.e = ne; - this.f = nf; - return this; - } - }, { - key: "inverse", - value: function inverse() { - return this.clone().inverseO(); - } // Translate matrix - - }, { - key: "translate", - value: function translate(x, y) { - return this.clone().translateO(x, y); - } - }, { - key: "translateO", - value: function translateO(x, y) { - this.e += x || 0; - this.f += y || 0; - return this; - } // Scale matrix - - }, { - key: "scale", - value: function scale(x, y, cx, cy) { - var _this$clone; - - return (_this$clone = this.clone()).scaleO.apply(_this$clone, arguments); - } - }, { - key: "scaleO", - value: function scaleO(x) { - var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; - var cx = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var cy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; - - // Support uniform scaling - if (arguments.length === 3) { - cy = cx; - cx = y; - y = x; - } + return !event.defaultPrevented; + } // Fire given event - var a = this.a, - b = this.b, - c = this.c, - d = this.d, - e = this.e, - f = this.f; - this.a = a * x; - this.b = b * y; - this.c = c * x; - this.d = d * y; - this.e = e * x - cx * x + cx; - this.f = f * y - cy * y + cy; - return this; - } // Rotate matrix - - }, { - key: "rotate", - value: function rotate(r, cx, cy) { - return this.clone().rotateO(r, cx, cy); - } - }, { - key: "rotateO", - value: function rotateO(r) { - var cx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - var cy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - // Convert degrees to radians - r = radians(r); - var cos = Math.cos(r); - var sin = Math.sin(r); - var a = this.a, - b = this.b, - c = this.c, - d = this.d, - e = this.e, - f = this.f; - this.a = a * cos - b * sin; - this.b = b * cos + a * sin; - this.c = c * cos - d * sin; - this.d = d * cos + c * sin; - this.e = e * cos - f * sin + cy * sin - cx * cos + cx; - this.f = f * cos + e * sin - cx * sin - cy * cos + cy; - return this; - } // Flip matrix on x or y, at a given offset - - }, { - key: "flip", - value: function flip(axis, around) { - return this.clone().flipO(axis, around); - } - }, { - key: "flipO", - value: function flipO(axis, around) { - return axis === 'x' ? this.scaleO(-1, 1, around, 0) : axis === 'y' ? this.scaleO(1, -1, 0, around) : this.scaleO(-1, -1, axis, around || axis); // Define an x, y flip point - } // Shear matrix - - }, { - key: "shear", - value: function shear(a, cx, cy) { - return this.clone().shearO(a, cx, cy); - } - }, { - key: "shearO", - value: function shearO(lx) { - var cy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var a = this.a, - b = this.b, - c = this.c, - d = this.d, - e = this.e, - f = this.f; - this.a = a + b * lx; - this.c = c + d * lx; - this.e = e + f * lx - cy * lx; - return this; - } // Skew Matrix - - }, { - key: "skew", - value: function skew(x, y, cx, cy) { - var _this$clone2; - - return (_this$clone2 = this.clone()).skewO.apply(_this$clone2, arguments); - } - }, { - key: "skewO", - value: function skewO(x) { - var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; - var cx = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var cy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; - - // support uniformal skew - if (arguments.length === 3) { - cy = cx; - cx = y; - y = x; - } // Convert degrees to radians - - - x = radians(x); - y = radians(y); - var lx = Math.tan(x); - var ly = Math.tan(y); - var a = this.a, - b = this.b, - c = this.c, - d = this.d, - e = this.e, - f = this.f; - this.a = a + b * lx; - this.b = b + a * ly; - this.c = c + d * lx; - this.d = d + c * ly; - this.e = e + f * lx - cy * lx; - this.f = f + e * ly - cx * ly; - return this; - } // SkewX - - }, { - key: "skewX", - value: function skewX(x, cx, cy) { - return this.skew(x, 0, cx, cy); - } - }, { - key: "skewXO", - value: function skewXO(x, cx, cy) { - return this.skewO(x, 0, cx, cy); - } // SkewY - - }, { - key: "skewY", - value: function skewY(y, cx, cy) { - return this.skew(0, y, cx, cy); - } - }, { - key: "skewYO", - value: function skewYO(y, cx, cy) { - return this.skewO(0, y, cx, cy); - } // Transform around a center point - - }, { - key: "aroundO", - value: function aroundO(cx, cy, matrix) { - var dx = cx || 0; - var dy = cy || 0; - return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy); - } - }, { - key: "around", - value: function around(cx, cy, matrix) { - return this.clone().aroundO(cx, cy, matrix); - } // Check if two matrices are equal - - }, { - key: "equals", - value: function equals(other) { - var comp = new Matrix(other); - return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f); - } // Convert matrix to string - - }, { - key: "toString", - value: function toString() { - return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'; - } - }, { - key: "toArray", - value: function toArray() { - return [this.a, this.b, this.c, this.d, this.e, this.f]; - } - }, { - key: "valueOf", - value: function valueOf() { - return { - a: this.a, - b: this.b, - c: this.c, - d: this.d, - e: this.e, - f: this.f - }; - } - }], [{ - key: "fromArray", - value: function fromArray(a) { - return { - a: a[0], - b: a[1], - c: a[2], - d: a[3], - e: a[4], - f: a[5] - }; - } - }, { - key: "isMatrixLike", - value: function isMatrixLike(o) { - return o.a != null || o.b != null || o.c != null || o.d != null || o.e != null || o.f != null; - } - }, { - key: "formatTransforms", - value: function formatTransforms(o) { - // Get all of the parameters required to form the matrix - var flipBoth = o.flip === 'both' || o.flip === true; - var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; - var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; - var skewX = o.skew && o.skew.length ? o.skew[0] : isFinite(o.skew) ? o.skew : isFinite(o.skewX) ? o.skewX : 0; - var skewY = o.skew && o.skew.length ? o.skew[1] : isFinite(o.skew) ? o.skew : isFinite(o.skewY) ? o.skewY : 0; - var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX : isFinite(o.scale) ? o.scale * flipX : isFinite(o.scaleX) ? o.scaleX * flipX : flipX; - var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY : isFinite(o.scale) ? o.scale * flipY : isFinite(o.scaleY) ? o.scaleY * flipY : flipY; - var shear = o.shear || 0; - var theta = o.rotate || o.theta || 0; - var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); - var ox = origin.x; - var oy = origin.y; - var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY); - var px = position.x; - var py = position.y; - var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); - var tx = translate.x; - var ty = translate.y; - var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); - var rx = relative.x; - var ry = relative.y; // Populate all of the values - - return { - scaleX: scaleX, - scaleY: scaleY, - skewX: skewX, - skewY: skewY, - shear: shear, - theta: theta, - rx: rx, - ry: ry, - tx: tx, - ty: ty, - ox: ox, - oy: oy, - px: px, - py: py - }; - } // left matrix, right matrix, target matrix which is overwritten - - }, { - key: "matrixMultiply", - value: function matrixMultiply(l, r, o) { - // Work out the product directly - var a = l.a * r.a + l.c * r.b; - var b = l.b * r.a + l.d * r.b; - var c = l.a * r.c + l.c * r.d; - var d = l.b * r.c + l.d * r.d; - var e = l.e + l.a * r.e + l.c * r.f; - var f = l.f + l.b * r.e + l.d * r.f; // make sure to use local variables because l/r and o could be the same - - o.a = a; - o.b = b; - o.c = c; - o.d = d; - o.e = e; - o.f = f; - return o; - } - }]); - - return Matrix; - }(); - function ctm() { - return new Matrix(this.node.getCTM()); - } - function screenCTM() { - /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 - This is needed because FF does not return the transformation matrix - for the inner coordinate system when getScreenCTM() is called on nested svgs. - However all other Browsers do that */ - if (typeof this.isRoot === 'function' && !this.isRoot()) { - var rect = this.rect(1, 1); - var m = rect.node.getScreenCTM(); - rect.remove(); - return new Matrix(m); - } - return new Matrix(this.node.getScreenCTM()); + fire(event, data) { + this.dispatch(event, data); + return this; } - /* eslint no-new-func: "off" */ - var subClassArray = function () { - try { - // try es6 subclassing - return Function('name', 'baseClass', '_constructor', ['baseClass = baseClass || Array', 'return {', ' [name]: class extends baseClass {', ' constructor (...args) {', ' super(...args)', ' _constructor && _constructor.apply(this, args)', ' }', ' }', '}[name]'].join('\n')); - } catch (e) { - // Use es5 approach - return function (name) { - var baseClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Array; + getEventHolder() { + return this; + } - var _constructor = arguments.length > 2 ? arguments[2] : undefined; + getEventTarget() { + return this; + } // Unbind event from listener - var Arr = function Arr() { - baseClass.apply(this, arguments); - _constructor && _constructor.apply(this, arguments); - }; - Arr.prototype = Object.create(baseClass.prototype); - Arr.prototype.constructor = Arr; + off(event, listener) { + off(this, event, listener); + return this; + } // Bind given event to listener - Arr.prototype.map = function (fn) { - var arr = new Arr(); - arr.push.apply(arr, Array.prototype.map.call(this, fn)); - return arr; - }; - return Arr; - }; - } - }(); + on(event, listener, binding, options) { + on(this, event, listener, binding, options); + return this; + } - var List = subClassArray('List', Array, function () { - var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + removeEventListener() {} + +} + +function noop() {} // Default animation values + +let timeline = { + duration: 400, + ease: '>', + delay: 0 // Default attribute values + +}; +let attrs = { + // fill and stroke + 'fill-opacity': 1, + 'stroke-opacity': 1, + 'stroke-width': 0, + 'stroke-linejoin': 'miter', + 'stroke-linecap': 'butt', + fill: '#000000', + stroke: '#000000', + opacity: 1, + // position + x: 0, + y: 0, + cx: 0, + cy: 0, + // size + width: 0, + height: 0, + // radius + r: 0, + rx: 0, + ry: 0, + // gradient + offset: 0, + 'stop-opacity': 1, + 'stop-color': '#000000', + // text + 'font-size': 16, + 'font-family': 'Helvetica, Arial, sans-serif', + 'text-anchor': 'start' +}; + +var defaults = /*#__PURE__*/Object.freeze({ + noop: noop, + timeline: timeline, + attrs: attrs +}); + +const SVGArray = subClassArray('SVGArray', Array, function (arr) { + this.init(arr); +}); +extend(SVGArray, { + init(arr) { // This catches the case, that native map tries to create an array with new Array(1) if (typeof arr === 'number') return this; this.length = 0; - this.push.apply(this, _toConsumableArray(arr)); - }); - extend(List, { - each: function each(fnOrMethodName) { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } + this.push(...this.parse(arr)); + return this; + }, - if (typeof fnOrMethodName === 'function') { - this.forEach(function (el) { - fnOrMethodName.call(el, el); - }); - } else { - return this.map(function (el) { - return el[fnOrMethodName].apply(el, args); - }); - } + toArray() { + return Array.prototype.concat.apply([], this); + }, - return this; - }, - toArray: function toArray() { - return Array.prototype.concat.apply([], this); - } - }); + toString() { + return this.join(' '); + }, - List.extend = function (methods) { - methods = methods.reduce(function (obj, name) { - obj[name] = function () { - for (var _len2 = arguments.length, attrs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - attrs[_key2] = arguments[_key2]; - } + // Flattens the array if needed + valueOf() { + const ret = []; + ret.push(...this); + return ret; + }, - return this.each.apply(this, [name].concat(attrs)); - }; + // Parse whitespace separated string + parse(array = []) { + // If already is an array, no need to parse it + if (array instanceof Array) return array; + return array.trim().split(delimiter).map(parseFloat); + }, - return obj; - }, {}); - extend(List, methods); - }; - - function baseFind(query, parent) { - return new List(map((parent || globals.document).querySelectorAll(query), function (node) { - return adopt(node); - })); - } // Scoped find method + clone() { + return new this.constructor(this); + }, - function find(query) { - return baseFind(query, this.node); + toSet() { + return new Set(this); } - var EventTarget = - /*#__PURE__*/ - function (_Base) { - _inherits(EventTarget, _Base); +}); - function EventTarget() { - var _this; +class SVGNumber { + // Initialize + constructor(...args) { + this.init(...args); + } - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$events = _ref.events, - events = _ref$events === void 0 ? {} : _ref$events; + init(value, unit) { + unit = Array.isArray(value) ? value[1] : unit; + value = Array.isArray(value) ? value[0] : value; // initialize defaults - _classCallCheck(this, EventTarget); + this.value = 0; + this.unit = unit || ''; // parse value - _this = _possibleConstructorReturn(this, _getPrototypeOf(EventTarget).call(this)); - _this.events = events; - return _this; - } + if (typeof value === 'number') { + // ensure a valid numeric value + this.value = isNaN(value) ? 0 : !isFinite(value) ? value < 0 ? -3.4e+38 : +3.4e+38 : value; + } else if (typeof value === 'string') { + unit = value.match(numberAndUnit); - _createClass(EventTarget, [{ - key: "addEventListener", - value: function addEventListener() {} - }, { - key: "dispatch", - value: function dispatch$$1(event, data) { - return dispatch(this, event, data); - } - }, { - key: "dispatchEvent", - value: function dispatchEvent(event) { - var bag = this.getEventHolder().events; - if (!bag) return true; - var events = bag[event.type]; - - for (var i in events) { - for (var j in events[i]) { - events[i][j](event); - } - } + if (unit) { + // make value numeric + this.value = parseFloat(unit[1]); // normalize - return !event.defaultPrevented; - } // Fire given event + if (unit[5] === '%') { + this.value /= 100; + } else if (unit[5] === 's') { + this.value *= 1000; + } // store unit - }, { - key: "fire", - value: function fire(event, data) { - this.dispatch(event, data); - return this; - } - }, { - key: "getEventHolder", - value: function getEventHolder() { - return this; + + this.unit = unit[5]; } - }, { - key: "getEventTarget", - value: function getEventTarget() { - return this; - } // Unbind event from listener - - }, { - key: "off", - value: function off$$1(event, listener) { - off(this, event, listener); - - return this; - } // Bind given event to listener - - }, { - key: "on", - value: function on$$1(event, listener, binding, options) { - on(this, event, listener, binding, options); - - return this; + } else { + if (value instanceof SVGNumber) { + this.value = value.valueOf(); + this.unit = value.unit; } - }, { - key: "removeEventListener", - value: function removeEventListener() {} - }]); + } - return EventTarget; - }(Base); + return this; + } - function noop() {} // Default animation values + toString() { + return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 : this.unit === 's' ? this.value / 1e3 : this.value) + this.unit; + } - var timeline = { - duration: 400, - ease: '>', - delay: 0 // Default attribute values + toJSON() { + return this.toString(); + } - }; - var attrs = { - // fill and stroke - 'fill-opacity': 1, - 'stroke-opacity': 1, - 'stroke-width': 0, - 'stroke-linejoin': 'miter', - 'stroke-linecap': 'butt', - fill: '#000000', - stroke: '#000000', - opacity: 1, - // position - x: 0, - y: 0, - cx: 0, - cy: 0, - // size - width: 0, - height: 0, - // radius - r: 0, - rx: 0, - ry: 0, - // gradient - offset: 0, - 'stop-opacity': 1, - 'stop-color': '#000000', - // text - 'font-size': 16, - 'font-family': 'Helvetica, Arial, sans-serif', - 'text-anchor': 'start' - }; + toArray() { + return [this.value, this.unit]; + } - var defaults = /*#__PURE__*/Object.freeze({ - noop: noop, - timeline: timeline, - attrs: attrs - }); + valueOf() { + return this.value; + } // Add number - var SVGArray = subClassArray('SVGArray', Array, function (arr) { - this.init(arr); - }); - extend(SVGArray, { - init: function init(arr) { - // This catches the case, that native map tries to create an array with new Array(1) - if (typeof arr === 'number') return this; - this.length = 0; - this.push.apply(this, _toConsumableArray(this.parse(arr))); - return this; - }, - toArray: function toArray() { - return Array.prototype.concat.apply([], this); - }, - toString: function toString() { - return this.join(' '); - }, - // Flattens the array if needed - valueOf: function valueOf() { - var ret = []; - ret.push.apply(ret, _toConsumableArray(this)); - return ret; - }, - // Parse whitespace separated string - parse: function parse() { - var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - // If already is an array, no need to parse it - if (array instanceof Array) return array; - return array.trim().split(delimiter).map(parseFloat); - }, - clone: function clone() { - return new this.constructor(this); - }, - toSet: function toSet() { - return new Set(this); + + plus(number) { + number = new SVGNumber(number); + return new SVGNumber(this + number, this.unit || number.unit); + } // Subtract number + + + minus(number) { + number = new SVGNumber(number); + return new SVGNumber(this - number, this.unit || number.unit); + } // Multiply number + + + times(number) { + number = new SVGNumber(number); + return new SVGNumber(this * number, this.unit || number.unit); + } // Divide number + + + divide(number) { + number = new SVGNumber(number); + return new SVGNumber(this / number, this.unit || number.unit); + } + +} + +const hooks = []; +function registerAttrHook(fn) { + hooks.push(fn); +} // Set svg element attribute + +function attr(attr, val, ns) { + // act as full getter + if (attr == null) { + // get an object of attributes + attr = {}; + val = this.node.attributes; + + for (let node of val) { + attr[node.nodeName] = isNumber.test(node.nodeValue) ? parseFloat(node.nodeValue) : node.nodeValue; } - }); - var SVGNumber = - /*#__PURE__*/ - function () { - // Initialize - function SVGNumber() { - _classCallCheck(this, SVGNumber); + return attr; + } else if (attr instanceof Array) { + // loop through array and get all values + return attr.reduce((last, curr) => { + last[curr] = this.attr(curr); + return last; + }, {}); + } else if (typeof attr === 'object') { + // apply every attribute individually if an object is passed + for (val in attr) this.attr(val, attr[val]); + } else if (val === null) { + // remove value + this.node.removeAttribute(attr); + } else if (val == null) { + // act as a getter if the first and only argument is not an object + val = this.node.getAttribute(attr); + return val == null ? attrs[attr] : isNumber.test(val) ? parseFloat(val) : val; + } else { + // Loop through hooks and execute them to convert value + val = hooks.reduce((_val, hook) => { + return hook(attr, _val, this); + }, val); // ensure correct numeric values (also accepts NaN and Infinity) + + if (typeof val === 'number') { + val = new SVGNumber(val); + } else if (Color.isColor(val)) { + // ensure full hex color + val = new Color(val); + } else if (val.constructor === Array) { + // Check for plain arrays and parse array values + val = new SVGArray(val); + } // if the passed attribute is leading... + + + if (attr === 'leading') { + // ... call the leading method instead + if (this.leading) { + this.leading(val); + } + } else { + // set given attribute on node + typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString()) : this.node.setAttribute(attr, val.toString()); + } // rebuild if required + - this.init.apply(this, arguments); + if (this.rebuild && (attr === 'font-size' || attr === 'x')) { + this.rebuild(); } + } - _createClass(SVGNumber, [{ - key: "init", - value: function init(value, unit) { - unit = Array.isArray(value) ? value[1] : unit; - value = Array.isArray(value) ? value[0] : value; // initialize defaults + return this; +} - this.value = 0; - this.unit = unit || ''; // parse value +class Dom extends EventTarget { + constructor(node, attrs) { + super(node); + this.node = node; + this.type = node.nodeName; - if (typeof value === 'number') { - // ensure a valid numeric value - this.value = isNaN(value) ? 0 : !isFinite(value) ? value < 0 ? -3.4e+38 : +3.4e+38 : value; - } else if (typeof value === 'string') { - unit = value.match(numberAndUnit); + if (attrs && node !== attrs) { + this.attr(attrs); + } + } // Add given element at a position - if (unit) { - // make value numeric - this.value = parseFloat(unit[1]); // normalize - if (unit[5] === '%') { - this.value /= 100; - } else if (unit[5] === 's') { - this.value *= 1000; - } // store unit + add(element, i) { + element = makeInstance(element); + if (i == null) { + this.node.appendChild(element.node); + } else if (element.node !== this.node.childNodes[i]) { + this.node.insertBefore(element.node, this.node.childNodes[i]); + } - this.unit = unit[5]; - } - } else { - if (value instanceof SVGNumber) { - this.value = value.valueOf(); - this.unit = value.unit; - } - } + return this; + } // Add element to given container and return self - return this; - } - }, { - key: "toString", - value: function toString() { - return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 : this.unit === 's' ? this.value / 1e3 : this.value) + this.unit; - } - }, { - key: "toJSON", - value: function toJSON() { - return this.toString(); - } - }, { - key: "toArray", - value: function toArray() { - return [this.value, this.unit]; - } - }, { - key: "valueOf", - value: function valueOf() { - return this.value; - } // Add number - - }, { - key: "plus", - value: function plus(number) { - number = new SVGNumber(number); - return new SVGNumber(this + number, this.unit || number.unit); - } // Subtract number - - }, { - key: "minus", - value: function minus(number) { - number = new SVGNumber(number); - return new SVGNumber(this - number, this.unit || number.unit); - } // Multiply number - - }, { - key: "times", - value: function times(number) { - number = new SVGNumber(number); - return new SVGNumber(this * number, this.unit || number.unit); - } // Divide number - - }, { - key: "divide", - value: function divide(number) { - number = new SVGNumber(number); - return new SVGNumber(this / number, this.unit || number.unit); - } - }]); - return SVGNumber; - }(); + addTo(parent) { + return makeInstance(parent).put(this); + } // Returns all child elements - var hooks = []; - function registerAttrHook(fn) { - hooks.push(fn); - } // Set svg element attribute - function attr(attr, val, ns) { - var _this = this; + children() { + return new List(map(this.node.children, function (node) { + return adopt(node); + })); + } // Remove all elements in this container - // act as full getter - if (attr == null) { - // get an object of attributes - attr = {}; - val = this.node.attributes; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = val[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var node = _step.value; - attr[node.nodeName] = isNumber.test(node.nodeValue) ? parseFloat(node.nodeValue) : node.nodeValue; - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - return attr; - } else if (attr instanceof Array) { - // loop through array and get all values - return attr.reduce(function (last, curr) { - last[curr] = _this.attr(curr); - return last; - }, {}); - } else if (_typeof(attr) === 'object') { - // apply every attribute individually if an object is passed - for (val in attr) { - this.attr(val, attr[val]); - } - } else if (val === null) { - // remove value - this.node.removeAttribute(attr); - } else if (val == null) { - // act as a getter if the first and only argument is not an object - val = this.node.getAttribute(attr); - return val == null ? attrs[attr] : isNumber.test(val) ? parseFloat(val) : val; - } else { - // Loop through hooks and execute them to convert value - val = hooks.reduce(function (_val, hook) { - return hook(attr, _val, _this); - }, val); // ensure correct numeric values (also accepts NaN and Infinity) - - if (typeof val === 'number') { - val = new SVGNumber(val); - } else if (Color.isColor(val)) { - // ensure full hex color - val = new Color(val); - } else if (val.constructor === Array) { - // Check for plain arrays and parse array values - val = new SVGArray(val); - } // if the passed attribute is leading... - - - if (attr === 'leading') { - // ... call the leading method instead - if (this.leading) { - this.leading(val); - } - } else { - // set given attribute on node - typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString()) : this.node.setAttribute(attr, val.toString()); - } // rebuild if required + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } // remove defs reference + + + delete this._defs; + return this; + } // Clone element + + + clone() { + // write dom data to the dom so the clone can pickup the data + this.writeDataToDom(); // clone element and assign new id + return assignNewId(this.node.cloneNode(true)); + } // Iterates over all children and invokes a given block - if (this.rebuild && (attr === 'font-size' || attr === 'x')) { - this.rebuild(); + + each(block, deep) { + var children = this.children(); + var i, il; + + for (i = 0, il = children.length; i < il; i++) { + block.apply(children[i], [i, children]); + + if (deep) { + children[i].each(block, deep); } } return this; } - var Dom = - /*#__PURE__*/ - function (_EventTarget) { - _inherits(Dom, _EventTarget); + element(nodeName) { + return this.put(new Dom(makeNode(nodeName))); + } // Get first child - function Dom(node, attrs) { - var _this2; - _classCallCheck(this, Dom); + first() { + return adopt(this.node.firstChild); + } // Get a element at the given index - _this2 = _possibleConstructorReturn(this, _getPrototypeOf(Dom).call(this, node)); - _this2.node = node; - _this2.type = node.nodeName; - if (attrs && node !== attrs) { - _this2.attr(attrs); - } - - return _this2; - } // Add given element at a position + get(i) { + return adopt(this.node.childNodes[i]); + } + getEventHolder() { + return this.node; + } - _createClass(Dom, [{ - key: "add", - value: function add(element, i) { - element = makeInstance(element); + getEventTarget() { + return this.node; + } // Checks if the given element is a child - if (i == null) { - this.node.appendChild(element.node); - } else if (element.node !== this.node.childNodes[i]) { - this.node.insertBefore(element.node, this.node.childNodes[i]); - } - return this; - } // Add element to given container and return self - - }, { - key: "addTo", - value: function addTo(parent) { - return makeInstance(parent).put(this); - } // Returns all child elements - - }, { - key: "children", - value: function children() { - return new List(map(this.node.children, function (node) { - return adopt(node); - })); - } // Remove all elements in this container - - }, { - key: "clear", - value: function clear() { - // remove children - while (this.node.hasChildNodes()) { - this.node.removeChild(this.node.lastChild); - } // remove defs reference - - - delete this._defs; - return this; - } // Clone element - - }, { - key: "clone", - value: function clone() { - // write dom data to the dom so the clone can pickup the data - this.writeDataToDom(); // clone element and assign new id - - return assignNewId(this.node.cloneNode(true)); - } // Iterates over all children and invokes a given block - - }, { - key: "each", - value: function each(block, deep) { - var children = this.children(); - var i, il; - - for (i = 0, il = children.length; i < il; i++) { - block.apply(children[i], [i, children]); - - if (deep) { - children[i].each(block, deep); - } - } + has(element) { + return this.index(element) >= 0; + } // Get / set id - return this; - } - }, { - key: "element", - value: function element(nodeName) { - return this.put(new Dom(makeNode(nodeName))); - } // Get first child - - }, { - key: "first", - value: function first() { - return adopt(this.node.firstChild); - } // Get a element at the given index - - }, { - key: "get", - value: function get(i) { - return adopt(this.node.childNodes[i]); - } - }, { - key: "getEventHolder", - value: function getEventHolder() { - return this.node; - } - }, { - key: "getEventTarget", - value: function getEventTarget() { - return this.node; - } // Checks if the given element is a child - - }, { - key: "has", - value: function has(element) { - return this.index(element) >= 0; - } // Get / set id - - }, { - key: "id", - value: function id(_id) { - // generate new id if no id set - if (typeof _id === 'undefined' && !this.node.id) { - this.node.id = eid(this.type); - } // dont't set directly width this.node.id to make `null` work correctly - - - return this.attr('id', _id); - } // Gets index of given element - - }, { - key: "index", - value: function index(element) { - return [].slice.call(this.node.childNodes).indexOf(element.node); - } // Get the last child - - }, { - key: "last", - value: function last() { - return adopt(this.node.lastChild); - } // matches the element vs a css selector - - }, { - key: "matches", - value: function matches(selector) { - var el = this.node; - return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector); - } // Returns the parent element instance - - }, { - key: "parent", - value: function parent(type) { - var parent = this; // check for parent - - if (!parent.node.parentNode) return null; // get parent element - - parent = adopt(parent.node.parentNode); - if (!type) return parent; // loop trough ancestors if type is given - - while (parent && parent.node instanceof globals.window.SVGElement) { - // FIXME: That shouldnt be neccessary - if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent; - parent = adopt(parent.node.parentNode); - } - } // Basically does the same as `add()` but returns the added element instead - - }, { - key: "put", - value: function put(element, i) { - this.add(element, i); - return element; - } // Add element to given container and return container - - }, { - key: "putIn", - value: function putIn(parent) { - return makeInstance(parent).add(this); - } // Remove element - - }, { - key: "remove", - value: function remove() { - if (this.parent()) { - this.parent().removeElement(this); - } - return this; - } // Remove a given child - - }, { - key: "removeElement", - value: function removeElement(element) { - this.node.removeChild(element.node); - return this; - } // Replace this with element - - }, { - key: "replace", - value: function replace(element) { - element = makeInstance(element); - this.node.parentNode.replaceChild(element.node, this.node); - return element; - } - }, { - key: "round", - value: function round() { - var precision = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2; - var map$$1 = arguments.length > 1 ? arguments[1] : undefined; - var factor = Math.pow(10, precision); - var attrs = this.attr(); // If we have no map, build one from attrs + id(id) { + // generate new id if no id set + if (typeof id === 'undefined' && !this.node.id) { + this.node.id = eid(this.type); + } // dont't set directly width this.node.id to make `null` work correctly - if (!map$$1) { - map$$1 = Object.keys(attrs); - } // Holds rounded attributes + return this.attr('id', id); + } // Gets index of given element - var newAttrs = {}; - map$$1.forEach(function (key) { - newAttrs[key] = Math.round(attrs[key] * factor) / factor; - }); - this.attr(newAttrs); - return this; - } // Return id on string conversion - }, { - key: "toString", - value: function toString() { - return this.id(); - } // Import raw svg + index(element) { + return [].slice.call(this.node.childNodes).indexOf(element.node); + } // Get the last child - }, { - key: "svg", - value: function svg(svgOrFn, outerHTML) { - var well, len, fragment; - if (svgOrFn === false) { - outerHTML = false; - svgOrFn = null; - } // act as getter if no svg string is given + last() { + return adopt(this.node.lastChild); + } // matches the element vs a css selector - if (svgOrFn == null || typeof svgOrFn === 'function') { - // The default for exports is, that the outerNode is included - outerHTML = outerHTML == null ? true : outerHTML; // write svgjs data to the dom + matches(selector) { + const el = this.node; + return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector); + } // Returns the parent element instance - this.writeDataToDom(); - var current = this; // An export modifier was passed - if (svgOrFn != null) { - current = adopt(current.node.cloneNode(true)); // If the user wants outerHTML we need to process this node, too + parent(type) { + var parent = this; // check for parent - if (outerHTML) { - var result = svgOrFn(current); - current = result || current; // The user does not want this node? Well, then he gets nothing + if (!parent.node.parentNode) return null; // get parent element - if (result === false) return ''; - } // Deep loop through all children and apply modifier + parent = adopt(parent.node.parentNode); + if (!type) return parent; // loop trough ancestors if type is given + while (parent && parent.node instanceof globals.window.SVGElement) { + // FIXME: That shouldnt be neccessary + if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent; + parent = adopt(parent.node.parentNode); + } + } // Basically does the same as `add()` but returns the added element instead - current.each(function () { - var result = svgOrFn(this); - var _this = result || this; // If modifier returns false, discard node + put(element, i) { + this.add(element, i); + return element; + } // Add element to given container and return container - if (result === false) { - this.remove(); // If modifier returns new node, use it - } else if (result && this !== _this) { - this.replace(_this); - } - }, true); - } // Return outer or inner content + putIn(parent) { + return makeInstance(parent).add(this); + } // Remove element - return outerHTML ? current.node.outerHTML : current.node.innerHTML; - } // Act as setter if we got a string - // The default for import is, that the current node is not replaced + remove() { + if (this.parent()) { + this.parent().removeElement(this); + } + return this; + } // Remove a given child - outerHTML = outerHTML == null ? false : outerHTML; // Create temporary holder - well = globals.document.createElementNS(ns, 'svg'); - fragment = globals.document.createDocumentFragment(); // Dump raw svg + removeElement(element) { + this.node.removeChild(element.node); + return this; + } // Replace this with element - well.innerHTML = svgOrFn; // Transplant nodes into the fragment - for (len = well.children.length; len--;) { - fragment.appendChild(well.firstElementChild); - } + replace(element) { + element = makeInstance(element); + this.node.parentNode.replaceChild(element.node, this.node); + return element; + } - var parent = this.parent(); // Add the whole fragment at once + round(precision = 2, map$$1) { + const factor = 10 ** precision; + const attrs = this.attr(); // If we have no map, build one from attrs - return outerHTML ? this.replace(fragment) && parent : this.add(fragment); - } - }, { - key: "words", - value: function words(text) { - // This is faster than removing all children and adding a new one - this.node.textContent = text; - return this; - } // write svgjs data to the dom - - }, { - key: "writeDataToDom", - value: function writeDataToDom() { - // dump variables recursively - this.each(function () { - this.writeDataToDom(); - }); - return this; - } - }]); + if (!map$$1) { + map$$1 = Object.keys(attrs); + } // Holds rounded attributes - return Dom; - }(EventTarget); - extend(Dom, { - attr: attr, - find: find - }); - register(Dom); - var Svg = getClass(root); + const newAttrs = {}; + map$$1.forEach(key => { + newAttrs[key] = Math.round(attrs[key] * factor) / factor; + }); + this.attr(newAttrs); + return this; + } // Return id on string conversion - var Element = - /*#__PURE__*/ - function (_Dom) { - _inherits(Element, _Dom); - function Element(node, attrs) { - var _this; + toString() { + return this.id(); + } // Import raw svg - _classCallCheck(this, Element); - _this = _possibleConstructorReturn(this, _getPrototypeOf(Element).call(this, node, attrs)); // initialize data object + svg(svgOrFn, outerHTML) { + var well, len, fragment; - _this.dom = {}; // create circular reference + if (svgOrFn === false) { + outerHTML = false; + svgOrFn = null; + } // act as getter if no svg string is given - _this.node.instance = _assertThisInitialized(_assertThisInitialized(_this)); - if (node.hasAttribute('svgjs:data')) { - // pull svgjs data from the dom (getAttributeNS doesn't work in html5) - _this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {}); - } + if (svgOrFn == null || typeof svgOrFn === 'function') { + // The default for exports is, that the outerNode is included + outerHTML = outerHTML == null ? true : outerHTML; // write svgjs data to the dom - return _this; - } // Move element by its center - - - _createClass(Element, [{ - key: "center", - value: function center(x, y) { - return this.cx(x).cy(y); - } // Move by center over x-axis - - }, { - key: "cx", - value: function cx(x) { - return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2); - } // Move by center over y-axis - - }, { - key: "cy", - value: function cy(y) { - return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2); - } // Get defs - - }, { - key: "defs", - value: function defs() { - return this.root().defs(); - } // Get parent document - - }, { - key: "root", - value: function root$$1() { - var p = this.parent(Svg); - return p && p.root(); - } - }, { - key: "getEventHolder", - value: function getEventHolder() { - return this; - } // Set height of element - - }, { - key: "height", - value: function height(_height) { - return this.attr('height', _height); - } // Checks whether the given point inside the bounding box of the element - - }, { - key: "inside", - value: function inside(x, y) { - var box = this.bbox(); - return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height; - } // Move element to given x and y values - - }, { - key: "move", - value: function move(x, y) { - return this.x(x).y(y); - } // return array of all ancestors of given type up to the root svg - - }, { - key: "parents", - value: function parents() { - var until = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globals.document; - until = makeInstance(until); - var parents = new List(); - var parent = this; - - while ((parent = parent.parent()) && parent.node !== until.node && parent.node !== globals.document) { - parents.push(parent); - } + this.writeDataToDom(); + let current = this; // An export modifier was passed - return parents; - } // Get referenced element form attribute value - - }, { - key: "reference", - value: function reference$$1(attr) { - attr = this.attr(attr); - if (!attr) return null; - var m = attr.match(reference); - return m ? makeInstance(m[1]) : null; - } // set given data to the elements data property - - }, { - key: "setData", - value: function setData(o) { - this.dom = o; - return this; - } // Set element size to given width and height - - }, { - key: "size", - value: function size(width, height) { - var p = proportionalSize(this, width, height); - return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height)); - } // Set width of element - - }, { - key: "width", - value: function width(_width) { - return this.attr('width', _width); - } // write svgjs data to the dom - - }, { - key: "writeDataToDom", - value: function writeDataToDom() { - // remove previously set data - this.node.removeAttribute('svgjs:data'); - - if (Object.keys(this.dom).length) { - this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428 - } + if (svgOrFn != null) { + current = adopt(current.node.cloneNode(true)); // If the user wants outerHTML we need to process this node, too - return _get(_getPrototypeOf(Element.prototype), "writeDataToDom", this).call(this); - } // Move over x-axis + if (outerHTML) { + let result = svgOrFn(current); + current = result || current; // The user does not want this node? Well, then he gets nothing - }, { - key: "x", - value: function x(_x) { - return this.attr('x', _x); - } // Move over y-axis + if (result === false) return ''; + } // Deep loop through all children and apply modifier - }, { - key: "y", - value: function y(_y) { - return this.attr('y', _y); - } - }]); - - return Element; - }(Dom); - extend(Element, { - bbox: bbox, - rbox: rbox, - point: point, - ctm: ctm, - screenCTM: screenCTM - }); - register(Element); - var sugar = { - stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'], - fill: ['color', 'opacity', 'rule'], - prefix: function prefix(t, a) { - return a === 'color' ? t : t + '-' + a; - } // Add sugar for fill and stroke + current.each(function () { + let result = svgOrFn(this); - }; - ['fill', 'stroke'].forEach(function (m) { - var extension = {}; - var i; + let _this = result || this; // If modifier returns false, discard node - extension[m] = function (o) { - if (typeof o === 'undefined') { - return this.attr(m); - } - if (typeof o === 'string' || Color.isRgb(o) || o instanceof Element) { - this.attr(m, o); - } else { - // set all attributes from sugar.fill and sugar.stroke list - for (i = sugar[m].length - 1; i >= 0; i--) { - if (o[sugar[m][i]] != null) { - this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]); + if (result === false) { + this.remove(); // If modifier returns new node, use it + } else if (result && this !== _this) { + this.replace(_this); } - } - } + }, true); + } // Return outer or inner content - return this; - }; - registerMethods(['Shape', 'Runner'], extension); - }); - registerMethods(['Element', 'Runner'], { - // Let the user set the matrix directly - matrix: function matrix(mat, b, c, d, e, f) { - // Act as a getter - if (mat == null) { - return new Matrix(this); - } // Act as a setter, the user can pass a matrix or a set of numbers + return outerHTML ? current.node.outerHTML : current.node.innerHTML; + } // Act as setter if we got a string + // The default for import is, that the current node is not replaced - return this.attr('transform', new Matrix(mat, b, c, d, e, f)); - }, - // Map rotation to transform - rotate: function rotate(angle, cx, cy) { - return this.transform({ - rotate: angle, - ox: cx, - oy: cy - }, true); - }, - // Map skew to transform - skew: function skew(x, y, cx, cy) { - return arguments.length === 1 || arguments.length === 3 ? this.transform({ - skew: x, - ox: y, - oy: cx - }, true) : this.transform({ - skew: [x, y], - ox: cx, - oy: cy - }, true); - }, - shear: function shear(lam, cx, cy) { - return this.transform({ - shear: lam, - ox: cx, - oy: cy - }, true); - }, - // Map scale to transform - scale: function scale(x, y, cx, cy) { - return arguments.length === 1 || arguments.length === 3 ? this.transform({ - scale: x, - ox: y, - oy: cx - }, true) : this.transform({ - scale: [x, y], - ox: cx, - oy: cy - }, true); - }, - // Map translate to transform - translate: function translate(x, y) { - return this.transform({ - translate: [x, y] - }, true); - }, - // Map relative translations to transform - relative: function relative(x, y) { - return this.transform({ - relative: [x, y] - }, true); - }, - // Map flip to transform - flip: function flip(direction, around) { - var directionString = typeof direction === 'string' ? direction : isFinite(direction) ? 'both' : 'both'; - var origin = direction === 'both' && isFinite(around) ? [around, around] : direction === 'x' ? [around, 0] : direction === 'y' ? [0, around] : isFinite(direction) ? [direction, direction] : [0, 0]; - this.transform({ - flip: directionString, - origin: origin - }, true); - }, - // Opacity - opacity: function opacity(value) { - return this.attr('opacity', value); - }, - // Relative move over x and y axes - dmove: function dmove(x, y) { - return this.dx(x).dy(y); - } - }); - registerMethods('Element', { - // Relative move over x axis - dx: function dx(x) { - return this.x(new SVGNumber(x).plus(this.x())); - }, - // Relative move over y axis - dy: function dy(y) { - return this.y(new SVGNumber(y).plus(this.y())); - } - }); - registerMethods('radius', { - // Add x and y radius - radius: function radius(x, y) { - var type = (this._element || this).type; - return type === 'radialGradient' || type === 'radialGradient' ? this.attr('r', new SVGNumber(x)) : this.rx(x).ry(y == null ? x : y); - } - }); - registerMethods('Path', { - // Get path length - length: function length() { - return this.node.getTotalLength(); - }, - // Get point at length - pointAt: function pointAt(length) { - return new Point(this.node.getPointAtLength(length)); - } - }); - registerMethods(['Element', 'Runner'], { - // Set font - font: function font(a, v) { - if (_typeof(a) === 'object') { - for (v in a) { - this.font(v, a[v]); - } - } + outerHTML = outerHTML == null ? false : outerHTML; // Create temporary holder - return a === 'leading' ? this.leading(v) : a === 'anchor' ? this.attr('text-anchor', v) : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style' ? this.attr('font-' + a, v) : this.attr(a, v); - } - }); - registerMethods('Text', { - ax: function ax(x) { - return this.attr('x', x); - }, - ay: function ay(y) { - return this.attr('y', y); - }, - amove: function amove(x, y) { - return this.ax(x).ay(y); - } - }); // Add events to elements + well = globals.document.createElementNS(ns, 'svg'); + fragment = globals.document.createDocumentFragment(); // Dump raw svg - var methods$1 = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'touchstart', 'touchmove', 'touchleave', 'touchend', 'touchcancel'].reduce(function (last, event) { - // add event to Element - var fn = function fn(f) { - if (f === null) { - off(this, event); - } else { - on(this, event, f); - } + well.innerHTML = svgOrFn; // Transplant nodes into the fragment - return this; - }; + for (len = well.children.length; len--;) { + fragment.appendChild(well.firstElementChild); + } - last[event] = fn; - return last; - }, {}); - registerMethods('Element', methods$1); - - function untransform() { - return this.attr('transform', null); - } // merge the whole transformation chain into one matrix and returns it - - function matrixify() { - var matrix = (this.attr('transform') || ''). // split transformations - split(transforms).slice(0, -1).map(function (str) { - // generate key => value pairs - var kv = str.trim().split('('); - return [kv[0], kv[1].split(delimiter).map(function (str) { - return parseFloat(str); - })]; - }).reverse() // merge every transformation into one matrix - .reduce(function (matrix, transform) { - if (transform[0] === 'matrix') { - return matrix.lmultiply(Matrix.fromArray(transform[1])); - } + let parent = this.parent(); // Add the whole fragment at once - return matrix[transform[0]].apply(matrix, transform[1]); - }, new Matrix()); - return matrix; - } // add an element to another parent without changing the visual representation on the screen + return outerHTML ? this.replace(fragment) && parent : this.add(fragment); + } - function toParent(parent) { - if (this === parent) return this; - var ctm$$1 = this.screenCTM(); - var pCtm = parent.screenCTM().inverse(); - this.addTo(parent).untransform().transform(pCtm.multiply(ctm$$1)); + words(text) { + // This is faster than removing all children and adding a new one + this.node.textContent = text; return this; - } // same as above with parent equals root-svg + } // write svgjs data to the dom - function toRoot() { - return this.toParent(this.root()); - } // Add transformations - function transform(o, relative) { - // Act as a getter if no object was passed - if (o == null || typeof o === 'string') { - var decomposed = new Matrix(this).decompose(); - return decomposed[o] || decomposed; - } + writeDataToDom() { + // dump variables recursively + this.each(function () { + this.writeDataToDom(); + }); + return this; + } - if (!Matrix.isMatrixLike(o)) { - // Set the origin according to the defined transform - o = _objectSpread({}, o, { - origin: getOrigin(o, this) - }); - } // The user can pass a boolean, an Element or an Matrix or nothing +} +extend(Dom, { + attr, + find +}); +register(Dom); +const Svg = getClass(root); +class Element extends Dom { + constructor(node, attrs) { + super(node, attrs); // initialize data object - var cleanRelative = relative === true ? this : relative || false; - var result = new Matrix(cleanRelative).transform(o); - return this.attr('transform', result); - } - registerMethods('Element', { - untransform: untransform, - matrixify: matrixify, - toParent: toParent, - toRoot: toRoot, - transform: transform - }); + this.dom = {}; // create circular reference - function rx(rx) { - return this.attr('rx', rx); - } // Radius y value + this.node.instance = this; - function ry(ry) { - return this.attr('ry', ry); - } // Move over x-axis + if (node.hasAttribute('svgjs:data')) { + // pull svgjs data from the dom (getAttributeNS doesn't work in html5) + this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {}); + } + } // Move element by its center - function x(x) { - return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()); - } // Move over y-axis - function y(y) { - return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()); + center(x, y) { + return this.cx(x).cy(y); } // Move by center over x-axis - function cx(x) { - return x == null ? this.attr('cx') : this.attr('cx', x); + + cx(x) { + return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2); } // Move by center over y-axis - function cy(y) { - return y == null ? this.attr('cy') : this.attr('cy', y); - } // Set width of element - function width(width) { - return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2)); - } // Set height of element + cy(y) { + return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2); + } // Get defs + + + defs() { + return this.root().defs(); + } // Get parent document + - function height(height) { - return height == null ? this.ry() * 2 : this.ry(new SVGNumber(height).divide(2)); + root() { + let p = this.parent(Svg); + return p && p.root(); } - var circled = /*#__PURE__*/Object.freeze({ - rx: rx, - ry: ry, - x: x, - y: y, - cx: cx, - cy: cy, - width: width, - height: height - }); + getEventHolder() { + return this; + } // Set height of element - var Shape = - /*#__PURE__*/ - function (_Element) { - _inherits(Shape, _Element); - function Shape() { - _classCallCheck(this, Shape); + height(height) { + return this.attr('height', height); + } // Checks whether the given point inside the bounding box of the element - return _possibleConstructorReturn(this, _getPrototypeOf(Shape).apply(this, arguments)); - } - return Shape; - }(Element); - register(Shape); + inside(x, y) { + let box = this.bbox(); + return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height; + } // Move element to given x and y values - var Circle = - /*#__PURE__*/ - function (_Shape) { - _inherits(Circle, _Shape); - function Circle(node) { - _classCallCheck(this, Circle); + move(x, y) { + return this.x(x).y(y); + } // return array of all ancestors of given type up to the root svg - return _possibleConstructorReturn(this, _getPrototypeOf(Circle).call(this, nodeOrNew('circle', node), node)); - } - _createClass(Circle, [{ - key: "radius", - value: function radius(r) { - return this.attr('r', r); - } // Radius x value - - }, { - key: "rx", - value: function rx$$1(_rx) { - return this.attr('r', _rx); - } // Alias radius x value - - }, { - key: "ry", - value: function ry$$1(_ry) { - return this.rx(_ry); - } - }, { - key: "size", - value: function size(_size) { - return this.radius(new SVGNumber(_size).divide(2)); - } - }]); - - return Circle; - }(Shape); - extend(Circle, { - x: x, - y: y, - cx: cx, - cy: cy, - width: width, - height: height - }); - registerMethods({ - Element: { - // Create circle element - circle: wrapWithAttrCheck(function (size) { - return this.put(new Circle()).size(size).move(0, 0); - }) + parents(until = globals.document) { + until = makeInstance(until); + let parents = new List(); + let parent = this; + + while ((parent = parent.parent()) && parent.node !== until.node && parent.node !== globals.document) { + parents.push(parent); } - }); - register(Circle); - var Container = - /*#__PURE__*/ - function (_Element) { - _inherits(Container, _Element); + return parents; + } // Get referenced element form attribute value + + + reference(attr) { + attr = this.attr(attr); + if (!attr) return null; + const m = attr.match(reference); + return m ? makeInstance(m[1]) : null; + } // set given data to the elements data property - function Container() { - _classCallCheck(this, Container); - return _possibleConstructorReturn(this, _getPrototypeOf(Container).apply(this, arguments)); + setData(o) { + this.dom = o; + return this; + } // Set element size to given width and height + + + size(width, height) { + let p = proportionalSize(this, width, height); + return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height)); + } // Set width of element + + + width(width) { + return this.attr('width', width); + } // write svgjs data to the dom + + + writeDataToDom() { + // remove previously set data + this.node.removeAttribute('svgjs:data'); + + if (Object.keys(this.dom).length) { + this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428 } - _createClass(Container, [{ - key: "flatten", - value: function flatten(parent) { - this.each(function () { - if (this instanceof Container) return this.flatten(parent).ungroup(parent); - return this.toParent(parent); - }); // we need this so that the root does not get removed + return super.writeDataToDom(); + } // Move over x-axis - this.node.firstElementChild || this.remove(); - return this; - } - }, { - key: "ungroup", - value: function ungroup(parent) { - parent = parent || this.parent(); - this.each(function () { - return this.toParent(parent); - }); - this.remove(); - return this; - } - }]); - return Container; - }(Element); - register(Container); + x(x) { + return this.attr('x', x); + } // Move over y-axis - var Defs = - /*#__PURE__*/ - function (_Container) { - _inherits(Defs, _Container); - function Defs(node) { - _classCallCheck(this, Defs); + y(y) { + return this.attr('y', y); + } - return _possibleConstructorReturn(this, _getPrototypeOf(Defs).call(this, nodeOrNew('defs', node), node)); +} +extend(Element, { + bbox, + rbox, + point, + ctm, + screenCTM +}); +register(Element); + +var sugar = { + stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'], + fill: ['color', 'opacity', 'rule'], + prefix: function prefix(t, a) { + return a === 'color' ? t : t + '-' + a; + } // Add sugar for fill and stroke + +}; +['fill', 'stroke'].forEach(function (m) { + var extension = {}; + var i; + + extension[m] = function (o) { + if (typeof o === 'undefined') { + return this.attr(m); } - _createClass(Defs, [{ - key: "flatten", - value: function flatten() { - return this; - } - }, { - key: "ungroup", - value: function ungroup() { - return this; + if (typeof o === 'string' || Color.isRgb(o) || o instanceof Element) { + this.attr(m, o); + } else { + // set all attributes from sugar.fill and sugar.stroke list + for (i = sugar[m].length - 1; i >= 0; i--) { + if (o[sugar[m][i]] != null) { + this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]); + } } - }]); + } + + return this; + }; - return Defs; - }(Container); - register(Defs); + registerMethods(['Shape', 'Runner'], extension); +}); +registerMethods(['Element', 'Runner'], { + // Let the user set the matrix directly + matrix: function matrix(mat, b, c, d, e, f) { + // Act as a getter + if (mat == null) { + return new Matrix(this); + } // Act as a setter, the user can pass a matrix or a set of numbers + + + return this.attr('transform', new Matrix(mat, b, c, d, e, f)); + }, + // Map rotation to transform + rotate: function rotate(angle, cx, cy) { + return this.transform({ + rotate: angle, + ox: cx, + oy: cy + }, true); + }, + // Map skew to transform + skew: function skew(x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + skew: x, + ox: y, + oy: cx + }, true) : this.transform({ + skew: [x, y], + ox: cx, + oy: cy + }, true); + }, + shear: function shear(lam, cx, cy) { + return this.transform({ + shear: lam, + ox: cx, + oy: cy + }, true); + }, + // Map scale to transform + scale: function scale(x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + scale: x, + ox: y, + oy: cx + }, true) : this.transform({ + scale: [x, y], + ox: cx, + oy: cy + }, true); + }, + // Map translate to transform + translate: function translate(x, y) { + return this.transform({ + translate: [x, y] + }, true); + }, + // Map relative translations to transform + relative: function relative(x, y) { + return this.transform({ + relative: [x, y] + }, true); + }, + // Map flip to transform + flip: function flip(direction, around) { + var directionString = typeof direction === 'string' ? direction : isFinite(direction) ? 'both' : 'both'; + var origin = direction === 'both' && isFinite(around) ? [around, around] : direction === 'x' ? [around, 0] : direction === 'y' ? [0, around] : isFinite(direction) ? [direction, direction] : [0, 0]; + this.transform({ + flip: directionString, + origin: origin + }, true); + }, + // Opacity + opacity: function opacity(value) { + return this.attr('opacity', value); + }, + // Relative move over x and y axes + dmove: function dmove(x, y) { + return this.dx(x).dy(y); + } +}); +registerMethods('Element', { + // Relative move over x axis + dx: function dx(x) { + return this.x(new SVGNumber(x).plus(this.x())); + }, + // Relative move over y axis + dy: function dy(y) { + return this.y(new SVGNumber(y).plus(this.y())); + } +}); +registerMethods('radius', { + // Add x and y radius + radius: function radius(x, y) { + var type = (this._element || this).type; + return type === 'radialGradient' || type === 'radialGradient' ? this.attr('r', new SVGNumber(x)) : this.rx(x).ry(y == null ? x : y); + } +}); +registerMethods('Path', { + // Get path length + length: function length() { + return this.node.getTotalLength(); + }, + // Get point at length + pointAt: function pointAt(length) { + return new Point(this.node.getPointAtLength(length)); + } +}); +registerMethods(['Element', 'Runner'], { + // Set font + font: function font(a, v) { + if (typeof a === 'object') { + for (v in a) this.font(v, a[v]); + } - var Ellipse = - /*#__PURE__*/ - function (_Shape) { - _inherits(Ellipse, _Shape); + return a === 'leading' ? this.leading(v) : a === 'anchor' ? this.attr('text-anchor', v) : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style' ? this.attr('font-' + a, v) : this.attr(a, v); + } +}); +registerMethods('Text', { + ax(x) { + return this.attr('x', x); + }, + + ay(y) { + return this.attr('y', y); + }, + + amove(x, y) { + return this.ax(x).ay(y); + } - function Ellipse(node) { - _classCallCheck(this, Ellipse); +}); // Add events to elements - return _possibleConstructorReturn(this, _getPrototypeOf(Ellipse).call(this, nodeOrNew('ellipse', node), node)); +const methods$1 = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'touchstart', 'touchmove', 'touchleave', 'touchend', 'touchcancel'].reduce(function (last, event) { + // add event to Element + const fn = function fn(f) { + if (f === null) { + off(this, event); + } else { + on(this, event, f); } - _createClass(Ellipse, [{ - key: "size", - value: function size(width$$1, height$$1) { - var p = proportionalSize(this, width$$1, height$$1); - return this.rx(new SVGNumber(p.width).divide(2)).ry(new SVGNumber(p.height).divide(2)); - } - }]); - - return Ellipse; - }(Shape); - extend(Ellipse, circled); - registerMethods('Container', { - // Create an ellipse - ellipse: wrapWithAttrCheck(function (width$$1, height$$1) { - return this.put(new Ellipse()).size(width$$1, height$$1).move(0, 0); - }) - }); - register(Ellipse); + return this; + }; - var Stop = - /*#__PURE__*/ - function (_Element) { - _inherits(Stop, _Element); + last[event] = fn; + return last; +}, {}); +registerMethods('Element', methods$1); + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } - function Stop(node) { - _classCallCheck(this, Stop); + return obj; +} - return _possibleConstructorReturn(this, _getPrototypeOf(Stop).call(this, nodeOrNew('stop', node), node)); - } // add color stops +function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } - _createClass(Stop, [{ - key: "update", - value: function update(o) { - if (typeof o === 'number' || o instanceof SVGNumber) { - o = { - offset: arguments[0], - color: arguments[1], - opacity: arguments[2] - }; - } // set attributes + ownKeys.forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } + return target; +} + +function untransform() { + return this.attr('transform', null); +} // merge the whole transformation chain into one matrix and returns it + +function matrixify() { + var matrix = (this.attr('transform') || ''). // split transformations + split(transforms).slice(0, -1).map(function (str) { + // generate key => value pairs + var kv = str.trim().split('('); + return [kv[0], kv[1].split(delimiter).map(function (str) { + return parseFloat(str); + })]; + }).reverse() // merge every transformation into one matrix + .reduce(function (matrix, transform) { + if (transform[0] === 'matrix') { + return matrix.lmultiply(Matrix.fromArray(transform[1])); + } - if (o.opacity != null) this.attr('stop-opacity', o.opacity); - if (o.color != null) this.attr('stop-color', o.color); - if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); - return this; - } - }]); - - return Stop; - }(Element); - register(Stop); - - function from(x, y) { - return (this._element || this).type === 'radialGradient' ? this.attr({ - fx: new SVGNumber(x), - fy: new SVGNumber(y) - }) : this.attr({ - x1: new SVGNumber(x), - y1: new SVGNumber(y) + return matrix[transform[0]].apply(matrix, transform[1]); + }, new Matrix()); + return matrix; +} // add an element to another parent without changing the visual representation on the screen + +function toParent(parent) { + if (this === parent) return this; + var ctm$$1 = this.screenCTM(); + var pCtm = parent.screenCTM().inverse(); + this.addTo(parent).untransform().transform(pCtm.multiply(ctm$$1)); + return this; +} // same as above with parent equals root-svg + +function toRoot() { + return this.toParent(this.root()); +} // Add transformations + +function transform(o, relative) { + // Act as a getter if no object was passed + if (o == null || typeof o === 'string') { + var decomposed = new Matrix(this).decompose(); + return decomposed[o] || decomposed; + } + + if (!Matrix.isMatrixLike(o)) { + // Set the origin according to the defined transform + o = _objectSpread({}, o, { + origin: getOrigin(o, this) }); + } // The user can pass a boolean, an Element or an Matrix or nothing + + + var cleanRelative = relative === true ? this : relative || false; + var result = new Matrix(cleanRelative).transform(o); + return this.attr('transform', result); +} +registerMethods('Element', { + untransform, + matrixify, + toParent, + toRoot, + transform +}); + +function rx(rx) { + return this.attr('rx', rx); +} // Radius y value + +function ry(ry) { + return this.attr('ry', ry); +} // Move over x-axis + +function x(x) { + return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()); +} // Move over y-axis + +function y(y) { + return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()); +} // Move by center over x-axis + +function cx(x) { + return x == null ? this.attr('cx') : this.attr('cx', x); +} // Move by center over y-axis + +function cy(y) { + return y == null ? this.attr('cy') : this.attr('cy', y); +} // Set width of element + +function width(width) { + return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2)); +} // Set height of element + +function height(height) { + return height == null ? this.ry() * 2 : this.ry(new SVGNumber(height).divide(2)); +} + +var circled = /*#__PURE__*/Object.freeze({ + rx: rx, + ry: ry, + x: x, + y: y, + cx: cx, + cy: cy, + width: width, + height: height +}); + +class Shape extends Element {} +register(Shape); + +class Circle extends Shape { + constructor(node) { + super(nodeOrNew('circle', node), node); + } + + radius(r) { + return this.attr('r', r); + } // Radius x value + + + rx(rx$$1) { + return this.attr('r', rx$$1); + } // Alias radius x value + + + ry(ry$$1) { + return this.rx(ry$$1); + } + + size(size) { + return this.radius(new SVGNumber(size).divide(2)); + } + +} +extend(Circle, { + x, + y, + cx, + cy, + width, + height +}); +registerMethods({ + Element: { + // Create circle element + circle: wrapWithAttrCheck(function (size) { + return this.put(new Circle()).size(size).move(0, 0); + }) + } +}); +register(Circle); + +class Container extends Element { + flatten(parent) { + this.each(function () { + if (this instanceof Container) return this.flatten(parent).ungroup(parent); + return this.toParent(parent); + }); // we need this so that the root does not get removed + + this.node.firstElementChild || this.remove(); + return this; } - function to(x, y) { - return (this._element || this).type === 'radialGradient' ? this.attr({ - cx: new SVGNumber(x), - cy: new SVGNumber(y) - }) : this.attr({ - x2: new SVGNumber(x), - y2: new SVGNumber(y) + + ungroup(parent) { + parent = parent || this.parent(); + this.each(function () { + return this.toParent(parent); }); + this.remove(); + return this; } - var gradiented = /*#__PURE__*/Object.freeze({ - from: from, - to: to - }); +} +register(Container); + +class Defs extends Container { + constructor(node) { + super(nodeOrNew('defs', node), node); + } - var Gradient = - /*#__PURE__*/ - function (_Container) { - _inherits(Gradient, _Container); + flatten() { + return this; + } - function Gradient(type, attrs) { - _classCallCheck(this, Gradient); + ungroup() { + return this; + } - return _possibleConstructorReturn(this, _getPrototypeOf(Gradient).call(this, nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type), attrs)); - } // Add a color stop +} +register(Defs); +class Ellipse extends Shape { + constructor(node) { + super(nodeOrNew('ellipse', node), node); + } - _createClass(Gradient, [{ - key: "stop", - value: function stop(offset, color, opacity) { - return this.put(new Stop()).update(offset, color, opacity); - } // Update gradient + size(width$$1, height$$1) { + var p = proportionalSize(this, width$$1, height$$1); + return this.rx(new SVGNumber(p.width).divide(2)).ry(new SVGNumber(p.height).divide(2)); + } - }, { - key: "update", - value: function update(block) { - // remove all stops - this.clear(); // invoke passed block +} +extend(Ellipse, circled); +registerMethods('Container', { + // Create an ellipse + ellipse: wrapWithAttrCheck(function (width$$1, height$$1) { + return this.put(new Ellipse()).size(width$$1, height$$1).move(0, 0); + }) +}); +register(Ellipse); + +class Stop extends Element { + constructor(node) { + super(nodeOrNew('stop', node), node); + } // add color stops + + + update(o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }; + } // set attributes - if (typeof block === 'function') { - block.call(this, this); - } - return this; - } // Return the fill id - - }, { - key: "url", - value: function url() { - return 'url(#' + this.id() + ')'; - } // Alias string convertion to fill - - }, { - key: "toString", - value: function toString() { - return this.url(); - } // custom attr to handle transform - - }, { - key: "attr", - value: function attr(a, b, c) { - if (a === 'transform') a = 'gradientTransform'; - return _get(_getPrototypeOf(Gradient.prototype), "attr", this).call(this, a, b, c); - } - }, { - key: "targets", - value: function targets() { - return baseFind('svg [fill*="' + this.id() + '"]'); - } - }, { - key: "bbox", - value: function bbox$$1() { - return new Box(); - } - }]); - - return Gradient; - }(Container); - extend(Gradient, gradiented); - registerMethods({ - Container: { - // Create gradient element in defs - gradient: wrapWithAttrCheck(function (type, block) { - return this.defs().gradient(type, block); - }) - }, - // define gradient - Defs: { - gradient: wrapWithAttrCheck(function (type, block) { - return this.put(new Gradient(type)).update(block); - }) - } + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); + return this; + } + +} +register(Stop); + +function from(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + fx: new SVGNumber(x), + fy: new SVGNumber(y) + }) : this.attr({ + x1: new SVGNumber(x), + y1: new SVGNumber(y) }); - register(Gradient); +} +function to(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + cx: new SVGNumber(x), + cy: new SVGNumber(y) + }) : this.attr({ + x2: new SVGNumber(x), + y2: new SVGNumber(y) + }); +} - var Pattern = - /*#__PURE__*/ - function (_Container) { - _inherits(Pattern, _Container); +var gradiented = /*#__PURE__*/Object.freeze({ + from: from, + to: to +}); - // Initialize node - function Pattern(node) { - _classCallCheck(this, Pattern); +class Gradient extends Container { + constructor(type, attrs) { + super(nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type), attrs); + } // Add a color stop - return _possibleConstructorReturn(this, _getPrototypeOf(Pattern).call(this, nodeOrNew('pattern', node), node)); - } // Return the fill id + stop(offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity); + } // Update gradient - _createClass(Pattern, [{ - key: "url", - value: function url() { - return 'url(#' + this.id() + ')'; - } // Update pattern by rebuilding - }, { - key: "update", - value: function update(block) { - // remove content - this.clear(); // invoke passed block + update(block) { + // remove all stops + this.clear(); // invoke passed block - if (typeof block === 'function') { - block.call(this, this); - } + if (typeof block === 'function') { + block.call(this, this); + } - return this; - } // Alias string convertion to fill + return this; + } // Return the fill id - }, { - key: "toString", - value: function toString() { - return this.url(); - } // custom attr to handle transform - }, { - key: "attr", - value: function attr(a, b, c) { - if (a === 'transform') a = 'patternTransform'; - return _get(_getPrototypeOf(Pattern.prototype), "attr", this).call(this, a, b, c); - } - }, { - key: "targets", - value: function targets() { - return baseFind('svg [fill*="' + this.id() + '"]'); - } - }, { - key: "bbox", - value: function bbox$$1() { - return new Box(); - } - }]); + url() { + return 'url(#' + this.id() + ')'; + } // Alias string convertion to fill - return Pattern; - }(Container); - registerMethods({ - Container: { - // Create pattern element in defs - pattern: function pattern() { - var _this$defs; - return (_this$defs = this.defs()).pattern.apply(_this$defs, arguments); - } - }, - Defs: { - pattern: wrapWithAttrCheck(function (width, height, block) { - return this.put(new Pattern()).update(block).attr({ - x: 0, - y: 0, - width: width, - height: height, - patternUnits: 'userSpaceOnUse' - }); - }) - } - }); - register(Pattern); + toString() { + return this.url(); + } // custom attr to handle transform - var Image = - /*#__PURE__*/ - function (_Shape) { - _inherits(Image, _Shape); - function Image(node) { - _classCallCheck(this, Image); + attr(a, b, c) { + if (a === 'transform') a = 'gradientTransform'; + return super.attr(a, b, c); + } - return _possibleConstructorReturn(this, _getPrototypeOf(Image).call(this, nodeOrNew('image', node), node)); - } // (re)load image + targets() { + return baseFind('svg [fill*="' + this.id() + '"]'); + } + bbox() { + return new Box(); + } - _createClass(Image, [{ - key: "load", - value: function load(url, callback) { - if (!url) return this; - var img = new globals.window.Image(); - on(img, 'load', function (e) { - var p = this.parent(Pattern); // ensure image size +} +extend(Gradient, gradiented); +registerMethods({ + Container: { + // Create gradient element in defs + gradient: wrapWithAttrCheck(function (type, block) { + return this.defs().gradient(type, block); + }) + }, + // define gradient + Defs: { + gradient: wrapWithAttrCheck(function (type, block) { + return this.put(new Gradient(type)).update(block); + }) + } +}); +register(Gradient); - if (this.width() === 0 && this.height() === 0) { - this.size(img.width, img.height); - } +class Pattern extends Container { + // Initialize node + constructor(node) { + super(nodeOrNew('pattern', node), node); + } // Return the fill id - if (p instanceof Pattern) { - // ensure pattern size if not set - if (p.width() === 0 && p.height() === 0) { - p.size(this.width(), this.height()); - } - } - if (typeof callback === 'function') { - callback.call(this, e); - } - }, this); - on(img, 'load error', function () { - // dont forget to unbind memory leaking events - off(img); - }); - return this.attr('href', img.src = url, xlink); - } - }]); - - return Image; - }(Shape); - registerAttrHook(function (attr$$1, val, _this) { - // convert image fill and stroke to patterns - if (attr$$1 === 'fill' || attr$$1 === 'stroke') { - if (isImage.test(val)) { - val = _this.root().defs().image(val); - } - } + url() { + return 'url(#' + this.id() + ')'; + } // Update pattern by rebuilding - if (val instanceof Image) { - val = _this.root().defs().pattern(0, 0, function (pattern) { - pattern.add(val); - }); - } - return val; - }); - registerMethods({ - Container: { - // create image element, load image and set its size - image: wrapWithAttrCheck(function (source, callback) { - return this.put(new Image()).size(0, 0).load(source, callback); - }) + update(block) { + // remove content + this.clear(); // invoke passed block + + if (typeof block === 'function') { + block.call(this, this); } - }); - register(Image); - - var PointArray = subClassArray('PointArray', SVGArray); - extend(PointArray, { - // Convert array to string - toString: function toString() { - // convert to a poly point string - for (var i = 0, il = this.length, array = []; i < il; i++) { - array.push(this[i].join(',')); - } - return array.join(' '); - }, - // Convert array to line object - toLine: function toLine() { - return { - x1: this[0][0], - y1: this[0][1], - x2: this[1][0], - y2: this[1][1] - }; - }, - // Get morphed array at given position - at: function at(pos) { - // make sure a destination is defined - if (!this.destination) return this; // generate morphed point string + return this; + } // Alias string convertion to fill - for (var i = 0, il = this.length, array = []; i < il; i++) { - array.push([this[i][0] + (this.destination[i][0] - this[i][0]) * pos, this[i][1] + (this.destination[i][1] - this[i][1]) * pos]); - } - return new PointArray(array); - }, - // Parse point string and flat array - parse: function parse() { - var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [[0, 0]]; - var points = []; // if it is an array - - if (array instanceof Array) { - // and it is not flat, there is no need to parse it - if (array[0] instanceof Array) { - return array; - } - } else { - // Else, it is considered as a string - // parse points - array = array.trim().split(delimiter).map(parseFloat); - } // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints - // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + toString() { + return this.url(); + } // custom attr to handle transform - if (array.length % 2 !== 0) array.pop(); // wrap points in two-tuples and parse points as floats + attr(a, b, c) { + if (a === 'transform') a = 'patternTransform'; + return super.attr(a, b, c); + } - for (var i = 0, len = array.length; i < len; i = i + 2) { - points.push([array[i], array[i + 1]]); - } + targets() { + return baseFind('svg [fill*="' + this.id() + '"]'); + } + + bbox() { + return new Box(); + } + +} +registerMethods({ + Container: { + // Create pattern element in defs + pattern(...args) { + return this.defs().pattern(...args); + } + + }, + Defs: { + pattern: wrapWithAttrCheck(function (width, height, block) { + return this.put(new Pattern()).update(block).attr({ + x: 0, + y: 0, + width: width, + height: height, + patternUnits: 'userSpaceOnUse' + }); + }) + } +}); +register(Pattern); + +class Image extends Shape { + constructor(node) { + super(nodeOrNew('image', node), node); + } // (re)load image - return points; - }, - // Move point string - move: function move(x, y) { - var box = this.bbox(); // get relative offset - x -= box.x; - y -= box.y; // move every point + load(url, callback) { + if (!url) return this; + var img = new globals.window.Image(); + on(img, 'load', function (e) { + var p = this.parent(Pattern); // ensure image size - if (!isNaN(x) && !isNaN(y)) { - for (var i = this.length - 1; i >= 0; i--) { - this[i] = [this[i][0] + x, this[i][1] + y]; + if (this.width() === 0 && this.height() === 0) { + this.size(img.width, img.height); + } + + if (p instanceof Pattern) { + // ensure pattern size if not set + if (p.width() === 0 && p.height() === 0) { + p.size(this.width(), this.height()); } } - return this; - }, - // Resize poly string - size: function size(width, height) { - var i; - var box = this.bbox(); // recalculate position of all points according to new size - - for (i = this.length - 1; i >= 0; i--) { - if (box.width) this[i][0] = (this[i][0] - box.x) * width / box.width + box.x; - if (box.height) this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + if (typeof callback === 'function') { + callback.call(this, e); } + }, this); + on(img, 'load error', function () { + // dont forget to unbind memory leaking events + off(img); + }); + return this.attr('href', img.src = url, xlink); + } - return this; - }, - // Get bounding box of points - bbox: function bbox() { - var maxX = -Infinity; - var maxY = -Infinity; - var minX = Infinity; - var minY = Infinity; - this.forEach(function (el) { - maxX = Math.max(el[0], maxX); - maxY = Math.max(el[1], maxY); - minX = Math.min(el[0], minX); - minY = Math.min(el[1], minY); - }); - return { - x: minX, - y: minY, - width: maxX - minX, - height: maxY - minY - }; +} +registerAttrHook(function (attr$$1, val, _this) { + // convert image fill and stroke to patterns + if (attr$$1 === 'fill' || attr$$1 === 'stroke') { + if (isImage.test(val)) { + val = _this.root().defs().image(val); } - }); - - var MorphArray = PointArray; // Move by left top corner over x-axis + } - function x$1(x) { - return x == null ? this.bbox().x : this.move(x, this.bbox().y); - } // Move by left top corner over y-axis + if (val instanceof Image) { + val = _this.root().defs().pattern(0, 0, pattern => { + pattern.add(val); + }); + } - function y$1(y) { - return y == null ? this.bbox().y : this.move(this.bbox().x, y); - } // Set width of element + return val; +}); +registerMethods({ + Container: { + // create image element, load image and set its size + image: wrapWithAttrCheck(function (source, callback) { + return this.put(new Image()).size(0, 0).load(source, callback); + }) + } +}); +register(Image); + +const PointArray = subClassArray('PointArray', SVGArray); +extend(PointArray, { + // Convert array to string + toString() { + // convert to a poly point string + for (var i = 0, il = this.length, array = []; i < il; i++) { + array.push(this[i].join(',')); + } - function width$1(width) { - var b = this.bbox(); - return width == null ? b.width : this.size(width, b.height); - } // Set height of element + return array.join(' '); + }, - function height$1(height) { - var b = this.bbox(); - return height == null ? b.height : this.size(b.width, height); - } + // Convert array to line object + toLine() { + return { + x1: this[0][0], + y1: this[0][1], + x2: this[1][0], + y2: this[1][1] + }; + }, - var pointed = /*#__PURE__*/Object.freeze({ - MorphArray: MorphArray, - x: x$1, - y: y$1, - width: width$1, - height: height$1 - }); + // Get morphed array at given position + at(pos) { + // make sure a destination is defined + if (!this.destination) return this; // generate morphed point string - var Line = - /*#__PURE__*/ - function (_Shape) { - _inherits(Line, _Shape); - - // Initialize node - function Line(node) { - _classCallCheck(this, Line); - - return _possibleConstructorReturn(this, _getPrototypeOf(Line).call(this, nodeOrNew('line', node), node)); - } // Get array - - - _createClass(Line, [{ - key: "array", - value: function array() { - return new PointArray([[this.attr('x1'), this.attr('y1')], [this.attr('x2'), this.attr('y2')]]); - } // Overwrite native plot() method - - }, { - key: "plot", - value: function plot(x1, y1, x2, y2) { - if (x1 == null) { - return this.array(); - } else if (typeof y1 !== 'undefined') { - x1 = { - x1: x1, - y1: y1, - x2: x2, - y2: y2 - }; - } else { - x1 = new PointArray(x1).toLine(); - } + for (var i = 0, il = this.length, array = []; i < il; i++) { + array.push([this[i][0] + (this.destination[i][0] - this[i][0]) * pos, this[i][1] + (this.destination[i][1] - this[i][1]) * pos]); + } - return this.attr(x1); - } // Move by left top corner + return new PointArray(array); + }, - }, { - key: "move", - value: function move(x, y) { - return this.attr(this.array().move(x, y).toLine()); - } // Set element size to given width and height + // Parse point string and flat array + parse(array = [[0, 0]]) { + var points = []; // if it is an array - }, { - key: "size", - value: function size(width, height) { - var p = proportionalSize(this, width, height); - return this.attr(this.array().size(p.width, p.height).toLine()); + if (array instanceof Array) { + // and it is not flat, there is no need to parse it + if (array[0] instanceof Array) { + return array; } - }]); - - return Line; - }(Shape); - extend(Line, pointed); - registerMethods({ - Container: { - // Create a line element - line: wrapWithAttrCheck(function () { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } + } else { + // Else, it is considered as a string + // parse points + array = array.trim().split(delimiter).map(parseFloat); + } // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints + // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + - // make sure plot is called as a setter - // x1 is not necessarily a number, it can also be an array, a string and a PointArray - return Line.prototype.plot.apply(this.put(new Line()), args[0] != null ? args : [0, 0, 0, 0]); - }) + if (array.length % 2 !== 0) array.pop(); // wrap points in two-tuples and parse points as floats + + for (var i = 0, len = array.length; i < len; i = i + 2) { + points.push([array[i], array[i + 1]]); } - }); - register(Line); - - var Marker = - /*#__PURE__*/ - function (_Container) { - _inherits(Marker, _Container); - - // Initialize node - function Marker(node) { - _classCallCheck(this, Marker); - - return _possibleConstructorReturn(this, _getPrototypeOf(Marker).call(this, nodeOrNew('marker', node), node)); - } // Set width of element - - - _createClass(Marker, [{ - key: "width", - value: function width(_width) { - return this.attr('markerWidth', _width); - } // Set height of element - - }, { - key: "height", - value: function height(_height) { - return this.attr('markerHeight', _height); - } // Set marker refX and refY - - }, { - key: "ref", - value: function ref(x, y) { - return this.attr('refX', x).attr('refY', y); - } // Update marker - - }, { - key: "update", - value: function update(block) { - // remove all content - this.clear(); // invoke passed block - - if (typeof block === 'function') { - block.call(this, this); - } - return this; - } // Return the fill id + return points; + }, - }, { - key: "toString", - value: function toString() { - return 'url(#' + this.id() + ')'; - } - }]); + // Move point string + move(x, y) { + var box = this.bbox(); // get relative offset - return Marker; - }(Container); - registerMethods({ - Container: { - marker: function marker() { - var _this$defs; + x -= box.x; + y -= box.y; // move every point - // Create marker element in defs - return (_this$defs = this.defs()).marker.apply(_this$defs, arguments); + if (!isNaN(x) && !isNaN(y)) { + for (var i = this.length - 1; i >= 0; i--) { + this[i] = [this[i][0] + x, this[i][1] + y]; } - }, - Defs: { - // Create marker - marker: wrapWithAttrCheck(function (width, height, block) { - // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto - return this.put(new Marker()).size(width, height).ref(width / 2, height / 2).viewbox(0, 0, width, height).attr('orient', 'auto').update(block); - }) - }, - marker: { - // Create and attach markers - marker: function marker(_marker, width, height, block) { - var attr = ['marker']; // Build attribute name + } - if (_marker !== 'all') attr.push(_marker); - attr = attr.join('-'); // Set marker attribute + return this; + }, - _marker = arguments[1] instanceof Marker ? arguments[1] : this.defs().marker(width, height, block); - return this.attr(attr, _marker); - } + // Resize poly string + size(width, height) { + var i; + var box = this.bbox(); // recalculate position of all points according to new size + + for (i = this.length - 1; i >= 0; i--) { + if (box.width) this[i][0] = (this[i][0] - box.x) * width / box.width + box.x; + if (box.height) this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; } - }); - register(Marker); - - /*** - Base Class - ========== - The base stepper class that will be - ***/ - - function makeSetterGetter(k, f) { - return function (v) { - if (v == null) return this[v]; - this[k] = v; - if (f) f.call(this); - return this; + + return this; + }, + + // Get bounding box of points + bbox() { + var maxX = -Infinity; + var maxY = -Infinity; + var minX = Infinity; + var minY = Infinity; + this.forEach(function (el) { + maxX = Math.max(el[0], maxX); + maxY = Math.max(el[1], maxY); + minX = Math.min(el[0], minX); + minY = Math.min(el[1], minY); + }); + return { + x: minX, + y: minY, + width: maxX - minX, + height: maxY - minY }; } - var easing = { - '-': function _(pos) { - return pos; - }, - '<>': function _(pos) { - return -Math.cos(pos * Math.PI) / 2 + 0.5; - }, - '>': function _(pos) { - return Math.sin(pos * Math.PI / 2); - }, - '<': function _(pos) { - return -Math.cos(pos * Math.PI / 2) + 1; - }, - bezier: function bezier(x1, y1, x2, y2) { - // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo - return function (t) { - if (t < 0) { - if (x1 > 0) { - return y1 / x1 * t; - } else if (x2 > 0) { - return y2 / x2 * t; - } else { - return 0; - } - } else if (t > 1) { - if (x2 < 1) { - return (1 - y2) / (1 - x2) * t + (y2 - x2) / (1 - x2); - } else if (x1 < 1) { - return (1 - y1) / (1 - x1) * t + (y1 - x1) / (1 - x1); - } else { - return 1; - } - } else { - return 3 * t * Math.pow(1 - t, 2) * y1 + 3 * Math.pow(t, 2) * (1 - t) * y2 + Math.pow(t, 3); - } +}); + +let MorphArray = PointArray; // Move by left top corner over x-axis + +function x$1(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); +} // Move by left top corner over y-axis + +function y$1(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); +} // Set width of element + +function width$1(width) { + let b = this.bbox(); + return width == null ? b.width : this.size(width, b.height); +} // Set height of element + +function height$1(height) { + let b = this.bbox(); + return height == null ? b.height : this.size(b.width, height); +} + +var pointed = /*#__PURE__*/Object.freeze({ + MorphArray: MorphArray, + x: x$1, + y: y$1, + width: width$1, + height: height$1 +}); + +class Line extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('line', node), node); + } // Get array + + + array() { + return new PointArray([[this.attr('x1'), this.attr('y1')], [this.attr('x2'), this.attr('y2')]]); + } // Overwrite native plot() method + + + plot(x1, y1, x2, y2) { + if (x1 == null) { + return this.array(); + } else if (typeof y1 !== 'undefined') { + x1 = { + x1: x1, + y1: y1, + x2: x2, + y2: y2 }; - }, - // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo - steps: function steps(_steps) { - var stepPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'end'; - // deal with "jump-" prefix - stepPosition = stepPosition.split('-').reverse()[0]; - var jumps = _steps; - - if (stepPosition === 'none') { - --jumps; - } else if (stepPosition === 'both') { - ++jumps; - } // The beforeFlag is essentially useless - - - return function (t) { - var beforeFlag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - // Step is called currentStep in referenced url - var step = Math.floor(t * _steps); - var jumping = t * step % 1 === 0; - - if (stepPosition === 'start' || stepPosition === 'both') { - ++step; - } + } else { + x1 = new PointArray(x1).toLine(); + } - if (beforeFlag && jumping) { - --step; - } + return this.attr(x1); + } // Move by left top corner - if (t >= 0 && step < 0) { - step = 0; - } - if (t <= 1 && step > jumps) { - step = jumps; - } + move(x, y) { + return this.attr(this.array().move(x, y).toLine()); + } // Set element size to given width and height - return step / jumps; - }; - } - }; - var Stepper = - /*#__PURE__*/ - function () { - function Stepper() { - _classCallCheck(this, Stepper); - } - _createClass(Stepper, [{ - key: "done", - value: function done() { - return false; - } - }]); + size(width, height) { + var p = proportionalSize(this, width, height); + return this.attr(this.array().size(p.width, p.height).toLine()); + } + +} +extend(Line, pointed); +registerMethods({ + Container: { + // Create a line element + line: wrapWithAttrCheck(function (...args) { + // make sure plot is called as a setter + // x1 is not necessarily a number, it can also be an array, a string and a PointArray + return Line.prototype.plot.apply(this.put(new Line()), args[0] != null ? args : [0, 0, 0, 0]); + }) + } +}); +register(Line); + +class Marker extends Container { + // Initialize node + constructor(node) { + super(nodeOrNew('marker', node), node); + } // Set width of element - return Stepper; - }(); - /*** - Easing Functions - ================ - ***/ - var Ease = - /*#__PURE__*/ - function (_Stepper) { - _inherits(Ease, _Stepper); + width(width) { + return this.attr('markerWidth', width); + } // Set height of element + + + height(height) { + return this.attr('markerHeight', height); + } // Set marker refX and refY - function Ease(fn) { - var _this; - _classCallCheck(this, Ease); + ref(x, y) { + return this.attr('refX', x).attr('refY', y); + } // Update marker - _this = _possibleConstructorReturn(this, _getPrototypeOf(Ease).call(this)); - _this.ease = easing[fn || timeline.ease] || fn; - return _this; + + update(block) { + // remove all content + this.clear(); // invoke passed block + + if (typeof block === 'function') { + block.call(this, this); } - _createClass(Ease, [{ - key: "step", - value: function step(from, to, pos) { - if (typeof from !== 'number') { - return pos < 1 ? from : to; - } + return this; + } // Return the fill id - return from + (to - from) * this.ease(pos); - } - }]); - return Ease; - }(Stepper); - /*** - Controller Types - ================ - ***/ + toString() { + return 'url(#' + this.id() + ')'; + } - var Controller = - /*#__PURE__*/ - function (_Stepper2) { - _inherits(Controller, _Stepper2); +} +registerMethods({ + Container: { + marker(...args) { + // Create marker element in defs + return this.defs().marker(...args); + } - function Controller(fn) { - var _this2; + }, + Defs: { + // Create marker + marker: wrapWithAttrCheck(function (width, height, block) { + // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto + return this.put(new Marker()).size(width, height).ref(width / 2, height / 2).viewbox(0, 0, width, height).attr('orient', 'auto').update(block); + }) + }, + marker: { + // Create and attach markers + marker(marker, width, height, block) { + var attr = ['marker']; // Build attribute name - _classCallCheck(this, Controller); + if (marker !== 'all') attr.push(marker); + attr = attr.join('-'); // Set marker attribute - _this2 = _possibleConstructorReturn(this, _getPrototypeOf(Controller).call(this)); - _this2.stepper = fn; - return _this2; + marker = arguments[1] instanceof Marker ? arguments[1] : this.defs().marker(width, height, block); + return this.attr(attr, marker); } - _createClass(Controller, [{ - key: "step", - value: function step(current, target, dt, c) { - return this.stepper(current, target, dt, c); + } +}); +register(Marker); + +var _strictMethod = function (method, arg) { + return !!method && _fails(function () { + // eslint-disable-next-line no-useless-call + arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); + }); +}; + +var $sort = [].sort; +var test = [1, 2, 3]; + +_export(_export.P + _export.F * (_fails(function () { + // IE8- + test.sort(undefined); +}) || !_fails(function () { + // V8 bug + test.sort(null); + // Old WebKit +}) || !_strictMethod($sort)), 'Array', { + // 22.1.3.25 Array.prototype.sort(comparefn) + sort: function sort(comparefn) { + return comparefn === undefined + ? $sort.call(_toObject(this)) + : $sort.call(_toObject(this), _aFunction(comparefn)); + } +}); + +/*** +Base Class +========== +The base stepper class that will be +***/ + +function makeSetterGetter(k, f) { + return function (v) { + if (v == null) return this[v]; + this[k] = v; + if (f) f.call(this); + return this; + }; +} + +let easing = { + '-': function _(pos) { + return pos; + }, + '<>': function _(pos) { + return -Math.cos(pos * Math.PI) / 2 + 0.5; + }, + '>': function _(pos) { + return Math.sin(pos * Math.PI / 2); + }, + '<': function _(pos) { + return -Math.cos(pos * Math.PI / 2) + 1; + }, + bezier: function bezier(x1, y1, x2, y2) { + // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo + return function (t) { + if (t < 0) { + if (x1 > 0) { + return y1 / x1 * t; + } else if (x2 > 0) { + return y2 / x2 * t; + } else { + return 0; + } + } else if (t > 1) { + if (x2 < 1) { + return (1 - y2) / (1 - x2) * t + (y2 - x2) / (1 - x2); + } else if (x1 < 1) { + return (1 - y1) / (1 - x1) * t + (y1 - x1) / (1 - x1); + } else { + return 1; + } + } else { + return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3; } - }, { - key: "done", - value: function done(c) { - return c.done; + }; + }, + // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo + steps: function steps(_steps, stepPosition = 'end') { + // deal with "jump-" prefix + stepPosition = stepPosition.split('-').reverse()[0]; + let jumps = _steps; + + if (stepPosition === 'none') { + --jumps; + } else if (stepPosition === 'both') { + ++jumps; + } // The beforeFlag is essentially useless + + + return (t, beforeFlag = false) => { + // Step is called currentStep in referenced url + let step = Math.floor(t * _steps); + const jumping = t * step % 1 === 0; + + if (stepPosition === 'start' || stepPosition === 'both') { + ++step; } - }]); - return Controller; - }(Stepper); + if (beforeFlag && jumping) { + --step; + } - function recalculate() { - // Apply the default parameters - var duration = (this._duration || 500) / 1000; - var overshoot = this._overshoot || 0; // Calculate the PID natural response + if (t >= 0 && step < 0) { + step = 0; + } - var eps = 1e-10; - var pi = Math.PI; - var os = Math.log(overshoot / 100 + eps); - var zeta = -os / Math.sqrt(pi * pi + os * os); - var wn = 3.9 / (zeta * duration); // Calculate the Spring values + if (t <= 1 && step > jumps) { + step = jumps; + } - this.d = 2 * zeta * wn; - this.k = wn * wn; + return step / jumps; + }; + } +}; +class Stepper { + done() { + return false; } - var Spring = - /*#__PURE__*/ - function (_Controller) { - _inherits(Spring, _Controller); +} +/*** +Easing Functions +================ +***/ - function Spring(duration, overshoot) { - var _this3; +class Ease extends Stepper { + constructor(fn) { + super(); + this.ease = easing[fn || timeline.ease] || fn; + } - _classCallCheck(this, Spring); + step(from, to, pos) { + if (typeof from !== 'number') { + return pos < 1 ? from : to; + } - _this3 = _possibleConstructorReturn(this, _getPrototypeOf(Spring).call(this)); + return from + (to - from) * this.ease(pos); + } - _this3.duration(duration || 500).overshoot(overshoot || 0); +} +/*** +Controller Types +================ +***/ - return _this3; - } +class Controller extends Stepper { + constructor(fn) { + super(); + this.stepper = fn; + } + + step(current, target, dt, c) { + return this.stepper(current, target, dt, c); + } - _createClass(Spring, [{ - key: "step", - value: function step(current, target, dt, c) { - if (typeof current === 'string') return current; - c.done = dt === Infinity; - if (dt === Infinity) return target; - if (dt === 0) return current; - if (dt > 100) dt = 16; - dt /= 1000; // Get the previous velocity + done(c) { + return c.done; + } - var velocity = c.velocity || 0; // Apply the control to get the new position and store it +} - var acceleration = -this.d * velocity - this.k * (current - target); - var newPosition = current + velocity * dt + acceleration * dt * dt / 2; // Store the velocity +function recalculate() { + // Apply the default parameters + var duration = (this._duration || 500) / 1000; + var overshoot = this._overshoot || 0; // Calculate the PID natural response - c.velocity = velocity + acceleration * dt; // Figure out if we have converged, and if so, pass the value + var eps = 1e-10; + var pi = Math.PI; + var os = Math.log(overshoot / 100 + eps); + var zeta = -os / Math.sqrt(pi * pi + os * os); + var wn = 3.9 / (zeta * duration); // Calculate the Spring values - c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; - return c.done ? target : newPosition; - } - }]); + this.d = 2 * zeta * wn; + this.k = wn * wn; +} - return Spring; - }(Controller); - extend(Spring, { - duration: makeSetterGetter('_duration', recalculate), - overshoot: makeSetterGetter('_overshoot', recalculate) - }); - var PID = - /*#__PURE__*/ - function (_Controller2) { - _inherits(PID, _Controller2); +class Spring extends Controller { + constructor(duration, overshoot) { + super(); + this.duration(duration || 500).overshoot(overshoot || 0); + } - function PID(p, i, d, windup) { - var _this4; + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + if (dt > 100) dt = 16; + dt /= 1000; // Get the previous velocity - _classCallCheck(this, PID); + var velocity = c.velocity || 0; // Apply the control to get the new position and store it - _this4 = _possibleConstructorReturn(this, _getPrototypeOf(PID).call(this)); - p = p == null ? 0.1 : p; - i = i == null ? 0.01 : i; - d = d == null ? 0 : d; - windup = windup == null ? 1000 : windup; + var acceleration = -this.d * velocity - this.k * (current - target); + var newPosition = current + velocity * dt + acceleration * dt * dt / 2; // Store the velocity - _this4.p(p).i(i).d(d).windup(windup); + c.velocity = velocity + acceleration * dt; // Figure out if we have converged, and if so, pass the value - return _this4; - } + c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; + return c.done ? target : newPosition; + } - _createClass(PID, [{ - key: "step", - value: function step(current, target, dt, c) { - if (typeof current === 'string') return current; - c.done = dt === Infinity; - if (dt === Infinity) return target; - if (dt === 0) return current; - var p = target - current; - var i = (c.integral || 0) + p * dt; - var d = (p - (c.error || 0)) / dt; - var windup = this.windup; // antiwindup - - if (windup !== false) { - i = Math.max(-windup, Math.min(i, windup)); - } +} +extend(Spring, { + duration: makeSetterGetter('_duration', recalculate), + overshoot: makeSetterGetter('_overshoot', recalculate) +}); +class PID extends Controller { + constructor(p, i, d, windup) { + super(); + p = p == null ? 0.1 : p; + i = i == null ? 0.01 : i; + d = d == null ? 0 : d; + windup = windup == null ? 1000 : windup; + this.p(p).i(i).d(d).windup(windup); + } - c.error = p; - c.integral = i; - c.done = Math.abs(p) < 0.001; - return c.done ? target : current + (this.P * p + this.I * i + this.D * d); - } - }]); - - return PID; - }(Controller); - extend(PID, { - windup: makeSetterGetter('windup'), - p: makeSetterGetter('P'), - i: makeSetterGetter('I'), - d: makeSetterGetter('D') - }); + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + var p = target - current; + var i = (c.integral || 0) + p * dt; + var d = (p - (c.error || 0)) / dt; + var windup = this.windup; // antiwindup + + if (windup !== false) { + i = Math.max(-windup, Math.min(i, windup)); + } - var PathArray = subClassArray('PathArray', SVGArray); - function pathRegReplace(a, b, c, d) { - return c + d.replace(dots, ' .'); + c.error = p; + c.integral = i; + c.done = Math.abs(p) < 0.001; + return c.done ? target : current + (this.P * p + this.I * i + this.D * d); } - function arrayToString(a) { - for (var i = 0, il = a.length, s = ''; i < il; i++) { - s += a[i][0]; +} +extend(PID, { + windup: makeSetterGetter('windup'), + p: makeSetterGetter('P'), + i: makeSetterGetter('I'), + d: makeSetterGetter('D') +}); + +const PathArray = subClassArray('PathArray', SVGArray); +function pathRegReplace(a, b, c, d) { + return c + d.replace(dots, ' .'); +} - if (a[i][1] != null) { - s += a[i][1]; +function arrayToString(a) { + for (var i = 0, il = a.length, s = ''; i < il; i++) { + s += a[i][0]; - if (a[i][2] != null) { + if (a[i][1] != null) { + s += a[i][1]; + + if (a[i][2] != null) { + s += ' '; + s += a[i][2]; + + if (a[i][3] != null) { + s += ' '; + s += a[i][3]; s += ' '; - s += a[i][2]; + s += a[i][4]; - if (a[i][3] != null) { + if (a[i][5] != null) { s += ' '; - s += a[i][3]; + s += a[i][5]; s += ' '; - s += a[i][4]; + s += a[i][6]; - if (a[i][5] != null) { + if (a[i][7] != null) { s += ' '; - s += a[i][5]; - s += ' '; - s += a[i][6]; - - if (a[i][7] != null) { - s += ' '; - s += a[i][7]; - } + s += a[i][7]; } } } } } - - return s + ' '; } - var pathHandlers = { - M: function M(c, p, p0) { - p.x = p0.x = c[0]; - p.y = p0.y = c[1]; - return ['M', p.x, p.y]; - }, - L: function L(c, p) { - p.x = c[0]; - p.y = c[1]; - return ['L', c[0], c[1]]; - }, - H: function H(c, p) { - p.x = c[0]; - return ['H', c[0]]; - }, - V: function V(c, p) { - p.y = c[0]; - return ['V', c[0]]; - }, - C: function C(c, p) { - p.x = c[4]; - p.y = c[5]; - return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]; - }, - S: function S(c, p) { - p.x = c[2]; - p.y = c[3]; - return ['S', c[0], c[1], c[2], c[3]]; - }, - Q: function Q(c, p) { - p.x = c[2]; - p.y = c[3]; - return ['Q', c[0], c[1], c[2], c[3]]; - }, - T: function T(c, p) { - p.x = c[0]; - p.y = c[1]; - return ['T', c[0], c[1]]; - }, - Z: function Z(c, p, p0) { - p.x = p0.x; - p.y = p0.y; - return ['Z']; - }, - A: function A(c, p) { - p.x = c[5]; - p.y = c[6]; - return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]; - } - }; - var mlhvqtcsaz = 'mlhvqtcsaz'.split(''); - - for (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) { - pathHandlers[mlhvqtcsaz[i]] = function (i) { - return function (c, p, p0) { - if (i === 'H') c[0] = c[0] + p.x;else if (i === 'V') c[0] = c[0] + p.y;else if (i === 'A') { - c[5] = c[5] + p.x; - c[6] = c[6] + p.y; - } else { - for (var j = 0, jl = c.length; j < jl; ++j) { - c[j] = c[j] + (j % 2 ? p.y : p.x); - } - } - return pathHandlers[i](c, p, p0); - }; - }(mlhvqtcsaz[i].toUpperCase()); + return s + ' '; +} + +const pathHandlers = { + M: function M(c, p, p0) { + p.x = p0.x = c[0]; + p.y = p0.y = c[1]; + return ['M', p.x, p.y]; + }, + L: function L(c, p) { + p.x = c[0]; + p.y = c[1]; + return ['L', c[0], c[1]]; + }, + H: function H(c, p) { + p.x = c[0]; + return ['H', c[0]]; + }, + V: function V(c, p) { + p.y = c[0]; + return ['V', c[0]]; + }, + C: function C(c, p) { + p.x = c[4]; + p.y = c[5]; + return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]; + }, + S: function S(c, p) { + p.x = c[2]; + p.y = c[3]; + return ['S', c[0], c[1], c[2], c[3]]; + }, + Q: function Q(c, p) { + p.x = c[2]; + p.y = c[3]; + return ['Q', c[0], c[1], c[2], c[3]]; + }, + T: function T(c, p) { + p.x = c[0]; + p.y = c[1]; + return ['T', c[0], c[1]]; + }, + Z: function Z(c, p, p0) { + p.x = p0.x; + p.y = p0.y; + return ['Z']; + }, + A: function A(c, p) { + p.x = c[5]; + p.y = c[6]; + return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]; } - - extend(PathArray, { - // Convert array to string - toString: function toString() { - return arrayToString(this); - }, - // Move path string - move: function move(x, y) { - // get bounding box of current situation - var box = this.bbox(); // get relative offset - - x -= box.x; - y -= box.y; - - if (!isNaN(x) && !isNaN(y)) { - // move every point - for (var l, i = this.length - 1; i >= 0; i--) { - l = this[i][0]; - - if (l === 'M' || l === 'L' || l === 'T') { - this[i][1] += x; - this[i][2] += y; - } else if (l === 'H') { - this[i][1] += x; - } else if (l === 'V') { - this[i][1] += y; - } else if (l === 'C' || l === 'S' || l === 'Q') { - this[i][1] += x; - this[i][2] += y; - this[i][3] += x; - this[i][4] += y; - - if (l === 'C') { - this[i][5] += x; - this[i][6] += y; - } - } else if (l === 'A') { - this[i][6] += x; - this[i][7] += y; - } +}; +let mlhvqtcsaz = 'mlhvqtcsaz'.split(''); + +for (var i$1 = 0, il = mlhvqtcsaz.length; i$1 < il; ++i$1) { + pathHandlers[mlhvqtcsaz[i$1]] = function (i) { + return function (c, p, p0) { + if (i === 'H') c[0] = c[0] + p.x;else if (i === 'V') c[0] = c[0] + p.y;else if (i === 'A') { + c[5] = c[5] + p.x; + c[6] = c[6] + p.y; + } else { + for (var j = 0, jl = c.length; j < jl; ++j) { + c[j] = c[j] + (j % 2 ? p.y : p.x); } } - - return this; - }, - // Resize path string - size: function size(width, height) { - // get bounding box of current situation - var box = this.bbox(); - var i, l; // recalculate position of all points according to new size - - for (i = this.length - 1; i >= 0; i--) { + return pathHandlers[i](c, p, p0); + }; + }(mlhvqtcsaz[i$1].toUpperCase()); +} + +extend(PathArray, { + // Convert array to string + toString() { + return arrayToString(this); + }, + + // Move path string + move(x, y) { + // get bounding box of current situation + var box = this.bbox(); // get relative offset + + x -= box.x; + y -= box.y; + + if (!isNaN(x) && !isNaN(y)) { + // move every point + for (var l, i = this.length - 1; i >= 0; i--) { l = this[i][0]; if (l === 'M' || l === 'L' || l === 'T') { - this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; - this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + this[i][1] += x; + this[i][2] += y; } else if (l === 'H') { - this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][1] += x; } else if (l === 'V') { - this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + this[i][1] += y; } else if (l === 'C' || l === 'S' || l === 'Q') { - this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; - this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; - this[i][3] = (this[i][3] - box.x) * width / box.width + box.x; - this[i][4] = (this[i][4] - box.y) * height / box.height + box.y; + this[i][1] += x; + this[i][2] += y; + this[i][3] += x; + this[i][4] += y; if (l === 'C') { - this[i][5] = (this[i][5] - box.x) * width / box.width + box.x; - this[i][6] = (this[i][6] - box.y) * height / box.height + box.y; + this[i][5] += x; + this[i][6] += y; } } else if (l === 'A') { - // resize radii - this[i][1] = this[i][1] * width / box.width; - this[i][2] = this[i][2] * height / box.height; // move position values - - this[i][6] = (this[i][6] - box.x) * width / box.width + box.x; - this[i][7] = (this[i][7] - box.y) * height / box.height + box.y; + this[i][6] += x; + this[i][7] += y; } } + } - return this; - }, - // Test if the passed path array use the same path data commands as this path array - equalCommands: function equalCommands(pathArray) { - var i, il, equalCommands; - pathArray = new PathArray(pathArray); - equalCommands = this.length === pathArray.length; - - for (i = 0, il = this.length; equalCommands && i < il; i++) { - equalCommands = this[i][0] === pathArray[i][0]; + return this; + }, + + // Resize path string + size(width, height) { + // get bounding box of current situation + var box = this.bbox(); + var i, l; // recalculate position of all points according to new size + + for (i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + } else if (l === 'H') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + } else if (l === 'V') { + this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + this[i][3] = (this[i][3] - box.x) * width / box.width + box.x; + this[i][4] = (this[i][4] - box.y) * height / box.height + box.y; + + if (l === 'C') { + this[i][5] = (this[i][5] - box.x) * width / box.width + box.x; + this[i][6] = (this[i][6] - box.y) * height / box.height + box.y; + } + } else if (l === 'A') { + // resize radii + this[i][1] = this[i][1] * width / box.width; + this[i][2] = this[i][2] * height / box.height; // move position values + + this[i][6] = (this[i][6] - box.x) * width / box.width + box.x; + this[i][7] = (this[i][7] - box.y) * height / box.height + box.y; } + } - return equalCommands; - }, - // Make path array morphable - morph: function morph(pathArray) { - pathArray = new PathArray(pathArray); + return this; + }, - if (this.equalCommands(pathArray)) { - this.destination = pathArray; - } else { - this.destination = null; + // Test if the passed path array use the same path data commands as this path array + equalCommands(pathArray) { + var i, il, equalCommands; + pathArray = new PathArray(pathArray); + equalCommands = this.length === pathArray.length; + + for (i = 0, il = this.length; equalCommands && i < il; i++) { + equalCommands = this[i][0] === pathArray[i][0]; + } + + return equalCommands; + }, + + // Make path array morphable + morph(pathArray) { + pathArray = new PathArray(pathArray); + + if (this.equalCommands(pathArray)) { + this.destination = pathArray; + } else { + this.destination = null; + } + + return this; + }, + + // Get morphed path array at given position + at(pos) { + // make sure a destination is defined + if (!this.destination) return this; + var sourceArray = this; + var destinationArray = this.destination.value; + var array = []; + var pathArray = new PathArray(); + var i, il, j, jl; // Animate has specified in the SVG spec + // See: https://www.w3.org/TR/SVG11/paths.html#PathElement + + for (i = 0, il = sourceArray.length; i < il; i++) { + array[i] = [sourceArray[i][0]]; + + for (j = 1, jl = sourceArray[i].length; j < jl; j++) { + array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos; + } // For the two flags of the elliptical arc command, the SVG spec say: + // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true + // Elliptical arc command as an array followed by corresponding indexes: + // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y] + // 0 1 2 3 4 5 6 7 + + + if (array[i][0] === 'A') { + array[i][4] = +(array[i][4] !== 0); + array[i][5] = +(array[i][5] !== 0); + } + } // Directly modify the value of a path array, this is done this way for performance + + + pathArray.value = array; + return pathArray; + }, + + // Absolutize and parse path to array + parse(array = [['M', 0, 0]]) { + // if it's already a patharray, no need to parse it + if (array instanceof PathArray) return array; // prepare for parsing + + var s; + var paramCnt = { + 'M': 2, + 'L': 2, + 'H': 1, + 'V': 1, + 'C': 6, + 'S': 4, + 'Q': 4, + 'T': 2, + 'A': 7, + 'Z': 0 + }; + + if (typeof array === 'string') { + array = array.replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123 + .replace(pathLetters, ' $& ') // put some room between letters and numbers + .replace(hyphen, '$1 -') // add space before hyphen + .trim() // trim + .split(delimiter); // split into array + } else { + array = array.reduce(function (prev, curr) { + return [].concat.call(prev, curr); + }, []); + } // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...] + + + var result = []; + var p = new Point(); + var p0 = new Point(); + var index = 0; + var len = array.length; + + do { + // Test if we have a path letter + if (isPathLetter.test(array[index])) { + s = array[index]; + ++index; // If last letter was a move command and we got no new, it defaults to [L]ine + } else if (s === 'M') { + s = 'L'; + } else if (s === 'm') { + s = 'l'; } - return this; - }, - // Get morphed path array at given position - at: function at(pos) { - // make sure a destination is defined - if (!this.destination) return this; - var sourceArray = this; - var destinationArray = this.destination.value; - var array = []; - var pathArray = new PathArray(); - var i, il, j, jl; // Animate has specified in the SVG spec - // See: https://www.w3.org/TR/SVG11/paths.html#PathElement - - for (i = 0, il = sourceArray.length; i < il; i++) { - array[i] = [sourceArray[i][0]]; - - for (j = 1, jl = sourceArray[i].length; j < jl; j++) { - array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos; - } // For the two flags of the elliptical arc command, the SVG spec say: - // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true - // Elliptical arc command as an array followed by corresponding indexes: - // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y] - // 0 1 2 3 4 5 6 7 - - - if (array[i][0] === 'A') { - array[i][4] = +(array[i][4] !== 0); - array[i][5] = +(array[i][5] !== 0); - } - } // Directly modify the value of a path array, this is done this way for performance + result.push(pathHandlers[s].call(null, array.slice(index, index = index + paramCnt[s.toUpperCase()]).map(parseFloat), p, p0)); + } while (len > index); + return result; + }, - pathArray.value = array; - return pathArray; - }, - // Absolutize and parse path to array - parse: function parse() { - var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [['M', 0, 0]]; - // if it's already a patharray, no need to parse it - if (array instanceof PathArray) return array; // prepare for parsing - - var s; - var paramCnt = { - 'M': 2, - 'L': 2, - 'H': 1, - 'V': 1, - 'C': 6, - 'S': 4, - 'Q': 4, - 'T': 2, - 'A': 7, - 'Z': 0 - }; + // Get bounding box of path + bbox() { + parser().path.setAttribute('d', this.toString()); + return parser.nodes.path.getBBox(); + } - if (typeof array === 'string') { - array = array.replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123 - .replace(pathLetters, ' $& ') // put some room between letters and numbers - .replace(hyphen, '$1 -') // add space before hyphen - .trim() // trim - .split(delimiter); // split into array - } else { - array = array.reduce(function (prev, curr) { - return [].concat.call(prev, curr); - }, []); - } // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...] - - - var result = []; - var p = new Point(); - var p0 = new Point(); - var index = 0; - var len = array.length; - - do { - // Test if we have a path letter - if (isPathLetter.test(array[index])) { - s = array[index]; - ++index; // If last letter was a move command and we got no new, it defaults to [L]ine - } else if (s === 'M') { - s = 'L'; - } else if (s === 'm') { - s = 'l'; - } +}); - result.push(pathHandlers[s].call(null, array.slice(index, index = index + paramCnt[s.toUpperCase()]).map(parseFloat), p, p0)); - } while (len > index); +class Morphable { + constructor(stepper) { + this._stepper = stepper || new Ease('-'); + this._from = null; + this._to = null; + this._type = null; + this._context = null; + this._morphObj = null; + } - return result; - }, - // Get bounding box of path - bbox: function bbox() { - parser().path.setAttribute('d', this.toString()); - return parser.nodes.path.getBBox(); + from(val) { + if (val == null) { + return this._from; } - }); - var Morphable = - /*#__PURE__*/ - function () { - function Morphable(stepper) { - _classCallCheck(this, Morphable); - - this._stepper = stepper || new Ease('-'); - this._from = null; - this._to = null; - this._type = null; - this._context = null; - this._morphObj = null; + this._from = this._set(val); + return this; + } + + to(val) { + if (val == null) { + return this._to; } - _createClass(Morphable, [{ - key: "from", - value: function from(val) { - if (val == null) { - return this._from; - } + this._to = this._set(val); + return this; + } - this._from = this._set(val); - return this; - } - }, { - key: "to", - value: function to(val) { - if (val == null) { - return this._to; - } + type(type) { + // getter + if (type == null) { + return this._type; + } // setter - this._to = this._set(val); - return this; - } - }, { - key: "type", - value: function type(_type) { - // getter - if (_type == null) { - return this._type; - } // setter + this._type = type; + return this; + } - this._type = _type; - return this; - } - }, { - key: "_set", - value: function _set$$1(value) { - if (!this._type) { - var type = _typeof(value); - - if (type === 'number') { - this.type(SVGNumber); - } else if (type === 'string') { - if (Color.isColor(value)) { - this.type(Color); - } else if (delimiter.test(value)) { - this.type(pathLetters.test(value) ? PathArray : SVGArray); - } else if (numberAndUnit.test(value)) { - this.type(SVGNumber); - } else { - this.type(NonMorphable); - } - } else if (morphableTypes.indexOf(value.constructor) > -1) { - this.type(value.constructor); - } else if (Array.isArray(value)) { - this.type(SVGArray); - } else if (type === 'object') { - this.type(ObjectBag); - } else { - this.type(NonMorphable); - } + _set(value) { + if (!this._type) { + var type = typeof value; + + if (type === 'number') { + this.type(SVGNumber); + } else if (type === 'string') { + if (Color.isColor(value)) { + this.type(Color); + } else if (delimiter.test(value)) { + this.type(pathLetters.test(value) ? PathArray : SVGArray); + } else if (numberAndUnit.test(value)) { + this.type(SVGNumber); + } else { + this.type(NonMorphable); } - - var result = new this._type(value).toArray(); - this._morphObj = this._morphObj || new this._type(); - this._context = this._context || Array.apply(null, Array(result.length)).map(Object); - return result; - } - }, { - key: "stepper", - value: function stepper(_stepper) { - if (_stepper == null) return this._stepper; - this._stepper = _stepper; - return this; + } else if (morphableTypes.indexOf(value.constructor) > -1) { + this.type(value.constructor); + } else if (Array.isArray(value)) { + this.type(SVGArray); + } else if (type === 'object') { + this.type(ObjectBag); + } else { + this.type(NonMorphable); } - }, { - key: "done", - value: function done() { - var complete = this._context.map(this._stepper.done).reduce(function (last, curr) { - return last && curr; - }, true); + } - return complete; - } - }, { - key: "at", - value: function at(pos) { - var _this = this; - - return this._morphObj.fromArray(this._from.map(function (i, index) { - return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context); - })); - } - }]); + var result = new this._type(value).toArray(); + this._morphObj = this._morphObj || new this._type(); + this._context = this._context || Array.apply(null, Array(result.length)).map(Object); + return result; + } - return Morphable; - }(); - var NonMorphable = - /*#__PURE__*/ - function () { - function NonMorphable() { - _classCallCheck(this, NonMorphable); + stepper(stepper) { + if (stepper == null) return this._stepper; + this._stepper = stepper; + return this; + } - this.init.apply(this, arguments); - } + done() { + var complete = this._context.map(this._stepper.done).reduce(function (last, curr) { + return last && curr; + }, true); - _createClass(NonMorphable, [{ - key: "init", - value: function init(val) { - val = Array.isArray(val) ? val[0] : val; - this.value = val; - return this; - } - }, { - key: "valueOf", - value: function valueOf() { - return this.value; - } - }, { - key: "toArray", - value: function toArray() { - return [this.value]; - } - }]); + return complete; + } - return NonMorphable; - }(); - var TransformBag = - /*#__PURE__*/ - function () { - function TransformBag() { - _classCallCheck(this, TransformBag); + at(pos) { + var _this = this; - this.init.apply(this, arguments); - } + return this._morphObj.fromArray(this._from.map(function (i, index) { + return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context); + })); + } - _createClass(TransformBag, [{ - key: "init", - value: function init(obj) { - if (Array.isArray(obj)) { - obj = { - scaleX: obj[0], - scaleY: obj[1], - shear: obj[2], - rotate: obj[3], - translateX: obj[4], - translateY: obj[5], - originX: obj[6], - originY: obj[7] - }; - } +} +class NonMorphable { + constructor(...args) { + this.init(...args); + } - Object.assign(this, TransformBag.defaults, obj); - return this; - } - }, { - key: "toArray", - value: function toArray() { - var v = this; - return [v.scaleX, v.scaleY, v.shear, v.rotate, v.translateX, v.translateY, v.originX, v.originY]; - } - }]); - - return TransformBag; - }(); - TransformBag.defaults = { - scaleX: 1, - scaleY: 1, - shear: 0, - rotate: 0, - translateX: 0, - translateY: 0, - originX: 0, - originY: 0 - }; - var ObjectBag = - /*#__PURE__*/ - function () { - function ObjectBag() { - _classCallCheck(this, ObjectBag); + init(val) { + val = Array.isArray(val) ? val[0] : val; + this.value = val; + return this; + } + + valueOf() { + return this.value; + } - this.init.apply(this, arguments); + toArray() { + return [this.value]; + } + +} +class TransformBag { + constructor(...args) { + this.init(...args); + } + + init(obj) { + if (Array.isArray(obj)) { + obj = { + scaleX: obj[0], + scaleY: obj[1], + shear: obj[2], + rotate: obj[3], + translateX: obj[4], + translateY: obj[5], + originX: obj[6], + originY: obj[7] + }; } - _createClass(ObjectBag, [{ - key: "init", - value: function init(objOrArr) { - this.values = []; + Object.assign(this, TransformBag.defaults, obj); + return this; + } - if (Array.isArray(objOrArr)) { - this.values = objOrArr; - return; - } + toArray() { + var v = this; + return [v.scaleX, v.scaleY, v.shear, v.rotate, v.translateX, v.translateY, v.originX, v.originY]; + } - var entries = Object.entries(objOrArr || {}).sort(function (a, b) { - return a[0] - b[0]; - }); - this.values = entries.reduce(function (last, curr) { - return last.concat(curr); - }, []); - return this; - } - }, { - key: "valueOf", - value: function valueOf() { - var obj = {}; - var arr = this.values; - - for (var i = 0, len = arr.length; i < len; i += 2) { - obj[arr[i]] = arr[i + 1]; - } +} +TransformBag.defaults = { + scaleX: 1, + scaleY: 1, + shear: 0, + rotate: 0, + translateX: 0, + translateY: 0, + originX: 0, + originY: 0 +}; +class ObjectBag { + constructor(...args) { + this.init(...args); + } - return obj; - } - }, { - key: "toArray", - value: function toArray() { - return this.values; - } - }]); - - return ObjectBag; - }(); - var morphableTypes = [NonMorphable, TransformBag, ObjectBag]; - function registerMorphableType() { - var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - morphableTypes.push.apply(morphableTypes, _toConsumableArray([].concat(type))); - } - function makeMorphable() { - extend(morphableTypes, { - to: function to(val) { - return new Morphable().type(this.constructor).from(this.valueOf()).to(val); - }, - fromArray: function fromArray(arr) { - this.init(arr); - return this; - } + init(objOrArr) { + this.values = []; + + if (Array.isArray(objOrArr)) { + this.values = objOrArr; + return; + } + + objOrArr = objOrArr || {}; + var entries = []; + + for (let i in objOrArr) { + entries.push([i, objOrArr[i]]); + } + + entries.sort((a, b) => { + return a[0] - b[0]; }); + this.values = entries.reduce((last, curr) => last.concat(curr), []); + return this; } - var Path = - /*#__PURE__*/ - function (_Shape) { - _inherits(Path, _Shape); - - // Initialize node - function Path(node) { - _classCallCheck(this, Path); - - return _possibleConstructorReturn(this, _getPrototypeOf(Path).call(this, nodeOrNew('path', node), node)); - } // Get array - - - _createClass(Path, [{ - key: "array", - value: function array() { - return this._array || (this._array = new PathArray(this.attr('d'))); - } // Plot new path - - }, { - key: "plot", - value: function plot(d) { - return d == null ? this.array() : this.clear().attr('d', typeof d === 'string' ? d : this._array = new PathArray(d)); - } // Clear array cache - - }, { - key: "clear", - value: function clear() { - delete this._array; - return this; - } // Move by left top corner - - }, { - key: "move", - value: function move(x, y) { - return this.attr('d', this.array().move(x, y)); - } // Move by left top corner over x-axis - - }, { - key: "x", - value: function x(_x) { - return _x == null ? this.bbox().x : this.move(_x, this.bbox().y); - } // Move by left top corner over y-axis - - }, { - key: "y", - value: function y(_y) { - return _y == null ? this.bbox().y : this.move(this.bbox().x, _y); - } // Set element size to given width and height - - }, { - key: "size", - value: function size(width, height) { - var p = proportionalSize(this, width, height); - return this.attr('d', this.array().size(p.width, p.height)); - } // Set width of element - - }, { - key: "width", - value: function width(_width) { - return _width == null ? this.bbox().width : this.size(_width, this.bbox().height); - } // Set height of element - - }, { - key: "height", - value: function height(_height) { - return _height == null ? this.bbox().height : this.size(this.bbox().width, _height); - } - }, { - key: "targets", - value: function targets() { - return baseFind('svg textpath [href*="' + this.id() + '"]'); - } - }]); - - return Path; - }(Shape); // Define morphable array - Path.prototype.MorphArray = PathArray; // Add parent method - - registerMethods({ - Container: { - // Create a wrapped path element - path: wrapWithAttrCheck(function (d) { - // make sure plot is called as a setter - return this.put(new Path()).plot(d || new PathArray()); - }) + valueOf() { + var obj = {}; + var arr = this.values; + + for (var i = 0, len = arr.length; i < len; i += 2) { + obj[arr[i]] = arr[i + 1]; + } + + return obj; + } + + toArray() { + return this.values; + } + +} +const morphableTypes = [NonMorphable, TransformBag, ObjectBag]; +function registerMorphableType(type = []) { + morphableTypes.push(...[].concat(type)); +} +function makeMorphable() { + extend(morphableTypes, { + to(val) { + return new Morphable().type(this.constructor).from(this.valueOf()).to(val); + }, + + fromArray(arr) { + this.init(arr); + return this; } + }); - register(Path); +} + +class Path extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('path', node), node); + } // Get array + - function array() { - return this._array || (this._array = new PointArray(this.attr('points'))); + array() { + return this._array || (this._array = new PathArray(this.attr('d'))); } // Plot new path - function plot(p) { - return p == null ? this.array() : this.clear().attr('points', typeof p === 'string' ? p : this._array = new PointArray(p)); + + plot(d) { + return d == null ? this.array() : this.clear().attr('d', typeof d === 'string' ? d : this._array = new PathArray(d)); } // Clear array cache - function clear() { + + clear() { delete this._array; return this; } // Move by left top corner - function move(x, y) { - return this.attr('points', this.array().move(x, y)); + + move(x, y) { + return this.attr('d', this.array().move(x, y)); + } // Move by left top corner over x-axis + + + x(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); + } // Move by left top corner over y-axis + + + y(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); } // Set element size to given width and height - function size(width, height) { + + size(width, height) { var p = proportionalSize(this, width, height); - return this.attr('points', this.array().size(p.width, p.height)); + return this.attr('d', this.array().size(p.width, p.height)); + } // Set width of element + + + width(width) { + return width == null ? this.bbox().width : this.size(width, this.bbox().height); + } // Set height of element + + + height(height) { + return height == null ? this.bbox().height : this.size(this.bbox().width, height); } - var poly = /*#__PURE__*/Object.freeze({ - array: array, - plot: plot, - clear: clear, - move: move, - size: size - }); + targets() { + return baseFind('svg textpath [href*="' + this.id() + '"]'); + } - var Polygon = - /*#__PURE__*/ - function (_Shape) { - _inherits(Polygon, _Shape); +} // Define morphable array - // Initialize node - function Polygon(node) { - _classCallCheck(this, Polygon); +Path.prototype.MorphArray = PathArray; // Add parent method - return _possibleConstructorReturn(this, _getPrototypeOf(Polygon).call(this, nodeOrNew('polygon', node), node)); - } +registerMethods({ + Container: { + // Create a wrapped path element + path: wrapWithAttrCheck(function (d) { + // make sure plot is called as a setter + return this.put(new Path()).plot(d || new PathArray()); + }) + } +}); +register(Path); + +function array() { + return this._array || (this._array = new PointArray(this.attr('points'))); +} // Plot new path + +function plot(p) { + return p == null ? this.array() : this.clear().attr('points', typeof p === 'string' ? p : this._array = new PointArray(p)); +} // Clear array cache + +function clear() { + delete this._array; + return this; +} // Move by left top corner + +function move(x, y) { + return this.attr('points', this.array().move(x, y)); +} // Set element size to given width and height + +function size(width, height) { + let p = proportionalSize(this, width, height); + return this.attr('points', this.array().size(p.width, p.height)); +} + +var poly = /*#__PURE__*/Object.freeze({ + array: array, + plot: plot, + clear: clear, + move: move, + size: size +}); + +class Polygon extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('polygon', node), node); + } - return Polygon; - }(Shape); - registerMethods({ - Container: { - // Create a wrapped polygon element - polygon: wrapWithAttrCheck(function (p) { - // make sure plot is called as a setter - return this.put(new Polygon()).plot(p || new PointArray()); - }) - } - }); - extend(Polygon, pointed); - extend(Polygon, poly); - register(Polygon); +} +registerMethods({ + Container: { + // Create a wrapped polygon element + polygon: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polygon()).plot(p || new PointArray()); + }) + } +}); +extend(Polygon, pointed); +extend(Polygon, poly); +register(Polygon); + +class Polyline extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('polyline', node), node); + } - var Polyline = - /*#__PURE__*/ - function (_Shape) { - _inherits(Polyline, _Shape); +} +registerMethods({ + Container: { + // Create a wrapped polygon element + polyline: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polyline()).plot(p || new PointArray()); + }) + } +}); +extend(Polyline, pointed); +extend(Polyline, poly); +register(Polyline); + +class Rect extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('rect', node), node); + } - // Initialize node - function Polyline(node) { - _classCallCheck(this, Polyline); +} +extend(Rect, { + rx, + ry +}); +registerMethods({ + Container: { + // Create a rect element + rect: wrapWithAttrCheck(function (width$$1, height$$1) { + return this.put(new Rect()).size(width$$1, height$$1); + }) + } +}); +register(Rect); - return _possibleConstructorReturn(this, _getPrototypeOf(Polyline).call(this, nodeOrNew('polyline', node), node)); - } +class Queue { + constructor() { + this._first = null; + this._last = null; + } - return Polyline; - }(Shape); - registerMethods({ - Container: { - // Create a wrapped polygon element - polyline: wrapWithAttrCheck(function (p) { - // make sure plot is called as a setter - return this.put(new Polyline()).plot(p || new PointArray()); - }) - } - }); - extend(Polyline, pointed); - extend(Polyline, poly); - register(Polyline); + push(value) { + // An item stores an id and the provided value + var item = value.next ? value : { + value: value, + next: null, + prev: null // Deal with the queue being empty or populated - var Rect = - /*#__PURE__*/ - function (_Shape) { - _inherits(Rect, _Shape); + }; - // Initialize node - function Rect(node) { - _classCallCheck(this, Rect); + if (this._last) { + item.prev = this._last; + this._last.next = item; + this._last = item; + } else { + this._last = item; + this._first = item; + } // Update the length and return the current item - return _possibleConstructorReturn(this, _getPrototypeOf(Rect).call(this, nodeOrNew('rect', node), node)); - } - return Rect; - }(Shape); - extend(Rect, { - rx: rx, - ry: ry - }); - registerMethods({ - Container: { - // Create a rect element - rect: wrapWithAttrCheck(function (width$$1, height$$1) { - return this.put(new Rect()).size(width$$1, height$$1); - }) - } - }); - register(Rect); + return item; + } - var Queue = - /*#__PURE__*/ - function () { - function Queue() { - _classCallCheck(this, Queue); + shift() { + // Check if we have a value + var remove = this._first; + if (!remove) return null; // If we do, remove it and relink things - this._first = null; - this._last = null; - } + this._first = remove.next; + if (this._first) this._first.prev = null; + this._last = this._first ? this._last : null; + return remove.value; + } // Shows us the first item in the list - _createClass(Queue, [{ - key: "push", - value: function push(value) { - // An item stores an id and the provided value - var item = value.next ? value : { - value: value, - next: null, - prev: null // Deal with the queue being empty or populated - - }; - - if (this._last) { - item.prev = this._last; - this._last.next = item; - this._last = item; - } else { - this._last = item; - this._first = item; - } // Update the length and return the current item + first() { + return this._first && this._first.value; + } // Shows us the last item in the list - return item; - } - }, { - key: "shift", - value: function shift() { - // Check if we have a value - var remove = this._first; - if (!remove) return null; // If we do, remove it and relink things - - this._first = remove.next; - if (this._first) this._first.prev = null; - this._last = this._first ? this._last : null; - return remove.value; - } // Shows us the first item in the list - - }, { - key: "first", - value: function first() { - return this._first && this._first.value; - } // Shows us the last item in the list - - }, { - key: "last", - value: function last() { - return this._last && this._last.value; - } // Removes the item that was returned from the push - - }, { - key: "remove", - value: function remove(item) { - // Relink the previous item - if (item.prev) item.prev.next = item.next; - if (item.next) item.next.prev = item.prev; - if (item === this._last) this._last = item.prev; - if (item === this._first) this._first = item.next; // Invalidate item - - item.prev = null; - item.next = null; - } - }]); - return Queue; - }(); + last() { + return this._last && this._last.value; + } // Removes the item that was returned from the push - var Animator = { - nextDraw: null, - frames: new Queue(), - timeouts: new Queue(), - timer: globals.window.performance || globals.window.Date, - transforms: [], - frame: function frame(fn) { - // Store the node - var node = Animator.frames.push({ - run: fn - }); // Request an animation frame if we don't have one - if (Animator.nextDraw === null) { - Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); - } // Return the node so we can remove it easily + remove(item) { + // Relink the previous item + if (item.prev) item.prev.next = item.next; + if (item.next) item.next.prev = item.prev; + if (item === this._last) this._last = item.prev; + if (item === this._first) this._first = item.next; // Invalidate item + item.prev = null; + item.next = null; + } - return node; - }, - transform_frame: function transform_frame(fn, id) { - Animator.transforms[id] = fn; - }, - timeout: function timeout(fn, delay) { - delay = delay || 0; // Work out when the event should fire +} - var time = Animator.timer.now() + delay; // Add the timeout to the end of the queue +const Animator = { + nextDraw: null, + frames: new Queue(), + timeouts: new Queue(), + timer: globals.window.performance || globals.window.Date, + transforms: [], - var node = Animator.timeouts.push({ - run: fn, - time: time - }); // Request another animation frame if we need one + frame(fn) { + // Store the node + var node = Animator.frames.push({ + run: fn + }); // Request an animation frame if we don't have one - if (Animator.nextDraw === null) { - Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); - } + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } // Return the node so we can remove it easily - return node; - }, - cancelFrame: function cancelFrame(node) { - node != null && Animator.frames.remove(node); - }, - clearTimeout: function clearTimeout(node) { - node != null && Animator.timeouts.remove(node); - }, - _draw: function _draw(now) { - // Run all the timeouts we can run, if they are not ready yet, add them - // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) - var nextTimeout = null; - var lastTimeout = Animator.timeouts.last(); - - while (nextTimeout = Animator.timeouts.shift()) { - // Run the timeout if its time, or push it to the end - if (now >= nextTimeout.time) { - nextTimeout.run(); - } else { - Animator.timeouts.push(nextTimeout); - } // If we hit the last item, we should stop shifting out more items + return node; + }, - if (nextTimeout === lastTimeout) break; - } // Run all of the animation frames + transform_frame(fn, id) { + Animator.transforms[id] = fn; + }, + timeout(fn, delay) { + delay = delay || 0; // Work out when the event should fire - var nextFrame = null; - var lastFrame = Animator.frames.last(); + var time = Animator.timer.now() + delay; // Add the timeout to the end of the queue + + var node = Animator.timeouts.push({ + run: fn, + time: time + }); // Request another animation frame if we need one + + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + + return node; + }, + + cancelFrame(node) { + node != null && Animator.frames.remove(node); + }, + + clearTimeout(node) { + node != null && Animator.timeouts.remove(node); + }, + + _draw(now) { + // Run all the timeouts we can run, if they are not ready yet, add them + // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) + var nextTimeout = null; + var lastTimeout = Animator.timeouts.last(); + + while (nextTimeout = Animator.timeouts.shift()) { + // Run the timeout if its time, or push it to the end + if (now >= nextTimeout.time) { + nextTimeout.run(); + } else { + Animator.timeouts.push(nextTimeout); + } // If we hit the last item, we should stop shifting out more items - while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) { - nextFrame.run(); - } - Animator.transforms.forEach(function (el) { - el(); - }); // If we have remaining timeouts or frames, draw until we don't anymore + if (nextTimeout === lastTimeout) break; + } // Run all of the animation frames - Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() ? globals.window.requestAnimationFrame(Animator._draw) : null; + + var nextFrame = null; + var lastFrame = Animator.frames.last(); + + while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) { + nextFrame.run(); } - }; - var makeSchedule = function makeSchedule(runnerInfo) { - var start = runnerInfo.start; - var duration = runnerInfo.runner.duration(); - var end = start + duration; - return { - start: start, - duration: duration, - end: end, - runner: runnerInfo.runner - }; - }; + Animator.transforms.forEach(function (el) { + el(); + }); // If we have remaining timeouts or frames, draw until we don't anymore + + Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() ? globals.window.requestAnimationFrame(Animator._draw) : null; + } - var defaultSource = function defaultSource() { - var w = globals.window; - return (w.performance || w.Date).now(); +}; + +var makeSchedule = function makeSchedule(runnerInfo) { + var start = runnerInfo.start; + var duration = runnerInfo.runner.duration(); + var end = start + duration; + return { + start: start, + duration: duration, + end: end, + runner: runnerInfo.runner }; +}; - var Timeline = - /*#__PURE__*/ - function (_EventTarget) { - _inherits(Timeline, _EventTarget); +const defaultSource = function defaultSource() { + let w = globals.window; + return (w.performance || w.Date).now(); +}; - // Construct a new timeline on the given element - function Timeline() { - var _this; +class Timeline extends EventTarget { + // Construct a new timeline on the given element + constructor(timeSource = defaultSource) { + super(); + this._timeSource = timeSource; // Store the timing variables - var timeSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSource; + this._startTime = 0; + this._speed = 1.0; // Determines how long a runner is hold in memory. Can be a dt or true/false - _classCallCheck(this, Timeline); + this._persist = 0; // Keep track of the running animations and their starting parameters - _this = _possibleConstructorReturn(this, _getPrototypeOf(Timeline).call(this)); - _this._timeSource = timeSource; // Store the timing variables + this._nextFrame = null; + this._paused = true; + this._runners = []; + this._order = []; + this._time = 0; + this._lastSourceTime = 0; + this._lastStepTime = 0; // Make sure that step is always called in class context - _this._startTime = 0; - _this._speed = 1.0; // Determines how long a runner is hold in memory. Can be a dt or true/false + this._step = this._step.bind(this); + } // schedules a runner on the timeline - _this._persist = 0; // Keep track of the running animations and their starting parameters - _this._nextFrame = null; - _this._paused = true; - _this._runners = []; - _this._order = []; - _this._time = 0; - _this._lastSourceTime = 0; - _this._lastStepTime = 0; // Make sure that step is always called in class context + schedule(runner, delay, when) { + if (runner == null) { + return this._runners.map(makeSchedule).sort(function (a, b) { + return a.runner.id - b.runner.id; + }); + } // The start time for the next animation can either be given explicitly, + // derived from the current timeline time or it can be relative to the + // last start time to chain animations direclty + + + var absoluteStartTime = 0; + var endTime = this.getEndTime(); + delay = delay || 0; // Work out when to start the animation + + if (when == null || when === 'last' || when === 'after') { + // Take the last time and increment + absoluteStartTime = endTime; + } else if (when === 'absolute' || when === 'start') { + absoluteStartTime = delay; + delay = 0; + } else if (when === 'now') { + absoluteStartTime = this._time; + } else if (when === 'relative') { + let runnerInfo = this._runners[runner.id]; + + if (runnerInfo) { + absoluteStartTime = runnerInfo.start + delay; + delay = 0; + } + } else { + throw new Error('Invalid value for the "when" parameter'); + } // Manage runner + - _this._step = _this._step.bind(_assertThisInitialized(_assertThisInitialized(_this))); - return _this; - } // schedules a runner on the timeline + runner.unschedule(); + runner.timeline(this); // runner.time(-delay) + // Save runnerInfo + this._runners[runner.id] = { + persist: this.persist(), + runner: runner, + start: absoluteStartTime + delay // Save order, update Time if needed and continue - _createClass(Timeline, [{ - key: "schedule", - value: function schedule(runner, delay, when) { - if (runner == null) { - return this._runners.map(makeSchedule).sort(function (a, b) { - return a.runner.id - b.runner.id; - }); - } // The start time for the next animation can either be given explicitly, - // derived from the current timeline time or it can be relative to the - // last start time to chain animations direclty - - - var absoluteStartTime = 0; - var endTime = this.getEndTime(); - delay = delay || 0; // Work out when to start the animation - - if (when == null || when === 'last' || when === 'after') { - // Take the last time and increment - absoluteStartTime = endTime; - } else if (when === 'absolute' || when === 'start') { - absoluteStartTime = delay; - delay = 0; - } else if (when === 'now') { - absoluteStartTime = this._time; - } else if (when === 'relative') { - var runnerInfo = this._runners[runner.id]; - - if (runnerInfo) { - absoluteStartTime = runnerInfo.start + delay; - delay = 0; - } - } else { - throw new Error('Invalid value for the "when" parameter'); - } // Manage runner + }; + this._order.push(runner.id); - runner.unschedule(); - runner.timeline(this); // runner.time(-delay) - // Save runnerInfo + this.updateTime()._continue(); - this._runners[runner.id] = { - persist: this.persist(), - runner: runner, - start: absoluteStartTime + delay // Save order, update Time if needed and continue + return this; + } // Remove the runner from this timeline - }; - this._order.push(runner.id); + unschedule(runner) { + var index = this._order.indexOf(runner.id); - this.updateTime()._continue(); + if (index < 0) return this; + delete this._runners[runner.id]; - return this; - } // Remove the runner from this timeline + this._order.splice(index, 1); - }, { - key: "unschedule", - value: function unschedule(runner) { - var index = this._order.indexOf(runner.id); + runner.timeline(null); + return this; + } // Calculates the end of the timeline - if (index < 0) return this; - delete this._runners[runner.id]; - this._order.splice(index, 1); + getEndTime() { + var lastRunnerInfo = this._runners[this._order[this._order.length - 1]]; + var lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0; + var lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : 0; + return lastStartTime + lastDuration; + } // Makes sure, that after pausing the time doesn't jump - runner.timeline(null); - return this; - } // Calculates the end of the timeline - }, { - key: "getEndTime", - value: function getEndTime() { - var lastRunnerInfo = this._runners[this._order[this._order.length - 1]]; - var lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0; - var lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : 0; - return lastStartTime + lastDuration; - } // Makes sure, that after pausing the time doesn't jump + updateTime() { + if (!this.active()) { + this._lastSourceTime = this._timeSource(); + } - }, { - key: "updateTime", - value: function updateTime() { - if (!this.active()) { - this._lastSourceTime = this._timeSource(); - } + return this; + } - return this; - } - }, { - key: "play", - value: function play() { - // Now make sure we are not paused and continue the animation - this._paused = false; - return this.updateTime()._continue(); - } - }, { - key: "pause", - value: function pause() { - this._paused = true; - return this._continue(); - } - }, { - key: "stop", - value: function stop() { - // Go to start and pause - this.time(0); - return this.pause(); - } - }, { - key: "finish", - value: function finish() { - // Go to end and pause - this.time(this.getEndTime() + 1); - return this.pause(); - } - }, { - key: "speed", - value: function speed(_speed) { - if (_speed == null) return this._speed; - this._speed = _speed; - return this; - } - }, { - key: "reverse", - value: function reverse(yes) { - var currentSpeed = this.speed(); - if (yes == null) return this.speed(-currentSpeed); - var positive = Math.abs(currentSpeed); - return this.speed(yes ? positive : -positive); - } - }, { - key: "seek", - value: function seek(dt) { - return this.time(this._time + dt); - } - }, { - key: "time", - value: function time(_time) { - if (_time == null) return this._time; - this._time = _time; - return this._continue(true); - } - }, { - key: "persist", - value: function persist(dtOrForever) { - if (dtOrForever == null) return this._persist; - this._persist = dtOrForever; - return this; - } - }, { - key: "source", - value: function source(fn) { - if (fn == null) return this._timeSource; - this._timeSource = fn; - return this; - } - }, { - key: "_step", - value: function _step() { - var immediateStep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - // Get the time delta from the last time and update the time - var time = this._timeSource(); - - var dtSource = time - this._lastSourceTime; - if (immediateStep) dtSource = 0; - var dtTime = this._speed * dtSource + (this._time - this._lastStepTime); - this._lastSourceTime = time; // Only update the time if we use the timeSource. - // Otherwise use the current time - - if (!immediateStep) { - // Update the time - this._time += dtTime; - this._time = this._time < 0 ? 0 : this._time; - } + play() { + // Now make sure we are not paused and continue the animation + this._paused = false; + return this.updateTime()._continue(); + } - this._lastStepTime = this._time; - this.fire('time', this._time); // Run all of the runners directly + pause() { + this._paused = true; + return this._continue(); + } + + stop() { + // Go to start and pause + this.time(0); + return this.pause(); + } - var runnersLeft = false; + finish() { + // Go to end and pause + this.time(this.getEndTime() + 1); + return this.pause(); + } + + speed(speed) { + if (speed == null) return this._speed; + this._speed = speed; + return this; + } - for (var i = 0, len = this._order.length; i < len; i++) { - // Get and run the current runner and ignore it if its inactive - var runnerInfo = this._runners[this._order[i]]; - var runner = runnerInfo.runner; - var dt = dtTime; // Make sure that we give the actual difference - // between runner start time and now + reverse(yes) { + var currentSpeed = this.speed(); + if (yes == null) return this.speed(-currentSpeed); + var positive = Math.abs(currentSpeed); + return this.speed(yes ? positive : -positive); + } - var dtToStart = this._time - runnerInfo.start; // Dont run runner if not started yet + seek(dt) { + return this.time(this._time + dt); + } - if (dtToStart <= 0) { - runnersLeft = true; // This is for the case that teh timeline was seeked so that the time - // is now before the startTime of the runner. Thats why we need to set - // the runner to position 0 + time(time) { + if (time == null) return this._time; + this._time = time; + return this._continue(true); + } - runner.reset(); - continue; - } else if (dtToStart < dt) { - // Adjust dt to make sure that animation is on point - dt = dtToStart; - } + persist(dtOrForever) { + if (dtOrForever == null) return this._persist; + this._persist = dtOrForever; + return this; + } - if (!runner.active()) continue; // If this runner is still going, signal that we need another animation - // frame, otherwise, remove the completed runner + source(fn) { + if (fn == null) return this._timeSource; + this._timeSource = fn; + return this; + } - var finished = runner.step(dt).done; + _step(immediateStep = false) { + // Get the time delta from the last time and update the time + var time = this._timeSource(); - if (!finished) { - runnersLeft = true; // continue - } else if (runnerInfo.persist !== true) { - // runner is finished. And runner might get removed - var endTime = runner.duration() - runner.time() + this._time; + var dtSource = time - this._lastSourceTime; + if (immediateStep) dtSource = 0; + var dtTime = this._speed * dtSource + (this._time - this._lastStepTime); + this._lastSourceTime = time; // Only update the time if we use the timeSource. + // Otherwise use the current time - if (endTime + this._persist < this._time) { - // Delete runner and correct index - delete this._runners[this._order[i]]; - this._order.splice(i--, 1) && --len; - runner.timeline(null); - } - } - } // Basically: we continue when there are runners right from us in time - // when -->, and when runners are left from us when <-- + if (!immediateStep) { + // Update the time + this._time += dtTime; + this._time = this._time < 0 ? 0 : this._time; + } + this._lastStepTime = this._time; + this.fire('time', this._time); // Run all of the runners directly - if (runnersLeft && !(this._speed < 0 && this._time === 0) || this._order.length && this._speed < 0 && this._time > 0) { - this._continue(); - } else { - this.fire('finished'); - this.pause(); - } + var runnersLeft = false; - return this; - } // Checks if we are running and continues the animation - - }, { - key: "_continue", - value: function _continue() { - var immediateStep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - Animator.cancelFrame(this._nextFrame); - this._nextFrame = null; - if (immediateStep) return this._step(true); - if (this._paused) return this; - this._nextFrame = Animator.frame(this._step); - return this; - } - }, { - key: "active", - value: function active() { - return !!this._nextFrame; + for (var i = 0, len = this._order.length; i < len; i++) { + // Get and run the current runner and ignore it if its inactive + var runnerInfo = this._runners[this._order[i]]; + var runner = runnerInfo.runner; + let dt = dtTime; // Make sure that we give the actual difference + // between runner start time and now + + let dtToStart = this._time - runnerInfo.start; // Dont run runner if not started yet + + if (dtToStart <= 0) { + runnersLeft = true; // This is for the case that teh timeline was seeked so that the time + // is now before the startTime of the runner. Thats why we need to set + // the runner to position 0 + + runner.reset(); + continue; + } else if (dtToStart < dt) { + // Adjust dt to make sure that animation is on point + dt = dtToStart; } - }]); - - return Timeline; - }(EventTarget); - registerMethods({ - Element: { - timeline: function timeline() { - this._timeline = this._timeline || new Timeline(); - return this._timeline; + + if (!runner.active()) continue; // If this runner is still going, signal that we need another animation + // frame, otherwise, remove the completed runner + + var finished = runner.step(dt).done; + + if (!finished) { + runnersLeft = true; // continue + } else if (runnerInfo.persist !== true) { + // runner is finished. And runner might get removed + var endTime = runner.duration() - runner.time() + this._time; + + if (endTime + this._persist < this._time) { + // Delete runner and correct index + delete this._runners[this._order[i]]; + this._order.splice(i--, 1) && --len; + runner.timeline(null); + } } + } // Basically: we continue when there are runners right from us in time + // when -->, and when runners are left from us when <-- + + + if (runnersLeft && !(this._speed < 0 && this._time === 0) || this._order.length && this._speed < 0 && this._time > 0) { + this._continue(); + } else { + this.fire('finished'); + this.pause(); } - }); - var Runner = - /*#__PURE__*/ - function (_EventTarget) { - _inherits(Runner, _EventTarget); + return this; + } // Checks if we are running and continues the animation - function Runner(options) { - var _this; - _classCallCheck(this, Runner); + _continue(immediateStep = false) { + Animator.cancelFrame(this._nextFrame); + this._nextFrame = null; + if (immediateStep) return this._step(true); + if (this._paused) return this; + this._nextFrame = Animator.frame(this._step); + return this; + } - _this = _possibleConstructorReturn(this, _getPrototypeOf(Runner).call(this)); // Store a unique id on the runner, so that we can identify it later + active() { + return !!this._nextFrame; + } - _this.id = Runner.id++; // Ensure a default value +} +registerMethods({ + Element: { + timeline: function timeline() { + this._timeline = this._timeline || new Timeline(); + return this._timeline; + } + } +}); - options = options == null ? timeline.duration : options; // Ensure that we get a controller +class Runner extends EventTarget { + constructor(options) { + super(); // Store a unique id on the runner, so that we can identify it later - options = typeof options === 'function' ? new Controller(options) : options; // Declare all of the variables + this.id = Runner.id++; // Ensure a default value - _this._element = null; - _this._timeline = null; - _this.done = false; - _this._queue = []; // Work out the stepper and the duration + options = options == null ? timeline.duration : options; // Ensure that we get a controller - _this._duration = typeof options === 'number' && options; - _this._isDeclarative = options instanceof Controller; - _this._stepper = _this._isDeclarative ? options : new Ease(); // We copy the current values from the timeline because they can change + options = typeof options === 'function' ? new Controller(options) : options; // Declare all of the variables - _this._history = {}; // Store the state of the runner + this._element = null; + this._timeline = null; + this.done = false; + this._queue = []; // Work out the stepper and the duration - _this.enabled = true; - _this._time = 0; - _this._lastTime = 0; // At creation, the runner is in reseted state + this._duration = typeof options === 'number' && options; + this._isDeclarative = options instanceof Controller; + this._stepper = this._isDeclarative ? options : new Ease(); // We copy the current values from the timeline because they can change - _this._reseted = true; // Save transforms applied to this runner + this._history = {}; // Store the state of the runner - _this.transforms = new Matrix(); - _this.transformId = 1; // Looping variables + this.enabled = true; + this._time = 0; + this._lastTime = 0; // At creation, the runner is in reseted state - _this._haveReversed = false; - _this._reverse = false; - _this._loopsDone = 0; - _this._swing = false; - _this._wait = 0; - _this._times = 1; - return _this; - } - /* - Runner Definitions - ================== - These methods help us define the runtime behaviour of the Runner or they - help us make new runners from the current runner - */ + this._reseted = true; // Save transforms applied to this runner + this.transforms = new Matrix(); + this.transformId = 1; // Looping variables - _createClass(Runner, [{ - key: "element", - value: function element(_element) { - if (_element == null) return this._element; - this._element = _element; + this._haveReversed = false; + this._reverse = false; + this._loopsDone = 0; + this._swing = false; + this._wait = 0; + this._times = 1; + } + /* + Runner Definitions + ================== + These methods help us define the runtime behaviour of the Runner or they + help us make new runners from the current runner + */ - _element._prepareRunner(); - return this; - } - }, { - key: "timeline", - value: function timeline$$1(_timeline) { - // check explicitly for undefined so we can set the timeline to null - if (typeof _timeline === 'undefined') return this._timeline; - this._timeline = _timeline; - return this; - } - }, { - key: "animate", - value: function animate(duration, delay, when) { - var o = Runner.sanitise(duration, delay, when); - var runner = new Runner(o.duration); - if (this._timeline) runner.timeline(this._timeline); - if (this._element) runner.element(this._element); - return runner.loop(o).schedule(delay, when); - } - }, { - key: "schedule", - value: function schedule(timeline$$1, delay, when) { - // The user doesn't need to pass a timeline if we already have one - if (!(timeline$$1 instanceof Timeline)) { - when = delay; - delay = timeline$$1; - timeline$$1 = this.timeline(); - } // If there is no timeline, yell at the user... + element(element) { + if (element == null) return this._element; + this._element = element; + element._prepareRunner(); - if (!timeline$$1) { - throw Error('Runner cannot be scheduled without timeline'); - } // Schedule the runner on the timeline provided + return this; + } + timeline(timeline$$1) { + // check explicitly for undefined so we can set the timeline to null + if (typeof timeline$$1 === 'undefined') return this._timeline; + this._timeline = timeline$$1; + return this; + } - timeline$$1.schedule(this, delay, when); - return this; - } - }, { - key: "unschedule", - value: function unschedule() { - var timeline$$1 = this.timeline(); - timeline$$1 && timeline$$1.unschedule(this); - return this; - } - }, { - key: "loop", - value: function loop(times, swing, wait) { - // Deal with the user passing in an object - if (_typeof(times) === 'object') { - swing = times.swing; - wait = times.wait; - times = times.times; - } // Sanitise the values and store them - - - this._times = times || Infinity; - this._swing = swing || false; - this._wait = wait || 0; - return this; - } - }, { - key: "delay", - value: function delay(_delay) { - return this.animate(0, _delay); - } - /* - Basic Functionality - =================== - These methods allow us to attach basic functions to the runner directly - */ + animate(duration, delay, when) { + var o = Runner.sanitise(duration, delay, when); + var runner = new Runner(o.duration); + if (this._timeline) runner.timeline(this._timeline); + if (this._element) runner.element(this._element); + return runner.loop(o).schedule(delay, when); + } - }, { - key: "queue", - value: function queue(initFn, runFn, retargetFn, isTransform) { - this._queue.push({ - initialiser: initFn || noop, - runner: runFn || noop, - retarget: retargetFn, - isTransform: isTransform, - initialised: false, - finished: false - }); - - var timeline$$1 = this.timeline(); - timeline$$1 && this.timeline()._continue(); - return this; - } - }, { - key: "during", - value: function during(fn) { - return this.queue(null, fn); - } - }, { - key: "after", - value: function after(fn) { - return this.on('finish', fn); - } - /* - Runner animation methods - ======================== - Control how the animation plays - */ + schedule(timeline$$1, delay, when) { + // The user doesn't need to pass a timeline if we already have one + if (!(timeline$$1 instanceof Timeline)) { + when = delay; + delay = timeline$$1; + timeline$$1 = this.timeline(); + } // If there is no timeline, yell at the user... - }, { - key: "time", - value: function time(_time) { - if (_time == null) { - return this._time; - } - var dt = _time - this._time; - this.step(dt); - return this; - } - }, { - key: "duration", - value: function duration() { - return this._times * (this._wait + this._duration) - this._wait; - } - }, { - key: "loops", - value: function loops(p) { - var loopDuration = this._duration + this._wait; - - if (p == null) { - var loopsDone = Math.floor(this._time / loopDuration); - var relativeTime = this._time - loopsDone * loopDuration; - var position = relativeTime / this._duration; - return Math.min(loopsDone + position, this._times); - } + if (!timeline$$1) { + throw Error('Runner cannot be scheduled without timeline'); + } // Schedule the runner on the timeline provided - var whole = Math.floor(p); - var partial = p % 1; - var time = loopDuration * whole + this._duration * partial; - return this.time(time); - } - }, { - key: "position", - value: function position(p) { - // Get all of the variables we need - var x$$1 = this._time; - var d = this._duration; - var w = this._wait; - var t = this._times; - var s = this._swing; - var r = this._reverse; - var position; - - if (p == null) { - /* - This function converts a time to a position in the range [0, 1] - The full explanation can be found in this desmos demonstration - https://www.desmos.com/calculator/u4fbavgche - The logic is slightly simplified here because we can use booleans - */ - // Figure out the value without thinking about the start or end time - var f = function f(x$$1) { - var swinging = s * Math.floor(x$$1 % (2 * (w + d)) / (w + d)); - var backwards = swinging && !r || !swinging && r; - var uncliped = Math.pow(-1, backwards) * (x$$1 % (w + d)) / d + backwards; - var clipped = Math.max(Math.min(uncliped, 1), 0); - return clipped; - }; // Figure out the value by incorporating the start time - - - var endTime = t * (w + d) - w; - position = x$$1 <= 0 ? Math.round(f(1e-5)) : x$$1 < endTime ? f(x$$1) : Math.round(f(endTime - 1e-5)); - return position; - } // Work out the loops done and add the position to the loops done - - - var loopsDone = Math.floor(this.loops()); - var swingForward = s && loopsDone % 2 === 0; - var forwards = swingForward && !r || r && swingForward; - position = loopsDone + (forwards ? p : 1 - p); - return this.loops(position); - } - }, { - key: "progress", - value: function progress(p) { - if (p == null) { - return Math.min(1, this._time / this.duration()); - } - return this.time(p * this.duration()); - } - }, { - key: "step", - value: function step(dt) { - // If we are inactive, this stepper just gets skipped - if (!this.enabled) return this; // Update the time and get the new position + timeline$$1.schedule(this, delay, when); + return this; + } - dt = dt == null ? 16 : dt; - this._time += dt; - var position = this.position(); // Figure out if we need to run the stepper in this frame + unschedule() { + var timeline$$1 = this.timeline(); + timeline$$1 && timeline$$1.unschedule(this); + return this; + } - var running = this._lastPosition !== position && this._time >= 0; - this._lastPosition = position; // Figure out if we just started + loop(times, swing, wait) { + // Deal with the user passing in an object + if (typeof times === 'object') { + swing = times.swing; + wait = times.wait; + times = times.times; + } // Sanitise the values and store them - var duration = this.duration(); - var justStarted = this._lastTime <= 0 && this._time > 0; - var justFinished = this._lastTime < this._time && this.time > duration; - this._lastTime = this._time; - if (justStarted) { - this.fire('start', this); - } // Work out if the runner is finished set the done flag here so animations - // know, that they are running in the last step (this is good for - // transformations which can be merged) + this._times = times || Infinity; + this._swing = swing || false; + this._wait = wait || 0; + return this; + } + delay(delay) { + return this.animate(0, delay); + } + /* + Basic Functionality + =================== + These methods allow us to attach basic functions to the runner directly + */ + + + queue(initFn, runFn, retargetFn, isTransform) { + this._queue.push({ + initialiser: initFn || noop, + runner: runFn || noop, + retarget: retargetFn, + isTransform: isTransform, + initialised: false, + finished: false + }); - var declarative = this._isDeclarative; - this.done = !declarative && !justFinished && this._time >= duration; // Runner is running. So its not in reseted state anymore + var timeline$$1 = this.timeline(); + timeline$$1 && this.timeline()._continue(); + return this; + } - this._reseted = false; // Call initialise and the run function + during(fn) { + return this.queue(null, fn); + } - if (running || declarative) { - this._initialise(running); // clear the transforms on this runner so they dont get added again and again + after(fn) { + return this.on('finish', fn); + } + /* + Runner animation methods + ======================== + Control how the animation plays + */ - this.transforms = new Matrix(); + time(time) { + if (time == null) { + return this._time; + } - var converged = this._run(declarative ? dt : position); + let dt = time - this._time; + this.step(dt); + return this; + } - this.fire('step', this); - } // correct the done flag here - // declaritive animations itself know when they converged + duration() { + return this._times * (this._wait + this._duration) - this._wait; + } + loops(p) { + var loopDuration = this._duration + this._wait; - this.done = this.done || converged && declarative; + if (p == null) { + var loopsDone = Math.floor(this._time / loopDuration); + var relativeTime = this._time - loopsDone * loopDuration; + var position = relativeTime / this._duration; + return Math.min(loopsDone + position, this._times); + } - if (this.done) { - this.fire('finish', this); - } + var whole = Math.floor(p); + var partial = p % 1; + var time = loopDuration * whole + this._duration * partial; + return this.time(time); + } - return this; - } - }, { - key: "reset", - value: function reset() { - if (this._reseted) return this; - this.loops(0); - this._reseted = true; - return this; - } - }, { - key: "finish", - value: function finish() { - return this.step(Infinity); - } - }, { - key: "reverse", - value: function reverse(_reverse) { - this._reverse = _reverse == null ? !this._reverse : _reverse; - return this; - } - }, { - key: "ease", - value: function ease(fn) { - this._stepper = new Ease(fn); - return this; - } - }, { - key: "active", - value: function active(enabled) { - if (enabled == null) return this.enabled; - this.enabled = enabled; - return this; - } + position(p) { + // Get all of the variables we need + var x$$1 = this._time; + var d = this._duration; + var w = this._wait; + var t = this._times; + var s = this._swing; + var r = this._reverse; + var position; + + if (p == null) { /* - Private Methods - =============== - Methods that shouldn't be used externally + This function converts a time to a position in the range [0, 1] + The full explanation can be found in this desmos demonstration + https://www.desmos.com/calculator/u4fbavgche + The logic is slightly simplified here because we can use booleans */ - // Save a morpher to the morpher list so that we can retarget it later + // Figure out the value without thinking about the start or end time + const f = function f(x$$1) { + var swinging = s * Math.floor(x$$1 % (2 * (w + d)) / (w + d)); + var backwards = swinging && !r || !swinging && r; + var uncliped = Math.pow(-1, backwards) * (x$$1 % (w + d)) / d + backwards; + var clipped = Math.max(Math.min(uncliped, 1), 0); + return clipped; + }; // Figure out the value by incorporating the start time + + + var endTime = t * (w + d) - w; + position = x$$1 <= 0 ? Math.round(f(1e-5)) : x$$1 < endTime ? f(x$$1) : Math.round(f(endTime - 1e-5)); + return position; + } // Work out the loops done and add the position to the loops done + + + var loopsDone = Math.floor(this.loops()); + var swingForward = s && loopsDone % 2 === 0; + var forwards = swingForward && !r || r && swingForward; + position = loopsDone + (forwards ? p : 1 - p); + return this.loops(position); + } - }, { - key: "_rememberMorpher", - value: function _rememberMorpher(method, morpher) { - this._history[method] = { - morpher: morpher, - caller: this._queue[this._queue.length - 1] - }; - } // Try to set the target for a morpher if the morpher exists, otherwise - // do nothing and return false + progress(p) { + if (p == null) { + return Math.min(1, this._time / this.duration()); + } - }, { - key: "_tryRetarget", - value: function _tryRetarget(method, target) { - if (this._history[method]) { - // if the last method wasnt even initialised, throw it away - if (!this._history[method].caller.initialised) { - var index = this._queue.indexOf(this._history[method].caller); + return this.time(p * this.duration()); + } - this._queue.splice(index, 1); + step(dt) { + // If we are inactive, this stepper just gets skipped + if (!this.enabled) return this; // Update the time and get the new position - return false; - } // for the case of transformations, we use the special retarget function - // which has access to the outer scope + dt = dt == null ? 16 : dt; + this._time += dt; + var position = this.position(); // Figure out if we need to run the stepper in this frame + var running = this._lastPosition !== position && this._time >= 0; + this._lastPosition = position; // Figure out if we just started - if (this._history[method].caller.retarget) { - this._history[method].caller.retarget(target); // for everything else a simple morpher change is sufficient + var duration = this.duration(); + var justStarted = this._lastTime <= 0 && this._time > 0; + var justFinished = this._lastTime < this._time && this.time > duration; + this._lastTime = this._time; - } else { - this._history[method].morpher.to(target); - } + if (justStarted) { + this.fire('start', this); + } // Work out if the runner is finished set the done flag here so animations + // know, that they are running in the last step (this is good for + // transformations which can be merged) - this._history[method].caller.finished = false; - var timeline$$1 = this.timeline(); - timeline$$1 && timeline$$1._continue(); - return true; - } - return false; - } // Run each initialise function in the runner if required + var declarative = this._isDeclarative; + this.done = !declarative && !justFinished && this._time >= duration; // Runner is running. So its not in reseted state anymore - }, { - key: "_initialise", - value: function _initialise(running) { - // If we aren't running, we shouldn't initialise when not declarative - if (!running && !this._isDeclarative) return; // Loop through all of the initialisers + this._reseted = false; // Call initialise and the run function - for (var i = 0, len = this._queue.length; i < len; ++i) { - // Get the current initialiser - var current = this._queue[i]; // Determine whether we need to initialise + if (running || declarative) { + this._initialise(running); // clear the transforms on this runner so they dont get added again and again - var needsIt = this._isDeclarative || !current.initialised && running; - running = !current.finished; // Call the initialiser if we need to - if (needsIt && running) { - current.initialiser.call(this); - current.initialised = true; - } - } - } // Run each run function for the position or dt given + this.transforms = new Matrix(); - }, { - key: "_run", - value: function _run(positionOrDt) { - // Run all of the _queue directly - var allfinished = true; + var converged = this._run(declarative ? dt : position); - for (var i = 0, len = this._queue.length; i < len; ++i) { - // Get the current function to run - var current = this._queue[i]; // Run the function if its not finished, we keep track of the finished - // flag for the sake of declarative _queue + this.fire('step', this); + } // correct the done flag here + // declaritive animations itself know when they converged - var converged = current.runner.call(this, positionOrDt); - current.finished = current.finished || converged === true; - allfinished = allfinished && current.finished; - } // We report when all of the constructors are finished + this.done = this.done || converged && declarative; - return allfinished; - } - }, { - key: "addTransform", - value: function addTransform(transform, index) { - this.transforms.lmultiplyO(transform); - return this; - } - }, { - key: "clearTransform", - value: function clearTransform() { - this.transforms = new Matrix(); - return this; - } // TODO: Keep track of all transformations so that deletion is faster - - }, { - key: "clearTransformsFromQueue", - value: function clearTransformsFromQueue() { - if (!this.done) { - this._queue = this._queue.filter(function (item) { - return !item.isTransform; - }); - } - } - }], [{ - key: "sanitise", - value: function sanitise(duration, delay, when) { - // Initialise the default parameters - var times = 1; - var swing = false; - var wait = 0; - duration = duration || timeline.duration; - delay = delay || timeline.delay; - when = when || 'last'; // If we have an object, unpack the values - - if (_typeof(duration) === 'object' && !(duration instanceof Stepper)) { - delay = duration.delay || delay; - when = duration.when || when; - swing = duration.swing || swing; - times = duration.times || times; - wait = duration.wait || wait; - duration = duration.duration || timeline.duration; - } + if (this.done) { + this.fire('finish', this); + } - return { - duration: duration, - delay: delay, - swing: swing, - times: times, - wait: wait, - when: when - }; - } - }]); + return this; + } + + reset() { + if (this._reseted) return this; + this.loops(0); + this._reseted = true; + return this; + } - return Runner; - }(EventTarget); - Runner.id = 0; + finish() { + return this.step(Infinity); + } - var FakeRunner = - /*#__PURE__*/ - function () { - function FakeRunner() { - var transforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Matrix(); - var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1; - var done = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + reverse(reverse) { + this._reverse = reverse == null ? !this._reverse : reverse; + return this; + } - _classCallCheck(this, FakeRunner); + ease(fn) { + this._stepper = new Ease(fn); + return this; + } - this.transforms = transforms; - this.id = id; - this.done = done; - } + active(enabled) { + if (enabled == null) return this.enabled; + this.enabled = enabled; + return this; + } + /* + Private Methods + =============== + Methods that shouldn't be used externally + */ + // Save a morpher to the morpher list so that we can retarget it later + + + _rememberMorpher(method, morpher) { + this._history[method] = { + morpher: morpher, + caller: this._queue[this._queue.length - 1] + }; + } // Try to set the target for a morpher if the morpher exists, otherwise + // do nothing and return false - _createClass(FakeRunner, [{ - key: "clearTransformsFromQueue", - value: function clearTransformsFromQueue() {} - }]); - return FakeRunner; - }(); + _tryRetarget(method, target) { + if (this._history[method]) { + // if the last method wasnt even initialised, throw it away + if (!this._history[method].caller.initialised) { + let index = this._queue.indexOf(this._history[method].caller); - extend([Runner, FakeRunner], { - mergeWith: function mergeWith(runner) { - return new FakeRunner(runner.transforms.lmultiply(this.transforms), runner.id); - } - }); // FakeRunner.emptyRunner = new FakeRunner() + this._queue.splice(index, 1); - var lmultiply = function lmultiply(last, curr) { - return last.lmultiplyO(curr); - }; + return false; + } // for the case of transformations, we use the special retarget function + // which has access to the outer scope - var getRunnerTransform = function getRunnerTransform(runner) { - return runner.transforms; - }; - function mergeTransforms() { - // Find the matrix to apply to the element and apply it - var runners = this._transformationRunners.runners; - var netTransform = runners.map(getRunnerTransform).reduce(lmultiply, new Matrix()); - this.transform(netTransform); + if (this._history[method].caller.retarget) { + this._history[method].caller.retarget(target); // for everything else a simple morpher change is sufficient - this._transformationRunners.merge(); + } else { + this._history[method].morpher.to(target); + } - if (this._transformationRunners.length() === 1) { - this._frameId = null; + this._history[method].caller.finished = false; + var timeline$$1 = this.timeline(); + timeline$$1 && timeline$$1._continue(); + return true; } - } - var RunnerArray = - /*#__PURE__*/ - function () { - function RunnerArray() { - _classCallCheck(this, RunnerArray); + return false; + } // Run each initialise function in the runner if required - this.runners = []; - this.ids = []; - } - _createClass(RunnerArray, [{ - key: "add", - value: function add(runner) { - if (this.runners.includes(runner)) return; - var id = runner.id + 1; - var leftSibling = this.ids.reduce(function (last, curr) { - if (curr > last && curr < id) return curr; - return last; - }, 0); - var index = this.ids.indexOf(leftSibling) + 1; - this.ids.splice(index, 0, id); - this.runners.splice(index, 0, runner); - return this; - } - }, { - key: "getByID", - value: function getByID(id) { - return this.runners[this.ids.indexOf(id + 1)]; - } - }, { - key: "remove", - value: function remove(id) { - var index = this.ids.indexOf(id + 1); - this.ids.splice(index, 1); - this.runners.splice(index, 1); - return this; - } - }, { - key: "merge", - value: function merge() { - var _this2 = this; + _initialise(running) { + // If we aren't running, we shouldn't initialise when not declarative + if (!running && !this._isDeclarative) return; // Loop through all of the initialisers - var lastRunner = null; - this.runners.forEach(function (runner, i) { - if (lastRunner && runner.done && lastRunner.done) { - _this2.remove(runner.id); + for (var i = 0, len = this._queue.length; i < len; ++i) { + // Get the current initialiser + var current = this._queue[i]; // Determine whether we need to initialise - _this2.edit(lastRunner.id, runner.mergeWith(lastRunner)); - } + var needsIt = this._isDeclarative || !current.initialised && running; + running = !current.finished; // Call the initialiser if we need to - lastRunner = runner; - }); - return this; - } - }, { - key: "edit", - value: function edit(id, newRunner) { - var index = this.ids.indexOf(id + 1); - this.ids.splice(index, 1, id); - this.runners.splice(index, 1, newRunner); - return this; - } - }, { - key: "length", - value: function length() { - return this.ids.length; - } - }, { - key: "clearBefore", - value: function clearBefore(id) { - var deleteCnt = this.ids.indexOf(id + 1) || 1; - this.ids.splice(0, deleteCnt, 0); - this.runners.splice(0, deleteCnt, new FakeRunner()).forEach(function (r) { - return r.clearTransformsFromQueue(); - }); - return this; - } - }]); - - return RunnerArray; - }(); - - var frameId = 0; - registerMethods({ - Element: { - animate: function animate(duration, delay, when) { - var o = Runner.sanitise(duration, delay, when); - var timeline$$1 = this.timeline(); - return new Runner(o.duration).loop(o).element(this).timeline(timeline$$1.play()).schedule(delay, when); - }, - delay: function delay(by, when) { - return this.animate(0, by, when); - }, - // this function searches for all runners on the element and deletes the ones - // which run before the current one. This is because absolute transformations - // overwfrite anything anyway so there is no need to waste time computing - // other runners - _clearTransformRunnersBefore: function _clearTransformRunnersBefore(currentRunner) { - this._transformationRunners.clearBefore(currentRunner.id); - }, - _currentTransform: function _currentTransform(current) { - return this._transformationRunners.runners // we need the equal sign here to make sure, that also transformations - // on the same runner which execute before the current transformation are - // taken into account - .filter(function (runner) { - return runner.id <= current.id; - }).map(getRunnerTransform).reduce(lmultiply, new Matrix()); - }, - addRunner: function addRunner(runner) { - this._transformationRunners.add(runner); - - Animator.transform_frame(mergeTransforms.bind(this), this._frameId); - }, - _prepareRunner: function _prepareRunner() { - if (this._frameId == null) { - this._transformationRunners = new RunnerArray().add(new FakeRunner(new Matrix(this))); - this._frameId = frameId++; - } + if (needsIt && running) { + current.initialiser.call(this); + current.initialised = true; } } - }); - extend(Runner, { - attr: function attr(a, v) { - return this.styleAttr('attr', a, v); - }, - // Add animatable styles - css: function css(s, v) { - return this.styleAttr('css', s, v); - }, - styleAttr: function styleAttr(type, name, val) { - // apply attributes individually - if (_typeof(name) === 'object') { - for (var key in val) { - this.styleAttr(type, key, val[key]); - } - } + } // Run each run function for the position or dt given - var morpher = new Morphable(this._stepper).to(val); - this.queue(function () { - morpher = morpher.from(this.element()[type](name)); - }, function (pos) { - this.element()[type](name, morpher.at(pos)); - return morpher.done(); - }); - return this; - }, - zoom: function zoom(level, point$$1) { - var morpher = new Morphable(this._stepper).to(new SVGNumber(level)); - this.queue(function () { - morpher = morpher.from(this.zoom()); - }, function (pos) { - this.element().zoom(morpher.at(pos), point$$1); - return morpher.done(); + + _run(positionOrDt) { + // Run all of the _queue directly + var allfinished = true; + + for (var i = 0, len = this._queue.length; i < len; ++i) { + // Get the current function to run + var current = this._queue[i]; // Run the function if its not finished, we keep track of the finished + // flag for the sake of declarative _queue + + var converged = current.runner.call(this, positionOrDt); + current.finished = current.finished || converged === true; + allfinished = allfinished && current.finished; + } // We report when all of the constructors are finished + + + return allfinished; + } + + addTransform(transform, index) { + this.transforms.lmultiplyO(transform); + return this; + } + + clearTransform() { + this.transforms = new Matrix(); + return this; + } // TODO: Keep track of all transformations so that deletion is faster + + + clearTransformsFromQueue() { + if (!this.done) { + this._queue = this._queue.filter(item => { + return !item.isTransform; }); - return this; - }, + } + } - /** - ** absolute transformations - **/ - // - // M v -----|-----(D M v = F v)------|-----> T v - // - // 1. define the final state (T) and decompose it (once) - // t = [tx, ty, the, lam, sy, sx] - // 2. on every frame: pull the current state of all previous transforms - // (M - m can change) - // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] - // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) - // - Note F(0) = M - // - Note F(1) = T - // 4. Now you get the delta matrix as a result: D = F * inv(M) - transform: function transform(transforms, relative, affine) { - // If we have a declarative function, we should retarget it if possible - relative = transforms.relative || relative; - - if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) { - return this; - } // Parse the parameters - - - var isMatrix = Matrix.isMatrixLike(transforms); - affine = transforms.affine != null ? transforms.affine : affine != null ? affine : !isMatrix; // Create a morepher and set its type - - var morpher = new Morphable(this._stepper).type(affine ? TransformBag : Matrix); - var origin; - var element; - var current; - var currentAngle; - var startTransform; - - function setup() { - // make sure element and origin is defined - element = element || this.element(); - origin = origin || getOrigin(transforms, element); - startTransform = new Matrix(relative ? undefined : element); // add the runner to the element so it can merge transformations - - element.addRunner(this); // Deactivate all transforms that have run so far if we are absolute - - if (!relative) { - element._clearTransformRunnersBefore(this); - } - } + static sanitise(duration, delay, when) { + // Initialise the default parameters + var times = 1; + var swing = false; + var wait = 0; + duration = duration || timeline.duration; + delay = delay || timeline.delay; + when = when || 'last'; // If we have an object, unpack the values + + if (typeof duration === 'object' && !(duration instanceof Stepper)) { + delay = duration.delay || delay; + when = duration.when || when; + swing = duration.swing || swing; + times = duration.times || times; + wait = duration.wait || wait; + duration = duration.duration || timeline.duration; + } - function run(pos) { - // clear all other transforms before this in case something is saved - // on this runner. We are absolute. We dont need these! - if (!relative) this.clearTransform(); + return { + duration: duration, + delay: delay, + swing: swing, + times: times, + wait: wait, + when: when + }; + } - var _transform = new Point(origin).transform(element._currentTransform(this)), - x$$1 = _transform.x, - y$$1 = _transform.y; +} +Runner.id = 0; - var target = new Matrix(_objectSpread({}, transforms, { - origin: [x$$1, y$$1] - })); - var start = this._isDeclarative && current ? current : startTransform; +class FakeRunner { + constructor(transforms = new Matrix(), id = -1, done = true) { + this.transforms = transforms; + this.id = id; + this.done = done; + } - if (affine) { - target = target.decompose(x$$1, y$$1); - start = start.decompose(x$$1, y$$1); // Get the current and target angle as it was set + clearTransformsFromQueue() {} - var rTarget = target.rotate; - var rCurrent = start.rotate; // Figure out the shortest path to rotate directly +} - var possibilities = [rTarget - 360, rTarget, rTarget + 360]; - var distances = possibilities.map(function (a) { - return Math.abs(a - rCurrent); - }); - var shortest = Math.min.apply(Math, _toConsumableArray(distances)); - var index = distances.indexOf(shortest); - target.rotate = possibilities[index]; - } +extend([Runner, FakeRunner], { + mergeWith(runner) { + return new FakeRunner(runner.transforms.lmultiply(this.transforms), runner.id); + } - if (relative) { - // we have to be careful here not to overwrite the rotation - // with the rotate method of Matrix - if (!isMatrix) { - target.rotate = transforms.rotate || 0; - } +}); // FakeRunner.emptyRunner = new FakeRunner() - if (this._isDeclarative && currentAngle) { - start.rotate = currentAngle; - } - } +const lmultiply = (last, curr) => last.lmultiplyO(curr); - morpher.from(start); - morpher.to(target); - var affineParameters = morpher.at(pos); - currentAngle = affineParameters.rotate; - current = new Matrix(affineParameters); - this.addTransform(current); - return morpher.done(); - } +const getRunnerTransform = runner => runner.transforms; - function retarget(newTransforms) { - // only get a new origin if it changed since the last call - if ((newTransforms.origin || 'center').toString() !== (transforms.origin || 'center').toString()) { - origin = getOrigin(transforms, element); - } // overwrite the old transformations with the new ones +function mergeTransforms() { + // Find the matrix to apply to the element and apply it + let runners = this._transformationRunners.runners; + let netTransform = runners.map(getRunnerTransform).reduce(lmultiply, new Matrix()); + this.transform(netTransform); + this._transformationRunners.merge(); + + if (this._transformationRunners.length() === 1) { + this._frameId = null; + } +} + +class RunnerArray { + constructor() { + this.runners = []; + this.ids = []; + } + + add(runner) { + if (this.runners.includes(runner)) return; + let id = runner.id + 1; + let leftSibling = this.ids.reduce((last, curr) => { + if (curr > last && curr < id) return curr; + return last; + }, 0); + let index = this.ids.indexOf(leftSibling) + 1; + this.ids.splice(index, 0, id); + this.runners.splice(index, 0, runner); + return this; + } + + getByID(id) { + return this.runners[this.ids.indexOf(id + 1)]; + } + + remove(id) { + let index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1); + this.runners.splice(index, 1); + return this; + } - transforms = _objectSpread({}, newTransforms, { - origin: origin - }); + merge() { + let lastRunner = null; + this.runners.forEach((runner, i) => { + if (lastRunner && runner.done && lastRunner.done) { + this.remove(runner.id); + this.edit(lastRunner.id, runner.mergeWith(lastRunner)); } - this.queue(setup, run, retarget, true); - this._isDeclarative && this._rememberMorpher('transform', morpher); - return this; - }, - // Animatable x-axis - x: function x$$1(_x, relative) { - return this._queueNumber('x', _x); - }, - // Animatable y-axis - y: function y$$1(_y) { - return this._queueNumber('y', _y); - }, - dx: function dx(x$$1) { - return this._queueNumberDelta('x', x$$1); - }, - dy: function dy(y$$1) { - return this._queueNumberDelta('y', y$$1); - }, - _queueNumberDelta: function _queueNumberDelta(method, to$$1) { - to$$1 = new SVGNumber(to$$1); // Try to change the target if we have this method already registerd - - if (this._tryRetarget(method, to$$1)) return this; // Make a morpher and queue the animation - - var morpher = new Morphable(this._stepper).to(to$$1); - var from$$1 = null; - this.queue(function () { - from$$1 = this.element()[method](); - morpher.from(from$$1); - morpher.to(from$$1 + to$$1); - }, function (pos) { - this.element()[method](morpher.at(pos)); - return morpher.done(); - }, function (newTo) { - morpher.to(from$$1 + new SVGNumber(newTo)); - }); // Register the morpher so that if it is changed again, we can retarget it - - this._rememberMorpher(method, morpher); + lastRunner = runner; + }); + return this; + } - return this; - }, - _queueObject: function _queueObject(method, to$$1) { - // Try to change the target if we have this method already registerd - if (this._tryRetarget(method, to$$1)) return this; // Make a morpher and queue the animation + edit(id, newRunner) { + let index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1, id); + this.runners.splice(index, 1, newRunner); + return this; + } - var morpher = new Morphable(this._stepper).to(to$$1); - this.queue(function () { - morpher.from(this.element()[method]()); - }, function (pos) { - this.element()[method](morpher.at(pos)); - return morpher.done(); - }); // Register the morpher so that if it is changed again, we can retarget it + length() { + return this.ids.length; + } - this._rememberMorpher(method, morpher); + clearBefore(id) { + let deleteCnt = this.ids.indexOf(id + 1) || 1; + this.ids.splice(0, deleteCnt, 0); + this.runners.splice(0, deleteCnt, new FakeRunner()).forEach(r => r.clearTransformsFromQueue()); + return this; + } - return this; - }, - _queueNumber: function _queueNumber(method, value) { - return this._queueObject(method, new SVGNumber(value)); +} + +let frameId = 0; +registerMethods({ + Element: { + animate(duration, delay, when) { + var o = Runner.sanitise(duration, delay, when); + var timeline$$1 = this.timeline(); + return new Runner(o.duration).loop(o).element(this).timeline(timeline$$1.play()).schedule(delay, when); }, - // Animatable center x-axis - cx: function cx$$1(x$$1) { - return this._queueNumber('cx', x$$1); + + delay(by, when) { + return this.animate(0, by, when); }, - // Animatable center y-axis - cy: function cy$$1(y$$1) { - return this._queueNumber('cy', y$$1); + + // this function searches for all runners on the element and deletes the ones + // which run before the current one. This is because absolute transformations + // overwfrite anything anyway so there is no need to waste time computing + // other runners + _clearTransformRunnersBefore(currentRunner) { + this._transformationRunners.clearBefore(currentRunner.id); }, - // Add animatable move - move: function move(x$$1, y$$1) { - return this.x(x$$1).y(y$$1); + + _currentTransform(current) { + return this._transformationRunners.runners // we need the equal sign here to make sure, that also transformations + // on the same runner which execute before the current transformation are + // taken into account + .filter(runner => runner.id <= current.id).map(getRunnerTransform).reduce(lmultiply, new Matrix()); }, - // Add animatable center - center: function center(x$$1, y$$1) { - return this.cx(x$$1).cy(y$$1); + + addRunner(runner) { + this._transformationRunners.add(runner); + + Animator.transform_frame(mergeTransforms.bind(this), this._frameId); }, - // Add animatable size - size: function size(width$$1, height$$1) { - // animate bbox based size for all other elements - var box; - if (!width$$1 || !height$$1) { - box = this._element.bbox(); + _prepareRunner() { + if (this._frameId == null) { + this._transformationRunners = new RunnerArray().add(new FakeRunner(new Matrix(this))); + this._frameId = frameId++; } + } - if (!width$$1) { - width$$1 = box.width / box.height * height$$1; + } +}); +extend(Runner, { + attr(a, v) { + return this.styleAttr('attr', a, v); + }, + + // Add animatable styles + css(s, v) { + return this.styleAttr('css', s, v); + }, + + styleAttr(type, name, val) { + // apply attributes individually + if (typeof name === 'object') { + for (var key in val) { + this.styleAttr(type, key, val[key]); } + } + + var morpher = new Morphable(this._stepper).to(val); + this.queue(function () { + morpher = morpher.from(this.element()[type](name)); + }, function (pos) { + this.element()[type](name, morpher.at(pos)); + return morpher.done(); + }); + return this; + }, + + zoom(level, point$$1) { + var morpher = new Morphable(this._stepper).to(new SVGNumber(level)); + this.queue(function () { + morpher = morpher.from(this.zoom()); + }, function (pos) { + this.element().zoom(morpher.at(pos), point$$1); + return morpher.done(); + }); + return this; + }, + + /** + ** absolute transformations + **/ + // + // M v -----|-----(D M v = F v)------|-----> T v + // + // 1. define the final state (T) and decompose it (once) + // t = [tx, ty, the, lam, sy, sx] + // 2. on every frame: pull the current state of all previous transforms + // (M - m can change) + // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] + // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) + // - Note F(0) = M + // - Note F(1) = T + // 4. Now you get the delta matrix as a result: D = F * inv(M) + transform(transforms, relative, affine) { + // If we have a declarative function, we should retarget it if possible + relative = transforms.relative || relative; + + if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) { + return this; + } // Parse the parameters + + + var isMatrix = Matrix.isMatrixLike(transforms); + affine = transforms.affine != null ? transforms.affine : affine != null ? affine : !isMatrix; // Create a morepher and set its type + + const morpher = new Morphable(this._stepper).type(affine ? TransformBag : Matrix); + let origin; + let element; + let current; + let currentAngle; + let startTransform; - if (!height$$1) { - height$$1 = box.height / box.width * width$$1; + function setup() { + // make sure element and origin is defined + element = element || this.element(); + origin = origin || getOrigin(transforms, element); + startTransform = new Matrix(relative ? undefined : element); // add the runner to the element so it can merge transformations + + element.addRunner(this); // Deactivate all transforms that have run so far if we are absolute + + if (!relative) { + element._clearTransformRunnersBefore(this); } + } - return this.width(width$$1).height(height$$1); - }, - // Add animatable width - width: function width$$1(_width) { - return this._queueNumber('width', _width); - }, - // Add animatable height - height: function height$$1(_height) { - return this._queueNumber('height', _height); - }, - // Add animatable plot - plot: function plot(a, b, c, d) { - // Lines can be plotted with 4 arguments - if (arguments.length === 4) { - return this.plot([a, b, c, d]); + function run(pos) { + // clear all other transforms before this in case something is saved + // on this runner. We are absolute. We dont need these! + if (!relative) this.clearTransform(); + + let _transform = new Point(origin).transform(element._currentTransform(this)), + x$$1 = _transform.x, + y$$1 = _transform.y; + + let target = new Matrix(_objectSpread({}, transforms, { + origin: [x$$1, y$$1] + })); + let start = this._isDeclarative && current ? current : startTransform; + + if (affine) { + target = target.decompose(x$$1, y$$1); + start = start.decompose(x$$1, y$$1); // Get the current and target angle as it was set + + const rTarget = target.rotate; + const rCurrent = start.rotate; // Figure out the shortest path to rotate directly + + const possibilities = [rTarget - 360, rTarget, rTarget + 360]; + const distances = possibilities.map(a => Math.abs(a - rCurrent)); + const shortest = Math.min(...distances); + const index = distances.indexOf(shortest); + target.rotate = possibilities[index]; } - var morpher = this._element.MorphArray().to(a); + if (relative) { + // we have to be careful here not to overwrite the rotation + // with the rotate method of Matrix + if (!isMatrix) { + target.rotate = transforms.rotate || 0; + } - this.queue(function () { - morpher.from(this._element.array()); - }, function (pos) { - this._element.plot(morpher.at(pos)); - }); - return this; - }, - // Add leading method - leading: function leading(value) { - return this._queueNumber('leading', value); - }, - // Add animatable viewbox - viewbox: function viewbox(x$$1, y$$1, width$$1, height$$1) { - return this._queueObject('viewbox', new Box(x$$1, y$$1, width$$1, height$$1)); - }, - update: function update(o) { - if (_typeof(o) !== 'object') { - return this.update({ - offset: arguments[0], - color: arguments[1], - opacity: arguments[2] - }); + if (this._isDeclarative && currentAngle) { + start.rotate = currentAngle; + } } - if (o.opacity != null) this.attr('stop-opacity', o.opacity); - if (o.color != null) this.attr('stop-color', o.color); - if (o.offset != null) this.attr('offset', o.offset); - return this; + morpher.from(start); + morpher.to(target); + let affineParameters = morpher.at(pos); + currentAngle = affineParameters.rotate; + current = new Matrix(affineParameters); + this.addTransform(current); + return morpher.done(); } - }); - extend(Runner, { - rx: rx, - ry: ry, - from: from, - to: to - }); - var Svg$1 = - /*#__PURE__*/ - function (_Container) { - _inherits(Svg, _Container); + function retarget(newTransforms) { + // only get a new origin if it changed since the last call + if ((newTransforms.origin || 'center').toString() !== (transforms.origin || 'center').toString()) { + origin = getOrigin(transforms, element); + } // overwrite the old transformations with the new ones - function Svg(node) { - var _this; - _classCallCheck(this, Svg); + transforms = _objectSpread({}, newTransforms, { + origin + }); + } - _this = _possibleConstructorReturn(this, _getPrototypeOf(Svg).call(this, nodeOrNew('svg', node), node)); + this.queue(setup, run, retarget, true); + this._isDeclarative && this._rememberMorpher('transform', morpher); + return this; + }, + + // Animatable x-axis + x(x$$1, relative) { + return this._queueNumber('x', x$$1); + }, + + // Animatable y-axis + y(y$$1) { + return this._queueNumber('y', y$$1); + }, + + dx(x$$1) { + return this._queueNumberDelta('x', x$$1); + }, + + dy(y$$1) { + return this._queueNumberDelta('y', y$$1); + }, + + _queueNumberDelta(method, to$$1) { + to$$1 = new SVGNumber(to$$1); // Try to change the target if we have this method already registerd + + if (this._tryRetarget(method, to$$1)) return this; // Make a morpher and queue the animation + + var morpher = new Morphable(this._stepper).to(to$$1); + var from$$1 = null; + this.queue(function () { + from$$1 = this.element()[method](); + morpher.from(from$$1); + morpher.to(from$$1 + to$$1); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }, function (newTo) { + morpher.to(from$$1 + new SVGNumber(newTo)); + }); // Register the morpher so that if it is changed again, we can retarget it + + this._rememberMorpher(method, morpher); - _this.namespace(); + return this; + }, - return _this; + _queueObject(method, to$$1) { + // Try to change the target if we have this method already registerd + if (this._tryRetarget(method, to$$1)) return this; // Make a morpher and queue the animation + + var morpher = new Morphable(this._stepper).to(to$$1); + this.queue(function () { + morpher.from(this.element()[method]()); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }); // Register the morpher so that if it is changed again, we can retarget it + + this._rememberMorpher(method, morpher); + + return this; + }, + + _queueNumber(method, value) { + return this._queueObject(method, new SVGNumber(value)); + }, + + // Animatable center x-axis + cx(x$$1) { + return this._queueNumber('cx', x$$1); + }, + + // Animatable center y-axis + cy(y$$1) { + return this._queueNumber('cy', y$$1); + }, + + // Add animatable move + move(x$$1, y$$1) { + return this.x(x$$1).y(y$$1); + }, + + // Add animatable center + center(x$$1, y$$1) { + return this.cx(x$$1).cy(y$$1); + }, + + // Add animatable size + size(width$$1, height$$1) { + // animate bbox based size for all other elements + var box; + + if (!width$$1 || !height$$1) { + box = this._element.bbox(); } - _createClass(Svg, [{ - key: "isRoot", - value: function isRoot() { - return !this.node.parentNode || !(this.node.parentNode instanceof globals.window.SVGElement) || this.node.parentNode.nodeName === '#document'; - } // Check if this is a root svg - // If not, call docs from this element - - }, { - key: "root", - value: function root$$1() { - if (this.isRoot()) return this; - return _get(_getPrototypeOf(Svg.prototype), "root", this).call(this); - } // Add namespaces - - }, { - key: "namespace", - value: function namespace() { - if (!this.isRoot()) return this.root().namespace(); - return this.attr({ - xmlns: ns, - version: '1.1' - }).attr('xmlns:xlink', xlink, xmlns).attr('xmlns:svgjs', svgjs, xmlns); - } // Creates and returns defs element - - }, { - key: "defs", - value: function defs() { - if (!this.isRoot()) return this.root().defs(); - return adopt(this.node.getElementsByTagName('defs')[0]) || this.put(new Defs()); - } // custom parent method - - }, { - key: "parent", - value: function parent(type) { - if (this.isRoot()) { - return this.node.parentNode.nodeName === '#document' ? null : adopt(this.node.parentNode); - } + if (!width$$1) { + width$$1 = box.width / box.height * height$$1; + } - return _get(_getPrototypeOf(Svg.prototype), "parent", this).call(this, type); - } - }, { - key: "clear", - value: function clear() { - // remove children - while (this.node.hasChildNodes()) { - this.node.removeChild(this.node.lastChild); - } + if (!height$$1) { + height$$1 = box.height / box.width * width$$1; + } - return this; - } - }]); - - return Svg; - }(Container); - registerMethods({ - Container: { - // Create nested svg document - nested: wrapWithAttrCheck(function () { - return this.put(new Svg$1()); - }) + return this.width(width$$1).height(height$$1); + }, + + // Add animatable width + width(width$$1) { + return this._queueNumber('width', width$$1); + }, + + // Add animatable height + height(height$$1) { + return this._queueNumber('height', height$$1); + }, + + // Add animatable plot + plot(a, b, c, d) { + // Lines can be plotted with 4 arguments + if (arguments.length === 4) { + return this.plot([a, b, c, d]); } - }); - register(Svg$1, 'Svg', true); - function plain(text) { - // clear if build mode is disabled - if (this._build === false) { - this.clear(); - } // create text node + var morpher = this._element.MorphArray().to(a); + this.queue(function () { + morpher.from(this._element.array()); + }, function (pos) { + this._element.plot(morpher.at(pos)); + }); + return this; + }, + + // Add leading method + leading(value) { + return this._queueNumber('leading', value); + }, + + // Add animatable viewbox + viewbox(x$$1, y$$1, width$$1, height$$1) { + return this._queueObject('viewbox', new Box(x$$1, y$$1, width$$1, height$$1)); + }, + + update(o) { + if (typeof o !== 'object') { + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }); + } - this.node.appendChild(globals.document.createTextNode(text)); + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', o.offset); return this; - } // Get length of text element + } - function length() { - return this.node.getComputedTextLength(); +}); +extend(Runner, { + rx, + ry, + from, + to +}); + +class Svg$1 extends Container { + constructor(node) { + super(nodeOrNew('svg', node), node); + this.namespace(); } - var textable = /*#__PURE__*/Object.freeze({ - plain: plain, - length: length - }); + isRoot() { + return !this.node.parentNode || !(this.node.parentNode instanceof globals.window.SVGElement) || this.node.parentNode.nodeName === '#document'; + } // Check if this is a root svg + // If not, call docs from this element - var Text = - /*#__PURE__*/ - function (_Shape) { - _inherits(Text, _Shape); - // Initialize node - function Text(node) { - var _this; + root() { + if (this.isRoot()) return this; + return super.root(); + } // Add namespaces - _classCallCheck(this, Text); - _this = _possibleConstructorReturn(this, _getPrototypeOf(Text).call(this, nodeOrNew('text', node), node)); - _this.dom.leading = new SVGNumber(1.3); // store leading value for rebuilding + namespace() { + if (!this.isRoot()) return this.root().namespace(); + return this.attr({ + xmlns: ns, + version: '1.1' + }).attr('xmlns:xlink', xlink, xmlns).attr('xmlns:svgjs', svgjs, xmlns); + } // Creates and returns defs element - _this._rebuild = true; // enable automatic updating of dy values - _this._build = false; // disable build mode for adding multiple lines - // set default font + defs() { + if (!this.isRoot()) return this.root().defs(); + return adopt(this.node.getElementsByTagName('defs')[0]) || this.put(new Defs()); + } // custom parent method - _this.attr('font-family', attrs['font-family']); - return _this; - } // Move over x-axis + parent(type) { + if (this.isRoot()) { + return this.node.parentNode.nodeName === '#document' ? null : adopt(this.node.parentNode); + } + return super.parent(type); + } - _createClass(Text, [{ - key: "x", - value: function x(_x) { - // act as getter - if (_x == null) { - return this.attr('x'); - } + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } - return this.attr('x', _x); - } // Move over y-axis + return this; + } - }, { - key: "y", - value: function y(_y) { - var oy = this.attr('y'); - var o = typeof oy === 'number' ? oy - this.bbox().y : 0; // act as getter +} +registerMethods({ + Container: { + // Create nested svg document + nested: wrapWithAttrCheck(function () { + return this.put(new Svg$1()); + }) + } +}); +register(Svg$1, 'Svg', true); - if (_y == null) { - return typeof oy === 'number' ? oy - o : oy; - } +class Symbol extends Container { + // Initialize node + constructor(node) { + super(nodeOrNew('symbol', node), node); + } - return this.attr('y', typeof _y === 'number' ? _y + o : _y); - } // Move center over x-axis +} +registerMethods({ + Container: { + symbol: wrapWithAttrCheck(function () { + return this.put(new Symbol()); + }) + } +}); +register(Symbol); - }, { - key: "cx", - value: function cx(x) { - return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2); - } // Move center over y-axis +function plain(text) { + // clear if build mode is disabled + if (this._build === false) { + this.clear(); + } // create text node - }, { - key: "cy", - value: function cy(y) { - return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2); - } // Set the text content - }, { - key: "text", - value: function text(_text) { - // act as getter - if (_text === undefined) { - var children = this.node.childNodes; - var firstLine = 0; - _text = ''; + this.node.appendChild(globals.document.createTextNode(text)); + return this; +} // Get length of text element - for (var i = 0, len = children.length; i < len; ++i) { - // skip textPaths - they are no lines - if (children[i].nodeName === 'textPath') { - if (i === 0) firstLine = 1; - continue; - } // add newline if its not the first child and newLined is set to true +function length() { + return this.node.getComputedTextLength(); +} +var textable = /*#__PURE__*/Object.freeze({ + plain: plain, + length: length +}); - if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) { - _text += '\n'; - } // add content of this node +class Text extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('text', node), node); + this.dom.leading = new SVGNumber(1.3); // store leading value for rebuilding + this._rebuild = true; // enable automatic updating of dy values - _text += children[i].textContent; - } + this._build = false; // disable build mode for adding multiple lines + // set default font - return _text; - } // remove existing content + this.attr('font-family', attrs['font-family']); + } // Move over x-axis - this.clear().build(true); + x(x) { + // act as getter + if (x == null) { + return this.attr('x'); + } - if (typeof _text === 'function') { - // call block - _text.call(this, this); - } else { - // store text and make sure text is not blank - _text = _text.split('\n'); // build new lines + return this.attr('x', x); + } // Move over y-axis - for (var j = 0, jl = _text.length; j < jl; j++) { - this.tspan(_text[j]).newLine(); - } - } // disable build mode and rebuild lines - - - return this.build(false).rebuild(); - } // Set / get leading - - }, { - key: "leading", - value: function leading(value) { - // act as getter - if (value == null) { - return this.dom.leading; - } // act as setter - - - this.dom.leading = new SVGNumber(value); - return this.rebuild(); - } // Rebuild appearance type - - }, { - key: "rebuild", - value: function rebuild(_rebuild) { - // store new rebuild flag if given - if (typeof _rebuild === 'boolean') { - this._rebuild = _rebuild; - } // define position of all lines - - - if (this._rebuild) { - var self = this; - var blankLineOffset = 0; - var leading = this.dom.leading; - this.each(function () { - var fontSize = globals.window.getComputedStyle(this.node).getPropertyValue('font-size'); - var dy = leading * new SVGNumber(fontSize); - - if (this.dom.newLined) { - this.attr('x', self.attr('x')); - - if (this.text() === '\n') { - blankLineOffset += dy; - } else { - this.attr('dy', dy + blankLineOffset); - blankLineOffset = 0; - } - } - }); - this.fire('rebuild'); - } - return this; - } // Enable / disable build mode - - }, { - key: "build", - value: function build(_build) { - this._build = !!_build; - return this; - } // overwrite method from parent to set data properly - - }, { - key: "setData", - value: function setData(o) { - this.dom = o; - this.dom.leading = new SVGNumber(o.leading || 1.3); - return this; - } - }]); - - return Text; - }(Shape); - extend(Text, textable); - registerMethods({ - Container: { - // Create text element - text: wrapWithAttrCheck(function (text) { - return this.put(new Text()).text(text); - }), - // Create plain text element - plain: wrapWithAttrCheck(function (text) { - return this.put(new Text()).plain(text); - }) + y(y) { + var oy = this.attr('y'); + var o = typeof oy === 'number' ? oy - this.bbox().y : 0; // act as getter + + if (y == null) { + return typeof oy === 'number' ? oy - o : oy; } - }); - register(Text); - - var Tspan = - /*#__PURE__*/ - function (_Text) { - _inherits(Tspan, _Text); - - // Initialize node - function Tspan(node) { - _classCallCheck(this, Tspan); - - return _possibleConstructorReturn(this, _getPrototypeOf(Tspan).call(this, nodeOrNew('tspan', node), node)); - } // Set text content - - - _createClass(Tspan, [{ - key: "text", - value: function text(_text) { - if (_text == null) return this.node.textContent + (this.dom.newLined ? '\n' : ''); - typeof _text === 'function' ? _text.call(this, this) : this.plain(_text); - return this; - } // Shortcut dx - - }, { - key: "dx", - value: function dx(_dx) { - return this.attr('dx', _dx); - } // Shortcut dy - - }, { - key: "dy", - value: function dy(_dy) { - return this.attr('dy', _dy); - } // Create new line - - }, { - key: "newLine", - value: function newLine() { - // fetch text parent - var t = this.parent(Text); // mark new line - - this.dom.newLined = true; // apply new position - - return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x()); - } - }]); - return Tspan; - }(Text); - extend(Tspan, textable); - registerMethods({ - Tspan: { - tspan: wrapWithAttrCheck(function (text) { - var tspan = new Tspan(); // clear if build mode is disabled + return this.attr('y', typeof y === 'number' ? y + o : y); + } // Move center over x-axis - if (!this._build) { - this.clear(); - } // add new tspan + cx(x) { + return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2); + } // Move center over y-axis - this.node.appendChild(tspan.node); - return tspan.text(text); - }) - } - }); - register(Tspan); - var ClipPath = - /*#__PURE__*/ - function (_Container) { - _inherits(ClipPath, _Container); + cy(y) { + return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2); + } // Set the text content - function ClipPath(node) { - _classCallCheck(this, ClipPath); - return _possibleConstructorReturn(this, _getPrototypeOf(ClipPath).call(this, nodeOrNew('clipPath', node), node)); - } // Unclip all clipped elements and remove itself + text(text) { + // act as getter + if (text === undefined) { + var children = this.node.childNodes; + var firstLine = 0; + text = ''; + for (var i = 0, len = children.length; i < len; ++i) { + // skip textPaths - they are no lines + if (children[i].nodeName === 'textPath') { + if (i === 0) firstLine = 1; + continue; + } // add newline if its not the first child and newLined is set to true - _createClass(ClipPath, [{ - key: "remove", - value: function remove() { - // unclip all targets - this.targets().forEach(function (el) { - el.unclip(); - }); // remove clipPath from parent - return _get(_getPrototypeOf(ClipPath.prototype), "remove", this).call(this); - } - }, { - key: "targets", - value: function targets() { - return baseFind('svg [clip-path*="' + this.id() + '"]'); + if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) { + text += '\n'; + } // add content of this node + + + text += children[i].textContent; } - }]); - - return ClipPath; - }(Container); - registerMethods({ - Container: { - // Create clipping element - clip: wrapWithAttrCheck(function () { - return this.defs().put(new ClipPath()); - }) - }, - Element: { - // Distribute clipPath to svg element - clipWith: function clipWith(element) { - // use given clip or create a new one - var clipper = element instanceof ClipPath ? element : this.parent().clip().add(element); // apply mask - - return this.attr('clip-path', 'url("#' + clipper.id() + '")'); - }, - // Unclip element - unclip: function unclip() { - return this.attr('clip-path', null); - }, - clipper: function clipper() { - return this.reference('clip-path'); + + return text; + } // remove existing content + + + this.clear().build(true); + + if (typeof text === 'function') { + // call block + text.call(this, this); + } else { + // store text and make sure text is not blank + text = text.split('\n'); // build new lines + + for (var j = 0, jl = text.length; j < jl; j++) { + this.tspan(text[j]).newLine(); } - } - }); - register(ClipPath); + } // disable build mode and rebuild lines - var G = - /*#__PURE__*/ - function (_Container) { - _inherits(G, _Container); - function G(node) { - _classCallCheck(this, G); + return this.build(false).rebuild(); + } // Set / get leading - return _possibleConstructorReturn(this, _getPrototypeOf(G).call(this, nodeOrNew('g', node), node)); - } - return G; - }(Container); - registerMethods({ - Element: { - // Create a group element - group: wrapWithAttrCheck(function () { - return this.put(new G()); - }) - } - }); - register(G); + leading(value) { + // act as getter + if (value == null) { + return this.dom.leading; + } // act as setter - var A = - /*#__PURE__*/ - function (_Container) { - _inherits(A, _Container); - function A(node) { - _classCallCheck(this, A); + this.dom.leading = new SVGNumber(value); + return this.rebuild(); + } // Rebuild appearance type - return _possibleConstructorReturn(this, _getPrototypeOf(A).call(this, nodeOrNew('a', node), node)); - } // Link url + rebuild(rebuild) { + // store new rebuild flag if given + if (typeof rebuild === 'boolean') { + this._rebuild = rebuild; + } // define position of all lines - _createClass(A, [{ - key: "to", - value: function to(url) { - return this.attr('href', url, xlink); - } // Link target attribute - }, { - key: "target", - value: function target(_target) { - return this.attr('target', _target); - } - }]); - - return A; - }(Container); - registerMethods({ - Container: { - // Create a hyperlink element - link: wrapWithAttrCheck(function (url) { - return this.put(new A()).to(url); - }) - }, - Element: { - // Create a hyperlink element - linkTo: function linkTo(url) { - var link = new A(); + if (this._rebuild) { + var self = this; + var blankLineOffset = 0; + var leading = this.dom.leading; + this.each(function () { + var fontSize = globals.window.getComputedStyle(this.node).getPropertyValue('font-size'); + var dy = leading * new SVGNumber(fontSize); - if (typeof url === 'function') { - url.call(link, link); - } else { - link.to(url); - } + if (this.dom.newLined) { + this.attr('x', self.attr('x')); - return this.parent().put(link).put(this); - } + if (this.text() === '\n') { + blankLineOffset += dy; + } else { + this.attr('dy', dy + blankLineOffset); + blankLineOffset = 0; + } + } + }); + this.fire('rebuild'); } - }); - register(A); - var Mask = - /*#__PURE__*/ - function (_Container) { - _inherits(Mask, _Container); + return this; + } // Enable / disable build mode - // Initialize node - function Mask(node) { - _classCallCheck(this, Mask); - return _possibleConstructorReturn(this, _getPrototypeOf(Mask).call(this, nodeOrNew('mask', node), node)); - } // Unmask all masked elements and remove itself + build(build) { + this._build = !!build; + return this; + } // overwrite method from parent to set data properly - _createClass(Mask, [{ - key: "remove", - value: function remove() { - // unmask all targets - this.targets().forEach(function (el) { - el.unmask(); - }); // remove mask from parent + setData(o) { + this.dom = o; + this.dom.leading = new SVGNumber(o.leading || 1.3); + return this; + } - return _get(_getPrototypeOf(Mask.prototype), "remove", this).call(this); - } - }, { - key: "targets", - value: function targets() { - return baseFind('svg [mask*="' + this.id() + '"]'); - } - }]); - - return Mask; - }(Container); - registerMethods({ - Container: { - mask: wrapWithAttrCheck(function () { - return this.defs().put(new Mask()); - }) - }, - Element: { - // Distribute mask to svg element - maskWith: function maskWith(element) { - // use given mask or create a new one - var masker = element instanceof Mask ? element : this.parent().mask().add(element); // apply mask - - return this.attr('mask', 'url("#' + masker.id() + '")'); - }, - // Unmask element - unmask: function unmask() { - return this.attr('mask', null); - }, - masker: function masker() { - return this.reference('mask'); - } - } - }); - register(Mask); +} +extend(Text, textable); +registerMethods({ + Container: { + // Create text element + text: wrapWithAttrCheck(function (text) { + return this.put(new Text()).text(text); + }), + // Create plain text element + plain: wrapWithAttrCheck(function (text) { + return this.put(new Text()).plain(text); + }) + } +}); +register(Text); - function cssRule(selector, rule) { - if (!selector) return ''; - if (!rule) return selector; - var ret = selector + '{'; +class Tspan extends Text { + // Initialize node + constructor(node) { + super(nodeOrNew('tspan', node), node); + } // Set text content - for (var i in rule) { - ret += unCamelCase(i) + ':' + rule[i] + ';'; - } - ret += '}'; - return ret; + text(text) { + if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : ''); + typeof text === 'function' ? text.call(this, this) : this.plain(text); + return this; + } // Shortcut dx + + + dx(dx) { + return this.attr('dx', dx); + } // Shortcut dy + + + dy(dy) { + return this.attr('dy', dy); + } // Create new line + + + newLine() { + // fetch text parent + var t = this.parent(Text); // mark new line + + this.dom.newLined = true; // apply new position + + return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x()); + } + +} +extend(Tspan, textable); +registerMethods({ + Tspan: { + tspan: wrapWithAttrCheck(function (text) { + var tspan = new Tspan(); // clear if build mode is disabled + + if (!this._build) { + this.clear(); + } // add new tspan + + + this.node.appendChild(tspan.node); + return tspan.text(text); + }) + } +}); +register(Tspan); + +class ClipPath extends Container { + constructor(node) { + super(nodeOrNew('clipPath', node), node); + } // Unclip all clipped elements and remove itself + + + remove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unclip(); + }); // remove clipPath from parent + + return super.remove(); + } + + targets() { + return baseFind('svg [clip-path*="' + this.id() + '"]'); } - var Style = - /*#__PURE__*/ - function (_Element) { - _inherits(Style, _Element); +} +registerMethods({ + Container: { + // Create clipping element + clip: wrapWithAttrCheck(function () { + return this.defs().put(new ClipPath()); + }) + }, + Element: { + // Distribute clipPath to svg element + clipWith(element) { + // use given clip or create a new one + let clipper = element instanceof ClipPath ? element : this.parent().clip().add(element); // apply mask + + return this.attr('clip-path', 'url("#' + clipper.id() + '")'); + }, - function Style(node) { - _classCallCheck(this, Style); + // Unclip element + unclip() { + return this.attr('clip-path', null); + }, - return _possibleConstructorReturn(this, _getPrototypeOf(Style).call(this, nodeOrNew('style', node), node)); + clipper() { + return this.reference('clip-path'); } - _createClass(Style, [{ - key: "addText", - value: function addText() { - var w = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - this.node.textContent += w; - return this; - } - }, { - key: "font", - value: function font(name, src) { - var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - return this.rule('@font-face', _objectSpread({ - fontFamily: name, - src: src - }, params)); - } - }, { - key: "rule", - value: function rule(selector, obj) { - return this.addText(cssRule(selector, obj)); - } - }]); + } +}); +register(ClipPath); - return Style; - }(Element); - registerMethods('Dom', { - style: wrapWithAttrCheck(function (selector, obj) { - return this.put(new Style()).rule(selector, obj); - }), - fontface: wrapWithAttrCheck(function (name, src, params) { - return this.put(new Style()).font(name, src, params); +class G extends Container { + constructor(node) { + super(nodeOrNew('g', node), node); + } + +} +registerMethods({ + Element: { + // Create a group element + group: wrapWithAttrCheck(function () { + return this.put(new G()); }) - }); - register(Style); + } +}); +register(G); + +class A extends Container { + constructor(node) { + super(nodeOrNew('a', node), node); + } // Link url + + + to(url) { + return this.attr('href', url, xlink); + } // Link target attribute - var _Symbol = - /*#__PURE__*/ - function (_Container) { - _inherits(_Symbol, _Container); - // Initialize node - function _Symbol(node) { - _classCallCheck(this, _Symbol); + target(target) { + return this.attr('target', target); + } + +} +registerMethods({ + Container: { + // Create a hyperlink element + link: wrapWithAttrCheck(function (url) { + return this.put(new A()).to(url); + }) + }, + Element: { + // Create a hyperlink element + linkTo: function linkTo(url) { + var link = new A(); + + if (typeof url === 'function') { + url.call(link, link); + } else { + link.to(url); + } - return _possibleConstructorReturn(this, _getPrototypeOf(_Symbol).call(this, nodeOrNew('symbol', node), node)); + return this.parent().put(link).put(this); } + } +}); +register(A); - return _Symbol; - }(Container); - registerMethods({ - Container: { - symbol: wrapWithAttrCheck(function () { - return this.put(new _Symbol()); - }) +class Mask extends Container { + // Initialize node + constructor(node) { + super(nodeOrNew('mask', node), node); + } // Unmask all masked elements and remove itself + + + remove() { + // unmask all targets + this.targets().forEach(function (el) { + el.unmask(); + }); // remove mask from parent + + return super.remove(); + } + + targets() { + return baseFind('svg [mask*="' + this.id() + '"]'); + } + +} +registerMethods({ + Container: { + mask: wrapWithAttrCheck(function () { + return this.defs().put(new Mask()); + }) + }, + Element: { + // Distribute mask to svg element + maskWith(element) { + // use given mask or create a new one + var masker = element instanceof Mask ? element : this.parent().mask().add(element); // apply mask + + return this.attr('mask', 'url("#' + masker.id() + '")'); + }, + + // Unmask element + unmask() { + return this.attr('mask', null); + }, + + masker() { + return this.reference('mask'); } - }); - register(_Symbol); - var TextPath = - /*#__PURE__*/ - function (_Text) { - _inherits(TextPath, _Text); + } +}); +register(Mask); - // Initialize node - function TextPath(node) { - _classCallCheck(this, TextPath); +function cssRule(selector, rule) { + if (!selector) return ''; + if (!rule) return selector; + var ret = selector + '{'; - return _possibleConstructorReturn(this, _getPrototypeOf(TextPath).call(this, nodeOrNew('textPath', node), node)); - } // return the array of the path track element + for (var i in rule) { + ret += unCamelCase(i) + ':' + rule[i] + ';'; + } + ret += '}'; + return ret; +} - _createClass(TextPath, [{ - key: "array", - value: function array() { - var track = this.track(); - return track ? track.array() : null; - } // Plot path if any +class Style extends Element { + constructor(node) { + super(nodeOrNew('style', node), node); + } - }, { - key: "plot", - value: function plot(d) { - var track = this.track(); - var pathArray = null; + addText(w = '') { + this.node.textContent += w; + return this; + } - if (track) { - pathArray = track.plot(d); - } + font(name, src, params = {}) { + return this.rule('@font-face', _objectSpread({ + fontFamily: name, + src: src + }, params)); + } - return d == null ? pathArray : this; - } // Get the path element + rule(selector, obj) { + return this.addText(cssRule(selector, obj)); + } - }, { - key: "track", - value: function track() { - return this.reference('href'); - } - }]); - - return TextPath; - }(Text); - registerMethods({ - Container: { - textPath: wrapWithAttrCheck(function (text, path) { - return this.defs().path(path).text(text).addTo(this); - }) - }, - Text: { - // Create path for text to run on - path: wrapWithAttrCheck(function (track) { - var path = new TextPath(); // if track is a path, reuse it +} +registerMethods('Dom', { + style: wrapWithAttrCheck(function (selector, obj) { + return this.put(new Style()).rule(selector, obj); + }), + fontface: wrapWithAttrCheck(function (name, src, params) { + return this.put(new Style()).font(name, src, params); + }) +}); +register(Style); - if (!(track instanceof Path)) { - // create path element - track = this.root().defs().path(track); - } // link textPath to path and add content +class TextPath extends Text { + // Initialize node + constructor(node) { + super(nodeOrNew('textPath', node), node); + } // return the array of the path track element - path.attr('href', '#' + track, xlink); // add textPath element as child node and return textPath + array() { + var track = this.track(); + return track ? track.array() : null; + } // Plot path if any - return this.put(path); - }), - // Get the textPath children - textPath: function textPath() { - return this.find('textPath')[0]; - } - }, - Path: { - // creates a textPath from this path - text: wrapWithAttrCheck(function (text) { - if (text instanceof Text) { - var txt = text.text(); - return text.clear().path(this).text(txt); - } - return this.parent().put(new Text()).path(this).text(text); - }), - targets: function targets() { - return baseFind('svg [href*="' + this.id() + '"]'); - } + plot(d) { + var track = this.track(); + var pathArray = null; + + if (track) { + pathArray = track.plot(d); } - }); - TextPath.prototype.MorphArray = PathArray; - register(TextPath); - var Use = - /*#__PURE__*/ - function (_Shape) { - _inherits(Use, _Shape); + return d == null ? pathArray : this; + } // Get the path element + + + track() { + return this.reference('href'); + } + +} +registerMethods({ + Container: { + textPath: wrapWithAttrCheck(function (text, path) { + return this.defs().path(path).text(text).addTo(this); + }) + }, + Text: { + // Create path for text to run on + path: wrapWithAttrCheck(function (track) { + var path = new TextPath(); // if track is a path, reuse it + + if (!(track instanceof Path)) { + // create path element + track = this.root().defs().path(track); + } // link textPath to path and add content + - function Use(node) { - _classCallCheck(this, Use); + path.attr('href', '#' + track, xlink); // add textPath element as child node and return textPath - return _possibleConstructorReturn(this, _getPrototypeOf(Use).call(this, nodeOrNew('use', node), node)); - } // Use element as a reference + return this.put(path); + }), + // Get the textPath children + textPath() { + return this.find('textPath')[0]; + } - _createClass(Use, [{ - key: "element", - value: function element(_element, file) { - // Set lined element - return this.attr('href', (file || '') + '#' + _element, xlink); + }, + Path: { + // creates a textPath from this path + text: wrapWithAttrCheck(function (text) { + if (text instanceof Text) { + var txt = text.text(); + return text.clear().path(this).text(txt); } - }]); - - return Use; - }(Shape); - registerMethods({ - Container: { - // Create a use element - use: wrapWithAttrCheck(function (element, file) { - return this.put(new Use()).element(element, file); - }) + + return this.parent().put(new Text()).path(this).text(text); + }), + + targets() { + return baseFind('svg [href*="' + this.id() + '"]'); } - }); - register(Use); - - /* Optional Modules */ - var SVG = makeInstance; - extend([Svg$1, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox')); - extend([Line, Polyline, Polygon, Path], getMethodsFor('marker')); - extend(Text, getMethodsFor('Text')); - extend(Path, getMethodsFor('Path')); - extend(Defs, getMethodsFor('Defs')); - extend([Text, Tspan], getMethodsFor('Tspan')); - extend([Rect, Ellipse, Circle, Gradient], getMethodsFor('radius')); - extend(EventTarget, getMethodsFor('EventTarget')); - extend(Dom, getMethodsFor('Dom')); - extend(Element, getMethodsFor('Element')); - extend(Shape, getMethodsFor('Shape')); // extend(Element, getConstructor('Memory')) - - extend(Container, getMethodsFor('Container')); - extend(Runner, getMethodsFor('Runner')); - List.extend(getMethodNames()); - registerMorphableType([SVGNumber, Color, Box, Matrix, SVGArray, PointArray, PathArray]); - makeMorphable(); - - var svgMembers = /*#__PURE__*/Object.freeze({ - Morphable: Morphable, - registerMorphableType: registerMorphableType, - makeMorphable: makeMorphable, - TransformBag: TransformBag, - ObjectBag: ObjectBag, - NonMorphable: NonMorphable, - defaults: defaults, - utils: utils, - namespaces: namespaces, - regex: regex, - SVG: SVG, - parser: parser, - find: baseFind, - registerWindow: registerWindow, - Animator: Animator, - Controller: Controller, - Ease: Ease, - PID: PID, - Spring: Spring, - easing: easing, - Queue: Queue, - Runner: Runner, - Timeline: Timeline, - Array: SVGArray, - Box: Box, - Color: Color, - EventTarget: EventTarget, - Matrix: Matrix, - Number: SVGNumber, - PathArray: PathArray, - Point: Point, - PointArray: PointArray, - List: List, - Circle: Circle, - ClipPath: ClipPath, - Container: Container, - Defs: Defs, - Dom: Dom, - Element: Element, - Ellipse: Ellipse, - Gradient: Gradient, - G: G, - A: A, - Image: Image, - Line: Line, - Marker: Marker, - Mask: Mask, - Path: Path, - Pattern: Pattern, - Polygon: Polygon, - Polyline: Polyline, - Rect: Rect, - Shape: Shape, - Stop: Stop, - Style: Style, - Svg: Svg$1, - Symbol: _Symbol, - Text: Text, - TextPath: TextPath, - Tspan: Tspan, - Use: Use, - on: on, - off: off, - dispatch: dispatch, - root: root, - makeNode: makeNode, - makeInstance: makeInstance, - nodeOrNew: nodeOrNew, - adopt: adopt, - register: register, - getClass: getClass, - eid: eid, - assignNewId: assignNewId, - extend: extend, - extendWithAttrCheck: extendWithAttrCheck, - wrapWithAttrCheck: wrapWithAttrCheck - }); - function SVG$1(element) { - return makeInstance(element); } - Object.assign(SVG$1, svgMembers); +}); +TextPath.prototype.MorphArray = PathArray; +register(TextPath); + +class Use extends Shape { + constructor(node) { + super(nodeOrNew('use', node), node); + } // Use element as a reference + - return SVG$1; + element(element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + element, xlink); + } -}()); +} +registerMethods({ + Container: { + // Create a use element + use: wrapWithAttrCheck(function (element, file) { + return this.put(new Use()).element(element, file); + }) + } +}); +register(Use); + +/* Optional Modules */ +const SVG = makeInstance; +extend([Svg$1, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox')); +extend([Line, Polyline, Polygon, Path], getMethodsFor('marker')); +extend(Text, getMethodsFor('Text')); +extend(Path, getMethodsFor('Path')); +extend(Defs, getMethodsFor('Defs')); +extend([Text, Tspan], getMethodsFor('Tspan')); +extend([Rect, Ellipse, Circle, Gradient], getMethodsFor('radius')); +extend(EventTarget, getMethodsFor('EventTarget')); +extend(Dom, getMethodsFor('Dom')); +extend(Element, getMethodsFor('Element')); +extend(Shape, getMethodsFor('Shape')); // extend(Element, getConstructor('Memory')) + +extend(Container, getMethodsFor('Container')); +extend(Runner, getMethodsFor('Runner')); +List.extend(getMethodNames()); +registerMorphableType([SVGNumber, Color, Box, Matrix, SVGArray, PointArray, PathArray]); +makeMorphable(); + +export { Morphable, registerMorphableType, makeMorphable, TransformBag, ObjectBag, NonMorphable, defaults, utils, namespaces, regex, SVG, parser, baseFind as find, registerWindow, Animator, Controller, Ease, PID, Spring, easing, Queue, Runner, Timeline, SVGArray as Array, Box, Color, EventTarget, Matrix, SVGNumber as Number, PathArray, Point, PointArray, List, Circle, ClipPath, Container, Defs, Dom, Element, Ellipse, Gradient, G, A, Image, Line, Marker, Mask, Path, Pattern, Polygon, Polyline, Rect, Shape, Stop, Style, Svg$1 as Svg, Symbol, Text, TextPath, Tspan, Use, on, off, dispatch, root, makeNode, makeInstance, nodeOrNew, adopt, register, getClass, eid, assignNewId, extend, extendWithAttrCheck, wrapWithAttrCheck }; +//# sourceMappingURL=svg.js.map diff --git a/dist/svg.js.map b/dist/svg.js.map new file mode 100644 index 0000000..45e0384 --- /dev/null +++ b/dist/svg.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.js","sources":["../node_modules/core-js/modules/_core.js","../node_modules/core-js/modules/_global.js","../node_modules/core-js/modules/_library.js","../node_modules/core-js/modules/_shared.js","../node_modules/core-js/modules/_uid.js","../node_modules/core-js/modules/_wks.js","../node_modules/core-js/modules/_is-object.js","../node_modules/core-js/modules/_an-object.js","../node_modules/core-js/modules/_fails.js","../node_modules/core-js/modules/_descriptors.js","../node_modules/core-js/modules/_dom-create.js","../node_modules/core-js/modules/_ie8-dom-define.js","../node_modules/core-js/modules/_to-primitive.js","../node_modules/core-js/modules/_object-dp.js","../node_modules/core-js/modules/_property-desc.js","../node_modules/core-js/modules/_hide.js","../node_modules/core-js/modules/_add-to-unscopables.js","../node_modules/core-js/modules/_iter-step.js","../node_modules/core-js/modules/_iterators.js","../node_modules/core-js/modules/_cof.js","../node_modules/core-js/modules/_iobject.js","../node_modules/core-js/modules/_defined.js","../node_modules/core-js/modules/_to-iobject.js","../node_modules/core-js/modules/_has.js","../node_modules/core-js/modules/_redefine.js","../node_modules/core-js/modules/_a-function.js","../node_modules/core-js/modules/_ctx.js","../node_modules/core-js/modules/_export.js","../node_modules/core-js/modules/_to-integer.js","../node_modules/core-js/modules/_to-length.js","../node_modules/core-js/modules/_to-absolute-index.js","../node_modules/core-js/modules/_array-includes.js","../node_modules/core-js/modules/_shared-key.js","../node_modules/core-js/modules/_object-keys-internal.js","../node_modules/core-js/modules/_enum-bug-keys.js","../node_modules/core-js/modules/_object-keys.js","../node_modules/core-js/modules/_object-dps.js","../node_modules/core-js/modules/_html.js","../node_modules/core-js/modules/_object-create.js","../node_modules/core-js/modules/_set-to-string-tag.js","../node_modules/core-js/modules/_iter-create.js","../node_modules/core-js/modules/_to-object.js","../node_modules/core-js/modules/_object-gpo.js","../node_modules/core-js/modules/_iter-define.js","../node_modules/core-js/modules/es6.array.iterator.js","../node_modules/core-js/modules/web.dom.iterable.js","../src/utils/methods.js","../node_modules/core-js/modules/_fix-re-wks.js","../node_modules/core-js/modules/es6.regexp.replace.js","../src/utils/utils.js","../src/modules/core/namespaces.js","../src/utils/window.js","../src/types/Base.js","../src/utils/adopter.js","../src/modules/optional/arrange.js","../node_modules/core-js/modules/_is-regexp.js","../node_modules/core-js/modules/es6.regexp.split.js","../src/modules/core/regex.js","../src/modules/optional/class.js","../src/modules/optional/css.js","../src/modules/optional/data.js","../src/modules/optional/memory.js","../src/modules/core/event.js","../node_modules/core-js/modules/_flags.js","../node_modules/core-js/modules/es6.regexp.flags.js","../node_modules/core-js/modules/es6.regexp.to-string.js","../src/types/Color.js","../node_modules/core-js/modules/es6.regexp.match.js","../src/types/Point.js","../src/modules/core/parser.js","../src/types/Box.js","../src/types/Matrix.js","../src/types/ArrayPolyfill.js","../src/types/List.js","../src/modules/core/selector.js","../src/types/EventTarget.js","../src/modules/core/defaults.js","../src/types/SVGArray.js","../src/types/SVGNumber.js","../src/modules/core/attr.js","../src/elements/Dom.js","../src/elements/Element.js","../src/modules/optional/sugar.js","../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../node_modules/@babel/runtime/helpers/esm/objectSpread.js","../src/modules/optional/transform.js","../src/modules/core/circled.js","../src/elements/Shape.js","../src/elements/Circle.js","../src/elements/Container.js","../src/elements/Defs.js","../src/elements/Ellipse.js","../src/elements/Stop.js","../src/modules/core/gradiented.js","../src/elements/Gradient.js","../src/elements/Pattern.js","../src/elements/Image.js","../src/types/PointArray.js","../src/modules/core/pointed.js","../src/elements/Line.js","../src/elements/Marker.js","../node_modules/core-js/modules/_strict-method.js","../node_modules/core-js/modules/es6.array.sort.js","../src/animation/Controller.js","../src/types/PathArray.js","../src/animation/Morphable.js","../src/elements/Path.js","../src/modules/core/poly.js","../src/elements/Polygon.js","../src/elements/Polyline.js","../src/elements/Rect.js","../src/animation/Queue.js","../src/animation/Animator.js","../src/animation/Timeline.js","../src/animation/Runner.js","../src/elements/Svg.js","../src/elements/Symbol.js","../src/modules/core/textable.js","../src/elements/Text.js","../src/elements/Tspan.js","../src/elements/ClipPath.js","../src/elements/G.js","../src/elements/A.js","../src/elements/Mask.js","../src/elements/Style.js","../src/elements/TextPath.js","../src/elements/Use.js","../src/main.js"],"sourcesContent":["var core = module.exports = { version: '2.5.7' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n","module.exports = false;\n","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2018 Denis Pushkarev (zloirock.ru)'\n});\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","var store = require('./_shared')('wks');\nvar uid = require('./_uid');\nvar Symbol = require('./_global').Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = require('./_wks')('unscopables');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n ArrayProto[UNSCOPABLES][key] = true;\n};\n","module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n","module.exports = {};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject');\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar TO_STRING = 'toString';\nvar $toString = Function[TO_STRING];\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n","var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n","var document = require('./_global').document;\nmodule.exports = document && document.documentElement;\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","'use strict';\nvar create = require('./_object-create');\nvar descriptor = require('./_property-desc');\nvar setToStringTag = require('./_set-to-string-tag');\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has');\nvar toObject = require('./_to-object');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables');\nvar step = require('./_iter-step');\nvar Iterators = require('./_iterators');\nvar toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var kind = this._k;\n var index = this._i++;\n if (!O || index >= O.length) {\n this._t = undefined;\n return step(1);\n }\n if (kind == 'keys') return step(0, index);\n if (kind == 'values') return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n","var $iterators = require('./es6.array.iterator');\nvar getKeys = require('./_object-keys');\nvar redefine = require('./_redefine');\nvar global = require('./_global');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar wks = require('./_wks');\nvar ITERATOR = wks('iterator');\nvar TO_STRING_TAG = wks('toStringTag');\nvar ArrayValues = Iterators.Array;\n\nvar DOMIterables = {\n CSSRuleList: true, // TODO: Not spec compliant, should be false.\n CSSStyleDeclaration: false,\n CSSValueList: false,\n ClientRectList: false,\n DOMRectList: false,\n DOMStringList: false,\n DOMTokenList: true,\n DataTransferItemList: false,\n FileList: false,\n HTMLAllCollection: false,\n HTMLCollection: false,\n HTMLFormElement: false,\n HTMLSelectElement: false,\n MediaList: true, // TODO: Not spec compliant, should be false.\n MimeTypeArray: false,\n NamedNodeMap: false,\n NodeList: true,\n PaintRequestList: false,\n Plugin: false,\n PluginArray: false,\n SVGLengthList: false,\n SVGNumberList: false,\n SVGPathSegList: false,\n SVGPointList: false,\n SVGStringList: false,\n SVGTransformList: false,\n SourceBufferList: false,\n StyleSheetList: true, // TODO: Not spec compliant, should be false.\n TextTrackCueList: false,\n TextTrackList: false,\n TouchList: false\n};\n\nfor (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {\n var NAME = collections[i];\n var explicit = DOMIterables[NAME];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n var key;\n if (proto) {\n if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);\n if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = ArrayValues;\n if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);\n }\n}\n","const methods = {}\r\nconst names = []\r\n\r\nexport function registerMethods (name, m) {\r\n if (Array.isArray(name)) {\r\n for (let _name of name) {\r\n registerMethods(_name, m)\r\n }\r\n return\r\n }\r\n\r\n if (typeof name === 'object') {\r\n for (let _name in name) {\r\n registerMethods(_name, name[_name])\r\n }\r\n return\r\n }\r\n\r\n addMethodNames(Object.keys(m))\r\n methods[name] = Object.assign(methods[name] || {}, m)\r\n}\r\n\r\nexport function getMethodsFor (name) {\r\n return methods[name] || {}\r\n}\r\n\r\nexport function getMethodNames () {\r\n return [...new Set(names)]\r\n}\r\n\r\nexport function addMethodNames (_names) {\r\n names.push(..._names)\r\n}\r\n","'use strict';\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar fails = require('./_fails');\nvar defined = require('./_defined');\nvar wks = require('./_wks');\n\nmodule.exports = function (KEY, length, exec) {\n var SYMBOL = wks(KEY);\n var fns = exec(defined, SYMBOL, ''[KEY]);\n var strfn = fns[0];\n var rxfn = fns[1];\n if (fails(function () {\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n })) {\n redefine(String.prototype, KEY, strfn);\n hide(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return rxfn.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return rxfn.call(string, this); }\n );\n }\n};\n","// @@replace logic\nrequire('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace) {\n // 21.1.3.14 String.prototype.replace(searchValue, replaceValue)\n return [function replace(searchValue, replaceValue) {\n 'use strict';\n var O = defined(this);\n var fn = searchValue == undefined ? undefined : searchValue[REPLACE];\n return fn !== undefined\n ? fn.call(searchValue, O, replaceValue)\n : $replace.call(String(O), searchValue, replaceValue);\n }, $replace];\n});\n","// Map function\r\nexport function map (array, block) {\r\n var i\r\n var il = array.length\r\n var result = []\r\n\r\n for (i = 0; i < il; i++) {\r\n result.push(block(array[i]))\r\n }\r\n\r\n return result\r\n}\r\n\r\n// Filter function\r\nexport function filter (array, block) {\r\n var i\r\n var il = array.length\r\n var result = []\r\n\r\n for (i = 0; i < il; i++) {\r\n if (block(array[i])) { result.push(array[i]) }\r\n }\r\n\r\n return result\r\n}\r\n\r\n// Degrees to radians\r\nexport function radians (d) {\r\n return d % 360 * Math.PI / 180\r\n}\r\n\r\n// Radians to degrees\r\nexport function degrees (r) {\r\n return r * 180 / Math.PI % 360\r\n}\r\n\r\n// Convert dash-separated-string to camelCase\r\nexport function camelCase (s) {\r\n return s.toLowerCase().replace(/-(.)/g, function (m, g) {\r\n return g.toUpperCase()\r\n })\r\n}\r\n\r\n// Convert camel cased string to string seperated\r\nexport function unCamelCase (s) {\r\n return s.replace(/([A-Z])/g, function (m, g) {\r\n return '-' + g.toLowerCase()\r\n })\r\n}\r\n\r\n// Capitalize first letter of a string\r\nexport function capitalize (s) {\r\n return s.charAt(0).toUpperCase() + s.slice(1)\r\n}\r\n\r\n// Calculate proportional width and height values when necessary\r\nexport function proportionalSize (element, width, height) {\r\n if (width == null || height == null) {\r\n var box = element.bbox()\r\n\r\n if (width == null) {\r\n width = box.width / box.height * height\r\n } else if (height == null) {\r\n height = box.height / box.width * width\r\n }\r\n }\r\n\r\n return {\r\n width: width,\r\n height: height\r\n }\r\n}\r\n\r\nexport function getOrigin (o, element) {\r\n // Allow origin or around as the names\r\n let origin = o.origin // o.around == null ? o.origin : o.around\r\n let ox, oy\r\n\r\n // Allow the user to pass a string to rotate around a given point\r\n if (typeof origin === 'string' || origin == null) {\r\n // Get the bounding box of the element with no transformations applied\r\n const string = (origin || 'center').toLowerCase().trim()\r\n const { height, width, x, y } = element.bbox()\r\n\r\n // Calculate the transformed x and y coordinates\r\n let bx = string.includes('left') ? x\r\n : string.includes('right') ? x + width\r\n : x + width / 2\r\n let by = string.includes('top') ? y\r\n : string.includes('bottom') ? y + height\r\n : y + height / 2\r\n\r\n // Set the bounds eg : \"bottom-left\", \"Top right\", \"middle\" etc...\r\n ox = o.ox != null ? o.ox : bx\r\n oy = o.oy != null ? o.oy : by\r\n } else {\r\n ox = origin[0]\r\n oy = origin[1]\r\n }\r\n\r\n // Return the origin as it is if it wasn't a string\r\n return [ ox, oy ]\r\n}\r\n","// Default namespaces\r\nexport let ns = 'http://www.w3.org/2000/svg'\r\nexport let xmlns = 'http://www.w3.org/2000/xmlns/'\r\nexport let xlink = 'http://www.w3.org/1999/xlink'\r\nexport let svgjs = 'http://svgjs.com/svgjs'\r\n","export const globals = {\r\n window: typeof window === 'undefined' ? null : window,\r\n document: typeof document === 'undefined' ? null : document\r\n}\r\n\r\nexport function registerWindow (win = null, doc = null) {\r\n globals.window = win\r\n globals.document = doc\r\n}\r\n","export default class Base {\r\n // constructor (node/*, {extensions = []} */) {\r\n // // this.tags = []\r\n // //\r\n // // for (let extension of extensions) {\r\n // // extension.setup.call(this, node)\r\n // // this.tags.push(extension.name)\r\n // // }\r\n // }\r\n}\r\n","import { addMethodNames } from './methods.js'\r\nimport { capitalize } from './utils.js'\r\nimport { ns } from '../modules/core/namespaces.js'\r\nimport { globals } from '../utils/window.js'\r\nimport Base from '../types/Base.js'\r\n\r\nconst elements = {}\r\nexport const root = '___SYMBOL___ROOT___'\r\n\r\n// Method for element creation\r\nexport function makeNode (name) {\r\n // create element\r\n return globals.document.createElementNS(ns, name)\r\n}\r\n\r\nexport function makeInstance (element) {\r\n if (element instanceof Base) return element\r\n\r\n if (typeof element === 'object') {\r\n return adopt(element)\r\n }\r\n\r\n if (element == null) {\r\n return new elements[root]()\r\n }\r\n\r\n if (typeof element === 'string' && element.charAt(0) !== '<') {\r\n return adopt(globals.document.querySelector(element))\r\n }\r\n\r\n var node = makeNode('svg')\r\n node.innerHTML = element\r\n\r\n // We can use firstChild here because we know,\r\n // that the first char is < and thus an element\r\n element = adopt(node.firstChild)\r\n\r\n return element\r\n}\r\n\r\nexport function nodeOrNew (name, node) {\r\n return node instanceof globals.window.Node ? node : makeNode(name)\r\n}\r\n\r\n// Adopt existing svg elements\r\nexport function adopt (node) {\r\n // check for presence of node\r\n if (!node) return null\r\n\r\n // make sure a node isn't already adopted\r\n if (node.instance instanceof Base) return node.instance\r\n\r\n // initialize variables\r\n var className = capitalize(node.nodeName)\r\n\r\n // Make sure that gradients are adopted correctly\r\n if (className === 'LinearGradient' || className === 'RadialGradient') {\r\n className = 'Gradient'\r\n\r\n // Fallback to Dom if element is not known\r\n } else if (!elements[className]) {\r\n className = 'Dom'\r\n }\r\n\r\n return new elements[className](node)\r\n}\r\n\r\nexport function register (element, name = element.name, asRoot = false) {\r\n elements[name] = element\r\n if (asRoot) elements[root] = element\r\n\r\n addMethodNames(Object.keys(element.prototype))\r\n\r\n return element\r\n}\r\n\r\nexport function getClass (name) {\r\n return elements[name]\r\n}\r\n\r\n// Element id sequence\r\nlet did = 1000\r\n\r\n// Get next named element id\r\nexport function eid (name) {\r\n return 'Svgjs' + capitalize(name) + (did++)\r\n}\r\n\r\n// Deep new id assignment\r\nexport function assignNewId (node) {\r\n // do the same for SVG child nodes as well\r\n for (var i = node.children.length - 1; i >= 0; i--) {\r\n assignNewId(node.children[i])\r\n }\r\n\r\n if (node.id) {\r\n return adopt(node).id(eid(node.nodeName))\r\n }\r\n\r\n return adopt(node)\r\n}\r\n\r\n// Method for extending objects\r\nexport function extend (modules, methods, attrCheck) {\r\n var key, i\r\n\r\n modules = Array.isArray(modules) ? modules : [modules]\r\n\r\n for (i = modules.length - 1; i >= 0; i--) {\r\n for (key in methods) {\r\n let method = methods[key]\r\n if (attrCheck) {\r\n method = wrapWithAttrCheck(methods[key])\r\n }\r\n modules[i].prototype[key] = method\r\n }\r\n }\r\n}\r\n\r\nexport function extendWithAttrCheck (...args) {\r\n extend(...args, true)\r\n}\r\n\r\nexport function wrapWithAttrCheck (fn) {\r\n return function (...args) {\r\n let o = args[args.length - 1]\r\n\r\n if (o && o.constructor === Object && !(o instanceof Array)) {\r\n return fn.apply(this, args.slice(0, -1)).attr(o)\r\n } else {\r\n return fn.apply(this, args)\r\n }\r\n }\r\n}\r\n","import { makeInstance } from '../../utils/adopter.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\n\r\n// Get all siblings, including myself\r\nexport function siblings () {\r\n return this.parent().children()\r\n}\r\n\r\n// Get the curent position siblings\r\nexport function position () {\r\n return this.parent().index(this)\r\n}\r\n\r\n// Get the next element (will return null if there is none)\r\nexport function next () {\r\n return this.siblings()[this.position() + 1]\r\n}\r\n\r\n// Get the next element (will return null if there is none)\r\nexport function prev () {\r\n return this.siblings()[this.position() - 1]\r\n}\r\n\r\n// Send given element one step forward\r\nexport function forward () {\r\n var i = this.position() + 1\r\n var p = this.parent()\r\n\r\n // move node one step forward\r\n p.removeElement(this).add(this, i)\r\n\r\n // make sure defs node is always at the top\r\n if (typeof p.isRoot === 'function' && p.isRoot()) {\r\n p.node.appendChild(p.defs().node)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element one step backward\r\nexport function backward () {\r\n var i = this.position()\r\n\r\n if (i > 0) {\r\n this.parent().removeElement(this).add(this, i - 1)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element all the way to the front\r\nexport function front () {\r\n var p = this.parent()\r\n\r\n // Move node forward\r\n p.node.appendChild(this.node)\r\n\r\n // Make sure defs node is always at the top\r\n if (typeof p.isRoot === 'function' && p.isRoot()) {\r\n p.node.appendChild(p.defs().node)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element all the way to the back\r\nexport function back () {\r\n if (this.position() > 0) {\r\n this.parent().removeElement(this).add(this, 0)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Inserts a given element before the targeted element\r\nexport function before (element) {\r\n element = makeInstance(element)\r\n element.remove()\r\n\r\n var i = this.position()\r\n\r\n this.parent().add(element, i)\r\n\r\n return this\r\n}\r\n\r\n// Inserts a given element after the targeted element\r\nexport function after (element) {\r\n element = makeInstance(element)\r\n element.remove()\r\n\r\n var i = this.position()\r\n\r\n this.parent().add(element, i + 1)\r\n\r\n return this\r\n}\r\n\r\nexport function insertBefore (element) {\r\n element = makeInstance(element)\r\n element.before(this)\r\n}\r\n\r\nexport function insertAfter (element) {\r\n element = makeInstance(element)\r\n element.after(this)\r\n}\r\n\r\nregisterMethods('Dom', {\r\n siblings,\r\n position,\r\n next,\r\n prev,\r\n forward,\r\n backward,\r\n front,\r\n back,\r\n before,\r\n after,\r\n insertBefore,\r\n insertAfter\r\n})\r\n","// 7.2.8 IsRegExp(argument)\nvar isObject = require('./_is-object');\nvar cof = require('./_cof');\nvar MATCH = require('./_wks')('match');\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');\n};\n","// @@split logic\nrequire('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split) {\n 'use strict';\n var isRegExp = require('./_is-regexp');\n var _split = $split;\n var $push = [].push;\n var $SPLIT = 'split';\n var LENGTH = 'length';\n var LAST_INDEX = 'lastIndex';\n if (\n 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||\n 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||\n 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||\n '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||\n '.'[$SPLIT](/()()/)[LENGTH] > 1 ||\n ''[$SPLIT](/.?/)[LENGTH]\n ) {\n var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group\n // based on es5-shim implementation, need to rework it\n $split = function (separator, limit) {\n var string = String(this);\n if (separator === undefined && limit === 0) return [];\n // If `separator` is not a regex, use native split\n if (!isRegExp(separator)) return _split.call(string, separator, limit);\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n var splitLimit = limit === undefined ? 4294967295 : limit >>> 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var separator2, match, lastIndex, lastLength, i;\n // Doesn't need flags gy, but they don't hurt\n if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\\\s)', flags);\n while (match = separatorCopy.exec(string)) {\n // `separatorCopy.lastIndex` is not reliable cross-browser\n lastIndex = match.index + match[0][LENGTH];\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG\n // eslint-disable-next-line no-loop-func\n if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () {\n for (i = 1; i < arguments[LENGTH] - 2; i++) if (arguments[i] === undefined) match[i] = undefined;\n });\n if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));\n lastLength = match[0][LENGTH];\n lastLastIndex = lastIndex;\n if (output[LENGTH] >= splitLimit) break;\n }\n if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop\n }\n if (lastLastIndex === string[LENGTH]) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;\n };\n // Chakra, V8\n } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {\n $split = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit);\n };\n }\n // 21.1.3.17 String.prototype.split(separator, limit)\n return [function split(separator, limit) {\n var O = defined(this);\n var fn = separator == undefined ? undefined : separator[SPLIT];\n return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit);\n }, $split];\n});\n","// Parse unit value\r\nexport let numberAndUnit = /^([+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?)([a-z%]*)$/i\r\n\r\n// Parse hex value\r\nexport let hex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i\r\n\r\n// Parse rgb value\r\nexport let rgb = /rgb\\((\\d+),(\\d+),(\\d+)\\)/\r\n\r\n// Parse reference id\r\nexport let reference = /(#[a-z0-9\\-_]+)/i\r\n\r\n// splits a transformation chain\r\nexport let transforms = /\\)\\s*,?\\s*/\r\n\r\n// Whitespace\r\nexport let whitespace = /\\s/g\r\n\r\n// Test hex value\r\nexport let isHex = /^#[a-f0-9]{3,6}$/i\r\n\r\n// Test rgb value\r\nexport let isRgb = /^rgb\\(/\r\n\r\n// Test css declaration\r\nexport let isCss = /[^:]+:[^;]+;?/\r\n\r\n// Test for blank string\r\nexport let isBlank = /^(\\s+)?$/\r\n\r\n// Test for numeric string\r\nexport let isNumber = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i\r\n\r\n// Test for percent value\r\nexport let isPercent = /^-?[\\d.]+%$/\r\n\r\n// Test for image url\r\nexport let isImage = /\\.(jpg|jpeg|png|gif|svg)(\\?[^=]+.*)?/i\r\n\r\n// split at whitespace and comma\r\nexport let delimiter = /[\\s,]+/\r\n\r\n// The following regex are used to parse the d attribute of a path\r\n\r\n// Matches all hyphens which are not after an exponent\r\nexport let hyphen = /([^e])-/gi\r\n\r\n// Replaces and tests for all path letters\r\nexport let pathLetters = /[MLHVCSQTAZ]/gi\r\n\r\n// yes we need this one, too\r\nexport let isPathLetter = /[MLHVCSQTAZ]/i\r\n\r\n// matches 0.154.23.45\r\nexport let numbersWithDots = /((\\d?\\.\\d+(?:e[+-]?\\d+)?)((?:\\.\\d+(?:e[+-]?\\d+)?)+))+/gi\r\n\r\n// matches .\r\nexport let dots = /\\./g\r\n","import { delimiter } from '../core/regex.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\n\r\n// Return array of classes on the node\r\nexport function classes () {\r\n var attr = this.attr('class')\r\n return attr == null ? [] : attr.trim().split(delimiter)\r\n}\r\n\r\n// Return true if class exists on the node, false otherwise\r\nexport function hasClass (name) {\r\n return this.classes().indexOf(name) !== -1\r\n}\r\n\r\n// Add class to the node\r\nexport function addClass (name) {\r\n if (!this.hasClass(name)) {\r\n var array = this.classes()\r\n array.push(name)\r\n this.attr('class', array.join(' '))\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Remove class from the node\r\nexport function removeClass (name) {\r\n if (this.hasClass(name)) {\r\n this.attr('class', this.classes().filter(function (c) {\r\n return c !== name\r\n }).join(' '))\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Toggle the presence of a class on the node\r\nexport function toggleClass (name) {\r\n return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)\r\n}\r\n\r\nregisterMethods('Dom', {\r\n classes, hasClass, addClass, removeClass, toggleClass\r\n})\r\n","import { camelCase } from '../../utils/utils.js'\r\nimport { isBlank } from '../core/regex.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\n\r\n// Dynamic style generator\r\nexport function css (style, val) {\r\n let ret = {}\r\n if (arguments.length === 0) {\r\n // get full style as object\r\n this.node.style.cssText.split(/\\s*;\\s*/)\r\n .filter(function (el) { return !!el.length })\r\n .forEach(function (el) {\r\n let t = el.split(/\\s*:\\s*/)\r\n ret[t[0]] = t[1]\r\n })\r\n return ret\r\n }\r\n\r\n if (arguments.length < 2) {\r\n // get style properties in the array\r\n if (Array.isArray(style)) {\r\n for (let name of style) {\r\n let cased = camelCase(name)\r\n ret[cased] = this.node.style[cased]\r\n }\r\n return ret\r\n }\r\n\r\n // get style for property\r\n if (typeof style === 'string') {\r\n return this.node.style[camelCase(style)]\r\n }\r\n\r\n // set styles in object\r\n if (typeof style === 'object') {\r\n for (let name in style) {\r\n // set empty string if null/undefined/'' was given\r\n this.node.style[camelCase(name)] =\r\n (style[name] == null || isBlank.test(style[name])) ? '' : style[name]\r\n }\r\n }\r\n }\r\n\r\n // set style for property\r\n if (arguments.length === 2) {\r\n this.node.style[camelCase(style)] =\r\n (val == null || isBlank.test(val)) ? '' : val\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Show element\r\nexport function show () {\r\n return this.css('display', '')\r\n}\r\n\r\n// Hide element\r\nexport function hide () {\r\n return this.css('display', 'none')\r\n}\r\n\r\n// Is element visible?\r\nexport function visible () {\r\n return this.css('display') !== 'none'\r\n}\r\n\r\nregisterMethods('Dom', {\r\n css, show, hide, visible\r\n})\r\n","import { registerMethods } from '../../utils/methods.js'\r\n\r\n// Store data values on svg nodes\r\nexport function data (a, v, r) {\r\n if (typeof a === 'object') {\r\n for (v in a) {\r\n this.data(v, a[v])\r\n }\r\n } else if (arguments.length < 2) {\r\n try {\r\n return JSON.parse(this.attr('data-' + a))\r\n } catch (e) {\r\n return this.attr('data-' + a)\r\n }\r\n } else {\r\n this.attr('data-' + a,\r\n v === null ? null\r\n : r === true || typeof v === 'string' || typeof v === 'number' ? v\r\n : JSON.stringify(v)\r\n )\r\n }\r\n\r\n return this\r\n}\r\n\r\nregisterMethods('Dom', { data })\r\n","import { registerMethods } from '../../utils/methods.js'\r\n\r\n// Remember arbitrary data\r\nexport function remember (k, v) {\r\n // remember every item in an object individually\r\n if (typeof arguments[0] === 'object') {\r\n for (var key in k) {\r\n this.remember(key, k[key])\r\n }\r\n } else if (arguments.length === 1) {\r\n // retrieve memory\r\n return this.memory()[k]\r\n } else {\r\n // store memory\r\n this.memory()[k] = v\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Erase a given memory\r\nexport function forget () {\r\n if (arguments.length === 0) {\r\n this._memory = {}\r\n } else {\r\n for (var i = arguments.length - 1; i >= 0; i--) {\r\n delete this.memory()[arguments[i]]\r\n }\r\n }\r\n return this\r\n}\r\n\r\n// This triggers creation of a new hidden class which is not performant\r\n// However, this function is not rarely used so it will not happen frequently\r\n// Return local memory object\r\nexport function memory () {\r\n return (this._memory = this._memory || {})\r\n}\r\n\r\nregisterMethods('Dom', { remember, forget, memory })\r\n","import { delimiter } from './regex.js'\r\nimport { makeInstance } from '../../utils/adopter.js'\r\nimport { globals } from '../../utils/window.js'\r\n\r\nlet listenerId = 0\r\n\r\nfunction getEvents (node) {\r\n const n = makeInstance(node).getEventHolder()\r\n if (!n.events) n.events = {}\r\n return n.events\r\n}\r\n\r\nfunction getEventTarget (node) {\r\n return makeInstance(node).getEventTarget()\r\n}\r\n\r\nfunction clearEvents (node) {\r\n const n = makeInstance(node).getEventHolder()\r\n if (n.events) n.events = {}\r\n}\r\n\r\n// Add event binder in the SVG namespace\r\nexport function on (node, events, listener, binding, options) {\r\n var l = listener.bind(binding || node)\r\n var bag = getEvents(node)\r\n var n = getEventTarget(node)\r\n\r\n // events can be an array of events or a string of events\r\n events = Array.isArray(events) ? events : events.split(delimiter)\r\n\r\n // add id to listener\r\n if (!listener._svgjsListenerId) {\r\n listener._svgjsListenerId = ++listenerId\r\n }\r\n\r\n events.forEach(function (event) {\r\n var ev = event.split('.')[0]\r\n var ns = event.split('.')[1] || '*'\r\n\r\n // ensure valid object\r\n bag[ev] = bag[ev] || {}\r\n bag[ev][ns] = bag[ev][ns] || {}\r\n\r\n // reference listener\r\n bag[ev][ns][listener._svgjsListenerId] = l\r\n\r\n // add listener\r\n n.addEventListener(ev, l, options || false)\r\n })\r\n}\r\n\r\n// Add event unbinder in the SVG namespace\r\nexport function off (node, events, listener, options) {\r\n var bag = getEvents(node)\r\n var n = getEventTarget(node)\r\n\r\n // listener can be a function or a number\r\n if (typeof listener === 'function') {\r\n listener = listener._svgjsListenerId\r\n if (!listener) return\r\n }\r\n\r\n // events can be an array of events or a string or undefined\r\n events = Array.isArray(events) ? events : (events || '').split(delimiter)\r\n\r\n events.forEach(function (event) {\r\n var ev = event && event.split('.')[0]\r\n var ns = event && event.split('.')[1]\r\n var namespace, l\r\n\r\n if (listener) {\r\n // remove listener reference\r\n if (bag[ev] && bag[ev][ns || '*']) {\r\n // removeListener\r\n n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false)\r\n\r\n delete bag[ev][ns || '*'][listener]\r\n }\r\n } else if (ev && ns) {\r\n // remove all listeners for a namespaced event\r\n if (bag[ev] && bag[ev][ns]) {\r\n for (l in bag[ev][ns]) { off(n, [ev, ns].join('.'), l) }\r\n\r\n delete bag[ev][ns]\r\n }\r\n } else if (ns) {\r\n // remove all listeners for a specific namespace\r\n for (event in bag) {\r\n for (namespace in bag[event]) {\r\n if (ns === namespace) { off(n, [event, ns].join('.')) }\r\n }\r\n }\r\n } else if (ev) {\r\n // remove all listeners for the event\r\n if (bag[ev]) {\r\n for (namespace in bag[ev]) { off(n, [ev, namespace].join('.')) }\r\n\r\n delete bag[ev]\r\n }\r\n } else {\r\n // remove all listeners on a given node\r\n for (event in bag) { off(n, event) }\r\n\r\n clearEvents(node)\r\n }\r\n })\r\n}\r\n\r\nexport function dispatch (node, event, data) {\r\n var n = getEventTarget(node)\r\n\r\n // Dispatch event\r\n if (event instanceof globals.window.Event) {\r\n n.dispatchEvent(event)\r\n } else {\r\n event = new globals.window.CustomEvent(event, { detail: data, cancelable: true })\r\n n.dispatchEvent(event)\r\n }\r\n return event\r\n}\r\n","'use strict';\n// 21.2.5.3 get RegExp.prototype.flags\nvar anObject = require('./_an-object');\nmodule.exports = function () {\n var that = anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n};\n","// 21.2.5.3 get RegExp.prototype.flags()\nif (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', {\n configurable: true,\n get: require('./_flags')\n});\n","'use strict';\nrequire('./es6.regexp.flags');\nvar anObject = require('./_an-object');\nvar $flags = require('./_flags');\nvar DESCRIPTORS = require('./_descriptors');\nvar TO_STRING = 'toString';\nvar $toString = /./[TO_STRING];\n\nvar define = function (fn) {\n require('./_redefine')(RegExp.prototype, TO_STRING, fn, true);\n};\n\n// 21.2.5.14 RegExp.prototype.toString()\nif (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) {\n define(function toString() {\n var R = anObject(this);\n return '/'.concat(R.source, '/',\n 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);\n });\n// FF44- RegExp#toString has a wrong name\n} else if ($toString.name != TO_STRING) {\n define(function toString() {\n return $toString.call(this);\n });\n}\n","/*\r\n\r\nColor {\r\n constructor (a, b, c, space) {\r\n space: 'hsl'\r\n a: 30\r\n b: 20\r\n c: 10\r\n },\r\n\r\n toRgb () { return new Color in rgb space }\r\n toHsl () { return new Color in hsl space }\r\n toLab () { return new Color in lab space }\r\n\r\n toArray () { [space, a, b, c] }\r\n fromArray () { convert it back }\r\n}\r\n\r\n// Conversions aren't always exact because of monitor profiles etc...\r\nnew Color(h, s, l, 'hsl') !== new Color(r, g, b).hsl()\r\nnew Color(100, 100, 100, [space])\r\nnew Color('hsl(30, 20, 10)')\r\n\r\n// Sugar\r\nSVG.rgb(30, 20, 50).lab()\r\nSVG.hsl()\r\nSVG.lab('rgb(100, 100, 100)')\r\n*/\r\n\r\nimport { hex, isHex, isRgb, rgb, whitespace } from '../modules/core/regex.js'\r\n\r\n// Ensure to six-based hex\r\nfunction fullHex (hex) {\r\n return hex.length === 4\r\n ? [ '#',\r\n hex.substring(1, 2), hex.substring(1, 2),\r\n hex.substring(2, 3), hex.substring(2, 3),\r\n hex.substring(3, 4), hex.substring(3, 4)\r\n ].join('')\r\n : hex\r\n}\r\n\r\n// Component to hex value\r\nfunction compToHex (comp) {\r\n var hex = comp.toString(16)\r\n return hex.length === 1 ? '0' + hex : hex\r\n}\r\n\r\nexport default class Color {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (color, g, b) {\r\n let match\r\n\r\n // initialize defaults\r\n this.r = 0\r\n this.g = 0\r\n this.b = 0\r\n\r\n if (!color) return\r\n\r\n // parse color\r\n if (typeof color === 'string') {\r\n if (isRgb.test(color)) {\r\n // get rgb values\r\n match = rgb.exec(color.replace(whitespace, ''))\r\n\r\n // parse numeric values\r\n this.r = parseInt(match[1])\r\n this.g = parseInt(match[2])\r\n this.b = parseInt(match[3])\r\n } else if (isHex.test(color)) {\r\n // get hex values\r\n match = hex.exec(fullHex(color))\r\n\r\n // parse numeric values\r\n this.r = parseInt(match[1], 16)\r\n this.g = parseInt(match[2], 16)\r\n this.b = parseInt(match[3], 16)\r\n }\r\n } else if (Array.isArray(color)) {\r\n this.r = color[0]\r\n this.g = color[1]\r\n this.b = color[2]\r\n } else if (typeof color === 'object') {\r\n this.r = color.r\r\n this.g = color.g\r\n this.b = color.b\r\n } else if (arguments.length === 3) {\r\n this.r = color\r\n this.g = g\r\n this.b = b\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Default to hex conversion\r\n toString () {\r\n return this.toHex()\r\n }\r\n\r\n toArray () {\r\n return [this.r, this.g, this.b]\r\n }\r\n\r\n // Build hex value\r\n toHex () {\r\n return '#' +\r\n compToHex(Math.round(this.r)) +\r\n compToHex(Math.round(this.g)) +\r\n compToHex(Math.round(this.b))\r\n }\r\n\r\n // Build rgb value\r\n toRgb () {\r\n return 'rgb(' + [this.r, this.g, this.b].join() + ')'\r\n }\r\n\r\n // Calculate true brightness\r\n brightness () {\r\n return (this.r / 255 * 0.30) +\r\n (this.g / 255 * 0.59) +\r\n (this.b / 255 * 0.11)\r\n }\r\n\r\n // Testers\r\n\r\n // Test if given value is a color string\r\n static test (color) {\r\n color += ''\r\n return isHex.test(color) || isRgb.test(color)\r\n }\r\n\r\n // Test if given value is a rgb object\r\n static isRgb (color) {\r\n return color && typeof color.r === 'number' &&\r\n typeof color.g === 'number' &&\r\n typeof color.b === 'number'\r\n }\r\n\r\n // Test if given value is a color\r\n static isColor (color) {\r\n return this.isRgb(color) || this.test(color)\r\n }\r\n}\r\n","// @@match logic\nrequire('./_fix-re-wks')('match', 1, function (defined, MATCH, $match) {\n // 21.1.3.11 String.prototype.match(regexp)\n return [function match(regexp) {\n 'use strict';\n var O = defined(this);\n var fn = regexp == undefined ? undefined : regexp[MATCH];\n return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));\n }, $match];\n});\n","export default class Point {\r\n // Initialize\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (x, y) {\r\n let source\r\n let base = { x: 0, y: 0 }\r\n\r\n // ensure source as object\r\n source = Array.isArray(x) ? { x: x[0], y: x[1] }\r\n : typeof x === 'object' ? { x: x.x, y: x.y }\r\n : { x: x, y: y }\r\n\r\n // merge source\r\n this.x = source.x == null ? base.x : source.x\r\n this.y = source.y == null ? base.y : source.y\r\n\r\n return this\r\n }\r\n\r\n // Clone point\r\n clone () {\r\n return new Point(this)\r\n }\r\n\r\n // transform point with matrix\r\n transform (m) {\r\n // Perform the matrix multiplication\r\n var x = m.a * this.x + m.c * this.y + m.e\r\n var y = m.b * this.x + m.d * this.y + m.f\r\n\r\n // Return the required point\r\n return new Point(x, y)\r\n }\r\n\r\n toArray () {\r\n return [this.x, this.y]\r\n }\r\n}\r\n\r\nexport function point (x, y) {\r\n return new Point(x, y).transform(this.screenCTM().inverse())\r\n}\r\n","import { globals } from '../../utils/window.js'\r\nimport { makeInstance } from '../../utils/adopter.js'\r\n\r\nexport default function parser () {\r\n // Reuse cached element if possible\r\n if (!parser.nodes) {\r\n let svg = makeInstance().size(2, 0)\r\n svg.node.cssText = [\r\n 'opacity: 0',\r\n 'position: absolute',\r\n 'left: -100%',\r\n 'top: -100%',\r\n 'overflow: hidden'\r\n ].join(';')\r\n\r\n let path = svg.path().node\r\n\r\n parser.nodes = { svg, path }\r\n }\r\n\r\n if (!parser.nodes.svg.node.parentNode) {\r\n let b = globals.document.body || globals.document.documentElement\r\n parser.nodes.svg.addTo(b)\r\n }\r\n\r\n return parser.nodes\r\n}\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { globals } from '../utils/window.js'\r\nimport Point from './Point.js'\r\nimport parser from '../modules/core/parser.js'\r\n\r\nfunction isNulledBox (box) {\r\n return !box.w && !box.h && !box.x && !box.y\r\n}\r\n\r\nfunction domContains (node) {\r\n return (globals.document.documentElement.contains || function (node) {\r\n // This is IE - it does not support contains() for top-level SVGs\r\n while (node.parentNode) {\r\n node = node.parentNode\r\n }\r\n return node === document\r\n }).call(globals.document.documentElement, node)\r\n}\r\n\r\nexport default class Box {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (source) {\r\n var base = [0, 0, 0, 0]\r\n source = typeof source === 'string' ? source.split(delimiter).map(parseFloat)\r\n : Array.isArray(source) ? source\r\n : typeof source === 'object' ? [source.left != null ? source.left\r\n : source.x, source.top != null ? source.top : source.y, source.width, source.height]\r\n : arguments.length === 4 ? [].slice.call(arguments)\r\n : base\r\n\r\n this.x = source[0] || 0\r\n this.y = source[1] || 0\r\n this.width = this.w = source[2] || 0\r\n this.height = this.h = source[3] || 0\r\n\r\n // Add more bounding box properties\r\n this.x2 = this.x + this.w\r\n this.y2 = this.y + this.h\r\n this.cx = this.x + this.w / 2\r\n this.cy = this.y + this.h / 2\r\n\r\n return this\r\n }\r\n\r\n // Merge rect box with another, return a new instance\r\n merge (box) {\r\n let x = Math.min(this.x, box.x)\r\n let y = Math.min(this.y, box.y)\r\n let width = Math.max(this.x + this.width, box.x + box.width) - x\r\n let height = Math.max(this.y + this.height, box.y + box.height) - y\r\n\r\n return new Box(x, y, width, height)\r\n }\r\n\r\n transform (m) {\r\n let xMin = Infinity\r\n let xMax = -Infinity\r\n let yMin = Infinity\r\n let yMax = -Infinity\r\n\r\n let pts = [\r\n new Point(this.x, this.y),\r\n new Point(this.x2, this.y),\r\n new Point(this.x, this.y2),\r\n new Point(this.x2, this.y2)\r\n ]\r\n\r\n pts.forEach(function (p) {\r\n p = p.transform(m)\r\n xMin = Math.min(xMin, p.x)\r\n xMax = Math.max(xMax, p.x)\r\n yMin = Math.min(yMin, p.y)\r\n yMax = Math.max(yMax, p.y)\r\n })\r\n\r\n return new Box(\r\n xMin, yMin,\r\n xMax - xMin,\r\n yMax - yMin\r\n )\r\n }\r\n\r\n addOffset () {\r\n // offset by window scroll position, because getBoundingClientRect changes when window is scrolled\r\n this.x += globals.window.pageXOffset\r\n this.y += globals.window.pageYOffset\r\n return this\r\n }\r\n\r\n toString () {\r\n return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height\r\n }\r\n\r\n toArray () {\r\n return [this.x, this.y, this.width, this.height]\r\n }\r\n\r\n isNulled () {\r\n return isNulledBox(this)\r\n }\r\n}\r\n\r\nfunction getBox (cb) {\r\n let box\r\n\r\n try {\r\n box = cb(this.node)\r\n\r\n if (isNulledBox(box) && !domContains(this.node)) {\r\n throw new Error('Element not in the dom')\r\n }\r\n } catch (e) {\r\n try {\r\n let clone = this.clone().addTo(parser().svg).show()\r\n box = cb(clone.node)\r\n clone.remove()\r\n } catch (e) {\r\n throw new Error('Getting a bounding box of element \"' + this.node.nodeName + '\" is not possible')\r\n }\r\n }\r\n return box\r\n}\r\n\r\nexport function bbox () {\r\n return new Box(getBox.call(this, (node) => node.getBBox()))\r\n}\r\n\r\nexport function rbox (el) {\r\n let box = new Box(getBox.call(this, (node) => node.getBoundingClientRect()))\r\n if (el) return box.transform(el.screenCTM().inverse())\r\n return box.addOffset()\r\n}\r\n\r\nregisterMethods({\r\n viewbox: {\r\n viewbox (x, y, width, height) {\r\n // act as getter\r\n if (x == null) return new Box(this.attr('viewBox'))\r\n\r\n // act as setter\r\n return this.attr('viewBox', new Box(x, y, width, height))\r\n }\r\n }\r\n})\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { radians } from '../utils/utils.js'\r\nimport Element from '../elements/Element.js'\r\nimport Point from './Point.js'\r\n\r\nfunction closeEnough (a, b, threshold) {\r\n return Math.abs(b - a) < (threshold || 1e-6)\r\n}\r\n\r\nexport default class Matrix {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n // Initialize\r\n init (source) {\r\n var base = Matrix.fromArray([1, 0, 0, 1, 0, 0])\r\n\r\n // ensure source as object\r\n source = source instanceof Element ? source.matrixify()\r\n : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat))\r\n : Array.isArray(source) ? Matrix.fromArray(source)\r\n : (typeof source === 'object' && Matrix.isMatrixLike(source)) ? source\r\n : (typeof source === 'object') ? new Matrix().transform(source)\r\n : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments))\r\n : base\r\n\r\n // Merge the source matrix with the base matrix\r\n this.a = source.a != null ? source.a : base.a\r\n this.b = source.b != null ? source.b : base.b\r\n this.c = source.c != null ? source.c : base.c\r\n this.d = source.d != null ? source.d : base.d\r\n this.e = source.e != null ? source.e : base.e\r\n this.f = source.f != null ? source.f : base.f\r\n\r\n return this\r\n }\r\n\r\n // Clones this matrix\r\n clone () {\r\n return new Matrix(this)\r\n }\r\n\r\n // Transform a matrix into another matrix by manipulating the space\r\n transform (o) {\r\n // Check if o is a matrix and then left multiply it directly\r\n if (Matrix.isMatrixLike(o)) {\r\n var matrix = new Matrix(o)\r\n return matrix.multiplyO(this)\r\n }\r\n\r\n // Get the proposed transformations and the current transformations\r\n var t = Matrix.formatTransforms(o)\r\n var current = this\r\n let { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current)\r\n\r\n // Construct the resulting matrix\r\n var transformer = new Matrix()\r\n .translateO(t.rx, t.ry)\r\n .lmultiplyO(current)\r\n .translateO(-ox, -oy)\r\n .scaleO(t.scaleX, t.scaleY)\r\n .skewO(t.skewX, t.skewY)\r\n .shearO(t.shear)\r\n .rotateO(t.theta)\r\n .translateO(ox, oy)\r\n\r\n // If we want the origin at a particular place, we force it there\r\n if (isFinite(t.px) || isFinite(t.py)) {\r\n const origin = new Point(ox, oy).transform(transformer)\r\n // TODO: Replace t.px with isFinite(t.px)\r\n const dx = t.px ? t.px - origin.x : 0\r\n const dy = t.py ? t.py - origin.y : 0\r\n transformer.translateO(dx, dy)\r\n }\r\n\r\n // Translate now after positioning\r\n transformer.translateO(t.tx, t.ty)\r\n return transformer\r\n }\r\n\r\n // Applies a matrix defined by its affine parameters\r\n compose (o) {\r\n if (o.origin) {\r\n o.originX = o.origin[0]\r\n o.originY = o.origin[1]\r\n }\r\n // Get the parameters\r\n var ox = o.originX || 0\r\n var oy = o.originY || 0\r\n var sx = o.scaleX || 1\r\n var sy = o.scaleY || 1\r\n var lam = o.shear || 0\r\n var theta = o.rotate || 0\r\n var tx = o.translateX || 0\r\n var ty = o.translateY || 0\r\n\r\n // Apply the standard matrix\r\n var result = new Matrix()\r\n .translateO(-ox, -oy)\r\n .scaleO(sx, sy)\r\n .shearO(lam)\r\n .rotateO(theta)\r\n .translateO(tx, ty)\r\n .lmultiplyO(this)\r\n .translateO(ox, oy)\r\n return result\r\n }\r\n\r\n // Decomposes this matrix into its affine parameters\r\n decompose (cx = 0, cy = 0) {\r\n // Get the parameters from the matrix\r\n var a = this.a\r\n var b = this.b\r\n var c = this.c\r\n var d = this.d\r\n var e = this.e\r\n var f = this.f\r\n\r\n // Figure out if the winding direction is clockwise or counterclockwise\r\n var determinant = a * d - b * c\r\n var ccw = determinant > 0 ? 1 : -1\r\n\r\n // Since we only shear in x, we can use the x basis to get the x scale\r\n // and the rotation of the resulting matrix\r\n var sx = ccw * Math.sqrt(a * a + b * b)\r\n var thetaRad = Math.atan2(ccw * b, ccw * a)\r\n var theta = 180 / Math.PI * thetaRad\r\n var ct = Math.cos(thetaRad)\r\n var st = Math.sin(thetaRad)\r\n\r\n // We can then solve the y basis vector simultaneously to get the other\r\n // two affine parameters directly from these parameters\r\n var lam = (a * c + b * d) / determinant\r\n var sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a))\r\n\r\n // Use the translations\r\n let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy)\r\n let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy)\r\n\r\n // Construct the decomposition and return it\r\n return {\r\n // Return the affine parameters\r\n scaleX: sx,\r\n scaleY: sy,\r\n shear: lam,\r\n rotate: theta,\r\n translateX: tx,\r\n translateY: ty,\r\n originX: cx,\r\n originY: cy,\r\n\r\n // Return the matrix parameters\r\n a: this.a,\r\n b: this.b,\r\n c: this.c,\r\n d: this.d,\r\n e: this.e,\r\n f: this.f\r\n }\r\n }\r\n\r\n // Left multiplies by the given matrix\r\n multiply (matrix) {\r\n return this.clone().multiplyO(matrix)\r\n }\r\n\r\n multiplyO (matrix) {\r\n // Get the matrices\r\n var l = this\r\n var r = matrix instanceof Matrix\r\n ? matrix\r\n : new Matrix(matrix)\r\n\r\n return Matrix.matrixMultiply(l, r, this)\r\n }\r\n\r\n lmultiply (matrix) {\r\n return this.clone().lmultiplyO(matrix)\r\n }\r\n\r\n lmultiplyO (matrix) {\r\n var r = this\r\n var l = matrix instanceof Matrix\r\n ? matrix\r\n : new Matrix(matrix)\r\n\r\n return Matrix.matrixMultiply(l, r, this)\r\n }\r\n\r\n // Inverses matrix\r\n inverseO () {\r\n // Get the current parameters out of the matrix\r\n var a = this.a\r\n var b = this.b\r\n var c = this.c\r\n var d = this.d\r\n var e = this.e\r\n var f = this.f\r\n\r\n // Invert the 2x2 matrix in the top left\r\n var det = a * d - b * c\r\n if (!det) throw new Error('Cannot invert ' + this)\r\n\r\n // Calculate the top 2x2 matrix\r\n var na = d / det\r\n var nb = -b / det\r\n var nc = -c / det\r\n var nd = a / det\r\n\r\n // Apply the inverted matrix to the top right\r\n var ne = -(na * e + nc * f)\r\n var nf = -(nb * e + nd * f)\r\n\r\n // Construct the inverted matrix\r\n this.a = na\r\n this.b = nb\r\n this.c = nc\r\n this.d = nd\r\n this.e = ne\r\n this.f = nf\r\n\r\n return this\r\n }\r\n\r\n inverse () {\r\n return this.clone().inverseO()\r\n }\r\n\r\n // Translate matrix\r\n translate (x, y) {\r\n return this.clone().translateO(x, y)\r\n }\r\n\r\n translateO (x, y) {\r\n this.e += x || 0\r\n this.f += y || 0\r\n return this\r\n }\r\n\r\n // Scale matrix\r\n scale (x, y, cx, cy) {\r\n return this.clone().scaleO(...arguments)\r\n }\r\n\r\n scaleO (x, y = x, cx = 0, cy = 0) {\r\n // Support uniform scaling\r\n if (arguments.length === 3) {\r\n cy = cx\r\n cx = y\r\n y = x\r\n }\r\n\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a * x\r\n this.b = b * y\r\n this.c = c * x\r\n this.d = d * y\r\n this.e = e * x - cx * x + cx\r\n this.f = f * y - cy * y + cy\r\n\r\n return this\r\n }\r\n\r\n // Rotate matrix\r\n rotate (r, cx, cy) {\r\n return this.clone().rotateO(r, cx, cy)\r\n }\r\n\r\n rotateO (r, cx = 0, cy = 0) {\r\n // Convert degrees to radians\r\n r = radians(r)\r\n\r\n let cos = Math.cos(r)\r\n let sin = Math.sin(r)\r\n\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a * cos - b * sin\r\n this.b = b * cos + a * sin\r\n this.c = c * cos - d * sin\r\n this.d = d * cos + c * sin\r\n this.e = e * cos - f * sin + cy * sin - cx * cos + cx\r\n this.f = f * cos + e * sin - cx * sin - cy * cos + cy\r\n\r\n return this\r\n }\r\n\r\n // Flip matrix on x or y, at a given offset\r\n flip (axis, around) {\r\n return this.clone().flipO(axis, around)\r\n }\r\n\r\n flipO (axis, around) {\r\n return axis === 'x' ? this.scaleO(-1, 1, around, 0)\r\n : axis === 'y' ? this.scaleO(1, -1, 0, around)\r\n : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point\r\n }\r\n\r\n // Shear matrix\r\n shear (a, cx, cy) {\r\n return this.clone().shearO(a, cx, cy)\r\n }\r\n\r\n shearO (lx, cx = 0, cy = 0) {\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a + b * lx\r\n this.c = c + d * lx\r\n this.e = e + f * lx - cy * lx\r\n\r\n return this\r\n }\r\n\r\n // Skew Matrix\r\n skew (x, y, cx, cy) {\r\n return this.clone().skewO(...arguments)\r\n }\r\n\r\n skewO (x, y = x, cx = 0, cy = 0) {\r\n // support uniformal skew\r\n if (arguments.length === 3) {\r\n cy = cx\r\n cx = y\r\n y = x\r\n }\r\n\r\n // Convert degrees to radians\r\n x = radians(x)\r\n y = radians(y)\r\n\r\n let lx = Math.tan(x)\r\n let ly = Math.tan(y)\r\n\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a + b * lx\r\n this.b = b + a * ly\r\n this.c = c + d * lx\r\n this.d = d + c * ly\r\n this.e = e + f * lx - cy * lx\r\n this.f = f + e * ly - cx * ly\r\n\r\n return this\r\n }\r\n\r\n // SkewX\r\n skewX (x, cx, cy) {\r\n return this.skew(x, 0, cx, cy)\r\n }\r\n\r\n skewXO (x, cx, cy) {\r\n return this.skewO(x, 0, cx, cy)\r\n }\r\n\r\n // SkewY\r\n skewY (y, cx, cy) {\r\n return this.skew(0, y, cx, cy)\r\n }\r\n\r\n skewYO (y, cx, cy) {\r\n return this.skewO(0, y, cx, cy)\r\n }\r\n\r\n // Transform around a center point\r\n aroundO (cx, cy, matrix) {\r\n var dx = cx || 0\r\n var dy = cy || 0\r\n return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)\r\n }\r\n\r\n around (cx, cy, matrix) {\r\n return this.clone().aroundO(cx, cy, matrix)\r\n }\r\n\r\n // Check if two matrices are equal\r\n equals (other) {\r\n var comp = new Matrix(other)\r\n return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) &&\r\n closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) &&\r\n closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f)\r\n }\r\n\r\n // Convert matrix to string\r\n toString () {\r\n return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'\r\n }\r\n\r\n toArray () {\r\n return [this.a, this.b, this.c, this.d, this.e, this.f]\r\n }\r\n\r\n valueOf () {\r\n return {\r\n a: this.a,\r\n b: this.b,\r\n c: this.c,\r\n d: this.d,\r\n e: this.e,\r\n f: this.f\r\n }\r\n }\r\n\r\n static fromArray (a) {\r\n return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }\r\n }\r\n\r\n static isMatrixLike (o) {\r\n return (\r\n o.a != null ||\r\n o.b != null ||\r\n o.c != null ||\r\n o.d != null ||\r\n o.e != null ||\r\n o.f != null\r\n )\r\n }\r\n\r\n static formatTransforms (o) {\r\n // Get all of the parameters required to form the matrix\r\n var flipBoth = o.flip === 'both' || o.flip === true\r\n var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1\r\n var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1\r\n var skewX = o.skew && o.skew.length ? o.skew[0]\r\n : isFinite(o.skew) ? o.skew\r\n : isFinite(o.skewX) ? o.skewX\r\n : 0\r\n var skewY = o.skew && o.skew.length ? o.skew[1]\r\n : isFinite(o.skew) ? o.skew\r\n : isFinite(o.skewY) ? o.skewY\r\n : 0\r\n var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX\r\n : isFinite(o.scale) ? o.scale * flipX\r\n : isFinite(o.scaleX) ? o.scaleX * flipX\r\n : flipX\r\n var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY\r\n : isFinite(o.scale) ? o.scale * flipY\r\n : isFinite(o.scaleY) ? o.scaleY * flipY\r\n : flipY\r\n var shear = o.shear || 0\r\n var theta = o.rotate || o.theta || 0\r\n var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY)\r\n var ox = origin.x\r\n var oy = origin.y\r\n var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY)\r\n var px = position.x\r\n var py = position.y\r\n var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY)\r\n var tx = translate.x\r\n var ty = translate.y\r\n var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY)\r\n var rx = relative.x\r\n var ry = relative.y\r\n\r\n // Populate all of the values\r\n return {\r\n scaleX, scaleY, skewX, skewY, shear, theta, rx, ry, tx, ty, ox, oy, px, py\r\n }\r\n }\r\n\r\n // left matrix, right matrix, target matrix which is overwritten\r\n static matrixMultiply (l, r, o) {\r\n // Work out the product directly\r\n var a = l.a * r.a + l.c * r.b\r\n var b = l.b * r.a + l.d * r.b\r\n var c = l.a * r.c + l.c * r.d\r\n var d = l.b * r.c + l.d * r.d\r\n var e = l.e + l.a * r.e + l.c * r.f\r\n var f = l.f + l.b * r.e + l.d * r.f\r\n\r\n // make sure to use local variables because l/r and o could be the same\r\n o.a = a\r\n o.b = b\r\n o.c = c\r\n o.d = d\r\n o.e = e\r\n o.f = f\r\n\r\n return o\r\n }\r\n}\r\n\r\nexport function ctm () {\r\n return new Matrix(this.node.getCTM())\r\n}\r\n\r\nexport function screenCTM () {\r\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537\r\n This is needed because FF does not return the transformation matrix\r\n for the inner coordinate system when getScreenCTM() is called on nested svgs.\r\n However all other Browsers do that */\r\n if (typeof this.isRoot === 'function' && !this.isRoot()) {\r\n var rect = this.rect(1, 1)\r\n var m = rect.node.getScreenCTM()\r\n rect.remove()\r\n return new Matrix(m)\r\n }\r\n return new Matrix(this.node.getScreenCTM())\r\n}\r\n","/* eslint no-new-func: \"off\" */\r\nexport const subClassArray = (function () {\r\n try {\r\n // try es6 subclassing\r\n return Function('name', 'baseClass', '_constructor', [\r\n 'baseClass = baseClass || Array',\r\n 'return {',\r\n ' [name]: class extends baseClass {',\r\n ' constructor (...args) {',\r\n ' super(...args)',\r\n ' _constructor && _constructor.apply(this, args)',\r\n ' }',\r\n ' }',\r\n '}[name]'\r\n ].join('\\n'))\r\n } catch (e) {\r\n // Use es5 approach\r\n return (name, baseClass = Array, _constructor) => {\r\n const Arr = function () {\r\n baseClass.apply(this, arguments)\r\n _constructor && _constructor.apply(this, arguments)\r\n }\r\n\r\n Arr.prototype = Object.create(baseClass.prototype)\r\n Arr.prototype.constructor = Arr\r\n\r\n Arr.prototype.map = function (fn) {\r\n const arr = new Arr()\r\n arr.push.apply(arr, Array.prototype.map.call(this, fn))\r\n return arr\r\n }\r\n\r\n return Arr\r\n }\r\n }\r\n})()\r\n","import { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\n\r\nconst List = subClassArray('List', Array, function (arr = []) {\r\n // This catches the case, that native map tries to create an array with new Array(1)\r\n if (typeof arr === 'number') return this\r\n this.length = 0\r\n this.push(...arr)\r\n})\r\n\r\nexport default List\r\n\r\nextend(List, {\r\n each (fnOrMethodName, ...args) {\r\n if (typeof fnOrMethodName === 'function') {\r\n this.forEach((el) => { fnOrMethodName.call(el, el) })\r\n } else {\r\n return this.map(el => { return el[fnOrMethodName](...args) })\r\n }\r\n\r\n return this\r\n },\r\n\r\n toArray () {\r\n return Array.prototype.concat.apply([], this)\r\n }\r\n})\r\n\r\nList.extend = function (methods) {\r\n methods = methods.reduce((obj, name) => {\r\n obj[name] = function (...attrs) {\r\n return this.each(name, ...attrs)\r\n }\r\n return obj\r\n }, {})\r\n\r\n extend(List, methods)\r\n}\r\n","import { adopt } from '../../utils/adopter.js'\r\nimport { globals } from '../../utils/window.js'\r\nimport { map } from '../../utils/utils.js'\r\nimport List from '../../types/List.js'\r\n\r\nexport default function baseFind (query, parent) {\r\n return new List(map((parent || globals.document).querySelectorAll(query), function (node) {\r\n return adopt(node)\r\n }))\r\n}\r\n\r\n// Scoped find method\r\nexport function find (query) {\r\n return baseFind(query, this.node)\r\n}\r\n","import { dispatch, off, on } from '../modules/core/event.js'\r\nimport Base from './Base.js'\r\n\r\nexport default class EventTarget extends Base {\r\n constructor ({ events = {} } = {}) {\r\n super()\r\n this.events = events\r\n }\r\n\r\n addEventListener () {}\r\n\r\n dispatch (event, data) {\r\n return dispatch(this, event, data)\r\n }\r\n\r\n dispatchEvent (event) {\r\n const bag = this.getEventHolder().events\r\n if (!bag) return true\r\n\r\n const events = bag[event.type]\r\n\r\n for (let i in events) {\r\n for (let j in events[i]) {\r\n events[i][j](event)\r\n }\r\n }\r\n\r\n return !event.defaultPrevented\r\n }\r\n\r\n // Fire given event\r\n fire (event, data) {\r\n this.dispatch(event, data)\r\n return this\r\n }\r\n\r\n getEventHolder () {\r\n return this\r\n }\r\n\r\n getEventTarget () {\r\n return this\r\n }\r\n\r\n // Unbind event from listener\r\n off (event, listener) {\r\n off(this, event, listener)\r\n return this\r\n }\r\n\r\n // Bind given event to listener\r\n on (event, listener, binding, options) {\r\n on(this, event, listener, binding, options)\r\n return this\r\n }\r\n\r\n removeEventListener () {}\r\n}\r\n","\r\nexport function noop () {}\r\n\r\n// Default animation values\r\nexport let timeline = {\r\n duration: 400,\r\n ease: '>',\r\n delay: 0\r\n}\r\n\r\n// Default attribute values\r\nexport let attrs = {\r\n\r\n // fill and stroke\r\n 'fill-opacity': 1,\r\n 'stroke-opacity': 1,\r\n 'stroke-width': 0,\r\n 'stroke-linejoin': 'miter',\r\n 'stroke-linecap': 'butt',\r\n fill: '#000000',\r\n stroke: '#000000',\r\n opacity: 1,\r\n\r\n // position\r\n x: 0,\r\n y: 0,\r\n cx: 0,\r\n cy: 0,\r\n\r\n // size\r\n width: 0,\r\n height: 0,\r\n\r\n // radius\r\n r: 0,\r\n rx: 0,\r\n ry: 0,\r\n\r\n // gradient\r\n offset: 0,\r\n 'stop-opacity': 1,\r\n 'stop-color': '#000000',\r\n\r\n // text\r\n 'font-size': 16,\r\n 'font-family': 'Helvetica, Arial, sans-serif',\r\n 'text-anchor': 'start'\r\n}\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\n\r\nconst SVGArray = subClassArray('SVGArray', Array, function (arr) {\r\n this.init(arr)\r\n})\r\n\r\nexport default SVGArray\r\n\r\nextend(SVGArray, {\r\n init (arr) {\r\n // This catches the case, that native map tries to create an array with new Array(1)\r\n if (typeof arr === 'number') return this\r\n this.length = 0\r\n this.push(...this.parse(arr))\r\n return this\r\n },\r\n\r\n toArray () {\r\n return Array.prototype.concat.apply([], this)\r\n },\r\n\r\n toString () {\r\n return this.join(' ')\r\n },\r\n\r\n // Flattens the array if needed\r\n valueOf () {\r\n const ret = []\r\n ret.push(...this)\r\n return ret\r\n },\r\n\r\n // Parse whitespace separated string\r\n parse (array = []) {\r\n // If already is an array, no need to parse it\r\n if (array instanceof Array) return array\r\n\r\n return array.trim().split(delimiter).map(parseFloat)\r\n },\r\n\r\n clone () {\r\n return new this.constructor(this)\r\n },\r\n\r\n toSet () {\r\n return new Set(this)\r\n }\r\n})\r\n","import { numberAndUnit } from '../modules/core/regex.js'\r\n\r\n// Module for unit convertions\r\nexport default class SVGNumber {\r\n // Initialize\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (value, unit) {\r\n unit = Array.isArray(value) ? value[1] : unit\r\n value = Array.isArray(value) ? value[0] : value\r\n\r\n // initialize defaults\r\n this.value = 0\r\n this.unit = unit || ''\r\n\r\n // parse value\r\n if (typeof value === 'number') {\r\n // ensure a valid numeric value\r\n this.value = isNaN(value) ? 0 : !isFinite(value) ? (value < 0 ? -3.4e+38 : +3.4e+38) : value\r\n } else if (typeof value === 'string') {\r\n unit = value.match(numberAndUnit)\r\n\r\n if (unit) {\r\n // make value numeric\r\n this.value = parseFloat(unit[1])\r\n\r\n // normalize\r\n if (unit[5] === '%') { this.value /= 100 } else if (unit[5] === 's') {\r\n this.value *= 1000\r\n }\r\n\r\n // store unit\r\n this.unit = unit[5]\r\n }\r\n } else {\r\n if (value instanceof SVGNumber) {\r\n this.value = value.valueOf()\r\n this.unit = value.unit\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n toString () {\r\n return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6\r\n : this.unit === 's' ? this.value / 1e3\r\n : this.value\r\n ) + this.unit\r\n }\r\n\r\n toJSON () {\r\n return this.toString()\r\n }\r\n\r\n toArray () {\r\n return [this.value, this.unit]\r\n }\r\n\r\n valueOf () {\r\n return this.value\r\n }\r\n\r\n // Add number\r\n plus (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this + number, this.unit || number.unit)\r\n }\r\n\r\n // Subtract number\r\n minus (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this - number, this.unit || number.unit)\r\n }\r\n\r\n // Multiply number\r\n times (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this * number, this.unit || number.unit)\r\n }\r\n\r\n // Divide number\r\n divide (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this / number, this.unit || number.unit)\r\n }\r\n}\r\n","import { attrs as defaults } from './defaults.js'\r\nimport { isNumber } from './regex.js'\r\nimport Color from '../../types/Color.js'\r\nimport SVGArray from '../../types/SVGArray.js'\r\nimport SVGNumber from '../../types/SVGNumber.js'\r\n\r\nconst hooks = []\r\nexport function registerAttrHook (fn) {\r\n hooks.push(fn)\r\n}\r\n\r\n// Set svg element attribute\r\nexport default function attr (attr, val, ns) {\r\n // act as full getter\r\n if (attr == null) {\r\n // get an object of attributes\r\n attr = {}\r\n val = this.node.attributes\r\n\r\n for (let node of val) {\r\n attr[node.nodeName] = isNumber.test(node.nodeValue)\r\n ? parseFloat(node.nodeValue)\r\n : node.nodeValue\r\n }\r\n\r\n return attr\r\n } else if (attr instanceof Array) {\r\n // loop through array and get all values\r\n return attr.reduce((last, curr) => {\r\n last[curr] = this.attr(curr)\r\n return last\r\n }, {})\r\n } else if (typeof attr === 'object') {\r\n // apply every attribute individually if an object is passed\r\n for (val in attr) this.attr(val, attr[val])\r\n } else if (val === null) {\r\n // remove value\r\n this.node.removeAttribute(attr)\r\n } else if (val == null) {\r\n // act as a getter if the first and only argument is not an object\r\n val = this.node.getAttribute(attr)\r\n return val == null ? defaults[attr]\r\n : isNumber.test(val) ? parseFloat(val)\r\n : val\r\n } else {\r\n // Loop through hooks and execute them to convert value\r\n val = hooks.reduce((_val, hook) => {\r\n return hook(attr, _val, this)\r\n }, val)\r\n\r\n // ensure correct numeric values (also accepts NaN and Infinity)\r\n if (typeof val === 'number') {\r\n val = new SVGNumber(val)\r\n } else if (Color.isColor(val)) {\r\n // ensure full hex color\r\n val = new Color(val)\r\n } else if (val.constructor === Array) {\r\n // Check for plain arrays and parse array values\r\n val = new SVGArray(val)\r\n }\r\n\r\n // if the passed attribute is leading...\r\n if (attr === 'leading') {\r\n // ... call the leading method instead\r\n if (this.leading) {\r\n this.leading(val)\r\n }\r\n } else {\r\n // set given attribute on node\r\n typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString())\r\n : this.node.setAttribute(attr, val.toString())\r\n }\r\n\r\n // rebuild if required\r\n if (this.rebuild && (attr === 'font-size' || attr === 'x')) {\r\n this.rebuild()\r\n }\r\n }\r\n\r\n return this\r\n}\r\n","import {\r\n adopt,\r\n assignNewId,\r\n eid,\r\n extend,\r\n makeInstance,\r\n makeNode,\r\n register\r\n} from '../utils/adopter.js'\r\nimport { find } from '../modules/core/selector.js'\r\nimport { globals } from '../utils/window.js'\r\nimport { map } from '../utils/utils.js'\r\nimport { ns } from '../modules/core/namespaces.js'\r\nimport EventTarget from '../types/EventTarget.js'\r\nimport List from '../types/List.js'\r\nimport attr from '../modules/core/attr.js'\r\n\r\nexport default class Dom extends EventTarget {\r\n constructor (node, attrs) {\r\n super(node)\r\n this.node = node\r\n this.type = node.nodeName\r\n\r\n if (attrs && node !== attrs) {\r\n this.attr(attrs)\r\n }\r\n }\r\n\r\n // Add given element at a position\r\n add (element, i) {\r\n element = makeInstance(element)\r\n\r\n if (i == null) {\r\n this.node.appendChild(element.node)\r\n } else if (element.node !== this.node.childNodes[i]) {\r\n this.node.insertBefore(element.node, this.node.childNodes[i])\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Add element to given container and return self\r\n addTo (parent) {\r\n return makeInstance(parent).put(this)\r\n }\r\n\r\n // Returns all child elements\r\n children () {\r\n return new List(map(this.node.children, function (node) {\r\n return adopt(node)\r\n }))\r\n }\r\n\r\n // Remove all elements in this container\r\n clear () {\r\n // remove children\r\n while (this.node.hasChildNodes()) {\r\n this.node.removeChild(this.node.lastChild)\r\n }\r\n\r\n // remove defs reference\r\n delete this._defs\r\n\r\n return this\r\n }\r\n\r\n // Clone element\r\n clone () {\r\n // write dom data to the dom so the clone can pickup the data\r\n this.writeDataToDom()\r\n\r\n // clone element and assign new id\r\n return assignNewId(this.node.cloneNode(true))\r\n }\r\n\r\n // Iterates over all children and invokes a given block\r\n each (block, deep) {\r\n var children = this.children()\r\n var i, il\r\n\r\n for (i = 0, il = children.length; i < il; i++) {\r\n block.apply(children[i], [i, children])\r\n\r\n if (deep) {\r\n children[i].each(block, deep)\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n element (nodeName) {\r\n return this.put(new Dom(makeNode(nodeName)))\r\n }\r\n\r\n // Get first child\r\n first () {\r\n return adopt(this.node.firstChild)\r\n }\r\n\r\n // Get a element at the given index\r\n get (i) {\r\n return adopt(this.node.childNodes[i])\r\n }\r\n\r\n getEventHolder () {\r\n return this.node\r\n }\r\n\r\n getEventTarget () {\r\n return this.node\r\n }\r\n\r\n // Checks if the given element is a child\r\n has (element) {\r\n return this.index(element) >= 0\r\n }\r\n\r\n // Get / set id\r\n id (id) {\r\n // generate new id if no id set\r\n if (typeof id === 'undefined' && !this.node.id) {\r\n this.node.id = eid(this.type)\r\n }\r\n\r\n // dont't set directly width this.node.id to make `null` work correctly\r\n return this.attr('id', id)\r\n }\r\n\r\n // Gets index of given element\r\n index (element) {\r\n return [].slice.call(this.node.childNodes).indexOf(element.node)\r\n }\r\n\r\n // Get the last child\r\n last () {\r\n return adopt(this.node.lastChild)\r\n }\r\n\r\n // matches the element vs a css selector\r\n matches (selector) {\r\n const el = this.node\r\n return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector)\r\n }\r\n\r\n // Returns the parent element instance\r\n parent (type) {\r\n var parent = this\r\n\r\n // check for parent\r\n if (!parent.node.parentNode) return null\r\n\r\n // get parent element\r\n parent = adopt(parent.node.parentNode)\r\n\r\n if (!type) return parent\r\n\r\n // loop trough ancestors if type is given\r\n while (parent && parent.node instanceof globals.window.SVGElement) { // FIXME: That shouldnt be neccessary\r\n if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent\r\n parent = adopt(parent.node.parentNode)\r\n }\r\n }\r\n\r\n // Basically does the same as `add()` but returns the added element instead\r\n put (element, i) {\r\n this.add(element, i)\r\n return element\r\n }\r\n\r\n // Add element to given container and return container\r\n putIn (parent) {\r\n return makeInstance(parent).add(this)\r\n }\r\n\r\n // Remove element\r\n remove () {\r\n if (this.parent()) {\r\n this.parent().removeElement(this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Remove a given child\r\n removeElement (element) {\r\n this.node.removeChild(element.node)\r\n\r\n return this\r\n }\r\n\r\n // Replace this with element\r\n replace (element) {\r\n element = makeInstance(element)\r\n this.node.parentNode.replaceChild(element.node, this.node)\r\n return element\r\n }\r\n\r\n round (precision = 2, map) {\r\n const factor = 10 ** precision\r\n const attrs = this.attr()\r\n\r\n // If we have no map, build one from attrs\r\n if (!map) {\r\n map = Object.keys(attrs)\r\n }\r\n\r\n // Holds rounded attributes\r\n const newAttrs = {}\r\n map.forEach((key) => {\r\n newAttrs[key] = Math.round(attrs[key] * factor) / factor\r\n })\r\n\r\n this.attr(newAttrs)\r\n return this\r\n }\r\n\r\n // Return id on string conversion\r\n toString () {\r\n return this.id()\r\n }\r\n\r\n // Import raw svg\r\n svg (svgOrFn, outerHTML) {\r\n var well, len, fragment\r\n\r\n if (svgOrFn === false) {\r\n outerHTML = false\r\n svgOrFn = null\r\n }\r\n\r\n // act as getter if no svg string is given\r\n if (svgOrFn == null || typeof svgOrFn === 'function') {\r\n // The default for exports is, that the outerNode is included\r\n outerHTML = outerHTML == null ? true : outerHTML\r\n\r\n // write svgjs data to the dom\r\n this.writeDataToDom()\r\n let current = this\r\n\r\n // An export modifier was passed\r\n if (svgOrFn != null) {\r\n current = adopt(current.node.cloneNode(true))\r\n\r\n // If the user wants outerHTML we need to process this node, too\r\n if (outerHTML) {\r\n let result = svgOrFn(current)\r\n current = result || current\r\n\r\n // The user does not want this node? Well, then he gets nothing\r\n if (result === false) return ''\r\n }\r\n\r\n // Deep loop through all children and apply modifier\r\n current.each(function () {\r\n let result = svgOrFn(this)\r\n let _this = result || this\r\n\r\n // If modifier returns false, discard node\r\n if (result === false) {\r\n this.remove()\r\n\r\n // If modifier returns new node, use it\r\n } else if (result && this !== _this) {\r\n this.replace(_this)\r\n }\r\n }, true)\r\n }\r\n\r\n // Return outer or inner content\r\n return outerHTML\r\n ? current.node.outerHTML\r\n : current.node.innerHTML\r\n }\r\n\r\n // Act as setter if we got a string\r\n\r\n // The default for import is, that the current node is not replaced\r\n outerHTML = outerHTML == null ? false : outerHTML\r\n\r\n // Create temporary holder\r\n well = globals.document.createElementNS(ns, 'svg')\r\n fragment = globals.document.createDocumentFragment()\r\n\r\n // Dump raw svg\r\n well.innerHTML = svgOrFn\r\n\r\n // Transplant nodes into the fragment\r\n for (len = well.children.length; len--;) {\r\n fragment.appendChild(well.firstElementChild)\r\n }\r\n\r\n let parent = this.parent()\r\n\r\n // Add the whole fragment at once\r\n return outerHTML\r\n ? this.replace(fragment) && parent\r\n : this.add(fragment)\r\n }\r\n\r\n words (text) {\r\n // This is faster than removing all children and adding a new one\r\n this.node.textContent = text\r\n return this\r\n }\r\n\r\n // write svgjs data to the dom\r\n writeDataToDom () {\r\n // dump variables recursively\r\n this.each(function () {\r\n this.writeDataToDom()\r\n })\r\n\r\n return this\r\n }\r\n}\r\n\r\nextend(Dom, { attr, find })\r\nregister(Dom)\r\n","import { bbox, rbox } from '../types/Box.js'\r\nimport { ctm, screenCTM } from '../types/Matrix.js'\r\nimport {\r\n extend,\r\n getClass,\r\n makeInstance,\r\n register,\r\n root\r\n} from '../utils/adopter.js'\r\nimport { globals } from '../utils/window.js'\r\nimport { point } from '../types/Point.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { reference } from '../modules/core/regex.js'\r\nimport Dom from './Dom.js'\r\nimport List from '../types/List.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\n\r\nconst Svg = getClass(root)\r\n\r\nexport default class Element extends Dom {\r\n constructor (node, attrs) {\r\n super(node, attrs)\r\n\r\n // initialize data object\r\n this.dom = {}\r\n\r\n // create circular reference\r\n this.node.instance = this\r\n\r\n if (node.hasAttribute('svgjs:data')) {\r\n // pull svgjs data from the dom (getAttributeNS doesn't work in html5)\r\n this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {})\r\n }\r\n }\r\n\r\n // Move element by its center\r\n center (x, y) {\r\n return this.cx(x).cy(y)\r\n }\r\n\r\n // Move by center over x-axis\r\n cx (x) {\r\n return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2)\r\n }\r\n\r\n // Move by center over y-axis\r\n cy (y) {\r\n return y == null\r\n ? this.y() + this.height() / 2\r\n : this.y(y - this.height() / 2)\r\n }\r\n\r\n // Get defs\r\n defs () {\r\n return this.root().defs()\r\n }\r\n\r\n // Get parent document\r\n root () {\r\n let p = this.parent(Svg)\r\n return p && p.root()\r\n }\r\n\r\n getEventHolder () {\r\n return this\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return this.attr('height', height)\r\n }\r\n\r\n // Checks whether the given point inside the bounding box of the element\r\n inside (x, y) {\r\n let box = this.bbox()\r\n\r\n return x > box.x &&\r\n y > box.y &&\r\n x < box.x + box.width &&\r\n y < box.y + box.height\r\n }\r\n\r\n // Move element to given x and y values\r\n move (x, y) {\r\n return this.x(x).y(y)\r\n }\r\n\r\n // return array of all ancestors of given type up to the root svg\r\n parents (until = globals.document) {\r\n until = makeInstance(until)\r\n let parents = new List()\r\n let parent = this\r\n\r\n while (\r\n (parent = parent.parent()) &&\r\n parent.node !== until.node &&\r\n parent.node !== globals.document\r\n ) {\r\n parents.push(parent)\r\n }\r\n\r\n return parents\r\n }\r\n\r\n // Get referenced element form attribute value\r\n reference (attr) {\r\n attr = this.attr(attr)\r\n if (!attr) return null\r\n\r\n const m = attr.match(reference)\r\n return m ? makeInstance(m[1]) : null\r\n }\r\n\r\n // set given data to the elements data property\r\n setData (o) {\r\n this.dom = o\r\n return this\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n let p = proportionalSize(this, width, height)\r\n\r\n return this\r\n .width(new SVGNumber(p.width))\r\n .height(new SVGNumber(p.height))\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return this.attr('width', width)\r\n }\r\n\r\n // write svgjs data to the dom\r\n writeDataToDom () {\r\n // remove previously set data\r\n this.node.removeAttribute('svgjs:data')\r\n\r\n if (Object.keys(this.dom).length) {\r\n this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)) // see #428\r\n }\r\n\r\n return super.writeDataToDom()\r\n }\r\n\r\n // Move over x-axis\r\n x (x) {\r\n return this.attr('x', x)\r\n }\r\n\r\n // Move over y-axis\r\n y (y) {\r\n return this.attr('y', y)\r\n }\r\n}\r\n\r\nextend(Element, {\r\n bbox, rbox, point, ctm, screenCTM\r\n})\r\n\r\nregister(Element)\r\n","import { on, off } from '../core/event.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\nimport Color from '../../types/Color.js'\r\nimport Element from '../../elements/Element.js'\r\nimport Matrix from '../../types/Matrix.js'\r\nimport Point from '../../types/Point.js'\r\nimport SVGNumber from '../../types/SVGNumber.js'\r\n\r\n// Define list of available attributes for stroke and fill\r\nvar sugar = {\r\n stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'],\r\n fill: ['color', 'opacity', 'rule'],\r\n prefix: function (t, a) {\r\n return a === 'color' ? t : t + '-' + a\r\n }\r\n}\r\n\r\n// Add sugar for fill and stroke\r\n;['fill', 'stroke'].forEach(function (m) {\r\n var extension = {}\r\n var i\r\n\r\n extension[m] = function (o) {\r\n if (typeof o === 'undefined') {\r\n return this.attr(m)\r\n }\r\n if (typeof o === 'string' || Color.isRgb(o) || (o instanceof Element)) {\r\n this.attr(m, o)\r\n } else {\r\n // set all attributes from sugar.fill and sugar.stroke list\r\n for (i = sugar[m].length - 1; i >= 0; i--) {\r\n if (o[sugar[m][i]] != null) {\r\n this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]])\r\n }\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n registerMethods(['Shape', 'Runner'], extension)\r\n})\r\n\r\nregisterMethods(['Element', 'Runner'], {\r\n // Let the user set the matrix directly\r\n matrix: function (mat, b, c, d, e, f) {\r\n // Act as a getter\r\n if (mat == null) {\r\n return new Matrix(this)\r\n }\r\n\r\n // Act as a setter, the user can pass a matrix or a set of numbers\r\n return this.attr('transform', new Matrix(mat, b, c, d, e, f))\r\n },\r\n\r\n // Map rotation to transform\r\n rotate: function (angle, cx, cy) {\r\n return this.transform({ rotate: angle, ox: cx, oy: cy }, true)\r\n },\r\n\r\n // Map skew to transform\r\n skew: function (x, y, cx, cy) {\r\n return arguments.length === 1 || arguments.length === 3\r\n ? this.transform({ skew: x, ox: y, oy: cx }, true)\r\n : this.transform({ skew: [x, y], ox: cx, oy: cy }, true)\r\n },\r\n\r\n shear: function (lam, cx, cy) {\r\n return this.transform({ shear: lam, ox: cx, oy: cy }, true)\r\n },\r\n\r\n // Map scale to transform\r\n scale: function (x, y, cx, cy) {\r\n return arguments.length === 1 || arguments.length === 3\r\n ? this.transform({ scale: x, ox: y, oy: cx }, true)\r\n : this.transform({ scale: [x, y], ox: cx, oy: cy }, true)\r\n },\r\n\r\n // Map translate to transform\r\n translate: function (x, y) {\r\n return this.transform({ translate: [x, y] }, true)\r\n },\r\n\r\n // Map relative translations to transform\r\n relative: function (x, y) {\r\n return this.transform({ relative: [x, y] }, true)\r\n },\r\n\r\n // Map flip to transform\r\n flip: function (direction, around) {\r\n var directionString = typeof direction === 'string' ? direction\r\n : isFinite(direction) ? 'both'\r\n : 'both'\r\n var origin = (direction === 'both' && isFinite(around)) ? [around, around]\r\n : (direction === 'x') ? [around, 0]\r\n : (direction === 'y') ? [0, around]\r\n : isFinite(direction) ? [direction, direction]\r\n : [0, 0]\r\n this.transform({ flip: directionString, origin: origin }, true)\r\n },\r\n\r\n // Opacity\r\n opacity: function (value) {\r\n return this.attr('opacity', value)\r\n },\r\n\r\n // Relative move over x and y axes\r\n dmove: function (x, y) {\r\n return this.dx(x).dy(y)\r\n }\r\n})\r\n\r\nregisterMethods('Element', {\r\n // Relative move over x axis\r\n dx: function (x) {\r\n return this.x(new SVGNumber(x).plus(this.x()))\r\n },\r\n\r\n // Relative move over y axis\r\n dy: function (y) {\r\n return this.y(new SVGNumber(y).plus(this.y()))\r\n }\r\n})\r\n\r\nregisterMethods('radius', {\r\n // Add x and y radius\r\n radius: function (x, y) {\r\n var type = (this._element || this).type\r\n return type === 'radialGradient' || type === 'radialGradient'\r\n ? this.attr('r', new SVGNumber(x))\r\n : this.rx(x).ry(y == null ? x : y)\r\n }\r\n})\r\n\r\nregisterMethods('Path', {\r\n // Get path length\r\n length: function () {\r\n return this.node.getTotalLength()\r\n },\r\n // Get point at length\r\n pointAt: function (length) {\r\n return new Point(this.node.getPointAtLength(length))\r\n }\r\n})\r\n\r\nregisterMethods(['Element', 'Runner'], {\r\n // Set font\r\n font: function (a, v) {\r\n if (typeof a === 'object') {\r\n for (v in a) this.font(v, a[v])\r\n }\r\n\r\n return a === 'leading'\r\n ? this.leading(v)\r\n : a === 'anchor'\r\n ? this.attr('text-anchor', v)\r\n : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style'\r\n ? this.attr('font-' + a, v)\r\n : this.attr(a, v)\r\n }\r\n})\r\n\r\nregisterMethods('Text', {\r\n ax (x) {\r\n return this.attr('x', x)\r\n },\r\n ay (y) {\r\n return this.attr('y', y)\r\n },\r\n amove (x, y) {\r\n return this.ax(x).ay(y)\r\n }\r\n})\r\n\r\n// Add events to elements\r\nconst methods = [ 'click',\r\n 'dblclick',\r\n 'mousedown',\r\n 'mouseup',\r\n 'mouseover',\r\n 'mouseout',\r\n 'mousemove',\r\n 'mouseenter',\r\n 'mouseleave',\r\n 'touchstart',\r\n 'touchmove',\r\n 'touchleave',\r\n 'touchend',\r\n 'touchcancel' ].reduce(function (last, event) {\r\n // add event to Element\r\n const fn = function (f) {\r\n if (f === null) {\r\n off(this, event)\r\n } else {\r\n on(this, event, f)\r\n }\r\n return this\r\n }\r\n\r\n last[event] = fn\r\n return last\r\n}, {})\r\n\r\nregisterMethods('Element', methods)\r\n","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"./defineProperty\";\nexport default function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}","import { getOrigin } from '../../utils/utils.js'\r\nimport { delimiter, transforms } from '../core/regex.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\nimport Matrix from '../../types/Matrix.js'\r\n\r\n// Reset all transformations\r\nexport function untransform () {\r\n return this.attr('transform', null)\r\n}\r\n\r\n// merge the whole transformation chain into one matrix and returns it\r\nexport function matrixify () {\r\n var matrix = (this.attr('transform') || '')\r\n // split transformations\r\n .split(transforms).slice(0, -1).map(function (str) {\r\n // generate key => value pairs\r\n var kv = str.trim().split('(')\r\n return [kv[0],\r\n kv[1].split(delimiter)\r\n .map(function (str) { return parseFloat(str) })\r\n ]\r\n })\r\n .reverse()\r\n // merge every transformation into one matrix\r\n .reduce(function (matrix, transform) {\r\n if (transform[0] === 'matrix') {\r\n return matrix.lmultiply(Matrix.fromArray(transform[1]))\r\n }\r\n return matrix[transform[0]].apply(matrix, transform[1])\r\n }, new Matrix())\r\n\r\n return matrix\r\n}\r\n\r\n// add an element to another parent without changing the visual representation on the screen\r\nexport function toParent (parent) {\r\n if (this === parent) return this\r\n var ctm = this.screenCTM()\r\n var pCtm = parent.screenCTM().inverse()\r\n\r\n this.addTo(parent).untransform().transform(pCtm.multiply(ctm))\r\n\r\n return this\r\n}\r\n\r\n// same as above with parent equals root-svg\r\nexport function toRoot () {\r\n return this.toParent(this.root())\r\n}\r\n\r\n// Add transformations\r\nexport function transform (o, relative) {\r\n // Act as a getter if no object was passed\r\n if (o == null || typeof o === 'string') {\r\n var decomposed = new Matrix(this).decompose()\r\n return decomposed[o] || decomposed\r\n }\r\n\r\n if (!Matrix.isMatrixLike(o)) {\r\n // Set the origin according to the defined transform\r\n o = { ...o, origin: getOrigin(o, this) }\r\n }\r\n\r\n // The user can pass a boolean, an Element or an Matrix or nothing\r\n var cleanRelative = relative === true ? this : (relative || false)\r\n var result = new Matrix(cleanRelative).transform(o)\r\n return this.attr('transform', result)\r\n}\r\n\r\nregisterMethods('Element', {\r\n untransform, matrixify, toParent, toRoot, transform\r\n})\r\n","import SVGNumber from '../../types/SVGNumber.js'\r\n\r\n// Radius x value\r\nexport function rx (rx) {\r\n return this.attr('rx', rx)\r\n}\r\n\r\n// Radius y value\r\nexport function ry (ry) {\r\n return this.attr('ry', ry)\r\n}\r\n\r\n// Move over x-axis\r\nexport function x (x) {\r\n return x == null\r\n ? this.cx() - this.rx()\r\n : this.cx(x + this.rx())\r\n}\r\n\r\n// Move over y-axis\r\nexport function y (y) {\r\n return y == null\r\n ? this.cy() - this.ry()\r\n : this.cy(y + this.ry())\r\n}\r\n\r\n// Move by center over x-axis\r\nexport function cx (x) {\r\n return x == null\r\n ? this.attr('cx')\r\n : this.attr('cx', x)\r\n}\r\n\r\n// Move by center over y-axis\r\nexport function cy (y) {\r\n return y == null\r\n ? this.attr('cy')\r\n : this.attr('cy', y)\r\n}\r\n\r\n// Set width of element\r\nexport function width (width) {\r\n return width == null\r\n ? this.rx() * 2\r\n : this.rx(new SVGNumber(width).divide(2))\r\n}\r\n\r\n// Set height of element\r\nexport function height (height) {\r\n return height == null\r\n ? this.ry() * 2\r\n : this.ry(new SVGNumber(height).divide(2))\r\n}\r\n","import { register } from '../utils/adopter.js'\r\nimport Element from './Element.js'\r\n\r\nexport default class Shape extends Element {}\r\n\r\nregister(Shape)\r\n","import { cx, cy, height, width, x, y } from '../modules/core/circled.js'\r\nimport {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Shape from './Shape.js'\r\n\r\nexport default class Circle extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('circle', node), node)\r\n }\r\n\r\n radius (r) {\r\n return this.attr('r', r)\r\n }\r\n\r\n // Radius x value\r\n rx (rx) {\r\n return this.attr('r', rx)\r\n }\r\n\r\n // Alias radius x value\r\n ry (ry) {\r\n return this.rx(ry)\r\n }\r\n\r\n size (size) {\r\n return this.radius(new SVGNumber(size).divide(2))\r\n }\r\n}\r\n\r\nextend(Circle, { x, y, cx, cy, width, height })\r\n\r\nregisterMethods({\r\n Element: {\r\n // Create circle element\r\n circle: wrapWithAttrCheck(function (size) {\r\n return this.put(new Circle())\r\n .size(size)\r\n .move(0, 0)\r\n })\r\n }\r\n})\r\n\r\nregister(Circle)\r\n","import { register } from '../utils/adopter.js'\r\nimport Element from './Element.js'\r\n\r\nexport default class Container extends Element {\r\n flatten (parent) {\r\n this.each(function () {\r\n if (this instanceof Container) return this.flatten(parent).ungroup(parent)\r\n return this.toParent(parent)\r\n })\r\n\r\n // we need this so that the root does not get removed\r\n this.node.firstElementChild || this.remove()\r\n\r\n return this\r\n }\r\n\r\n ungroup (parent) {\r\n parent = parent || this.parent()\r\n\r\n this.each(function () {\r\n return this.toParent(parent)\r\n })\r\n\r\n this.remove()\r\n\r\n return this\r\n }\r\n}\r\n\r\nregister(Container)\r\n","import { nodeOrNew, register } from '../utils/adopter.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class Defs extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('defs', node), node)\r\n }\r\n\r\n flatten () { return this }\r\n ungroup () { return this }\r\n}\r\n\r\nregister(Defs)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Shape from './Shape.js'\r\nimport * as circled from '../modules/core/circled.js'\r\n\r\nexport default class Ellipse extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('ellipse', node), node)\r\n }\r\n\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n\r\n return this\r\n .rx(new SVGNumber(p.width).divide(2))\r\n .ry(new SVGNumber(p.height).divide(2))\r\n }\r\n}\r\n\r\nextend(Ellipse, circled)\r\n\r\nregisterMethods('Container', {\r\n // Create an ellipse\r\n ellipse: wrapWithAttrCheck(function (width, height) {\r\n return this.put(new Ellipse()).size(width, height).move(0, 0)\r\n })\r\n})\r\n\r\nregister(Ellipse)\r\n","import { nodeOrNew, register } from '../utils/adopter.js'\r\nimport Element from './Element.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\n\r\nexport default class Stop extends Element {\r\n constructor (node) {\r\n super(nodeOrNew('stop', node), node)\r\n }\r\n\r\n // add color stops\r\n update (o) {\r\n if (typeof o === 'number' || o instanceof SVGNumber) {\r\n o = {\r\n offset: arguments[0],\r\n color: arguments[1],\r\n opacity: arguments[2]\r\n }\r\n }\r\n\r\n // set attributes\r\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\r\n if (o.color != null) this.attr('stop-color', o.color)\r\n if (o.offset != null) this.attr('offset', new SVGNumber(o.offset))\r\n\r\n return this\r\n }\r\n}\r\n\r\nregister(Stop)\r\n","import SVGNumber from '../../types/SVGNumber.js'\r\n\r\nexport function from (x, y) {\r\n return (this._element || this).type === 'radialGradient'\r\n ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })\r\n : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })\r\n}\r\n\r\nexport function to (x, y) {\r\n return (this._element || this).type === 'radialGradient'\r\n ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })\r\n : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })\r\n}\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Box from '../types/Box.js'\r\nimport Container from './Container.js'\r\nimport Stop from './Stop.js'\r\nimport baseFind from '../modules/core/selector.js'\r\nimport * as gradiented from '../modules/core/gradiented.js'\r\n\r\nexport default class Gradient extends Container {\r\n constructor (type, attrs) {\r\n super(\r\n nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type),\r\n attrs\r\n )\r\n }\r\n\r\n // Add a color stop\r\n stop (offset, color, opacity) {\r\n return this.put(new Stop()).update(offset, color, opacity)\r\n }\r\n\r\n // Update gradient\r\n update (block) {\r\n // remove all stops\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') {\r\n block.call(this, this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Return the fill id\r\n url () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n\r\n // Alias string convertion to fill\r\n toString () {\r\n return this.url()\r\n }\r\n\r\n // custom attr to handle transform\r\n attr (a, b, c) {\r\n if (a === 'transform') a = 'gradientTransform'\r\n return super.attr(a, b, c)\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [fill*=\"' + this.id() + '\"]')\r\n }\r\n\r\n bbox () {\r\n return new Box()\r\n }\r\n}\r\n\r\nextend(Gradient, gradiented)\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create gradient element in defs\r\n gradient: wrapWithAttrCheck(function (type, block) {\r\n return this.defs().gradient(type, block)\r\n })\r\n },\r\n // define gradient\r\n Defs: {\r\n gradient: wrapWithAttrCheck(function (type, block) {\r\n return this.put(new Gradient(type)).update(block)\r\n })\r\n }\r\n})\r\n\r\nregister(Gradient)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Box from '../types/Box.js'\r\nimport Container from './Container.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class Pattern extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('pattern', node), node)\r\n }\r\n\r\n // Return the fill id\r\n url () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n\r\n // Update pattern by rebuilding\r\n update (block) {\r\n // remove content\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') {\r\n block.call(this, this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Alias string convertion to fill\r\n toString () {\r\n return this.url()\r\n }\r\n\r\n // custom attr to handle transform\r\n attr (a, b, c) {\r\n if (a === 'transform') a = 'patternTransform'\r\n return super.attr(a, b, c)\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [fill*=\"' + this.id() + '\"]')\r\n }\r\n\r\n bbox () {\r\n return new Box()\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create pattern element in defs\r\n pattern (...args) {\r\n return this.defs().pattern(...args)\r\n }\r\n },\r\n Defs: {\r\n pattern: wrapWithAttrCheck(function (width, height, block) {\r\n return this.put(new Pattern()).update(block).attr({\r\n x: 0,\r\n y: 0,\r\n width: width,\r\n height: height,\r\n patternUnits: 'userSpaceOnUse'\r\n })\r\n })\r\n }\r\n})\r\n\r\nregister(Pattern)\r\n","import { isImage } from '../modules/core/regex.js'\r\nimport { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { off, on } from '../modules/core/event.js'\r\nimport { registerAttrHook } from '../modules/core/attr.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Pattern from './Pattern.js'\r\nimport Shape from './Shape.js'\r\nimport { globals } from '../utils/window.js'\r\n\r\nexport default class Image extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('image', node), node)\r\n }\r\n\r\n // (re)load image\r\n load (url, callback) {\r\n if (!url) return this\r\n\r\n var img = new globals.window.Image()\r\n\r\n on(img, 'load', function (e) {\r\n var p = this.parent(Pattern)\r\n\r\n // ensure image size\r\n if (this.width() === 0 && this.height() === 0) {\r\n this.size(img.width, img.height)\r\n }\r\n\r\n if (p instanceof Pattern) {\r\n // ensure pattern size if not set\r\n if (p.width() === 0 && p.height() === 0) {\r\n p.size(this.width(), this.height())\r\n }\r\n }\r\n\r\n if (typeof callback === 'function') {\r\n callback.call(this, e)\r\n }\r\n }, this)\r\n\r\n on(img, 'load error', function () {\r\n // dont forget to unbind memory leaking events\r\n off(img)\r\n })\r\n\r\n return this.attr('href', (img.src = url), xlink)\r\n }\r\n}\r\n\r\nregisterAttrHook(function (attr, val, _this) {\r\n // convert image fill and stroke to patterns\r\n if (attr === 'fill' || attr === 'stroke') {\r\n if (isImage.test(val)) {\r\n val = _this.root().defs().image(val)\r\n }\r\n }\r\n\r\n if (val instanceof Image) {\r\n val = _this.root().defs().pattern(0, 0, (pattern) => {\r\n pattern.add(val)\r\n })\r\n }\r\n\r\n return val\r\n})\r\n\r\nregisterMethods({\r\n Container: {\r\n // create image element, load image and set its size\r\n image: wrapWithAttrCheck(function (source, callback) {\r\n return this.put(new Image()).size(0, 0).load(source, callback)\r\n })\r\n }\r\n})\r\n\r\nregister(Image)\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\nimport SVGArray from './SVGArray.js'\r\n\r\nconst PointArray = subClassArray('PointArray', SVGArray)\r\n\r\nexport default PointArray\r\n\r\nextend(PointArray, {\r\n // Convert array to string\r\n toString () {\r\n // convert to a poly point string\r\n for (var i = 0, il = this.length, array = []; i < il; i++) {\r\n array.push(this[i].join(','))\r\n }\r\n\r\n return array.join(' ')\r\n },\r\n\r\n // Convert array to line object\r\n toLine () {\r\n return {\r\n x1: this[0][0],\r\n y1: this[0][1],\r\n x2: this[1][0],\r\n y2: this[1][1]\r\n }\r\n },\r\n\r\n // Get morphed array at given position\r\n at (pos) {\r\n // make sure a destination is defined\r\n if (!this.destination) return this\r\n\r\n // generate morphed point string\r\n for (var i = 0, il = this.length, array = []; i < il; i++) {\r\n array.push([\r\n this[i][0] + (this.destination[i][0] - this[i][0]) * pos,\r\n this[i][1] + (this.destination[i][1] - this[i][1]) * pos\r\n ])\r\n }\r\n\r\n return new PointArray(array)\r\n },\r\n\r\n // Parse point string and flat array\r\n parse (array = [[0, 0]]) {\r\n var points = []\r\n\r\n // if it is an array\r\n if (array instanceof Array) {\r\n // and it is not flat, there is no need to parse it\r\n if (array[0] instanceof Array) {\r\n return array\r\n }\r\n } else { // Else, it is considered as a string\r\n // parse points\r\n array = array.trim().split(delimiter).map(parseFloat)\r\n }\r\n\r\n // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints\r\n // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.\r\n if (array.length % 2 !== 0) array.pop()\r\n\r\n // wrap points in two-tuples and parse points as floats\r\n for (var i = 0, len = array.length; i < len; i = i + 2) {\r\n points.push([ array[i], array[i + 1] ])\r\n }\r\n\r\n return points\r\n },\r\n\r\n // Move point string\r\n move (x, y) {\r\n var box = this.bbox()\r\n\r\n // get relative offset\r\n x -= box.x\r\n y -= box.y\r\n\r\n // move every point\r\n if (!isNaN(x) && !isNaN(y)) {\r\n for (var i = this.length - 1; i >= 0; i--) {\r\n this[i] = [this[i][0] + x, this[i][1] + y]\r\n }\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Resize poly string\r\n size (width, height) {\r\n var i\r\n var box = this.bbox()\r\n\r\n // recalculate position of all points according to new size\r\n for (i = this.length - 1; i >= 0; i--) {\r\n if (box.width) this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x\r\n if (box.height) this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Get bounding box of points\r\n bbox () {\r\n var maxX = -Infinity\r\n var maxY = -Infinity\r\n var minX = Infinity\r\n var minY = Infinity\r\n this.forEach(function (el) {\r\n maxX = Math.max(el[0], maxX)\r\n maxY = Math.max(el[1], maxY)\r\n minX = Math.min(el[0], minX)\r\n minY = Math.min(el[1], minY)\r\n })\r\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\r\n }\r\n})\r\n","import PointArray from '../../types/PointArray.js'\r\n\r\nexport let MorphArray = PointArray\r\n\r\n// Move by left top corner over x-axis\r\nexport function x (x) {\r\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r\n}\r\n\r\n// Move by left top corner over y-axis\r\nexport function y (y) {\r\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r\n}\r\n\r\n// Set width of element\r\nexport function width (width) {\r\n let b = this.bbox()\r\n return width == null ? b.width : this.size(width, b.height)\r\n}\r\n\r\n// Set height of element\r\nexport function height (height) {\r\n let b = this.bbox()\r\n return height == null ? b.height : this.size(b.width, height)\r\n}\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PointArray from '../types/PointArray.js'\r\nimport Shape from './Shape.js'\r\nimport * as pointed from '../modules/core/pointed.js'\r\n\r\nexport default class Line extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('line', node), node)\r\n }\r\n\r\n // Get array\r\n array () {\r\n return new PointArray([\r\n [ this.attr('x1'), this.attr('y1') ],\r\n [ this.attr('x2'), this.attr('y2') ]\r\n ])\r\n }\r\n\r\n // Overwrite native plot() method\r\n plot (x1, y1, x2, y2) {\r\n if (x1 == null) {\r\n return this.array()\r\n } else if (typeof y1 !== 'undefined') {\r\n x1 = { x1: x1, y1: y1, x2: x2, y2: y2 }\r\n } else {\r\n x1 = new PointArray(x1).toLine()\r\n }\r\n\r\n return this.attr(x1)\r\n }\r\n\r\n // Move by left top corner\r\n move (x, y) {\r\n return this.attr(this.array().move(x, y).toLine())\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n return this.attr(this.array().size(p.width, p.height).toLine())\r\n }\r\n}\r\n\r\nextend(Line, pointed)\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a line element\r\n line: wrapWithAttrCheck(function (...args) {\r\n // make sure plot is called as a setter\r\n // x1 is not necessarily a number, it can also be an array, a string and a PointArray\r\n return Line.prototype.plot.apply(\r\n this.put(new Line())\r\n , args[0] != null ? args : [0, 0, 0, 0]\r\n )\r\n })\r\n }\r\n})\r\n\r\nregister(Line)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class Marker extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('marker', node), node)\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return this.attr('markerWidth', width)\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return this.attr('markerHeight', height)\r\n }\r\n\r\n // Set marker refX and refY\r\n ref (x, y) {\r\n return this.attr('refX', x).attr('refY', y)\r\n }\r\n\r\n // Update marker\r\n update (block) {\r\n // remove all content\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') { block.call(this, this) }\r\n\r\n return this\r\n }\r\n\r\n // Return the fill id\r\n toString () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n marker (...args) {\r\n // Create marker element in defs\r\n return this.defs().marker(...args)\r\n }\r\n },\r\n Defs: {\r\n // Create marker\r\n marker: wrapWithAttrCheck(function (width, height, block) {\r\n // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto\r\n return this.put(new Marker())\r\n .size(width, height)\r\n .ref(width / 2, height / 2)\r\n .viewbox(0, 0, width, height)\r\n .attr('orient', 'auto')\r\n .update(block)\r\n })\r\n },\r\n marker: {\r\n // Create and attach markers\r\n marker (marker, width, height, block) {\r\n var attr = ['marker']\r\n\r\n // Build attribute name\r\n if (marker !== 'all') attr.push(marker)\r\n attr = attr.join('-')\r\n\r\n // Set marker attribute\r\n marker = arguments[1] instanceof Marker\r\n ? arguments[1]\r\n : this.defs().marker(width, height, block)\r\n\r\n return this.attr(attr, marker)\r\n }\r\n }\r\n})\r\n\r\nregister(Marker)\r\n","'use strict';\nvar fails = require('./_fails');\n\nmodule.exports = function (method, arg) {\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call\n arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);\n });\n};\n","'use strict';\nvar $export = require('./_export');\nvar aFunction = require('./_a-function');\nvar toObject = require('./_to-object');\nvar fails = require('./_fails');\nvar $sort = [].sort;\nvar test = [1, 2, 3];\n\n$export($export.P + $export.F * (fails(function () {\n // IE8-\n test.sort(undefined);\n}) || !fails(function () {\n // V8 bug\n test.sort(null);\n // Old WebKit\n}) || !require('./_strict-method')($sort)), 'Array', {\n // 22.1.3.25 Array.prototype.sort(comparefn)\n sort: function sort(comparefn) {\n return comparefn === undefined\n ? $sort.call(toObject(this))\n : $sort.call(toObject(this), aFunction(comparefn));\n }\n});\n","import { timeline } from '../modules/core/defaults.js'\r\nimport { extend } from '../utils/adopter.js'\r\n\r\n/***\r\nBase Class\r\n==========\r\nThe base stepper class that will be\r\n***/\r\n\r\nfunction makeSetterGetter (k, f) {\r\n return function (v) {\r\n if (v == null) return this[v]\r\n this[k] = v\r\n if (f) f.call(this)\r\n return this\r\n }\r\n}\r\n\r\nexport let easing = {\r\n '-': function (pos) { return pos },\r\n '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 },\r\n '>': function (pos) { return Math.sin(pos * Math.PI / 2) },\r\n '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 },\r\n bezier: function (x1, y1, x2, y2) {\r\n // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo\r\n return function (t) {\r\n if (t < 0) {\r\n if (x1 > 0) {\r\n return y1 / x1 * t\r\n } else if (x2 > 0) {\r\n return y2 / x2 * t\r\n } else {\r\n return 0\r\n }\r\n } else if (t > 1) {\r\n if (x2 < 1) {\r\n return (1 - y2) / (1 - x2) * t + (y2 - x2) / (1 - x2)\r\n } else if (x1 < 1) {\r\n return (1 - y1) / (1 - x1) * t + (y1 - x1) / (1 - x1)\r\n } else {\r\n return 1\r\n }\r\n } else {\r\n return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3\r\n }\r\n }\r\n },\r\n // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo\r\n steps: function (steps, stepPosition = 'end') {\r\n // deal with \"jump-\" prefix\r\n stepPosition = stepPosition.split('-').reverse()[0]\r\n\r\n let jumps = steps\r\n if (stepPosition === 'none') {\r\n --jumps\r\n } else if (stepPosition === 'both') {\r\n ++jumps\r\n }\r\n\r\n // The beforeFlag is essentially useless\r\n return (t, beforeFlag = false) => {\r\n // Step is called currentStep in referenced url\r\n let step = Math.floor(t * steps)\r\n const jumping = (t * step) % 1 === 0\r\n\r\n if (stepPosition === 'start' || stepPosition === 'both') {\r\n ++step\r\n }\r\n\r\n if (beforeFlag && jumping) {\r\n --step\r\n }\r\n\r\n if (t >= 0 && step < 0) {\r\n step = 0\r\n }\r\n\r\n if (t <= 1 && step > jumps) {\r\n step = jumps\r\n }\r\n\r\n return step / jumps\r\n }\r\n }\r\n}\r\n\r\nexport class Stepper {\r\n done () { return false }\r\n}\r\n\r\n/***\r\nEasing Functions\r\n================\r\n***/\r\n\r\nexport class Ease extends Stepper {\r\n constructor (fn) {\r\n super()\r\n this.ease = easing[fn || timeline.ease] || fn\r\n }\r\n\r\n step (from, to, pos) {\r\n if (typeof from !== 'number') {\r\n return pos < 1 ? from : to\r\n }\r\n return from + (to - from) * this.ease(pos)\r\n }\r\n}\r\n\r\n/***\r\nController Types\r\n================\r\n***/\r\n\r\nexport class Controller extends Stepper {\r\n constructor (fn) {\r\n super()\r\n this.stepper = fn\r\n }\r\n\r\n step (current, target, dt, c) {\r\n return this.stepper(current, target, dt, c)\r\n }\r\n\r\n done (c) {\r\n return c.done\r\n }\r\n}\r\n\r\nfunction recalculate () {\r\n // Apply the default parameters\r\n var duration = (this._duration || 500) / 1000\r\n var overshoot = this._overshoot || 0\r\n\r\n // Calculate the PID natural response\r\n var eps = 1e-10\r\n var pi = Math.PI\r\n var os = Math.log(overshoot / 100 + eps)\r\n var zeta = -os / Math.sqrt(pi * pi + os * os)\r\n var wn = 3.9 / (zeta * duration)\r\n\r\n // Calculate the Spring values\r\n this.d = 2 * zeta * wn\r\n this.k = wn * wn\r\n}\r\n\r\nexport class Spring extends Controller {\r\n constructor (duration, overshoot) {\r\n super()\r\n this.duration(duration || 500)\r\n .overshoot(overshoot || 0)\r\n }\r\n\r\n step (current, target, dt, c) {\r\n if (typeof current === 'string') return current\r\n c.done = dt === Infinity\r\n if (dt === Infinity) return target\r\n if (dt === 0) return current\r\n\r\n if (dt > 100) dt = 16\r\n\r\n dt /= 1000\r\n\r\n // Get the previous velocity\r\n var velocity = c.velocity || 0\r\n\r\n // Apply the control to get the new position and store it\r\n var acceleration = -this.d * velocity - this.k * (current - target)\r\n var newPosition = current +\r\n velocity * dt +\r\n acceleration * dt * dt / 2\r\n\r\n // Store the velocity\r\n c.velocity = velocity + acceleration * dt\r\n\r\n // Figure out if we have converged, and if so, pass the value\r\n c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002\r\n return c.done ? target : newPosition\r\n }\r\n}\r\n\r\nextend(Spring, {\r\n duration: makeSetterGetter('_duration', recalculate),\r\n overshoot: makeSetterGetter('_overshoot', recalculate)\r\n})\r\n\r\nexport class PID extends Controller {\r\n constructor (p, i, d, windup) {\r\n super()\r\n\r\n p = p == null ? 0.1 : p\r\n i = i == null ? 0.01 : i\r\n d = d == null ? 0 : d\r\n windup = windup == null ? 1000 : windup\r\n this.p(p).i(i).d(d).windup(windup)\r\n }\r\n\r\n step (current, target, dt, c) {\r\n if (typeof current === 'string') return current\r\n c.done = dt === Infinity\r\n\r\n if (dt === Infinity) return target\r\n if (dt === 0) return current\r\n\r\n var p = target - current\r\n var i = (c.integral || 0) + p * dt\r\n var d = (p - (c.error || 0)) / dt\r\n var windup = this.windup\r\n\r\n // antiwindup\r\n if (windup !== false) {\r\n i = Math.max(-windup, Math.min(i, windup))\r\n }\r\n\r\n c.error = p\r\n c.integral = i\r\n\r\n c.done = Math.abs(p) < 0.001\r\n\r\n return c.done ? target : current + (this.P * p + this.I * i + this.D * d)\r\n }\r\n}\r\n\r\nextend(PID, {\r\n windup: makeSetterGetter('windup'),\r\n p: makeSetterGetter('P'),\r\n i: makeSetterGetter('I'),\r\n d: makeSetterGetter('D')\r\n})\r\n","import {\r\n delimiter,\r\n dots,\r\n hyphen,\r\n isPathLetter,\r\n numbersWithDots,\r\n pathLetters\r\n} from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\nimport Point from './Point.js'\r\nimport SVGArray from './SVGArray.js'\r\nimport parser from '../modules/core/parser.js'\r\n\r\nconst PathArray = subClassArray('PathArray', SVGArray)\r\n\r\nexport default PathArray\r\n\r\nexport function pathRegReplace (a, b, c, d) {\r\n return c + d.replace(dots, ' .')\r\n}\r\n\r\nfunction arrayToString (a) {\r\n for (var i = 0, il = a.length, s = ''; i < il; i++) {\r\n s += a[i][0]\r\n\r\n if (a[i][1] != null) {\r\n s += a[i][1]\r\n\r\n if (a[i][2] != null) {\r\n s += ' '\r\n s += a[i][2]\r\n\r\n if (a[i][3] != null) {\r\n s += ' '\r\n s += a[i][3]\r\n s += ' '\r\n s += a[i][4]\r\n\r\n if (a[i][5] != null) {\r\n s += ' '\r\n s += a[i][5]\r\n s += ' '\r\n s += a[i][6]\r\n\r\n if (a[i][7] != null) {\r\n s += ' '\r\n s += a[i][7]\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return s + ' '\r\n}\r\n\r\nconst pathHandlers = {\r\n M: function (c, p, p0) {\r\n p.x = p0.x = c[0]\r\n p.y = p0.y = c[1]\r\n\r\n return ['M', p.x, p.y]\r\n },\r\n L: function (c, p) {\r\n p.x = c[0]\r\n p.y = c[1]\r\n return ['L', c[0], c[1]]\r\n },\r\n H: function (c, p) {\r\n p.x = c[0]\r\n return ['H', c[0]]\r\n },\r\n V: function (c, p) {\r\n p.y = c[0]\r\n return ['V', c[0]]\r\n },\r\n C: function (c, p) {\r\n p.x = c[4]\r\n p.y = c[5]\r\n return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]\r\n },\r\n S: function (c, p) {\r\n p.x = c[2]\r\n p.y = c[3]\r\n return ['S', c[0], c[1], c[2], c[3]]\r\n },\r\n Q: function (c, p) {\r\n p.x = c[2]\r\n p.y = c[3]\r\n return ['Q', c[0], c[1], c[2], c[3]]\r\n },\r\n T: function (c, p) {\r\n p.x = c[0]\r\n p.y = c[1]\r\n return ['T', c[0], c[1]]\r\n },\r\n Z: function (c, p, p0) {\r\n p.x = p0.x\r\n p.y = p0.y\r\n return ['Z']\r\n },\r\n A: function (c, p) {\r\n p.x = c[5]\r\n p.y = c[6]\r\n return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]\r\n }\r\n}\r\n\r\nlet mlhvqtcsaz = 'mlhvqtcsaz'.split('')\r\n\r\nfor (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) {\r\n pathHandlers[mlhvqtcsaz[i]] = (function (i) {\r\n return function (c, p, p0) {\r\n if (i === 'H') c[0] = c[0] + p.x\r\n else if (i === 'V') c[0] = c[0] + p.y\r\n else if (i === 'A') {\r\n c[5] = c[5] + p.x\r\n c[6] = c[6] + p.y\r\n } else {\r\n for (var j = 0, jl = c.length; j < jl; ++j) {\r\n c[j] = c[j] + (j % 2 ? p.y : p.x)\r\n }\r\n }\r\n\r\n return pathHandlers[i](c, p, p0)\r\n }\r\n })(mlhvqtcsaz[i].toUpperCase())\r\n}\r\n\r\nextend(PathArray, {\r\n // Convert array to string\r\n toString () {\r\n return arrayToString(this)\r\n },\r\n\r\n // Move path string\r\n move (x, y) {\r\n // get bounding box of current situation\r\n var box = this.bbox()\r\n\r\n // get relative offset\r\n x -= box.x\r\n y -= box.y\r\n\r\n if (!isNaN(x) && !isNaN(y)) {\r\n // move every point\r\n for (var l, i = this.length - 1; i >= 0; i--) {\r\n l = this[i][0]\r\n\r\n if (l === 'M' || l === 'L' || l === 'T') {\r\n this[i][1] += x\r\n this[i][2] += y\r\n } else if (l === 'H') {\r\n this[i][1] += x\r\n } else if (l === 'V') {\r\n this[i][1] += y\r\n } else if (l === 'C' || l === 'S' || l === 'Q') {\r\n this[i][1] += x\r\n this[i][2] += y\r\n this[i][3] += x\r\n this[i][4] += y\r\n\r\n if (l === 'C') {\r\n this[i][5] += x\r\n this[i][6] += y\r\n }\r\n } else if (l === 'A') {\r\n this[i][6] += x\r\n this[i][7] += y\r\n }\r\n }\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Resize path string\r\n size (width, height) {\r\n // get bounding box of current situation\r\n var box = this.bbox()\r\n var i, l\r\n\r\n // recalculate position of all points according to new size\r\n for (i = this.length - 1; i >= 0; i--) {\r\n l = this[i][0]\r\n\r\n if (l === 'M' || l === 'L' || l === 'T') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\r\n } else if (l === 'H') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n } else if (l === 'V') {\r\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\r\n } else if (l === 'C' || l === 'S' || l === 'Q') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\r\n this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x\r\n this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y\r\n\r\n if (l === 'C') {\r\n this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x\r\n this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y\r\n }\r\n } else if (l === 'A') {\r\n // resize radii\r\n this[i][1] = (this[i][1] * width) / box.width\r\n this[i][2] = (this[i][2] * height) / box.height\r\n\r\n // move position values\r\n this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x\r\n this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y\r\n }\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Test if the passed path array use the same path data commands as this path array\r\n equalCommands (pathArray) {\r\n var i, il, equalCommands\r\n\r\n pathArray = new PathArray(pathArray)\r\n\r\n equalCommands = this.length === pathArray.length\r\n for (i = 0, il = this.length; equalCommands && i < il; i++) {\r\n equalCommands = this[i][0] === pathArray[i][0]\r\n }\r\n\r\n return equalCommands\r\n },\r\n\r\n // Make path array morphable\r\n morph (pathArray) {\r\n pathArray = new PathArray(pathArray)\r\n\r\n if (this.equalCommands(pathArray)) {\r\n this.destination = pathArray\r\n } else {\r\n this.destination = null\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Get morphed path array at given position\r\n at (pos) {\r\n // make sure a destination is defined\r\n if (!this.destination) return this\r\n\r\n var sourceArray = this\r\n var destinationArray = this.destination.value\r\n var array = []\r\n var pathArray = new PathArray()\r\n var i, il, j, jl\r\n\r\n // Animate has specified in the SVG spec\r\n // See: https://www.w3.org/TR/SVG11/paths.html#PathElement\r\n for (i = 0, il = sourceArray.length; i < il; i++) {\r\n array[i] = [sourceArray[i][0]]\r\n for (j = 1, jl = sourceArray[i].length; j < jl; j++) {\r\n array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos\r\n }\r\n // For the two flags of the elliptical arc command, the SVG spec say:\r\n // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true\r\n // Elliptical arc command as an array followed by corresponding indexes:\r\n // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y]\r\n // 0 1 2 3 4 5 6 7\r\n if (array[i][0] === 'A') {\r\n array[i][4] = +(array[i][4] !== 0)\r\n array[i][5] = +(array[i][5] !== 0)\r\n }\r\n }\r\n\r\n // Directly modify the value of a path array, this is done this way for performance\r\n pathArray.value = array\r\n return pathArray\r\n },\r\n\r\n // Absolutize and parse path to array\r\n parse (array = [['M', 0, 0]]) {\r\n // if it's already a patharray, no need to parse it\r\n if (array instanceof PathArray) return array\r\n\r\n // prepare for parsing\r\n var s\r\n var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 }\r\n\r\n if (typeof array === 'string') {\r\n array = array\r\n .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123\r\n .replace(pathLetters, ' $& ') // put some room between letters and numbers\r\n .replace(hyphen, '$1 -') // add space before hyphen\r\n .trim() // trim\r\n .split(delimiter) // split into array\r\n } else {\r\n array = array.reduce(function (prev, curr) {\r\n return [].concat.call(prev, curr)\r\n }, [])\r\n }\r\n\r\n // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...]\r\n var result = []\r\n var p = new Point()\r\n var p0 = new Point()\r\n var index = 0\r\n var len = array.length\r\n\r\n do {\r\n // Test if we have a path letter\r\n if (isPathLetter.test(array[index])) {\r\n s = array[index]\r\n ++index\r\n // If last letter was a move command and we got no new, it defaults to [L]ine\r\n } else if (s === 'M') {\r\n s = 'L'\r\n } else if (s === 'm') {\r\n s = 'l'\r\n }\r\n\r\n result.push(pathHandlers[s].call(null,\r\n array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat),\r\n p, p0\r\n )\r\n )\r\n } while (len > index)\r\n\r\n return result\r\n },\r\n\r\n // Get bounding box of path\r\n bbox () {\r\n parser().path.setAttribute('d', this.toString())\r\n return parser.nodes.path.getBBox()\r\n }\r\n})\r\n","import { Ease } from './Controller.js'\r\nimport {\r\n delimiter,\r\n numberAndUnit,\r\n pathLetters\r\n} from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport Color from '../types/Color.js'\r\nimport PathArray from '../types/PathArray.js'\r\nimport SVGArray from '../types/SVGArray.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\n\r\nexport default class Morphable {\r\n constructor (stepper) {\r\n this._stepper = stepper || new Ease('-')\r\n\r\n this._from = null\r\n this._to = null\r\n this._type = null\r\n this._context = null\r\n this._morphObj = null\r\n }\r\n\r\n from (val) {\r\n if (val == null) {\r\n return this._from\r\n }\r\n\r\n this._from = this._set(val)\r\n return this\r\n }\r\n\r\n to (val) {\r\n if (val == null) {\r\n return this._to\r\n }\r\n\r\n this._to = this._set(val)\r\n return this\r\n }\r\n\r\n type (type) {\r\n // getter\r\n if (type == null) {\r\n return this._type\r\n }\r\n\r\n // setter\r\n this._type = type\r\n return this\r\n }\r\n\r\n _set (value) {\r\n if (!this._type) {\r\n var type = typeof value\r\n\r\n if (type === 'number') {\r\n this.type(SVGNumber)\r\n } else if (type === 'string') {\r\n if (Color.isColor(value)) {\r\n this.type(Color)\r\n } else if (delimiter.test(value)) {\r\n this.type(pathLetters.test(value)\r\n ? PathArray\r\n : SVGArray\r\n )\r\n } else if (numberAndUnit.test(value)) {\r\n this.type(SVGNumber)\r\n } else {\r\n this.type(NonMorphable)\r\n }\r\n } else if (morphableTypes.indexOf(value.constructor) > -1) {\r\n this.type(value.constructor)\r\n } else if (Array.isArray(value)) {\r\n this.type(SVGArray)\r\n } else if (type === 'object') {\r\n this.type(ObjectBag)\r\n } else {\r\n this.type(NonMorphable)\r\n }\r\n }\r\n\r\n var result = (new this._type(value)).toArray()\r\n this._morphObj = this._morphObj || new this._type()\r\n this._context = this._context ||\r\n Array.apply(null, Array(result.length)).map(Object)\r\n return result\r\n }\r\n\r\n stepper (stepper) {\r\n if (stepper == null) return this._stepper\r\n this._stepper = stepper\r\n return this\r\n }\r\n\r\n done () {\r\n var complete = this._context\r\n .map(this._stepper.done)\r\n .reduce(function (last, curr) {\r\n return last && curr\r\n }, true)\r\n return complete\r\n }\r\n\r\n at (pos) {\r\n var _this = this\r\n\r\n return this._morphObj.fromArray(\r\n this._from.map(function (i, index) {\r\n return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context)\r\n })\r\n )\r\n }\r\n}\r\n\r\nexport class NonMorphable {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (val) {\r\n val = Array.isArray(val) ? val[0] : val\r\n this.value = val\r\n return this\r\n }\r\n\r\n valueOf () {\r\n return this.value\r\n }\r\n\r\n toArray () {\r\n return [this.value]\r\n }\r\n}\r\n\r\nexport class TransformBag {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (obj) {\r\n if (Array.isArray(obj)) {\r\n obj = {\r\n scaleX: obj[0],\r\n scaleY: obj[1],\r\n shear: obj[2],\r\n rotate: obj[3],\r\n translateX: obj[4],\r\n translateY: obj[5],\r\n originX: obj[6],\r\n originY: obj[7]\r\n }\r\n }\r\n\r\n Object.assign(this, TransformBag.defaults, obj)\r\n return this\r\n }\r\n\r\n toArray () {\r\n var v = this\r\n\r\n return [\r\n v.scaleX,\r\n v.scaleY,\r\n v.shear,\r\n v.rotate,\r\n v.translateX,\r\n v.translateY,\r\n v.originX,\r\n v.originY\r\n ]\r\n }\r\n}\r\n\r\nTransformBag.defaults = {\r\n scaleX: 1,\r\n scaleY: 1,\r\n shear: 0,\r\n rotate: 0,\r\n translateX: 0,\r\n translateY: 0,\r\n originX: 0,\r\n originY: 0\r\n}\r\n\r\nexport class ObjectBag {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (objOrArr) {\r\n this.values = []\r\n\r\n if (Array.isArray(objOrArr)) {\r\n this.values = objOrArr\r\n return\r\n }\r\n\r\n objOrArr = objOrArr || {}\r\n var entries = []\r\n\r\n for (let i in objOrArr) {\r\n entries.push([i, objOrArr[i]])\r\n }\r\n\r\n entries.sort((a, b) => {\r\n return a[0] - b[0]\r\n })\r\n\r\n this.values = entries.reduce((last, curr) => last.concat(curr), [])\r\n return this\r\n }\r\n\r\n valueOf () {\r\n var obj = {}\r\n var arr = this.values\r\n\r\n for (var i = 0, len = arr.length; i < len; i += 2) {\r\n obj[arr[i]] = arr[i + 1]\r\n }\r\n\r\n return obj\r\n }\r\n\r\n toArray () {\r\n return this.values\r\n }\r\n}\r\n\r\nconst morphableTypes = [\r\n NonMorphable,\r\n TransformBag,\r\n ObjectBag\r\n]\r\n\r\nexport function registerMorphableType (type = []) {\r\n morphableTypes.push(...[].concat(type))\r\n}\r\n\r\nexport function makeMorphable () {\r\n extend(morphableTypes, {\r\n to (val) {\r\n return new Morphable()\r\n .type(this.constructor)\r\n .from(this.valueOf())\r\n .to(val)\r\n },\r\n fromArray (arr) {\r\n this.init(arr)\r\n return this\r\n }\r\n })\r\n}\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PathArray from '../types/PathArray.js'\r\nimport Shape from './Shape.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class Path extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('path', node), node)\r\n }\r\n\r\n // Get array\r\n array () {\r\n return this._array || (this._array = new PathArray(this.attr('d')))\r\n }\r\n\r\n // Plot new path\r\n plot (d) {\r\n return (d == null) ? this.array()\r\n : this.clear().attr('d', typeof d === 'string' ? d : (this._array = new PathArray(d)))\r\n }\r\n\r\n // Clear array cache\r\n clear () {\r\n delete this._array\r\n return this\r\n }\r\n\r\n // Move by left top corner\r\n move (x, y) {\r\n return this.attr('d', this.array().move(x, y))\r\n }\r\n\r\n // Move by left top corner over x-axis\r\n x (x) {\r\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r\n }\r\n\r\n // Move by left top corner over y-axis\r\n y (y) {\r\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n return this.attr('d', this.array().size(p.width, p.height))\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return width == null ? this.bbox().width : this.size(width, this.bbox().height)\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return height == null ? this.bbox().height : this.size(this.bbox().width, height)\r\n }\r\n\r\n targets () {\r\n return baseFind('svg textpath [href*=\"' + this.id() + '\"]')\r\n }\r\n}\r\n\r\n// Define morphable array\r\nPath.prototype.MorphArray = PathArray\r\n\r\n// Add parent method\r\nregisterMethods({\r\n Container: {\r\n // Create a wrapped path element\r\n path: wrapWithAttrCheck(function (d) {\r\n // make sure plot is called as a setter\r\n return this.put(new Path()).plot(d || new PathArray())\r\n })\r\n }\r\n})\r\n\r\nregister(Path)\r\n","import { proportionalSize } from '../../utils/utils.js'\r\nimport PointArray from '../../types/PointArray.js'\r\n\r\n// Get array\r\nexport function array () {\r\n return this._array || (this._array = new PointArray(this.attr('points')))\r\n}\r\n\r\n// Plot new path\r\nexport function plot (p) {\r\n return (p == null) ? this.array()\r\n : this.clear().attr('points', typeof p === 'string' ? p\r\n : (this._array = new PointArray(p)))\r\n}\r\n\r\n// Clear array cache\r\nexport function clear () {\r\n delete this._array\r\n return this\r\n}\r\n\r\n// Move by left top corner\r\nexport function move (x, y) {\r\n return this.attr('points', this.array().move(x, y))\r\n}\r\n\r\n// Set element size to given width and height\r\nexport function size (width, height) {\r\n let p = proportionalSize(this, width, height)\r\n return this.attr('points', this.array().size(p.width, p.height))\r\n}\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PointArray from '../types/PointArray.js'\r\nimport Shape from './Shape.js'\r\nimport * as pointed from '../modules/core/pointed.js'\r\nimport * as poly from '../modules/core/poly.js'\r\n\r\nexport default class Polygon extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('polygon', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a wrapped polygon element\r\n polygon: wrapWithAttrCheck(function (p) {\r\n // make sure plot is called as a setter\r\n return this.put(new Polygon()).plot(p || new PointArray())\r\n })\r\n }\r\n})\r\n\r\nextend(Polygon, pointed)\r\nextend(Polygon, poly)\r\nregister(Polygon)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PointArray from '../types/PointArray.js'\r\nimport Shape from './Shape.js'\r\nimport * as pointed from '../modules/core/pointed.js'\r\nimport * as poly from '../modules/core/poly.js'\r\n\r\nexport default class Polyline extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('polyline', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a wrapped polygon element\r\n polyline: wrapWithAttrCheck(function (p) {\r\n // make sure plot is called as a setter\r\n return this.put(new Polyline()).plot(p || new PointArray())\r\n })\r\n }\r\n})\r\n\r\nextend(Polyline, pointed)\r\nextend(Polyline, poly)\r\nregister(Polyline)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { rx, ry } from '../modules/core/circled.js'\r\nimport Shape from './Shape.js'\r\n\r\nexport default class Rect extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('rect', node), node)\r\n }\r\n}\r\n\r\nextend(Rect, { rx, ry })\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a rect element\r\n rect: wrapWithAttrCheck(function (width, height) {\r\n return this.put(new Rect()).size(width, height)\r\n })\r\n }\r\n})\r\n\r\nregister(Rect)\r\n","export default class Queue {\r\n constructor () {\r\n this._first = null\r\n this._last = null\r\n }\r\n\r\n push (value) {\r\n // An item stores an id and the provided value\r\n var item = value.next ? value : { value: value, next: null, prev: null }\r\n\r\n // Deal with the queue being empty or populated\r\n if (this._last) {\r\n item.prev = this._last\r\n this._last.next = item\r\n this._last = item\r\n } else {\r\n this._last = item\r\n this._first = item\r\n }\r\n\r\n // Update the length and return the current item\r\n return item\r\n }\r\n\r\n shift () {\r\n // Check if we have a value\r\n var remove = this._first\r\n if (!remove) return null\r\n\r\n // If we do, remove it and relink things\r\n this._first = remove.next\r\n if (this._first) this._first.prev = null\r\n this._last = this._first ? this._last : null\r\n return remove.value\r\n }\r\n\r\n // Shows us the first item in the list\r\n first () {\r\n return this._first && this._first.value\r\n }\r\n\r\n // Shows us the last item in the list\r\n last () {\r\n return this._last && this._last.value\r\n }\r\n\r\n // Removes the item that was returned from the push\r\n remove (item) {\r\n // Relink the previous item\r\n if (item.prev) item.prev.next = item.next\r\n if (item.next) item.next.prev = item.prev\r\n if (item === this._last) this._last = item.prev\r\n if (item === this._first) this._first = item.next\r\n\r\n // Invalidate item\r\n item.prev = null\r\n item.next = null\r\n }\r\n}\r\n","import { globals } from '../utils/window.js'\r\nimport Queue from './Queue.js'\r\n\r\nconst Animator = {\r\n nextDraw: null,\r\n frames: new Queue(),\r\n timeouts: new Queue(),\r\n timer: globals.window.performance || globals.window.Date,\r\n transforms: [],\r\n\r\n frame (fn) {\r\n // Store the node\r\n var node = Animator.frames.push({ run: fn })\r\n\r\n // Request an animation frame if we don't have one\r\n if (Animator.nextDraw === null) {\r\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\r\n }\r\n\r\n // Return the node so we can remove it easily\r\n return node\r\n },\r\n\r\n transform_frame (fn, id) {\r\n Animator.transforms[id] = fn\r\n },\r\n\r\n timeout (fn, delay) {\r\n delay = delay || 0\r\n\r\n // Work out when the event should fire\r\n var time = Animator.timer.now() + delay\r\n\r\n // Add the timeout to the end of the queue\r\n var node = Animator.timeouts.push({ run: fn, time: time })\r\n\r\n // Request another animation frame if we need one\r\n if (Animator.nextDraw === null) {\r\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\r\n }\r\n\r\n return node\r\n },\r\n\r\n cancelFrame (node) {\r\n node != null && Animator.frames.remove(node)\r\n },\r\n\r\n clearTimeout (node) {\r\n node != null && Animator.timeouts.remove(node)\r\n },\r\n\r\n _draw (now) {\r\n // Run all the timeouts we can run, if they are not ready yet, add them\r\n // to the end of the queue immediately! (bad timeouts!!! [sarcasm])\r\n var nextTimeout = null\r\n var lastTimeout = Animator.timeouts.last()\r\n while ((nextTimeout = Animator.timeouts.shift())) {\r\n // Run the timeout if its time, or push it to the end\r\n if (now >= nextTimeout.time) {\r\n nextTimeout.run()\r\n } else {\r\n Animator.timeouts.push(nextTimeout)\r\n }\r\n\r\n // If we hit the last item, we should stop shifting out more items\r\n if (nextTimeout === lastTimeout) break\r\n }\r\n\r\n // Run all of the animation frames\r\n var nextFrame = null\r\n var lastFrame = Animator.frames.last()\r\n while ((nextFrame !== lastFrame) && (nextFrame = Animator.frames.shift())) {\r\n nextFrame.run()\r\n }\r\n\r\n Animator.transforms.forEach(function (el) { el() })\r\n\r\n // If we have remaining timeouts or frames, draw until we don't anymore\r\n Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first()\r\n ? globals.window.requestAnimationFrame(Animator._draw)\r\n : null\r\n }\r\n}\r\n\r\nexport default Animator\r\n","import { globals } from '../utils/window.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Animator from './Animator.js'\r\nimport EventTarget from '../types/EventTarget.js'\r\n\r\nvar makeSchedule = function (runnerInfo) {\r\n var start = runnerInfo.start\r\n var duration = runnerInfo.runner.duration()\r\n var end = start + duration\r\n return { start: start, duration: duration, end: end, runner: runnerInfo.runner }\r\n}\r\n\r\nconst defaultSource = function () {\r\n let w = globals.window\r\n return (w.performance || w.Date).now()\r\n}\r\n\r\nexport default class Timeline extends EventTarget {\r\n // Construct a new timeline on the given element\r\n constructor (timeSource = defaultSource) {\r\n super()\r\n\r\n this._timeSource = timeSource\r\n\r\n // Store the timing variables\r\n this._startTime = 0\r\n this._speed = 1.0\r\n\r\n // Determines how long a runner is hold in memory. Can be a dt or true/false\r\n this._persist = 0\r\n\r\n // Keep track of the running animations and their starting parameters\r\n this._nextFrame = null\r\n this._paused = true\r\n this._runners = []\r\n this._order = []\r\n this._time = 0\r\n this._lastSourceTime = 0\r\n this._lastStepTime = 0\r\n\r\n // Make sure that step is always called in class context\r\n this._step = this._step.bind(this)\r\n }\r\n\r\n // schedules a runner on the timeline\r\n schedule (runner, delay, when) {\r\n if (runner == null) {\r\n return this._runners.map(makeSchedule).sort(function (a, b) {\r\n return a.runner.id - b.runner.id\r\n })\r\n }\r\n\r\n // The start time for the next animation can either be given explicitly,\r\n // derived from the current timeline time or it can be relative to the\r\n // last start time to chain animations direclty\r\n\r\n var absoluteStartTime = 0\r\n var endTime = this.getEndTime()\r\n delay = delay || 0\r\n\r\n // Work out when to start the animation\r\n if (when == null || when === 'last' || when === 'after') {\r\n // Take the last time and increment\r\n absoluteStartTime = endTime\r\n } else if (when === 'absolute' || when === 'start') {\r\n absoluteStartTime = delay\r\n delay = 0\r\n } else if (when === 'now') {\r\n absoluteStartTime = this._time\r\n } else if (when === 'relative') {\r\n let runnerInfo = this._runners[runner.id]\r\n if (runnerInfo) {\r\n absoluteStartTime = runnerInfo.start + delay\r\n delay = 0\r\n }\r\n } else {\r\n throw new Error('Invalid value for the \"when\" parameter')\r\n }\r\n\r\n // Manage runner\r\n runner.unschedule()\r\n runner.timeline(this)\r\n // runner.time(-delay)\r\n\r\n // Save runnerInfo\r\n this._runners[runner.id] = {\r\n persist: this.persist(),\r\n runner: runner,\r\n start: absoluteStartTime + delay\r\n }\r\n\r\n // Save order, update Time if needed and continue\r\n this._order.push(runner.id)\r\n this.updateTime()._continue()\r\n return this\r\n }\r\n\r\n // Remove the runner from this timeline\r\n unschedule (runner) {\r\n var index = this._order.indexOf(runner.id)\r\n if (index < 0) return this\r\n\r\n delete this._runners[runner.id]\r\n this._order.splice(index, 1)\r\n runner.timeline(null)\r\n return this\r\n }\r\n\r\n // Calculates the end of the timeline\r\n getEndTime () {\r\n var lastRunnerInfo = this._runners[this._order[this._order.length - 1]]\r\n var lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0\r\n var lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : 0\r\n return lastStartTime + lastDuration\r\n }\r\n\r\n // Makes sure, that after pausing the time doesn't jump\r\n updateTime () {\r\n if (!this.active()) {\r\n this._lastSourceTime = this._timeSource()\r\n }\r\n return this\r\n }\r\n\r\n play () {\r\n // Now make sure we are not paused and continue the animation\r\n this._paused = false\r\n return this.updateTime()._continue()\r\n }\r\n\r\n pause () {\r\n this._paused = true\r\n return this._continue()\r\n }\r\n\r\n stop () {\r\n // Go to start and pause\r\n this.time(0)\r\n return this.pause()\r\n }\r\n\r\n finish () {\r\n // Go to end and pause\r\n this.time(this.getEndTime() + 1)\r\n return this.pause()\r\n }\r\n\r\n speed (speed) {\r\n if (speed == null) return this._speed\r\n this._speed = speed\r\n return this\r\n }\r\n\r\n reverse (yes) {\r\n var currentSpeed = this.speed()\r\n if (yes == null) return this.speed(-currentSpeed)\r\n\r\n var positive = Math.abs(currentSpeed)\r\n return this.speed(yes ? positive : -positive)\r\n }\r\n\r\n seek (dt) {\r\n return this.time(this._time + dt)\r\n }\r\n\r\n time (time) {\r\n if (time == null) return this._time\r\n this._time = time\r\n return this._continue(true)\r\n }\r\n\r\n persist (dtOrForever) {\r\n if (dtOrForever == null) return this._persist\r\n this._persist = dtOrForever\r\n return this\r\n }\r\n\r\n source (fn) {\r\n if (fn == null) return this._timeSource\r\n this._timeSource = fn\r\n return this\r\n }\r\n\r\n _step (immediateStep = false) {\r\n // Get the time delta from the last time and update the time\r\n var time = this._timeSource()\r\n var dtSource = time - this._lastSourceTime\r\n\r\n if (immediateStep) dtSource = 0\r\n\r\n var dtTime = this._speed * dtSource + (this._time - this._lastStepTime)\r\n this._lastSourceTime = time\r\n\r\n // Only update the time if we use the timeSource.\r\n // Otherwise use the current time\r\n if (!immediateStep) {\r\n // Update the time\r\n this._time += dtTime\r\n this._time = this._time < 0 ? 0 : this._time\r\n }\r\n this._lastStepTime = this._time\r\n this.fire('time', this._time)\r\n\r\n // Run all of the runners directly\r\n var runnersLeft = false\r\n for (var i = 0, len = this._order.length; i < len; i++) {\r\n // Get and run the current runner and ignore it if its inactive\r\n var runnerInfo = this._runners[this._order[i]]\r\n var runner = runnerInfo.runner\r\n let dt = dtTime\r\n\r\n // Make sure that we give the actual difference\r\n // between runner start time and now\r\n let dtToStart = this._time - runnerInfo.start\r\n\r\n // Dont run runner if not started yet\r\n if (dtToStart <= 0) {\r\n runnersLeft = true\r\n\r\n // This is for the case that teh timeline was seeked so that the time\r\n // is now before the startTime of the runner. Thats why we need to set\r\n // the runner to position 0\r\n runner.reset()\r\n continue\r\n } else if (dtToStart < dt) {\r\n // Adjust dt to make sure that animation is on point\r\n dt = dtToStart\r\n }\r\n\r\n if (!runner.active()) continue\r\n\r\n // If this runner is still going, signal that we need another animation\r\n // frame, otherwise, remove the completed runner\r\n var finished = runner.step(dt).done\r\n if (!finished) {\r\n runnersLeft = true\r\n // continue\r\n } else if (runnerInfo.persist !== true) {\r\n // runner is finished. And runner might get removed\r\n\r\n var endTime = runner.duration() - runner.time() + this._time\r\n\r\n if (endTime + this._persist < this._time) {\r\n // Delete runner and correct index\r\n delete this._runners[this._order[i]]\r\n this._order.splice(i--, 1) && --len\r\n runner.timeline(null)\r\n }\r\n }\r\n }\r\n\r\n // Basically: we continue when there are runners right from us in time\r\n // when -->, and when runners are left from us when <--\r\n if ((runnersLeft && !(this._speed < 0 && this._time === 0)) || (this._order.length && this._speed < 0 && this._time > 0)) {\r\n this._continue()\r\n } else {\r\n this.fire('finished')\r\n this.pause()\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Checks if we are running and continues the animation\r\n _continue (immediateStep = false) {\r\n Animator.cancelFrame(this._nextFrame)\r\n this._nextFrame = null\r\n\r\n if (immediateStep) return this._step(true)\r\n if (this._paused) return this\r\n\r\n this._nextFrame = Animator.frame(this._step)\r\n return this\r\n }\r\n\r\n active () {\r\n return !!this._nextFrame\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Element: {\r\n timeline: function () {\r\n this._timeline = (this._timeline || new Timeline())\r\n return this._timeline\r\n }\r\n }\r\n})\r\n","import { Controller, Ease, Stepper } from './Controller.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { from, to } from '../modules/core/gradiented.js'\r\nimport { getOrigin } from '../utils/utils.js'\r\nimport { noop, timeline } from '../modules/core/defaults.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { rx, ry } from '../modules/core/circled.js'\r\nimport Animator from './Animator.js'\r\nimport Box from '../types/Box.js'\r\nimport EventTarget from '../types/EventTarget.js'\r\nimport Matrix from '../types/Matrix.js'\r\nimport Morphable, { TransformBag } from './Morphable.js'\r\nimport Point from '../types/Point.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Timeline from './Timeline.js'\r\n\r\nexport default class Runner extends EventTarget {\r\n constructor (options) {\r\n super()\r\n\r\n // Store a unique id on the runner, so that we can identify it later\r\n this.id = Runner.id++\r\n\r\n // Ensure a default value\r\n options = options == null\r\n ? timeline.duration\r\n : options\r\n\r\n // Ensure that we get a controller\r\n options = typeof options === 'function'\r\n ? new Controller(options)\r\n : options\r\n\r\n // Declare all of the variables\r\n this._element = null\r\n this._timeline = null\r\n this.done = false\r\n this._queue = []\r\n\r\n // Work out the stepper and the duration\r\n this._duration = typeof options === 'number' && options\r\n this._isDeclarative = options instanceof Controller\r\n this._stepper = this._isDeclarative ? options : new Ease()\r\n\r\n // We copy the current values from the timeline because they can change\r\n this._history = {}\r\n\r\n // Store the state of the runner\r\n this.enabled = true\r\n this._time = 0\r\n this._lastTime = 0\r\n\r\n // At creation, the runner is in reseted state\r\n this._reseted = true\r\n\r\n // Save transforms applied to this runner\r\n this.transforms = new Matrix()\r\n this.transformId = 1\r\n\r\n // Looping variables\r\n this._haveReversed = false\r\n this._reverse = false\r\n this._loopsDone = 0\r\n this._swing = false\r\n this._wait = 0\r\n this._times = 1\r\n }\r\n\r\n /*\r\n Runner Definitions\r\n ==================\r\n These methods help us define the runtime behaviour of the Runner or they\r\n help us make new runners from the current runner\r\n */\r\n\r\n element (element) {\r\n if (element == null) return this._element\r\n this._element = element\r\n element._prepareRunner()\r\n return this\r\n }\r\n\r\n timeline (timeline) {\r\n // check explicitly for undefined so we can set the timeline to null\r\n if (typeof timeline === 'undefined') return this._timeline\r\n this._timeline = timeline\r\n return this\r\n }\r\n\r\n animate (duration, delay, when) {\r\n var o = Runner.sanitise(duration, delay, when)\r\n var runner = new Runner(o.duration)\r\n if (this._timeline) runner.timeline(this._timeline)\r\n if (this._element) runner.element(this._element)\r\n return runner.loop(o).schedule(delay, when)\r\n }\r\n\r\n schedule (timeline, delay, when) {\r\n // The user doesn't need to pass a timeline if we already have one\r\n if (!(timeline instanceof Timeline)) {\r\n when = delay\r\n delay = timeline\r\n timeline = this.timeline()\r\n }\r\n\r\n // If there is no timeline, yell at the user...\r\n if (!timeline) {\r\n throw Error('Runner cannot be scheduled without timeline')\r\n }\r\n\r\n // Schedule the runner on the timeline provided\r\n timeline.schedule(this, delay, when)\r\n return this\r\n }\r\n\r\n unschedule () {\r\n var timeline = this.timeline()\r\n timeline && timeline.unschedule(this)\r\n return this\r\n }\r\n\r\n loop (times, swing, wait) {\r\n // Deal with the user passing in an object\r\n if (typeof times === 'object') {\r\n swing = times.swing\r\n wait = times.wait\r\n times = times.times\r\n }\r\n\r\n // Sanitise the values and store them\r\n this._times = times || Infinity\r\n this._swing = swing || false\r\n this._wait = wait || 0\r\n return this\r\n }\r\n\r\n delay (delay) {\r\n return this.animate(0, delay)\r\n }\r\n\r\n /*\r\n Basic Functionality\r\n ===================\r\n These methods allow us to attach basic functions to the runner directly\r\n */\r\n\r\n queue (initFn, runFn, retargetFn, isTransform) {\r\n this._queue.push({\r\n initialiser: initFn || noop,\r\n runner: runFn || noop,\r\n retarget: retargetFn,\r\n isTransform: isTransform,\r\n initialised: false,\r\n finished: false\r\n })\r\n var timeline = this.timeline()\r\n timeline && this.timeline()._continue()\r\n return this\r\n }\r\n\r\n during (fn) {\r\n return this.queue(null, fn)\r\n }\r\n\r\n after (fn) {\r\n return this.on('finish', fn)\r\n }\r\n\r\n /*\r\n Runner animation methods\r\n ========================\r\n Control how the animation plays\r\n */\r\n\r\n time (time) {\r\n if (time == null) {\r\n return this._time\r\n }\r\n let dt = time - this._time\r\n this.step(dt)\r\n return this\r\n }\r\n\r\n duration () {\r\n return this._times * (this._wait + this._duration) - this._wait\r\n }\r\n\r\n loops (p) {\r\n var loopDuration = this._duration + this._wait\r\n if (p == null) {\r\n var loopsDone = Math.floor(this._time / loopDuration)\r\n var relativeTime = (this._time - loopsDone * loopDuration)\r\n var position = relativeTime / this._duration\r\n return Math.min(loopsDone + position, this._times)\r\n }\r\n var whole = Math.floor(p)\r\n var partial = p % 1\r\n var time = loopDuration * whole + this._duration * partial\r\n return this.time(time)\r\n }\r\n\r\n position (p) {\r\n // Get all of the variables we need\r\n var x = this._time\r\n var d = this._duration\r\n var w = this._wait\r\n var t = this._times\r\n var s = this._swing\r\n var r = this._reverse\r\n var position\r\n\r\n if (p == null) {\r\n /*\r\n This function converts a time to a position in the range [0, 1]\r\n The full explanation can be found in this desmos demonstration\r\n https://www.desmos.com/calculator/u4fbavgche\r\n The logic is slightly simplified here because we can use booleans\r\n */\r\n\r\n // Figure out the value without thinking about the start or end time\r\n const f = function (x) {\r\n var swinging = s * Math.floor(x % (2 * (w + d)) / (w + d))\r\n var backwards = (swinging && !r) || (!swinging && r)\r\n var uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards\r\n var clipped = Math.max(Math.min(uncliped, 1), 0)\r\n return clipped\r\n }\r\n\r\n // Figure out the value by incorporating the start time\r\n var endTime = t * (w + d) - w\r\n position = x <= 0 ? Math.round(f(1e-5))\r\n : x < endTime ? f(x)\r\n : Math.round(f(endTime - 1e-5))\r\n return position\r\n }\r\n\r\n // Work out the loops done and add the position to the loops done\r\n var loopsDone = Math.floor(this.loops())\r\n var swingForward = s && (loopsDone % 2 === 0)\r\n var forwards = (swingForward && !r) || (r && swingForward)\r\n position = loopsDone + (forwards ? p : 1 - p)\r\n return this.loops(position)\r\n }\r\n\r\n progress (p) {\r\n if (p == null) {\r\n return Math.min(1, this._time / this.duration())\r\n }\r\n return this.time(p * this.duration())\r\n }\r\n\r\n step (dt) {\r\n // If we are inactive, this stepper just gets skipped\r\n if (!this.enabled) return this\r\n\r\n // Update the time and get the new position\r\n dt = dt == null ? 16 : dt\r\n this._time += dt\r\n var position = this.position()\r\n\r\n // Figure out if we need to run the stepper in this frame\r\n var running = this._lastPosition !== position && this._time >= 0\r\n this._lastPosition = position\r\n\r\n // Figure out if we just started\r\n var duration = this.duration()\r\n var justStarted = this._lastTime <= 0 && this._time > 0\r\n var justFinished = this._lastTime < this._time && this.time > duration\r\n this._lastTime = this._time\r\n if (justStarted) {\r\n this.fire('start', this)\r\n }\r\n\r\n // Work out if the runner is finished set the done flag here so animations\r\n // know, that they are running in the last step (this is good for\r\n // transformations which can be merged)\r\n var declarative = this._isDeclarative\r\n this.done = !declarative && !justFinished && this._time >= duration\r\n\r\n // Runner is running. So its not in reseted state anymore\r\n this._reseted = false\r\n\r\n // Call initialise and the run function\r\n if (running || declarative) {\n this._initialise(running)\r\n\r\n // clear the transforms on this runner so they dont get added again and again\r\n this.transforms = new Matrix()\r\n var converged = this._run(declarative ? dt : position)\r\n\r\n this.fire('step', this)\r\n }\r\n // correct the done flag here\r\n // declaritive animations itself know when they converged\r\n this.done = this.done || (converged && declarative)\r\n if (this.done) {\r\n this.fire('finish', this)\r\n }\r\n return this\r\n }\r\n\r\n reset () {\r\n if (this._reseted) return this\r\n this.loops(0)\r\n this._reseted = true\r\n return this\r\n }\r\n\r\n finish () {\r\n return this.step(Infinity)\r\n }\r\n\r\n reverse (reverse) {\r\n this._reverse = reverse == null ? !this._reverse : reverse\r\n return this\r\n }\r\n\r\n ease (fn) {\r\n this._stepper = new Ease(fn)\r\n return this\r\n }\r\n\r\n active (enabled) {\r\n if (enabled == null) return this.enabled\r\n this.enabled = enabled\r\n return this\r\n }\r\n\r\n /*\r\n Private Methods\r\n ===============\r\n Methods that shouldn't be used externally\r\n */\r\n\r\n // Save a morpher to the morpher list so that we can retarget it later\r\n _rememberMorpher (method, morpher) {\r\n this._history[method] = {\r\n morpher: morpher,\r\n caller: this._queue[this._queue.length - 1]\r\n }\r\n }\r\n\r\n // Try to set the target for a morpher if the morpher exists, otherwise\r\n // do nothing and return false\r\n _tryRetarget (method, target) {\r\n if (this._history[method]) {\r\n // if the last method wasnt even initialised, throw it away\r\n if (!this._history[method].caller.initialised) {\r\n let index = this._queue.indexOf(this._history[method].caller)\r\n this._queue.splice(index, 1)\r\n return false\r\n }\r\n\r\n // for the case of transformations, we use the special retarget function\r\n // which has access to the outer scope\r\n if (this._history[method].caller.retarget) {\r\n this._history[method].caller.retarget(target)\r\n // for everything else a simple morpher change is sufficient\r\n } else {\r\n this._history[method].morpher.to(target)\r\n }\r\n\r\n this._history[method].caller.finished = false\r\n var timeline = this.timeline()\r\n timeline && timeline._continue()\r\n return true\r\n }\r\n return false\r\n }\r\n\r\n // Run each initialise function in the runner if required\r\n _initialise (running) {\r\n // If we aren't running, we shouldn't initialise when not declarative\r\n if (!running && !this._isDeclarative) return\r\n\r\n // Loop through all of the initialisers\r\n for (var i = 0, len = this._queue.length; i < len; ++i) {\r\n // Get the current initialiser\r\n var current = this._queue[i]\r\n\r\n // Determine whether we need to initialise\r\n var needsIt = this._isDeclarative || (!current.initialised && running)\r\n running = !current.finished\r\n\r\n // Call the initialiser if we need to\r\n if (needsIt && running) {\r\n current.initialiser.call(this)\r\n current.initialised = true\r\n }\r\n }\r\n }\r\n\r\n // Run each run function for the position or dt given\r\n _run (positionOrDt) {\r\n // Run all of the _queue directly\r\n var allfinished = true\r\n for (var i = 0, len = this._queue.length; i < len; ++i) {\r\n // Get the current function to run\r\n var current = this._queue[i]\r\n\r\n // Run the function if its not finished, we keep track of the finished\r\n // flag for the sake of declarative _queue\r\n var converged = current.runner.call(this, positionOrDt)\r\n current.finished = current.finished || (converged === true)\r\n allfinished = allfinished && current.finished\r\n }\r\n\r\n // We report when all of the constructors are finished\r\n return allfinished\r\n }\r\n\r\n addTransform (transform, index) {\r\n this.transforms.lmultiplyO(transform)\r\n return this\r\n }\r\n\r\n clearTransform () {\r\n this.transforms = new Matrix()\r\n return this\r\n }\r\n\r\n // TODO: Keep track of all transformations so that deletion is faster\r\n clearTransformsFromQueue () {\r\n if (!this.done) {\r\n this._queue = this._queue.filter((item) => {\r\n return !item.isTransform\r\n })\r\n }\r\n }\r\n\r\n static sanitise (duration, delay, when) {\r\n // Initialise the default parameters\r\n var times = 1\r\n var swing = false\r\n var wait = 0\r\n duration = duration || timeline.duration\r\n delay = delay || timeline.delay\r\n when = when || 'last'\r\n\r\n // If we have an object, unpack the values\r\n if (typeof duration === 'object' && !(duration instanceof Stepper)) {\r\n delay = duration.delay || delay\r\n when = duration.when || when\r\n swing = duration.swing || swing\r\n times = duration.times || times\r\n wait = duration.wait || wait\r\n duration = duration.duration || timeline.duration\r\n }\r\n\r\n return {\r\n duration: duration,\r\n delay: delay,\r\n swing: swing,\r\n times: times,\r\n wait: wait,\r\n when: when\r\n }\r\n }\r\n}\r\n\r\nRunner.id = 0\r\n\r\nclass FakeRunner {\r\n constructor (transforms = new Matrix(), id = -1, done = true) {\r\n this.transforms = transforms\r\n this.id = id\r\n this.done = done\r\n }\r\n\r\n clearTransformsFromQueue () { }\r\n}\r\n\r\nextend([Runner, FakeRunner], {\r\n mergeWith (runner) {\r\n return new FakeRunner(\r\n runner.transforms.lmultiply(this.transforms),\r\n runner.id\r\n )\r\n }\r\n})\r\n\r\n// FakeRunner.emptyRunner = new FakeRunner()\r\n\r\nconst lmultiply = (last, curr) => last.lmultiplyO(curr)\r\nconst getRunnerTransform = (runner) => runner.transforms\r\n\r\nfunction mergeTransforms () {\r\n // Find the matrix to apply to the element and apply it\r\n let runners = this._transformationRunners.runners\r\n let netTransform = runners\r\n .map(getRunnerTransform)\r\n .reduce(lmultiply, new Matrix())\r\n\r\n this.transform(netTransform)\r\n\r\n this._transformationRunners.merge()\r\n\r\n if (this._transformationRunners.length() === 1) {\r\n this._frameId = null\r\n }\r\n}\r\n\r\nclass RunnerArray {\r\n constructor () {\r\n this.runners = []\r\n this.ids = []\r\n }\r\n\r\n add (runner) {\r\n if (this.runners.includes(runner)) return\r\n\r\n let id = runner.id + 1\r\n\r\n let leftSibling = this.ids.reduce((last, curr) => {\r\n if (curr > last && curr < id) return curr\r\n return last\r\n }, 0)\r\n\r\n let index = this.ids.indexOf(leftSibling) + 1\r\n\r\n this.ids.splice(index, 0, id)\r\n this.runners.splice(index, 0, runner)\r\n\r\n return this\r\n }\r\n\r\n getByID (id) {\r\n return this.runners[this.ids.indexOf(id + 1)]\r\n }\r\n\r\n remove (id) {\r\n let index = this.ids.indexOf(id + 1)\r\n this.ids.splice(index, 1)\r\n this.runners.splice(index, 1)\r\n return this\r\n }\r\n\r\n merge () {\r\n let lastRunner = null\r\n this.runners.forEach((runner, i) => {\r\n if (lastRunner && runner.done && lastRunner.done) {\r\n this.remove(runner.id)\r\n this.edit(lastRunner.id, runner.mergeWith(lastRunner))\r\n }\r\n\r\n lastRunner = runner\r\n })\r\n\r\n return this\r\n }\r\n\r\n edit (id, newRunner) {\r\n let index = this.ids.indexOf(id + 1)\r\n this.ids.splice(index, 1, id)\r\n this.runners.splice(index, 1, newRunner)\r\n return this\r\n }\r\n\r\n length () {\r\n return this.ids.length\r\n }\r\n\r\n clearBefore (id) {\r\n let deleteCnt = this.ids.indexOf(id + 1) || 1\r\n this.ids.splice(0, deleteCnt, 0)\r\n this.runners.splice(0, deleteCnt, new FakeRunner())\r\n .forEach((r) => r.clearTransformsFromQueue())\r\n return this\r\n }\r\n}\r\n\r\nlet frameId = 0\r\nregisterMethods({\r\n Element: {\r\n animate (duration, delay, when) {\r\n var o = Runner.sanitise(duration, delay, when)\r\n var timeline = this.timeline()\r\n return new Runner(o.duration)\r\n .loop(o)\r\n .element(this)\r\n .timeline(timeline.play())\r\n .schedule(delay, when)\r\n },\r\n\r\n delay (by, when) {\r\n return this.animate(0, by, when)\r\n },\r\n\r\n // this function searches for all runners on the element and deletes the ones\r\n // which run before the current one. This is because absolute transformations\r\n // overwfrite anything anyway so there is no need to waste time computing\r\n // other runners\r\n _clearTransformRunnersBefore (currentRunner) {\r\n this._transformationRunners.clearBefore(currentRunner.id)\r\n },\r\n\r\n _currentTransform (current) {\r\n return this._transformationRunners.runners\r\n // we need the equal sign here to make sure, that also transformations\r\n // on the same runner which execute before the current transformation are\r\n // taken into account\r\n .filter((runner) => runner.id <= current.id)\r\n .map(getRunnerTransform)\r\n .reduce(lmultiply, new Matrix())\r\n },\r\n\r\n addRunner (runner) {\r\n this._transformationRunners.add(runner)\r\n\r\n Animator.transform_frame(\r\n mergeTransforms.bind(this), this._frameId\r\n )\r\n },\r\n\r\n _prepareRunner () {\r\n if (this._frameId == null) {\r\n this._transformationRunners = new RunnerArray()\r\n .add(new FakeRunner(new Matrix(this)))\r\n\r\n this._frameId = frameId++\r\n }\r\n }\r\n }\r\n})\r\n\r\nextend(Runner, {\r\n attr (a, v) {\r\n return this.styleAttr('attr', a, v)\r\n },\r\n\r\n // Add animatable styles\r\n css (s, v) {\r\n return this.styleAttr('css', s, v)\r\n },\r\n\r\n styleAttr (type, name, val) {\r\n // apply attributes individually\r\n if (typeof name === 'object') {\r\n for (var key in val) {\r\n this.styleAttr(type, key, val[key])\r\n }\r\n }\r\n\r\n var morpher = new Morphable(this._stepper).to(val)\r\n\r\n this.queue(function () {\r\n morpher = morpher.from(this.element()[type](name))\r\n }, function (pos) {\r\n this.element()[type](name, morpher.at(pos))\r\n return morpher.done()\r\n })\r\n\r\n return this\r\n },\r\n\r\n zoom (level, point) {\r\n var morpher = new Morphable(this._stepper).to(new SVGNumber(level))\r\n\r\n this.queue(function () {\r\n morpher = morpher.from(this.zoom())\r\n }, function (pos) {\r\n this.element().zoom(morpher.at(pos), point)\r\n return morpher.done()\r\n })\r\n\r\n return this\r\n },\r\n\r\n /**\r\n ** absolute transformations\r\n **/\r\n\r\n //\r\n // M v -----|-----(D M v = F v)------|-----> T v\r\n //\r\n // 1. define the final state (T) and decompose it (once)\r\n // t = [tx, ty, the, lam, sy, sx]\r\n // 2. on every frame: pull the current state of all previous transforms\r\n // (M - m can change)\r\n // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]\r\n // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)\r\n // - Note F(0) = M\r\n // - Note F(1) = T\r\n // 4. Now you get the delta matrix as a result: D = F * inv(M)\r\n\r\n transform (transforms, relative, affine) {\r\n // If we have a declarative function, we should retarget it if possible\r\n relative = transforms.relative || relative\r\n if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) {\r\n return this\r\n }\r\n\r\n // Parse the parameters\r\n var isMatrix = Matrix.isMatrixLike(transforms)\r\n affine = transforms.affine != null\r\n ? transforms.affine\r\n : (affine != null ? affine : !isMatrix)\r\n\r\n // Create a morepher and set its type\r\n const morpher = new Morphable(this._stepper)\r\n .type(affine ? TransformBag : Matrix)\r\n\r\n let origin\r\n let element\r\n let current\r\n let currentAngle\r\n let startTransform\r\n\r\n function setup () {\r\n // make sure element and origin is defined\r\n element = element || this.element()\r\n origin = origin || getOrigin(transforms, element)\r\n\r\n startTransform = new Matrix(relative ? undefined : element)\r\n\r\n // add the runner to the element so it can merge transformations\r\n element.addRunner(this)\r\n\r\n // Deactivate all transforms that have run so far if we are absolute\r\n if (!relative) {\r\n element._clearTransformRunnersBefore(this)\r\n }\r\n }\r\n\r\n function run (pos) {\r\n // clear all other transforms before this in case something is saved\r\n // on this runner. We are absolute. We dont need these!\r\n if (!relative) this.clearTransform()\r\n\r\n let { x, y } = new Point(origin).transform(element._currentTransform(this))\r\n\r\n let target = new Matrix({ ...transforms, origin: [x, y] })\r\n let start = this._isDeclarative && current\r\n ? current\r\n : startTransform\r\n\r\n if (affine) {\r\n target = target.decompose(x, y)\r\n start = start.decompose(x, y)\r\n\r\n // Get the current and target angle as it was set\r\n const rTarget = target.rotate\r\n const rCurrent = start.rotate\r\n\r\n // Figure out the shortest path to rotate directly\r\n const possibilities = [rTarget - 360, rTarget, rTarget + 360]\r\n const distances = possibilities.map(a => Math.abs(a - rCurrent))\r\n const shortest = Math.min(...distances)\r\n const index = distances.indexOf(shortest)\r\n target.rotate = possibilities[index]\r\n }\r\n\r\n if (relative) {\r\n // we have to be careful here not to overwrite the rotation\r\n // with the rotate method of Matrix\r\n if (!isMatrix) {\r\n target.rotate = transforms.rotate || 0\r\n }\r\n if (this._isDeclarative && currentAngle) {\r\n start.rotate = currentAngle\r\n }\r\n }\r\n\r\n morpher.from(start)\r\n morpher.to(target)\r\n\r\n let affineParameters = morpher.at(pos)\r\n currentAngle = affineParameters.rotate\r\n current = new Matrix(affineParameters)\r\n\r\n this.addTransform(current)\r\n return morpher.done()\r\n }\r\n\r\n function retarget (newTransforms) {\r\n // only get a new origin if it changed since the last call\r\n if (\r\n (newTransforms.origin || 'center').toString() !==\r\n (transforms.origin || 'center').toString()\r\n ) {\r\n origin = getOrigin(transforms, element)\r\n }\r\n\r\n // overwrite the old transformations with the new ones\r\n transforms = { ...newTransforms, origin }\r\n }\r\n\r\n this.queue(setup, run, retarget, true)\r\n this._isDeclarative && this._rememberMorpher('transform', morpher)\r\n return this\r\n },\r\n\r\n // Animatable x-axis\r\n x (x, relative) {\r\n return this._queueNumber('x', x)\r\n },\r\n\r\n // Animatable y-axis\r\n y (y) {\r\n return this._queueNumber('y', y)\r\n },\r\n\r\n dx (x) {\r\n return this._queueNumberDelta('x', x)\r\n },\r\n\r\n dy (y) {\r\n return this._queueNumberDelta('y', y)\r\n },\r\n\r\n _queueNumberDelta (method, to) {\r\n to = new SVGNumber(to)\r\n\r\n // Try to change the target if we have this method already registerd\r\n if (this._tryRetarget(method, to)) return this\r\n\r\n // Make a morpher and queue the animation\r\n var morpher = new Morphable(this._stepper).to(to)\r\n var from = null\r\n this.queue(function () {\r\n from = this.element()[method]()\r\n morpher.from(from)\r\n morpher.to(from + to)\r\n }, function (pos) {\r\n this.element()[method](morpher.at(pos))\r\n return morpher.done()\r\n }, function (newTo) {\r\n morpher.to(from + new SVGNumber(newTo))\r\n })\r\n\r\n // Register the morpher so that if it is changed again, we can retarget it\r\n this._rememberMorpher(method, morpher)\r\n return this\r\n },\r\n\r\n _queueObject (method, to) {\r\n // Try to change the target if we have this method already registerd\r\n if (this._tryRetarget(method, to)) return this\r\n\r\n // Make a morpher and queue the animation\r\n var morpher = new Morphable(this._stepper).to(to)\r\n this.queue(function () {\r\n morpher.from(this.element()[method]())\r\n }, function (pos) {\r\n this.element()[method](morpher.at(pos))\r\n return morpher.done()\r\n })\r\n\r\n // Register the morpher so that if it is changed again, we can retarget it\r\n this._rememberMorpher(method, morpher)\r\n return this\r\n },\r\n\r\n _queueNumber (method, value) {\r\n return this._queueObject(method, new SVGNumber(value))\r\n },\r\n\r\n // Animatable center x-axis\r\n cx (x) {\r\n return this._queueNumber('cx', x)\r\n },\r\n\r\n // Animatable center y-axis\r\n cy (y) {\r\n return this._queueNumber('cy', y)\r\n },\r\n\r\n // Add animatable move\r\n move (x, y) {\r\n return this.x(x).y(y)\r\n },\r\n\r\n // Add animatable center\r\n center (x, y) {\r\n return this.cx(x).cy(y)\r\n },\r\n\r\n // Add animatable size\r\n size (width, height) {\r\n // animate bbox based size for all other elements\r\n var box\r\n\r\n if (!width || !height) {\r\n box = this._element.bbox()\r\n }\r\n\r\n if (!width) {\r\n width = box.width / box.height * height\r\n }\r\n\r\n if (!height) {\r\n height = box.height / box.width * width\r\n }\r\n\r\n return this\r\n .width(width)\r\n .height(height)\r\n },\r\n\r\n // Add animatable width\r\n width (width) {\r\n return this._queueNumber('width', width)\r\n },\r\n\r\n // Add animatable height\r\n height (height) {\r\n return this._queueNumber('height', height)\r\n },\r\n\r\n // Add animatable plot\r\n plot (a, b, c, d) {\r\n // Lines can be plotted with 4 arguments\r\n if (arguments.length === 4) {\r\n return this.plot([a, b, c, d])\r\n }\r\n\r\n var morpher = this._element.MorphArray().to(a)\r\n\r\n this.queue(function () {\r\n morpher.from(this._element.array())\r\n }, function (pos) {\r\n this._element.plot(morpher.at(pos))\r\n })\r\n\r\n return this\r\n },\r\n\r\n // Add leading method\r\n leading (value) {\r\n return this._queueNumber('leading', value)\r\n },\r\n\r\n // Add animatable viewbox\r\n viewbox (x, y, width, height) {\r\n return this._queueObject('viewbox', new Box(x, y, width, height))\r\n },\r\n\r\n update (o) {\r\n if (typeof o !== 'object') {\r\n return this.update({\r\n offset: arguments[0],\r\n color: arguments[1],\r\n opacity: arguments[2]\r\n })\r\n }\r\n\r\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\r\n if (o.color != null) this.attr('stop-color', o.color)\r\n if (o.offset != null) this.attr('offset', o.offset)\r\n\r\n return this\r\n }\r\n})\r\n\r\nextend(Runner, { rx, ry, from, to })\r\n","import {\r\n adopt,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { ns, svgjs, xlink, xmlns } from '../modules/core/namespaces.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\nimport Defs from './Defs.js'\r\nimport { globals } from '../utils/window.js'\r\n\r\nexport default class Svg extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('svg', node), node)\r\n this.namespace()\r\n }\r\n\r\n isRoot () {\r\n return !this.node.parentNode ||\r\n !(this.node.parentNode instanceof globals.window.SVGElement) ||\r\n this.node.parentNode.nodeName === '#document'\r\n }\r\n\r\n // Check if this is a root svg\r\n // If not, call docs from this element\r\n root () {\r\n if (this.isRoot()) return this\r\n return super.root()\r\n }\r\n\r\n // Add namespaces\r\n namespace () {\r\n if (!this.isRoot()) return this.root().namespace()\r\n return this\r\n .attr({ xmlns: ns, version: '1.1' })\r\n .attr('xmlns:xlink', xlink, xmlns)\r\n .attr('xmlns:svgjs', svgjs, xmlns)\r\n }\r\n\r\n // Creates and returns defs element\r\n defs () {\r\n if (!this.isRoot()) return this.root().defs()\r\n\r\n return adopt(this.node.getElementsByTagName('defs')[0]) ||\r\n this.put(new Defs())\r\n }\r\n\r\n // custom parent method\r\n parent (type) {\r\n if (this.isRoot()) {\r\n return this.node.parentNode.nodeName === '#document'\r\n ? null\r\n : adopt(this.node.parentNode)\r\n }\r\n\r\n return super.parent(type)\r\n }\r\n\r\n clear () {\r\n // remove children\r\n while (this.node.hasChildNodes()) {\r\n this.node.removeChild(this.node.lastChild)\r\n }\r\n return this\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create nested svg document\r\n nested: wrapWithAttrCheck(function () {\r\n return this.put(new Svg())\r\n })\r\n }\r\n})\r\n\r\nregister(Svg, 'Svg', true)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class Symbol extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('symbol', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n symbol: wrapWithAttrCheck(function () {\r\n return this.put(new Symbol())\r\n })\r\n }\r\n})\r\n\r\nregister(Symbol)\r\n","import { globals } from '../../utils/window.js'\r\n\r\n// Create plain text node\r\nexport function plain (text) {\r\n // clear if build mode is disabled\r\n if (this._build === false) {\r\n this.clear()\r\n }\r\n\r\n // create text node\r\n this.node.appendChild(globals.document.createTextNode(text))\r\n\r\n return this\r\n}\r\n\r\n// Get length of text element\r\nexport function length () {\r\n return this.node.getComputedTextLength()\r\n}\r\n","import {\r\n adopt,\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { attrs } from '../modules/core/defaults.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Shape from './Shape.js'\r\nimport { globals } from '../utils/window.js'\r\nimport * as textable from '../modules/core/textable.js'\r\n\r\nexport default class Text extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('text', node), node)\r\n\r\n this.dom.leading = new SVGNumber(1.3) // store leading value for rebuilding\r\n this._rebuild = true // enable automatic updating of dy values\r\n this._build = false // disable build mode for adding multiple lines\r\n\r\n // set default font\r\n this.attr('font-family', attrs['font-family'])\r\n }\r\n\r\n // Move over x-axis\r\n x (x) {\r\n // act as getter\r\n if (x == null) {\r\n return this.attr('x')\r\n }\r\n\r\n return this.attr('x', x)\r\n }\r\n\r\n // Move over y-axis\r\n y (y) {\r\n var oy = this.attr('y')\r\n var o = typeof oy === 'number' ? oy - this.bbox().y : 0\r\n\r\n // act as getter\r\n if (y == null) {\r\n return typeof oy === 'number' ? oy - o : oy\r\n }\r\n\r\n return this.attr('y', typeof y === 'number' ? y + o : y)\r\n }\r\n\r\n // Move center over x-axis\r\n cx (x) {\r\n return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2)\r\n }\r\n\r\n // Move center over y-axis\r\n cy (y) {\r\n return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2)\r\n }\r\n\r\n // Set the text content\r\n text (text) {\r\n // act as getter\r\n if (text === undefined) {\r\n var children = this.node.childNodes\r\n var firstLine = 0\r\n text = ''\r\n\r\n for (var i = 0, len = children.length; i < len; ++i) {\r\n // skip textPaths - they are no lines\r\n if (children[i].nodeName === 'textPath') {\r\n if (i === 0) firstLine = 1\r\n continue\r\n }\r\n\r\n // add newline if its not the first child and newLined is set to true\r\n if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) {\r\n text += '\\n'\r\n }\r\n\r\n // add content of this node\r\n text += children[i].textContent\r\n }\r\n\r\n return text\r\n }\r\n\r\n // remove existing content\r\n this.clear().build(true)\r\n\r\n if (typeof text === 'function') {\r\n // call block\r\n text.call(this, this)\r\n } else {\r\n // store text and make sure text is not blank\r\n text = text.split('\\n')\r\n\r\n // build new lines\r\n for (var j = 0, jl = text.length; j < jl; j++) {\r\n this.tspan(text[j]).newLine()\r\n }\r\n }\r\n\r\n // disable build mode and rebuild lines\r\n return this.build(false).rebuild()\r\n }\r\n\r\n // Set / get leading\r\n leading (value) {\r\n // act as getter\r\n if (value == null) {\r\n return this.dom.leading\r\n }\r\n\r\n // act as setter\r\n this.dom.leading = new SVGNumber(value)\r\n\r\n return this.rebuild()\r\n }\r\n\r\n // Rebuild appearance type\r\n rebuild (rebuild) {\r\n // store new rebuild flag if given\r\n if (typeof rebuild === 'boolean') {\r\n this._rebuild = rebuild\r\n }\r\n\r\n // define position of all lines\r\n if (this._rebuild) {\r\n var self = this\r\n var blankLineOffset = 0\r\n var leading = this.dom.leading\r\n\r\n this.each(function () {\r\n var fontSize = globals.window.getComputedStyle(this.node)\r\n .getPropertyValue('font-size')\r\n var dy = leading * new SVGNumber(fontSize)\r\n\r\n if (this.dom.newLined) {\r\n this.attr('x', self.attr('x'))\r\n\r\n if (this.text() === '\\n') {\r\n blankLineOffset += dy\r\n } else {\r\n this.attr('dy', dy + blankLineOffset)\r\n blankLineOffset = 0\r\n }\r\n }\r\n })\r\n\r\n this.fire('rebuild')\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Enable / disable build mode\r\n build (build) {\r\n this._build = !!build\r\n return this\r\n }\r\n\r\n // overwrite method from parent to set data properly\r\n setData (o) {\r\n this.dom = o\r\n this.dom.leading = new SVGNumber(o.leading || 1.3)\r\n return this\r\n }\r\n}\r\n\r\nextend(Text, textable)\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create text element\r\n text: wrapWithAttrCheck(function (text) {\r\n return this.put(new Text()).text(text)\r\n }),\r\n\r\n // Create plain text element\r\n plain: wrapWithAttrCheck(function (text) {\r\n return this.put(new Text()).plain(text)\r\n })\r\n }\r\n})\r\n\r\nregister(Text)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Text from './Text.js'\r\nimport * as textable from '../modules/core/textable.js'\r\n\r\nexport default class Tspan extends Text {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('tspan', node), node)\r\n }\r\n\r\n // Set text content\r\n text (text) {\r\n if (text == null) return this.node.textContent + (this.dom.newLined ? '\\n' : '')\r\n\r\n typeof text === 'function' ? text.call(this, this) : this.plain(text)\r\n\r\n return this\r\n }\r\n\r\n // Shortcut dx\r\n dx (dx) {\r\n return this.attr('dx', dx)\r\n }\r\n\r\n // Shortcut dy\r\n dy (dy) {\r\n return this.attr('dy', dy)\r\n }\r\n\r\n // Create new line\r\n newLine () {\r\n // fetch text parent\r\n var t = this.parent(Text)\r\n\r\n // mark new line\r\n this.dom.newLined = true\r\n\r\n // apply new position\r\n return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x())\r\n }\r\n}\r\n\r\nextend(Tspan, textable)\r\n\r\nregisterMethods({\r\n Tspan: {\r\n tspan: wrapWithAttrCheck(function (text) {\r\n var tspan = new Tspan()\r\n\r\n // clear if build mode is disabled\r\n if (!this._build) {\r\n this.clear()\r\n }\r\n\r\n // add new tspan\r\n this.node.appendChild(tspan.node)\r\n\r\n return tspan.text(text)\r\n })\r\n }\r\n})\r\n\r\nregister(Tspan)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class ClipPath extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('clipPath', node), node)\r\n }\r\n\r\n // Unclip all clipped elements and remove itself\r\n remove () {\r\n // unclip all targets\r\n this.targets().forEach(function (el) {\r\n el.unclip()\r\n })\r\n\r\n // remove clipPath from parent\r\n return super.remove()\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [clip-path*=\"' + this.id() + '\"]')\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create clipping element\r\n clip: wrapWithAttrCheck(function () {\r\n return this.defs().put(new ClipPath())\r\n })\r\n },\r\n Element: {\r\n // Distribute clipPath to svg element\r\n clipWith (element) {\r\n // use given clip or create a new one\r\n let clipper = element instanceof ClipPath\r\n ? element\r\n : this.parent().clip().add(element)\r\n\r\n // apply mask\r\n return this.attr('clip-path', 'url(\"#' + clipper.id() + '\")')\r\n },\r\n\r\n // Unclip element\r\n unclip () {\r\n return this.attr('clip-path', null)\r\n },\r\n\r\n clipper () {\r\n return this.reference('clip-path')\r\n }\r\n }\r\n})\r\n\r\nregister(ClipPath)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class G extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('g', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Element: {\r\n // Create a group element\r\n group: wrapWithAttrCheck(function () {\r\n return this.put(new G())\r\n })\r\n }\r\n})\r\n\r\nregister(G)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class A extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('a', node), node)\r\n }\r\n\r\n // Link url\r\n to (url) {\r\n return this.attr('href', url, xlink)\r\n }\r\n\r\n // Link target attribute\r\n target (target) {\r\n return this.attr('target', target)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a hyperlink element\r\n link: wrapWithAttrCheck(function (url) {\r\n return this.put(new A()).to(url)\r\n })\r\n },\r\n Element: {\r\n // Create a hyperlink element\r\n linkTo: function (url) {\r\n var link = new A()\r\n\r\n if (typeof url === 'function') { url.call(link, link) } else {\r\n link.to(url)\r\n }\r\n\r\n return this.parent().put(link).put(this)\r\n }\r\n }\r\n})\r\n\r\nregister(A)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class Mask extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('mask', node), node)\r\n }\r\n\r\n // Unmask all masked elements and remove itself\r\n remove () {\r\n // unmask all targets\r\n this.targets().forEach(function (el) {\r\n el.unmask()\r\n })\r\n\r\n // remove mask from parent\r\n return super.remove()\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [mask*=\"' + this.id() + '\"]')\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n mask: wrapWithAttrCheck(function () {\r\n return this.defs().put(new Mask())\r\n })\r\n },\r\n Element: {\r\n // Distribute mask to svg element\r\n maskWith (element) {\r\n // use given mask or create a new one\r\n var masker = element instanceof Mask\r\n ? element\r\n : this.parent().mask().add(element)\r\n\r\n // apply mask\r\n return this.attr('mask', 'url(\"#' + masker.id() + '\")')\r\n },\r\n\r\n // Unmask element\r\n unmask () {\r\n return this.attr('mask', null)\r\n },\r\n\r\n masker () {\r\n return this.reference('mask')\r\n }\r\n }\r\n})\r\n\r\nregister(Mask)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { unCamelCase } from '../utils/utils.js'\r\nimport Element from './Element.js'\r\n\r\nfunction cssRule (selector, rule) {\r\n if (!selector) return ''\r\n if (!rule) return selector\r\n\r\n var ret = selector + '{'\r\n\r\n for (var i in rule) {\r\n ret += unCamelCase(i) + ':' + rule[i] + ';'\r\n }\r\n\r\n ret += '}'\r\n\r\n return ret\r\n}\r\n\r\nexport default class Style extends Element {\r\n constructor (node) {\r\n super(nodeOrNew('style', node), node)\r\n }\r\n\r\n addText (w = '') {\r\n this.node.textContent += w\r\n return this\r\n }\r\n\r\n font (name, src, params = {}) {\r\n return this.rule('@font-face', {\r\n fontFamily: name,\r\n src: src,\r\n ...params\r\n })\r\n }\r\n\r\n rule (selector, obj) {\r\n return this.addText(cssRule(selector, obj))\r\n }\r\n}\r\n\r\nregisterMethods('Dom', {\r\n style: wrapWithAttrCheck(function (selector, obj) {\r\n return this.put(new Style()).rule(selector, obj)\r\n }),\r\n fontface: wrapWithAttrCheck(function (name, src, params) {\r\n return this.put(new Style()).font(name, src, params)\r\n })\r\n})\r\n\r\nregister(Style)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Path from './Path.js'\r\nimport PathArray from '../types/PathArray.js'\r\nimport Text from './Text.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class TextPath extends Text {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('textPath', node), node)\r\n }\r\n\r\n // return the array of the path track element\r\n array () {\r\n var track = this.track()\r\n\r\n return track ? track.array() : null\r\n }\r\n\r\n // Plot path if any\r\n plot (d) {\r\n var track = this.track()\r\n var pathArray = null\r\n\r\n if (track) {\r\n pathArray = track.plot(d)\r\n }\r\n\r\n return (d == null) ? pathArray : this\r\n }\r\n\r\n // Get the path element\r\n track () {\r\n return this.reference('href')\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n textPath: wrapWithAttrCheck(function (text, path) {\r\n return this.defs().path(path).text(text).addTo(this)\r\n })\r\n },\r\n Text: {\r\n // Create path for text to run on\r\n path: wrapWithAttrCheck(function (track) {\r\n var path = new TextPath()\r\n\r\n // if track is a path, reuse it\r\n if (!(track instanceof Path)) {\r\n // create path element\r\n track = this.root().defs().path(track)\r\n }\r\n\r\n // link textPath to path and add content\r\n path.attr('href', '#' + track, xlink)\r\n\r\n // add textPath element as child node and return textPath\r\n return this.put(path)\r\n }),\r\n\r\n // Get the textPath children\r\n textPath () {\r\n return this.find('textPath')[0]\r\n }\r\n },\r\n Path: {\r\n // creates a textPath from this path\r\n text: wrapWithAttrCheck(function (text) {\r\n if (text instanceof Text) {\r\n var txt = text.text()\r\n return text.clear().path(this).text(txt)\r\n }\r\n return this.parent().put(new Text()).path(this).text(text)\r\n }),\r\n\r\n targets () {\r\n return baseFind('svg [href*=\"' + this.id() + '\"]')\r\n }\r\n }\r\n})\r\n\r\nTextPath.prototype.MorphArray = PathArray\r\nregister(TextPath)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Shape from './Shape.js'\r\n\r\nexport default class Use extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('use', node), node)\r\n }\r\n\r\n // Use element as a reference\r\n element (element, file) {\r\n // Set lined element\r\n return this.attr('href', (file || '') + '#' + element, xlink)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a use element\r\n use: wrapWithAttrCheck(function (element, file) {\r\n return this.put(new Use()).element(element, file)\r\n })\r\n }\r\n})\r\n\r\nregister(Use)\r\n","/* Optional Modules */\r\nimport './modules/optional/arrange.js'\r\nimport './modules/optional/class.js'\r\nimport './modules/optional/css.js'\r\nimport './modules/optional/data.js'\r\nimport './modules/optional/memory.js'\r\nimport './modules/optional/sugar.js'\r\nimport './modules/optional/transform.js'\r\n\r\nimport { extend, makeInstance } from './utils/adopter.js'\r\nimport { getMethodNames, getMethodsFor } from './utils/methods.js'\r\nimport Box from './types/Box.js'\r\nimport Circle from './elements/Circle.js'\r\nimport Color from './types/Color.js'\r\nimport Container from './elements/Container.js'\r\nimport Defs from './elements/Defs.js'\r\nimport Dom from './elements/Dom.js'\r\nimport Element from './elements/Element.js'\r\nimport Ellipse from './elements/Ellipse.js'\r\nimport EventTarget from './types/EventTarget.js'\r\nimport Gradient from './elements/Gradient.js'\r\nimport Image from './elements/Image.js'\r\nimport Line from './elements/Line.js'\r\nimport List from './types/List.js'\r\nimport Marker from './elements/Marker.js'\r\nimport Matrix from './types/Matrix.js'\r\nimport Morphable, {\r\n NonMorphable,\r\n ObjectBag,\r\n TransformBag,\r\n makeMorphable,\r\n registerMorphableType\r\n} from './animation/Morphable.js'\r\nimport Path from './elements/Path.js'\r\nimport PathArray from './types/PathArray.js'\r\nimport Pattern from './elements/Pattern.js'\r\nimport PointArray from './types/PointArray.js'\r\nimport Polygon from './elements/Polygon.js'\r\nimport Polyline from './elements/Polyline.js'\r\nimport Rect from './elements/Rect.js'\r\nimport Runner from './animation/Runner.js'\r\nimport SVGArray from './types/SVGArray.js'\r\nimport SVGNumber from './types/SVGNumber.js'\r\nimport Shape from './elements/Shape.js'\r\nimport Svg from './elements/Svg.js'\r\nimport Symbol from './elements/Symbol.js'\r\nimport Text from './elements/Text.js'\r\nimport Tspan from './elements/Tspan.js'\r\nimport * as defaults from './modules/core/defaults.js'\r\nimport * as utils from './utils/utils.js'\r\nimport * as namespaces from './modules/core/namespaces.js'\r\nimport * as regex from './modules/core/regex.js'\r\n\r\nexport {\r\n Morphable,\r\n registerMorphableType,\r\n makeMorphable,\r\n TransformBag,\r\n ObjectBag,\r\n NonMorphable\r\n}\r\n\r\nexport { defaults, utils, namespaces, regex }\r\nexport const SVG = makeInstance\r\nexport { default as parser } from './modules/core/parser.js'\r\nexport { default as find } from './modules/core/selector.js'\r\nexport * from './modules/core/event.js'\r\nexport * from './utils/adopter.js'\r\nexport { registerWindow } from './utils/window.js'\r\n\r\n/* Animation Modules */\r\nexport { default as Animator } from './animation/Animator.js'\r\nexport { Controller, Ease, PID, Spring, easing } from './animation/Controller.js'\r\nexport { default as Queue } from './animation/Queue.js'\r\nexport { default as Runner } from './animation/Runner.js'\r\nexport { default as Timeline } from './animation/Timeline.js'\r\n\r\n/* Types */\r\nexport { default as Array } from './types/SVGArray.js'\r\nexport { default as Box } from './types/Box.js'\r\nexport { default as Color } from './types/Color.js'\r\nexport { default as EventTarget } from './types/EventTarget.js'\r\nexport { default as Matrix } from './types/Matrix.js'\r\nexport { default as Number } from './types/SVGNumber.js'\r\nexport { default as PathArray } from './types/PathArray.js'\r\nexport { default as Point } from './types/Point.js'\r\nexport { default as PointArray } from './types/PointArray.js'\r\nexport { default as List } from './types/List.js'\r\n\r\n/* Elements */\r\nexport { default as Circle } from './elements/Circle.js'\r\nexport { default as ClipPath } from './elements/ClipPath.js'\r\nexport { default as Container } from './elements/Container.js'\r\nexport { default as Defs } from './elements/Defs.js'\r\nexport { default as Dom } from './elements/Dom.js'\r\nexport { default as Element } from './elements/Element.js'\r\nexport { default as Ellipse } from './elements/Ellipse.js'\r\nexport { default as Gradient } from './elements/Gradient.js'\r\nexport { default as G } from './elements/G.js'\r\nexport { default as A } from './elements/A.js'\r\nexport { default as Image } from './elements/Image.js'\r\nexport { default as Line } from './elements/Line.js'\r\nexport { default as Marker } from './elements/Marker.js'\r\nexport { default as Mask } from './elements/Mask.js'\r\nexport { default as Path } from './elements/Path.js'\r\nexport { default as Pattern } from './elements/Pattern.js'\r\nexport { default as Polygon } from './elements/Polygon.js'\r\nexport { default as Polyline } from './elements/Polyline.js'\r\nexport { default as Rect } from './elements/Rect.js'\r\nexport { default as Shape } from './elements/Shape.js'\r\nexport { default as Stop } from './elements/Stop.js'\r\nexport { default as Style } from './elements/Style.js'\r\nexport { default as Svg } from './elements/Svg.js'\r\nexport { default as Symbol } from './elements/Symbol.js'\r\nexport { default as Text } from './elements/Text.js'\r\nexport { default as TextPath } from './elements/TextPath.js'\r\nexport { default as Tspan } from './elements/Tspan.js'\r\nexport { default as Use } from './elements/Use.js'\r\n\r\nextend([\r\n Svg,\r\n Symbol,\r\n Image,\r\n Pattern,\r\n Marker\r\n], getMethodsFor('viewbox'))\r\n\r\nextend([\r\n Line,\r\n Polyline,\r\n Polygon,\r\n Path\r\n], getMethodsFor('marker'))\r\n\r\nextend(Text, getMethodsFor('Text'))\r\nextend(Path, getMethodsFor('Path'))\r\n\r\nextend(Defs, getMethodsFor('Defs'))\r\n\r\nextend([\r\n Text,\r\n Tspan\r\n], getMethodsFor('Tspan'))\r\n\r\nextend([\r\n Rect,\r\n Ellipse,\r\n Circle,\r\n Gradient\r\n], getMethodsFor('radius'))\r\n\r\nextend(EventTarget, getMethodsFor('EventTarget'))\r\nextend(Dom, getMethodsFor('Dom'))\r\nextend(Element, getMethodsFor('Element'))\r\nextend(Shape, getMethodsFor('Shape'))\r\n// extend(Element, getConstructor('Memory'))\r\nextend(Container, getMethodsFor('Container'))\r\n\r\nextend(Runner, getMethodsFor('Runner'))\r\n\r\nList.extend(getMethodNames())\r\n\r\nregisterMorphableType([\r\n SVGNumber,\r\n Color,\r\n Box,\r\n Matrix,\r\n SVGArray,\r\n PointArray,\r\n PathArray\r\n])\r\n\r\nmakeMorphable()\r\n"],"names":["global","core","require$$0","require$$1","uid","isObject","document","require$$2","anObject","toPrimitive","IE8_DOM_DEFINE","dP","createDesc","cof","IObject","defined","has","hide","aFunction","ctx","redefine","toInteger","min","toIObject","toLength","toAbsoluteIndex","$keys","enumBugKeys","getKeys","IE_PROTO","PROTOTYPE","dPs","create","descriptor","setToStringTag","toObject","$iterCreate","getPrototypeOf","LIBRARY","Iterators","$export","step","addToUnscopables","ITERATOR","wks","$iterators","methods","names","registerMethods","name","m","Array","isArray","_name","addMethodNames","Object","keys","assign","getMethodsFor","getMethodNames","Set","_names","push","fails","map","array","block","i","il","length","result","filter","radians","d","Math","PI","degrees","r","camelCase","s","toLowerCase","replace","g","toUpperCase","unCamelCase","capitalize","charAt","slice","proportionalSize","element","width","height","box","bbox","getOrigin","o","origin","ox","oy","string","trim","x","y","bx","includes","by","ns","xmlns","xlink","svgjs","globals","window","registerWindow","win","doc","Base","elements","root","makeNode","createElementNS","makeInstance","adopt","querySelector","node","innerHTML","firstChild","nodeOrNew","Node","instance","className","nodeName","register","asRoot","prototype","getClass","did","eid","assignNewId","children","id","extend","modules","attrCheck","key","method","wrapWithAttrCheck","extendWithAttrCheck","args","fn","constructor","apply","attr","siblings","parent","position","index","next","prev","forward","p","removeElement","add","isRoot","appendChild","defs","backward","front","back","before","remove","after","insertBefore","insertAfter","numberAndUnit","hex","rgb","reference","transforms","whitespace","isHex","isRgb","isCss","isBlank","isNumber","isPercent","isImage","delimiter","hyphen","pathLetters","isPathLetter","numbersWithDots","dots","classes","split","hasClass","indexOf","addClass","join","removeClass","c","toggleClass","css","style","val","ret","arguments","cssText","el","forEach","t","cased","test","show","visible","data","a","v","JSON","parse","e","stringify","remember","k","memory","forget","_memory","listenerId","getEvents","n","getEventHolder","events","getEventTarget","clearEvents","on","listener","binding","options","l","bind","bag","_svgjsListenerId","event","ev","addEventListener","off","namespace","removeEventListener","dispatch","Event","dispatchEvent","CustomEvent","detail","cancelable","DESCRIPTORS","$flags","fullHex","substring","compToHex","comp","toString","Color","init","color","b","match","exec","parseInt","toHex","toArray","round","toRgb","brightness","isColor","Point","source","base","clone","transform","f","point","screenCTM","inverse","parser","nodes","svg","size","path","parentNode","body","documentElement","addTo","isNulledBox","w","h","domContains","contains","call","Box","parseFloat","left","top","x2","y2","cx","cy","merge","max","xMin","Infinity","xMax","yMin","yMax","pts","addOffset","pageXOffset","pageYOffset","isNulled","getBox","cb","Error","getBBox","rbox","getBoundingClientRect","viewbox","closeEnough","threshold","abs","Matrix","fromArray","Element","matrixify","isMatrixLike","matrix","multiplyO","formatTransforms","current","transformer","translateO","rx","ry","lmultiplyO","scaleO","scaleX","scaleY","skewO","skewX","skewY","shearO","shear","rotateO","theta","isFinite","px","py","dx","dy","tx","ty","compose","originX","originY","sx","sy","lam","rotate","translateX","translateY","decompose","determinant","ccw","sqrt","thetaRad","atan2","ct","cos","st","sin","multiply","matrixMultiply","lmultiply","inverseO","det","na","nb","nc","nd","ne","nf","translate","scale","flip","axis","around","flipO","lx","skew","tan","ly","skewXO","skewYO","aroundO","equals","other","valueOf","flipBoth","flipX","flipY","positionX","positionY","relative","relativeX","relativeY","ctm","getCTM","rect","getScreenCTM","subClassArray","Function","baseClass","_constructor","Arr","arr","List","each","fnOrMethodName","concat","reduce","obj","attrs","baseFind","query","querySelectorAll","find","EventTarget","type","j","defaultPrevented","fire","noop","timeline","duration","ease","delay","fill","stroke","opacity","offset","SVGArray","toSet","SVGNumber","value","unit","isNaN","toJSON","plus","number","minus","times","divide","hooks","registerAttrHook","attributes","nodeValue","last","curr","removeAttribute","getAttribute","defaults","_val","hook","leading","setAttributeNS","setAttribute","rebuild","Dom","childNodes","put","clear","hasChildNodes","removeChild","lastChild","_defs","writeDataToDom","cloneNode","deep","first","get","matches","selector","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","SVGElement","putIn","replaceChild","precision","factor","newAttrs","svgOrFn","outerHTML","well","len","fragment","_this","createDocumentFragment","firstElementChild","words","text","textContent","Svg","dom","hasAttribute","setData","center","inside","move","parents","until","sugar","prefix","extension","mat","angle","direction","directionString","dmove","radius","_element","getTotalLength","pointAt","getPointAtLength","font","ax","ay","amove","defineProperty","untransform","str","kv","reverse","toParent","pCtm","toRoot","decomposed","cleanRelative","Shape","Circle","circle","Container","flatten","ungroup","Defs","Ellipse","circled","ellipse","Stop","update","from","fx","fy","x1","y1","to","Gradient","stop","url","targets","gradiented","gradient","Pattern","pattern","patternUnits","Image","load","callback","img","src","image","PointArray","toLine","at","pos","destination","points","pop","maxX","maxY","minX","minY","MorphArray","Line","plot","pointed","line","Marker","ref","marker","makeSetterGetter","easing","bezier","steps","stepPosition","jumps","beforeFlag","floor","jumping","Stepper","done","Ease","Controller","stepper","target","dt","recalculate","_duration","overshoot","_overshoot","eps","pi","os","log","zeta","wn","Spring","velocity","acceleration","newPosition","PID","windup","integral","error","P","I","D","PathArray","pathRegReplace","arrayToString","pathHandlers","M","p0","L","H","V","C","S","Q","T","Z","A","mlhvqtcsaz","jl","equalCommands","pathArray","morph","sourceArray","destinationArray","paramCnt","Morphable","_stepper","_from","_to","_type","_context","_morphObj","_set","NonMorphable","morphableTypes","ObjectBag","complete","TransformBag","objOrArr","values","entries","sort","registerMorphableType","makeMorphable","Path","_array","Polygon","polygon","poly","Polyline","polyline","Rect","Queue","_first","_last","item","shift","Animator","nextDraw","frames","timeouts","timer","performance","Date","frame","run","requestAnimationFrame","_draw","transform_frame","timeout","time","now","cancelFrame","clearTimeout","nextTimeout","lastTimeout","nextFrame","lastFrame","makeSchedule","runnerInfo","start","runner","end","defaultSource","Timeline","timeSource","_timeSource","_startTime","_speed","_persist","_nextFrame","_paused","_runners","_order","_time","_lastSourceTime","_lastStepTime","_step","schedule","when","absoluteStartTime","endTime","getEndTime","unschedule","persist","updateTime","_continue","splice","lastRunnerInfo","lastDuration","lastStartTime","active","play","pause","finish","speed","yes","currentSpeed","positive","seek","dtOrForever","immediateStep","dtSource","dtTime","runnersLeft","dtToStart","reset","finished","_timeline","Runner","_queue","_isDeclarative","_history","enabled","_lastTime","_reseted","transformId","_haveReversed","_reverse","_loopsDone","_swing","_wait","_times","_prepareRunner","animate","sanitise","loop","swing","wait","queue","initFn","runFn","retargetFn","isTransform","initialiser","retarget","initialised","during","loops","loopDuration","loopsDone","relativeTime","whole","partial","swinging","backwards","uncliped","pow","clipped","swingForward","forwards","progress","running","_lastPosition","justStarted","justFinished","declarative","_initialise","converged","_run","_rememberMorpher","morpher","caller","_tryRetarget","needsIt","positionOrDt","allfinished","addTransform","clearTransform","clearTransformsFromQueue","FakeRunner","mergeWith","getRunnerTransform","mergeTransforms","runners","_transformationRunners","netTransform","_frameId","RunnerArray","ids","leftSibling","getByID","lastRunner","edit","newRunner","clearBefore","deleteCnt","frameId","_clearTransformRunnersBefore","currentRunner","_currentTransform","addRunner","styleAttr","zoom","level","affine","isMatrix","currentAngle","startTransform","setup","undefined","rTarget","rCurrent","possibilities","distances","shortest","affineParameters","newTransforms","_queueNumber","_queueNumberDelta","newTo","_queueObject","version","getElementsByTagName","nested","Symbol","symbol","plain","_build","createTextNode","getComputedTextLength","Text","_rebuild","firstLine","nodeType","newLined","build","tspan","newLine","self","blankLineOffset","fontSize","getComputedStyle","getPropertyValue","textable","Tspan","ClipPath","unclip","clip","clipWith","clipper","G","group","link","linkTo","Mask","unmask","mask","maskWith","masker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AAD,CAAvB,CAAN;AACAkF,MAAM,CAACuZ,KAAD,EAAQze,aAAa,CAAC,OAAD,CAArB,CAAN;;AAEAkF,MAAM,CAAC0Z,SAAD,EAAY5e,aAAa,CAAC,WAAD,CAAzB,CAAN;AAEAkF,MAAM,CAAC+mB,MAAD,EAASjsB,aAAa,CAAC,QAAD,CAAtB,CAAN;AAEA4W,IAAI,CAAC1R,MAAL,CAAYjF,cAAc,EAA1B;AAEAymB,qBAAqB,CAAC,CACpBnO,SADoB,EAEpB7L,KAFoB,EAGpBqC,GAHoB,EAIpB8B,MAJoB,EAKpBwH,QALoB,EAMpBqI,UANoB,EAOpBwD,SAPoB,CAAD,CAArB;AAUAyC,aAAa;;;;"}
\ No newline at end of file diff --git a/dist/svg.min.js b/dist/svg.min.js new file mode 100644 index 0000000..8e94ddb --- /dev/null +++ b/dist/svg.min.js @@ -0,0 +1,3 @@ +/*! @svgdotjs/svg.js v3.0.0 MIT*/; +var SVG=function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var m=t(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),y=t(function(t){var e=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=e)}),g=(y.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),p=function(t){if(!g(t))throw TypeError(t+" is not an object!");return t},w=function(t){try{return!!t()}catch(t){return!0}},u=!w(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),e=m.document,n=g(e)&&g(e.createElement),r=function(t){return n?e.createElement(t):{}},i=!u&&!w(function(){return 7!=Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a}),s=function(t,e){if(!g(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!g(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},o=Object.defineProperty,a={f:u?Object.defineProperty:function(t,e,n){if(p(t),e=s(e,!0),p(n),i)try{return o(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},k=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},x=u?function(t,e,n){return a.f(t,e,k(1,n))}:function(t,e,n){return t[e]=n,t},h={}.hasOwnProperty,l=function(t,e){return h.call(t,e)},c=0,f=Math.random(),v=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++c+f).toString(36))},O=t(function(t){var s=v("src"),e="toString",n=Function[e],u=(""+n).split(e);y.inspectSource=function(t){return n.call(t)},(t.exports=function(t,e,n,r){var i="function"==typeof n;i&&(l(n,"name")||x(n,"name",e)),t[e]!==n&&(i&&(l(n,s)||x(n,s,t[e]?""+t[e]:u.join(String(e)))),t===m?t[e]=n:r?t[e]?t[e]=n:x(t,e,n):(delete t[e],x(t,e,n)))})(Function.prototype,e,function(){return"function"==typeof this&&this[s]||n.call(this)})}),d=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},b=function(r,i,t){if(d(r),void 0===i)return r;switch(t){case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}},_="prototype",S=function(t,e,n){var r,i,s,u,o=t&S.F,a=t&S.G,h=t&S.S,l=t&S.P,c=t&S.B,f=a?m:h?m[e]||(m[e]={}):(m[e]||{})[_],v=a?y:y[e]||(y[e]={}),d=v[_]||(v[_]={});for(r in a&&(n=e),n)s=((i=!o&&f&&void 0!==f[r])?f:n)[r],u=c&&i?b(s,m):l&&"function"==typeof s?b(Function.call,s):s,f&&O(f,r,s,t&S.U),v[r]!=s&&x(v,r,u),l&&d[r]!=s&&(d[r]=s)};m.core=y,S.F=1,S.G=2,S.S=4,S.P=8,S.B=16,S.W=32,S.U=64,S.R=128;var j=S,M={}.toString,E=function(t){return M.call(t).slice(8,-1)},T=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==E(t)?t.split(""):Object(t)},C=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},P=function(t){return T(C(t))},N=Math.ceil,L=Math.floor,D=function(t){return isNaN(t=+t)?0:(0<t?L:N)(t)},F=Math.min,R=function(t){return 0<t?F(D(t),9007199254740991):0},z=Math.max,I=Math.min,q=function(h){return function(t,e,n){var r,i,s,u=P(t),o=R(u.length),a=(i=o,(r=D(r=n))<0?z(r+i,0):I(r,i));if(h&&e!=e){for(;a<o;)if((s=u[a++])!=s)return!0}else for(;a<o;a++)if((h||a in u)&&u[a]===e)return h||a||0;return!h&&-1}},Y=t(function(t){var e="__core-js_shared__",n=m[e]||(m[e]={});(t.exports=function(t,e){return n[t]||(n[t]=void 0!==e?e:{})})("versions",[]).push({version:y.version,mode:"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})}),X=Y("keys"),H=function(t){return X[t]||(X[t]=v(t))},B=q(!1),V=H("IE_PROTO"),W=function(t,e){var n,r=P(t),i=0,s=[];for(n in r)n!=V&&l(r,n)&&s.push(n);for(;e.length>i;)l(r,n=e[i++])&&(~B(s,n)||s.push(n));return s},Q="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),U=Object.keys||function(t){return W(t,Q)},J={f:Object.getOwnPropertySymbols},$={f:{}.propertyIsEnumerable},K=function(t){return Object(C(t))},Z=Object.assign,tt=!Z||w(function(){var A={},e={},t=Symbol(),n="abcdefghijklmnopqrst";return A[t]=7,n.split("").forEach(function(t){e[t]=t}),7!=Z({},A)[t]||Object.keys(Z({},e)).join("")!=n})?function(t,e){for(var n=K(t),r=arguments.length,i=1,s=J.f,u=$.f;i<r;)for(var o,a=T(arguments[i++]),h=s?U(a).concat(s(a)):U(a),l=h.length,c=0;c<l;)u.call(a,o=h[c++])&&(n[o]=a[o]);return n}:Z;j(j.S+j.F,"Object",{assign:tt});var et=t(function(t){var e=Y("wks"),Symbol=m.Symbol,n="function"==typeof Symbol;(t.exports=function(t){return e[t]||(e[t]=n&&Symbol[t]||(n?Symbol:v)("Symbol."+t))}).store=e}),nt=et("unscopables"),rt=Array.prototype;null==rt[nt]&&x(rt,nt,{});var it=function(t){rt[nt][t]=!0},st=function(t,e){return{value:e,done:!!t}},ut={},ot=u?Object.defineProperties:function(t,e){p(t);for(var n,r=U(e),i=r.length,s=0;s<i;)a.f(t,n=r[s++],e[n]);return t},at=m.document,ht=at&&at.documentElement,lt=H("IE_PROTO"),ct=function(){},ft="prototype",vt=function(){var t,e=r("iframe"),n=Q.length;for(e.style.display="none",ht.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),vt=t.F;n--;)delete vt[ft][Q[n]];return vt()},dt=Object.create||function(t,e){var n;return null!==t?(ct[ft]=p(t),n=new ct,ct[ft]=null,n[lt]=t):n=vt(),void 0===e?n:ot(n,e)},yt=a.f,pt=et("toStringTag"),mt=function(t,e,n){t&&!l(t=n?t:t.prototype,pt)&&yt(t,pt,{configurable:!0,value:e})},gt={};x(gt,et("iterator"),function(){return this});var wt=H("IE_PROTO"),bt=Object.prototype,_t=Object.getPrototypeOf||function(t){return t=K(t),l(t,wt)?t[wt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?bt:null},kt=et("iterator"),xt=!([].keys&&"next"in[].keys()),Ot="values",St=function(){return this},At=function(t,e,n,r,i,s,u){var o,a,h;a=e,h=r,(o=n).prototype=dt(gt,{next:k(1,h)}),mt(o,a+" Iterator");var l,c,f,v=function(t){if(!xt&&t in m)return m[t];switch(t){case"keys":case Ot:return function(){return new n(this,t)}}return function(){return new n(this,t)}},d=e+" Iterator",y=i==Ot,p=!1,m=t.prototype,g=m[kt]||m["@@iterator"]||i&&m[i],w=g||v(i),b=i?y?v("entries"):w:void 0,_="Array"==e&&m.entries||g;if(_&&(f=_t(_.call(new t)))!==Object.prototype&&f.next&&(mt(f,d,!0),"function"!=typeof f[kt]&&x(f,kt,St)),y&&g&&g.name!==Ot&&(p=!0,w=function(){return g.call(this)}),(xt||p||!m[kt])&&x(m,kt,w),ut[e]=w,ut[d]=St,i)if(l={values:y?w:v(Ot),keys:s?w:v("keys"),entries:b},u)for(c in l)c in m||O(m,c,l[c]);else j(j.P+j.F*(xt||p),e,l);return l},jt=At(Array,"Array",function(t,e){this._t=P(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,st(1)):st(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");ut.Arguments=ut.Array,it("keys"),it("values"),it("entries");for(var Mt=et("iterator"),Et=et("toStringTag"),Tt=ut.Array,Ct={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Pt=U(Ct),Nt=0;Nt<Pt.length;Nt++){var Lt,Dt=Pt[Nt],Ft=Ct[Dt],Rt=m[Dt],zt=Rt&&Rt.prototype;if(zt&&(zt[Mt]||x(zt,Mt,Tt),zt[Et]||x(zt,Et,Dt),ut[Dt]=Tt,Ft))for(Lt in jt)zt[Lt]||O(zt,Lt,jt[Lt],!0)}var It,qt,Yt,Xt;It="keys",qt=function(){return function(t){return U(K(t))}},Yt=(y.Object||{})[It]||Object[It],(Xt={})[It]=qt(Yt),j(j.S+j.F*w(function(){Yt(1)}),"Object",Xt);var Ht=a.f,Gt=Function.prototype,Bt=/^\s*function ([^ (]*)/;function Vt(t){return(Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Wt(t){return(Wt="function"==typeof Symbol&&"symbol"===Vt(Symbol.iterator)?function(t){return Vt(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":Vt(t)})(t)}"name"in Gt||u&&Ht(Gt,"name",{configurable:!0,get:function(){try{return(""+this).match(Bt)[1]}catch(t){return""}}});var Qt,Ut=(Qt=!0,function(t,e){var n,r,i=String(C(t)),s=D(e),u=i.length;return s<0||u<=s?Qt?"":void 0:(n=i.charCodeAt(s))<55296||56319<n||s+1===u||(r=i.charCodeAt(s+1))<56320||57343<r?Qt?i.charAt(s):n:Qt?i.slice(s,s+2):r-56320+(n-55296<<10)+65536});At(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=Ut(e,n),this._i+=t.length,{value:t,done:!1})});var Jt=function(t,e,n){for(var r in e)O(t,r,e[r],n);return t},$t=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t},Kt=function(e,t,n,r){try{return r?t(p(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&p(i.call(e)),t}},Zt=et("iterator"),te=Array.prototype,ee=et("toStringTag"),ne="Arguments"==E(function(){return arguments}()),re=et("iterator"),ie=y.getIteratorMethod=function(t){if(null!=t)return t[re]||t["@@iterator"]||ut[(e=t,void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(n=Object(e),ee))?r:ne?E(n):"Object"==(i=E(n))&&"function"==typeof n.callee?"Arguments":i)];var e,n,r,i},se=t(function(t){var v={},d={},e=t.exports=function(t,e,n,r,i){var s,u,o,a,h,l=i?function(){return t}:ie(t),c=b(n,r,e?2:1),f=0;if("function"!=typeof l)throw TypeError(t+" is not iterable!");if(void 0===(h=l)||ut.Array!==h&&te[Zt]!==h){for(o=l.call(t);!(u=o.next()).done;)if((a=Kt(o,c,u.value,e))===v||a===d)return a}else for(s=R(t.length);f<s;f++)if((a=e?c(p(u=t[f])[0],u[1]):c(t[f]))===v||a===d)return a};e.BREAK=v,e.RETURN=d}),ue=et("species"),oe=t(function(t){var n=v("meta"),e=a.f,r=0,i=Object.isExtensible||function(){return!0},s=!w(function(){return i(Object.preventExtensions({}))}),u=function(t){e(t,n,{value:{i:"O"+ ++r,w:{}}})},o=t.exports={KEY:n,NEED:!1,fastKey:function(t,e){if(!g(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!l(t,n)){if(!i(t))return"F";if(!e)return"E";u(t)}return t[n].i},getWeak:function(t,e){if(!l(t,n)){if(!i(t))return!0;if(!e)return!1;u(t)}return t[n].w},onFreeze:function(t){return s&&o.NEED&&i(t)&&!l(t,n)&&u(t),t}}}),ae=(oe.KEY,oe.NEED,oe.fastKey,oe.getWeak,oe.onFreeze,function(t,e){if(!g(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}),he=a.f,le=oe.fastKey,ce=u?"_s":"size",fe=function(t,e){var n,r=le(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n},ve={getConstructor:function(t,s,n,r){var i=t(function(t,e){$t(t,i,s,"_i"),t._t=s,t._i=dt(null),t._f=void 0,t._l=void 0,t[ce]=0,null!=e&&se(e,n,t[r],t)});return Jt(i.prototype,{clear:function(){for(var t=ae(this,s),e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[ce]=0},delete:function(t){var e=ae(this,s),n=fe(e,t);if(n){var r=n.n,i=n.p;delete e._i[n.i],n.r=!0,i&&(i.n=r),r&&(r.p=i),e._f==n&&(e._f=r),e._l==n&&(e._l=i),e[ce]--}return!!n},forEach:function(t){ae(this,s);for(var e,n=b(t,1<arguments.length?arguments[1]:void 0,3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!fe(ae(this,s),t)}}),u&&he(i.prototype,"size",{get:function(){return ae(this,s)[ce]}}),i},def:function(t,e,n){var r,i,s=fe(t,e);return s?s.v=n:(t._l=s={i:i=le(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=s),r&&(r.n=s),t[ce]++,"F"!==i&&(t._i[i]=s)),t},getEntry:fe,setStrong:function(t,n,e){var r;At(t,n,function(t,e){this._t=ae(t,n),this._k=e,this._l=void 0},function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?st(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,st(1))},e?"entries":"values",!e,!0),r=m[n],u&&r&&!r[ue]&&a.f(r,ue,{configurable:!0,get:function(){return this}})}},de=et("iterator"),ye=!1;try{[7][de]().return=function(){ye=!0}}catch(t){}var pe=Object.getOwnPropertyDescriptor,me={f:u?pe:function(t,e){if(t=P(t),e=s(e,!0),i)try{return pe(t,e)}catch(t){}if(l(t,e))return k(!$.f.call(t,e),t[e])}},ge=function(t,e){if(p(t),!g(e)&&null!==e)throw TypeError(e+": can't set as prototype!")},we={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=b(Function.call,me.f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return ge(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:ge}.set;!function(o,t,e,n,a,r){var h=m[o],l=h,c=a?"set":"add",i=l&&l.prototype,s={},u=function(t){var n=i[t];O(i,t,"delete"==t?function(t){return!(r&&!g(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(r&&!g(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return r&&!g(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,e){return n.call(this,0===t?0:t,e),this})};if("function"==typeof l&&(r||i.forEach&&!w(function(){(new l).entries().next()}))){var f=new l,v=f[c](r?{}:-0,1)!=f,d=w(function(){f.has(1)}),y=function(t,e){if(!e&&!ye)return!1;var n=!1;try{var r=[7],i=r[de]();i.next=function(){return{done:n=!0}},r[de]=function(){return i},t(r)}catch(t){}return n}(function(t){new l(t)}),p=!r&&w(function(){for(var t=new l,e=5;e--;)t[c](e,e);return!t.has(-0)});y||(((l=t(function(t,e){$t(t,l,o);var n,r,i,s,u=(n=new h,r=l,(s=t.constructor)!==r&&"function"==typeof s&&(i=s.prototype)!==r.prototype&&g(i)&&we&&we(n,i),n);return null!=e&&se(e,a,u[c],u),u})).prototype=i).constructor=l),(d||p)&&(u("delete"),u("has"),a&&u("get")),(p||v)&&u(c),r&&i.clear&&delete i.clear}else l=n.getConstructor(t,o,a,c),Jt(l.prototype,e),oe.NEED=!0;mt(l,o),s[o]=l,j(j.G+j.W+j.F*(l!=h),s),r||n.setStrong(l,o,a)}("Set",function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function(t){return ve.def(ae(this,"Set"),t=0===t?0:t,t)}},ve);function be(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var _e={f:et},ke=a.f,xe=function(t){var e=y.Symbol||(y.Symbol=m.Symbol||{});"_"==t.charAt(0)||t in e||ke(e,t,{value:_e.f(t)})};xe("asyncIterator");var Oe=Array.isArray||function(t){return"Array"==E(t)},Se=Q.concat("length","prototype"),Ae={f:Object.getOwnPropertyNames||function(t){return W(t,Se)}},je=Ae.f,Me={}.toString,Ee="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Te={f:function(t){return Ee&&"[object Window]"==Me.call(t)?function(t){try{return je(t)}catch(t){return Ee.slice()}}(t):je(P(t))}},Ce=oe.KEY,Pe=me.f,Ne=a.f,Le=Te.f,De=m.Symbol,Fe=m.JSON,Re=Fe&&Fe.stringify,ze="prototype",Ie=et("_hidden"),qe=et("toPrimitive"),Ye={}.propertyIsEnumerable,Xe=Y("symbol-registry"),He=Y("symbols"),Ge=Y("op-symbols"),Be=Object[ze],Ve="function"==typeof De,We=m.QObject,Qe=!We||!We[ze]||!We[ze].findChild,Ue=u&&w(function(){return 7!=dt(Ne({},"a",{get:function(){return Ne(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=Pe(Be,e);r&&delete Be[e],Ne(t,e,n),r&&t!==Be&&Ne(Be,e,r)}:Ne,Je=function(t){var e=He[t]=dt(De[ze]);return e._k=t,e},$e=Ve&&"symbol"==typeof De.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof De},Ke=function(t,e,n){return t===Be&&Ke(Ge,e,n),p(t),e=s(e,!0),p(n),l(He,e)?(n.enumerable?(l(t,Ie)&&t[Ie][e]&&(t[Ie][e]=!1),n=dt(n,{enumerable:k(0,!1)})):(l(t,Ie)||Ne(t,Ie,k(1,{})),t[Ie][e]=!0),Ue(t,e,n)):Ne(t,e,n)},Ze=function(t,e){p(t);for(var n,r=function(t){var e=U(t),n=J.f;if(n)for(var r,i=n(t),s=$.f,u=0;i.length>u;)s.call(t,r=i[u++])&&e.push(r);return e}(e=P(e)),i=0,s=r.length;i<s;)Ke(t,n=r[i++],e[n]);return t},tn=function(t){var e=Ye.call(this,t=s(t,!0));return!(this===Be&&l(He,t)&&!l(Ge,t))&&(!(e||!l(this,t)||!l(He,t)||l(this,Ie)&&this[Ie][t])||e)},en=function(t,e){if(t=P(t),e=s(e,!0),t!==Be||!l(He,e)||l(Ge,e)){var n=Pe(t,e);return!n||!l(He,e)||l(t,Ie)&&t[Ie][e]||(n.enumerable=!0),n}},nn=function(t){for(var e,n=Le(P(t)),r=[],i=0;n.length>i;)l(He,e=n[i++])||e==Ie||e==Ce||r.push(e);return r},rn=function(t){for(var e,n=t===Be,r=Le(n?Ge:P(t)),i=[],s=0;r.length>s;)!l(He,e=r[s++])||n&&!l(Be,e)||i.push(He[e]);return i};Ve||(O((De=function(){if(this instanceof De)throw TypeError("Symbol is not a constructor!");var e=v(0<arguments.length?arguments[0]:void 0),n=function(t){this===Be&&n.call(Ge,t),l(this,Ie)&&l(this[Ie],e)&&(this[Ie][e]=!1),Ue(this,e,k(1,t))};return u&&Qe&&Ue(Be,e,{configurable:!0,set:n}),Je(e)})[ze],"toString",function(){return this._k}),me.f=en,a.f=Ke,Ae.f=Te.f=nn,$.f=tn,J.f=rn,u&&O(Be,"propertyIsEnumerable",tn,!0),_e.f=function(t){return Je(et(t))}),j(j.G+j.W+j.F*!Ve,{Symbol:De});for(var sn="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),un=0;sn.length>un;)et(sn[un++]);for(var on=U(et.store),an=0;on.length>an;)xe(on[an++]);j(j.S+j.F*!Ve,"Symbol",{for:function(t){return l(Xe,t+="")?Xe[t]:Xe[t]=De(t)},keyFor:function(t){if(!$e(t))throw TypeError(t+" is not a symbol!");for(var e in Xe)if(Xe[e]===t)return e},useSetter:function(){Qe=!0},useSimple:function(){Qe=!1}}),j(j.S+j.F*!Ve,"Object",{create:function(t,e){return void 0===e?dt(t):Ze(dt(t),e)},defineProperty:Ke,defineProperties:Ze,getOwnPropertyDescriptor:en,getOwnPropertyNames:nn,getOwnPropertySymbols:rn}),Fe&&j(j.S+j.F*(!Ve||w(function(){var t=De();return"[null]"!=Re([t])||"{}"!=Re({a:t})||"{}"!=Re(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(g(e)||void 0!==t)&&!$e(t))return Oe(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!$e(e))return e}),r[1]=e,Re.apply(Fe,r)}}),De[ze][qe]||x(De[ze],qe,De[ze].valueOf),mt(De,"Symbol"),mt(Math,"Math",!0),mt(m.JSON,"JSON",!0);var hn={},ln=[];function cn(t,e){if(Array.isArray(t)){var n=!0,r=!1,i=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done);n=!0){cn(s.value,e)}}catch(t){r=!0,i=t}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}}else if("object"!==Wt(t))vn(Object.keys(e)),hn[t]=Object.assign(hn[t]||{},e);else for(var o in t)cn(o,t[o])}function fn(t){return hn[t]||{}}function vn(t){ln.push.apply(ln,be(t))}var dn=q(!0);j(j.P,"Array",{includes:function(t){return dn(this,t,1<arguments.length?arguments[1]:void 0)}}),it("includes");var yn=et("match"),pn=function(t){var e;return g(t)&&(void 0!==(e=t[yn])?!!e:"RegExp"==E(t))},mn=et("match"),gn="includes";j(j.P+j.F*function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[mn]=!1,!"/./"[e](n)}catch(t){}}return!0}(gn),"String",{includes:function(t){return!!~function(t,e,n){if(pn(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(C(t))}(this,t,gn).indexOf(t,1<arguments.length?arguments[1]:void 0)}});var wn=function(e,t,n){var r=et(e),i=n(C,r,""[e]),s=i[0],u=i[1];w(function(){var t={};return t[r]=function(){return 7},7!=""[e](t)})&&(O(String.prototype,e,s),x(RegExp.prototype,r,2==t?function(t,e){return u.call(t,this,e)}:function(t){return u.call(t,this)}))};function bn(t,e){var n,r=t.length,i=[];for(n=0;n<r;n++)i.push(e(t[n]));return i}function _n(t){return t%360*Math.PI/180}function kn(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function xn(t){return t.replace(/([A-Z])/g,function(t,e){return"-"+e.toLowerCase()})}function On(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Sn(t,e,n){if(null==e||null==n){var r=t.bbox();null==e?e=r.width/r.height*n:null==n&&(n=r.height/r.width*e)}return{width:e,height:n}}function An(t,e){var n,r,i=t.origin;if("string"==typeof i||null==i){var s=(i||"center").toLowerCase().trim(),u=e.bbox(),o=u.height,a=u.width,h=u.x,l=u.y,c=s.includes("left")?h:s.includes("right")?h+a:h+a/2,f=s.includes("top")?l:s.includes("bottom")?l+o:l+o/2;n=null!=t.ox?t.ox:c,r=null!=t.oy?t.oy:f}else n=i[0],r=i[1];return[n,r]}wn("replace",2,function(i,s,u){return[function(t,e){var n=i(this),r=null==t?void 0:t[s];return void 0!==r?r.call(t,n,e):u.call(String(n),t,e)},u]});var jn=Object.freeze({map:bn,filter:function(t,e){var n,r=t.length,i=[];for(n=0;n<r;n++)e(t[n])&&i.push(t[n]);return i},radians:_n,degrees:function(t){return 180*t/Math.PI%360},camelCase:kn,unCamelCase:xn,capitalize:On,proportionalSize:Sn,getOrigin:An}),Mn="http://www.w3.org/2000/svg",En="http://www.w3.org/2000/xmlns/",Tn="http://www.w3.org/1999/xlink",Cn="http://svgjs.com/svgjs",Pn=Object.freeze({ns:Mn,xmlns:En,xlink:Tn,svgjs:Cn}),Nn={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};function Ln(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Dn=function t(){Ln(this,t)},Fn={},Rn="___SYMBOL___ROOT___";function zn(t){return Nn.document.createElementNS(Mn,t)}function In(t){if(t instanceof Dn)return t;if("object"===Wt(t))return Yn(t);if(null==t)return new Fn[Rn];if("string"==typeof t&&"<"!==t.charAt(0))return Yn(Nn.document.querySelector(t));var e=zn("svg");return e.innerHTML=t,t=Yn(e.firstChild)}function qn(t,e){return e instanceof Nn.window.Node?e:zn(t)}function Yn(t){if(!t)return null;if(t.instance instanceof Dn)return t.instance;var e=On(t.nodeName);return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":Fn[e]||(e="Dom"),new Fn[e](t)}function Xn(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.name,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return Fn[e]=t,n&&(Fn[Rn]=t),vn(Object.keys(t.prototype)),t}function Hn(t){return Fn[t]}var Gn=1e3;function Bn(t){return"Svgjs"+On(t)+Gn++}function Vn(t){for(var e=t.children.length-1;0<=e;e--)Vn(t.children[e]);return t.id?Yn(t).id(Bn(t.nodeName)):Yn(t)}function Wn(t,e,n){var r,i;for(i=(t=Array.isArray(t)?t:[t]).length-1;0<=i;i--)for(r in e){var s=e[r];n&&(s=Qn(e[r])),t[i].prototype[r]=s}}function Qn(i){return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[e.length-1];return!r||r.constructor!==Object||r instanceof Array?i.apply(this,e):i.apply(this,e.slice(0,-1)).attr(r)}}cn("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){var t=this.position()+1,e=this.parent();return e.removeElement(this).add(this,t),"function"==typeof e.isRoot&&e.isRoot()&&e.node.appendChild(e.defs().node),this},backward:function(){var t=this.position();return 0<t&&this.parent().removeElement(this).add(this,t-1),this},front:function(){var t=this.parent();return t.node.appendChild(this.node),"function"==typeof t.isRoot&&t.isRoot()&&t.node.appendChild(t.defs().node),this},back:function(){return 0<this.position()&&this.parent().removeElement(this).add(this,0),this},before:function(t){(t=In(t)).remove();var e=this.position();return this.parent().add(t,e),this},after:function(t){(t=In(t)).remove();var e=this.position();return this.parent().add(t,e+1),this},insertBefore:function(t){(t=In(t)).before(this)},insertAfter:function(t){(t=In(t)).after(this)}}),wn("split",2,function(i,s,u){var v=pn,d=u,y=[].push,t="split",p="length",m="lastIndex";if("c"=="abbc"[t](/(b)*/)[1]||4!="test"[t](/(?:)/,-1)[p]||2!="ab"[t](/(?:ab)*/)[p]||4!="."[t](/(.?)(.?)/)[p]||1<"."[t](/()()/)[p]||""[t](/.?/)[p]){var g=void 0===/()??/.exec("")[1];u=function(t,e){var n=String(this);if(void 0===t&&0===e)return[];if(!v(t))return d.call(n,t,e);var r,i,s,u,o,a=[],h=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),l=0,c=void 0===e?4294967295:e>>>0,f=new RegExp(t.source,h+"g");for(g||(r=new RegExp("^"+f.source+"$(?!\\s)",h));(i=f.exec(n))&&!(l<(s=i.index+i[0][p])&&(a.push(n.slice(l,i.index)),!g&&1<i[p]&&i[0].replace(r,function(){for(o=1;o<arguments[p]-2;o++)void 0===arguments[o]&&(i[o]=void 0)}),1<i[p]&&i.index<n[p]&&y.apply(a,i.slice(1)),u=i[0][p],l=s,a[p]>=c));)f[m]===i.index&&f[m]++;return l===n[p]?!u&&f.test("")||a.push(""):a.push(n.slice(l)),a[p]>c?a.slice(0,c):a}}else"0"[t](void 0,0)[p]&&(u=function(t,e){return void 0===t&&0===e?[]:d.call(this,t,e)});return[function(t,e){var n=i(this),r=null==t?void 0:t[s];return void 0!==r?r.call(t,n,e):u.call(String(n),t,e)},u]});var Un=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,Jn=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,$n=/rgb\((\d+),(\d+),(\d+)\)/,Kn=/(#[a-z0-9\-_]+)/i,Zn=/\)\s*,?\s*/,tr=/\s/g,er=/^#[a-f0-9]{3,6}$/i,nr=/^rgb\(/,rr=/^(\s+)?$/,ir=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,sr=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,ur=/[\s,]+/,or=/([^e])-/gi,ar=/[MLHVCSQTAZ]/gi,hr=/[MLHVCSQTAZ]/i,lr=/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,cr=/\./g,fr=Object.freeze({numberAndUnit:Un,hex:Jn,rgb:$n,reference:Kn,transforms:Zn,whitespace:tr,isHex:er,isRgb:nr,isCss:/[^:]+:[^;]+;?/,isBlank:rr,isNumber:ir,isPercent:/^-?[\d.]+%$/,isImage:sr,delimiter:ur,hyphen:or,pathLetters:ar,isPathLetter:hr,numbersWithDots:lr,dots:cr});cn("Dom",{classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(ur)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(e){return this.hasClass(e)&&this.attr("class",this.classes().filter(function(t){return t!==e}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),cn("Dom",{css:function(t,e){var n={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){var e=t.split(/\s*:\s*/);n[e[0]]=e[1]}),n;if(arguments.length<2){if(Array.isArray(t)){var r=!0,i=!1,s=void 0;try{for(var u,o=t[Symbol.iterator]();!(r=(u=o.next()).done);r=!0){var a=kn(u.value);n[a]=this.node.style[a]}}catch(t){i=!0,s=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw s}}return n}if("string"==typeof t)return this.node.style[kn(t)];if("object"===Wt(t))for(var h in t)this.node.style[kn(h)]=null==t[h]||rr.test(t[h])?"":t[h]}return 2===arguments.length&&(this.node.style[kn(t)]=null==e||rr.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),cn("Dom",{data:function(e,t,n){if("object"===Wt(e))for(t in e)this.data(t,e[t]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+e))}catch(t){return this.attr("data-"+e)}else this.attr("data-"+e,null===t?null:!0===n||"string"==typeof t||"number"==typeof t?t:JSON.stringify(t));return this}}),cn("Dom",{remember:function(t,e){if("object"===Wt(t))for(var n in t)this.remember(n,t[n]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(var t=arguments.length-1;0<=t;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});var vr=0;function dr(t){var e=In(t).getEventHolder();return e.events||(e.events={}),e.events}function yr(t){return In(t).getEventTarget()}function pr(t,e,r,n,i){var s=r.bind(n||t),u=dr(t),o=yr(t);e=Array.isArray(e)?e:e.split(ur),r._svgjsListenerId||(r._svgjsListenerId=++vr),e.forEach(function(t){var e=t.split(".")[0],n=t.split(".")[1]||"*";u[e]=u[e]||{},u[e][n]=u[e][n]||{},u[e][n][r._svgjsListenerId]=s,o.addEventListener(e,s,i||!1)})}function mr(u,t,o,a){var h=dr(u),l=yr(u);("function"!=typeof o||(o=o._svgjsListenerId))&&(t=Array.isArray(t)?t:(t||"").split(ur)).forEach(function(t){var e,n,r,i=t&&t.split(".")[0],s=t&&t.split(".")[1];if(o)h[i]&&h[i][s||"*"]&&(l.removeEventListener(i,h[i][s||"*"][o],a||!1),delete h[i][s||"*"][o]);else if(i&&s){if(h[i]&&h[i][s]){for(n in h[i][s])mr(l,[i,s].join("."),n);delete h[i][s]}}else if(s)for(t in h)for(e in h[t])s===e&&mr(l,[t,s].join("."));else if(i){if(h[i]){for(e in h[i])mr(l,[i,e].join("."));delete h[i]}}else{for(t in h)mr(l,t);(r=In(u).getEventHolder()).events&&(r.events={})}})}function gr(t,e,n){var r=yr(t);return e instanceof Nn.window.Event||(e=new Nn.window.CustomEvent(e,{detail:n,cancelable:!0})),r.dispatchEvent(e),e}function wr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function br(t,e,n){return e&&wr(t.prototype,e),n&&wr(t,n),t}var _r=function(){var t=p(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e};u&&"g"!=/./g.flags&&a.f(RegExp.prototype,"flags",{configurable:!0,get:_r});var kr="toString",xr=/./[kr],Or=function(t){O(RegExp.prototype,kr,t,!0)};function Sr(t){var e=t.toString(16);return 1===e.length?"0"+e:e}w(function(){return"/a/b"!=xr.call({source:"a",flags:"b"})})?Or(function(){var t=p(this);return"/".concat(t.source,"/","flags"in t?t.flags:!u&&t instanceof RegExp?_r.call(t):void 0)}):xr.name!=kr&&Or(function(){return xr.call(this)});var Ar=function(){function t(){Ln(this,t),this.init.apply(this,arguments)}return br(t,[{key:"init",value:function(t,e,n){var r,i;if(this.r=0,this.g=0,this.b=0,t)return"string"==typeof t?nr.test(t)?(r=$n.exec(t.replace(tr,"")),this.r=parseInt(r[1]),this.g=parseInt(r[2]),this.b=parseInt(r[3])):er.test(t)&&(r=Jn.exec(4===(i=t).length?["#",i.substring(1,2),i.substring(1,2),i.substring(2,3),i.substring(2,3),i.substring(3,4),i.substring(3,4)].join(""):i),this.r=parseInt(r[1],16),this.g=parseInt(r[2],16),this.b=parseInt(r[3],16)):Array.isArray(t)?(this.r=t[0],this.g=t[1],this.b=t[2]):"object"===Wt(t)?(this.r=t.r,this.g=t.g,this.b=t.b):3===arguments.length&&(this.r=t,this.g=e,this.b=n),this}},{key:"toString",value:function(){return this.toHex()}},{key:"toArray",value:function(){return[this.r,this.g,this.b]}},{key:"toHex",value:function(){return"#"+Sr(Math.round(this.r))+Sr(Math.round(this.g))+Sr(Math.round(this.b))}},{key:"toRgb",value:function(){return"rgb("+[this.r,this.g,this.b].join()+")"}},{key:"brightness",value:function(){return this.r/255*.3+this.g/255*.59+this.b/255*.11}}],[{key:"test",value:function(t){return t+="",er.test(t)||nr.test(t)}},{key:"isRgb",value:function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}},{key:"isColor",value:function(t){return this.isRgb(t)||this.test(t)}}]),t}();function jr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Mr(t,e){return!e||"object"!==Wt(e)&&"function"!=typeof e?jr(t):e}function Er(t){return(Er=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Tr(t,e,n){return(Tr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Er(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Cr(t,e){return(Cr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Pr(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Cr(t,e)}wn("match",1,function(r,i,t){return[function(t){var e=r(this),n=null==t?void 0:t[i];return void 0!==n?n.call(t,e):new RegExp(t)[i](String(e))},t]});var Nr=function(){function e(){Ln(this,e),this.init.apply(this,arguments)}return br(e,[{key:"init",value:function(t,e){var n,r=0,i=0;return n=Array.isArray(t)?{x:t[0],y:t[1]}:"object"===Wt(t)?{x:t.x,y:t.y}:{x:t,y:e},this.x=null==n.x?r:n.x,this.y=null==n.y?i:n.y,this}},{key:"clone",value:function(){return new e(this)}},{key:"transform",value:function(t){return new e(t.a*this.x+t.c*this.y+t.e,t.b*this.x+t.d*this.y+t.f)}},{key:"toArray",value:function(){return[this.x,this.y]}}]),e}();function Lr(){if(!Lr.nodes){var t=In().size(2,0);t.node.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";");var e=t.path().node;Lr.nodes={svg:t,path:e}}if(!Lr.nodes.svg.node.parentNode){var n=Nn.document.body||Nn.document.documentElement;Lr.nodes.svg.addTo(n)}return Lr.nodes}function Dr(t){return!(t.w||t.h||t.x||t.y)}var Fr=function(){function u(){Ln(this,u),this.init.apply(this,arguments)}return br(u,[{key:"init",value:function(t){return t="string"==typeof t?t.split(ur).map(parseFloat):Array.isArray(t)?t:"object"===Wt(t)?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}},{key:"merge",value:function(t){var e=Math.min(this.x,t.x),n=Math.min(this.y,t.y);return new u(e,n,Math.max(this.x+this.width,t.x+t.width)-e,Math.max(this.y+this.height,t.y+t.height)-n)}},{key:"transform",value:function(e){var n=1/0,r=-1/0,i=1/0,s=-1/0;return[new Nr(this.x,this.y),new Nr(this.x2,this.y),new Nr(this.x,this.y2),new Nr(this.x2,this.y2)].forEach(function(t){t=t.transform(e),n=Math.min(n,t.x),r=Math.max(r,t.x),i=Math.min(i,t.y),s=Math.max(s,t.y)}),new u(n,i,r-n,s-i)}},{key:"addOffset",value:function(){return this.x+=Nn.window.pageXOffset,this.y+=Nn.window.pageYOffset,this}},{key:"toString",value:function(){return this.x+" "+this.y+" "+this.width+" "+this.height}},{key:"toArray",value:function(){return[this.x,this.y,this.width,this.height]}},{key:"isNulled",value:function(){return Dr(this)}}]),u}();function Rr(e){var n,t;try{if(Dr(n=e(this.node))&&(t=this.node,!(Nn.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===document}).call(Nn.document.documentElement,t)))throw new Error("Element not in the dom")}catch(t){try{var r=this.clone().addTo(Lr().svg).show();n=e(r.node),r.remove()}catch(t){throw new Error('Getting a bounding box of element "'+this.node.nodeName+'" is not possible')}}return n}function zr(t,e,n){return Math.abs(e-t)<(n||1e-6)}cn({viewbox:{viewbox:function(t,e,n,r){return null==t?new Fr(this.attr("viewBox")):this.attr("viewBox",new Fr(t,e,n,r))}}});var Ir=function(){function h(){Ln(this,h),this.init.apply(this,arguments)}return br(h,[{key:"init",value:function(t){var e=h.fromArray([1,0,0,1,0,0]);return t=t instanceof Element?t.matrixify():"string"==typeof t?h.fromArray(t.split(ur).map(parseFloat)):Array.isArray(t)?h.fromArray(t):"object"===Wt(t)&&h.isMatrixLike(t)?t:"object"===Wt(t)?(new h).transform(t):6===arguments.length?h.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}},{key:"clone",value:function(){return new h(this)}},{key:"transform",value:function(t){if(h.isMatrixLike(t))return new h(t).multiplyO(this);var e=h.formatTransforms(t),n=new Nr(e.ox,e.oy).transform(this),r=n.x,i=n.y,s=(new h).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-r,-i).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(r,i);if(isFinite(e.px)||isFinite(e.py)){var u=new Nr(r,i).transform(s),o=e.px?e.px-u.x:0,a=e.py?e.py-u.y:0;s.translateO(o,a)}return s.translateO(e.tx,e.ty),s}},{key:"compose",value:function(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,n=t.originY||0,r=t.scaleX||1,i=t.scaleY||1,s=t.shear||0,u=t.rotate||0,o=t.translateX||0,a=t.translateY||0;return(new h).translateO(-e,-n).scaleO(r,i).shearO(s).rotateO(u).translateO(o,a).lmultiplyO(this).translateO(e,n)}},{key:"decompose",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.a,r=this.b,i=this.c,s=this.d,u=this.e,o=this.f,a=n*s-r*i,h=0<a?1:-1,l=h*Math.sqrt(n*n+r*r),c=Math.atan2(h*r,h*n),f=180/Math.PI*c,v=Math.cos(c),d=Math.sin(c),y=(n*i+r*s)/a,p=i*l/(y*n-r)||s*l/(y*r+n);return{scaleX:l,scaleY:p,shear:y,rotate:f,translateX:u-t+t*v*l+e*(y*v*l-d*p),translateY:o-e+t*d*l+e*(y*d*l+v*p),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}},{key:"multiply",value:function(t){return this.clone().multiplyO(t)}},{key:"multiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(this,e,this)}},{key:"lmultiply",value:function(t){return this.clone().lmultiplyO(t)}},{key:"lmultiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(e,this,this)}},{key:"inverseO",value:function(){var t=this.a,e=this.b,n=this.c,r=this.d,i=this.e,s=this.f,u=t*r-e*n;if(!u)throw new Error("Cannot invert "+this);var o=r/u,a=-e/u,h=-n/u,l=t/u,c=-(o*i+h*s),f=-(a*i+l*s);return this.a=o,this.b=a,this.c=h,this.d=l,this.e=c,this.f=f,this}},{key:"inverse",value:function(){return this.clone().inverseO()}},{key:"translate",value:function(t,e){return this.clone().translateO(t,e)}},{key:"translateO",value:function(t,e){return this.e+=t||0,this.f+=e||0,this}},{key:"scale",value:function(t,e,n,r){var i;return(i=this.clone()).scaleO.apply(i,arguments)}},{key:"scaleO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(r=n,n=e,e=t);var i=this.a,s=this.b,u=this.c,o=this.d,a=this.e,h=this.f;return this.a=i*t,this.b=s*e,this.c=u*t,this.d=o*e,this.e=a*t-n*t+n,this.f=h*e-r*e+r,this}},{key:"rotate",value:function(t,e,n){return this.clone().rotateO(t,e,n)}},{key:"rotateO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;t=_n(t);var r=Math.cos(t),i=Math.sin(t),s=this.a,u=this.b,o=this.c,a=this.d,h=this.e,l=this.f;return this.a=s*r-u*i,this.b=u*r+s*i,this.c=o*r-a*i,this.d=a*r+o*i,this.e=h*r-l*i+n*i-e*r+e,this.f=l*r+h*i-e*i-n*r+n,this}},{key:"flip",value:function(t,e){return this.clone().flipO(t,e)}},{key:"flipO",value:function(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}},{key:"shear",value:function(t,e,n){return this.clone().shearO(t,e,n)}},{key:"shearO",value:function(t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,n=this.a,r=this.b,i=this.c,s=this.d,u=this.e,o=this.f;return this.a=n+r*t,this.c=i+s*t,this.e=u+o*t-e*t,this}},{key:"skew",value:function(t,e,n,r){var i;return(i=this.clone()).skewO.apply(i,arguments)}},{key:"skewO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(r=n,n=e,e=t),t=_n(t),e=_n(e);var i=Math.tan(t),s=Math.tan(e),u=this.a,o=this.b,a=this.c,h=this.d,l=this.e,c=this.f;return this.a=u+o*i,this.b=o+u*s,this.c=a+h*i,this.d=h+a*s,this.e=l+c*i-r*i,this.f=c+l*s-n*s,this}},{key:"skewX",value:function(t,e,n){return this.skew(t,0,e,n)}},{key:"skewXO",value:function(t,e,n){return this.skewO(t,0,e,n)}},{key:"skewY",value:function(t,e,n){return this.skew(0,t,e,n)}},{key:"skewYO",value:function(t,e,n){return this.skewO(0,t,e,n)}},{key:"aroundO",value:function(t,e,n){var r=t||0,i=e||0;return this.translateO(-r,-i).lmultiplyO(n).translateO(r,i)}},{key:"around",value:function(t,e,n){return this.clone().aroundO(t,e,n)}},{key:"equals",value:function(t){var e=new h(t);return zr(this.a,e.a)&&zr(this.b,e.b)&&zr(this.c,e.c)&&zr(this.d,e.d)&&zr(this.e,e.e)&&zr(this.f,e.f)}},{key:"toString",value:function(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}},{key:"toArray",value:function(){return[this.a,this.b,this.c,this.d,this.e,this.f]}},{key:"valueOf",value:function(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}],[{key:"fromArray",value:function(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}},{key:"isMatrixLike",value:function(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}},{key:"formatTransforms",value:function(t){var e="both"===t.flip||!0===t.flip,n=t.flip&&(e||"x"===t.flip)?-1:1,r=t.flip&&(e||"y"===t.flip)?-1:1,i=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,s=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,u=t.scale&&t.scale.length?t.scale[0]*n:isFinite(t.scale)?t.scale*n:isFinite(t.scaleX)?t.scaleX*n:n,o=t.scale&&t.scale.length?t.scale[1]*r:isFinite(t.scale)?t.scale*r:isFinite(t.scaleY)?t.scaleY*r:r,a=t.shear||0,h=t.rotate||t.theta||0,l=new Nr(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),c=l.x,f=l.y,v=new Nr(t.position||t.px||t.positionX,t.py||t.positionY),d=v.x,y=v.y,p=new Nr(t.translate||t.tx||t.translateX,t.ty||t.translateY),m=p.x,g=p.y,w=new Nr(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:u,scaleY:o,skewX:i,skewY:s,shear:a,theta:h,rx:w.x,ry:w.y,tx:m,ty:g,ox:c,oy:f,px:d,py:y}}},{key:"matrixMultiply",value:function(t,e,n){var r=t.a*e.a+t.c*e.b,i=t.b*e.a+t.d*e.b,s=t.a*e.c+t.c*e.d,u=t.b*e.c+t.d*e.d,o=t.e+t.a*e.e+t.c*e.f,a=t.f+t.b*e.e+t.d*e.f;return n.a=r,n.b=i,n.c=s,n.d=u,n.e=o,n.f=a,n}}]),h}();var qr=function(){try{return Function("name","baseClass","_constructor",["baseClass = baseClass || Array","return {"," [name]: class extends baseClass {"," constructor (...args) {"," super(...args)"," _constructor && _constructor.apply(this, args)"," }"," }","}[name]"].join("\n"))}catch(t){return function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Array,n=2<arguments.length?arguments[2]:void 0,r=function(){e.apply(this,arguments),n&&n.apply(this,arguments)};return((r.prototype=Object.create(e.prototype)).constructor=r).prototype.map=function(t){var e=new r;return e.push.apply(e,Array.prototype.map.call(this,t)),e},r}}}(),Yr=qr("List",Array,function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];if("number"==typeof t)return this;this.length=0,this.push.apply(this,be(t))});function Xr(t,e){return new Yr(bn((e||Nn.document).querySelectorAll(t),function(t){return Yn(t)}))}Wn(Yr,{each:function(e){for(var t=arguments.length,n=new Array(1<t?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"!=typeof e?this.map(function(t){return t[e].apply(t,n)}):(this.forEach(function(t){e.call(t,t)}),this)},toArray:function(){return Array.prototype.concat.apply([],this)}}),Yr.extend=function(t){t=t.reduce(function(t,r){return t[r]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.each.apply(this,[r].concat(e))},t},{}),Wn(Yr,t)};var Hr=function(t){function r(){var t,e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).events,n=void 0===e?{}:e;return Ln(this,r),(t=Mr(this,Er(r).call(this))).events=n,t}return Pr(r,Dn),br(r,[{key:"addEventListener",value:function(){}},{key:"dispatch",value:function(t,e){return gr(this,t,e)}},{key:"dispatchEvent",value:function(t){var e=this.getEventHolder().events;if(!e)return!0;var n=e[t.type];for(var r in n)for(var i in n[r])n[r][i](t);return!t.defaultPrevented}},{key:"fire",value:function(t,e){return this.dispatch(t,e),this}},{key:"getEventHolder",value:function(){return this}},{key:"getEventTarget",value:function(){return this}},{key:"off",value:function(t,e){return mr(this,t,e),this}},{key:"on",value:function(t,e,n,r){return pr(this,t,e,n,r),this}},{key:"removeEventListener",value:function(){}}]),r}();function Gr(){}var Br={duration:400,ease:">",delay:0},Vr={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","font-size":16,"font-family":"Helvetica, Arial, sans-serif","text-anchor":"start"},Wr=Object.freeze({noop:Gr,timeline:Br,attrs:Vr}),Qr=qr("SVGArray",Array,function(t){this.init(t)});Wn(Qr,{init:function(t){return"number"==typeof t||(this.length=0,this.push.apply(this,be(this.parse(t)))),this},toArray:function(){return Array.prototype.concat.apply([],this)},toString:function(){return this.join(" ")},valueOf:function(){var t=[];return t.push.apply(t,be(this)),t},parse:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return t instanceof Array?t:t.trim().split(ur).map(parseFloat)},clone:function(){return new this.constructor(this)},toSet:function(){return new Set(this)}});var Ur=function(){function n(){Ln(this,n),this.init.apply(this,arguments)}return br(n,[{key:"init",value:function(t,e){return e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(Un))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof n&&(this.value=t.valueOf(),this.unit=t.unit),this}},{key:"toString",value:function(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}},{key:"toJSON",value:function(){return this.toString()}},{key:"toArray",value:function(){return[this.value,this.unit]}},{key:"valueOf",value:function(){return this.value}},{key:"plus",value:function(t){return new n(this+(t=new n(t)),this.unit||t.unit)}},{key:"minus",value:function(t){return new n(this-(t=new n(t)),this.unit||t.unit)}},{key:"times",value:function(t){return new n(this*(t=new n(t)),this.unit||t.unit)}},{key:"divide",value:function(t){return new n(this/(t=new n(t)),this.unit||t.unit)}}]),n}(),Jr=[];var Dom=function(t){function Dom(t,e){var n;return Ln(this,Dom),(n=Mr(this,Er(Dom).call(this,t))).node=t,n.type=t.nodeName,e&&t!==e&&n.attr(e),n}return Pr(Dom,Hr),br(Dom,[{key:"add",value:function(t,e){return t=In(t),null==e?this.node.appendChild(t.node):t.node!==this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this}},{key:"addTo",value:function(t){return In(t).put(this)}},{key:"children",value:function(){return new Yr(bn(this.node.children,function(t){return Yn(t)}))}},{key:"clear",value:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this}},{key:"clone",value:function(){return this.writeDataToDom(),Vn(this.node.cloneNode(!0))}},{key:"each",value:function(t,e){var n,r,i=this.children();for(n=0,r=i.length;n<r;n++)t.apply(i[n],[n,i]),e&&i[n].each(t,e);return this}},{key:"element",value:function(t){return this.put(new Dom(zn(t)))}},{key:"first",value:function(){return Yn(this.node.firstChild)}},{key:"get",value:function(t){return Yn(this.node.childNodes[t])}},{key:"getEventHolder",value:function(){return this.node}},{key:"getEventTarget",value:function(){return this.node}},{key:"has",value:function(t){return 0<=this.index(t)}},{key:"id",value:function(t){return void 0!==t||this.node.id||(this.node.id=Bn(this.type)),this.attr("id",t)}},{key:"index",value:function(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}},{key:"last",value:function(){return Yn(this.node.lastChild)}},{key:"matches",value:function(t){var e=this.node;return(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector).call(e,t)}},{key:"parent",value:function(t){var e=this;if(!e.node.parentNode)return null;if(e=Yn(e.node.parentNode),!t)return e;for(;e&&e.node instanceof Nn.window.SVGElement;){if("string"==typeof t?e.matches(t):e instanceof t)return e;e=Yn(e.node.parentNode)}}},{key:"put",value:function(t,e){return this.add(t,e),t}},{key:"putIn",value:function(t){return In(t).add(this)}},{key:"remove",value:function(){return this.parent()&&this.parent().removeElement(this),this}},{key:"removeElement",value:function(t){return this.node.removeChild(t.node),this}},{key:"replace",value:function(t){return t=In(t),this.node.parentNode.replaceChild(t.node,this.node),t}},{key:"round",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:2,e=1<arguments.length?arguments[1]:void 0,n=Math.pow(10,t),r=this.attr();e||(e=Object.keys(r));var i={};return e.forEach(function(t){i[t]=Math.round(r[t]*n)/n}),this.attr(i),this}},{key:"toString",value:function(){return this.id()}},{key:"svg",value:function(n,t){var e,r,i;if(!1===n&&(t=!1,n=null),null==n||"function"==typeof n){t=null==t||t,this.writeDataToDom();var s=this;if(null!=n){if(s=Yn(s.node.cloneNode(!0)),t){var u=n(s);if(s=u||s,!1===u)return""}s.each(function(){var t=n(this),e=t||this;!1===t?this.remove():t&&this!==e&&this.replace(e)},!0)}return t?s.node.outerHTML:s.node.innerHTML}for(t=null!=t&&t,e=Nn.document.createElementNS(Mn,"svg"),i=Nn.document.createDocumentFragment(),e.innerHTML=n,r=e.children.length;r--;)i.appendChild(e.firstElementChild);var o=this.parent();return t?this.replace(i)&&o:this.add(i)}},{key:"words",value:function(t){return this.node.textContent=t,this}},{key:"writeDataToDom",value:function(){return this.each(function(){this.writeDataToDom()}),this}}]),Dom}();Wn(Dom,{attr:function(n,t,e){var r=this;if(null==n){n={},t=this.node.attributes;var i=!0,s=!1,u=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var h=o.value;n[h.nodeName]=ir.test(h.nodeValue)?parseFloat(h.nodeValue):h.nodeValue}}catch(t){s=!0,u=t}finally{try{i||null==a.return||a.return()}finally{if(s)throw u}}return n}if(n instanceof Array)return n.reduce(function(t,e){return t[e]=r.attr(e),t},{});if("object"===Wt(n))for(t in n)this.attr(t,n[t]);else if(null===t)this.node.removeAttribute(n);else{if(null==t)return null==(t=this.node.getAttribute(n))?Vr[n]:ir.test(t)?parseFloat(t):t;"number"==typeof(t=Jr.reduce(function(t,e){return e(n,t,r)},t))?t=new Ur(t):Ar.isColor(t)?t=new Ar(t):t.constructor===Array&&(t=new Qr(t)),"leading"===n?this.leading&&this.leading(t):"string"==typeof e?this.node.setAttributeNS(e,n,t.toString()):this.node.setAttribute(n,t.toString()),!this.rebuild||"font-size"!==n&&"x"!==n||this.rebuild()}return this},find:function(t){return Xr(t,this.node)}}),Xn(Dom);var Svg=Hn(Rn),Element=function(t){function Element(t,e){var n;return Ln(this,Element),(n=Mr(this,Er(Element).call(this,t,e))).dom={},n.node.instance=jr(jr(n)),t.hasAttribute("svgjs:data")&&n.setData(JSON.parse(t.getAttribute("svgjs:data"))||{}),n}return Pr(Element,Dom),br(Element,[{key:"center",value:function(t,e){return this.cx(t).cy(e)}},{key:"cx",value:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}},{key:"cy",value:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}},{key:"defs",value:function(){return this.root().defs()}},{key:"root",value:function(){var t=this.parent(Svg);return t&&t.root()}},{key:"getEventHolder",value:function(){return this}},{key:"height",value:function(t){return this.attr("height",t)}},{key:"inside",value:function(t,e){var n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height}},{key:"move",value:function(t,e){return this.x(t).y(e)}},{key:"parents",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Nn.document;t=In(t);for(var e=new Yr,n=this;(n=n.parent())&&n.node!==t.node&&n.node!==Nn.document;)e.push(n);return e}},{key:"reference",value:function(t){if(!(t=this.attr(t)))return null;var e=t.match(Kn);return e?In(e[1]):null}},{key:"setData",value:function(t){return this.dom=t,this}},{key:"size",value:function(t,e){var n=Sn(this,t,e);return this.width(new Ur(n.width)).height(new Ur(n.height))}},{key:"width",value:function(t){return this.attr("width",t)}},{key:"writeDataToDom",value:function(){return this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),Tr(Er(Element.prototype),"writeDataToDom",this).call(this)}},{key:"x",value:function(t){return this.attr("x",t)}},{key:"y",value:function(t){return this.attr("y",t)}}]),Element}();Wn(Element,{bbox:function(){return new Fr(Rr.call(this,function(t){return t.getBBox()}))},rbox:function(t){var e=new Fr(Rr.call(this,function(t){return t.getBoundingClientRect()}));return t?e.transform(t.screenCTM().inverse()):e.addOffset()},point:function(t,e){return new Nr(t,e).transform(this.screenCTM().inverse())},ctm:function(){return new Ir(this.node.getCTM())},screenCTM:function(){if("function"!=typeof this.isRoot||this.isRoot())return new Ir(this.node.getScreenCTM());var t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new Ir(e)}}),Xn(Element);var $r={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"===e?t:t+"-"+e}};function Kr(i){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},e=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),e.forEach(function(t){var e,n,r;e=i,r=s[n=t],n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r})}return i}function Zr(t){return this.attr("rx",t)}function ti(t){return this.attr("ry",t)}function ei(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function ni(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function ri(t){return null==t?this.attr("cx"):this.attr("cx",t)}function ii(t){return null==t?this.attr("cy"):this.attr("cy",t)}function si(t){return null==t?2*this.rx():this.rx(new Ur(t).divide(2))}function ui(t){return null==t?2*this.ry():this.ry(new Ur(t).divide(2))}["fill","stroke"].forEach(function(e){var n,t={};t[e]=function(t){if(void 0===t)return this.attr(e);if("string"==typeof t||Ar.isRgb(t)||t instanceof Element)this.attr(e,t);else for(n=$r[e].length-1;0<=n;n--)null!=t[$r[e][n]]&&this.attr($r.prefix(e,$r[e][n]),t[$r[e][n]]);return this},cn(["Shape","Runner"],t)}),cn(["Element","Runner"],{matrix:function(t,e,n,r,i,s){return null==t?new Ir(this):this.attr("transform",new Ir(t,e,n,r,i,s))},rotate:function(t,e,n){return this.transform({rotate:t,ox:e,oy:n},!0)},skew:function(t,e,n,r){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:n},!0):this.transform({skew:[t,e],ox:n,oy:r},!0)},shear:function(t,e,n){return this.transform({shear:t,ox:e,oy:n},!0)},scale:function(t,e,n,r){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:n},!0):this.transform({scale:[t,e],ox:n,oy:r},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(t,e){var n="string"==typeof t?t:(isFinite(t),"both"),r="both"===t&&isFinite(e)?[e,e]:"x"===t?[e,0]:"y"===t?[0,e]:isFinite(t)?[t,t]:[0,0];this.transform({flip:n,origin:r},!0)},opacity:function(t){return this.attr("opacity",t)},dmove:function(t,e){return this.dx(t).dy(e)}}),cn("Element",{dx:function(t){return this.x(new Ur(t).plus(this.x()))},dy:function(t){return this.y(new Ur(t).plus(this.y()))}}),cn("radius",{radius:function(t,e){var n=(this._element||this).type;return"radialGradient"===n||"radialGradient"===n?this.attr("r",new Ur(t)):this.rx(t).ry(null==e?t:e)}}),cn("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new Nr(this.node.getPointAtLength(t))}}),cn(["Element","Runner"],{font:function(t,e){if("object"===Wt(t))for(e in t)this.font(e,t[e]);return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}}),cn("Text",{ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},amove:function(t,e){return this.ax(t).ay(e)}}),cn("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel"].reduce(function(t,e){return t[e]=function(t){return null===t?mr(this,e):pr(this,e,t),this},t},{})),cn("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(Zn).slice(0,-1).map(function(t){var e=t.trim().split("(");return[e[0],e[1].split(ur).map(function(t){return parseFloat(t)})]}).reverse().reduce(function(t,e){return"matrix"===e[0]?t.lmultiply(Ir.fromArray(e[1])):t[e[0]].apply(t,e[1])},new Ir)},toParent:function(t){if(this===t)return this;var e=this.screenCTM(),n=t.screenCTM().inverse();return this.addTo(t).untransform().transform(n.multiply(e)),this},toRoot:function(){return this.toParent(this.root())},transform:function(t,e){if(null==t||"string"==typeof t){var n=new Ir(this).decompose();return n[t]||n}Ir.isMatrixLike(t)||(t=Kr({},t,{origin:An(t,this)}));var r=new Ir(!0===e?this:e||!1).transform(t);return this.attr("transform",r)}});var oi=Object.freeze({rx:Zr,ry:ti,x:ei,y:ni,cx:ri,cy:ii,width:si,height:ui}),Shape=function(t){function Shape(){return Ln(this,Shape),Mr(this,Er(Shape).apply(this,arguments))}return Pr(Shape,Element),Shape}();Xn(Shape);var Circle=function(t){function Circle(t){return Ln(this,Circle),Mr(this,Er(Circle).call(this,qn("circle",t),t))}return Pr(Circle,Shape),br(Circle,[{key:"radius",value:function(t){return this.attr("r",t)}},{key:"rx",value:function(t){return this.attr("r",t)}},{key:"ry",value:function(t){return this.rx(t)}},{key:"size",value:function(t){return this.radius(new Ur(t).divide(2))}}]),Circle}();Wn(Circle,{x:ei,y:ni,cx:ri,cy:ii,width:si,height:ui}),cn({Element:{circle:Qn(function(t){return this.put(new Circle).size(t).move(0,0)})}}),Xn(Circle);var Container=function(t){function Container(){return Ln(this,Container),Mr(this,Er(Container).apply(this,arguments))}return Pr(Container,Element),br(Container,[{key:"flatten",value:function(t){return this.each(function(){return this instanceof Container?this.flatten(t).ungroup(t):this.toParent(t)}),this.node.firstElementChild||this.remove(),this}},{key:"ungroup",value:function(t){return t=t||this.parent(),this.each(function(){return this.toParent(t)}),this.remove(),this}}]),Container}();Xn(Container);var Defs=function(t){function Defs(t){return Ln(this,Defs),Mr(this,Er(Defs).call(this,qn("defs",t),t))}return Pr(Defs,Container),br(Defs,[{key:"flatten",value:function(){return this}},{key:"ungroup",value:function(){return this}}]),Defs}();Xn(Defs);var Ellipse=function(t){function Ellipse(t){return Ln(this,Ellipse),Mr(this,Er(Ellipse).call(this,qn("ellipse",t),t))}return Pr(Ellipse,Shape),br(Ellipse,[{key:"size",value:function(t,e){var n=Sn(this,t,e);return this.rx(new Ur(n.width).divide(2)).ry(new Ur(n.height).divide(2))}}]),Ellipse}();Wn(Ellipse,oi),cn("Container",{ellipse:Qn(function(t,e){return this.put(new Ellipse).size(t,e).move(0,0)})}),Xn(Ellipse);var Stop=function(t){function Stop(t){return Ln(this,Stop),Mr(this,Er(Stop).call(this,qn("stop",t),t))}return Pr(Stop,Element),br(Stop,[{key:"update",value:function(t){return("number"==typeof t||t instanceof Ur)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new Ur(t.offset)),this}}]),Stop}();function ai(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new Ur(t),fy:new Ur(e)}):this.attr({x1:new Ur(t),y1:new Ur(e)})}function hi(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new Ur(t),cy:new Ur(e)}):this.attr({x2:new Ur(t),y2:new Ur(e)})}Xn(Stop);var li=Object.freeze({from:ai,to:hi}),Gradient=function(t){function Gradient(t,e){return Ln(this,Gradient),Mr(this,Er(Gradient).call(this,qn(t+"Gradient","string"==typeof t?null:t),e))}return Pr(Gradient,Container),br(Gradient,[{key:"stop",value:function(t,e,n){return this.put(new Stop).update(t,e,n)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"toString",value:function(){return this.url()}},{key:"attr",value:function(t,e,n){return"transform"===t&&(t="gradientTransform"),Tr(Er(Gradient.prototype),"attr",this).call(this,t,e,n)}},{key:"targets",value:function(){return Xr('svg [fill*="'+this.id()+'"]')}},{key:"bbox",value:function(){return new Fr}}]),Gradient}();Wn(Gradient,li),cn({Container:{gradient:Qn(function(t,e){return this.defs().gradient(t,e)})},Defs:{gradient:Qn(function(t,e){return this.put(new Gradient(t)).update(e)})}}),Xn(Gradient);var Pattern=function(t){function Pattern(t){return Ln(this,Pattern),Mr(this,Er(Pattern).call(this,qn("pattern",t),t))}return Pr(Pattern,Container),br(Pattern,[{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return this.url()}},{key:"attr",value:function(t,e,n){return"transform"===t&&(t="patternTransform"),Tr(Er(Pattern.prototype),"attr",this).call(this,t,e,n)}},{key:"targets",value:function(){return Xr('svg [fill*="'+this.id()+'"]')}},{key:"bbox",value:function(){return new Fr}}]),Pattern}();cn({Container:{pattern:function(){var t;return(t=this.defs()).pattern.apply(t,arguments)}},Defs:{pattern:Qn(function(t,e,n){return this.put(new Pattern).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})})}}),Xn(Pattern);var ci,Image=function(t){function Image(t){return Ln(this,Image),Mr(this,Er(Image).call(this,qn("image",t),t))}return Pr(Image,Shape),br(Image,[{key:"load",value:function(t,n){if(!t)return this;var r=new Nn.window.Image;return pr(r,"load",function(t){var e=this.parent(Pattern);0===this.width()&&0===this.height()&&this.size(r.width,r.height),e instanceof Pattern&&0===e.width()&&0===e.height()&&e.size(this.width(),this.height()),"function"==typeof n&&n.call(this,t)},this),pr(r,"load error",function(){mr(r)}),this.attr("href",r.src=t,Tn)}}]),Image}();ci=function(t,e,n){return"fill"!==t&&"stroke"!==t||sr.test(e)&&(e=n.root().defs().image(e)),e instanceof Image&&(e=n.root().defs().pattern(0,0,function(t){t.add(e)})),e},Jr.push(ci),cn({Container:{image:Qn(function(t,e){return this.put(new Image).size(0,0).load(t,e)})}}),Xn(Image);var fi=qr("PointArray",Qr);Wn(fi,{toString:function(){for(var t=0,e=this.length,n=[];t<e;t++)n.push(this[t].join(","));return n.join(" ")},toLine:function(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}},at:function(t){if(!this.destination)return this;for(var e=0,n=this.length,r=[];e<n;e++)r.push([this[e][0]+(this.destination[e][0]-this[e][0])*t,this[e][1]+(this.destination[e][1]-this[e][1])*t]);return new fi(r)},parse:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[[0,0]],e=[];if(t instanceof Array){if(t[0]instanceof Array)return t}else t=t.trim().split(ur).map(parseFloat);t.length%2!=0&&t.pop();for(var n=0,r=t.length;n<r;n+=2)e.push([t[n],t[n+1]]);return e},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var r=this.length-1;0<=r;r--)this[r]=[this[r][0]+t,this[r][1]+e];return this},size:function(t,e){var n,r=this.bbox();for(n=this.length-1;0<=n;n--)r.width&&(this[n][0]=(this[n][0]-r.x)*t/r.width+r.x),r.height&&(this[n][1]=(this[n][1]-r.y)*e/r.height+r.y);return this},bbox:function(){var e=-1/0,n=-1/0,r=1/0,i=1/0;return this.forEach(function(t){e=Math.max(t[0],e),n=Math.max(t[1],n),r=Math.min(t[0],r),i=Math.min(t[1],i)}),{x:r,y:i,width:e-r,height:n-i}}});var vi=fi;var di=Object.freeze({MorphArray:vi,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){var e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){var e=this.bbox();return null==t?e.height:this.size(e.width,t)}}),Line=function(t){function Line(t){return Ln(this,Line),Mr(this,Er(Line).call(this,qn("line",t),t))}return Pr(Line,Shape),br(Line,[{key:"array",value:function(){return new fi([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}},{key:"plot",value:function(t,e,n,r){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:n,y2:r}:new fi(t).toLine(),this.attr(t))}},{key:"move",value:function(t,e){return this.attr(this.array().move(t,e).toLine())}},{key:"size",value:function(t,e){var n=Sn(this,t,e);return this.attr(this.array().size(n.width,n.height).toLine())}}]),Line}();Wn(Line,di),cn({Container:{line:Qn(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Line.prototype.plot.apply(this.put(new Line),null!=e[0]?e:[0,0,0,0])})}}),Xn(Line);var Marker=function(t){function Marker(t){return Ln(this,Marker),Mr(this,Er(Marker).call(this,qn("marker",t),t))}return Pr(Marker,Container),br(Marker,[{key:"width",value:function(t){return this.attr("markerWidth",t)}},{key:"height",value:function(t){return this.attr("markerHeight",t)}},{key:"ref",value:function(t,e){return this.attr("refX",t).attr("refY",e)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return"url(#"+this.id()+")"}}]),Marker}();cn({Container:{marker:function(){var t;return(t=this.defs()).marker.apply(t,arguments)}},Defs:{marker:Qn(function(t,e,n){return this.put(new Marker).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(n)})},marker:{marker:function(t,e,n,r){var i=["marker"];return"all"!==t&&i.push(t),i=i.join("-"),t=e instanceof Marker?e:this.defs().marker(e,n,r),this.attr(i,t)}}}),Xn(Marker);var yi,pi,mi=[].sort,gi=[1,2,3];function wi(e,n){return function(t){return null==t?this[t]:(this[e]=t,n&&n.call(this),this)}}j(j.P+j.F*(w(function(){gi.sort(void 0)})||!w(function(){gi.sort(null)})||!((yi=mi)&&w(function(){pi?yi.call(null,function(){},1):yi.call(null)}))),"Array",{sort:function(t){return void 0===t?mi.call(K(this)):mi.call(K(this),d(t))}});var bi={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(e,n,r,i){return function(t){return t<0?0<e?n/e*t:0<r?i/r*t:0:1<t?r<1?(1-i)/(1-r)*t+(i-r)/(1-r):e<1?(1-n)/(1-e)*t+(n-e)/(1-e):1:3*t*Math.pow(1-t,2)*n+3*Math.pow(t,2)*(1-t)*i+Math.pow(t,3)}},steps:function(i){var s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"end";s=s.split("-").reverse()[0];var u=i;return"none"===s?--u:"both"===s&&++u,function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=Math.floor(t*i),r=t*n%1==0;return"start"!==s&&"both"!==s||++n,e&&r&&--n,0<=t&&n<0&&(n=0),t<=1&&u<n&&(n=u),n/u}}},_i=function(){function t(){Ln(this,t)}return br(t,[{key:"done",value:function(){return!1}}]),t}(),ki=function(t){function n(t){var e;return Ln(this,n),(e=Mr(this,Er(n).call(this))).ease=bi[t||Br.ease]||t,e}return Pr(n,_i),br(n,[{key:"step",value:function(t,e,n){return"number"!=typeof t?n<1?t:e:t+(e-t)*this.ease(n)}}]),n}(),xi=function(t){function n(t){var e;return Ln(this,n),(e=Mr(this,Er(n).call(this))).stepper=t,e}return Pr(n,_i),br(n,[{key:"step",value:function(t,e,n,r){return this.stepper(t,e,n,r)}},{key:"done",value:function(t){return t.done}}]),n}();function Oi(){var t=(this._duration||500)/1e3,e=this._overshoot||0,n=Math.PI,r=Math.log(e/100+1e-10),i=-r/Math.sqrt(n*n+r*r),s=3.9/(i*t);this.d=2*i*s,this.k=s*s}var Si=function(t){function r(t,e){var n;return Ln(this,r),(n=Mr(this,Er(r).call(this))).duration(t||500).overshoot(e||0),n}return Pr(r,xi),br(r,[{key:"step",value:function(t,e,n,r){if("string"==typeof t)return t;if(r.done=n===1/0,n===1/0)return e;if(0===n)return t;100<n&&(n=16),n/=1e3;var i=r.velocity||0,s=-this.d*i-this.k*(t-e),u=t+i*n+s*n*n/2;return r.velocity=i+s*n,r.done=Math.abs(e-u)+Math.abs(i)<.002,r.done?e:u}}]),r}();Wn(Si,{duration:wi("_duration",Oi),overshoot:wi("_overshoot",Oi)});var Ai=function(t){function s(t,e,n,r){var i;return Ln(this,s),t=null==t?.1:t,e=null==e?.01:e,n=null==n?0:n,r=null==r?1e3:r,(i=Mr(this,Er(s).call(this))).p(t).i(e).d(n).windup(r),i}return Pr(s,xi),br(s,[{key:"step",value:function(t,e,n,r){if("string"==typeof t)return t;if(r.done=n===1/0,n===1/0)return e;if(0===n)return t;var i=e-t,s=(r.integral||0)+i*n,u=(i-(r.error||0))/n,o=this.windup;return!1!==o&&(s=Math.max(-o,Math.min(s,o))),r.error=i,r.integral=s,r.done=Math.abs(i)<.001,r.done?e:t+(this.P*i+this.I*s+this.D*u)}}]),s}();Wn(Ai,{windup:wi("windup"),p:wi("P"),i:wi("I"),d:wi("D")});var ji=qr("PathArray",Qr);function Mi(t,e,n,r){return n+r.replace(cr," .")}for(var Ei={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},Ti="mlhvqtcsaz".split(""),Ci=0,Pi=Ti.length;Ci<Pi;++Ci)Ei[Ti[Ci]]=function(s){return function(t,e,n){if("H"===s)t[0]=t[0]+e.x;else if("V"===s)t[0]=t[0]+e.y;else if("A"===s)t[5]=t[5]+e.x,t[6]=t[6]+e.y;else for(var r=0,i=t.length;r<i;++r)t[r]=t[r]+(r%2?e.y:e.x);return Ei[s](t,e,n)}}(Ti[Ci].toUpperCase());Wn(ji,{toString:function(){return function(t){for(var e=0,n=t.length,r="";e<n;e++)r+=t[e][0],null!=t[e][1]&&(r+=t[e][1],null!=t[e][2]&&(r+=" ",r+=t[e][2],null!=t[e][3]&&(r+=" ",r+=t[e][3],r+=" ",r+=t[e][4],null!=t[e][5]&&(r+=" ",r+=t[e][5],r+=" ",r+=t[e][6],null!=t[e][7]&&(r+=" ",r+=t[e][7])))));return r+" "}(this)},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var r,i=this.length-1;0<=i;i--)"M"===(r=this[i][0])||"L"===r||"T"===r?(this[i][1]+=t,this[i][2]+=e):"H"===r?this[i][1]+=t:"V"===r?this[i][1]+=e:"C"===r||"S"===r||"Q"===r?(this[i][1]+=t,this[i][2]+=e,this[i][3]+=t,this[i][4]+=e,"C"===r&&(this[i][5]+=t,this[i][6]+=e)):"A"===r&&(this[i][6]+=t,this[i][7]+=e);return this},size:function(t,e){var n,r,i=this.bbox();for(n=this.length-1;0<=n;n--)"M"===(r=this[n][0])||"L"===r||"T"===r?(this[n][1]=(this[n][1]-i.x)*t/i.width+i.x,this[n][2]=(this[n][2]-i.y)*e/i.height+i.y):"H"===r?this[n][1]=(this[n][1]-i.x)*t/i.width+i.x:"V"===r?this[n][1]=(this[n][1]-i.y)*e/i.height+i.y:"C"===r||"S"===r||"Q"===r?(this[n][1]=(this[n][1]-i.x)*t/i.width+i.x,this[n][2]=(this[n][2]-i.y)*e/i.height+i.y,this[n][3]=(this[n][3]-i.x)*t/i.width+i.x,this[n][4]=(this[n][4]-i.y)*e/i.height+i.y,"C"===r&&(this[n][5]=(this[n][5]-i.x)*t/i.width+i.x,this[n][6]=(this[n][6]-i.y)*e/i.height+i.y)):"A"===r&&(this[n][1]=this[n][1]*t/i.width,this[n][2]=this[n][2]*e/i.height,this[n][6]=(this[n][6]-i.x)*t/i.width+i.x,this[n][7]=(this[n][7]-i.y)*e/i.height+i.y);return this},equalCommands:function(t){var e,n,r;for(t=new ji(t),r=this.length===t.length,e=0,n=this.length;r&&e<n;e++)r=this[e][0]===t[e][0];return r},morph:function(t){return t=new ji(t),this.equalCommands(t)?this.destination=t:this.destination=null,this},at:function(t){if(!this.destination)return this;var e,n,r,i,s=this,u=this.destination.value,o=[],a=new ji;for(e=0,n=s.length;e<n;e++){for(o[e]=[s[e][0]],r=1,i=s[e].length;r<i;r++)o[e][r]=s[e][r]+(u[e][r]-s[e][r])*t;"A"===o[e][0]&&(o[e][4]=+(0!==o[e][4]),o[e][5]=+(0!==o[e][5]))}return a.value=o,a},parse:function(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[["M",0,0]];if(e instanceof ji)return e;var n={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};e="string"==typeof e?e.replace(lr,Mi).replace(ar," $& ").replace(or,"$1 -").trim().split(ur):e.reduce(function(t,e){return[].concat.call(t,e)},[]);for(var r=[],i=new Nr,s=new Nr,u=0,o=e.length;hr.test(e[u])?(t=e[u],++u):"M"===t?t="L":"m"===t&&(t="l"),r.push(Ei[t].call(null,e.slice(u,u+=n[t.toUpperCase()]).map(parseFloat),i,s)),u<o;);return r},bbox:function(){return Lr().path.setAttribute("d",this.toString()),Lr.nodes.path.getBBox()}});var Ni=function(){function e(t){Ln(this,e),this._stepper=t||new ki("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}return br(e,[{key:"from",value:function(t){return null==t?this._from:(this._from=this._set(t),this)}},{key:"to",value:function(t){return null==t?this._to:(this._to=this._set(t),this)}},{key:"type",value:function(t){return null==t?this._type:(this._type=t,this)}},{key:"_set",value:function(t){if(!this._type){var e=Wt(t);"number"===e?this.type(Ur):"string"===e?Ar.isColor(t)?this.type(Ar):ur.test(t)?this.type(ar.test(t)?ji:Qr):Un.test(t)?this.type(Ur):this.type(Li):-1<Ri.indexOf(t.constructor)?this.type(t.constructor):Array.isArray(t)?this.type(Qr):"object"===e?this.type(Fi):this.type(Li)}var n=new this._type(t).toArray();return this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object),n}},{key:"stepper",value:function(t){return null==t?this._stepper:(this._stepper=t,this)}},{key:"done",value:function(){return this._context.map(this._stepper.done).reduce(function(t,e){return t&&e},!0)}},{key:"at",value:function(n){var r=this;return this._morphObj.fromArray(this._from.map(function(t,e){return r._stepper.step(t,r._to[e],n,r._context[e],r._context)}))}}]),e}(),Li=function(){function t(){Ln(this,t),this.init.apply(this,arguments)}return br(t,[{key:"init",value:function(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}},{key:"valueOf",value:function(){return this.value}},{key:"toArray",value:function(){return[this.value]}}]),t}(),Di=function(){function e(){Ln(this,e),this.init.apply(this,arguments)}return br(e,[{key:"init",value:function(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,e.defaults,t),this}},{key:"toArray",value:function(){var t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}]),e}();Di.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};var Fi=function(){function t(){Ln(this,t),this.init.apply(this,arguments)}return br(t,[{key:"init",value:function(t){if(this.values=[],!Array.isArray(t)){t=t||{};var e=[];for(var n in t)e.push([n,t[n]]);return e.sort(function(t,e){return t[0]-e[0]}),this.values=e.reduce(function(t,e){return t.concat(e)},[]),this}this.values=t}},{key:"valueOf",value:function(){for(var t={},e=this.values,n=0,r=e.length;n<r;n+=2)t[e[n]]=e[n+1];return t}},{key:"toArray",value:function(){return this.values}}]),t}(),Ri=[Li,Di,Fi];function zi(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];Ri.push.apply(Ri,be([].concat(t)))}function Ii(){Wn(Ri,{to:function(t){return(new Ni).type(this.constructor).from(this.valueOf()).to(t)},fromArray:function(t){return this.init(t),this}})}var Path=function(t){function Path(t){return Ln(this,Path),Mr(this,Er(Path).call(this,qn("path",t),t))}return Pr(Path,Shape),br(Path,[{key:"array",value:function(){return this._array||(this._array=new ji(this.attr("d")))}},{key:"plot",value:function(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new ji(t))}},{key:"clear",value:function(){return delete this._array,this}},{key:"move",value:function(t,e){return this.attr("d",this.array().move(t,e))}},{key:"x",value:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}},{key:"y",value:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}},{key:"size",value:function(t,e){var n=Sn(this,t,e);return this.attr("d",this.array().size(n.width,n.height))}},{key:"width",value:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}},{key:"height",value:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}},{key:"targets",value:function(){return Xr('svg textpath [href*="'+this.id()+'"]')}}]),Path}();Path.prototype.MorphArray=ji,cn({Container:{path:Qn(function(t){return this.put(new Path).plot(t||new ji)})}}),Xn(Path);var qi=Object.freeze({array:function(){return this._array||(this._array=new fi(this.attr("points")))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new fi(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){var n=Sn(this,t,e);return this.attr("points",this.array().size(n.width,n.height))}}),Polygon=function(t){function Polygon(t){return Ln(this,Polygon),Mr(this,Er(Polygon).call(this,qn("polygon",t),t))}return Pr(Polygon,Shape),Polygon}();cn({Container:{polygon:Qn(function(t){return this.put(new Polygon).plot(t||new fi)})}}),Wn(Polygon,di),Wn(Polygon,qi),Xn(Polygon);var Polyline=function(t){function Polyline(t){return Ln(this,Polyline),Mr(this,Er(Polyline).call(this,qn("polyline",t),t))}return Pr(Polyline,Shape),Polyline}();cn({Container:{polyline:Qn(function(t){return this.put(new Polyline).plot(t||new fi)})}}),Wn(Polyline,di),Wn(Polyline,qi),Xn(Polyline);var Rect=function(t){function Rect(t){return Ln(this,Rect),Mr(this,Er(Rect).call(this,qn("rect",t),t))}return Pr(Rect,Shape),Rect}();Wn(Rect,{rx:Zr,ry:ti}),cn({Container:{rect:Qn(function(t,e){return this.put(new Rect).size(t,e)})}}),Xn(Rect);var Yi=function(){function t(){Ln(this,t),this._first=null,this._last=null}return br(t,[{key:"push",value:function(t){var e=t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}},{key:"shift",value:function(){var t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}},{key:"first",value:function(){return this._first&&this._first.value}},{key:"last",value:function(){return this._last&&this._last.value}},{key:"remove",value:function(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}}]),t}(),Xi={nextDraw:null,frames:new Yi,timeouts:new Yi,timer:Nn.window.performance||Nn.window.Date,transforms:[],frame:function(t){var e=Xi.frames.push({run:t});return null===Xi.nextDraw&&(Xi.nextDraw=Nn.window.requestAnimationFrame(Xi._draw)),e},transform_frame:function(t,e){Xi.transforms[e]=t},timeout:function(t,e){e=e||0;var n=Xi.timer.now()+e,r=Xi.timeouts.push({run:t,time:n});return null===Xi.nextDraw&&(Xi.nextDraw=Nn.window.requestAnimationFrame(Xi._draw)),r},cancelFrame:function(t){null!=t&&Xi.frames.remove(t)},clearTimeout:function(t){null!=t&&Xi.timeouts.remove(t)},_draw:function(t){for(var e=null,n=Xi.timeouts.last();(e=Xi.timeouts.shift())&&(t>=e.time?e.run():Xi.timeouts.push(e),e!==n););for(var r=null,i=Xi.frames.last();r!==i&&(r=Xi.frames.shift());)r.run();Xi.transforms.forEach(function(t){t()}),Xi.nextDraw=Xi.timeouts.first()||Xi.frames.first()?Nn.window.requestAnimationFrame(Xi._draw):null}},Hi=function(t){var e=t.start,n=t.runner.duration();return{start:e,duration:n,end:e+n,runner:t.runner}},Gi=function(){var t=Nn.window;return(t.performance||t.Date).now()},Bi=function(t){function n(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Gi;return Ln(this,n),(t=Mr(this,Er(n).call(this)))._timeSource=e,t._startTime=0,t._speed=1,t._persist=0,t._nextFrame=null,t._paused=!0,t._runners=[],t._order=[],t._time=0,t._lastSourceTime=0,t._lastStepTime=0,t._step=t._step.bind(jr(jr(t))),t}return Pr(n,Hr),br(n,[{key:"schedule",value:function(t,e,n){if(null==t)return this._runners.map(Hi).sort(function(t,e){return t.runner.id-e.runner.id});var r=0,i=this.getEndTime();if(e=e||0,null==n||"last"===n||"after"===n)r=i;else if("absolute"===n||"start"===n)r=e,e=0;else if("now"===n)r=this._time;else{if("relative"!==n)throw new Error('Invalid value for the "when" parameter');var s=this._runners[t.id];s&&(r=s.start+e,e=0)}return t.unschedule(),t.timeline(this),this._runners[t.id]={persist:this.persist(),runner:t,start:r+e},this._order.push(t.id),this.updateTime()._continue(),this}},{key:"unschedule",value:function(t){var e=this._order.indexOf(t.id);return e<0||(delete this._runners[t.id],this._order.splice(e,1),t.timeline(null)),this}},{key:"getEndTime",value:function(){var t=this._runners[this._order[this._order.length-1]],e=t?t.runner.duration():0;return(t?t.start:0)+e}},{key:"updateTime",value:function(){return this.active()||(this._lastSourceTime=this._timeSource()),this}},{key:"play",value:function(){return this._paused=!1,this.updateTime()._continue()}},{key:"pause",value:function(){return this._paused=!0,this._continue()}},{key:"stop",value:function(){return this.time(0),this.pause()}},{key:"finish",value:function(){return this.time(this.getEndTime()+1),this.pause()}},{key:"speed",value:function(t){return null==t?this._speed:(this._speed=t,this)}},{key:"reverse",value:function(t){var e=this.speed();if(null==t)return this.speed(-e);var n=Math.abs(e);return this.speed(t?n:-n)}},{key:"seek",value:function(t){return this.time(this._time+t)}},{key:"time",value:function(t){return null==t?this._time:(this._time=t,this._continue(!0))}},{key:"persist",value:function(t){return null==t?this._persist:(this._persist=t,this)}},{key:"source",value:function(t){return null==t?this._timeSource:(this._timeSource=t,this)}},{key:"_step",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this._timeSource(),n=e-this._lastSourceTime;t&&(n=0);var r=this._speed*n+(this._time-this._lastStepTime);this._lastSourceTime=e,t||(this._time+=r,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(var i=!1,s=0,u=this._order.length;s<u;s++){var o=this._runners[this._order[s]],a=o.runner,h=r,l=this._time-o.start;if(l<=0)i=!0,a.reset();else if(l<h&&(h=l),a.active())if(a.step(h).done){if(!0!==o.persist){a.duration()-a.time()+this._time+this._persist<this._time&&(delete this._runners[this._order[s]],this._order.splice(s--,1)&&--u,a.timeline(null))}}else i=!0}return i&&!(this._speed<0&&0===this._time)||this._order.length&&this._speed<0&&0<this._time?this._continue():(this.fire("finished"),this.pause()),this}},{key:"_continue",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return Xi.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._step(!0):(this._paused||(this._nextFrame=Xi.frame(this._step)),this)}},{key:"active",value:function(){return!!this._nextFrame}}]),n}();cn({Element:{timeline:function(){return this._timeline=this._timeline||new Bi,this._timeline}}});var Vi=function(t){function s(t){var e;return Ln(this,s),(e=Mr(this,Er(s).call(this))).id=s.id++,t="function"==typeof(t=null==t?Br.duration:t)?new xi(t):t,e._element=null,e._timeline=null,e.done=!1,e._queue=[],e._duration="number"==typeof t&&t,e._isDeclarative=t instanceof xi,e._stepper=e._isDeclarative?t:new ki,e._history={},e.enabled=!0,e._time=0,e._lastTime=0,e._reseted=!0,e.transforms=new Ir,e.transformId=1,e._haveReversed=!1,e._reverse=!1,e._loopsDone=0,e._swing=!1,e._wait=0,e._times=1,e}return Pr(s,Hr),br(s,[{key:"element",value:function(t){return null==t?this._element:((this._element=t)._prepareRunner(),this)}},{key:"timeline",value:function(t){return void 0===t?this._timeline:(this._timeline=t,this)}},{key:"animate",value:function(t,e,n){var r=s.sanitise(t,e,n),i=new s(r.duration);return this._timeline&&i.timeline(this._timeline),this._element&&i.element(this._element),i.loop(r).schedule(e,n)}},{key:"schedule",value:function(t,e,n){if(t instanceof Bi||(n=e,e=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,e,n),this}},{key:"unschedule",value:function(){var t=this.timeline();return t&&t.unschedule(this),this}},{key:"loop",value:function(t,e,n){return"object"===Wt(t)&&(e=t.swing,n=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=n||0,this}},{key:"delay",value:function(t){return this.animate(0,t)}},{key:"queue",value:function(t,e,n,r){return this._queue.push({initialiser:t||Gr,runner:e||Gr,retarget:n,isTransform:r,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this}},{key:"during",value:function(t){return this.queue(null,t)}},{key:"after",value:function(t){return this.on("finish",t)}},{key:"time",value:function(t){if(null==t)return this._time;var e=t-this._time;return this.step(e),this}},{key:"duration",value:function(){return this._times*(this._wait+this._duration)-this._wait}},{key:"loops",value:function(t){var e=this._duration+this._wait;if(null==t){var n=Math.floor(this._time/e),r=(this._time-n*e)/this._duration;return Math.min(n+r,this._times)}var i=t%1,s=e*Math.floor(t)+this._duration*i;return this.time(s)}},{key:"position",value:function(t){var e,n=this._time,i=this._duration,s=this._wait,r=this._times,u=this._swing,o=this._reverse;if(null==t){var a=function(t){var e=u*Math.floor(t%(2*(s+i))/(s+i)),n=e&&!o||!e&&o,r=Math.pow(-1,n)*(t%(s+i))/i+n;return Math.max(Math.min(r,1),0)},h=r*(s+i)-s;return e=n<=0?Math.round(a(1e-5)):n<h?a(n):Math.round(a(h-1e-5)),e}var l=Math.floor(this.loops()),c=u&&l%2==0;return e=l+(c&&!o||o&&c?t:1-t),this.loops(e)}},{key:"progress",value:function(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}},{key:"step",value:function(t){if(!this.enabled)return this;t=null==t?16:t,this._time+=t;var e=this.position(),n=this._lastPosition!==e&&0<=this._time;this._lastPosition=e;var r=this.duration(),i=this._lastTime<=0&&0<this._time,s=this._lastTime<this._time&&this.time>r;this._lastTime=this._time,i&&this.fire("start",this);var u=this._isDeclarative;if(this.done=!u&&!s&&this._time>=r,this._reseted=!1,n||u){this._initialise(n),this.transforms=new Ir;var o=this._run(u?t:e);this.fire("step",this)}return this.done=this.done||o&&u,this.done&&this.fire("finish",this),this}},{key:"reset",value:function(){return this._reseted||(this.loops(0),this._reseted=!0),this}},{key:"finish",value:function(){return this.step(1/0)}},{key:"reverse",value:function(t){return this._reverse=null==t?!this._reverse:t,this}},{key:"ease",value:function(t){return this._stepper=new ki(t),this}},{key:"active",value:function(t){return null==t?this.enabled:(this.enabled=t,this)}},{key:"_rememberMorpher",value:function(t,e){this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]}}},{key:"_tryRetarget",value:function(t,e){if(this._history[t]){if(!this._history[t].caller.initialised){var n=this._queue.indexOf(this._history[t].caller);return this._queue.splice(n,1),!1}this._history[t].caller.retarget?this._history[t].caller.retarget(e):this._history[t].morpher.to(e),this._history[t].caller.finished=!1;var r=this.timeline();return r&&r._continue(),!0}return!1}},{key:"_initialise",value:function(t){if(t||this._isDeclarative)for(var e=0,n=this._queue.length;e<n;++e){var r=this._queue[e],i=this._isDeclarative||!r.initialised&&t;t=!r.finished,i&&t&&(r.initialiser.call(this),r.initialised=!0)}}},{key:"_run",value:function(t){for(var e=!0,n=0,r=this._queue.length;n<r;++n){var i=this._queue[n],s=i.runner.call(this,t);i.finished=i.finished||!0===s,e=e&&i.finished}return e}},{key:"addTransform",value:function(t,e){return this.transforms.lmultiplyO(t),this}},{key:"clearTransform",value:function(){return this.transforms=new Ir,this}},{key:"clearTransformsFromQueue",value:function(){this.done||(this._queue=this._queue.filter(function(t){return!t.isTransform}))}}],[{key:"sanitise",value:function(t,e,n){var r=1,i=!1,s=0;return e=e||Br.delay,n=n||"last","object"!==Wt(t=t||Br.duration)||t instanceof _i||(e=t.delay||e,n=t.when||n,i=t.swing||i,r=t.times||r,s=t.wait||s,t=t.duration||Br.duration),{duration:t,delay:e,swing:i,times:r,wait:s,when:n}}}]),s}();Vi.id=0;var Wi=function(){function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Ir,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];Ln(this,r),this.transforms=t,this.id=e,this.done=n}return br(r,[{key:"clearTransformsFromQueue",value:function(){}}]),r}();Wn([Vi,Wi],{mergeWith:function(t){return new Wi(t.transforms.lmultiply(this.transforms),t.id)}});var Qi=function(t,e){return t.lmultiplyO(e)},Ui=function(t){return t.transforms};var Ji=function(){function t(){Ln(this,t),this.runners=[],this.ids=[]}return br(t,[{key:"add",value:function(t){if(!this.runners.includes(t)){var n=t.id+1,e=this.ids.reduce(function(t,e){return t<e&&e<n?e:t},0),r=this.ids.indexOf(e)+1;return this.ids.splice(r,0,n),this.runners.splice(r,0,t),this}}},{key:"getByID",value:function(t){return this.runners[this.ids.indexOf(t+1)]}},{key:"remove",value:function(t){var e=this.ids.indexOf(t+1);return this.ids.splice(e,1),this.runners.splice(e,1),this}},{key:"merge",value:function(){var n=this,r=null;return this.runners.forEach(function(t,e){r&&t.done&&r.done&&(n.remove(t.id),n.edit(r.id,t.mergeWith(r))),r=t}),this}},{key:"edit",value:function(t,e){var n=this.ids.indexOf(t+1);return this.ids.splice(n,1,t),this.runners.splice(n,1,e),this}},{key:"length",value:function(){return this.ids.length}},{key:"clearBefore",value:function(t){var e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new Wi).forEach(function(t){return t.clearTransformsFromQueue()}),this}}]),t}(),$i=0;cn({Element:{animate:function(t,e,n){var r=Vi.sanitise(t,e,n),i=this.timeline();return new Vi(r.duration).loop(r).element(this).timeline(i.play()).schedule(e,n)},delay:function(t,e){return this.animate(0,t,e)},_clearTransformRunnersBefore:function(t){this._transformationRunners.clearBefore(t.id)},_currentTransform:function(e){return this._transformationRunners.runners.filter(function(t){return t.id<=e.id}).map(Ui).reduce(Qi,new Ir)},addRunner:function(t){this._transformationRunners.add(t),Xi.transform_frame(function(){var t=this._transformationRunners.runners.map(Ui).reduce(Qi,new Ir);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}.bind(this),this._frameId)},_prepareRunner:function(){null==this._frameId&&(this._transformationRunners=(new Ji).add(new Wi(new Ir(this))),this._frameId=$i++)}}}),Wn(Vi,{attr:function(t,e){return this.styleAttr("attr",t,e)},css:function(t,e){return this.styleAttr("css",t,e)},styleAttr:function(e,n,t){if("object"===Wt(n))for(var r in t)this.styleAttr(e,r,t[r]);var i=new Ni(this._stepper).to(t);return this.queue(function(){i=i.from(this.element()[e](n))},function(t){return this.element()[e](n,i.at(t)),i.done()}),this},zoom:function(t,e){var n=new Ni(this._stepper).to(new Ur(t));return this.queue(function(){n=n.from(this.zoom())},function(t){return this.element().zoom(n.at(t),e),n.done()}),this},transform:function(v,d,y){if(d=v.relative||d,this._isDeclarative&&!d&&this._tryRetarget("transform",v))return this;var p=Ir.isMatrixLike(v);y=null!=v.affine?v.affine:null!=y?y:!p;var m,g,w,b,_,k=new Ni(this._stepper).type(y?Di:Ir);return this.queue(function(){g=g||this.element(),m=m||An(v,g),_=new Ir(d?void 0:g),g.addRunner(this),d||g._clearTransformRunnersBefore(this)},function(t){d||this.clearTransform();var e=new Nr(m).transform(g._currentTransform(this)),n=e.x,r=e.y,i=new Ir(Kr({},v,{origin:[n,r]})),s=this._isDeclarative&&w?w:_;if(y){i=i.decompose(n,r),s=s.decompose(n,r);var u=i.rotate,o=s.rotate,a=[u-360,u,u+360],h=a.map(function(t){return Math.abs(t-o)}),l=Math.min.apply(Math,be(h)),c=h.indexOf(l);i.rotate=a[c]}d&&(p||(i.rotate=v.rotate||0),this._isDeclarative&&b&&(s.rotate=b)),k.from(s),k.to(i);var f=k.at(t);return b=f.rotate,w=new Ir(f),this.addTransform(w),k.done()},function(t){(t.origin||"center").toString()!==(v.origin||"center").toString()&&(m=An(v,g)),v=Kr({},t,{origin:m})},!0),this._isDeclarative&&this._rememberMorpher("transform",k),this},x:function(t,e){return this._queueNumber("x",t)},y:function(t){return this._queueNumber("y",t)},dx:function(t){return this._queueNumberDelta("x",t)},dy:function(t){return this._queueNumberDelta("y",t)},_queueNumberDelta:function(e,t){if(t=new Ur(t),this._tryRetarget(e,t))return this;var n=new Ni(this._stepper).to(t),r=null;return this.queue(function(){r=this.element()[e](),n.from(r),n.to(r+t)},function(t){return this.element()[e](n.at(t)),n.done()},function(t){n.to(r+new Ur(t))}),this._rememberMorpher(e,n),this},_queueObject:function(e,t){if(this._tryRetarget(e,t))return this;var n=new Ni(this._stepper).to(t);return this.queue(function(){n.from(this.element()[e]())},function(t){return this.element()[e](n.at(t)),n.done()}),this._rememberMorpher(e,n),this},_queueNumber:function(t,e){return this._queueObject(t,new Ur(e))},cx:function(t){return this._queueNumber("cx",t)},cy:function(t){return this._queueNumber("cy",t)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){var n;return t&&e||(n=this._element.bbox()),t||(t=n.width/n.height*e),e||(e=n.height/n.width*t),this.width(t).height(e)},width:function(t){return this._queueNumber("width",t)},height:function(t){return this._queueNumber("height",t)},plot:function(t,e,n,r){if(4===arguments.length)return this.plot([t,e,n,r]);var i=this._element.MorphArray().to(t);return this.queue(function(){i.from(this._element.array())},function(t){this._element.plot(i.at(t))}),this},leading:function(t){return this._queueNumber("leading",t)},viewbox:function(t,e,n,r){return this._queueObject("viewbox",new Fr(t,e,n,r))},update:function(t){return"object"!==Wt(t)?this.update({offset:t,color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),Wn(Vi,{rx:Zr,ry:ti,from:ai,to:hi});var Ki=function(t){function Svg(t){var e;return Ln(this,Svg),(e=Mr(this,Er(Svg).call(this,qn("svg",t),t))).namespace(),e}return Pr(Svg,Container),br(Svg,[{key:"isRoot",value:function(){return!(this.node.parentNode&&this.node.parentNode instanceof Nn.window.SVGElement&&"#document"!==this.node.parentNode.nodeName)}},{key:"root",value:function(){return this.isRoot()?this:Tr(Er(Svg.prototype),"root",this).call(this)}},{key:"namespace",value:function(){return this.isRoot()?this.attr({xmlns:Mn,version:"1.1"}).attr("xmlns:xlink",Tn,En).attr("xmlns:svgjs",Cn,En):this.root().namespace()}},{key:"defs",value:function(){return this.isRoot()?Yn(this.node.getElementsByTagName("defs")[0])||this.put(new Defs):this.root().defs()}},{key:"parent",value:function(t){return this.isRoot()?"#document"===this.node.parentNode.nodeName?null:Yn(this.node.parentNode):Tr(Er(Svg.prototype),"parent",this).call(this,t)}},{key:"clear",value:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}}]),Svg}();cn({Container:{nested:Qn(function(){return this.put(new Ki)})}}),Xn(Ki,"Svg",!0);var Zi=function(t){function e(t){return Ln(this,e),Mr(this,Er(e).call(this,qn("symbol",t),t))}return Pr(e,Container),e}();cn({Container:{symbol:Qn(function(){return this.put(new Zi)})}}),Xn(Zi);var ts=Object.freeze({plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(Nn.document.createTextNode(t)),this},length:function(){return this.node.getComputedTextLength()}}),Text=function(t){function Text(t){var e;return Ln(this,Text),(e=Mr(this,Er(Text).call(this,qn("text",t),t))).dom.leading=new Ur(1.3),e._rebuild=!0,e._build=!1,e.attr("font-family",Vr["font-family"]),e}return Pr(Text,Shape),br(Text,[{key:"x",value:function(t){return null==t?this.attr("x"):this.attr("x",t)}},{key:"y",value:function(t){var e=this.attr("y"),n="number"==typeof e?e-this.bbox().y:0;return null==t?"number"==typeof e?e-n:e:this.attr("y","number"==typeof t?t+n:t)}},{key:"cx",value:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)}},{key:"cy",value:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)}},{key:"text",value:function(t){if(void 0===t){var e=this.node.childNodes,n=0;t="";for(var r=0,i=e.length;r<i;++r)"textPath"!==e[r].nodeName?(r!==n&&3!==e[r].nodeType&&!0===Yn(e[r]).dom.newLined&&(t+="\n"),t+=e[r].textContent):0===r&&(n=1);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(var s=0,u=(t=t.split("\n")).length;s<u;s++)this.tspan(t[s]).newLine();return this.build(!1).rebuild()}},{key:"leading",value:function(t){return null==t?this.dom.leading:(this.dom.leading=new Ur(t),this.rebuild())}},{key:"rebuild",value:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var n=this,r=0,i=this.dom.leading;this.each(function(){var t=Nn.window.getComputedStyle(this.node).getPropertyValue("font-size"),e=i*new Ur(t);this.dom.newLined&&(this.attr("x",n.attr("x")),"\n"===this.text()?r+=e:(this.attr("dy",e+r),r=0))}),this.fire("rebuild")}return this}},{key:"build",value:function(t){return this._build=!!t,this}},{key:"setData",value:function(t){return this.dom=t,this.dom.leading=new Ur(t.leading||1.3),this}}]),Text}();Wn(Text,ts),cn({Container:{text:Qn(function(t){return this.put(new Text).text(t)}),plain:Qn(function(t){return this.put(new Text).plain(t)})}}),Xn(Text);var Tspan=function(t){function Tspan(t){return Ln(this,Tspan),Mr(this,Er(Tspan).call(this,qn("tspan",t),t))}return Pr(Tspan,Text),br(Tspan,[{key:"text",value:function(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?t.call(this,this):this.plain(t),this)}},{key:"dx",value:function(t){return this.attr("dx",t)}},{key:"dy",value:function(t){return this.attr("dy",t)}},{key:"newLine",value:function(){var t=this.parent(Text);return this.dom.newLined=!0,this.dy(t.dom.leading*t.attr("font-size")).attr("x",t.x())}}]),Tspan}();Wn(Tspan,ts),cn({Tspan:{tspan:Qn(function(t){var e=new Tspan;return this._build||this.clear(),this.node.appendChild(e.node),e.text(t)})}}),Xn(Tspan);var ClipPath=function(t){function ClipPath(t){return Ln(this,ClipPath),Mr(this,Er(ClipPath).call(this,qn("clipPath",t),t))}return Pr(ClipPath,Container),br(ClipPath,[{key:"remove",value:function(){return this.targets().forEach(function(t){t.unclip()}),Tr(Er(ClipPath.prototype),"remove",this).call(this)}},{key:"targets",value:function(){return Xr('svg [clip-path*="'+this.id()+'"]')}}]),ClipPath}();cn({Container:{clip:Qn(function(){return this.defs().put(new ClipPath)})},Element:{clipWith:function(t){var e=t instanceof ClipPath?t:this.parent().clip().add(t);return this.attr("clip-path",'url("#'+e.id()+'")')},unclip:function(){return this.attr("clip-path",null)},clipper:function(){return this.reference("clip-path")}}}),Xn(ClipPath);var G=function(t){function G(t){return Ln(this,G),Mr(this,Er(G).call(this,qn("g",t),t))}return Pr(G,Container),G}();cn({Element:{group:Qn(function(){return this.put(new G)})}}),Xn(G);var A=function(t){function A(t){return Ln(this,A),Mr(this,Er(A).call(this,qn("a",t),t))}return Pr(A,Container),br(A,[{key:"to",value:function(t){return this.attr("href",t,Tn)}},{key:"target",value:function(t){return this.attr("target",t)}}]),A}();cn({Container:{link:Qn(function(t){return this.put(new A).to(t)})},Element:{linkTo:function(t){var e=new A;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}}),Xn(A);var Mask=function(t){function Mask(t){return Ln(this,Mask),Mr(this,Er(Mask).call(this,qn("mask",t),t))}return Pr(Mask,Container),br(Mask,[{key:"remove",value:function(){return this.targets().forEach(function(t){t.unmask()}),Tr(Er(Mask.prototype),"remove",this).call(this)}},{key:"targets",value:function(){return Xr('svg [mask*="'+this.id()+'"]')}}]),Mask}();cn({Container:{mask:Qn(function(){return this.defs().put(new Mask)})},Element:{maskWith:function(t){var e=t instanceof Mask?t:this.parent().mask().add(t);return this.attr("mask",'url("#'+e.id()+'")')},unmask:function(){return this.attr("mask",null)},masker:function(){return this.reference("mask")}}}),Xn(Mask);var Style=function(t){function Style(t){return Ln(this,Style),Mr(this,Er(Style).call(this,qn("style",t),t))}return Pr(Style,Element),br(Style,[{key:"addText",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return this.node.textContent+=t,this}},{key:"font",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return this.rule("@font-face",Kr({fontFamily:t,src:e},n))}},{key:"rule",value:function(t,e){return this.addText(function(t,e){if(!t)return"";if(!e)return t;var n=t+"{";for(var r in e)n+=xn(r)+":"+e[r]+";";return n+="}"}(t,e))}}]),Style}();cn("Dom",{style:Qn(function(t,e){return this.put(new Style).rule(t,e)}),fontface:Qn(function(t,e,n){return this.put(new Style).font(t,e,n)})}),Xn(Style);var es,ns,rs,is,ss,us,os,as,hs,ls=et("species"),cs=(rs=1==(es=5),is=2==es,ss=3==es,us=4==es,os=6==es,as=5==es||os,hs=ns||function(t,e){return Oe(n=t)&&("function"!=typeof(r=n.constructor)||r!==Array&&!Oe(r.prototype)||(r=void 0),g(r)&&null===(r=r[ls])&&(r=void 0)),new(void 0===r?Array:r)(e);var n,r},function(t,e,n){for(var r,i,s=K(t),u=T(s),o=b(e,n,3),a=R(u.length),h=0,l=rs?hs(t,a):is?hs(t,0):void 0;h<a;h++)if((as||h in u)&&(i=o(r=u[h],h,s),es))if(rs)l[h]=i;else if(i)switch(es){case 3:return!0;case 5:return r;case 6:return h;case 2:l.push(r)}else if(us)return!1;return os?-1:ss||us?us:l}),fs="find",vs=!0;fs in[]&&Array(1)[fs](function(){vs=!1}),j(j.P+j.F*vs,"Array",{find:function(t){return cs(this,t,1<arguments.length?arguments[1]:void 0)}}),it(fs);var TextPath=function(t){function TextPath(t){return Ln(this,TextPath),Mr(this,Er(TextPath).call(this,qn("textPath",t),t))}return Pr(TextPath,Text),br(TextPath,[{key:"array",value:function(){var t=this.track();return t?t.array():null}},{key:"plot",value:function(t){var e=this.track(),n=null;return e&&(n=e.plot(t)),null==t?n:this}},{key:"track",value:function(){return this.reference("href")}}]),TextPath}();cn({Container:{textPath:Qn(function(t,e){return this.defs().path(e).text(t).addTo(this)})},Text:{path:Qn(function(t){var e=new TextPath;return t instanceof Path||(t=this.root().defs().path(t)),e.attr("href","#"+t,Tn),this.put(e)}),textPath:function(){return this.find("textPath")[0]}},Path:{text:Qn(function(t){if(t instanceof Text){var e=t.text();return t.clear().path(this).text(e)}return this.parent().put(new Text).path(this).text(t)}),targets:function(){return Xr('svg [href*="'+this.id()+'"]')}}}),TextPath.prototype.MorphArray=ji,Xn(TextPath);var Use=function(t){function Use(t){return Ln(this,Use),Mr(this,Er(Use).call(this,qn("use",t),t))}return Pr(Use,Shape),br(Use,[{key:"element",value:function(t,e){return this.attr("href",(e||"")+"#"+t,Tn)}}]),Use}();cn({Container:{use:Qn(function(t,e){return this.put(new Use).element(t,e)})}}),Xn(Use);var ds=In;Wn([Ki,Zi,Image,Pattern,Marker],fn("viewbox")),Wn([Line,Polyline,Polygon,Path],fn("marker")),Wn(Text,fn("Text")),Wn(Path,fn("Path")),Wn(Defs,fn("Defs")),Wn([Text,Tspan],fn("Tspan")),Wn([Rect,Ellipse,Circle,Gradient],fn("radius")),Wn(Hr,fn("EventTarget")),Wn(Dom,fn("Dom")),Wn(Element,fn("Element")),Wn(Shape,fn("Shape")),Wn(Container,fn("Container")),Wn(Vi,fn("Runner")),Yr.extend(be(new Set(ln))),zi([Ur,Ar,Fr,Ir,Qr,fi,ji]),Ii();var ys=Object.freeze({Morphable:Ni,registerMorphableType:zi,makeMorphable:Ii,TransformBag:Di,ObjectBag:Fi,NonMorphable:Li,defaults:Wr,utils:jn,namespaces:Pn,regex:fr,SVG:ds,parser:Lr,find:Xr,registerWindow:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;Nn.window=t,Nn.document=e},Animator:Xi,Controller:xi,Ease:ki,PID:Ai,Spring:Si,easing:bi,Queue:Yi,Runner:Vi,Timeline:Bi,Array:Qr,Box:Fr,Color:Ar,EventTarget:Hr,Matrix:Ir,Number:Ur,PathArray:ji,Point:Nr,PointArray:fi,List:Yr,Circle:Circle,ClipPath:ClipPath,Container:Container,Defs:Defs,Dom:Dom,Element:Element,Ellipse:Ellipse,Gradient:Gradient,G:G,A:A,Image:Image,Line:Line,Marker:Marker,Mask:Mask,Path:Path,Pattern:Pattern,Polygon:Polygon,Polyline:Polyline,Rect:Rect,Shape:Shape,Stop:Stop,Style:Style,Svg:Ki,Symbol:Zi,Text:Text,TextPath:TextPath,Tspan:Tspan,Use:Use,on:pr,off:mr,dispatch:gr,root:Rn,makeNode:zn,makeInstance:In,nodeOrNew:qn,adopt:Yn,register:Xn,getClass:Hn,eid:Bn,assignNewId:Vn,extend:Wn,extendWithAttrCheck:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];Wn.apply(void 0,e.concat([!0]))},wrapWithAttrCheck:Qn});function ps(t){return In(t)}return Object.assign(ps,ys),ps}(); +//# sourceMappingURL=svg.min.js.map diff --git a/dist/svg.min.js.map b/dist/svg.min.js.map new file mode 100644 index 0000000..b16573b --- /dev/null +++ b/dist/svg.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.min.js","sources":["../node_modules/core-js/modules/_global.js","../node_modules/core-js/modules/_core.js","../node_modules/core-js/modules/_is-object.js","../node_modules/core-js/modules/_an-object.js","../node_modules/core-js/modules/_fails.js","../node_modules/core-js/modules/_descriptors.js","../node_modules/core-js/modules/_dom-create.js","../node_modules/core-js/modules/_ie8-dom-define.js","../node_modules/core-js/modules/_to-primitive.js","../node_modules/core-js/modules/_object-dp.js","../node_modules/core-js/modules/_property-desc.js","../node_modules/core-js/modules/_hide.js","../node_modules/core-js/modules/_has.js","../node_modules/core-js/modules/_uid.js","../node_modules/core-js/modules/_redefine.js","../node_modules/core-js/modules/_a-function.js","../node_modules/core-js/modules/_ctx.js","../node_modules/core-js/modules/_export.js","../node_modules/core-js/modules/_cof.js","../node_modules/core-js/modules/_iobject.js","../node_modules/core-js/modules/_defined.js","../node_modules/core-js/modules/_to-iobject.js","../node_modules/core-js/modules/_to-integer.js","../node_modules/core-js/modules/_to-length.js","../node_modules/core-js/modules/_to-absolute-index.js","../node_modules/core-js/modules/_array-includes.js","../node_modules/core-js/modules/_shared.js","../node_modules/core-js/modules/_shared-key.js","../node_modules/core-js/modules/_object-keys-internal.js","../node_modules/core-js/modules/_enum-bug-keys.js","../node_modules/core-js/modules/_object-keys.js","../node_modules/core-js/modules/_object-gops.js","../node_modules/core-js/modules/_object-pie.js","../node_modules/core-js/modules/_to-object.js","../node_modules/core-js/modules/_object-assign.js","../node_modules/core-js/modules/es6.object.assign.js","../node_modules/core-js/modules/_wks.js","../node_modules/core-js/modules/_add-to-unscopables.js","../node_modules/core-js/modules/_iter-step.js","../node_modules/core-js/modules/_iterators.js","../node_modules/core-js/modules/_object-dps.js","../node_modules/core-js/modules/_html.js","../node_modules/core-js/modules/_object-create.js","../node_modules/core-js/modules/_set-to-string-tag.js","../node_modules/core-js/modules/_iter-create.js","../node_modules/core-js/modules/_object-gpo.js","../node_modules/core-js/modules/_iter-define.js","../node_modules/core-js/modules/es6.array.iterator.js","../node_modules/core-js/modules/web.dom.iterable.js","../node_modules/core-js/modules/_object-sap.js","../node_modules/core-js/modules/es6.object.keys.js","../node_modules/core-js/modules/es6.function.name.js","../node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/core-js/modules/_string-at.js","../node_modules/core-js/modules/es6.string.iterator.js","../node_modules/core-js/modules/_redefine-all.js","../node_modules/core-js/modules/_an-instance.js","../node_modules/core-js/modules/_iter-call.js","../node_modules/core-js/modules/_is-array-iter.js","../node_modules/core-js/modules/_classof.js","../node_modules/core-js/modules/core.get-iterator-method.js","../node_modules/core-js/modules/_for-of.js","../node_modules/core-js/modules/_set-species.js","../node_modules/core-js/modules/_meta.js","../node_modules/core-js/modules/_validate-collection.js","../node_modules/core-js/modules/_collection-strong.js","../node_modules/core-js/modules/_iter-detect.js","../node_modules/core-js/modules/_object-gopd.js","../node_modules/core-js/modules/_set-proto.js","../node_modules/core-js/modules/_inherit-if-required.js","../node_modules/core-js/modules/_collection.js","../node_modules/core-js/modules/es6.set.js","../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","../node_modules/@babel/runtime/helpers/esm/iterableToArray.js","../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","../node_modules/core-js/modules/_wks-ext.js","../node_modules/core-js/modules/_wks-define.js","../node_modules/core-js/modules/es7.symbol.async-iterator.js","../node_modules/core-js/modules/_enum-keys.js","../node_modules/core-js/modules/_is-array.js","../node_modules/core-js/modules/_object-gopn.js","../node_modules/core-js/modules/_object-gopn-ext.js","../node_modules/core-js/modules/es6.symbol.js","../src/utils/methods.js","../node_modules/core-js/modules/es7.array.includes.js","../node_modules/core-js/modules/_is-regexp.js","../node_modules/core-js/modules/_fails-is-regexp.js","../node_modules/core-js/modules/es6.string.includes.js","../node_modules/core-js/modules/_string-context.js","../node_modules/core-js/modules/_fix-re-wks.js","../src/utils/utils.js","../node_modules/core-js/modules/es6.regexp.replace.js","../src/modules/core/namespaces.js","../src/utils/window.js","../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../src/types/Base.js","../src/utils/adopter.js","../src/modules/optional/arrange.js","../node_modules/core-js/modules/es6.regexp.split.js","../src/modules/core/regex.js","../src/modules/optional/class.js","../src/modules/optional/css.js","../src/modules/optional/data.js","../src/modules/optional/memory.js","../src/modules/core/event.js","../node_modules/@babel/runtime/helpers/esm/createClass.js","../node_modules/core-js/modules/_flags.js","../node_modules/core-js/modules/es6.regexp.flags.js","../node_modules/core-js/modules/es6.regexp.to-string.js","../src/types/Color.js","../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../node_modules/@babel/runtime/helpers/esm/get.js","../node_modules/@babel/runtime/helpers/esm/superPropBase.js","../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/esm/inherits.js","../node_modules/core-js/modules/es6.regexp.match.js","../src/types/Point.js","../src/modules/core/parser.js","../src/types/Box.js","../src/types/Matrix.js","../src/types/ArrayPolyfill.js","../src/types/List.js","../src/modules/core/selector.js","../src/types/EventTarget.js","../src/modules/core/defaults.js","../src/types/SVGArray.js","../src/types/SVGNumber.js","../src/modules/core/attr.js","../src/elements/Dom.js","../src/elements/Element.js","../src/modules/optional/sugar.js","../node_modules/@babel/runtime/helpers/esm/objectSpread.js","../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../src/modules/core/circled.js","../src/modules/optional/transform.js","../src/elements/Shape.js","../src/elements/Circle.js","../src/elements/Container.js","../src/elements/Defs.js","../src/elements/Ellipse.js","../src/elements/Stop.js","../src/modules/core/gradiented.js","../src/elements/Gradient.js","../src/elements/Pattern.js","../src/elements/Image.js","../src/types/PointArray.js","../src/modules/core/pointed.js","../src/elements/Line.js","../src/elements/Marker.js","../node_modules/core-js/modules/_strict-method.js","../node_modules/core-js/modules/es6.array.sort.js","../src/animation/Controller.js","../src/types/PathArray.js","../src/animation/Morphable.js","../src/elements/Path.js","../src/modules/core/poly.js","../src/elements/Polygon.js","../src/elements/Polyline.js","../src/elements/Rect.js","../src/animation/Queue.js","../src/animation/Animator.js","../src/animation/Timeline.js","../src/animation/Runner.js","../src/elements/Svg.js","../src/elements/Symbol.js","../src/modules/core/textable.js","../src/elements/Text.js","../src/elements/Tspan.js","../src/elements/ClipPath.js","../src/elements/G.js","../src/elements/A.js","../src/elements/Mask.js","../src/elements/Style.js","../node_modules/core-js/modules/_array-species-constructor.js","../node_modules/core-js/modules/_array-methods.js","../node_modules/core-js/modules/es6.array.find.js","../node_modules/core-js/modules/_array-species-create.js","../src/elements/TextPath.js","../src/elements/Use.js","../src/main.js","../src/svg.js"],"sourcesContent":["// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n","var core = module.exports = { version: '2.5.7' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar TO_STRING = 'toString';\nvar $toString = Function[TO_STRING];\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject');\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2018 Denis Pushkarev (zloirock.ru)'\n});\n","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n","exports.f = Object.getOwnPropertySymbols;\n","exports.f = {}.propertyIsEnumerable;\n","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","'use strict';\n// 19.1.2.1 Object.assign(target, source, ...)\nvar getKeys = require('./_object-keys');\nvar gOPS = require('./_object-gops');\nvar pIE = require('./_object-pie');\nvar toObject = require('./_to-object');\nvar IObject = require('./_iobject');\nvar $assign = Object.assign;\n\n// should work with symbols and should have deterministic property order (V8 bug)\nmodule.exports = !$assign || require('./_fails')(function () {\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var S = Symbol();\n var K = 'abcdefghijklmnopqrst';\n A[S] = 7;\n K.split('').forEach(function (k) { B[k] = k; });\n return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var aLen = arguments.length;\n var index = 1;\n var getSymbols = gOPS.f;\n var isEnum = pIE.f;\n while (aLen > index) {\n var S = IObject(arguments[index++]);\n var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];\n } return T;\n} : $assign;\n","// 19.1.3.1 Object.assign(target, source)\nvar $export = require('./_export');\n\n$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') });\n","var store = require('./_shared')('wks');\nvar uid = require('./_uid');\nvar Symbol = require('./_global').Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n","// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = require('./_wks')('unscopables');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n ArrayProto[UNSCOPABLES][key] = true;\n};\n","module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n","module.exports = {};\n","var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n","var document = require('./_global').document;\nmodule.exports = document && document.documentElement;\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","'use strict';\nvar create = require('./_object-create');\nvar descriptor = require('./_property-desc');\nvar setToStringTag = require('./_set-to-string-tag');\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has');\nvar toObject = require('./_to-object');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables');\nvar step = require('./_iter-step');\nvar Iterators = require('./_iterators');\nvar toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var kind = this._k;\n var index = this._i++;\n if (!O || index >= O.length) {\n this._t = undefined;\n return step(1);\n }\n if (kind == 'keys') return step(0, index);\n if (kind == 'values') return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n","var $iterators = require('./es6.array.iterator');\nvar getKeys = require('./_object-keys');\nvar redefine = require('./_redefine');\nvar global = require('./_global');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar wks = require('./_wks');\nvar ITERATOR = wks('iterator');\nvar TO_STRING_TAG = wks('toStringTag');\nvar ArrayValues = Iterators.Array;\n\nvar DOMIterables = {\n CSSRuleList: true, // TODO: Not spec compliant, should be false.\n CSSStyleDeclaration: false,\n CSSValueList: false,\n ClientRectList: false,\n DOMRectList: false,\n DOMStringList: false,\n DOMTokenList: true,\n DataTransferItemList: false,\n FileList: false,\n HTMLAllCollection: false,\n HTMLCollection: false,\n HTMLFormElement: false,\n HTMLSelectElement: false,\n MediaList: true, // TODO: Not spec compliant, should be false.\n MimeTypeArray: false,\n NamedNodeMap: false,\n NodeList: true,\n PaintRequestList: false,\n Plugin: false,\n PluginArray: false,\n SVGLengthList: false,\n SVGNumberList: false,\n SVGPathSegList: false,\n SVGPointList: false,\n SVGStringList: false,\n SVGTransformList: false,\n SourceBufferList: false,\n StyleSheetList: true, // TODO: Not spec compliant, should be false.\n TextTrackCueList: false,\n TextTrackList: false,\n TouchList: false\n};\n\nfor (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {\n var NAME = collections[i];\n var explicit = DOMIterables[NAME];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n var key;\n if (proto) {\n if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);\n if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = ArrayValues;\n if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);\n }\n}\n","// most Object methods by ES6 should accept primitives\nvar $export = require('./_export');\nvar core = require('./_core');\nvar fails = require('./_fails');\nmodule.exports = function (KEY, exec) {\n var fn = (core.Object || {})[KEY] || Object[KEY];\n var exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);\n};\n","// 19.1.2.14 Object.keys(O)\nvar toObject = require('./_to-object');\nvar $keys = require('./_object-keys');\n\nrequire('./_object-sap')('keys', function () {\n return function keys(it) {\n return $keys(toObject(it));\n };\n});\n","var dP = require('./_object-dp').f;\nvar FProto = Function.prototype;\nvar nameRE = /^\\s*function ([^ (]*)/;\nvar NAME = 'name';\n\n// 19.2.4.2 name\nNAME in FProto || require('./_descriptors') && dP(FProto, NAME, {\n configurable: true,\n get: function () {\n try {\n return ('' + this).match(nameRE)[1];\n } catch (e) {\n return '';\n }\n }\n});\n","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nexport default function _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}","var toInteger = require('./_to-integer');\nvar defined = require('./_defined');\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function (TO_STRING) {\n return function (that, pos) {\n var s = String(defined(that));\n var i = toInteger(pos);\n var l = s.length;\n var a, b;\n if (i < 0 || i >= l) return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function (iterated) {\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var index = this._i;\n var point;\n if (index >= O.length) return { value: undefined, done: true };\n point = $at(O, index);\n this._i += point.length;\n return { value: point, done: false };\n});\n","var redefine = require('./_redefine');\nmodule.exports = function (target, src, safe) {\n for (var key in src) redefine(target, key, src[key], safe);\n return target;\n};\n","module.exports = function (it, Constructor, name, forbiddenField) {\n if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {\n throw TypeError(name + ': incorrect invocation!');\n } return it;\n};\n","// call something on iterator step with safe closing on error\nvar anObject = require('./_an-object');\nmodule.exports = function (iterator, fn, value, entries) {\n try {\n return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (e) {\n var ret = iterator['return'];\n if (ret !== undefined) anObject(ret.call(iterator));\n throw e;\n }\n};\n","// check on default Array iterator\nvar Iterators = require('./_iterators');\nvar ITERATOR = require('./_wks')('iterator');\nvar ArrayProto = Array.prototype;\n\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","var ctx = require('./_ctx');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar anObject = require('./_an-object');\nvar toLength = require('./_to-length');\nvar getIterFn = require('./core.get-iterator-method');\nvar BREAK = {};\nvar RETURN = {};\nvar exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {\n var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);\n var f = ctx(fn, that, entries ? 2 : 1);\n var index = 0;\n var length, step, iterator, result;\n if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');\n // fast case for arrays with default iterator\n if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {\n result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);\n if (result === BREAK || result === RETURN) return result;\n } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {\n result = call(iterator, f, step.value, entries);\n if (result === BREAK || result === RETURN) return result;\n }\n};\nexports.BREAK = BREAK;\nexports.RETURN = RETURN;\n","'use strict';\nvar global = require('./_global');\nvar dP = require('./_object-dp');\nvar DESCRIPTORS = require('./_descriptors');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (KEY) {\n var C = global[KEY];\n if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n};\n","var META = require('./_uid')('meta');\nvar isObject = require('./_is-object');\nvar has = require('./_has');\nvar setDesc = require('./_object-dp').f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !require('./_fails')(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it, TYPE) {\n if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');\n return it;\n};\n","'use strict';\nvar dP = require('./_object-dp').f;\nvar create = require('./_object-create');\nvar redefineAll = require('./_redefine-all');\nvar ctx = require('./_ctx');\nvar anInstance = require('./_an-instance');\nvar forOf = require('./_for-of');\nvar $iterDefine = require('./_iter-define');\nvar step = require('./_iter-step');\nvar setSpecies = require('./_set-species');\nvar DESCRIPTORS = require('./_descriptors');\nvar fastKey = require('./_meta').fastKey;\nvar validate = require('./_validate-collection');\nvar SIZE = DESCRIPTORS ? '_s' : 'size';\n\nvar getEntry = function (that, key) {\n // fast case\n var index = fastKey(key);\n var entry;\n if (index !== 'F') return that._i[index];\n // frozen object case\n for (entry = that._f; entry; entry = entry.n) {\n if (entry.k == key) return entry;\n }\n};\n\nmodule.exports = {\n getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {\n var C = wrapper(function (that, iterable) {\n anInstance(that, C, NAME, '_i');\n that._t = NAME; // collection type\n that._i = create(null); // index\n that._f = undefined; // first entry\n that._l = undefined; // last entry\n that[SIZE] = 0; // size\n if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);\n });\n redefineAll(C.prototype, {\n // 23.1.3.1 Map.prototype.clear()\n // 23.2.3.2 Set.prototype.clear()\n clear: function clear() {\n for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {\n entry.r = true;\n if (entry.p) entry.p = entry.p.n = undefined;\n delete data[entry.i];\n }\n that._f = that._l = undefined;\n that[SIZE] = 0;\n },\n // 23.1.3.3 Map.prototype.delete(key)\n // 23.2.3.4 Set.prototype.delete(value)\n 'delete': function (key) {\n var that = validate(this, NAME);\n var entry = getEntry(that, key);\n if (entry) {\n var next = entry.n;\n var prev = entry.p;\n delete that._i[entry.i];\n entry.r = true;\n if (prev) prev.n = next;\n if (next) next.p = prev;\n if (that._f == entry) that._f = next;\n if (that._l == entry) that._l = prev;\n that[SIZE]--;\n } return !!entry;\n },\n // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)\n // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)\n forEach: function forEach(callbackfn /* , that = undefined */) {\n validate(this, NAME);\n var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);\n var entry;\n while (entry = entry ? entry.n : this._f) {\n f(entry.v, entry.k, this);\n // revert to the last existing entry\n while (entry && entry.r) entry = entry.p;\n }\n },\n // 23.1.3.7 Map.prototype.has(key)\n // 23.2.3.7 Set.prototype.has(value)\n has: function has(key) {\n return !!getEntry(validate(this, NAME), key);\n }\n });\n if (DESCRIPTORS) dP(C.prototype, 'size', {\n get: function () {\n return validate(this, NAME)[SIZE];\n }\n });\n return C;\n },\n def: function (that, key, value) {\n var entry = getEntry(that, key);\n var prev, index;\n // change existing entry\n if (entry) {\n entry.v = value;\n // create new entry\n } else {\n that._l = entry = {\n i: index = fastKey(key, true), // <- index\n k: key, // <- key\n v: value, // <- value\n p: prev = that._l, // <- previous entry\n n: undefined, // <- next entry\n r: false // <- removed\n };\n if (!that._f) that._f = entry;\n if (prev) prev.n = entry;\n that[SIZE]++;\n // add to index\n if (index !== 'F') that._i[index] = entry;\n } return that;\n },\n getEntry: getEntry,\n setStrong: function (C, NAME, IS_MAP) {\n // add .keys, .values, .entries, [@@iterator]\n // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11\n $iterDefine(C, NAME, function (iterated, kind) {\n this._t = validate(iterated, NAME); // target\n this._k = kind; // kind\n this._l = undefined; // previous\n }, function () {\n var that = this;\n var kind = that._k;\n var entry = that._l;\n // revert to the last existing entry\n while (entry && entry.r) entry = entry.p;\n // get next entry\n if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {\n // or finish the iteration\n that._t = undefined;\n return step(1);\n }\n // return step by kind\n if (kind == 'keys') return step(0, entry.k);\n if (kind == 'values') return step(0, entry.v);\n return step(0, [entry.k, entry.v]);\n }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);\n\n // add [@@species], 23.1.2.2, 23.2.2.2\n setSpecies(NAME);\n }\n};\n","var ITERATOR = require('./_wks')('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var riter = [7][ITERATOR]();\n riter['return'] = function () { SAFE_CLOSING = true; };\n // eslint-disable-next-line no-throw-literal\n Array.from(riter, function () { throw 2; });\n} catch (e) { /* empty */ }\n\nmodule.exports = function (exec, skipClosing) {\n if (!skipClosing && !SAFE_CLOSING) return false;\n var safe = false;\n try {\n var arr = [7];\n var iter = arr[ITERATOR]();\n iter.next = function () { return { done: safe = true }; };\n arr[ITERATOR] = function () { return iter; };\n exec(arr);\n } catch (e) { /* empty */ }\n return safe;\n};\n","var pIE = require('./_object-pie');\nvar createDesc = require('./_property-desc');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar has = require('./_has');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n","// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = require('./_is-object');\nvar anObject = require('./_an-object');\nvar check = function (O, proto) {\n anObject(O);\n if (!isObject(proto) && proto !== null) throw TypeError(proto + \": can't set as prototype!\");\n};\nmodule.exports = {\n set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line\n function (test, buggy, set) {\n try {\n set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);\n set(test, []);\n buggy = !(test instanceof Array);\n } catch (e) { buggy = true; }\n return function setPrototypeOf(O, proto) {\n check(O, proto);\n if (buggy) O.__proto__ = proto;\n else set(O, proto);\n return O;\n };\n }({}, false) : undefined),\n check: check\n};\n","var isObject = require('./_is-object');\nvar setPrototypeOf = require('./_set-proto').set;\nmodule.exports = function (that, target, C) {\n var S = target.constructor;\n var P;\n if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {\n setPrototypeOf(that, P);\n } return that;\n};\n","'use strict';\nvar global = require('./_global');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar redefineAll = require('./_redefine-all');\nvar meta = require('./_meta');\nvar forOf = require('./_for-of');\nvar anInstance = require('./_an-instance');\nvar isObject = require('./_is-object');\nvar fails = require('./_fails');\nvar $iterDetect = require('./_iter-detect');\nvar setToStringTag = require('./_set-to-string-tag');\nvar inheritIfRequired = require('./_inherit-if-required');\n\nmodule.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {\n var Base = global[NAME];\n var C = Base;\n var ADDER = IS_MAP ? 'set' : 'add';\n var proto = C && C.prototype;\n var O = {};\n var fixMethod = function (KEY) {\n var fn = proto[KEY];\n redefine(proto, KEY,\n KEY == 'delete' ? function (a) {\n return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);\n } : KEY == 'has' ? function has(a) {\n return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);\n } : KEY == 'get' ? function get(a) {\n return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);\n } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; }\n : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; }\n );\n };\n if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {\n new C().entries().next();\n }))) {\n // create collection constructor\n C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);\n redefineAll(C.prototype, methods);\n meta.NEED = true;\n } else {\n var instance = new C();\n // early implementations not supports chaining\n var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;\n // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false\n var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });\n // most early implementations doesn't supports iterables, most modern - not close it correctly\n var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new\n // for early implementations -0 and +0 not the same\n var BUGGY_ZERO = !IS_WEAK && fails(function () {\n // V8 ~ Chromium 42- fails only with 5+ elements\n var $instance = new C();\n var index = 5;\n while (index--) $instance[ADDER](index, index);\n return !$instance.has(-0);\n });\n if (!ACCEPT_ITERABLES) {\n C = wrapper(function (target, iterable) {\n anInstance(target, C, NAME);\n var that = inheritIfRequired(new Base(), target, C);\n if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);\n return that;\n });\n C.prototype = proto;\n proto.constructor = C;\n }\n if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {\n fixMethod('delete');\n fixMethod('has');\n IS_MAP && fixMethod('get');\n }\n if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);\n // weak collections should not contains .clear method\n if (IS_WEAK && proto.clear) delete proto.clear;\n }\n\n setToStringTag(C, NAME);\n\n O[NAME] = C;\n $export($export.G + $export.W + $export.F * (C != Base), O);\n\n if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);\n\n return C;\n};\n","'use strict';\nvar strong = require('./_collection-strong');\nvar validate = require('./_validate-collection');\nvar SET = 'Set';\n\n// 23.2 Set Objects\nmodule.exports = require('./_collection')(SET, function (get) {\n return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };\n}, {\n // 23.2.3.1 Set.prototype.add(value)\n add: function add(value) {\n return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value);\n }\n}, strong);\n","import arrayWithoutHoles from \"./arrayWithoutHoles\";\nimport iterableToArray from \"./iterableToArray\";\nimport nonIterableSpread from \"./nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();\n}","export default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n}","export default function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}","exports.f = require('./_wks');\n","var global = require('./_global');\nvar core = require('./_core');\nvar LIBRARY = require('./_library');\nvar wksExt = require('./_wks-ext');\nvar defineProperty = require('./_object-dp').f;\nmodule.exports = function (name) {\n var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});\n if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });\n};\n","require('./_wks-define')('asyncIterator');\n","// all enumerable object keys, includes symbols\nvar getKeys = require('./_object-keys');\nvar gOPS = require('./_object-gops');\nvar pIE = require('./_object-pie');\nmodule.exports = function (it) {\n var result = getKeys(it);\n var getSymbols = gOPS.f;\n if (getSymbols) {\n var symbols = getSymbols(it);\n var isEnum = pIE.f;\n var i = 0;\n var key;\n while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);\n } return result;\n};\n","// 7.2.2 IsArray(argument)\nvar cof = require('./_cof');\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n","// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = require('./_object-keys-internal');\nvar hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return $keys(O, hiddenKeys);\n};\n","// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nvar toIObject = require('./_to-iobject');\nvar gOPN = require('./_object-gopn').f;\nvar toString = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return gOPN(it);\n } catch (e) {\n return windowNames.slice();\n }\n};\n\nmodule.exports.f = function getOwnPropertyNames(it) {\n return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));\n};\n","'use strict';\n// ECMAScript 6 symbols shim\nvar global = require('./_global');\nvar has = require('./_has');\nvar DESCRIPTORS = require('./_descriptors');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar META = require('./_meta').KEY;\nvar $fails = require('./_fails');\nvar shared = require('./_shared');\nvar setToStringTag = require('./_set-to-string-tag');\nvar uid = require('./_uid');\nvar wks = require('./_wks');\nvar wksExt = require('./_wks-ext');\nvar wksDefine = require('./_wks-define');\nvar enumKeys = require('./_enum-keys');\nvar isArray = require('./_is-array');\nvar anObject = require('./_an-object');\nvar isObject = require('./_is-object');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar createDesc = require('./_property-desc');\nvar _create = require('./_object-create');\nvar gOPNExt = require('./_object-gopn-ext');\nvar $GOPD = require('./_object-gopd');\nvar $DP = require('./_object-dp');\nvar $keys = require('./_object-keys');\nvar gOPD = $GOPD.f;\nvar dP = $DP.f;\nvar gOPN = gOPNExt.f;\nvar $Symbol = global.Symbol;\nvar $JSON = global.JSON;\nvar _stringify = $JSON && $JSON.stringify;\nvar PROTOTYPE = 'prototype';\nvar HIDDEN = wks('_hidden');\nvar TO_PRIMITIVE = wks('toPrimitive');\nvar isEnum = {}.propertyIsEnumerable;\nvar SymbolRegistry = shared('symbol-registry');\nvar AllSymbols = shared('symbols');\nvar OPSymbols = shared('op-symbols');\nvar ObjectProto = Object[PROTOTYPE];\nvar USE_NATIVE = typeof $Symbol == 'function';\nvar QObject = global.QObject;\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDesc = DESCRIPTORS && $fails(function () {\n return _create(dP({}, 'a', {\n get: function () { return dP(this, 'a', { value: 7 }).a; }\n })).a != 7;\n}) ? function (it, key, D) {\n var protoDesc = gOPD(ObjectProto, key);\n if (protoDesc) delete ObjectProto[key];\n dP(it, key, D);\n if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);\n} : dP;\n\nvar wrap = function (tag) {\n var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);\n sym._k = tag;\n return sym;\n};\n\nvar isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n return it instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(it, key, D) {\n if (it === ObjectProto) $defineProperty(OPSymbols, key, D);\n anObject(it);\n key = toPrimitive(key, true);\n anObject(D);\n if (has(AllSymbols, key)) {\n if (!D.enumerable) {\n if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));\n it[HIDDEN][key] = true;\n } else {\n if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;\n D = _create(D, { enumerable: createDesc(0, false) });\n } return setSymbolDesc(it, key, D);\n } return dP(it, key, D);\n};\nvar $defineProperties = function defineProperties(it, P) {\n anObject(it);\n var keys = enumKeys(P = toIObject(P));\n var i = 0;\n var l = keys.length;\n var key;\n while (l > i) $defineProperty(it, key = keys[i++], P[key]);\n return it;\n};\nvar $create = function create(it, P) {\n return P === undefined ? _create(it) : $defineProperties(_create(it), P);\n};\nvar $propertyIsEnumerable = function propertyIsEnumerable(key) {\n var E = isEnum.call(this, key = toPrimitive(key, true));\n if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;\n return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;\n};\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {\n it = toIObject(it);\n key = toPrimitive(key, true);\n if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;\n var D = gOPD(it, key);\n if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;\n return D;\n};\nvar $getOwnPropertyNames = function getOwnPropertyNames(it) {\n var names = gOPN(toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);\n } return result;\n};\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(it) {\n var IS_OP = it === ObjectProto;\n var names = gOPN(IS_OP ? OPSymbols : toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);\n } return result;\n};\n\n// 19.4.1.1 Symbol([description])\nif (!USE_NATIVE) {\n $Symbol = function Symbol() {\n if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');\n var tag = uid(arguments.length > 0 ? arguments[0] : undefined);\n var $set = function (value) {\n if (this === ObjectProto) $set.call(OPSymbols, value);\n if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDesc(this, tag, createDesc(1, value));\n };\n if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });\n return wrap(tag);\n };\n redefine($Symbol[PROTOTYPE], 'toString', function toString() {\n return this._k;\n });\n\n $GOPD.f = $getOwnPropertyDescriptor;\n $DP.f = $defineProperty;\n require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;\n require('./_object-pie').f = $propertyIsEnumerable;\n require('./_object-gops').f = $getOwnPropertySymbols;\n\n if (DESCRIPTORS && !require('./_library')) {\n redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);\n }\n\n wksExt.f = function (name) {\n return wrap(wks(name));\n };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });\n\nfor (var es6Symbols = (\n // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14\n 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'\n).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);\n\nfor (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);\n\n$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {\n // 19.4.2.1 Symbol.for(key)\n 'for': function (key) {\n return has(SymbolRegistry, key += '')\n ? SymbolRegistry[key]\n : SymbolRegistry[key] = $Symbol(key);\n },\n // 19.4.2.5 Symbol.keyFor(sym)\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');\n for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;\n },\n useSetter: function () { setter = true; },\n useSimple: function () { setter = false; }\n});\n\n$export($export.S + $export.F * !USE_NATIVE, 'Object', {\n // 19.1.2.2 Object.create(O [, Properties])\n create: $create,\n // 19.1.2.4 Object.defineProperty(O, P, Attributes)\n defineProperty: $defineProperty,\n // 19.1.2.3 Object.defineProperties(O, Properties)\n defineProperties: $defineProperties,\n // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor,\n // 19.1.2.7 Object.getOwnPropertyNames(O)\n getOwnPropertyNames: $getOwnPropertyNames,\n // 19.1.2.8 Object.getOwnPropertySymbols(O)\n getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// 24.3.2 JSON.stringify(value [, replacer [, space]])\n$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {\n var S = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n // WebKit converts symbol values to JSON as null\n // V8 throws on boxed symbols\n return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';\n})), 'JSON', {\n stringify: function stringify(it) {\n var args = [it];\n var i = 1;\n var replacer, $replacer;\n while (arguments.length > i) args.push(arguments[i++]);\n $replacer = replacer = args[1];\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (typeof $replacer == 'function') value = $replacer.call(this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return _stringify.apply($JSON, args);\n }\n});\n\n// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)\n$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);\n// 19.4.3.5 Symbol.prototype[@@toStringTag]\nsetToStringTag($Symbol, 'Symbol');\n// 20.2.1.9 Math[@@toStringTag]\nsetToStringTag(Math, 'Math', true);\n// 24.3.3 JSON[@@toStringTag]\nsetToStringTag(global.JSON, 'JSON', true);\n","const methods = {}\r\nconst names = []\r\n\r\nexport function registerMethods (name, m) {\r\n if (Array.isArray(name)) {\r\n for (let _name of name) {\r\n registerMethods(_name, m)\r\n }\r\n return\r\n }\r\n\r\n if (typeof name === 'object') {\r\n for (let _name in name) {\r\n registerMethods(_name, name[_name])\r\n }\r\n return\r\n }\r\n\r\n addMethodNames(Object.keys(m))\r\n methods[name] = Object.assign(methods[name] || {}, m)\r\n}\r\n\r\nexport function getMethodsFor (name) {\r\n return methods[name] || {}\r\n}\r\n\r\nexport function getMethodNames () {\r\n return [...new Set(names)]\r\n}\r\n\r\nexport function addMethodNames (_names) {\r\n names.push(..._names)\r\n}\r\n","'use strict';\n// https://github.com/tc39/Array.prototype.includes\nvar $export = require('./_export');\nvar $includes = require('./_array-includes')(true);\n\n$export($export.P, 'Array', {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\nrequire('./_add-to-unscopables')('includes');\n","// 7.2.8 IsRegExp(argument)\nvar isObject = require('./_is-object');\nvar cof = require('./_cof');\nvar MATCH = require('./_wks')('match');\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');\n};\n","var MATCH = require('./_wks')('match');\nmodule.exports = function (KEY) {\n var re = /./;\n try {\n '/./'[KEY](re);\n } catch (e) {\n try {\n re[MATCH] = false;\n return !'/./'[KEY](re);\n } catch (f) { /* empty */ }\n } return true;\n};\n","// 21.1.3.7 String.prototype.includes(searchString, position = 0)\n'use strict';\nvar $export = require('./_export');\nvar context = require('./_string-context');\nvar INCLUDES = 'includes';\n\n$export($export.P + $export.F * require('./_fails-is-regexp')(INCLUDES), 'String', {\n includes: function includes(searchString /* , position = 0 */) {\n return !!~context(this, searchString, INCLUDES)\n .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","// helper for String#{startsWith, endsWith, includes}\nvar isRegExp = require('./_is-regexp');\nvar defined = require('./_defined');\n\nmodule.exports = function (that, searchString, NAME) {\n if (isRegExp(searchString)) throw TypeError('String#' + NAME + \" doesn't accept regex!\");\n return String(defined(that));\n};\n","'use strict';\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar fails = require('./_fails');\nvar defined = require('./_defined');\nvar wks = require('./_wks');\n\nmodule.exports = function (KEY, length, exec) {\n var SYMBOL = wks(KEY);\n var fns = exec(defined, SYMBOL, ''[KEY]);\n var strfn = fns[0];\n var rxfn = fns[1];\n if (fails(function () {\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n })) {\n redefine(String.prototype, KEY, strfn);\n hide(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return rxfn.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return rxfn.call(string, this); }\n );\n }\n};\n","// Map function\r\nexport function map (array, block) {\r\n var i\r\n var il = array.length\r\n var result = []\r\n\r\n for (i = 0; i < il; i++) {\r\n result.push(block(array[i]))\r\n }\r\n\r\n return result\r\n}\r\n\r\n// Filter function\r\nexport function filter (array, block) {\r\n var i\r\n var il = array.length\r\n var result = []\r\n\r\n for (i = 0; i < il; i++) {\r\n if (block(array[i])) { result.push(array[i]) }\r\n }\r\n\r\n return result\r\n}\r\n\r\n// Degrees to radians\r\nexport function radians (d) {\r\n return d % 360 * Math.PI / 180\r\n}\r\n\r\n// Radians to degrees\r\nexport function degrees (r) {\r\n return r * 180 / Math.PI % 360\r\n}\r\n\r\n// Convert dash-separated-string to camelCase\r\nexport function camelCase (s) {\r\n return s.toLowerCase().replace(/-(.)/g, function (m, g) {\r\n return g.toUpperCase()\r\n })\r\n}\r\n\r\n// Convert camel cased string to string seperated\r\nexport function unCamelCase (s) {\r\n return s.replace(/([A-Z])/g, function (m, g) {\r\n return '-' + g.toLowerCase()\r\n })\r\n}\r\n\r\n// Capitalize first letter of a string\r\nexport function capitalize (s) {\r\n return s.charAt(0).toUpperCase() + s.slice(1)\r\n}\r\n\r\n// Calculate proportional width and height values when necessary\r\nexport function proportionalSize (element, width, height) {\r\n if (width == null || height == null) {\r\n var box = element.bbox()\r\n\r\n if (width == null) {\r\n width = box.width / box.height * height\r\n } else if (height == null) {\r\n height = box.height / box.width * width\r\n }\r\n }\r\n\r\n return {\r\n width: width,\r\n height: height\r\n }\r\n}\r\n\r\nexport function getOrigin (o, element) {\r\n // Allow origin or around as the names\r\n let origin = o.origin // o.around == null ? o.origin : o.around\r\n let ox, oy\r\n\r\n // Allow the user to pass a string to rotate around a given point\r\n if (typeof origin === 'string' || origin == null) {\r\n // Get the bounding box of the element with no transformations applied\r\n const string = (origin || 'center').toLowerCase().trim()\r\n const { height, width, x, y } = element.bbox()\r\n\r\n // Calculate the transformed x and y coordinates\r\n let bx = string.includes('left') ? x\r\n : string.includes('right') ? x + width\r\n : x + width / 2\r\n let by = string.includes('top') ? y\r\n : string.includes('bottom') ? y + height\r\n : y + height / 2\r\n\r\n // Set the bounds eg : \"bottom-left\", \"Top right\", \"middle\" etc...\r\n ox = o.ox != null ? o.ox : bx\r\n oy = o.oy != null ? o.oy : by\r\n } else {\r\n ox = origin[0]\r\n oy = origin[1]\r\n }\r\n\r\n // Return the origin as it is if it wasn't a string\r\n return [ ox, oy ]\r\n}\r\n","// @@replace logic\nrequire('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace) {\n // 21.1.3.14 String.prototype.replace(searchValue, replaceValue)\n return [function replace(searchValue, replaceValue) {\n 'use strict';\n var O = defined(this);\n var fn = searchValue == undefined ? undefined : searchValue[REPLACE];\n return fn !== undefined\n ? fn.call(searchValue, O, replaceValue)\n : $replace.call(String(O), searchValue, replaceValue);\n }, $replace];\n});\n","// Default namespaces\r\nexport let ns = 'http://www.w3.org/2000/svg'\r\nexport let xmlns = 'http://www.w3.org/2000/xmlns/'\r\nexport let xlink = 'http://www.w3.org/1999/xlink'\r\nexport let svgjs = 'http://svgjs.com/svgjs'\r\n","export const globals = {\r\n window: typeof window === 'undefined' ? null : window,\r\n document: typeof document === 'undefined' ? null : document\r\n}\r\n\r\nexport function registerWindow (win = null, doc = null) {\r\n globals.window = win\r\n globals.document = doc\r\n}\r\n","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","export default class Base {\r\n // constructor (node/*, {extensions = []} */) {\r\n // // this.tags = []\r\n // //\r\n // // for (let extension of extensions) {\r\n // // extension.setup.call(this, node)\r\n // // this.tags.push(extension.name)\r\n // // }\r\n // }\r\n}\r\n","import { addMethodNames } from './methods.js'\r\nimport { capitalize } from './utils.js'\r\nimport { ns } from '../modules/core/namespaces.js'\r\nimport { globals } from '../utils/window.js'\r\nimport Base from '../types/Base.js'\r\n\r\nconst elements = {}\r\nexport const root = '___SYMBOL___ROOT___'\r\n\r\n// Method for element creation\r\nexport function makeNode (name) {\r\n // create element\r\n return globals.document.createElementNS(ns, name)\r\n}\r\n\r\nexport function makeInstance (element) {\r\n if (element instanceof Base) return element\r\n\r\n if (typeof element === 'object') {\r\n return adopt(element)\r\n }\r\n\r\n if (element == null) {\r\n return new elements[root]()\r\n }\r\n\r\n if (typeof element === 'string' && element.charAt(0) !== '<') {\r\n return adopt(globals.document.querySelector(element))\r\n }\r\n\r\n var node = makeNode('svg')\r\n node.innerHTML = element\r\n\r\n // We can use firstChild here because we know,\r\n // that the first char is < and thus an element\r\n element = adopt(node.firstChild)\r\n\r\n return element\r\n}\r\n\r\nexport function nodeOrNew (name, node) {\r\n return node instanceof globals.window.Node ? node : makeNode(name)\r\n}\r\n\r\n// Adopt existing svg elements\r\nexport function adopt (node) {\r\n // check for presence of node\r\n if (!node) return null\r\n\r\n // make sure a node isn't already adopted\r\n if (node.instance instanceof Base) return node.instance\r\n\r\n // initialize variables\r\n var className = capitalize(node.nodeName)\r\n\r\n // Make sure that gradients are adopted correctly\r\n if (className === 'LinearGradient' || className === 'RadialGradient') {\r\n className = 'Gradient'\r\n\r\n // Fallback to Dom if element is not known\r\n } else if (!elements[className]) {\r\n className = 'Dom'\r\n }\r\n\r\n return new elements[className](node)\r\n}\r\n\r\nexport function register (element, name = element.name, asRoot = false) {\r\n elements[name] = element\r\n if (asRoot) elements[root] = element\r\n\r\n addMethodNames(Object.keys(element.prototype))\r\n\r\n return element\r\n}\r\n\r\nexport function getClass (name) {\r\n return elements[name]\r\n}\r\n\r\n// Element id sequence\r\nlet did = 1000\r\n\r\n// Get next named element id\r\nexport function eid (name) {\r\n return 'Svgjs' + capitalize(name) + (did++)\r\n}\r\n\r\n// Deep new id assignment\r\nexport function assignNewId (node) {\r\n // do the same for SVG child nodes as well\r\n for (var i = node.children.length - 1; i >= 0; i--) {\r\n assignNewId(node.children[i])\r\n }\r\n\r\n if (node.id) {\r\n return adopt(node).id(eid(node.nodeName))\r\n }\r\n\r\n return adopt(node)\r\n}\r\n\r\n// Method for extending objects\r\nexport function extend (modules, methods, attrCheck) {\r\n var key, i\r\n\r\n modules = Array.isArray(modules) ? modules : [modules]\r\n\r\n for (i = modules.length - 1; i >= 0; i--) {\r\n for (key in methods) {\r\n let method = methods[key]\r\n if (attrCheck) {\r\n method = wrapWithAttrCheck(methods[key])\r\n }\r\n modules[i].prototype[key] = method\r\n }\r\n }\r\n}\r\n\r\nexport function extendWithAttrCheck (...args) {\r\n extend(...args, true)\r\n}\r\n\r\nexport function wrapWithAttrCheck (fn) {\r\n return function (...args) {\r\n let o = args[args.length - 1]\r\n\r\n if (o && o.constructor === Object && !(o instanceof Array)) {\r\n return fn.apply(this, args.slice(0, -1)).attr(o)\r\n } else {\r\n return fn.apply(this, args)\r\n }\r\n }\r\n}\r\n","import { makeInstance } from '../../utils/adopter.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\n\r\n// Get all siblings, including myself\r\nexport function siblings () {\r\n return this.parent().children()\r\n}\r\n\r\n// Get the curent position siblings\r\nexport function position () {\r\n return this.parent().index(this)\r\n}\r\n\r\n// Get the next element (will return null if there is none)\r\nexport function next () {\r\n return this.siblings()[this.position() + 1]\r\n}\r\n\r\n// Get the next element (will return null if there is none)\r\nexport function prev () {\r\n return this.siblings()[this.position() - 1]\r\n}\r\n\r\n// Send given element one step forward\r\nexport function forward () {\r\n var i = this.position() + 1\r\n var p = this.parent()\r\n\r\n // move node one step forward\r\n p.removeElement(this).add(this, i)\r\n\r\n // make sure defs node is always at the top\r\n if (typeof p.isRoot === 'function' && p.isRoot()) {\r\n p.node.appendChild(p.defs().node)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element one step backward\r\nexport function backward () {\r\n var i = this.position()\r\n\r\n if (i > 0) {\r\n this.parent().removeElement(this).add(this, i - 1)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element all the way to the front\r\nexport function front () {\r\n var p = this.parent()\r\n\r\n // Move node forward\r\n p.node.appendChild(this.node)\r\n\r\n // Make sure defs node is always at the top\r\n if (typeof p.isRoot === 'function' && p.isRoot()) {\r\n p.node.appendChild(p.defs().node)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element all the way to the back\r\nexport function back () {\r\n if (this.position() > 0) {\r\n this.parent().removeElement(this).add(this, 0)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Inserts a given element before the targeted element\r\nexport function before (element) {\r\n element = makeInstance(element)\r\n element.remove()\r\n\r\n var i = this.position()\r\n\r\n this.parent().add(element, i)\r\n\r\n return this\r\n}\r\n\r\n// Inserts a given element after the targeted element\r\nexport function after (element) {\r\n element = makeInstance(element)\r\n element.remove()\r\n\r\n var i = this.position()\r\n\r\n this.parent().add(element, i + 1)\r\n\r\n return this\r\n}\r\n\r\nexport function insertBefore (element) {\r\n element = makeInstance(element)\r\n element.before(this)\r\n}\r\n\r\nexport function insertAfter (element) {\r\n element = makeInstance(element)\r\n element.after(this)\r\n}\r\n\r\nregisterMethods('Dom', {\r\n siblings,\r\n position,\r\n next,\r\n prev,\r\n forward,\r\n backward,\r\n front,\r\n back,\r\n before,\r\n after,\r\n insertBefore,\r\n insertAfter\r\n})\r\n","// @@split logic\nrequire('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split) {\n 'use strict';\n var isRegExp = require('./_is-regexp');\n var _split = $split;\n var $push = [].push;\n var $SPLIT = 'split';\n var LENGTH = 'length';\n var LAST_INDEX = 'lastIndex';\n if (\n 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||\n 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||\n 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||\n '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||\n '.'[$SPLIT](/()()/)[LENGTH] > 1 ||\n ''[$SPLIT](/.?/)[LENGTH]\n ) {\n var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group\n // based on es5-shim implementation, need to rework it\n $split = function (separator, limit) {\n var string = String(this);\n if (separator === undefined && limit === 0) return [];\n // If `separator` is not a regex, use native split\n if (!isRegExp(separator)) return _split.call(string, separator, limit);\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n var splitLimit = limit === undefined ? 4294967295 : limit >>> 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var separator2, match, lastIndex, lastLength, i;\n // Doesn't need flags gy, but they don't hurt\n if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\\\s)', flags);\n while (match = separatorCopy.exec(string)) {\n // `separatorCopy.lastIndex` is not reliable cross-browser\n lastIndex = match.index + match[0][LENGTH];\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG\n // eslint-disable-next-line no-loop-func\n if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () {\n for (i = 1; i < arguments[LENGTH] - 2; i++) if (arguments[i] === undefined) match[i] = undefined;\n });\n if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));\n lastLength = match[0][LENGTH];\n lastLastIndex = lastIndex;\n if (output[LENGTH] >= splitLimit) break;\n }\n if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop\n }\n if (lastLastIndex === string[LENGTH]) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;\n };\n // Chakra, V8\n } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {\n $split = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit);\n };\n }\n // 21.1.3.17 String.prototype.split(separator, limit)\n return [function split(separator, limit) {\n var O = defined(this);\n var fn = separator == undefined ? undefined : separator[SPLIT];\n return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit);\n }, $split];\n});\n","// Parse unit value\r\nexport let numberAndUnit = /^([+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?)([a-z%]*)$/i\r\n\r\n// Parse hex value\r\nexport let hex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i\r\n\r\n// Parse rgb value\r\nexport let rgb = /rgb\\((\\d+),(\\d+),(\\d+)\\)/\r\n\r\n// Parse reference id\r\nexport let reference = /(#[a-z0-9\\-_]+)/i\r\n\r\n// splits a transformation chain\r\nexport let transforms = /\\)\\s*,?\\s*/\r\n\r\n// Whitespace\r\nexport let whitespace = /\\s/g\r\n\r\n// Test hex value\r\nexport let isHex = /^#[a-f0-9]{3,6}$/i\r\n\r\n// Test rgb value\r\nexport let isRgb = /^rgb\\(/\r\n\r\n// Test css declaration\r\nexport let isCss = /[^:]+:[^;]+;?/\r\n\r\n// Test for blank string\r\nexport let isBlank = /^(\\s+)?$/\r\n\r\n// Test for numeric string\r\nexport let isNumber = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i\r\n\r\n// Test for percent value\r\nexport let isPercent = /^-?[\\d.]+%$/\r\n\r\n// Test for image url\r\nexport let isImage = /\\.(jpg|jpeg|png|gif|svg)(\\?[^=]+.*)?/i\r\n\r\n// split at whitespace and comma\r\nexport let delimiter = /[\\s,]+/\r\n\r\n// The following regex are used to parse the d attribute of a path\r\n\r\n// Matches all hyphens which are not after an exponent\r\nexport let hyphen = /([^e])-/gi\r\n\r\n// Replaces and tests for all path letters\r\nexport let pathLetters = /[MLHVCSQTAZ]/gi\r\n\r\n// yes we need this one, too\r\nexport let isPathLetter = /[MLHVCSQTAZ]/i\r\n\r\n// matches 0.154.23.45\r\nexport let numbersWithDots = /((\\d?\\.\\d+(?:e[+-]?\\d+)?)((?:\\.\\d+(?:e[+-]?\\d+)?)+))+/gi\r\n\r\n// matches .\r\nexport let dots = /\\./g\r\n","import { delimiter } from '../core/regex.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\n\r\n// Return array of classes on the node\r\nexport function classes () {\r\n var attr = this.attr('class')\r\n return attr == null ? [] : attr.trim().split(delimiter)\r\n}\r\n\r\n// Return true if class exists on the node, false otherwise\r\nexport function hasClass (name) {\r\n return this.classes().indexOf(name) !== -1\r\n}\r\n\r\n// Add class to the node\r\nexport function addClass (name) {\r\n if (!this.hasClass(name)) {\r\n var array = this.classes()\r\n array.push(name)\r\n this.attr('class', array.join(' '))\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Remove class from the node\r\nexport function removeClass (name) {\r\n if (this.hasClass(name)) {\r\n this.attr('class', this.classes().filter(function (c) {\r\n return c !== name\r\n }).join(' '))\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Toggle the presence of a class on the node\r\nexport function toggleClass (name) {\r\n return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)\r\n}\r\n\r\nregisterMethods('Dom', {\r\n classes, hasClass, addClass, removeClass, toggleClass\r\n})\r\n","import { camelCase } from '../../utils/utils.js'\r\nimport { isBlank } from '../core/regex.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\n\r\n// Dynamic style generator\r\nexport function css (style, val) {\r\n let ret = {}\r\n if (arguments.length === 0) {\r\n // get full style as object\r\n this.node.style.cssText.split(/\\s*;\\s*/)\r\n .filter(function (el) { return !!el.length })\r\n .forEach(function (el) {\r\n let t = el.split(/\\s*:\\s*/)\r\n ret[t[0]] = t[1]\r\n })\r\n return ret\r\n }\r\n\r\n if (arguments.length < 2) {\r\n // get style properties in the array\r\n if (Array.isArray(style)) {\r\n for (let name of style) {\r\n let cased = camelCase(name)\r\n ret[cased] = this.node.style[cased]\r\n }\r\n return ret\r\n }\r\n\r\n // get style for property\r\n if (typeof style === 'string') {\r\n return this.node.style[camelCase(style)]\r\n }\r\n\r\n // set styles in object\r\n if (typeof style === 'object') {\r\n for (let name in style) {\r\n // set empty string if null/undefined/'' was given\r\n this.node.style[camelCase(name)] =\r\n (style[name] == null || isBlank.test(style[name])) ? '' : style[name]\r\n }\r\n }\r\n }\r\n\r\n // set style for property\r\n if (arguments.length === 2) {\r\n this.node.style[camelCase(style)] =\r\n (val == null || isBlank.test(val)) ? '' : val\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Show element\r\nexport function show () {\r\n return this.css('display', '')\r\n}\r\n\r\n// Hide element\r\nexport function hide () {\r\n return this.css('display', 'none')\r\n}\r\n\r\n// Is element visible?\r\nexport function visible () {\r\n return this.css('display') !== 'none'\r\n}\r\n\r\nregisterMethods('Dom', {\r\n css, show, hide, visible\r\n})\r\n","import { registerMethods } from '../../utils/methods.js'\r\n\r\n// Store data values on svg nodes\r\nexport function data (a, v, r) {\r\n if (typeof a === 'object') {\r\n for (v in a) {\r\n this.data(v, a[v])\r\n }\r\n } else if (arguments.length < 2) {\r\n try {\r\n return JSON.parse(this.attr('data-' + a))\r\n } catch (e) {\r\n return this.attr('data-' + a)\r\n }\r\n } else {\r\n this.attr('data-' + a,\r\n v === null ? null\r\n : r === true || typeof v === 'string' || typeof v === 'number' ? v\r\n : JSON.stringify(v)\r\n )\r\n }\r\n\r\n return this\r\n}\r\n\r\nregisterMethods('Dom', { data })\r\n","import { registerMethods } from '../../utils/methods.js'\r\n\r\n// Remember arbitrary data\r\nexport function remember (k, v) {\r\n // remember every item in an object individually\r\n if (typeof arguments[0] === 'object') {\r\n for (var key in k) {\r\n this.remember(key, k[key])\r\n }\r\n } else if (arguments.length === 1) {\r\n // retrieve memory\r\n return this.memory()[k]\r\n } else {\r\n // store memory\r\n this.memory()[k] = v\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Erase a given memory\r\nexport function forget () {\r\n if (arguments.length === 0) {\r\n this._memory = {}\r\n } else {\r\n for (var i = arguments.length - 1; i >= 0; i--) {\r\n delete this.memory()[arguments[i]]\r\n }\r\n }\r\n return this\r\n}\r\n\r\n// This triggers creation of a new hidden class which is not performant\r\n// However, this function is not rarely used so it will not happen frequently\r\n// Return local memory object\r\nexport function memory () {\r\n return (this._memory = this._memory || {})\r\n}\r\n\r\nregisterMethods('Dom', { remember, forget, memory })\r\n","import { delimiter } from './regex.js'\r\nimport { makeInstance } from '../../utils/adopter.js'\r\nimport { globals } from '../../utils/window.js'\r\n\r\nlet listenerId = 0\r\n\r\nfunction getEvents (node) {\r\n const n = makeInstance(node).getEventHolder()\r\n if (!n.events) n.events = {}\r\n return n.events\r\n}\r\n\r\nfunction getEventTarget (node) {\r\n return makeInstance(node).getEventTarget()\r\n}\r\n\r\nfunction clearEvents (node) {\r\n const n = makeInstance(node).getEventHolder()\r\n if (n.events) n.events = {}\r\n}\r\n\r\n// Add event binder in the SVG namespace\r\nexport function on (node, events, listener, binding, options) {\r\n var l = listener.bind(binding || node)\r\n var bag = getEvents(node)\r\n var n = getEventTarget(node)\r\n\r\n // events can be an array of events or a string of events\r\n events = Array.isArray(events) ? events : events.split(delimiter)\r\n\r\n // add id to listener\r\n if (!listener._svgjsListenerId) {\r\n listener._svgjsListenerId = ++listenerId\r\n }\r\n\r\n events.forEach(function (event) {\r\n var ev = event.split('.')[0]\r\n var ns = event.split('.')[1] || '*'\r\n\r\n // ensure valid object\r\n bag[ev] = bag[ev] || {}\r\n bag[ev][ns] = bag[ev][ns] || {}\r\n\r\n // reference listener\r\n bag[ev][ns][listener._svgjsListenerId] = l\r\n\r\n // add listener\r\n n.addEventListener(ev, l, options || false)\r\n })\r\n}\r\n\r\n// Add event unbinder in the SVG namespace\r\nexport function off (node, events, listener, options) {\r\n var bag = getEvents(node)\r\n var n = getEventTarget(node)\r\n\r\n // listener can be a function or a number\r\n if (typeof listener === 'function') {\r\n listener = listener._svgjsListenerId\r\n if (!listener) return\r\n }\r\n\r\n // events can be an array of events or a string or undefined\r\n events = Array.isArray(events) ? events : (events || '').split(delimiter)\r\n\r\n events.forEach(function (event) {\r\n var ev = event && event.split('.')[0]\r\n var ns = event && event.split('.')[1]\r\n var namespace, l\r\n\r\n if (listener) {\r\n // remove listener reference\r\n if (bag[ev] && bag[ev][ns || '*']) {\r\n // removeListener\r\n n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false)\r\n\r\n delete bag[ev][ns || '*'][listener]\r\n }\r\n } else if (ev && ns) {\r\n // remove all listeners for a namespaced event\r\n if (bag[ev] && bag[ev][ns]) {\r\n for (l in bag[ev][ns]) { off(n, [ev, ns].join('.'), l) }\r\n\r\n delete bag[ev][ns]\r\n }\r\n } else if (ns) {\r\n // remove all listeners for a specific namespace\r\n for (event in bag) {\r\n for (namespace in bag[event]) {\r\n if (ns === namespace) { off(n, [event, ns].join('.')) }\r\n }\r\n }\r\n } else if (ev) {\r\n // remove all listeners for the event\r\n if (bag[ev]) {\r\n for (namespace in bag[ev]) { off(n, [ev, namespace].join('.')) }\r\n\r\n delete bag[ev]\r\n }\r\n } else {\r\n // remove all listeners on a given node\r\n for (event in bag) { off(n, event) }\r\n\r\n clearEvents(node)\r\n }\r\n })\r\n}\r\n\r\nexport function dispatch (node, event, data) {\r\n var n = getEventTarget(node)\r\n\r\n // Dispatch event\r\n if (event instanceof globals.window.Event) {\r\n n.dispatchEvent(event)\r\n } else {\r\n event = new globals.window.CustomEvent(event, { detail: data, cancelable: true })\r\n n.dispatchEvent(event)\r\n }\r\n return event\r\n}\r\n","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","'use strict';\n// 21.2.5.3 get RegExp.prototype.flags\nvar anObject = require('./_an-object');\nmodule.exports = function () {\n var that = anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n};\n","// 21.2.5.3 get RegExp.prototype.flags()\nif (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', {\n configurable: true,\n get: require('./_flags')\n});\n","'use strict';\nrequire('./es6.regexp.flags');\nvar anObject = require('./_an-object');\nvar $flags = require('./_flags');\nvar DESCRIPTORS = require('./_descriptors');\nvar TO_STRING = 'toString';\nvar $toString = /./[TO_STRING];\n\nvar define = function (fn) {\n require('./_redefine')(RegExp.prototype, TO_STRING, fn, true);\n};\n\n// 21.2.5.14 RegExp.prototype.toString()\nif (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) {\n define(function toString() {\n var R = anObject(this);\n return '/'.concat(R.source, '/',\n 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);\n });\n// FF44- RegExp#toString has a wrong name\n} else if ($toString.name != TO_STRING) {\n define(function toString() {\n return $toString.call(this);\n });\n}\n","/*\r\n\r\nColor {\r\n constructor (a, b, c, space) {\r\n space: 'hsl'\r\n a: 30\r\n b: 20\r\n c: 10\r\n },\r\n\r\n toRgb () { return new Color in rgb space }\r\n toHsl () { return new Color in hsl space }\r\n toLab () { return new Color in lab space }\r\n\r\n toArray () { [space, a, b, c] }\r\n fromArray () { convert it back }\r\n}\r\n\r\n// Conversions aren't always exact because of monitor profiles etc...\r\nnew Color(h, s, l, 'hsl') !== new Color(r, g, b).hsl()\r\nnew Color(100, 100, 100, [space])\r\nnew Color('hsl(30, 20, 10)')\r\n\r\n// Sugar\r\nSVG.rgb(30, 20, 50).lab()\r\nSVG.hsl()\r\nSVG.lab('rgb(100, 100, 100)')\r\n*/\r\n\r\nimport { hex, isHex, isRgb, rgb, whitespace } from '../modules/core/regex.js'\r\n\r\n// Ensure to six-based hex\r\nfunction fullHex (hex) {\r\n return hex.length === 4\r\n ? [ '#',\r\n hex.substring(1, 2), hex.substring(1, 2),\r\n hex.substring(2, 3), hex.substring(2, 3),\r\n hex.substring(3, 4), hex.substring(3, 4)\r\n ].join('')\r\n : hex\r\n}\r\n\r\n// Component to hex value\r\nfunction compToHex (comp) {\r\n var hex = comp.toString(16)\r\n return hex.length === 1 ? '0' + hex : hex\r\n}\r\n\r\nexport default class Color {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (color, g, b) {\r\n let match\r\n\r\n // initialize defaults\r\n this.r = 0\r\n this.g = 0\r\n this.b = 0\r\n\r\n if (!color) return\r\n\r\n // parse color\r\n if (typeof color === 'string') {\r\n if (isRgb.test(color)) {\r\n // get rgb values\r\n match = rgb.exec(color.replace(whitespace, ''))\r\n\r\n // parse numeric values\r\n this.r = parseInt(match[1])\r\n this.g = parseInt(match[2])\r\n this.b = parseInt(match[3])\r\n } else if (isHex.test(color)) {\r\n // get hex values\r\n match = hex.exec(fullHex(color))\r\n\r\n // parse numeric values\r\n this.r = parseInt(match[1], 16)\r\n this.g = parseInt(match[2], 16)\r\n this.b = parseInt(match[3], 16)\r\n }\r\n } else if (Array.isArray(color)) {\r\n this.r = color[0]\r\n this.g = color[1]\r\n this.b = color[2]\r\n } else if (typeof color === 'object') {\r\n this.r = color.r\r\n this.g = color.g\r\n this.b = color.b\r\n } else if (arguments.length === 3) {\r\n this.r = color\r\n this.g = g\r\n this.b = b\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Default to hex conversion\r\n toString () {\r\n return this.toHex()\r\n }\r\n\r\n toArray () {\r\n return [this.r, this.g, this.b]\r\n }\r\n\r\n // Build hex value\r\n toHex () {\r\n return '#' +\r\n compToHex(Math.round(this.r)) +\r\n compToHex(Math.round(this.g)) +\r\n compToHex(Math.round(this.b))\r\n }\r\n\r\n // Build rgb value\r\n toRgb () {\r\n return 'rgb(' + [this.r, this.g, this.b].join() + ')'\r\n }\r\n\r\n // Calculate true brightness\r\n brightness () {\r\n return (this.r / 255 * 0.30) +\r\n (this.g / 255 * 0.59) +\r\n (this.b / 255 * 0.11)\r\n }\r\n\r\n // Testers\r\n\r\n // Test if given value is a color string\r\n static test (color) {\r\n color += ''\r\n return isHex.test(color) || isRgb.test(color)\r\n }\r\n\r\n // Test if given value is a rgb object\r\n static isRgb (color) {\r\n return color && typeof color.r === 'number' &&\r\n typeof color.g === 'number' &&\r\n typeof color.b === 'number'\r\n }\r\n\r\n // Test if given value is a color\r\n static isColor (color) {\r\n return this.isRgb(color) || this.test(color)\r\n }\r\n}\r\n","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","import getPrototypeOf from \"./getPrototypeOf\";\nimport superPropBase from \"./superPropBase\";\nexport default function _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get;\n } else {\n _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}","import getPrototypeOf from \"./getPrototypeOf\";\nexport default function _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","// @@match logic\nrequire('./_fix-re-wks')('match', 1, function (defined, MATCH, $match) {\n // 21.1.3.11 String.prototype.match(regexp)\n return [function match(regexp) {\n 'use strict';\n var O = defined(this);\n var fn = regexp == undefined ? undefined : regexp[MATCH];\n return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));\n }, $match];\n});\n","export default class Point {\r\n // Initialize\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (x, y) {\r\n let source\r\n let base = { x: 0, y: 0 }\r\n\r\n // ensure source as object\r\n source = Array.isArray(x) ? { x: x[0], y: x[1] }\r\n : typeof x === 'object' ? { x: x.x, y: x.y }\r\n : { x: x, y: y }\r\n\r\n // merge source\r\n this.x = source.x == null ? base.x : source.x\r\n this.y = source.y == null ? base.y : source.y\r\n\r\n return this\r\n }\r\n\r\n // Clone point\r\n clone () {\r\n return new Point(this)\r\n }\r\n\r\n // transform point with matrix\r\n transform (m) {\r\n // Perform the matrix multiplication\r\n var x = m.a * this.x + m.c * this.y + m.e\r\n var y = m.b * this.x + m.d * this.y + m.f\r\n\r\n // Return the required point\r\n return new Point(x, y)\r\n }\r\n\r\n toArray () {\r\n return [this.x, this.y]\r\n }\r\n}\r\n\r\nexport function point (x, y) {\r\n return new Point(x, y).transform(this.screenCTM().inverse())\r\n}\r\n","import { globals } from '../../utils/window.js'\r\nimport { makeInstance } from '../../utils/adopter.js'\r\n\r\nexport default function parser () {\r\n // Reuse cached element if possible\r\n if (!parser.nodes) {\r\n let svg = makeInstance().size(2, 0)\r\n svg.node.cssText = [\r\n 'opacity: 0',\r\n 'position: absolute',\r\n 'left: -100%',\r\n 'top: -100%',\r\n 'overflow: hidden'\r\n ].join(';')\r\n\r\n let path = svg.path().node\r\n\r\n parser.nodes = { svg, path }\r\n }\r\n\r\n if (!parser.nodes.svg.node.parentNode) {\r\n let b = globals.document.body || globals.document.documentElement\r\n parser.nodes.svg.addTo(b)\r\n }\r\n\r\n return parser.nodes\r\n}\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { globals } from '../utils/window.js'\r\nimport Point from './Point.js'\r\nimport parser from '../modules/core/parser.js'\r\n\r\nfunction isNulledBox (box) {\r\n return !box.w && !box.h && !box.x && !box.y\r\n}\r\n\r\nfunction domContains (node) {\r\n return (globals.document.documentElement.contains || function (node) {\r\n // This is IE - it does not support contains() for top-level SVGs\r\n while (node.parentNode) {\r\n node = node.parentNode\r\n }\r\n return node === document\r\n }).call(globals.document.documentElement, node)\r\n}\r\n\r\nexport default class Box {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (source) {\r\n var base = [0, 0, 0, 0]\r\n source = typeof source === 'string' ? source.split(delimiter).map(parseFloat)\r\n : Array.isArray(source) ? source\r\n : typeof source === 'object' ? [source.left != null ? source.left\r\n : source.x, source.top != null ? source.top : source.y, source.width, source.height]\r\n : arguments.length === 4 ? [].slice.call(arguments)\r\n : base\r\n\r\n this.x = source[0] || 0\r\n this.y = source[1] || 0\r\n this.width = this.w = source[2] || 0\r\n this.height = this.h = source[3] || 0\r\n\r\n // Add more bounding box properties\r\n this.x2 = this.x + this.w\r\n this.y2 = this.y + this.h\r\n this.cx = this.x + this.w / 2\r\n this.cy = this.y + this.h / 2\r\n\r\n return this\r\n }\r\n\r\n // Merge rect box with another, return a new instance\r\n merge (box) {\r\n let x = Math.min(this.x, box.x)\r\n let y = Math.min(this.y, box.y)\r\n let width = Math.max(this.x + this.width, box.x + box.width) - x\r\n let height = Math.max(this.y + this.height, box.y + box.height) - y\r\n\r\n return new Box(x, y, width, height)\r\n }\r\n\r\n transform (m) {\r\n let xMin = Infinity\r\n let xMax = -Infinity\r\n let yMin = Infinity\r\n let yMax = -Infinity\r\n\r\n let pts = [\r\n new Point(this.x, this.y),\r\n new Point(this.x2, this.y),\r\n new Point(this.x, this.y2),\r\n new Point(this.x2, this.y2)\r\n ]\r\n\r\n pts.forEach(function (p) {\r\n p = p.transform(m)\r\n xMin = Math.min(xMin, p.x)\r\n xMax = Math.max(xMax, p.x)\r\n yMin = Math.min(yMin, p.y)\r\n yMax = Math.max(yMax, p.y)\r\n })\r\n\r\n return new Box(\r\n xMin, yMin,\r\n xMax - xMin,\r\n yMax - yMin\r\n )\r\n }\r\n\r\n addOffset () {\r\n // offset by window scroll position, because getBoundingClientRect changes when window is scrolled\r\n this.x += globals.window.pageXOffset\r\n this.y += globals.window.pageYOffset\r\n return this\r\n }\r\n\r\n toString () {\r\n return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height\r\n }\r\n\r\n toArray () {\r\n return [this.x, this.y, this.width, this.height]\r\n }\r\n\r\n isNulled () {\r\n return isNulledBox(this)\r\n }\r\n}\r\n\r\nfunction getBox (cb) {\r\n let box\r\n\r\n try {\r\n box = cb(this.node)\r\n\r\n if (isNulledBox(box) && !domContains(this.node)) {\r\n throw new Error('Element not in the dom')\r\n }\r\n } catch (e) {\r\n try {\r\n let clone = this.clone().addTo(parser().svg).show()\r\n box = cb(clone.node)\r\n clone.remove()\r\n } catch (e) {\r\n throw new Error('Getting a bounding box of element \"' + this.node.nodeName + '\" is not possible')\r\n }\r\n }\r\n return box\r\n}\r\n\r\nexport function bbox () {\r\n return new Box(getBox.call(this, (node) => node.getBBox()))\r\n}\r\n\r\nexport function rbox (el) {\r\n let box = new Box(getBox.call(this, (node) => node.getBoundingClientRect()))\r\n if (el) return box.transform(el.screenCTM().inverse())\r\n return box.addOffset()\r\n}\r\n\r\nregisterMethods({\r\n viewbox: {\r\n viewbox (x, y, width, height) {\r\n // act as getter\r\n if (x == null) return new Box(this.attr('viewBox'))\r\n\r\n // act as setter\r\n return this.attr('viewBox', new Box(x, y, width, height))\r\n }\r\n }\r\n})\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { radians } from '../utils/utils.js'\r\nimport Element from '../elements/Element.js'\r\nimport Point from './Point.js'\r\n\r\nfunction closeEnough (a, b, threshold) {\r\n return Math.abs(b - a) < (threshold || 1e-6)\r\n}\r\n\r\nexport default class Matrix {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n // Initialize\r\n init (source) {\r\n var base = Matrix.fromArray([1, 0, 0, 1, 0, 0])\r\n\r\n // ensure source as object\r\n source = source instanceof Element ? source.matrixify()\r\n : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat))\r\n : Array.isArray(source) ? Matrix.fromArray(source)\r\n : (typeof source === 'object' && Matrix.isMatrixLike(source)) ? source\r\n : (typeof source === 'object') ? new Matrix().transform(source)\r\n : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments))\r\n : base\r\n\r\n // Merge the source matrix with the base matrix\r\n this.a = source.a != null ? source.a : base.a\r\n this.b = source.b != null ? source.b : base.b\r\n this.c = source.c != null ? source.c : base.c\r\n this.d = source.d != null ? source.d : base.d\r\n this.e = source.e != null ? source.e : base.e\r\n this.f = source.f != null ? source.f : base.f\r\n\r\n return this\r\n }\r\n\r\n // Clones this matrix\r\n clone () {\r\n return new Matrix(this)\r\n }\r\n\r\n // Transform a matrix into another matrix by manipulating the space\r\n transform (o) {\r\n // Check if o is a matrix and then left multiply it directly\r\n if (Matrix.isMatrixLike(o)) {\r\n var matrix = new Matrix(o)\r\n return matrix.multiplyO(this)\r\n }\r\n\r\n // Get the proposed transformations and the current transformations\r\n var t = Matrix.formatTransforms(o)\r\n var current = this\r\n let { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current)\r\n\r\n // Construct the resulting matrix\r\n var transformer = new Matrix()\r\n .translateO(t.rx, t.ry)\r\n .lmultiplyO(current)\r\n .translateO(-ox, -oy)\r\n .scaleO(t.scaleX, t.scaleY)\r\n .skewO(t.skewX, t.skewY)\r\n .shearO(t.shear)\r\n .rotateO(t.theta)\r\n .translateO(ox, oy)\r\n\r\n // If we want the origin at a particular place, we force it there\r\n if (isFinite(t.px) || isFinite(t.py)) {\r\n const origin = new Point(ox, oy).transform(transformer)\r\n // TODO: Replace t.px with isFinite(t.px)\r\n const dx = t.px ? t.px - origin.x : 0\r\n const dy = t.py ? t.py - origin.y : 0\r\n transformer.translateO(dx, dy)\r\n }\r\n\r\n // Translate now after positioning\r\n transformer.translateO(t.tx, t.ty)\r\n return transformer\r\n }\r\n\r\n // Applies a matrix defined by its affine parameters\r\n compose (o) {\r\n if (o.origin) {\r\n o.originX = o.origin[0]\r\n o.originY = o.origin[1]\r\n }\r\n // Get the parameters\r\n var ox = o.originX || 0\r\n var oy = o.originY || 0\r\n var sx = o.scaleX || 1\r\n var sy = o.scaleY || 1\r\n var lam = o.shear || 0\r\n var theta = o.rotate || 0\r\n var tx = o.translateX || 0\r\n var ty = o.translateY || 0\r\n\r\n // Apply the standard matrix\r\n var result = new Matrix()\r\n .translateO(-ox, -oy)\r\n .scaleO(sx, sy)\r\n .shearO(lam)\r\n .rotateO(theta)\r\n .translateO(tx, ty)\r\n .lmultiplyO(this)\r\n .translateO(ox, oy)\r\n return result\r\n }\r\n\r\n // Decomposes this matrix into its affine parameters\r\n decompose (cx = 0, cy = 0) {\r\n // Get the parameters from the matrix\r\n var a = this.a\r\n var b = this.b\r\n var c = this.c\r\n var d = this.d\r\n var e = this.e\r\n var f = this.f\r\n\r\n // Figure out if the winding direction is clockwise or counterclockwise\r\n var determinant = a * d - b * c\r\n var ccw = determinant > 0 ? 1 : -1\r\n\r\n // Since we only shear in x, we can use the x basis to get the x scale\r\n // and the rotation of the resulting matrix\r\n var sx = ccw * Math.sqrt(a * a + b * b)\r\n var thetaRad = Math.atan2(ccw * b, ccw * a)\r\n var theta = 180 / Math.PI * thetaRad\r\n var ct = Math.cos(thetaRad)\r\n var st = Math.sin(thetaRad)\r\n\r\n // We can then solve the y basis vector simultaneously to get the other\r\n // two affine parameters directly from these parameters\r\n var lam = (a * c + b * d) / determinant\r\n var sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a))\r\n\r\n // Use the translations\r\n let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy)\r\n let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy)\r\n\r\n // Construct the decomposition and return it\r\n return {\r\n // Return the affine parameters\r\n scaleX: sx,\r\n scaleY: sy,\r\n shear: lam,\r\n rotate: theta,\r\n translateX: tx,\r\n translateY: ty,\r\n originX: cx,\r\n originY: cy,\r\n\r\n // Return the matrix parameters\r\n a: this.a,\r\n b: this.b,\r\n c: this.c,\r\n d: this.d,\r\n e: this.e,\r\n f: this.f\r\n }\r\n }\r\n\r\n // Left multiplies by the given matrix\r\n multiply (matrix) {\r\n return this.clone().multiplyO(matrix)\r\n }\r\n\r\n multiplyO (matrix) {\r\n // Get the matrices\r\n var l = this\r\n var r = matrix instanceof Matrix\r\n ? matrix\r\n : new Matrix(matrix)\r\n\r\n return Matrix.matrixMultiply(l, r, this)\r\n }\r\n\r\n lmultiply (matrix) {\r\n return this.clone().lmultiplyO(matrix)\r\n }\r\n\r\n lmultiplyO (matrix) {\r\n var r = this\r\n var l = matrix instanceof Matrix\r\n ? matrix\r\n : new Matrix(matrix)\r\n\r\n return Matrix.matrixMultiply(l, r, this)\r\n }\r\n\r\n // Inverses matrix\r\n inverseO () {\r\n // Get the current parameters out of the matrix\r\n var a = this.a\r\n var b = this.b\r\n var c = this.c\r\n var d = this.d\r\n var e = this.e\r\n var f = this.f\r\n\r\n // Invert the 2x2 matrix in the top left\r\n var det = a * d - b * c\r\n if (!det) throw new Error('Cannot invert ' + this)\r\n\r\n // Calculate the top 2x2 matrix\r\n var na = d / det\r\n var nb = -b / det\r\n var nc = -c / det\r\n var nd = a / det\r\n\r\n // Apply the inverted matrix to the top right\r\n var ne = -(na * e + nc * f)\r\n var nf = -(nb * e + nd * f)\r\n\r\n // Construct the inverted matrix\r\n this.a = na\r\n this.b = nb\r\n this.c = nc\r\n this.d = nd\r\n this.e = ne\r\n this.f = nf\r\n\r\n return this\r\n }\r\n\r\n inverse () {\r\n return this.clone().inverseO()\r\n }\r\n\r\n // Translate matrix\r\n translate (x, y) {\r\n return this.clone().translateO(x, y)\r\n }\r\n\r\n translateO (x, y) {\r\n this.e += x || 0\r\n this.f += y || 0\r\n return this\r\n }\r\n\r\n // Scale matrix\r\n scale (x, y, cx, cy) {\r\n return this.clone().scaleO(...arguments)\r\n }\r\n\r\n scaleO (x, y = x, cx = 0, cy = 0) {\r\n // Support uniform scaling\r\n if (arguments.length === 3) {\r\n cy = cx\r\n cx = y\r\n y = x\r\n }\r\n\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a * x\r\n this.b = b * y\r\n this.c = c * x\r\n this.d = d * y\r\n this.e = e * x - cx * x + cx\r\n this.f = f * y - cy * y + cy\r\n\r\n return this\r\n }\r\n\r\n // Rotate matrix\r\n rotate (r, cx, cy) {\r\n return this.clone().rotateO(r, cx, cy)\r\n }\r\n\r\n rotateO (r, cx = 0, cy = 0) {\r\n // Convert degrees to radians\r\n r = radians(r)\r\n\r\n let cos = Math.cos(r)\r\n let sin = Math.sin(r)\r\n\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a * cos - b * sin\r\n this.b = b * cos + a * sin\r\n this.c = c * cos - d * sin\r\n this.d = d * cos + c * sin\r\n this.e = e * cos - f * sin + cy * sin - cx * cos + cx\r\n this.f = f * cos + e * sin - cx * sin - cy * cos + cy\r\n\r\n return this\r\n }\r\n\r\n // Flip matrix on x or y, at a given offset\r\n flip (axis, around) {\r\n return this.clone().flipO(axis, around)\r\n }\r\n\r\n flipO (axis, around) {\r\n return axis === 'x' ? this.scaleO(-1, 1, around, 0)\r\n : axis === 'y' ? this.scaleO(1, -1, 0, around)\r\n : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point\r\n }\r\n\r\n // Shear matrix\r\n shear (a, cx, cy) {\r\n return this.clone().shearO(a, cx, cy)\r\n }\r\n\r\n shearO (lx, cx = 0, cy = 0) {\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a + b * lx\r\n this.c = c + d * lx\r\n this.e = e + f * lx - cy * lx\r\n\r\n return this\r\n }\r\n\r\n // Skew Matrix\r\n skew (x, y, cx, cy) {\r\n return this.clone().skewO(...arguments)\r\n }\r\n\r\n skewO (x, y = x, cx = 0, cy = 0) {\r\n // support uniformal skew\r\n if (arguments.length === 3) {\r\n cy = cx\r\n cx = y\r\n y = x\r\n }\r\n\r\n // Convert degrees to radians\r\n x = radians(x)\r\n y = radians(y)\r\n\r\n let lx = Math.tan(x)\r\n let ly = Math.tan(y)\r\n\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a + b * lx\r\n this.b = b + a * ly\r\n this.c = c + d * lx\r\n this.d = d + c * ly\r\n this.e = e + f * lx - cy * lx\r\n this.f = f + e * ly - cx * ly\r\n\r\n return this\r\n }\r\n\r\n // SkewX\r\n skewX (x, cx, cy) {\r\n return this.skew(x, 0, cx, cy)\r\n }\r\n\r\n skewXO (x, cx, cy) {\r\n return this.skewO(x, 0, cx, cy)\r\n }\r\n\r\n // SkewY\r\n skewY (y, cx, cy) {\r\n return this.skew(0, y, cx, cy)\r\n }\r\n\r\n skewYO (y, cx, cy) {\r\n return this.skewO(0, y, cx, cy)\r\n }\r\n\r\n // Transform around a center point\r\n aroundO (cx, cy, matrix) {\r\n var dx = cx || 0\r\n var dy = cy || 0\r\n return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)\r\n }\r\n\r\n around (cx, cy, matrix) {\r\n return this.clone().aroundO(cx, cy, matrix)\r\n }\r\n\r\n // Check if two matrices are equal\r\n equals (other) {\r\n var comp = new Matrix(other)\r\n return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) &&\r\n closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) &&\r\n closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f)\r\n }\r\n\r\n // Convert matrix to string\r\n toString () {\r\n return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'\r\n }\r\n\r\n toArray () {\r\n return [this.a, this.b, this.c, this.d, this.e, this.f]\r\n }\r\n\r\n valueOf () {\r\n return {\r\n a: this.a,\r\n b: this.b,\r\n c: this.c,\r\n d: this.d,\r\n e: this.e,\r\n f: this.f\r\n }\r\n }\r\n\r\n static fromArray (a) {\r\n return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }\r\n }\r\n\r\n static isMatrixLike (o) {\r\n return (\r\n o.a != null ||\r\n o.b != null ||\r\n o.c != null ||\r\n o.d != null ||\r\n o.e != null ||\r\n o.f != null\r\n )\r\n }\r\n\r\n static formatTransforms (o) {\r\n // Get all of the parameters required to form the matrix\r\n var flipBoth = o.flip === 'both' || o.flip === true\r\n var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1\r\n var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1\r\n var skewX = o.skew && o.skew.length ? o.skew[0]\r\n : isFinite(o.skew) ? o.skew\r\n : isFinite(o.skewX) ? o.skewX\r\n : 0\r\n var skewY = o.skew && o.skew.length ? o.skew[1]\r\n : isFinite(o.skew) ? o.skew\r\n : isFinite(o.skewY) ? o.skewY\r\n : 0\r\n var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX\r\n : isFinite(o.scale) ? o.scale * flipX\r\n : isFinite(o.scaleX) ? o.scaleX * flipX\r\n : flipX\r\n var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY\r\n : isFinite(o.scale) ? o.scale * flipY\r\n : isFinite(o.scaleY) ? o.scaleY * flipY\r\n : flipY\r\n var shear = o.shear || 0\r\n var theta = o.rotate || o.theta || 0\r\n var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY)\r\n var ox = origin.x\r\n var oy = origin.y\r\n var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY)\r\n var px = position.x\r\n var py = position.y\r\n var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY)\r\n var tx = translate.x\r\n var ty = translate.y\r\n var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY)\r\n var rx = relative.x\r\n var ry = relative.y\r\n\r\n // Populate all of the values\r\n return {\r\n scaleX, scaleY, skewX, skewY, shear, theta, rx, ry, tx, ty, ox, oy, px, py\r\n }\r\n }\r\n\r\n // left matrix, right matrix, target matrix which is overwritten\r\n static matrixMultiply (l, r, o) {\r\n // Work out the product directly\r\n var a = l.a * r.a + l.c * r.b\r\n var b = l.b * r.a + l.d * r.b\r\n var c = l.a * r.c + l.c * r.d\r\n var d = l.b * r.c + l.d * r.d\r\n var e = l.e + l.a * r.e + l.c * r.f\r\n var f = l.f + l.b * r.e + l.d * r.f\r\n\r\n // make sure to use local variables because l/r and o could be the same\r\n o.a = a\r\n o.b = b\r\n o.c = c\r\n o.d = d\r\n o.e = e\r\n o.f = f\r\n\r\n return o\r\n }\r\n}\r\n\r\nexport function ctm () {\r\n return new Matrix(this.node.getCTM())\r\n}\r\n\r\nexport function screenCTM () {\r\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537\r\n This is needed because FF does not return the transformation matrix\r\n for the inner coordinate system when getScreenCTM() is called on nested svgs.\r\n However all other Browsers do that */\r\n if (typeof this.isRoot === 'function' && !this.isRoot()) {\r\n var rect = this.rect(1, 1)\r\n var m = rect.node.getScreenCTM()\r\n rect.remove()\r\n return new Matrix(m)\r\n }\r\n return new Matrix(this.node.getScreenCTM())\r\n}\r\n","/* eslint no-new-func: \"off\" */\r\nexport const subClassArray = (function () {\r\n try {\r\n // try es6 subclassing\r\n return Function('name', 'baseClass', '_constructor', [\r\n 'baseClass = baseClass || Array',\r\n 'return {',\r\n ' [name]: class extends baseClass {',\r\n ' constructor (...args) {',\r\n ' super(...args)',\r\n ' _constructor && _constructor.apply(this, args)',\r\n ' }',\r\n ' }',\r\n '}[name]'\r\n ].join('\\n'))\r\n } catch (e) {\r\n // Use es5 approach\r\n return (name, baseClass = Array, _constructor) => {\r\n const Arr = function () {\r\n baseClass.apply(this, arguments)\r\n _constructor && _constructor.apply(this, arguments)\r\n }\r\n\r\n Arr.prototype = Object.create(baseClass.prototype)\r\n Arr.prototype.constructor = Arr\r\n\r\n Arr.prototype.map = function (fn) {\r\n const arr = new Arr()\r\n arr.push.apply(arr, Array.prototype.map.call(this, fn))\r\n return arr\r\n }\r\n\r\n return Arr\r\n }\r\n }\r\n})()\r\n","import { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\n\r\nconst List = subClassArray('List', Array, function (arr = []) {\r\n // This catches the case, that native map tries to create an array with new Array(1)\r\n if (typeof arr === 'number') return this\r\n this.length = 0\r\n this.push(...arr)\r\n})\r\n\r\nexport default List\r\n\r\nextend(List, {\r\n each (fnOrMethodName, ...args) {\r\n if (typeof fnOrMethodName === 'function') {\r\n this.forEach((el) => { fnOrMethodName.call(el, el) })\r\n } else {\r\n return this.map(el => { return el[fnOrMethodName](...args) })\r\n }\r\n\r\n return this\r\n },\r\n\r\n toArray () {\r\n return Array.prototype.concat.apply([], this)\r\n }\r\n})\r\n\r\nList.extend = function (methods) {\r\n methods = methods.reduce((obj, name) => {\r\n obj[name] = function (...attrs) {\r\n return this.each(name, ...attrs)\r\n }\r\n return obj\r\n }, {})\r\n\r\n extend(List, methods)\r\n}\r\n","import { adopt } from '../../utils/adopter.js'\r\nimport { globals } from '../../utils/window.js'\r\nimport { map } from '../../utils/utils.js'\r\nimport List from '../../types/List.js'\r\n\r\nexport default function baseFind (query, parent) {\r\n return new List(map((parent || globals.document).querySelectorAll(query), function (node) {\r\n return adopt(node)\r\n }))\r\n}\r\n\r\n// Scoped find method\r\nexport function find (query) {\r\n return baseFind(query, this.node)\r\n}\r\n","import { dispatch, off, on } from '../modules/core/event.js'\r\nimport Base from './Base.js'\r\n\r\nexport default class EventTarget extends Base {\r\n constructor ({ events = {} } = {}) {\r\n super()\r\n this.events = events\r\n }\r\n\r\n addEventListener () {}\r\n\r\n dispatch (event, data) {\r\n return dispatch(this, event, data)\r\n }\r\n\r\n dispatchEvent (event) {\r\n const bag = this.getEventHolder().events\r\n if (!bag) return true\r\n\r\n const events = bag[event.type]\r\n\r\n for (let i in events) {\r\n for (let j in events[i]) {\r\n events[i][j](event)\r\n }\r\n }\r\n\r\n return !event.defaultPrevented\r\n }\r\n\r\n // Fire given event\r\n fire (event, data) {\r\n this.dispatch(event, data)\r\n return this\r\n }\r\n\r\n getEventHolder () {\r\n return this\r\n }\r\n\r\n getEventTarget () {\r\n return this\r\n }\r\n\r\n // Unbind event from listener\r\n off (event, listener) {\r\n off(this, event, listener)\r\n return this\r\n }\r\n\r\n // Bind given event to listener\r\n on (event, listener, binding, options) {\r\n on(this, event, listener, binding, options)\r\n return this\r\n }\r\n\r\n removeEventListener () {}\r\n}\r\n","\r\nexport function noop () {}\r\n\r\n// Default animation values\r\nexport let timeline = {\r\n duration: 400,\r\n ease: '>',\r\n delay: 0\r\n}\r\n\r\n// Default attribute values\r\nexport let attrs = {\r\n\r\n // fill and stroke\r\n 'fill-opacity': 1,\r\n 'stroke-opacity': 1,\r\n 'stroke-width': 0,\r\n 'stroke-linejoin': 'miter',\r\n 'stroke-linecap': 'butt',\r\n fill: '#000000',\r\n stroke: '#000000',\r\n opacity: 1,\r\n\r\n // position\r\n x: 0,\r\n y: 0,\r\n cx: 0,\r\n cy: 0,\r\n\r\n // size\r\n width: 0,\r\n height: 0,\r\n\r\n // radius\r\n r: 0,\r\n rx: 0,\r\n ry: 0,\r\n\r\n // gradient\r\n offset: 0,\r\n 'stop-opacity': 1,\r\n 'stop-color': '#000000',\r\n\r\n // text\r\n 'font-size': 16,\r\n 'font-family': 'Helvetica, Arial, sans-serif',\r\n 'text-anchor': 'start'\r\n}\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\n\r\nconst SVGArray = subClassArray('SVGArray', Array, function (arr) {\r\n this.init(arr)\r\n})\r\n\r\nexport default SVGArray\r\n\r\nextend(SVGArray, {\r\n init (arr) {\r\n // This catches the case, that native map tries to create an array with new Array(1)\r\n if (typeof arr === 'number') return this\r\n this.length = 0\r\n this.push(...this.parse(arr))\r\n return this\r\n },\r\n\r\n toArray () {\r\n return Array.prototype.concat.apply([], this)\r\n },\r\n\r\n toString () {\r\n return this.join(' ')\r\n },\r\n\r\n // Flattens the array if needed\r\n valueOf () {\r\n const ret = []\r\n ret.push(...this)\r\n return ret\r\n },\r\n\r\n // Parse whitespace separated string\r\n parse (array = []) {\r\n // If already is an array, no need to parse it\r\n if (array instanceof Array) return array\r\n\r\n return array.trim().split(delimiter).map(parseFloat)\r\n },\r\n\r\n clone () {\r\n return new this.constructor(this)\r\n },\r\n\r\n toSet () {\r\n return new Set(this)\r\n }\r\n})\r\n","import { numberAndUnit } from '../modules/core/regex.js'\r\n\r\n// Module for unit convertions\r\nexport default class SVGNumber {\r\n // Initialize\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (value, unit) {\r\n unit = Array.isArray(value) ? value[1] : unit\r\n value = Array.isArray(value) ? value[0] : value\r\n\r\n // initialize defaults\r\n this.value = 0\r\n this.unit = unit || ''\r\n\r\n // parse value\r\n if (typeof value === 'number') {\r\n // ensure a valid numeric value\r\n this.value = isNaN(value) ? 0 : !isFinite(value) ? (value < 0 ? -3.4e+38 : +3.4e+38) : value\r\n } else if (typeof value === 'string') {\r\n unit = value.match(numberAndUnit)\r\n\r\n if (unit) {\r\n // make value numeric\r\n this.value = parseFloat(unit[1])\r\n\r\n // normalize\r\n if (unit[5] === '%') { this.value /= 100 } else if (unit[5] === 's') {\r\n this.value *= 1000\r\n }\r\n\r\n // store unit\r\n this.unit = unit[5]\r\n }\r\n } else {\r\n if (value instanceof SVGNumber) {\r\n this.value = value.valueOf()\r\n this.unit = value.unit\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n toString () {\r\n return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6\r\n : this.unit === 's' ? this.value / 1e3\r\n : this.value\r\n ) + this.unit\r\n }\r\n\r\n toJSON () {\r\n return this.toString()\r\n }\r\n\r\n toArray () {\r\n return [this.value, this.unit]\r\n }\r\n\r\n valueOf () {\r\n return this.value\r\n }\r\n\r\n // Add number\r\n plus (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this + number, this.unit || number.unit)\r\n }\r\n\r\n // Subtract number\r\n minus (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this - number, this.unit || number.unit)\r\n }\r\n\r\n // Multiply number\r\n times (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this * number, this.unit || number.unit)\r\n }\r\n\r\n // Divide number\r\n divide (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this / number, this.unit || number.unit)\r\n }\r\n}\r\n","import { attrs as defaults } from './defaults.js'\r\nimport { isNumber } from './regex.js'\r\nimport Color from '../../types/Color.js'\r\nimport SVGArray from '../../types/SVGArray.js'\r\nimport SVGNumber from '../../types/SVGNumber.js'\r\n\r\nconst hooks = []\r\nexport function registerAttrHook (fn) {\r\n hooks.push(fn)\r\n}\r\n\r\n// Set svg element attribute\r\nexport default function attr (attr, val, ns) {\r\n // act as full getter\r\n if (attr == null) {\r\n // get an object of attributes\r\n attr = {}\r\n val = this.node.attributes\r\n\r\n for (let node of val) {\r\n attr[node.nodeName] = isNumber.test(node.nodeValue)\r\n ? parseFloat(node.nodeValue)\r\n : node.nodeValue\r\n }\r\n\r\n return attr\r\n } else if (attr instanceof Array) {\r\n // loop through array and get all values\r\n return attr.reduce((last, curr) => {\r\n last[curr] = this.attr(curr)\r\n return last\r\n }, {})\r\n } else if (typeof attr === 'object') {\r\n // apply every attribute individually if an object is passed\r\n for (val in attr) this.attr(val, attr[val])\r\n } else if (val === null) {\r\n // remove value\r\n this.node.removeAttribute(attr)\r\n } else if (val == null) {\r\n // act as a getter if the first and only argument is not an object\r\n val = this.node.getAttribute(attr)\r\n return val == null ? defaults[attr]\r\n : isNumber.test(val) ? parseFloat(val)\r\n : val\r\n } else {\r\n // Loop through hooks and execute them to convert value\r\n val = hooks.reduce((_val, hook) => {\r\n return hook(attr, _val, this)\r\n }, val)\r\n\r\n // ensure correct numeric values (also accepts NaN and Infinity)\r\n if (typeof val === 'number') {\r\n val = new SVGNumber(val)\r\n } else if (Color.isColor(val)) {\r\n // ensure full hex color\r\n val = new Color(val)\r\n } else if (val.constructor === Array) {\r\n // Check for plain arrays and parse array values\r\n val = new SVGArray(val)\r\n }\r\n\r\n // if the passed attribute is leading...\r\n if (attr === 'leading') {\r\n // ... call the leading method instead\r\n if (this.leading) {\r\n this.leading(val)\r\n }\r\n } else {\r\n // set given attribute on node\r\n typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString())\r\n : this.node.setAttribute(attr, val.toString())\r\n }\r\n\r\n // rebuild if required\r\n if (this.rebuild && (attr === 'font-size' || attr === 'x')) {\r\n this.rebuild()\r\n }\r\n }\r\n\r\n return this\r\n}\r\n","import {\r\n adopt,\r\n assignNewId,\r\n eid,\r\n extend,\r\n makeInstance,\r\n makeNode,\r\n register\r\n} from '../utils/adopter.js'\r\nimport { find } from '../modules/core/selector.js'\r\nimport { globals } from '../utils/window.js'\r\nimport { map } from '../utils/utils.js'\r\nimport { ns } from '../modules/core/namespaces.js'\r\nimport EventTarget from '../types/EventTarget.js'\r\nimport List from '../types/List.js'\r\nimport attr from '../modules/core/attr.js'\r\n\r\nexport default class Dom extends EventTarget {\r\n constructor (node, attrs) {\r\n super(node)\r\n this.node = node\r\n this.type = node.nodeName\r\n\r\n if (attrs && node !== attrs) {\r\n this.attr(attrs)\r\n }\r\n }\r\n\r\n // Add given element at a position\r\n add (element, i) {\r\n element = makeInstance(element)\r\n\r\n if (i == null) {\r\n this.node.appendChild(element.node)\r\n } else if (element.node !== this.node.childNodes[i]) {\r\n this.node.insertBefore(element.node, this.node.childNodes[i])\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Add element to given container and return self\r\n addTo (parent) {\r\n return makeInstance(parent).put(this)\r\n }\r\n\r\n // Returns all child elements\r\n children () {\r\n return new List(map(this.node.children, function (node) {\r\n return adopt(node)\r\n }))\r\n }\r\n\r\n // Remove all elements in this container\r\n clear () {\r\n // remove children\r\n while (this.node.hasChildNodes()) {\r\n this.node.removeChild(this.node.lastChild)\r\n }\r\n\r\n // remove defs reference\r\n delete this._defs\r\n\r\n return this\r\n }\r\n\r\n // Clone element\r\n clone () {\r\n // write dom data to the dom so the clone can pickup the data\r\n this.writeDataToDom()\r\n\r\n // clone element and assign new id\r\n return assignNewId(this.node.cloneNode(true))\r\n }\r\n\r\n // Iterates over all children and invokes a given block\r\n each (block, deep) {\r\n var children = this.children()\r\n var i, il\r\n\r\n for (i = 0, il = children.length; i < il; i++) {\r\n block.apply(children[i], [i, children])\r\n\r\n if (deep) {\r\n children[i].each(block, deep)\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n element (nodeName) {\r\n return this.put(new Dom(makeNode(nodeName)))\r\n }\r\n\r\n // Get first child\r\n first () {\r\n return adopt(this.node.firstChild)\r\n }\r\n\r\n // Get a element at the given index\r\n get (i) {\r\n return adopt(this.node.childNodes[i])\r\n }\r\n\r\n getEventHolder () {\r\n return this.node\r\n }\r\n\r\n getEventTarget () {\r\n return this.node\r\n }\r\n\r\n // Checks if the given element is a child\r\n has (element) {\r\n return this.index(element) >= 0\r\n }\r\n\r\n // Get / set id\r\n id (id) {\r\n // generate new id if no id set\r\n if (typeof id === 'undefined' && !this.node.id) {\r\n this.node.id = eid(this.type)\r\n }\r\n\r\n // dont't set directly width this.node.id to make `null` work correctly\r\n return this.attr('id', id)\r\n }\r\n\r\n // Gets index of given element\r\n index (element) {\r\n return [].slice.call(this.node.childNodes).indexOf(element.node)\r\n }\r\n\r\n // Get the last child\r\n last () {\r\n return adopt(this.node.lastChild)\r\n }\r\n\r\n // matches the element vs a css selector\r\n matches (selector) {\r\n const el = this.node\r\n return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector)\r\n }\r\n\r\n // Returns the parent element instance\r\n parent (type) {\r\n var parent = this\r\n\r\n // check for parent\r\n if (!parent.node.parentNode) return null\r\n\r\n // get parent element\r\n parent = adopt(parent.node.parentNode)\r\n\r\n if (!type) return parent\r\n\r\n // loop trough ancestors if type is given\r\n while (parent && parent.node instanceof globals.window.SVGElement) { // FIXME: That shouldnt be neccessary\r\n if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent\r\n parent = adopt(parent.node.parentNode)\r\n }\r\n }\r\n\r\n // Basically does the same as `add()` but returns the added element instead\r\n put (element, i) {\r\n this.add(element, i)\r\n return element\r\n }\r\n\r\n // Add element to given container and return container\r\n putIn (parent) {\r\n return makeInstance(parent).add(this)\r\n }\r\n\r\n // Remove element\r\n remove () {\r\n if (this.parent()) {\r\n this.parent().removeElement(this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Remove a given child\r\n removeElement (element) {\r\n this.node.removeChild(element.node)\r\n\r\n return this\r\n }\r\n\r\n // Replace this with element\r\n replace (element) {\r\n element = makeInstance(element)\r\n this.node.parentNode.replaceChild(element.node, this.node)\r\n return element\r\n }\r\n\r\n round (precision = 2, map) {\r\n const factor = 10 ** precision\r\n const attrs = this.attr()\r\n\r\n // If we have no map, build one from attrs\r\n if (!map) {\r\n map = Object.keys(attrs)\r\n }\r\n\r\n // Holds rounded attributes\r\n const newAttrs = {}\r\n map.forEach((key) => {\r\n newAttrs[key] = Math.round(attrs[key] * factor) / factor\r\n })\r\n\r\n this.attr(newAttrs)\r\n return this\r\n }\r\n\r\n // Return id on string conversion\r\n toString () {\r\n return this.id()\r\n }\r\n\r\n // Import raw svg\r\n svg (svgOrFn, outerHTML) {\r\n var well, len, fragment\r\n\r\n if (svgOrFn === false) {\r\n outerHTML = false\r\n svgOrFn = null\r\n }\r\n\r\n // act as getter if no svg string is given\r\n if (svgOrFn == null || typeof svgOrFn === 'function') {\r\n // The default for exports is, that the outerNode is included\r\n outerHTML = outerHTML == null ? true : outerHTML\r\n\r\n // write svgjs data to the dom\r\n this.writeDataToDom()\r\n let current = this\r\n\r\n // An export modifier was passed\r\n if (svgOrFn != null) {\r\n current = adopt(current.node.cloneNode(true))\r\n\r\n // If the user wants outerHTML we need to process this node, too\r\n if (outerHTML) {\r\n let result = svgOrFn(current)\r\n current = result || current\r\n\r\n // The user does not want this node? Well, then he gets nothing\r\n if (result === false) return ''\r\n }\r\n\r\n // Deep loop through all children and apply modifier\r\n current.each(function () {\r\n let result = svgOrFn(this)\r\n let _this = result || this\r\n\r\n // If modifier returns false, discard node\r\n if (result === false) {\r\n this.remove()\r\n\r\n // If modifier returns new node, use it\r\n } else if (result && this !== _this) {\r\n this.replace(_this)\r\n }\r\n }, true)\r\n }\r\n\r\n // Return outer or inner content\r\n return outerHTML\r\n ? current.node.outerHTML\r\n : current.node.innerHTML\r\n }\r\n\r\n // Act as setter if we got a string\r\n\r\n // The default for import is, that the current node is not replaced\r\n outerHTML = outerHTML == null ? false : outerHTML\r\n\r\n // Create temporary holder\r\n well = globals.document.createElementNS(ns, 'svg')\r\n fragment = globals.document.createDocumentFragment()\r\n\r\n // Dump raw svg\r\n well.innerHTML = svgOrFn\r\n\r\n // Transplant nodes into the fragment\r\n for (len = well.children.length; len--;) {\r\n fragment.appendChild(well.firstElementChild)\r\n }\r\n\r\n let parent = this.parent()\r\n\r\n // Add the whole fragment at once\r\n return outerHTML\r\n ? this.replace(fragment) && parent\r\n : this.add(fragment)\r\n }\r\n\r\n words (text) {\r\n // This is faster than removing all children and adding a new one\r\n this.node.textContent = text\r\n return this\r\n }\r\n\r\n // write svgjs data to the dom\r\n writeDataToDom () {\r\n // dump variables recursively\r\n this.each(function () {\r\n this.writeDataToDom()\r\n })\r\n\r\n return this\r\n }\r\n}\r\n\r\nextend(Dom, { attr, find })\r\nregister(Dom)\r\n","import { bbox, rbox } from '../types/Box.js'\r\nimport { ctm, screenCTM } from '../types/Matrix.js'\r\nimport {\r\n extend,\r\n getClass,\r\n makeInstance,\r\n register,\r\n root\r\n} from '../utils/adopter.js'\r\nimport { globals } from '../utils/window.js'\r\nimport { point } from '../types/Point.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { reference } from '../modules/core/regex.js'\r\nimport Dom from './Dom.js'\r\nimport List from '../types/List.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\n\r\nconst Svg = getClass(root)\r\n\r\nexport default class Element extends Dom {\r\n constructor (node, attrs) {\r\n super(node, attrs)\r\n\r\n // initialize data object\r\n this.dom = {}\r\n\r\n // create circular reference\r\n this.node.instance = this\r\n\r\n if (node.hasAttribute('svgjs:data')) {\r\n // pull svgjs data from the dom (getAttributeNS doesn't work in html5)\r\n this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {})\r\n }\r\n }\r\n\r\n // Move element by its center\r\n center (x, y) {\r\n return this.cx(x).cy(y)\r\n }\r\n\r\n // Move by center over x-axis\r\n cx (x) {\r\n return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2)\r\n }\r\n\r\n // Move by center over y-axis\r\n cy (y) {\r\n return y == null\r\n ? this.y() + this.height() / 2\r\n : this.y(y - this.height() / 2)\r\n }\r\n\r\n // Get defs\r\n defs () {\r\n return this.root().defs()\r\n }\r\n\r\n // Get parent document\r\n root () {\r\n let p = this.parent(Svg)\r\n return p && p.root()\r\n }\r\n\r\n getEventHolder () {\r\n return this\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return this.attr('height', height)\r\n }\r\n\r\n // Checks whether the given point inside the bounding box of the element\r\n inside (x, y) {\r\n let box = this.bbox()\r\n\r\n return x > box.x &&\r\n y > box.y &&\r\n x < box.x + box.width &&\r\n y < box.y + box.height\r\n }\r\n\r\n // Move element to given x and y values\r\n move (x, y) {\r\n return this.x(x).y(y)\r\n }\r\n\r\n // return array of all ancestors of given type up to the root svg\r\n parents (until = globals.document) {\r\n until = makeInstance(until)\r\n let parents = new List()\r\n let parent = this\r\n\r\n while (\r\n (parent = parent.parent()) &&\r\n parent.node !== until.node &&\r\n parent.node !== globals.document\r\n ) {\r\n parents.push(parent)\r\n }\r\n\r\n return parents\r\n }\r\n\r\n // Get referenced element form attribute value\r\n reference (attr) {\r\n attr = this.attr(attr)\r\n if (!attr) return null\r\n\r\n const m = attr.match(reference)\r\n return m ? makeInstance(m[1]) : null\r\n }\r\n\r\n // set given data to the elements data property\r\n setData (o) {\r\n this.dom = o\r\n return this\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n let p = proportionalSize(this, width, height)\r\n\r\n return this\r\n .width(new SVGNumber(p.width))\r\n .height(new SVGNumber(p.height))\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return this.attr('width', width)\r\n }\r\n\r\n // write svgjs data to the dom\r\n writeDataToDom () {\r\n // remove previously set data\r\n this.node.removeAttribute('svgjs:data')\r\n\r\n if (Object.keys(this.dom).length) {\r\n this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)) // see #428\r\n }\r\n\r\n return super.writeDataToDom()\r\n }\r\n\r\n // Move over x-axis\r\n x (x) {\r\n return this.attr('x', x)\r\n }\r\n\r\n // Move over y-axis\r\n y (y) {\r\n return this.attr('y', y)\r\n }\r\n}\r\n\r\nextend(Element, {\r\n bbox, rbox, point, ctm, screenCTM\r\n})\r\n\r\nregister(Element)\r\n","import { on, off } from '../core/event.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\nimport Color from '../../types/Color.js'\r\nimport Element from '../../elements/Element.js'\r\nimport Matrix from '../../types/Matrix.js'\r\nimport Point from '../../types/Point.js'\r\nimport SVGNumber from '../../types/SVGNumber.js'\r\n\r\n// Define list of available attributes for stroke and fill\r\nvar sugar = {\r\n stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'],\r\n fill: ['color', 'opacity', 'rule'],\r\n prefix: function (t, a) {\r\n return a === 'color' ? t : t + '-' + a\r\n }\r\n}\r\n\r\n// Add sugar for fill and stroke\r\n;['fill', 'stroke'].forEach(function (m) {\r\n var extension = {}\r\n var i\r\n\r\n extension[m] = function (o) {\r\n if (typeof o === 'undefined') {\r\n return this.attr(m)\r\n }\r\n if (typeof o === 'string' || Color.isRgb(o) || (o instanceof Element)) {\r\n this.attr(m, o)\r\n } else {\r\n // set all attributes from sugar.fill and sugar.stroke list\r\n for (i = sugar[m].length - 1; i >= 0; i--) {\r\n if (o[sugar[m][i]] != null) {\r\n this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]])\r\n }\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n registerMethods(['Shape', 'Runner'], extension)\r\n})\r\n\r\nregisterMethods(['Element', 'Runner'], {\r\n // Let the user set the matrix directly\r\n matrix: function (mat, b, c, d, e, f) {\r\n // Act as a getter\r\n if (mat == null) {\r\n return new Matrix(this)\r\n }\r\n\r\n // Act as a setter, the user can pass a matrix or a set of numbers\r\n return this.attr('transform', new Matrix(mat, b, c, d, e, f))\r\n },\r\n\r\n // Map rotation to transform\r\n rotate: function (angle, cx, cy) {\r\n return this.transform({ rotate: angle, ox: cx, oy: cy }, true)\r\n },\r\n\r\n // Map skew to transform\r\n skew: function (x, y, cx, cy) {\r\n return arguments.length === 1 || arguments.length === 3\r\n ? this.transform({ skew: x, ox: y, oy: cx }, true)\r\n : this.transform({ skew: [x, y], ox: cx, oy: cy }, true)\r\n },\r\n\r\n shear: function (lam, cx, cy) {\r\n return this.transform({ shear: lam, ox: cx, oy: cy }, true)\r\n },\r\n\r\n // Map scale to transform\r\n scale: function (x, y, cx, cy) {\r\n return arguments.length === 1 || arguments.length === 3\r\n ? this.transform({ scale: x, ox: y, oy: cx }, true)\r\n : this.transform({ scale: [x, y], ox: cx, oy: cy }, true)\r\n },\r\n\r\n // Map translate to transform\r\n translate: function (x, y) {\r\n return this.transform({ translate: [x, y] }, true)\r\n },\r\n\r\n // Map relative translations to transform\r\n relative: function (x, y) {\r\n return this.transform({ relative: [x, y] }, true)\r\n },\r\n\r\n // Map flip to transform\r\n flip: function (direction, around) {\r\n var directionString = typeof direction === 'string' ? direction\r\n : isFinite(direction) ? 'both'\r\n : 'both'\r\n var origin = (direction === 'both' && isFinite(around)) ? [around, around]\r\n : (direction === 'x') ? [around, 0]\r\n : (direction === 'y') ? [0, around]\r\n : isFinite(direction) ? [direction, direction]\r\n : [0, 0]\r\n this.transform({ flip: directionString, origin: origin }, true)\r\n },\r\n\r\n // Opacity\r\n opacity: function (value) {\r\n return this.attr('opacity', value)\r\n },\r\n\r\n // Relative move over x and y axes\r\n dmove: function (x, y) {\r\n return this.dx(x).dy(y)\r\n }\r\n})\r\n\r\nregisterMethods('Element', {\r\n // Relative move over x axis\r\n dx: function (x) {\r\n return this.x(new SVGNumber(x).plus(this.x()))\r\n },\r\n\r\n // Relative move over y axis\r\n dy: function (y) {\r\n return this.y(new SVGNumber(y).plus(this.y()))\r\n }\r\n})\r\n\r\nregisterMethods('radius', {\r\n // Add x and y radius\r\n radius: function (x, y) {\r\n var type = (this._element || this).type\r\n return type === 'radialGradient' || type === 'radialGradient'\r\n ? this.attr('r', new SVGNumber(x))\r\n : this.rx(x).ry(y == null ? x : y)\r\n }\r\n})\r\n\r\nregisterMethods('Path', {\r\n // Get path length\r\n length: function () {\r\n return this.node.getTotalLength()\r\n },\r\n // Get point at length\r\n pointAt: function (length) {\r\n return new Point(this.node.getPointAtLength(length))\r\n }\r\n})\r\n\r\nregisterMethods(['Element', 'Runner'], {\r\n // Set font\r\n font: function (a, v) {\r\n if (typeof a === 'object') {\r\n for (v in a) this.font(v, a[v])\r\n }\r\n\r\n return a === 'leading'\r\n ? this.leading(v)\r\n : a === 'anchor'\r\n ? this.attr('text-anchor', v)\r\n : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style'\r\n ? this.attr('font-' + a, v)\r\n : this.attr(a, v)\r\n }\r\n})\r\n\r\nregisterMethods('Text', {\r\n ax (x) {\r\n return this.attr('x', x)\r\n },\r\n ay (y) {\r\n return this.attr('y', y)\r\n },\r\n amove (x, y) {\r\n return this.ax(x).ay(y)\r\n }\r\n})\r\n\r\n// Add events to elements\r\nconst methods = [ 'click',\r\n 'dblclick',\r\n 'mousedown',\r\n 'mouseup',\r\n 'mouseover',\r\n 'mouseout',\r\n 'mousemove',\r\n 'mouseenter',\r\n 'mouseleave',\r\n 'touchstart',\r\n 'touchmove',\r\n 'touchleave',\r\n 'touchend',\r\n 'touchcancel' ].reduce(function (last, event) {\r\n // add event to Element\r\n const fn = function (f) {\r\n if (f === null) {\r\n off(this, event)\r\n } else {\r\n on(this, event, f)\r\n }\r\n return this\r\n }\r\n\r\n last[event] = fn\r\n return last\r\n}, {})\r\n\r\nregisterMethods('Element', methods)\r\n","import defineProperty from \"./defineProperty\";\nexport default function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import SVGNumber from '../../types/SVGNumber.js'\r\n\r\n// Radius x value\r\nexport function rx (rx) {\r\n return this.attr('rx', rx)\r\n}\r\n\r\n// Radius y value\r\nexport function ry (ry) {\r\n return this.attr('ry', ry)\r\n}\r\n\r\n// Move over x-axis\r\nexport function x (x) {\r\n return x == null\r\n ? this.cx() - this.rx()\r\n : this.cx(x + this.rx())\r\n}\r\n\r\n// Move over y-axis\r\nexport function y (y) {\r\n return y == null\r\n ? this.cy() - this.ry()\r\n : this.cy(y + this.ry())\r\n}\r\n\r\n// Move by center over x-axis\r\nexport function cx (x) {\r\n return x == null\r\n ? this.attr('cx')\r\n : this.attr('cx', x)\r\n}\r\n\r\n// Move by center over y-axis\r\nexport function cy (y) {\r\n return y == null\r\n ? this.attr('cy')\r\n : this.attr('cy', y)\r\n}\r\n\r\n// Set width of element\r\nexport function width (width) {\r\n return width == null\r\n ? this.rx() * 2\r\n : this.rx(new SVGNumber(width).divide(2))\r\n}\r\n\r\n// Set height of element\r\nexport function height (height) {\r\n return height == null\r\n ? this.ry() * 2\r\n : this.ry(new SVGNumber(height).divide(2))\r\n}\r\n","import { getOrigin } from '../../utils/utils.js'\r\nimport { delimiter, transforms } from '../core/regex.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\nimport Matrix from '../../types/Matrix.js'\r\n\r\n// Reset all transformations\r\nexport function untransform () {\r\n return this.attr('transform', null)\r\n}\r\n\r\n// merge the whole transformation chain into one matrix and returns it\r\nexport function matrixify () {\r\n var matrix = (this.attr('transform') || '')\r\n // split transformations\r\n .split(transforms).slice(0, -1).map(function (str) {\r\n // generate key => value pairs\r\n var kv = str.trim().split('(')\r\n return [kv[0],\r\n kv[1].split(delimiter)\r\n .map(function (str) { return parseFloat(str) })\r\n ]\r\n })\r\n .reverse()\r\n // merge every transformation into one matrix\r\n .reduce(function (matrix, transform) {\r\n if (transform[0] === 'matrix') {\r\n return matrix.lmultiply(Matrix.fromArray(transform[1]))\r\n }\r\n return matrix[transform[0]].apply(matrix, transform[1])\r\n }, new Matrix())\r\n\r\n return matrix\r\n}\r\n\r\n// add an element to another parent without changing the visual representation on the screen\r\nexport function toParent (parent) {\r\n if (this === parent) return this\r\n var ctm = this.screenCTM()\r\n var pCtm = parent.screenCTM().inverse()\r\n\r\n this.addTo(parent).untransform().transform(pCtm.multiply(ctm))\r\n\r\n return this\r\n}\r\n\r\n// same as above with parent equals root-svg\r\nexport function toRoot () {\r\n return this.toParent(this.root())\r\n}\r\n\r\n// Add transformations\r\nexport function transform (o, relative) {\r\n // Act as a getter if no object was passed\r\n if (o == null || typeof o === 'string') {\r\n var decomposed = new Matrix(this).decompose()\r\n return decomposed[o] || decomposed\r\n }\r\n\r\n if (!Matrix.isMatrixLike(o)) {\r\n // Set the origin according to the defined transform\r\n o = { ...o, origin: getOrigin(o, this) }\r\n }\r\n\r\n // The user can pass a boolean, an Element or an Matrix or nothing\r\n var cleanRelative = relative === true ? this : (relative || false)\r\n var result = new Matrix(cleanRelative).transform(o)\r\n return this.attr('transform', result)\r\n}\r\n\r\nregisterMethods('Element', {\r\n untransform, matrixify, toParent, toRoot, transform\r\n})\r\n","import { register } from '../utils/adopter.js'\r\nimport Element from './Element.js'\r\n\r\nexport default class Shape extends Element {}\r\n\r\nregister(Shape)\r\n","import { cx, cy, height, width, x, y } from '../modules/core/circled.js'\r\nimport {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Shape from './Shape.js'\r\n\r\nexport default class Circle extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('circle', node), node)\r\n }\r\n\r\n radius (r) {\r\n return this.attr('r', r)\r\n }\r\n\r\n // Radius x value\r\n rx (rx) {\r\n return this.attr('r', rx)\r\n }\r\n\r\n // Alias radius x value\r\n ry (ry) {\r\n return this.rx(ry)\r\n }\r\n\r\n size (size) {\r\n return this.radius(new SVGNumber(size).divide(2))\r\n }\r\n}\r\n\r\nextend(Circle, { x, y, cx, cy, width, height })\r\n\r\nregisterMethods({\r\n Element: {\r\n // Create circle element\r\n circle: wrapWithAttrCheck(function (size) {\r\n return this.put(new Circle())\r\n .size(size)\r\n .move(0, 0)\r\n })\r\n }\r\n})\r\n\r\nregister(Circle)\r\n","import { register } from '../utils/adopter.js'\r\nimport Element from './Element.js'\r\n\r\nexport default class Container extends Element {\r\n flatten (parent) {\r\n this.each(function () {\r\n if (this instanceof Container) return this.flatten(parent).ungroup(parent)\r\n return this.toParent(parent)\r\n })\r\n\r\n // we need this so that the root does not get removed\r\n this.node.firstElementChild || this.remove()\r\n\r\n return this\r\n }\r\n\r\n ungroup (parent) {\r\n parent = parent || this.parent()\r\n\r\n this.each(function () {\r\n return this.toParent(parent)\r\n })\r\n\r\n this.remove()\r\n\r\n return this\r\n }\r\n}\r\n\r\nregister(Container)\r\n","import { nodeOrNew, register } from '../utils/adopter.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class Defs extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('defs', node), node)\r\n }\r\n\r\n flatten () { return this }\r\n ungroup () { return this }\r\n}\r\n\r\nregister(Defs)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Shape from './Shape.js'\r\nimport * as circled from '../modules/core/circled.js'\r\n\r\nexport default class Ellipse extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('ellipse', node), node)\r\n }\r\n\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n\r\n return this\r\n .rx(new SVGNumber(p.width).divide(2))\r\n .ry(new SVGNumber(p.height).divide(2))\r\n }\r\n}\r\n\r\nextend(Ellipse, circled)\r\n\r\nregisterMethods('Container', {\r\n // Create an ellipse\r\n ellipse: wrapWithAttrCheck(function (width, height) {\r\n return this.put(new Ellipse()).size(width, height).move(0, 0)\r\n })\r\n})\r\n\r\nregister(Ellipse)\r\n","import { nodeOrNew, register } from '../utils/adopter.js'\r\nimport Element from './Element.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\n\r\nexport default class Stop extends Element {\r\n constructor (node) {\r\n super(nodeOrNew('stop', node), node)\r\n }\r\n\r\n // add color stops\r\n update (o) {\r\n if (typeof o === 'number' || o instanceof SVGNumber) {\r\n o = {\r\n offset: arguments[0],\r\n color: arguments[1],\r\n opacity: arguments[2]\r\n }\r\n }\r\n\r\n // set attributes\r\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\r\n if (o.color != null) this.attr('stop-color', o.color)\r\n if (o.offset != null) this.attr('offset', new SVGNumber(o.offset))\r\n\r\n return this\r\n }\r\n}\r\n\r\nregister(Stop)\r\n","import SVGNumber from '../../types/SVGNumber.js'\r\n\r\nexport function from (x, y) {\r\n return (this._element || this).type === 'radialGradient'\r\n ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })\r\n : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })\r\n}\r\n\r\nexport function to (x, y) {\r\n return (this._element || this).type === 'radialGradient'\r\n ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })\r\n : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })\r\n}\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Box from '../types/Box.js'\r\nimport Container from './Container.js'\r\nimport Stop from './Stop.js'\r\nimport baseFind from '../modules/core/selector.js'\r\nimport * as gradiented from '../modules/core/gradiented.js'\r\n\r\nexport default class Gradient extends Container {\r\n constructor (type, attrs) {\r\n super(\r\n nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type),\r\n attrs\r\n )\r\n }\r\n\r\n // Add a color stop\r\n stop (offset, color, opacity) {\r\n return this.put(new Stop()).update(offset, color, opacity)\r\n }\r\n\r\n // Update gradient\r\n update (block) {\r\n // remove all stops\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') {\r\n block.call(this, this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Return the fill id\r\n url () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n\r\n // Alias string convertion to fill\r\n toString () {\r\n return this.url()\r\n }\r\n\r\n // custom attr to handle transform\r\n attr (a, b, c) {\r\n if (a === 'transform') a = 'gradientTransform'\r\n return super.attr(a, b, c)\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [fill*=\"' + this.id() + '\"]')\r\n }\r\n\r\n bbox () {\r\n return new Box()\r\n }\r\n}\r\n\r\nextend(Gradient, gradiented)\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create gradient element in defs\r\n gradient: wrapWithAttrCheck(function (type, block) {\r\n return this.defs().gradient(type, block)\r\n })\r\n },\r\n // define gradient\r\n Defs: {\r\n gradient: wrapWithAttrCheck(function (type, block) {\r\n return this.put(new Gradient(type)).update(block)\r\n })\r\n }\r\n})\r\n\r\nregister(Gradient)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Box from '../types/Box.js'\r\nimport Container from './Container.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class Pattern extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('pattern', node), node)\r\n }\r\n\r\n // Return the fill id\r\n url () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n\r\n // Update pattern by rebuilding\r\n update (block) {\r\n // remove content\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') {\r\n block.call(this, this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Alias string convertion to fill\r\n toString () {\r\n return this.url()\r\n }\r\n\r\n // custom attr to handle transform\r\n attr (a, b, c) {\r\n if (a === 'transform') a = 'patternTransform'\r\n return super.attr(a, b, c)\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [fill*=\"' + this.id() + '\"]')\r\n }\r\n\r\n bbox () {\r\n return new Box()\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create pattern element in defs\r\n pattern (...args) {\r\n return this.defs().pattern(...args)\r\n }\r\n },\r\n Defs: {\r\n pattern: wrapWithAttrCheck(function (width, height, block) {\r\n return this.put(new Pattern()).update(block).attr({\r\n x: 0,\r\n y: 0,\r\n width: width,\r\n height: height,\r\n patternUnits: 'userSpaceOnUse'\r\n })\r\n })\r\n }\r\n})\r\n\r\nregister(Pattern)\r\n","import { isImage } from '../modules/core/regex.js'\r\nimport { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { off, on } from '../modules/core/event.js'\r\nimport { registerAttrHook } from '../modules/core/attr.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Pattern from './Pattern.js'\r\nimport Shape from './Shape.js'\r\nimport { globals } from '../utils/window.js'\r\n\r\nexport default class Image extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('image', node), node)\r\n }\r\n\r\n // (re)load image\r\n load (url, callback) {\r\n if (!url) return this\r\n\r\n var img = new globals.window.Image()\r\n\r\n on(img, 'load', function (e) {\r\n var p = this.parent(Pattern)\r\n\r\n // ensure image size\r\n if (this.width() === 0 && this.height() === 0) {\r\n this.size(img.width, img.height)\r\n }\r\n\r\n if (p instanceof Pattern) {\r\n // ensure pattern size if not set\r\n if (p.width() === 0 && p.height() === 0) {\r\n p.size(this.width(), this.height())\r\n }\r\n }\r\n\r\n if (typeof callback === 'function') {\r\n callback.call(this, e)\r\n }\r\n }, this)\r\n\r\n on(img, 'load error', function () {\r\n // dont forget to unbind memory leaking events\r\n off(img)\r\n })\r\n\r\n return this.attr('href', (img.src = url), xlink)\r\n }\r\n}\r\n\r\nregisterAttrHook(function (attr, val, _this) {\r\n // convert image fill and stroke to patterns\r\n if (attr === 'fill' || attr === 'stroke') {\r\n if (isImage.test(val)) {\r\n val = _this.root().defs().image(val)\r\n }\r\n }\r\n\r\n if (val instanceof Image) {\r\n val = _this.root().defs().pattern(0, 0, (pattern) => {\r\n pattern.add(val)\r\n })\r\n }\r\n\r\n return val\r\n})\r\n\r\nregisterMethods({\r\n Container: {\r\n // create image element, load image and set its size\r\n image: wrapWithAttrCheck(function (source, callback) {\r\n return this.put(new Image()).size(0, 0).load(source, callback)\r\n })\r\n }\r\n})\r\n\r\nregister(Image)\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\nimport SVGArray from './SVGArray.js'\r\n\r\nconst PointArray = subClassArray('PointArray', SVGArray)\r\n\r\nexport default PointArray\r\n\r\nextend(PointArray, {\r\n // Convert array to string\r\n toString () {\r\n // convert to a poly point string\r\n for (var i = 0, il = this.length, array = []; i < il; i++) {\r\n array.push(this[i].join(','))\r\n }\r\n\r\n return array.join(' ')\r\n },\r\n\r\n // Convert array to line object\r\n toLine () {\r\n return {\r\n x1: this[0][0],\r\n y1: this[0][1],\r\n x2: this[1][0],\r\n y2: this[1][1]\r\n }\r\n },\r\n\r\n // Get morphed array at given position\r\n at (pos) {\r\n // make sure a destination is defined\r\n if (!this.destination) return this\r\n\r\n // generate morphed point string\r\n for (var i = 0, il = this.length, array = []; i < il; i++) {\r\n array.push([\r\n this[i][0] + (this.destination[i][0] - this[i][0]) * pos,\r\n this[i][1] + (this.destination[i][1] - this[i][1]) * pos\r\n ])\r\n }\r\n\r\n return new PointArray(array)\r\n },\r\n\r\n // Parse point string and flat array\r\n parse (array = [[0, 0]]) {\r\n var points = []\r\n\r\n // if it is an array\r\n if (array instanceof Array) {\r\n // and it is not flat, there is no need to parse it\r\n if (array[0] instanceof Array) {\r\n return array\r\n }\r\n } else { // Else, it is considered as a string\r\n // parse points\r\n array = array.trim().split(delimiter).map(parseFloat)\r\n }\r\n\r\n // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints\r\n // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.\r\n if (array.length % 2 !== 0) array.pop()\r\n\r\n // wrap points in two-tuples and parse points as floats\r\n for (var i = 0, len = array.length; i < len; i = i + 2) {\r\n points.push([ array[i], array[i + 1] ])\r\n }\r\n\r\n return points\r\n },\r\n\r\n // Move point string\r\n move (x, y) {\r\n var box = this.bbox()\r\n\r\n // get relative offset\r\n x -= box.x\r\n y -= box.y\r\n\r\n // move every point\r\n if (!isNaN(x) && !isNaN(y)) {\r\n for (var i = this.length - 1; i >= 0; i--) {\r\n this[i] = [this[i][0] + x, this[i][1] + y]\r\n }\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Resize poly string\r\n size (width, height) {\r\n var i\r\n var box = this.bbox()\r\n\r\n // recalculate position of all points according to new size\r\n for (i = this.length - 1; i >= 0; i--) {\r\n if (box.width) this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x\r\n if (box.height) this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Get bounding box of points\r\n bbox () {\r\n var maxX = -Infinity\r\n var maxY = -Infinity\r\n var minX = Infinity\r\n var minY = Infinity\r\n this.forEach(function (el) {\r\n maxX = Math.max(el[0], maxX)\r\n maxY = Math.max(el[1], maxY)\r\n minX = Math.min(el[0], minX)\r\n minY = Math.min(el[1], minY)\r\n })\r\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\r\n }\r\n})\r\n","import PointArray from '../../types/PointArray.js'\r\n\r\nexport let MorphArray = PointArray\r\n\r\n// Move by left top corner over x-axis\r\nexport function x (x) {\r\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r\n}\r\n\r\n// Move by left top corner over y-axis\r\nexport function y (y) {\r\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r\n}\r\n\r\n// Set width of element\r\nexport function width (width) {\r\n let b = this.bbox()\r\n return width == null ? b.width : this.size(width, b.height)\r\n}\r\n\r\n// Set height of element\r\nexport function height (height) {\r\n let b = this.bbox()\r\n return height == null ? b.height : this.size(b.width, height)\r\n}\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PointArray from '../types/PointArray.js'\r\nimport Shape from './Shape.js'\r\nimport * as pointed from '../modules/core/pointed.js'\r\n\r\nexport default class Line extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('line', node), node)\r\n }\r\n\r\n // Get array\r\n array () {\r\n return new PointArray([\r\n [ this.attr('x1'), this.attr('y1') ],\r\n [ this.attr('x2'), this.attr('y2') ]\r\n ])\r\n }\r\n\r\n // Overwrite native plot() method\r\n plot (x1, y1, x2, y2) {\r\n if (x1 == null) {\r\n return this.array()\r\n } else if (typeof y1 !== 'undefined') {\r\n x1 = { x1: x1, y1: y1, x2: x2, y2: y2 }\r\n } else {\r\n x1 = new PointArray(x1).toLine()\r\n }\r\n\r\n return this.attr(x1)\r\n }\r\n\r\n // Move by left top corner\r\n move (x, y) {\r\n return this.attr(this.array().move(x, y).toLine())\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n return this.attr(this.array().size(p.width, p.height).toLine())\r\n }\r\n}\r\n\r\nextend(Line, pointed)\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a line element\r\n line: wrapWithAttrCheck(function (...args) {\r\n // make sure plot is called as a setter\r\n // x1 is not necessarily a number, it can also be an array, a string and a PointArray\r\n return Line.prototype.plot.apply(\r\n this.put(new Line())\r\n , args[0] != null ? args : [0, 0, 0, 0]\r\n )\r\n })\r\n }\r\n})\r\n\r\nregister(Line)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class Marker extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('marker', node), node)\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return this.attr('markerWidth', width)\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return this.attr('markerHeight', height)\r\n }\r\n\r\n // Set marker refX and refY\r\n ref (x, y) {\r\n return this.attr('refX', x).attr('refY', y)\r\n }\r\n\r\n // Update marker\r\n update (block) {\r\n // remove all content\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') { block.call(this, this) }\r\n\r\n return this\r\n }\r\n\r\n // Return the fill id\r\n toString () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n marker (...args) {\r\n // Create marker element in defs\r\n return this.defs().marker(...args)\r\n }\r\n },\r\n Defs: {\r\n // Create marker\r\n marker: wrapWithAttrCheck(function (width, height, block) {\r\n // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto\r\n return this.put(new Marker())\r\n .size(width, height)\r\n .ref(width / 2, height / 2)\r\n .viewbox(0, 0, width, height)\r\n .attr('orient', 'auto')\r\n .update(block)\r\n })\r\n },\r\n marker: {\r\n // Create and attach markers\r\n marker (marker, width, height, block) {\r\n var attr = ['marker']\r\n\r\n // Build attribute name\r\n if (marker !== 'all') attr.push(marker)\r\n attr = attr.join('-')\r\n\r\n // Set marker attribute\r\n marker = arguments[1] instanceof Marker\r\n ? arguments[1]\r\n : this.defs().marker(width, height, block)\r\n\r\n return this.attr(attr, marker)\r\n }\r\n }\r\n})\r\n\r\nregister(Marker)\r\n","'use strict';\nvar fails = require('./_fails');\n\nmodule.exports = function (method, arg) {\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call\n arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);\n });\n};\n","'use strict';\nvar $export = require('./_export');\nvar aFunction = require('./_a-function');\nvar toObject = require('./_to-object');\nvar fails = require('./_fails');\nvar $sort = [].sort;\nvar test = [1, 2, 3];\n\n$export($export.P + $export.F * (fails(function () {\n // IE8-\n test.sort(undefined);\n}) || !fails(function () {\n // V8 bug\n test.sort(null);\n // Old WebKit\n}) || !require('./_strict-method')($sort)), 'Array', {\n // 22.1.3.25 Array.prototype.sort(comparefn)\n sort: function sort(comparefn) {\n return comparefn === undefined\n ? $sort.call(toObject(this))\n : $sort.call(toObject(this), aFunction(comparefn));\n }\n});\n","import { timeline } from '../modules/core/defaults.js'\r\nimport { extend } from '../utils/adopter.js'\r\n\r\n/***\r\nBase Class\r\n==========\r\nThe base stepper class that will be\r\n***/\r\n\r\nfunction makeSetterGetter (k, f) {\r\n return function (v) {\r\n if (v == null) return this[v]\r\n this[k] = v\r\n if (f) f.call(this)\r\n return this\r\n }\r\n}\r\n\r\nexport let easing = {\r\n '-': function (pos) { return pos },\r\n '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 },\r\n '>': function (pos) { return Math.sin(pos * Math.PI / 2) },\r\n '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 },\r\n bezier: function (x1, y1, x2, y2) {\r\n // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo\r\n return function (t) {\r\n if (t < 0) {\r\n if (x1 > 0) {\r\n return y1 / x1 * t\r\n } else if (x2 > 0) {\r\n return y2 / x2 * t\r\n } else {\r\n return 0\r\n }\r\n } else if (t > 1) {\r\n if (x2 < 1) {\r\n return (1 - y2) / (1 - x2) * t + (y2 - x2) / (1 - x2)\r\n } else if (x1 < 1) {\r\n return (1 - y1) / (1 - x1) * t + (y1 - x1) / (1 - x1)\r\n } else {\r\n return 1\r\n }\r\n } else {\r\n return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3\r\n }\r\n }\r\n },\r\n // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo\r\n steps: function (steps, stepPosition = 'end') {\r\n // deal with \"jump-\" prefix\r\n stepPosition = stepPosition.split('-').reverse()[0]\r\n\r\n let jumps = steps\r\n if (stepPosition === 'none') {\r\n --jumps\r\n } else if (stepPosition === 'both') {\r\n ++jumps\r\n }\r\n\r\n // The beforeFlag is essentially useless\r\n return (t, beforeFlag = false) => {\r\n // Step is called currentStep in referenced url\r\n let step = Math.floor(t * steps)\r\n const jumping = (t * step) % 1 === 0\r\n\r\n if (stepPosition === 'start' || stepPosition === 'both') {\r\n ++step\r\n }\r\n\r\n if (beforeFlag && jumping) {\r\n --step\r\n }\r\n\r\n if (t >= 0 && step < 0) {\r\n step = 0\r\n }\r\n\r\n if (t <= 1 && step > jumps) {\r\n step = jumps\r\n }\r\n\r\n return step / jumps\r\n }\r\n }\r\n}\r\n\r\nexport class Stepper {\r\n done () { return false }\r\n}\r\n\r\n/***\r\nEasing Functions\r\n================\r\n***/\r\n\r\nexport class Ease extends Stepper {\r\n constructor (fn) {\r\n super()\r\n this.ease = easing[fn || timeline.ease] || fn\r\n }\r\n\r\n step (from, to, pos) {\r\n if (typeof from !== 'number') {\r\n return pos < 1 ? from : to\r\n }\r\n return from + (to - from) * this.ease(pos)\r\n }\r\n}\r\n\r\n/***\r\nController Types\r\n================\r\n***/\r\n\r\nexport class Controller extends Stepper {\r\n constructor (fn) {\r\n super()\r\n this.stepper = fn\r\n }\r\n\r\n step (current, target, dt, c) {\r\n return this.stepper(current, target, dt, c)\r\n }\r\n\r\n done (c) {\r\n return c.done\r\n }\r\n}\r\n\r\nfunction recalculate () {\r\n // Apply the default parameters\r\n var duration = (this._duration || 500) / 1000\r\n var overshoot = this._overshoot || 0\r\n\r\n // Calculate the PID natural response\r\n var eps = 1e-10\r\n var pi = Math.PI\r\n var os = Math.log(overshoot / 100 + eps)\r\n var zeta = -os / Math.sqrt(pi * pi + os * os)\r\n var wn = 3.9 / (zeta * duration)\r\n\r\n // Calculate the Spring values\r\n this.d = 2 * zeta * wn\r\n this.k = wn * wn\r\n}\r\n\r\nexport class Spring extends Controller {\r\n constructor (duration, overshoot) {\r\n super()\r\n this.duration(duration || 500)\r\n .overshoot(overshoot || 0)\r\n }\r\n\r\n step (current, target, dt, c) {\r\n if (typeof current === 'string') return current\r\n c.done = dt === Infinity\r\n if (dt === Infinity) return target\r\n if (dt === 0) return current\r\n\r\n if (dt > 100) dt = 16\r\n\r\n dt /= 1000\r\n\r\n // Get the previous velocity\r\n var velocity = c.velocity || 0\r\n\r\n // Apply the control to get the new position and store it\r\n var acceleration = -this.d * velocity - this.k * (current - target)\r\n var newPosition = current +\r\n velocity * dt +\r\n acceleration * dt * dt / 2\r\n\r\n // Store the velocity\r\n c.velocity = velocity + acceleration * dt\r\n\r\n // Figure out if we have converged, and if so, pass the value\r\n c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002\r\n return c.done ? target : newPosition\r\n }\r\n}\r\n\r\nextend(Spring, {\r\n duration: makeSetterGetter('_duration', recalculate),\r\n overshoot: makeSetterGetter('_overshoot', recalculate)\r\n})\r\n\r\nexport class PID extends Controller {\r\n constructor (p, i, d, windup) {\r\n super()\r\n\r\n p = p == null ? 0.1 : p\r\n i = i == null ? 0.01 : i\r\n d = d == null ? 0 : d\r\n windup = windup == null ? 1000 : windup\r\n this.p(p).i(i).d(d).windup(windup)\r\n }\r\n\r\n step (current, target, dt, c) {\r\n if (typeof current === 'string') return current\r\n c.done = dt === Infinity\r\n\r\n if (dt === Infinity) return target\r\n if (dt === 0) return current\r\n\r\n var p = target - current\r\n var i = (c.integral || 0) + p * dt\r\n var d = (p - (c.error || 0)) / dt\r\n var windup = this.windup\r\n\r\n // antiwindup\r\n if (windup !== false) {\r\n i = Math.max(-windup, Math.min(i, windup))\r\n }\r\n\r\n c.error = p\r\n c.integral = i\r\n\r\n c.done = Math.abs(p) < 0.001\r\n\r\n return c.done ? target : current + (this.P * p + this.I * i + this.D * d)\r\n }\r\n}\r\n\r\nextend(PID, {\r\n windup: makeSetterGetter('windup'),\r\n p: makeSetterGetter('P'),\r\n i: makeSetterGetter('I'),\r\n d: makeSetterGetter('D')\r\n})\r\n","import {\r\n delimiter,\r\n dots,\r\n hyphen,\r\n isPathLetter,\r\n numbersWithDots,\r\n pathLetters\r\n} from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\nimport Point from './Point.js'\r\nimport SVGArray from './SVGArray.js'\r\nimport parser from '../modules/core/parser.js'\r\n\r\nconst PathArray = subClassArray('PathArray', SVGArray)\r\n\r\nexport default PathArray\r\n\r\nexport function pathRegReplace (a, b, c, d) {\r\n return c + d.replace(dots, ' .')\r\n}\r\n\r\nfunction arrayToString (a) {\r\n for (var i = 0, il = a.length, s = ''; i < il; i++) {\r\n s += a[i][0]\r\n\r\n if (a[i][1] != null) {\r\n s += a[i][1]\r\n\r\n if (a[i][2] != null) {\r\n s += ' '\r\n s += a[i][2]\r\n\r\n if (a[i][3] != null) {\r\n s += ' '\r\n s += a[i][3]\r\n s += ' '\r\n s += a[i][4]\r\n\r\n if (a[i][5] != null) {\r\n s += ' '\r\n s += a[i][5]\r\n s += ' '\r\n s += a[i][6]\r\n\r\n if (a[i][7] != null) {\r\n s += ' '\r\n s += a[i][7]\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return s + ' '\r\n}\r\n\r\nconst pathHandlers = {\r\n M: function (c, p, p0) {\r\n p.x = p0.x = c[0]\r\n p.y = p0.y = c[1]\r\n\r\n return ['M', p.x, p.y]\r\n },\r\n L: function (c, p) {\r\n p.x = c[0]\r\n p.y = c[1]\r\n return ['L', c[0], c[1]]\r\n },\r\n H: function (c, p) {\r\n p.x = c[0]\r\n return ['H', c[0]]\r\n },\r\n V: function (c, p) {\r\n p.y = c[0]\r\n return ['V', c[0]]\r\n },\r\n C: function (c, p) {\r\n p.x = c[4]\r\n p.y = c[5]\r\n return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]\r\n },\r\n S: function (c, p) {\r\n p.x = c[2]\r\n p.y = c[3]\r\n return ['S', c[0], c[1], c[2], c[3]]\r\n },\r\n Q: function (c, p) {\r\n p.x = c[2]\r\n p.y = c[3]\r\n return ['Q', c[0], c[1], c[2], c[3]]\r\n },\r\n T: function (c, p) {\r\n p.x = c[0]\r\n p.y = c[1]\r\n return ['T', c[0], c[1]]\r\n },\r\n Z: function (c, p, p0) {\r\n p.x = p0.x\r\n p.y = p0.y\r\n return ['Z']\r\n },\r\n A: function (c, p) {\r\n p.x = c[5]\r\n p.y = c[6]\r\n return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]\r\n }\r\n}\r\n\r\nlet mlhvqtcsaz = 'mlhvqtcsaz'.split('')\r\n\r\nfor (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) {\r\n pathHandlers[mlhvqtcsaz[i]] = (function (i) {\r\n return function (c, p, p0) {\r\n if (i === 'H') c[0] = c[0] + p.x\r\n else if (i === 'V') c[0] = c[0] + p.y\r\n else if (i === 'A') {\r\n c[5] = c[5] + p.x\r\n c[6] = c[6] + p.y\r\n } else {\r\n for (var j = 0, jl = c.length; j < jl; ++j) {\r\n c[j] = c[j] + (j % 2 ? p.y : p.x)\r\n }\r\n }\r\n\r\n return pathHandlers[i](c, p, p0)\r\n }\r\n })(mlhvqtcsaz[i].toUpperCase())\r\n}\r\n\r\nextend(PathArray, {\r\n // Convert array to string\r\n toString () {\r\n return arrayToString(this)\r\n },\r\n\r\n // Move path string\r\n move (x, y) {\r\n // get bounding box of current situation\r\n var box = this.bbox()\r\n\r\n // get relative offset\r\n x -= box.x\r\n y -= box.y\r\n\r\n if (!isNaN(x) && !isNaN(y)) {\r\n // move every point\r\n for (var l, i = this.length - 1; i >= 0; i--) {\r\n l = this[i][0]\r\n\r\n if (l === 'M' || l === 'L' || l === 'T') {\r\n this[i][1] += x\r\n this[i][2] += y\r\n } else if (l === 'H') {\r\n this[i][1] += x\r\n } else if (l === 'V') {\r\n this[i][1] += y\r\n } else if (l === 'C' || l === 'S' || l === 'Q') {\r\n this[i][1] += x\r\n this[i][2] += y\r\n this[i][3] += x\r\n this[i][4] += y\r\n\r\n if (l === 'C') {\r\n this[i][5] += x\r\n this[i][6] += y\r\n }\r\n } else if (l === 'A') {\r\n this[i][6] += x\r\n this[i][7] += y\r\n }\r\n }\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Resize path string\r\n size (width, height) {\r\n // get bounding box of current situation\r\n var box = this.bbox()\r\n var i, l\r\n\r\n // recalculate position of all points according to new size\r\n for (i = this.length - 1; i >= 0; i--) {\r\n l = this[i][0]\r\n\r\n if (l === 'M' || l === 'L' || l === 'T') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\r\n } else if (l === 'H') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n } else if (l === 'V') {\r\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\r\n } else if (l === 'C' || l === 'S' || l === 'Q') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\r\n this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x\r\n this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y\r\n\r\n if (l === 'C') {\r\n this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x\r\n this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y\r\n }\r\n } else if (l === 'A') {\r\n // resize radii\r\n this[i][1] = (this[i][1] * width) / box.width\r\n this[i][2] = (this[i][2] * height) / box.height\r\n\r\n // move position values\r\n this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x\r\n this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y\r\n }\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Test if the passed path array use the same path data commands as this path array\r\n equalCommands (pathArray) {\r\n var i, il, equalCommands\r\n\r\n pathArray = new PathArray(pathArray)\r\n\r\n equalCommands = this.length === pathArray.length\r\n for (i = 0, il = this.length; equalCommands && i < il; i++) {\r\n equalCommands = this[i][0] === pathArray[i][0]\r\n }\r\n\r\n return equalCommands\r\n },\r\n\r\n // Make path array morphable\r\n morph (pathArray) {\r\n pathArray = new PathArray(pathArray)\r\n\r\n if (this.equalCommands(pathArray)) {\r\n this.destination = pathArray\r\n } else {\r\n this.destination = null\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Get morphed path array at given position\r\n at (pos) {\r\n // make sure a destination is defined\r\n if (!this.destination) return this\r\n\r\n var sourceArray = this\r\n var destinationArray = this.destination.value\r\n var array = []\r\n var pathArray = new PathArray()\r\n var i, il, j, jl\r\n\r\n // Animate has specified in the SVG spec\r\n // See: https://www.w3.org/TR/SVG11/paths.html#PathElement\r\n for (i = 0, il = sourceArray.length; i < il; i++) {\r\n array[i] = [sourceArray[i][0]]\r\n for (j = 1, jl = sourceArray[i].length; j < jl; j++) {\r\n array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos\r\n }\r\n // For the two flags of the elliptical arc command, the SVG spec say:\r\n // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true\r\n // Elliptical arc command as an array followed by corresponding indexes:\r\n // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y]\r\n // 0 1 2 3 4 5 6 7\r\n if (array[i][0] === 'A') {\r\n array[i][4] = +(array[i][4] !== 0)\r\n array[i][5] = +(array[i][5] !== 0)\r\n }\r\n }\r\n\r\n // Directly modify the value of a path array, this is done this way for performance\r\n pathArray.value = array\r\n return pathArray\r\n },\r\n\r\n // Absolutize and parse path to array\r\n parse (array = [['M', 0, 0]]) {\r\n // if it's already a patharray, no need to parse it\r\n if (array instanceof PathArray) return array\r\n\r\n // prepare for parsing\r\n var s\r\n var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 }\r\n\r\n if (typeof array === 'string') {\r\n array = array\r\n .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123\r\n .replace(pathLetters, ' $& ') // put some room between letters and numbers\r\n .replace(hyphen, '$1 -') // add space before hyphen\r\n .trim() // trim\r\n .split(delimiter) // split into array\r\n } else {\r\n array = array.reduce(function (prev, curr) {\r\n return [].concat.call(prev, curr)\r\n }, [])\r\n }\r\n\r\n // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...]\r\n var result = []\r\n var p = new Point()\r\n var p0 = new Point()\r\n var index = 0\r\n var len = array.length\r\n\r\n do {\r\n // Test if we have a path letter\r\n if (isPathLetter.test(array[index])) {\r\n s = array[index]\r\n ++index\r\n // If last letter was a move command and we got no new, it defaults to [L]ine\r\n } else if (s === 'M') {\r\n s = 'L'\r\n } else if (s === 'm') {\r\n s = 'l'\r\n }\r\n\r\n result.push(pathHandlers[s].call(null,\r\n array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat),\r\n p, p0\r\n )\r\n )\r\n } while (len > index)\r\n\r\n return result\r\n },\r\n\r\n // Get bounding box of path\r\n bbox () {\r\n parser().path.setAttribute('d', this.toString())\r\n return parser.nodes.path.getBBox()\r\n }\r\n})\r\n","import { Ease } from './Controller.js'\r\nimport {\r\n delimiter,\r\n numberAndUnit,\r\n pathLetters\r\n} from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport Color from '../types/Color.js'\r\nimport PathArray from '../types/PathArray.js'\r\nimport SVGArray from '../types/SVGArray.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\n\r\nexport default class Morphable {\r\n constructor (stepper) {\r\n this._stepper = stepper || new Ease('-')\r\n\r\n this._from = null\r\n this._to = null\r\n this._type = null\r\n this._context = null\r\n this._morphObj = null\r\n }\r\n\r\n from (val) {\r\n if (val == null) {\r\n return this._from\r\n }\r\n\r\n this._from = this._set(val)\r\n return this\r\n }\r\n\r\n to (val) {\r\n if (val == null) {\r\n return this._to\r\n }\r\n\r\n this._to = this._set(val)\r\n return this\r\n }\r\n\r\n type (type) {\r\n // getter\r\n if (type == null) {\r\n return this._type\r\n }\r\n\r\n // setter\r\n this._type = type\r\n return this\r\n }\r\n\r\n _set (value) {\r\n if (!this._type) {\r\n var type = typeof value\r\n\r\n if (type === 'number') {\r\n this.type(SVGNumber)\r\n } else if (type === 'string') {\r\n if (Color.isColor(value)) {\r\n this.type(Color)\r\n } else if (delimiter.test(value)) {\r\n this.type(pathLetters.test(value)\r\n ? PathArray\r\n : SVGArray\r\n )\r\n } else if (numberAndUnit.test(value)) {\r\n this.type(SVGNumber)\r\n } else {\r\n this.type(NonMorphable)\r\n }\r\n } else if (morphableTypes.indexOf(value.constructor) > -1) {\r\n this.type(value.constructor)\r\n } else if (Array.isArray(value)) {\r\n this.type(SVGArray)\r\n } else if (type === 'object') {\r\n this.type(ObjectBag)\r\n } else {\r\n this.type(NonMorphable)\r\n }\r\n }\r\n\r\n var result = (new this._type(value)).toArray()\r\n this._morphObj = this._morphObj || new this._type()\r\n this._context = this._context ||\r\n Array.apply(null, Array(result.length)).map(Object)\r\n return result\r\n }\r\n\r\n stepper (stepper) {\r\n if (stepper == null) return this._stepper\r\n this._stepper = stepper\r\n return this\r\n }\r\n\r\n done () {\r\n var complete = this._context\r\n .map(this._stepper.done)\r\n .reduce(function (last, curr) {\r\n return last && curr\r\n }, true)\r\n return complete\r\n }\r\n\r\n at (pos) {\r\n var _this = this\r\n\r\n return this._morphObj.fromArray(\r\n this._from.map(function (i, index) {\r\n return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context)\r\n })\r\n )\r\n }\r\n}\r\n\r\nexport class NonMorphable {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (val) {\r\n val = Array.isArray(val) ? val[0] : val\r\n this.value = val\r\n return this\r\n }\r\n\r\n valueOf () {\r\n return this.value\r\n }\r\n\r\n toArray () {\r\n return [this.value]\r\n }\r\n}\r\n\r\nexport class TransformBag {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (obj) {\r\n if (Array.isArray(obj)) {\r\n obj = {\r\n scaleX: obj[0],\r\n scaleY: obj[1],\r\n shear: obj[2],\r\n rotate: obj[3],\r\n translateX: obj[4],\r\n translateY: obj[5],\r\n originX: obj[6],\r\n originY: obj[7]\r\n }\r\n }\r\n\r\n Object.assign(this, TransformBag.defaults, obj)\r\n return this\r\n }\r\n\r\n toArray () {\r\n var v = this\r\n\r\n return [\r\n v.scaleX,\r\n v.scaleY,\r\n v.shear,\r\n v.rotate,\r\n v.translateX,\r\n v.translateY,\r\n v.originX,\r\n v.originY\r\n ]\r\n }\r\n}\r\n\r\nTransformBag.defaults = {\r\n scaleX: 1,\r\n scaleY: 1,\r\n shear: 0,\r\n rotate: 0,\r\n translateX: 0,\r\n translateY: 0,\r\n originX: 0,\r\n originY: 0\r\n}\r\n\r\nexport class ObjectBag {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (objOrArr) {\r\n this.values = []\r\n\r\n if (Array.isArray(objOrArr)) {\r\n this.values = objOrArr\r\n return\r\n }\r\n\r\n objOrArr = objOrArr || {}\r\n var entries = []\r\n\r\n for (let i in objOrArr) {\r\n entries.push([i, objOrArr[i]])\r\n }\r\n\r\n entries.sort((a, b) => {\r\n return a[0] - b[0]\r\n })\r\n\r\n this.values = entries.reduce((last, curr) => last.concat(curr), [])\r\n return this\r\n }\r\n\r\n valueOf () {\r\n var obj = {}\r\n var arr = this.values\r\n\r\n for (var i = 0, len = arr.length; i < len; i += 2) {\r\n obj[arr[i]] = arr[i + 1]\r\n }\r\n\r\n return obj\r\n }\r\n\r\n toArray () {\r\n return this.values\r\n }\r\n}\r\n\r\nconst morphableTypes = [\r\n NonMorphable,\r\n TransformBag,\r\n ObjectBag\r\n]\r\n\r\nexport function registerMorphableType (type = []) {\r\n morphableTypes.push(...[].concat(type))\r\n}\r\n\r\nexport function makeMorphable () {\r\n extend(morphableTypes, {\r\n to (val) {\r\n return new Morphable()\r\n .type(this.constructor)\r\n .from(this.valueOf())\r\n .to(val)\r\n },\r\n fromArray (arr) {\r\n this.init(arr)\r\n return this\r\n }\r\n })\r\n}\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PathArray from '../types/PathArray.js'\r\nimport Shape from './Shape.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class Path extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('path', node), node)\r\n }\r\n\r\n // Get array\r\n array () {\r\n return this._array || (this._array = new PathArray(this.attr('d')))\r\n }\r\n\r\n // Plot new path\r\n plot (d) {\r\n return (d == null) ? this.array()\r\n : this.clear().attr('d', typeof d === 'string' ? d : (this._array = new PathArray(d)))\r\n }\r\n\r\n // Clear array cache\r\n clear () {\r\n delete this._array\r\n return this\r\n }\r\n\r\n // Move by left top corner\r\n move (x, y) {\r\n return this.attr('d', this.array().move(x, y))\r\n }\r\n\r\n // Move by left top corner over x-axis\r\n x (x) {\r\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r\n }\r\n\r\n // Move by left top corner over y-axis\r\n y (y) {\r\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n return this.attr('d', this.array().size(p.width, p.height))\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return width == null ? this.bbox().width : this.size(width, this.bbox().height)\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return height == null ? this.bbox().height : this.size(this.bbox().width, height)\r\n }\r\n\r\n targets () {\r\n return baseFind('svg textpath [href*=\"' + this.id() + '\"]')\r\n }\r\n}\r\n\r\n// Define morphable array\r\nPath.prototype.MorphArray = PathArray\r\n\r\n// Add parent method\r\nregisterMethods({\r\n Container: {\r\n // Create a wrapped path element\r\n path: wrapWithAttrCheck(function (d) {\r\n // make sure plot is called as a setter\r\n return this.put(new Path()).plot(d || new PathArray())\r\n })\r\n }\r\n})\r\n\r\nregister(Path)\r\n","import { proportionalSize } from '../../utils/utils.js'\r\nimport PointArray from '../../types/PointArray.js'\r\n\r\n// Get array\r\nexport function array () {\r\n return this._array || (this._array = new PointArray(this.attr('points')))\r\n}\r\n\r\n// Plot new path\r\nexport function plot (p) {\r\n return (p == null) ? this.array()\r\n : this.clear().attr('points', typeof p === 'string' ? p\r\n : (this._array = new PointArray(p)))\r\n}\r\n\r\n// Clear array cache\r\nexport function clear () {\r\n delete this._array\r\n return this\r\n}\r\n\r\n// Move by left top corner\r\nexport function move (x, y) {\r\n return this.attr('points', this.array().move(x, y))\r\n}\r\n\r\n// Set element size to given width and height\r\nexport function size (width, height) {\r\n let p = proportionalSize(this, width, height)\r\n return this.attr('points', this.array().size(p.width, p.height))\r\n}\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PointArray from '../types/PointArray.js'\r\nimport Shape from './Shape.js'\r\nimport * as pointed from '../modules/core/pointed.js'\r\nimport * as poly from '../modules/core/poly.js'\r\n\r\nexport default class Polygon extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('polygon', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a wrapped polygon element\r\n polygon: wrapWithAttrCheck(function (p) {\r\n // make sure plot is called as a setter\r\n return this.put(new Polygon()).plot(p || new PointArray())\r\n })\r\n }\r\n})\r\n\r\nextend(Polygon, pointed)\r\nextend(Polygon, poly)\r\nregister(Polygon)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PointArray from '../types/PointArray.js'\r\nimport Shape from './Shape.js'\r\nimport * as pointed from '../modules/core/pointed.js'\r\nimport * as poly from '../modules/core/poly.js'\r\n\r\nexport default class Polyline extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('polyline', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a wrapped polygon element\r\n polyline: wrapWithAttrCheck(function (p) {\r\n // make sure plot is called as a setter\r\n return this.put(new Polyline()).plot(p || new PointArray())\r\n })\r\n }\r\n})\r\n\r\nextend(Polyline, pointed)\r\nextend(Polyline, poly)\r\nregister(Polyline)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { rx, ry } from '../modules/core/circled.js'\r\nimport Shape from './Shape.js'\r\n\r\nexport default class Rect extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('rect', node), node)\r\n }\r\n}\r\n\r\nextend(Rect, { rx, ry })\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a rect element\r\n rect: wrapWithAttrCheck(function (width, height) {\r\n return this.put(new Rect()).size(width, height)\r\n })\r\n }\r\n})\r\n\r\nregister(Rect)\r\n","export default class Queue {\r\n constructor () {\r\n this._first = null\r\n this._last = null\r\n }\r\n\r\n push (value) {\r\n // An item stores an id and the provided value\r\n var item = value.next ? value : { value: value, next: null, prev: null }\r\n\r\n // Deal with the queue being empty or populated\r\n if (this._last) {\r\n item.prev = this._last\r\n this._last.next = item\r\n this._last = item\r\n } else {\r\n this._last = item\r\n this._first = item\r\n }\r\n\r\n // Update the length and return the current item\r\n return item\r\n }\r\n\r\n shift () {\r\n // Check if we have a value\r\n var remove = this._first\r\n if (!remove) return null\r\n\r\n // If we do, remove it and relink things\r\n this._first = remove.next\r\n if (this._first) this._first.prev = null\r\n this._last = this._first ? this._last : null\r\n return remove.value\r\n }\r\n\r\n // Shows us the first item in the list\r\n first () {\r\n return this._first && this._first.value\r\n }\r\n\r\n // Shows us the last item in the list\r\n last () {\r\n return this._last && this._last.value\r\n }\r\n\r\n // Removes the item that was returned from the push\r\n remove (item) {\r\n // Relink the previous item\r\n if (item.prev) item.prev.next = item.next\r\n if (item.next) item.next.prev = item.prev\r\n if (item === this._last) this._last = item.prev\r\n if (item === this._first) this._first = item.next\r\n\r\n // Invalidate item\r\n item.prev = null\r\n item.next = null\r\n }\r\n}\r\n","import { globals } from '../utils/window.js'\r\nimport Queue from './Queue.js'\r\n\r\nconst Animator = {\r\n nextDraw: null,\r\n frames: new Queue(),\r\n timeouts: new Queue(),\r\n timer: globals.window.performance || globals.window.Date,\r\n transforms: [],\r\n\r\n frame (fn) {\r\n // Store the node\r\n var node = Animator.frames.push({ run: fn })\r\n\r\n // Request an animation frame if we don't have one\r\n if (Animator.nextDraw === null) {\r\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\r\n }\r\n\r\n // Return the node so we can remove it easily\r\n return node\r\n },\r\n\r\n transform_frame (fn, id) {\r\n Animator.transforms[id] = fn\r\n },\r\n\r\n timeout (fn, delay) {\r\n delay = delay || 0\r\n\r\n // Work out when the event should fire\r\n var time = Animator.timer.now() + delay\r\n\r\n // Add the timeout to the end of the queue\r\n var node = Animator.timeouts.push({ run: fn, time: time })\r\n\r\n // Request another animation frame if we need one\r\n if (Animator.nextDraw === null) {\r\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\r\n }\r\n\r\n return node\r\n },\r\n\r\n cancelFrame (node) {\r\n node != null && Animator.frames.remove(node)\r\n },\r\n\r\n clearTimeout (node) {\r\n node != null && Animator.timeouts.remove(node)\r\n },\r\n\r\n _draw (now) {\r\n // Run all the timeouts we can run, if they are not ready yet, add them\r\n // to the end of the queue immediately! (bad timeouts!!! [sarcasm])\r\n var nextTimeout = null\r\n var lastTimeout = Animator.timeouts.last()\r\n while ((nextTimeout = Animator.timeouts.shift())) {\r\n // Run the timeout if its time, or push it to the end\r\n if (now >= nextTimeout.time) {\r\n nextTimeout.run()\r\n } else {\r\n Animator.timeouts.push(nextTimeout)\r\n }\r\n\r\n // If we hit the last item, we should stop shifting out more items\r\n if (nextTimeout === lastTimeout) break\r\n }\r\n\r\n // Run all of the animation frames\r\n var nextFrame = null\r\n var lastFrame = Animator.frames.last()\r\n while ((nextFrame !== lastFrame) && (nextFrame = Animator.frames.shift())) {\r\n nextFrame.run()\r\n }\r\n\r\n Animator.transforms.forEach(function (el) { el() })\r\n\r\n // If we have remaining timeouts or frames, draw until we don't anymore\r\n Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first()\r\n ? globals.window.requestAnimationFrame(Animator._draw)\r\n : null\r\n }\r\n}\r\n\r\nexport default Animator\r\n","import { globals } from '../utils/window.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Animator from './Animator.js'\r\nimport EventTarget from '../types/EventTarget.js'\r\n\r\nvar makeSchedule = function (runnerInfo) {\r\n var start = runnerInfo.start\r\n var duration = runnerInfo.runner.duration()\r\n var end = start + duration\r\n return { start: start, duration: duration, end: end, runner: runnerInfo.runner }\r\n}\r\n\r\nconst defaultSource = function () {\r\n let w = globals.window\r\n return (w.performance || w.Date).now()\r\n}\r\n\r\nexport default class Timeline extends EventTarget {\r\n // Construct a new timeline on the given element\r\n constructor (timeSource = defaultSource) {\r\n super()\r\n\r\n this._timeSource = timeSource\r\n\r\n // Store the timing variables\r\n this._startTime = 0\r\n this._speed = 1.0\r\n\r\n // Determines how long a runner is hold in memory. Can be a dt or true/false\r\n this._persist = 0\r\n\r\n // Keep track of the running animations and their starting parameters\r\n this._nextFrame = null\r\n this._paused = true\r\n this._runners = []\r\n this._order = []\r\n this._time = 0\r\n this._lastSourceTime = 0\r\n this._lastStepTime = 0\r\n\r\n // Make sure that step is always called in class context\r\n this._step = this._step.bind(this)\r\n }\r\n\r\n // schedules a runner on the timeline\r\n schedule (runner, delay, when) {\r\n if (runner == null) {\r\n return this._runners.map(makeSchedule).sort(function (a, b) {\r\n return a.runner.id - b.runner.id\r\n })\r\n }\r\n\r\n // The start time for the next animation can either be given explicitly,\r\n // derived from the current timeline time or it can be relative to the\r\n // last start time to chain animations direclty\r\n\r\n var absoluteStartTime = 0\r\n var endTime = this.getEndTime()\r\n delay = delay || 0\r\n\r\n // Work out when to start the animation\r\n if (when == null || when === 'last' || when === 'after') {\r\n // Take the last time and increment\r\n absoluteStartTime = endTime\r\n } else if (when === 'absolute' || when === 'start') {\r\n absoluteStartTime = delay\r\n delay = 0\r\n } else if (when === 'now') {\r\n absoluteStartTime = this._time\r\n } else if (when === 'relative') {\r\n let runnerInfo = this._runners[runner.id]\r\n if (runnerInfo) {\r\n absoluteStartTime = runnerInfo.start + delay\r\n delay = 0\r\n }\r\n } else {\r\n throw new Error('Invalid value for the \"when\" parameter')\r\n }\r\n\r\n // Manage runner\r\n runner.unschedule()\r\n runner.timeline(this)\r\n // runner.time(-delay)\r\n\r\n // Save runnerInfo\r\n this._runners[runner.id] = {\r\n persist: this.persist(),\r\n runner: runner,\r\n start: absoluteStartTime + delay\r\n }\r\n\r\n // Save order, update Time if needed and continue\r\n this._order.push(runner.id)\r\n this.updateTime()._continue()\r\n return this\r\n }\r\n\r\n // Remove the runner from this timeline\r\n unschedule (runner) {\r\n var index = this._order.indexOf(runner.id)\r\n if (index < 0) return this\r\n\r\n delete this._runners[runner.id]\r\n this._order.splice(index, 1)\r\n runner.timeline(null)\r\n return this\r\n }\r\n\r\n // Calculates the end of the timeline\r\n getEndTime () {\r\n var lastRunnerInfo = this._runners[this._order[this._order.length - 1]]\r\n var lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0\r\n var lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : 0\r\n return lastStartTime + lastDuration\r\n }\r\n\r\n // Makes sure, that after pausing the time doesn't jump\r\n updateTime () {\r\n if (!this.active()) {\r\n this._lastSourceTime = this._timeSource()\r\n }\r\n return this\r\n }\r\n\r\n play () {\r\n // Now make sure we are not paused and continue the animation\r\n this._paused = false\r\n return this.updateTime()._continue()\r\n }\r\n\r\n pause () {\r\n this._paused = true\r\n return this._continue()\r\n }\r\n\r\n stop () {\r\n // Go to start and pause\r\n this.time(0)\r\n return this.pause()\r\n }\r\n\r\n finish () {\r\n // Go to end and pause\r\n this.time(this.getEndTime() + 1)\r\n return this.pause()\r\n }\r\n\r\n speed (speed) {\r\n if (speed == null) return this._speed\r\n this._speed = speed\r\n return this\r\n }\r\n\r\n reverse (yes) {\r\n var currentSpeed = this.speed()\r\n if (yes == null) return this.speed(-currentSpeed)\r\n\r\n var positive = Math.abs(currentSpeed)\r\n return this.speed(yes ? positive : -positive)\r\n }\r\n\r\n seek (dt) {\r\n return this.time(this._time + dt)\r\n }\r\n\r\n time (time) {\r\n if (time == null) return this._time\r\n this._time = time\r\n return this._continue(true)\r\n }\r\n\r\n persist (dtOrForever) {\r\n if (dtOrForever == null) return this._persist\r\n this._persist = dtOrForever\r\n return this\r\n }\r\n\r\n source (fn) {\r\n if (fn == null) return this._timeSource\r\n this._timeSource = fn\r\n return this\r\n }\r\n\r\n _step (immediateStep = false) {\r\n // Get the time delta from the last time and update the time\r\n var time = this._timeSource()\r\n var dtSource = time - this._lastSourceTime\r\n\r\n if (immediateStep) dtSource = 0\r\n\r\n var dtTime = this._speed * dtSource + (this._time - this._lastStepTime)\r\n this._lastSourceTime = time\r\n\r\n // Only update the time if we use the timeSource.\r\n // Otherwise use the current time\r\n if (!immediateStep) {\r\n // Update the time\r\n this._time += dtTime\r\n this._time = this._time < 0 ? 0 : this._time\r\n }\r\n this._lastStepTime = this._time\r\n this.fire('time', this._time)\r\n\r\n // Run all of the runners directly\r\n var runnersLeft = false\r\n for (var i = 0, len = this._order.length; i < len; i++) {\r\n // Get and run the current runner and ignore it if its inactive\r\n var runnerInfo = this._runners[this._order[i]]\r\n var runner = runnerInfo.runner\r\n let dt = dtTime\r\n\r\n // Make sure that we give the actual difference\r\n // between runner start time and now\r\n let dtToStart = this._time - runnerInfo.start\r\n\r\n // Dont run runner if not started yet\r\n if (dtToStart <= 0) {\r\n runnersLeft = true\r\n\r\n // This is for the case that teh timeline was seeked so that the time\r\n // is now before the startTime of the runner. Thats why we need to set\r\n // the runner to position 0\r\n runner.reset()\r\n continue\r\n } else if (dtToStart < dt) {\r\n // Adjust dt to make sure that animation is on point\r\n dt = dtToStart\r\n }\r\n\r\n if (!runner.active()) continue\r\n\r\n // If this runner is still going, signal that we need another animation\r\n // frame, otherwise, remove the completed runner\r\n var finished = runner.step(dt).done\r\n if (!finished) {\r\n runnersLeft = true\r\n // continue\r\n } else if (runnerInfo.persist !== true) {\r\n // runner is finished. And runner might get removed\r\n\r\n var endTime = runner.duration() - runner.time() + this._time\r\n\r\n if (endTime + this._persist < this._time) {\r\n // Delete runner and correct index\r\n delete this._runners[this._order[i]]\r\n this._order.splice(i--, 1) && --len\r\n runner.timeline(null)\r\n }\r\n }\r\n }\r\n\r\n // Basically: we continue when there are runners right from us in time\r\n // when -->, and when runners are left from us when <--\r\n if ((runnersLeft && !(this._speed < 0 && this._time === 0)) || (this._order.length && this._speed < 0 && this._time > 0)) {\r\n this._continue()\r\n } else {\r\n this.fire('finished')\r\n this.pause()\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Checks if we are running and continues the animation\r\n _continue (immediateStep = false) {\r\n Animator.cancelFrame(this._nextFrame)\r\n this._nextFrame = null\r\n\r\n if (immediateStep) return this._step(true)\r\n if (this._paused) return this\r\n\r\n this._nextFrame = Animator.frame(this._step)\r\n return this\r\n }\r\n\r\n active () {\r\n return !!this._nextFrame\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Element: {\r\n timeline: function () {\r\n this._timeline = (this._timeline || new Timeline())\r\n return this._timeline\r\n }\r\n }\r\n})\r\n","import { Controller, Ease, Stepper } from './Controller.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { from, to } from '../modules/core/gradiented.js'\r\nimport { getOrigin } from '../utils/utils.js'\r\nimport { noop, timeline } from '../modules/core/defaults.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { rx, ry } from '../modules/core/circled.js'\r\nimport Animator from './Animator.js'\r\nimport Box from '../types/Box.js'\r\nimport EventTarget from '../types/EventTarget.js'\r\nimport Matrix from '../types/Matrix.js'\r\nimport Morphable, { TransformBag } from './Morphable.js'\r\nimport Point from '../types/Point.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Timeline from './Timeline.js'\r\n\r\nexport default class Runner extends EventTarget {\r\n constructor (options) {\r\n super()\r\n\r\n // Store a unique id on the runner, so that we can identify it later\r\n this.id = Runner.id++\r\n\r\n // Ensure a default value\r\n options = options == null\r\n ? timeline.duration\r\n : options\r\n\r\n // Ensure that we get a controller\r\n options = typeof options === 'function'\r\n ? new Controller(options)\r\n : options\r\n\r\n // Declare all of the variables\r\n this._element = null\r\n this._timeline = null\r\n this.done = false\r\n this._queue = []\r\n\r\n // Work out the stepper and the duration\r\n this._duration = typeof options === 'number' && options\r\n this._isDeclarative = options instanceof Controller\r\n this._stepper = this._isDeclarative ? options : new Ease()\r\n\r\n // We copy the current values from the timeline because they can change\r\n this._history = {}\r\n\r\n // Store the state of the runner\r\n this.enabled = true\r\n this._time = 0\r\n this._lastTime = 0\r\n\r\n // At creation, the runner is in reseted state\r\n this._reseted = true\r\n\r\n // Save transforms applied to this runner\r\n this.transforms = new Matrix()\r\n this.transformId = 1\r\n\r\n // Looping variables\r\n this._haveReversed = false\r\n this._reverse = false\r\n this._loopsDone = 0\r\n this._swing = false\r\n this._wait = 0\r\n this._times = 1\r\n }\r\n\r\n /*\r\n Runner Definitions\r\n ==================\r\n These methods help us define the runtime behaviour of the Runner or they\r\n help us make new runners from the current runner\r\n */\r\n\r\n element (element) {\r\n if (element == null) return this._element\r\n this._element = element\r\n element._prepareRunner()\r\n return this\r\n }\r\n\r\n timeline (timeline) {\r\n // check explicitly for undefined so we can set the timeline to null\r\n if (typeof timeline === 'undefined') return this._timeline\r\n this._timeline = timeline\r\n return this\r\n }\r\n\r\n animate (duration, delay, when) {\r\n var o = Runner.sanitise(duration, delay, when)\r\n var runner = new Runner(o.duration)\r\n if (this._timeline) runner.timeline(this._timeline)\r\n if (this._element) runner.element(this._element)\r\n return runner.loop(o).schedule(delay, when)\r\n }\r\n\r\n schedule (timeline, delay, when) {\r\n // The user doesn't need to pass a timeline if we already have one\r\n if (!(timeline instanceof Timeline)) {\r\n when = delay\r\n delay = timeline\r\n timeline = this.timeline()\r\n }\r\n\r\n // If there is no timeline, yell at the user...\r\n if (!timeline) {\r\n throw Error('Runner cannot be scheduled without timeline')\r\n }\r\n\r\n // Schedule the runner on the timeline provided\r\n timeline.schedule(this, delay, when)\r\n return this\r\n }\r\n\r\n unschedule () {\r\n var timeline = this.timeline()\r\n timeline && timeline.unschedule(this)\r\n return this\r\n }\r\n\r\n loop (times, swing, wait) {\r\n // Deal with the user passing in an object\r\n if (typeof times === 'object') {\r\n swing = times.swing\r\n wait = times.wait\r\n times = times.times\r\n }\r\n\r\n // Sanitise the values and store them\r\n this._times = times || Infinity\r\n this._swing = swing || false\r\n this._wait = wait || 0\r\n return this\r\n }\r\n\r\n delay (delay) {\r\n return this.animate(0, delay)\r\n }\r\n\r\n /*\r\n Basic Functionality\r\n ===================\r\n These methods allow us to attach basic functions to the runner directly\r\n */\r\n\r\n queue (initFn, runFn, retargetFn, isTransform) {\r\n this._queue.push({\r\n initialiser: initFn || noop,\r\n runner: runFn || noop,\r\n retarget: retargetFn,\r\n isTransform: isTransform,\r\n initialised: false,\r\n finished: false\r\n })\r\n var timeline = this.timeline()\r\n timeline && this.timeline()._continue()\r\n return this\r\n }\r\n\r\n during (fn) {\r\n return this.queue(null, fn)\r\n }\r\n\r\n after (fn) {\r\n return this.on('finish', fn)\r\n }\r\n\r\n /*\r\n Runner animation methods\r\n ========================\r\n Control how the animation plays\r\n */\r\n\r\n time (time) {\r\n if (time == null) {\r\n return this._time\r\n }\r\n let dt = time - this._time\r\n this.step(dt)\r\n return this\r\n }\r\n\r\n duration () {\r\n return this._times * (this._wait + this._duration) - this._wait\r\n }\r\n\r\n loops (p) {\r\n var loopDuration = this._duration + this._wait\r\n if (p == null) {\r\n var loopsDone = Math.floor(this._time / loopDuration)\r\n var relativeTime = (this._time - loopsDone * loopDuration)\r\n var position = relativeTime / this._duration\r\n return Math.min(loopsDone + position, this._times)\r\n }\r\n var whole = Math.floor(p)\r\n var partial = p % 1\r\n var time = loopDuration * whole + this._duration * partial\r\n return this.time(time)\r\n }\r\n\r\n position (p) {\r\n // Get all of the variables we need\r\n var x = this._time\r\n var d = this._duration\r\n var w = this._wait\r\n var t = this._times\r\n var s = this._swing\r\n var r = this._reverse\r\n var position\r\n\r\n if (p == null) {\r\n /*\r\n This function converts a time to a position in the range [0, 1]\r\n The full explanation can be found in this desmos demonstration\r\n https://www.desmos.com/calculator/u4fbavgche\r\n The logic is slightly simplified here because we can use booleans\r\n */\r\n\r\n // Figure out the value without thinking about the start or end time\r\n const f = function (x) {\r\n var swinging = s * Math.floor(x % (2 * (w + d)) / (w + d))\r\n var backwards = (swinging && !r) || (!swinging && r)\r\n var uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards\r\n var clipped = Math.max(Math.min(uncliped, 1), 0)\r\n return clipped\r\n }\r\n\r\n // Figure out the value by incorporating the start time\r\n var endTime = t * (w + d) - w\r\n position = x <= 0 ? Math.round(f(1e-5))\r\n : x < endTime ? f(x)\r\n : Math.round(f(endTime - 1e-5))\r\n return position\r\n }\r\n\r\n // Work out the loops done and add the position to the loops done\r\n var loopsDone = Math.floor(this.loops())\r\n var swingForward = s && (loopsDone % 2 === 0)\r\n var forwards = (swingForward && !r) || (r && swingForward)\r\n position = loopsDone + (forwards ? p : 1 - p)\r\n return this.loops(position)\r\n }\r\n\r\n progress (p) {\r\n if (p == null) {\r\n return Math.min(1, this._time / this.duration())\r\n }\r\n return this.time(p * this.duration())\r\n }\r\n\r\n step (dt) {\r\n // If we are inactive, this stepper just gets skipped\r\n if (!this.enabled) return this\r\n\r\n // Update the time and get the new position\r\n dt = dt == null ? 16 : dt\r\n this._time += dt\r\n var position = this.position()\r\n\r\n // Figure out if we need to run the stepper in this frame\r\n var running = this._lastPosition !== position && this._time >= 0\r\n this._lastPosition = position\r\n\r\n // Figure out if we just started\r\n var duration = this.duration()\r\n var justStarted = this._lastTime <= 0 && this._time > 0\r\n var justFinished = this._lastTime < this._time && this.time > duration\r\n this._lastTime = this._time\r\n if (justStarted) {\r\n this.fire('start', this)\r\n }\r\n\r\n // Work out if the runner is finished set the done flag here so animations\r\n // know, that they are running in the last step (this is good for\r\n // transformations which can be merged)\r\n var declarative = this._isDeclarative\r\n this.done = !declarative && !justFinished && this._time >= duration\r\n\r\n // Runner is running. So its not in reseted state anymore\r\n this._reseted = false\r\n\r\n // Call initialise and the run function\r\n if (running || declarative) {\n this._initialise(running)\r\n\r\n // clear the transforms on this runner so they dont get added again and again\r\n this.transforms = new Matrix()\r\n var converged = this._run(declarative ? dt : position)\r\n\r\n this.fire('step', this)\r\n }\r\n // correct the done flag here\r\n // declaritive animations itself know when they converged\r\n this.done = this.done || (converged && declarative)\r\n if (this.done) {\r\n this.fire('finish', this)\r\n }\r\n return this\r\n }\r\n\r\n reset () {\r\n if (this._reseted) return this\r\n this.loops(0)\r\n this._reseted = true\r\n return this\r\n }\r\n\r\n finish () {\r\n return this.step(Infinity)\r\n }\r\n\r\n reverse (reverse) {\r\n this._reverse = reverse == null ? !this._reverse : reverse\r\n return this\r\n }\r\n\r\n ease (fn) {\r\n this._stepper = new Ease(fn)\r\n return this\r\n }\r\n\r\n active (enabled) {\r\n if (enabled == null) return this.enabled\r\n this.enabled = enabled\r\n return this\r\n }\r\n\r\n /*\r\n Private Methods\r\n ===============\r\n Methods that shouldn't be used externally\r\n */\r\n\r\n // Save a morpher to the morpher list so that we can retarget it later\r\n _rememberMorpher (method, morpher) {\r\n this._history[method] = {\r\n morpher: morpher,\r\n caller: this._queue[this._queue.length - 1]\r\n }\r\n }\r\n\r\n // Try to set the target for a morpher if the morpher exists, otherwise\r\n // do nothing and return false\r\n _tryRetarget (method, target) {\r\n if (this._history[method]) {\r\n // if the last method wasnt even initialised, throw it away\r\n if (!this._history[method].caller.initialised) {\r\n let index = this._queue.indexOf(this._history[method].caller)\r\n this._queue.splice(index, 1)\r\n return false\r\n }\r\n\r\n // for the case of transformations, we use the special retarget function\r\n // which has access to the outer scope\r\n if (this._history[method].caller.retarget) {\r\n this._history[method].caller.retarget(target)\r\n // for everything else a simple morpher change is sufficient\r\n } else {\r\n this._history[method].morpher.to(target)\r\n }\r\n\r\n this._history[method].caller.finished = false\r\n var timeline = this.timeline()\r\n timeline && timeline._continue()\r\n return true\r\n }\r\n return false\r\n }\r\n\r\n // Run each initialise function in the runner if required\r\n _initialise (running) {\r\n // If we aren't running, we shouldn't initialise when not declarative\r\n if (!running && !this._isDeclarative) return\r\n\r\n // Loop through all of the initialisers\r\n for (var i = 0, len = this._queue.length; i < len; ++i) {\r\n // Get the current initialiser\r\n var current = this._queue[i]\r\n\r\n // Determine whether we need to initialise\r\n var needsIt = this._isDeclarative || (!current.initialised && running)\r\n running = !current.finished\r\n\r\n // Call the initialiser if we need to\r\n if (needsIt && running) {\r\n current.initialiser.call(this)\r\n current.initialised = true\r\n }\r\n }\r\n }\r\n\r\n // Run each run function for the position or dt given\r\n _run (positionOrDt) {\r\n // Run all of the _queue directly\r\n var allfinished = true\r\n for (var i = 0, len = this._queue.length; i < len; ++i) {\r\n // Get the current function to run\r\n var current = this._queue[i]\r\n\r\n // Run the function if its not finished, we keep track of the finished\r\n // flag for the sake of declarative _queue\r\n var converged = current.runner.call(this, positionOrDt)\r\n current.finished = current.finished || (converged === true)\r\n allfinished = allfinished && current.finished\r\n }\r\n\r\n // We report when all of the constructors are finished\r\n return allfinished\r\n }\r\n\r\n addTransform (transform, index) {\r\n this.transforms.lmultiplyO(transform)\r\n return this\r\n }\r\n\r\n clearTransform () {\r\n this.transforms = new Matrix()\r\n return this\r\n }\r\n\r\n // TODO: Keep track of all transformations so that deletion is faster\r\n clearTransformsFromQueue () {\r\n if (!this.done) {\r\n this._queue = this._queue.filter((item) => {\r\n return !item.isTransform\r\n })\r\n }\r\n }\r\n\r\n static sanitise (duration, delay, when) {\r\n // Initialise the default parameters\r\n var times = 1\r\n var swing = false\r\n var wait = 0\r\n duration = duration || timeline.duration\r\n delay = delay || timeline.delay\r\n when = when || 'last'\r\n\r\n // If we have an object, unpack the values\r\n if (typeof duration === 'object' && !(duration instanceof Stepper)) {\r\n delay = duration.delay || delay\r\n when = duration.when || when\r\n swing = duration.swing || swing\r\n times = duration.times || times\r\n wait = duration.wait || wait\r\n duration = duration.duration || timeline.duration\r\n }\r\n\r\n return {\r\n duration: duration,\r\n delay: delay,\r\n swing: swing,\r\n times: times,\r\n wait: wait,\r\n when: when\r\n }\r\n }\r\n}\r\n\r\nRunner.id = 0\r\n\r\nclass FakeRunner {\r\n constructor (transforms = new Matrix(), id = -1, done = true) {\r\n this.transforms = transforms\r\n this.id = id\r\n this.done = done\r\n }\r\n\r\n clearTransformsFromQueue () { }\r\n}\r\n\r\nextend([Runner, FakeRunner], {\r\n mergeWith (runner) {\r\n return new FakeRunner(\r\n runner.transforms.lmultiply(this.transforms),\r\n runner.id\r\n )\r\n }\r\n})\r\n\r\n// FakeRunner.emptyRunner = new FakeRunner()\r\n\r\nconst lmultiply = (last, curr) => last.lmultiplyO(curr)\r\nconst getRunnerTransform = (runner) => runner.transforms\r\n\r\nfunction mergeTransforms () {\r\n // Find the matrix to apply to the element and apply it\r\n let runners = this._transformationRunners.runners\r\n let netTransform = runners\r\n .map(getRunnerTransform)\r\n .reduce(lmultiply, new Matrix())\r\n\r\n this.transform(netTransform)\r\n\r\n this._transformationRunners.merge()\r\n\r\n if (this._transformationRunners.length() === 1) {\r\n this._frameId = null\r\n }\r\n}\r\n\r\nclass RunnerArray {\r\n constructor () {\r\n this.runners = []\r\n this.ids = []\r\n }\r\n\r\n add (runner) {\r\n if (this.runners.includes(runner)) return\r\n\r\n let id = runner.id + 1\r\n\r\n let leftSibling = this.ids.reduce((last, curr) => {\r\n if (curr > last && curr < id) return curr\r\n return last\r\n }, 0)\r\n\r\n let index = this.ids.indexOf(leftSibling) + 1\r\n\r\n this.ids.splice(index, 0, id)\r\n this.runners.splice(index, 0, runner)\r\n\r\n return this\r\n }\r\n\r\n getByID (id) {\r\n return this.runners[this.ids.indexOf(id + 1)]\r\n }\r\n\r\n remove (id) {\r\n let index = this.ids.indexOf(id + 1)\r\n this.ids.splice(index, 1)\r\n this.runners.splice(index, 1)\r\n return this\r\n }\r\n\r\n merge () {\r\n let lastRunner = null\r\n this.runners.forEach((runner, i) => {\r\n if (lastRunner && runner.done && lastRunner.done) {\r\n this.remove(runner.id)\r\n this.edit(lastRunner.id, runner.mergeWith(lastRunner))\r\n }\r\n\r\n lastRunner = runner\r\n })\r\n\r\n return this\r\n }\r\n\r\n edit (id, newRunner) {\r\n let index = this.ids.indexOf(id + 1)\r\n this.ids.splice(index, 1, id)\r\n this.runners.splice(index, 1, newRunner)\r\n return this\r\n }\r\n\r\n length () {\r\n return this.ids.length\r\n }\r\n\r\n clearBefore (id) {\r\n let deleteCnt = this.ids.indexOf(id + 1) || 1\r\n this.ids.splice(0, deleteCnt, 0)\r\n this.runners.splice(0, deleteCnt, new FakeRunner())\r\n .forEach((r) => r.clearTransformsFromQueue())\r\n return this\r\n }\r\n}\r\n\r\nlet frameId = 0\r\nregisterMethods({\r\n Element: {\r\n animate (duration, delay, when) {\r\n var o = Runner.sanitise(duration, delay, when)\r\n var timeline = this.timeline()\r\n return new Runner(o.duration)\r\n .loop(o)\r\n .element(this)\r\n .timeline(timeline.play())\r\n .schedule(delay, when)\r\n },\r\n\r\n delay (by, when) {\r\n return this.animate(0, by, when)\r\n },\r\n\r\n // this function searches for all runners on the element and deletes the ones\r\n // which run before the current one. This is because absolute transformations\r\n // overwfrite anything anyway so there is no need to waste time computing\r\n // other runners\r\n _clearTransformRunnersBefore (currentRunner) {\r\n this._transformationRunners.clearBefore(currentRunner.id)\r\n },\r\n\r\n _currentTransform (current) {\r\n return this._transformationRunners.runners\r\n // we need the equal sign here to make sure, that also transformations\r\n // on the same runner which execute before the current transformation are\r\n // taken into account\r\n .filter((runner) => runner.id <= current.id)\r\n .map(getRunnerTransform)\r\n .reduce(lmultiply, new Matrix())\r\n },\r\n\r\n addRunner (runner) {\r\n this._transformationRunners.add(runner)\r\n\r\n Animator.transform_frame(\r\n mergeTransforms.bind(this), this._frameId\r\n )\r\n },\r\n\r\n _prepareRunner () {\r\n if (this._frameId == null) {\r\n this._transformationRunners = new RunnerArray()\r\n .add(new FakeRunner(new Matrix(this)))\r\n\r\n this._frameId = frameId++\r\n }\r\n }\r\n }\r\n})\r\n\r\nextend(Runner, {\r\n attr (a, v) {\r\n return this.styleAttr('attr', a, v)\r\n },\r\n\r\n // Add animatable styles\r\n css (s, v) {\r\n return this.styleAttr('css', s, v)\r\n },\r\n\r\n styleAttr (type, name, val) {\r\n // apply attributes individually\r\n if (typeof name === 'object') {\r\n for (var key in val) {\r\n this.styleAttr(type, key, val[key])\r\n }\r\n }\r\n\r\n var morpher = new Morphable(this._stepper).to(val)\r\n\r\n this.queue(function () {\r\n morpher = morpher.from(this.element()[type](name))\r\n }, function (pos) {\r\n this.element()[type](name, morpher.at(pos))\r\n return morpher.done()\r\n })\r\n\r\n return this\r\n },\r\n\r\n zoom (level, point) {\r\n var morpher = new Morphable(this._stepper).to(new SVGNumber(level))\r\n\r\n this.queue(function () {\r\n morpher = morpher.from(this.zoom())\r\n }, function (pos) {\r\n this.element().zoom(morpher.at(pos), point)\r\n return morpher.done()\r\n })\r\n\r\n return this\r\n },\r\n\r\n /**\r\n ** absolute transformations\r\n **/\r\n\r\n //\r\n // M v -----|-----(D M v = F v)------|-----> T v\r\n //\r\n // 1. define the final state (T) and decompose it (once)\r\n // t = [tx, ty, the, lam, sy, sx]\r\n // 2. on every frame: pull the current state of all previous transforms\r\n // (M - m can change)\r\n // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]\r\n // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)\r\n // - Note F(0) = M\r\n // - Note F(1) = T\r\n // 4. Now you get the delta matrix as a result: D = F * inv(M)\r\n\r\n transform (transforms, relative, affine) {\r\n // If we have a declarative function, we should retarget it if possible\r\n relative = transforms.relative || relative\r\n if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) {\r\n return this\r\n }\r\n\r\n // Parse the parameters\r\n var isMatrix = Matrix.isMatrixLike(transforms)\r\n affine = transforms.affine != null\r\n ? transforms.affine\r\n : (affine != null ? affine : !isMatrix)\r\n\r\n // Create a morepher and set its type\r\n const morpher = new Morphable(this._stepper)\r\n .type(affine ? TransformBag : Matrix)\r\n\r\n let origin\r\n let element\r\n let current\r\n let currentAngle\r\n let startTransform\r\n\r\n function setup () {\r\n // make sure element and origin is defined\r\n element = element || this.element()\r\n origin = origin || getOrigin(transforms, element)\r\n\r\n startTransform = new Matrix(relative ? undefined : element)\r\n\r\n // add the runner to the element so it can merge transformations\r\n element.addRunner(this)\r\n\r\n // Deactivate all transforms that have run so far if we are absolute\r\n if (!relative) {\r\n element._clearTransformRunnersBefore(this)\r\n }\r\n }\r\n\r\n function run (pos) {\r\n // clear all other transforms before this in case something is saved\r\n // on this runner. We are absolute. We dont need these!\r\n if (!relative) this.clearTransform()\r\n\r\n let { x, y } = new Point(origin).transform(element._currentTransform(this))\r\n\r\n let target = new Matrix({ ...transforms, origin: [x, y] })\r\n let start = this._isDeclarative && current\r\n ? current\r\n : startTransform\r\n\r\n if (affine) {\r\n target = target.decompose(x, y)\r\n start = start.decompose(x, y)\r\n\r\n // Get the current and target angle as it was set\r\n const rTarget = target.rotate\r\n const rCurrent = start.rotate\r\n\r\n // Figure out the shortest path to rotate directly\r\n const possibilities = [rTarget - 360, rTarget, rTarget + 360]\r\n const distances = possibilities.map(a => Math.abs(a - rCurrent))\r\n const shortest = Math.min(...distances)\r\n const index = distances.indexOf(shortest)\r\n target.rotate = possibilities[index]\r\n }\r\n\r\n if (relative) {\r\n // we have to be careful here not to overwrite the rotation\r\n // with the rotate method of Matrix\r\n if (!isMatrix) {\r\n target.rotate = transforms.rotate || 0\r\n }\r\n if (this._isDeclarative && currentAngle) {\r\n start.rotate = currentAngle\r\n }\r\n }\r\n\r\n morpher.from(start)\r\n morpher.to(target)\r\n\r\n let affineParameters = morpher.at(pos)\r\n currentAngle = affineParameters.rotate\r\n current = new Matrix(affineParameters)\r\n\r\n this.addTransform(current)\r\n return morpher.done()\r\n }\r\n\r\n function retarget (newTransforms) {\r\n // only get a new origin if it changed since the last call\r\n if (\r\n (newTransforms.origin || 'center').toString() !==\r\n (transforms.origin || 'center').toString()\r\n ) {\r\n origin = getOrigin(transforms, element)\r\n }\r\n\r\n // overwrite the old transformations with the new ones\r\n transforms = { ...newTransforms, origin }\r\n }\r\n\r\n this.queue(setup, run, retarget, true)\r\n this._isDeclarative && this._rememberMorpher('transform', morpher)\r\n return this\r\n },\r\n\r\n // Animatable x-axis\r\n x (x, relative) {\r\n return this._queueNumber('x', x)\r\n },\r\n\r\n // Animatable y-axis\r\n y (y) {\r\n return this._queueNumber('y', y)\r\n },\r\n\r\n dx (x) {\r\n return this._queueNumberDelta('x', x)\r\n },\r\n\r\n dy (y) {\r\n return this._queueNumberDelta('y', y)\r\n },\r\n\r\n _queueNumberDelta (method, to) {\r\n to = new SVGNumber(to)\r\n\r\n // Try to change the target if we have this method already registerd\r\n if (this._tryRetarget(method, to)) return this\r\n\r\n // Make a morpher and queue the animation\r\n var morpher = new Morphable(this._stepper).to(to)\r\n var from = null\r\n this.queue(function () {\r\n from = this.element()[method]()\r\n morpher.from(from)\r\n morpher.to(from + to)\r\n }, function (pos) {\r\n this.element()[method](morpher.at(pos))\r\n return morpher.done()\r\n }, function (newTo) {\r\n morpher.to(from + new SVGNumber(newTo))\r\n })\r\n\r\n // Register the morpher so that if it is changed again, we can retarget it\r\n this._rememberMorpher(method, morpher)\r\n return this\r\n },\r\n\r\n _queueObject (method, to) {\r\n // Try to change the target if we have this method already registerd\r\n if (this._tryRetarget(method, to)) return this\r\n\r\n // Make a morpher and queue the animation\r\n var morpher = new Morphable(this._stepper).to(to)\r\n this.queue(function () {\r\n morpher.from(this.element()[method]())\r\n }, function (pos) {\r\n this.element()[method](morpher.at(pos))\r\n return morpher.done()\r\n })\r\n\r\n // Register the morpher so that if it is changed again, we can retarget it\r\n this._rememberMorpher(method, morpher)\r\n return this\r\n },\r\n\r\n _queueNumber (method, value) {\r\n return this._queueObject(method, new SVGNumber(value))\r\n },\r\n\r\n // Animatable center x-axis\r\n cx (x) {\r\n return this._queueNumber('cx', x)\r\n },\r\n\r\n // Animatable center y-axis\r\n cy (y) {\r\n return this._queueNumber('cy', y)\r\n },\r\n\r\n // Add animatable move\r\n move (x, y) {\r\n return this.x(x).y(y)\r\n },\r\n\r\n // Add animatable center\r\n center (x, y) {\r\n return this.cx(x).cy(y)\r\n },\r\n\r\n // Add animatable size\r\n size (width, height) {\r\n // animate bbox based size for all other elements\r\n var box\r\n\r\n if (!width || !height) {\r\n box = this._element.bbox()\r\n }\r\n\r\n if (!width) {\r\n width = box.width / box.height * height\r\n }\r\n\r\n if (!height) {\r\n height = box.height / box.width * width\r\n }\r\n\r\n return this\r\n .width(width)\r\n .height(height)\r\n },\r\n\r\n // Add animatable width\r\n width (width) {\r\n return this._queueNumber('width', width)\r\n },\r\n\r\n // Add animatable height\r\n height (height) {\r\n return this._queueNumber('height', height)\r\n },\r\n\r\n // Add animatable plot\r\n plot (a, b, c, d) {\r\n // Lines can be plotted with 4 arguments\r\n if (arguments.length === 4) {\r\n return this.plot([a, b, c, d])\r\n }\r\n\r\n var morpher = this._element.MorphArray().to(a)\r\n\r\n this.queue(function () {\r\n morpher.from(this._element.array())\r\n }, function (pos) {\r\n this._element.plot(morpher.at(pos))\r\n })\r\n\r\n return this\r\n },\r\n\r\n // Add leading method\r\n leading (value) {\r\n return this._queueNumber('leading', value)\r\n },\r\n\r\n // Add animatable viewbox\r\n viewbox (x, y, width, height) {\r\n return this._queueObject('viewbox', new Box(x, y, width, height))\r\n },\r\n\r\n update (o) {\r\n if (typeof o !== 'object') {\r\n return this.update({\r\n offset: arguments[0],\r\n color: arguments[1],\r\n opacity: arguments[2]\r\n })\r\n }\r\n\r\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\r\n if (o.color != null) this.attr('stop-color', o.color)\r\n if (o.offset != null) this.attr('offset', o.offset)\r\n\r\n return this\r\n }\r\n})\r\n\r\nextend(Runner, { rx, ry, from, to })\r\n","import {\r\n adopt,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { ns, svgjs, xlink, xmlns } from '../modules/core/namespaces.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\nimport Defs from './Defs.js'\r\nimport { globals } from '../utils/window.js'\r\n\r\nexport default class Svg extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('svg', node), node)\r\n this.namespace()\r\n }\r\n\r\n isRoot () {\r\n return !this.node.parentNode ||\r\n !(this.node.parentNode instanceof globals.window.SVGElement) ||\r\n this.node.parentNode.nodeName === '#document'\r\n }\r\n\r\n // Check if this is a root svg\r\n // If not, call docs from this element\r\n root () {\r\n if (this.isRoot()) return this\r\n return super.root()\r\n }\r\n\r\n // Add namespaces\r\n namespace () {\r\n if (!this.isRoot()) return this.root().namespace()\r\n return this\r\n .attr({ xmlns: ns, version: '1.1' })\r\n .attr('xmlns:xlink', xlink, xmlns)\r\n .attr('xmlns:svgjs', svgjs, xmlns)\r\n }\r\n\r\n // Creates and returns defs element\r\n defs () {\r\n if (!this.isRoot()) return this.root().defs()\r\n\r\n return adopt(this.node.getElementsByTagName('defs')[0]) ||\r\n this.put(new Defs())\r\n }\r\n\r\n // custom parent method\r\n parent (type) {\r\n if (this.isRoot()) {\r\n return this.node.parentNode.nodeName === '#document'\r\n ? null\r\n : adopt(this.node.parentNode)\r\n }\r\n\r\n return super.parent(type)\r\n }\r\n\r\n clear () {\r\n // remove children\r\n while (this.node.hasChildNodes()) {\r\n this.node.removeChild(this.node.lastChild)\r\n }\r\n return this\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create nested svg document\r\n nested: wrapWithAttrCheck(function () {\r\n return this.put(new Svg())\r\n })\r\n }\r\n})\r\n\r\nregister(Svg, 'Svg', true)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class Symbol extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('symbol', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n symbol: wrapWithAttrCheck(function () {\r\n return this.put(new Symbol())\r\n })\r\n }\r\n})\r\n\r\nregister(Symbol)\r\n","import { globals } from '../../utils/window.js'\r\n\r\n// Create plain text node\r\nexport function plain (text) {\r\n // clear if build mode is disabled\r\n if (this._build === false) {\r\n this.clear()\r\n }\r\n\r\n // create text node\r\n this.node.appendChild(globals.document.createTextNode(text))\r\n\r\n return this\r\n}\r\n\r\n// Get length of text element\r\nexport function length () {\r\n return this.node.getComputedTextLength()\r\n}\r\n","import {\r\n adopt,\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { attrs } from '../modules/core/defaults.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Shape from './Shape.js'\r\nimport { globals } from '../utils/window.js'\r\nimport * as textable from '../modules/core/textable.js'\r\n\r\nexport default class Text extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('text', node), node)\r\n\r\n this.dom.leading = new SVGNumber(1.3) // store leading value for rebuilding\r\n this._rebuild = true // enable automatic updating of dy values\r\n this._build = false // disable build mode for adding multiple lines\r\n\r\n // set default font\r\n this.attr('font-family', attrs['font-family'])\r\n }\r\n\r\n // Move over x-axis\r\n x (x) {\r\n // act as getter\r\n if (x == null) {\r\n return this.attr('x')\r\n }\r\n\r\n return this.attr('x', x)\r\n }\r\n\r\n // Move over y-axis\r\n y (y) {\r\n var oy = this.attr('y')\r\n var o = typeof oy === 'number' ? oy - this.bbox().y : 0\r\n\r\n // act as getter\r\n if (y == null) {\r\n return typeof oy === 'number' ? oy - o : oy\r\n }\r\n\r\n return this.attr('y', typeof y === 'number' ? y + o : y)\r\n }\r\n\r\n // Move center over x-axis\r\n cx (x) {\r\n return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2)\r\n }\r\n\r\n // Move center over y-axis\r\n cy (y) {\r\n return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2)\r\n }\r\n\r\n // Set the text content\r\n text (text) {\r\n // act as getter\r\n if (text === undefined) {\r\n var children = this.node.childNodes\r\n var firstLine = 0\r\n text = ''\r\n\r\n for (var i = 0, len = children.length; i < len; ++i) {\r\n // skip textPaths - they are no lines\r\n if (children[i].nodeName === 'textPath') {\r\n if (i === 0) firstLine = 1\r\n continue\r\n }\r\n\r\n // add newline if its not the first child and newLined is set to true\r\n if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) {\r\n text += '\\n'\r\n }\r\n\r\n // add content of this node\r\n text += children[i].textContent\r\n }\r\n\r\n return text\r\n }\r\n\r\n // remove existing content\r\n this.clear().build(true)\r\n\r\n if (typeof text === 'function') {\r\n // call block\r\n text.call(this, this)\r\n } else {\r\n // store text and make sure text is not blank\r\n text = text.split('\\n')\r\n\r\n // build new lines\r\n for (var j = 0, jl = text.length; j < jl; j++) {\r\n this.tspan(text[j]).newLine()\r\n }\r\n }\r\n\r\n // disable build mode and rebuild lines\r\n return this.build(false).rebuild()\r\n }\r\n\r\n // Set / get leading\r\n leading (value) {\r\n // act as getter\r\n if (value == null) {\r\n return this.dom.leading\r\n }\r\n\r\n // act as setter\r\n this.dom.leading = new SVGNumber(value)\r\n\r\n return this.rebuild()\r\n }\r\n\r\n // Rebuild appearance type\r\n rebuild (rebuild) {\r\n // store new rebuild flag if given\r\n if (typeof rebuild === 'boolean') {\r\n this._rebuild = rebuild\r\n }\r\n\r\n // define position of all lines\r\n if (this._rebuild) {\r\n var self = this\r\n var blankLineOffset = 0\r\n var leading = this.dom.leading\r\n\r\n this.each(function () {\r\n var fontSize = globals.window.getComputedStyle(this.node)\r\n .getPropertyValue('font-size')\r\n var dy = leading * new SVGNumber(fontSize)\r\n\r\n if (this.dom.newLined) {\r\n this.attr('x', self.attr('x'))\r\n\r\n if (this.text() === '\\n') {\r\n blankLineOffset += dy\r\n } else {\r\n this.attr('dy', dy + blankLineOffset)\r\n blankLineOffset = 0\r\n }\r\n }\r\n })\r\n\r\n this.fire('rebuild')\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Enable / disable build mode\r\n build (build) {\r\n this._build = !!build\r\n return this\r\n }\r\n\r\n // overwrite method from parent to set data properly\r\n setData (o) {\r\n this.dom = o\r\n this.dom.leading = new SVGNumber(o.leading || 1.3)\r\n return this\r\n }\r\n}\r\n\r\nextend(Text, textable)\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create text element\r\n text: wrapWithAttrCheck(function (text) {\r\n return this.put(new Text()).text(text)\r\n }),\r\n\r\n // Create plain text element\r\n plain: wrapWithAttrCheck(function (text) {\r\n return this.put(new Text()).plain(text)\r\n })\r\n }\r\n})\r\n\r\nregister(Text)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Text from './Text.js'\r\nimport * as textable from '../modules/core/textable.js'\r\n\r\nexport default class Tspan extends Text {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('tspan', node), node)\r\n }\r\n\r\n // Set text content\r\n text (text) {\r\n if (text == null) return this.node.textContent + (this.dom.newLined ? '\\n' : '')\r\n\r\n typeof text === 'function' ? text.call(this, this) : this.plain(text)\r\n\r\n return this\r\n }\r\n\r\n // Shortcut dx\r\n dx (dx) {\r\n return this.attr('dx', dx)\r\n }\r\n\r\n // Shortcut dy\r\n dy (dy) {\r\n return this.attr('dy', dy)\r\n }\r\n\r\n // Create new line\r\n newLine () {\r\n // fetch text parent\r\n var t = this.parent(Text)\r\n\r\n // mark new line\r\n this.dom.newLined = true\r\n\r\n // apply new position\r\n return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x())\r\n }\r\n}\r\n\r\nextend(Tspan, textable)\r\n\r\nregisterMethods({\r\n Tspan: {\r\n tspan: wrapWithAttrCheck(function (text) {\r\n var tspan = new Tspan()\r\n\r\n // clear if build mode is disabled\r\n if (!this._build) {\r\n this.clear()\r\n }\r\n\r\n // add new tspan\r\n this.node.appendChild(tspan.node)\r\n\r\n return tspan.text(text)\r\n })\r\n }\r\n})\r\n\r\nregister(Tspan)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class ClipPath extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('clipPath', node), node)\r\n }\r\n\r\n // Unclip all clipped elements and remove itself\r\n remove () {\r\n // unclip all targets\r\n this.targets().forEach(function (el) {\r\n el.unclip()\r\n })\r\n\r\n // remove clipPath from parent\r\n return super.remove()\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [clip-path*=\"' + this.id() + '\"]')\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create clipping element\r\n clip: wrapWithAttrCheck(function () {\r\n return this.defs().put(new ClipPath())\r\n })\r\n },\r\n Element: {\r\n // Distribute clipPath to svg element\r\n clipWith (element) {\r\n // use given clip or create a new one\r\n let clipper = element instanceof ClipPath\r\n ? element\r\n : this.parent().clip().add(element)\r\n\r\n // apply mask\r\n return this.attr('clip-path', 'url(\"#' + clipper.id() + '\")')\r\n },\r\n\r\n // Unclip element\r\n unclip () {\r\n return this.attr('clip-path', null)\r\n },\r\n\r\n clipper () {\r\n return this.reference('clip-path')\r\n }\r\n }\r\n})\r\n\r\nregister(ClipPath)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class G extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('g', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Element: {\r\n // Create a group element\r\n group: wrapWithAttrCheck(function () {\r\n return this.put(new G())\r\n })\r\n }\r\n})\r\n\r\nregister(G)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class A extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('a', node), node)\r\n }\r\n\r\n // Link url\r\n to (url) {\r\n return this.attr('href', url, xlink)\r\n }\r\n\r\n // Link target attribute\r\n target (target) {\r\n return this.attr('target', target)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a hyperlink element\r\n link: wrapWithAttrCheck(function (url) {\r\n return this.put(new A()).to(url)\r\n })\r\n },\r\n Element: {\r\n // Create a hyperlink element\r\n linkTo: function (url) {\r\n var link = new A()\r\n\r\n if (typeof url === 'function') { url.call(link, link) } else {\r\n link.to(url)\r\n }\r\n\r\n return this.parent().put(link).put(this)\r\n }\r\n }\r\n})\r\n\r\nregister(A)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class Mask extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('mask', node), node)\r\n }\r\n\r\n // Unmask all masked elements and remove itself\r\n remove () {\r\n // unmask all targets\r\n this.targets().forEach(function (el) {\r\n el.unmask()\r\n })\r\n\r\n // remove mask from parent\r\n return super.remove()\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [mask*=\"' + this.id() + '\"]')\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n mask: wrapWithAttrCheck(function () {\r\n return this.defs().put(new Mask())\r\n })\r\n },\r\n Element: {\r\n // Distribute mask to svg element\r\n maskWith (element) {\r\n // use given mask or create a new one\r\n var masker = element instanceof Mask\r\n ? element\r\n : this.parent().mask().add(element)\r\n\r\n // apply mask\r\n return this.attr('mask', 'url(\"#' + masker.id() + '\")')\r\n },\r\n\r\n // Unmask element\r\n unmask () {\r\n return this.attr('mask', null)\r\n },\r\n\r\n masker () {\r\n return this.reference('mask')\r\n }\r\n }\r\n})\r\n\r\nregister(Mask)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { unCamelCase } from '../utils/utils.js'\r\nimport Element from './Element.js'\r\n\r\nfunction cssRule (selector, rule) {\r\n if (!selector) return ''\r\n if (!rule) return selector\r\n\r\n var ret = selector + '{'\r\n\r\n for (var i in rule) {\r\n ret += unCamelCase(i) + ':' + rule[i] + ';'\r\n }\r\n\r\n ret += '}'\r\n\r\n return ret\r\n}\r\n\r\nexport default class Style extends Element {\r\n constructor (node) {\r\n super(nodeOrNew('style', node), node)\r\n }\r\n\r\n addText (w = '') {\r\n this.node.textContent += w\r\n return this\r\n }\r\n\r\n font (name, src, params = {}) {\r\n return this.rule('@font-face', {\r\n fontFamily: name,\r\n src: src,\r\n ...params\r\n })\r\n }\r\n\r\n rule (selector, obj) {\r\n return this.addText(cssRule(selector, obj))\r\n }\r\n}\r\n\r\nregisterMethods('Dom', {\r\n style: wrapWithAttrCheck(function (selector, obj) {\r\n return this.put(new Style()).rule(selector, obj)\r\n }),\r\n fontface: wrapWithAttrCheck(function (name, src, params) {\r\n return this.put(new Style()).font(name, src, params)\r\n })\r\n})\r\n\r\nregister(Style)\r\n","var isObject = require('./_is-object');\nvar isArray = require('./_is-array');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (original) {\n var C;\n if (isArray(original)) {\n C = original.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return C === undefined ? Array : C;\n};\n","// 0 -> Array#forEach\n// 1 -> Array#map\n// 2 -> Array#filter\n// 3 -> Array#some\n// 4 -> Array#every\n// 5 -> Array#find\n// 6 -> Array#findIndex\nvar ctx = require('./_ctx');\nvar IObject = require('./_iobject');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar asc = require('./_array-species-create');\nmodule.exports = function (TYPE, $create) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n var create = $create || asc;\n return function ($this, callbackfn, that) {\n var O = toObject($this);\n var self = IObject(O);\n var f = ctx(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var val, res;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n val = self[index];\n res = f(val, index, O);\n if (TYPE) {\n if (IS_MAP) result[index] = res; // map\n else if (res) switch (TYPE) {\n case 3: return true; // some\n case 5: return val; // find\n case 6: return index; // findIndex\n case 2: result.push(val); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;\n };\n};\n","'use strict';\n// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)\nvar $export = require('./_export');\nvar $find = require('./_array-methods')(5);\nvar KEY = 'find';\nvar forced = true;\n// Shouldn't skip holes\nif (KEY in []) Array(1)[KEY](function () { forced = false; });\n$export($export.P + $export.F * forced, 'Array', {\n find: function find(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\nrequire('./_add-to-unscopables')(KEY);\n","// 9.4.2.3 ArraySpeciesCreate(originalArray, length)\nvar speciesConstructor = require('./_array-species-constructor');\n\nmodule.exports = function (original, length) {\n return new (speciesConstructor(original))(length);\n};\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Path from './Path.js'\r\nimport PathArray from '../types/PathArray.js'\r\nimport Text from './Text.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class TextPath extends Text {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('textPath', node), node)\r\n }\r\n\r\n // return the array of the path track element\r\n array () {\r\n var track = this.track()\r\n\r\n return track ? track.array() : null\r\n }\r\n\r\n // Plot path if any\r\n plot (d) {\r\n var track = this.track()\r\n var pathArray = null\r\n\r\n if (track) {\r\n pathArray = track.plot(d)\r\n }\r\n\r\n return (d == null) ? pathArray : this\r\n }\r\n\r\n // Get the path element\r\n track () {\r\n return this.reference('href')\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n textPath: wrapWithAttrCheck(function (text, path) {\r\n return this.defs().path(path).text(text).addTo(this)\r\n })\r\n },\r\n Text: {\r\n // Create path for text to run on\r\n path: wrapWithAttrCheck(function (track) {\r\n var path = new TextPath()\r\n\r\n // if track is a path, reuse it\r\n if (!(track instanceof Path)) {\r\n // create path element\r\n track = this.root().defs().path(track)\r\n }\r\n\r\n // link textPath to path and add content\r\n path.attr('href', '#' + track, xlink)\r\n\r\n // add textPath element as child node and return textPath\r\n return this.put(path)\r\n }),\r\n\r\n // Get the textPath children\r\n textPath () {\r\n return this.find('textPath')[0]\r\n }\r\n },\r\n Path: {\r\n // creates a textPath from this path\r\n text: wrapWithAttrCheck(function (text) {\r\n if (text instanceof Text) {\r\n var txt = text.text()\r\n return text.clear().path(this).text(txt)\r\n }\r\n return this.parent().put(new Text()).path(this).text(text)\r\n }),\r\n\r\n targets () {\r\n return baseFind('svg [href*=\"' + this.id() + '\"]')\r\n }\r\n }\r\n})\r\n\r\nTextPath.prototype.MorphArray = PathArray\r\nregister(TextPath)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Shape from './Shape.js'\r\n\r\nexport default class Use extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('use', node), node)\r\n }\r\n\r\n // Use element as a reference\r\n element (element, file) {\r\n // Set lined element\r\n return this.attr('href', (file || '') + '#' + element, xlink)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a use element\r\n use: wrapWithAttrCheck(function (element, file) {\r\n return this.put(new Use()).element(element, file)\r\n })\r\n }\r\n})\r\n\r\nregister(Use)\r\n","/* Optional Modules */\r\nimport './modules/optional/arrange.js'\r\nimport './modules/optional/class.js'\r\nimport './modules/optional/css.js'\r\nimport './modules/optional/data.js'\r\nimport './modules/optional/memory.js'\r\nimport './modules/optional/sugar.js'\r\nimport './modules/optional/transform.js'\r\n\r\nimport { extend, makeInstance } from './utils/adopter.js'\r\nimport { getMethodNames, getMethodsFor } from './utils/methods.js'\r\nimport Box from './types/Box.js'\r\nimport Circle from './elements/Circle.js'\r\nimport Color from './types/Color.js'\r\nimport Container from './elements/Container.js'\r\nimport Defs from './elements/Defs.js'\r\nimport Dom from './elements/Dom.js'\r\nimport Element from './elements/Element.js'\r\nimport Ellipse from './elements/Ellipse.js'\r\nimport EventTarget from './types/EventTarget.js'\r\nimport Gradient from './elements/Gradient.js'\r\nimport Image from './elements/Image.js'\r\nimport Line from './elements/Line.js'\r\nimport List from './types/List.js'\r\nimport Marker from './elements/Marker.js'\r\nimport Matrix from './types/Matrix.js'\r\nimport Morphable, {\r\n NonMorphable,\r\n ObjectBag,\r\n TransformBag,\r\n makeMorphable,\r\n registerMorphableType\r\n} from './animation/Morphable.js'\r\nimport Path from './elements/Path.js'\r\nimport PathArray from './types/PathArray.js'\r\nimport Pattern from './elements/Pattern.js'\r\nimport PointArray from './types/PointArray.js'\r\nimport Polygon from './elements/Polygon.js'\r\nimport Polyline from './elements/Polyline.js'\r\nimport Rect from './elements/Rect.js'\r\nimport Runner from './animation/Runner.js'\r\nimport SVGArray from './types/SVGArray.js'\r\nimport SVGNumber from './types/SVGNumber.js'\r\nimport Shape from './elements/Shape.js'\r\nimport Svg from './elements/Svg.js'\r\nimport Symbol from './elements/Symbol.js'\r\nimport Text from './elements/Text.js'\r\nimport Tspan from './elements/Tspan.js'\r\nimport * as defaults from './modules/core/defaults.js'\r\nimport * as utils from './utils/utils.js'\r\nimport * as namespaces from './modules/core/namespaces.js'\r\nimport * as regex from './modules/core/regex.js'\r\n\r\nexport {\r\n Morphable,\r\n registerMorphableType,\r\n makeMorphable,\r\n TransformBag,\r\n ObjectBag,\r\n NonMorphable\r\n}\r\n\r\nexport { defaults, utils, namespaces, regex }\r\nexport const SVG = makeInstance\r\nexport { default as parser } from './modules/core/parser.js'\r\nexport { default as find } from './modules/core/selector.js'\r\nexport * from './modules/core/event.js'\r\nexport * from './utils/adopter.js'\r\nexport { registerWindow } from './utils/window.js'\r\n\r\n/* Animation Modules */\r\nexport { default as Animator } from './animation/Animator.js'\r\nexport { Controller, Ease, PID, Spring, easing } from './animation/Controller.js'\r\nexport { default as Queue } from './animation/Queue.js'\r\nexport { default as Runner } from './animation/Runner.js'\r\nexport { default as Timeline } from './animation/Timeline.js'\r\n\r\n/* Types */\r\nexport { default as Array } from './types/SVGArray.js'\r\nexport { default as Box } from './types/Box.js'\r\nexport { default as Color } from './types/Color.js'\r\nexport { default as EventTarget } from './types/EventTarget.js'\r\nexport { default as Matrix } from './types/Matrix.js'\r\nexport { default as Number } from './types/SVGNumber.js'\r\nexport { default as PathArray } from './types/PathArray.js'\r\nexport { default as Point } from './types/Point.js'\r\nexport { default as PointArray } from './types/PointArray.js'\r\nexport { default as List } from './types/List.js'\r\n\r\n/* Elements */\r\nexport { default as Circle } from './elements/Circle.js'\r\nexport { default as ClipPath } from './elements/ClipPath.js'\r\nexport { default as Container } from './elements/Container.js'\r\nexport { default as Defs } from './elements/Defs.js'\r\nexport { default as Dom } from './elements/Dom.js'\r\nexport { default as Element } from './elements/Element.js'\r\nexport { default as Ellipse } from './elements/Ellipse.js'\r\nexport { default as Gradient } from './elements/Gradient.js'\r\nexport { default as G } from './elements/G.js'\r\nexport { default as A } from './elements/A.js'\r\nexport { default as Image } from './elements/Image.js'\r\nexport { default as Line } from './elements/Line.js'\r\nexport { default as Marker } from './elements/Marker.js'\r\nexport { default as Mask } from './elements/Mask.js'\r\nexport { default as Path } from './elements/Path.js'\r\nexport { default as Pattern } from './elements/Pattern.js'\r\nexport { default as Polygon } from './elements/Polygon.js'\r\nexport { default as Polyline } from './elements/Polyline.js'\r\nexport { default as Rect } from './elements/Rect.js'\r\nexport { default as Shape } from './elements/Shape.js'\r\nexport { default as Stop } from './elements/Stop.js'\r\nexport { default as Style } from './elements/Style.js'\r\nexport { default as Svg } from './elements/Svg.js'\r\nexport { default as Symbol } from './elements/Symbol.js'\r\nexport { default as Text } from './elements/Text.js'\r\nexport { default as TextPath } from './elements/TextPath.js'\r\nexport { default as Tspan } from './elements/Tspan.js'\r\nexport { default as Use } from './elements/Use.js'\r\n\r\nextend([\r\n Svg,\r\n Symbol,\r\n Image,\r\n Pattern,\r\n Marker\r\n], getMethodsFor('viewbox'))\r\n\r\nextend([\r\n Line,\r\n Polyline,\r\n Polygon,\r\n Path\r\n], getMethodsFor('marker'))\r\n\r\nextend(Text, getMethodsFor('Text'))\r\nextend(Path, getMethodsFor('Path'))\r\n\r\nextend(Defs, getMethodsFor('Defs'))\r\n\r\nextend([\r\n Text,\r\n Tspan\r\n], getMethodsFor('Tspan'))\r\n\r\nextend([\r\n Rect,\r\n Ellipse,\r\n Circle,\r\n Gradient\r\n], getMethodsFor('radius'))\r\n\r\nextend(EventTarget, getMethodsFor('EventTarget'))\r\nextend(Dom, getMethodsFor('Dom'))\r\nextend(Element, getMethodsFor('Element'))\r\nextend(Shape, getMethodsFor('Shape'))\r\n// extend(Element, getConstructor('Memory'))\r\nextend(Container, getMethodsFor('Container'))\r\n\r\nextend(Runner, getMethodsFor('Runner'))\r\n\r\nList.extend(getMethodNames())\r\n\r\nregisterMorphableType([\r\n SVGNumber,\r\n Color,\r\n Box,\r\n Matrix,\r\n SVGArray,\r\n PointArray,\r\n PathArray\r\n])\r\n\r\nmakeMorphable()\r\n","import * as svgMembers from './main.js'\r\nimport { makeInstance } from './utils/adopter.js'\r\n\r\n// The main wrapping element\r\nexport default function SVG (element) {\r\n return makeInstance(element)\r\n}\r\n\r\nObject.assign(SVG, svgMembers)\r\n"],"names":["global","module","window","Math","self","Function","__g","core","version","__e","it","isObject","TypeError","exec","e","require$$0","Object","defineProperty","get","a","document","is","createElement","require$$1","require$$2","S","fn","val","toString","call","valueOf","dP","O","P","Attributes","anObject","toPrimitive","IE8_DOM_DEFINE","value","bitmap","enumerable","configurable","writable","object","key","f","createDesc","hasOwnProperty","id","px","random","concat","undefined","SRC","TO_STRING","$toString","TPL","split","inspectSource","safe","isFunction","has","hide","join","String","prototype","this","that","length","aFunction","b","c","apply","arguments","PROTOTYPE","$export","type","name","source","own","out","exp","IS_FORCED","F","IS_GLOBAL","G","IS_STATIC","IS_PROTO","IS_BIND","B","target","exports","expProto","ctx","redefine","U","W","R","slice","propertyIsEnumerable","cof","IObject","defined","ceil","floor","isNaN","min","toInteger","max","IS_INCLUDES","$this","el","fromIndex","index","toIObject","toLength","SHARED","store","push","mode","copyright","shared","uid","arrayIndexOf","IE_PROTO","names","i","result","keys","$keys","enumBugKeys","getOwnPropertySymbols","$assign","assign","A","Symbol","K","forEach","k","T","toObject","aLen","getSymbols","gOPS","isEnum","pIE","getKeys","j","USE_SYMBOL","UNSCOPABLES","ArrayProto","Array","done","defineProperties","Properties","documentElement","Empty","createDict","iframeDocument","iframe","style","display","appendChild","src","contentWindow","open","write","lt","close","create","dPs","def","TAG","tag","stat","IteratorPrototype","ObjectProto","getPrototypeOf","constructor","ITERATOR","BUGGY","VALUES","returnThis","Base","NAME","Constructor","next","DEFAULT","IS_SET","FORCED","descriptor","setToStringTag","methods","getMethod","kind","proto","DEF_VALUES","VALUES_BUG","$native","$default","$entries","$anyNative","entries","Iterators","values","iterated","_t","_i","_k","step","Arguments","wks","TO_STRING_TAG","ArrayValues","DOMIterables","CSSRuleList","CSSStyleDeclaration","CSSValueList","ClientRectList","DOMRectList","DOMStringList","DOMTokenList","DataTransferItemList","FileList","HTMLAllCollection","HTMLCollection","HTMLFormElement","HTMLSelectElement","MediaList","MimeTypeArray","NamedNodeMap","NodeList","PaintRequestList","Plugin","PluginArray","SVGLengthList","SVGNumberList","SVGPathSegList","SVGPointList","SVGStringList","SVGTransformList","SourceBufferList","StyleSheetList","TextTrackCueList","TextTrackList","TouchList","collections","explicit","Collection","$iterators","KEY","fails","FProto","nameRE","_typeof2","obj","iterator","_typeof","match","$at","pos","s","l","charCodeAt","charAt","point","forbiddenField","ret","ARG","getIteratorMethod","tryGet","callee","BREAK","RETURN","iterable","iterFn","getIterFn","SPECIES","META","setDesc","isExtensible","FREEZE","preventExtensions","setMeta","w","meta","NEED","fastKey","getWeak","onFreeze","TYPE","SIZE","DESCRIPTORS","getEntry","entry","_f","n","getConstructor","wrapper","IS_MAP","ADDER","C","anInstance","_l","forOf","redefineAll","clear","validate","data","r","p","delete","prev","callbackfn","v","setStrong","$iterDefine","SAFE_CLOSING","gOPD","getOwnPropertyDescriptor","check","setPrototypeOf","set","test","buggy","__proto__","common","IS_WEAK","fixMethod","instance","HASNT_CHAINING","THROWS_ON_PRIMITIVES","ACCEPT_ITERABLES","skipClosing","arr","iter","$iterDetect","BUGGY_ZERO","$instance","add","strong","_toConsumableArray","isArray","arr2","arrayWithoutHoles","from","iterableToArray","nonIterableSpread","$Symbol","wksExt","arg","hiddenKeys","getOwnPropertyNames","gOPN","windowNames","getWindowNames","$GOPD","$DP","gOPNExt","$JSON","JSON","_stringify","stringify","HIDDEN","TO_PRIMITIVE","SymbolRegistry","AllSymbols","OPSymbols","USE_NATIVE","QObject","setter","findChild","setSymbolDesc","$fails","_create","D","protoDesc","wrap","sym","isSymbol","$defineProperty","$defineProperties","symbols","enumKeys","$propertyIsEnumerable","E","$getOwnPropertyDescriptor","$getOwnPropertyNames","$getOwnPropertySymbols","IS_OP","$set","require$$3","es6Symbols","wellKnownSymbols","wksDefine","for","keyFor","useSetter","useSimple","replacer","$replacer","args","require$$5","registerMethods","m","addMethodNames","_name","getMethodsFor","_names","$includes","includes","MATCH","isRegExp","INCLUDES","re","searchString","context","indexOf","SYMBOL","fns","strfn","rxfn","RegExp","string","map","array","block","il","radians","d","PI","camelCase","toLowerCase","replace","g","toUpperCase","unCamelCase","capitalize","proportionalSize","element","width","height","box","bbox","getOrigin","o","ox","oy","origin","trim","x","y","bx","by","REPLACE","$replace","searchValue","replaceValue","ns","xmlns","xlink","svgjs","globals","_classCallCheck","elements","root","makeNode","createElementNS","makeInstance","adopt","querySelector","node","innerHTML","firstChild","nodeOrNew","Node","className","nodeName","register","asRoot","getClass","did","eid","assignNewId","children","extend","modules","attrCheck","method","wrapWithAttrCheck","attr","siblings","parent","position","forward","removeElement","isRoot","defs","backward","front","back","before","remove","after","insertBefore","insertAfter","SPLIT","$split","_split","$push","$SPLIT","LENGTH","LAST_INDEX","NPCG","separator","limit","separator2","lastIndex","lastLength","output","flags","ignoreCase","multiline","unicode","sticky","lastLastIndex","splitLimit","separatorCopy","numberAndUnit","hex","rgb","reference","transforms","whitespace","isHex","isRgb","isBlank","isNumber","isImage","delimiter","hyphen","pathLetters","isPathLetter","numbersWithDots","dots","classes","hasClass","addClass","removeClass","filter","toggleClass","css","cssText","t","cased","show","visible","parse","remember","memory","forget","_memory","listenerId","getEvents","getEventHolder","events","getEventTarget","on","listener","binding","options","bind","bag","_svgjsListenerId","event","ev","addEventListener","off","namespace","removeEventListener","dispatch","Event","CustomEvent","detail","cancelable","dispatchEvent","_defineProperties","props","_createClass","protoProps","staticProps","define","compToHex","comp","$flags","Color","init","color","parseInt","substring","toHex","round","_assertThisInitialized","ReferenceError","_possibleConstructorReturn","assertThisInitialized","_getPrototypeOf","_get","property","receiver","Reflect","base","superPropBase","desc","_setPrototypeOf","_inherits","subClass","superClass","$match","regexp","Point","parser","nodes","svg","size","path","parentNode","body","addTo","isNulledBox","h","Box","parseFloat","left","top","x2","y2","cx","cy","xMin","Infinity","xMax","yMin","yMax","transform","pageXOffset","pageYOffset","getBox","cb","contains","Error","clone","closeEnough","threshold","abs","viewbox","Matrix","fromArray","Element","matrixify","isMatrixLike","multiplyO","formatTransforms","transformer","translateO","rx","ry","lmultiplyO","scaleO","scaleX","scaleY","skewO","skewX","skewY","shearO","shear","rotateO","theta","isFinite","py","dx","dy","tx","ty","originX","originY","sx","sy","lam","rotate","translateX","translateY","determinant","ccw","sqrt","thetaRad","atan2","ct","cos","st","sin","matrix","matrixMultiply","det","na","nb","nc","nd","ne","nf","inverseO","axis","around","flipO","lx","tan","ly","skew","aroundO","other","flipBoth","flip","flipX","flipY","scale","positionX","positionY","translate","relative","relativeX","relativeY","subClassArray","baseClass","_constructor","Arr","List","baseFind","query","querySelectorAll","each","fnOrMethodName","toArray","reduce","attrs","EventTarget","defaultPrevented","noop","timeline","duration","ease","delay","fill","stroke","opacity","offset","SVGArray","toSet","Set","SVGNumber","unit","number","hooks","Dom","childNodes","put","hasChildNodes","removeChild","lastChild","_defs","writeDataToDom","cloneNode","deep","selector","matches","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","SVGElement","replaceChild","precision","factor","newAttrs","svgOrFn","outerHTML","well","len","fragment","current","_this","createDocumentFragment","firstElementChild","text","textContent","attributes","nodeValue","last","curr","removeAttribute","getAttribute","defaults","_val","hook","isColor","leading","setAttributeNS","setAttribute","rebuild","find","Svg","dom","hasAttribute","setData","until","parents","getBBox","rbox","getBoundingClientRect","screenCTM","inverse","addOffset","ctm","getCTM","getScreenCTM","rect","sugar","prefix","_objectSpread","ownKeys","divide","extension","mat","angle","direction","directionString","dmove","plus","radius","_element","getTotalLength","pointAt","getPointAtLength","font","ax","ay","amove","untransform","str","kv","reverse","lmultiply","toParent","pCtm","multiply","toRoot","decomposed","decompose","Shape","Circle","circle","move","Container","flatten","ungroup","Defs","Ellipse","circled","ellipse","Stop","fx","fy","x1","y1","to","Gradient","update","url","gradiented","gradient","Pattern","pattern","patternUnits","Image","callback","img","image","load","PointArray","toLine","at","destination","points","pop","maxX","maxY","minX","minY","MorphArray","Line","pointed","line","plot","Marker","marker","ref","$sort","sort","makeSetterGetter","comparefn","easing","bezier","steps","stepPosition","jumps","beforeFlag","jumping","Stepper","Ease","Controller","stepper","dt","recalculate","_duration","overshoot","_overshoot","pi","os","log","zeta","wn","Spring","velocity","acceleration","newPosition","PID","windup","integral","error","I","PathArray","pathRegReplace","pathHandlers","M","p0","L","H","V","Q","Z","mlhvqtcsaz","jl","arrayToString","equalCommands","pathArray","morph","sourceArray","destinationArray","paramCnt","Morphable","_stepper","_from","_to","_type","_context","_morphObj","_set","NonMorphable","morphableTypes","ObjectBag","TransformBag","objOrArr","registerMorphableType","makeMorphable","Path","_array","Polygon","polygon","poly","Polyline","polyline","Rect","Queue","_first","_last","item","Animator","nextDraw","frames","timeouts","timer","performance","Date","frame","run","requestAnimationFrame","_draw","transform_frame","timeout","time","now","cancelFrame","clearTimeout","nextTimeout","lastTimeout","shift","nextFrame","lastFrame","first","makeSchedule","runnerInfo","start","runner","end","defaultSource","Timeline","timeSource","_timeSource","_startTime","_speed","_persist","_nextFrame","_paused","_runners","_order","_time","_lastSourceTime","_lastStepTime","_step","when","absoluteStartTime","endTime","getEndTime","unschedule","persist","updateTime","_continue","splice","lastRunnerInfo","lastDuration","active","pause","speed","yes","currentSpeed","positive","dtOrForever","immediateStep","dtSource","dtTime","fire","runnersLeft","dtToStart","reset","_timeline","Runner","_queue","_isDeclarative","_history","enabled","_lastTime","_reseted","transformId","_haveReversed","_reverse","_loopsDone","_swing","_wait","_times","_prepareRunner","sanitise","loop","schedule","times","swing","wait","animate","initFn","runFn","retargetFn","isTransform","initialiser","retarget","initialised","finished","queue","loopDuration","loopsDone","partial","swinging","backwards","uncliped","pow","loops","swingForward","running","_lastPosition","justStarted","justFinished","declarative","_initialise","converged","_run","morpher","caller","needsIt","positionOrDt","allfinished","FakeRunner","mergeWith","getRunnerTransform","RunnerArray","runners","ids","leftSibling","lastRunner","_this2","edit","newRunner","deleteCnt","clearTransformsFromQueue","frameId","play","_clearTransformRunnersBefore","currentRunner","_transformationRunners","clearBefore","_currentTransform","addRunner","netTransform","merge","_frameId","styleAttr","zoom","level","affine","_tryRetarget","isMatrix","currentAngle","startTransform","clearTransform","rTarget","rCurrent","possibilities","distances","shortest","affineParameters","addTransform","newTransforms","_rememberMorpher","_queueNumber","_queueNumberDelta","newTo","_queueObject","center","getElementsByTagName","nested","symbol","_build","createTextNode","getComputedTextLength","Text","_rebuild","firstLine","nodeType","newLined","build","tspan","newLine","blankLineOffset","fontSize","getComputedStyle","getPropertyValue","textable","plain","Tspan","ClipPath","targets","unclip","clip","clipWith","clipper","group","link","linkTo","Mask","unmask","mask","maskWith","masker","Style","params","rule","fontFamily","addText","cssRule","fontface","$create","IS_FILTER","IS_SOME","IS_EVERY","IS_FIND_INDEX","NO_HOLES","$find","original","res","forced","TextPath","track","textPath","txt","Use","file","use","SVG","win","doc","svgMembers"],"mappings":";iHACA,IAAIA,EAASC,UAAkC,oBAAVC,QAAyBA,OAAOC,MAAQA,KACzED,OAAwB,oBAARE,MAAuBA,KAAKD,MAAQA,KAAOC,KAE3DC,SAAS,cAATA,GACc,iBAAPC,MAAiBA,IAAMN,qBCLlC,IAAIO,EAAON,UAAiB,CAAEO,QAAS,SACrB,iBAAPC,MAAiBA,IAAMF,kBCDjB,SAAUG,GACzB,MAAqB,iBAAPA,EAAyB,OAAPA,EAA4B,mBAAPA,MCAtC,SAAUA,GACzB,IAAKC,EAASD,GAAK,MAAME,UAAUF,EAAK,sBACxC,OAAOA,KCHQ,SAAU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,GAAQ5c,OAAS6rC,EACjBjvB,GAAQ1b,SAAW4qC,6rBGgHd,sCAAiC/yB,2BAAAA,kBACtCoF,gBAAUpF,WAAM,6BsFpHH,SAAS6yB,GAAKvwB,UACpB6B,GAAa7B,UAGtBva,OAAOqH,OAAOyjC,GAAKG"}
\ No newline at end of file diff --git a/dist/svg.node.js b/dist/svg.node.js new file mode 100644 index 0000000..4c22676 --- /dev/null +++ b/dist/svg.node.js @@ -0,0 +1,6430 @@ +/*! +* @svgdotjs/svg.js - A lightweight library for manipulating and animating SVG. +* @version 3.0.0 +* https://svgdotjs.github.io/ +* +* @copyright Wout Fierens <wout@mick-wout.com> +* @license MIT +* +* BUILT: Wed Nov 28 2018 12:47:10 GMT+0100 (GMT+01:00) +*/; +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +const methods = {}; +const names = []; +function registerMethods(name, m) { + if (Array.isArray(name)) { + for (let _name of name) { + registerMethods(_name, m); + } + + return; + } + + if (typeof name === 'object') { + for (let _name in name) { + registerMethods(_name, name[_name]); + } + + return; + } + + addMethodNames(Object.keys(m)); + methods[name] = Object.assign(methods[name] || {}, m); +} +function getMethodsFor(name) { + return methods[name] || {}; +} +function getMethodNames() { + return [...new Set(names)]; +} +function addMethodNames(_names) { + names.push(..._names); +} + +// Map function +function map(array, block) { + var i; + var il = array.length; + var result = []; + + for (i = 0; i < il; i++) { + result.push(block(array[i])); + } + + return result; +} // Filter function + +function filter(array, block) { + var i; + var il = array.length; + var result = []; + + for (i = 0; i < il; i++) { + if (block(array[i])) { + result.push(array[i]); + } + } + + return result; +} // Degrees to radians + +function radians(d) { + return d % 360 * Math.PI / 180; +} // Radians to degrees + +function degrees(r) { + return r * 180 / Math.PI % 360; +} // Convert dash-separated-string to camelCase + +function camelCase(s) { + return s.toLowerCase().replace(/-(.)/g, function (m, g) { + return g.toUpperCase(); + }); +} // Convert camel cased string to string seperated + +function unCamelCase(s) { + return s.replace(/([A-Z])/g, function (m, g) { + return '-' + g.toLowerCase(); + }); +} // Capitalize first letter of a string + +function capitalize(s) { + return s.charAt(0).toUpperCase() + s.slice(1); +} // Calculate proportional width and height values when necessary + +function proportionalSize(element, width, height) { + if (width == null || height == null) { + var box = element.bbox(); + + if (width == null) { + width = box.width / box.height * height; + } else if (height == null) { + height = box.height / box.width * width; + } + } + + return { + width: width, + height: height + }; +} +function getOrigin(o, element) { + // Allow origin or around as the names + let origin = o.origin; // o.around == null ? o.origin : o.around + + let ox, oy; // Allow the user to pass a string to rotate around a given point + + if (typeof origin === 'string' || origin == null) { + // Get the bounding box of the element with no transformations applied + const string = (origin || 'center').toLowerCase().trim(); + const { + height, + width, + x, + y + } = element.bbox(); // Calculate the transformed x and y coordinates + + let bx = string.includes('left') ? x : string.includes('right') ? x + width : x + width / 2; + let by = string.includes('top') ? y : string.includes('bottom') ? y + height : y + height / 2; // Set the bounds eg : "bottom-left", "Top right", "middle" etc... + + ox = o.ox != null ? o.ox : bx; + oy = o.oy != null ? o.oy : by; + } else { + ox = origin[0]; + oy = origin[1]; + } // Return the origin as it is if it wasn't a string + + + return [ox, oy]; +} + +var utils = /*#__PURE__*/Object.freeze({ + map: map, + filter: filter, + radians: radians, + degrees: degrees, + camelCase: camelCase, + unCamelCase: unCamelCase, + capitalize: capitalize, + proportionalSize: proportionalSize, + getOrigin: getOrigin +}); + +// Default namespaces +let ns = 'http://www.w3.org/2000/svg'; +let xmlns = 'http://www.w3.org/2000/xmlns/'; +let xlink = 'http://www.w3.org/1999/xlink'; +let svgjs = 'http://svgjs.com/svgjs'; + +var namespaces = /*#__PURE__*/Object.freeze({ + ns: ns, + xmlns: xmlns, + xlink: xlink, + svgjs: svgjs +}); + +const globals = { + window: typeof window === 'undefined' ? null : window, + document: typeof document === 'undefined' ? null : document +}; +function registerWindow(win = null, doc = null) { + globals.window = win; + globals.document = doc; +} + +class Base {// constructor (node/*, {extensions = []} */) { + // // this.tags = [] + // // + // // for (let extension of extensions) { + // // extension.setup.call(this, node) + // // this.tags.push(extension.name) + // // } + // } +} + +const elements = {}; +const root = '___SYMBOL___ROOT___'; // Method for element creation + +function makeNode(name) { + // create element + return globals.document.createElementNS(ns, name); +} +function makeInstance(element) { + if (element instanceof Base) return element; + + if (typeof element === 'object') { + return adopt(element); + } + + if (element == null) { + return new elements[root](); + } + + if (typeof element === 'string' && element.charAt(0) !== '<') { + return adopt(globals.document.querySelector(element)); + } + + var node = makeNode('svg'); + node.innerHTML = element; // We can use firstChild here because we know, + // that the first char is < and thus an element + + element = adopt(node.firstChild); + return element; +} +function nodeOrNew(name, node) { + return node instanceof globals.window.Node ? node : makeNode(name); +} // Adopt existing svg elements + +function adopt(node) { + // check for presence of node + if (!node) return null; // make sure a node isn't already adopted + + if (node.instance instanceof Base) return node.instance; // initialize variables + + var className = capitalize(node.nodeName); // Make sure that gradients are adopted correctly + + if (className === 'LinearGradient' || className === 'RadialGradient') { + className = 'Gradient'; // Fallback to Dom if element is not known + } else if (!elements[className]) { + className = 'Dom'; + } + + return new elements[className](node); +} +function register(element, name = element.name, asRoot = false) { + elements[name] = element; + if (asRoot) elements[root] = element; + addMethodNames(Object.keys(element.prototype)); + return element; +} +function getClass(name) { + return elements[name]; +} // Element id sequence + +let did = 1000; // Get next named element id + +function eid(name) { + return 'Svgjs' + capitalize(name) + did++; +} // Deep new id assignment + +function assignNewId(node) { + // do the same for SVG child nodes as well + for (var i = node.children.length - 1; i >= 0; i--) { + assignNewId(node.children[i]); + } + + if (node.id) { + return adopt(node).id(eid(node.nodeName)); + } + + return adopt(node); +} // Method for extending objects + +function extend(modules, methods, attrCheck) { + var key, i; + modules = Array.isArray(modules) ? modules : [modules]; + + for (i = modules.length - 1; i >= 0; i--) { + for (key in methods) { + let method = methods[key]; + + if (attrCheck) { + method = wrapWithAttrCheck(methods[key]); + } + + modules[i].prototype[key] = method; + } + } +} +function extendWithAttrCheck(...args) { + extend(...args, true); +} +function wrapWithAttrCheck(fn) { + return function (...args) { + let o = args[args.length - 1]; + + if (o && o.constructor === Object && !(o instanceof Array)) { + return fn.apply(this, args.slice(0, -1)).attr(o); + } else { + return fn.apply(this, args); + } + }; +} + +function siblings() { + return this.parent().children(); +} // Get the curent position siblings + +function position() { + return this.parent().index(this); +} // Get the next element (will return null if there is none) + +function next() { + return this.siblings()[this.position() + 1]; +} // Get the next element (will return null if there is none) + +function prev() { + return this.siblings()[this.position() - 1]; +} // Send given element one step forward + +function forward() { + var i = this.position() + 1; + var p = this.parent(); // move node one step forward + + p.removeElement(this).add(this, i); // make sure defs node is always at the top + + if (typeof p.isRoot === 'function' && p.isRoot()) { + p.node.appendChild(p.defs().node); + } + + return this; +} // Send given element one step backward + +function backward() { + var i = this.position(); + + if (i > 0) { + this.parent().removeElement(this).add(this, i - 1); + } + + return this; +} // Send given element all the way to the front + +function front() { + var p = this.parent(); // Move node forward + + p.node.appendChild(this.node); // Make sure defs node is always at the top + + if (typeof p.isRoot === 'function' && p.isRoot()) { + p.node.appendChild(p.defs().node); + } + + return this; +} // Send given element all the way to the back + +function back() { + if (this.position() > 0) { + this.parent().removeElement(this).add(this, 0); + } + + return this; +} // Inserts a given element before the targeted element + +function before(element) { + element = makeInstance(element); + element.remove(); + var i = this.position(); + this.parent().add(element, i); + return this; +} // Inserts a given element after the targeted element + +function after(element) { + element = makeInstance(element); + element.remove(); + var i = this.position(); + this.parent().add(element, i + 1); + return this; +} +function insertBefore(element) { + element = makeInstance(element); + element.before(this); +} +function insertAfter(element) { + element = makeInstance(element); + element.after(this); +} +registerMethods('Dom', { + siblings, + position, + next, + prev, + forward, + backward, + front, + back, + before, + after, + insertBefore, + insertAfter +}); + +// Parse unit value +let numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i; // Parse hex value + +let hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; // Parse rgb value + +let rgb = /rgb\((\d+),(\d+),(\d+)\)/; // Parse reference id + +let reference = /(#[a-z0-9\-_]+)/i; // splits a transformation chain + +let transforms = /\)\s*,?\s*/; // Whitespace + +let whitespace = /\s/g; // Test hex value + +let isHex = /^#[a-f0-9]{3,6}$/i; // Test rgb value + +let isRgb = /^rgb\(/; // Test css declaration + +let isCss = /[^:]+:[^;]+;?/; // Test for blank string + +let isBlank = /^(\s+)?$/; // Test for numeric string + +let isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; // Test for percent value + +let isPercent = /^-?[\d.]+%$/; // Test for image url + +let isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i; // split at whitespace and comma + +let delimiter = /[\s,]+/; // The following regex are used to parse the d attribute of a path +// Matches all hyphens which are not after an exponent + +let hyphen = /([^e])-/gi; // Replaces and tests for all path letters + +let pathLetters = /[MLHVCSQTAZ]/gi; // yes we need this one, too + +let isPathLetter = /[MLHVCSQTAZ]/i; // matches 0.154.23.45 + +let numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi; // matches . + +let dots = /\./g; + +var regex = /*#__PURE__*/Object.freeze({ + numberAndUnit: numberAndUnit, + hex: hex, + rgb: rgb, + reference: reference, + transforms: transforms, + whitespace: whitespace, + isHex: isHex, + isRgb: isRgb, + isCss: isCss, + isBlank: isBlank, + isNumber: isNumber, + isPercent: isPercent, + isImage: isImage, + delimiter: delimiter, + hyphen: hyphen, + pathLetters: pathLetters, + isPathLetter: isPathLetter, + numbersWithDots: numbersWithDots, + dots: dots +}); + +function classes() { + var attr = this.attr('class'); + return attr == null ? [] : attr.trim().split(delimiter); +} // Return true if class exists on the node, false otherwise + +function hasClass(name) { + return this.classes().indexOf(name) !== -1; +} // Add class to the node + +function addClass(name) { + if (!this.hasClass(name)) { + var array = this.classes(); + array.push(name); + this.attr('class', array.join(' ')); + } + + return this; +} // Remove class from the node + +function removeClass(name) { + if (this.hasClass(name)) { + this.attr('class', this.classes().filter(function (c) { + return c !== name; + }).join(' ')); + } + + return this; +} // Toggle the presence of a class on the node + +function toggleClass(name) { + return this.hasClass(name) ? this.removeClass(name) : this.addClass(name); +} +registerMethods('Dom', { + classes, + hasClass, + addClass, + removeClass, + toggleClass +}); + +function css(style, val) { + let ret = {}; + + if (arguments.length === 0) { + // get full style as object + this.node.style.cssText.split(/\s*;\s*/).filter(function (el) { + return !!el.length; + }).forEach(function (el) { + let t = el.split(/\s*:\s*/); + ret[t[0]] = t[1]; + }); + return ret; + } + + if (arguments.length < 2) { + // get style properties in the array + if (Array.isArray(style)) { + for (let name of style) { + let cased = camelCase(name); + ret[cased] = this.node.style[cased]; + } + + return ret; + } // get style for property + + + if (typeof style === 'string') { + return this.node.style[camelCase(style)]; + } // set styles in object + + + if (typeof style === 'object') { + for (let name in style) { + // set empty string if null/undefined/'' was given + this.node.style[camelCase(name)] = style[name] == null || isBlank.test(style[name]) ? '' : style[name]; + } + } + } // set style for property + + + if (arguments.length === 2) { + this.node.style[camelCase(style)] = val == null || isBlank.test(val) ? '' : val; + } + + return this; +} // Show element + +function show() { + return this.css('display', ''); +} // Hide element + +function hide() { + return this.css('display', 'none'); +} // Is element visible? + +function visible() { + return this.css('display') !== 'none'; +} +registerMethods('Dom', { + css, + show, + hide, + visible +}); + +function data(a, v, r) { + if (typeof a === 'object') { + for (v in a) { + this.data(v, a[v]); + } + } else if (arguments.length < 2) { + try { + return JSON.parse(this.attr('data-' + a)); + } catch (e) { + return this.attr('data-' + a); + } + } else { + this.attr('data-' + a, v === null ? null : r === true || typeof v === 'string' || typeof v === 'number' ? v : JSON.stringify(v)); + } + + return this; +} +registerMethods('Dom', { + data +}); + +function remember(k, v) { + // remember every item in an object individually + if (typeof arguments[0] === 'object') { + for (var key in k) { + this.remember(key, k[key]); + } + } else if (arguments.length === 1) { + // retrieve memory + return this.memory()[k]; + } else { + // store memory + this.memory()[k] = v; + } + + return this; +} // Erase a given memory + +function forget() { + if (arguments.length === 0) { + this._memory = {}; + } else { + for (var i = arguments.length - 1; i >= 0; i--) { + delete this.memory()[arguments[i]]; + } + } + + return this; +} // This triggers creation of a new hidden class which is not performant +// However, this function is not rarely used so it will not happen frequently +// Return local memory object + +function memory() { + return this._memory = this._memory || {}; +} +registerMethods('Dom', { + remember, + forget, + memory +}); + +let listenerId = 0; + +function getEvents(node) { + const n = makeInstance(node).getEventHolder(); + if (!n.events) n.events = {}; + return n.events; +} + +function getEventTarget(node) { + return makeInstance(node).getEventTarget(); +} + +function clearEvents(node) { + const n = makeInstance(node).getEventHolder(); + if (n.events) n.events = {}; +} // Add event binder in the SVG namespace + + +function on(node, events, listener, binding, options) { + var l = listener.bind(binding || node); + var bag = getEvents(node); + var n = getEventTarget(node); // events can be an array of events or a string of events + + events = Array.isArray(events) ? events : events.split(delimiter); // add id to listener + + if (!listener._svgjsListenerId) { + listener._svgjsListenerId = ++listenerId; + } + + events.forEach(function (event) { + var ev = event.split('.')[0]; + var ns = event.split('.')[1] || '*'; // ensure valid object + + bag[ev] = bag[ev] || {}; + bag[ev][ns] = bag[ev][ns] || {}; // reference listener + + bag[ev][ns][listener._svgjsListenerId] = l; // add listener + + n.addEventListener(ev, l, options || false); + }); +} // Add event unbinder in the SVG namespace + +function off(node, events, listener, options) { + var bag = getEvents(node); + var n = getEventTarget(node); // listener can be a function or a number + + if (typeof listener === 'function') { + listener = listener._svgjsListenerId; + if (!listener) return; + } // events can be an array of events or a string or undefined + + + events = Array.isArray(events) ? events : (events || '').split(delimiter); + events.forEach(function (event) { + var ev = event && event.split('.')[0]; + var ns = event && event.split('.')[1]; + var namespace, l; + + if (listener) { + // remove listener reference + if (bag[ev] && bag[ev][ns || '*']) { + // removeListener + n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false); + delete bag[ev][ns || '*'][listener]; + } + } else if (ev && ns) { + // remove all listeners for a namespaced event + if (bag[ev] && bag[ev][ns]) { + for (l in bag[ev][ns]) { + off(n, [ev, ns].join('.'), l); + } + + delete bag[ev][ns]; + } + } else if (ns) { + // remove all listeners for a specific namespace + for (event in bag) { + for (namespace in bag[event]) { + if (ns === namespace) { + off(n, [event, ns].join('.')); + } + } + } + } else if (ev) { + // remove all listeners for the event + if (bag[ev]) { + for (namespace in bag[ev]) { + off(n, [ev, namespace].join('.')); + } + + delete bag[ev]; + } + } else { + // remove all listeners on a given node + for (event in bag) { + off(n, event); + } + + clearEvents(node); + } + }); +} +function dispatch(node, event, data) { + var n = getEventTarget(node); // Dispatch event + + if (event instanceof globals.window.Event) { + n.dispatchEvent(event); + } else { + event = new globals.window.CustomEvent(event, { + detail: data, + cancelable: true + }); + n.dispatchEvent(event); + } + + return event; +} + +/* + +Color { + constructor (a, b, c, space) { + space: 'hsl' + a: 30 + b: 20 + c: 10 + }, + + toRgb () { return new Color in rgb space } + toHsl () { return new Color in hsl space } + toLab () { return new Color in lab space } + + toArray () { [space, a, b, c] } + fromArray () { convert it back } +} + +// Conversions aren't always exact because of monitor profiles etc... +new Color(h, s, l, 'hsl') !== new Color(r, g, b).hsl() +new Color(100, 100, 100, [space]) +new Color('hsl(30, 20, 10)') + +// Sugar +SVG.rgb(30, 20, 50).lab() +SVG.hsl() +SVG.lab('rgb(100, 100, 100)') +*/ + +function fullHex(hex$$1) { + return hex$$1.length === 4 ? ['#', hex$$1.substring(1, 2), hex$$1.substring(1, 2), hex$$1.substring(2, 3), hex$$1.substring(2, 3), hex$$1.substring(3, 4), hex$$1.substring(3, 4)].join('') : hex$$1; +} // Component to hex value + + +function compToHex(comp) { + var hex$$1 = comp.toString(16); + return hex$$1.length === 1 ? '0' + hex$$1 : hex$$1; +} + +class Color { + constructor(...args) { + this.init(...args); + } + + init(color, g, b) { + let match; // initialize defaults + + this.r = 0; + this.g = 0; + this.b = 0; + if (!color) return; // parse color + + if (typeof color === 'string') { + if (isRgb.test(color)) { + // get rgb values + match = rgb.exec(color.replace(whitespace, '')); // parse numeric values + + this.r = parseInt(match[1]); + this.g = parseInt(match[2]); + this.b = parseInt(match[3]); + } else if (isHex.test(color)) { + // get hex values + match = hex.exec(fullHex(color)); // parse numeric values + + this.r = parseInt(match[1], 16); + this.g = parseInt(match[2], 16); + this.b = parseInt(match[3], 16); + } + } else if (Array.isArray(color)) { + this.r = color[0]; + this.g = color[1]; + this.b = color[2]; + } else if (typeof color === 'object') { + this.r = color.r; + this.g = color.g; + this.b = color.b; + } else if (arguments.length === 3) { + this.r = color; + this.g = g; + this.b = b; + } + + return this; + } // Default to hex conversion + + + toString() { + return this.toHex(); + } + + toArray() { + return [this.r, this.g, this.b]; + } // Build hex value + + + toHex() { + return '#' + compToHex(Math.round(this.r)) + compToHex(Math.round(this.g)) + compToHex(Math.round(this.b)); + } // Build rgb value + + + toRgb() { + return 'rgb(' + [this.r, this.g, this.b].join() + ')'; + } // Calculate true brightness + + + brightness() { + return this.r / 255 * 0.30 + this.g / 255 * 0.59 + this.b / 255 * 0.11; + } // Testers + // Test if given value is a color string + + + static test(color) { + color += ''; + return isHex.test(color) || isRgb.test(color); + } // Test if given value is a rgb object + + + static isRgb(color) { + return color && typeof color.r === 'number' && typeof color.g === 'number' && typeof color.b === 'number'; + } // Test if given value is a color + + + static isColor(color) { + return this.isRgb(color) || this.test(color); + } + +} + +class Point { + // Initialize + constructor(...args) { + this.init(...args); + } + + init(x, y) { + let source; + let base = { + x: 0, + y: 0 // ensure source as object + + }; + source = Array.isArray(x) ? { + x: x[0], + y: x[1] + } : typeof x === 'object' ? { + x: x.x, + y: x.y + } : { + x: x, + y: y // merge source + + }; + this.x = source.x == null ? base.x : source.x; + this.y = source.y == null ? base.y : source.y; + return this; + } // Clone point + + + clone() { + return new Point(this); + } // transform point with matrix + + + transform(m) { + // Perform the matrix multiplication + var x = m.a * this.x + m.c * this.y + m.e; + var y = m.b * this.x + m.d * this.y + m.f; // Return the required point + + return new Point(x, y); + } + + toArray() { + return [this.x, this.y]; + } + +} +function point(x, y) { + return new Point(x, y).transform(this.screenCTM().inverse()); +} + +function parser() { + // Reuse cached element if possible + if (!parser.nodes) { + let svg = makeInstance().size(2, 0); + svg.node.cssText = ['opacity: 0', 'position: absolute', 'left: -100%', 'top: -100%', 'overflow: hidden'].join(';'); + let path = svg.path().node; + parser.nodes = { + svg, + path + }; + } + + if (!parser.nodes.svg.node.parentNode) { + let b = globals.document.body || globals.document.documentElement; + parser.nodes.svg.addTo(b); + } + + return parser.nodes; +} + +function isNulledBox(box) { + return !box.w && !box.h && !box.x && !box.y; +} + +function domContains(node) { + return (globals.document.documentElement.contains || function (node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode) { + node = node.parentNode; + } + + return node === document; + }).call(globals.document.documentElement, node); +} + +class Box { + constructor(...args) { + this.init(...args); + } + + init(source) { + var base = [0, 0, 0, 0]; + source = typeof source === 'string' ? source.split(delimiter).map(parseFloat) : Array.isArray(source) ? source : typeof source === 'object' ? [source.left != null ? source.left : source.x, source.top != null ? source.top : source.y, source.width, source.height] : arguments.length === 4 ? [].slice.call(arguments) : base; + this.x = source[0] || 0; + this.y = source[1] || 0; + this.width = this.w = source[2] || 0; + this.height = this.h = source[3] || 0; // Add more bounding box properties + + this.x2 = this.x + this.w; + this.y2 = this.y + this.h; + this.cx = this.x + this.w / 2; + this.cy = this.y + this.h / 2; + return this; + } // Merge rect box with another, return a new instance + + + merge(box) { + let x = Math.min(this.x, box.x); + let y = Math.min(this.y, box.y); + let width = Math.max(this.x + this.width, box.x + box.width) - x; + let height = Math.max(this.y + this.height, box.y + box.height) - y; + return new Box(x, y, width, height); + } + + transform(m) { + let xMin = Infinity; + let xMax = -Infinity; + let yMin = Infinity; + let yMax = -Infinity; + let pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)]; + pts.forEach(function (p) { + p = p.transform(m); + xMin = Math.min(xMin, p.x); + xMax = Math.max(xMax, p.x); + yMin = Math.min(yMin, p.y); + yMax = Math.max(yMax, p.y); + }); + return new Box(xMin, yMin, xMax - xMin, yMax - yMin); + } + + addOffset() { + // offset by window scroll position, because getBoundingClientRect changes when window is scrolled + this.x += globals.window.pageXOffset; + this.y += globals.window.pageYOffset; + return this; + } + + toString() { + return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height; + } + + toArray() { + return [this.x, this.y, this.width, this.height]; + } + + isNulled() { + return isNulledBox(this); + } + +} + +function getBox(cb) { + let box; + + try { + box = cb(this.node); + + if (isNulledBox(box) && !domContains(this.node)) { + throw new Error('Element not in the dom'); + } + } catch (e) { + try { + let clone = this.clone().addTo(parser().svg).show(); + box = cb(clone.node); + clone.remove(); + } catch (e) { + throw new Error('Getting a bounding box of element "' + this.node.nodeName + '" is not possible'); + } + } + + return box; +} + +function bbox() { + return new Box(getBox.call(this, node => node.getBBox())); +} +function rbox(el) { + let box = new Box(getBox.call(this, node => node.getBoundingClientRect())); + if (el) return box.transform(el.screenCTM().inverse()); + return box.addOffset(); +} +registerMethods({ + viewbox: { + viewbox(x, y, width, height) { + // act as getter + if (x == null) return new Box(this.attr('viewBox')); // act as setter + + return this.attr('viewBox', new Box(x, y, width, height)); + } + + } +}); + +function closeEnough(a, b, threshold) { + return Math.abs(b - a) < (threshold || 1e-6); +} + +class Matrix { + constructor(...args) { + this.init(...args); + } // Initialize + + + init(source) { + var base = Matrix.fromArray([1, 0, 0, 1, 0, 0]); // ensure source as object + + source = source instanceof Element ? source.matrixify() : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat)) : Array.isArray(source) ? Matrix.fromArray(source) : typeof source === 'object' && Matrix.isMatrixLike(source) ? source : typeof source === 'object' ? new Matrix().transform(source) : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments)) : base; // Merge the source matrix with the base matrix + + this.a = source.a != null ? source.a : base.a; + this.b = source.b != null ? source.b : base.b; + this.c = source.c != null ? source.c : base.c; + this.d = source.d != null ? source.d : base.d; + this.e = source.e != null ? source.e : base.e; + this.f = source.f != null ? source.f : base.f; + return this; + } // Clones this matrix + + + clone() { + return new Matrix(this); + } // Transform a matrix into another matrix by manipulating the space + + + transform(o) { + // Check if o is a matrix and then left multiply it directly + if (Matrix.isMatrixLike(o)) { + var matrix = new Matrix(o); + return matrix.multiplyO(this); + } // Get the proposed transformations and the current transformations + + + var t = Matrix.formatTransforms(o); + var current = this; + let { + x: ox, + y: oy + } = new Point(t.ox, t.oy).transform(current); // Construct the resulting matrix + + var transformer = new Matrix().translateO(t.rx, t.ry).lmultiplyO(current).translateO(-ox, -oy).scaleO(t.scaleX, t.scaleY).skewO(t.skewX, t.skewY).shearO(t.shear).rotateO(t.theta).translateO(ox, oy); // If we want the origin at a particular place, we force it there + + if (isFinite(t.px) || isFinite(t.py)) { + const origin = new Point(ox, oy).transform(transformer); // TODO: Replace t.px with isFinite(t.px) + + const dx = t.px ? t.px - origin.x : 0; + const dy = t.py ? t.py - origin.y : 0; + transformer.translateO(dx, dy); + } // Translate now after positioning + + + transformer.translateO(t.tx, t.ty); + return transformer; + } // Applies a matrix defined by its affine parameters + + + compose(o) { + if (o.origin) { + o.originX = o.origin[0]; + o.originY = o.origin[1]; + } // Get the parameters + + + var ox = o.originX || 0; + var oy = o.originY || 0; + var sx = o.scaleX || 1; + var sy = o.scaleY || 1; + var lam = o.shear || 0; + var theta = o.rotate || 0; + var tx = o.translateX || 0; + var ty = o.translateY || 0; // Apply the standard matrix + + var result = new Matrix().translateO(-ox, -oy).scaleO(sx, sy).shearO(lam).rotateO(theta).translateO(tx, ty).lmultiplyO(this).translateO(ox, oy); + return result; + } // Decomposes this matrix into its affine parameters + + + decompose(cx = 0, cy = 0) { + // Get the parameters from the matrix + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var e = this.e; + var f = this.f; // Figure out if the winding direction is clockwise or counterclockwise + + var determinant = a * d - b * c; + var ccw = determinant > 0 ? 1 : -1; // Since we only shear in x, we can use the x basis to get the x scale + // and the rotation of the resulting matrix + + var sx = ccw * Math.sqrt(a * a + b * b); + var thetaRad = Math.atan2(ccw * b, ccw * a); + var theta = 180 / Math.PI * thetaRad; + var ct = Math.cos(thetaRad); + var st = Math.sin(thetaRad); // We can then solve the y basis vector simultaneously to get the other + // two affine parameters directly from these parameters + + var lam = (a * c + b * d) / determinant; + var sy = c * sx / (lam * a - b) || d * sx / (lam * b + a); // Use the translations + + let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy); + let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy); // Construct the decomposition and return it + + return { + // Return the affine parameters + scaleX: sx, + scaleY: sy, + shear: lam, + rotate: theta, + translateX: tx, + translateY: ty, + originX: cx, + originY: cy, + // Return the matrix parameters + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } // Left multiplies by the given matrix + + + multiply(matrix) { + return this.clone().multiplyO(matrix); + } + + multiplyO(matrix) { + // Get the matrices + var l = this; + var r = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } + + lmultiply(matrix) { + return this.clone().lmultiplyO(matrix); + } + + lmultiplyO(matrix) { + var r = this; + var l = matrix instanceof Matrix ? matrix : new Matrix(matrix); + return Matrix.matrixMultiply(l, r, this); + } // Inverses matrix + + + inverseO() { + // Get the current parameters out of the matrix + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var e = this.e; + var f = this.f; // Invert the 2x2 matrix in the top left + + var det = a * d - b * c; + if (!det) throw new Error('Cannot invert ' + this); // Calculate the top 2x2 matrix + + var na = d / det; + var nb = -b / det; + var nc = -c / det; + var nd = a / det; // Apply the inverted matrix to the top right + + var ne = -(na * e + nc * f); + var nf = -(nb * e + nd * f); // Construct the inverted matrix + + this.a = na; + this.b = nb; + this.c = nc; + this.d = nd; + this.e = ne; + this.f = nf; + return this; + } + + inverse() { + return this.clone().inverseO(); + } // Translate matrix + + + translate(x, y) { + return this.clone().translateO(x, y); + } + + translateO(x, y) { + this.e += x || 0; + this.f += y || 0; + return this; + } // Scale matrix + + + scale(x, y, cx, cy) { + return this.clone().scaleO(...arguments); + } + + scaleO(x, y = x, cx = 0, cy = 0) { + // Support uniform scaling + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } + + let { + a, + b, + c, + d, + e, + f + } = this; + this.a = a * x; + this.b = b * y; + this.c = c * x; + this.d = d * y; + this.e = e * x - cx * x + cx; + this.f = f * y - cy * y + cy; + return this; + } // Rotate matrix + + + rotate(r, cx, cy) { + return this.clone().rotateO(r, cx, cy); + } + + rotateO(r, cx = 0, cy = 0) { + // Convert degrees to radians + r = radians(r); + let cos = Math.cos(r); + let sin = Math.sin(r); + let { + a, + b, + c, + d, + e, + f + } = this; + this.a = a * cos - b * sin; + this.b = b * cos + a * sin; + this.c = c * cos - d * sin; + this.d = d * cos + c * sin; + this.e = e * cos - f * sin + cy * sin - cx * cos + cx; + this.f = f * cos + e * sin - cx * sin - cy * cos + cy; + return this; + } // Flip matrix on x or y, at a given offset + + + flip(axis, around) { + return this.clone().flipO(axis, around); + } + + flipO(axis, around) { + return axis === 'x' ? this.scaleO(-1, 1, around, 0) : axis === 'y' ? this.scaleO(1, -1, 0, around) : this.scaleO(-1, -1, axis, around || axis); // Define an x, y flip point + } // Shear matrix + + + shear(a, cx, cy) { + return this.clone().shearO(a, cx, cy); + } + + shearO(lx, cx = 0, cy = 0) { + let { + a, + b, + c, + d, + e, + f + } = this; + this.a = a + b * lx; + this.c = c + d * lx; + this.e = e + f * lx - cy * lx; + return this; + } // Skew Matrix + + + skew(x, y, cx, cy) { + return this.clone().skewO(...arguments); + } + + skewO(x, y = x, cx = 0, cy = 0) { + // support uniformal skew + if (arguments.length === 3) { + cy = cx; + cx = y; + y = x; + } // Convert degrees to radians + + + x = radians(x); + y = radians(y); + let lx = Math.tan(x); + let ly = Math.tan(y); + let { + a, + b, + c, + d, + e, + f + } = this; + this.a = a + b * lx; + this.b = b + a * ly; + this.c = c + d * lx; + this.d = d + c * ly; + this.e = e + f * lx - cy * lx; + this.f = f + e * ly - cx * ly; + return this; + } // SkewX + + + skewX(x, cx, cy) { + return this.skew(x, 0, cx, cy); + } + + skewXO(x, cx, cy) { + return this.skewO(x, 0, cx, cy); + } // SkewY + + + skewY(y, cx, cy) { + return this.skew(0, y, cx, cy); + } + + skewYO(y, cx, cy) { + return this.skewO(0, y, cx, cy); + } // Transform around a center point + + + aroundO(cx, cy, matrix) { + var dx = cx || 0; + var dy = cy || 0; + return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy); + } + + around(cx, cy, matrix) { + return this.clone().aroundO(cx, cy, matrix); + } // Check if two matrices are equal + + + equals(other) { + var comp = new Matrix(other); + return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f); + } // Convert matrix to string + + + toString() { + return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'; + } + + toArray() { + return [this.a, this.b, this.c, this.d, this.e, this.f]; + } + + valueOf() { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f + }; + } + + static fromArray(a) { + return { + a: a[0], + b: a[1], + c: a[2], + d: a[3], + e: a[4], + f: a[5] + }; + } + + static isMatrixLike(o) { + return o.a != null || o.b != null || o.c != null || o.d != null || o.e != null || o.f != null; + } + + static formatTransforms(o) { + // Get all of the parameters required to form the matrix + var flipBoth = o.flip === 'both' || o.flip === true; + var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1; + var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1; + var skewX = o.skew && o.skew.length ? o.skew[0] : isFinite(o.skew) ? o.skew : isFinite(o.skewX) ? o.skewX : 0; + var skewY = o.skew && o.skew.length ? o.skew[1] : isFinite(o.skew) ? o.skew : isFinite(o.skewY) ? o.skewY : 0; + var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX : isFinite(o.scale) ? o.scale * flipX : isFinite(o.scaleX) ? o.scaleX * flipX : flipX; + var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY : isFinite(o.scale) ? o.scale * flipY : isFinite(o.scaleY) ? o.scaleY * flipY : flipY; + var shear = o.shear || 0; + var theta = o.rotate || o.theta || 0; + var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY); + var ox = origin.x; + var oy = origin.y; + var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY); + var px = position.x; + var py = position.y; + var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY); + var tx = translate.x; + var ty = translate.y; + var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY); + var rx = relative.x; + var ry = relative.y; // Populate all of the values + + return { + scaleX, + scaleY, + skewX, + skewY, + shear, + theta, + rx, + ry, + tx, + ty, + ox, + oy, + px, + py + }; + } // left matrix, right matrix, target matrix which is overwritten + + + static matrixMultiply(l, r, o) { + // Work out the product directly + var a = l.a * r.a + l.c * r.b; + var b = l.b * r.a + l.d * r.b; + var c = l.a * r.c + l.c * r.d; + var d = l.b * r.c + l.d * r.d; + var e = l.e + l.a * r.e + l.c * r.f; + var f = l.f + l.b * r.e + l.d * r.f; // make sure to use local variables because l/r and o could be the same + + o.a = a; + o.b = b; + o.c = c; + o.d = d; + o.e = e; + o.f = f; + return o; + } + +} +function ctm() { + return new Matrix(this.node.getCTM()); +} +function screenCTM() { + /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 + This is needed because FF does not return the transformation matrix + for the inner coordinate system when getScreenCTM() is called on nested svgs. + However all other Browsers do that */ + if (typeof this.isRoot === 'function' && !this.isRoot()) { + var rect = this.rect(1, 1); + var m = rect.node.getScreenCTM(); + rect.remove(); + return new Matrix(m); + } + + return new Matrix(this.node.getScreenCTM()); +} + +/* eslint no-new-func: "off" */ +const subClassArray = function () { + try { + // try es6 subclassing + return Function('name', 'baseClass', '_constructor', ['baseClass = baseClass || Array', 'return {', ' [name]: class extends baseClass {', ' constructor (...args) {', ' super(...args)', ' _constructor && _constructor.apply(this, args)', ' }', ' }', '}[name]'].join('\n')); + } catch (e) { + // Use es5 approach + return (name, baseClass = Array, _constructor) => { + const Arr = function () { + baseClass.apply(this, arguments); + _constructor && _constructor.apply(this, arguments); + }; + + Arr.prototype = Object.create(baseClass.prototype); + Arr.prototype.constructor = Arr; + + Arr.prototype.map = function (fn) { + const arr = new Arr(); + arr.push.apply(arr, Array.prototype.map.call(this, fn)); + return arr; + }; + + return Arr; + }; + } +}(); + +const List = subClassArray('List', Array, function (arr = []) { + // This catches the case, that native map tries to create an array with new Array(1) + if (typeof arr === 'number') return this; + this.length = 0; + this.push(...arr); +}); +extend(List, { + each(fnOrMethodName, ...args) { + if (typeof fnOrMethodName === 'function') { + this.forEach(el => { + fnOrMethodName.call(el, el); + }); + } else { + return this.map(el => { + return el[fnOrMethodName](...args); + }); + } + + return this; + }, + + toArray() { + return Array.prototype.concat.apply([], this); + } + +}); + +List.extend = function (methods) { + methods = methods.reduce((obj, name) => { + obj[name] = function (...attrs) { + return this.each(name, ...attrs); + }; + + return obj; + }, {}); + extend(List, methods); +}; + +function baseFind(query, parent) { + return new List(map((parent || globals.document).querySelectorAll(query), function (node) { + return adopt(node); + })); +} // Scoped find method + +function find(query) { + return baseFind(query, this.node); +} + +class EventTarget extends Base { + constructor({ + events = {} + } = {}) { + super(); + this.events = events; + } + + addEventListener() {} + + dispatch(event, data) { + return dispatch(this, event, data); + } + + dispatchEvent(event) { + const bag = this.getEventHolder().events; + if (!bag) return true; + const events = bag[event.type]; + + for (let i in events) { + for (let j in events[i]) { + events[i][j](event); + } + } + + return !event.defaultPrevented; + } // Fire given event + + + fire(event, data) { + this.dispatch(event, data); + return this; + } + + getEventHolder() { + return this; + } + + getEventTarget() { + return this; + } // Unbind event from listener + + + off(event, listener) { + off(this, event, listener); + return this; + } // Bind given event to listener + + + on(event, listener, binding, options) { + on(this, event, listener, binding, options); + return this; + } + + removeEventListener() {} + +} + +function noop() {} // Default animation values + +let timeline = { + duration: 400, + ease: '>', + delay: 0 // Default attribute values + +}; +let attrs = { + // fill and stroke + 'fill-opacity': 1, + 'stroke-opacity': 1, + 'stroke-width': 0, + 'stroke-linejoin': 'miter', + 'stroke-linecap': 'butt', + fill: '#000000', + stroke: '#000000', + opacity: 1, + // position + x: 0, + y: 0, + cx: 0, + cy: 0, + // size + width: 0, + height: 0, + // radius + r: 0, + rx: 0, + ry: 0, + // gradient + offset: 0, + 'stop-opacity': 1, + 'stop-color': '#000000', + // text + 'font-size': 16, + 'font-family': 'Helvetica, Arial, sans-serif', + 'text-anchor': 'start' +}; + +var defaults = /*#__PURE__*/Object.freeze({ + noop: noop, + timeline: timeline, + attrs: attrs +}); + +const SVGArray = subClassArray('SVGArray', Array, function (arr) { + this.init(arr); +}); +extend(SVGArray, { + init(arr) { + // This catches the case, that native map tries to create an array with new Array(1) + if (typeof arr === 'number') return this; + this.length = 0; + this.push(...this.parse(arr)); + return this; + }, + + toArray() { + return Array.prototype.concat.apply([], this); + }, + + toString() { + return this.join(' '); + }, + + // Flattens the array if needed + valueOf() { + const ret = []; + ret.push(...this); + return ret; + }, + + // Parse whitespace separated string + parse(array = []) { + // If already is an array, no need to parse it + if (array instanceof Array) return array; + return array.trim().split(delimiter).map(parseFloat); + }, + + clone() { + return new this.constructor(this); + }, + + toSet() { + return new Set(this); + } + +}); + +class SVGNumber { + // Initialize + constructor(...args) { + this.init(...args); + } + + init(value, unit) { + unit = Array.isArray(value) ? value[1] : unit; + value = Array.isArray(value) ? value[0] : value; // initialize defaults + + this.value = 0; + this.unit = unit || ''; // parse value + + if (typeof value === 'number') { + // ensure a valid numeric value + this.value = isNaN(value) ? 0 : !isFinite(value) ? value < 0 ? -3.4e+38 : +3.4e+38 : value; + } else if (typeof value === 'string') { + unit = value.match(numberAndUnit); + + if (unit) { + // make value numeric + this.value = parseFloat(unit[1]); // normalize + + if (unit[5] === '%') { + this.value /= 100; + } else if (unit[5] === 's') { + this.value *= 1000; + } // store unit + + + this.unit = unit[5]; + } + } else { + if (value instanceof SVGNumber) { + this.value = value.valueOf(); + this.unit = value.unit; + } + } + + return this; + } + + toString() { + return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6 : this.unit === 's' ? this.value / 1e3 : this.value) + this.unit; + } + + toJSON() { + return this.toString(); + } + + toArray() { + return [this.value, this.unit]; + } + + valueOf() { + return this.value; + } // Add number + + + plus(number) { + number = new SVGNumber(number); + return new SVGNumber(this + number, this.unit || number.unit); + } // Subtract number + + + minus(number) { + number = new SVGNumber(number); + return new SVGNumber(this - number, this.unit || number.unit); + } // Multiply number + + + times(number) { + number = new SVGNumber(number); + return new SVGNumber(this * number, this.unit || number.unit); + } // Divide number + + + divide(number) { + number = new SVGNumber(number); + return new SVGNumber(this / number, this.unit || number.unit); + } + +} + +const hooks = []; +function registerAttrHook(fn) { + hooks.push(fn); +} // Set svg element attribute + +function attr(attr, val, ns) { + // act as full getter + if (attr == null) { + // get an object of attributes + attr = {}; + val = this.node.attributes; + + for (let node of val) { + attr[node.nodeName] = isNumber.test(node.nodeValue) ? parseFloat(node.nodeValue) : node.nodeValue; + } + + return attr; + } else if (attr instanceof Array) { + // loop through array and get all values + return attr.reduce((last, curr) => { + last[curr] = this.attr(curr); + return last; + }, {}); + } else if (typeof attr === 'object') { + // apply every attribute individually if an object is passed + for (val in attr) this.attr(val, attr[val]); + } else if (val === null) { + // remove value + this.node.removeAttribute(attr); + } else if (val == null) { + // act as a getter if the first and only argument is not an object + val = this.node.getAttribute(attr); + return val == null ? attrs[attr] : isNumber.test(val) ? parseFloat(val) : val; + } else { + // Loop through hooks and execute them to convert value + val = hooks.reduce((_val, hook) => { + return hook(attr, _val, this); + }, val); // ensure correct numeric values (also accepts NaN and Infinity) + + if (typeof val === 'number') { + val = new SVGNumber(val); + } else if (Color.isColor(val)) { + // ensure full hex color + val = new Color(val); + } else if (val.constructor === Array) { + // Check for plain arrays and parse array values + val = new SVGArray(val); + } // if the passed attribute is leading... + + + if (attr === 'leading') { + // ... call the leading method instead + if (this.leading) { + this.leading(val); + } + } else { + // set given attribute on node + typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString()) : this.node.setAttribute(attr, val.toString()); + } // rebuild if required + + + if (this.rebuild && (attr === 'font-size' || attr === 'x')) { + this.rebuild(); + } + } + + return this; +} + +class Dom extends EventTarget { + constructor(node, attrs) { + super(node); + this.node = node; + this.type = node.nodeName; + + if (attrs && node !== attrs) { + this.attr(attrs); + } + } // Add given element at a position + + + add(element, i) { + element = makeInstance(element); + + if (i == null) { + this.node.appendChild(element.node); + } else if (element.node !== this.node.childNodes[i]) { + this.node.insertBefore(element.node, this.node.childNodes[i]); + } + + return this; + } // Add element to given container and return self + + + addTo(parent) { + return makeInstance(parent).put(this); + } // Returns all child elements + + + children() { + return new List(map(this.node.children, function (node) { + return adopt(node); + })); + } // Remove all elements in this container + + + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } // remove defs reference + + + delete this._defs; + return this; + } // Clone element + + + clone() { + // write dom data to the dom so the clone can pickup the data + this.writeDataToDom(); // clone element and assign new id + + return assignNewId(this.node.cloneNode(true)); + } // Iterates over all children and invokes a given block + + + each(block, deep) { + var children = this.children(); + var i, il; + + for (i = 0, il = children.length; i < il; i++) { + block.apply(children[i], [i, children]); + + if (deep) { + children[i].each(block, deep); + } + } + + return this; + } + + element(nodeName) { + return this.put(new Dom(makeNode(nodeName))); + } // Get first child + + + first() { + return adopt(this.node.firstChild); + } // Get a element at the given index + + + get(i) { + return adopt(this.node.childNodes[i]); + } + + getEventHolder() { + return this.node; + } + + getEventTarget() { + return this.node; + } // Checks if the given element is a child + + + has(element) { + return this.index(element) >= 0; + } // Get / set id + + + id(id) { + // generate new id if no id set + if (typeof id === 'undefined' && !this.node.id) { + this.node.id = eid(this.type); + } // dont't set directly width this.node.id to make `null` work correctly + + + return this.attr('id', id); + } // Gets index of given element + + + index(element) { + return [].slice.call(this.node.childNodes).indexOf(element.node); + } // Get the last child + + + last() { + return adopt(this.node.lastChild); + } // matches the element vs a css selector + + + matches(selector) { + const el = this.node; + return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector); + } // Returns the parent element instance + + + parent(type) { + var parent = this; // check for parent + + if (!parent.node.parentNode) return null; // get parent element + + parent = adopt(parent.node.parentNode); + if (!type) return parent; // loop trough ancestors if type is given + + while (parent && parent.node instanceof globals.window.SVGElement) { + // FIXME: That shouldnt be neccessary + if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent; + parent = adopt(parent.node.parentNode); + } + } // Basically does the same as `add()` but returns the added element instead + + + put(element, i) { + this.add(element, i); + return element; + } // Add element to given container and return container + + + putIn(parent) { + return makeInstance(parent).add(this); + } // Remove element + + + remove() { + if (this.parent()) { + this.parent().removeElement(this); + } + + return this; + } // Remove a given child + + + removeElement(element) { + this.node.removeChild(element.node); + return this; + } // Replace this with element + + + replace(element) { + element = makeInstance(element); + this.node.parentNode.replaceChild(element.node, this.node); + return element; + } + + round(precision = 2, map$$1) { + const factor = Math.pow(10, precision); + const attrs = this.attr(); // If we have no map, build one from attrs + + if (!map$$1) { + map$$1 = Object.keys(attrs); + } // Holds rounded attributes + + + const newAttrs = {}; + map$$1.forEach(key => { + newAttrs[key] = Math.round(attrs[key] * factor) / factor; + }); + this.attr(newAttrs); + return this; + } // Return id on string conversion + + + toString() { + return this.id(); + } // Import raw svg + + + svg(svgOrFn, outerHTML) { + var well, len, fragment; + + if (svgOrFn === false) { + outerHTML = false; + svgOrFn = null; + } // act as getter if no svg string is given + + + if (svgOrFn == null || typeof svgOrFn === 'function') { + // The default for exports is, that the outerNode is included + outerHTML = outerHTML == null ? true : outerHTML; // write svgjs data to the dom + + this.writeDataToDom(); + let current = this; // An export modifier was passed + + if (svgOrFn != null) { + current = adopt(current.node.cloneNode(true)); // If the user wants outerHTML we need to process this node, too + + if (outerHTML) { + let result = svgOrFn(current); + current = result || current; // The user does not want this node? Well, then he gets nothing + + if (result === false) return ''; + } // Deep loop through all children and apply modifier + + + current.each(function () { + let result = svgOrFn(this); + + let _this = result || this; // If modifier returns false, discard node + + + if (result === false) { + this.remove(); // If modifier returns new node, use it + } else if (result && this !== _this) { + this.replace(_this); + } + }, true); + } // Return outer or inner content + + + return outerHTML ? current.node.outerHTML : current.node.innerHTML; + } // Act as setter if we got a string + // The default for import is, that the current node is not replaced + + + outerHTML = outerHTML == null ? false : outerHTML; // Create temporary holder + + well = globals.document.createElementNS(ns, 'svg'); + fragment = globals.document.createDocumentFragment(); // Dump raw svg + + well.innerHTML = svgOrFn; // Transplant nodes into the fragment + + for (len = well.children.length; len--;) { + fragment.appendChild(well.firstElementChild); + } + + let parent = this.parent(); // Add the whole fragment at once + + return outerHTML ? this.replace(fragment) && parent : this.add(fragment); + } + + words(text) { + // This is faster than removing all children and adding a new one + this.node.textContent = text; + return this; + } // write svgjs data to the dom + + + writeDataToDom() { + // dump variables recursively + this.each(function () { + this.writeDataToDom(); + }); + return this; + } + +} +extend(Dom, { + attr, + find +}); +register(Dom); + +const Svg = getClass(root); +class Element extends Dom { + constructor(node, attrs) { + super(node, attrs); // initialize data object + + this.dom = {}; // create circular reference + + this.node.instance = this; + + if (node.hasAttribute('svgjs:data')) { + // pull svgjs data from the dom (getAttributeNS doesn't work in html5) + this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {}); + } + } // Move element by its center + + + center(x, y) { + return this.cx(x).cy(y); + } // Move by center over x-axis + + + cx(x) { + return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2); + } // Move by center over y-axis + + + cy(y) { + return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2); + } // Get defs + + + defs() { + return this.root().defs(); + } // Get parent document + + + root() { + let p = this.parent(Svg); + return p && p.root(); + } + + getEventHolder() { + return this; + } // Set height of element + + + height(height) { + return this.attr('height', height); + } // Checks whether the given point inside the bounding box of the element + + + inside(x, y) { + let box = this.bbox(); + return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height; + } // Move element to given x and y values + + + move(x, y) { + return this.x(x).y(y); + } // return array of all ancestors of given type up to the root svg + + + parents(until = globals.document) { + until = makeInstance(until); + let parents = new List(); + let parent = this; + + while ((parent = parent.parent()) && parent.node !== until.node && parent.node !== globals.document) { + parents.push(parent); + } + + return parents; + } // Get referenced element form attribute value + + + reference(attr) { + attr = this.attr(attr); + if (!attr) return null; + const m = attr.match(reference); + return m ? makeInstance(m[1]) : null; + } // set given data to the elements data property + + + setData(o) { + this.dom = o; + return this; + } // Set element size to given width and height + + + size(width, height) { + let p = proportionalSize(this, width, height); + return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height)); + } // Set width of element + + + width(width) { + return this.attr('width', width); + } // write svgjs data to the dom + + + writeDataToDom() { + // remove previously set data + this.node.removeAttribute('svgjs:data'); + + if (Object.keys(this.dom).length) { + this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)); // see #428 + } + + return super.writeDataToDom(); + } // Move over x-axis + + + x(x) { + return this.attr('x', x); + } // Move over y-axis + + + y(y) { + return this.attr('y', y); + } + +} +extend(Element, { + bbox, + rbox, + point, + ctm, + screenCTM +}); +register(Element); + +var sugar = { + stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'], + fill: ['color', 'opacity', 'rule'], + prefix: function (t, a) { + return a === 'color' ? t : t + '-' + a; + } // Add sugar for fill and stroke + +}; +['fill', 'stroke'].forEach(function (m) { + var extension = {}; + var i; + + extension[m] = function (o) { + if (typeof o === 'undefined') { + return this.attr(m); + } + + if (typeof o === 'string' || Color.isRgb(o) || o instanceof Element) { + this.attr(m, o); + } else { + // set all attributes from sugar.fill and sugar.stroke list + for (i = sugar[m].length - 1; i >= 0; i--) { + if (o[sugar[m][i]] != null) { + this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]); + } + } + } + + return this; + }; + + registerMethods(['Shape', 'Runner'], extension); +}); +registerMethods(['Element', 'Runner'], { + // Let the user set the matrix directly + matrix: function (mat, b, c, d, e, f) { + // Act as a getter + if (mat == null) { + return new Matrix(this); + } // Act as a setter, the user can pass a matrix or a set of numbers + + + return this.attr('transform', new Matrix(mat, b, c, d, e, f)); + }, + // Map rotation to transform + rotate: function (angle, cx, cy) { + return this.transform({ + rotate: angle, + ox: cx, + oy: cy + }, true); + }, + // Map skew to transform + skew: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + skew: x, + ox: y, + oy: cx + }, true) : this.transform({ + skew: [x, y], + ox: cx, + oy: cy + }, true); + }, + shear: function (lam, cx, cy) { + return this.transform({ + shear: lam, + ox: cx, + oy: cy + }, true); + }, + // Map scale to transform + scale: function (x, y, cx, cy) { + return arguments.length === 1 || arguments.length === 3 ? this.transform({ + scale: x, + ox: y, + oy: cx + }, true) : this.transform({ + scale: [x, y], + ox: cx, + oy: cy + }, true); + }, + // Map translate to transform + translate: function (x, y) { + return this.transform({ + translate: [x, y] + }, true); + }, + // Map relative translations to transform + relative: function (x, y) { + return this.transform({ + relative: [x, y] + }, true); + }, + // Map flip to transform + flip: function (direction, around) { + var directionString = typeof direction === 'string' ? direction : isFinite(direction) ? 'both' : 'both'; + var origin = direction === 'both' && isFinite(around) ? [around, around] : direction === 'x' ? [around, 0] : direction === 'y' ? [0, around] : isFinite(direction) ? [direction, direction] : [0, 0]; + this.transform({ + flip: directionString, + origin: origin + }, true); + }, + // Opacity + opacity: function (value) { + return this.attr('opacity', value); + }, + // Relative move over x and y axes + dmove: function (x, y) { + return this.dx(x).dy(y); + } +}); +registerMethods('Element', { + // Relative move over x axis + dx: function (x) { + return this.x(new SVGNumber(x).plus(this.x())); + }, + // Relative move over y axis + dy: function (y) { + return this.y(new SVGNumber(y).plus(this.y())); + } +}); +registerMethods('radius', { + // Add x and y radius + radius: function (x, y) { + var type = (this._element || this).type; + return type === 'radialGradient' || type === 'radialGradient' ? this.attr('r', new SVGNumber(x)) : this.rx(x).ry(y == null ? x : y); + } +}); +registerMethods('Path', { + // Get path length + length: function () { + return this.node.getTotalLength(); + }, + // Get point at length + pointAt: function (length) { + return new Point(this.node.getPointAtLength(length)); + } +}); +registerMethods(['Element', 'Runner'], { + // Set font + font: function (a, v) { + if (typeof a === 'object') { + for (v in a) this.font(v, a[v]); + } + + return a === 'leading' ? this.leading(v) : a === 'anchor' ? this.attr('text-anchor', v) : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style' ? this.attr('font-' + a, v) : this.attr(a, v); + } +}); +registerMethods('Text', { + ax(x) { + return this.attr('x', x); + }, + + ay(y) { + return this.attr('y', y); + }, + + amove(x, y) { + return this.ax(x).ay(y); + } + +}); // Add events to elements + +const methods$1 = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'touchstart', 'touchmove', 'touchleave', 'touchend', 'touchcancel'].reduce(function (last, event) { + // add event to Element + const fn = function (f) { + if (f === null) { + off(this, event); + } else { + on(this, event, f); + } + + return this; + }; + + last[event] = fn; + return last; +}, {}); +registerMethods('Element', methods$1); + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + + ownKeys.forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } + + return target; +} + +function untransform() { + return this.attr('transform', null); +} // merge the whole transformation chain into one matrix and returns it + +function matrixify() { + var matrix = (this.attr('transform') || ''). // split transformations + split(transforms).slice(0, -1).map(function (str) { + // generate key => value pairs + var kv = str.trim().split('('); + return [kv[0], kv[1].split(delimiter).map(function (str) { + return parseFloat(str); + })]; + }).reverse() // merge every transformation into one matrix + .reduce(function (matrix, transform) { + if (transform[0] === 'matrix') { + return matrix.lmultiply(Matrix.fromArray(transform[1])); + } + + return matrix[transform[0]].apply(matrix, transform[1]); + }, new Matrix()); + return matrix; +} // add an element to another parent without changing the visual representation on the screen + +function toParent(parent) { + if (this === parent) return this; + var ctm$$1 = this.screenCTM(); + var pCtm = parent.screenCTM().inverse(); + this.addTo(parent).untransform().transform(pCtm.multiply(ctm$$1)); + return this; +} // same as above with parent equals root-svg + +function toRoot() { + return this.toParent(this.root()); +} // Add transformations + +function transform(o, relative) { + // Act as a getter if no object was passed + if (o == null || typeof o === 'string') { + var decomposed = new Matrix(this).decompose(); + return decomposed[o] || decomposed; + } + + if (!Matrix.isMatrixLike(o)) { + // Set the origin according to the defined transform + o = _objectSpread({}, o, { + origin: getOrigin(o, this) + }); + } // The user can pass a boolean, an Element or an Matrix or nothing + + + var cleanRelative = relative === true ? this : relative || false; + var result = new Matrix(cleanRelative).transform(o); + return this.attr('transform', result); +} +registerMethods('Element', { + untransform, + matrixify, + toParent, + toRoot, + transform +}); + +function rx(rx) { + return this.attr('rx', rx); +} // Radius y value + +function ry(ry) { + return this.attr('ry', ry); +} // Move over x-axis + +function x(x) { + return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()); +} // Move over y-axis + +function y(y) { + return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()); +} // Move by center over x-axis + +function cx(x) { + return x == null ? this.attr('cx') : this.attr('cx', x); +} // Move by center over y-axis + +function cy(y) { + return y == null ? this.attr('cy') : this.attr('cy', y); +} // Set width of element + +function width(width) { + return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2)); +} // Set height of element + +function height(height) { + return height == null ? this.ry() * 2 : this.ry(new SVGNumber(height).divide(2)); +} + +var circled = /*#__PURE__*/Object.freeze({ + rx: rx, + ry: ry, + x: x, + y: y, + cx: cx, + cy: cy, + width: width, + height: height +}); + +class Shape extends Element {} +register(Shape); + +class Circle extends Shape { + constructor(node) { + super(nodeOrNew('circle', node), node); + } + + radius(r) { + return this.attr('r', r); + } // Radius x value + + + rx(rx$$1) { + return this.attr('r', rx$$1); + } // Alias radius x value + + + ry(ry$$1) { + return this.rx(ry$$1); + } + + size(size) { + return this.radius(new SVGNumber(size).divide(2)); + } + +} +extend(Circle, { + x, + y, + cx, + cy, + width, + height +}); +registerMethods({ + Element: { + // Create circle element + circle: wrapWithAttrCheck(function (size) { + return this.put(new Circle()).size(size).move(0, 0); + }) + } +}); +register(Circle); + +class Container extends Element { + flatten(parent) { + this.each(function () { + if (this instanceof Container) return this.flatten(parent).ungroup(parent); + return this.toParent(parent); + }); // we need this so that the root does not get removed + + this.node.firstElementChild || this.remove(); + return this; + } + + ungroup(parent) { + parent = parent || this.parent(); + this.each(function () { + return this.toParent(parent); + }); + this.remove(); + return this; + } + +} +register(Container); + +class Defs extends Container { + constructor(node) { + super(nodeOrNew('defs', node), node); + } + + flatten() { + return this; + } + + ungroup() { + return this; + } + +} +register(Defs); + +class Ellipse extends Shape { + constructor(node) { + super(nodeOrNew('ellipse', node), node); + } + + size(width$$1, height$$1) { + var p = proportionalSize(this, width$$1, height$$1); + return this.rx(new SVGNumber(p.width).divide(2)).ry(new SVGNumber(p.height).divide(2)); + } + +} +extend(Ellipse, circled); +registerMethods('Container', { + // Create an ellipse + ellipse: wrapWithAttrCheck(function (width$$1, height$$1) { + return this.put(new Ellipse()).size(width$$1, height$$1).move(0, 0); + }) +}); +register(Ellipse); + +class Stop extends Element { + constructor(node) { + super(nodeOrNew('stop', node), node); + } // add color stops + + + update(o) { + if (typeof o === 'number' || o instanceof SVGNumber) { + o = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }; + } // set attributes + + + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', new SVGNumber(o.offset)); + return this; + } + +} +register(Stop); + +function from(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + fx: new SVGNumber(x), + fy: new SVGNumber(y) + }) : this.attr({ + x1: new SVGNumber(x), + y1: new SVGNumber(y) + }); +} +function to(x, y) { + return (this._element || this).type === 'radialGradient' ? this.attr({ + cx: new SVGNumber(x), + cy: new SVGNumber(y) + }) : this.attr({ + x2: new SVGNumber(x), + y2: new SVGNumber(y) + }); +} + +var gradiented = /*#__PURE__*/Object.freeze({ + from: from, + to: to +}); + +class Gradient extends Container { + constructor(type, attrs) { + super(nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type), attrs); + } // Add a color stop + + + stop(offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity); + } // Update gradient + + + update(block) { + // remove all stops + this.clear(); // invoke passed block + + if (typeof block === 'function') { + block.call(this, this); + } + + return this; + } // Return the fill id + + + url() { + return 'url(#' + this.id() + ')'; + } // Alias string convertion to fill + + + toString() { + return this.url(); + } // custom attr to handle transform + + + attr(a, b, c) { + if (a === 'transform') a = 'gradientTransform'; + return super.attr(a, b, c); + } + + targets() { + return baseFind('svg [fill*="' + this.id() + '"]'); + } + + bbox() { + return new Box(); + } + +} +extend(Gradient, gradiented); +registerMethods({ + Container: { + // Create gradient element in defs + gradient: wrapWithAttrCheck(function (type, block) { + return this.defs().gradient(type, block); + }) + }, + // define gradient + Defs: { + gradient: wrapWithAttrCheck(function (type, block) { + return this.put(new Gradient(type)).update(block); + }) + } +}); +register(Gradient); + +class Pattern extends Container { + // Initialize node + constructor(node) { + super(nodeOrNew('pattern', node), node); + } // Return the fill id + + + url() { + return 'url(#' + this.id() + ')'; + } // Update pattern by rebuilding + + + update(block) { + // remove content + this.clear(); // invoke passed block + + if (typeof block === 'function') { + block.call(this, this); + } + + return this; + } // Alias string convertion to fill + + + toString() { + return this.url(); + } // custom attr to handle transform + + + attr(a, b, c) { + if (a === 'transform') a = 'patternTransform'; + return super.attr(a, b, c); + } + + targets() { + return baseFind('svg [fill*="' + this.id() + '"]'); + } + + bbox() { + return new Box(); + } + +} +registerMethods({ + Container: { + // Create pattern element in defs + pattern(...args) { + return this.defs().pattern(...args); + } + + }, + Defs: { + pattern: wrapWithAttrCheck(function (width, height, block) { + return this.put(new Pattern()).update(block).attr({ + x: 0, + y: 0, + width: width, + height: height, + patternUnits: 'userSpaceOnUse' + }); + }) + } +}); +register(Pattern); + +class Image extends Shape { + constructor(node) { + super(nodeOrNew('image', node), node); + } // (re)load image + + + load(url, callback) { + if (!url) return this; + var img = new globals.window.Image(); + on(img, 'load', function (e) { + var p = this.parent(Pattern); // ensure image size + + if (this.width() === 0 && this.height() === 0) { + this.size(img.width, img.height); + } + + if (p instanceof Pattern) { + // ensure pattern size if not set + if (p.width() === 0 && p.height() === 0) { + p.size(this.width(), this.height()); + } + } + + if (typeof callback === 'function') { + callback.call(this, e); + } + }, this); + on(img, 'load error', function () { + // dont forget to unbind memory leaking events + off(img); + }); + return this.attr('href', img.src = url, xlink); + } + +} +registerAttrHook(function (attr$$1, val, _this) { + // convert image fill and stroke to patterns + if (attr$$1 === 'fill' || attr$$1 === 'stroke') { + if (isImage.test(val)) { + val = _this.root().defs().image(val); + } + } + + if (val instanceof Image) { + val = _this.root().defs().pattern(0, 0, pattern => { + pattern.add(val); + }); + } + + return val; +}); +registerMethods({ + Container: { + // create image element, load image and set its size + image: wrapWithAttrCheck(function (source, callback) { + return this.put(new Image()).size(0, 0).load(source, callback); + }) + } +}); +register(Image); + +const PointArray = subClassArray('PointArray', SVGArray); +extend(PointArray, { + // Convert array to string + toString() { + // convert to a poly point string + for (var i = 0, il = this.length, array = []; i < il; i++) { + array.push(this[i].join(',')); + } + + return array.join(' '); + }, + + // Convert array to line object + toLine() { + return { + x1: this[0][0], + y1: this[0][1], + x2: this[1][0], + y2: this[1][1] + }; + }, + + // Get morphed array at given position + at(pos) { + // make sure a destination is defined + if (!this.destination) return this; // generate morphed point string + + for (var i = 0, il = this.length, array = []; i < il; i++) { + array.push([this[i][0] + (this.destination[i][0] - this[i][0]) * pos, this[i][1] + (this.destination[i][1] - this[i][1]) * pos]); + } + + return new PointArray(array); + }, + + // Parse point string and flat array + parse(array = [[0, 0]]) { + var points = []; // if it is an array + + if (array instanceof Array) { + // and it is not flat, there is no need to parse it + if (array[0] instanceof Array) { + return array; + } + } else { + // Else, it is considered as a string + // parse points + array = array.trim().split(delimiter).map(parseFloat); + } // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints + // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. + + + if (array.length % 2 !== 0) array.pop(); // wrap points in two-tuples and parse points as floats + + for (var i = 0, len = array.length; i < len; i = i + 2) { + points.push([array[i], array[i + 1]]); + } + + return points; + }, + + // Move point string + move(x, y) { + var box = this.bbox(); // get relative offset + + x -= box.x; + y -= box.y; // move every point + + if (!isNaN(x) && !isNaN(y)) { + for (var i = this.length - 1; i >= 0; i--) { + this[i] = [this[i][0] + x, this[i][1] + y]; + } + } + + return this; + }, + + // Resize poly string + size(width, height) { + var i; + var box = this.bbox(); // recalculate position of all points according to new size + + for (i = this.length - 1; i >= 0; i--) { + if (box.width) this[i][0] = (this[i][0] - box.x) * width / box.width + box.x; + if (box.height) this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } + + return this; + }, + + // Get bounding box of points + bbox() { + var maxX = -Infinity; + var maxY = -Infinity; + var minX = Infinity; + var minY = Infinity; + this.forEach(function (el) { + maxX = Math.max(el[0], maxX); + maxY = Math.max(el[1], maxY); + minX = Math.min(el[0], minX); + minY = Math.min(el[1], minY); + }); + return { + x: minX, + y: minY, + width: maxX - minX, + height: maxY - minY + }; + } + +}); + +let MorphArray = PointArray; // Move by left top corner over x-axis + +function x$1(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); +} // Move by left top corner over y-axis + +function y$1(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); +} // Set width of element + +function width$1(width) { + let b = this.bbox(); + return width == null ? b.width : this.size(width, b.height); +} // Set height of element + +function height$1(height) { + let b = this.bbox(); + return height == null ? b.height : this.size(b.width, height); +} + +var pointed = /*#__PURE__*/Object.freeze({ + MorphArray: MorphArray, + x: x$1, + y: y$1, + width: width$1, + height: height$1 +}); + +class Line extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('line', node), node); + } // Get array + + + array() { + return new PointArray([[this.attr('x1'), this.attr('y1')], [this.attr('x2'), this.attr('y2')]]); + } // Overwrite native plot() method + + + plot(x1, y1, x2, y2) { + if (x1 == null) { + return this.array(); + } else if (typeof y1 !== 'undefined') { + x1 = { + x1: x1, + y1: y1, + x2: x2, + y2: y2 + }; + } else { + x1 = new PointArray(x1).toLine(); + } + + return this.attr(x1); + } // Move by left top corner + + + move(x, y) { + return this.attr(this.array().move(x, y).toLine()); + } // Set element size to given width and height + + + size(width, height) { + var p = proportionalSize(this, width, height); + return this.attr(this.array().size(p.width, p.height).toLine()); + } + +} +extend(Line, pointed); +registerMethods({ + Container: { + // Create a line element + line: wrapWithAttrCheck(function (...args) { + // make sure plot is called as a setter + // x1 is not necessarily a number, it can also be an array, a string and a PointArray + return Line.prototype.plot.apply(this.put(new Line()), args[0] != null ? args : [0, 0, 0, 0]); + }) + } +}); +register(Line); + +class Marker extends Container { + // Initialize node + constructor(node) { + super(nodeOrNew('marker', node), node); + } // Set width of element + + + width(width) { + return this.attr('markerWidth', width); + } // Set height of element + + + height(height) { + return this.attr('markerHeight', height); + } // Set marker refX and refY + + + ref(x, y) { + return this.attr('refX', x).attr('refY', y); + } // Update marker + + + update(block) { + // remove all content + this.clear(); // invoke passed block + + if (typeof block === 'function') { + block.call(this, this); + } + + return this; + } // Return the fill id + + + toString() { + return 'url(#' + this.id() + ')'; + } + +} +registerMethods({ + Container: { + marker(...args) { + // Create marker element in defs + return this.defs().marker(...args); + } + + }, + Defs: { + // Create marker + marker: wrapWithAttrCheck(function (width, height, block) { + // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto + return this.put(new Marker()).size(width, height).ref(width / 2, height / 2).viewbox(0, 0, width, height).attr('orient', 'auto').update(block); + }) + }, + marker: { + // Create and attach markers + marker(marker, width, height, block) { + var attr = ['marker']; // Build attribute name + + if (marker !== 'all') attr.push(marker); + attr = attr.join('-'); // Set marker attribute + + marker = arguments[1] instanceof Marker ? arguments[1] : this.defs().marker(width, height, block); + return this.attr(attr, marker); + } + + } +}); +register(Marker); + +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +var _global = createCommonjsModule(function (module) { +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef +}); + +var _core = createCommonjsModule(function (module) { +var core = module.exports = { version: '2.5.7' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef +}); +var _core_1 = _core.version; + +var _isObject = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + +var _anObject = function (it) { + if (!_isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + +var _fails = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + +// Thank's IE8 for his funny defineProperty +var _descriptors = !_fails(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); + +var document$1 = _global.document; +// typeof document.createElement is 'object' in old IE +var is = _isObject(document$1) && _isObject(document$1.createElement); +var _domCreate = function (it) { + return is ? document$1.createElement(it) : {}; +}; + +var _ie8DomDefine = !_descriptors && !_fails(function () { + return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + +// 7.1.1 ToPrimitive(input [, PreferredType]) + +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +var _toPrimitive = function (it, S) { + if (!_isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + +var dP = Object.defineProperty; + +var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { + _anObject(O); + P = _toPrimitive(P, true); + _anObject(Attributes); + if (_ie8DomDefine) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + +var _objectDp = { + f: f +}; + +var _propertyDesc = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + +var _hide = _descriptors ? function (object, key, value) { + return _objectDp.f(object, key, _propertyDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; + +var hasOwnProperty = {}.hasOwnProperty; +var _has = function (it, key) { + return hasOwnProperty.call(it, key); +}; + +var id = 0; +var px = Math.random(); +var _uid = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + +var _redefine = createCommonjsModule(function (module) { +var SRC = _uid('src'); +var TO_STRING = 'toString'; +var $toString = Function[TO_STRING]; +var TPL = ('' + $toString).split(TO_STRING); + +_core.inspectSource = function (it) { + return $toString.call(it); +}; + +(module.exports = function (O, key, val, safe) { + var isFunction = typeof val == 'function'; + if (isFunction) _has(val, 'name') || _hide(val, 'name', key); + if (O[key] === val) return; + if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); + if (O === _global) { + O[key] = val; + } else if (!safe) { + delete O[key]; + _hide(O, key, val); + } else if (O[key]) { + O[key] = val; + } else { + _hide(O, key, val); + } +// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative +})(Function.prototype, TO_STRING, function toString() { + return typeof this == 'function' && this[SRC] || $toString.call(this); +}); +}); + +var _aFunction = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + +// optional / simple context binding + +var _ctx = function (fn, that, length) { + _aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; +}; + +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; + var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); + var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); + var key, own, out, exp; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + // export native or passed + out = (own ? target : source)[key]; + // bind timers to global for call from export context + exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; + // extend global + if (target) _redefine(target, key, out, type & $export.U); + // export + if (exports[key] != out) _hide(exports, key, exp); + if (IS_PROTO && expProto[key] != out) expProto[key] = out; + } +}; +_global.core = _core; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +var _export = $export; + +// 7.2.1 RequireObjectCoercible(argument) +var _defined = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + +// 7.1.13 ToObject(argument) + +var _toObject = function (it) { + return Object(_defined(it)); +}; + +var _strictMethod = function (method, arg) { + return !!method && _fails(function () { + // eslint-disable-next-line no-useless-call + arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); + }); +}; + +var $sort = [].sort; +var test = [1, 2, 3]; + +_export(_export.P + _export.F * (_fails(function () { + // IE8- + test.sort(undefined); +}) || !_fails(function () { + // V8 bug + test.sort(null); + // Old WebKit +}) || !_strictMethod($sort)), 'Array', { + // 22.1.3.25 Array.prototype.sort(comparefn) + sort: function sort(comparefn) { + return comparefn === undefined + ? $sort.call(_toObject(this)) + : $sort.call(_toObject(this), _aFunction(comparefn)); + } +}); + +/*** +Base Class +========== +The base stepper class that will be +***/ + +function makeSetterGetter(k, f) { + return function (v) { + if (v == null) return this[v]; + this[k] = v; + if (f) f.call(this); + return this; + }; +} + +let easing = { + '-': function (pos) { + return pos; + }, + '<>': function (pos) { + return -Math.cos(pos * Math.PI) / 2 + 0.5; + }, + '>': function (pos) { + return Math.sin(pos * Math.PI / 2); + }, + '<': function (pos) { + return -Math.cos(pos * Math.PI / 2) + 1; + }, + bezier: function (x1, y1, x2, y2) { + // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo + return function (t) { + if (t < 0) { + if (x1 > 0) { + return y1 / x1 * t; + } else if (x2 > 0) { + return y2 / x2 * t; + } else { + return 0; + } + } else if (t > 1) { + if (x2 < 1) { + return (1 - y2) / (1 - x2) * t + (y2 - x2) / (1 - x2); + } else if (x1 < 1) { + return (1 - y1) / (1 - x1) * t + (y1 - x1) / (1 - x1); + } else { + return 1; + } + } else { + return 3 * t * Math.pow(1 - t, 2) * y1 + 3 * Math.pow(t, 2) * (1 - t) * y2 + Math.pow(t, 3); + } + }; + }, + // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo + steps: function (steps, stepPosition = 'end') { + // deal with "jump-" prefix + stepPosition = stepPosition.split('-').reverse()[0]; + let jumps = steps; + + if (stepPosition === 'none') { + --jumps; + } else if (stepPosition === 'both') { + ++jumps; + } // The beforeFlag is essentially useless + + + return (t, beforeFlag = false) => { + // Step is called currentStep in referenced url + let step = Math.floor(t * steps); + const jumping = t * step % 1 === 0; + + if (stepPosition === 'start' || stepPosition === 'both') { + ++step; + } + + if (beforeFlag && jumping) { + --step; + } + + if (t >= 0 && step < 0) { + step = 0; + } + + if (t <= 1 && step > jumps) { + step = jumps; + } + + return step / jumps; + }; + } +}; +class Stepper { + done() { + return false; + } + +} +/*** +Easing Functions +================ +***/ + +class Ease extends Stepper { + constructor(fn) { + super(); + this.ease = easing[fn || timeline.ease] || fn; + } + + step(from, to, pos) { + if (typeof from !== 'number') { + return pos < 1 ? from : to; + } + + return from + (to - from) * this.ease(pos); + } + +} +/*** +Controller Types +================ +***/ + +class Controller extends Stepper { + constructor(fn) { + super(); + this.stepper = fn; + } + + step(current, target, dt, c) { + return this.stepper(current, target, dt, c); + } + + done(c) { + return c.done; + } + +} + +function recalculate() { + // Apply the default parameters + var duration = (this._duration || 500) / 1000; + var overshoot = this._overshoot || 0; // Calculate the PID natural response + + var eps = 1e-10; + var pi = Math.PI; + var os = Math.log(overshoot / 100 + eps); + var zeta = -os / Math.sqrt(pi * pi + os * os); + var wn = 3.9 / (zeta * duration); // Calculate the Spring values + + this.d = 2 * zeta * wn; + this.k = wn * wn; +} + +class Spring extends Controller { + constructor(duration, overshoot) { + super(); + this.duration(duration || 500).overshoot(overshoot || 0); + } + + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + if (dt > 100) dt = 16; + dt /= 1000; // Get the previous velocity + + var velocity = c.velocity || 0; // Apply the control to get the new position and store it + + var acceleration = -this.d * velocity - this.k * (current - target); + var newPosition = current + velocity * dt + acceleration * dt * dt / 2; // Store the velocity + + c.velocity = velocity + acceleration * dt; // Figure out if we have converged, and if so, pass the value + + c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002; + return c.done ? target : newPosition; + } + +} +extend(Spring, { + duration: makeSetterGetter('_duration', recalculate), + overshoot: makeSetterGetter('_overshoot', recalculate) +}); +class PID extends Controller { + constructor(p, i, d, windup) { + super(); + p = p == null ? 0.1 : p; + i = i == null ? 0.01 : i; + d = d == null ? 0 : d; + windup = windup == null ? 1000 : windup; + this.p(p).i(i).d(d).windup(windup); + } + + step(current, target, dt, c) { + if (typeof current === 'string') return current; + c.done = dt === Infinity; + if (dt === Infinity) return target; + if (dt === 0) return current; + var p = target - current; + var i = (c.integral || 0) + p * dt; + var d = (p - (c.error || 0)) / dt; + var windup = this.windup; // antiwindup + + if (windup !== false) { + i = Math.max(-windup, Math.min(i, windup)); + } + + c.error = p; + c.integral = i; + c.done = Math.abs(p) < 0.001; + return c.done ? target : current + (this.P * p + this.I * i + this.D * d); + } + +} +extend(PID, { + windup: makeSetterGetter('windup'), + p: makeSetterGetter('P'), + i: makeSetterGetter('I'), + d: makeSetterGetter('D') +}); + +const PathArray = subClassArray('PathArray', SVGArray); +function pathRegReplace(a, b, c, d) { + return c + d.replace(dots, ' .'); +} + +function arrayToString(a) { + for (var i = 0, il = a.length, s = ''; i < il; i++) { + s += a[i][0]; + + if (a[i][1] != null) { + s += a[i][1]; + + if (a[i][2] != null) { + s += ' '; + s += a[i][2]; + + if (a[i][3] != null) { + s += ' '; + s += a[i][3]; + s += ' '; + s += a[i][4]; + + if (a[i][5] != null) { + s += ' '; + s += a[i][5]; + s += ' '; + s += a[i][6]; + + if (a[i][7] != null) { + s += ' '; + s += a[i][7]; + } + } + } + } + } + } + + return s + ' '; +} + +const pathHandlers = { + M: function (c, p, p0) { + p.x = p0.x = c[0]; + p.y = p0.y = c[1]; + return ['M', p.x, p.y]; + }, + L: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['L', c[0], c[1]]; + }, + H: function (c, p) { + p.x = c[0]; + return ['H', c[0]]; + }, + V: function (c, p) { + p.y = c[0]; + return ['V', c[0]]; + }, + C: function (c, p) { + p.x = c[4]; + p.y = c[5]; + return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]; + }, + S: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['S', c[0], c[1], c[2], c[3]]; + }, + Q: function (c, p) { + p.x = c[2]; + p.y = c[3]; + return ['Q', c[0], c[1], c[2], c[3]]; + }, + T: function (c, p) { + p.x = c[0]; + p.y = c[1]; + return ['T', c[0], c[1]]; + }, + Z: function (c, p, p0) { + p.x = p0.x; + p.y = p0.y; + return ['Z']; + }, + A: function (c, p) { + p.x = c[5]; + p.y = c[6]; + return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]; + } +}; +let mlhvqtcsaz = 'mlhvqtcsaz'.split(''); + +for (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) { + pathHandlers[mlhvqtcsaz[i]] = function (i) { + return function (c, p, p0) { + if (i === 'H') c[0] = c[0] + p.x;else if (i === 'V') c[0] = c[0] + p.y;else if (i === 'A') { + c[5] = c[5] + p.x; + c[6] = c[6] + p.y; + } else { + for (var j = 0, jl = c.length; j < jl; ++j) { + c[j] = c[j] + (j % 2 ? p.y : p.x); + } + } + return pathHandlers[i](c, p, p0); + }; + }(mlhvqtcsaz[i].toUpperCase()); +} + +extend(PathArray, { + // Convert array to string + toString() { + return arrayToString(this); + }, + + // Move path string + move(x, y) { + // get bounding box of current situation + var box = this.bbox(); // get relative offset + + x -= box.x; + y -= box.y; + + if (!isNaN(x) && !isNaN(y)) { + // move every point + for (var l, i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] += x; + this[i][2] += y; + } else if (l === 'H') { + this[i][1] += x; + } else if (l === 'V') { + this[i][1] += y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] += x; + this[i][2] += y; + this[i][3] += x; + this[i][4] += y; + + if (l === 'C') { + this[i][5] += x; + this[i][6] += y; + } + } else if (l === 'A') { + this[i][6] += x; + this[i][7] += y; + } + } + } + + return this; + }, + + // Resize path string + size(width, height) { + // get bounding box of current situation + var box = this.bbox(); + var i, l; // recalculate position of all points according to new size + + for (i = this.length - 1; i >= 0; i--) { + l = this[i][0]; + + if (l === 'M' || l === 'L' || l === 'T') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + } else if (l === 'H') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + } else if (l === 'V') { + this[i][1] = (this[i][1] - box.y) * height / box.height + box.y; + } else if (l === 'C' || l === 'S' || l === 'Q') { + this[i][1] = (this[i][1] - box.x) * width / box.width + box.x; + this[i][2] = (this[i][2] - box.y) * height / box.height + box.y; + this[i][3] = (this[i][3] - box.x) * width / box.width + box.x; + this[i][4] = (this[i][4] - box.y) * height / box.height + box.y; + + if (l === 'C') { + this[i][5] = (this[i][5] - box.x) * width / box.width + box.x; + this[i][6] = (this[i][6] - box.y) * height / box.height + box.y; + } + } else if (l === 'A') { + // resize radii + this[i][1] = this[i][1] * width / box.width; + this[i][2] = this[i][2] * height / box.height; // move position values + + this[i][6] = (this[i][6] - box.x) * width / box.width + box.x; + this[i][7] = (this[i][7] - box.y) * height / box.height + box.y; + } + } + + return this; + }, + + // Test if the passed path array use the same path data commands as this path array + equalCommands(pathArray) { + var i, il, equalCommands; + pathArray = new PathArray(pathArray); + equalCommands = this.length === pathArray.length; + + for (i = 0, il = this.length; equalCommands && i < il; i++) { + equalCommands = this[i][0] === pathArray[i][0]; + } + + return equalCommands; + }, + + // Make path array morphable + morph(pathArray) { + pathArray = new PathArray(pathArray); + + if (this.equalCommands(pathArray)) { + this.destination = pathArray; + } else { + this.destination = null; + } + + return this; + }, + + // Get morphed path array at given position + at(pos) { + // make sure a destination is defined + if (!this.destination) return this; + var sourceArray = this; + var destinationArray = this.destination.value; + var array = []; + var pathArray = new PathArray(); + var i, il, j, jl; // Animate has specified in the SVG spec + // See: https://www.w3.org/TR/SVG11/paths.html#PathElement + + for (i = 0, il = sourceArray.length; i < il; i++) { + array[i] = [sourceArray[i][0]]; + + for (j = 1, jl = sourceArray[i].length; j < jl; j++) { + array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos; + } // For the two flags of the elliptical arc command, the SVG spec say: + // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true + // Elliptical arc command as an array followed by corresponding indexes: + // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y] + // 0 1 2 3 4 5 6 7 + + + if (array[i][0] === 'A') { + array[i][4] = +(array[i][4] !== 0); + array[i][5] = +(array[i][5] !== 0); + } + } // Directly modify the value of a path array, this is done this way for performance + + + pathArray.value = array; + return pathArray; + }, + + // Absolutize and parse path to array + parse(array = [['M', 0, 0]]) { + // if it's already a patharray, no need to parse it + if (array instanceof PathArray) return array; // prepare for parsing + + var s; + var paramCnt = { + 'M': 2, + 'L': 2, + 'H': 1, + 'V': 1, + 'C': 6, + 'S': 4, + 'Q': 4, + 'T': 2, + 'A': 7, + 'Z': 0 + }; + + if (typeof array === 'string') { + array = array.replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123 + .replace(pathLetters, ' $& ') // put some room between letters and numbers + .replace(hyphen, '$1 -') // add space before hyphen + .trim() // trim + .split(delimiter); // split into array + } else { + array = array.reduce(function (prev, curr) { + return [].concat.call(prev, curr); + }, []); + } // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...] + + + var result = []; + var p = new Point(); + var p0 = new Point(); + var index = 0; + var len = array.length; + + do { + // Test if we have a path letter + if (isPathLetter.test(array[index])) { + s = array[index]; + ++index; // If last letter was a move command and we got no new, it defaults to [L]ine + } else if (s === 'M') { + s = 'L'; + } else if (s === 'm') { + s = 'l'; + } + + result.push(pathHandlers[s].call(null, array.slice(index, index = index + paramCnt[s.toUpperCase()]).map(parseFloat), p, p0)); + } while (len > index); + + return result; + }, + + // Get bounding box of path + bbox() { + parser().path.setAttribute('d', this.toString()); + return parser.nodes.path.getBBox(); + } + +}); + +class Morphable { + constructor(stepper) { + this._stepper = stepper || new Ease('-'); + this._from = null; + this._to = null; + this._type = null; + this._context = null; + this._morphObj = null; + } + + from(val) { + if (val == null) { + return this._from; + } + + this._from = this._set(val); + return this; + } + + to(val) { + if (val == null) { + return this._to; + } + + this._to = this._set(val); + return this; + } + + type(type) { + // getter + if (type == null) { + return this._type; + } // setter + + + this._type = type; + return this; + } + + _set(value) { + if (!this._type) { + var type = typeof value; + + if (type === 'number') { + this.type(SVGNumber); + } else if (type === 'string') { + if (Color.isColor(value)) { + this.type(Color); + } else if (delimiter.test(value)) { + this.type(pathLetters.test(value) ? PathArray : SVGArray); + } else if (numberAndUnit.test(value)) { + this.type(SVGNumber); + } else { + this.type(NonMorphable); + } + } else if (morphableTypes.indexOf(value.constructor) > -1) { + this.type(value.constructor); + } else if (Array.isArray(value)) { + this.type(SVGArray); + } else if (type === 'object') { + this.type(ObjectBag); + } else { + this.type(NonMorphable); + } + } + + var result = new this._type(value).toArray(); + this._morphObj = this._morphObj || new this._type(); + this._context = this._context || Array.apply(null, Array(result.length)).map(Object); + return result; + } + + stepper(stepper) { + if (stepper == null) return this._stepper; + this._stepper = stepper; + return this; + } + + done() { + var complete = this._context.map(this._stepper.done).reduce(function (last, curr) { + return last && curr; + }, true); + + return complete; + } + + at(pos) { + var _this = this; + + return this._morphObj.fromArray(this._from.map(function (i, index) { + return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context); + })); + } + +} +class NonMorphable { + constructor(...args) { + this.init(...args); + } + + init(val) { + val = Array.isArray(val) ? val[0] : val; + this.value = val; + return this; + } + + valueOf() { + return this.value; + } + + toArray() { + return [this.value]; + } + +} +class TransformBag { + constructor(...args) { + this.init(...args); + } + + init(obj) { + if (Array.isArray(obj)) { + obj = { + scaleX: obj[0], + scaleY: obj[1], + shear: obj[2], + rotate: obj[3], + translateX: obj[4], + translateY: obj[5], + originX: obj[6], + originY: obj[7] + }; + } + + Object.assign(this, TransformBag.defaults, obj); + return this; + } + + toArray() { + var v = this; + return [v.scaleX, v.scaleY, v.shear, v.rotate, v.translateX, v.translateY, v.originX, v.originY]; + } + +} +TransformBag.defaults = { + scaleX: 1, + scaleY: 1, + shear: 0, + rotate: 0, + translateX: 0, + translateY: 0, + originX: 0, + originY: 0 +}; +class ObjectBag { + constructor(...args) { + this.init(...args); + } + + init(objOrArr) { + this.values = []; + + if (Array.isArray(objOrArr)) { + this.values = objOrArr; + return; + } + + objOrArr = objOrArr || {}; + var entries = []; + + for (let i in objOrArr) { + entries.push([i, objOrArr[i]]); + } + + entries.sort((a, b) => { + return a[0] - b[0]; + }); + this.values = entries.reduce((last, curr) => last.concat(curr), []); + return this; + } + + valueOf() { + var obj = {}; + var arr = this.values; + + for (var i = 0, len = arr.length; i < len; i += 2) { + obj[arr[i]] = arr[i + 1]; + } + + return obj; + } + + toArray() { + return this.values; + } + +} +const morphableTypes = [NonMorphable, TransformBag, ObjectBag]; +function registerMorphableType(type = []) { + morphableTypes.push(...[].concat(type)); +} +function makeMorphable() { + extend(morphableTypes, { + to(val) { + return new Morphable().type(this.constructor).from(this.valueOf()).to(val); + }, + + fromArray(arr) { + this.init(arr); + return this; + } + + }); +} + +class Path extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('path', node), node); + } // Get array + + + array() { + return this._array || (this._array = new PathArray(this.attr('d'))); + } // Plot new path + + + plot(d) { + return d == null ? this.array() : this.clear().attr('d', typeof d === 'string' ? d : this._array = new PathArray(d)); + } // Clear array cache + + + clear() { + delete this._array; + return this; + } // Move by left top corner + + + move(x, y) { + return this.attr('d', this.array().move(x, y)); + } // Move by left top corner over x-axis + + + x(x) { + return x == null ? this.bbox().x : this.move(x, this.bbox().y); + } // Move by left top corner over y-axis + + + y(y) { + return y == null ? this.bbox().y : this.move(this.bbox().x, y); + } // Set element size to given width and height + + + size(width, height) { + var p = proportionalSize(this, width, height); + return this.attr('d', this.array().size(p.width, p.height)); + } // Set width of element + + + width(width) { + return width == null ? this.bbox().width : this.size(width, this.bbox().height); + } // Set height of element + + + height(height) { + return height == null ? this.bbox().height : this.size(this.bbox().width, height); + } + + targets() { + return baseFind('svg textpath [href*="' + this.id() + '"]'); + } + +} // Define morphable array + +Path.prototype.MorphArray = PathArray; // Add parent method + +registerMethods({ + Container: { + // Create a wrapped path element + path: wrapWithAttrCheck(function (d) { + // make sure plot is called as a setter + return this.put(new Path()).plot(d || new PathArray()); + }) + } +}); +register(Path); + +function array() { + return this._array || (this._array = new PointArray(this.attr('points'))); +} // Plot new path + +function plot(p) { + return p == null ? this.array() : this.clear().attr('points', typeof p === 'string' ? p : this._array = new PointArray(p)); +} // Clear array cache + +function clear() { + delete this._array; + return this; +} // Move by left top corner + +function move(x, y) { + return this.attr('points', this.array().move(x, y)); +} // Set element size to given width and height + +function size(width, height) { + let p = proportionalSize(this, width, height); + return this.attr('points', this.array().size(p.width, p.height)); +} + +var poly = /*#__PURE__*/Object.freeze({ + array: array, + plot: plot, + clear: clear, + move: move, + size: size +}); + +class Polygon extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('polygon', node), node); + } + +} +registerMethods({ + Container: { + // Create a wrapped polygon element + polygon: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polygon()).plot(p || new PointArray()); + }) + } +}); +extend(Polygon, pointed); +extend(Polygon, poly); +register(Polygon); + +class Polyline extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('polyline', node), node); + } + +} +registerMethods({ + Container: { + // Create a wrapped polygon element + polyline: wrapWithAttrCheck(function (p) { + // make sure plot is called as a setter + return this.put(new Polyline()).plot(p || new PointArray()); + }) + } +}); +extend(Polyline, pointed); +extend(Polyline, poly); +register(Polyline); + +class Rect extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('rect', node), node); + } + +} +extend(Rect, { + rx, + ry +}); +registerMethods({ + Container: { + // Create a rect element + rect: wrapWithAttrCheck(function (width$$1, height$$1) { + return this.put(new Rect()).size(width$$1, height$$1); + }) + } +}); +register(Rect); + +class Queue { + constructor() { + this._first = null; + this._last = null; + } + + push(value) { + // An item stores an id and the provided value + var item = value.next ? value : { + value: value, + next: null, + prev: null // Deal with the queue being empty or populated + + }; + + if (this._last) { + item.prev = this._last; + this._last.next = item; + this._last = item; + } else { + this._last = item; + this._first = item; + } // Update the length and return the current item + + + return item; + } + + shift() { + // Check if we have a value + var remove = this._first; + if (!remove) return null; // If we do, remove it and relink things + + this._first = remove.next; + if (this._first) this._first.prev = null; + this._last = this._first ? this._last : null; + return remove.value; + } // Shows us the first item in the list + + + first() { + return this._first && this._first.value; + } // Shows us the last item in the list + + + last() { + return this._last && this._last.value; + } // Removes the item that was returned from the push + + + remove(item) { + // Relink the previous item + if (item.prev) item.prev.next = item.next; + if (item.next) item.next.prev = item.prev; + if (item === this._last) this._last = item.prev; + if (item === this._first) this._first = item.next; // Invalidate item + + item.prev = null; + item.next = null; + } + +} + +const Animator = { + nextDraw: null, + frames: new Queue(), + timeouts: new Queue(), + timer: globals.window.performance || globals.window.Date, + transforms: [], + + frame(fn) { + // Store the node + var node = Animator.frames.push({ + run: fn + }); // Request an animation frame if we don't have one + + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } // Return the node so we can remove it easily + + + return node; + }, + + transform_frame(fn, id) { + Animator.transforms[id] = fn; + }, + + timeout(fn, delay) { + delay = delay || 0; // Work out when the event should fire + + var time = Animator.timer.now() + delay; // Add the timeout to the end of the queue + + var node = Animator.timeouts.push({ + run: fn, + time: time + }); // Request another animation frame if we need one + + if (Animator.nextDraw === null) { + Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw); + } + + return node; + }, + + cancelFrame(node) { + node != null && Animator.frames.remove(node); + }, + + clearTimeout(node) { + node != null && Animator.timeouts.remove(node); + }, + + _draw(now) { + // Run all the timeouts we can run, if they are not ready yet, add them + // to the end of the queue immediately! (bad timeouts!!! [sarcasm]) + var nextTimeout = null; + var lastTimeout = Animator.timeouts.last(); + + while (nextTimeout = Animator.timeouts.shift()) { + // Run the timeout if its time, or push it to the end + if (now >= nextTimeout.time) { + nextTimeout.run(); + } else { + Animator.timeouts.push(nextTimeout); + } // If we hit the last item, we should stop shifting out more items + + + if (nextTimeout === lastTimeout) break; + } // Run all of the animation frames + + + var nextFrame = null; + var lastFrame = Animator.frames.last(); + + while (nextFrame !== lastFrame && (nextFrame = Animator.frames.shift())) { + nextFrame.run(); + } + + Animator.transforms.forEach(function (el) { + el(); + }); // If we have remaining timeouts or frames, draw until we don't anymore + + Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first() ? globals.window.requestAnimationFrame(Animator._draw) : null; + } + +}; + +var makeSchedule = function (runnerInfo) { + var start = runnerInfo.start; + var duration = runnerInfo.runner.duration(); + var end = start + duration; + return { + start: start, + duration: duration, + end: end, + runner: runnerInfo.runner + }; +}; + +const defaultSource = function () { + let w = globals.window; + return (w.performance || w.Date).now(); +}; + +class Timeline extends EventTarget { + // Construct a new timeline on the given element + constructor(timeSource = defaultSource) { + super(); + this._timeSource = timeSource; // Store the timing variables + + this._startTime = 0; + this._speed = 1.0; // Determines how long a runner is hold in memory. Can be a dt or true/false + + this._persist = 0; // Keep track of the running animations and their starting parameters + + this._nextFrame = null; + this._paused = true; + this._runners = []; + this._order = []; + this._time = 0; + this._lastSourceTime = 0; + this._lastStepTime = 0; // Make sure that step is always called in class context + + this._step = this._step.bind(this); + } // schedules a runner on the timeline + + + schedule(runner, delay, when) { + if (runner == null) { + return this._runners.map(makeSchedule).sort(function (a, b) { + return a.runner.id - b.runner.id; + }); + } // The start time for the next animation can either be given explicitly, + // derived from the current timeline time or it can be relative to the + // last start time to chain animations direclty + + + var absoluteStartTime = 0; + var endTime = this.getEndTime(); + delay = delay || 0; // Work out when to start the animation + + if (when == null || when === 'last' || when === 'after') { + // Take the last time and increment + absoluteStartTime = endTime; + } else if (when === 'absolute' || when === 'start') { + absoluteStartTime = delay; + delay = 0; + } else if (when === 'now') { + absoluteStartTime = this._time; + } else if (when === 'relative') { + let runnerInfo = this._runners[runner.id]; + + if (runnerInfo) { + absoluteStartTime = runnerInfo.start + delay; + delay = 0; + } + } else { + throw new Error('Invalid value for the "when" parameter'); + } // Manage runner + + + runner.unschedule(); + runner.timeline(this); // runner.time(-delay) + // Save runnerInfo + + this._runners[runner.id] = { + persist: this.persist(), + runner: runner, + start: absoluteStartTime + delay // Save order, update Time if needed and continue + + }; + + this._order.push(runner.id); + + this.updateTime()._continue(); + + return this; + } // Remove the runner from this timeline + + + unschedule(runner) { + var index = this._order.indexOf(runner.id); + + if (index < 0) return this; + delete this._runners[runner.id]; + + this._order.splice(index, 1); + + runner.timeline(null); + return this; + } // Calculates the end of the timeline + + + getEndTime() { + var lastRunnerInfo = this._runners[this._order[this._order.length - 1]]; + var lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0; + var lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : 0; + return lastStartTime + lastDuration; + } // Makes sure, that after pausing the time doesn't jump + + + updateTime() { + if (!this.active()) { + this._lastSourceTime = this._timeSource(); + } + + return this; + } + + play() { + // Now make sure we are not paused and continue the animation + this._paused = false; + return this.updateTime()._continue(); + } + + pause() { + this._paused = true; + return this._continue(); + } + + stop() { + // Go to start and pause + this.time(0); + return this.pause(); + } + + finish() { + // Go to end and pause + this.time(this.getEndTime() + 1); + return this.pause(); + } + + speed(speed) { + if (speed == null) return this._speed; + this._speed = speed; + return this; + } + + reverse(yes) { + var currentSpeed = this.speed(); + if (yes == null) return this.speed(-currentSpeed); + var positive = Math.abs(currentSpeed); + return this.speed(yes ? positive : -positive); + } + + seek(dt) { + return this.time(this._time + dt); + } + + time(time) { + if (time == null) return this._time; + this._time = time; + return this._continue(true); + } + + persist(dtOrForever) { + if (dtOrForever == null) return this._persist; + this._persist = dtOrForever; + return this; + } + + source(fn) { + if (fn == null) return this._timeSource; + this._timeSource = fn; + return this; + } + + _step(immediateStep = false) { + // Get the time delta from the last time and update the time + var time = this._timeSource(); + + var dtSource = time - this._lastSourceTime; + if (immediateStep) dtSource = 0; + var dtTime = this._speed * dtSource + (this._time - this._lastStepTime); + this._lastSourceTime = time; // Only update the time if we use the timeSource. + // Otherwise use the current time + + if (!immediateStep) { + // Update the time + this._time += dtTime; + this._time = this._time < 0 ? 0 : this._time; + } + + this._lastStepTime = this._time; + this.fire('time', this._time); // Run all of the runners directly + + var runnersLeft = false; + + for (var i = 0, len = this._order.length; i < len; i++) { + // Get and run the current runner and ignore it if its inactive + var runnerInfo = this._runners[this._order[i]]; + var runner = runnerInfo.runner; + let dt = dtTime; // Make sure that we give the actual difference + // between runner start time and now + + let dtToStart = this._time - runnerInfo.start; // Dont run runner if not started yet + + if (dtToStart <= 0) { + runnersLeft = true; // This is for the case that teh timeline was seeked so that the time + // is now before the startTime of the runner. Thats why we need to set + // the runner to position 0 + + runner.reset(); + continue; + } else if (dtToStart < dt) { + // Adjust dt to make sure that animation is on point + dt = dtToStart; + } + + if (!runner.active()) continue; // If this runner is still going, signal that we need another animation + // frame, otherwise, remove the completed runner + + var finished = runner.step(dt).done; + + if (!finished) { + runnersLeft = true; // continue + } else if (runnerInfo.persist !== true) { + // runner is finished. And runner might get removed + var endTime = runner.duration() - runner.time() + this._time; + + if (endTime + this._persist < this._time) { + // Delete runner and correct index + delete this._runners[this._order[i]]; + this._order.splice(i--, 1) && --len; + runner.timeline(null); + } + } + } // Basically: we continue when there are runners right from us in time + // when -->, and when runners are left from us when <-- + + + if (runnersLeft && !(this._speed < 0 && this._time === 0) || this._order.length && this._speed < 0 && this._time > 0) { + this._continue(); + } else { + this.fire('finished'); + this.pause(); + } + + return this; + } // Checks if we are running and continues the animation + + + _continue(immediateStep = false) { + Animator.cancelFrame(this._nextFrame); + this._nextFrame = null; + if (immediateStep) return this._step(true); + if (this._paused) return this; + this._nextFrame = Animator.frame(this._step); + return this; + } + + active() { + return !!this._nextFrame; + } + +} +registerMethods({ + Element: { + timeline: function () { + this._timeline = this._timeline || new Timeline(); + return this._timeline; + } + } +}); + +class Runner extends EventTarget { + constructor(options) { + super(); // Store a unique id on the runner, so that we can identify it later + + this.id = Runner.id++; // Ensure a default value + + options = options == null ? timeline.duration : options; // Ensure that we get a controller + + options = typeof options === 'function' ? new Controller(options) : options; // Declare all of the variables + + this._element = null; + this._timeline = null; + this.done = false; + this._queue = []; // Work out the stepper and the duration + + this._duration = typeof options === 'number' && options; + this._isDeclarative = options instanceof Controller; + this._stepper = this._isDeclarative ? options : new Ease(); // We copy the current values from the timeline because they can change + + this._history = {}; // Store the state of the runner + + this.enabled = true; + this._time = 0; + this._lastTime = 0; // At creation, the runner is in reseted state + + this._reseted = true; // Save transforms applied to this runner + + this.transforms = new Matrix(); + this.transformId = 1; // Looping variables + + this._haveReversed = false; + this._reverse = false; + this._loopsDone = 0; + this._swing = false; + this._wait = 0; + this._times = 1; + } + /* + Runner Definitions + ================== + These methods help us define the runtime behaviour of the Runner or they + help us make new runners from the current runner + */ + + + element(element) { + if (element == null) return this._element; + this._element = element; + + element._prepareRunner(); + + return this; + } + + timeline(timeline$$1) { + // check explicitly for undefined so we can set the timeline to null + if (typeof timeline$$1 === 'undefined') return this._timeline; + this._timeline = timeline$$1; + return this; + } + + animate(duration, delay, when) { + var o = Runner.sanitise(duration, delay, when); + var runner = new Runner(o.duration); + if (this._timeline) runner.timeline(this._timeline); + if (this._element) runner.element(this._element); + return runner.loop(o).schedule(delay, when); + } + + schedule(timeline$$1, delay, when) { + // The user doesn't need to pass a timeline if we already have one + if (!(timeline$$1 instanceof Timeline)) { + when = delay; + delay = timeline$$1; + timeline$$1 = this.timeline(); + } // If there is no timeline, yell at the user... + + + if (!timeline$$1) { + throw Error('Runner cannot be scheduled without timeline'); + } // Schedule the runner on the timeline provided + + + timeline$$1.schedule(this, delay, when); + return this; + } + + unschedule() { + var timeline$$1 = this.timeline(); + timeline$$1 && timeline$$1.unschedule(this); + return this; + } + + loop(times, swing, wait) { + // Deal with the user passing in an object + if (typeof times === 'object') { + swing = times.swing; + wait = times.wait; + times = times.times; + } // Sanitise the values and store them + + + this._times = times || Infinity; + this._swing = swing || false; + this._wait = wait || 0; + return this; + } + + delay(delay) { + return this.animate(0, delay); + } + /* + Basic Functionality + =================== + These methods allow us to attach basic functions to the runner directly + */ + + + queue(initFn, runFn, retargetFn, isTransform) { + this._queue.push({ + initialiser: initFn || noop, + runner: runFn || noop, + retarget: retargetFn, + isTransform: isTransform, + initialised: false, + finished: false + }); + + var timeline$$1 = this.timeline(); + timeline$$1 && this.timeline()._continue(); + return this; + } + + during(fn) { + return this.queue(null, fn); + } + + after(fn) { + return this.on('finish', fn); + } + /* + Runner animation methods + ======================== + Control how the animation plays + */ + + + time(time) { + if (time == null) { + return this._time; + } + + let dt = time - this._time; + this.step(dt); + return this; + } + + duration() { + return this._times * (this._wait + this._duration) - this._wait; + } + + loops(p) { + var loopDuration = this._duration + this._wait; + + if (p == null) { + var loopsDone = Math.floor(this._time / loopDuration); + var relativeTime = this._time - loopsDone * loopDuration; + var position = relativeTime / this._duration; + return Math.min(loopsDone + position, this._times); + } + + var whole = Math.floor(p); + var partial = p % 1; + var time = loopDuration * whole + this._duration * partial; + return this.time(time); + } + + position(p) { + // Get all of the variables we need + var x$$1 = this._time; + var d = this._duration; + var w = this._wait; + var t = this._times; + var s = this._swing; + var r = this._reverse; + var position; + + if (p == null) { + /* + This function converts a time to a position in the range [0, 1] + The full explanation can be found in this desmos demonstration + https://www.desmos.com/calculator/u4fbavgche + The logic is slightly simplified here because we can use booleans + */ + // Figure out the value without thinking about the start or end time + const f = function (x$$1) { + var swinging = s * Math.floor(x$$1 % (2 * (w + d)) / (w + d)); + var backwards = swinging && !r || !swinging && r; + var uncliped = Math.pow(-1, backwards) * (x$$1 % (w + d)) / d + backwards; + var clipped = Math.max(Math.min(uncliped, 1), 0); + return clipped; + }; // Figure out the value by incorporating the start time + + + var endTime = t * (w + d) - w; + position = x$$1 <= 0 ? Math.round(f(1e-5)) : x$$1 < endTime ? f(x$$1) : Math.round(f(endTime - 1e-5)); + return position; + } // Work out the loops done and add the position to the loops done + + + var loopsDone = Math.floor(this.loops()); + var swingForward = s && loopsDone % 2 === 0; + var forwards = swingForward && !r || r && swingForward; + position = loopsDone + (forwards ? p : 1 - p); + return this.loops(position); + } + + progress(p) { + if (p == null) { + return Math.min(1, this._time / this.duration()); + } + + return this.time(p * this.duration()); + } + + step(dt) { + // If we are inactive, this stepper just gets skipped + if (!this.enabled) return this; // Update the time and get the new position + + dt = dt == null ? 16 : dt; + this._time += dt; + var position = this.position(); // Figure out if we need to run the stepper in this frame + + var running = this._lastPosition !== position && this._time >= 0; + this._lastPosition = position; // Figure out if we just started + + var duration = this.duration(); + var justStarted = this._lastTime <= 0 && this._time > 0; + var justFinished = this._lastTime < this._time && this.time > duration; + this._lastTime = this._time; + + if (justStarted) { + this.fire('start', this); + } // Work out if the runner is finished set the done flag here so animations + // know, that they are running in the last step (this is good for + // transformations which can be merged) + + + var declarative = this._isDeclarative; + this.done = !declarative && !justFinished && this._time >= duration; // Runner is running. So its not in reseted state anymore + + this._reseted = false; // Call initialise and the run function + + if (running || declarative) { + this._initialise(running); // clear the transforms on this runner so they dont get added again and again + + + this.transforms = new Matrix(); + + var converged = this._run(declarative ? dt : position); + + this.fire('step', this); + } // correct the done flag here + // declaritive animations itself know when they converged + + + this.done = this.done || converged && declarative; + + if (this.done) { + this.fire('finish', this); + } + + return this; + } + + reset() { + if (this._reseted) return this; + this.loops(0); + this._reseted = true; + return this; + } + + finish() { + return this.step(Infinity); + } + + reverse(reverse) { + this._reverse = reverse == null ? !this._reverse : reverse; + return this; + } + + ease(fn) { + this._stepper = new Ease(fn); + return this; + } + + active(enabled) { + if (enabled == null) return this.enabled; + this.enabled = enabled; + return this; + } + /* + Private Methods + =============== + Methods that shouldn't be used externally + */ + // Save a morpher to the morpher list so that we can retarget it later + + + _rememberMorpher(method, morpher) { + this._history[method] = { + morpher: morpher, + caller: this._queue[this._queue.length - 1] + }; + } // Try to set the target for a morpher if the morpher exists, otherwise + // do nothing and return false + + + _tryRetarget(method, target) { + if (this._history[method]) { + // if the last method wasnt even initialised, throw it away + if (!this._history[method].caller.initialised) { + let index = this._queue.indexOf(this._history[method].caller); + + this._queue.splice(index, 1); + + return false; + } // for the case of transformations, we use the special retarget function + // which has access to the outer scope + + + if (this._history[method].caller.retarget) { + this._history[method].caller.retarget(target); // for everything else a simple morpher change is sufficient + + } else { + this._history[method].morpher.to(target); + } + + this._history[method].caller.finished = false; + var timeline$$1 = this.timeline(); + timeline$$1 && timeline$$1._continue(); + return true; + } + + return false; + } // Run each initialise function in the runner if required + + + _initialise(running) { + // If we aren't running, we shouldn't initialise when not declarative + if (!running && !this._isDeclarative) return; // Loop through all of the initialisers + + for (var i = 0, len = this._queue.length; i < len; ++i) { + // Get the current initialiser + var current = this._queue[i]; // Determine whether we need to initialise + + var needsIt = this._isDeclarative || !current.initialised && running; + running = !current.finished; // Call the initialiser if we need to + + if (needsIt && running) { + current.initialiser.call(this); + current.initialised = true; + } + } + } // Run each run function for the position or dt given + + + _run(positionOrDt) { + // Run all of the _queue directly + var allfinished = true; + + for (var i = 0, len = this._queue.length; i < len; ++i) { + // Get the current function to run + var current = this._queue[i]; // Run the function if its not finished, we keep track of the finished + // flag for the sake of declarative _queue + + var converged = current.runner.call(this, positionOrDt); + current.finished = current.finished || converged === true; + allfinished = allfinished && current.finished; + } // We report when all of the constructors are finished + + + return allfinished; + } + + addTransform(transform, index) { + this.transforms.lmultiplyO(transform); + return this; + } + + clearTransform() { + this.transforms = new Matrix(); + return this; + } // TODO: Keep track of all transformations so that deletion is faster + + + clearTransformsFromQueue() { + if (!this.done) { + this._queue = this._queue.filter(item => { + return !item.isTransform; + }); + } + } + + static sanitise(duration, delay, when) { + // Initialise the default parameters + var times = 1; + var swing = false; + var wait = 0; + duration = duration || timeline.duration; + delay = delay || timeline.delay; + when = when || 'last'; // If we have an object, unpack the values + + if (typeof duration === 'object' && !(duration instanceof Stepper)) { + delay = duration.delay || delay; + when = duration.when || when; + swing = duration.swing || swing; + times = duration.times || times; + wait = duration.wait || wait; + duration = duration.duration || timeline.duration; + } + + return { + duration: duration, + delay: delay, + swing: swing, + times: times, + wait: wait, + when: when + }; + } + +} +Runner.id = 0; + +class FakeRunner { + constructor(transforms = new Matrix(), id = -1, done = true) { + this.transforms = transforms; + this.id = id; + this.done = done; + } + + clearTransformsFromQueue() {} + +} + +extend([Runner, FakeRunner], { + mergeWith(runner) { + return new FakeRunner(runner.transforms.lmultiply(this.transforms), runner.id); + } + +}); // FakeRunner.emptyRunner = new FakeRunner() + +const lmultiply = (last, curr) => last.lmultiplyO(curr); + +const getRunnerTransform = runner => runner.transforms; + +function mergeTransforms() { + // Find the matrix to apply to the element and apply it + let runners = this._transformationRunners.runners; + let netTransform = runners.map(getRunnerTransform).reduce(lmultiply, new Matrix()); + this.transform(netTransform); + + this._transformationRunners.merge(); + + if (this._transformationRunners.length() === 1) { + this._frameId = null; + } +} + +class RunnerArray { + constructor() { + this.runners = []; + this.ids = []; + } + + add(runner) { + if (this.runners.includes(runner)) return; + let id = runner.id + 1; + let leftSibling = this.ids.reduce((last, curr) => { + if (curr > last && curr < id) return curr; + return last; + }, 0); + let index = this.ids.indexOf(leftSibling) + 1; + this.ids.splice(index, 0, id); + this.runners.splice(index, 0, runner); + return this; + } + + getByID(id) { + return this.runners[this.ids.indexOf(id + 1)]; + } + + remove(id) { + let index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1); + this.runners.splice(index, 1); + return this; + } + + merge() { + let lastRunner = null; + this.runners.forEach((runner, i) => { + if (lastRunner && runner.done && lastRunner.done) { + this.remove(runner.id); + this.edit(lastRunner.id, runner.mergeWith(lastRunner)); + } + + lastRunner = runner; + }); + return this; + } + + edit(id, newRunner) { + let index = this.ids.indexOf(id + 1); + this.ids.splice(index, 1, id); + this.runners.splice(index, 1, newRunner); + return this; + } + + length() { + return this.ids.length; + } + + clearBefore(id) { + let deleteCnt = this.ids.indexOf(id + 1) || 1; + this.ids.splice(0, deleteCnt, 0); + this.runners.splice(0, deleteCnt, new FakeRunner()).forEach(r => r.clearTransformsFromQueue()); + return this; + } + +} + +let frameId = 0; +registerMethods({ + Element: { + animate(duration, delay, when) { + var o = Runner.sanitise(duration, delay, when); + var timeline$$1 = this.timeline(); + return new Runner(o.duration).loop(o).element(this).timeline(timeline$$1.play()).schedule(delay, when); + }, + + delay(by, when) { + return this.animate(0, by, when); + }, + + // this function searches for all runners on the element and deletes the ones + // which run before the current one. This is because absolute transformations + // overwfrite anything anyway so there is no need to waste time computing + // other runners + _clearTransformRunnersBefore(currentRunner) { + this._transformationRunners.clearBefore(currentRunner.id); + }, + + _currentTransform(current) { + return this._transformationRunners.runners // we need the equal sign here to make sure, that also transformations + // on the same runner which execute before the current transformation are + // taken into account + .filter(runner => runner.id <= current.id).map(getRunnerTransform).reduce(lmultiply, new Matrix()); + }, + + addRunner(runner) { + this._transformationRunners.add(runner); + + Animator.transform_frame(mergeTransforms.bind(this), this._frameId); + }, + + _prepareRunner() { + if (this._frameId == null) { + this._transformationRunners = new RunnerArray().add(new FakeRunner(new Matrix(this))); + this._frameId = frameId++; + } + } + + } +}); +extend(Runner, { + attr(a, v) { + return this.styleAttr('attr', a, v); + }, + + // Add animatable styles + css(s, v) { + return this.styleAttr('css', s, v); + }, + + styleAttr(type, name, val) { + // apply attributes individually + if (typeof name === 'object') { + for (var key in val) { + this.styleAttr(type, key, val[key]); + } + } + + var morpher = new Morphable(this._stepper).to(val); + this.queue(function () { + morpher = morpher.from(this.element()[type](name)); + }, function (pos) { + this.element()[type](name, morpher.at(pos)); + return morpher.done(); + }); + return this; + }, + + zoom(level, point$$1) { + var morpher = new Morphable(this._stepper).to(new SVGNumber(level)); + this.queue(function () { + morpher = morpher.from(this.zoom()); + }, function (pos) { + this.element().zoom(morpher.at(pos), point$$1); + return morpher.done(); + }); + return this; + }, + + /** + ** absolute transformations + **/ + // + // M v -----|-----(D M v = F v)------|-----> T v + // + // 1. define the final state (T) and decompose it (once) + // t = [tx, ty, the, lam, sy, sx] + // 2. on every frame: pull the current state of all previous transforms + // (M - m can change) + // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0] + // 3. Find the interpolated matrix F(pos) = m + pos * (t - m) + // - Note F(0) = M + // - Note F(1) = T + // 4. Now you get the delta matrix as a result: D = F * inv(M) + transform(transforms, relative, affine) { + // If we have a declarative function, we should retarget it if possible + relative = transforms.relative || relative; + + if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) { + return this; + } // Parse the parameters + + + var isMatrix = Matrix.isMatrixLike(transforms); + affine = transforms.affine != null ? transforms.affine : affine != null ? affine : !isMatrix; // Create a morepher and set its type + + const morpher = new Morphable(this._stepper).type(affine ? TransformBag : Matrix); + let origin; + let element; + let current; + let currentAngle; + let startTransform; + + function setup() { + // make sure element and origin is defined + element = element || this.element(); + origin = origin || getOrigin(transforms, element); + startTransform = new Matrix(relative ? undefined : element); // add the runner to the element so it can merge transformations + + element.addRunner(this); // Deactivate all transforms that have run so far if we are absolute + + if (!relative) { + element._clearTransformRunnersBefore(this); + } + } + + function run(pos) { + // clear all other transforms before this in case something is saved + // on this runner. We are absolute. We dont need these! + if (!relative) this.clearTransform(); + let { + x: x$$1, + y: y$$1 + } = new Point(origin).transform(element._currentTransform(this)); + let target = new Matrix(_objectSpread({}, transforms, { + origin: [x$$1, y$$1] + })); + let start = this._isDeclarative && current ? current : startTransform; + + if (affine) { + target = target.decompose(x$$1, y$$1); + start = start.decompose(x$$1, y$$1); // Get the current and target angle as it was set + + const rTarget = target.rotate; + const rCurrent = start.rotate; // Figure out the shortest path to rotate directly + + const possibilities = [rTarget - 360, rTarget, rTarget + 360]; + const distances = possibilities.map(a => Math.abs(a - rCurrent)); + const shortest = Math.min(...distances); + const index = distances.indexOf(shortest); + target.rotate = possibilities[index]; + } + + if (relative) { + // we have to be careful here not to overwrite the rotation + // with the rotate method of Matrix + if (!isMatrix) { + target.rotate = transforms.rotate || 0; + } + + if (this._isDeclarative && currentAngle) { + start.rotate = currentAngle; + } + } + + morpher.from(start); + morpher.to(target); + let affineParameters = morpher.at(pos); + currentAngle = affineParameters.rotate; + current = new Matrix(affineParameters); + this.addTransform(current); + return morpher.done(); + } + + function retarget(newTransforms) { + // only get a new origin if it changed since the last call + if ((newTransforms.origin || 'center').toString() !== (transforms.origin || 'center').toString()) { + origin = getOrigin(transforms, element); + } // overwrite the old transformations with the new ones + + + transforms = _objectSpread({}, newTransforms, { + origin + }); + } + + this.queue(setup, run, retarget, true); + this._isDeclarative && this._rememberMorpher('transform', morpher); + return this; + }, + + // Animatable x-axis + x(x$$1, relative) { + return this._queueNumber('x', x$$1); + }, + + // Animatable y-axis + y(y$$1) { + return this._queueNumber('y', y$$1); + }, + + dx(x$$1) { + return this._queueNumberDelta('x', x$$1); + }, + + dy(y$$1) { + return this._queueNumberDelta('y', y$$1); + }, + + _queueNumberDelta(method, to$$1) { + to$$1 = new SVGNumber(to$$1); // Try to change the target if we have this method already registerd + + if (this._tryRetarget(method, to$$1)) return this; // Make a morpher and queue the animation + + var morpher = new Morphable(this._stepper).to(to$$1); + var from$$1 = null; + this.queue(function () { + from$$1 = this.element()[method](); + morpher.from(from$$1); + morpher.to(from$$1 + to$$1); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }, function (newTo) { + morpher.to(from$$1 + new SVGNumber(newTo)); + }); // Register the morpher so that if it is changed again, we can retarget it + + this._rememberMorpher(method, morpher); + + return this; + }, + + _queueObject(method, to$$1) { + // Try to change the target if we have this method already registerd + if (this._tryRetarget(method, to$$1)) return this; // Make a morpher and queue the animation + + var morpher = new Morphable(this._stepper).to(to$$1); + this.queue(function () { + morpher.from(this.element()[method]()); + }, function (pos) { + this.element()[method](morpher.at(pos)); + return morpher.done(); + }); // Register the morpher so that if it is changed again, we can retarget it + + this._rememberMorpher(method, morpher); + + return this; + }, + + _queueNumber(method, value) { + return this._queueObject(method, new SVGNumber(value)); + }, + + // Animatable center x-axis + cx(x$$1) { + return this._queueNumber('cx', x$$1); + }, + + // Animatable center y-axis + cy(y$$1) { + return this._queueNumber('cy', y$$1); + }, + + // Add animatable move + move(x$$1, y$$1) { + return this.x(x$$1).y(y$$1); + }, + + // Add animatable center + center(x$$1, y$$1) { + return this.cx(x$$1).cy(y$$1); + }, + + // Add animatable size + size(width$$1, height$$1) { + // animate bbox based size for all other elements + var box; + + if (!width$$1 || !height$$1) { + box = this._element.bbox(); + } + + if (!width$$1) { + width$$1 = box.width / box.height * height$$1; + } + + if (!height$$1) { + height$$1 = box.height / box.width * width$$1; + } + + return this.width(width$$1).height(height$$1); + }, + + // Add animatable width + width(width$$1) { + return this._queueNumber('width', width$$1); + }, + + // Add animatable height + height(height$$1) { + return this._queueNumber('height', height$$1); + }, + + // Add animatable plot + plot(a, b, c, d) { + // Lines can be plotted with 4 arguments + if (arguments.length === 4) { + return this.plot([a, b, c, d]); + } + + var morpher = this._element.MorphArray().to(a); + + this.queue(function () { + morpher.from(this._element.array()); + }, function (pos) { + this._element.plot(morpher.at(pos)); + }); + return this; + }, + + // Add leading method + leading(value) { + return this._queueNumber('leading', value); + }, + + // Add animatable viewbox + viewbox(x$$1, y$$1, width$$1, height$$1) { + return this._queueObject('viewbox', new Box(x$$1, y$$1, width$$1, height$$1)); + }, + + update(o) { + if (typeof o !== 'object') { + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }); + } + + if (o.opacity != null) this.attr('stop-opacity', o.opacity); + if (o.color != null) this.attr('stop-color', o.color); + if (o.offset != null) this.attr('offset', o.offset); + return this; + } + +}); +extend(Runner, { + rx, + ry, + from, + to +}); + +class Svg$1 extends Container { + constructor(node) { + super(nodeOrNew('svg', node), node); + this.namespace(); + } + + isRoot() { + return !this.node.parentNode || !(this.node.parentNode instanceof globals.window.SVGElement) || this.node.parentNode.nodeName === '#document'; + } // Check if this is a root svg + // If not, call docs from this element + + + root() { + if (this.isRoot()) return this; + return super.root(); + } // Add namespaces + + + namespace() { + if (!this.isRoot()) return this.root().namespace(); + return this.attr({ + xmlns: ns, + version: '1.1' + }).attr('xmlns:xlink', xlink, xmlns).attr('xmlns:svgjs', svgjs, xmlns); + } // Creates and returns defs element + + + defs() { + if (!this.isRoot()) return this.root().defs(); + return adopt(this.node.getElementsByTagName('defs')[0]) || this.put(new Defs()); + } // custom parent method + + + parent(type) { + if (this.isRoot()) { + return this.node.parentNode.nodeName === '#document' ? null : adopt(this.node.parentNode); + } + + return super.parent(type); + } + + clear() { + // remove children + while (this.node.hasChildNodes()) { + this.node.removeChild(this.node.lastChild); + } + + return this; + } + +} +registerMethods({ + Container: { + // Create nested svg document + nested: wrapWithAttrCheck(function () { + return this.put(new Svg$1()); + }) + } +}); +register(Svg$1, 'Svg', true); + +class Symbol extends Container { + // Initialize node + constructor(node) { + super(nodeOrNew('symbol', node), node); + } + +} +registerMethods({ + Container: { + symbol: wrapWithAttrCheck(function () { + return this.put(new Symbol()); + }) + } +}); +register(Symbol); + +function plain(text) { + // clear if build mode is disabled + if (this._build === false) { + this.clear(); + } // create text node + + + this.node.appendChild(globals.document.createTextNode(text)); + return this; +} // Get length of text element + +function length() { + return this.node.getComputedTextLength(); +} + +var textable = /*#__PURE__*/Object.freeze({ + plain: plain, + length: length +}); + +class Text extends Shape { + // Initialize node + constructor(node) { + super(nodeOrNew('text', node), node); + this.dom.leading = new SVGNumber(1.3); // store leading value for rebuilding + + this._rebuild = true; // enable automatic updating of dy values + + this._build = false; // disable build mode for adding multiple lines + // set default font + + this.attr('font-family', attrs['font-family']); + } // Move over x-axis + + + x(x) { + // act as getter + if (x == null) { + return this.attr('x'); + } + + return this.attr('x', x); + } // Move over y-axis + + + y(y) { + var oy = this.attr('y'); + var o = typeof oy === 'number' ? oy - this.bbox().y : 0; // act as getter + + if (y == null) { + return typeof oy === 'number' ? oy - o : oy; + } + + return this.attr('y', typeof y === 'number' ? y + o : y); + } // Move center over x-axis + + + cx(x) { + return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2); + } // Move center over y-axis + + + cy(y) { + return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2); + } // Set the text content + + + text(text) { + // act as getter + if (text === undefined) { + var children = this.node.childNodes; + var firstLine = 0; + text = ''; + + for (var i = 0, len = children.length; i < len; ++i) { + // skip textPaths - they are no lines + if (children[i].nodeName === 'textPath') { + if (i === 0) firstLine = 1; + continue; + } // add newline if its not the first child and newLined is set to true + + + if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) { + text += '\n'; + } // add content of this node + + + text += children[i].textContent; + } + + return text; + } // remove existing content + + + this.clear().build(true); + + if (typeof text === 'function') { + // call block + text.call(this, this); + } else { + // store text and make sure text is not blank + text = text.split('\n'); // build new lines + + for (var j = 0, jl = text.length; j < jl; j++) { + this.tspan(text[j]).newLine(); + } + } // disable build mode and rebuild lines + + + return this.build(false).rebuild(); + } // Set / get leading + + + leading(value) { + // act as getter + if (value == null) { + return this.dom.leading; + } // act as setter + + + this.dom.leading = new SVGNumber(value); + return this.rebuild(); + } // Rebuild appearance type + + + rebuild(rebuild) { + // store new rebuild flag if given + if (typeof rebuild === 'boolean') { + this._rebuild = rebuild; + } // define position of all lines + + + if (this._rebuild) { + var self = this; + var blankLineOffset = 0; + var leading = this.dom.leading; + this.each(function () { + var fontSize = globals.window.getComputedStyle(this.node).getPropertyValue('font-size'); + var dy = leading * new SVGNumber(fontSize); + + if (this.dom.newLined) { + this.attr('x', self.attr('x')); + + if (this.text() === '\n') { + blankLineOffset += dy; + } else { + this.attr('dy', dy + blankLineOffset); + blankLineOffset = 0; + } + } + }); + this.fire('rebuild'); + } + + return this; + } // Enable / disable build mode + + + build(build) { + this._build = !!build; + return this; + } // overwrite method from parent to set data properly + + + setData(o) { + this.dom = o; + this.dom.leading = new SVGNumber(o.leading || 1.3); + return this; + } + +} +extend(Text, textable); +registerMethods({ + Container: { + // Create text element + text: wrapWithAttrCheck(function (text) { + return this.put(new Text()).text(text); + }), + // Create plain text element + plain: wrapWithAttrCheck(function (text) { + return this.put(new Text()).plain(text); + }) + } +}); +register(Text); + +class Tspan extends Text { + // Initialize node + constructor(node) { + super(nodeOrNew('tspan', node), node); + } // Set text content + + + text(text) { + if (text == null) return this.node.textContent + (this.dom.newLined ? '\n' : ''); + typeof text === 'function' ? text.call(this, this) : this.plain(text); + return this; + } // Shortcut dx + + + dx(dx) { + return this.attr('dx', dx); + } // Shortcut dy + + + dy(dy) { + return this.attr('dy', dy); + } // Create new line + + + newLine() { + // fetch text parent + var t = this.parent(Text); // mark new line + + this.dom.newLined = true; // apply new position + + return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x()); + } + +} +extend(Tspan, textable); +registerMethods({ + Tspan: { + tspan: wrapWithAttrCheck(function (text) { + var tspan = new Tspan(); // clear if build mode is disabled + + if (!this._build) { + this.clear(); + } // add new tspan + + + this.node.appendChild(tspan.node); + return tspan.text(text); + }) + } +}); +register(Tspan); + +class ClipPath extends Container { + constructor(node) { + super(nodeOrNew('clipPath', node), node); + } // Unclip all clipped elements and remove itself + + + remove() { + // unclip all targets + this.targets().forEach(function (el) { + el.unclip(); + }); // remove clipPath from parent + + return super.remove(); + } + + targets() { + return baseFind('svg [clip-path*="' + this.id() + '"]'); + } + +} +registerMethods({ + Container: { + // Create clipping element + clip: wrapWithAttrCheck(function () { + return this.defs().put(new ClipPath()); + }) + }, + Element: { + // Distribute clipPath to svg element + clipWith(element) { + // use given clip or create a new one + let clipper = element instanceof ClipPath ? element : this.parent().clip().add(element); // apply mask + + return this.attr('clip-path', 'url("#' + clipper.id() + '")'); + }, + + // Unclip element + unclip() { + return this.attr('clip-path', null); + }, + + clipper() { + return this.reference('clip-path'); + } + + } +}); +register(ClipPath); + +class G extends Container { + constructor(node) { + super(nodeOrNew('g', node), node); + } + +} +registerMethods({ + Element: { + // Create a group element + group: wrapWithAttrCheck(function () { + return this.put(new G()); + }) + } +}); +register(G); + +class A extends Container { + constructor(node) { + super(nodeOrNew('a', node), node); + } // Link url + + + to(url) { + return this.attr('href', url, xlink); + } // Link target attribute + + + target(target) { + return this.attr('target', target); + } + +} +registerMethods({ + Container: { + // Create a hyperlink element + link: wrapWithAttrCheck(function (url) { + return this.put(new A()).to(url); + }) + }, + Element: { + // Create a hyperlink element + linkTo: function (url) { + var link = new A(); + + if (typeof url === 'function') { + url.call(link, link); + } else { + link.to(url); + } + + return this.parent().put(link).put(this); + } + } +}); +register(A); + +class Mask extends Container { + // Initialize node + constructor(node) { + super(nodeOrNew('mask', node), node); + } // Unmask all masked elements and remove itself + + + remove() { + // unmask all targets + this.targets().forEach(function (el) { + el.unmask(); + }); // remove mask from parent + + return super.remove(); + } + + targets() { + return baseFind('svg [mask*="' + this.id() + '"]'); + } + +} +registerMethods({ + Container: { + mask: wrapWithAttrCheck(function () { + return this.defs().put(new Mask()); + }) + }, + Element: { + // Distribute mask to svg element + maskWith(element) { + // use given mask or create a new one + var masker = element instanceof Mask ? element : this.parent().mask().add(element); // apply mask + + return this.attr('mask', 'url("#' + masker.id() + '")'); + }, + + // Unmask element + unmask() { + return this.attr('mask', null); + }, + + masker() { + return this.reference('mask'); + } + + } +}); +register(Mask); + +function cssRule(selector, rule) { + if (!selector) return ''; + if (!rule) return selector; + var ret = selector + '{'; + + for (var i in rule) { + ret += unCamelCase(i) + ':' + rule[i] + ';'; + } + + ret += '}'; + return ret; +} + +class Style extends Element { + constructor(node) { + super(nodeOrNew('style', node), node); + } + + addText(w = '') { + this.node.textContent += w; + return this; + } + + font(name, src, params = {}) { + return this.rule('@font-face', _objectSpread({ + fontFamily: name, + src: src + }, params)); + } + + rule(selector, obj) { + return this.addText(cssRule(selector, obj)); + } + +} +registerMethods('Dom', { + style: wrapWithAttrCheck(function (selector, obj) { + return this.put(new Style()).rule(selector, obj); + }), + fontface: wrapWithAttrCheck(function (name, src, params) { + return this.put(new Style()).font(name, src, params); + }) +}); +register(Style); + +class TextPath extends Text { + // Initialize node + constructor(node) { + super(nodeOrNew('textPath', node), node); + } // return the array of the path track element + + + array() { + var track = this.track(); + return track ? track.array() : null; + } // Plot path if any + + + plot(d) { + var track = this.track(); + var pathArray = null; + + if (track) { + pathArray = track.plot(d); + } + + return d == null ? pathArray : this; + } // Get the path element + + + track() { + return this.reference('href'); + } + +} +registerMethods({ + Container: { + textPath: wrapWithAttrCheck(function (text, path) { + return this.defs().path(path).text(text).addTo(this); + }) + }, + Text: { + // Create path for text to run on + path: wrapWithAttrCheck(function (track) { + var path = new TextPath(); // if track is a path, reuse it + + if (!(track instanceof Path)) { + // create path element + track = this.root().defs().path(track); + } // link textPath to path and add content + + + path.attr('href', '#' + track, xlink); // add textPath element as child node and return textPath + + return this.put(path); + }), + + // Get the textPath children + textPath() { + return this.find('textPath')[0]; + } + + }, + Path: { + // creates a textPath from this path + text: wrapWithAttrCheck(function (text) { + if (text instanceof Text) { + var txt = text.text(); + return text.clear().path(this).text(txt); + } + + return this.parent().put(new Text()).path(this).text(text); + }), + + targets() { + return baseFind('svg [href*="' + this.id() + '"]'); + } + + } +}); +TextPath.prototype.MorphArray = PathArray; +register(TextPath); + +class Use extends Shape { + constructor(node) { + super(nodeOrNew('use', node), node); + } // Use element as a reference + + + element(element, file) { + // Set lined element + return this.attr('href', (file || '') + '#' + element, xlink); + } + +} +registerMethods({ + Container: { + // Create a use element + use: wrapWithAttrCheck(function (element, file) { + return this.put(new Use()).element(element, file); + }) + } +}); +register(Use); + +/* Optional Modules */ +const SVG = makeInstance; +extend([Svg$1, Symbol, Image, Pattern, Marker], getMethodsFor('viewbox')); +extend([Line, Polyline, Polygon, Path], getMethodsFor('marker')); +extend(Text, getMethodsFor('Text')); +extend(Path, getMethodsFor('Path')); +extend(Defs, getMethodsFor('Defs')); +extend([Text, Tspan], getMethodsFor('Tspan')); +extend([Rect, Ellipse, Circle, Gradient], getMethodsFor('radius')); +extend(EventTarget, getMethodsFor('EventTarget')); +extend(Dom, getMethodsFor('Dom')); +extend(Element, getMethodsFor('Element')); +extend(Shape, getMethodsFor('Shape')); // extend(Element, getConstructor('Memory')) + +extend(Container, getMethodsFor('Container')); +extend(Runner, getMethodsFor('Runner')); +List.extend(getMethodNames()); +registerMorphableType([SVGNumber, Color, Box, Matrix, SVGArray, PointArray, PathArray]); +makeMorphable(); + +exports.Morphable = Morphable; +exports.registerMorphableType = registerMorphableType; +exports.makeMorphable = makeMorphable; +exports.TransformBag = TransformBag; +exports.ObjectBag = ObjectBag; +exports.NonMorphable = NonMorphable; +exports.defaults = defaults; +exports.utils = utils; +exports.namespaces = namespaces; +exports.regex = regex; +exports.SVG = SVG; +exports.parser = parser; +exports.find = baseFind; +exports.registerWindow = registerWindow; +exports.Animator = Animator; +exports.Controller = Controller; +exports.Ease = Ease; +exports.PID = PID; +exports.Spring = Spring; +exports.easing = easing; +exports.Queue = Queue; +exports.Runner = Runner; +exports.Timeline = Timeline; +exports.Array = SVGArray; +exports.Box = Box; +exports.Color = Color; +exports.EventTarget = EventTarget; +exports.Matrix = Matrix; +exports.Number = SVGNumber; +exports.PathArray = PathArray; +exports.Point = Point; +exports.PointArray = PointArray; +exports.List = List; +exports.Circle = Circle; +exports.ClipPath = ClipPath; +exports.Container = Container; +exports.Defs = Defs; +exports.Dom = Dom; +exports.Element = Element; +exports.Ellipse = Ellipse; +exports.Gradient = Gradient; +exports.G = G; +exports.A = A; +exports.Image = Image; +exports.Line = Line; +exports.Marker = Marker; +exports.Mask = Mask; +exports.Path = Path; +exports.Pattern = Pattern; +exports.Polygon = Polygon; +exports.Polyline = Polyline; +exports.Rect = Rect; +exports.Shape = Shape; +exports.Stop = Stop; +exports.Style = Style; +exports.Svg = Svg$1; +exports.Symbol = Symbol; +exports.Text = Text; +exports.TextPath = TextPath; +exports.Tspan = Tspan; +exports.Use = Use; +exports.on = on; +exports.off = off; +exports.dispatch = dispatch; +exports.root = root; +exports.makeNode = makeNode; +exports.makeInstance = makeInstance; +exports.nodeOrNew = nodeOrNew; +exports.adopt = adopt; +exports.register = register; +exports.getClass = getClass; +exports.eid = eid; +exports.assignNewId = assignNewId; +exports.extend = extend; +exports.extendWithAttrCheck = extendWithAttrCheck; +exports.wrapWithAttrCheck = wrapWithAttrCheck; +//# sourceMappingURL=svg.node.js.map diff --git a/dist/svg.node.js.map b/dist/svg.node.js.map new file mode 100644 index 0000000..ad81645 --- /dev/null +++ b/dist/svg.node.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svg.node.js","sources":["../src/utils/methods.js","../src/utils/utils.js","../src/modules/core/namespaces.js","../src/utils/window.js","../src/types/Base.js","../src/utils/adopter.js","../src/modules/optional/arrange.js","../src/modules/core/regex.js","../src/modules/optional/class.js","../src/modules/optional/css.js","../src/modules/optional/data.js","../src/modules/optional/memory.js","../src/modules/core/event.js","../src/types/Color.js","../src/types/Point.js","../src/modules/core/parser.js","../src/types/Box.js","../src/types/Matrix.js","../src/types/ArrayPolyfill.js","../src/types/List.js","../src/modules/core/selector.js","../src/types/EventTarget.js","../src/modules/core/defaults.js","../src/types/SVGArray.js","../src/types/SVGNumber.js","../src/modules/core/attr.js","../src/elements/Dom.js","../src/elements/Element.js","../src/modules/optional/sugar.js","../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../node_modules/@babel/runtime/helpers/esm/objectSpread.js","../src/modules/optional/transform.js","../src/modules/core/circled.js","../src/elements/Shape.js","../src/elements/Circle.js","../src/elements/Container.js","../src/elements/Defs.js","../src/elements/Ellipse.js","../src/elements/Stop.js","../src/modules/core/gradiented.js","../src/elements/Gradient.js","../src/elements/Pattern.js","../src/elements/Image.js","../src/types/PointArray.js","../src/modules/core/pointed.js","../src/elements/Line.js","../src/elements/Marker.js","../node_modules/core-js/modules/_global.js","../node_modules/core-js/modules/_core.js","../node_modules/core-js/modules/_is-object.js","../node_modules/core-js/modules/_an-object.js","../node_modules/core-js/modules/_fails.js","../node_modules/core-js/modules/_descriptors.js","../node_modules/core-js/modules/_dom-create.js","../node_modules/core-js/modules/_ie8-dom-define.js","../node_modules/core-js/modules/_to-primitive.js","../node_modules/core-js/modules/_object-dp.js","../node_modules/core-js/modules/_property-desc.js","../node_modules/core-js/modules/_hide.js","../node_modules/core-js/modules/_has.js","../node_modules/core-js/modules/_uid.js","../node_modules/core-js/modules/_redefine.js","../node_modules/core-js/modules/_a-function.js","../node_modules/core-js/modules/_ctx.js","../node_modules/core-js/modules/_export.js","../node_modules/core-js/modules/_defined.js","../node_modules/core-js/modules/_to-object.js","../node_modules/core-js/modules/_strict-method.js","../node_modules/core-js/modules/es6.array.sort.js","../src/animation/Controller.js","../src/types/PathArray.js","../src/animation/Morphable.js","../src/elements/Path.js","../src/modules/core/poly.js","../src/elements/Polygon.js","../src/elements/Polyline.js","../src/elements/Rect.js","../src/animation/Queue.js","../src/animation/Animator.js","../src/animation/Timeline.js","../src/animation/Runner.js","../src/elements/Svg.js","../src/elements/Symbol.js","../src/modules/core/textable.js","../src/elements/Text.js","../src/elements/Tspan.js","../src/elements/ClipPath.js","../src/elements/G.js","../src/elements/A.js","../src/elements/Mask.js","../src/elements/Style.js","../src/elements/TextPath.js","../src/elements/Use.js","../src/main.js"],"sourcesContent":["const methods = {}\r\nconst names = []\r\n\r\nexport function registerMethods (name, m) {\r\n if (Array.isArray(name)) {\r\n for (let _name of name) {\r\n registerMethods(_name, m)\r\n }\r\n return\r\n }\r\n\r\n if (typeof name === 'object') {\r\n for (let _name in name) {\r\n registerMethods(_name, name[_name])\r\n }\r\n return\r\n }\r\n\r\n addMethodNames(Object.keys(m))\r\n methods[name] = Object.assign(methods[name] || {}, m)\r\n}\r\n\r\nexport function getMethodsFor (name) {\r\n return methods[name] || {}\r\n}\r\n\r\nexport function getMethodNames () {\r\n return [...new Set(names)]\r\n}\r\n\r\nexport function addMethodNames (_names) {\r\n names.push(..._names)\r\n}\r\n","// Map function\r\nexport function map (array, block) {\r\n var i\r\n var il = array.length\r\n var result = []\r\n\r\n for (i = 0; i < il; i++) {\r\n result.push(block(array[i]))\r\n }\r\n\r\n return result\r\n}\r\n\r\n// Filter function\r\nexport function filter (array, block) {\r\n var i\r\n var il = array.length\r\n var result = []\r\n\r\n for (i = 0; i < il; i++) {\r\n if (block(array[i])) { result.push(array[i]) }\r\n }\r\n\r\n return result\r\n}\r\n\r\n// Degrees to radians\r\nexport function radians (d) {\r\n return d % 360 * Math.PI / 180\r\n}\r\n\r\n// Radians to degrees\r\nexport function degrees (r) {\r\n return r * 180 / Math.PI % 360\r\n}\r\n\r\n// Convert dash-separated-string to camelCase\r\nexport function camelCase (s) {\r\n return s.toLowerCase().replace(/-(.)/g, function (m, g) {\r\n return g.toUpperCase()\r\n })\r\n}\r\n\r\n// Convert camel cased string to string seperated\r\nexport function unCamelCase (s) {\r\n return s.replace(/([A-Z])/g, function (m, g) {\r\n return '-' + g.toLowerCase()\r\n })\r\n}\r\n\r\n// Capitalize first letter of a string\r\nexport function capitalize (s) {\r\n return s.charAt(0).toUpperCase() + s.slice(1)\r\n}\r\n\r\n// Calculate proportional width and height values when necessary\r\nexport function proportionalSize (element, width, height) {\r\n if (width == null || height == null) {\r\n var box = element.bbox()\r\n\r\n if (width == null) {\r\n width = box.width / box.height * height\r\n } else if (height == null) {\r\n height = box.height / box.width * width\r\n }\r\n }\r\n\r\n return {\r\n width: width,\r\n height: height\r\n }\r\n}\r\n\r\nexport function getOrigin (o, element) {\r\n // Allow origin or around as the names\r\n let origin = o.origin // o.around == null ? o.origin : o.around\r\n let ox, oy\r\n\r\n // Allow the user to pass a string to rotate around a given point\r\n if (typeof origin === 'string' || origin == null) {\r\n // Get the bounding box of the element with no transformations applied\r\n const string = (origin || 'center').toLowerCase().trim()\r\n const { height, width, x, y } = element.bbox()\r\n\r\n // Calculate the transformed x and y coordinates\r\n let bx = string.includes('left') ? x\r\n : string.includes('right') ? x + width\r\n : x + width / 2\r\n let by = string.includes('top') ? y\r\n : string.includes('bottom') ? y + height\r\n : y + height / 2\r\n\r\n // Set the bounds eg : \"bottom-left\", \"Top right\", \"middle\" etc...\r\n ox = o.ox != null ? o.ox : bx\r\n oy = o.oy != null ? o.oy : by\r\n } else {\r\n ox = origin[0]\r\n oy = origin[1]\r\n }\r\n\r\n // Return the origin as it is if it wasn't a string\r\n return [ ox, oy ]\r\n}\r\n","// Default namespaces\r\nexport let ns = 'http://www.w3.org/2000/svg'\r\nexport let xmlns = 'http://www.w3.org/2000/xmlns/'\r\nexport let xlink = 'http://www.w3.org/1999/xlink'\r\nexport let svgjs = 'http://svgjs.com/svgjs'\r\n","export const globals = {\r\n window: typeof window === 'undefined' ? null : window,\r\n document: typeof document === 'undefined' ? null : document\r\n}\r\n\r\nexport function registerWindow (win = null, doc = null) {\r\n globals.window = win\r\n globals.document = doc\r\n}\r\n","export default class Base {\r\n // constructor (node/*, {extensions = []} */) {\r\n // // this.tags = []\r\n // //\r\n // // for (let extension of extensions) {\r\n // // extension.setup.call(this, node)\r\n // // this.tags.push(extension.name)\r\n // // }\r\n // }\r\n}\r\n","import { addMethodNames } from './methods.js'\r\nimport { capitalize } from './utils.js'\r\nimport { ns } from '../modules/core/namespaces.js'\r\nimport { globals } from '../utils/window.js'\r\nimport Base from '../types/Base.js'\r\n\r\nconst elements = {}\r\nexport const root = '___SYMBOL___ROOT___'\r\n\r\n// Method for element creation\r\nexport function makeNode (name) {\r\n // create element\r\n return globals.document.createElementNS(ns, name)\r\n}\r\n\r\nexport function makeInstance (element) {\r\n if (element instanceof Base) return element\r\n\r\n if (typeof element === 'object') {\r\n return adopt(element)\r\n }\r\n\r\n if (element == null) {\r\n return new elements[root]()\r\n }\r\n\r\n if (typeof element === 'string' && element.charAt(0) !== '<') {\r\n return adopt(globals.document.querySelector(element))\r\n }\r\n\r\n var node = makeNode('svg')\r\n node.innerHTML = element\r\n\r\n // We can use firstChild here because we know,\r\n // that the first char is < and thus an element\r\n element = adopt(node.firstChild)\r\n\r\n return element\r\n}\r\n\r\nexport function nodeOrNew (name, node) {\r\n return node instanceof globals.window.Node ? node : makeNode(name)\r\n}\r\n\r\n// Adopt existing svg elements\r\nexport function adopt (node) {\r\n // check for presence of node\r\n if (!node) return null\r\n\r\n // make sure a node isn't already adopted\r\n if (node.instance instanceof Base) return node.instance\r\n\r\n // initialize variables\r\n var className = capitalize(node.nodeName)\r\n\r\n // Make sure that gradients are adopted correctly\r\n if (className === 'LinearGradient' || className === 'RadialGradient') {\r\n className = 'Gradient'\r\n\r\n // Fallback to Dom if element is not known\r\n } else if (!elements[className]) {\r\n className = 'Dom'\r\n }\r\n\r\n return new elements[className](node)\r\n}\r\n\r\nexport function register (element, name = element.name, asRoot = false) {\r\n elements[name] = element\r\n if (asRoot) elements[root] = element\r\n\r\n addMethodNames(Object.keys(element.prototype))\r\n\r\n return element\r\n}\r\n\r\nexport function getClass (name) {\r\n return elements[name]\r\n}\r\n\r\n// Element id sequence\r\nlet did = 1000\r\n\r\n// Get next named element id\r\nexport function eid (name) {\r\n return 'Svgjs' + capitalize(name) + (did++)\r\n}\r\n\r\n// Deep new id assignment\r\nexport function assignNewId (node) {\r\n // do the same for SVG child nodes as well\r\n for (var i = node.children.length - 1; i >= 0; i--) {\r\n assignNewId(node.children[i])\r\n }\r\n\r\n if (node.id) {\r\n return adopt(node).id(eid(node.nodeName))\r\n }\r\n\r\n return adopt(node)\r\n}\r\n\r\n// Method for extending objects\r\nexport function extend (modules, methods, attrCheck) {\r\n var key, i\r\n\r\n modules = Array.isArray(modules) ? modules : [modules]\r\n\r\n for (i = modules.length - 1; i >= 0; i--) {\r\n for (key in methods) {\r\n let method = methods[key]\r\n if (attrCheck) {\r\n method = wrapWithAttrCheck(methods[key])\r\n }\r\n modules[i].prototype[key] = method\r\n }\r\n }\r\n}\r\n\r\nexport function extendWithAttrCheck (...args) {\r\n extend(...args, true)\r\n}\r\n\r\nexport function wrapWithAttrCheck (fn) {\r\n return function (...args) {\r\n let o = args[args.length - 1]\r\n\r\n if (o && o.constructor === Object && !(o instanceof Array)) {\r\n return fn.apply(this, args.slice(0, -1)).attr(o)\r\n } else {\r\n return fn.apply(this, args)\r\n }\r\n }\r\n}\r\n","import { makeInstance } from '../../utils/adopter.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\n\r\n// Get all siblings, including myself\r\nexport function siblings () {\r\n return this.parent().children()\r\n}\r\n\r\n// Get the curent position siblings\r\nexport function position () {\r\n return this.parent().index(this)\r\n}\r\n\r\n// Get the next element (will return null if there is none)\r\nexport function next () {\r\n return this.siblings()[this.position() + 1]\r\n}\r\n\r\n// Get the next element (will return null if there is none)\r\nexport function prev () {\r\n return this.siblings()[this.position() - 1]\r\n}\r\n\r\n// Send given element one step forward\r\nexport function forward () {\r\n var i = this.position() + 1\r\n var p = this.parent()\r\n\r\n // move node one step forward\r\n p.removeElement(this).add(this, i)\r\n\r\n // make sure defs node is always at the top\r\n if (typeof p.isRoot === 'function' && p.isRoot()) {\r\n p.node.appendChild(p.defs().node)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element one step backward\r\nexport function backward () {\r\n var i = this.position()\r\n\r\n if (i > 0) {\r\n this.parent().removeElement(this).add(this, i - 1)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element all the way to the front\r\nexport function front () {\r\n var p = this.parent()\r\n\r\n // Move node forward\r\n p.node.appendChild(this.node)\r\n\r\n // Make sure defs node is always at the top\r\n if (typeof p.isRoot === 'function' && p.isRoot()) {\r\n p.node.appendChild(p.defs().node)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Send given element all the way to the back\r\nexport function back () {\r\n if (this.position() > 0) {\r\n this.parent().removeElement(this).add(this, 0)\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Inserts a given element before the targeted element\r\nexport function before (element) {\r\n element = makeInstance(element)\r\n element.remove()\r\n\r\n var i = this.position()\r\n\r\n this.parent().add(element, i)\r\n\r\n return this\r\n}\r\n\r\n// Inserts a given element after the targeted element\r\nexport function after (element) {\r\n element = makeInstance(element)\r\n element.remove()\r\n\r\n var i = this.position()\r\n\r\n this.parent().add(element, i + 1)\r\n\r\n return this\r\n}\r\n\r\nexport function insertBefore (element) {\r\n element = makeInstance(element)\r\n element.before(this)\r\n}\r\n\r\nexport function insertAfter (element) {\r\n element = makeInstance(element)\r\n element.after(this)\r\n}\r\n\r\nregisterMethods('Dom', {\r\n siblings,\r\n position,\r\n next,\r\n prev,\r\n forward,\r\n backward,\r\n front,\r\n back,\r\n before,\r\n after,\r\n insertBefore,\r\n insertAfter\r\n})\r\n","// Parse unit value\r\nexport let numberAndUnit = /^([+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?)([a-z%]*)$/i\r\n\r\n// Parse hex value\r\nexport let hex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i\r\n\r\n// Parse rgb value\r\nexport let rgb = /rgb\\((\\d+),(\\d+),(\\d+)\\)/\r\n\r\n// Parse reference id\r\nexport let reference = /(#[a-z0-9\\-_]+)/i\r\n\r\n// splits a transformation chain\r\nexport let transforms = /\\)\\s*,?\\s*/\r\n\r\n// Whitespace\r\nexport let whitespace = /\\s/g\r\n\r\n// Test hex value\r\nexport let isHex = /^#[a-f0-9]{3,6}$/i\r\n\r\n// Test rgb value\r\nexport let isRgb = /^rgb\\(/\r\n\r\n// Test css declaration\r\nexport let isCss = /[^:]+:[^;]+;?/\r\n\r\n// Test for blank string\r\nexport let isBlank = /^(\\s+)?$/\r\n\r\n// Test for numeric string\r\nexport let isNumber = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i\r\n\r\n// Test for percent value\r\nexport let isPercent = /^-?[\\d.]+%$/\r\n\r\n// Test for image url\r\nexport let isImage = /\\.(jpg|jpeg|png|gif|svg)(\\?[^=]+.*)?/i\r\n\r\n// split at whitespace and comma\r\nexport let delimiter = /[\\s,]+/\r\n\r\n// The following regex are used to parse the d attribute of a path\r\n\r\n// Matches all hyphens which are not after an exponent\r\nexport let hyphen = /([^e])-/gi\r\n\r\n// Replaces and tests for all path letters\r\nexport let pathLetters = /[MLHVCSQTAZ]/gi\r\n\r\n// yes we need this one, too\r\nexport let isPathLetter = /[MLHVCSQTAZ]/i\r\n\r\n// matches 0.154.23.45\r\nexport let numbersWithDots = /((\\d?\\.\\d+(?:e[+-]?\\d+)?)((?:\\.\\d+(?:e[+-]?\\d+)?)+))+/gi\r\n\r\n// matches .\r\nexport let dots = /\\./g\r\n","import { delimiter } from '../core/regex.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\n\r\n// Return array of classes on the node\r\nexport function classes () {\r\n var attr = this.attr('class')\r\n return attr == null ? [] : attr.trim().split(delimiter)\r\n}\r\n\r\n// Return true if class exists on the node, false otherwise\r\nexport function hasClass (name) {\r\n return this.classes().indexOf(name) !== -1\r\n}\r\n\r\n// Add class to the node\r\nexport function addClass (name) {\r\n if (!this.hasClass(name)) {\r\n var array = this.classes()\r\n array.push(name)\r\n this.attr('class', array.join(' '))\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Remove class from the node\r\nexport function removeClass (name) {\r\n if (this.hasClass(name)) {\r\n this.attr('class', this.classes().filter(function (c) {\r\n return c !== name\r\n }).join(' '))\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Toggle the presence of a class on the node\r\nexport function toggleClass (name) {\r\n return this.hasClass(name) ? this.removeClass(name) : this.addClass(name)\r\n}\r\n\r\nregisterMethods('Dom', {\r\n classes, hasClass, addClass, removeClass, toggleClass\r\n})\r\n","import { camelCase } from '../../utils/utils.js'\r\nimport { isBlank } from '../core/regex.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\n\r\n// Dynamic style generator\r\nexport function css (style, val) {\r\n let ret = {}\r\n if (arguments.length === 0) {\r\n // get full style as object\r\n this.node.style.cssText.split(/\\s*;\\s*/)\r\n .filter(function (el) { return !!el.length })\r\n .forEach(function (el) {\r\n let t = el.split(/\\s*:\\s*/)\r\n ret[t[0]] = t[1]\r\n })\r\n return ret\r\n }\r\n\r\n if (arguments.length < 2) {\r\n // get style properties in the array\r\n if (Array.isArray(style)) {\r\n for (let name of style) {\r\n let cased = camelCase(name)\r\n ret[cased] = this.node.style[cased]\r\n }\r\n return ret\r\n }\r\n\r\n // get style for property\r\n if (typeof style === 'string') {\r\n return this.node.style[camelCase(style)]\r\n }\r\n\r\n // set styles in object\r\n if (typeof style === 'object') {\r\n for (let name in style) {\r\n // set empty string if null/undefined/'' was given\r\n this.node.style[camelCase(name)] =\r\n (style[name] == null || isBlank.test(style[name])) ? '' : style[name]\r\n }\r\n }\r\n }\r\n\r\n // set style for property\r\n if (arguments.length === 2) {\r\n this.node.style[camelCase(style)] =\r\n (val == null || isBlank.test(val)) ? '' : val\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Show element\r\nexport function show () {\r\n return this.css('display', '')\r\n}\r\n\r\n// Hide element\r\nexport function hide () {\r\n return this.css('display', 'none')\r\n}\r\n\r\n// Is element visible?\r\nexport function visible () {\r\n return this.css('display') !== 'none'\r\n}\r\n\r\nregisterMethods('Dom', {\r\n css, show, hide, visible\r\n})\r\n","import { registerMethods } from '../../utils/methods.js'\r\n\r\n// Store data values on svg nodes\r\nexport function data (a, v, r) {\r\n if (typeof a === 'object') {\r\n for (v in a) {\r\n this.data(v, a[v])\r\n }\r\n } else if (arguments.length < 2) {\r\n try {\r\n return JSON.parse(this.attr('data-' + a))\r\n } catch (e) {\r\n return this.attr('data-' + a)\r\n }\r\n } else {\r\n this.attr('data-' + a,\r\n v === null ? null\r\n : r === true || typeof v === 'string' || typeof v === 'number' ? v\r\n : JSON.stringify(v)\r\n )\r\n }\r\n\r\n return this\r\n}\r\n\r\nregisterMethods('Dom', { data })\r\n","import { registerMethods } from '../../utils/methods.js'\r\n\r\n// Remember arbitrary data\r\nexport function remember (k, v) {\r\n // remember every item in an object individually\r\n if (typeof arguments[0] === 'object') {\r\n for (var key in k) {\r\n this.remember(key, k[key])\r\n }\r\n } else if (arguments.length === 1) {\r\n // retrieve memory\r\n return this.memory()[k]\r\n } else {\r\n // store memory\r\n this.memory()[k] = v\r\n }\r\n\r\n return this\r\n}\r\n\r\n// Erase a given memory\r\nexport function forget () {\r\n if (arguments.length === 0) {\r\n this._memory = {}\r\n } else {\r\n for (var i = arguments.length - 1; i >= 0; i--) {\r\n delete this.memory()[arguments[i]]\r\n }\r\n }\r\n return this\r\n}\r\n\r\n// This triggers creation of a new hidden class which is not performant\r\n// However, this function is not rarely used so it will not happen frequently\r\n// Return local memory object\r\nexport function memory () {\r\n return (this._memory = this._memory || {})\r\n}\r\n\r\nregisterMethods('Dom', { remember, forget, memory })\r\n","import { delimiter } from './regex.js'\r\nimport { makeInstance } from '../../utils/adopter.js'\r\nimport { globals } from '../../utils/window.js'\r\n\r\nlet listenerId = 0\r\n\r\nfunction getEvents (node) {\r\n const n = makeInstance(node).getEventHolder()\r\n if (!n.events) n.events = {}\r\n return n.events\r\n}\r\n\r\nfunction getEventTarget (node) {\r\n return makeInstance(node).getEventTarget()\r\n}\r\n\r\nfunction clearEvents (node) {\r\n const n = makeInstance(node).getEventHolder()\r\n if (n.events) n.events = {}\r\n}\r\n\r\n// Add event binder in the SVG namespace\r\nexport function on (node, events, listener, binding, options) {\r\n var l = listener.bind(binding || node)\r\n var bag = getEvents(node)\r\n var n = getEventTarget(node)\r\n\r\n // events can be an array of events or a string of events\r\n events = Array.isArray(events) ? events : events.split(delimiter)\r\n\r\n // add id to listener\r\n if (!listener._svgjsListenerId) {\r\n listener._svgjsListenerId = ++listenerId\r\n }\r\n\r\n events.forEach(function (event) {\r\n var ev = event.split('.')[0]\r\n var ns = event.split('.')[1] || '*'\r\n\r\n // ensure valid object\r\n bag[ev] = bag[ev] || {}\r\n bag[ev][ns] = bag[ev][ns] || {}\r\n\r\n // reference listener\r\n bag[ev][ns][listener._svgjsListenerId] = l\r\n\r\n // add listener\r\n n.addEventListener(ev, l, options || false)\r\n })\r\n}\r\n\r\n// Add event unbinder in the SVG namespace\r\nexport function off (node, events, listener, options) {\r\n var bag = getEvents(node)\r\n var n = getEventTarget(node)\r\n\r\n // listener can be a function or a number\r\n if (typeof listener === 'function') {\r\n listener = listener._svgjsListenerId\r\n if (!listener) return\r\n }\r\n\r\n // events can be an array of events or a string or undefined\r\n events = Array.isArray(events) ? events : (events || '').split(delimiter)\r\n\r\n events.forEach(function (event) {\r\n var ev = event && event.split('.')[0]\r\n var ns = event && event.split('.')[1]\r\n var namespace, l\r\n\r\n if (listener) {\r\n // remove listener reference\r\n if (bag[ev] && bag[ev][ns || '*']) {\r\n // removeListener\r\n n.removeEventListener(ev, bag[ev][ns || '*'][listener], options || false)\r\n\r\n delete bag[ev][ns || '*'][listener]\r\n }\r\n } else if (ev && ns) {\r\n // remove all listeners for a namespaced event\r\n if (bag[ev] && bag[ev][ns]) {\r\n for (l in bag[ev][ns]) { off(n, [ev, ns].join('.'), l) }\r\n\r\n delete bag[ev][ns]\r\n }\r\n } else if (ns) {\r\n // remove all listeners for a specific namespace\r\n for (event in bag) {\r\n for (namespace in bag[event]) {\r\n if (ns === namespace) { off(n, [event, ns].join('.')) }\r\n }\r\n }\r\n } else if (ev) {\r\n // remove all listeners for the event\r\n if (bag[ev]) {\r\n for (namespace in bag[ev]) { off(n, [ev, namespace].join('.')) }\r\n\r\n delete bag[ev]\r\n }\r\n } else {\r\n // remove all listeners on a given node\r\n for (event in bag) { off(n, event) }\r\n\r\n clearEvents(node)\r\n }\r\n })\r\n}\r\n\r\nexport function dispatch (node, event, data) {\r\n var n = getEventTarget(node)\r\n\r\n // Dispatch event\r\n if (event instanceof globals.window.Event) {\r\n n.dispatchEvent(event)\r\n } else {\r\n event = new globals.window.CustomEvent(event, { detail: data, cancelable: true })\r\n n.dispatchEvent(event)\r\n }\r\n return event\r\n}\r\n","/*\r\n\r\nColor {\r\n constructor (a, b, c, space) {\r\n space: 'hsl'\r\n a: 30\r\n b: 20\r\n c: 10\r\n },\r\n\r\n toRgb () { return new Color in rgb space }\r\n toHsl () { return new Color in hsl space }\r\n toLab () { return new Color in lab space }\r\n\r\n toArray () { [space, a, b, c] }\r\n fromArray () { convert it back }\r\n}\r\n\r\n// Conversions aren't always exact because of monitor profiles etc...\r\nnew Color(h, s, l, 'hsl') !== new Color(r, g, b).hsl()\r\nnew Color(100, 100, 100, [space])\r\nnew Color('hsl(30, 20, 10)')\r\n\r\n// Sugar\r\nSVG.rgb(30, 20, 50).lab()\r\nSVG.hsl()\r\nSVG.lab('rgb(100, 100, 100)')\r\n*/\r\n\r\nimport { hex, isHex, isRgb, rgb, whitespace } from '../modules/core/regex.js'\r\n\r\n// Ensure to six-based hex\r\nfunction fullHex (hex) {\r\n return hex.length === 4\r\n ? [ '#',\r\n hex.substring(1, 2), hex.substring(1, 2),\r\n hex.substring(2, 3), hex.substring(2, 3),\r\n hex.substring(3, 4), hex.substring(3, 4)\r\n ].join('')\r\n : hex\r\n}\r\n\r\n// Component to hex value\r\nfunction compToHex (comp) {\r\n var hex = comp.toString(16)\r\n return hex.length === 1 ? '0' + hex : hex\r\n}\r\n\r\nexport default class Color {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (color, g, b) {\r\n let match\r\n\r\n // initialize defaults\r\n this.r = 0\r\n this.g = 0\r\n this.b = 0\r\n\r\n if (!color) return\r\n\r\n // parse color\r\n if (typeof color === 'string') {\r\n if (isRgb.test(color)) {\r\n // get rgb values\r\n match = rgb.exec(color.replace(whitespace, ''))\r\n\r\n // parse numeric values\r\n this.r = parseInt(match[1])\r\n this.g = parseInt(match[2])\r\n this.b = parseInt(match[3])\r\n } else if (isHex.test(color)) {\r\n // get hex values\r\n match = hex.exec(fullHex(color))\r\n\r\n // parse numeric values\r\n this.r = parseInt(match[1], 16)\r\n this.g = parseInt(match[2], 16)\r\n this.b = parseInt(match[3], 16)\r\n }\r\n } else if (Array.isArray(color)) {\r\n this.r = color[0]\r\n this.g = color[1]\r\n this.b = color[2]\r\n } else if (typeof color === 'object') {\r\n this.r = color.r\r\n this.g = color.g\r\n this.b = color.b\r\n } else if (arguments.length === 3) {\r\n this.r = color\r\n this.g = g\r\n this.b = b\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Default to hex conversion\r\n toString () {\r\n return this.toHex()\r\n }\r\n\r\n toArray () {\r\n return [this.r, this.g, this.b]\r\n }\r\n\r\n // Build hex value\r\n toHex () {\r\n return '#' +\r\n compToHex(Math.round(this.r)) +\r\n compToHex(Math.round(this.g)) +\r\n compToHex(Math.round(this.b))\r\n }\r\n\r\n // Build rgb value\r\n toRgb () {\r\n return 'rgb(' + [this.r, this.g, this.b].join() + ')'\r\n }\r\n\r\n // Calculate true brightness\r\n brightness () {\r\n return (this.r / 255 * 0.30) +\r\n (this.g / 255 * 0.59) +\r\n (this.b / 255 * 0.11)\r\n }\r\n\r\n // Testers\r\n\r\n // Test if given value is a color string\r\n static test (color) {\r\n color += ''\r\n return isHex.test(color) || isRgb.test(color)\r\n }\r\n\r\n // Test if given value is a rgb object\r\n static isRgb (color) {\r\n return color && typeof color.r === 'number' &&\r\n typeof color.g === 'number' &&\r\n typeof color.b === 'number'\r\n }\r\n\r\n // Test if given value is a color\r\n static isColor (color) {\r\n return this.isRgb(color) || this.test(color)\r\n }\r\n}\r\n","export default class Point {\r\n // Initialize\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (x, y) {\r\n let source\r\n let base = { x: 0, y: 0 }\r\n\r\n // ensure source as object\r\n source = Array.isArray(x) ? { x: x[0], y: x[1] }\r\n : typeof x === 'object' ? { x: x.x, y: x.y }\r\n : { x: x, y: y }\r\n\r\n // merge source\r\n this.x = source.x == null ? base.x : source.x\r\n this.y = source.y == null ? base.y : source.y\r\n\r\n return this\r\n }\r\n\r\n // Clone point\r\n clone () {\r\n return new Point(this)\r\n }\r\n\r\n // transform point with matrix\r\n transform (m) {\r\n // Perform the matrix multiplication\r\n var x = m.a * this.x + m.c * this.y + m.e\r\n var y = m.b * this.x + m.d * this.y + m.f\r\n\r\n // Return the required point\r\n return new Point(x, y)\r\n }\r\n\r\n toArray () {\r\n return [this.x, this.y]\r\n }\r\n}\r\n\r\nexport function point (x, y) {\r\n return new Point(x, y).transform(this.screenCTM().inverse())\r\n}\r\n","import { globals } from '../../utils/window.js'\r\nimport { makeInstance } from '../../utils/adopter.js'\r\n\r\nexport default function parser () {\r\n // Reuse cached element if possible\r\n if (!parser.nodes) {\r\n let svg = makeInstance().size(2, 0)\r\n svg.node.cssText = [\r\n 'opacity: 0',\r\n 'position: absolute',\r\n 'left: -100%',\r\n 'top: -100%',\r\n 'overflow: hidden'\r\n ].join(';')\r\n\r\n let path = svg.path().node\r\n\r\n parser.nodes = { svg, path }\r\n }\r\n\r\n if (!parser.nodes.svg.node.parentNode) {\r\n let b = globals.document.body || globals.document.documentElement\r\n parser.nodes.svg.addTo(b)\r\n }\r\n\r\n return parser.nodes\r\n}\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { globals } from '../utils/window.js'\r\nimport Point from './Point.js'\r\nimport parser from '../modules/core/parser.js'\r\n\r\nfunction isNulledBox (box) {\r\n return !box.w && !box.h && !box.x && !box.y\r\n}\r\n\r\nfunction domContains (node) {\r\n return (globals.document.documentElement.contains || function (node) {\r\n // This is IE - it does not support contains() for top-level SVGs\r\n while (node.parentNode) {\r\n node = node.parentNode\r\n }\r\n return node === document\r\n }).call(globals.document.documentElement, node)\r\n}\r\n\r\nexport default class Box {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (source) {\r\n var base = [0, 0, 0, 0]\r\n source = typeof source === 'string' ? source.split(delimiter).map(parseFloat)\r\n : Array.isArray(source) ? source\r\n : typeof source === 'object' ? [source.left != null ? source.left\r\n : source.x, source.top != null ? source.top : source.y, source.width, source.height]\r\n : arguments.length === 4 ? [].slice.call(arguments)\r\n : base\r\n\r\n this.x = source[0] || 0\r\n this.y = source[1] || 0\r\n this.width = this.w = source[2] || 0\r\n this.height = this.h = source[3] || 0\r\n\r\n // Add more bounding box properties\r\n this.x2 = this.x + this.w\r\n this.y2 = this.y + this.h\r\n this.cx = this.x + this.w / 2\r\n this.cy = this.y + this.h / 2\r\n\r\n return this\r\n }\r\n\r\n // Merge rect box with another, return a new instance\r\n merge (box) {\r\n let x = Math.min(this.x, box.x)\r\n let y = Math.min(this.y, box.y)\r\n let width = Math.max(this.x + this.width, box.x + box.width) - x\r\n let height = Math.max(this.y + this.height, box.y + box.height) - y\r\n\r\n return new Box(x, y, width, height)\r\n }\r\n\r\n transform (m) {\r\n let xMin = Infinity\r\n let xMax = -Infinity\r\n let yMin = Infinity\r\n let yMax = -Infinity\r\n\r\n let pts = [\r\n new Point(this.x, this.y),\r\n new Point(this.x2, this.y),\r\n new Point(this.x, this.y2),\r\n new Point(this.x2, this.y2)\r\n ]\r\n\r\n pts.forEach(function (p) {\r\n p = p.transform(m)\r\n xMin = Math.min(xMin, p.x)\r\n xMax = Math.max(xMax, p.x)\r\n yMin = Math.min(yMin, p.y)\r\n yMax = Math.max(yMax, p.y)\r\n })\r\n\r\n return new Box(\r\n xMin, yMin,\r\n xMax - xMin,\r\n yMax - yMin\r\n )\r\n }\r\n\r\n addOffset () {\r\n // offset by window scroll position, because getBoundingClientRect changes when window is scrolled\r\n this.x += globals.window.pageXOffset\r\n this.y += globals.window.pageYOffset\r\n return this\r\n }\r\n\r\n toString () {\r\n return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height\r\n }\r\n\r\n toArray () {\r\n return [this.x, this.y, this.width, this.height]\r\n }\r\n\r\n isNulled () {\r\n return isNulledBox(this)\r\n }\r\n}\r\n\r\nfunction getBox (cb) {\r\n let box\r\n\r\n try {\r\n box = cb(this.node)\r\n\r\n if (isNulledBox(box) && !domContains(this.node)) {\r\n throw new Error('Element not in the dom')\r\n }\r\n } catch (e) {\r\n try {\r\n let clone = this.clone().addTo(parser().svg).show()\r\n box = cb(clone.node)\r\n clone.remove()\r\n } catch (e) {\r\n throw new Error('Getting a bounding box of element \"' + this.node.nodeName + '\" is not possible')\r\n }\r\n }\r\n return box\r\n}\r\n\r\nexport function bbox () {\r\n return new Box(getBox.call(this, (node) => node.getBBox()))\r\n}\r\n\r\nexport function rbox (el) {\r\n let box = new Box(getBox.call(this, (node) => node.getBoundingClientRect()))\r\n if (el) return box.transform(el.screenCTM().inverse())\r\n return box.addOffset()\r\n}\r\n\r\nregisterMethods({\r\n viewbox: {\r\n viewbox (x, y, width, height) {\r\n // act as getter\r\n if (x == null) return new Box(this.attr('viewBox'))\r\n\r\n // act as setter\r\n return this.attr('viewBox', new Box(x, y, width, height))\r\n }\r\n }\r\n})\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { radians } from '../utils/utils.js'\r\nimport Element from '../elements/Element.js'\r\nimport Point from './Point.js'\r\n\r\nfunction closeEnough (a, b, threshold) {\r\n return Math.abs(b - a) < (threshold || 1e-6)\r\n}\r\n\r\nexport default class Matrix {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n // Initialize\r\n init (source) {\r\n var base = Matrix.fromArray([1, 0, 0, 1, 0, 0])\r\n\r\n // ensure source as object\r\n source = source instanceof Element ? source.matrixify()\r\n : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat))\r\n : Array.isArray(source) ? Matrix.fromArray(source)\r\n : (typeof source === 'object' && Matrix.isMatrixLike(source)) ? source\r\n : (typeof source === 'object') ? new Matrix().transform(source)\r\n : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments))\r\n : base\r\n\r\n // Merge the source matrix with the base matrix\r\n this.a = source.a != null ? source.a : base.a\r\n this.b = source.b != null ? source.b : base.b\r\n this.c = source.c != null ? source.c : base.c\r\n this.d = source.d != null ? source.d : base.d\r\n this.e = source.e != null ? source.e : base.e\r\n this.f = source.f != null ? source.f : base.f\r\n\r\n return this\r\n }\r\n\r\n // Clones this matrix\r\n clone () {\r\n return new Matrix(this)\r\n }\r\n\r\n // Transform a matrix into another matrix by manipulating the space\r\n transform (o) {\r\n // Check if o is a matrix and then left multiply it directly\r\n if (Matrix.isMatrixLike(o)) {\r\n var matrix = new Matrix(o)\r\n return matrix.multiplyO(this)\r\n }\r\n\r\n // Get the proposed transformations and the current transformations\r\n var t = Matrix.formatTransforms(o)\r\n var current = this\r\n let { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current)\r\n\r\n // Construct the resulting matrix\r\n var transformer = new Matrix()\r\n .translateO(t.rx, t.ry)\r\n .lmultiplyO(current)\r\n .translateO(-ox, -oy)\r\n .scaleO(t.scaleX, t.scaleY)\r\n .skewO(t.skewX, t.skewY)\r\n .shearO(t.shear)\r\n .rotateO(t.theta)\r\n .translateO(ox, oy)\r\n\r\n // If we want the origin at a particular place, we force it there\r\n if (isFinite(t.px) || isFinite(t.py)) {\r\n const origin = new Point(ox, oy).transform(transformer)\r\n // TODO: Replace t.px with isFinite(t.px)\r\n const dx = t.px ? t.px - origin.x : 0\r\n const dy = t.py ? t.py - origin.y : 0\r\n transformer.translateO(dx, dy)\r\n }\r\n\r\n // Translate now after positioning\r\n transformer.translateO(t.tx, t.ty)\r\n return transformer\r\n }\r\n\r\n // Applies a matrix defined by its affine parameters\r\n compose (o) {\r\n if (o.origin) {\r\n o.originX = o.origin[0]\r\n o.originY = o.origin[1]\r\n }\r\n // Get the parameters\r\n var ox = o.originX || 0\r\n var oy = o.originY || 0\r\n var sx = o.scaleX || 1\r\n var sy = o.scaleY || 1\r\n var lam = o.shear || 0\r\n var theta = o.rotate || 0\r\n var tx = o.translateX || 0\r\n var ty = o.translateY || 0\r\n\r\n // Apply the standard matrix\r\n var result = new Matrix()\r\n .translateO(-ox, -oy)\r\n .scaleO(sx, sy)\r\n .shearO(lam)\r\n .rotateO(theta)\r\n .translateO(tx, ty)\r\n .lmultiplyO(this)\r\n .translateO(ox, oy)\r\n return result\r\n }\r\n\r\n // Decomposes this matrix into its affine parameters\r\n decompose (cx = 0, cy = 0) {\r\n // Get the parameters from the matrix\r\n var a = this.a\r\n var b = this.b\r\n var c = this.c\r\n var d = this.d\r\n var e = this.e\r\n var f = this.f\r\n\r\n // Figure out if the winding direction is clockwise or counterclockwise\r\n var determinant = a * d - b * c\r\n var ccw = determinant > 0 ? 1 : -1\r\n\r\n // Since we only shear in x, we can use the x basis to get the x scale\r\n // and the rotation of the resulting matrix\r\n var sx = ccw * Math.sqrt(a * a + b * b)\r\n var thetaRad = Math.atan2(ccw * b, ccw * a)\r\n var theta = 180 / Math.PI * thetaRad\r\n var ct = Math.cos(thetaRad)\r\n var st = Math.sin(thetaRad)\r\n\r\n // We can then solve the y basis vector simultaneously to get the other\r\n // two affine parameters directly from these parameters\r\n var lam = (a * c + b * d) / determinant\r\n var sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a))\r\n\r\n // Use the translations\r\n let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy)\r\n let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy)\r\n\r\n // Construct the decomposition and return it\r\n return {\r\n // Return the affine parameters\r\n scaleX: sx,\r\n scaleY: sy,\r\n shear: lam,\r\n rotate: theta,\r\n translateX: tx,\r\n translateY: ty,\r\n originX: cx,\r\n originY: cy,\r\n\r\n // Return the matrix parameters\r\n a: this.a,\r\n b: this.b,\r\n c: this.c,\r\n d: this.d,\r\n e: this.e,\r\n f: this.f\r\n }\r\n }\r\n\r\n // Left multiplies by the given matrix\r\n multiply (matrix) {\r\n return this.clone().multiplyO(matrix)\r\n }\r\n\r\n multiplyO (matrix) {\r\n // Get the matrices\r\n var l = this\r\n var r = matrix instanceof Matrix\r\n ? matrix\r\n : new Matrix(matrix)\r\n\r\n return Matrix.matrixMultiply(l, r, this)\r\n }\r\n\r\n lmultiply (matrix) {\r\n return this.clone().lmultiplyO(matrix)\r\n }\r\n\r\n lmultiplyO (matrix) {\r\n var r = this\r\n var l = matrix instanceof Matrix\r\n ? matrix\r\n : new Matrix(matrix)\r\n\r\n return Matrix.matrixMultiply(l, r, this)\r\n }\r\n\r\n // Inverses matrix\r\n inverseO () {\r\n // Get the current parameters out of the matrix\r\n var a = this.a\r\n var b = this.b\r\n var c = this.c\r\n var d = this.d\r\n var e = this.e\r\n var f = this.f\r\n\r\n // Invert the 2x2 matrix in the top left\r\n var det = a * d - b * c\r\n if (!det) throw new Error('Cannot invert ' + this)\r\n\r\n // Calculate the top 2x2 matrix\r\n var na = d / det\r\n var nb = -b / det\r\n var nc = -c / det\r\n var nd = a / det\r\n\r\n // Apply the inverted matrix to the top right\r\n var ne = -(na * e + nc * f)\r\n var nf = -(nb * e + nd * f)\r\n\r\n // Construct the inverted matrix\r\n this.a = na\r\n this.b = nb\r\n this.c = nc\r\n this.d = nd\r\n this.e = ne\r\n this.f = nf\r\n\r\n return this\r\n }\r\n\r\n inverse () {\r\n return this.clone().inverseO()\r\n }\r\n\r\n // Translate matrix\r\n translate (x, y) {\r\n return this.clone().translateO(x, y)\r\n }\r\n\r\n translateO (x, y) {\r\n this.e += x || 0\r\n this.f += y || 0\r\n return this\r\n }\r\n\r\n // Scale matrix\r\n scale (x, y, cx, cy) {\r\n return this.clone().scaleO(...arguments)\r\n }\r\n\r\n scaleO (x, y = x, cx = 0, cy = 0) {\r\n // Support uniform scaling\r\n if (arguments.length === 3) {\r\n cy = cx\r\n cx = y\r\n y = x\r\n }\r\n\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a * x\r\n this.b = b * y\r\n this.c = c * x\r\n this.d = d * y\r\n this.e = e * x - cx * x + cx\r\n this.f = f * y - cy * y + cy\r\n\r\n return this\r\n }\r\n\r\n // Rotate matrix\r\n rotate (r, cx, cy) {\r\n return this.clone().rotateO(r, cx, cy)\r\n }\r\n\r\n rotateO (r, cx = 0, cy = 0) {\r\n // Convert degrees to radians\r\n r = radians(r)\r\n\r\n let cos = Math.cos(r)\r\n let sin = Math.sin(r)\r\n\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a * cos - b * sin\r\n this.b = b * cos + a * sin\r\n this.c = c * cos - d * sin\r\n this.d = d * cos + c * sin\r\n this.e = e * cos - f * sin + cy * sin - cx * cos + cx\r\n this.f = f * cos + e * sin - cx * sin - cy * cos + cy\r\n\r\n return this\r\n }\r\n\r\n // Flip matrix on x or y, at a given offset\r\n flip (axis, around) {\r\n return this.clone().flipO(axis, around)\r\n }\r\n\r\n flipO (axis, around) {\r\n return axis === 'x' ? this.scaleO(-1, 1, around, 0)\r\n : axis === 'y' ? this.scaleO(1, -1, 0, around)\r\n : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point\r\n }\r\n\r\n // Shear matrix\r\n shear (a, cx, cy) {\r\n return this.clone().shearO(a, cx, cy)\r\n }\r\n\r\n shearO (lx, cx = 0, cy = 0) {\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a + b * lx\r\n this.c = c + d * lx\r\n this.e = e + f * lx - cy * lx\r\n\r\n return this\r\n }\r\n\r\n // Skew Matrix\r\n skew (x, y, cx, cy) {\r\n return this.clone().skewO(...arguments)\r\n }\r\n\r\n skewO (x, y = x, cx = 0, cy = 0) {\r\n // support uniformal skew\r\n if (arguments.length === 3) {\r\n cy = cx\r\n cx = y\r\n y = x\r\n }\r\n\r\n // Convert degrees to radians\r\n x = radians(x)\r\n y = radians(y)\r\n\r\n let lx = Math.tan(x)\r\n let ly = Math.tan(y)\r\n\r\n let { a, b, c, d, e, f } = this\r\n\r\n this.a = a + b * lx\r\n this.b = b + a * ly\r\n this.c = c + d * lx\r\n this.d = d + c * ly\r\n this.e = e + f * lx - cy * lx\r\n this.f = f + e * ly - cx * ly\r\n\r\n return this\r\n }\r\n\r\n // SkewX\r\n skewX (x, cx, cy) {\r\n return this.skew(x, 0, cx, cy)\r\n }\r\n\r\n skewXO (x, cx, cy) {\r\n return this.skewO(x, 0, cx, cy)\r\n }\r\n\r\n // SkewY\r\n skewY (y, cx, cy) {\r\n return this.skew(0, y, cx, cy)\r\n }\r\n\r\n skewYO (y, cx, cy) {\r\n return this.skewO(0, y, cx, cy)\r\n }\r\n\r\n // Transform around a center point\r\n aroundO (cx, cy, matrix) {\r\n var dx = cx || 0\r\n var dy = cy || 0\r\n return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy)\r\n }\r\n\r\n around (cx, cy, matrix) {\r\n return this.clone().aroundO(cx, cy, matrix)\r\n }\r\n\r\n // Check if two matrices are equal\r\n equals (other) {\r\n var comp = new Matrix(other)\r\n return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) &&\r\n closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) &&\r\n closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f)\r\n }\r\n\r\n // Convert matrix to string\r\n toString () {\r\n return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')'\r\n }\r\n\r\n toArray () {\r\n return [this.a, this.b, this.c, this.d, this.e, this.f]\r\n }\r\n\r\n valueOf () {\r\n return {\r\n a: this.a,\r\n b: this.b,\r\n c: this.c,\r\n d: this.d,\r\n e: this.e,\r\n f: this.f\r\n }\r\n }\r\n\r\n static fromArray (a) {\r\n return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] }\r\n }\r\n\r\n static isMatrixLike (o) {\r\n return (\r\n o.a != null ||\r\n o.b != null ||\r\n o.c != null ||\r\n o.d != null ||\r\n o.e != null ||\r\n o.f != null\r\n )\r\n }\r\n\r\n static formatTransforms (o) {\r\n // Get all of the parameters required to form the matrix\r\n var flipBoth = o.flip === 'both' || o.flip === true\r\n var flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1\r\n var flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1\r\n var skewX = o.skew && o.skew.length ? o.skew[0]\r\n : isFinite(o.skew) ? o.skew\r\n : isFinite(o.skewX) ? o.skewX\r\n : 0\r\n var skewY = o.skew && o.skew.length ? o.skew[1]\r\n : isFinite(o.skew) ? o.skew\r\n : isFinite(o.skewY) ? o.skewY\r\n : 0\r\n var scaleX = o.scale && o.scale.length ? o.scale[0] * flipX\r\n : isFinite(o.scale) ? o.scale * flipX\r\n : isFinite(o.scaleX) ? o.scaleX * flipX\r\n : flipX\r\n var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY\r\n : isFinite(o.scale) ? o.scale * flipY\r\n : isFinite(o.scaleY) ? o.scaleY * flipY\r\n : flipY\r\n var shear = o.shear || 0\r\n var theta = o.rotate || o.theta || 0\r\n var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY)\r\n var ox = origin.x\r\n var oy = origin.y\r\n var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY)\r\n var px = position.x\r\n var py = position.y\r\n var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY)\r\n var tx = translate.x\r\n var ty = translate.y\r\n var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY)\r\n var rx = relative.x\r\n var ry = relative.y\r\n\r\n // Populate all of the values\r\n return {\r\n scaleX, scaleY, skewX, skewY, shear, theta, rx, ry, tx, ty, ox, oy, px, py\r\n }\r\n }\r\n\r\n // left matrix, right matrix, target matrix which is overwritten\r\n static matrixMultiply (l, r, o) {\r\n // Work out the product directly\r\n var a = l.a * r.a + l.c * r.b\r\n var b = l.b * r.a + l.d * r.b\r\n var c = l.a * r.c + l.c * r.d\r\n var d = l.b * r.c + l.d * r.d\r\n var e = l.e + l.a * r.e + l.c * r.f\r\n var f = l.f + l.b * r.e + l.d * r.f\r\n\r\n // make sure to use local variables because l/r and o could be the same\r\n o.a = a\r\n o.b = b\r\n o.c = c\r\n o.d = d\r\n o.e = e\r\n o.f = f\r\n\r\n return o\r\n }\r\n}\r\n\r\nexport function ctm () {\r\n return new Matrix(this.node.getCTM())\r\n}\r\n\r\nexport function screenCTM () {\r\n /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537\r\n This is needed because FF does not return the transformation matrix\r\n for the inner coordinate system when getScreenCTM() is called on nested svgs.\r\n However all other Browsers do that */\r\n if (typeof this.isRoot === 'function' && !this.isRoot()) {\r\n var rect = this.rect(1, 1)\r\n var m = rect.node.getScreenCTM()\r\n rect.remove()\r\n return new Matrix(m)\r\n }\r\n return new Matrix(this.node.getScreenCTM())\r\n}\r\n","/* eslint no-new-func: \"off\" */\r\nexport const subClassArray = (function () {\r\n try {\r\n // try es6 subclassing\r\n return Function('name', 'baseClass', '_constructor', [\r\n 'baseClass = baseClass || Array',\r\n 'return {',\r\n ' [name]: class extends baseClass {',\r\n ' constructor (...args) {',\r\n ' super(...args)',\r\n ' _constructor && _constructor.apply(this, args)',\r\n ' }',\r\n ' }',\r\n '}[name]'\r\n ].join('\\n'))\r\n } catch (e) {\r\n // Use es5 approach\r\n return (name, baseClass = Array, _constructor) => {\r\n const Arr = function () {\r\n baseClass.apply(this, arguments)\r\n _constructor && _constructor.apply(this, arguments)\r\n }\r\n\r\n Arr.prototype = Object.create(baseClass.prototype)\r\n Arr.prototype.constructor = Arr\r\n\r\n Arr.prototype.map = function (fn) {\r\n const arr = new Arr()\r\n arr.push.apply(arr, Array.prototype.map.call(this, fn))\r\n return arr\r\n }\r\n\r\n return Arr\r\n }\r\n }\r\n})()\r\n","import { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\n\r\nconst List = subClassArray('List', Array, function (arr = []) {\r\n // This catches the case, that native map tries to create an array with new Array(1)\r\n if (typeof arr === 'number') return this\r\n this.length = 0\r\n this.push(...arr)\r\n})\r\n\r\nexport default List\r\n\r\nextend(List, {\r\n each (fnOrMethodName, ...args) {\r\n if (typeof fnOrMethodName === 'function') {\r\n this.forEach((el) => { fnOrMethodName.call(el, el) })\r\n } else {\r\n return this.map(el => { return el[fnOrMethodName](...args) })\r\n }\r\n\r\n return this\r\n },\r\n\r\n toArray () {\r\n return Array.prototype.concat.apply([], this)\r\n }\r\n})\r\n\r\nList.extend = function (methods) {\r\n methods = methods.reduce((obj, name) => {\r\n obj[name] = function (...attrs) {\r\n return this.each(name, ...attrs)\r\n }\r\n return obj\r\n }, {})\r\n\r\n extend(List, methods)\r\n}\r\n","import { adopt } from '../../utils/adopter.js'\r\nimport { globals } from '../../utils/window.js'\r\nimport { map } from '../../utils/utils.js'\r\nimport List from '../../types/List.js'\r\n\r\nexport default function baseFind (query, parent) {\r\n return new List(map((parent || globals.document).querySelectorAll(query), function (node) {\r\n return adopt(node)\r\n }))\r\n}\r\n\r\n// Scoped find method\r\nexport function find (query) {\r\n return baseFind(query, this.node)\r\n}\r\n","import { dispatch, off, on } from '../modules/core/event.js'\r\nimport Base from './Base.js'\r\n\r\nexport default class EventTarget extends Base {\r\n constructor ({ events = {} } = {}) {\r\n super()\r\n this.events = events\r\n }\r\n\r\n addEventListener () {}\r\n\r\n dispatch (event, data) {\r\n return dispatch(this, event, data)\r\n }\r\n\r\n dispatchEvent (event) {\r\n const bag = this.getEventHolder().events\r\n if (!bag) return true\r\n\r\n const events = bag[event.type]\r\n\r\n for (let i in events) {\r\n for (let j in events[i]) {\r\n events[i][j](event)\r\n }\r\n }\r\n\r\n return !event.defaultPrevented\r\n }\r\n\r\n // Fire given event\r\n fire (event, data) {\r\n this.dispatch(event, data)\r\n return this\r\n }\r\n\r\n getEventHolder () {\r\n return this\r\n }\r\n\r\n getEventTarget () {\r\n return this\r\n }\r\n\r\n // Unbind event from listener\r\n off (event, listener) {\r\n off(this, event, listener)\r\n return this\r\n }\r\n\r\n // Bind given event to listener\r\n on (event, listener, binding, options) {\r\n on(this, event, listener, binding, options)\r\n return this\r\n }\r\n\r\n removeEventListener () {}\r\n}\r\n","\r\nexport function noop () {}\r\n\r\n// Default animation values\r\nexport let timeline = {\r\n duration: 400,\r\n ease: '>',\r\n delay: 0\r\n}\r\n\r\n// Default attribute values\r\nexport let attrs = {\r\n\r\n // fill and stroke\r\n 'fill-opacity': 1,\r\n 'stroke-opacity': 1,\r\n 'stroke-width': 0,\r\n 'stroke-linejoin': 'miter',\r\n 'stroke-linecap': 'butt',\r\n fill: '#000000',\r\n stroke: '#000000',\r\n opacity: 1,\r\n\r\n // position\r\n x: 0,\r\n y: 0,\r\n cx: 0,\r\n cy: 0,\r\n\r\n // size\r\n width: 0,\r\n height: 0,\r\n\r\n // radius\r\n r: 0,\r\n rx: 0,\r\n ry: 0,\r\n\r\n // gradient\r\n offset: 0,\r\n 'stop-opacity': 1,\r\n 'stop-color': '#000000',\r\n\r\n // text\r\n 'font-size': 16,\r\n 'font-family': 'Helvetica, Arial, sans-serif',\r\n 'text-anchor': 'start'\r\n}\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\n\r\nconst SVGArray = subClassArray('SVGArray', Array, function (arr) {\r\n this.init(arr)\r\n})\r\n\r\nexport default SVGArray\r\n\r\nextend(SVGArray, {\r\n init (arr) {\r\n // This catches the case, that native map tries to create an array with new Array(1)\r\n if (typeof arr === 'number') return this\r\n this.length = 0\r\n this.push(...this.parse(arr))\r\n return this\r\n },\r\n\r\n toArray () {\r\n return Array.prototype.concat.apply([], this)\r\n },\r\n\r\n toString () {\r\n return this.join(' ')\r\n },\r\n\r\n // Flattens the array if needed\r\n valueOf () {\r\n const ret = []\r\n ret.push(...this)\r\n return ret\r\n },\r\n\r\n // Parse whitespace separated string\r\n parse (array = []) {\r\n // If already is an array, no need to parse it\r\n if (array instanceof Array) return array\r\n\r\n return array.trim().split(delimiter).map(parseFloat)\r\n },\r\n\r\n clone () {\r\n return new this.constructor(this)\r\n },\r\n\r\n toSet () {\r\n return new Set(this)\r\n }\r\n})\r\n","import { numberAndUnit } from '../modules/core/regex.js'\r\n\r\n// Module for unit convertions\r\nexport default class SVGNumber {\r\n // Initialize\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (value, unit) {\r\n unit = Array.isArray(value) ? value[1] : unit\r\n value = Array.isArray(value) ? value[0] : value\r\n\r\n // initialize defaults\r\n this.value = 0\r\n this.unit = unit || ''\r\n\r\n // parse value\r\n if (typeof value === 'number') {\r\n // ensure a valid numeric value\r\n this.value = isNaN(value) ? 0 : !isFinite(value) ? (value < 0 ? -3.4e+38 : +3.4e+38) : value\r\n } else if (typeof value === 'string') {\r\n unit = value.match(numberAndUnit)\r\n\r\n if (unit) {\r\n // make value numeric\r\n this.value = parseFloat(unit[1])\r\n\r\n // normalize\r\n if (unit[5] === '%') { this.value /= 100 } else if (unit[5] === 's') {\r\n this.value *= 1000\r\n }\r\n\r\n // store unit\r\n this.unit = unit[5]\r\n }\r\n } else {\r\n if (value instanceof SVGNumber) {\r\n this.value = value.valueOf()\r\n this.unit = value.unit\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n toString () {\r\n return (this.unit === '%' ? ~~(this.value * 1e8) / 1e6\r\n : this.unit === 's' ? this.value / 1e3\r\n : this.value\r\n ) + this.unit\r\n }\r\n\r\n toJSON () {\r\n return this.toString()\r\n }\r\n\r\n toArray () {\r\n return [this.value, this.unit]\r\n }\r\n\r\n valueOf () {\r\n return this.value\r\n }\r\n\r\n // Add number\r\n plus (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this + number, this.unit || number.unit)\r\n }\r\n\r\n // Subtract number\r\n minus (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this - number, this.unit || number.unit)\r\n }\r\n\r\n // Multiply number\r\n times (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this * number, this.unit || number.unit)\r\n }\r\n\r\n // Divide number\r\n divide (number) {\r\n number = new SVGNumber(number)\r\n return new SVGNumber(this / number, this.unit || number.unit)\r\n }\r\n}\r\n","import { attrs as defaults } from './defaults.js'\r\nimport { isNumber } from './regex.js'\r\nimport Color from '../../types/Color.js'\r\nimport SVGArray from '../../types/SVGArray.js'\r\nimport SVGNumber from '../../types/SVGNumber.js'\r\n\r\nconst hooks = []\r\nexport function registerAttrHook (fn) {\r\n hooks.push(fn)\r\n}\r\n\r\n// Set svg element attribute\r\nexport default function attr (attr, val, ns) {\r\n // act as full getter\r\n if (attr == null) {\r\n // get an object of attributes\r\n attr = {}\r\n val = this.node.attributes\r\n\r\n for (let node of val) {\r\n attr[node.nodeName] = isNumber.test(node.nodeValue)\r\n ? parseFloat(node.nodeValue)\r\n : node.nodeValue\r\n }\r\n\r\n return attr\r\n } else if (attr instanceof Array) {\r\n // loop through array and get all values\r\n return attr.reduce((last, curr) => {\r\n last[curr] = this.attr(curr)\r\n return last\r\n }, {})\r\n } else if (typeof attr === 'object') {\r\n // apply every attribute individually if an object is passed\r\n for (val in attr) this.attr(val, attr[val])\r\n } else if (val === null) {\r\n // remove value\r\n this.node.removeAttribute(attr)\r\n } else if (val == null) {\r\n // act as a getter if the first and only argument is not an object\r\n val = this.node.getAttribute(attr)\r\n return val == null ? defaults[attr]\r\n : isNumber.test(val) ? parseFloat(val)\r\n : val\r\n } else {\r\n // Loop through hooks and execute them to convert value\r\n val = hooks.reduce((_val, hook) => {\r\n return hook(attr, _val, this)\r\n }, val)\r\n\r\n // ensure correct numeric values (also accepts NaN and Infinity)\r\n if (typeof val === 'number') {\r\n val = new SVGNumber(val)\r\n } else if (Color.isColor(val)) {\r\n // ensure full hex color\r\n val = new Color(val)\r\n } else if (val.constructor === Array) {\r\n // Check for plain arrays and parse array values\r\n val = new SVGArray(val)\r\n }\r\n\r\n // if the passed attribute is leading...\r\n if (attr === 'leading') {\r\n // ... call the leading method instead\r\n if (this.leading) {\r\n this.leading(val)\r\n }\r\n } else {\r\n // set given attribute on node\r\n typeof ns === 'string' ? this.node.setAttributeNS(ns, attr, val.toString())\r\n : this.node.setAttribute(attr, val.toString())\r\n }\r\n\r\n // rebuild if required\r\n if (this.rebuild && (attr === 'font-size' || attr === 'x')) {\r\n this.rebuild()\r\n }\r\n }\r\n\r\n return this\r\n}\r\n","import {\r\n adopt,\r\n assignNewId,\r\n eid,\r\n extend,\r\n makeInstance,\r\n makeNode,\r\n register\r\n} from '../utils/adopter.js'\r\nimport { find } from '../modules/core/selector.js'\r\nimport { globals } from '../utils/window.js'\r\nimport { map } from '../utils/utils.js'\r\nimport { ns } from '../modules/core/namespaces.js'\r\nimport EventTarget from '../types/EventTarget.js'\r\nimport List from '../types/List.js'\r\nimport attr from '../modules/core/attr.js'\r\n\r\nexport default class Dom extends EventTarget {\r\n constructor (node, attrs) {\r\n super(node)\r\n this.node = node\r\n this.type = node.nodeName\r\n\r\n if (attrs && node !== attrs) {\r\n this.attr(attrs)\r\n }\r\n }\r\n\r\n // Add given element at a position\r\n add (element, i) {\r\n element = makeInstance(element)\r\n\r\n if (i == null) {\r\n this.node.appendChild(element.node)\r\n } else if (element.node !== this.node.childNodes[i]) {\r\n this.node.insertBefore(element.node, this.node.childNodes[i])\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Add element to given container and return self\r\n addTo (parent) {\r\n return makeInstance(parent).put(this)\r\n }\r\n\r\n // Returns all child elements\r\n children () {\r\n return new List(map(this.node.children, function (node) {\r\n return adopt(node)\r\n }))\r\n }\r\n\r\n // Remove all elements in this container\r\n clear () {\r\n // remove children\r\n while (this.node.hasChildNodes()) {\r\n this.node.removeChild(this.node.lastChild)\r\n }\r\n\r\n // remove defs reference\r\n delete this._defs\r\n\r\n return this\r\n }\r\n\r\n // Clone element\r\n clone () {\r\n // write dom data to the dom so the clone can pickup the data\r\n this.writeDataToDom()\r\n\r\n // clone element and assign new id\r\n return assignNewId(this.node.cloneNode(true))\r\n }\r\n\r\n // Iterates over all children and invokes a given block\r\n each (block, deep) {\r\n var children = this.children()\r\n var i, il\r\n\r\n for (i = 0, il = children.length; i < il; i++) {\r\n block.apply(children[i], [i, children])\r\n\r\n if (deep) {\r\n children[i].each(block, deep)\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n element (nodeName) {\r\n return this.put(new Dom(makeNode(nodeName)))\r\n }\r\n\r\n // Get first child\r\n first () {\r\n return adopt(this.node.firstChild)\r\n }\r\n\r\n // Get a element at the given index\r\n get (i) {\r\n return adopt(this.node.childNodes[i])\r\n }\r\n\r\n getEventHolder () {\r\n return this.node\r\n }\r\n\r\n getEventTarget () {\r\n return this.node\r\n }\r\n\r\n // Checks if the given element is a child\r\n has (element) {\r\n return this.index(element) >= 0\r\n }\r\n\r\n // Get / set id\r\n id (id) {\r\n // generate new id if no id set\r\n if (typeof id === 'undefined' && !this.node.id) {\r\n this.node.id = eid(this.type)\r\n }\r\n\r\n // dont't set directly width this.node.id to make `null` work correctly\r\n return this.attr('id', id)\r\n }\r\n\r\n // Gets index of given element\r\n index (element) {\r\n return [].slice.call(this.node.childNodes).indexOf(element.node)\r\n }\r\n\r\n // Get the last child\r\n last () {\r\n return adopt(this.node.lastChild)\r\n }\r\n\r\n // matches the element vs a css selector\r\n matches (selector) {\r\n const el = this.node\r\n return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector)\r\n }\r\n\r\n // Returns the parent element instance\r\n parent (type) {\r\n var parent = this\r\n\r\n // check for parent\r\n if (!parent.node.parentNode) return null\r\n\r\n // get parent element\r\n parent = adopt(parent.node.parentNode)\r\n\r\n if (!type) return parent\r\n\r\n // loop trough ancestors if type is given\r\n while (parent && parent.node instanceof globals.window.SVGElement) { // FIXME: That shouldnt be neccessary\r\n if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent\r\n parent = adopt(parent.node.parentNode)\r\n }\r\n }\r\n\r\n // Basically does the same as `add()` but returns the added element instead\r\n put (element, i) {\r\n this.add(element, i)\r\n return element\r\n }\r\n\r\n // Add element to given container and return container\r\n putIn (parent) {\r\n return makeInstance(parent).add(this)\r\n }\r\n\r\n // Remove element\r\n remove () {\r\n if (this.parent()) {\r\n this.parent().removeElement(this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Remove a given child\r\n removeElement (element) {\r\n this.node.removeChild(element.node)\r\n\r\n return this\r\n }\r\n\r\n // Replace this with element\r\n replace (element) {\r\n element = makeInstance(element)\r\n this.node.parentNode.replaceChild(element.node, this.node)\r\n return element\r\n }\r\n\r\n round (precision = 2, map) {\r\n const factor = 10 ** precision\r\n const attrs = this.attr()\r\n\r\n // If we have no map, build one from attrs\r\n if (!map) {\r\n map = Object.keys(attrs)\r\n }\r\n\r\n // Holds rounded attributes\r\n const newAttrs = {}\r\n map.forEach((key) => {\r\n newAttrs[key] = Math.round(attrs[key] * factor) / factor\r\n })\r\n\r\n this.attr(newAttrs)\r\n return this\r\n }\r\n\r\n // Return id on string conversion\r\n toString () {\r\n return this.id()\r\n }\r\n\r\n // Import raw svg\r\n svg (svgOrFn, outerHTML) {\r\n var well, len, fragment\r\n\r\n if (svgOrFn === false) {\r\n outerHTML = false\r\n svgOrFn = null\r\n }\r\n\r\n // act as getter if no svg string is given\r\n if (svgOrFn == null || typeof svgOrFn === 'function') {\r\n // The default for exports is, that the outerNode is included\r\n outerHTML = outerHTML == null ? true : outerHTML\r\n\r\n // write svgjs data to the dom\r\n this.writeDataToDom()\r\n let current = this\r\n\r\n // An export modifier was passed\r\n if (svgOrFn != null) {\r\n current = adopt(current.node.cloneNode(true))\r\n\r\n // If the user wants outerHTML we need to process this node, too\r\n if (outerHTML) {\r\n let result = svgOrFn(current)\r\n current = result || current\r\n\r\n // The user does not want this node? Well, then he gets nothing\r\n if (result === false) return ''\r\n }\r\n\r\n // Deep loop through all children and apply modifier\r\n current.each(function () {\r\n let result = svgOrFn(this)\r\n let _this = result || this\r\n\r\n // If modifier returns false, discard node\r\n if (result === false) {\r\n this.remove()\r\n\r\n // If modifier returns new node, use it\r\n } else if (result && this !== _this) {\r\n this.replace(_this)\r\n }\r\n }, true)\r\n }\r\n\r\n // Return outer or inner content\r\n return outerHTML\r\n ? current.node.outerHTML\r\n : current.node.innerHTML\r\n }\r\n\r\n // Act as setter if we got a string\r\n\r\n // The default for import is, that the current node is not replaced\r\n outerHTML = outerHTML == null ? false : outerHTML\r\n\r\n // Create temporary holder\r\n well = globals.document.createElementNS(ns, 'svg')\r\n fragment = globals.document.createDocumentFragment()\r\n\r\n // Dump raw svg\r\n well.innerHTML = svgOrFn\r\n\r\n // Transplant nodes into the fragment\r\n for (len = well.children.length; len--;) {\r\n fragment.appendChild(well.firstElementChild)\r\n }\r\n\r\n let parent = this.parent()\r\n\r\n // Add the whole fragment at once\r\n return outerHTML\r\n ? this.replace(fragment) && parent\r\n : this.add(fragment)\r\n }\r\n\r\n words (text) {\r\n // This is faster than removing all children and adding a new one\r\n this.node.textContent = text\r\n return this\r\n }\r\n\r\n // write svgjs data to the dom\r\n writeDataToDom () {\r\n // dump variables recursively\r\n this.each(function () {\r\n this.writeDataToDom()\r\n })\r\n\r\n return this\r\n }\r\n}\r\n\r\nextend(Dom, { attr, find })\r\nregister(Dom)\r\n","import { bbox, rbox } from '../types/Box.js'\r\nimport { ctm, screenCTM } from '../types/Matrix.js'\r\nimport {\r\n extend,\r\n getClass,\r\n makeInstance,\r\n register,\r\n root\r\n} from '../utils/adopter.js'\r\nimport { globals } from '../utils/window.js'\r\nimport { point } from '../types/Point.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { reference } from '../modules/core/regex.js'\r\nimport Dom from './Dom.js'\r\nimport List from '../types/List.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\n\r\nconst Svg = getClass(root)\r\n\r\nexport default class Element extends Dom {\r\n constructor (node, attrs) {\r\n super(node, attrs)\r\n\r\n // initialize data object\r\n this.dom = {}\r\n\r\n // create circular reference\r\n this.node.instance = this\r\n\r\n if (node.hasAttribute('svgjs:data')) {\r\n // pull svgjs data from the dom (getAttributeNS doesn't work in html5)\r\n this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {})\r\n }\r\n }\r\n\r\n // Move element by its center\r\n center (x, y) {\r\n return this.cx(x).cy(y)\r\n }\r\n\r\n // Move by center over x-axis\r\n cx (x) {\r\n return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2)\r\n }\r\n\r\n // Move by center over y-axis\r\n cy (y) {\r\n return y == null\r\n ? this.y() + this.height() / 2\r\n : this.y(y - this.height() / 2)\r\n }\r\n\r\n // Get defs\r\n defs () {\r\n return this.root().defs()\r\n }\r\n\r\n // Get parent document\r\n root () {\r\n let p = this.parent(Svg)\r\n return p && p.root()\r\n }\r\n\r\n getEventHolder () {\r\n return this\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return this.attr('height', height)\r\n }\r\n\r\n // Checks whether the given point inside the bounding box of the element\r\n inside (x, y) {\r\n let box = this.bbox()\r\n\r\n return x > box.x &&\r\n y > box.y &&\r\n x < box.x + box.width &&\r\n y < box.y + box.height\r\n }\r\n\r\n // Move element to given x and y values\r\n move (x, y) {\r\n return this.x(x).y(y)\r\n }\r\n\r\n // return array of all ancestors of given type up to the root svg\r\n parents (until = globals.document) {\r\n until = makeInstance(until)\r\n let parents = new List()\r\n let parent = this\r\n\r\n while (\r\n (parent = parent.parent()) &&\r\n parent.node !== until.node &&\r\n parent.node !== globals.document\r\n ) {\r\n parents.push(parent)\r\n }\r\n\r\n return parents\r\n }\r\n\r\n // Get referenced element form attribute value\r\n reference (attr) {\r\n attr = this.attr(attr)\r\n if (!attr) return null\r\n\r\n const m = attr.match(reference)\r\n return m ? makeInstance(m[1]) : null\r\n }\r\n\r\n // set given data to the elements data property\r\n setData (o) {\r\n this.dom = o\r\n return this\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n let p = proportionalSize(this, width, height)\r\n\r\n return this\r\n .width(new SVGNumber(p.width))\r\n .height(new SVGNumber(p.height))\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return this.attr('width', width)\r\n }\r\n\r\n // write svgjs data to the dom\r\n writeDataToDom () {\r\n // remove previously set data\r\n this.node.removeAttribute('svgjs:data')\r\n\r\n if (Object.keys(this.dom).length) {\r\n this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)) // see #428\r\n }\r\n\r\n return super.writeDataToDom()\r\n }\r\n\r\n // Move over x-axis\r\n x (x) {\r\n return this.attr('x', x)\r\n }\r\n\r\n // Move over y-axis\r\n y (y) {\r\n return this.attr('y', y)\r\n }\r\n}\r\n\r\nextend(Element, {\r\n bbox, rbox, point, ctm, screenCTM\r\n})\r\n\r\nregister(Element)\r\n","import { on, off } from '../core/event.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\nimport Color from '../../types/Color.js'\r\nimport Element from '../../elements/Element.js'\r\nimport Matrix from '../../types/Matrix.js'\r\nimport Point from '../../types/Point.js'\r\nimport SVGNumber from '../../types/SVGNumber.js'\r\n\r\n// Define list of available attributes for stroke and fill\r\nvar sugar = {\r\n stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'],\r\n fill: ['color', 'opacity', 'rule'],\r\n prefix: function (t, a) {\r\n return a === 'color' ? t : t + '-' + a\r\n }\r\n}\r\n\r\n// Add sugar for fill and stroke\r\n;['fill', 'stroke'].forEach(function (m) {\r\n var extension = {}\r\n var i\r\n\r\n extension[m] = function (o) {\r\n if (typeof o === 'undefined') {\r\n return this.attr(m)\r\n }\r\n if (typeof o === 'string' || Color.isRgb(o) || (o instanceof Element)) {\r\n this.attr(m, o)\r\n } else {\r\n // set all attributes from sugar.fill and sugar.stroke list\r\n for (i = sugar[m].length - 1; i >= 0; i--) {\r\n if (o[sugar[m][i]] != null) {\r\n this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]])\r\n }\r\n }\r\n }\r\n\r\n return this\r\n }\r\n\r\n registerMethods(['Shape', 'Runner'], extension)\r\n})\r\n\r\nregisterMethods(['Element', 'Runner'], {\r\n // Let the user set the matrix directly\r\n matrix: function (mat, b, c, d, e, f) {\r\n // Act as a getter\r\n if (mat == null) {\r\n return new Matrix(this)\r\n }\r\n\r\n // Act as a setter, the user can pass a matrix or a set of numbers\r\n return this.attr('transform', new Matrix(mat, b, c, d, e, f))\r\n },\r\n\r\n // Map rotation to transform\r\n rotate: function (angle, cx, cy) {\r\n return this.transform({ rotate: angle, ox: cx, oy: cy }, true)\r\n },\r\n\r\n // Map skew to transform\r\n skew: function (x, y, cx, cy) {\r\n return arguments.length === 1 || arguments.length === 3\r\n ? this.transform({ skew: x, ox: y, oy: cx }, true)\r\n : this.transform({ skew: [x, y], ox: cx, oy: cy }, true)\r\n },\r\n\r\n shear: function (lam, cx, cy) {\r\n return this.transform({ shear: lam, ox: cx, oy: cy }, true)\r\n },\r\n\r\n // Map scale to transform\r\n scale: function (x, y, cx, cy) {\r\n return arguments.length === 1 || arguments.length === 3\r\n ? this.transform({ scale: x, ox: y, oy: cx }, true)\r\n : this.transform({ scale: [x, y], ox: cx, oy: cy }, true)\r\n },\r\n\r\n // Map translate to transform\r\n translate: function (x, y) {\r\n return this.transform({ translate: [x, y] }, true)\r\n },\r\n\r\n // Map relative translations to transform\r\n relative: function (x, y) {\r\n return this.transform({ relative: [x, y] }, true)\r\n },\r\n\r\n // Map flip to transform\r\n flip: function (direction, around) {\r\n var directionString = typeof direction === 'string' ? direction\r\n : isFinite(direction) ? 'both'\r\n : 'both'\r\n var origin = (direction === 'both' && isFinite(around)) ? [around, around]\r\n : (direction === 'x') ? [around, 0]\r\n : (direction === 'y') ? [0, around]\r\n : isFinite(direction) ? [direction, direction]\r\n : [0, 0]\r\n this.transform({ flip: directionString, origin: origin }, true)\r\n },\r\n\r\n // Opacity\r\n opacity: function (value) {\r\n return this.attr('opacity', value)\r\n },\r\n\r\n // Relative move over x and y axes\r\n dmove: function (x, y) {\r\n return this.dx(x).dy(y)\r\n }\r\n})\r\n\r\nregisterMethods('Element', {\r\n // Relative move over x axis\r\n dx: function (x) {\r\n return this.x(new SVGNumber(x).plus(this.x()))\r\n },\r\n\r\n // Relative move over y axis\r\n dy: function (y) {\r\n return this.y(new SVGNumber(y).plus(this.y()))\r\n }\r\n})\r\n\r\nregisterMethods('radius', {\r\n // Add x and y radius\r\n radius: function (x, y) {\r\n var type = (this._element || this).type\r\n return type === 'radialGradient' || type === 'radialGradient'\r\n ? this.attr('r', new SVGNumber(x))\r\n : this.rx(x).ry(y == null ? x : y)\r\n }\r\n})\r\n\r\nregisterMethods('Path', {\r\n // Get path length\r\n length: function () {\r\n return this.node.getTotalLength()\r\n },\r\n // Get point at length\r\n pointAt: function (length) {\r\n return new Point(this.node.getPointAtLength(length))\r\n }\r\n})\r\n\r\nregisterMethods(['Element', 'Runner'], {\r\n // Set font\r\n font: function (a, v) {\r\n if (typeof a === 'object') {\r\n for (v in a) this.font(v, a[v])\r\n }\r\n\r\n return a === 'leading'\r\n ? this.leading(v)\r\n : a === 'anchor'\r\n ? this.attr('text-anchor', v)\r\n : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style'\r\n ? this.attr('font-' + a, v)\r\n : this.attr(a, v)\r\n }\r\n})\r\n\r\nregisterMethods('Text', {\r\n ax (x) {\r\n return this.attr('x', x)\r\n },\r\n ay (y) {\r\n return this.attr('y', y)\r\n },\r\n amove (x, y) {\r\n return this.ax(x).ay(y)\r\n }\r\n})\r\n\r\n// Add events to elements\r\nconst methods = [ 'click',\r\n 'dblclick',\r\n 'mousedown',\r\n 'mouseup',\r\n 'mouseover',\r\n 'mouseout',\r\n 'mousemove',\r\n 'mouseenter',\r\n 'mouseleave',\r\n 'touchstart',\r\n 'touchmove',\r\n 'touchleave',\r\n 'touchend',\r\n 'touchcancel' ].reduce(function (last, event) {\r\n // add event to Element\r\n const fn = function (f) {\r\n if (f === null) {\r\n off(this, event)\r\n } else {\r\n on(this, event, f)\r\n }\r\n return this\r\n }\r\n\r\n last[event] = fn\r\n return last\r\n}, {})\r\n\r\nregisterMethods('Element', methods)\r\n","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"./defineProperty\";\nexport default function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}","import { getOrigin } from '../../utils/utils.js'\r\nimport { delimiter, transforms } from '../core/regex.js'\r\nimport { registerMethods } from '../../utils/methods.js'\r\nimport Matrix from '../../types/Matrix.js'\r\n\r\n// Reset all transformations\r\nexport function untransform () {\r\n return this.attr('transform', null)\r\n}\r\n\r\n// merge the whole transformation chain into one matrix and returns it\r\nexport function matrixify () {\r\n var matrix = (this.attr('transform') || '')\r\n // split transformations\r\n .split(transforms).slice(0, -1).map(function (str) {\r\n // generate key => value pairs\r\n var kv = str.trim().split('(')\r\n return [kv[0],\r\n kv[1].split(delimiter)\r\n .map(function (str) { return parseFloat(str) })\r\n ]\r\n })\r\n .reverse()\r\n // merge every transformation into one matrix\r\n .reduce(function (matrix, transform) {\r\n if (transform[0] === 'matrix') {\r\n return matrix.lmultiply(Matrix.fromArray(transform[1]))\r\n }\r\n return matrix[transform[0]].apply(matrix, transform[1])\r\n }, new Matrix())\r\n\r\n return matrix\r\n}\r\n\r\n// add an element to another parent without changing the visual representation on the screen\r\nexport function toParent (parent) {\r\n if (this === parent) return this\r\n var ctm = this.screenCTM()\r\n var pCtm = parent.screenCTM().inverse()\r\n\r\n this.addTo(parent).untransform().transform(pCtm.multiply(ctm))\r\n\r\n return this\r\n}\r\n\r\n// same as above with parent equals root-svg\r\nexport function toRoot () {\r\n return this.toParent(this.root())\r\n}\r\n\r\n// Add transformations\r\nexport function transform (o, relative) {\r\n // Act as a getter if no object was passed\r\n if (o == null || typeof o === 'string') {\r\n var decomposed = new Matrix(this).decompose()\r\n return decomposed[o] || decomposed\r\n }\r\n\r\n if (!Matrix.isMatrixLike(o)) {\r\n // Set the origin according to the defined transform\r\n o = { ...o, origin: getOrigin(o, this) }\r\n }\r\n\r\n // The user can pass a boolean, an Element or an Matrix or nothing\r\n var cleanRelative = relative === true ? this : (relative || false)\r\n var result = new Matrix(cleanRelative).transform(o)\r\n return this.attr('transform', result)\r\n}\r\n\r\nregisterMethods('Element', {\r\n untransform, matrixify, toParent, toRoot, transform\r\n})\r\n","import SVGNumber from '../../types/SVGNumber.js'\r\n\r\n// Radius x value\r\nexport function rx (rx) {\r\n return this.attr('rx', rx)\r\n}\r\n\r\n// Radius y value\r\nexport function ry (ry) {\r\n return this.attr('ry', ry)\r\n}\r\n\r\n// Move over x-axis\r\nexport function x (x) {\r\n return x == null\r\n ? this.cx() - this.rx()\r\n : this.cx(x + this.rx())\r\n}\r\n\r\n// Move over y-axis\r\nexport function y (y) {\r\n return y == null\r\n ? this.cy() - this.ry()\r\n : this.cy(y + this.ry())\r\n}\r\n\r\n// Move by center over x-axis\r\nexport function cx (x) {\r\n return x == null\r\n ? this.attr('cx')\r\n : this.attr('cx', x)\r\n}\r\n\r\n// Move by center over y-axis\r\nexport function cy (y) {\r\n return y == null\r\n ? this.attr('cy')\r\n : this.attr('cy', y)\r\n}\r\n\r\n// Set width of element\r\nexport function width (width) {\r\n return width == null\r\n ? this.rx() * 2\r\n : this.rx(new SVGNumber(width).divide(2))\r\n}\r\n\r\n// Set height of element\r\nexport function height (height) {\r\n return height == null\r\n ? this.ry() * 2\r\n : this.ry(new SVGNumber(height).divide(2))\r\n}\r\n","import { register } from '../utils/adopter.js'\r\nimport Element from './Element.js'\r\n\r\nexport default class Shape extends Element {}\r\n\r\nregister(Shape)\r\n","import { cx, cy, height, width, x, y } from '../modules/core/circled.js'\r\nimport {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Shape from './Shape.js'\r\n\r\nexport default class Circle extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('circle', node), node)\r\n }\r\n\r\n radius (r) {\r\n return this.attr('r', r)\r\n }\r\n\r\n // Radius x value\r\n rx (rx) {\r\n return this.attr('r', rx)\r\n }\r\n\r\n // Alias radius x value\r\n ry (ry) {\r\n return this.rx(ry)\r\n }\r\n\r\n size (size) {\r\n return this.radius(new SVGNumber(size).divide(2))\r\n }\r\n}\r\n\r\nextend(Circle, { x, y, cx, cy, width, height })\r\n\r\nregisterMethods({\r\n Element: {\r\n // Create circle element\r\n circle: wrapWithAttrCheck(function (size) {\r\n return this.put(new Circle())\r\n .size(size)\r\n .move(0, 0)\r\n })\r\n }\r\n})\r\n\r\nregister(Circle)\r\n","import { register } from '../utils/adopter.js'\r\nimport Element from './Element.js'\r\n\r\nexport default class Container extends Element {\r\n flatten (parent) {\r\n this.each(function () {\r\n if (this instanceof Container) return this.flatten(parent).ungroup(parent)\r\n return this.toParent(parent)\r\n })\r\n\r\n // we need this so that the root does not get removed\r\n this.node.firstElementChild || this.remove()\r\n\r\n return this\r\n }\r\n\r\n ungroup (parent) {\r\n parent = parent || this.parent()\r\n\r\n this.each(function () {\r\n return this.toParent(parent)\r\n })\r\n\r\n this.remove()\r\n\r\n return this\r\n }\r\n}\r\n\r\nregister(Container)\r\n","import { nodeOrNew, register } from '../utils/adopter.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class Defs extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('defs', node), node)\r\n }\r\n\r\n flatten () { return this }\r\n ungroup () { return this }\r\n}\r\n\r\nregister(Defs)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Shape from './Shape.js'\r\nimport * as circled from '../modules/core/circled.js'\r\n\r\nexport default class Ellipse extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('ellipse', node), node)\r\n }\r\n\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n\r\n return this\r\n .rx(new SVGNumber(p.width).divide(2))\r\n .ry(new SVGNumber(p.height).divide(2))\r\n }\r\n}\r\n\r\nextend(Ellipse, circled)\r\n\r\nregisterMethods('Container', {\r\n // Create an ellipse\r\n ellipse: wrapWithAttrCheck(function (width, height) {\r\n return this.put(new Ellipse()).size(width, height).move(0, 0)\r\n })\r\n})\r\n\r\nregister(Ellipse)\r\n","import { nodeOrNew, register } from '../utils/adopter.js'\r\nimport Element from './Element.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\n\r\nexport default class Stop extends Element {\r\n constructor (node) {\r\n super(nodeOrNew('stop', node), node)\r\n }\r\n\r\n // add color stops\r\n update (o) {\r\n if (typeof o === 'number' || o instanceof SVGNumber) {\r\n o = {\r\n offset: arguments[0],\r\n color: arguments[1],\r\n opacity: arguments[2]\r\n }\r\n }\r\n\r\n // set attributes\r\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\r\n if (o.color != null) this.attr('stop-color', o.color)\r\n if (o.offset != null) this.attr('offset', new SVGNumber(o.offset))\r\n\r\n return this\r\n }\r\n}\r\n\r\nregister(Stop)\r\n","import SVGNumber from '../../types/SVGNumber.js'\r\n\r\nexport function from (x, y) {\r\n return (this._element || this).type === 'radialGradient'\r\n ? this.attr({ fx: new SVGNumber(x), fy: new SVGNumber(y) })\r\n : this.attr({ x1: new SVGNumber(x), y1: new SVGNumber(y) })\r\n}\r\n\r\nexport function to (x, y) {\r\n return (this._element || this).type === 'radialGradient'\r\n ? this.attr({ cx: new SVGNumber(x), cy: new SVGNumber(y) })\r\n : this.attr({ x2: new SVGNumber(x), y2: new SVGNumber(y) })\r\n}\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Box from '../types/Box.js'\r\nimport Container from './Container.js'\r\nimport Stop from './Stop.js'\r\nimport baseFind from '../modules/core/selector.js'\r\nimport * as gradiented from '../modules/core/gradiented.js'\r\n\r\nexport default class Gradient extends Container {\r\n constructor (type, attrs) {\r\n super(\r\n nodeOrNew(type + 'Gradient', typeof type === 'string' ? null : type),\r\n attrs\r\n )\r\n }\r\n\r\n // Add a color stop\r\n stop (offset, color, opacity) {\r\n return this.put(new Stop()).update(offset, color, opacity)\r\n }\r\n\r\n // Update gradient\r\n update (block) {\r\n // remove all stops\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') {\r\n block.call(this, this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Return the fill id\r\n url () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n\r\n // Alias string convertion to fill\r\n toString () {\r\n return this.url()\r\n }\r\n\r\n // custom attr to handle transform\r\n attr (a, b, c) {\r\n if (a === 'transform') a = 'gradientTransform'\r\n return super.attr(a, b, c)\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [fill*=\"' + this.id() + '\"]')\r\n }\r\n\r\n bbox () {\r\n return new Box()\r\n }\r\n}\r\n\r\nextend(Gradient, gradiented)\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create gradient element in defs\r\n gradient: wrapWithAttrCheck(function (type, block) {\r\n return this.defs().gradient(type, block)\r\n })\r\n },\r\n // define gradient\r\n Defs: {\r\n gradient: wrapWithAttrCheck(function (type, block) {\r\n return this.put(new Gradient(type)).update(block)\r\n })\r\n }\r\n})\r\n\r\nregister(Gradient)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Box from '../types/Box.js'\r\nimport Container from './Container.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class Pattern extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('pattern', node), node)\r\n }\r\n\r\n // Return the fill id\r\n url () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n\r\n // Update pattern by rebuilding\r\n update (block) {\r\n // remove content\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') {\r\n block.call(this, this)\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Alias string convertion to fill\r\n toString () {\r\n return this.url()\r\n }\r\n\r\n // custom attr to handle transform\r\n attr (a, b, c) {\r\n if (a === 'transform') a = 'patternTransform'\r\n return super.attr(a, b, c)\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [fill*=\"' + this.id() + '\"]')\r\n }\r\n\r\n bbox () {\r\n return new Box()\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create pattern element in defs\r\n pattern (...args) {\r\n return this.defs().pattern(...args)\r\n }\r\n },\r\n Defs: {\r\n pattern: wrapWithAttrCheck(function (width, height, block) {\r\n return this.put(new Pattern()).update(block).attr({\r\n x: 0,\r\n y: 0,\r\n width: width,\r\n height: height,\r\n patternUnits: 'userSpaceOnUse'\r\n })\r\n })\r\n }\r\n})\r\n\r\nregister(Pattern)\r\n","import { isImage } from '../modules/core/regex.js'\r\nimport { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { off, on } from '../modules/core/event.js'\r\nimport { registerAttrHook } from '../modules/core/attr.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Pattern from './Pattern.js'\r\nimport Shape from './Shape.js'\r\nimport { globals } from '../utils/window.js'\r\n\r\nexport default class Image extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('image', node), node)\r\n }\r\n\r\n // (re)load image\r\n load (url, callback) {\r\n if (!url) return this\r\n\r\n var img = new globals.window.Image()\r\n\r\n on(img, 'load', function (e) {\r\n var p = this.parent(Pattern)\r\n\r\n // ensure image size\r\n if (this.width() === 0 && this.height() === 0) {\r\n this.size(img.width, img.height)\r\n }\r\n\r\n if (p instanceof Pattern) {\r\n // ensure pattern size if not set\r\n if (p.width() === 0 && p.height() === 0) {\r\n p.size(this.width(), this.height())\r\n }\r\n }\r\n\r\n if (typeof callback === 'function') {\r\n callback.call(this, e)\r\n }\r\n }, this)\r\n\r\n on(img, 'load error', function () {\r\n // dont forget to unbind memory leaking events\r\n off(img)\r\n })\r\n\r\n return this.attr('href', (img.src = url), xlink)\r\n }\r\n}\r\n\r\nregisterAttrHook(function (attr, val, _this) {\r\n // convert image fill and stroke to patterns\r\n if (attr === 'fill' || attr === 'stroke') {\r\n if (isImage.test(val)) {\r\n val = _this.root().defs().image(val)\r\n }\r\n }\r\n\r\n if (val instanceof Image) {\r\n val = _this.root().defs().pattern(0, 0, (pattern) => {\r\n pattern.add(val)\r\n })\r\n }\r\n\r\n return val\r\n})\r\n\r\nregisterMethods({\r\n Container: {\r\n // create image element, load image and set its size\r\n image: wrapWithAttrCheck(function (source, callback) {\r\n return this.put(new Image()).size(0, 0).load(source, callback)\r\n })\r\n }\r\n})\r\n\r\nregister(Image)\r\n","import { delimiter } from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\nimport SVGArray from './SVGArray.js'\r\n\r\nconst PointArray = subClassArray('PointArray', SVGArray)\r\n\r\nexport default PointArray\r\n\r\nextend(PointArray, {\r\n // Convert array to string\r\n toString () {\r\n // convert to a poly point string\r\n for (var i = 0, il = this.length, array = []; i < il; i++) {\r\n array.push(this[i].join(','))\r\n }\r\n\r\n return array.join(' ')\r\n },\r\n\r\n // Convert array to line object\r\n toLine () {\r\n return {\r\n x1: this[0][0],\r\n y1: this[0][1],\r\n x2: this[1][0],\r\n y2: this[1][1]\r\n }\r\n },\r\n\r\n // Get morphed array at given position\r\n at (pos) {\r\n // make sure a destination is defined\r\n if (!this.destination) return this\r\n\r\n // generate morphed point string\r\n for (var i = 0, il = this.length, array = []; i < il; i++) {\r\n array.push([\r\n this[i][0] + (this.destination[i][0] - this[i][0]) * pos,\r\n this[i][1] + (this.destination[i][1] - this[i][1]) * pos\r\n ])\r\n }\r\n\r\n return new PointArray(array)\r\n },\r\n\r\n // Parse point string and flat array\r\n parse (array = [[0, 0]]) {\r\n var points = []\r\n\r\n // if it is an array\r\n if (array instanceof Array) {\r\n // and it is not flat, there is no need to parse it\r\n if (array[0] instanceof Array) {\r\n return array\r\n }\r\n } else { // Else, it is considered as a string\r\n // parse points\r\n array = array.trim().split(delimiter).map(parseFloat)\r\n }\r\n\r\n // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints\r\n // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.\r\n if (array.length % 2 !== 0) array.pop()\r\n\r\n // wrap points in two-tuples and parse points as floats\r\n for (var i = 0, len = array.length; i < len; i = i + 2) {\r\n points.push([ array[i], array[i + 1] ])\r\n }\r\n\r\n return points\r\n },\r\n\r\n // Move point string\r\n move (x, y) {\r\n var box = this.bbox()\r\n\r\n // get relative offset\r\n x -= box.x\r\n y -= box.y\r\n\r\n // move every point\r\n if (!isNaN(x) && !isNaN(y)) {\r\n for (var i = this.length - 1; i >= 0; i--) {\r\n this[i] = [this[i][0] + x, this[i][1] + y]\r\n }\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Resize poly string\r\n size (width, height) {\r\n var i\r\n var box = this.bbox()\r\n\r\n // recalculate position of all points according to new size\r\n for (i = this.length - 1; i >= 0; i--) {\r\n if (box.width) this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x\r\n if (box.height) this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Get bounding box of points\r\n bbox () {\r\n var maxX = -Infinity\r\n var maxY = -Infinity\r\n var minX = Infinity\r\n var minY = Infinity\r\n this.forEach(function (el) {\r\n maxX = Math.max(el[0], maxX)\r\n maxY = Math.max(el[1], maxY)\r\n minX = Math.min(el[0], minX)\r\n minY = Math.min(el[1], minY)\r\n })\r\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\r\n }\r\n})\r\n","import PointArray from '../../types/PointArray.js'\r\n\r\nexport let MorphArray = PointArray\r\n\r\n// Move by left top corner over x-axis\r\nexport function x (x) {\r\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r\n}\r\n\r\n// Move by left top corner over y-axis\r\nexport function y (y) {\r\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r\n}\r\n\r\n// Set width of element\r\nexport function width (width) {\r\n let b = this.bbox()\r\n return width == null ? b.width : this.size(width, b.height)\r\n}\r\n\r\n// Set height of element\r\nexport function height (height) {\r\n let b = this.bbox()\r\n return height == null ? b.height : this.size(b.width, height)\r\n}\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PointArray from '../types/PointArray.js'\r\nimport Shape from './Shape.js'\r\nimport * as pointed from '../modules/core/pointed.js'\r\n\r\nexport default class Line extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('line', node), node)\r\n }\r\n\r\n // Get array\r\n array () {\r\n return new PointArray([\r\n [ this.attr('x1'), this.attr('y1') ],\r\n [ this.attr('x2'), this.attr('y2') ]\r\n ])\r\n }\r\n\r\n // Overwrite native plot() method\r\n plot (x1, y1, x2, y2) {\r\n if (x1 == null) {\r\n return this.array()\r\n } else if (typeof y1 !== 'undefined') {\r\n x1 = { x1: x1, y1: y1, x2: x2, y2: y2 }\r\n } else {\r\n x1 = new PointArray(x1).toLine()\r\n }\r\n\r\n return this.attr(x1)\r\n }\r\n\r\n // Move by left top corner\r\n move (x, y) {\r\n return this.attr(this.array().move(x, y).toLine())\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n return this.attr(this.array().size(p.width, p.height).toLine())\r\n }\r\n}\r\n\r\nextend(Line, pointed)\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a line element\r\n line: wrapWithAttrCheck(function (...args) {\r\n // make sure plot is called as a setter\r\n // x1 is not necessarily a number, it can also be an array, a string and a PointArray\r\n return Line.prototype.plot.apply(\r\n this.put(new Line())\r\n , args[0] != null ? args : [0, 0, 0, 0]\r\n )\r\n })\r\n }\r\n})\r\n\r\nregister(Line)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class Marker extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('marker', node), node)\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return this.attr('markerWidth', width)\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return this.attr('markerHeight', height)\r\n }\r\n\r\n // Set marker refX and refY\r\n ref (x, y) {\r\n return this.attr('refX', x).attr('refY', y)\r\n }\r\n\r\n // Update marker\r\n update (block) {\r\n // remove all content\r\n this.clear()\r\n\r\n // invoke passed block\r\n if (typeof block === 'function') { block.call(this, this) }\r\n\r\n return this\r\n }\r\n\r\n // Return the fill id\r\n toString () {\r\n return 'url(#' + this.id() + ')'\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n marker (...args) {\r\n // Create marker element in defs\r\n return this.defs().marker(...args)\r\n }\r\n },\r\n Defs: {\r\n // Create marker\r\n marker: wrapWithAttrCheck(function (width, height, block) {\r\n // Set default viewbox to match the width and height, set ref to cx and cy and set orient to auto\r\n return this.put(new Marker())\r\n .size(width, height)\r\n .ref(width / 2, height / 2)\r\n .viewbox(0, 0, width, height)\r\n .attr('orient', 'auto')\r\n .update(block)\r\n })\r\n },\r\n marker: {\r\n // Create and attach markers\r\n marker (marker, width, height, block) {\r\n var attr = ['marker']\r\n\r\n // Build attribute name\r\n if (marker !== 'all') attr.push(marker)\r\n attr = attr.join('-')\r\n\r\n // Set marker attribute\r\n marker = arguments[1] instanceof Marker\r\n ? arguments[1]\r\n : this.defs().marker(width, height, block)\r\n\r\n return this.attr(attr, marker)\r\n }\r\n }\r\n})\r\n\r\nregister(Marker)\r\n","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n","var core = module.exports = { version: '2.5.7' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar TO_STRING = 'toString';\nvar $toString = Function[TO_STRING];\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","'use strict';\nvar fails = require('./_fails');\n\nmodule.exports = function (method, arg) {\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call\n arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);\n });\n};\n","'use strict';\nvar $export = require('./_export');\nvar aFunction = require('./_a-function');\nvar toObject = require('./_to-object');\nvar fails = require('./_fails');\nvar $sort = [].sort;\nvar test = [1, 2, 3];\n\n$export($export.P + $export.F * (fails(function () {\n // IE8-\n test.sort(undefined);\n}) || !fails(function () {\n // V8 bug\n test.sort(null);\n // Old WebKit\n}) || !require('./_strict-method')($sort)), 'Array', {\n // 22.1.3.25 Array.prototype.sort(comparefn)\n sort: function sort(comparefn) {\n return comparefn === undefined\n ? $sort.call(toObject(this))\n : $sort.call(toObject(this), aFunction(comparefn));\n }\n});\n","import { timeline } from '../modules/core/defaults.js'\r\nimport { extend } from '../utils/adopter.js'\r\n\r\n/***\r\nBase Class\r\n==========\r\nThe base stepper class that will be\r\n***/\r\n\r\nfunction makeSetterGetter (k, f) {\r\n return function (v) {\r\n if (v == null) return this[v]\r\n this[k] = v\r\n if (f) f.call(this)\r\n return this\r\n }\r\n}\r\n\r\nexport let easing = {\r\n '-': function (pos) { return pos },\r\n '<>': function (pos) { return -Math.cos(pos * Math.PI) / 2 + 0.5 },\r\n '>': function (pos) { return Math.sin(pos * Math.PI / 2) },\r\n '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 },\r\n bezier: function (x1, y1, x2, y2) {\r\n // see https://www.w3.org/TR/css-easing-1/#cubic-bezier-algo\r\n return function (t) {\r\n if (t < 0) {\r\n if (x1 > 0) {\r\n return y1 / x1 * t\r\n } else if (x2 > 0) {\r\n return y2 / x2 * t\r\n } else {\r\n return 0\r\n }\r\n } else if (t > 1) {\r\n if (x2 < 1) {\r\n return (1 - y2) / (1 - x2) * t + (y2 - x2) / (1 - x2)\r\n } else if (x1 < 1) {\r\n return (1 - y1) / (1 - x1) * t + (y1 - x1) / (1 - x1)\r\n } else {\r\n return 1\r\n }\r\n } else {\r\n return 3 * t * (1 - t) ** 2 * y1 + 3 * t ** 2 * (1 - t) * y2 + t ** 3\r\n }\r\n }\r\n },\r\n // see https://www.w3.org/TR/css-easing-1/#step-timing-function-algo\r\n steps: function (steps, stepPosition = 'end') {\r\n // deal with \"jump-\" prefix\r\n stepPosition = stepPosition.split('-').reverse()[0]\r\n\r\n let jumps = steps\r\n if (stepPosition === 'none') {\r\n --jumps\r\n } else if (stepPosition === 'both') {\r\n ++jumps\r\n }\r\n\r\n // The beforeFlag is essentially useless\r\n return (t, beforeFlag = false) => {\r\n // Step is called currentStep in referenced url\r\n let step = Math.floor(t * steps)\r\n const jumping = (t * step) % 1 === 0\r\n\r\n if (stepPosition === 'start' || stepPosition === 'both') {\r\n ++step\r\n }\r\n\r\n if (beforeFlag && jumping) {\r\n --step\r\n }\r\n\r\n if (t >= 0 && step < 0) {\r\n step = 0\r\n }\r\n\r\n if (t <= 1 && step > jumps) {\r\n step = jumps\r\n }\r\n\r\n return step / jumps\r\n }\r\n }\r\n}\r\n\r\nexport class Stepper {\r\n done () { return false }\r\n}\r\n\r\n/***\r\nEasing Functions\r\n================\r\n***/\r\n\r\nexport class Ease extends Stepper {\r\n constructor (fn) {\r\n super()\r\n this.ease = easing[fn || timeline.ease] || fn\r\n }\r\n\r\n step (from, to, pos) {\r\n if (typeof from !== 'number') {\r\n return pos < 1 ? from : to\r\n }\r\n return from + (to - from) * this.ease(pos)\r\n }\r\n}\r\n\r\n/***\r\nController Types\r\n================\r\n***/\r\n\r\nexport class Controller extends Stepper {\r\n constructor (fn) {\r\n super()\r\n this.stepper = fn\r\n }\r\n\r\n step (current, target, dt, c) {\r\n return this.stepper(current, target, dt, c)\r\n }\r\n\r\n done (c) {\r\n return c.done\r\n }\r\n}\r\n\r\nfunction recalculate () {\r\n // Apply the default parameters\r\n var duration = (this._duration || 500) / 1000\r\n var overshoot = this._overshoot || 0\r\n\r\n // Calculate the PID natural response\r\n var eps = 1e-10\r\n var pi = Math.PI\r\n var os = Math.log(overshoot / 100 + eps)\r\n var zeta = -os / Math.sqrt(pi * pi + os * os)\r\n var wn = 3.9 / (zeta * duration)\r\n\r\n // Calculate the Spring values\r\n this.d = 2 * zeta * wn\r\n this.k = wn * wn\r\n}\r\n\r\nexport class Spring extends Controller {\r\n constructor (duration, overshoot) {\r\n super()\r\n this.duration(duration || 500)\r\n .overshoot(overshoot || 0)\r\n }\r\n\r\n step (current, target, dt, c) {\r\n if (typeof current === 'string') return current\r\n c.done = dt === Infinity\r\n if (dt === Infinity) return target\r\n if (dt === 0) return current\r\n\r\n if (dt > 100) dt = 16\r\n\r\n dt /= 1000\r\n\r\n // Get the previous velocity\r\n var velocity = c.velocity || 0\r\n\r\n // Apply the control to get the new position and store it\r\n var acceleration = -this.d * velocity - this.k * (current - target)\r\n var newPosition = current +\r\n velocity * dt +\r\n acceleration * dt * dt / 2\r\n\r\n // Store the velocity\r\n c.velocity = velocity + acceleration * dt\r\n\r\n // Figure out if we have converged, and if so, pass the value\r\n c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 0.002\r\n return c.done ? target : newPosition\r\n }\r\n}\r\n\r\nextend(Spring, {\r\n duration: makeSetterGetter('_duration', recalculate),\r\n overshoot: makeSetterGetter('_overshoot', recalculate)\r\n})\r\n\r\nexport class PID extends Controller {\r\n constructor (p, i, d, windup) {\r\n super()\r\n\r\n p = p == null ? 0.1 : p\r\n i = i == null ? 0.01 : i\r\n d = d == null ? 0 : d\r\n windup = windup == null ? 1000 : windup\r\n this.p(p).i(i).d(d).windup(windup)\r\n }\r\n\r\n step (current, target, dt, c) {\r\n if (typeof current === 'string') return current\r\n c.done = dt === Infinity\r\n\r\n if (dt === Infinity) return target\r\n if (dt === 0) return current\r\n\r\n var p = target - current\r\n var i = (c.integral || 0) + p * dt\r\n var d = (p - (c.error || 0)) / dt\r\n var windup = this.windup\r\n\r\n // antiwindup\r\n if (windup !== false) {\r\n i = Math.max(-windup, Math.min(i, windup))\r\n }\r\n\r\n c.error = p\r\n c.integral = i\r\n\r\n c.done = Math.abs(p) < 0.001\r\n\r\n return c.done ? target : current + (this.P * p + this.I * i + this.D * d)\r\n }\r\n}\r\n\r\nextend(PID, {\r\n windup: makeSetterGetter('windup'),\r\n p: makeSetterGetter('P'),\r\n i: makeSetterGetter('I'),\r\n d: makeSetterGetter('D')\r\n})\r\n","import {\r\n delimiter,\r\n dots,\r\n hyphen,\r\n isPathLetter,\r\n numbersWithDots,\r\n pathLetters\r\n} from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { subClassArray } from './ArrayPolyfill.js'\r\nimport Point from './Point.js'\r\nimport SVGArray from './SVGArray.js'\r\nimport parser from '../modules/core/parser.js'\r\n\r\nconst PathArray = subClassArray('PathArray', SVGArray)\r\n\r\nexport default PathArray\r\n\r\nexport function pathRegReplace (a, b, c, d) {\r\n return c + d.replace(dots, ' .')\r\n}\r\n\r\nfunction arrayToString (a) {\r\n for (var i = 0, il = a.length, s = ''; i < il; i++) {\r\n s += a[i][0]\r\n\r\n if (a[i][1] != null) {\r\n s += a[i][1]\r\n\r\n if (a[i][2] != null) {\r\n s += ' '\r\n s += a[i][2]\r\n\r\n if (a[i][3] != null) {\r\n s += ' '\r\n s += a[i][3]\r\n s += ' '\r\n s += a[i][4]\r\n\r\n if (a[i][5] != null) {\r\n s += ' '\r\n s += a[i][5]\r\n s += ' '\r\n s += a[i][6]\r\n\r\n if (a[i][7] != null) {\r\n s += ' '\r\n s += a[i][7]\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return s + ' '\r\n}\r\n\r\nconst pathHandlers = {\r\n M: function (c, p, p0) {\r\n p.x = p0.x = c[0]\r\n p.y = p0.y = c[1]\r\n\r\n return ['M', p.x, p.y]\r\n },\r\n L: function (c, p) {\r\n p.x = c[0]\r\n p.y = c[1]\r\n return ['L', c[0], c[1]]\r\n },\r\n H: function (c, p) {\r\n p.x = c[0]\r\n return ['H', c[0]]\r\n },\r\n V: function (c, p) {\r\n p.y = c[0]\r\n return ['V', c[0]]\r\n },\r\n C: function (c, p) {\r\n p.x = c[4]\r\n p.y = c[5]\r\n return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]\r\n },\r\n S: function (c, p) {\r\n p.x = c[2]\r\n p.y = c[3]\r\n return ['S', c[0], c[1], c[2], c[3]]\r\n },\r\n Q: function (c, p) {\r\n p.x = c[2]\r\n p.y = c[3]\r\n return ['Q', c[0], c[1], c[2], c[3]]\r\n },\r\n T: function (c, p) {\r\n p.x = c[0]\r\n p.y = c[1]\r\n return ['T', c[0], c[1]]\r\n },\r\n Z: function (c, p, p0) {\r\n p.x = p0.x\r\n p.y = p0.y\r\n return ['Z']\r\n },\r\n A: function (c, p) {\r\n p.x = c[5]\r\n p.y = c[6]\r\n return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]\r\n }\r\n}\r\n\r\nlet mlhvqtcsaz = 'mlhvqtcsaz'.split('')\r\n\r\nfor (var i = 0, il = mlhvqtcsaz.length; i < il; ++i) {\r\n pathHandlers[mlhvqtcsaz[i]] = (function (i) {\r\n return function (c, p, p0) {\r\n if (i === 'H') c[0] = c[0] + p.x\r\n else if (i === 'V') c[0] = c[0] + p.y\r\n else if (i === 'A') {\r\n c[5] = c[5] + p.x\r\n c[6] = c[6] + p.y\r\n } else {\r\n for (var j = 0, jl = c.length; j < jl; ++j) {\r\n c[j] = c[j] + (j % 2 ? p.y : p.x)\r\n }\r\n }\r\n\r\n return pathHandlers[i](c, p, p0)\r\n }\r\n })(mlhvqtcsaz[i].toUpperCase())\r\n}\r\n\r\nextend(PathArray, {\r\n // Convert array to string\r\n toString () {\r\n return arrayToString(this)\r\n },\r\n\r\n // Move path string\r\n move (x, y) {\r\n // get bounding box of current situation\r\n var box = this.bbox()\r\n\r\n // get relative offset\r\n x -= box.x\r\n y -= box.y\r\n\r\n if (!isNaN(x) && !isNaN(y)) {\r\n // move every point\r\n for (var l, i = this.length - 1; i >= 0; i--) {\r\n l = this[i][0]\r\n\r\n if (l === 'M' || l === 'L' || l === 'T') {\r\n this[i][1] += x\r\n this[i][2] += y\r\n } else if (l === 'H') {\r\n this[i][1] += x\r\n } else if (l === 'V') {\r\n this[i][1] += y\r\n } else if (l === 'C' || l === 'S' || l === 'Q') {\r\n this[i][1] += x\r\n this[i][2] += y\r\n this[i][3] += x\r\n this[i][4] += y\r\n\r\n if (l === 'C') {\r\n this[i][5] += x\r\n this[i][6] += y\r\n }\r\n } else if (l === 'A') {\r\n this[i][6] += x\r\n this[i][7] += y\r\n }\r\n }\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Resize path string\r\n size (width, height) {\r\n // get bounding box of current situation\r\n var box = this.bbox()\r\n var i, l\r\n\r\n // recalculate position of all points according to new size\r\n for (i = this.length - 1; i >= 0; i--) {\r\n l = this[i][0]\r\n\r\n if (l === 'M' || l === 'L' || l === 'T') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\r\n } else if (l === 'H') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n } else if (l === 'V') {\r\n this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y\r\n } else if (l === 'C' || l === 'S' || l === 'Q') {\r\n this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x\r\n this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y\r\n this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x\r\n this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y\r\n\r\n if (l === 'C') {\r\n this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x\r\n this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y\r\n }\r\n } else if (l === 'A') {\r\n // resize radii\r\n this[i][1] = (this[i][1] * width) / box.width\r\n this[i][2] = (this[i][2] * height) / box.height\r\n\r\n // move position values\r\n this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x\r\n this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y\r\n }\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Test if the passed path array use the same path data commands as this path array\r\n equalCommands (pathArray) {\r\n var i, il, equalCommands\r\n\r\n pathArray = new PathArray(pathArray)\r\n\r\n equalCommands = this.length === pathArray.length\r\n for (i = 0, il = this.length; equalCommands && i < il; i++) {\r\n equalCommands = this[i][0] === pathArray[i][0]\r\n }\r\n\r\n return equalCommands\r\n },\r\n\r\n // Make path array morphable\r\n morph (pathArray) {\r\n pathArray = new PathArray(pathArray)\r\n\r\n if (this.equalCommands(pathArray)) {\r\n this.destination = pathArray\r\n } else {\r\n this.destination = null\r\n }\r\n\r\n return this\r\n },\r\n\r\n // Get morphed path array at given position\r\n at (pos) {\r\n // make sure a destination is defined\r\n if (!this.destination) return this\r\n\r\n var sourceArray = this\r\n var destinationArray = this.destination.value\r\n var array = []\r\n var pathArray = new PathArray()\r\n var i, il, j, jl\r\n\r\n // Animate has specified in the SVG spec\r\n // See: https://www.w3.org/TR/SVG11/paths.html#PathElement\r\n for (i = 0, il = sourceArray.length; i < il; i++) {\r\n array[i] = [sourceArray[i][0]]\r\n for (j = 1, jl = sourceArray[i].length; j < jl; j++) {\r\n array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos\r\n }\r\n // For the two flags of the elliptical arc command, the SVG spec say:\r\n // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true\r\n // Elliptical arc command as an array followed by corresponding indexes:\r\n // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y]\r\n // 0 1 2 3 4 5 6 7\r\n if (array[i][0] === 'A') {\r\n array[i][4] = +(array[i][4] !== 0)\r\n array[i][5] = +(array[i][5] !== 0)\r\n }\r\n }\r\n\r\n // Directly modify the value of a path array, this is done this way for performance\r\n pathArray.value = array\r\n return pathArray\r\n },\r\n\r\n // Absolutize and parse path to array\r\n parse (array = [['M', 0, 0]]) {\r\n // if it's already a patharray, no need to parse it\r\n if (array instanceof PathArray) return array\r\n\r\n // prepare for parsing\r\n var s\r\n var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 }\r\n\r\n if (typeof array === 'string') {\r\n array = array\r\n .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123\r\n .replace(pathLetters, ' $& ') // put some room between letters and numbers\r\n .replace(hyphen, '$1 -') // add space before hyphen\r\n .trim() // trim\r\n .split(delimiter) // split into array\r\n } else {\r\n array = array.reduce(function (prev, curr) {\r\n return [].concat.call(prev, curr)\r\n }, [])\r\n }\r\n\r\n // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...]\r\n var result = []\r\n var p = new Point()\r\n var p0 = new Point()\r\n var index = 0\r\n var len = array.length\r\n\r\n do {\r\n // Test if we have a path letter\r\n if (isPathLetter.test(array[index])) {\r\n s = array[index]\r\n ++index\r\n // If last letter was a move command and we got no new, it defaults to [L]ine\r\n } else if (s === 'M') {\r\n s = 'L'\r\n } else if (s === 'm') {\r\n s = 'l'\r\n }\r\n\r\n result.push(pathHandlers[s].call(null,\r\n array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat),\r\n p, p0\r\n )\r\n )\r\n } while (len > index)\r\n\r\n return result\r\n },\r\n\r\n // Get bounding box of path\r\n bbox () {\r\n parser().path.setAttribute('d', this.toString())\r\n return parser.nodes.path.getBBox()\r\n }\r\n})\r\n","import { Ease } from './Controller.js'\r\nimport {\r\n delimiter,\r\n numberAndUnit,\r\n pathLetters\r\n} from '../modules/core/regex.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport Color from '../types/Color.js'\r\nimport PathArray from '../types/PathArray.js'\r\nimport SVGArray from '../types/SVGArray.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\n\r\nexport default class Morphable {\r\n constructor (stepper) {\r\n this._stepper = stepper || new Ease('-')\r\n\r\n this._from = null\r\n this._to = null\r\n this._type = null\r\n this._context = null\r\n this._morphObj = null\r\n }\r\n\r\n from (val) {\r\n if (val == null) {\r\n return this._from\r\n }\r\n\r\n this._from = this._set(val)\r\n return this\r\n }\r\n\r\n to (val) {\r\n if (val == null) {\r\n return this._to\r\n }\r\n\r\n this._to = this._set(val)\r\n return this\r\n }\r\n\r\n type (type) {\r\n // getter\r\n if (type == null) {\r\n return this._type\r\n }\r\n\r\n // setter\r\n this._type = type\r\n return this\r\n }\r\n\r\n _set (value) {\r\n if (!this._type) {\r\n var type = typeof value\r\n\r\n if (type === 'number') {\r\n this.type(SVGNumber)\r\n } else if (type === 'string') {\r\n if (Color.isColor(value)) {\r\n this.type(Color)\r\n } else if (delimiter.test(value)) {\r\n this.type(pathLetters.test(value)\r\n ? PathArray\r\n : SVGArray\r\n )\r\n } else if (numberAndUnit.test(value)) {\r\n this.type(SVGNumber)\r\n } else {\r\n this.type(NonMorphable)\r\n }\r\n } else if (morphableTypes.indexOf(value.constructor) > -1) {\r\n this.type(value.constructor)\r\n } else if (Array.isArray(value)) {\r\n this.type(SVGArray)\r\n } else if (type === 'object') {\r\n this.type(ObjectBag)\r\n } else {\r\n this.type(NonMorphable)\r\n }\r\n }\r\n\r\n var result = (new this._type(value)).toArray()\r\n this._morphObj = this._morphObj || new this._type()\r\n this._context = this._context ||\r\n Array.apply(null, Array(result.length)).map(Object)\r\n return result\r\n }\r\n\r\n stepper (stepper) {\r\n if (stepper == null) return this._stepper\r\n this._stepper = stepper\r\n return this\r\n }\r\n\r\n done () {\r\n var complete = this._context\r\n .map(this._stepper.done)\r\n .reduce(function (last, curr) {\r\n return last && curr\r\n }, true)\r\n return complete\r\n }\r\n\r\n at (pos) {\r\n var _this = this\r\n\r\n return this._morphObj.fromArray(\r\n this._from.map(function (i, index) {\r\n return _this._stepper.step(i, _this._to[index], pos, _this._context[index], _this._context)\r\n })\r\n )\r\n }\r\n}\r\n\r\nexport class NonMorphable {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (val) {\r\n val = Array.isArray(val) ? val[0] : val\r\n this.value = val\r\n return this\r\n }\r\n\r\n valueOf () {\r\n return this.value\r\n }\r\n\r\n toArray () {\r\n return [this.value]\r\n }\r\n}\r\n\r\nexport class TransformBag {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (obj) {\r\n if (Array.isArray(obj)) {\r\n obj = {\r\n scaleX: obj[0],\r\n scaleY: obj[1],\r\n shear: obj[2],\r\n rotate: obj[3],\r\n translateX: obj[4],\r\n translateY: obj[5],\r\n originX: obj[6],\r\n originY: obj[7]\r\n }\r\n }\r\n\r\n Object.assign(this, TransformBag.defaults, obj)\r\n return this\r\n }\r\n\r\n toArray () {\r\n var v = this\r\n\r\n return [\r\n v.scaleX,\r\n v.scaleY,\r\n v.shear,\r\n v.rotate,\r\n v.translateX,\r\n v.translateY,\r\n v.originX,\r\n v.originY\r\n ]\r\n }\r\n}\r\n\r\nTransformBag.defaults = {\r\n scaleX: 1,\r\n scaleY: 1,\r\n shear: 0,\r\n rotate: 0,\r\n translateX: 0,\r\n translateY: 0,\r\n originX: 0,\r\n originY: 0\r\n}\r\n\r\nexport class ObjectBag {\r\n constructor (...args) {\r\n this.init(...args)\r\n }\r\n\r\n init (objOrArr) {\r\n this.values = []\r\n\r\n if (Array.isArray(objOrArr)) {\r\n this.values = objOrArr\r\n return\r\n }\r\n\r\n objOrArr = objOrArr || {}\r\n var entries = []\r\n\r\n for (let i in objOrArr) {\r\n entries.push([i, objOrArr[i]])\r\n }\r\n\r\n entries.sort((a, b) => {\r\n return a[0] - b[0]\r\n })\r\n\r\n this.values = entries.reduce((last, curr) => last.concat(curr), [])\r\n return this\r\n }\r\n\r\n valueOf () {\r\n var obj = {}\r\n var arr = this.values\r\n\r\n for (var i = 0, len = arr.length; i < len; i += 2) {\r\n obj[arr[i]] = arr[i + 1]\r\n }\r\n\r\n return obj\r\n }\r\n\r\n toArray () {\r\n return this.values\r\n }\r\n}\r\n\r\nconst morphableTypes = [\r\n NonMorphable,\r\n TransformBag,\r\n ObjectBag\r\n]\r\n\r\nexport function registerMorphableType (type = []) {\r\n morphableTypes.push(...[].concat(type))\r\n}\r\n\r\nexport function makeMorphable () {\r\n extend(morphableTypes, {\r\n to (val) {\r\n return new Morphable()\r\n .type(this.constructor)\r\n .from(this.valueOf())\r\n .to(val)\r\n },\r\n fromArray (arr) {\r\n this.init(arr)\r\n return this\r\n }\r\n })\r\n}\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { proportionalSize } from '../utils/utils.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PathArray from '../types/PathArray.js'\r\nimport Shape from './Shape.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class Path extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('path', node), node)\r\n }\r\n\r\n // Get array\r\n array () {\r\n return this._array || (this._array = new PathArray(this.attr('d')))\r\n }\r\n\r\n // Plot new path\r\n plot (d) {\r\n return (d == null) ? this.array()\r\n : this.clear().attr('d', typeof d === 'string' ? d : (this._array = new PathArray(d)))\r\n }\r\n\r\n // Clear array cache\r\n clear () {\r\n delete this._array\r\n return this\r\n }\r\n\r\n // Move by left top corner\r\n move (x, y) {\r\n return this.attr('d', this.array().move(x, y))\r\n }\r\n\r\n // Move by left top corner over x-axis\r\n x (x) {\r\n return x == null ? this.bbox().x : this.move(x, this.bbox().y)\r\n }\r\n\r\n // Move by left top corner over y-axis\r\n y (y) {\r\n return y == null ? this.bbox().y : this.move(this.bbox().x, y)\r\n }\r\n\r\n // Set element size to given width and height\r\n size (width, height) {\r\n var p = proportionalSize(this, width, height)\r\n return this.attr('d', this.array().size(p.width, p.height))\r\n }\r\n\r\n // Set width of element\r\n width (width) {\r\n return width == null ? this.bbox().width : this.size(width, this.bbox().height)\r\n }\r\n\r\n // Set height of element\r\n height (height) {\r\n return height == null ? this.bbox().height : this.size(this.bbox().width, height)\r\n }\r\n\r\n targets () {\r\n return baseFind('svg textpath [href*=\"' + this.id() + '\"]')\r\n }\r\n}\r\n\r\n// Define morphable array\r\nPath.prototype.MorphArray = PathArray\r\n\r\n// Add parent method\r\nregisterMethods({\r\n Container: {\r\n // Create a wrapped path element\r\n path: wrapWithAttrCheck(function (d) {\r\n // make sure plot is called as a setter\r\n return this.put(new Path()).plot(d || new PathArray())\r\n })\r\n }\r\n})\r\n\r\nregister(Path)\r\n","import { proportionalSize } from '../../utils/utils.js'\r\nimport PointArray from '../../types/PointArray.js'\r\n\r\n// Get array\r\nexport function array () {\r\n return this._array || (this._array = new PointArray(this.attr('points')))\r\n}\r\n\r\n// Plot new path\r\nexport function plot (p) {\r\n return (p == null) ? this.array()\r\n : this.clear().attr('points', typeof p === 'string' ? p\r\n : (this._array = new PointArray(p)))\r\n}\r\n\r\n// Clear array cache\r\nexport function clear () {\r\n delete this._array\r\n return this\r\n}\r\n\r\n// Move by left top corner\r\nexport function move (x, y) {\r\n return this.attr('points', this.array().move(x, y))\r\n}\r\n\r\n// Set element size to given width and height\r\nexport function size (width, height) {\r\n let p = proportionalSize(this, width, height)\r\n return this.attr('points', this.array().size(p.width, p.height))\r\n}\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PointArray from '../types/PointArray.js'\r\nimport Shape from './Shape.js'\r\nimport * as pointed from '../modules/core/pointed.js'\r\nimport * as poly from '../modules/core/poly.js'\r\n\r\nexport default class Polygon extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('polygon', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a wrapped polygon element\r\n polygon: wrapWithAttrCheck(function (p) {\r\n // make sure plot is called as a setter\r\n return this.put(new Polygon()).plot(p || new PointArray())\r\n })\r\n }\r\n})\r\n\r\nextend(Polygon, pointed)\r\nextend(Polygon, poly)\r\nregister(Polygon)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport PointArray from '../types/PointArray.js'\r\nimport Shape from './Shape.js'\r\nimport * as pointed from '../modules/core/pointed.js'\r\nimport * as poly from '../modules/core/poly.js'\r\n\r\nexport default class Polyline extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('polyline', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a wrapped polygon element\r\n polyline: wrapWithAttrCheck(function (p) {\r\n // make sure plot is called as a setter\r\n return this.put(new Polyline()).plot(p || new PointArray())\r\n })\r\n }\r\n})\r\n\r\nextend(Polyline, pointed)\r\nextend(Polyline, poly)\r\nregister(Polyline)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { rx, ry } from '../modules/core/circled.js'\r\nimport Shape from './Shape.js'\r\n\r\nexport default class Rect extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('rect', node), node)\r\n }\r\n}\r\n\r\nextend(Rect, { rx, ry })\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a rect element\r\n rect: wrapWithAttrCheck(function (width, height) {\r\n return this.put(new Rect()).size(width, height)\r\n })\r\n }\r\n})\r\n\r\nregister(Rect)\r\n","export default class Queue {\r\n constructor () {\r\n this._first = null\r\n this._last = null\r\n }\r\n\r\n push (value) {\r\n // An item stores an id and the provided value\r\n var item = value.next ? value : { value: value, next: null, prev: null }\r\n\r\n // Deal with the queue being empty or populated\r\n if (this._last) {\r\n item.prev = this._last\r\n this._last.next = item\r\n this._last = item\r\n } else {\r\n this._last = item\r\n this._first = item\r\n }\r\n\r\n // Update the length and return the current item\r\n return item\r\n }\r\n\r\n shift () {\r\n // Check if we have a value\r\n var remove = this._first\r\n if (!remove) return null\r\n\r\n // If we do, remove it and relink things\r\n this._first = remove.next\r\n if (this._first) this._first.prev = null\r\n this._last = this._first ? this._last : null\r\n return remove.value\r\n }\r\n\r\n // Shows us the first item in the list\r\n first () {\r\n return this._first && this._first.value\r\n }\r\n\r\n // Shows us the last item in the list\r\n last () {\r\n return this._last && this._last.value\r\n }\r\n\r\n // Removes the item that was returned from the push\r\n remove (item) {\r\n // Relink the previous item\r\n if (item.prev) item.prev.next = item.next\r\n if (item.next) item.next.prev = item.prev\r\n if (item === this._last) this._last = item.prev\r\n if (item === this._first) this._first = item.next\r\n\r\n // Invalidate item\r\n item.prev = null\r\n item.next = null\r\n }\r\n}\r\n","import { globals } from '../utils/window.js'\r\nimport Queue from './Queue.js'\r\n\r\nconst Animator = {\r\n nextDraw: null,\r\n frames: new Queue(),\r\n timeouts: new Queue(),\r\n timer: globals.window.performance || globals.window.Date,\r\n transforms: [],\r\n\r\n frame (fn) {\r\n // Store the node\r\n var node = Animator.frames.push({ run: fn })\r\n\r\n // Request an animation frame if we don't have one\r\n if (Animator.nextDraw === null) {\r\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\r\n }\r\n\r\n // Return the node so we can remove it easily\r\n return node\r\n },\r\n\r\n transform_frame (fn, id) {\r\n Animator.transforms[id] = fn\r\n },\r\n\r\n timeout (fn, delay) {\r\n delay = delay || 0\r\n\r\n // Work out when the event should fire\r\n var time = Animator.timer.now() + delay\r\n\r\n // Add the timeout to the end of the queue\r\n var node = Animator.timeouts.push({ run: fn, time: time })\r\n\r\n // Request another animation frame if we need one\r\n if (Animator.nextDraw === null) {\r\n Animator.nextDraw = globals.window.requestAnimationFrame(Animator._draw)\r\n }\r\n\r\n return node\r\n },\r\n\r\n cancelFrame (node) {\r\n node != null && Animator.frames.remove(node)\r\n },\r\n\r\n clearTimeout (node) {\r\n node != null && Animator.timeouts.remove(node)\r\n },\r\n\r\n _draw (now) {\r\n // Run all the timeouts we can run, if they are not ready yet, add them\r\n // to the end of the queue immediately! (bad timeouts!!! [sarcasm])\r\n var nextTimeout = null\r\n var lastTimeout = Animator.timeouts.last()\r\n while ((nextTimeout = Animator.timeouts.shift())) {\r\n // Run the timeout if its time, or push it to the end\r\n if (now >= nextTimeout.time) {\r\n nextTimeout.run()\r\n } else {\r\n Animator.timeouts.push(nextTimeout)\r\n }\r\n\r\n // If we hit the last item, we should stop shifting out more items\r\n if (nextTimeout === lastTimeout) break\r\n }\r\n\r\n // Run all of the animation frames\r\n var nextFrame = null\r\n var lastFrame = Animator.frames.last()\r\n while ((nextFrame !== lastFrame) && (nextFrame = Animator.frames.shift())) {\r\n nextFrame.run()\r\n }\r\n\r\n Animator.transforms.forEach(function (el) { el() })\r\n\r\n // If we have remaining timeouts or frames, draw until we don't anymore\r\n Animator.nextDraw = Animator.timeouts.first() || Animator.frames.first()\r\n ? globals.window.requestAnimationFrame(Animator._draw)\r\n : null\r\n }\r\n}\r\n\r\nexport default Animator\r\n","import { globals } from '../utils/window.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Animator from './Animator.js'\r\nimport EventTarget from '../types/EventTarget.js'\r\n\r\nvar makeSchedule = function (runnerInfo) {\r\n var start = runnerInfo.start\r\n var duration = runnerInfo.runner.duration()\r\n var end = start + duration\r\n return { start: start, duration: duration, end: end, runner: runnerInfo.runner }\r\n}\r\n\r\nconst defaultSource = function () {\r\n let w = globals.window\r\n return (w.performance || w.Date).now()\r\n}\r\n\r\nexport default class Timeline extends EventTarget {\r\n // Construct a new timeline on the given element\r\n constructor (timeSource = defaultSource) {\r\n super()\r\n\r\n this._timeSource = timeSource\r\n\r\n // Store the timing variables\r\n this._startTime = 0\r\n this._speed = 1.0\r\n\r\n // Determines how long a runner is hold in memory. Can be a dt or true/false\r\n this._persist = 0\r\n\r\n // Keep track of the running animations and their starting parameters\r\n this._nextFrame = null\r\n this._paused = true\r\n this._runners = []\r\n this._order = []\r\n this._time = 0\r\n this._lastSourceTime = 0\r\n this._lastStepTime = 0\r\n\r\n // Make sure that step is always called in class context\r\n this._step = this._step.bind(this)\r\n }\r\n\r\n // schedules a runner on the timeline\r\n schedule (runner, delay, when) {\r\n if (runner == null) {\r\n return this._runners.map(makeSchedule).sort(function (a, b) {\r\n return a.runner.id - b.runner.id\r\n })\r\n }\r\n\r\n // The start time for the next animation can either be given explicitly,\r\n // derived from the current timeline time or it can be relative to the\r\n // last start time to chain animations direclty\r\n\r\n var absoluteStartTime = 0\r\n var endTime = this.getEndTime()\r\n delay = delay || 0\r\n\r\n // Work out when to start the animation\r\n if (when == null || when === 'last' || when === 'after') {\r\n // Take the last time and increment\r\n absoluteStartTime = endTime\r\n } else if (when === 'absolute' || when === 'start') {\r\n absoluteStartTime = delay\r\n delay = 0\r\n } else if (when === 'now') {\r\n absoluteStartTime = this._time\r\n } else if (when === 'relative') {\r\n let runnerInfo = this._runners[runner.id]\r\n if (runnerInfo) {\r\n absoluteStartTime = runnerInfo.start + delay\r\n delay = 0\r\n }\r\n } else {\r\n throw new Error('Invalid value for the \"when\" parameter')\r\n }\r\n\r\n // Manage runner\r\n runner.unschedule()\r\n runner.timeline(this)\r\n // runner.time(-delay)\r\n\r\n // Save runnerInfo\r\n this._runners[runner.id] = {\r\n persist: this.persist(),\r\n runner: runner,\r\n start: absoluteStartTime + delay\r\n }\r\n\r\n // Save order, update Time if needed and continue\r\n this._order.push(runner.id)\r\n this.updateTime()._continue()\r\n return this\r\n }\r\n\r\n // Remove the runner from this timeline\r\n unschedule (runner) {\r\n var index = this._order.indexOf(runner.id)\r\n if (index < 0) return this\r\n\r\n delete this._runners[runner.id]\r\n this._order.splice(index, 1)\r\n runner.timeline(null)\r\n return this\r\n }\r\n\r\n // Calculates the end of the timeline\r\n getEndTime () {\r\n var lastRunnerInfo = this._runners[this._order[this._order.length - 1]]\r\n var lastDuration = lastRunnerInfo ? lastRunnerInfo.runner.duration() : 0\r\n var lastStartTime = lastRunnerInfo ? lastRunnerInfo.start : 0\r\n return lastStartTime + lastDuration\r\n }\r\n\r\n // Makes sure, that after pausing the time doesn't jump\r\n updateTime () {\r\n if (!this.active()) {\r\n this._lastSourceTime = this._timeSource()\r\n }\r\n return this\r\n }\r\n\r\n play () {\r\n // Now make sure we are not paused and continue the animation\r\n this._paused = false\r\n return this.updateTime()._continue()\r\n }\r\n\r\n pause () {\r\n this._paused = true\r\n return this._continue()\r\n }\r\n\r\n stop () {\r\n // Go to start and pause\r\n this.time(0)\r\n return this.pause()\r\n }\r\n\r\n finish () {\r\n // Go to end and pause\r\n this.time(this.getEndTime() + 1)\r\n return this.pause()\r\n }\r\n\r\n speed (speed) {\r\n if (speed == null) return this._speed\r\n this._speed = speed\r\n return this\r\n }\r\n\r\n reverse (yes) {\r\n var currentSpeed = this.speed()\r\n if (yes == null) return this.speed(-currentSpeed)\r\n\r\n var positive = Math.abs(currentSpeed)\r\n return this.speed(yes ? positive : -positive)\r\n }\r\n\r\n seek (dt) {\r\n return this.time(this._time + dt)\r\n }\r\n\r\n time (time) {\r\n if (time == null) return this._time\r\n this._time = time\r\n return this._continue(true)\r\n }\r\n\r\n persist (dtOrForever) {\r\n if (dtOrForever == null) return this._persist\r\n this._persist = dtOrForever\r\n return this\r\n }\r\n\r\n source (fn) {\r\n if (fn == null) return this._timeSource\r\n this._timeSource = fn\r\n return this\r\n }\r\n\r\n _step (immediateStep = false) {\r\n // Get the time delta from the last time and update the time\r\n var time = this._timeSource()\r\n var dtSource = time - this._lastSourceTime\r\n\r\n if (immediateStep) dtSource = 0\r\n\r\n var dtTime = this._speed * dtSource + (this._time - this._lastStepTime)\r\n this._lastSourceTime = time\r\n\r\n // Only update the time if we use the timeSource.\r\n // Otherwise use the current time\r\n if (!immediateStep) {\r\n // Update the time\r\n this._time += dtTime\r\n this._time = this._time < 0 ? 0 : this._time\r\n }\r\n this._lastStepTime = this._time\r\n this.fire('time', this._time)\r\n\r\n // Run all of the runners directly\r\n var runnersLeft = false\r\n for (var i = 0, len = this._order.length; i < len; i++) {\r\n // Get and run the current runner and ignore it if its inactive\r\n var runnerInfo = this._runners[this._order[i]]\r\n var runner = runnerInfo.runner\r\n let dt = dtTime\r\n\r\n // Make sure that we give the actual difference\r\n // between runner start time and now\r\n let dtToStart = this._time - runnerInfo.start\r\n\r\n // Dont run runner if not started yet\r\n if (dtToStart <= 0) {\r\n runnersLeft = true\r\n\r\n // This is for the case that teh timeline was seeked so that the time\r\n // is now before the startTime of the runner. Thats why we need to set\r\n // the runner to position 0\r\n runner.reset()\r\n continue\r\n } else if (dtToStart < dt) {\r\n // Adjust dt to make sure that animation is on point\r\n dt = dtToStart\r\n }\r\n\r\n if (!runner.active()) continue\r\n\r\n // If this runner is still going, signal that we need another animation\r\n // frame, otherwise, remove the completed runner\r\n var finished = runner.step(dt).done\r\n if (!finished) {\r\n runnersLeft = true\r\n // continue\r\n } else if (runnerInfo.persist !== true) {\r\n // runner is finished. And runner might get removed\r\n\r\n var endTime = runner.duration() - runner.time() + this._time\r\n\r\n if (endTime + this._persist < this._time) {\r\n // Delete runner and correct index\r\n delete this._runners[this._order[i]]\r\n this._order.splice(i--, 1) && --len\r\n runner.timeline(null)\r\n }\r\n }\r\n }\r\n\r\n // Basically: we continue when there are runners right from us in time\r\n // when -->, and when runners are left from us when <--\r\n if ((runnersLeft && !(this._speed < 0 && this._time === 0)) || (this._order.length && this._speed < 0 && this._time > 0)) {\r\n this._continue()\r\n } else {\r\n this.fire('finished')\r\n this.pause()\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Checks if we are running and continues the animation\r\n _continue (immediateStep = false) {\r\n Animator.cancelFrame(this._nextFrame)\r\n this._nextFrame = null\r\n\r\n if (immediateStep) return this._step(true)\r\n if (this._paused) return this\r\n\r\n this._nextFrame = Animator.frame(this._step)\r\n return this\r\n }\r\n\r\n active () {\r\n return !!this._nextFrame\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Element: {\r\n timeline: function () {\r\n this._timeline = (this._timeline || new Timeline())\r\n return this._timeline\r\n }\r\n }\r\n})\r\n","import { Controller, Ease, Stepper } from './Controller.js'\r\nimport { extend } from '../utils/adopter.js'\r\nimport { from, to } from '../modules/core/gradiented.js'\r\nimport { getOrigin } from '../utils/utils.js'\r\nimport { noop, timeline } from '../modules/core/defaults.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { rx, ry } from '../modules/core/circled.js'\r\nimport Animator from './Animator.js'\r\nimport Box from '../types/Box.js'\r\nimport EventTarget from '../types/EventTarget.js'\r\nimport Matrix from '../types/Matrix.js'\r\nimport Morphable, { TransformBag } from './Morphable.js'\r\nimport Point from '../types/Point.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Timeline from './Timeline.js'\r\n\r\nexport default class Runner extends EventTarget {\r\n constructor (options) {\r\n super()\r\n\r\n // Store a unique id on the runner, so that we can identify it later\r\n this.id = Runner.id++\r\n\r\n // Ensure a default value\r\n options = options == null\r\n ? timeline.duration\r\n : options\r\n\r\n // Ensure that we get a controller\r\n options = typeof options === 'function'\r\n ? new Controller(options)\r\n : options\r\n\r\n // Declare all of the variables\r\n this._element = null\r\n this._timeline = null\r\n this.done = false\r\n this._queue = []\r\n\r\n // Work out the stepper and the duration\r\n this._duration = typeof options === 'number' && options\r\n this._isDeclarative = options instanceof Controller\r\n this._stepper = this._isDeclarative ? options : new Ease()\r\n\r\n // We copy the current values from the timeline because they can change\r\n this._history = {}\r\n\r\n // Store the state of the runner\r\n this.enabled = true\r\n this._time = 0\r\n this._lastTime = 0\r\n\r\n // At creation, the runner is in reseted state\r\n this._reseted = true\r\n\r\n // Save transforms applied to this runner\r\n this.transforms = new Matrix()\r\n this.transformId = 1\r\n\r\n // Looping variables\r\n this._haveReversed = false\r\n this._reverse = false\r\n this._loopsDone = 0\r\n this._swing = false\r\n this._wait = 0\r\n this._times = 1\r\n }\r\n\r\n /*\r\n Runner Definitions\r\n ==================\r\n These methods help us define the runtime behaviour of the Runner or they\r\n help us make new runners from the current runner\r\n */\r\n\r\n element (element) {\r\n if (element == null) return this._element\r\n this._element = element\r\n element._prepareRunner()\r\n return this\r\n }\r\n\r\n timeline (timeline) {\r\n // check explicitly for undefined so we can set the timeline to null\r\n if (typeof timeline === 'undefined') return this._timeline\r\n this._timeline = timeline\r\n return this\r\n }\r\n\r\n animate (duration, delay, when) {\r\n var o = Runner.sanitise(duration, delay, when)\r\n var runner = new Runner(o.duration)\r\n if (this._timeline) runner.timeline(this._timeline)\r\n if (this._element) runner.element(this._element)\r\n return runner.loop(o).schedule(delay, when)\r\n }\r\n\r\n schedule (timeline, delay, when) {\r\n // The user doesn't need to pass a timeline if we already have one\r\n if (!(timeline instanceof Timeline)) {\r\n when = delay\r\n delay = timeline\r\n timeline = this.timeline()\r\n }\r\n\r\n // If there is no timeline, yell at the user...\r\n if (!timeline) {\r\n throw Error('Runner cannot be scheduled without timeline')\r\n }\r\n\r\n // Schedule the runner on the timeline provided\r\n timeline.schedule(this, delay, when)\r\n return this\r\n }\r\n\r\n unschedule () {\r\n var timeline = this.timeline()\r\n timeline && timeline.unschedule(this)\r\n return this\r\n }\r\n\r\n loop (times, swing, wait) {\r\n // Deal with the user passing in an object\r\n if (typeof times === 'object') {\r\n swing = times.swing\r\n wait = times.wait\r\n times = times.times\r\n }\r\n\r\n // Sanitise the values and store them\r\n this._times = times || Infinity\r\n this._swing = swing || false\r\n this._wait = wait || 0\r\n return this\r\n }\r\n\r\n delay (delay) {\r\n return this.animate(0, delay)\r\n }\r\n\r\n /*\r\n Basic Functionality\r\n ===================\r\n These methods allow us to attach basic functions to the runner directly\r\n */\r\n\r\n queue (initFn, runFn, retargetFn, isTransform) {\r\n this._queue.push({\r\n initialiser: initFn || noop,\r\n runner: runFn || noop,\r\n retarget: retargetFn,\r\n isTransform: isTransform,\r\n initialised: false,\r\n finished: false\r\n })\r\n var timeline = this.timeline()\r\n timeline && this.timeline()._continue()\r\n return this\r\n }\r\n\r\n during (fn) {\r\n return this.queue(null, fn)\r\n }\r\n\r\n after (fn) {\r\n return this.on('finish', fn)\r\n }\r\n\r\n /*\r\n Runner animation methods\r\n ========================\r\n Control how the animation plays\r\n */\r\n\r\n time (time) {\r\n if (time == null) {\r\n return this._time\r\n }\r\n let dt = time - this._time\r\n this.step(dt)\r\n return this\r\n }\r\n\r\n duration () {\r\n return this._times * (this._wait + this._duration) - this._wait\r\n }\r\n\r\n loops (p) {\r\n var loopDuration = this._duration + this._wait\r\n if (p == null) {\r\n var loopsDone = Math.floor(this._time / loopDuration)\r\n var relativeTime = (this._time - loopsDone * loopDuration)\r\n var position = relativeTime / this._duration\r\n return Math.min(loopsDone + position, this._times)\r\n }\r\n var whole = Math.floor(p)\r\n var partial = p % 1\r\n var time = loopDuration * whole + this._duration * partial\r\n return this.time(time)\r\n }\r\n\r\n position (p) {\r\n // Get all of the variables we need\r\n var x = this._time\r\n var d = this._duration\r\n var w = this._wait\r\n var t = this._times\r\n var s = this._swing\r\n var r = this._reverse\r\n var position\r\n\r\n if (p == null) {\r\n /*\r\n This function converts a time to a position in the range [0, 1]\r\n The full explanation can be found in this desmos demonstration\r\n https://www.desmos.com/calculator/u4fbavgche\r\n The logic is slightly simplified here because we can use booleans\r\n */\r\n\r\n // Figure out the value without thinking about the start or end time\r\n const f = function (x) {\r\n var swinging = s * Math.floor(x % (2 * (w + d)) / (w + d))\r\n var backwards = (swinging && !r) || (!swinging && r)\r\n var uncliped = Math.pow(-1, backwards) * (x % (w + d)) / d + backwards\r\n var clipped = Math.max(Math.min(uncliped, 1), 0)\r\n return clipped\r\n }\r\n\r\n // Figure out the value by incorporating the start time\r\n var endTime = t * (w + d) - w\r\n position = x <= 0 ? Math.round(f(1e-5))\r\n : x < endTime ? f(x)\r\n : Math.round(f(endTime - 1e-5))\r\n return position\r\n }\r\n\r\n // Work out the loops done and add the position to the loops done\r\n var loopsDone = Math.floor(this.loops())\r\n var swingForward = s && (loopsDone % 2 === 0)\r\n var forwards = (swingForward && !r) || (r && swingForward)\r\n position = loopsDone + (forwards ? p : 1 - p)\r\n return this.loops(position)\r\n }\r\n\r\n progress (p) {\r\n if (p == null) {\r\n return Math.min(1, this._time / this.duration())\r\n }\r\n return this.time(p * this.duration())\r\n }\r\n\r\n step (dt) {\r\n // If we are inactive, this stepper just gets skipped\r\n if (!this.enabled) return this\r\n\r\n // Update the time and get the new position\r\n dt = dt == null ? 16 : dt\r\n this._time += dt\r\n var position = this.position()\r\n\r\n // Figure out if we need to run the stepper in this frame\r\n var running = this._lastPosition !== position && this._time >= 0\r\n this._lastPosition = position\r\n\r\n // Figure out if we just started\r\n var duration = this.duration()\r\n var justStarted = this._lastTime <= 0 && this._time > 0\r\n var justFinished = this._lastTime < this._time && this.time > duration\r\n this._lastTime = this._time\r\n if (justStarted) {\r\n this.fire('start', this)\r\n }\r\n\r\n // Work out if the runner is finished set the done flag here so animations\r\n // know, that they are running in the last step (this is good for\r\n // transformations which can be merged)\r\n var declarative = this._isDeclarative\r\n this.done = !declarative && !justFinished && this._time >= duration\r\n\r\n // Runner is running. So its not in reseted state anymore\r\n this._reseted = false\r\n\r\n // Call initialise and the run function\r\n if (running || declarative) {\n this._initialise(running)\r\n\r\n // clear the transforms on this runner so they dont get added again and again\r\n this.transforms = new Matrix()\r\n var converged = this._run(declarative ? dt : position)\r\n\r\n this.fire('step', this)\r\n }\r\n // correct the done flag here\r\n // declaritive animations itself know when they converged\r\n this.done = this.done || (converged && declarative)\r\n if (this.done) {\r\n this.fire('finish', this)\r\n }\r\n return this\r\n }\r\n\r\n reset () {\r\n if (this._reseted) return this\r\n this.loops(0)\r\n this._reseted = true\r\n return this\r\n }\r\n\r\n finish () {\r\n return this.step(Infinity)\r\n }\r\n\r\n reverse (reverse) {\r\n this._reverse = reverse == null ? !this._reverse : reverse\r\n return this\r\n }\r\n\r\n ease (fn) {\r\n this._stepper = new Ease(fn)\r\n return this\r\n }\r\n\r\n active (enabled) {\r\n if (enabled == null) return this.enabled\r\n this.enabled = enabled\r\n return this\r\n }\r\n\r\n /*\r\n Private Methods\r\n ===============\r\n Methods that shouldn't be used externally\r\n */\r\n\r\n // Save a morpher to the morpher list so that we can retarget it later\r\n _rememberMorpher (method, morpher) {\r\n this._history[method] = {\r\n morpher: morpher,\r\n caller: this._queue[this._queue.length - 1]\r\n }\r\n }\r\n\r\n // Try to set the target for a morpher if the morpher exists, otherwise\r\n // do nothing and return false\r\n _tryRetarget (method, target) {\r\n if (this._history[method]) {\r\n // if the last method wasnt even initialised, throw it away\r\n if (!this._history[method].caller.initialised) {\r\n let index = this._queue.indexOf(this._history[method].caller)\r\n this._queue.splice(index, 1)\r\n return false\r\n }\r\n\r\n // for the case of transformations, we use the special retarget function\r\n // which has access to the outer scope\r\n if (this._history[method].caller.retarget) {\r\n this._history[method].caller.retarget(target)\r\n // for everything else a simple morpher change is sufficient\r\n } else {\r\n this._history[method].morpher.to(target)\r\n }\r\n\r\n this._history[method].caller.finished = false\r\n var timeline = this.timeline()\r\n timeline && timeline._continue()\r\n return true\r\n }\r\n return false\r\n }\r\n\r\n // Run each initialise function in the runner if required\r\n _initialise (running) {\r\n // If we aren't running, we shouldn't initialise when not declarative\r\n if (!running && !this._isDeclarative) return\r\n\r\n // Loop through all of the initialisers\r\n for (var i = 0, len = this._queue.length; i < len; ++i) {\r\n // Get the current initialiser\r\n var current = this._queue[i]\r\n\r\n // Determine whether we need to initialise\r\n var needsIt = this._isDeclarative || (!current.initialised && running)\r\n running = !current.finished\r\n\r\n // Call the initialiser if we need to\r\n if (needsIt && running) {\r\n current.initialiser.call(this)\r\n current.initialised = true\r\n }\r\n }\r\n }\r\n\r\n // Run each run function for the position or dt given\r\n _run (positionOrDt) {\r\n // Run all of the _queue directly\r\n var allfinished = true\r\n for (var i = 0, len = this._queue.length; i < len; ++i) {\r\n // Get the current function to run\r\n var current = this._queue[i]\r\n\r\n // Run the function if its not finished, we keep track of the finished\r\n // flag for the sake of declarative _queue\r\n var converged = current.runner.call(this, positionOrDt)\r\n current.finished = current.finished || (converged === true)\r\n allfinished = allfinished && current.finished\r\n }\r\n\r\n // We report when all of the constructors are finished\r\n return allfinished\r\n }\r\n\r\n addTransform (transform, index) {\r\n this.transforms.lmultiplyO(transform)\r\n return this\r\n }\r\n\r\n clearTransform () {\r\n this.transforms = new Matrix()\r\n return this\r\n }\r\n\r\n // TODO: Keep track of all transformations so that deletion is faster\r\n clearTransformsFromQueue () {\r\n if (!this.done) {\r\n this._queue = this._queue.filter((item) => {\r\n return !item.isTransform\r\n })\r\n }\r\n }\r\n\r\n static sanitise (duration, delay, when) {\r\n // Initialise the default parameters\r\n var times = 1\r\n var swing = false\r\n var wait = 0\r\n duration = duration || timeline.duration\r\n delay = delay || timeline.delay\r\n when = when || 'last'\r\n\r\n // If we have an object, unpack the values\r\n if (typeof duration === 'object' && !(duration instanceof Stepper)) {\r\n delay = duration.delay || delay\r\n when = duration.when || when\r\n swing = duration.swing || swing\r\n times = duration.times || times\r\n wait = duration.wait || wait\r\n duration = duration.duration || timeline.duration\r\n }\r\n\r\n return {\r\n duration: duration,\r\n delay: delay,\r\n swing: swing,\r\n times: times,\r\n wait: wait,\r\n when: when\r\n }\r\n }\r\n}\r\n\r\nRunner.id = 0\r\n\r\nclass FakeRunner {\r\n constructor (transforms = new Matrix(), id = -1, done = true) {\r\n this.transforms = transforms\r\n this.id = id\r\n this.done = done\r\n }\r\n\r\n clearTransformsFromQueue () { }\r\n}\r\n\r\nextend([Runner, FakeRunner], {\r\n mergeWith (runner) {\r\n return new FakeRunner(\r\n runner.transforms.lmultiply(this.transforms),\r\n runner.id\r\n )\r\n }\r\n})\r\n\r\n// FakeRunner.emptyRunner = new FakeRunner()\r\n\r\nconst lmultiply = (last, curr) => last.lmultiplyO(curr)\r\nconst getRunnerTransform = (runner) => runner.transforms\r\n\r\nfunction mergeTransforms () {\r\n // Find the matrix to apply to the element and apply it\r\n let runners = this._transformationRunners.runners\r\n let netTransform = runners\r\n .map(getRunnerTransform)\r\n .reduce(lmultiply, new Matrix())\r\n\r\n this.transform(netTransform)\r\n\r\n this._transformationRunners.merge()\r\n\r\n if (this._transformationRunners.length() === 1) {\r\n this._frameId = null\r\n }\r\n}\r\n\r\nclass RunnerArray {\r\n constructor () {\r\n this.runners = []\r\n this.ids = []\r\n }\r\n\r\n add (runner) {\r\n if (this.runners.includes(runner)) return\r\n\r\n let id = runner.id + 1\r\n\r\n let leftSibling = this.ids.reduce((last, curr) => {\r\n if (curr > last && curr < id) return curr\r\n return last\r\n }, 0)\r\n\r\n let index = this.ids.indexOf(leftSibling) + 1\r\n\r\n this.ids.splice(index, 0, id)\r\n this.runners.splice(index, 0, runner)\r\n\r\n return this\r\n }\r\n\r\n getByID (id) {\r\n return this.runners[this.ids.indexOf(id + 1)]\r\n }\r\n\r\n remove (id) {\r\n let index = this.ids.indexOf(id + 1)\r\n this.ids.splice(index, 1)\r\n this.runners.splice(index, 1)\r\n return this\r\n }\r\n\r\n merge () {\r\n let lastRunner = null\r\n this.runners.forEach((runner, i) => {\r\n if (lastRunner && runner.done && lastRunner.done) {\r\n this.remove(runner.id)\r\n this.edit(lastRunner.id, runner.mergeWith(lastRunner))\r\n }\r\n\r\n lastRunner = runner\r\n })\r\n\r\n return this\r\n }\r\n\r\n edit (id, newRunner) {\r\n let index = this.ids.indexOf(id + 1)\r\n this.ids.splice(index, 1, id)\r\n this.runners.splice(index, 1, newRunner)\r\n return this\r\n }\r\n\r\n length () {\r\n return this.ids.length\r\n }\r\n\r\n clearBefore (id) {\r\n let deleteCnt = this.ids.indexOf(id + 1) || 1\r\n this.ids.splice(0, deleteCnt, 0)\r\n this.runners.splice(0, deleteCnt, new FakeRunner())\r\n .forEach((r) => r.clearTransformsFromQueue())\r\n return this\r\n }\r\n}\r\n\r\nlet frameId = 0\r\nregisterMethods({\r\n Element: {\r\n animate (duration, delay, when) {\r\n var o = Runner.sanitise(duration, delay, when)\r\n var timeline = this.timeline()\r\n return new Runner(o.duration)\r\n .loop(o)\r\n .element(this)\r\n .timeline(timeline.play())\r\n .schedule(delay, when)\r\n },\r\n\r\n delay (by, when) {\r\n return this.animate(0, by, when)\r\n },\r\n\r\n // this function searches for all runners on the element and deletes the ones\r\n // which run before the current one. This is because absolute transformations\r\n // overwfrite anything anyway so there is no need to waste time computing\r\n // other runners\r\n _clearTransformRunnersBefore (currentRunner) {\r\n this._transformationRunners.clearBefore(currentRunner.id)\r\n },\r\n\r\n _currentTransform (current) {\r\n return this._transformationRunners.runners\r\n // we need the equal sign here to make sure, that also transformations\r\n // on the same runner which execute before the current transformation are\r\n // taken into account\r\n .filter((runner) => runner.id <= current.id)\r\n .map(getRunnerTransform)\r\n .reduce(lmultiply, new Matrix())\r\n },\r\n\r\n addRunner (runner) {\r\n this._transformationRunners.add(runner)\r\n\r\n Animator.transform_frame(\r\n mergeTransforms.bind(this), this._frameId\r\n )\r\n },\r\n\r\n _prepareRunner () {\r\n if (this._frameId == null) {\r\n this._transformationRunners = new RunnerArray()\r\n .add(new FakeRunner(new Matrix(this)))\r\n\r\n this._frameId = frameId++\r\n }\r\n }\r\n }\r\n})\r\n\r\nextend(Runner, {\r\n attr (a, v) {\r\n return this.styleAttr('attr', a, v)\r\n },\r\n\r\n // Add animatable styles\r\n css (s, v) {\r\n return this.styleAttr('css', s, v)\r\n },\r\n\r\n styleAttr (type, name, val) {\r\n // apply attributes individually\r\n if (typeof name === 'object') {\r\n for (var key in val) {\r\n this.styleAttr(type, key, val[key])\r\n }\r\n }\r\n\r\n var morpher = new Morphable(this._stepper).to(val)\r\n\r\n this.queue(function () {\r\n morpher = morpher.from(this.element()[type](name))\r\n }, function (pos) {\r\n this.element()[type](name, morpher.at(pos))\r\n return morpher.done()\r\n })\r\n\r\n return this\r\n },\r\n\r\n zoom (level, point) {\r\n var morpher = new Morphable(this._stepper).to(new SVGNumber(level))\r\n\r\n this.queue(function () {\r\n morpher = morpher.from(this.zoom())\r\n }, function (pos) {\r\n this.element().zoom(morpher.at(pos), point)\r\n return morpher.done()\r\n })\r\n\r\n return this\r\n },\r\n\r\n /**\r\n ** absolute transformations\r\n **/\r\n\r\n //\r\n // M v -----|-----(D M v = F v)------|-----> T v\r\n //\r\n // 1. define the final state (T) and decompose it (once)\r\n // t = [tx, ty, the, lam, sy, sx]\r\n // 2. on every frame: pull the current state of all previous transforms\r\n // (M - m can change)\r\n // and then write this as m = [tx0, ty0, the0, lam0, sy0, sx0]\r\n // 3. Find the interpolated matrix F(pos) = m + pos * (t - m)\r\n // - Note F(0) = M\r\n // - Note F(1) = T\r\n // 4. Now you get the delta matrix as a result: D = F * inv(M)\r\n\r\n transform (transforms, relative, affine) {\r\n // If we have a declarative function, we should retarget it if possible\r\n relative = transforms.relative || relative\r\n if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) {\r\n return this\r\n }\r\n\r\n // Parse the parameters\r\n var isMatrix = Matrix.isMatrixLike(transforms)\r\n affine = transforms.affine != null\r\n ? transforms.affine\r\n : (affine != null ? affine : !isMatrix)\r\n\r\n // Create a morepher and set its type\r\n const morpher = new Morphable(this._stepper)\r\n .type(affine ? TransformBag : Matrix)\r\n\r\n let origin\r\n let element\r\n let current\r\n let currentAngle\r\n let startTransform\r\n\r\n function setup () {\r\n // make sure element and origin is defined\r\n element = element || this.element()\r\n origin = origin || getOrigin(transforms, element)\r\n\r\n startTransform = new Matrix(relative ? undefined : element)\r\n\r\n // add the runner to the element so it can merge transformations\r\n element.addRunner(this)\r\n\r\n // Deactivate all transforms that have run so far if we are absolute\r\n if (!relative) {\r\n element._clearTransformRunnersBefore(this)\r\n }\r\n }\r\n\r\n function run (pos) {\r\n // clear all other transforms before this in case something is saved\r\n // on this runner. We are absolute. We dont need these!\r\n if (!relative) this.clearTransform()\r\n\r\n let { x, y } = new Point(origin).transform(element._currentTransform(this))\r\n\r\n let target = new Matrix({ ...transforms, origin: [x, y] })\r\n let start = this._isDeclarative && current\r\n ? current\r\n : startTransform\r\n\r\n if (affine) {\r\n target = target.decompose(x, y)\r\n start = start.decompose(x, y)\r\n\r\n // Get the current and target angle as it was set\r\n const rTarget = target.rotate\r\n const rCurrent = start.rotate\r\n\r\n // Figure out the shortest path to rotate directly\r\n const possibilities = [rTarget - 360, rTarget, rTarget + 360]\r\n const distances = possibilities.map(a => Math.abs(a - rCurrent))\r\n const shortest = Math.min(...distances)\r\n const index = distances.indexOf(shortest)\r\n target.rotate = possibilities[index]\r\n }\r\n\r\n if (relative) {\r\n // we have to be careful here not to overwrite the rotation\r\n // with the rotate method of Matrix\r\n if (!isMatrix) {\r\n target.rotate = transforms.rotate || 0\r\n }\r\n if (this._isDeclarative && currentAngle) {\r\n start.rotate = currentAngle\r\n }\r\n }\r\n\r\n morpher.from(start)\r\n morpher.to(target)\r\n\r\n let affineParameters = morpher.at(pos)\r\n currentAngle = affineParameters.rotate\r\n current = new Matrix(affineParameters)\r\n\r\n this.addTransform(current)\r\n return morpher.done()\r\n }\r\n\r\n function retarget (newTransforms) {\r\n // only get a new origin if it changed since the last call\r\n if (\r\n (newTransforms.origin || 'center').toString() !==\r\n (transforms.origin || 'center').toString()\r\n ) {\r\n origin = getOrigin(transforms, element)\r\n }\r\n\r\n // overwrite the old transformations with the new ones\r\n transforms = { ...newTransforms, origin }\r\n }\r\n\r\n this.queue(setup, run, retarget, true)\r\n this._isDeclarative && this._rememberMorpher('transform', morpher)\r\n return this\r\n },\r\n\r\n // Animatable x-axis\r\n x (x, relative) {\r\n return this._queueNumber('x', x)\r\n },\r\n\r\n // Animatable y-axis\r\n y (y) {\r\n return this._queueNumber('y', y)\r\n },\r\n\r\n dx (x) {\r\n return this._queueNumberDelta('x', x)\r\n },\r\n\r\n dy (y) {\r\n return this._queueNumberDelta('y', y)\r\n },\r\n\r\n _queueNumberDelta (method, to) {\r\n to = new SVGNumber(to)\r\n\r\n // Try to change the target if we have this method already registerd\r\n if (this._tryRetarget(method, to)) return this\r\n\r\n // Make a morpher and queue the animation\r\n var morpher = new Morphable(this._stepper).to(to)\r\n var from = null\r\n this.queue(function () {\r\n from = this.element()[method]()\r\n morpher.from(from)\r\n morpher.to(from + to)\r\n }, function (pos) {\r\n this.element()[method](morpher.at(pos))\r\n return morpher.done()\r\n }, function (newTo) {\r\n morpher.to(from + new SVGNumber(newTo))\r\n })\r\n\r\n // Register the morpher so that if it is changed again, we can retarget it\r\n this._rememberMorpher(method, morpher)\r\n return this\r\n },\r\n\r\n _queueObject (method, to) {\r\n // Try to change the target if we have this method already registerd\r\n if (this._tryRetarget(method, to)) return this\r\n\r\n // Make a morpher and queue the animation\r\n var morpher = new Morphable(this._stepper).to(to)\r\n this.queue(function () {\r\n morpher.from(this.element()[method]())\r\n }, function (pos) {\r\n this.element()[method](morpher.at(pos))\r\n return morpher.done()\r\n })\r\n\r\n // Register the morpher so that if it is changed again, we can retarget it\r\n this._rememberMorpher(method, morpher)\r\n return this\r\n },\r\n\r\n _queueNumber (method, value) {\r\n return this._queueObject(method, new SVGNumber(value))\r\n },\r\n\r\n // Animatable center x-axis\r\n cx (x) {\r\n return this._queueNumber('cx', x)\r\n },\r\n\r\n // Animatable center y-axis\r\n cy (y) {\r\n return this._queueNumber('cy', y)\r\n },\r\n\r\n // Add animatable move\r\n move (x, y) {\r\n return this.x(x).y(y)\r\n },\r\n\r\n // Add animatable center\r\n center (x, y) {\r\n return this.cx(x).cy(y)\r\n },\r\n\r\n // Add animatable size\r\n size (width, height) {\r\n // animate bbox based size for all other elements\r\n var box\r\n\r\n if (!width || !height) {\r\n box = this._element.bbox()\r\n }\r\n\r\n if (!width) {\r\n width = box.width / box.height * height\r\n }\r\n\r\n if (!height) {\r\n height = box.height / box.width * width\r\n }\r\n\r\n return this\r\n .width(width)\r\n .height(height)\r\n },\r\n\r\n // Add animatable width\r\n width (width) {\r\n return this._queueNumber('width', width)\r\n },\r\n\r\n // Add animatable height\r\n height (height) {\r\n return this._queueNumber('height', height)\r\n },\r\n\r\n // Add animatable plot\r\n plot (a, b, c, d) {\r\n // Lines can be plotted with 4 arguments\r\n if (arguments.length === 4) {\r\n return this.plot([a, b, c, d])\r\n }\r\n\r\n var morpher = this._element.MorphArray().to(a)\r\n\r\n this.queue(function () {\r\n morpher.from(this._element.array())\r\n }, function (pos) {\r\n this._element.plot(morpher.at(pos))\r\n })\r\n\r\n return this\r\n },\r\n\r\n // Add leading method\r\n leading (value) {\r\n return this._queueNumber('leading', value)\r\n },\r\n\r\n // Add animatable viewbox\r\n viewbox (x, y, width, height) {\r\n return this._queueObject('viewbox', new Box(x, y, width, height))\r\n },\r\n\r\n update (o) {\r\n if (typeof o !== 'object') {\r\n return this.update({\r\n offset: arguments[0],\r\n color: arguments[1],\r\n opacity: arguments[2]\r\n })\r\n }\r\n\r\n if (o.opacity != null) this.attr('stop-opacity', o.opacity)\r\n if (o.color != null) this.attr('stop-color', o.color)\r\n if (o.offset != null) this.attr('offset', o.offset)\r\n\r\n return this\r\n }\r\n})\r\n\r\nextend(Runner, { rx, ry, from, to })\r\n","import {\r\n adopt,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { ns, svgjs, xlink, xmlns } from '../modules/core/namespaces.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\nimport Defs from './Defs.js'\r\nimport { globals } from '../utils/window.js'\r\n\r\nexport default class Svg extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('svg', node), node)\r\n this.namespace()\r\n }\r\n\r\n isRoot () {\r\n return !this.node.parentNode ||\r\n !(this.node.parentNode instanceof globals.window.SVGElement) ||\r\n this.node.parentNode.nodeName === '#document'\r\n }\r\n\r\n // Check if this is a root svg\r\n // If not, call docs from this element\r\n root () {\r\n if (this.isRoot()) return this\r\n return super.root()\r\n }\r\n\r\n // Add namespaces\r\n namespace () {\r\n if (!this.isRoot()) return this.root().namespace()\r\n return this\r\n .attr({ xmlns: ns, version: '1.1' })\r\n .attr('xmlns:xlink', xlink, xmlns)\r\n .attr('xmlns:svgjs', svgjs, xmlns)\r\n }\r\n\r\n // Creates and returns defs element\r\n defs () {\r\n if (!this.isRoot()) return this.root().defs()\r\n\r\n return adopt(this.node.getElementsByTagName('defs')[0]) ||\r\n this.put(new Defs())\r\n }\r\n\r\n // custom parent method\r\n parent (type) {\r\n if (this.isRoot()) {\r\n return this.node.parentNode.nodeName === '#document'\r\n ? null\r\n : adopt(this.node.parentNode)\r\n }\r\n\r\n return super.parent(type)\r\n }\r\n\r\n clear () {\r\n // remove children\r\n while (this.node.hasChildNodes()) {\r\n this.node.removeChild(this.node.lastChild)\r\n }\r\n return this\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create nested svg document\r\n nested: wrapWithAttrCheck(function () {\r\n return this.put(new Svg())\r\n })\r\n }\r\n})\r\n\r\nregister(Svg, 'Svg', true)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class Symbol extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('symbol', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n symbol: wrapWithAttrCheck(function () {\r\n return this.put(new Symbol())\r\n })\r\n }\r\n})\r\n\r\nregister(Symbol)\r\n","import { globals } from '../../utils/window.js'\r\n\r\n// Create plain text node\r\nexport function plain (text) {\r\n // clear if build mode is disabled\r\n if (this._build === false) {\r\n this.clear()\r\n }\r\n\r\n // create text node\r\n this.node.appendChild(globals.document.createTextNode(text))\r\n\r\n return this\r\n}\r\n\r\n// Get length of text element\r\nexport function length () {\r\n return this.node.getComputedTextLength()\r\n}\r\n","import {\r\n adopt,\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { attrs } from '../modules/core/defaults.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport SVGNumber from '../types/SVGNumber.js'\r\nimport Shape from './Shape.js'\r\nimport { globals } from '../utils/window.js'\r\nimport * as textable from '../modules/core/textable.js'\r\n\r\nexport default class Text extends Shape {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('text', node), node)\r\n\r\n this.dom.leading = new SVGNumber(1.3) // store leading value for rebuilding\r\n this._rebuild = true // enable automatic updating of dy values\r\n this._build = false // disable build mode for adding multiple lines\r\n\r\n // set default font\r\n this.attr('font-family', attrs['font-family'])\r\n }\r\n\r\n // Move over x-axis\r\n x (x) {\r\n // act as getter\r\n if (x == null) {\r\n return this.attr('x')\r\n }\r\n\r\n return this.attr('x', x)\r\n }\r\n\r\n // Move over y-axis\r\n y (y) {\r\n var oy = this.attr('y')\r\n var o = typeof oy === 'number' ? oy - this.bbox().y : 0\r\n\r\n // act as getter\r\n if (y == null) {\r\n return typeof oy === 'number' ? oy - o : oy\r\n }\r\n\r\n return this.attr('y', typeof y === 'number' ? y + o : y)\r\n }\r\n\r\n // Move center over x-axis\r\n cx (x) {\r\n return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2)\r\n }\r\n\r\n // Move center over y-axis\r\n cy (y) {\r\n return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2)\r\n }\r\n\r\n // Set the text content\r\n text (text) {\r\n // act as getter\r\n if (text === undefined) {\r\n var children = this.node.childNodes\r\n var firstLine = 0\r\n text = ''\r\n\r\n for (var i = 0, len = children.length; i < len; ++i) {\r\n // skip textPaths - they are no lines\r\n if (children[i].nodeName === 'textPath') {\r\n if (i === 0) firstLine = 1\r\n continue\r\n }\r\n\r\n // add newline if its not the first child and newLined is set to true\r\n if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) {\r\n text += '\\n'\r\n }\r\n\r\n // add content of this node\r\n text += children[i].textContent\r\n }\r\n\r\n return text\r\n }\r\n\r\n // remove existing content\r\n this.clear().build(true)\r\n\r\n if (typeof text === 'function') {\r\n // call block\r\n text.call(this, this)\r\n } else {\r\n // store text and make sure text is not blank\r\n text = text.split('\\n')\r\n\r\n // build new lines\r\n for (var j = 0, jl = text.length; j < jl; j++) {\r\n this.tspan(text[j]).newLine()\r\n }\r\n }\r\n\r\n // disable build mode and rebuild lines\r\n return this.build(false).rebuild()\r\n }\r\n\r\n // Set / get leading\r\n leading (value) {\r\n // act as getter\r\n if (value == null) {\r\n return this.dom.leading\r\n }\r\n\r\n // act as setter\r\n this.dom.leading = new SVGNumber(value)\r\n\r\n return this.rebuild()\r\n }\r\n\r\n // Rebuild appearance type\r\n rebuild (rebuild) {\r\n // store new rebuild flag if given\r\n if (typeof rebuild === 'boolean') {\r\n this._rebuild = rebuild\r\n }\r\n\r\n // define position of all lines\r\n if (this._rebuild) {\r\n var self = this\r\n var blankLineOffset = 0\r\n var leading = this.dom.leading\r\n\r\n this.each(function () {\r\n var fontSize = globals.window.getComputedStyle(this.node)\r\n .getPropertyValue('font-size')\r\n var dy = leading * new SVGNumber(fontSize)\r\n\r\n if (this.dom.newLined) {\r\n this.attr('x', self.attr('x'))\r\n\r\n if (this.text() === '\\n') {\r\n blankLineOffset += dy\r\n } else {\r\n this.attr('dy', dy + blankLineOffset)\r\n blankLineOffset = 0\r\n }\r\n }\r\n })\r\n\r\n this.fire('rebuild')\r\n }\r\n\r\n return this\r\n }\r\n\r\n // Enable / disable build mode\r\n build (build) {\r\n this._build = !!build\r\n return this\r\n }\r\n\r\n // overwrite method from parent to set data properly\r\n setData (o) {\r\n this.dom = o\r\n this.dom.leading = new SVGNumber(o.leading || 1.3)\r\n return this\r\n }\r\n}\r\n\r\nextend(Text, textable)\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create text element\r\n text: wrapWithAttrCheck(function (text) {\r\n return this.put(new Text()).text(text)\r\n }),\r\n\r\n // Create plain text element\r\n plain: wrapWithAttrCheck(function (text) {\r\n return this.put(new Text()).plain(text)\r\n })\r\n }\r\n})\r\n\r\nregister(Text)\r\n","import {\r\n extend,\r\n nodeOrNew,\r\n register,\r\n wrapWithAttrCheck\r\n} from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Text from './Text.js'\r\nimport * as textable from '../modules/core/textable.js'\r\n\r\nexport default class Tspan extends Text {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('tspan', node), node)\r\n }\r\n\r\n // Set text content\r\n text (text) {\r\n if (text == null) return this.node.textContent + (this.dom.newLined ? '\\n' : '')\r\n\r\n typeof text === 'function' ? text.call(this, this) : this.plain(text)\r\n\r\n return this\r\n }\r\n\r\n // Shortcut dx\r\n dx (dx) {\r\n return this.attr('dx', dx)\r\n }\r\n\r\n // Shortcut dy\r\n dy (dy) {\r\n return this.attr('dy', dy)\r\n }\r\n\r\n // Create new line\r\n newLine () {\r\n // fetch text parent\r\n var t = this.parent(Text)\r\n\r\n // mark new line\r\n this.dom.newLined = true\r\n\r\n // apply new position\r\n return this.dy(t.dom.leading * t.attr('font-size')).attr('x', t.x())\r\n }\r\n}\r\n\r\nextend(Tspan, textable)\r\n\r\nregisterMethods({\r\n Tspan: {\r\n tspan: wrapWithAttrCheck(function (text) {\r\n var tspan = new Tspan()\r\n\r\n // clear if build mode is disabled\r\n if (!this._build) {\r\n this.clear()\r\n }\r\n\r\n // add new tspan\r\n this.node.appendChild(tspan.node)\r\n\r\n return tspan.text(text)\r\n })\r\n }\r\n})\r\n\r\nregister(Tspan)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class ClipPath extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('clipPath', node), node)\r\n }\r\n\r\n // Unclip all clipped elements and remove itself\r\n remove () {\r\n // unclip all targets\r\n this.targets().forEach(function (el) {\r\n el.unclip()\r\n })\r\n\r\n // remove clipPath from parent\r\n return super.remove()\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [clip-path*=\"' + this.id() + '\"]')\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create clipping element\r\n clip: wrapWithAttrCheck(function () {\r\n return this.defs().put(new ClipPath())\r\n })\r\n },\r\n Element: {\r\n // Distribute clipPath to svg element\r\n clipWith (element) {\r\n // use given clip or create a new one\r\n let clipper = element instanceof ClipPath\r\n ? element\r\n : this.parent().clip().add(element)\r\n\r\n // apply mask\r\n return this.attr('clip-path', 'url(\"#' + clipper.id() + '\")')\r\n },\r\n\r\n // Unclip element\r\n unclip () {\r\n return this.attr('clip-path', null)\r\n },\r\n\r\n clipper () {\r\n return this.reference('clip-path')\r\n }\r\n }\r\n})\r\n\r\nregister(ClipPath)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class G extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('g', node), node)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Element: {\r\n // Create a group element\r\n group: wrapWithAttrCheck(function () {\r\n return this.put(new G())\r\n })\r\n }\r\n})\r\n\r\nregister(G)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Container from './Container.js'\r\n\r\nexport default class A extends Container {\r\n constructor (node) {\r\n super(nodeOrNew('a', node), node)\r\n }\r\n\r\n // Link url\r\n to (url) {\r\n return this.attr('href', url, xlink)\r\n }\r\n\r\n // Link target attribute\r\n target (target) {\r\n return this.attr('target', target)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a hyperlink element\r\n link: wrapWithAttrCheck(function (url) {\r\n return this.put(new A()).to(url)\r\n })\r\n },\r\n Element: {\r\n // Create a hyperlink element\r\n linkTo: function (url) {\r\n var link = new A()\r\n\r\n if (typeof url === 'function') { url.call(link, link) } else {\r\n link.to(url)\r\n }\r\n\r\n return this.parent().put(link).put(this)\r\n }\r\n }\r\n})\r\n\r\nregister(A)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport Container from './Container.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class Mask extends Container {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('mask', node), node)\r\n }\r\n\r\n // Unmask all masked elements and remove itself\r\n remove () {\r\n // unmask all targets\r\n this.targets().forEach(function (el) {\r\n el.unmask()\r\n })\r\n\r\n // remove mask from parent\r\n return super.remove()\r\n }\r\n\r\n targets () {\r\n return baseFind('svg [mask*=\"' + this.id() + '\"]')\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n mask: wrapWithAttrCheck(function () {\r\n return this.defs().put(new Mask())\r\n })\r\n },\r\n Element: {\r\n // Distribute mask to svg element\r\n maskWith (element) {\r\n // use given mask or create a new one\r\n var masker = element instanceof Mask\r\n ? element\r\n : this.parent().mask().add(element)\r\n\r\n // apply mask\r\n return this.attr('mask', 'url(\"#' + masker.id() + '\")')\r\n },\r\n\r\n // Unmask element\r\n unmask () {\r\n return this.attr('mask', null)\r\n },\r\n\r\n masker () {\r\n return this.reference('mask')\r\n }\r\n }\r\n})\r\n\r\nregister(Mask)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { unCamelCase } from '../utils/utils.js'\r\nimport Element from './Element.js'\r\n\r\nfunction cssRule (selector, rule) {\r\n if (!selector) return ''\r\n if (!rule) return selector\r\n\r\n var ret = selector + '{'\r\n\r\n for (var i in rule) {\r\n ret += unCamelCase(i) + ':' + rule[i] + ';'\r\n }\r\n\r\n ret += '}'\r\n\r\n return ret\r\n}\r\n\r\nexport default class Style extends Element {\r\n constructor (node) {\r\n super(nodeOrNew('style', node), node)\r\n }\r\n\r\n addText (w = '') {\r\n this.node.textContent += w\r\n return this\r\n }\r\n\r\n font (name, src, params = {}) {\r\n return this.rule('@font-face', {\r\n fontFamily: name,\r\n src: src,\r\n ...params\r\n })\r\n }\r\n\r\n rule (selector, obj) {\r\n return this.addText(cssRule(selector, obj))\r\n }\r\n}\r\n\r\nregisterMethods('Dom', {\r\n style: wrapWithAttrCheck(function (selector, obj) {\r\n return this.put(new Style()).rule(selector, obj)\r\n }),\r\n fontface: wrapWithAttrCheck(function (name, src, params) {\r\n return this.put(new Style()).font(name, src, params)\r\n })\r\n})\r\n\r\nregister(Style)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Path from './Path.js'\r\nimport PathArray from '../types/PathArray.js'\r\nimport Text from './Text.js'\r\nimport baseFind from '../modules/core/selector.js'\r\n\r\nexport default class TextPath extends Text {\r\n // Initialize node\r\n constructor (node) {\r\n super(nodeOrNew('textPath', node), node)\r\n }\r\n\r\n // return the array of the path track element\r\n array () {\r\n var track = this.track()\r\n\r\n return track ? track.array() : null\r\n }\r\n\r\n // Plot path if any\r\n plot (d) {\r\n var track = this.track()\r\n var pathArray = null\r\n\r\n if (track) {\r\n pathArray = track.plot(d)\r\n }\r\n\r\n return (d == null) ? pathArray : this\r\n }\r\n\r\n // Get the path element\r\n track () {\r\n return this.reference('href')\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n textPath: wrapWithAttrCheck(function (text, path) {\r\n return this.defs().path(path).text(text).addTo(this)\r\n })\r\n },\r\n Text: {\r\n // Create path for text to run on\r\n path: wrapWithAttrCheck(function (track) {\r\n var path = new TextPath()\r\n\r\n // if track is a path, reuse it\r\n if (!(track instanceof Path)) {\r\n // create path element\r\n track = this.root().defs().path(track)\r\n }\r\n\r\n // link textPath to path and add content\r\n path.attr('href', '#' + track, xlink)\r\n\r\n // add textPath element as child node and return textPath\r\n return this.put(path)\r\n }),\r\n\r\n // Get the textPath children\r\n textPath () {\r\n return this.find('textPath')[0]\r\n }\r\n },\r\n Path: {\r\n // creates a textPath from this path\r\n text: wrapWithAttrCheck(function (text) {\r\n if (text instanceof Text) {\r\n var txt = text.text()\r\n return text.clear().path(this).text(txt)\r\n }\r\n return this.parent().put(new Text()).path(this).text(text)\r\n }),\r\n\r\n targets () {\r\n return baseFind('svg [href*=\"' + this.id() + '\"]')\r\n }\r\n }\r\n})\r\n\r\nTextPath.prototype.MorphArray = PathArray\r\nregister(TextPath)\r\n","import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'\r\nimport { registerMethods } from '../utils/methods.js'\r\nimport { xlink } from '../modules/core/namespaces.js'\r\nimport Shape from './Shape.js'\r\n\r\nexport default class Use extends Shape {\r\n constructor (node) {\r\n super(nodeOrNew('use', node), node)\r\n }\r\n\r\n // Use element as a reference\r\n element (element, file) {\r\n // Set lined element\r\n return this.attr('href', (file || '') + '#' + element, xlink)\r\n }\r\n}\r\n\r\nregisterMethods({\r\n Container: {\r\n // Create a use element\r\n use: wrapWithAttrCheck(function (element, file) {\r\n return this.put(new Use()).element(element, file)\r\n })\r\n }\r\n})\r\n\r\nregister(Use)\r\n","/* Optional Modules */\r\nimport './modules/optional/arrange.js'\r\nimport './modules/optional/class.js'\r\nimport './modules/optional/css.js'\r\nimport './modules/optional/data.js'\r\nimport './modules/optional/memory.js'\r\nimport './modules/optional/sugar.js'\r\nimport './modules/optional/transform.js'\r\n\r\nimport { extend, makeInstance } from './utils/adopter.js'\r\nimport { getMethodNames, getMethodsFor } from './utils/methods.js'\r\nimport Box from './types/Box.js'\r\nimport Circle from './elements/Circle.js'\r\nimport Color from './types/Color.js'\r\nimport Container from './elements/Container.js'\r\nimport Defs from './elements/Defs.js'\r\nimport Dom from './elements/Dom.js'\r\nimport Element from './elements/Element.js'\r\nimport Ellipse from './elements/Ellipse.js'\r\nimport EventTarget from './types/EventTarget.js'\r\nimport Gradient from './elements/Gradient.js'\r\nimport Image from './elements/Image.js'\r\nimport Line from './elements/Line.js'\r\nimport List from './types/List.js'\r\nimport Marker from './elements/Marker.js'\r\nimport Matrix from './types/Matrix.js'\r\nimport Morphable, {\r\n NonMorphable,\r\n ObjectBag,\r\n TransformBag,\r\n makeMorphable,\r\n registerMorphableType\r\n} from './animation/Morphable.js'\r\nimport Path from './elements/Path.js'\r\nimport PathArray from './types/PathArray.js'\r\nimport Pattern from './elements/Pattern.js'\r\nimport PointArray from './types/PointArray.js'\r\nimport Polygon from './elements/Polygon.js'\r\nimport Polyline from './elements/Polyline.js'\r\nimport Rect from './elements/Rect.js'\r\nimport Runner from './animation/Runner.js'\r\nimport SVGArray from './types/SVGArray.js'\r\nimport SVGNumber from './types/SVGNumber.js'\r\nimport Shape from './elements/Shape.js'\r\nimport Svg from './elements/Svg.js'\r\nimport Symbol from './elements/Symbol.js'\r\nimport Text from './elements/Text.js'\r\nimport Tspan from './elements/Tspan.js'\r\nimport * as defaults from './modules/core/defaults.js'\r\nimport * as utils from './utils/utils.js'\r\nimport * as namespaces from './modules/core/namespaces.js'\r\nimport * as regex from './modules/core/regex.js'\r\n\r\nexport {\r\n Morphable,\r\n registerMorphableType,\r\n makeMorphable,\r\n TransformBag,\r\n ObjectBag,\r\n NonMorphable\r\n}\r\n\r\nexport { defaults, utils, namespaces, regex }\r\nexport const SVG = makeInstance\r\nexport { default as parser } from './modules/core/parser.js'\r\nexport { default as find } from './modules/core/selector.js'\r\nexport * from './modules/core/event.js'\r\nexport * from './utils/adopter.js'\r\nexport { registerWindow } from './utils/window.js'\r\n\r\n/* Animation Modules */\r\nexport { default as Animator } from './animation/Animator.js'\r\nexport { Controller, Ease, PID, Spring, easing } from './animation/Controller.js'\r\nexport { default as Queue } from './animation/Queue.js'\r\nexport { default as Runner } from './animation/Runner.js'\r\nexport { default as Timeline } from './animation/Timeline.js'\r\n\r\n/* Types */\r\nexport { default as Array } from './types/SVGArray.js'\r\nexport { default as Box } from './types/Box.js'\r\nexport { default as Color } from './types/Color.js'\r\nexport { default as EventTarget } from './types/EventTarget.js'\r\nexport { default as Matrix } from './types/Matrix.js'\r\nexport { default as Number } from './types/SVGNumber.js'\r\nexport { default as PathArray } from './types/PathArray.js'\r\nexport { default as Point } from './types/Point.js'\r\nexport { default as PointArray } from './types/PointArray.js'\r\nexport { default as List } from './types/List.js'\r\n\r\n/* Elements */\r\nexport { default as Circle } from './elements/Circle.js'\r\nexport { default as ClipPath } from './elements/ClipPath.js'\r\nexport { default as Container } from './elements/Container.js'\r\nexport { default as Defs } from './elements/Defs.js'\r\nexport { default as Dom } from './elements/Dom.js'\r\nexport { default as Element } from './elements/Element.js'\r\nexport { default as Ellipse } from './elements/Ellipse.js'\r\nexport { default as Gradient } from './elements/Gradient.js'\r\nexport { default as G } from './elements/G.js'\r\nexport { default as A } from './elements/A.js'\r\nexport { default as Image } from './elements/Image.js'\r\nexport { default as Line } from './elements/Line.js'\r\nexport { default as Marker } from './elements/Marker.js'\r\nexport { default as Mask } from './elements/Mask.js'\r\nexport { default as Path } from './elements/Path.js'\r\nexport { default as Pattern } from './elements/Pattern.js'\r\nexport { default as Polygon } from './elements/Polygon.js'\r\nexport { default as Polyline } from './elements/Polyline.js'\r\nexport { default as Rect } from './elements/Rect.js'\r\nexport { default as Shape } from './elements/Shape.js'\r\nexport { default as Stop } from './elements/Stop.js'\r\nexport { default as Style } from './elements/Style.js'\r\nexport { default as Svg } from './elements/Svg.js'\r\nexport { default as Symbol } from './elements/Symbol.js'\r\nexport { default as Text } from './elements/Text.js'\r\nexport { default as TextPath } from './elements/TextPath.js'\r\nexport { default as Tspan } from './elements/Tspan.js'\r\nexport { default as Use } from './elements/Use.js'\r\n\r\nextend([\r\n Svg,\r\n Symbol,\r\n Image,\r\n Pattern,\r\n Marker\r\n], getMethodsFor('viewbox'))\r\n\r\nextend([\r\n Line,\r\n Polyline,\r\n Polygon,\r\n Path\r\n], getMethodsFor('marker'))\r\n\r\nextend(Text, getMethodsFor('Text'))\r\nextend(Path, getMethodsFor('Path'))\r\n\r\nextend(Defs, getMethodsFor('Defs'))\r\n\r\nextend([\r\n Text,\r\n Tspan\r\n], getMethodsFor('Tspan'))\r\n\r\nextend([\r\n Rect,\r\n Ellipse,\r\n Circle,\r\n Gradient\r\n], getMethodsFor('radius'))\r\n\r\nextend(EventTarget, getMethodsFor('EventTarget'))\r\nextend(Dom, getMethodsFor('Dom'))\r\nextend(Element, getMethodsFor('Element'))\r\nextend(Shape, getMethodsFor('Shape'))\r\n// extend(Element, getConstructor('Memory'))\r\nextend(Container, getMethodsFor('Container'))\r\n\r\nextend(Runner, getMethodsFor('Runner'))\r\n\r\nList.extend(getMethodNames())\r\n\r\nregisterMorphableType([\r\n SVGNumber,\r\n Color,\r\n Box,\r\n Matrix,\r\n SVGArray,\r\n PointArray,\r\n PathArray\r\n])\r\n\r\nmakeMorphable()\r\n"],"names":["methods","names","registerMethods","name","m","Array","isArray","_name","addMethodNames","Object","keys","assign","getMethodsFor","getMethodNames","Set","_names","push","map","array","block","i","il","length","result","filter","radians","d","Math","PI","degrees","r","camelCase","s","toLowerCase","replace","g","toUpperCase","unCamelCase","capitalize","charAt","slice","proportionalSize","element","width","height","box","bbox","getOrigin","o","origin","ox","oy","string","trim","x","y","bx","includes","by","ns","xmlns","xlink","svgjs","globals","window","document","registerWindow","win","doc","Base","elements","root","makeNode","createElementNS","makeInstance","adopt","querySelector","node","innerHTML","firstChild","nodeOrNew","Node","instance","className","nodeName","register","asRoot","prototype","getClass","did","eid","assignNewId","children","id","extend","modules","attrCheck","key","method","wrapWithAttrCheck","extendWithAttrCheck","args","fn","constructor","apply","attr","siblings","parent","position","index","next","prev","forward","p","removeElement","add","isRoot","appendChild","defs","backward","front","back","before","remove","after","insertBefore","insertAfter","numberAndUnit","hex","rgb","reference","transforms","whitespace","isHex","isRgb","isCss","isBlank","isNumber","isPercent","isImage","delimiter","hyphen","pathLetters","isPathLetter","numbersWithDots","dots","classes","split","hasClass","indexOf","addClass","join","removeClass","c","toggleClass","css","style","val","ret","arguments","cssText","el","forEach","t","cased","test","show","hide","visible","data","a","v","JSON","parse","e","stringify","remember","k","memory","forget","_memory","listenerId","getEvents","n","getEventHolder","events","getEventTarget","clearEvents","on","listener","binding","options","l","bind","bag","_svgjsListenerId","event","ev","addEventListener","off","namespace","removeEventListener","dispatch","Event","dispatchEvent","CustomEvent","detail","cancelable","fullHex","substring","compToHex","comp","toString","Color","init","color","b","match","exec","parseInt","toHex","toArray","round","toRgb","brightness","isColor","Point","source","base","clone","transform","f","point","screenCTM","inverse","parser","nodes","svg","size","path","parentNode","body","documentElement","addTo","isNulledBox","w","h","domContains","contains","call","Box","parseFloat","left","top","x2","y2","cx","cy","merge","min","max","xMin","Infinity","xMax","yMin","yMax","pts","addOffset","pageXOffset","pageYOffset","isNulled","getBox","cb","Error","getBBox","rbox","getBoundingClientRect","viewbox","closeEnough","threshold","abs","Matrix","fromArray","Element","matrixify","isMatrixLike","matrix","multiplyO","formatTransforms","current","transformer","translateO","rx","ry","lmultiplyO","scaleO","scaleX","scaleY","skewO","skewX","skewY","shearO","shear","rotateO","theta","isFinite","px","py","dx","dy","tx","ty","compose","originX","originY","sx","sy","lam","rotate","translateX","translateY","decompose","determinant","ccw","sqrt","thetaRad","atan2","ct","cos","st","sin","multiply","matrixMultiply","lmultiply","inverseO","det","na","nb","nc","nd","ne","nf","translate","scale","flip","axis","around","flipO","lx","skew","tan","ly","skewXO","skewYO","aroundO","equals","other","valueOf","flipBoth","flipX","flipY","positionX","positionY","relative","relativeX","relativeY","ctm","getCTM","rect","getScreenCTM","subClassArray","Function","baseClass","_constructor","Arr","create","arr","List","each","fnOrMethodName","concat","reduce","obj","attrs","baseFind","query","querySelectorAll","find","EventTarget","type","j","defaultPrevented","fire","noop","timeline","duration","ease","delay","fill","stroke","opacity","offset","SVGArray","toSet","SVGNumber","value","unit","isNaN","toJSON","plus","number","minus","times","divide","hooks","registerAttrHook","attributes","nodeValue","last","curr","removeAttribute","getAttribute","defaults","_val","hook","leading","setAttributeNS","setAttribute","rebuild","Dom","childNodes","put","clear","hasChildNodes","removeChild","lastChild","_defs","writeDataToDom","cloneNode","deep","first","get","has","matches","selector","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","SVGElement","putIn","replaceChild","precision","factor","newAttrs","svgOrFn","outerHTML","well","len","fragment","_this","createDocumentFragment","firstElementChild","words","text","textContent","Svg","dom","hasAttribute","setData","center","inside","move","parents","until","sugar","prefix","extension","mat","angle","direction","directionString","dmove","radius","_element","getTotalLength","pointAt","getPointAtLength","font","ax","ay","amove","defineProperty","untransform","str","kv","reverse","toParent","pCtm","toRoot","decomposed","cleanRelative","Shape","Circle","circle","Container","flatten","ungroup","Defs","Ellipse","circled","ellipse","Stop","update","from","fx","fy","x1","y1","to","Gradient","stop","url","targets","gradiented","gradient","Pattern","pattern","patternUnits","Image","load","callback","img","src","image","PointArray","toLine","at","pos","destination","points","pop","maxX","maxY","minX","minY","MorphArray","Line","plot","pointed","line","Marker","ref","marker","isObject","require$$0","require$$1","require$$2","anObject","toPrimitive","IE8_DOM_DEFINE","dP","createDesc","global","aFunction","core","ctx","redefine","defined","fails","$export","toObject","makeSetterGetter","easing","bezier","steps","stepPosition","jumps","beforeFlag","step","floor","jumping","Stepper","done","Ease","Controller","stepper","target","dt","recalculate","_duration","overshoot","_overshoot","eps","pi","os","log","zeta","wn","Spring","velocity","acceleration","newPosition","PID","windup","integral","error","P","I","D","PathArray","pathRegReplace","arrayToString","pathHandlers","M","p0","L","H","V","C","S","Q","T","Z","A","mlhvqtcsaz","jl","equalCommands","pathArray","morph","sourceArray","destinationArray","paramCnt","Morphable","_stepper","_from","_to","_type","_context","_morphObj","_set","NonMorphable","morphableTypes","ObjectBag","complete","TransformBag","objOrArr","values","entries","sort","registerMorphableType","makeMorphable","Path","_array","Polygon","polygon","poly","Polyline","polyline","Rect","Queue","_first","_last","item","shift","Animator","nextDraw","frames","timeouts","timer","performance","Date","frame","run","requestAnimationFrame","_draw","transform_frame","timeout","time","now","cancelFrame","clearTimeout","nextTimeout","lastTimeout","nextFrame","lastFrame","makeSchedule","runnerInfo","start","runner","end","defaultSource","Timeline","timeSource","_timeSource","_startTime","_speed","_persist","_nextFrame","_paused","_runners","_order","_time","_lastSourceTime","_lastStepTime","_step","schedule","when","absoluteStartTime","endTime","getEndTime","unschedule","persist","updateTime","_continue","splice","lastRunnerInfo","lastDuration","lastStartTime","active","play","pause","finish","speed","yes","currentSpeed","positive","seek","dtOrForever","immediateStep","dtSource","dtTime","runnersLeft","dtToStart","reset","finished","_timeline","Runner","_queue","_isDeclarative","_history","enabled","_lastTime","_reseted","transformId","_haveReversed","_reverse","_loopsDone","_swing","_wait","_times","_prepareRunner","animate","sanitise","loop","swing","wait","queue","initFn","runFn","retargetFn","isTransform","initialiser","retarget","initialised","during","loops","loopDuration","loopsDone","relativeTime","whole","partial","swinging","backwards","uncliped","pow","clipped","swingForward","forwards","progress","running","_lastPosition","justStarted","justFinished","declarative","_initialise","converged","_run","_rememberMorpher","morpher","caller","_tryRetarget","needsIt","positionOrDt","allfinished","addTransform","clearTransform","clearTransformsFromQueue","FakeRunner","mergeWith","getRunnerTransform","mergeTransforms","runners","_transformationRunners","netTransform","_frameId","RunnerArray","ids","leftSibling","getByID","lastRunner","edit","newRunner","clearBefore","deleteCnt","frameId","_clearTransformRunnersBefore","currentRunner","_currentTransform","addRunner","styleAttr","zoom","level","affine","isMatrix","currentAngle","startTransform","setup","undefined","rTarget","rCurrent","possibilities","distances","shortest","affineParameters","newTransforms","_queueNumber","_queueNumberDelta","newTo","_queueObject","version","getElementsByTagName","nested","Symbol","symbol","plain","_build","createTextNode","getComputedTextLength","Text","_rebuild","firstLine","nodeType","newLined","build","tspan","newLine","self","blankLineOffset","fontSize","getComputedStyle","getPropertyValue","textable","Tspan","ClipPath","unclip","clip","clipWith","clipper","G","group","link","linkTo","Mask","unmask","mask","maskWith","masker","cssRule","rule","Style","addText","params","fontFamily","fontface","TextPath","track","textPath","txt","Use","file","use","SVG"],"mappings":";;;;;;;;;;;;;;AAAA,MAAMA,OAAO,GAAG,EAAhB;AACA,MAAMC,KAAK,GAAG,EAAd;AAEA,AAAO,SAASC,eAAT,CAA0BC,IAA1B,EAAgCC,CAAhC,EAAmC;MACpCC,KAAK,CAACC,OAAN,CAAcH,IAAd,CAAJ,EAAyB;SAClB,IAAII,KAAT,IAAkBJ,IAAlB,EAAwB;MACtBD,eAAe,CAACK,KAAD,EAAQH,CAAR,CAAf;;;;;;MAKA,OAAOD,IAAP,KAAgB,QAApB,EAA8B;SACvB,IAAII,KAAT,IAAkBJ,IAAlB,EAAwB;MACtBD,eAAe,CAACK,KAAD,EAAQJ,IAAI,CAACI,KAAD,CAAZ,CAAf;;;;;;EAKJC,cAAc,CAACC,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;;;;;"}
\ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 57b9b40..e7a88bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "svg.js", + "name": "@svgdotjs/svg.js", "version": "3.0.0", "lockfileVersion": 1, "requires": true, @@ -841,6 +841,41 @@ } } }, + "@babel/runtime": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.1.5.tgz", + "integrity": "sha512-xKnPpXG/pvK1B90JkwwxSGii90rQGKtzcMt2gI5G6+M0REXaq6rOHsGC2ay6/d0Uje7zzvSzjEzfR3ENhFlrfA==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.12.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", + "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==", + "dev": true + } + } + }, + "@babel/runtime-corejs2": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.1.5.tgz", + "integrity": "sha512-WsYRwQsFhVmxkAqwypPTZyV9GpkqMEaAr2zOItOmqSX2GBFaI+eq98CN81e13o0zaUKJOQGYyjhNVqj56nnkYg==", + "dev": true, + "requires": { + "core-js": "^2.5.7", + "regenerator-runtime": "^0.12.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", + "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==", + "dev": true + } + } + }, "@babel/template": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.2.tgz", @@ -1016,6 +1051,11 @@ "dev": true, "optional": true }, + "animation-frame-polyfill": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/animation-frame-polyfill/-/animation-frame-polyfill-1.0.1.tgz", + "integrity": "sha1-X1rZk6eHlL0Xas3lttzmKGdBDJ0=" + }, "ansi-align": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", @@ -4658,6 +4698,12 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, + "innersvg-polyfill": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/innersvg-polyfill/-/innersvg-polyfill-0.0.2.tgz", + "integrity": "sha1-i9M2G0UpHqOMv8brcYI+7RiQrzk=", + "dev": true + }, "inquirer": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", diff --git a/package.json b/package.json index 6776214..3c8366e 100644 --- a/package.json +++ b/package.json @@ -11,15 +11,11 @@ "animation" ], "author": "Wout Fierens <wout@mick-wout.com>", - "main": "dist/svg.js", - "module": "dist/svg.esm.js", - "jam": { - "include": [ - "dist/svg.js", - "README.md", - "LICENSE.txt" - ] - }, + "main": "dist/svg.node.js", + "unpkg": "dist/svg.min.js", + "jsdelivr": "dist/svg.min.js", + "browser": "dist/svg.min.js", + "module": "dist/svg.js", "maintainers": [ { "name": "Wout Fierens", @@ -62,7 +58,9 @@ "server": "npx http-server ./ -d", "test": "npx karma start .config/karma.conf.js", "test:ci": "karma start .config/karma.conf.saucelabs.js", - "build:polyfills": "npx rollup -c .config/rollup.polyfills.js" + "build:polyfills": "npx rollup -c .config/rollup.polyfills.js", + "prepublishOnly": "npm run build && npm run build:polyfills && npm test", + "postPublish": "echo Please upload a zip to the github release containing the dist, license and changelog" }, "devDependencies": { "@babel/core": "^7.1.2", @@ -70,6 +68,8 @@ "@babel/plugin-transform-runtime": "^7.1.0", "@babel/polyfill": "^7.0.0", "@babel/preset-env": "^7.1.0", + "@babel/runtime": "^7.1.5", + "@babel/runtime-corejs2": "^7.1.5", "@target/custom-event-polyfill": "github:Adobe-Marketing-Cloud/custom-event-polyfill", "babel-eslint": "^10.0.1", "core-js": "^2.5.7", @@ -82,6 +82,7 @@ "eslint-plugin-standard": "^4.0.0", "esm": "^3.0.84", "http-server": "^0.11.1", + "innersvg-polyfill": "0.0.2", "jasmine-core": "^3.3.0", "karma": "^3.1.1", "karma-chrome-launcher": "^2.2.0", @@ -98,5 +99,11 @@ "rollup-plugin-uglify": "^6.0.0", "rollup-plugin-uglify-es": "0.0.1", "svgdom": "latest" - } + }, + "browserslist": [ + "last 1 version", + "> 0.25%", + "not maintained node versions", + "not dead" + ] } diff --git a/spec/SpecRunner.html b/spec/SpecRunner.html index 9d84677..c24aac5 100644 --- a/spec/SpecRunner.html +++ b/spec/SpecRunner.html @@ -15,7 +15,9 @@ <link rel="stylesheet" href="fixtures/fixture.css"> <!-- include source files here... --> - <script src="../dist/svg.js" charset="utf-8"></script> + <script src="../dist/polyfills.js" charset="utf-8"></script> + <script src="../dist/polyfillsIE.js" charset="utf-8"></script> + <script src="../dist/svg.min.js" charset="utf-8"></script> </head> diff --git a/spec/spec/arrange.js b/spec/spec/arrange.js index 89ece9c..ea0ea2b 100644 --- a/spec/spec/arrange.js +++ b/spec/spec/arrange.js @@ -58,6 +58,7 @@ describe('Arrange', function() { it('keeps the defs on top of the stack', function() { draw.defs() e3.forward() + expect(draw.node.childNodes[2+parserInDoc]).toBe(e3.node) expect(draw.node.childNodes[3+parserInDoc]).toBe(draw.defs().node) }) @@ -169,17 +170,3 @@ describe('Arrange', function() { }) }) - - - - - - - - - - - - - - diff --git a/spec/spec/event.js b/spec/spec/event.js index 83d173a..8515d21 100644 --- a/spec/spec/event.js +++ b/spec/spec/event.js @@ -270,7 +270,8 @@ describe('Event', function() { rect.on('event', function(e) { e.preventDefault() }) - expect(rect.dispatch('event').defaultPrevented).toBe(true) + var event = rect.dispatch('event') + expect(event.defaultPrevented).toBe(true) }) }) }) diff --git a/spec/spec/helper.js b/spec/spec/helper.js index f8992ac..4c9fe4a 100644 --- a/spec/spec/helper.js +++ b/spec/spec/helper.js @@ -183,6 +183,6 @@ window.roundMatrix = function (mat) { +(mat.c.toFixed(5)), +(mat.d.toFixed(5)), +(mat.e.toFixed(5)), - +(mat.f.toFixed(5)), + +(mat.f.toFixed(5)) ) } diff --git a/spec/spec/morphing.js b/spec/spec/morphing.js index 0557428..505440f 100644 --- a/spec/spec/morphing.js +++ b/spec/spec/morphing.js @@ -29,7 +29,7 @@ describe('Morphing', function () { expect(morpher.at(0.5).valueOf()).toEqual(jasmine.objectContaining({a: 7.5, b: 15})) }) - it(`Creates a morphable out of an SVG.Number`, function () { + it('Creates a morphable out of an SVG.Number', function () { var morpher = new SVG.Number(5).to(10) expect(morpher instanceof SVG.Morphable).toBe(true) @@ -38,7 +38,7 @@ describe('Morphing', function () { expect(morpher.at(0.5).valueOf()).toBe(7.5) }) - it(`Creates a morphable out of an SVG.Color`, function () { + it('Creates a morphable out of an SVG.Color', function () { var morpher = new SVG.Color('#fff').to('#000') expect(morpher instanceof SVG.Morphable).toBe(true) @@ -47,7 +47,7 @@ describe('Morphing', function () { expect(morpher.at(0.5).toHex()).toBe('#808080') }) - it(`Creates a morphable out of an SVG.Box`, function () { + it('Creates a morphable out of an SVG.Box', function () { var morpher = new SVG.Box(1, 2, 3, 4).to([5, 6, 7, 8]) expect(morpher instanceof SVG.Morphable).toBe(true) @@ -56,7 +56,7 @@ describe('Morphing', function () { expect(morpher.at(0.5)).toEqual(jasmine.objectContaining({x: 3, y: 4, width: 5, height: 6})) }) - it(`Creates a morphable out of an SVG.Matrix`, function () { + it('Creates a morphable out of an SVG.Matrix', function () { var morpher = new SVG.Matrix(1, 2, 3, 4, 5, 6).to([3, 4, 5, 6, 7, 8]) expect(morpher instanceof SVG.Morphable).toBe(true) @@ -65,7 +65,7 @@ describe('Morphing', function () { expect(morpher.at(0.5)).toEqual(jasmine.objectContaining(new SVG.Matrix(2, 3, 4, 5, 6, 7))) }) - it(`Creates a morphable out of an SVG.Array`, function () { + it('Creates a morphable out of an SVG.Array', function () { var morpher = new SVG.Array([1,2,3,4,5,6]).to([3,4,5,6,7,8]) expect(morpher instanceof SVG.Morphable).toBe(true) @@ -74,7 +74,7 @@ describe('Morphing', function () { expect(morpher.at(0.5).toArray()).toEqual(jasmine.arrayContaining([2, 3, 4, 5, 6, 7])) }) - it(`Creates a morphable out of an SVG.PointArray`, function () { + it('Creates a morphable out of an SVG.PointArray', function () { var morpher = new SVG.PointArray([1, 2, 3, 4, 5, 6]).to([3, 4, 5, 6, 7, 8]) expect(morpher instanceof SVG.Morphable).toBe(true) @@ -83,7 +83,7 @@ describe('Morphing', function () { expect(morpher.at(0.5).toArray()).toEqual(jasmine.arrayContaining([2, 3, 4, 5, 6, 7])) }) - it(`Creates a morphable out of an SVG.PathArray`, function () { + it('Creates a morphable out of an SVG.PathArray', function () { var morpher = new SVG.PathArray(['M', 1, 2, 'L', 3, 4, 'L', 5, 6]).to(['M', 3, 4, 'L', 5, 6, 'L', 7, 8]) expect(morpher instanceof SVG.Morphable).toBe(true) @@ -92,7 +92,7 @@ describe('Morphing', function () { expect(morpher.at(0.5).toArray()).toEqual(jasmine.arrayContaining(['M', 2, 3, 'L', 4, 5, 'L', 6, 7])) }) - it(`Creates a morphable out of an SVG.NonMorphable`, function () { + it('Creates a morphable out of an SVG.NonMorphable', function () { var morpher = new SVG.NonMorphable('foo').to('bar') expect(morpher instanceof SVG.Morphable).toBe(true) @@ -102,7 +102,7 @@ describe('Morphing', function () { expect(morpher.at(1).valueOf()).toBe('bar') }) - it(`Creates a morphable out of an SVG.TransformBag`, function () { + it('Creates a morphable out of an SVG.TransformBag', function () { var morpher = new SVG.TransformBag({rotate: 0, translateX: 0}) .to({rotate: 50, translateX: 20}) @@ -113,7 +113,7 @@ describe('Morphing', function () { expect(morpher.at(0.5)).toEqual(jasmine.objectContaining({rotate: 25, translateX: 10})) }) - it(`Creates a morphable out of an SVG.ObjectBag`, function () { + it('Creates a morphable out of an SVG.ObjectBag', function () { var morpher = new SVG.ObjectBag({a:5, b: 10}).to({a: 10, b: 20}) expect(morpher instanceof SVG.Morphable).toBe(true) diff --git a/spec/spec/runner.js b/spec/spec/runner.js index ff9df7b..2cda176 100644 --- a/spec/spec/runner.js +++ b/spec/spec/runner.js @@ -100,7 +100,7 @@ describe('SVG.Runner', function () { // return new orginalRunner() // }) // - // var element = SVG('<rect>') + // var element = SVG('<rect />') // var runner = element.animate() // expect(SVG.Runner).toHaveBeenCalled(); // expect(runner instanceof SVG.Runner) @@ -111,7 +111,7 @@ describe('SVG.Runner', function () { describe('delay()', function () { it('calls animate with correct parameters', function () { - var element = SVG('<rect>') + var element = SVG('<rect />') spyOn(element, 'animate') element.delay(100, 'now') @@ -662,14 +662,14 @@ describe('SVG.Runner', function () { var runner1 = new SVG.Runner() expect(runner1.element()).toBe(null) - var element = SVG('<rect>') + var element = SVG('<rect />') var runner2 = element.animate() expect(runner2.element()).toBe(element) }) it('sets an element to be bound to the runner', function () { var runner = new SVG.Runner() - var element = SVG('<rect>') + var element = SVG('<rect />') expect(runner.element(element)).toBe(runner) expect(runner.element()).toBe(element) }) @@ -680,7 +680,7 @@ describe('SVG.Runner', function () { var runner1 = new SVG.Runner() expect(runner1.element()).toBe(null) - var element = SVG('<rect>') + var element = SVG('<rect />') var runner2 = element.animate() expect(runner2.timeline()).toBe(element.timeline()) }) diff --git a/spec/spec/svg.js b/spec/spec/svg.js index a3e33b5..57db8e0 100644 --- a/spec/spec/svg.js +++ b/spec/spec/svg.js @@ -62,8 +62,8 @@ describe('SVG', function() { }) it('creates SVG.Shape from any shape string', function() { - var rect = SVG('<rect width="200" height="100">') - , circle = SVG('<circle r="200">') + var rect = SVG('<rect width="200" height="100" />') + , circle = SVG('<circle r="200" />') expect(rect instanceof SVG.Rect).toBe(true) expect(rect.node.nodeName).toBe('rect') diff --git a/src/animation/Morphable.js b/src/animation/Morphable.js index a02ba31..4d52066 100644 --- a/src/animation/Morphable.js +++ b/src/animation/Morphable.js @@ -196,7 +196,14 @@ export class ObjectBag { return } - var entries = Object.entries(objOrArr || {}).sort((a, b) => { + objOrArr = objOrArr || {} + var entries = [] + + for (let i in objOrArr) { + entries.push([i, objOrArr[i]]) + } + + entries.sort((a, b) => { return a[0] - b[0] }) diff --git a/src/main.js b/src/main.js index 1ce11f7..8ea3e5d 100644 --- a/src/main.js +++ b/src/main.js @@ -43,6 +43,7 @@ import SVGArray from './types/SVGArray.js' import SVGNumber from './types/SVGNumber.js' import Shape from './elements/Shape.js' import Svg from './elements/Svg.js' +import Symbol from './elements/Symbol.js' import Text from './elements/Text.js' import Tspan from './elements/Tspan.js' import * as defaults from './modules/core/defaults.js' diff --git a/src/polyfills/children.js b/src/polyfills/children.js new file mode 100644 index 0000000..98e9143 --- /dev/null +++ b/src/polyfills/children.js @@ -0,0 +1,8 @@ +import { filter } from '../utils/utils.js' + +// IE11: children does not work for svg nodes +export default function children (node) { + return filter(node.childNodes, function (child) { + return child.nodeType === 1 + }) +} diff --git a/src/polyfills/innerHTML.js b/src/polyfills/innerHTML.js new file mode 100644 index 0000000..4be7f1b --- /dev/null +++ b/src/polyfills/innerHTML.js @@ -0,0 +1,95 @@ +/* globals SVGElement, DOMParser */ + +(function () { + try { + if (SVGElement.prototype.innerHTML) return + } catch (e) { return } + + var serializeXML = function (node, output) { + var nodeType = node.nodeType + if (nodeType === 3) { + output.push(node.textContent.replace(/&/, '&').replace(/</, '<').replace('>', '>')) + } else if (nodeType === 1) { + output.push('<', node.tagName) + if (node.hasAttributes()) { + [].forEach.call(node.attributes, function (attrNode) { + output.push(' ', attrNode.name, '=\'', attrNode.value, '\'') + }) + } + if (node.hasChildNodes()) { + output.push('>'); + [].forEach.call(node.childNodes, function (childNode) { + serializeXML(childNode, output) + }) + output.push('</', node.tagName, '>') + } else { + output.push('/>') + } + } else if (nodeType === 8) { + output.push('<!--', node.nodeValue, '-->') + } + } + + Object.defineProperty(SVGElement.prototype, 'innerHTML', { + get: function () { + var output = [] + var childNode = this.firstChild + while (childNode) { + serializeXML(childNode, output) + childNode = childNode.nextSibling + } + return output.join('') + }, + set: function (markupText) { + while (this.firstChild) { + this.removeChild(this.firstChild) + } + + try { + var dXML = new DOMParser() + dXML.async = false + + var sXML = '<svg xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\'>' + markupText + '</svg>' + var svgDocElement = dXML.parseFromString(sXML, 'text/xml').documentElement + + var childNode = svgDocElement.firstChild + while (childNode) { + this.appendChild(this.ownerDocument.importNode(childNode, true)) + childNode = childNode.nextSibling + } + } catch (e) { + throw new Error('Can not set innerHTML on node') + }; + } + }) + + Object.defineProperty(SVGElement.prototype, 'outerHTML', { + get: function () { + var output = [] + serializeXML(this, output) + return output.join('') + }, + set: function (markupText) { + while (this.firstChild) { + this.removeChild(this.firstChild) + } + + try { + var dXML = new DOMParser() + dXML.async = false + + var sXML = '<svg xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\'>' + markupText + '</svg>' + var svgDocElement = dXML.parseFromString(sXML, 'text/xml').documentElement + + var childNode = svgDocElement.firstChild + while (childNode) { + this.parentNode.insertBefore(this.ownerDocument.importNode(childNode, true), this) + // this.appendChild(this.ownerDocument.importNode(childNode, true)); + childNode = childNode.nextSibling + } + } catch (e) { + throw new Error('Can not set outerHTML on node') + }; + } + }) +})() diff --git a/src/utils/adopter.js b/src/utils/adopter.js index 52d589e..a4c60de 100644 --- a/src/utils/adopter.js +++ b/src/utils/adopter.js @@ -5,7 +5,7 @@ import { globals } from '../utils/window.js' import Base from '../types/Base.js' const elements = {} -export const root = Symbol('root') +export const root = '___SYMBOL___ROOT___' // Method for element creation export function makeNode (name) { diff --git a/src/utils/methods.js b/src/utils/methods.js index 70f9329..bf30a1e 100644 --- a/src/utils/methods.js +++ b/src/utils/methods.js @@ -1,5 +1,4 @@ const methods = {} -const constructors = {} const names = [] export function registerMethods (name, m) { @@ -11,8 +10,8 @@ export function registerMethods (name, m) { } if (typeof name === 'object') { - for (let [_name, _m] of Object.entries(name)) { - registerMethods(_name, _m) + for (let _name in name) { + registerMethods(_name, name[_name]) } return } @@ -32,11 +31,3 @@ export function getMethodNames () { export function addMethodNames (_names) { names.push(..._names) } - -export function registerConstructor (name, setup) { - constructors[name] = setup -} - -export function getConstructor (name) { - return constructors[name] ? { setup: constructors[name], name } : {} -} |