diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..7cd53fdb --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +**/node_modules/ diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..f99a9bd9 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,16 @@ +{ + "extends": "defaults", + + "env": { + "browser": true, + "node": true + }, + + "globals": { + "$": true + }, + + "rules": { + "no-console": 0 + } +} diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 679b4dcb..00000000 --- a/Gruntfile.js +++ /dev/null @@ -1,246 +0,0 @@ -/*global module:false*/ -module.exports = function(grunt) { - - var component = require('./package.json'); - // before release: - // update component.js, package.json - // after release: - // add tag to repo: git tag v1.0.0 - // push tag: git push --tags - // to initialize all again - // http://twoguysarguing.wordpress.com/2010/11/14/tie-git-submodules-to-a-particular-commit-or-branch/ - // nav to site and do: git checkout gh-pages - - grunt.loadNpmTasks('grunt-rigger'); - grunt.loadNpmTasks('grunt-contrib'); - - // Project configuration. - grunt.initConfig({ - meta: { - version: component.version, - banner: '// ' + component.name + ', v<%= meta.version %>\n' + - '// Copyright (c)<%= grunt.template.today("yyyy") %> Adriano Raiano (adrai).\n' + - '// Distributed under MIT license\n' + - '// http://adrai.github.io/flowchart.js\n' - }, - - clean: ['bin'], - - jshint: { - options: { - scripturl: true, - laxcomma: true, - loopfunc: true, - curly: false, - eqeqeq: false, - immed: false, - latedef: true, - newcap: true, - noarg: true, - sub: true, - undef: true, - boss: true, - eqnull: true, - browser: true, - globals: { - jQuery: true, - $: true, - console: true, - ActiveXObject: true, - module: true - } - }, - files: [ 'bin/*.js' ] - }, - - rig: { - options: { - banner: '<%= meta.banner %>' - }, - build: { - src: ['src/flowchart.js'], - dest: 'bin/flowchart-latest.js' - }, - amd: { - src: ['src/amd.js'], - dest: 'bin/flowchart.amd-latest.js' - } - }, - - uglify: { - options: { - banner: '<%= meta.banner %>', - }, - // bin: { - // src: ['bin/flowchart-latest.js'], - // dest: 'bin/flowchart-<%= meta.version %>.min.js' - // }, - // release: { - // src: ['bin/flowchart-latest.js'], - // dest: 'release/flowchart-<%= meta.version %>.min.js', - // options: { - // sourceMap: true, - // sourceMapName: 'release/flowchart-<%= meta.version %>.min.map' - // } - // }, - // amd: { - // src: ['bin/flowchart.amd-latest.js'], - // dest: 'release/flowchart.amd-<%= meta.version %>.min.js', - // options: { - // sourceMap: true, - // sourceMapName: 'release/flowchart.amd-<%= meta.version %>.min.map' - // } - // } - release: { - src: ['bin/flowchart-latest.js'], - dest: 'release/flowchart.min.js', - options: { - sourceMap: true, - sourceMapName: 'release/flowchart.min.map' - } - }, - amd: { - src: ['bin/flowchart.amd-latest.js'], - dest: 'release/flowchart.amd.min.js', - options: { - sourceMap: true, - sourceMapName: 'release/flowchart.amd.min.map' - } - } - }, - - copy: { - js: { - // files: [ - // { expand: true, cwd: 'bin/', src: ['*.js'], dest: 'release/', - // rename: function(dest, src) { console.log(src + ' -> ' + dest); - // if (src == 'flowchart-latest.js') { - // dest += 'flowchart-' + component.version + '.js'; - // } - // if (src == 'flowchart.amd-latest.js') { - // dest += 'flowchart.amd-' + component.version + '.js'; - // } - // return dest; - // } - // }, - // { expand: true, cwd: 'bin/', src: ['flowchart-latest.js'], dest: 'site/'} - // //'bin/': ['bin/flowchart-latest.js', 'bin/flowchart.amd-latest.js'], - // //'release/': ['bin/flowchart-latest.js', 'bin/flowchart.amd-latest.js'] - // ] - files: [ - { expand: true, cwd: 'bin/', src: ['*.js'], dest: 'release/', - rename: function(dest, src) { console.log(src + ' -> ' + dest); - if (src == 'flowchart-latest.js') { - dest += 'flowchart.js'; - } - if (src == 'flowchart.amd-latest.js') { - dest += 'flowchart.amd.js'; - } - return dest; - } - }, - { expand: true, cwd: 'bin/', src: ['flowchart-latest.js'], dest: 'site/'} - //'bin/': ['bin/flowchart-latest.js', 'bin/flowchart.amd-latest.js'], - //'release/': ['bin/flowchart-latest.js', 'bin/flowchart.amd-latest.js'] - ] - } - }, - - compress: { - // zip: { - // options: { - // archive: 'release/flowchart-<%= meta.version %>.zip', - // mode: 'zip', - // level: 1 - // }, - // files: [ - // { - // expand: true, - // flatten: true, - // cwd: 'release/', - // src: [ - // 'flowchart-<%= meta.version %>.js', - // 'flowchart-<%= meta.version %>.min.js', - // 'flowchart-<%= meta.version %>.min.map' - // ], - // dest: 'flowchart-<%= meta.version %>/' - // } - // ] - // }, - 'zip-latest': { - options: { - archive: 'release/flowchart.zip', - mode: 'zip', - level: 1 - }, - files: [ - { - expand: true, - flatten: true, - cwd: 'release/', - src: [ - 'flowchart.js', - 'flowchart.min.js', - 'flowchart.min.map' - ], - dest: 'flowchart/' - } - ] - }, - // zipamd: { - // options: { - // archive: 'release/flowchart.amd-<%= meta.version %>.zip', - // mode: 'zip', - // level: 1 - // }, - // files: [ - // { - // expand: true, - // flatten: true, - // cwd: 'release/', - // src: [ - // 'flowchart.amd-<%= meta.version %>.js', - // 'flowchart.amd-<%= meta.version %>.min.js', - // 'flowchart.amd-<%= meta.version %>.min.map' - // ], - // dest: 'flowchart.amd-<%= meta.version %>/' - // } - // ] - // }, - 'zipamd-latest': { - options: { - archive: 'release/flowchart.amd.zip', - mode: 'zip', - level: 1 - }, - files: [ - { - expand: true, - flatten: true, - cwd: 'release/', - src: [ - 'flowchart.amd.js', - 'flowchart.amd.min.js', - 'flowchart.amd.min.map' - ], - dest: 'flowchart/' - } - ] - } - }, - - watch: { - lib: { - files: 'src/*.js', - tasks: 'rig:build' - } - } - - }); - - // Default task. - grunt.registerTask('default', ['clean', 'rig']); - grunt.registerTask('release', ['default', 'uglify', 'copy', 'compress']); - - -}; diff --git a/devserver.js b/devserver.js new file mode 100644 index 00000000..c993de91 --- /dev/null +++ b/devserver.js @@ -0,0 +1,30 @@ +var path = require('path'); +var express = require('express'); +var webpack = require('webpack'); +var config = require('./webpack.config'); + +var port = 8000; +var app = express(); +var compiler = webpack(config); + +app.use(express.static(process.cwd())); + +app.use(require('webpack-dev-middleware')(compiler, { + noInfo: true, + publicPath: config.output.publicPath +})); + +app.use(require('webpack-hot-middleware')(compiler)); + +app.get('/', function (req, res) { + res.sendFile(path.join(__dirname, 'index.html')); +}); + +app.listen(port, '0.0.0.0', function (err) { + if (err) { + console.log(err); + return; + } + + console.log('Listening at http://0.0.0.0:%s', port); +}); diff --git a/index.html b/index.html new file mode 100644 index 00000000..6bc6c29b --- /dev/null +++ b/index.html @@ -0,0 +1,33 @@ + + + + Demo page + + + + + +
+st=>start: Start|past:>http://www.google.com[blank] +e=>end: End:>http://www.google.com +op1=>operation: My Operation|past +op2=>operation: Stuff|current +sub1=>subroutine: My Subroutine|invalid +cond=>condition: Yes +or No?|approved:>http://www.google.com +c2=>condition: Good idea|rejected +io=>inputoutput: catch something...|request + +st->op1(right)->cond +cond(yes, right)->c2 +cond(no)->sub1(left)->op1 +c2(yes)->io->e +c2(no)->op2->e +
+ + + + + diff --git a/index.js b/index.js new file mode 100644 index 00000000..2ce1aa86 --- /dev/null +++ b/index.js @@ -0,0 +1,13 @@ +require('./src/flowchart.shim'); +var parse = require('./src/flowchart.parse'); +require('./src/jquery-plugin'); + +var FlowChart = { + parse: parse +}; + +if (typeof window !== 'undefined') { + window.FlowChart = FlowChart; +} + +module.exports = FlowChart; diff --git a/package.json b/package.json index 293432fa..28fa6360 100644 --- a/package.json +++ b/package.json @@ -2,22 +2,32 @@ "author": "adrai", "name": "flowchart", "version": "1.4.2", + "main": "./index", "private": false, "engines": { "node": "~v0.4.12" }, - "dependencies": {}, + "dependencies": { + "raphael": "git://github.com/DmitryBaranovskiy/raphael.git" + }, "devDependencies": { - "grunt": ">=0.4.1", - "grunt-rigger": ">=0.5.0", - "grunt-contrib": ">=0.1.0", + "eslint": "^1.10.3", + "eslint-config-defaults": "^8.0.2", "express": ">= 0.0.1", - "async": ">= 0.1.18", + "jquery": "^2.2.0", "lodash": ">=0.2.1", - "zipstream": ">=0.2.1" + "moment": "^2.11.1", + "webpack": "^1.12.11", + "webpack-dev-middleware": "^1.4.0", + "webpack-hot-middleware": "^2.6.0" }, "scripts": { - "test": "" + "start": "node devserver.js", + "lint": "eslint src", + "build:unminified": "NODE_ENV=production webpack -d --config webpack.config.js", + "build:minified": "NODE_ENV=production MINIFIED=1 webpack -d --config webpack.config.js", + "build": "npm run build:unminified && npm run build:minified", + "test": "npm run lint" }, "repository": { "type": "git", @@ -29,13 +39,5 @@ "script" ], "homepage": "http://flowchart.js.org/", - "license": "MIT", - "files": [ - "release/flowchart.js", - "release/flowchart.min.js", - "release/flowchart.min.map", - "release/flowchart.amd.js", - "release/flowchart.amd.min.js", - "release/flowchart.amd.min.map" - ] + "license": "MIT" } diff --git a/release/flowchart.amd.js b/release/flowchart.amd.js deleted file mode 100644 index 29c57db6..00000000 --- a/release/flowchart.amd.js +++ /dev/null @@ -1,1427 +0,0 @@ -// flowchart, v1.4.2 -// Copyright (c)2015 Adriano Raiano (adrai). -// Distributed under MIT license -// http://adrai.github.io/flowchart.js -(function (root, factory) { - if (typeof exports === 'object') { - - module.exports = factory(); - - } else if (typeof define === 'function' && define.amd) { - - define([], factory); - - } -}(this, function () { - - // add indexOf to non ECMA-262 standard compliant browsers - if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { - "use strict"; - if (this === null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) { - return -1; - } - var n = 0; - if (arguments.length > 0) { - n = Number(arguments[1]); - if (n != n) { // shortcut for verifying if it's NaN - n = 0; - } else if (n !== 0 && n != Infinity && n != -Infinity) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - if (n >= len) { - return -1; - } - var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); - for (; k < len; k++) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; - } - - // add lastIndexOf to non ECMA-262 standard compliant browsers - if (!Array.prototype.lastIndexOf) { - Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) { - "use strict"; - if (this === null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) { - return -1; - } - var n = len; - if (arguments.length > 1) { - n = Number(arguments[1]); - if (n != n) { - n = 0; - } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n); - for (; k >= 0; k--) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; - } - - if (!String.prototype.trim) { - String.prototype.trim = function() { - return this.replace(/^\s+|\s+$/g, ''); - }; - } - - var root = this, - flowchart = {}; - - // defaults - var o = { - 'x': 0, - 'y': 0, - 'line-width': 3, - 'line-length': 50, - 'text-margin': 10, - 'font-size': 14, - 'font-color': 'black', - // 'font': 'normal', - // 'font-family': 'calibri', - // 'font-weight': 'normal', - 'line-color': 'black', - 'element-color': 'black', - 'fill': 'white', - 'yes-text': 'yes', - 'no-text': 'no', - 'arrow-end': 'block', - 'class': 'flowchart', - 'scale': 1, - 'symbols': { - 'start': {}, - 'end': {}, - 'condition': {}, - 'inputoutput': {}, - 'operation': {}, - 'subroutine': {} - }//, - // 'flowstate' : { - // 'past' : { 'fill': '#CCCCCC', 'font-size': 12}, - // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'}, - // 'future' : { 'fill': '#FFFF99'}, - // 'invalid': {'fill': '#444444'} - // } - }; - function _defaults(options, defaultOptions) { - if (!options || typeof options === 'function') { - return defaultOptions; - } - - var merged = {}; - for (var attrname in defaultOptions) { - merged[attrname] = defaultOptions[attrname]; - } - - for (attrname in options) { - if (options[attrname]) { - if (typeof merged[attrname] === 'object') { - merged[attrname] = _defaults(merged[attrname], options[attrname]); - } else { - merged[attrname] = options[attrname]; - } - } - } - return merged; - } - - function _inherits(ctor, superCtor) { - if (typeof(Object.create) === 'function') { - // implementation from standard node.js 'util' module - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - } else { - // old school shim for old browsers - ctor.super_ = superCtor; - var TempCtor = function () {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - } - } - - // move dependent functions to a container so that - // they can be overriden easier in no jquery environment (node.js) - var f = { - defaults: _defaults, - inherits: _inherits - }; - function drawPath(chart, location, points) { - var i, len; - var path = 'M{0},{1}'; - for (i = 2, len = 2 * points.length + 2; i < len; i+=2) { - path += ' L{' + i + '},{' + (i + 1) + '}'; - } - var pathValues = [location.x, location.y]; - for (i = 0, len = points.length; i < len; i++) { - pathValues.push(points[i].x); - pathValues.push(points[i].y); - } - var symbol = chart.paper.path(path, pathValues); - symbol.attr('stroke', chart.options['element-color']); - symbol.attr('stroke-width', chart.options['line-width']); - - var font = chart.options['font']; - var fontF = chart.options['font-family']; - var fontW = chart.options['font-weight']; - - if (font) symbol.attr({ 'font': font }); - if (fontF) symbol.attr({ 'font-family': fontF }); - if (fontW) symbol.attr({ 'font-weight': fontW }); - - return symbol; - } - - function drawLine(chart, from, to, text) { - var i, len; - - if (Object.prototype.toString.call(to) !== '[object Array]') { - to = [to]; - } - - var path = 'M{0},{1}'; - for (i = 2, len = 2 * to.length + 2; i < len; i+=2) { - path += ' L{' + i + '},{' + (i + 1) + '}'; - } - var pathValues = [from.x, from.y]; - for (i = 0, len = to.length; i < len; i++) { - pathValues.push(to[i].x); - pathValues.push(to[i].y); - } - - var line = chart.paper.path(path, pathValues); - line.attr({ - stroke: chart.options['line-color'], - 'stroke-width': chart.options['line-width'], - 'arrow-end': chart.options['arrow-end'] - }); - - var font = chart.options['font']; - var fontF = chart.options['font-family']; - var fontW = chart.options['font-weight']; - - if (font) line.attr({ 'font': font }); - if (fontF) line.attr({ 'font-family': fontF }); - if (fontW) line.attr({ 'font-weight': fontW }); - - if (text) { - - var centerText = false; - - var textPath = chart.paper.text(0, 0, text); - - var isHorizontal = false; - var firstTo = to[0]; - - if (from.y === firstTo.y) { - isHorizontal = true; - } - - var x = 0, - y = 0; - - if (centerText) { - if (from.x > firstTo.x) { - x = from.x - (from.x - firstTo.x)/2; - } else { - x = firstTo.x - (firstTo.x - from.x)/2; - } - - if (from.y > firstTo.y) { - y = from.y - (from.y - firstTo.y)/2; - } else { - y = firstTo.y - (firstTo.y - from.y)/2; - } - - if (isHorizontal) { - x -= textPath.getBBox().width/2; - y -= chart.options['text-margin']; - } else { - x += chart.options['text-margin']; - y -= textPath.getBBox().height/2; - } - } else { - x = from.x; - y = from.y; - - if (isHorizontal) { - x += chart.options['text-margin']/2; - y -= chart.options['text-margin']; - } else { - x += chart.options['text-margin']/2; - y += chart.options['text-margin']; - } - } - - textPath.attr({ - 'text-anchor': 'start', - 'font-size': chart.options['font-size'], - 'fill': chart.options['font-color'], - x: x, - y: y - }); - - if (font) textPath.attr({ 'font': font }); - if (fontF) textPath.attr({ 'font-family': fontF }); - if (fontW) textPath.attr({ 'font-weight': fontW }); - } - - return line; - } - - function checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) { - // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point - var denominator, a, b, numerator1, numerator2, result = { - x: null, - y: null, - onLine1: false, - onLine2: false - }; - denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY)); - if (denominator === 0) { - return result; - } - a = line1StartY - line2StartY; - b = line1StartX - line2StartX; - numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b); - numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b); - a = numerator1 / denominator; - b = numerator2 / denominator; - - // if we cast these lines infinitely in both directions, they intersect here: - result.x = line1StartX + (a * (line1EndX - line1StartX)); - result.y = line1StartY + (a * (line1EndY - line1StartY)); - /* - // it is worth noting that this should be the same as: - x = line2StartX + (b * (line2EndX - line2StartX)); - y = line2StartX + (b * (line2EndY - line2StartY)); - */ - // if line1 is a segment and line2 is infinite, they intersect if: - if (a > 0 && a < 1) { - result.onLine1 = true; - } - // if line2 is a segment and line1 is infinite, they intersect if: - if (b > 0 && b < 1) { - result.onLine2 = true; - } - // if line1 and line2 are segments, they intersect if both of the above are true - return result; - } - function FlowChart(container, options) { - options = options || {}; - - this.paper = new Raphael(container); - - this.options = f.defaults(options, o); - - this.symbols = []; - this.lines = []; - this.start = null; - } - - FlowChart.prototype.handle = function(symbol) { - if (this.symbols.indexOf(symbol) <= -1) { - this.symbols.push(symbol); - } - - var flowChart = this; - - if (symbol instanceof(Condition)) { - symbol.yes = function(nextSymbol) { - symbol.yes_symbol = nextSymbol; - if(symbol.no_symbol) { - symbol.pathOk = true; - } - return flowChart.handle(nextSymbol); - }; - symbol.no = function(nextSymbol) { - symbol.no_symbol = nextSymbol; - if(symbol.yes_symbol) { - symbol.pathOk = true; - } - return flowChart.handle(nextSymbol); - }; - } else { - symbol.then = function(nextSymbol) { - symbol.next = nextSymbol; - symbol.pathOk = true; - return flowChart.handle(nextSymbol); - }; - } - - return symbol; - }; - - FlowChart.prototype.startWith = function(symbol) { - this.start = symbol; - return this.handle(symbol); - }; - - FlowChart.prototype.render = function() { - var maxWidth = 0, - maxHeight = 0, - i = 0, - len = 0, - maxX = 0, - maxY = 0, - symbol; - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - if (symbol.width > maxWidth) { - maxWidth = symbol.width; - } - if (symbol.height > maxHeight) { - maxHeight = symbol.height; - } - } - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']); - symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']); - } - - this.start.render(); - // for (i = 0, len = this.symbols.length; i < len; i++) { - // symbol = this.symbols[i]; - // symbol.render(); - // } - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - symbol.renderLines(); - } - - maxX = this.maxXFromLine; - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - var x = symbol.getX() + symbol.width; - var y = symbol.getY() + symbol.height; - if (x > maxX) { - maxX = x; - } - if (y > maxY) { - maxY = y; - } - } - - var scale = this.options['scale']; - var lineWidth = this.options['line-width']; - this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale)); - this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true); - }; - - FlowChart.prototype.clean = function() { - if (this.paper) { - var paperDom = this.paper.canvas; - paperDom.parentNode.removeChild(paperDom); - } - }; - function Symbol(chart, options, symbol) { - this.chart = chart; - this.group = this.chart.paper.set(); - this.symbol = symbol; - this.connectedTo = []; - this.symbolType = options.symbolType; - this.flowstate = (options.flowstate || 'future'); - - this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined; - - this.text = this.chart.paper.text(0, 0, options.text); - //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t - if (options.key) { this.text.node.id = options.key + 't'; } - this.text.node.setAttribute('class', this.getAttr('class') + 't'); - - this.text.attr({ - 'text-anchor': 'start', - 'x' : this.getAttr('text-margin'), - 'fill' : this.getAttr('font-color'), - 'font-size' : this.getAttr('font-size') - }); - - var font = this.getAttr('font'); - var fontF = this.getAttr('font-family'); - var fontW = this.getAttr('font-weight'); - - if (font) this.text.attr({ 'font': font }); - if (fontF) this.text.attr({ 'font-family': fontF }); - if (fontW) this.text.attr({ 'font-weight': fontW }); - - if (options.link) { this.text.attr('href', options.link); } - if (options.target) { this.text.attr('target', options.target); } - - var maxWidth = this.getAttr('maxWidth'); - if (maxWidth) { - // using this approach: http://stackoverflow.com/a/3153457/22466 - var words = options.text.split(' '); - var tempText = ""; - for (var i=0, ii=words.length; i maxWidth) { - tempText += "\n" + word; - } else { - tempText += " " + word; - } - } - this.text.attr("text", tempText.substring(1)); - } - - this.group.push(this.text); - - if (symbol) { - var tmpMargin = this.getAttr('text-margin'); - - symbol.attr({ - 'fill' : this.getAttr('fill'), - 'stroke' : this.getAttr('element-color'), - 'stroke-width' : this.getAttr('line-width'), - 'width' : this.text.getBBox().width + 2 * tmpMargin, - 'height' : this.text.getBBox().height + 2 * tmpMargin - }); - - symbol.node.setAttribute('class', this.getAttr('class')); - - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.text.attr({ - 'y': symbol.getBBox().height/2 - }); - - this.initialize(); - } - - } - - /* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */ - Symbol.prototype.getAttr = function(attName) { - if (!this.chart) { - return undefined; - } - var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined; - var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined; - var opt1; - if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) { - opt1 = this.chart.options.flowstate[this.flowstate][attName]; - } - return (opt1 || opt2 || opt3); - }; - - Symbol.prototype.initialize = function() { - this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width')); - - this.width = this.group.getBBox().width; - this.height = this.group.getBBox().height; - }; - - Symbol.prototype.getCenter = function() { - return {x: this.getX() + this.width/2, - y: this.getY() + this.height/2}; - }; - - Symbol.prototype.getX = function() { - return this.group.getBBox().x; - }; - - Symbol.prototype.getY = function() { - return this.group.getBBox().y; - }; - - Symbol.prototype.shiftX = function(x) { - this.group.transform('t' + (this.getX() + x) + ',' + this.getY()); - }; - - Symbol.prototype.setX = function(x) { - this.group.transform('t' + x + ',' + this.getY()); - }; - - Symbol.prototype.shiftY = function(y) { - this.group.transform('t' + this.getX() + ',' + (this.getY() + y)); - }; - - Symbol.prototype.setY = function(y) { - this.group.transform('t' + this.getX() + ',' + y); - }; - - Symbol.prototype.getTop = function() { - var y = this.getY(); - var x = this.getX() + this.width/2; - return {x: x, y: y}; - }; - - Symbol.prototype.getBottom = function() { - var y = this.getY() + this.height; - var x = this.getX() + this.width/2; - return {x: x, y: y}; - }; - - Symbol.prototype.getLeft = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX(); - return {x: x, y: y}; - }; - - Symbol.prototype.getRight = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.group.getBBox().width; - return {x: x, y: y}; - }; - - Symbol.prototype.render = function() { - if (this.next) { - - var lineLength = this.getAttr('line-length'); - - if (this.next_direction === 'right') { - - var rightPoint = this.getRight(); - var leftPoint = this.next.getLeft(); - - if (!this.next.isPositioned) { - - this.next.setY(rightPoint.y - this.next.height/2); - this.next.shiftX(this.group.getBBox().x + this.width + lineLength); - - var self = this; - (function shift() { - var hasSymbolUnder = false; - var symb; - for (var i = 0, len = self.chart.symbols.length; i < len; i++) { - symb = self.chart.symbols[i]; - - var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x); - if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) { - hasSymbolUnder = true; - break; - } - } - - if (hasSymbolUnder) { - self.next.setX(symb.getX() + symb.width + lineLength); - shift(); - } - })(); - - this.next.isPositioned = true; - - this.next.render(); - } - } else { - var bottomPoint = this.getBottom(); - var topPoint = this.next.getTop(); - - if (!this.next.isPositioned) { - this.next.shiftY(this.getY() + this.height + lineLength); - this.next.setX(bottomPoint.x - this.next.width/2); - this.next.isPositioned = true; - - this.next.render(); - } - } - } - }; - - Symbol.prototype.renderLines = function() { - if (this.next) { - if (this.next_direction) { - this.drawLineTo(this.next, '', this.next_direction); - } else { - this.drawLineTo(this.next); - } - } - }; - - Symbol.prototype.drawLineTo = function(symbol, text, origin) { - if (this.connectedTo.indexOf(symbol) < 0) { - this.connectedTo.push(symbol); - } - - var x = this.getCenter().x, - y = this.getCenter().y, - top = this.getTop(), - right = this.getRight(), - bottom = this.getBottom(), - left = this.getLeft(); - - var symbolX = symbol.getCenter().x, - symbolY = symbol.getCenter().y, - symbolTop = symbol.getTop(), - symbolRight = symbol.getRight(), - symbolBottom = symbol.getBottom(), - symbolLeft = symbol.getLeft(); - - var isOnSameColumn = x === symbolX, - isOnSameLine = y === symbolY, - isUnder = y < symbolY, - isUpper = y > symbolY, - isLeft = x > symbolX, - isRight = x < symbolX; - - var maxX = 0, - line, - lineLength = this.getAttr('line-length'), - lineWith = this.getAttr('line-width'); - - if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) { - line = drawLine(this.chart, bottom, symbolTop, text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x; - } else if ((!origin || origin === 'right') && isOnSameLine && isRight) { - line = drawLine(this.chart, right, symbolLeft, text); - this.rightStart = true; - symbol.leftEnd = true; - maxX = symbolLeft.x; - } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) { - line = drawLine(this.chart, left, symbolRight, text); - this.leftStart = true; - symbol.rightEnd = true; - maxX = symbolRight.x; - } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((!origin || origin === 'bottom') && isLeft) { - if (this.leftEnd && isUpper) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - } else { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - } - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + (bottom.x - symbolTop.x)/2; - } else if ((!origin || origin === 'bottom') && isRight) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + (bottom.x - symbolTop.x)/2; - } else if ((origin && origin === 'right') && isLeft) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((origin && origin === 'right') && isRight) { - line = drawLine(this.chart, right, [ - {x: symbolTop.x, y: right.y}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + lineLength/2; - } else if ((origin === 'left') && isOnSameColumn && isUpper) { - var diffX = left.x - lineLength/2; - if (symbolLeft.x < left.x) { - diffX = symbolLeft.x - lineLength/2; - } - line = drawLine(this.chart, left, [ - {x: diffX, y: left.y}, - {x: diffX, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.leftStart = true; - symbol.topEnd = true; - maxX = left.x; - } else if ((origin === 'left')) { - line = drawLine(this.chart, left, [ - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y}, - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.leftStart = true; - symbol.topEnd = true; - maxX = left.x; - } - - if (line) { - var self = this; - for (var l = 0, llen = this.chart.lines.length; l < llen; l++) { - var otherLine = this.chart.lines[l]; - var i, - len, - intersections, - inter; - - var ePath = otherLine.attr('path'), - lPath = line.attr('path'); - - for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) { - var newPath = []; - newPath.push(['M', ePath[iP][1], ePath[iP][2]]); - newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]); - - var line1_from_x = newPath[0][1]; - var line1_from_y = newPath[0][2]; - var line1_to_x = newPath[1][1]; - var line1_to_y = newPath[1][2]; - - for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) { - var newLinePath = []; - newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]); - newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]); - - var line2_from_x = newLinePath[0][1]; - var line2_from_y = newLinePath[0][2]; - var line2_to_x = newLinePath[1][1]; - var line2_to_y = newLinePath[1][2]; - - var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y); - if (res.onLine1 && res.onLine2) { - - var newSegment; - if (line2_from_y === line2_to_y) { - if (line2_from_x > line2_to_x) { - newSegment = ['L', res.x + lineWith * 2, line2_from_y]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } else { - newSegment = ['L', res.x - lineWith * 2, line2_from_y]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } - } else { - if (line2_from_y > line2_to_y) { - newSegment = ['L', line2_from_x, res.y + lineWith * 2]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } else { - newSegment = ['L', line2_from_x, res.y - lineWith * 2]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } - } - - lP += 2; - len += 2; - } - } - } - } - - this.chart.lines.push(line); - } - - if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) { - this.chart.maxXFromLine = maxX; - } - }; - function Start(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0, 20); - options = options || {}; - options.text = options.text || 'Start'; - Symbol.call(this, chart, options, symbol); - } - f.inherits(Start, Symbol); - - - // Start.prototype.render = function() { - // if (this.next) { - // var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length']; - - // var bottomPoint = this.getBottom(); - // var topPoint = this.next.getTop(); - - // if (!this.next.isPositioned) { - // this.next.shiftY(this.getY() + this.height + lineLength); - // this.next.setX(bottomPoint.x - this.next.width/2); - // this.next.isPositioned = true; - - // this.next.render(); - // } - // } - // }; - - // Start.prototype.renderLines = function() { - // if (this.next) { - // this.drawLineTo(this.next); - // } - // }; - function End(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0, 20); - options = options || {}; - options.text = options.text || 'End'; - Symbol.call(this, chart, options, symbol); - } - f.inherits(End, Symbol); - function Operation(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0); - options = options || {}; - Symbol.call(this, chart, options, symbol); - } - f.inherits(Operation, Symbol); - function Subroutine(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0); - options = options || {}; - Symbol.call(this, chart, options, symbol); - - symbol.attr({ - width: this.text.getBBox().width + 4 * this.getAttr('text-margin') - }); - - this.text.attr({ - 'x': 2 * this.getAttr('text-margin') - }); - - var innerWrap = chart.paper.rect(0, 0, 0, 0); - innerWrap.attr({ - x: this.getAttr('text-margin'), - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - width: this.text.getBBox().width + 2 * this.getAttr('text-margin'), - height: this.text.getBBox().height + 2 * this.getAttr('text-margin'), - fill: this.getAttr('fill') - }); - if (options.key) { innerWrap.node.id = options.key + 'i'; } - - var font = this.getAttr('font'); - var fontF = this.getAttr('font-family'); - var fontW = this.getAttr('font-weight'); - - if (font) innerWrap.attr({ 'font': font }); - if (fontF) innerWrap.attr({ 'font-family': fontF }); - if (fontW) innerWrap.attr({ 'font-weight': fontW }); - - if (options.link) { innerWrap.attr('href', options.link); } - if (options.target) { innerWrap.attr('target', options.target); } - this.group.push(innerWrap); - innerWrap.insertBefore(this.text); - - this.initialize(); - } - f.inherits(Subroutine, Symbol); - function InputOutput(chart, options) { - options = options || {}; - Symbol.call(this, chart, options); - this.textMargin = this.getAttr('text-margin'); - - this.text.attr({ - x: this.textMargin * 3 - }); - - var width = this.text.getBBox().width + 4 * this.textMargin; - var height = this.text.getBBox().height + 2 * this.textMargin; - var startX = this.textMargin; - var startY = height/2; - - var start = {x: startX, y: startY}; - var points = [ - {x: startX - this.textMargin, y: height}, - {x: startX - this.textMargin + width, y: height}, - {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0}, - {x: startX - this.textMargin + 2 * this.textMargin, y: 0}, - {x: startX, y: startY} - ]; - - var symbol = drawPath(chart, start, points); - - symbol.attr({ - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - fill: this.getAttr('fill') - }); - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - symbol.node.setAttribute('class', this.getAttr('class')); - - this.text.attr({ - y: symbol.getBBox().height/2 - }); - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.initialize(); - } - f.inherits(InputOutput, Symbol); - - InputOutput.prototype.getLeft = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.textMargin; - return {x: x, y: y}; - }; - - InputOutput.prototype.getRight = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.group.getBBox().width - this.textMargin; - return {x: x, y: y}; - }; - function Condition(chart, options) { - options = options || {}; - Symbol.call(this, chart, options); - this.textMargin = this.getAttr('text-margin'); - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - if (options.yes && options['direction_yes'] && options.no && !options['direction_no']) { - if (options['direction_yes'] === 'right') { - this.no_direction = 'bottom'; - this.yes_direction = 'right'; - } else { - this.no_direction = 'right'; - this.yes_direction = 'bottom'; - } - } else if (options.yes && !options['direction_yes'] && options.no && options['direction_no']) { - if (options['direction_no'] === 'right') { - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - } else { - this.yes_direction = 'right'; - this.no_direction = 'bottom'; - } - } else { - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - } - - this.yes_direction = this.yes_direction || 'bottom'; - this.no_direction = this.no_direction || 'right'; - - this.text.attr({ - x: this.textMargin * 2 - }); - - var width = this.text.getBBox().width + 3 * this.textMargin; - width += width/2; - var height = this.text.getBBox().height + 2 * this.textMargin; - height += height/2; - height = Math.max(width * 0.5, height); - var startX = width/4; - var startY = height/4; - - this.text.attr({ - x: startX + this.textMargin/2 - }); - - var start = {x: startX, y: startY}; - var points = [ - {x: startX - width/4, y: startY + height/4}, - {x: startX - width/4 + width/2, y: startY + height/4 + height/2}, - {x: startX - width/4 + width, y: startY + height/4}, - {x: startX - width/4 + width/2, y: startY + height/4 - height/2}, - {x: startX - width/4, y: startY + height/4} - ]; - - var symbol = drawPath(chart, start, points); - - symbol.attr({ - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - fill: this.getAttr('fill') - }); - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - symbol.node.setAttribute('class', this.getAttr('class')); - - this.text.attr({ - y: symbol.getBBox().height/2 - }); - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.initialize(); - } - f.inherits(Condition, Symbol); - - Condition.prototype.render = function() { - - if (this.yes_direction) { - this[this.yes_direction + '_symbol'] = this.yes_symbol; - } - - if (this.no_direction) { - this[this.no_direction + '_symbol'] = this.no_symbol; - } - - var lineLength = this.getAttr('line-length'); - - if (this.bottom_symbol) { - var bottomPoint = this.getBottom(); - var topPoint = this.bottom_symbol.getTop(); - - if (!this.bottom_symbol.isPositioned) { - this.bottom_symbol.shiftY(this.getY() + this.height + lineLength); - this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2); - this.bottom_symbol.isPositioned = true; - - this.bottom_symbol.render(); - } - } - - if (this.right_symbol) { - var rightPoint = this.getRight(); - var leftPoint = this.right_symbol.getLeft(); - - if (!this.right_symbol.isPositioned) { - - this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2); - this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength); - - var self = this; - (function shift() { - var hasSymbolUnder = false; - var symb; - for (var i = 0, len = self.chart.symbols.length; i < len; i++) { - symb = self.chart.symbols[i]; - - var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); - if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) { - hasSymbolUnder = true; - break; - } - } - - if (hasSymbolUnder) { - self.right_symbol.setX(symb.getX() + symb.width + lineLength); - shift(); - } - })(); - - this.right_symbol.isPositioned = true; - - this.right_symbol.render(); - } - } - }; - - Condition.prototype.renderLines = function() { - if (this.yes_symbol) { - this.drawLineTo(this.yes_symbol, this.getAttr('yes-text'), this.yes_direction); - } - - if (this.no_symbol) { - this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction); - } - }; - function parse(input) { - input = input || ''; - input = input.trim(); - - var chart = { - symbols: {}, - start: null, - drawSVG: function(container, options) { - var self = this; - - if (this.diagram) { - this.diagram.clean(); - } - - var diagram = new FlowChart(container, options); - this.diagram = diagram; - var dispSymbols = {}; - - function getDisplaySymbol(s) { - if (dispSymbols[s.key]) { - return dispSymbols[s.key]; - } - - switch (s.symbolType) { - case 'start': - dispSymbols[s.key] = new Start(diagram, s); - break; - case 'end': - dispSymbols[s.key] = new End(diagram, s); - break; - case 'operation': - dispSymbols[s.key] = new Operation(diagram, s); - break; - case 'inputoutput': - dispSymbols[s.key] = new InputOutput(diagram, s); - break; - case 'subroutine': - dispSymbols[s.key] = new Subroutine(diagram, s); - break; - case 'condition': - dispSymbols[s.key] = new Condition(diagram, s); - break; - default: - return new Error('Wrong symbol type!'); - } - - return dispSymbols[s.key]; - } - - (function constructChart(s, prevDisp, prev) { - var dispSymb = getDisplaySymbol(s); - - if (self.start === s) { - diagram.startWith(dispSymb); - } else if (prevDisp && prev && !prevDisp.pathOk) { - if (prevDisp instanceof(Condition)) { - if (prev.yes === s) { - prevDisp.yes(dispSymb); - } - if (prev.no === s) { - prevDisp.no(dispSymb); - } - } else { - prevDisp.then(dispSymb); - } - } - - if (dispSymb.pathOk) { - return dispSymb; - } - - if (dispSymb instanceof(Condition)) { - if (s.yes) { - constructChart(s.yes, dispSymb, s); - } - if (s.no) { - constructChart(s.no, dispSymb, s); - } - } else if (s.next) { - constructChart(s.next, dispSymb, s); - } - - return dispSymb; - })(this.start); - - diagram.render(); - }, - clean: function() { - this.diagram.clean(); - } - }; - - var lines = []; - var prevBreak = 0; - for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) { - if(input[i0] === '\n' && input[i0 - 1] !== '\\') { - var line0 = input.substring(prevBreak, i0); - prevBreak = i0 + 1; - lines.push(line0.replace(/\\\n/g, '\n')); - } - } - - if(prevBreak < input.length) { - lines.push(input.substr(prevBreak)); - } - - for (var l = 1, len = lines.length; l < len;) { - var currentLine = lines[l]; - - if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0) { - lines[l - 1] += '\n' + currentLine; - lines.splice(l, 1); - len--; - } else { - l++; - } - } - - function getSymbol(s) { - var startIndex = s.indexOf('(') + 1; - var endIndex = s.indexOf(')'); - if (startIndex >= 0 && endIndex >= 0) { - return chart.symbols[s.substring(0, startIndex - 1)]; - } - return chart.symbols[s]; - } - - function getNextPath(s) { - var next = 'next'; - var startIndex = s.indexOf('(') + 1; - var endIndex = s.indexOf(')'); - if (startIndex >= 0 && endIndex >= 0) { - next = flowSymb.substring(startIndex, endIndex); - if (next.indexOf(',') < 0) { - if (next !== 'yes' && next !== 'no') { - next = 'next, ' + next; - } - } - } - return next; - } - - while (lines.length > 0) { - var line = lines.splice(0, 1)[0]; - - if (line.indexOf('=>') >= 0) { - // definition - var parts = line.split('=>'); - var symbol = { - key: parts[0], - symbolType: parts[1], - text: null, - link: null, - target: null, - flowstate: null - }; - - var sub; - - if (symbol.symbolType.indexOf(': ') >= 0) { - sub = symbol.symbolType.split(': '); - symbol.symbolType = sub.shift(); - symbol.text = sub.join(': '); - } - - if (symbol.text && symbol.text.indexOf(':>') >= 0) { - sub = symbol.text.split(':>'); - symbol.text = sub.shift(); - symbol.link = sub.join(':>'); - } else if (symbol.symbolType.indexOf(':>') >= 0) { - sub = symbol.symbolType.split(':>'); - symbol.symbolType = sub.shift(); - symbol.link = sub.join(':>'); - } - - if (symbol.symbolType.indexOf('\n') >= 0) { - symbol.symbolType = symbol.symbolType.split('\n')[0]; - } - - /* adding support for links */ - if (symbol.link) { - var startIndex = symbol.link.indexOf('[') + 1; - var endIndex = symbol.link.indexOf(']'); - if (startIndex >= 0 && endIndex >= 0) { - symbol.target = symbol.link.substring(startIndex, endIndex); - symbol.link = symbol.link.substring(0, startIndex - 1); - } - } - /* end of link support */ - - /* adding support for flowstates */ - if (symbol.text) { - if (symbol.text.indexOf('|') >= 0) { - var txtAndState = symbol.text.split('|'); - symbol.flowstate = txtAndState.pop().trim(); - symbol.text = txtAndState.join('|'); - } - } - /* end of flowstate support */ - - chart.symbols[symbol.key] = symbol; - - } else if (line.indexOf('->') >= 0) { - // flow - var flowSymbols = line.split('->'); - for (var i = 0, lenS = flowSymbols.length; i < lenS; i++) { - var flowSymb = flowSymbols[i]; - - var realSymb = getSymbol(flowSymb); - var next = getNextPath(flowSymb); - - var direction = null; - if (next.indexOf(',') >= 0) { - var condOpt = next.split(','); - next = condOpt[0]; - direction = condOpt[1].trim(); - } - - if (!chart.start) { - chart.start = realSymb; - } - - if (i + 1 < lenS) { - var nextSymb = flowSymbols[i + 1]; - realSymb[next] = getSymbol(nextSymb); - realSymb['direction_' + next] = direction; - direction = null; - } - } - } - - } - return chart; - } - // public api interface - flowchart.parse = parse; - - return flowchart; - -})); \ No newline at end of file diff --git a/release/flowchart.amd.min.js b/release/flowchart.amd.min.js deleted file mode 100644 index f2f54dcb..00000000 --- a/release/flowchart.amd.min.js +++ /dev/null @@ -1,7 +0,0 @@ -// flowchart, v1.4.2 -// Copyright (c)2015 Adriano Raiano (adrai). -// Distributed under MIT license -// http://adrai.github.io/flowchart.js - -!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd&&define([],b)}(this,function(){function a(b,c){if(!b||"function"==typeof b)return c;var d={};for(var e in c)d[e]=c[e];for(e in b)b[e]&&("object"==typeof d[e]?d[e]=a(d[e],b[e]):d[e]=b[e]);return d}function b(a,b){if("function"==typeof Object.create)a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});else{a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}}function c(a,b,c){var d,e,f="M{0},{1}";for(d=2,e=2*c.length+2;e>d;d+=2)f+=" L{"+d+"},{"+(d+1)+"}";var g=[b.x,b.y];for(d=0,e=c.length;e>d;d++)g.push(c[d].x),g.push(c[d].y);var h=a.paper.path(f,g);h.attr("stroke",a.options["element-color"]),h.attr("stroke-width",a.options["line-width"]);var i=a.options.font,j=a.options["font-family"],k=a.options["font-weight"];return i&&h.attr({font:i}),j&&h.attr({"font-family":j}),k&&h.attr({"font-weight":k}),h}function d(a,b,c,d){var e,f;"[object Array]"!==Object.prototype.toString.call(c)&&(c=[c]);var g="M{0},{1}";for(e=2,f=2*c.length+2;f>e;e+=2)g+=" L{"+e+"},{"+(e+1)+"}";var h=[b.x,b.y];for(e=0,f=c.length;f>e;e++)h.push(c[e].x),h.push(c[e].y);var i=a.paper.path(g,h);i.attr({stroke:a.options["line-color"],"stroke-width":a.options["line-width"],"arrow-end":a.options["arrow-end"]});var j=a.options.font,k=a.options["font-family"],l=a.options["font-weight"];if(j&&i.attr({font:j}),k&&i.attr({"font-family":k}),l&&i.attr({"font-weight":l}),d){var m=!1,n=a.paper.text(0,0,d),o=!1,p=c[0];b.y===p.y&&(o=!0);var q=0,r=0;m?(q=b.x>p.x?b.x-(b.x-p.x)/2:p.x-(p.x-b.x)/2,r=b.y>p.y?b.y-(b.y-p.y)/2:p.y-(p.y-b.y)/2,o?(q-=n.getBBox().width/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"],r-=n.getBBox().height/2)):(q=b.x,r=b.y,o?(q+=a.options["text-margin"]/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"]/2,r+=a.options["text-margin"])),n.attr({"text-anchor":"start","font-size":a.options["font-size"],fill:a.options["font-color"],x:q,y:r}),j&&n.attr({font:j}),k&&n.attr({"font-family":k}),l&&n.attr({"font-weight":l})}return i}function e(a,b,c,d,e,f,g,h){var i,j,k,l,m,n={x:null,y:null,onLine1:!1,onLine2:!1};return i=(h-f)*(c-a)-(g-e)*(d-b),0===i?n:(j=b-f,k=a-e,l=(g-e)*j-(h-f)*k,m=(c-a)*j-(d-b)*k,j=l/i,k=m/i,n.x=a+j*(c-a),n.y=b+j*(d-b),j>0&&1>j&&(n.onLine1=!0),k>0&&1>k&&(n.onLine2=!0),n)}function f(a,b){b=b||{},this.paper=new Raphael(a),this.options=q.defaults(b,p),this.symbols=[],this.lines=[],this.start=null}function g(a,b,c){this.chart=a,this.group=this.chart.paper.set(),this.symbol=c,this.connectedTo=[],this.symbolType=b.symbolType,this.flowstate=b.flowstate||"future",this.next_direction=b.next&&b.direction_next?b.direction_next:void 0,this.text=this.chart.paper.text(0,0,b.text),b.key&&(this.text.node.id=b.key+"t"),this.text.node.setAttribute("class",this.getAttr("class")+"t"),this.text.attr({"text-anchor":"start",x:this.getAttr("text-margin"),fill:this.getAttr("font-color"),"font-size":this.getAttr("font-size")});var d=this.getAttr("font"),e=this.getAttr("font-family"),f=this.getAttr("font-weight");d&&this.text.attr({font:d}),e&&this.text.attr({"font-family":e}),f&&this.text.attr({"font-weight":f}),b.link&&this.text.attr("href",b.link),b.target&&this.text.attr("target",b.target);var g=this.getAttr("maxWidth");if(g){for(var h=b.text.split(" "),i="",j=0,k=h.length;k>j;j++){var l=h[j];this.text.attr("text",i+" "+l),i+=this.text.getBBox().width>g?"\n"+l:" "+l}this.text.attr("text",i.substring(1))}if(this.group.push(this.text),c){var m=this.getAttr("text-margin");c.attr({fill:this.getAttr("fill"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*m,height:this.text.getBBox().height+2*m}),c.node.setAttribute("class",this.getAttr("class")),b.link&&c.attr("href",b.link),b.target&&c.attr("target",b.target),b.key&&(c.node.id=b.key),this.group.push(c),c.insertBefore(this.text),this.text.attr({y:c.getBBox().height/2}),this.initialize()}}function h(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"Start",g.call(this,a,b,c)}function i(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"End",g.call(this,a,b,c)}function j(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c)}function k(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c),c.attr({width:this.text.getBBox().width+4*this.getAttr("text-margin")}),this.text.attr({x:2*this.getAttr("text-margin")});var d=a.paper.rect(0,0,0,0);d.attr({x:this.getAttr("text-margin"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*this.getAttr("text-margin"),height:this.text.getBBox().height+2*this.getAttr("text-margin"),fill:this.getAttr("fill")}),b.key&&(d.node.id=b.key+"i");var e=this.getAttr("font"),f=this.getAttr("font-family"),h=this.getAttr("font-weight");e&&d.attr({font:e}),f&&d.attr({"font-family":f}),h&&d.attr({"font-weight":h}),b.link&&d.attr("href",b.link),b.target&&d.attr("target",b.target),this.group.push(d),d.insertBefore(this.text),this.initialize()}function l(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var d=this.text.getBBox().width+4*this.textMargin,e=this.text.getBBox().height+2*this.textMargin,f=this.textMargin,h=e/2,i={x:f,y:h},j=[{x:f-this.textMargin,y:e},{x:f-this.textMargin+d,y:e},{x:f-this.textMargin+d+2*this.textMargin,y:0},{x:f-this.textMargin+2*this.textMargin,y:0},{x:f,y:h}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function m(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.yes_direction="bottom",this.no_direction="right",b.yes&&b.direction_yes&&b.no&&!b.direction_no?"right"===b.direction_yes?(this.no_direction="bottom",this.yes_direction="right"):(this.no_direction="right",this.yes_direction="bottom"):b.yes&&!b.direction_yes&&b.no&&b.direction_no?"right"===b.direction_no?(this.yes_direction="bottom",this.no_direction="right"):(this.yes_direction="right",this.no_direction="bottom"):(this.yes_direction="bottom",this.no_direction="right"),this.yes_direction=this.yes_direction||"bottom",this.no_direction=this.no_direction||"right",this.text.attr({x:2*this.textMargin});var d=this.text.getBBox().width+3*this.textMargin;d+=d/2;var e=this.text.getBBox().height+2*this.textMargin;e+=e/2,e=Math.max(.5*d,e);var f=d/4,h=e/4;this.text.attr({x:f+this.textMargin/2});var i={x:f,y:h},j=[{x:f-d/4,y:h+e/4},{x:f-d/4+d/2,y:h+e/4+e/2},{x:f-d/4+d,y:h+e/4},{x:f-d/4+d/2,y:h+e/4-e/2},{x:f-d/4,y:h+e/4}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function n(a){function b(a){var b=a.indexOf("(")+1,c=a.indexOf(")");return b>=0&&c>=0?d.symbols[a.substring(0,b-1)]:d.symbols[a]}function c(a){var b="next",c=a.indexOf("(")+1,d=a.indexOf(")");return c>=0&&d>=0&&(b=D.substring(c,d),b.indexOf(",")<0&&"yes"!==b&&"no"!==b&&(b="next, "+b)),b}a=a||"",a=a.trim();for(var d={symbols:{},start:null,drawSVG:function(a,b){function c(a){if(g[a.key])return g[a.key];switch(a.symbolType){case"start":g[a.key]=new h(e,a);break;case"end":g[a.key]=new i(e,a);break;case"operation":g[a.key]=new j(e,a);break;case"inputoutput":g[a.key]=new l(e,a);break;case"subroutine":g[a.key]=new k(e,a);break;case"condition":g[a.key]=new m(e,a);break;default:return new Error("Wrong symbol type!")}return g[a.key]}var d=this;this.diagram&&this.diagram.clean();var e=new f(a,b);this.diagram=e;var g={};!function n(a,b,f){var g=c(a);return d.start===a?e.startWith(g):b&&f&&!b.pathOk&&(b instanceof m?(f.yes===a&&b.yes(g),f.no===a&&b.no(g)):b.then(g)),g.pathOk?g:(g instanceof m?(a.yes&&n(a.yes,g,a),a.no&&n(a.no,g,a)):a.next&&n(a.next,g,a),g)}(this.start),e.render()},clean:function(){this.diagram.clean()}},e=[],g=0,n=1,o=a.length;o>n;n++)if("\n"===a[n]&&"\\"!==a[n-1]){var p=a.substring(g,n);g=n+1,e.push(p.replace(/\\\n/g,"\n"))}gq;){var s=e[q];s.indexOf("->")<0&&s.indexOf("=>")<0?(e[q-1]+="\n"+s,e.splice(q,1),r--):q++}for(;e.length>0;){var t=e.splice(0,1)[0];if(t.indexOf("=>")>=0){var u,v=t.split("=>"),w={key:v[0],symbolType:v[1],text:null,link:null,target:null,flowstate:null};if(w.symbolType.indexOf(": ")>=0&&(u=w.symbolType.split(": "),w.symbolType=u.shift(),w.text=u.join(": ")),w.text&&w.text.indexOf(":>")>=0?(u=w.text.split(":>"),w.text=u.shift(),w.link=u.join(":>")):w.symbolType.indexOf(":>")>=0&&(u=w.symbolType.split(":>"),w.symbolType=u.shift(),w.link=u.join(":>")),w.symbolType.indexOf("\n")>=0&&(w.symbolType=w.symbolType.split("\n")[0]),w.link){var x=w.link.indexOf("[")+1,y=w.link.indexOf("]");x>=0&&y>=0&&(w.target=w.link.substring(x,y),w.link=w.link.substring(0,x-1))}if(w.text&&w.text.indexOf("|")>=0){var z=w.text.split("|");w.flowstate=z.pop().trim(),w.text=z.join("|")}d.symbols[w.key]=w}else if(t.indexOf("->")>=0)for(var A=t.split("->"),B=0,C=A.length;C>B;B++){var D=A[B],E=b(D),F=c(D),G=null;if(F.indexOf(",")>=0){var H=F.split(",");F=H[0],G=H[1].trim()}if(d.start||(d.start=E),C>B+1){var I=A[B+1];E[F]=b(I),E["direction_"+F]=G,G=null}}}return d}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=c;arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));for(var e=d>=0?Math.min(d,c-1):c-Math.abs(d);e>=0;e--)if(e in b&&b[e]===a)return e;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var o={},p={x:0,y:0,"line-width":3,"line-length":50,"text-margin":10,"font-size":14,"font-color":"black","line-color":"black","element-color":"black",fill:"white","yes-text":"yes","no-text":"no","arrow-end":"block","class":"flowchart",scale:1,symbols:{start:{},end:{},condition:{},inputoutput:{},operation:{},subroutine:{}}},q={defaults:a,inherits:b};return f.prototype.handle=function(a){this.symbols.indexOf(a)<=-1&&this.symbols.push(a);var b=this;return a instanceof m?(a.yes=function(c){return a.yes_symbol=c,a.no_symbol&&(a.pathOk=!0),b.handle(c)},a.no=function(c){return a.no_symbol=c,a.yes_symbol&&(a.pathOk=!0),b.handle(c)}):a.then=function(c){return a.next=c,a.pathOk=!0,b.handle(c)},a},f.prototype.startWith=function(a){return this.start=a,this.handle(a)},f.prototype.render=function(){var a,b=0,c=0,d=0,e=0,f=0,g=0;for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.width>b&&(b=a.width),a.height>c&&(c=a.height);for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.shiftX(this.options.x+(b-a.width)/2+this.options["line-width"]),a.shiftY(this.options.y+(c-a.height)/2+this.options["line-width"]);for(this.start.render(),d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.renderLines();for(f=this.maxXFromLine,d=0,e=this.symbols.length;e>d;d++){a=this.symbols[d];var h=a.getX()+a.width,i=a.getY()+a.height;h>f&&(f=h),i>g&&(g=i)}var j=this.options.scale,k=this.options["line-width"];this.paper.setSize(f*j+k*j,g*j+k*j),this.paper.setViewBox(0,0,f+k,g+k,!0)},f.prototype.clean=function(){if(this.paper){var a=this.paper.canvas;a.parentNode.removeChild(a)}},g.prototype.getAttr=function(a){if(!this.chart)return void 0;var b,c=this.chart.options?this.chart.options[a]:void 0,d=this.chart.options.symbols?this.chart.options.symbols[this.symbolType][a]:void 0;return this.chart.options.flowstate&&this.chart.options.flowstate[this.flowstate]&&(b=this.chart.options.flowstate[this.flowstate][a]),b||d||c},g.prototype.initialize=function(){this.group.transform("t"+this.getAttr("line-width")+","+this.getAttr("line-width")),this.width=this.group.getBBox().width,this.height=this.group.getBBox().height},g.prototype.getCenter=function(){return{x:this.getX()+this.width/2,y:this.getY()+this.height/2}},g.prototype.getX=function(){return this.group.getBBox().x},g.prototype.getY=function(){return this.group.getBBox().y},g.prototype.shiftX=function(a){this.group.transform("t"+(this.getX()+a)+","+this.getY())},g.prototype.setX=function(a){this.group.transform("t"+a+","+this.getY())},g.prototype.shiftY=function(a){this.group.transform("t"+this.getX()+","+(this.getY()+a))},g.prototype.setY=function(a){this.group.transform("t"+this.getX()+","+a)},g.prototype.getTop=function(){var a=this.getY(),b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getBottom=function(){var a=this.getY()+this.height,b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX();return{x:b,y:a}},g.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width;return{x:b,y:a}},g.prototype.render=function(){if(this.next){var a=this.getAttr("line-length");if("right"===this.next_direction){var b=this.getRight();this.next.getLeft();if(!this.next.isPositioned){this.next.setY(b.y-this.next.height/2),this.next.shiftX(this.group.getBBox().x+this.width+a);var c=this;!function e(){for(var b,d=!1,f=0,g=c.chart.symbols.length;g>f;f++){b=c.chart.symbols[f];var h=Math.abs(b.getCenter().x-c.next.getCenter().x);if(b.getCenter().y>c.next.getCenter().y&&h<=c.next.width/2){d=!0;break}}d&&(c.next.setX(b.getX()+b.width+a),e())}(),this.next.isPositioned=!0,this.next.render()}}else{var d=this.getBottom();this.next.getTop();this.next.isPositioned||(this.next.shiftY(this.getY()+this.height+a),this.next.setX(d.x-this.next.width/2),this.next.isPositioned=!0,this.next.render())}}},g.prototype.renderLines=function(){this.next&&(this.next_direction?this.drawLineTo(this.next,"",this.next_direction):this.drawLineTo(this.next))},g.prototype.drawLineTo=function(a,b,c){this.connectedTo.indexOf(a)<0&&this.connectedTo.push(a);var f,g=this.getCenter().x,h=this.getCenter().y,i=(this.getTop(),this.getRight()),j=this.getBottom(),k=this.getLeft(),l=a.getCenter().x,m=a.getCenter().y,n=a.getTop(),o=a.getRight(),p=(a.getBottom(),a.getLeft()),q=g===l,r=h===m,s=m>h,t=h>m,u=g>l,v=l>g,w=0,x=this.getAttr("line-length"),y=this.getAttr("line-width");if(c&&"bottom"!==c||!q||!s)if(c&&"right"!==c||!r||!v)if(c&&"left"!==c||!r||!u)if(c&&"right"!==c||!q||!t)if(c&&"right"!==c||!q||!s)if(c&&"bottom"!==c||!u)if(c&&"bottom"!==c||!v)if(c&&"right"===c&&u)f=d(this.chart,i,[{x:i.x+x/2,y:i.y},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"right"===c&&v)f=d(this.chart,i,[{x:n.x,y:i.y},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"bottom"===c&&q&&t)f=d(this.chart,j,[{x:j.x,y:j.y+x/2},{x:i.x+x/2,y:j.y+x/2},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.bottomStart=!0,a.topEnd=!0,w=j.x+x/2;else if("left"===c&&q&&t){var z=k.x-x/2;p.xA;A++)for(var C,D=this.chart.lines[A],E=D.attr("path"),F=f.attr("path"),G=0,H=E.length-1;H>G;G++){var I=[];I.push(["M",E[G][1],E[G][2]]),I.push(["L",E[G+1][1],E[G+1][2]]);for(var J=I[0][1],K=I[0][2],L=I[1][1],M=I[1][2],N=0,O=F.length-1;O>N;N++){var P=[];P.push(["M",F[N][1],F[N][2]]),P.push(["L",F[N+1][1],F[N+1][2]]);var Q=P[0][1],R=P[0][2],S=P[1][1],T=P[1][2],U=e(J,K,L,M,Q,R,S,T);if(U.onLine1&&U.onLine2){var V;R===T?Q>S?(V=["L",U.x+2*y,R],F.splice(N+1,0,V),V=["C",U.x+2*y,R,U.x,R-4*y,U.x-2*y,R],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",U.x-2*y,R],F.splice(N+1,0,V),V=["C",U.x-2*y,R,U.x,R-4*y,U.x+2*y,R],F.splice(N+2,0,V),f.attr("path",F)):R>T?(V=["L",Q,U.y+2*y],F.splice(N+1,0,V),V=["C",Q,U.y+2*y,Q+4*y,U.y,Q,U.y-2*y],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",Q,U.y-2*y],F.splice(N+1,0,V),V=["C",Q,U.y-2*y,Q+4*y,U.y,Q,U.y+2*y],F.splice(N+2,0,V),f.attr("path",F)),N+=2,C+=2}}}this.chart.lines.push(f)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&w>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=w)},q.inherits(h,g),q.inherits(i,g),q.inherits(j,g),q.inherits(k,g),q.inherits(l,g),l.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.textMargin;return{x:b,y:a}},l.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width-this.textMargin;return{x:b,y:a}},q.inherits(m,g),m.prototype.render=function(){this.yes_direction&&(this[this.yes_direction+"_symbol"]=this.yes_symbol),this.no_direction&&(this[this.no_direction+"_symbol"]=this.no_symbol);var a=this.getAttr("line-length");if(this.bottom_symbol){var b=this.getBottom();this.bottom_symbol.getTop();this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+a),this.bottom_symbol.setX(b.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var c=this.getRight();this.right_symbol.getLeft();if(!this.right_symbol.isPositioned){this.right_symbol.setY(c.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+a);var d=this;!function e(){for(var b,c=!1,f=0,g=d.chart.symbols.length;g>f;f++){b=d.chart.symbols[f];var h=Math.abs(b.getCenter().x-d.right_symbol.getCenter().x);if(b.getCenter().y>d.right_symbol.getCenter().y&&h<=d.right_symbol.width/2){c=!0;break}}c&&(d.right_symbol.setX(b.getX()+b.width+a),e())}(),this.right_symbol.isPositioned=!0,this.right_symbol.render()}}},m.prototype.renderLines=function(){this.yes_symbol&&this.drawLineTo(this.yes_symbol,this.getAttr("yes-text"),this.yes_direction),this.no_symbol&&this.drawLineTo(this.no_symbol,this.getAttr("no-text"),this.no_direction)},o.parse=n,o}); -//# sourceMappingURL=flowchart.amd.min.map \ No newline at end of file diff --git a/release/flowchart.amd.min.map b/release/flowchart.amd.min.map deleted file mode 100644 index fbea064f..00000000 --- a/release/flowchart.amd.min.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flowchart.amd.min.js","sources":["../bin/flowchart.amd-latest.js"],"names":["root","factory","exports","module","define","amd","this","_defaults","options","defaultOptions","merged","attrname","_inherits","ctor","superCtor","Object","super_","prototype","create","constructor","value","enumerable","writable","configurable","TempCtor","drawPath","chart","location","points","i","len","path","length","pathValues","x","y","push","symbol","paper","attr","font","fontF","fontW","font-family","font-weight","drawLine","from","to","text","toString","call","line","stroke","stroke-width","arrow-end","centerText","textPath","isHorizontal","firstTo","getBBox","width","height","text-anchor","font-size","fill","checkLineIntersection","line1StartX","line1StartY","line1EndX","line1EndY","line2StartX","line2StartY","line2EndX","line2EndY","denominator","a","b","numerator1","numerator2","result","onLine1","onLine2","FlowChart","container","Raphael","f","defaults","o","symbols","lines","start","Symbol","group","set","connectedTo","symbolType","flowstate","next_direction","next","undefined","key","node","id","setAttribute","getAttr","link","target","maxWidth","words","split","tempText","ii","word","substring","tmpMargin","insertBefore","initialize","Start","rect","End","Operation","Subroutine","innerWrap","InputOutput","textMargin","startX","startY","Condition","yes_direction","no_direction","yes","no","Math","max","parse","input","getSymbol","s","startIndex","indexOf","endIndex","getNextPath","flowSymb","trim","drawSVG","getDisplaySymbol","dispSymbols","diagram","Error","self","clean","constructChart","prevDisp","prev","dispSymb","startWith","pathOk","then","render","prevBreak","i0","i0len","line0","replace","substr","l","currentLine","splice","sub","parts","shift","join","txtAndState","pop","flowSymbols","lenS","realSymb","direction","condOpt","nextSymb","Array","searchElement","TypeError","t","n","arguments","Number","Infinity","floor","abs","k","lastIndexOf","min","String","flowchart","line-width","line-length","text-margin","font-color","line-color","element-color","yes-text","no-text","class","scale","end","condition","inputoutput","operation","subroutine","inherits","handle","flowChart","nextSymbol","yes_symbol","no_symbol","maxHeight","maxX","maxY","shiftX","shiftY","renderLines","maxXFromLine","getX","getY","lineWidth","setSize","setViewBox","paperDom","canvas","parentNode","removeChild","attName","opt1","opt3","opt2","transform","getCenter","setX","setY","getTop","getBottom","getLeft","getRight","lineLength","rightPoint","isPositioned","symb","hasSymbolUnder","diff","bottomPoint","drawLineTo","origin","right","bottom","left","symbolX","symbolY","symbolTop","symbolRight","symbolLeft","isOnSameColumn","isOnSameLine","isUnder","isUpper","isLeft","isRight","lineWith","rightStart","topEnd","bottomStart","diffX","leftStart","leftEnd","rightEnd","llen","otherLine","ePath","lPath","iP","lenP","newPath","line1_from_x","line1_from_y","line1_to_x","line1_to_y","lP","lenlP","newLinePath","line2_from_x","line2_from_y","line2_to_x","line2_to_y","res","newSegment","bottom_symbol","right_symbol"],"mappings":";;;;;CAIC,SAAUA,EAAMC,GACQ,gBAAZC,SAETC,OAAOD,QAAUD,IAEU,kBAAXG,SAAyBA,OAAOC,KAEhDD,UAAWH,IAGbK,KAAM,WA+GN,QAASC,GAAUC,EAASC,GAC1B,IAAKD,GAA8B,kBAAZA,GACrB,MAAOC,EAGT,IAAIC,KACJ,KAAK,GAAIC,KAAYF,GACnBC,EAAOC,GAAYF,EAAeE,EAGpC,KAAKA,IAAYH,GACXA,EAAQG,KACsB,gBAArBD,GAAOC,GAChBD,EAAOC,GAAYJ,EAAUG,EAAOC,GAAWH,EAAQG,IAEvDD,EAAOC,GAAYH,EAAQG,GAIjC,OAAOD,GAGT,QAASE,GAAUC,EAAMC,GACvB,GAA8B,kBAAnBC,QAAa,OAEtBF,EAAKG,OAASF,EACdD,EAAKI,UAAYF,OAAOG,OAAOJ,EAAUG,WACvCE,aACEC,MAAOP,EACPQ,YAAY,EACZC,UAAU,EACVC,cAAc,SAGb,CAELV,EAAKG,OAASF,CACd,IAAIU,GAAW,YACfA,GAASP,UAAYH,EAAUG,UAC/BJ,EAAKI,UAAY,GAAIO,GACrBX,EAAKI,UAAUE,YAAcN,GAUjC,QAASY,GAASC,EAAOC,EAAUC,GACjC,GAAIC,GAAGC,EACHC,EAA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ACFnG,EAAKmJ,aAAa1D,KAAKS,EAAKxB,OAASwB,EAAK3L,MAAQwL,GAClD1E,QAIJpK,KAAKkS,aAAalD,cAAe,EAEjChP,KAAKkS,aAAa1I,YAKxB/B,EAAU9G,UAAU4M,YAAc,WAC5BvN,KAAKgN,YACPhN,KAAKqP,WAAWrP,KAAKgN,WAAYhN,KAAKkG,QAAQ,YAAalG,KAAK0H,eAG9D1H,KAAKiN,WACPjN,KAAKqP,WAAWrP,KAAKiN,UAAWjN,KAAKkG,QAAQ,WAAYlG,KAAK2H,eA8OlEiE,EAAU5D,MAAQA,EAEX4D"} \ No newline at end of file diff --git a/release/flowchart.amd.zip b/release/flowchart.amd.zip deleted file mode 100644 index 505eb441..00000000 Binary files a/release/flowchart.amd.zip and /dev/null differ diff --git a/release/flowchart.js b/release/flowchart.js index 8e97c90c..42556e58 100644 --- a/release/flowchart.js +++ b/release/flowchart.js @@ -1,1423 +1,984 @@ // flowchart, v1.4.2 -// Copyright (c)2015 Adriano Raiano (adrai). +// Copyright (c)yyyy Adriano Raiano (adrai). // Distributed under MIT license // http://adrai.github.io/flowchart.js -(function() { - // add indexOf to non ECMA-262 standard compliant browsers - if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { - "use strict"; - if (this === null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) { - return -1; - } - var n = 0; - if (arguments.length > 0) { - n = Number(arguments[1]); - if (n != n) { // shortcut for verifying if it's NaN - n = 0; - } else if (n !== 0 && n != Infinity && n != -Infinity) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); +!function(root, factory) { + if ("object" == typeof exports && "object" == typeof module) module.exports = factory(require("Raphael")); else if ("function" == typeof define && define.amd) define([ "Raphael" ], factory); else { + var a = factory("object" == typeof exports ? require("Raphael") : root.Raphael); + for (var i in a) ("object" == typeof exports ? exports : root)[i] = a[i]; + } +}(this, function(__WEBPACK_EXTERNAL_MODULE_15__) { + /******/ + return function(modules) { + /******/ + /******/ + // The require function + /******/ + function __webpack_require__(moduleId) { + /******/ + /******/ + // Check if module is in cache + /******/ + if (installedModules[moduleId]) /******/ + return installedModules[moduleId].exports; + /******/ + /******/ + // Create a new module (and put it into the cache) + /******/ + var module = installedModules[moduleId] = { + /******/ + exports: {}, + /******/ + id: moduleId, + /******/ + loaded: !1 + }; + /******/ + /******/ + // Return the exports of the module + /******/ + /******/ + /******/ + // Execute the module function + /******/ + /******/ + /******/ + // Flag the module as loaded + /******/ + return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__), + module.loaded = !0, module.exports; } - } - if (n >= len) { - return -1; - } - var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); - for (; k < len; k++) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; - } - - // add lastIndexOf to non ECMA-262 standard compliant browsers - if (!Array.prototype.lastIndexOf) { - Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) { - "use strict"; - if (this === null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) { - return -1; - } - var n = len; - if (arguments.length > 1) { - n = Number(arguments[1]); - if (n != n) { - n = 0; - } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n); - for (; k >= 0; k--) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; - } - - if (!String.prototype.trim) { - String.prototype.trim = function() { - return this.replace(/^\s+|\s+$/g, ''); - }; - } - - var root = this, - flowchart = {}; - - // Export the flowchart object for **CommonJS**. - // If we're not in CommonJS, add `flowchart` to the - // global object or to jquery. - if (typeof module !== 'undefined' && module.exports) { - module.exports = flowchart; - } else { - root.flowchart = root.flowchart || flowchart; - } - // defaults - var o = { - 'x': 0, - 'y': 0, - 'line-width': 3, - 'line-length': 50, - 'text-margin': 10, - 'font-size': 14, - 'font-color': 'black', - // 'font': 'normal', - // 'font-family': 'calibri', - // 'font-weight': 'normal', - 'line-color': 'black', - 'element-color': 'black', - 'fill': 'white', - 'yes-text': 'yes', - 'no-text': 'no', - 'arrow-end': 'block', - 'class': 'flowchart', - 'scale': 1, - 'symbols': { - 'start': {}, - 'end': {}, - 'condition': {}, - 'inputoutput': {}, - 'operation': {}, - 'subroutine': {} - }//, - // 'flowstate' : { - // 'past' : { 'fill': '#CCCCCC', 'font-size': 12}, - // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'}, - // 'future' : { 'fill': '#FFFF99'}, - // 'invalid': {'fill': '#444444'} - // } - }; - function _defaults(options, defaultOptions) { - if (!options || typeof options === 'function') { - return defaultOptions; - } - - var merged = {}; - for (var attrname in defaultOptions) { - merged[attrname] = defaultOptions[attrname]; - } - - for (attrname in options) { - if (options[attrname]) { - if (typeof merged[attrname] === 'object') { - merged[attrname] = _defaults(merged[attrname], options[attrname]); - } else { - merged[attrname] = options[attrname]; - } - } - } - return merged; - } - - function _inherits(ctor, superCtor) { - if (typeof(Object.create) === 'function') { - // implementation from standard node.js 'util' module - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - } else { - // old school shim for old browsers - ctor.super_ = superCtor; - var TempCtor = function () {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - } - } - - // move dependent functions to a container so that - // they can be overriden easier in no jquery environment (node.js) - var f = { - defaults: _defaults, - inherits: _inherits - }; - function drawPath(chart, location, points) { - var i, len; - var path = 'M{0},{1}'; - for (i = 2, len = 2 * points.length + 2; i < len; i+=2) { - path += ' L{' + i + '},{' + (i + 1) + '}'; - } - var pathValues = [location.x, location.y]; - for (i = 0, len = points.length; i < len; i++) { - pathValues.push(points[i].x); - pathValues.push(points[i].y); - } - var symbol = chart.paper.path(path, pathValues); - symbol.attr('stroke', chart.options['element-color']); - symbol.attr('stroke-width', chart.options['line-width']); - - var font = chart.options['font']; - var fontF = chart.options['font-family']; - var fontW = chart.options['font-weight']; - - if (font) symbol.attr({ 'font': font }); - if (fontF) symbol.attr({ 'font-family': fontF }); - if (fontW) symbol.attr({ 'font-weight': fontW }); - - return symbol; - } - - function drawLine(chart, from, to, text) { - var i, len; - - if (Object.prototype.toString.call(to) !== '[object Array]') { - to = [to]; - } - - var path = 'M{0},{1}'; - for (i = 2, len = 2 * to.length + 2; i < len; i+=2) { - path += ' L{' + i + '},{' + (i + 1) + '}'; - } - var pathValues = [from.x, from.y]; - for (i = 0, len = to.length; i < len; i++) { - pathValues.push(to[i].x); - pathValues.push(to[i].y); - } - - var line = chart.paper.path(path, pathValues); - line.attr({ - stroke: chart.options['line-color'], - 'stroke-width': chart.options['line-width'], - 'arrow-end': chart.options['arrow-end'] - }); - - var font = chart.options['font']; - var fontF = chart.options['font-family']; - var fontW = chart.options['font-weight']; - - if (font) line.attr({ 'font': font }); - if (fontF) line.attr({ 'font-family': fontF }); - if (fontW) line.attr({ 'font-weight': fontW }); - - if (text) { - - var centerText = false; - - var textPath = chart.paper.text(0, 0, text); - - var isHorizontal = false; - var firstTo = to[0]; - - if (from.y === firstTo.y) { - isHorizontal = true; - } - - var x = 0, - y = 0; - - if (centerText) { - if (from.x > firstTo.x) { - x = from.x - (from.x - firstTo.x)/2; - } else { - x = firstTo.x - (firstTo.x - from.x)/2; - } - - if (from.y > firstTo.y) { - y = from.y - (from.y - firstTo.y)/2; - } else { - y = firstTo.y - (firstTo.y - from.y)/2; - } - - if (isHorizontal) { - x -= textPath.getBBox().width/2; - y -= chart.options['text-margin']; - } else { - x += chart.options['text-margin']; - y -= textPath.getBBox().height/2; - } - } else { - x = from.x; - y = from.y; - - if (isHorizontal) { - x += chart.options['text-margin']/2; - y -= chart.options['text-margin']; - } else { - x += chart.options['text-margin']/2; - y += chart.options['text-margin']; - } - } - - textPath.attr({ - 'text-anchor': 'start', - 'font-size': chart.options['font-size'], - 'fill': chart.options['font-color'], - x: x, - y: y - }); - - if (font) textPath.attr({ 'font': font }); - if (fontF) textPath.attr({ 'font-family': fontF }); - if (fontW) textPath.attr({ 'font-weight': fontW }); - } - - return line; - } - - function checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) { - // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point - var denominator, a, b, numerator1, numerator2, result = { - x: null, - y: null, - onLine1: false, - onLine2: false - }; - denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY)); - if (denominator === 0) { - return result; - } - a = line1StartY - line2StartY; - b = line1StartX - line2StartX; - numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b); - numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b); - a = numerator1 / denominator; - b = numerator2 / denominator; - - // if we cast these lines infinitely in both directions, they intersect here: - result.x = line1StartX + (a * (line1EndX - line1StartX)); - result.y = line1StartY + (a * (line1EndY - line1StartY)); - /* - // it is worth noting that this should be the same as: - x = line2StartX + (b * (line2EndX - line2StartX)); - y = line2StartX + (b * (line2EndY - line2StartY)); - */ - // if line1 is a segment and line2 is infinite, they intersect if: - if (a > 0 && a < 1) { - result.onLine1 = true; - } - // if line2 is a segment and line1 is infinite, they intersect if: - if (b > 0 && b < 1) { - result.onLine2 = true; - } - // if line1 and line2 are segments, they intersect if both of the above are true - return result; - } - function FlowChart(container, options) { - options = options || {}; - - this.paper = new Raphael(container); - - this.options = f.defaults(options, o); - - this.symbols = []; - this.lines = []; - this.start = null; - } - - FlowChart.prototype.handle = function(symbol) { - if (this.symbols.indexOf(symbol) <= -1) { - this.symbols.push(symbol); - } - - var flowChart = this; - - if (symbol instanceof(Condition)) { - symbol.yes = function(nextSymbol) { - symbol.yes_symbol = nextSymbol; - if(symbol.no_symbol) { - symbol.pathOk = true; - } - return flowChart.handle(nextSymbol); - }; - symbol.no = function(nextSymbol) { - symbol.no_symbol = nextSymbol; - if(symbol.yes_symbol) { - symbol.pathOk = true; + // webpackBootstrap + /******/ + // The module cache + /******/ + var installedModules = {}; + /******/ + /******/ + // Load entry module and return exports + /******/ + /******/ + /******/ + /******/ + // expose the modules object (__webpack_modules__) + /******/ + /******/ + /******/ + // expose the module cache + /******/ + /******/ + /******/ + // __webpack_public_path__ + /******/ + return __webpack_require__.m = modules, __webpack_require__.c = installedModules, + __webpack_require__.p = "", __webpack_require__(0); + }([ /* 0 */ + /*!******************!*\ + !*** ./index.js ***! + \******************/ + /***/ + function(module, exports, __webpack_require__) { + __webpack_require__(/*! ./src/flowchart.shim */ 8); + var parse = __webpack_require__(/*! ./src/flowchart.parse */ 4); + __webpack_require__(/*! ./src/jquery-plugin */ 14); + var FlowChart = { + parse: parse + }; + "undefined" != typeof window && (window.FlowChart = FlowChart), module.exports = FlowChart; + }, /* 1 */ + /*!**********************************!*\ + !*** ./src/flowchart.helpers.js ***! + \**********************************/ + /***/ + function(module, exports) { + function _defaults(options, defaultOptions) { + if (!options || "function" == typeof options) return defaultOptions; + var merged = {}; + for (var attrname in defaultOptions) merged[attrname] = defaultOptions[attrname]; + for (attrname in options) options[attrname] && ("object" == typeof merged[attrname] ? merged[attrname] = _defaults(merged[attrname], options[attrname]) : merged[attrname] = options[attrname]); + return merged; } - return flowChart.handle(nextSymbol); - }; - } else { - symbol.then = function(nextSymbol) { - symbol.next = nextSymbol; - symbol.pathOk = true; - return flowChart.handle(nextSymbol); - }; - } - - return symbol; - }; - - FlowChart.prototype.startWith = function(symbol) { - this.start = symbol; - return this.handle(symbol); - }; - - FlowChart.prototype.render = function() { - var maxWidth = 0, - maxHeight = 0, - i = 0, - len = 0, - maxX = 0, - maxY = 0, - symbol; - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - if (symbol.width > maxWidth) { - maxWidth = symbol.width; - } - if (symbol.height > maxHeight) { - maxHeight = symbol.height; - } - } - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']); - symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']); - } - - this.start.render(); - // for (i = 0, len = this.symbols.length; i < len; i++) { - // symbol = this.symbols[i]; - // symbol.render(); - // } - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - symbol.renderLines(); - } - - maxX = this.maxXFromLine; - - for (i = 0, len = this.symbols.length; i < len; i++) { - symbol = this.symbols[i]; - var x = symbol.getX() + symbol.width; - var y = symbol.getY() + symbol.height; - if (x > maxX) { - maxX = x; - } - if (y > maxY) { - maxY = y; - } - } - - var scale = this.options['scale']; - var lineWidth = this.options['line-width']; - this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale)); - this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true); - }; - - FlowChart.prototype.clean = function() { - if (this.paper) { - var paperDom = this.paper.canvas; - paperDom.parentNode.removeChild(paperDom); - } - }; - function Symbol(chart, options, symbol) { - this.chart = chart; - this.group = this.chart.paper.set(); - this.symbol = symbol; - this.connectedTo = []; - this.symbolType = options.symbolType; - this.flowstate = (options.flowstate || 'future'); - - this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined; - - this.text = this.chart.paper.text(0, 0, options.text); - //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t - if (options.key) { this.text.node.id = options.key + 't'; } - this.text.node.setAttribute('class', this.getAttr('class') + 't'); - - this.text.attr({ - 'text-anchor': 'start', - 'x' : this.getAttr('text-margin'), - 'fill' : this.getAttr('font-color'), - 'font-size' : this.getAttr('font-size') - }); - - var font = this.getAttr('font'); - var fontF = this.getAttr('font-family'); - var fontW = this.getAttr('font-weight'); - - if (font) this.text.attr({ 'font': font }); - if (fontF) this.text.attr({ 'font-family': fontF }); - if (fontW) this.text.attr({ 'font-weight': fontW }); - - if (options.link) { this.text.attr('href', options.link); } - if (options.target) { this.text.attr('target', options.target); } - - var maxWidth = this.getAttr('maxWidth'); - if (maxWidth) { - // using this approach: http://stackoverflow.com/a/3153457/22466 - var words = options.text.split(' '); - var tempText = ""; - for (var i=0, ii=words.length; i maxWidth) { - tempText += "\n" + word; - } else { - tempText += " " + word; + function _inherits(ctor, superCtor) { + if ("function" == typeof Object.create) // implementation from standard node.js 'util' module + ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: !1, + writable: !0, + configurable: !0 + } + }); else { + // old school shim for old browsers + ctor.super_ = superCtor; + var TempCtor = function() {}; + TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor(), ctor.prototype.constructor = ctor; + } } - } - this.text.attr("text", tempText.substring(1)); - } - - this.group.push(this.text); - - if (symbol) { - var tmpMargin = this.getAttr('text-margin'); - - symbol.attr({ - 'fill' : this.getAttr('fill'), - 'stroke' : this.getAttr('element-color'), - 'stroke-width' : this.getAttr('line-width'), - 'width' : this.text.getBBox().width + 2 * tmpMargin, - 'height' : this.text.getBBox().height + 2 * tmpMargin - }); - - symbol.node.setAttribute('class', this.getAttr('class')); - - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.text.attr({ - 'y': symbol.getBBox().height/2 - }); - - this.initialize(); - } - - } - - /* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */ - Symbol.prototype.getAttr = function(attName) { - if (!this.chart) { - return undefined; - } - var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined; - var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined; - var opt1; - if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) { - opt1 = this.chart.options.flowstate[this.flowstate][attName]; - } - return (opt1 || opt2 || opt3); - }; - - Symbol.prototype.initialize = function() { - this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width')); - - this.width = this.group.getBBox().width; - this.height = this.group.getBBox().height; - }; - - Symbol.prototype.getCenter = function() { - return {x: this.getX() + this.width/2, - y: this.getY() + this.height/2}; - }; - - Symbol.prototype.getX = function() { - return this.group.getBBox().x; - }; - - Symbol.prototype.getY = function() { - return this.group.getBBox().y; - }; - - Symbol.prototype.shiftX = function(x) { - this.group.transform('t' + (this.getX() + x) + ',' + this.getY()); - }; - - Symbol.prototype.setX = function(x) { - this.group.transform('t' + x + ',' + this.getY()); - }; - - Symbol.prototype.shiftY = function(y) { - this.group.transform('t' + this.getX() + ',' + (this.getY() + y)); - }; - - Symbol.prototype.setY = function(y) { - this.group.transform('t' + this.getX() + ',' + y); - }; - - Symbol.prototype.getTop = function() { - var y = this.getY(); - var x = this.getX() + this.width/2; - return {x: x, y: y}; - }; - - Symbol.prototype.getBottom = function() { - var y = this.getY() + this.height; - var x = this.getX() + this.width/2; - return {x: x, y: y}; - }; - - Symbol.prototype.getLeft = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX(); - return {x: x, y: y}; - }; - - Symbol.prototype.getRight = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.group.getBBox().width; - return {x: x, y: y}; - }; - - Symbol.prototype.render = function() { - if (this.next) { - - var lineLength = this.getAttr('line-length'); - - if (this.next_direction === 'right') { - - var rightPoint = this.getRight(); - var leftPoint = this.next.getLeft(); - - if (!this.next.isPositioned) { - - this.next.setY(rightPoint.y - this.next.height/2); - this.next.shiftX(this.group.getBBox().x + this.width + lineLength); - - var self = this; - (function shift() { - var hasSymbolUnder = false; - var symb; - for (var i = 0, len = self.chart.symbols.length; i < len; i++) { - symb = self.chart.symbols[i]; - - var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x); - if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) { - hasSymbolUnder = true; - break; - } + // move dependent functions to a container so that + // they can be overriden easier in no jquery environment (node.js) + module.exports = { + defaults: _defaults, + inherits: _inherits + }; + }, /* 2 */ + /*!*********************************!*\ + !*** ./src/flowchart.symbol.js ***! + \*********************************/ + /***/ + function(module, exports, __webpack_require__) { + function Symbol(chart, options, symbol) { + this.chart = chart, this.group = this.chart.paper.set(), this.symbol = symbol, this.connectedTo = [], + this.symbolType = options.symbolType, this.flowstate = options.flowstate || "future", + this.next_direction = options.next && options.direction_next ? options.direction_next : void 0, + this.text = this.chart.paper.text(0, 0, options.text), //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t + options.key && (this.text.node.id = options.key + "t"), this.text.node.setAttribute("class", this.getAttr("class") + "t"), + this.text.attr({ + "text-anchor": "start", + x: this.getAttr("text-margin"), + fill: this.getAttr("font-color"), + "font-size": this.getAttr("font-size") + }); + var font = this.getAttr("font"), fontF = this.getAttr("font-family"), fontW = this.getAttr("font-weight"); + font && this.text.attr({ + font: font + }), fontF && this.text.attr({ + "font-family": fontF + }), fontW && this.text.attr({ + "font-weight": fontW + }), options.link && this.text.attr("href", options.link), options.target && this.text.attr("target", options.target); + var maxWidth = this.getAttr("maxWidth"); + if (maxWidth) { + for (var words = options.text.split(" "), tempText = "", i = 0, ii = words.length; ii > i; i++) { + var word = words[i]; + this.text.attr("text", tempText + " " + word), tempText += this.text.getBBox().width > maxWidth ? "\n" + word : " " + word; + } + this.text.attr("text", tempText.substring(1)); } - - if (hasSymbolUnder) { - self.next.setX(symb.getX() + symb.width + lineLength); - shift(); + if (this.group.push(this.text), symbol) { + var tmpMargin = this.getAttr("text-margin"); + symbol.attr({ + fill: this.getAttr("fill"), + stroke: this.getAttr("element-color"), + "stroke-width": this.getAttr("line-width"), + width: this.text.getBBox().width + 2 * tmpMargin, + height: this.text.getBBox().height + 2 * tmpMargin + }), symbol.node.setAttribute("class", this.getAttr("class")), options.link && symbol.attr("href", options.link), + options.target && symbol.attr("target", options.target), options.key && (symbol.node.id = options.key), + this.group.push(symbol), symbol.insertBefore(this.text), this.text.attr({ + y: symbol.getBBox().height / 2 + }), this.initialize(); } - })(); - - this.next.isPositioned = true; - - this.next.render(); - } - } else { - var bottomPoint = this.getBottom(); - var topPoint = this.next.getTop(); - - if (!this.next.isPositioned) { - this.next.shiftY(this.getY() + this.height + lineLength); - this.next.setX(bottomPoint.x - this.next.width/2); - this.next.isPositioned = true; - - this.next.render(); } - } - } - }; - - Symbol.prototype.renderLines = function() { - if (this.next) { - if (this.next_direction) { - this.drawLineTo(this.next, '', this.next_direction); - } else { - this.drawLineTo(this.next); - } - } - }; - - Symbol.prototype.drawLineTo = function(symbol, text, origin) { - if (this.connectedTo.indexOf(symbol) < 0) { - this.connectedTo.push(symbol); - } - - var x = this.getCenter().x, - y = this.getCenter().y, - top = this.getTop(), - right = this.getRight(), - bottom = this.getBottom(), - left = this.getLeft(); - - var symbolX = symbol.getCenter().x, - symbolY = symbol.getCenter().y, - symbolTop = symbol.getTop(), - symbolRight = symbol.getRight(), - symbolBottom = symbol.getBottom(), - symbolLeft = symbol.getLeft(); - - var isOnSameColumn = x === symbolX, - isOnSameLine = y === symbolY, - isUnder = y < symbolY, - isUpper = y > symbolY, - isLeft = x > symbolX, - isRight = x < symbolX; - - var maxX = 0, - line, - lineLength = this.getAttr('line-length'), - lineWith = this.getAttr('line-width'); - - if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) { - line = drawLine(this.chart, bottom, symbolTop, text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x; - } else if ((!origin || origin === 'right') && isOnSameLine && isRight) { - line = drawLine(this.chart, right, symbolLeft, text); - this.rightStart = true; - symbol.leftEnd = true; - maxX = symbolLeft.x; - } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) { - line = drawLine(this.chart, left, symbolRight, text); - this.leftStart = true; - symbol.rightEnd = true; - maxX = symbolRight.x; - } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((!origin || origin === 'bottom') && isLeft) { - if (this.leftEnd && isUpper) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - } else { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - } - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + (bottom.x - symbolTop.x)/2; - } else if ((!origin || origin === 'bottom') && isRight) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2}, - {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + (bottom.x - symbolTop.x)/2; - } else if ((origin && origin === 'right') && isLeft) { - line = drawLine(this.chart, right, [ - {x: right.x + lineLength/2, y: right.y}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((origin && origin === 'right') && isRight) { - line = drawLine(this.chart, right, [ - {x: symbolTop.x, y: right.y}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.rightStart = true; - symbol.topEnd = true; - maxX = right.x + lineLength/2; - } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) { - line = drawLine(this.chart, bottom, [ - {x: bottom.x, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: bottom.y + lineLength/2}, - {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.bottomStart = true; - symbol.topEnd = true; - maxX = bottom.x + lineLength/2; - } else if ((origin === 'left') && isOnSameColumn && isUpper) { - var diffX = left.x - lineLength/2; - if (symbolLeft.x < left.x) { - diffX = symbolLeft.x - lineLength/2; - } - line = drawLine(this.chart, left, [ - {x: diffX, y: left.y}, - {x: diffX, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.leftStart = true; - symbol.topEnd = true; - maxX = left.x; - } else if ((origin === 'left')) { - line = drawLine(this.chart, left, [ - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y}, - {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y - lineLength/2}, - {x: symbolTop.x, y: symbolTop.y} - ], text); - this.leftStart = true; - symbol.topEnd = true; - maxX = left.x; - } - - if (line) { - var self = this; - for (var l = 0, llen = this.chart.lines.length; l < llen; l++) { - var otherLine = this.chart.lines[l]; - var i, - len, - intersections, - inter; - - var ePath = otherLine.attr('path'), - lPath = line.attr('path'); - - for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) { - var newPath = []; - newPath.push(['M', ePath[iP][1], ePath[iP][2]]); - newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]); - - var line1_from_x = newPath[0][1]; - var line1_from_y = newPath[0][2]; - var line1_to_x = newPath[1][1]; - var line1_to_y = newPath[1][2]; - - for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) { - var newLinePath = []; - newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]); - newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]); - - var line2_from_x = newLinePath[0][1]; - var line2_from_y = newLinePath[0][2]; - var line2_to_x = newLinePath[1][1]; - var line2_to_y = newLinePath[1][2]; - - var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y); - if (res.onLine1 && res.onLine2) { - - var newSegment; - if (line2_from_y === line2_to_y) { - if (line2_from_x > line2_to_x) { - newSegment = ['L', res.x + lineWith * 2, line2_from_y]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); + var drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3), drawLine = drawAPI.drawLine, checkLineIntersection = drawAPI.checkLineIntersection; + /* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */ + Symbol.prototype.getAttr = function(attName) { + if (this.chart) { + var opt1, opt3 = this.chart.options ? this.chart.options[attName] : void 0, opt2 = this.chart.options.symbols ? this.chart.options.symbols[this.symbolType][attName] : void 0; + return this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate] && (opt1 = this.chart.options.flowstate[this.flowstate][attName]), + opt1 || opt2 || opt3; + } + }, Symbol.prototype.initialize = function() { + this.group.transform("t" + this.getAttr("line-width") + "," + this.getAttr("line-width")), + this.width = this.group.getBBox().width, this.height = this.group.getBBox().height; + }, Symbol.prototype.getCenter = function() { + return { + x: this.getX() + this.width / 2, + y: this.getY() + this.height / 2 + }; + }, Symbol.prototype.getX = function() { + return this.group.getBBox().x; + }, Symbol.prototype.getY = function() { + return this.group.getBBox().y; + }, Symbol.prototype.shiftX = function(x) { + this.group.transform("t" + (this.getX() + x) + "," + this.getY()); + }, Symbol.prototype.setX = function(x) { + this.group.transform("t" + x + "," + this.getY()); + }, Symbol.prototype.shiftY = function(y) { + this.group.transform("t" + this.getX() + "," + (this.getY() + y)); + }, Symbol.prototype.setY = function(y) { + this.group.transform("t" + this.getX() + "," + y); + }, Symbol.prototype.getTop = function() { + var y = this.getY(), x = this.getX() + this.width / 2; + return { + x: x, + y: y + }; + }, Symbol.prototype.getBottom = function() { + var y = this.getY() + this.height, x = this.getX() + this.width / 2; + return { + x: x, + y: y + }; + }, Symbol.prototype.getLeft = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX(); + return { + x: x, + y: y + }; + }, Symbol.prototype.getRight = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.group.getBBox().width; + return { + x: x, + y: y + }; + }, Symbol.prototype.render = function() { + if (this.next) { + var lineLength = this.getAttr("line-length"); + if ("right" === this.next_direction) { + var rightPoint = this.getRight(); + if (!this.next.isPositioned) { + this.next.setY(rightPoint.y - this.next.height / 2), this.next.shiftX(this.group.getBBox().x + this.width + lineLength); + var self = this; + !function shift() { + for (var symb, hasSymbolUnder = !1, i = 0, len = self.chart.symbols.length; len > i; i++) { + symb = self.chart.symbols[i]; + var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x); + if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width / 2) { + hasSymbolUnder = !0; + break; + } + } + hasSymbolUnder && (self.next.setX(symb.getX() + symb.width + lineLength), shift()); + }(), this.next.isPositioned = !0, this.next.render(); + } } else { - newSegment = ['L', res.x - lineWith * 2, line2_from_y]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); + var bottomPoint = this.getBottom(); + this.next.isPositioned || (this.next.shiftY(this.getY() + this.height + lineLength), + this.next.setX(bottomPoint.x - this.next.width / 2), this.next.isPositioned = !0, + this.next.render()); } - } else { - if (line2_from_y > line2_to_y) { - newSegment = ['L', line2_from_x, res.y + lineWith * 2]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); - } else { - newSegment = ['L', line2_from_x, res.y - lineWith * 2]; - lPath.splice(lP + 1, 0, newSegment); - newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2]; - lPath.splice(lP + 2, 0, newSegment); - line.attr('path', lPath); + } + }, Symbol.prototype.renderLines = function() { + this.next && (this.next_direction ? this.drawLineTo(this.next, "", this.next_direction) : this.drawLineTo(this.next)); + }, Symbol.prototype.drawLineTo = function(symbol, text, origin) { + this.connectedTo.indexOf(symbol) < 0 && this.connectedTo.push(symbol); + var line, x = this.getCenter().x, y = this.getCenter().y, right = this.getRight(), bottom = this.getBottom(), left = this.getLeft(), symbolX = symbol.getCenter().x, symbolY = symbol.getCenter().y, symbolTop = symbol.getTop(), symbolRight = symbol.getRight(), symbolLeft = symbol.getLeft(), isOnSameColumn = x === symbolX, isOnSameLine = y === symbolY, isUnder = symbolY > y, isUpper = y > symbolY, isLeft = x > symbolX, isRight = symbolX > x, maxX = 0, lineLength = this.getAttr("line-length"), lineWith = this.getAttr("line-width"); + if (origin && "bottom" !== origin || !isOnSameColumn || !isUnder) if (origin && "right" !== origin || !isOnSameLine || !isRight) if (origin && "left" !== origin || !isOnSameLine || !isLeft) if (origin && "right" !== origin || !isOnSameColumn || !isUpper) if (origin && "right" !== origin || !isOnSameColumn || !isUnder) if (origin && "bottom" !== origin || !isLeft) if (origin && "bottom" !== origin || !isRight) if (origin && "right" === origin && isLeft) line = drawLine(this.chart, right, [ { + x: right.x + lineLength / 2, + y: right.y + }, { + x: right.x + lineLength / 2, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.rightStart = !0, symbol.topEnd = !0, maxX = right.x + lineLength / 2; else if (origin && "right" === origin && isRight) line = drawLine(this.chart, right, [ { + x: symbolTop.x, + y: right.y + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.rightStart = !0, symbol.topEnd = !0, maxX = right.x + lineLength / 2; else if (origin && "bottom" === origin && isOnSameColumn && isUpper) line = drawLine(this.chart, bottom, [ { + x: bottom.x, + y: bottom.y + lineLength / 2 + }, { + x: right.x + lineLength / 2, + y: bottom.y + lineLength / 2 + }, { + x: right.x + lineLength / 2, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.bottomStart = !0, symbol.topEnd = !0, maxX = bottom.x + lineLength / 2; else if ("left" === origin && isOnSameColumn && isUpper) { + var diffX = left.x - lineLength / 2; + symbolLeft.x < left.x && (diffX = symbolLeft.x - lineLength / 2), line = drawLine(this.chart, left, [ { + x: diffX, + y: left.y + }, { + x: diffX, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.leftStart = !0, symbol.topEnd = !0, maxX = left.x; + } else "left" === origin && (line = drawLine(this.chart, left, [ { + x: symbolTop.x + (left.x - symbolTop.x) / 2, + y: left.y + }, { + x: symbolTop.x + (left.x - symbolTop.x) / 2, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.leftStart = !0, symbol.topEnd = !0, maxX = left.x); else line = drawLine(this.chart, bottom, [ { + x: bottom.x, + y: bottom.y + lineLength / 2 + }, { + x: bottom.x + (bottom.x - symbolTop.x) / 2, + y: bottom.y + lineLength / 2 + }, { + x: bottom.x + (bottom.x - symbolTop.x) / 2, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.bottomStart = !0, symbol.topEnd = !0, maxX = bottom.x + (bottom.x - symbolTop.x) / 2; else line = this.leftEnd && isUpper ? drawLine(this.chart, bottom, [ { + x: bottom.x, + y: bottom.y + lineLength / 2 + }, { + x: bottom.x + (bottom.x - symbolTop.x) / 2, + y: bottom.y + lineLength / 2 + }, { + x: bottom.x + (bottom.x - symbolTop.x) / 2, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text) : drawLine(this.chart, bottom, [ { + x: bottom.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.bottomStart = !0, symbol.topEnd = !0, maxX = bottom.x + (bottom.x - symbolTop.x) / 2; else line = drawLine(this.chart, right, [ { + x: right.x + lineLength / 2, + y: right.y + }, { + x: right.x + lineLength / 2, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.rightStart = !0, symbol.topEnd = !0, maxX = right.x + lineLength / 2; else line = drawLine(this.chart, right, [ { + x: right.x + lineLength / 2, + y: right.y + }, { + x: right.x + lineLength / 2, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y - lineLength / 2 + }, { + x: symbolTop.x, + y: symbolTop.y + } ], text), this.rightStart = !0, symbol.topEnd = !0, maxX = right.x + lineLength / 2; else line = drawLine(this.chart, left, symbolRight, text), + this.leftStart = !0, symbol.rightEnd = !0, maxX = symbolRight.x; else line = drawLine(this.chart, right, symbolLeft, text), + this.rightStart = !0, symbol.leftEnd = !0, maxX = symbolLeft.x; else line = drawLine(this.chart, bottom, symbolTop, text), + this.bottomStart = !0, symbol.topEnd = !0, maxX = bottom.x; + if (line) { + for (var l = 0, llen = this.chart.lines.length; llen > l; l++) for (var len, otherLine = this.chart.lines[l], ePath = otherLine.attr("path"), lPath = line.attr("path"), iP = 0, lenP = ePath.length - 1; lenP > iP; iP++) { + var newPath = []; + newPath.push([ "M", ePath[iP][1], ePath[iP][2] ]), newPath.push([ "L", ePath[iP + 1][1], ePath[iP + 1][2] ]); + for (var line1_from_x = newPath[0][1], line1_from_y = newPath[0][2], line1_to_x = newPath[1][1], line1_to_y = newPath[1][2], lP = 0, lenlP = lPath.length - 1; lenlP > lP; lP++) { + var newLinePath = []; + newLinePath.push([ "M", lPath[lP][1], lPath[lP][2] ]), newLinePath.push([ "L", lPath[lP + 1][1], lPath[lP + 1][2] ]); + var line2_from_x = newLinePath[0][1], line2_from_y = newLinePath[0][2], line2_to_x = newLinePath[1][1], line2_to_y = newLinePath[1][2], res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y); + if (res.onLine1 && res.onLine2) { + var newSegment; + line2_from_y === line2_to_y ? line2_from_x > line2_to_x ? (newSegment = [ "L", res.x + 2 * lineWith, line2_from_y ], + lPath.splice(lP + 1, 0, newSegment), newSegment = [ "C", res.x + 2 * lineWith, line2_from_y, res.x, line2_from_y - 4 * lineWith, res.x - 2 * lineWith, line2_from_y ], + lPath.splice(lP + 2, 0, newSegment), line.attr("path", lPath)) : (newSegment = [ "L", res.x - 2 * lineWith, line2_from_y ], + lPath.splice(lP + 1, 0, newSegment), newSegment = [ "C", res.x - 2 * lineWith, line2_from_y, res.x, line2_from_y - 4 * lineWith, res.x + 2 * lineWith, line2_from_y ], + lPath.splice(lP + 2, 0, newSegment), line.attr("path", lPath)) : line2_from_y > line2_to_y ? (newSegment = [ "L", line2_from_x, res.y + 2 * lineWith ], + lPath.splice(lP + 1, 0, newSegment), newSegment = [ "C", line2_from_x, res.y + 2 * lineWith, line2_from_x + 4 * lineWith, res.y, line2_from_x, res.y - 2 * lineWith ], + lPath.splice(lP + 2, 0, newSegment), line.attr("path", lPath)) : (newSegment = [ "L", line2_from_x, res.y - 2 * lineWith ], + lPath.splice(lP + 1, 0, newSegment), newSegment = [ "C", line2_from_x, res.y - 2 * lineWith, line2_from_x + 4 * lineWith, res.y, line2_from_x, res.y + 2 * lineWith ], + lPath.splice(lP + 2, 0, newSegment), line.attr("path", lPath)), lP += 2, len += 2; + } + } } - } - - lP += 2; - len += 2; + this.chart.lines.push(line); } - } + (!this.chart.maxXFromLine || this.chart.maxXFromLine && maxX > this.chart.maxXFromLine) && (this.chart.maxXFromLine = maxX); + }, module.exports = Symbol; + }, /* 3 */ + /*!************************************!*\ + !*** ./src/flowchart.functions.js ***! + \************************************/ + /***/ + function(module, exports) { + function drawPath(chart, location, points) { + var i, len, path = "M{0},{1}"; + for (i = 2, len = 2 * points.length + 2; len > i; i += 2) path += " L{" + i + "},{" + (i + 1) + "}"; + var pathValues = [ location.x, location.y ]; + for (i = 0, len = points.length; len > i; i++) pathValues.push(points[i].x), pathValues.push(points[i].y); + var symbol = chart.paper.path(path, pathValues); + symbol.attr("stroke", chart.options["element-color"]), symbol.attr("stroke-width", chart.options["line-width"]); + var font = chart.options.font, fontF = chart.options["font-family"], fontW = chart.options["font-weight"]; + return font && symbol.attr({ + font: font + }), fontF && symbol.attr({ + "font-family": fontF + }), fontW && symbol.attr({ + "font-weight": fontW + }), symbol; } - } - - this.chart.lines.push(line); - } - - if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) { - this.chart.maxXFromLine = maxX; - } - }; - function Start(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0, 20); - options = options || {}; - options.text = options.text || 'Start'; - Symbol.call(this, chart, options, symbol); - } - f.inherits(Start, Symbol); - - - // Start.prototype.render = function() { - // if (this.next) { - // var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length']; - - // var bottomPoint = this.getBottom(); - // var topPoint = this.next.getTop(); - - // if (!this.next.isPositioned) { - // this.next.shiftY(this.getY() + this.height + lineLength); - // this.next.setX(bottomPoint.x - this.next.width/2); - // this.next.isPositioned = true; - - // this.next.render(); - // } - // } - // }; - - // Start.prototype.renderLines = function() { - // if (this.next) { - // this.drawLineTo(this.next); - // } - // }; - function End(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0, 20); - options = options || {}; - options.text = options.text || 'End'; - Symbol.call(this, chart, options, symbol); - } - f.inherits(End, Symbol); - function Operation(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0); - options = options || {}; - Symbol.call(this, chart, options, symbol); - } - f.inherits(Operation, Symbol); - function Subroutine(chart, options) { - var symbol = chart.paper.rect(0, 0, 0, 0); - options = options || {}; - Symbol.call(this, chart, options, symbol); - - symbol.attr({ - width: this.text.getBBox().width + 4 * this.getAttr('text-margin') - }); - - this.text.attr({ - 'x': 2 * this.getAttr('text-margin') - }); - - var innerWrap = chart.paper.rect(0, 0, 0, 0); - innerWrap.attr({ - x: this.getAttr('text-margin'), - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - width: this.text.getBBox().width + 2 * this.getAttr('text-margin'), - height: this.text.getBBox().height + 2 * this.getAttr('text-margin'), - fill: this.getAttr('fill') - }); - if (options.key) { innerWrap.node.id = options.key + 'i'; } - - var font = this.getAttr('font'); - var fontF = this.getAttr('font-family'); - var fontW = this.getAttr('font-weight'); - - if (font) innerWrap.attr({ 'font': font }); - if (fontF) innerWrap.attr({ 'font-family': fontF }); - if (fontW) innerWrap.attr({ 'font-weight': fontW }); - - if (options.link) { innerWrap.attr('href', options.link); } - if (options.target) { innerWrap.attr('target', options.target); } - this.group.push(innerWrap); - innerWrap.insertBefore(this.text); - - this.initialize(); - } - f.inherits(Subroutine, Symbol); - function InputOutput(chart, options) { - options = options || {}; - Symbol.call(this, chart, options); - this.textMargin = this.getAttr('text-margin'); - - this.text.attr({ - x: this.textMargin * 3 - }); - - var width = this.text.getBBox().width + 4 * this.textMargin; - var height = this.text.getBBox().height + 2 * this.textMargin; - var startX = this.textMargin; - var startY = height/2; - - var start = {x: startX, y: startY}; - var points = [ - {x: startX - this.textMargin, y: height}, - {x: startX - this.textMargin + width, y: height}, - {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0}, - {x: startX - this.textMargin + 2 * this.textMargin, y: 0}, - {x: startX, y: startY} - ]; - - var symbol = drawPath(chart, start, points); - - symbol.attr({ - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - fill: this.getAttr('fill') - }); - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - symbol.node.setAttribute('class', this.getAttr('class')); - - this.text.attr({ - y: symbol.getBBox().height/2 - }); - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.initialize(); - } - f.inherits(InputOutput, Symbol); - - InputOutput.prototype.getLeft = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.textMargin; - return {x: x, y: y}; - }; - - InputOutput.prototype.getRight = function() { - var y = this.getY() + this.group.getBBox().height/2; - var x = this.getX() + this.group.getBBox().width - this.textMargin; - return {x: x, y: y}; - }; - function Condition(chart, options) { - options = options || {}; - Symbol.call(this, chart, options); - this.textMargin = this.getAttr('text-margin'); - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - if (options.yes && options['direction_yes'] && options.no && !options['direction_no']) { - if (options['direction_yes'] === 'right') { - this.no_direction = 'bottom'; - this.yes_direction = 'right'; - } else { - this.no_direction = 'right'; - this.yes_direction = 'bottom'; - } - } else if (options.yes && !options['direction_yes'] && options.no && options['direction_no']) { - if (options['direction_no'] === 'right') { - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - } else { - this.yes_direction = 'right'; - this.no_direction = 'bottom'; - } - } else { - this.yes_direction = 'bottom'; - this.no_direction = 'right'; - } - - this.yes_direction = this.yes_direction || 'bottom'; - this.no_direction = this.no_direction || 'right'; - - this.text.attr({ - x: this.textMargin * 2 - }); - - var width = this.text.getBBox().width + 3 * this.textMargin; - width += width/2; - var height = this.text.getBBox().height + 2 * this.textMargin; - height += height/2; - height = Math.max(width * 0.5, height); - var startX = width/4; - var startY = height/4; - - this.text.attr({ - x: startX + this.textMargin/2 - }); - - var start = {x: startX, y: startY}; - var points = [ - {x: startX - width/4, y: startY + height/4}, - {x: startX - width/4 + width/2, y: startY + height/4 + height/2}, - {x: startX - width/4 + width, y: startY + height/4}, - {x: startX - width/4 + width/2, y: startY + height/4 - height/2}, - {x: startX - width/4, y: startY + height/4} - ]; - - var symbol = drawPath(chart, start, points); - - symbol.attr({ - stroke: this.getAttr('element-color'), - 'stroke-width': this.getAttr('line-width'), - fill: this.getAttr('fill') - }); - if (options.link) { symbol.attr('href', options.link); } - if (options.target) { symbol.attr('target', options.target); } - if (options.key) { symbol.node.id = options.key; } - symbol.node.setAttribute('class', this.getAttr('class')); - - this.text.attr({ - y: symbol.getBBox().height/2 - }); - - this.group.push(symbol); - symbol.insertBefore(this.text); - - this.initialize(); - } - f.inherits(Condition, Symbol); - - Condition.prototype.render = function() { - - if (this.yes_direction) { - this[this.yes_direction + '_symbol'] = this.yes_symbol; - } - - if (this.no_direction) { - this[this.no_direction + '_symbol'] = this.no_symbol; - } - - var lineLength = this.getAttr('line-length'); - - if (this.bottom_symbol) { - var bottomPoint = this.getBottom(); - var topPoint = this.bottom_symbol.getTop(); - - if (!this.bottom_symbol.isPositioned) { - this.bottom_symbol.shiftY(this.getY() + this.height + lineLength); - this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2); - this.bottom_symbol.isPositioned = true; - - this.bottom_symbol.render(); - } - } - - if (this.right_symbol) { - var rightPoint = this.getRight(); - var leftPoint = this.right_symbol.getLeft(); - - if (!this.right_symbol.isPositioned) { - - this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2); - this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength); - - var self = this; - (function shift() { - var hasSymbolUnder = false; - var symb; - for (var i = 0, len = self.chart.symbols.length; i < len; i++) { - symb = self.chart.symbols[i]; - - var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); - if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) { - hasSymbolUnder = true; - break; + function drawLine(chart, from, to, text) { + var i, len; + "[object Array]" !== Object.prototype.toString.call(to) && (to = [ to ]); + var path = "M{0},{1}"; + for (i = 2, len = 2 * to.length + 2; len > i; i += 2) path += " L{" + i + "},{" + (i + 1) + "}"; + var pathValues = [ from.x, from.y ]; + for (i = 0, len = to.length; len > i; i++) pathValues.push(to[i].x), pathValues.push(to[i].y); + var line = chart.paper.path(path, pathValues); + line.attr({ + stroke: chart.options["line-color"], + "stroke-width": chart.options["line-width"], + "arrow-end": chart.options["arrow-end"] + }); + var font = chart.options.font, fontF = chart.options["font-family"], fontW = chart.options["font-weight"]; + if (font && line.attr({ + font: font + }), fontF && line.attr({ + "font-family": fontF + }), fontW && line.attr({ + "font-weight": fontW + }), text) { + var centerText = !1, textPath = chart.paper.text(0, 0, text), isHorizontal = !1, firstTo = to[0]; + from.y === firstTo.y && (isHorizontal = !0); + var x = 0, y = 0; + centerText ? (x = from.x > firstTo.x ? from.x - (from.x - firstTo.x) / 2 : firstTo.x - (firstTo.x - from.x) / 2, + y = from.y > firstTo.y ? from.y - (from.y - firstTo.y) / 2 : firstTo.y - (firstTo.y - from.y) / 2, + isHorizontal ? (x -= textPath.getBBox().width / 2, y -= chart.options["text-margin"]) : (x += chart.options["text-margin"], + y -= textPath.getBBox().height / 2)) : (x = from.x, y = from.y, isHorizontal ? (x += chart.options["text-margin"] / 2, + y -= chart.options["text-margin"]) : (x += chart.options["text-margin"] / 2, y += chart.options["text-margin"])), + textPath.attr({ + "text-anchor": "start", + "font-size": chart.options["font-size"], + fill: chart.options["font-color"], + x: x, + y: y + }), font && textPath.attr({ + font: font + }), fontF && textPath.attr({ + "font-family": fontF + }), fontW && textPath.attr({ + "font-weight": fontW + }); } - } - - if (hasSymbolUnder) { - self.right_symbol.setX(symb.getX() + symb.width + lineLength); - shift(); - } - })(); - - this.right_symbol.isPositioned = true; - - this.right_symbol.render(); - } - } - }; - - Condition.prototype.renderLines = function() { - if (this.yes_symbol) { - this.drawLineTo(this.yes_symbol, this.getAttr('yes-text'), this.yes_direction); - } - - if (this.no_symbol) { - this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction); - } - }; - function parse(input) { - input = input || ''; - input = input.trim(); - - var chart = { - symbols: {}, - start: null, - drawSVG: function(container, options) { - var self = this; - - if (this.diagram) { - this.diagram.clean(); + return line; } - - var diagram = new FlowChart(container, options); - this.diagram = diagram; - var dispSymbols = {}; - - function getDisplaySymbol(s) { - if (dispSymbols[s.key]) { - return dispSymbols[s.key]; - } - - switch (s.symbolType) { - case 'start': - dispSymbols[s.key] = new Start(diagram, s); - break; - case 'end': - dispSymbols[s.key] = new End(diagram, s); - break; - case 'operation': - dispSymbols[s.key] = new Operation(diagram, s); - break; - case 'inputoutput': - dispSymbols[s.key] = new InputOutput(diagram, s); - break; - case 'subroutine': - dispSymbols[s.key] = new Subroutine(diagram, s); - break; - case 'condition': - dispSymbols[s.key] = new Condition(diagram, s); - break; - default: - return new Error('Wrong symbol type!'); - } - - return dispSymbols[s.key]; + function checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) { + // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point + var denominator, a, b, numerator1, numerator2, result = { + x: null, + y: null, + onLine1: !1, + onLine2: !1 + }; + // if we cast these lines infinitely in both directions, they intersect here: + /* + // it is worth noting that this should be the same as: + x = line2StartX + (b * (line2EndX - line2StartX)); + y = line2StartX + (b * (line2EndY - line2StartY)); + */ + // if line1 is a segment and line2 is infinite, they intersect if: + // if line2 is a segment and line1 is infinite, they intersect if: + return denominator = (line2EndY - line2StartY) * (line1EndX - line1StartX) - (line2EndX - line2StartX) * (line1EndY - line1StartY), + 0 === denominator ? result : (a = line1StartY - line2StartY, b = line1StartX - line2StartX, + numerator1 = (line2EndX - line2StartX) * a - (line2EndY - line2StartY) * b, numerator2 = (line1EndX - line1StartX) * a - (line1EndY - line1StartY) * b, + a = numerator1 / denominator, b = numerator2 / denominator, result.x = line1StartX + a * (line1EndX - line1StartX), + result.y = line1StartY + a * (line1EndY - line1StartY), a > 0 && 1 > a && (result.onLine1 = !0), + b > 0 && 1 > b && (result.onLine2 = !0), result); } - - (function constructChart(s, prevDisp, prev) { - var dispSymb = getDisplaySymbol(s); - - if (self.start === s) { - diagram.startWith(dispSymb); - } else if (prevDisp && prev && !prevDisp.pathOk) { - if (prevDisp instanceof(Condition)) { - if (prev.yes === s) { - prevDisp.yes(dispSymb); - } - if (prev.no === s) { - prevDisp.no(dispSymb); - } - } else { - prevDisp.then(dispSymb); + module.exports = { + drawPath: drawPath, + drawLine: drawLine, + checkLineIntersection: checkLineIntersection + }; + }, /* 4 */ + /*!********************************!*\ + !*** ./src/flowchart.parse.js ***! + \********************************/ + /***/ + function(module, exports, __webpack_require__) { + function parse(input) { + function getSymbol(s) { + var startIndex = s.indexOf("(") + 1, endIndex = s.indexOf(")"); + return startIndex >= 0 && endIndex >= 0 ? chart.symbols[s.substring(0, startIndex - 1)] : chart.symbols[s]; + } + function getNextPath(s) { + var next = "next", startIndex = s.indexOf("(") + 1, endIndex = s.indexOf(")"); + return startIndex >= 0 && endIndex >= 0 && (next = flowSymb.substring(startIndex, endIndex), + next.indexOf(",") < 0 && "yes" !== next && "no" !== next && (next = "next, " + next)), + next; + } + input = input || "", input = input.trim(); + for (var chart = { + symbols: {}, + start: null, + drawSVG: function(container, options) { + function getDisplaySymbol(s) { + if (dispSymbols[s.key]) return dispSymbols[s.key]; + switch (s.symbolType) { + case "start": + dispSymbols[s.key] = new Start(diagram, s); + break; + + case "end": + dispSymbols[s.key] = new End(diagram, s); + break; + + case "operation": + dispSymbols[s.key] = new Operation(diagram, s); + break; + + case "inputoutput": + dispSymbols[s.key] = new InputOutput(diagram, s); + break; + + case "subroutine": + dispSymbols[s.key] = new Subroutine(diagram, s); + break; + + case "condition": + dispSymbols[s.key] = new Condition(diagram, s); + break; + + default: + return new Error("Wrong symbol type!"); + } + return dispSymbols[s.key]; + } + var self = this; + this.diagram && this.diagram.clean(); + var diagram = new FlowChart(container, options); + this.diagram = diagram; + var dispSymbols = {}; + !function constructChart(s, prevDisp, prev) { + var dispSymb = getDisplaySymbol(s); + return self.start === s ? diagram.startWith(dispSymb) : prevDisp && prev && !prevDisp.pathOk && (prevDisp instanceof Condition ? (prev.yes === s && prevDisp.yes(dispSymb), + prev.no === s && prevDisp.no(dispSymb)) : prevDisp.then(dispSymb)), dispSymb.pathOk ? dispSymb : (dispSymb instanceof Condition ? (s.yes && constructChart(s.yes, dispSymb, s), + s.no && constructChart(s.no, dispSymb, s)) : s.next && constructChart(s.next, dispSymb, s), + dispSymb); + }(this.start), diagram.render(); + }, + clean: function() { + this.diagram.clean(); + } + }, lines = [], prevBreak = 0, i0 = 1, i0len = input.length; i0len > i0; i0++) if ("\n" === input[i0] && "\\" !== input[i0 - 1]) { + var line0 = input.substring(prevBreak, i0); + prevBreak = i0 + 1, lines.push(line0.replace(/\\\n/g, "\n")); } - } - - if (dispSymb.pathOk) { - return dispSymb; - } - - if (dispSymb instanceof(Condition)) { - if (s.yes) { - constructChart(s.yes, dispSymb, s); + prevBreak < input.length && lines.push(input.substr(prevBreak)); + for (var l = 1, len = lines.length; len > l; ) { + var currentLine = lines[l]; + currentLine.indexOf("->") < 0 && currentLine.indexOf("=>") < 0 ? (lines[l - 1] += "\n" + currentLine, + lines.splice(l, 1), len--) : l++; } - if (s.no) { - constructChart(s.no, dispSymb, s); + for (;lines.length > 0; ) { + var line = lines.splice(0, 1)[0]; + if (line.indexOf("=>") >= 0) { + // definition + var sub, parts = line.split("=>"), symbol = { + key: parts[0], + symbolType: parts[1], + text: null, + link: null, + target: null, + flowstate: null + }; + /* adding support for links */ + if (symbol.symbolType.indexOf(": ") >= 0 && (sub = symbol.symbolType.split(": "), + symbol.symbolType = sub.shift(), symbol.text = sub.join(": ")), symbol.text && symbol.text.indexOf(":>") >= 0 ? (sub = symbol.text.split(":>"), + symbol.text = sub.shift(), symbol.link = sub.join(":>")) : symbol.symbolType.indexOf(":>") >= 0 && (sub = symbol.symbolType.split(":>"), + symbol.symbolType = sub.shift(), symbol.link = sub.join(":>")), symbol.symbolType.indexOf("\n") >= 0 && (symbol.symbolType = symbol.symbolType.split("\n")[0]), + symbol.link) { + var startIndex = symbol.link.indexOf("[") + 1, endIndex = symbol.link.indexOf("]"); + startIndex >= 0 && endIndex >= 0 && (symbol.target = symbol.link.substring(startIndex, endIndex), + symbol.link = symbol.link.substring(0, startIndex - 1)); + } + /* end of link support */ + /* adding support for flowstates */ + if (symbol.text && symbol.text.indexOf("|") >= 0) { + var txtAndState = symbol.text.split("|"); + symbol.flowstate = txtAndState.pop().trim(), symbol.text = txtAndState.join("|"); + } + /* end of flowstate support */ + chart.symbols[symbol.key] = symbol; + } else if (line.indexOf("->") >= 0) for (var flowSymbols = line.split("->"), i = 0, lenS = flowSymbols.length; lenS > i; i++) { + var flowSymb = flowSymbols[i], realSymb = getSymbol(flowSymb), next = getNextPath(flowSymb), direction = null; + if (next.indexOf(",") >= 0) { + var condOpt = next.split(","); + next = condOpt[0], direction = condOpt[1].trim(); + } + if (chart.start || (chart.start = realSymb), lenS > i + 1) { + var nextSymb = flowSymbols[i + 1]; + realSymb[next] = getSymbol(nextSymb), realSymb["direction_" + next] = direction, + direction = null; + } + } } - } else if (s.next) { - constructChart(s.next, dispSymb, s); - } - - return dispSymb; - })(this.start); - - diagram.render(); - }, - clean: function() { - this.diagram.clean(); - } - }; - - var lines = []; - var prevBreak = 0; - for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) { - if(input[i0] === '\n' && input[i0 - 1] !== '\\') { - var line0 = input.substring(prevBreak, i0); - prevBreak = i0 + 1; - lines.push(line0.replace(/\\\n/g, '\n')); - } - } - - if(prevBreak < input.length) { - lines.push(input.substr(prevBreak)); - } - - for (var l = 1, len = lines.length; l < len;) { - var currentLine = lines[l]; - - if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0) { - lines[l - 1] += '\n' + currentLine; - lines.splice(l, 1); - len--; - } else { - l++; - } - } - - function getSymbol(s) { - var startIndex = s.indexOf('(') + 1; - var endIndex = s.indexOf(')'); - if (startIndex >= 0 && endIndex >= 0) { - return chart.symbols[s.substring(0, startIndex - 1)]; - } - return chart.symbols[s]; - } - - function getNextPath(s) { - var next = 'next'; - var startIndex = s.indexOf('(') + 1; - var endIndex = s.indexOf(')'); - if (startIndex >= 0 && endIndex >= 0) { - next = flowSymb.substring(startIndex, endIndex); - if (next.indexOf(',') < 0) { - if (next !== 'yes' && next !== 'no') { - next = 'next, ' + next; - } + return chart; } - } - return next; - } - - while (lines.length > 0) { - var line = lines.splice(0, 1)[0]; - - if (line.indexOf('=>') >= 0) { - // definition - var parts = line.split('=>'); - var symbol = { - key: parts[0], - symbolType: parts[1], - text: null, - link: null, - target: null, - flowstate: null + var FlowChart = __webpack_require__(/*! ./flowchart.chart */ 6), Start = __webpack_require__(/*! ./flowchart.symbol.start */ 12), End = __webpack_require__(/*! ./flowchart.symbol.end */ 9), Operation = __webpack_require__(/*! ./flowchart.symbol.operation */ 11), InputOutput = __webpack_require__(/*! ./flowchart.symbol.inputoutput */ 10), Subroutine = __webpack_require__(/*! ./flowchart.symbol.subroutine */ 13), Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5); + module.exports = parse; + }, /* 5 */ + /*!*******************************************!*\ + !*** ./src/flowchart.symbol.condition.js ***! + \*******************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Condition(chart, options) { + options = options || {}, Symbol.call(this, chart, options), this.textMargin = this.getAttr("text-margin"), + this.yes_direction = "bottom", this.no_direction = "right", options.yes && options.direction_yes && options.no && !options.direction_no ? "right" === options.direction_yes ? (this.no_direction = "bottom", + this.yes_direction = "right") : (this.no_direction = "right", this.yes_direction = "bottom") : options.yes && !options.direction_yes && options.no && options.direction_no ? "right" === options.direction_no ? (this.yes_direction = "bottom", + this.no_direction = "right") : (this.yes_direction = "right", this.no_direction = "bottom") : (this.yes_direction = "bottom", + this.no_direction = "right"), this.yes_direction = this.yes_direction || "bottom", + this.no_direction = this.no_direction || "right", this.text.attr({ + x: 2 * this.textMargin + }); + var width = this.text.getBBox().width + 3 * this.textMargin; + width += width / 2; + var height = this.text.getBBox().height + 2 * this.textMargin; + height += height / 2, height = Math.max(.5 * width, height); + var startX = width / 4, startY = height / 4; + this.text.attr({ + x: startX + this.textMargin / 2 + }); + var start = { + x: startX, + y: startY + }, points = [ { + x: startX - width / 4, + y: startY + height / 4 + }, { + x: startX - width / 4 + width / 2, + y: startY + height / 4 + height / 2 + }, { + x: startX - width / 4 + width, + y: startY + height / 4 + }, { + x: startX - width / 4 + width / 2, + y: startY + height / 4 - height / 2 + }, { + x: startX - width / 4, + y: startY + height / 4 + } ], symbol = drawPath(chart, start, points); + symbol.attr({ + stroke: this.getAttr("element-color"), + "stroke-width": this.getAttr("line-width"), + fill: this.getAttr("fill") + }), options.link && symbol.attr("href", options.link), options.target && symbol.attr("target", options.target), + options.key && (symbol.node.id = options.key), symbol.node.setAttribute("class", this.getAttr("class")), + this.text.attr({ + y: symbol.getBBox().height / 2 + }), this.group.push(symbol), symbol.insertBefore(this.text), this.initialize(); + } + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits, drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3), drawPath = drawAPI.drawPath; + inherits(Condition, Symbol), Condition.prototype.render = function() { + this.yes_direction && (this[this.yes_direction + "_symbol"] = this.yes_symbol), + this.no_direction && (this[this.no_direction + "_symbol"] = this.no_symbol); + var lineLength = this.getAttr("line-length"); + if (this.bottom_symbol) { + var bottomPoint = this.getBottom(); + this.bottom_symbol.isPositioned || (this.bottom_symbol.shiftY(this.getY() + this.height + lineLength), + this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width / 2), this.bottom_symbol.isPositioned = !0, + this.bottom_symbol.render()); + } + if (this.right_symbol) { + var rightPoint = this.getRight(); + if (!this.right_symbol.isPositioned) { + this.right_symbol.setY(rightPoint.y - this.right_symbol.height / 2), this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength); + var self = this; + !function shift() { + for (var symb, hasSymbolUnder = !1, i = 0, len = self.chart.symbols.length; len > i; i++) { + symb = self.chart.symbols[i]; + var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x); + if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width / 2) { + hasSymbolUnder = !0; + break; + } + } + hasSymbolUnder && (self.right_symbol.setX(symb.getX() + symb.width + lineLength), + shift()); + }(), this.right_symbol.isPositioned = !0, this.right_symbol.render(); + } + } + }, Condition.prototype.renderLines = function() { + this.yes_symbol && this.drawLineTo(this.yes_symbol, this.getAttr("yes-text"), this.yes_direction), + this.no_symbol && this.drawLineTo(this.no_symbol, this.getAttr("no-text"), this.no_direction); + }, module.exports = Condition; + }, /* 6 */ + /*!********************************!*\ + !*** ./src/flowchart.chart.js ***! + \********************************/ + /***/ + function(module, exports, __webpack_require__) { + function FlowChart(container, options) { + options = options || {}, this.paper = new Raphael(container), this.options = defaults(options, defaultOptions), + this.symbols = [], this.lines = [], this.start = null; + } + var Raphael = __webpack_require__(/*! raphael */ 15), defaults = __webpack_require__(/*! ./flowchart.helpers */ 1).defaults, defaultOptions = __webpack_require__(/*! ./flowchart.defaults */ 7), Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5); + FlowChart.prototype.handle = function(symbol) { + this.symbols.indexOf(symbol) <= -1 && this.symbols.push(symbol); + var flowChart = this; + return symbol instanceof Condition ? (symbol.yes = function(nextSymbol) { + return symbol.yes_symbol = nextSymbol, symbol.no_symbol && (symbol.pathOk = !0), + flowChart.handle(nextSymbol); + }, symbol.no = function(nextSymbol) { + return symbol.no_symbol = nextSymbol, symbol.yes_symbol && (symbol.pathOk = !0), + flowChart.handle(nextSymbol); + }) : symbol.then = function(nextSymbol) { + return symbol.next = nextSymbol, symbol.pathOk = !0, flowChart.handle(nextSymbol); + }, symbol; + }, FlowChart.prototype.startWith = function(symbol) { + return this.start = symbol, this.handle(symbol); + }, FlowChart.prototype.render = function() { + var symbol, maxWidth = 0, maxHeight = 0, i = 0, len = 0, maxX = 0, maxY = 0; + for (i = 0, len = this.symbols.length; len > i; i++) symbol = this.symbols[i], symbol.width > maxWidth && (maxWidth = symbol.width), + symbol.height > maxHeight && (maxHeight = symbol.height); + for (i = 0, len = this.symbols.length; len > i; i++) symbol = this.symbols[i], symbol.shiftX(this.options.x + (maxWidth - symbol.width) / 2 + this.options["line-width"]), + symbol.shiftY(this.options.y + (maxHeight - symbol.height) / 2 + this.options["line-width"]); + // for (i = 0, len = this.symbols.length; i < len; i++) { + // symbol = this.symbols[i]; + // symbol.render(); + // } + for (this.start.render(), i = 0, len = this.symbols.length; len > i; i++) symbol = this.symbols[i], + symbol.renderLines(); + for (maxX = this.maxXFromLine, i = 0, len = this.symbols.length; len > i; i++) { + symbol = this.symbols[i]; + var x = symbol.getX() + symbol.width, y = symbol.getY() + symbol.height; + x > maxX && (maxX = x), y > maxY && (maxY = y); + } + var scale = this.options.scale, lineWidth = this.options["line-width"]; + this.paper.setSize(maxX * scale + lineWidth * scale, maxY * scale + lineWidth * scale), + this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, !0); + }, FlowChart.prototype.clean = function() { + if (this.paper) { + var paperDom = this.paper.canvas; + paperDom.parentNode.removeChild(paperDom); + } + }, module.exports = FlowChart; + }, /* 7 */ + /*!***********************************!*\ + !*** ./src/flowchart.defaults.js ***! + \***********************************/ + /***/ + function(module, exports) { + // defaults + module.exports = { + x: 0, + y: 0, + "line-width": 3, + "line-length": 50, + "text-margin": 10, + "font-size": 14, + "font-color": "black", + // 'font': 'normal', + // 'font-family': 'calibri', + // 'font-weight': 'normal', + "line-color": "black", + "element-color": "black", + fill: "white", + "yes-text": "yes", + "no-text": "no", + "arrow-end": "block", + "class": "flowchart", + scale: 1, + symbols: { + start: {}, + end: {}, + condition: {}, + inputoutput: {}, + operation: {}, + subroutine: {} + } }; - - var sub; - - if (symbol.symbolType.indexOf(': ') >= 0) { - sub = symbol.symbolType.split(': '); - symbol.symbolType = sub.shift(); - symbol.text = sub.join(': '); + }, /* 8 */ + /*!*******************************!*\ + !*** ./src/flowchart.shim.js ***! + \*******************************/ + /***/ + function(module, exports) { + // add indexOf to non ECMA-262 standard compliant browsers + Array.prototype.indexOf || (Array.prototype.indexOf = function(searchElement) { + "use strict"; + if (null === this) throw new TypeError(); + var t = Object(this), len = t.length >>> 0; + if (0 === len) return -1; + var n = 0; + if (arguments.length > 0 && (n = Number(arguments[1]), n != n ? n = 0 : 0 !== n && n != 1 / 0 && n != -(1 / 0) && (n = (n > 0 || -1) * Math.floor(Math.abs(n)))), + n >= len) return -1; + for (var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); len > k; k++) if (k in t && t[k] === searchElement) return k; + return -1; + }), // add lastIndexOf to non ECMA-262 standard compliant browsers + Array.prototype.lastIndexOf || (Array.prototype.lastIndexOf = function(searchElement) { + "use strict"; + if (null === this) throw new TypeError(); + var t = Object(this), len = t.length >>> 0; + if (0 === len) return -1; + var n = len; + arguments.length > 1 && (n = Number(arguments[1]), n != n ? n = 0 : 0 !== n && n != 1 / 0 && n != -(1 / 0) && (n = (n > 0 || -1) * Math.floor(Math.abs(n)))); + for (var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n); k >= 0; k--) if (k in t && t[k] === searchElement) return k; + return -1; + }), String.prototype.trim || (String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ""); + }); + }, /* 9 */ + /*!*************************************!*\ + !*** ./src/flowchart.symbol.end.js ***! + \*************************************/ + /***/ + function(module, exports, __webpack_require__) { + function End(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0, 20); + options = options || {}, options.text = options.text || "End", Symbol.call(this, chart, options, symbol); } - - if (symbol.text && symbol.text.indexOf(':>') >= 0) { - sub = symbol.text.split(':>'); - symbol.text = sub.shift(); - symbol.link = sub.join(':>'); - } else if (symbol.symbolType.indexOf(':>') >= 0) { - sub = symbol.symbolType.split(':>'); - symbol.symbolType = sub.shift(); - symbol.link = sub.join(':>'); + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits; + inherits(End, Symbol), module.exports = End; + }, /* 10 */ + /*!*********************************************!*\ + !*** ./src/flowchart.symbol.inputoutput.js ***! + \*********************************************/ + /***/ + function(module, exports, __webpack_require__) { + function InputOutput(chart, options) { + options = options || {}, Symbol.call(this, chart, options), this.textMargin = this.getAttr("text-margin"), + this.text.attr({ + x: 3 * this.textMargin + }); + var width = this.text.getBBox().width + 4 * this.textMargin, height = this.text.getBBox().height + 2 * this.textMargin, startX = this.textMargin, startY = height / 2, start = { + x: startX, + y: startY + }, points = [ { + x: startX - this.textMargin, + y: height + }, { + x: startX - this.textMargin + width, + y: height + }, { + x: startX - this.textMargin + width + 2 * this.textMargin, + y: 0 + }, { + x: startX - this.textMargin + 2 * this.textMargin, + y: 0 + }, { + x: startX, + y: startY + } ], symbol = drawPath(chart, start, points); + symbol.attr({ + stroke: this.getAttr("element-color"), + "stroke-width": this.getAttr("line-width"), + fill: this.getAttr("fill") + }), options.link && symbol.attr("href", options.link), options.target && symbol.attr("target", options.target), + options.key && (symbol.node.id = options.key), symbol.node.setAttribute("class", this.getAttr("class")), + this.text.attr({ + y: symbol.getBBox().height / 2 + }), this.group.push(symbol), symbol.insertBefore(this.text), this.initialize(); } - - if (symbol.symbolType.indexOf('\n') >= 0) { - symbol.symbolType = symbol.symbolType.split('\n')[0]; + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits, drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3), drawPath = drawAPI.drawPath; + inherits(InputOutput, Symbol), InputOutput.prototype.getLeft = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.textMargin; + return { + x: x, + y: y + }; + }, InputOutput.prototype.getRight = function() { + var y = this.getY() + this.group.getBBox().height / 2, x = this.getX() + this.group.getBBox().width - this.textMargin; + return { + x: x, + y: y + }; + }, module.exports = InputOutput; + }, /* 11 */ + /*!*******************************************!*\ + !*** ./src/flowchart.symbol.operation.js ***! + \*******************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Operation(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0); + options = options || {}, Symbol.call(this, chart, options, symbol); } - - /* adding support for links */ - if (symbol.link) { - var startIndex = symbol.link.indexOf('[') + 1; - var endIndex = symbol.link.indexOf(']'); - if (startIndex >= 0 && endIndex >= 0) { - symbol.target = symbol.link.substring(startIndex, endIndex); - symbol.link = symbol.link.substring(0, startIndex - 1); - } + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits; + inherits(Operation, Symbol), module.exports = Operation; + }, /* 12 */ + /*!***************************************!*\ + !*** ./src/flowchart.symbol.start.js ***! + \***************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Start(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0, 20); + options = options || {}, options.text = options.text || "Start", Symbol.call(this, chart, options, symbol); } - /* end of link support */ - - /* adding support for flowstates */ - if (symbol.text) { - if (symbol.text.indexOf('|') >= 0) { - var txtAndState = symbol.text.split('|'); - symbol.flowstate = txtAndState.pop().trim(); - symbol.text = txtAndState.join('|'); - } + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits; + inherits(Start, Symbol), module.exports = Start; + }, /* 13 */ + /*!********************************************!*\ + !*** ./src/flowchart.symbol.subroutine.js ***! + \********************************************/ + /***/ + function(module, exports, __webpack_require__) { + function Subroutine(chart, options) { + var symbol = chart.paper.rect(0, 0, 0, 0); + options = options || {}, Symbol.call(this, chart, options, symbol), symbol.attr({ + width: this.text.getBBox().width + 4 * this.getAttr("text-margin") + }), this.text.attr({ + x: 2 * this.getAttr("text-margin") + }); + var innerWrap = chart.paper.rect(0, 0, 0, 0); + innerWrap.attr({ + x: this.getAttr("text-margin"), + stroke: this.getAttr("element-color"), + "stroke-width": this.getAttr("line-width"), + width: this.text.getBBox().width + 2 * this.getAttr("text-margin"), + height: this.text.getBBox().height + 2 * this.getAttr("text-margin"), + fill: this.getAttr("fill") + }), options.key && (innerWrap.node.id = options.key + "i"); + var font = this.getAttr("font"), fontF = this.getAttr("font-family"), fontW = this.getAttr("font-weight"); + font && innerWrap.attr({ + font: font + }), fontF && innerWrap.attr({ + "font-family": fontF + }), fontW && innerWrap.attr({ + "font-weight": fontW + }), options.link && innerWrap.attr("href", options.link), options.target && innerWrap.attr("target", options.target), + this.group.push(innerWrap), innerWrap.insertBefore(this.text), this.initialize(); } - /* end of flowstate support */ - - chart.symbols[symbol.key] = symbol; - - } else if (line.indexOf('->') >= 0) { - // flow - var flowSymbols = line.split('->'); - for (var i = 0, lenS = flowSymbols.length; i < lenS; i++) { - var flowSymb = flowSymbols[i]; - - var realSymb = getSymbol(flowSymb); - var next = getNextPath(flowSymb); - - var direction = null; - if (next.indexOf(',') >= 0) { - var condOpt = next.split(','); - next = condOpt[0]; - direction = condOpt[1].trim(); - } - - if (!chart.start) { - chart.start = realSymb; - } - - if (i + 1 < lenS) { - var nextSymb = flowSymbols[i + 1]; - realSymb[next] = getSymbol(nextSymb); - realSymb['direction_' + next] = direction; - direction = null; - } + var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2), inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits; + inherits(Subroutine, Symbol), module.exports = Subroutine; + }, /* 14 */ + /*!******************************!*\ + !*** ./src/jquery-plugin.js ***! + \******************************/ + /***/ + function(module, exports, __webpack_require__) { + if ("undefined" != typeof jQuery) { + var parse = __webpack_require__(/*! ./flowchart.parse */ 4); + !function($) { + $.fn.flowChart = function(options) { + return this.each(function() { + var $this = $(this), chart = parse($this.text()); + $this.html(""), chart.drawSVG(this, options); + }); + }; + }(jQuery); } - } - - } - return chart; - } - // public api interface - flowchart.parse = parse; - -})(); \ No newline at end of file + }, /* 15 */ + /*!**************************!*\ + !*** external "Raphael" ***! + \**************************/ + /***/ + function(module, exports) { + module.exports = __WEBPACK_EXTERNAL_MODULE_15__; + } ]); +}); +//# sourceMappingURL=flowchart.js.map \ No newline at end of file diff --git a/release/flowchart.js.map b/release/flowchart.js.map new file mode 100644 index 00000000..9721120f --- /dev/null +++ b/release/flowchart.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///flowchart.js","webpack:///webpack/bootstrap 30f32d336fe3b803c43a","webpack:///./index.js","webpack:///./src/flowchart.helpers.js","webpack:///./src/flowchart.symbol.js","webpack:///./src/flowchart.functions.js","webpack:///./src/flowchart.parse.js","webpack:///./src/flowchart.symbol.condition.js","webpack:///./src/flowchart.chart.js","webpack:///./src/flowchart.defaults.js","webpack:///./src/flowchart.shim.js","webpack:///./src/flowchart.symbol.end.js","webpack:///./src/flowchart.symbol.inputoutput.js","webpack:///./src/flowchart.symbol.operation.js","webpack:///./src/flowchart.symbol.start.js","webpack:///./src/flowchart.symbol.subroutine.js","webpack:///./src/jquery-plugin.js","webpack:///external \"Raphael\""],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE_15__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","parse","FlowChart","window","_defaults","options","defaultOptions","merged","attrname","_inherits","ctor","superCtor","Object","super_","prototype","create","constructor","value","enumerable","writable","configurable","TempCtor","defaults","inherits","Symbol","chart","symbol","group","paper","set","connectedTo","symbolType","flowstate","next_direction","next","undefined","text","key","node","setAttribute","getAttr","attr","text-anchor","x","fill","font-size","font","fontF","fontW","font-family","font-weight","link","target","maxWidth","words","split","tempText","ii","length","word","getBBox","width","substring","push","tmpMargin","stroke","stroke-width","height","insertBefore","y","initialize","drawAPI","drawLine","checkLineIntersection","attName","opt1","opt3","opt2","symbols","transform","getCenter","getX","getY","shiftX","setX","shiftY","setY","getTop","getBottom","getLeft","getRight","render","lineLength","rightPoint","isPositioned","self","shift","symb","hasSymbolUnder","len","diff","Math","abs","bottomPoint","renderLines","drawLineTo","origin","indexOf","line","right","bottom","left","symbolX","symbolY","symbolTop","symbolRight","symbolLeft","isOnSameColumn","isOnSameLine","isUnder","isUpper","isLeft","isRight","maxX","lineWith","rightStart","topEnd","bottomStart","diffX","leftStart","leftEnd","rightEnd","l","llen","lines","otherLine","ePath","lPath","iP","lenP","newPath","line1_from_x","line1_from_y","line1_to_x","line1_to_y","lP","lenlP","newLinePath","line2_from_x","line2_from_y","line2_to_x","line2_to_y","res","onLine1","onLine2","newSegment","splice","maxXFromLine","drawPath","location","points","path","pathValues","from","to","toString","arrow-end","centerText","textPath","isHorizontal","firstTo","line1StartX","line1StartY","line1EndX","line1EndY","line2StartX","line2StartY","line2EndX","line2EndY","denominator","b","numerator1","numerator2","result","input","getSymbol","s","startIndex","endIndex","getNextPath","flowSymb","trim","start","drawSVG","container","getDisplaySymbol","dispSymbols","Start","diagram","End","Operation","InputOutput","Subroutine","Condition","Error","clean","constructChart","prevDisp","prev","dispSymb","startWith","pathOk","yes","no","then","prevBreak","i0","i0len","line0","replace","substr","currentLine","sub","parts","join","txtAndState","pop","flowSymbols","lenS","realSymb","direction","condOpt","nextSymb","textMargin","yes_direction","no_direction","direction_yes","direction_no","max","startX","startY","yes_symbol","no_symbol","bottom_symbol","right_symbol","Raphael","handle","flowChart","nextSymbol","maxHeight","maxY","scale","lineWidth","setSize","setViewBox","paperDom","canvas","parentNode","removeChild","line-width","line-length","text-margin","font-color","line-color","element-color","yes-text","no-text","class","end","condition","inputoutput","operation","subroutine","Array","searchElement","TypeError","t","n","arguments","Number","Infinity","floor","k","lastIndexOf","min","String","rect","innerWrap","jQuery","$","fn","each","$this","html"],"mappings":";;;;;CAAA,SAAAA,MAAAC;IACA,uBAAAC,WAAA,mBAAAC,QACAA,OAAAD,UAAAD,QAAAG,QAAA,kBACA,yBAAAC,iBAAAC,KACAD,SAAA,aAAAJ,eACA;QACA,IAAAM,IAAAN,QAAA,mBAAAC,UAAAE,QAAA,aAAAJ,KAAA;QACA,SAAAQ,KAAAD,IAAA,mBAAAL,oBAAAF,MAAAQ,KAAAD,EAAAC;;EAECC,MAAA,SAAAC;;IACD,OCAgB,SAAUC;;;;;QCN1B,SAAAC,oBAAAC;;;;;YAGA,IAAAC,iBAAAD;YACA,OAAAC,iBAAAD,UAAAX;;;;;YAGA,IAAAC,SAAAW,iBAAAD;;gBACAX;;gBACAa,IAAAF;;gBACAG,SAAA;;;;;;;;;;;;;;YAUA,OANAL,QAAAE,UAAAI,KAAAd,OAAAD,SAAAC,eAAAD,SAAAU;YAGAT,OAAAa,UAAA,GAGAb,OAAAD;;;;;;QAvBA,IAAAY;;;;;;;;;;;;;;;;;;QAqCA,OATAF,oBAAAM,IAAAP,SAGAC,oBAAAO,IAAAL;QAGAF,oBAAAQ,IAAA,IAGAR,oBAAA;;;;;;IDmBM,SAAST,QAAQD,SAASU;QEzDhCA,gDAAA;QACA,IAAAS,QAAAT,iD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AAAmS,MAAAhQ;wBACAgQ,MAAAC,KAAA,KACA5Q,MAAAwK,QAAA5M,MAAAgB;;;cAGA2R;;;;;;;IhB2nDM,SAASjT,QAAQD;QiBtoDvBC,OAAAD,UAAAQ","file":"flowchart.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Raphael\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Raphael\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"Raphael\")) : factory(root[\"Raphael\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_15__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Raphael\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Raphael\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"Raphael\")) : factory(root[\"Raphael\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_15__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/*!******************!*\\\n !*** ./index.js ***!\n \\******************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t__webpack_require__(/*! ./src/flowchart.shim */ 8);\n\tvar parse = __webpack_require__(/*! ./src/flowchart.parse */ 4);\n\t__webpack_require__(/*! ./src/jquery-plugin */ 14);\n\t\n\tvar FlowChart = {\n\t\tparse: parse\n\t};\n\t\n\tif (typeof window !== 'undefined') {\n\t\twindow.FlowChart = FlowChart;\n\t}\n\t\n\tmodule.exports = FlowChart;\n\n\n/***/ },\n/* 1 */\n/*!**********************************!*\\\n !*** ./src/flowchart.helpers.js ***!\n \\**********************************/\n/***/ function(module, exports) {\n\n\tfunction _defaults(options, defaultOptions) {\n\t if (!options || typeof options === 'function') {\n\t return defaultOptions;\n\t }\n\t\n\t var merged = {};\n\t for (var attrname in defaultOptions) {\n\t merged[attrname] = defaultOptions[attrname];\n\t }\n\t\n\t for (attrname in options) {\n\t if (options[attrname]) {\n\t if (typeof merged[attrname] === 'object') {\n\t merged[attrname] = _defaults(merged[attrname], options[attrname]);\n\t } else {\n\t merged[attrname] = options[attrname];\n\t }\n\t }\n\t }\n\t return merged;\n\t}\n\t\n\tfunction _inherits(ctor, superCtor) {\n\t if (typeof(Object.create) === 'function') {\n\t // implementation from standard node.js 'util' module\n\t ctor.super_ = superCtor;\n\t ctor.prototype = Object.create(superCtor.prototype, {\n\t constructor: {\n\t value: ctor,\n\t enumerable: false,\n\t writable: true,\n\t configurable: true\n\t }\n\t });\n\t } else {\n\t // old school shim for old browsers\n\t ctor.super_ = superCtor;\n\t var TempCtor = function () {};\n\t TempCtor.prototype = superCtor.prototype;\n\t ctor.prototype = new TempCtor();\n\t ctor.prototype.constructor = ctor;\n\t }\n\t}\n\t\n\t// move dependent functions to a container so that\n\t// they can be overriden easier in no jquery environment (node.js)\n\tmodule.exports = {\n\t defaults: _defaults,\n\t inherits: _inherits\n\t};\n\n\n/***/ },\n/* 2 */\n/*!*********************************!*\\\n !*** ./src/flowchart.symbol.js ***!\n \\*********************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawLine = drawAPI.drawLine;\n\tvar checkLineIntersection = drawAPI.checkLineIntersection;\n\t\n\tfunction Symbol(chart, options, symbol) {\n\t this.chart = chart;\n\t this.group = this.chart.paper.set();\n\t this.symbol = symbol;\n\t this.connectedTo = [];\n\t this.symbolType = options.symbolType;\n\t this.flowstate = (options.flowstate || 'future');\n\t\n\t this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined;\n\t\n\t this.text = this.chart.paper.text(0, 0, options.text);\n\t //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t\n\t if (options.key) { this.text.node.id = options.key + 't'; }\n\t this.text.node.setAttribute('class', this.getAttr('class') + 't');\n\t\n\t this.text.attr({\n\t 'text-anchor': 'start',\n\t 'x' : this.getAttr('text-margin'),\n\t 'fill' : this.getAttr('font-color'),\n\t 'font-size' : this.getAttr('font-size')\n\t });\n\t\n\t var font = this.getAttr('font');\n\t var fontF = this.getAttr('font-family');\n\t var fontW = this.getAttr('font-weight');\n\t\n\t if (font) this.text.attr({ 'font': font });\n\t if (fontF) this.text.attr({ 'font-family': fontF });\n\t if (fontW) this.text.attr({ 'font-weight': fontW });\n\t\n\t if (options.link) { this.text.attr('href', options.link); }\n\t if (options.target) { this.text.attr('target', options.target); }\n\t\n\t var maxWidth = this.getAttr('maxWidth');\n\t if (maxWidth) {\n\t // using this approach: http://stackoverflow.com/a/3153457/22466\n\t var words = options.text.split(' ');\n\t var tempText = \"\";\n\t for (var i=0, ii=words.length; i maxWidth) {\n\t tempText += \"\\n\" + word;\n\t } else {\n\t tempText += \" \" + word;\n\t }\n\t }\n\t this.text.attr(\"text\", tempText.substring(1));\n\t }\n\t\n\t this.group.push(this.text);\n\t\n\t if (symbol) {\n\t var tmpMargin = this.getAttr('text-margin');\n\t\n\t symbol.attr({\n\t 'fill' : this.getAttr('fill'),\n\t 'stroke' : this.getAttr('element-color'),\n\t 'stroke-width' : this.getAttr('line-width'),\n\t 'width' : this.text.getBBox().width + 2 * tmpMargin,\n\t 'height' : this.text.getBBox().height + 2 * tmpMargin\n\t });\n\t\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t\n\t this.text.attr({\n\t 'y': symbol.getBBox().height/2\n\t });\n\t\n\t this.initialize();\n\t }\n\t\n\t}\n\t\n\t/* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */\n\tSymbol.prototype.getAttr = function(attName) {\n\t if (!this.chart) {\n\t return undefined;\n\t }\n\t var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined;\n\t var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined;\n\t var opt1;\n\t if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) {\n\t opt1 = this.chart.options.flowstate[this.flowstate][attName];\n\t }\n\t return (opt1 || opt2 || opt3);\n\t};\n\t\n\tSymbol.prototype.initialize = function() {\n\t this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width'));\n\t\n\t this.width = this.group.getBBox().width;\n\t this.height = this.group.getBBox().height;\n\t};\n\t\n\tSymbol.prototype.getCenter = function() {\n\t return {x: this.getX() + this.width/2,\n\t y: this.getY() + this.height/2};\n\t};\n\t\n\tSymbol.prototype.getX = function() {\n\t return this.group.getBBox().x;\n\t};\n\t\n\tSymbol.prototype.getY = function() {\n\t return this.group.getBBox().y;\n\t};\n\t\n\tSymbol.prototype.shiftX = function(x) {\n\t this.group.transform('t' + (this.getX() + x) + ',' + this.getY());\n\t};\n\t\n\tSymbol.prototype.setX = function(x) {\n\t this.group.transform('t' + x + ',' + this.getY());\n\t};\n\t\n\tSymbol.prototype.shiftY = function(y) {\n\t this.group.transform('t' + this.getX() + ',' + (this.getY() + y));\n\t};\n\t\n\tSymbol.prototype.setY = function(y) {\n\t this.group.transform('t' + this.getX() + ',' + y);\n\t};\n\t\n\tSymbol.prototype.getTop = function() {\n\t var y = this.getY();\n\t var x = this.getX() + this.width/2;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getBottom = function() {\n\t var y = this.getY() + this.height;\n\t var x = this.getX() + this.width/2;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX();\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.render = function() {\n\t if (this.next) {\n\t\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.next_direction === 'right') {\n\t\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.next.isPositioned) {\n\t\n\t this.next.setY(rightPoint.y - this.next.height/2);\n\t this.next.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t\n\t var self = this;\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n\t if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t self.next.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t } else {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.next.isPositioned) {\n\t this.next.shiftY(this.getY() + this.height + lineLength);\n\t this.next.setX(bottomPoint.x - this.next.width/2);\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t }\n\t }\n\t};\n\t\n\tSymbol.prototype.renderLines = function() {\n\t if (this.next) {\n\t if (this.next_direction) {\n\t this.drawLineTo(this.next, '', this.next_direction);\n\t } else {\n\t this.drawLineTo(this.next);\n\t }\n\t }\n\t};\n\t\n\tSymbol.prototype.drawLineTo = function(symbol, text, origin) {\n\t if (this.connectedTo.indexOf(symbol) < 0) {\n\t this.connectedTo.push(symbol);\n\t }\n\t\n\t var x = this.getCenter().x,\n\t y = this.getCenter().y,\n\t right = this.getRight(),\n\t bottom = this.getBottom(),\n\t left = this.getLeft();\n\t\n\t var symbolX = symbol.getCenter().x,\n\t symbolY = symbol.getCenter().y,\n\t symbolTop = symbol.getTop(),\n\t symbolRight = symbol.getRight(),\n\t symbolLeft = symbol.getLeft();\n\t\n\t var isOnSameColumn = x === symbolX,\n\t isOnSameLine = y === symbolY,\n\t isUnder = y < symbolY,\n\t isUpper = y > symbolY,\n\t isLeft = x > symbolX,\n\t isRight = x < symbolX;\n\t\n\t var maxX = 0,\n\t line,\n\t lineLength = this.getAttr('line-length'),\n\t lineWith = this.getAttr('line-width');\n\t\n\t if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) {\n\t line = drawLine(this.chart, bottom, symbolTop, text);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x;\n\t } else if ((!origin || origin === 'right') && isOnSameLine && isRight) {\n\t line = drawLine(this.chart, right, symbolLeft, text);\n\t this.rightStart = true;\n\t symbol.leftEnd = true;\n\t maxX = symbolLeft.x;\n\t } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) {\n\t line = drawLine(this.chart, left, symbolRight, text);\n\t this.leftStart = true;\n\t symbol.rightEnd = true;\n\t maxX = symbolRight.x;\n\t } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) {\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) {\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((!origin || origin === 'bottom') && isLeft) {\n\t if (this.leftEnd && isUpper) {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t } else {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t }\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n\t } else if ((!origin || origin === 'bottom') && isRight) {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n\t } else if ((origin && origin === 'right') && isLeft) {\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((origin && origin === 'right') && isRight) {\n\t line = drawLine(this.chart, right, [\n\t {x: symbolTop.x, y: right.y},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2},\n\t {x: right.x + lineLength/2, y: bottom.y + lineLength/2},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + lineLength/2;\n\t } else if ((origin === 'left') && isOnSameColumn && isUpper) {\n\t var diffX = left.x - lineLength/2;\n\t if (symbolLeft.x < left.x) {\n\t diffX = symbolLeft.x - lineLength/2;\n\t }\n\t line = drawLine(this.chart, left, [\n\t {x: diffX, y: left.y},\n\t {x: diffX, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.leftStart = true;\n\t symbol.topEnd = true;\n\t maxX = left.x;\n\t } else if ((origin === 'left')) {\n\t line = drawLine(this.chart, left, [\n\t {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y},\n\t {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.leftStart = true;\n\t symbol.topEnd = true;\n\t maxX = left.x;\n\t }\n\t\n\t if (line) {\n\t for (var l = 0, llen = this.chart.lines.length; l < llen; l++) {\n\t var otherLine = this.chart.lines[l];\n\t var len;\n\t\n\t var ePath = otherLine.attr('path'),\n\t lPath = line.attr('path');\n\t\n\t for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) {\n\t var newPath = [];\n\t newPath.push(['M', ePath[iP][1], ePath[iP][2]]);\n\t newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]);\n\t\n\t var line1_from_x = newPath[0][1];\n\t var line1_from_y = newPath[0][2];\n\t var line1_to_x = newPath[1][1];\n\t var line1_to_y = newPath[1][2];\n\t\n\t for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) {\n\t var newLinePath = [];\n\t newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]);\n\t newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]);\n\t\n\t var line2_from_x = newLinePath[0][1];\n\t var line2_from_y = newLinePath[0][2];\n\t var line2_to_x = newLinePath[1][1];\n\t var line2_to_y = newLinePath[1][2];\n\t\n\t var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y);\n\t if (res.onLine1 && res.onLine2) {\n\t\n\t var newSegment;\n\t if (line2_from_y === line2_to_y) {\n\t if (line2_from_x > line2_to_x) {\n\t newSegment = ['L', res.x + lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t } else {\n\t newSegment = ['L', res.x - lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t }\n\t } else {\n\t if (line2_from_y > line2_to_y) {\n\t newSegment = ['L', line2_from_x, res.y + lineWith * 2];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t } else {\n\t newSegment = ['L', line2_from_x, res.y - lineWith * 2];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t }\n\t }\n\t\n\t lP += 2;\n\t len += 2;\n\t }\n\t }\n\t }\n\t }\n\t\n\t this.chart.lines.push(line);\n\t }\n\t\n\t if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) {\n\t this.chart.maxXFromLine = maxX;\n\t }\n\t};\n\t\n\tmodule.exports = Symbol;\n\n\n/***/ },\n/* 3 */\n/*!************************************!*\\\n !*** ./src/flowchart.functions.js ***!\n \\************************************/\n/***/ function(module, exports) {\n\n\tfunction drawPath(chart, location, points) {\n\t var i, len;\n\t var path = 'M{0},{1}';\n\t for (i = 2, len = 2 * points.length + 2; i < len; i+=2) {\n\t path += ' L{' + i + '},{' + (i + 1) + '}';\n\t }\n\t var pathValues = [location.x, location.y];\n\t for (i = 0, len = points.length; i < len; i++) {\n\t pathValues.push(points[i].x);\n\t pathValues.push(points[i].y);\n\t }\n\t var symbol = chart.paper.path(path, pathValues);\n\t symbol.attr('stroke', chart.options['element-color']);\n\t symbol.attr('stroke-width', chart.options['line-width']);\n\t\n\t var font = chart.options.font;\n\t var fontF = chart.options['font-family'];\n\t var fontW = chart.options['font-weight'];\n\t\n\t if (font) symbol.attr({ 'font': font });\n\t if (fontF) symbol.attr({ 'font-family': fontF });\n\t if (fontW) symbol.attr({ 'font-weight': fontW });\n\t\n\t return symbol;\n\t}\n\t\n\tfunction drawLine(chart, from, to, text) {\n\t var i, len;\n\t\n\t if (Object.prototype.toString.call(to) !== '[object Array]') {\n\t to = [to];\n\t }\n\t\n\t var path = 'M{0},{1}';\n\t for (i = 2, len = 2 * to.length + 2; i < len; i+=2) {\n\t path += ' L{' + i + '},{' + (i + 1) + '}';\n\t }\n\t var pathValues = [from.x, from.y];\n\t for (i = 0, len = to.length; i < len; i++) {\n\t pathValues.push(to[i].x);\n\t pathValues.push(to[i].y);\n\t }\n\t\n\t var line = chart.paper.path(path, pathValues);\n\t line.attr({\n\t stroke: chart.options['line-color'],\n\t 'stroke-width': chart.options['line-width'],\n\t 'arrow-end': chart.options['arrow-end']\n\t });\n\t\n\t var font = chart.options.font;\n\t var fontF = chart.options['font-family'];\n\t var fontW = chart.options['font-weight'];\n\t\n\t if (font) line.attr({ 'font': font });\n\t if (fontF) line.attr({ 'font-family': fontF });\n\t if (fontW) line.attr({ 'font-weight': fontW });\n\t\n\t if (text) {\n\t\n\t var centerText = false;\n\t\n\t var textPath = chart.paper.text(0, 0, text);\n\t\n\t var isHorizontal = false;\n\t var firstTo = to[0];\n\t\n\t if (from.y === firstTo.y) {\n\t isHorizontal = true;\n\t }\n\t\n\t var x = 0,\n\t y = 0;\n\t\n\t if (centerText) {\n\t if (from.x > firstTo.x) {\n\t x = from.x - (from.x - firstTo.x)/2;\n\t } else {\n\t x = firstTo.x - (firstTo.x - from.x)/2;\n\t }\n\t\n\t if (from.y > firstTo.y) {\n\t y = from.y - (from.y - firstTo.y)/2;\n\t } else {\n\t y = firstTo.y - (firstTo.y - from.y)/2;\n\t }\n\t\n\t if (isHorizontal) {\n\t x -= textPath.getBBox().width/2;\n\t y -= chart.options['text-margin'];\n\t } else {\n\t x += chart.options['text-margin'];\n\t y -= textPath.getBBox().height/2;\n\t }\n\t } else {\n\t x = from.x;\n\t y = from.y;\n\t\n\t if (isHorizontal) {\n\t x += chart.options['text-margin']/2;\n\t y -= chart.options['text-margin'];\n\t } else {\n\t x += chart.options['text-margin']/2;\n\t y += chart.options['text-margin'];\n\t }\n\t }\n\t\n\t textPath.attr({\n\t 'text-anchor': 'start',\n\t 'font-size': chart.options['font-size'],\n\t 'fill': chart.options['font-color'],\n\t x: x,\n\t y: y\n\t });\n\t\n\t if (font) textPath.attr({ 'font': font });\n\t if (fontF) textPath.attr({ 'font-family': fontF });\n\t if (fontW) textPath.attr({ 'font-weight': fontW });\n\t }\n\t\n\t return line;\n\t}\n\t\n\tfunction checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {\n\t // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point\n\t var denominator, a, b, numerator1, numerator2, result = {\n\t x: null,\n\t y: null,\n\t onLine1: false,\n\t onLine2: false\n\t };\n\t denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY));\n\t if (denominator === 0) {\n\t return result;\n\t }\n\t a = line1StartY - line2StartY;\n\t b = line1StartX - line2StartX;\n\t numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);\n\t numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);\n\t a = numerator1 / denominator;\n\t b = numerator2 / denominator;\n\t\n\t // if we cast these lines infinitely in both directions, they intersect here:\n\t result.x = line1StartX + (a * (line1EndX - line1StartX));\n\t result.y = line1StartY + (a * (line1EndY - line1StartY));\n\t /*\n\t // it is worth noting that this should be the same as:\n\t x = line2StartX + (b * (line2EndX - line2StartX));\n\t y = line2StartX + (b * (line2EndY - line2StartY));\n\t */\n\t // if line1 is a segment and line2 is infinite, they intersect if:\n\t if (a > 0 && a < 1) {\n\t result.onLine1 = true;\n\t }\n\t // if line2 is a segment and line1 is infinite, they intersect if:\n\t if (b > 0 && b < 1) {\n\t result.onLine2 = true;\n\t }\n\t // if line1 and line2 are segments, they intersect if both of the above are true\n\t return result;\n\t}\n\t\n\tmodule.exports = {\n\t\tdrawPath: drawPath,\n\t\tdrawLine: drawLine,\n\t\tcheckLineIntersection: checkLineIntersection\n\t};\n\n\n/***/ },\n/* 4 */\n/*!********************************!*\\\n !*** ./src/flowchart.parse.js ***!\n \\********************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar FlowChart = __webpack_require__(/*! ./flowchart.chart */ 6);\n\tvar Start = __webpack_require__(/*! ./flowchart.symbol.start */ 12);\n\tvar End = __webpack_require__(/*! ./flowchart.symbol.end */ 9);\n\tvar Operation = __webpack_require__(/*! ./flowchart.symbol.operation */ 11);\n\tvar InputOutput = __webpack_require__(/*! ./flowchart.symbol.inputoutput */ 10);\n\tvar Subroutine = __webpack_require__(/*! ./flowchart.symbol.subroutine */ 13);\n\tvar Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5);\n\t\n\tfunction parse(input) {\n\t input = input || '';\n\t input = input.trim();\n\t\n\t var chart = {\n\t symbols: {},\n\t start: null,\n\t drawSVG: function(container, options) {\n\t var self = this;\n\t\n\t if (this.diagram) {\n\t this.diagram.clean();\n\t }\n\t\n\t var diagram = new FlowChart(container, options);\n\t this.diagram = diagram;\n\t var dispSymbols = {};\n\t\n\t function getDisplaySymbol(s) {\n\t if (dispSymbols[s.key]) {\n\t return dispSymbols[s.key];\n\t }\n\t\n\t switch (s.symbolType) {\n\t case 'start':\n\t dispSymbols[s.key] = new Start(diagram, s);\n\t break;\n\t case 'end':\n\t dispSymbols[s.key] = new End(diagram, s);\n\t break;\n\t case 'operation':\n\t dispSymbols[s.key] = new Operation(diagram, s);\n\t break;\n\t case 'inputoutput':\n\t dispSymbols[s.key] = new InputOutput(diagram, s);\n\t break;\n\t case 'subroutine':\n\t dispSymbols[s.key] = new Subroutine(diagram, s);\n\t break;\n\t case 'condition':\n\t dispSymbols[s.key] = new Condition(diagram, s);\n\t break;\n\t default:\n\t return new Error('Wrong symbol type!');\n\t }\n\t\n\t return dispSymbols[s.key];\n\t }\n\t\n\t (function constructChart(s, prevDisp, prev) {\n\t var dispSymb = getDisplaySymbol(s);\n\t\n\t if (self.start === s) {\n\t diagram.startWith(dispSymb);\n\t } else if (prevDisp && prev && !prevDisp.pathOk) {\n\t if (prevDisp instanceof(Condition)) {\n\t if (prev.yes === s) {\n\t prevDisp.yes(dispSymb);\n\t }\n\t if (prev.no === s) {\n\t prevDisp.no(dispSymb);\n\t }\n\t } else {\n\t prevDisp.then(dispSymb);\n\t }\n\t }\n\t\n\t if (dispSymb.pathOk) {\n\t return dispSymb;\n\t }\n\t\n\t if (dispSymb instanceof(Condition)) {\n\t if (s.yes) {\n\t constructChart(s.yes, dispSymb, s);\n\t }\n\t if (s.no) {\n\t constructChart(s.no, dispSymb, s);\n\t }\n\t } else if (s.next) {\n\t constructChart(s.next, dispSymb, s);\n\t }\n\t\n\t return dispSymb;\n\t })(this.start);\n\t\n\t diagram.render();\n\t },\n\t clean: function() {\n\t this.diagram.clean();\n\t }\n\t };\n\t\n\t var lines = [];\n\t var prevBreak = 0;\n\t for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) {\n\t if(input[i0] === '\\n' && input[i0 - 1] !== '\\\\') {\n\t var line0 = input.substring(prevBreak, i0);\n\t prevBreak = i0 + 1;\n\t lines.push(line0.replace(/\\\\\\n/g, '\\n'));\n\t }\n\t }\n\t\n\t if(prevBreak < input.length) {\n\t lines.push(input.substr(prevBreak));\n\t }\n\t\n\t for (var l = 1, len = lines.length; l < len;) {\n\t var currentLine = lines[l];\n\t\n\t if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0) {\n\t lines[l - 1] += '\\n' + currentLine;\n\t lines.splice(l, 1);\n\t len--;\n\t } else {\n\t l++;\n\t }\n\t }\n\t\n\t function getSymbol(s) {\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t return chart.symbols[s.substring(0, startIndex - 1)];\n\t }\n\t return chart.symbols[s];\n\t }\n\t\n\t function getNextPath(s) {\n\t var next = 'next';\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t next = flowSymb.substring(startIndex, endIndex);\n\t if (next.indexOf(',') < 0) {\n\t if (next !== 'yes' && next !== 'no') {\n\t next = 'next, ' + next;\n\t }\n\t }\n\t }\n\t return next;\n\t }\n\t\n\t while (lines.length > 0) {\n\t var line = lines.splice(0, 1)[0];\n\t\n\t if (line.indexOf('=>') >= 0) {\n\t // definition\n\t var parts = line.split('=>');\n\t var symbol = {\n\t key: parts[0],\n\t symbolType: parts[1],\n\t text: null,\n\t link: null,\n\t target: null,\n\t flowstate: null\n\t };\n\t\n\t var sub;\n\t\n\t if (symbol.symbolType.indexOf(': ') >= 0) {\n\t sub = symbol.symbolType.split(': ');\n\t symbol.symbolType = sub.shift();\n\t symbol.text = sub.join(': ');\n\t }\n\t\n\t if (symbol.text && symbol.text.indexOf(':>') >= 0) {\n\t sub = symbol.text.split(':>');\n\t symbol.text = sub.shift();\n\t symbol.link = sub.join(':>');\n\t } else if (symbol.symbolType.indexOf(':>') >= 0) {\n\t sub = symbol.symbolType.split(':>');\n\t symbol.symbolType = sub.shift();\n\t symbol.link = sub.join(':>');\n\t }\n\t\n\t if (symbol.symbolType.indexOf('\\n') >= 0) {\n\t symbol.symbolType = symbol.symbolType.split('\\n')[0];\n\t }\n\t\n\t /* adding support for links */\n\t if (symbol.link) {\n\t var startIndex = symbol.link.indexOf('[') + 1;\n\t var endIndex = symbol.link.indexOf(']');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t symbol.target = symbol.link.substring(startIndex, endIndex);\n\t symbol.link = symbol.link.substring(0, startIndex - 1);\n\t }\n\t }\n\t /* end of link support */\n\t\n\t /* adding support for flowstates */\n\t if (symbol.text) {\n\t if (symbol.text.indexOf('|') >= 0) {\n\t var txtAndState = symbol.text.split('|');\n\t symbol.flowstate = txtAndState.pop().trim();\n\t symbol.text = txtAndState.join('|');\n\t }\n\t }\n\t /* end of flowstate support */\n\t\n\t chart.symbols[symbol.key] = symbol;\n\t\n\t } else if (line.indexOf('->') >= 0) {\n\t // flow\n\t var flowSymbols = line.split('->');\n\t for (var i = 0, lenS = flowSymbols.length; i < lenS; i++) {\n\t var flowSymb = flowSymbols[i];\n\t\n\t var realSymb = getSymbol(flowSymb);\n\t var next = getNextPath(flowSymb);\n\t\n\t var direction = null;\n\t if (next.indexOf(',') >= 0) {\n\t var condOpt = next.split(',');\n\t next = condOpt[0];\n\t direction = condOpt[1].trim();\n\t }\n\t\n\t if (!chart.start) {\n\t chart.start = realSymb;\n\t }\n\t\n\t if (i + 1 < lenS) {\n\t var nextSymb = flowSymbols[i + 1];\n\t realSymb[next] = getSymbol(nextSymb);\n\t realSymb['direction_' + next] = direction;\n\t direction = null;\n\t }\n\t }\n\t }\n\t\n\t }\n\t return chart;\n\t}\n\t\n\tmodule.exports = parse;\n\n\n/***/ },\n/* 5 */\n/*!*******************************************!*\\\n !*** ./src/flowchart.symbol.condition.js ***!\n \\*******************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Condition(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t this.yes_direction = 'bottom';\n\t this.no_direction = 'right';\n\t if (options.yes && options.direction_yes && options.no && !options.direction_no) {\n\t if (options.direction_yes === 'right') {\n\t this.no_direction = 'bottom';\n\t this.yes_direction = 'right';\n\t } else {\n\t this.no_direction = 'right';\n\t this.yes_direction = 'bottom';\n\t }\n\t } else if (options.yes && !options.direction_yes && options.no && options.direction_no) {\n\t if (options.direction_no === 'right') {\n\t this.yes_direction = 'bottom';\n\t this.no_direction = 'right';\n\t } else {\n\t this.yes_direction = 'right';\n\t this.no_direction = 'bottom';\n\t }\n\t } else {\n\t this.yes_direction = 'bottom';\n\t this.no_direction = 'right';\n\t }\n\t\n\t this.yes_direction = this.yes_direction || 'bottom';\n\t this.no_direction = this.no_direction || 'right';\n\t\n\t this.text.attr({\n\t x: this.textMargin * 2\n\t });\n\t\n\t var width = this.text.getBBox().width + 3 * this.textMargin;\n\t width += width/2;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t height += height/2;\n\t height = Math.max(width * 0.5, height);\n\t var startX = width/4;\n\t var startY = height/4;\n\t\n\t this.text.attr({\n\t x: startX + this.textMargin/2\n\t });\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - width/4, y: startY + height/4},\n\t {x: startX - width/4 + width/2, y: startY + height/4 + height/2},\n\t {x: startX - width/4 + width, y: startY + height/4},\n\t {x: startX - width/4 + width/2, y: startY + height/4 - height/2},\n\t {x: startX - width/4, y: startY + height/4}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t\n\t this.initialize();\n\t}\n\tinherits(Condition, Symbol);\n\t\n\tCondition.prototype.render = function() {\n\t\n\t if (this.yes_direction) {\n\t this[this.yes_direction + '_symbol'] = this.yes_symbol;\n\t }\n\t\n\t if (this.no_direction) {\n\t this[this.no_direction + '_symbol'] = this.no_symbol;\n\t }\n\t\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.bottom_symbol) {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.bottom_symbol.isPositioned) {\n\t this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n\t this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2);\n\t this.bottom_symbol.isPositioned = true;\n\t\n\t this.bottom_symbol.render();\n\t }\n\t }\n\t\n\t if (this.right_symbol) {\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.right_symbol.isPositioned) {\n\t\n\t this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2);\n\t this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t\n\t var self = this;\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.right_symbol.isPositioned = true;\n\t\n\t this.right_symbol.render();\n\t }\n\t }\n\t};\n\t\n\tCondition.prototype.renderLines = function() {\n\t if (this.yes_symbol) {\n\t this.drawLineTo(this.yes_symbol, this.getAttr('yes-text'), this.yes_direction);\n\t }\n\t\n\t if (this.no_symbol) {\n\t this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction);\n\t }\n\t};\n\t\n\tmodule.exports = Condition;\n\n\n/***/ },\n/* 6 */\n/*!********************************!*\\\n !*** ./src/flowchart.chart.js ***!\n \\********************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Raphael = __webpack_require__(/*! raphael */ 15);\n\tvar defaults = __webpack_require__(/*! ./flowchart.helpers */ 1).defaults;\n\tvar defaultOptions = __webpack_require__(/*! ./flowchart.defaults */ 7);\n\tvar Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5);\n\t\n\tfunction FlowChart(container, options) {\n\t options = options || {};\n\t\n\t this.paper = new Raphael(container);\n\t\n\t this.options = defaults(options, defaultOptions);\n\t\n\t this.symbols = [];\n\t this.lines = [];\n\t this.start = null;\n\t}\n\t\n\tFlowChart.prototype.handle = function(symbol) {\n\t if (this.symbols.indexOf(symbol) <= -1) {\n\t this.symbols.push(symbol);\n\t }\n\t\n\t var flowChart = this;\n\t\n\t if (symbol instanceof(Condition)) {\n\t symbol.yes = function(nextSymbol) {\n\t symbol.yes_symbol = nextSymbol;\n\t if(symbol.no_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t symbol.no = function(nextSymbol) {\n\t symbol.no_symbol = nextSymbol;\n\t if(symbol.yes_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t } else {\n\t symbol.then = function(nextSymbol) {\n\t symbol.next = nextSymbol;\n\t symbol.pathOk = true;\n\t return flowChart.handle(nextSymbol);\n\t };\n\t }\n\t\n\t return symbol;\n\t};\n\t\n\tFlowChart.prototype.startWith = function(symbol) {\n\t this.start = symbol;\n\t return this.handle(symbol);\n\t};\n\t\n\tFlowChart.prototype.render = function() {\n\t var maxWidth = 0,\n\t maxHeight = 0,\n\t i = 0,\n\t len = 0,\n\t maxX = 0,\n\t maxY = 0,\n\t symbol;\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t if (symbol.width > maxWidth) {\n\t maxWidth = symbol.width;\n\t }\n\t if (symbol.height > maxHeight) {\n\t maxHeight = symbol.height;\n\t }\n\t }\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']);\n\t symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']);\n\t }\n\t\n\t this.start.render();\n\t // for (i = 0, len = this.symbols.length; i < len; i++) {\n\t // symbol = this.symbols[i];\n\t // symbol.render();\n\t // }\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t symbol.renderLines();\n\t }\n\t\n\t maxX = this.maxXFromLine;\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t var x = symbol.getX() + symbol.width;\n\t var y = symbol.getY() + symbol.height;\n\t if (x > maxX) {\n\t maxX = x;\n\t }\n\t if (y > maxY) {\n\t maxY = y;\n\t }\n\t }\n\t\n\t var scale = this.options['scale'];\n\t var lineWidth = this.options['line-width'];\n\t this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale));\n\t this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true);\n\t};\n\t\n\tFlowChart.prototype.clean = function() {\n\t if (this.paper) {\n\t var paperDom = this.paper.canvas;\n\t paperDom.parentNode.removeChild(paperDom);\n\t }\n\t};\n\t\n\tmodule.exports = FlowChart;\n\n\n/***/ },\n/* 7 */\n/*!***********************************!*\\\n !*** ./src/flowchart.defaults.js ***!\n \\***********************************/\n/***/ function(module, exports) {\n\n\t// defaults\n\tmodule.exports = {\n\t 'x': 0,\n\t 'y': 0,\n\t 'line-width': 3,\n\t 'line-length': 50,\n\t 'text-margin': 10,\n\t 'font-size': 14,\n\t 'font-color': 'black',\n\t // 'font': 'normal',\n\t // 'font-family': 'calibri',\n\t // 'font-weight': 'normal',\n\t 'line-color': 'black',\n\t 'element-color': 'black',\n\t 'fill': 'white',\n\t 'yes-text': 'yes',\n\t 'no-text': 'no',\n\t 'arrow-end': 'block',\n\t 'class': 'flowchart',\n\t 'scale': 1,\n\t 'symbols': {\n\t 'start': {},\n\t 'end': {},\n\t 'condition': {},\n\t 'inputoutput': {},\n\t 'operation': {},\n\t 'subroutine': {}\n\t }//,\n\t // 'flowstate' : {\n\t // 'past' : { 'fill': '#CCCCCC', 'font-size': 12},\n\t // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'},\n\t // 'future' : { 'fill': '#FFFF99'},\n\t // 'invalid': {'fill': '#444444'}\n\t // }\n\t};\n\n\n/***/ },\n/* 8 */\n/*!*******************************!*\\\n !*** ./src/flowchart.shim.js ***!\n \\*******************************/\n/***/ function(module, exports) {\n\n\t// add indexOf to non ECMA-262 standard compliant browsers\n\tif (!Array.prototype.indexOf) {\n\t Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\n\t \"use strict\";\n\t if (this === null) {\n\t throw new TypeError();\n\t }\n\t var t = Object(this);\n\t var len = t.length >>> 0;\n\t if (len === 0) {\n\t return -1;\n\t }\n\t var n = 0;\n\t if (arguments.length > 0) {\n\t n = Number(arguments[1]);\n\t if (n != n) { // shortcut for verifying if it's NaN\n\t n = 0;\n\t } else if (n !== 0 && n != Infinity && n != -Infinity) {\n\t n = (n > 0 || -1) * Math.floor(Math.abs(n));\n\t }\n\t }\n\t if (n >= len) {\n\t return -1;\n\t }\n\t var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\n\t for (; k < len; k++) {\n\t if (k in t && t[k] === searchElement) {\n\t return k;\n\t }\n\t }\n\t return -1;\n\t };\n\t}\n\t\n\t// add lastIndexOf to non ECMA-262 standard compliant browsers\n\tif (!Array.prototype.lastIndexOf) {\n\t Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {\n\t \"use strict\";\n\t if (this === null) {\n\t throw new TypeError();\n\t }\n\t var t = Object(this);\n\t var len = t.length >>> 0;\n\t if (len === 0) {\n\t return -1;\n\t }\n\t var n = len;\n\t if (arguments.length > 1) {\n\t n = Number(arguments[1]);\n\t if (n != n) {\n\t n = 0;\n\t } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) {\n\t n = (n > 0 || -1) * Math.floor(Math.abs(n));\n\t }\n\t }\n\t var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);\n\t for (; k >= 0; k--) {\n\t if (k in t && t[k] === searchElement) {\n\t return k;\n\t }\n\t }\n\t return -1;\n\t };\n\t}\n\t\n\tif (!String.prototype.trim) {\n\t String.prototype.trim = function() {\n\t return this.replace(/^\\s+|\\s+$/g, '');\n\t };\n\t}\n\n/***/ },\n/* 9 */\n/*!*************************************!*\\\n !*** ./src/flowchart.symbol.end.js ***!\n \\*************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction End(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n\t options = options || {};\n\t options.text = options.text || 'End';\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(End, Symbol);\n\t\n\tmodule.exports = End;\n\n\n/***/ },\n/* 10 */\n/*!*********************************************!*\\\n !*** ./src/flowchart.symbol.inputoutput.js ***!\n \\*********************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction InputOutput(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t\n\t this.text.attr({\n\t x: this.textMargin * 3\n\t });\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t\n\t this.initialize();\n\t}\n\tinherits(InputOutput, Symbol);\n\t\n\tInputOutput.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tInputOutput.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width - this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tmodule.exports = InputOutput;\n\n\n/***/ },\n/* 11 */\n/*!*******************************************!*\\\n !*** ./src/flowchart.symbol.operation.js ***!\n \\*******************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Operation(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(Operation, Symbol);\n\t\n\tmodule.exports = Operation;\n\n\n/***/ },\n/* 12 */\n/*!***************************************!*\\\n !*** ./src/flowchart.symbol.start.js ***!\n \\***************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Start(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n\t options = options || {};\n\t options.text = options.text || 'Start';\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(Start, Symbol);\n\t\n\tmodule.exports = Start;\n\t\n\t// Start.prototype.render = function() {\n\t// if (this.next) {\n\t// var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length'];\n\t\n\t// var bottomPoint = this.getBottom();\n\t// var topPoint = this.next.getTop();\n\t\n\t// if (!this.next.isPositioned) {\n\t// this.next.shiftY(this.getY() + this.height + lineLength);\n\t// this.next.setX(bottomPoint.x - this.next.width/2);\n\t// this.next.isPositioned = true;\n\t\n\t// this.next.render();\n\t// }\n\t// }\n\t// };\n\t\n\t// Start.prototype.renderLines = function() {\n\t// if (this.next) {\n\t// this.drawLineTo(this.next);\n\t// }\n\t// };\n\n\n/***/ },\n/* 13 */\n/*!********************************************!*\\\n !*** ./src/flowchart.symbol.subroutine.js ***!\n \\********************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Subroutine(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t\n\t symbol.attr({\n\t width: this.text.getBBox().width + 4 * this.getAttr('text-margin')\n\t });\n\t\n\t this.text.attr({\n\t 'x': 2 * this.getAttr('text-margin')\n\t });\n\t\n\t var innerWrap = chart.paper.rect(0, 0, 0, 0);\n\t innerWrap.attr({\n\t x: this.getAttr('text-margin'),\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t width: this.text.getBBox().width + 2 * this.getAttr('text-margin'),\n\t height: this.text.getBBox().height + 2 * this.getAttr('text-margin'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.key) { innerWrap.node.id = options.key + 'i'; }\n\t\n\t var font = this.getAttr('font');\n\t var fontF = this.getAttr('font-family');\n\t var fontW = this.getAttr('font-weight');\n\t\n\t if (font) innerWrap.attr({ 'font': font });\n\t if (fontF) innerWrap.attr({ 'font-family': fontF });\n\t if (fontW) innerWrap.attr({ 'font-weight': fontW });\n\t\n\t if (options.link) { innerWrap.attr('href', options.link); }\n\t if (options.target) { innerWrap.attr('target', options.target); }\n\t this.group.push(innerWrap);\n\t innerWrap.insertBefore(this.text);\n\t\n\t this.initialize();\n\t}\n\tinherits(Subroutine, Symbol);\n\t\n\tmodule.exports = Subroutine;\n\n\n/***/ },\n/* 14 */\n/*!******************************!*\\\n !*** ./src/jquery-plugin.js ***!\n \\******************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tif (typeof jQuery != 'undefined') {\n\t\tvar parse = __webpack_require__(/*! ./flowchart.parse */ 4);\n\t\t(function( $ ) {\n\t\t\t$.fn.flowChart = function( options ) {\n\t\t\t\treturn this.each(function() {\n\t\t\t\t\tvar $this = $(this);\n\t\t\t\t\tvar chart = parse($this.text());\n\t\t\t\t\t$this.html('');\n\t\t\t\t\tchart.drawSVG(this, options);\n\t\t\t\t});\n\t\t\t};\n\t\t})( jQuery ); // eslint-disable-line\n\t}\n\n\n/***/ },\n/* 15 */\n/*!**************************!*\\\n !*** external \"Raphael\" ***!\n \\**************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_15__;\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** flowchart.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 30f32d336fe3b803c43a\n **/","require('./src/flowchart.shim');\nvar parse = require('./src/flowchart.parse');\nrequire('./src/jquery-plugin');\n\nvar FlowChart = {\n\tparse: parse\n};\n\nif (typeof window !== 'undefined') {\n\twindow.FlowChart = FlowChart;\n}\n\nmodule.exports = FlowChart;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./index.js\n ** module id = 0\n ** module chunks = 0\n **/","function _defaults(options, defaultOptions) {\n if (!options || typeof options === 'function') {\n return defaultOptions;\n }\n\n var merged = {};\n for (var attrname in defaultOptions) {\n merged[attrname] = defaultOptions[attrname];\n }\n\n for (attrname in options) {\n if (options[attrname]) {\n if (typeof merged[attrname] === 'object') {\n merged[attrname] = _defaults(merged[attrname], options[attrname]);\n } else {\n merged[attrname] = options[attrname];\n }\n }\n }\n return merged;\n}\n\nfunction _inherits(ctor, superCtor) {\n if (typeof(Object.create) === 'function') {\n // implementation from standard node.js 'util' module\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n } else {\n // old school shim for old browsers\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n}\n\n// move dependent functions to a container so that\n// they can be overriden easier in no jquery environment (node.js)\nmodule.exports = {\n defaults: _defaults,\n inherits: _inherits\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.helpers.js\n ** module id = 1\n ** module chunks = 0\n **/","var drawAPI = require('./flowchart.functions');\nvar drawLine = drawAPI.drawLine;\nvar checkLineIntersection = drawAPI.checkLineIntersection;\n\nfunction Symbol(chart, options, symbol) {\n this.chart = chart;\n this.group = this.chart.paper.set();\n this.symbol = symbol;\n this.connectedTo = [];\n this.symbolType = options.symbolType;\n this.flowstate = (options.flowstate || 'future');\n\n this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined;\n\n this.text = this.chart.paper.text(0, 0, options.text);\n //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t\n if (options.key) { this.text.node.id = options.key + 't'; }\n this.text.node.setAttribute('class', this.getAttr('class') + 't');\n\n this.text.attr({\n 'text-anchor': 'start',\n 'x' : this.getAttr('text-margin'),\n 'fill' : this.getAttr('font-color'),\n 'font-size' : this.getAttr('font-size')\n });\n\n var font = this.getAttr('font');\n var fontF = this.getAttr('font-family');\n var fontW = this.getAttr('font-weight');\n\n if (font) this.text.attr({ 'font': font });\n if (fontF) this.text.attr({ 'font-family': fontF });\n if (fontW) this.text.attr({ 'font-weight': fontW });\n\n if (options.link) { this.text.attr('href', options.link); }\n if (options.target) { this.text.attr('target', options.target); }\n\n var maxWidth = this.getAttr('maxWidth');\n if (maxWidth) {\n // using this approach: http://stackoverflow.com/a/3153457/22466\n var words = options.text.split(' ');\n var tempText = \"\";\n for (var i=0, ii=words.length; i maxWidth) {\n tempText += \"\\n\" + word;\n } else {\n tempText += \" \" + word;\n }\n }\n this.text.attr(\"text\", tempText.substring(1));\n }\n\n this.group.push(this.text);\n\n if (symbol) {\n var tmpMargin = this.getAttr('text-margin');\n\n symbol.attr({\n 'fill' : this.getAttr('fill'),\n 'stroke' : this.getAttr('element-color'),\n 'stroke-width' : this.getAttr('line-width'),\n 'width' : this.text.getBBox().width + 2 * tmpMargin,\n 'height' : this.text.getBBox().height + 2 * tmpMargin\n });\n\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n\n this.text.attr({\n 'y': symbol.getBBox().height/2\n });\n\n this.initialize();\n }\n\n}\n\n/* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */\nSymbol.prototype.getAttr = function(attName) {\n if (!this.chart) {\n return undefined;\n }\n var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined;\n var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined;\n var opt1;\n if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) {\n opt1 = this.chart.options.flowstate[this.flowstate][attName];\n }\n return (opt1 || opt2 || opt3);\n};\n\nSymbol.prototype.initialize = function() {\n this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width'));\n\n this.width = this.group.getBBox().width;\n this.height = this.group.getBBox().height;\n};\n\nSymbol.prototype.getCenter = function() {\n return {x: this.getX() + this.width/2,\n y: this.getY() + this.height/2};\n};\n\nSymbol.prototype.getX = function() {\n return this.group.getBBox().x;\n};\n\nSymbol.prototype.getY = function() {\n return this.group.getBBox().y;\n};\n\nSymbol.prototype.shiftX = function(x) {\n this.group.transform('t' + (this.getX() + x) + ',' + this.getY());\n};\n\nSymbol.prototype.setX = function(x) {\n this.group.transform('t' + x + ',' + this.getY());\n};\n\nSymbol.prototype.shiftY = function(y) {\n this.group.transform('t' + this.getX() + ',' + (this.getY() + y));\n};\n\nSymbol.prototype.setY = function(y) {\n this.group.transform('t' + this.getX() + ',' + y);\n};\n\nSymbol.prototype.getTop = function() {\n var y = this.getY();\n var x = this.getX() + this.width/2;\n return {x: x, y: y};\n};\n\nSymbol.prototype.getBottom = function() {\n var y = this.getY() + this.height;\n var x = this.getX() + this.width/2;\n return {x: x, y: y};\n};\n\nSymbol.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX();\n return {x: x, y: y};\n};\n\nSymbol.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width;\n return {x: x, y: y};\n};\n\nSymbol.prototype.render = function() {\n if (this.next) {\n\n var lineLength = this.getAttr('line-length');\n\n if (this.next_direction === 'right') {\n\n var rightPoint = this.getRight();\n\n if (!this.next.isPositioned) {\n\n this.next.setY(rightPoint.y - this.next.height/2);\n this.next.shiftX(this.group.getBBox().x + this.width + lineLength);\n\n var self = this;\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n\n if (hasSymbolUnder) {\n self.next.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.next.isPositioned = true;\n\n this.next.render();\n }\n } else {\n var bottomPoint = this.getBottom();\n\n if (!this.next.isPositioned) {\n this.next.shiftY(this.getY() + this.height + lineLength);\n this.next.setX(bottomPoint.x - this.next.width/2);\n this.next.isPositioned = true;\n\n this.next.render();\n }\n }\n }\n};\n\nSymbol.prototype.renderLines = function() {\n if (this.next) {\n if (this.next_direction) {\n this.drawLineTo(this.next, '', this.next_direction);\n } else {\n this.drawLineTo(this.next);\n }\n }\n};\n\nSymbol.prototype.drawLineTo = function(symbol, text, origin) {\n if (this.connectedTo.indexOf(symbol) < 0) {\n this.connectedTo.push(symbol);\n }\n\n var x = this.getCenter().x,\n y = this.getCenter().y,\n right = this.getRight(),\n bottom = this.getBottom(),\n left = this.getLeft();\n\n var symbolX = symbol.getCenter().x,\n symbolY = symbol.getCenter().y,\n symbolTop = symbol.getTop(),\n symbolRight = symbol.getRight(),\n symbolLeft = symbol.getLeft();\n\n var isOnSameColumn = x === symbolX,\n isOnSameLine = y === symbolY,\n isUnder = y < symbolY,\n isUpper = y > symbolY,\n isLeft = x > symbolX,\n isRight = x < symbolX;\n\n var maxX = 0,\n line,\n lineLength = this.getAttr('line-length'),\n lineWith = this.getAttr('line-width');\n\n if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) {\n line = drawLine(this.chart, bottom, symbolTop, text);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x;\n } else if ((!origin || origin === 'right') && isOnSameLine && isRight) {\n line = drawLine(this.chart, right, symbolLeft, text);\n this.rightStart = true;\n symbol.leftEnd = true;\n maxX = symbolLeft.x;\n } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) {\n line = drawLine(this.chart, left, symbolRight, text);\n this.leftStart = true;\n symbol.rightEnd = true;\n maxX = symbolRight.x;\n } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) {\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) {\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((!origin || origin === 'bottom') && isLeft) {\n if (this.leftEnd && isUpper) {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n } else {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n }\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n } else if ((!origin || origin === 'bottom') && isRight) {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n } else if ((origin && origin === 'right') && isLeft) {\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((origin && origin === 'right') && isRight) {\n line = drawLine(this.chart, right, [\n {x: symbolTop.x, y: right.y},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2},\n {x: right.x + lineLength/2, y: bottom.y + lineLength/2},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + lineLength/2;\n } else if ((origin === 'left') && isOnSameColumn && isUpper) {\n var diffX = left.x - lineLength/2;\n if (symbolLeft.x < left.x) {\n diffX = symbolLeft.x - lineLength/2;\n }\n line = drawLine(this.chart, left, [\n {x: diffX, y: left.y},\n {x: diffX, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.leftStart = true;\n symbol.topEnd = true;\n maxX = left.x;\n } else if ((origin === 'left')) {\n line = drawLine(this.chart, left, [\n {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y},\n {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.leftStart = true;\n symbol.topEnd = true;\n maxX = left.x;\n }\n\n if (line) {\n for (var l = 0, llen = this.chart.lines.length; l < llen; l++) {\n var otherLine = this.chart.lines[l];\n var len;\n\n var ePath = otherLine.attr('path'),\n lPath = line.attr('path');\n\n for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) {\n var newPath = [];\n newPath.push(['M', ePath[iP][1], ePath[iP][2]]);\n newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]);\n\n var line1_from_x = newPath[0][1];\n var line1_from_y = newPath[0][2];\n var line1_to_x = newPath[1][1];\n var line1_to_y = newPath[1][2];\n\n for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) {\n var newLinePath = [];\n newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]);\n newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]);\n\n var line2_from_x = newLinePath[0][1];\n var line2_from_y = newLinePath[0][2];\n var line2_to_x = newLinePath[1][1];\n var line2_to_y = newLinePath[1][2];\n\n var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y);\n if (res.onLine1 && res.onLine2) {\n\n var newSegment;\n if (line2_from_y === line2_to_y) {\n if (line2_from_x > line2_to_x) {\n newSegment = ['L', res.x + lineWith * 2, line2_from_y];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n } else {\n newSegment = ['L', res.x - lineWith * 2, line2_from_y];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n }\n } else {\n if (line2_from_y > line2_to_y) {\n newSegment = ['L', line2_from_x, res.y + lineWith * 2];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n } else {\n newSegment = ['L', line2_from_x, res.y - lineWith * 2];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n }\n }\n\n lP += 2;\n len += 2;\n }\n }\n }\n }\n\n this.chart.lines.push(line);\n }\n\n if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) {\n this.chart.maxXFromLine = maxX;\n }\n};\n\nmodule.exports = Symbol;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.js\n ** module id = 2\n ** module chunks = 0\n **/","function drawPath(chart, location, points) {\n var i, len;\n var path = 'M{0},{1}';\n for (i = 2, len = 2 * points.length + 2; i < len; i+=2) {\n path += ' L{' + i + '},{' + (i + 1) + '}';\n }\n var pathValues = [location.x, location.y];\n for (i = 0, len = points.length; i < len; i++) {\n pathValues.push(points[i].x);\n pathValues.push(points[i].y);\n }\n var symbol = chart.paper.path(path, pathValues);\n symbol.attr('stroke', chart.options['element-color']);\n symbol.attr('stroke-width', chart.options['line-width']);\n\n var font = chart.options.font;\n var fontF = chart.options['font-family'];\n var fontW = chart.options['font-weight'];\n\n if (font) symbol.attr({ 'font': font });\n if (fontF) symbol.attr({ 'font-family': fontF });\n if (fontW) symbol.attr({ 'font-weight': fontW });\n\n return symbol;\n}\n\nfunction drawLine(chart, from, to, text) {\n var i, len;\n\n if (Object.prototype.toString.call(to) !== '[object Array]') {\n to = [to];\n }\n\n var path = 'M{0},{1}';\n for (i = 2, len = 2 * to.length + 2; i < len; i+=2) {\n path += ' L{' + i + '},{' + (i + 1) + '}';\n }\n var pathValues = [from.x, from.y];\n for (i = 0, len = to.length; i < len; i++) {\n pathValues.push(to[i].x);\n pathValues.push(to[i].y);\n }\n\n var line = chart.paper.path(path, pathValues);\n line.attr({\n stroke: chart.options['line-color'],\n 'stroke-width': chart.options['line-width'],\n 'arrow-end': chart.options['arrow-end']\n });\n\n var font = chart.options.font;\n var fontF = chart.options['font-family'];\n var fontW = chart.options['font-weight'];\n\n if (font) line.attr({ 'font': font });\n if (fontF) line.attr({ 'font-family': fontF });\n if (fontW) line.attr({ 'font-weight': fontW });\n\n if (text) {\n\n var centerText = false;\n\n var textPath = chart.paper.text(0, 0, text);\n\n var isHorizontal = false;\n var firstTo = to[0];\n\n if (from.y === firstTo.y) {\n isHorizontal = true;\n }\n\n var x = 0,\n y = 0;\n\n if (centerText) {\n if (from.x > firstTo.x) {\n x = from.x - (from.x - firstTo.x)/2;\n } else {\n x = firstTo.x - (firstTo.x - from.x)/2;\n }\n\n if (from.y > firstTo.y) {\n y = from.y - (from.y - firstTo.y)/2;\n } else {\n y = firstTo.y - (firstTo.y - from.y)/2;\n }\n\n if (isHorizontal) {\n x -= textPath.getBBox().width/2;\n y -= chart.options['text-margin'];\n } else {\n x += chart.options['text-margin'];\n y -= textPath.getBBox().height/2;\n }\n } else {\n x = from.x;\n y = from.y;\n\n if (isHorizontal) {\n x += chart.options['text-margin']/2;\n y -= chart.options['text-margin'];\n } else {\n x += chart.options['text-margin']/2;\n y += chart.options['text-margin'];\n }\n }\n\n textPath.attr({\n 'text-anchor': 'start',\n 'font-size': chart.options['font-size'],\n 'fill': chart.options['font-color'],\n x: x,\n y: y\n });\n\n if (font) textPath.attr({ 'font': font });\n if (fontF) textPath.attr({ 'font-family': fontF });\n if (fontW) textPath.attr({ 'font-weight': fontW });\n }\n\n return line;\n}\n\nfunction checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {\n // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point\n var denominator, a, b, numerator1, numerator2, result = {\n x: null,\n y: null,\n onLine1: false,\n onLine2: false\n };\n denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY));\n if (denominator === 0) {\n return result;\n }\n a = line1StartY - line2StartY;\n b = line1StartX - line2StartX;\n numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);\n numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);\n a = numerator1 / denominator;\n b = numerator2 / denominator;\n\n // if we cast these lines infinitely in both directions, they intersect here:\n result.x = line1StartX + (a * (line1EndX - line1StartX));\n result.y = line1StartY + (a * (line1EndY - line1StartY));\n /*\n // it is worth noting that this should be the same as:\n x = line2StartX + (b * (line2EndX - line2StartX));\n y = line2StartX + (b * (line2EndY - line2StartY));\n */\n // if line1 is a segment and line2 is infinite, they intersect if:\n if (a > 0 && a < 1) {\n result.onLine1 = true;\n }\n // if line2 is a segment and line1 is infinite, they intersect if:\n if (b > 0 && b < 1) {\n result.onLine2 = true;\n }\n // if line1 and line2 are segments, they intersect if both of the above are true\n return result;\n}\n\nmodule.exports = {\n\tdrawPath: drawPath,\n\tdrawLine: drawLine,\n\tcheckLineIntersection: checkLineIntersection\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.functions.js\n ** module id = 3\n ** module chunks = 0\n **/","var FlowChart = require('./flowchart.chart');\nvar Start = require('./flowchart.symbol.start');\nvar End = require('./flowchart.symbol.end');\nvar Operation = require('./flowchart.symbol.operation');\nvar InputOutput = require('./flowchart.symbol.inputoutput');\nvar Subroutine = require('./flowchart.symbol.subroutine');\nvar Condition = require('./flowchart.symbol.condition');\n\nfunction parse(input) {\n input = input || '';\n input = input.trim();\n\n var chart = {\n symbols: {},\n start: null,\n drawSVG: function(container, options) {\n var self = this;\n\n if (this.diagram) {\n this.diagram.clean();\n }\n\n var diagram = new FlowChart(container, options);\n this.diagram = diagram;\n var dispSymbols = {};\n\n function getDisplaySymbol(s) {\n if (dispSymbols[s.key]) {\n return dispSymbols[s.key];\n }\n\n switch (s.symbolType) {\n case 'start':\n dispSymbols[s.key] = new Start(diagram, s);\n break;\n case 'end':\n dispSymbols[s.key] = new End(diagram, s);\n break;\n case 'operation':\n dispSymbols[s.key] = new Operation(diagram, s);\n break;\n case 'inputoutput':\n dispSymbols[s.key] = new InputOutput(diagram, s);\n break;\n case 'subroutine':\n dispSymbols[s.key] = new Subroutine(diagram, s);\n break;\n case 'condition':\n dispSymbols[s.key] = new Condition(diagram, s);\n break;\n default:\n return new Error('Wrong symbol type!');\n }\n\n return dispSymbols[s.key];\n }\n\n (function constructChart(s, prevDisp, prev) {\n var dispSymb = getDisplaySymbol(s);\n\n if (self.start === s) {\n diagram.startWith(dispSymb);\n } else if (prevDisp && prev && !prevDisp.pathOk) {\n if (prevDisp instanceof(Condition)) {\n if (prev.yes === s) {\n prevDisp.yes(dispSymb);\n }\n if (prev.no === s) {\n prevDisp.no(dispSymb);\n }\n } else {\n prevDisp.then(dispSymb);\n }\n }\n\n if (dispSymb.pathOk) {\n return dispSymb;\n }\n\n if (dispSymb instanceof(Condition)) {\n if (s.yes) {\n constructChart(s.yes, dispSymb, s);\n }\n if (s.no) {\n constructChart(s.no, dispSymb, s);\n }\n } else if (s.next) {\n constructChart(s.next, dispSymb, s);\n }\n\n return dispSymb;\n })(this.start);\n\n diagram.render();\n },\n clean: function() {\n this.diagram.clean();\n }\n };\n\n var lines = [];\n var prevBreak = 0;\n for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) {\n if(input[i0] === '\\n' && input[i0 - 1] !== '\\\\') {\n var line0 = input.substring(prevBreak, i0);\n prevBreak = i0 + 1;\n lines.push(line0.replace(/\\\\\\n/g, '\\n'));\n }\n }\n\n if(prevBreak < input.length) {\n lines.push(input.substr(prevBreak));\n }\n\n for (var l = 1, len = lines.length; l < len;) {\n var currentLine = lines[l];\n\n if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0) {\n lines[l - 1] += '\\n' + currentLine;\n lines.splice(l, 1);\n len--;\n } else {\n l++;\n }\n }\n\n function getSymbol(s) {\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n return chart.symbols[s.substring(0, startIndex - 1)];\n }\n return chart.symbols[s];\n }\n\n function getNextPath(s) {\n var next = 'next';\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n next = flowSymb.substring(startIndex, endIndex);\n if (next.indexOf(',') < 0) {\n if (next !== 'yes' && next !== 'no') {\n next = 'next, ' + next;\n }\n }\n }\n return next;\n }\n\n while (lines.length > 0) {\n var line = lines.splice(0, 1)[0];\n\n if (line.indexOf('=>') >= 0) {\n // definition\n var parts = line.split('=>');\n var symbol = {\n key: parts[0],\n symbolType: parts[1],\n text: null,\n link: null,\n target: null,\n flowstate: null\n };\n\n var sub;\n\n if (symbol.symbolType.indexOf(': ') >= 0) {\n sub = symbol.symbolType.split(': ');\n symbol.symbolType = sub.shift();\n symbol.text = sub.join(': ');\n }\n\n if (symbol.text && symbol.text.indexOf(':>') >= 0) {\n sub = symbol.text.split(':>');\n symbol.text = sub.shift();\n symbol.link = sub.join(':>');\n } else if (symbol.symbolType.indexOf(':>') >= 0) {\n sub = symbol.symbolType.split(':>');\n symbol.symbolType = sub.shift();\n symbol.link = sub.join(':>');\n }\n\n if (symbol.symbolType.indexOf('\\n') >= 0) {\n symbol.symbolType = symbol.symbolType.split('\\n')[0];\n }\n\n /* adding support for links */\n if (symbol.link) {\n var startIndex = symbol.link.indexOf('[') + 1;\n var endIndex = symbol.link.indexOf(']');\n if (startIndex >= 0 && endIndex >= 0) {\n symbol.target = symbol.link.substring(startIndex, endIndex);\n symbol.link = symbol.link.substring(0, startIndex - 1);\n }\n }\n /* end of link support */\n\n /* adding support for flowstates */\n if (symbol.text) {\n if (symbol.text.indexOf('|') >= 0) {\n var txtAndState = symbol.text.split('|');\n symbol.flowstate = txtAndState.pop().trim();\n symbol.text = txtAndState.join('|');\n }\n }\n /* end of flowstate support */\n\n chart.symbols[symbol.key] = symbol;\n\n } else if (line.indexOf('->') >= 0) {\n // flow\n var flowSymbols = line.split('->');\n for (var i = 0, lenS = flowSymbols.length; i < lenS; i++) {\n var flowSymb = flowSymbols[i];\n\n var realSymb = getSymbol(flowSymb);\n var next = getNextPath(flowSymb);\n\n var direction = null;\n if (next.indexOf(',') >= 0) {\n var condOpt = next.split(',');\n next = condOpt[0];\n direction = condOpt[1].trim();\n }\n\n if (!chart.start) {\n chart.start = realSymb;\n }\n\n if (i + 1 < lenS) {\n var nextSymb = flowSymbols[i + 1];\n realSymb[next] = getSymbol(nextSymb);\n realSymb['direction_' + next] = direction;\n direction = null;\n }\n }\n }\n\n }\n return chart;\n}\n\nmodule.exports = parse;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.parse.js\n ** module id = 4\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction Condition(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n this.yes_direction = 'bottom';\n this.no_direction = 'right';\n if (options.yes && options.direction_yes && options.no && !options.direction_no) {\n if (options.direction_yes === 'right') {\n this.no_direction = 'bottom';\n this.yes_direction = 'right';\n } else {\n this.no_direction = 'right';\n this.yes_direction = 'bottom';\n }\n } else if (options.yes && !options.direction_yes && options.no && options.direction_no) {\n if (options.direction_no === 'right') {\n this.yes_direction = 'bottom';\n this.no_direction = 'right';\n } else {\n this.yes_direction = 'right';\n this.no_direction = 'bottom';\n }\n } else {\n this.yes_direction = 'bottom';\n this.no_direction = 'right';\n }\n\n this.yes_direction = this.yes_direction || 'bottom';\n this.no_direction = this.no_direction || 'right';\n\n this.text.attr({\n x: this.textMargin * 2\n });\n\n var width = this.text.getBBox().width + 3 * this.textMargin;\n width += width/2;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n height += height/2;\n height = Math.max(width * 0.5, height);\n var startX = width/4;\n var startY = height/4;\n\n this.text.attr({\n x: startX + this.textMargin/2\n });\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - width/4, y: startY + height/4},\n {x: startX - width/4 + width/2, y: startY + height/4 + height/2},\n {x: startX - width/4 + width, y: startY + height/4},\n {x: startX - width/4 + width/2, y: startY + height/4 - height/2},\n {x: startX - width/4, y: startY + height/4}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n\n this.initialize();\n}\ninherits(Condition, Symbol);\n\nCondition.prototype.render = function() {\n\n if (this.yes_direction) {\n this[this.yes_direction + '_symbol'] = this.yes_symbol;\n }\n\n if (this.no_direction) {\n this[this.no_direction + '_symbol'] = this.no_symbol;\n }\n\n var lineLength = this.getAttr('line-length');\n\n if (this.bottom_symbol) {\n var bottomPoint = this.getBottom();\n\n if (!this.bottom_symbol.isPositioned) {\n this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2);\n this.bottom_symbol.isPositioned = true;\n\n this.bottom_symbol.render();\n }\n }\n\n if (this.right_symbol) {\n var rightPoint = this.getRight();\n\n if (!this.right_symbol.isPositioned) {\n\n this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2);\n this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\n var self = this;\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n\n if (hasSymbolUnder) {\n self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.right_symbol.isPositioned = true;\n\n this.right_symbol.render();\n }\n }\n};\n\nCondition.prototype.renderLines = function() {\n if (this.yes_symbol) {\n this.drawLineTo(this.yes_symbol, this.getAttr('yes-text'), this.yes_direction);\n }\n\n if (this.no_symbol) {\n this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction);\n }\n};\n\nmodule.exports = Condition;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.condition.js\n ** module id = 5\n ** module chunks = 0\n **/","var Raphael = require('raphael');\nvar defaults = require('./flowchart.helpers').defaults;\nvar defaultOptions = require('./flowchart.defaults');\nvar Condition = require('./flowchart.symbol.condition');\n\nfunction FlowChart(container, options) {\n options = options || {};\n\n this.paper = new Raphael(container);\n\n this.options = defaults(options, defaultOptions);\n\n this.symbols = [];\n this.lines = [];\n this.start = null;\n}\n\nFlowChart.prototype.handle = function(symbol) {\n if (this.symbols.indexOf(symbol) <= -1) {\n this.symbols.push(symbol);\n }\n\n var flowChart = this;\n\n if (symbol instanceof(Condition)) {\n symbol.yes = function(nextSymbol) {\n symbol.yes_symbol = nextSymbol;\n if(symbol.no_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n symbol.no = function(nextSymbol) {\n symbol.no_symbol = nextSymbol;\n if(symbol.yes_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n } else {\n symbol.then = function(nextSymbol) {\n symbol.next = nextSymbol;\n symbol.pathOk = true;\n return flowChart.handle(nextSymbol);\n };\n }\n\n return symbol;\n};\n\nFlowChart.prototype.startWith = function(symbol) {\n this.start = symbol;\n return this.handle(symbol);\n};\n\nFlowChart.prototype.render = function() {\n var maxWidth = 0,\n maxHeight = 0,\n i = 0,\n len = 0,\n maxX = 0,\n maxY = 0,\n symbol;\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n if (symbol.width > maxWidth) {\n maxWidth = symbol.width;\n }\n if (symbol.height > maxHeight) {\n maxHeight = symbol.height;\n }\n }\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']);\n symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']);\n }\n\n this.start.render();\n // for (i = 0, len = this.symbols.length; i < len; i++) {\n // symbol = this.symbols[i];\n // symbol.render();\n // }\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n symbol.renderLines();\n }\n\n maxX = this.maxXFromLine;\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n var x = symbol.getX() + symbol.width;\n var y = symbol.getY() + symbol.height;\n if (x > maxX) {\n maxX = x;\n }\n if (y > maxY) {\n maxY = y;\n }\n }\n\n var scale = this.options['scale'];\n var lineWidth = this.options['line-width'];\n this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale));\n this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true);\n};\n\nFlowChart.prototype.clean = function() {\n if (this.paper) {\n var paperDom = this.paper.canvas;\n paperDom.parentNode.removeChild(paperDom);\n }\n};\n\nmodule.exports = FlowChart;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.chart.js\n ** module id = 6\n ** module chunks = 0\n **/","// defaults\nmodule.exports = {\n 'x': 0,\n 'y': 0,\n 'line-width': 3,\n 'line-length': 50,\n 'text-margin': 10,\n 'font-size': 14,\n 'font-color': 'black',\n // 'font': 'normal',\n // 'font-family': 'calibri',\n // 'font-weight': 'normal',\n 'line-color': 'black',\n 'element-color': 'black',\n 'fill': 'white',\n 'yes-text': 'yes',\n 'no-text': 'no',\n 'arrow-end': 'block',\n 'class': 'flowchart',\n 'scale': 1,\n 'symbols': {\n 'start': {},\n 'end': {},\n 'condition': {},\n 'inputoutput': {},\n 'operation': {},\n 'subroutine': {}\n }//,\n // 'flowstate' : {\n // 'past' : { 'fill': '#CCCCCC', 'font-size': 12},\n // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'},\n // 'future' : { 'fill': '#FFFF99'},\n // 'invalid': {'fill': '#444444'}\n // }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.defaults.js\n ** module id = 7\n ** module chunks = 0\n **/","// add indexOf to non ECMA-262 standard compliant browsers\nif (!Array.prototype.indexOf) {\n Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\n \"use strict\";\n if (this === null) {\n throw new TypeError();\n }\n var t = Object(this);\n var len = t.length >>> 0;\n if (len === 0) {\n return -1;\n }\n var n = 0;\n if (arguments.length > 0) {\n n = Number(arguments[1]);\n if (n != n) { // shortcut for verifying if it's NaN\n n = 0;\n } else if (n !== 0 && n != Infinity && n != -Infinity) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n }\n if (n >= len) {\n return -1;\n }\n var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\n for (; k < len; k++) {\n if (k in t && t[k] === searchElement) {\n return k;\n }\n }\n return -1;\n };\n}\n\n// add lastIndexOf to non ECMA-262 standard compliant browsers\nif (!Array.prototype.lastIndexOf) {\n Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {\n \"use strict\";\n if (this === null) {\n throw new TypeError();\n }\n var t = Object(this);\n var len = t.length >>> 0;\n if (len === 0) {\n return -1;\n }\n var n = len;\n if (arguments.length > 1) {\n n = Number(arguments[1]);\n if (n != n) {\n n = 0;\n } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n }\n var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);\n for (; k >= 0; k--) {\n if (k in t && t[k] === searchElement) {\n return k;\n }\n }\n return -1;\n };\n}\n\nif (!String.prototype.trim) {\n String.prototype.trim = function() {\n return this.replace(/^\\s+|\\s+$/g, '');\n };\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.shim.js\n ** module id = 8\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction End(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n options = options || {};\n options.text = options.text || 'End';\n Symbol.call(this, chart, options, symbol);\n}\ninherits(End, Symbol);\n\nmodule.exports = End;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.end.js\n ** module id = 9\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction InputOutput(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n\n this.text.attr({\n x: this.textMargin * 3\n });\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n\n this.initialize();\n}\ninherits(InputOutput, Symbol);\n\nInputOutput.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.textMargin;\n return {x: x, y: y};\n};\n\nInputOutput.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width - this.textMargin;\n return {x: x, y: y};\n};\n\nmodule.exports = InputOutput;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.inputoutput.js\n ** module id = 10\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Operation(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n}\ninherits(Operation, Symbol);\n\nmodule.exports = Operation;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.operation.js\n ** module id = 11\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Start(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n options = options || {};\n options.text = options.text || 'Start';\n Symbol.call(this, chart, options, symbol);\n}\ninherits(Start, Symbol);\n\nmodule.exports = Start;\n\n// Start.prototype.render = function() {\n// if (this.next) {\n// var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length'];\n\n// var bottomPoint = this.getBottom();\n// var topPoint = this.next.getTop();\n\n// if (!this.next.isPositioned) {\n// this.next.shiftY(this.getY() + this.height + lineLength);\n// this.next.setX(bottomPoint.x - this.next.width/2);\n// this.next.isPositioned = true;\n\n// this.next.render();\n// }\n// }\n// };\n\n// Start.prototype.renderLines = function() {\n// if (this.next) {\n// this.drawLineTo(this.next);\n// }\n// };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.start.js\n ** module id = 12\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Subroutine(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n\n symbol.attr({\n width: this.text.getBBox().width + 4 * this.getAttr('text-margin')\n });\n\n this.text.attr({\n 'x': 2 * this.getAttr('text-margin')\n });\n\n var innerWrap = chart.paper.rect(0, 0, 0, 0);\n innerWrap.attr({\n x: this.getAttr('text-margin'),\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n width: this.text.getBBox().width + 2 * this.getAttr('text-margin'),\n height: this.text.getBBox().height + 2 * this.getAttr('text-margin'),\n fill: this.getAttr('fill')\n });\n if (options.key) { innerWrap.node.id = options.key + 'i'; }\n\n var font = this.getAttr('font');\n var fontF = this.getAttr('font-family');\n var fontW = this.getAttr('font-weight');\n\n if (font) innerWrap.attr({ 'font': font });\n if (fontF) innerWrap.attr({ 'font-family': fontF });\n if (fontW) innerWrap.attr({ 'font-weight': fontW });\n\n if (options.link) { innerWrap.attr('href', options.link); }\n if (options.target) { innerWrap.attr('target', options.target); }\n this.group.push(innerWrap);\n innerWrap.insertBefore(this.text);\n\n this.initialize();\n}\ninherits(Subroutine, Symbol);\n\nmodule.exports = Subroutine;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.subroutine.js\n ** module id = 13\n ** module chunks = 0\n **/","if (typeof jQuery != 'undefined') {\n\tvar parse = require('./flowchart.parse');\n\t(function( $ ) {\n\t\t$.fn.flowChart = function( options ) {\n\t\t\treturn this.each(function() {\n\t\t\t\tvar $this = $(this);\n\t\t\t\tvar chart = parse($this.text());\n\t\t\t\t$this.html('');\n\t\t\t\tchart.drawSVG(this, options);\n\t\t\t});\n\t\t};\n\t})( jQuery ); // eslint-disable-line\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/jquery-plugin.js\n ** module id = 14\n ** module chunks = 0\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_15__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"Raphael\"\n ** module id = 15\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/release/flowchart.min.js b/release/flowchart.min.js index e10004ad..680f03b5 100644 --- a/release/flowchart.min.js +++ b/release/flowchart.min.js @@ -1,7 +1,7 @@ // flowchart, v1.4.2 -// Copyright (c)2015 Adriano Raiano (adrai). +// Copyright (c)yyyy Adriano Raiano (adrai). // Distributed under MIT license // http://adrai.github.io/flowchart.js -!function(){function a(b,c){if(!b||"function"==typeof b)return c;var d={};for(var e in c)d[e]=c[e];for(e in b)b[e]&&("object"==typeof d[e]?d[e]=a(d[e],b[e]):d[e]=b[e]);return d}function b(a,b){if("function"==typeof Object.create)a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});else{a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}}function c(a,b,c){var d,e,f="M{0},{1}";for(d=2,e=2*c.length+2;e>d;d+=2)f+=" L{"+d+"},{"+(d+1)+"}";var g=[b.x,b.y];for(d=0,e=c.length;e>d;d++)g.push(c[d].x),g.push(c[d].y);var h=a.paper.path(f,g);h.attr("stroke",a.options["element-color"]),h.attr("stroke-width",a.options["line-width"]);var i=a.options.font,j=a.options["font-family"],k=a.options["font-weight"];return i&&h.attr({font:i}),j&&h.attr({"font-family":j}),k&&h.attr({"font-weight":k}),h}function d(a,b,c,d){var e,f;"[object Array]"!==Object.prototype.toString.call(c)&&(c=[c]);var g="M{0},{1}";for(e=2,f=2*c.length+2;f>e;e+=2)g+=" L{"+e+"},{"+(e+1)+"}";var h=[b.x,b.y];for(e=0,f=c.length;f>e;e++)h.push(c[e].x),h.push(c[e].y);var i=a.paper.path(g,h);i.attr({stroke:a.options["line-color"],"stroke-width":a.options["line-width"],"arrow-end":a.options["arrow-end"]});var j=a.options.font,k=a.options["font-family"],l=a.options["font-weight"];if(j&&i.attr({font:j}),k&&i.attr({"font-family":k}),l&&i.attr({"font-weight":l}),d){var m=!1,n=a.paper.text(0,0,d),o=!1,p=c[0];b.y===p.y&&(o=!0);var q=0,r=0;m?(q=b.x>p.x?b.x-(b.x-p.x)/2:p.x-(p.x-b.x)/2,r=b.y>p.y?b.y-(b.y-p.y)/2:p.y-(p.y-b.y)/2,o?(q-=n.getBBox().width/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"],r-=n.getBBox().height/2)):(q=b.x,r=b.y,o?(q+=a.options["text-margin"]/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"]/2,r+=a.options["text-margin"])),n.attr({"text-anchor":"start","font-size":a.options["font-size"],fill:a.options["font-color"],x:q,y:r}),j&&n.attr({font:j}),k&&n.attr({"font-family":k}),l&&n.attr({"font-weight":l})}return i}function e(a,b,c,d,e,f,g,h){var i,j,k,l,m,n={x:null,y:null,onLine1:!1,onLine2:!1};return i=(h-f)*(c-a)-(g-e)*(d-b),0===i?n:(j=b-f,k=a-e,l=(g-e)*j-(h-f)*k,m=(c-a)*j-(d-b)*k,j=l/i,k=m/i,n.x=a+j*(c-a),n.y=b+j*(d-b),j>0&&1>j&&(n.onLine1=!0),k>0&&1>k&&(n.onLine2=!0),n)}function f(a,b){b=b||{},this.paper=new Raphael(a),this.options=r.defaults(b,q),this.symbols=[],this.lines=[],this.start=null}function g(a,b,c){this.chart=a,this.group=this.chart.paper.set(),this.symbol=c,this.connectedTo=[],this.symbolType=b.symbolType,this.flowstate=b.flowstate||"future",this.next_direction=b.next&&b.direction_next?b.direction_next:void 0,this.text=this.chart.paper.text(0,0,b.text),b.key&&(this.text.node.id=b.key+"t"),this.text.node.setAttribute("class",this.getAttr("class")+"t"),this.text.attr({"text-anchor":"start",x:this.getAttr("text-margin"),fill:this.getAttr("font-color"),"font-size":this.getAttr("font-size")});var d=this.getAttr("font"),e=this.getAttr("font-family"),f=this.getAttr("font-weight");d&&this.text.attr({font:d}),e&&this.text.attr({"font-family":e}),f&&this.text.attr({"font-weight":f}),b.link&&this.text.attr("href",b.link),b.target&&this.text.attr("target",b.target);var g=this.getAttr("maxWidth");if(g){for(var h=b.text.split(" "),i="",j=0,k=h.length;k>j;j++){var l=h[j];this.text.attr("text",i+" "+l),i+=this.text.getBBox().width>g?"\n"+l:" "+l}this.text.attr("text",i.substring(1))}if(this.group.push(this.text),c){var m=this.getAttr("text-margin");c.attr({fill:this.getAttr("fill"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*m,height:this.text.getBBox().height+2*m}),c.node.setAttribute("class",this.getAttr("class")),b.link&&c.attr("href",b.link),b.target&&c.attr("target",b.target),b.key&&(c.node.id=b.key),this.group.push(c),c.insertBefore(this.text),this.text.attr({y:c.getBBox().height/2}),this.initialize()}}function h(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"Start",g.call(this,a,b,c)}function i(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"End",g.call(this,a,b,c)}function j(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c)}function k(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c),c.attr({width:this.text.getBBox().width+4*this.getAttr("text-margin")}),this.text.attr({x:2*this.getAttr("text-margin")});var d=a.paper.rect(0,0,0,0);d.attr({x:this.getAttr("text-margin"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*this.getAttr("text-margin"),height:this.text.getBBox().height+2*this.getAttr("text-margin"),fill:this.getAttr("fill")}),b.key&&(d.node.id=b.key+"i");var e=this.getAttr("font"),f=this.getAttr("font-family"),h=this.getAttr("font-weight");e&&d.attr({font:e}),f&&d.attr({"font-family":f}),h&&d.attr({"font-weight":h}),b.link&&d.attr("href",b.link),b.target&&d.attr("target",b.target),this.group.push(d),d.insertBefore(this.text),this.initialize()}function l(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var d=this.text.getBBox().width+4*this.textMargin,e=this.text.getBBox().height+2*this.textMargin,f=this.textMargin,h=e/2,i={x:f,y:h},j=[{x:f-this.textMargin,y:e},{x:f-this.textMargin+d,y:e},{x:f-this.textMargin+d+2*this.textMargin,y:0},{x:f-this.textMargin+2*this.textMargin,y:0},{x:f,y:h}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function m(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.yes_direction="bottom",this.no_direction="right",b.yes&&b.direction_yes&&b.no&&!b.direction_no?"right"===b.direction_yes?(this.no_direction="bottom",this.yes_direction="right"):(this.no_direction="right",this.yes_direction="bottom"):b.yes&&!b.direction_yes&&b.no&&b.direction_no?"right"===b.direction_no?(this.yes_direction="bottom",this.no_direction="right"):(this.yes_direction="right",this.no_direction="bottom"):(this.yes_direction="bottom",this.no_direction="right"),this.yes_direction=this.yes_direction||"bottom",this.no_direction=this.no_direction||"right",this.text.attr({x:2*this.textMargin});var d=this.text.getBBox().width+3*this.textMargin;d+=d/2;var e=this.text.getBBox().height+2*this.textMargin;e+=e/2,e=Math.max(.5*d,e);var f=d/4,h=e/4;this.text.attr({x:f+this.textMargin/2});var i={x:f,y:h},j=[{x:f-d/4,y:h+e/4},{x:f-d/4+d/2,y:h+e/4+e/2},{x:f-d/4+d,y:h+e/4},{x:f-d/4+d/2,y:h+e/4-e/2},{x:f-d/4,y:h+e/4}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function n(a){function b(a){var b=a.indexOf("(")+1,c=a.indexOf(")");return b>=0&&c>=0?d.symbols[a.substring(0,b-1)]:d.symbols[a]}function c(a){var b="next",c=a.indexOf("(")+1,d=a.indexOf(")");return c>=0&&d>=0&&(b=D.substring(c,d),b.indexOf(",")<0&&"yes"!==b&&"no"!==b&&(b="next, "+b)),b}a=a||"",a=a.trim();for(var d={symbols:{},start:null,drawSVG:function(a,b){function c(a){if(g[a.key])return g[a.key];switch(a.symbolType){case"start":g[a.key]=new h(e,a);break;case"end":g[a.key]=new i(e,a);break;case"operation":g[a.key]=new j(e,a);break;case"inputoutput":g[a.key]=new l(e,a);break;case"subroutine":g[a.key]=new k(e,a);break;case"condition":g[a.key]=new m(e,a);break;default:return new Error("Wrong symbol type!")}return g[a.key]}var d=this;this.diagram&&this.diagram.clean();var e=new f(a,b);this.diagram=e;var g={};!function n(a,b,f){var g=c(a);return d.start===a?e.startWith(g):b&&f&&!b.pathOk&&(b instanceof m?(f.yes===a&&b.yes(g),f.no===a&&b.no(g)):b.then(g)),g.pathOk?g:(g instanceof m?(a.yes&&n(a.yes,g,a),a.no&&n(a.no,g,a)):a.next&&n(a.next,g,a),g)}(this.start),e.render()},clean:function(){this.diagram.clean()}},e=[],g=0,n=1,o=a.length;o>n;n++)if("\n"===a[n]&&"\\"!==a[n-1]){var p=a.substring(g,n);g=n+1,e.push(p.replace(/\\\n/g,"\n"))}gq;){var s=e[q];s.indexOf("->")<0&&s.indexOf("=>")<0?(e[q-1]+="\n"+s,e.splice(q,1),r--):q++}for(;e.length>0;){var t=e.splice(0,1)[0];if(t.indexOf("=>")>=0){var u,v=t.split("=>"),w={key:v[0],symbolType:v[1],text:null,link:null,target:null,flowstate:null};if(w.symbolType.indexOf(": ")>=0&&(u=w.symbolType.split(": "),w.symbolType=u.shift(),w.text=u.join(": ")),w.text&&w.text.indexOf(":>")>=0?(u=w.text.split(":>"),w.text=u.shift(),w.link=u.join(":>")):w.symbolType.indexOf(":>")>=0&&(u=w.symbolType.split(":>"),w.symbolType=u.shift(),w.link=u.join(":>")),w.symbolType.indexOf("\n")>=0&&(w.symbolType=w.symbolType.split("\n")[0]),w.link){var x=w.link.indexOf("[")+1,y=w.link.indexOf("]");x>=0&&y>=0&&(w.target=w.link.substring(x,y),w.link=w.link.substring(0,x-1))}if(w.text&&w.text.indexOf("|")>=0){var z=w.text.split("|");w.flowstate=z.pop().trim(),w.text=z.join("|")}d.symbols[w.key]=w}else if(t.indexOf("->")>=0)for(var A=t.split("->"),B=0,C=A.length;C>B;B++){var D=A[B],E=b(D),F=c(D),G=null;if(F.indexOf(",")>=0){var H=F.split(",");F=H[0],G=H[1].trim()}if(d.start||(d.start=E),C>B+1){var I=A[B+1];E[F]=b(I),E["direction_"+F]=G,G=null}}}return d}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=c;arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));for(var e=d>=0?Math.min(d,c-1):c-Math.abs(d);e>=0;e--)if(e in b&&b[e]===a)return e;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var o=this,p={};"undefined"!=typeof module&&module.exports?module.exports=p:o.flowchart=o.flowchart||p;var q={x:0,y:0,"line-width":3,"line-length":50,"text-margin":10,"font-size":14,"font-color":"black","line-color":"black","element-color":"black",fill:"white","yes-text":"yes","no-text":"no","arrow-end":"block","class":"flowchart",scale:1,symbols:{start:{},end:{},condition:{},inputoutput:{},operation:{},subroutine:{}}},r={defaults:a,inherits:b};f.prototype.handle=function(a){this.symbols.indexOf(a)<=-1&&this.symbols.push(a);var b=this;return a instanceof m?(a.yes=function(c){return a.yes_symbol=c,a.no_symbol&&(a.pathOk=!0),b.handle(c)},a.no=function(c){return a.no_symbol=c,a.yes_symbol&&(a.pathOk=!0),b.handle(c)}):a.then=function(c){return a.next=c,a.pathOk=!0,b.handle(c)},a},f.prototype.startWith=function(a){return this.start=a,this.handle(a)},f.prototype.render=function(){var a,b=0,c=0,d=0,e=0,f=0,g=0;for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.width>b&&(b=a.width),a.height>c&&(c=a.height);for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.shiftX(this.options.x+(b-a.width)/2+this.options["line-width"]),a.shiftY(this.options.y+(c-a.height)/2+this.options["line-width"]);for(this.start.render(),d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.renderLines();for(f=this.maxXFromLine,d=0,e=this.symbols.length;e>d;d++){a=this.symbols[d];var h=a.getX()+a.width,i=a.getY()+a.height;h>f&&(f=h),i>g&&(g=i)}var j=this.options.scale,k=this.options["line-width"];this.paper.setSize(f*j+k*j,g*j+k*j),this.paper.setViewBox(0,0,f+k,g+k,!0)},f.prototype.clean=function(){if(this.paper){var a=this.paper.canvas;a.parentNode.removeChild(a)}},g.prototype.getAttr=function(a){if(!this.chart)return void 0;var b,c=this.chart.options?this.chart.options[a]:void 0,d=this.chart.options.symbols?this.chart.options.symbols[this.symbolType][a]:void 0;return this.chart.options.flowstate&&this.chart.options.flowstate[this.flowstate]&&(b=this.chart.options.flowstate[this.flowstate][a]),b||d||c},g.prototype.initialize=function(){this.group.transform("t"+this.getAttr("line-width")+","+this.getAttr("line-width")),this.width=this.group.getBBox().width,this.height=this.group.getBBox().height},g.prototype.getCenter=function(){return{x:this.getX()+this.width/2,y:this.getY()+this.height/2}},g.prototype.getX=function(){return this.group.getBBox().x},g.prototype.getY=function(){return this.group.getBBox().y},g.prototype.shiftX=function(a){this.group.transform("t"+(this.getX()+a)+","+this.getY())},g.prototype.setX=function(a){this.group.transform("t"+a+","+this.getY())},g.prototype.shiftY=function(a){this.group.transform("t"+this.getX()+","+(this.getY()+a))},g.prototype.setY=function(a){this.group.transform("t"+this.getX()+","+a)},g.prototype.getTop=function(){var a=this.getY(),b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getBottom=function(){var a=this.getY()+this.height,b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX();return{x:b,y:a}},g.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width;return{x:b,y:a}},g.prototype.render=function(){if(this.next){var a=this.getAttr("line-length");if("right"===this.next_direction){var b=this.getRight();this.next.getLeft();if(!this.next.isPositioned){this.next.setY(b.y-this.next.height/2),this.next.shiftX(this.group.getBBox().x+this.width+a);var c=this;!function e(){for(var b,d=!1,f=0,g=c.chart.symbols.length;g>f;f++){b=c.chart.symbols[f];var h=Math.abs(b.getCenter().x-c.next.getCenter().x);if(b.getCenter().y>c.next.getCenter().y&&h<=c.next.width/2){d=!0;break}}d&&(c.next.setX(b.getX()+b.width+a),e())}(),this.next.isPositioned=!0,this.next.render()}}else{var d=this.getBottom();this.next.getTop();this.next.isPositioned||(this.next.shiftY(this.getY()+this.height+a),this.next.setX(d.x-this.next.width/2),this.next.isPositioned=!0,this.next.render())}}},g.prototype.renderLines=function(){this.next&&(this.next_direction?this.drawLineTo(this.next,"",this.next_direction):this.drawLineTo(this.next))},g.prototype.drawLineTo=function(a,b,c){this.connectedTo.indexOf(a)<0&&this.connectedTo.push(a);var f,g=this.getCenter().x,h=this.getCenter().y,i=(this.getTop(),this.getRight()),j=this.getBottom(),k=this.getLeft(),l=a.getCenter().x,m=a.getCenter().y,n=a.getTop(),o=a.getRight(),p=(a.getBottom(),a.getLeft()),q=g===l,r=h===m,s=m>h,t=h>m,u=g>l,v=l>g,w=0,x=this.getAttr("line-length"),y=this.getAttr("line-width");if(c&&"bottom"!==c||!q||!s)if(c&&"right"!==c||!r||!v)if(c&&"left"!==c||!r||!u)if(c&&"right"!==c||!q||!t)if(c&&"right"!==c||!q||!s)if(c&&"bottom"!==c||!u)if(c&&"bottom"!==c||!v)if(c&&"right"===c&&u)f=d(this.chart,i,[{x:i.x+x/2,y:i.y},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"right"===c&&v)f=d(this.chart,i,[{x:n.x,y:i.y},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"bottom"===c&&q&&t)f=d(this.chart,j,[{x:j.x,y:j.y+x/2},{x:i.x+x/2,y:j.y+x/2},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.bottomStart=!0,a.topEnd=!0,w=j.x+x/2;else if("left"===c&&q&&t){var z=k.x-x/2;p.xA;A++)for(var C,D=this.chart.lines[A],E=D.attr("path"),F=f.attr("path"),G=0,H=E.length-1;H>G;G++){var I=[];I.push(["M",E[G][1],E[G][2]]),I.push(["L",E[G+1][1],E[G+1][2]]);for(var J=I[0][1],K=I[0][2],L=I[1][1],M=I[1][2],N=0,O=F.length-1;O>N;N++){var P=[];P.push(["M",F[N][1],F[N][2]]),P.push(["L",F[N+1][1],F[N+1][2]]);var Q=P[0][1],R=P[0][2],S=P[1][1],T=P[1][2],U=e(J,K,L,M,Q,R,S,T);if(U.onLine1&&U.onLine2){var V;R===T?Q>S?(V=["L",U.x+2*y,R],F.splice(N+1,0,V),V=["C",U.x+2*y,R,U.x,R-4*y,U.x-2*y,R],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",U.x-2*y,R],F.splice(N+1,0,V),V=["C",U.x-2*y,R,U.x,R-4*y,U.x+2*y,R],F.splice(N+2,0,V),f.attr("path",F)):R>T?(V=["L",Q,U.y+2*y],F.splice(N+1,0,V),V=["C",Q,U.y+2*y,Q+4*y,U.y,Q,U.y-2*y],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",Q,U.y-2*y],F.splice(N+1,0,V),V=["C",Q,U.y-2*y,Q+4*y,U.y,Q,U.y+2*y],F.splice(N+2,0,V),f.attr("path",F)),N+=2,C+=2}}}this.chart.lines.push(f)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&w>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=w)},r.inherits(h,g),r.inherits(i,g),r.inherits(j,g),r.inherits(k,g),r.inherits(l,g),l.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.textMargin;return{x:b,y:a}},l.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width-this.textMargin;return{x:b,y:a}},r.inherits(m,g),m.prototype.render=function(){this.yes_direction&&(this[this.yes_direction+"_symbol"]=this.yes_symbol),this.no_direction&&(this[this.no_direction+"_symbol"]=this.no_symbol);var a=this.getAttr("line-length");if(this.bottom_symbol){var b=this.getBottom();this.bottom_symbol.getTop();this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+a),this.bottom_symbol.setX(b.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var c=this.getRight();this.right_symbol.getLeft();if(!this.right_symbol.isPositioned){this.right_symbol.setY(c.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+a);var d=this;!function e(){for(var b,c=!1,f=0,g=d.chart.symbols.length;g>f;f++){b=d.chart.symbols[f];var h=Math.abs(b.getCenter().x-d.right_symbol.getCenter().x);if(b.getCenter().y>d.right_symbol.getCenter().y&&h<=d.right_symbol.width/2){c=!0;break}}c&&(d.right_symbol.setX(b.getX()+b.width+a),e())}(),this.right_symbol.isPositioned=!0,this.right_symbol.render()}}},m.prototype.renderLines=function(){this.yes_symbol&&this.drawLineTo(this.yes_symbol,this.getAttr("yes-text"),this.yes_direction),this.no_symbol&&this.drawLineTo(this.no_symbol,this.getAttr("no-text"),this.no_direction)},p.parse=n}(); -//# sourceMappingURL=flowchart.min.map \ No newline at end of file +!function(t,i){if("object"==typeof exports&&"object"==typeof module)module.exports=i(require("Raphael"));else if("function"==typeof define&&define.amd)define(["Raphael"],i);else{var e=i("object"==typeof exports?require("Raphael"):t.Raphael);for(var r in e)("object"==typeof exports?exports:t)[r]=e[r]}}(this,function(t){return function(t){function i(r){if(e[r])return e[r].exports;var s=e[r]={exports:{},id:r,loaded:!1};return t[r].call(s.exports,s,s.exports,i),s.loaded=!0,s.exports}var e={};return i.m=t,i.c=e,i.p="",i(0)}([function(t,i,e){e(8);var r=e(4);e(14);var s={parse:r};"undefined"!=typeof window&&(window.FlowChart=s),t.exports=s},function(t,i){function e(t,i){if(!t||"function"==typeof t)return i;var r={};for(var s in i)r[s]=i[s];for(s in t)t[s]&&("object"==typeof r[s]?r[s]=e(r[s],t[s]):r[s]=t[s]);return r}function r(t,i){if("function"==typeof Object.create)t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});else{t.super_=i;var e=function(){};e.prototype=i.prototype,t.prototype=new e,t.prototype.constructor=t}}t.exports={defaults:e,inherits:r}},function(t,i,e){function r(t,i,e){this.chart=t,this.group=this.chart.paper.set(),this.symbol=e,this.connectedTo=[],this.symbolType=i.symbolType,this.flowstate=i.flowstate||"future",this.next_direction=i.next&&i.direction_next?i.direction_next:void 0,this.text=this.chart.paper.text(0,0,i.text),i.key&&(this.text.node.id=i.key+"t"),this.text.node.setAttribute("class",this.getAttr("class")+"t"),this.text.attr({"text-anchor":"start",x:this.getAttr("text-margin"),fill:this.getAttr("font-color"),"font-size":this.getAttr("font-size")});var r=this.getAttr("font"),s=this.getAttr("font-family"),o=this.getAttr("font-weight");r&&this.text.attr({font:r}),s&&this.text.attr({"font-family":s}),o&&this.text.attr({"font-weight":o}),i.link&&this.text.attr("href",i.link),i.target&&this.text.attr("target",i.target);var n=this.getAttr("maxWidth");if(n){for(var h=i.text.split(" "),a="",x=0,y=h.length;y>x;x++){var l=h[x];this.text.attr("text",a+" "+l),a+=this.text.getBBox().width>n?"\n"+l:" "+l}this.text.attr("text",a.substring(1))}if(this.group.push(this.text),e){var g=this.getAttr("text-margin");e.attr({fill:this.getAttr("fill"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*g,height:this.text.getBBox().height+2*g}),e.node.setAttribute("class",this.getAttr("class")),i.link&&e.attr("href",i.link),i.target&&e.attr("target",i.target),i.key&&(e.node.id=i.key),this.group.push(e),e.insertBefore(this.text),this.text.attr({y:e.getBBox().height/2}),this.initialize()}}var s=e(3),o=s.drawLine,n=s.checkLineIntersection;r.prototype.getAttr=function(t){if(this.chart){var i,e=this.chart.options?this.chart.options[t]:void 0,r=this.chart.options.symbols?this.chart.options.symbols[this.symbolType][t]:void 0;return this.chart.options.flowstate&&this.chart.options.flowstate[this.flowstate]&&(i=this.chart.options.flowstate[this.flowstate][t]),i||r||e}},r.prototype.initialize=function(){this.group.transform("t"+this.getAttr("line-width")+","+this.getAttr("line-width")),this.width=this.group.getBBox().width,this.height=this.group.getBBox().height},r.prototype.getCenter=function(){return{x:this.getX()+this.width/2,y:this.getY()+this.height/2}},r.prototype.getX=function(){return this.group.getBBox().x},r.prototype.getY=function(){return this.group.getBBox().y},r.prototype.shiftX=function(t){this.group.transform("t"+(this.getX()+t)+","+this.getY())},r.prototype.setX=function(t){this.group.transform("t"+t+","+this.getY())},r.prototype.shiftY=function(t){this.group.transform("t"+this.getX()+","+(this.getY()+t))},r.prototype.setY=function(t){this.group.transform("t"+this.getX()+","+t)},r.prototype.getTop=function(){var t=this.getY(),i=this.getX()+this.width/2;return{x:i,y:t}},r.prototype.getBottom=function(){var t=this.getY()+this.height,i=this.getX()+this.width/2;return{x:i,y:t}},r.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX();return{x:i,y:t}},r.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.group.getBBox().width;return{x:i,y:t}},r.prototype.render=function(){if(this.next){var t=this.getAttr("line-length");if("right"===this.next_direction){var i=this.getRight();if(!this.next.isPositioned){this.next.setY(i.y-this.next.height/2),this.next.shiftX(this.group.getBBox().x+this.width+t);var e=this;!function s(){for(var i,r=!1,o=0,n=e.chart.symbols.length;n>o;o++){i=e.chart.symbols[o];var h=Math.abs(i.getCenter().x-e.next.getCenter().x);if(i.getCenter().y>e.next.getCenter().y&&h<=e.next.width/2){r=!0;break}}r&&(e.next.setX(i.getX()+i.width+t),s())}(),this.next.isPositioned=!0,this.next.render()}}else{var r=this.getBottom();this.next.isPositioned||(this.next.shiftY(this.getY()+this.height+t),this.next.setX(r.x-this.next.width/2),this.next.isPositioned=!0,this.next.render())}}},r.prototype.renderLines=function(){this.next&&(this.next_direction?this.drawLineTo(this.next,"",this.next_direction):this.drawLineTo(this.next))},r.prototype.drawLineTo=function(t,i,e){this.connectedTo.indexOf(t)<0&&this.connectedTo.push(t);var r,s=this.getCenter().x,h=this.getCenter().y,a=this.getRight(),x=this.getBottom(),y=this.getLeft(),l=t.getCenter().x,g=t.getCenter().y,f=t.getTop(),p=t.getRight(),c=t.getLeft(),u=s===l,d=h===g,m=g>h,b=h>g,v=s>l,w=l>s,k=0,_=this.getAttr("line-length"),B=this.getAttr("line-width");if(e&&"bottom"!==e||!u||!m)if(e&&"right"!==e||!d||!w)if(e&&"left"!==e||!d||!v)if(e&&"right"!==e||!u||!b)if(e&&"right"!==e||!u||!m)if(e&&"bottom"!==e||!v)if(e&&"bottom"!==e||!w)if(e&&"right"===e&&v)r=o(this.chart,a,[{x:a.x+_/2,y:a.y},{x:a.x+_/2,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+_/2;else if(e&&"right"===e&&w)r=o(this.chart,a,[{x:f.x,y:a.y},{x:f.x,y:f.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+_/2;else if(e&&"bottom"===e&&u&&b)r=o(this.chart,x,[{x:x.x,y:x.y+_/2},{x:a.x+_/2,y:x.y+_/2},{x:a.x+_/2,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.bottomStart=!0,t.topEnd=!0,k=x.x+_/2;else if("left"===e&&u&&b){var A=y.x-_/2;c.xL;L++)for(var O,X=this.chart.lines[L],T=X.attr("path"),Y=r.attr("path"),C=0,S=T.length-1;S>C;C++){var j=[];j.push(["M",T[C][1],T[C][2]]),j.push(["L",T[C+1][1],T[C+1][2]]);for(var E=j[0][1],z=j[0][2],P=j[1][1],R=j[1][2],F=0,I=Y.length-1;I>F;F++){var W=[];W.push(["M",Y[F][1],Y[F][2]]),W.push(["L",Y[F+1][1],Y[F+1][2]]);var N=W[0][1],V=W[0][2],q=W[1][1],G=W[1][2],Q=n(E,z,P,R,N,V,q,G);if(Q.onLine1&&Q.onLine2){var $;V===G?N>q?($=["L",Q.x+2*B,V],Y.splice(F+1,0,$),$=["C",Q.x+2*B,V,Q.x,V-4*B,Q.x-2*B,V],Y.splice(F+2,0,$),r.attr("path",Y)):($=["L",Q.x-2*B,V],Y.splice(F+1,0,$),$=["C",Q.x-2*B,V,Q.x,V-4*B,Q.x+2*B,V],Y.splice(F+2,0,$),r.attr("path",Y)):V>G?($=["L",N,Q.y+2*B],Y.splice(F+1,0,$),$=["C",N,Q.y+2*B,N+4*B,Q.y,N,Q.y-2*B],Y.splice(F+2,0,$),r.attr("path",Y)):($=["L",N,Q.y-2*B],Y.splice(F+1,0,$),$=["C",N,Q.y-2*B,N+4*B,Q.y,N,Q.y+2*B],Y.splice(F+2,0,$),r.attr("path",Y)),F+=2,O+=2}}}this.chart.lines.push(r)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&k>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=k)},t.exports=r},function(t,i){function e(t,i,e){var r,s,o="M{0},{1}";for(r=2,s=2*e.length+2;s>r;r+=2)o+=" L{"+r+"},{"+(r+1)+"}";var n=[i.x,i.y];for(r=0,s=e.length;s>r;r++)n.push(e[r].x),n.push(e[r].y);var h=t.paper.path(o,n);h.attr("stroke",t.options["element-color"]),h.attr("stroke-width",t.options["line-width"]);var a=t.options.font,x=t.options["font-family"],y=t.options["font-weight"];return a&&h.attr({font:a}),x&&h.attr({"font-family":x}),y&&h.attr({"font-weight":y}),h}function r(t,i,e,r){var s,o;"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]);var n="M{0},{1}";for(s=2,o=2*e.length+2;o>s;s+=2)n+=" L{"+s+"},{"+(s+1)+"}";var h=[i.x,i.y];for(s=0,o=e.length;o>s;s++)h.push(e[s].x),h.push(e[s].y);var a=t.paper.path(n,h);a.attr({stroke:t.options["line-color"],"stroke-width":t.options["line-width"],"arrow-end":t.options["arrow-end"]});var x=t.options.font,y=t.options["font-family"],l=t.options["font-weight"];if(x&&a.attr({font:x}),y&&a.attr({"font-family":y}),l&&a.attr({"font-weight":l}),r){var g=!1,f=t.paper.text(0,0,r),p=!1,c=e[0];i.y===c.y&&(p=!0);var u=0,d=0;g?(u=i.x>c.x?i.x-(i.x-c.x)/2:c.x-(c.x-i.x)/2,d=i.y>c.y?i.y-(i.y-c.y)/2:c.y-(c.y-i.y)/2,p?(u-=f.getBBox().width/2,d-=t.options["text-margin"]):(u+=t.options["text-margin"],d-=f.getBBox().height/2)):(u=i.x,d=i.y,p?(u+=t.options["text-margin"]/2,d-=t.options["text-margin"]):(u+=t.options["text-margin"]/2,d+=t.options["text-margin"])),f.attr({"text-anchor":"start","font-size":t.options["font-size"],fill:t.options["font-color"],x:u,y:d}),x&&f.attr({font:x}),y&&f.attr({"font-family":y}),l&&f.attr({"font-weight":l})}return a}function s(t,i,e,r,s,o,n,h){var a,x,y,l,g,f={x:null,y:null,onLine1:!1,onLine2:!1};return a=(h-o)*(e-t)-(n-s)*(r-i),0===a?f:(x=i-o,y=t-s,l=(n-s)*x-(h-o)*y,g=(e-t)*x-(r-i)*y,x=l/a,y=g/a,f.x=t+x*(e-t),f.y=i+x*(r-i),x>0&&1>x&&(f.onLine1=!0),y>0&&1>y&&(f.onLine2=!0),f)}t.exports={drawPath:e,drawLine:r,checkLineIntersection:s}},function(t,i,e){function r(t){function i(t){var i=t.indexOf("(")+1,e=t.indexOf(")");return i>=0&&e>=0?r.symbols[t.substring(0,i-1)]:r.symbols[t]}function e(t){var i="next",e=t.indexOf("(")+1,r=t.indexOf(")");return e>=0&&r>=0&&(i=X.substring(e,r),i.indexOf(",")<0&&"yes"!==i&&"no"!==i&&(i="next, "+i)),i}t=t||"",t=t.trim();for(var r={symbols:{},start:null,drawSVG:function(t,i){function e(t){if(g[t.key])return g[t.key];switch(t.symbolType){case"start":g[t.key]=new o(l,t);break;case"end":g[t.key]=new n(l,t);break;case"operation":g[t.key]=new h(l,t);break;case"inputoutput":g[t.key]=new a(l,t);break;case"subroutine":g[t.key]=new x(l,t);break;case"condition":g[t.key]=new y(l,t);break;default:return new Error("Wrong symbol type!")}return g[t.key]}var r=this;this.diagram&&this.diagram.clean();var l=new s(t,i);this.diagram=l;var g={};!function f(t,i,s){var o=e(t);return r.start===t?l.startWith(o):i&&s&&!i.pathOk&&(i instanceof y?(s.yes===t&&i.yes(o),s.no===t&&i.no(o)):i.then(o)),o.pathOk?o:(o instanceof y?(t.yes&&f(t.yes,o,t),t.no&&f(t.no,o,t)):t.next&&f(t.next,o,t),o)}(this.start),l.render()},clean:function(){this.diagram.clean()}},l=[],g=0,f=1,p=t.length;p>f;f++)if("\n"===t[f]&&"\\"!==t[f-1]){var c=t.substring(g,f);g=f+1,l.push(c.replace(/\\\n/g,"\n"))}gu;){var m=l[u];m.indexOf("->")<0&&m.indexOf("=>")<0?(l[u-1]+="\n"+m,l.splice(u,1),d--):u++}for(;l.length>0;){var b=l.splice(0,1)[0];if(b.indexOf("=>")>=0){var v,w=b.split("=>"),k={key:w[0],symbolType:w[1],text:null,link:null,target:null,flowstate:null};if(k.symbolType.indexOf(": ")>=0&&(v=k.symbolType.split(": "),k.symbolType=v.shift(),k.text=v.join(": ")),k.text&&k.text.indexOf(":>")>=0?(v=k.text.split(":>"),k.text=v.shift(),k.link=v.join(":>")):k.symbolType.indexOf(":>")>=0&&(v=k.symbolType.split(":>"),k.symbolType=v.shift(),k.link=v.join(":>")),k.symbolType.indexOf("\n")>=0&&(k.symbolType=k.symbolType.split("\n")[0]),k.link){var _=k.link.indexOf("[")+1,B=k.link.indexOf("]");_>=0&&B>=0&&(k.target=k.link.substring(_,B),k.link=k.link.substring(0,_-1))}if(k.text&&k.text.indexOf("|")>=0){var A=k.text.split("|");k.flowstate=A.pop().trim(),k.text=A.join("|")}r.symbols[k.key]=k}else if(b.indexOf("->")>=0)for(var L=b.split("->"),M=0,O=L.length;O>M;M++){var X=L[M],T=i(X),Y=e(X),C=null;if(Y.indexOf(",")>=0){var S=Y.split(",");Y=S[0],C=S[1].trim()}if(r.start||(r.start=T),O>M+1){var j=L[M+1];T[Y]=i(j),T["direction_"+Y]=C,C=null}}}return r}var s=e(6),o=e(12),n=e(9),h=e(11),a=e(10),x=e(13),y=e(5);t.exports=r},function(t,i,e){function r(t,i){i=i||{},s.call(this,t,i),this.textMargin=this.getAttr("text-margin"),this.yes_direction="bottom",this.no_direction="right",i.yes&&i.direction_yes&&i.no&&!i.direction_no?"right"===i.direction_yes?(this.no_direction="bottom",this.yes_direction="right"):(this.no_direction="right",this.yes_direction="bottom"):i.yes&&!i.direction_yes&&i.no&&i.direction_no?"right"===i.direction_no?(this.yes_direction="bottom",this.no_direction="right"):(this.yes_direction="right",this.no_direction="bottom"):(this.yes_direction="bottom",this.no_direction="right"),this.yes_direction=this.yes_direction||"bottom",this.no_direction=this.no_direction||"right",this.text.attr({x:2*this.textMargin});var e=this.text.getBBox().width+3*this.textMargin;e+=e/2;var r=this.text.getBBox().height+2*this.textMargin;r+=r/2,r=Math.max(.5*e,r);var o=e/4,n=r/4;this.text.attr({x:o+this.textMargin/2});var a={x:o,y:n},x=[{x:o-e/4,y:n+r/4},{x:o-e/4+e/2,y:n+r/4+r/2},{x:o-e/4+e,y:n+r/4},{x:o-e/4+e/2,y:n+r/4-r/2},{x:o-e/4,y:n+r/4}],y=h(t,a,x);y.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),i.link&&y.attr("href",i.link),i.target&&y.attr("target",i.target),i.key&&(y.node.id=i.key),y.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:y.getBBox().height/2}),this.group.push(y),y.insertBefore(this.text),this.initialize()}var s=e(2),o=e(1).inherits,n=e(3),h=n.drawPath;o(r,s),r.prototype.render=function(){this.yes_direction&&(this[this.yes_direction+"_symbol"]=this.yes_symbol),this.no_direction&&(this[this.no_direction+"_symbol"]=this.no_symbol);var t=this.getAttr("line-length");if(this.bottom_symbol){var i=this.getBottom();this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+t),this.bottom_symbol.setX(i.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var e=this.getRight();if(!this.right_symbol.isPositioned){this.right_symbol.setY(e.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+t);var r=this;!function s(){for(var i,e=!1,o=0,n=r.chart.symbols.length;n>o;o++){i=r.chart.symbols[o];var h=Math.abs(i.getCenter().x-r.right_symbol.getCenter().x);if(i.getCenter().y>r.right_symbol.getCenter().y&&h<=r.right_symbol.width/2){e=!0;break}}e&&(r.right_symbol.setX(i.getX()+i.width+t),s())}(),this.right_symbol.isPositioned=!0,this.right_symbol.render()}}},r.prototype.renderLines=function(){this.yes_symbol&&this.drawLineTo(this.yes_symbol,this.getAttr("yes-text"),this.yes_direction),this.no_symbol&&this.drawLineTo(this.no_symbol,this.getAttr("no-text"),this.no_direction)},t.exports=r},function(t,i,e){function r(t,i){i=i||{},this.paper=new s(t),this.options=o(i,n),this.symbols=[],this.lines=[],this.start=null}var s=e(15),o=e(1).defaults,n=e(7),h=e(5);r.prototype.handle=function(t){this.symbols.indexOf(t)<=-1&&this.symbols.push(t);var i=this;return t instanceof h?(t.yes=function(e){return t.yes_symbol=e,t.no_symbol&&(t.pathOk=!0),i.handle(e)},t.no=function(e){return t.no_symbol=e,t.yes_symbol&&(t.pathOk=!0),i.handle(e)}):t.then=function(e){return t.next=e,t.pathOk=!0,i.handle(e)},t},r.prototype.startWith=function(t){return this.start=t,this.handle(t)},r.prototype.render=function(){var t,i=0,e=0,r=0,s=0,o=0,n=0;for(r=0,s=this.symbols.length;s>r;r++)t=this.symbols[r],t.width>i&&(i=t.width),t.height>e&&(e=t.height);for(r=0,s=this.symbols.length;s>r;r++)t=this.symbols[r],t.shiftX(this.options.x+(i-t.width)/2+this.options["line-width"]),t.shiftY(this.options.y+(e-t.height)/2+this.options["line-width"]);for(this.start.render(),r=0,s=this.symbols.length;s>r;r++)t=this.symbols[r],t.renderLines();for(o=this.maxXFromLine,r=0,s=this.symbols.length;s>r;r++){t=this.symbols[r];var h=t.getX()+t.width,a=t.getY()+t.height;h>o&&(o=h),a>n&&(n=a)}var x=this.options.scale,y=this.options["line-width"];this.paper.setSize(o*x+y*x,n*x+y*x),this.paper.setViewBox(0,0,o+y,n+y,!0)},r.prototype.clean=function(){if(this.paper){var t=this.paper.canvas;t.parentNode.removeChild(t)}},t.exports=r},function(t,i){t.exports={x:0,y:0,"line-width":3,"line-length":50,"text-margin":10,"font-size":14,"font-color":"black","line-color":"black","element-color":"black",fill:"white","yes-text":"yes","no-text":"no","arrow-end":"block","class":"flowchart",scale:1,symbols:{start:{},end:{},condition:{},inputoutput:{},operation:{},subroutine:{}}}},function(t,i){Array.prototype.indexOf||(Array.prototype.indexOf=function(t){"use strict";if(null===this)throw new TypeError;var i=Object(this),e=i.length>>>0;if(0===e)return-1;var r=0;if(arguments.length>0&&(r=Number(arguments[1]),r!=r?r=0:0!==r&&r!=1/0&&r!=-(1/0)&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=e)return-1;for(var s=r>=0?r:Math.max(e-Math.abs(r),0);e>s;s++)if(s in i&&i[s]===t)return s;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(t){"use strict";if(null===this)throw new TypeError;var i=Object(this),e=i.length>>>0;if(0===e)return-1;var r=e;arguments.length>1&&(r=Number(arguments[1]),r!=r?r=0:0!==r&&r!=1/0&&r!=-(1/0)&&(r=(r>0||-1)*Math.floor(Math.abs(r))));for(var s=r>=0?Math.min(r,e-1):e-Math.abs(r);s>=0;s--)if(s in i&&i[s]===t)return s;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")})},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0,20);i=i||{},i.text=i.text||"End",s.call(this,t,i,e)}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){function r(t,i){i=i||{},s.call(this,t,i),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var e=this.text.getBBox().width+4*this.textMargin,r=this.text.getBBox().height+2*this.textMargin,o=this.textMargin,n=r/2,a={x:o,y:n},x=[{x:o-this.textMargin,y:r},{x:o-this.textMargin+e,y:r},{x:o-this.textMargin+e+2*this.textMargin,y:0},{x:o-this.textMargin+2*this.textMargin,y:0},{x:o,y:n}],y=h(t,a,x);y.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),i.link&&y.attr("href",i.link),i.target&&y.attr("target",i.target),i.key&&(y.node.id=i.key),y.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:y.getBBox().height/2}),this.group.push(y),y.insertBefore(this.text),this.initialize()}var s=e(2),o=e(1).inherits,n=e(3),h=n.drawPath;o(r,s),r.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.textMargin;return{x:i,y:t}},r.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.group.getBBox().width-this.textMargin;return{x:i,y:t}},t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},s.call(this,t,i,e)}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0,20);i=i||{},i.text=i.text||"Start",s.call(this,t,i,e)}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},s.call(this,t,i,e),e.attr({width:this.text.getBBox().width+4*this.getAttr("text-margin")}),this.text.attr({x:2*this.getAttr("text-margin")});var r=t.paper.rect(0,0,0,0);r.attr({x:this.getAttr("text-margin"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*this.getAttr("text-margin"),height:this.text.getBBox().height+2*this.getAttr("text-margin"),fill:this.getAttr("fill")}),i.key&&(r.node.id=i.key+"i");var o=this.getAttr("font"),n=this.getAttr("font-family"),h=this.getAttr("font-weight");o&&r.attr({font:o}),n&&r.attr({"font-family":n}),h&&r.attr({"font-weight":h}),i.link&&r.attr("href",i.link),i.target&&r.attr("target",i.target),this.group.push(r),r.insertBefore(this.text),this.initialize()}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){if("undefined"!=typeof jQuery){var r=e(4);!function(t){t.fn.flowChart=function(i){return this.each(function(){var e=t(this),s=r(e.text());e.html(""),s.drawSVG(this,i)})}}(jQuery)}},function(i,e){i.exports=t}])}); +//# sourceMappingURL=flowchart.min.js.map \ No newline at end of file diff --git a/release/flowchart.min.js.map b/release/flowchart.min.js.map new file mode 100644 index 00000000..9013def8 --- /dev/null +++ b/release/flowchart.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///flowchart.min.js","webpack:///webpack/bootstrap 3956c0fd3abd37421728","webpack:///./index.js","webpack:///./src/flowchart.helpers.js","webpack:///./src/flowchart.symbol.js","webpack:///./src/flowchart.functions.js","webpack:///./src/flowchart.parse.js","webpack:///./src/flowchart.symbol.condition.js","webpack:///./src/flowchart.chart.js","webpack:///./src/flowchart.defaults.js","webpack:///./src/flowchart.shim.js","webpack:///./src/flowchart.symbol.end.js","webpack:///./src/flowchart.symbol.inputoutput.js","webpack:///./src/flowchart.symbol.operation.js","webpack:///./src/flowchart.symbol.start.js","webpack:///./src/flowchart.symbol.subroutine.js","webpack:///./src/jquery-plugin.js","webpack:///external \"Raphael\""],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE_15__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","parse","FlowChart","window","_defaults","options","defaultOptions","merged","attrname","_inherits","ctor","superCtor","Object","super_","prototype","create","constructor","value","enumerable","writable","configurable","TempCtor","defaults","inherits","Symbol","chart","symbol","group","paper","set","connectedTo","symbolType","flowstate","next_direction","next","undefined","text","key","node","setAttribute","getAttr","attr","text-anchor","x","fill","font-size","font","fontF","fontW","font-family","font-weight","link","target","maxWidth","words","split","tempText","ii","length","word","getBBox","width","substring","push","tmpMargin","stroke","stroke-width","height","insertBefore","y","initialize","drawAPI","drawLine","checkLineIntersection","attName","opt1","opt3","opt2","symbols","transform","getCenter","getX","getY","shiftX","setX","shiftY","setY","getTop","getBottom","getLeft","getRight","render","lineLength","rightPoint","isPositioned","self","shift","symb","hasSymbolUnder","len","diff","Math","abs","bottomPoint","renderLines","drawLineTo","origin","indexOf","line","right","bottom","left","symbolX","symbolY","symbolTop","symbolRight","symbolLeft","isOnSameColumn","isOnSameLine","isUnder","isUpper","isLeft","isRight","maxX","lineWith","rightStart","topEnd","bottomStart","diffX","leftStart","leftEnd","rightEnd","l","llen","lines","otherLine","ePath","lPath","iP","lenP","newPath","line1_from_x","line1_from_y","line1_to_x","line1_to_y","lP","lenlP","newLinePath","line2_from_x","line2_from_y","line2_to_x","line2_to_y","res","onLine1","onLine2","newSegment","splice","maxXFromLine","drawPath","location","points","path","pathValues","from","to","toString","arrow-end","centerText","textPath","isHorizontal","firstTo","line1StartX","line1StartY","line1EndX","line1EndY","line2StartX","line2StartY","line2EndX","line2EndY","denominator","b","numerator1","numerator2","result","input","getSymbol","s","startIndex","endIndex","getNextPath","flowSymb","trim","start","drawSVG","container","getDisplaySymbol","dispSymbols","Start","diagram","End","Operation","InputOutput","Subroutine","Condition","Error","clean","constructChart","prevDisp","prev","dispSymb","startWith","pathOk","yes","no","then","prevBreak","i0","i0len","line0","replace","substr","currentLine","sub","parts","join","txtAndState","pop","flowSymbols","lenS","realSymb","direction","condOpt","nextSymb","textMargin","yes_direction","no_direction","direction_yes","direction_no","max","startX","startY","yes_symbol","no_symbol","bottom_symbol","right_symbol","Raphael","handle","flowChart","nextSymbol","maxHeight","maxY","scale","lineWidth","setSize","setViewBox","paperDom","canvas","parentNode","removeChild","line-width","line-length","text-margin","font-color","line-color","element-color","yes-text","no-text","class","end","condition","inputoutput","operation","subroutine","Array","searchElement","TypeError","t","n","arguments","Number","Infinity","floor","k","lastIndexOf","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,QAAAQ","file":"flowchart.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Raphael\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Raphael\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"Raphael\")) : factory(root[\"Raphael\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_15__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Raphael\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Raphael\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"Raphael\")) : factory(root[\"Raphael\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_15__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/*!******************!*\\\n !*** ./index.js ***!\n \\******************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t__webpack_require__(/*! ./src/flowchart.shim */ 8);\n\tvar parse = __webpack_require__(/*! ./src/flowchart.parse */ 4);\n\t__webpack_require__(/*! ./src/jquery-plugin */ 14);\n\t\n\tvar FlowChart = {\n\t\tparse: parse\n\t};\n\t\n\tif (typeof window !== 'undefined') {\n\t\twindow.FlowChart = FlowChart;\n\t}\n\t\n\tmodule.exports = FlowChart;\n\n\n/***/ },\n/* 1 */\n/*!**********************************!*\\\n !*** ./src/flowchart.helpers.js ***!\n \\**********************************/\n/***/ function(module, exports) {\n\n\tfunction _defaults(options, defaultOptions) {\n\t if (!options || typeof options === 'function') {\n\t return defaultOptions;\n\t }\n\t\n\t var merged = {};\n\t for (var attrname in defaultOptions) {\n\t merged[attrname] = defaultOptions[attrname];\n\t }\n\t\n\t for (attrname in options) {\n\t if (options[attrname]) {\n\t if (typeof merged[attrname] === 'object') {\n\t merged[attrname] = _defaults(merged[attrname], options[attrname]);\n\t } else {\n\t merged[attrname] = options[attrname];\n\t }\n\t }\n\t }\n\t return merged;\n\t}\n\t\n\tfunction _inherits(ctor, superCtor) {\n\t if (typeof(Object.create) === 'function') {\n\t // implementation from standard node.js 'util' module\n\t ctor.super_ = superCtor;\n\t ctor.prototype = Object.create(superCtor.prototype, {\n\t constructor: {\n\t value: ctor,\n\t enumerable: false,\n\t writable: true,\n\t configurable: true\n\t }\n\t });\n\t } else {\n\t // old school shim for old browsers\n\t ctor.super_ = superCtor;\n\t var TempCtor = function () {};\n\t TempCtor.prototype = superCtor.prototype;\n\t ctor.prototype = new TempCtor();\n\t ctor.prototype.constructor = ctor;\n\t }\n\t}\n\t\n\t// move dependent functions to a container so that\n\t// they can be overriden easier in no jquery environment (node.js)\n\tmodule.exports = {\n\t defaults: _defaults,\n\t inherits: _inherits\n\t};\n\n\n/***/ },\n/* 2 */\n/*!*********************************!*\\\n !*** ./src/flowchart.symbol.js ***!\n \\*********************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawLine = drawAPI.drawLine;\n\tvar checkLineIntersection = drawAPI.checkLineIntersection;\n\t\n\tfunction Symbol(chart, options, symbol) {\n\t this.chart = chart;\n\t this.group = this.chart.paper.set();\n\t this.symbol = symbol;\n\t this.connectedTo = [];\n\t this.symbolType = options.symbolType;\n\t this.flowstate = (options.flowstate || 'future');\n\t\n\t this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined;\n\t\n\t this.text = this.chart.paper.text(0, 0, options.text);\n\t //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t\n\t if (options.key) { this.text.node.id = options.key + 't'; }\n\t this.text.node.setAttribute('class', this.getAttr('class') + 't');\n\t\n\t this.text.attr({\n\t 'text-anchor': 'start',\n\t 'x' : this.getAttr('text-margin'),\n\t 'fill' : this.getAttr('font-color'),\n\t 'font-size' : this.getAttr('font-size')\n\t });\n\t\n\t var font = this.getAttr('font');\n\t var fontF = this.getAttr('font-family');\n\t var fontW = this.getAttr('font-weight');\n\t\n\t if (font) this.text.attr({ 'font': font });\n\t if (fontF) this.text.attr({ 'font-family': fontF });\n\t if (fontW) this.text.attr({ 'font-weight': fontW });\n\t\n\t if (options.link) { this.text.attr('href', options.link); }\n\t if (options.target) { this.text.attr('target', options.target); }\n\t\n\t var maxWidth = this.getAttr('maxWidth');\n\t if (maxWidth) {\n\t // using this approach: http://stackoverflow.com/a/3153457/22466\n\t var words = options.text.split(' ');\n\t var tempText = \"\";\n\t for (var i=0, ii=words.length; i maxWidth) {\n\t tempText += \"\\n\" + word;\n\t } else {\n\t tempText += \" \" + word;\n\t }\n\t }\n\t this.text.attr(\"text\", tempText.substring(1));\n\t }\n\t\n\t this.group.push(this.text);\n\t\n\t if (symbol) {\n\t var tmpMargin = this.getAttr('text-margin');\n\t\n\t symbol.attr({\n\t 'fill' : this.getAttr('fill'),\n\t 'stroke' : this.getAttr('element-color'),\n\t 'stroke-width' : this.getAttr('line-width'),\n\t 'width' : this.text.getBBox().width + 2 * tmpMargin,\n\t 'height' : this.text.getBBox().height + 2 * tmpMargin\n\t });\n\t\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t\n\t this.text.attr({\n\t 'y': symbol.getBBox().height/2\n\t });\n\t\n\t this.initialize();\n\t }\n\t\n\t}\n\t\n\t/* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */\n\tSymbol.prototype.getAttr = function(attName) {\n\t if (!this.chart) {\n\t return undefined;\n\t }\n\t var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined;\n\t var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined;\n\t var opt1;\n\t if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) {\n\t opt1 = this.chart.options.flowstate[this.flowstate][attName];\n\t }\n\t return (opt1 || opt2 || opt3);\n\t};\n\t\n\tSymbol.prototype.initialize = function() {\n\t this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width'));\n\t\n\t this.width = this.group.getBBox().width;\n\t this.height = this.group.getBBox().height;\n\t};\n\t\n\tSymbol.prototype.getCenter = function() {\n\t return {x: this.getX() + this.width/2,\n\t y: this.getY() + this.height/2};\n\t};\n\t\n\tSymbol.prototype.getX = function() {\n\t return this.group.getBBox().x;\n\t};\n\t\n\tSymbol.prototype.getY = function() {\n\t return this.group.getBBox().y;\n\t};\n\t\n\tSymbol.prototype.shiftX = function(x) {\n\t this.group.transform('t' + (this.getX() + x) + ',' + this.getY());\n\t};\n\t\n\tSymbol.prototype.setX = function(x) {\n\t this.group.transform('t' + x + ',' + this.getY());\n\t};\n\t\n\tSymbol.prototype.shiftY = function(y) {\n\t this.group.transform('t' + this.getX() + ',' + (this.getY() + y));\n\t};\n\t\n\tSymbol.prototype.setY = function(y) {\n\t this.group.transform('t' + this.getX() + ',' + y);\n\t};\n\t\n\tSymbol.prototype.getTop = function() {\n\t var y = this.getY();\n\t var x = this.getX() + this.width/2;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getBottom = function() {\n\t var y = this.getY() + this.height;\n\t var x = this.getX() + this.width/2;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX();\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width;\n\t return {x: x, y: y};\n\t};\n\t\n\tSymbol.prototype.render = function() {\n\t if (this.next) {\n\t\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.next_direction === 'right') {\n\t\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.next.isPositioned) {\n\t\n\t this.next.setY(rightPoint.y - this.next.height/2);\n\t this.next.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t\n\t var self = this;\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n\t if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t self.next.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t } else {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.next.isPositioned) {\n\t this.next.shiftY(this.getY() + this.height + lineLength);\n\t this.next.setX(bottomPoint.x - this.next.width/2);\n\t this.next.isPositioned = true;\n\t\n\t this.next.render();\n\t }\n\t }\n\t }\n\t};\n\t\n\tSymbol.prototype.renderLines = function() {\n\t if (this.next) {\n\t if (this.next_direction) {\n\t this.drawLineTo(this.next, '', this.next_direction);\n\t } else {\n\t this.drawLineTo(this.next);\n\t }\n\t }\n\t};\n\t\n\tSymbol.prototype.drawLineTo = function(symbol, text, origin) {\n\t if (this.connectedTo.indexOf(symbol) < 0) {\n\t this.connectedTo.push(symbol);\n\t }\n\t\n\t var x = this.getCenter().x,\n\t y = this.getCenter().y,\n\t right = this.getRight(),\n\t bottom = this.getBottom(),\n\t left = this.getLeft();\n\t\n\t var symbolX = symbol.getCenter().x,\n\t symbolY = symbol.getCenter().y,\n\t symbolTop = symbol.getTop(),\n\t symbolRight = symbol.getRight(),\n\t symbolLeft = symbol.getLeft();\n\t\n\t var isOnSameColumn = x === symbolX,\n\t isOnSameLine = y === symbolY,\n\t isUnder = y < symbolY,\n\t isUpper = y > symbolY,\n\t isLeft = x > symbolX,\n\t isRight = x < symbolX;\n\t\n\t var maxX = 0,\n\t line,\n\t lineLength = this.getAttr('line-length'),\n\t lineWith = this.getAttr('line-width');\n\t\n\t if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) {\n\t line = drawLine(this.chart, bottom, symbolTop, text);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x;\n\t } else if ((!origin || origin === 'right') && isOnSameLine && isRight) {\n\t line = drawLine(this.chart, right, symbolLeft, text);\n\t this.rightStart = true;\n\t symbol.leftEnd = true;\n\t maxX = symbolLeft.x;\n\t } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) {\n\t line = drawLine(this.chart, left, symbolRight, text);\n\t this.leftStart = true;\n\t symbol.rightEnd = true;\n\t maxX = symbolRight.x;\n\t } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) {\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) {\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((!origin || origin === 'bottom') && isLeft) {\n\t if (this.leftEnd && isUpper) {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t } else {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t }\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n\t } else if ((!origin || origin === 'bottom') && isRight) {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2},\n\t {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n\t } else if ((origin && origin === 'right') && isLeft) {\n\t line = drawLine(this.chart, right, [\n\t {x: right.x + lineLength/2, y: right.y},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((origin && origin === 'right') && isRight) {\n\t line = drawLine(this.chart, right, [\n\t {x: symbolTop.x, y: right.y},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.rightStart = true;\n\t symbol.topEnd = true;\n\t maxX = right.x + lineLength/2;\n\t } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) {\n\t line = drawLine(this.chart, bottom, [\n\t {x: bottom.x, y: bottom.y + lineLength/2},\n\t {x: right.x + lineLength/2, y: bottom.y + lineLength/2},\n\t {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.bottomStart = true;\n\t symbol.topEnd = true;\n\t maxX = bottom.x + lineLength/2;\n\t } else if ((origin === 'left') && isOnSameColumn && isUpper) {\n\t var diffX = left.x - lineLength/2;\n\t if (symbolLeft.x < left.x) {\n\t diffX = symbolLeft.x - lineLength/2;\n\t }\n\t line = drawLine(this.chart, left, [\n\t {x: diffX, y: left.y},\n\t {x: diffX, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.leftStart = true;\n\t symbol.topEnd = true;\n\t maxX = left.x;\n\t } else if ((origin === 'left')) {\n\t line = drawLine(this.chart, left, [\n\t {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y},\n\t {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n\t {x: symbolTop.x, y: symbolTop.y}\n\t ], text);\n\t this.leftStart = true;\n\t symbol.topEnd = true;\n\t maxX = left.x;\n\t }\n\t\n\t if (line) {\n\t for (var l = 0, llen = this.chart.lines.length; l < llen; l++) {\n\t var otherLine = this.chart.lines[l];\n\t var len;\n\t\n\t var ePath = otherLine.attr('path'),\n\t lPath = line.attr('path');\n\t\n\t for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) {\n\t var newPath = [];\n\t newPath.push(['M', ePath[iP][1], ePath[iP][2]]);\n\t newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]);\n\t\n\t var line1_from_x = newPath[0][1];\n\t var line1_from_y = newPath[0][2];\n\t var line1_to_x = newPath[1][1];\n\t var line1_to_y = newPath[1][2];\n\t\n\t for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) {\n\t var newLinePath = [];\n\t newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]);\n\t newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]);\n\t\n\t var line2_from_x = newLinePath[0][1];\n\t var line2_from_y = newLinePath[0][2];\n\t var line2_to_x = newLinePath[1][1];\n\t var line2_to_y = newLinePath[1][2];\n\t\n\t var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y);\n\t if (res.onLine1 && res.onLine2) {\n\t\n\t var newSegment;\n\t if (line2_from_y === line2_to_y) {\n\t if (line2_from_x > line2_to_x) {\n\t newSegment = ['L', res.x + lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t } else {\n\t newSegment = ['L', res.x - lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t }\n\t } else {\n\t if (line2_from_y > line2_to_y) {\n\t newSegment = ['L', line2_from_x, res.y + lineWith * 2];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t } else {\n\t newSegment = ['L', line2_from_x, res.y - lineWith * 2];\n\t lPath.splice(lP + 1, 0, newSegment);\n\t newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2];\n\t lPath.splice(lP + 2, 0, newSegment);\n\t line.attr('path', lPath);\n\t }\n\t }\n\t\n\t lP += 2;\n\t len += 2;\n\t }\n\t }\n\t }\n\t }\n\t\n\t this.chart.lines.push(line);\n\t }\n\t\n\t if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) {\n\t this.chart.maxXFromLine = maxX;\n\t }\n\t};\n\t\n\tmodule.exports = Symbol;\n\n\n/***/ },\n/* 3 */\n/*!************************************!*\\\n !*** ./src/flowchart.functions.js ***!\n \\************************************/\n/***/ function(module, exports) {\n\n\tfunction drawPath(chart, location, points) {\n\t var i, len;\n\t var path = 'M{0},{1}';\n\t for (i = 2, len = 2 * points.length + 2; i < len; i+=2) {\n\t path += ' L{' + i + '},{' + (i + 1) + '}';\n\t }\n\t var pathValues = [location.x, location.y];\n\t for (i = 0, len = points.length; i < len; i++) {\n\t pathValues.push(points[i].x);\n\t pathValues.push(points[i].y);\n\t }\n\t var symbol = chart.paper.path(path, pathValues);\n\t symbol.attr('stroke', chart.options['element-color']);\n\t symbol.attr('stroke-width', chart.options['line-width']);\n\t\n\t var font = chart.options.font;\n\t var fontF = chart.options['font-family'];\n\t var fontW = chart.options['font-weight'];\n\t\n\t if (font) symbol.attr({ 'font': font });\n\t if (fontF) symbol.attr({ 'font-family': fontF });\n\t if (fontW) symbol.attr({ 'font-weight': fontW });\n\t\n\t return symbol;\n\t}\n\t\n\tfunction drawLine(chart, from, to, text) {\n\t var i, len;\n\t\n\t if (Object.prototype.toString.call(to) !== '[object Array]') {\n\t to = [to];\n\t }\n\t\n\t var path = 'M{0},{1}';\n\t for (i = 2, len = 2 * to.length + 2; i < len; i+=2) {\n\t path += ' L{' + i + '},{' + (i + 1) + '}';\n\t }\n\t var pathValues = [from.x, from.y];\n\t for (i = 0, len = to.length; i < len; i++) {\n\t pathValues.push(to[i].x);\n\t pathValues.push(to[i].y);\n\t }\n\t\n\t var line = chart.paper.path(path, pathValues);\n\t line.attr({\n\t stroke: chart.options['line-color'],\n\t 'stroke-width': chart.options['line-width'],\n\t 'arrow-end': chart.options['arrow-end']\n\t });\n\t\n\t var font = chart.options.font;\n\t var fontF = chart.options['font-family'];\n\t var fontW = chart.options['font-weight'];\n\t\n\t if (font) line.attr({ 'font': font });\n\t if (fontF) line.attr({ 'font-family': fontF });\n\t if (fontW) line.attr({ 'font-weight': fontW });\n\t\n\t if (text) {\n\t\n\t var centerText = false;\n\t\n\t var textPath = chart.paper.text(0, 0, text);\n\t\n\t var isHorizontal = false;\n\t var firstTo = to[0];\n\t\n\t if (from.y === firstTo.y) {\n\t isHorizontal = true;\n\t }\n\t\n\t var x = 0,\n\t y = 0;\n\t\n\t if (centerText) {\n\t if (from.x > firstTo.x) {\n\t x = from.x - (from.x - firstTo.x)/2;\n\t } else {\n\t x = firstTo.x - (firstTo.x - from.x)/2;\n\t }\n\t\n\t if (from.y > firstTo.y) {\n\t y = from.y - (from.y - firstTo.y)/2;\n\t } else {\n\t y = firstTo.y - (firstTo.y - from.y)/2;\n\t }\n\t\n\t if (isHorizontal) {\n\t x -= textPath.getBBox().width/2;\n\t y -= chart.options['text-margin'];\n\t } else {\n\t x += chart.options['text-margin'];\n\t y -= textPath.getBBox().height/2;\n\t }\n\t } else {\n\t x = from.x;\n\t y = from.y;\n\t\n\t if (isHorizontal) {\n\t x += chart.options['text-margin']/2;\n\t y -= chart.options['text-margin'];\n\t } else {\n\t x += chart.options['text-margin']/2;\n\t y += chart.options['text-margin'];\n\t }\n\t }\n\t\n\t textPath.attr({\n\t 'text-anchor': 'start',\n\t 'font-size': chart.options['font-size'],\n\t 'fill': chart.options['font-color'],\n\t x: x,\n\t y: y\n\t });\n\t\n\t if (font) textPath.attr({ 'font': font });\n\t if (fontF) textPath.attr({ 'font-family': fontF });\n\t if (fontW) textPath.attr({ 'font-weight': fontW });\n\t }\n\t\n\t return line;\n\t}\n\t\n\tfunction checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {\n\t // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point\n\t var denominator, a, b, numerator1, numerator2, result = {\n\t x: null,\n\t y: null,\n\t onLine1: false,\n\t onLine2: false\n\t };\n\t denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY));\n\t if (denominator === 0) {\n\t return result;\n\t }\n\t a = line1StartY - line2StartY;\n\t b = line1StartX - line2StartX;\n\t numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);\n\t numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);\n\t a = numerator1 / denominator;\n\t b = numerator2 / denominator;\n\t\n\t // if we cast these lines infinitely in both directions, they intersect here:\n\t result.x = line1StartX + (a * (line1EndX - line1StartX));\n\t result.y = line1StartY + (a * (line1EndY - line1StartY));\n\t /*\n\t // it is worth noting that this should be the same as:\n\t x = line2StartX + (b * (line2EndX - line2StartX));\n\t y = line2StartX + (b * (line2EndY - line2StartY));\n\t */\n\t // if line1 is a segment and line2 is infinite, they intersect if:\n\t if (a > 0 && a < 1) {\n\t result.onLine1 = true;\n\t }\n\t // if line2 is a segment and line1 is infinite, they intersect if:\n\t if (b > 0 && b < 1) {\n\t result.onLine2 = true;\n\t }\n\t // if line1 and line2 are segments, they intersect if both of the above are true\n\t return result;\n\t}\n\t\n\tmodule.exports = {\n\t\tdrawPath: drawPath,\n\t\tdrawLine: drawLine,\n\t\tcheckLineIntersection: checkLineIntersection\n\t};\n\n\n/***/ },\n/* 4 */\n/*!********************************!*\\\n !*** ./src/flowchart.parse.js ***!\n \\********************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar FlowChart = __webpack_require__(/*! ./flowchart.chart */ 6);\n\tvar Start = __webpack_require__(/*! ./flowchart.symbol.start */ 12);\n\tvar End = __webpack_require__(/*! ./flowchart.symbol.end */ 9);\n\tvar Operation = __webpack_require__(/*! ./flowchart.symbol.operation */ 11);\n\tvar InputOutput = __webpack_require__(/*! ./flowchart.symbol.inputoutput */ 10);\n\tvar Subroutine = __webpack_require__(/*! ./flowchart.symbol.subroutine */ 13);\n\tvar Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5);\n\t\n\tfunction parse(input) {\n\t input = input || '';\n\t input = input.trim();\n\t\n\t var chart = {\n\t symbols: {},\n\t start: null,\n\t drawSVG: function(container, options) {\n\t var self = this;\n\t\n\t if (this.diagram) {\n\t this.diagram.clean();\n\t }\n\t\n\t var diagram = new FlowChart(container, options);\n\t this.diagram = diagram;\n\t var dispSymbols = {};\n\t\n\t function getDisplaySymbol(s) {\n\t if (dispSymbols[s.key]) {\n\t return dispSymbols[s.key];\n\t }\n\t\n\t switch (s.symbolType) {\n\t case 'start':\n\t dispSymbols[s.key] = new Start(diagram, s);\n\t break;\n\t case 'end':\n\t dispSymbols[s.key] = new End(diagram, s);\n\t break;\n\t case 'operation':\n\t dispSymbols[s.key] = new Operation(diagram, s);\n\t break;\n\t case 'inputoutput':\n\t dispSymbols[s.key] = new InputOutput(diagram, s);\n\t break;\n\t case 'subroutine':\n\t dispSymbols[s.key] = new Subroutine(diagram, s);\n\t break;\n\t case 'condition':\n\t dispSymbols[s.key] = new Condition(diagram, s);\n\t break;\n\t default:\n\t return new Error('Wrong symbol type!');\n\t }\n\t\n\t return dispSymbols[s.key];\n\t }\n\t\n\t (function constructChart(s, prevDisp, prev) {\n\t var dispSymb = getDisplaySymbol(s);\n\t\n\t if (self.start === s) {\n\t diagram.startWith(dispSymb);\n\t } else if (prevDisp && prev && !prevDisp.pathOk) {\n\t if (prevDisp instanceof(Condition)) {\n\t if (prev.yes === s) {\n\t prevDisp.yes(dispSymb);\n\t }\n\t if (prev.no === s) {\n\t prevDisp.no(dispSymb);\n\t }\n\t } else {\n\t prevDisp.then(dispSymb);\n\t }\n\t }\n\t\n\t if (dispSymb.pathOk) {\n\t return dispSymb;\n\t }\n\t\n\t if (dispSymb instanceof(Condition)) {\n\t if (s.yes) {\n\t constructChart(s.yes, dispSymb, s);\n\t }\n\t if (s.no) {\n\t constructChart(s.no, dispSymb, s);\n\t }\n\t } else if (s.next) {\n\t constructChart(s.next, dispSymb, s);\n\t }\n\t\n\t return dispSymb;\n\t })(this.start);\n\t\n\t diagram.render();\n\t },\n\t clean: function() {\n\t this.diagram.clean();\n\t }\n\t };\n\t\n\t var lines = [];\n\t var prevBreak = 0;\n\t for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) {\n\t if(input[i0] === '\\n' && input[i0 - 1] !== '\\\\') {\n\t var line0 = input.substring(prevBreak, i0);\n\t prevBreak = i0 + 1;\n\t lines.push(line0.replace(/\\\\\\n/g, '\\n'));\n\t }\n\t }\n\t\n\t if(prevBreak < input.length) {\n\t lines.push(input.substr(prevBreak));\n\t }\n\t\n\t for (var l = 1, len = lines.length; l < len;) {\n\t var currentLine = lines[l];\n\t\n\t if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0) {\n\t lines[l - 1] += '\\n' + currentLine;\n\t lines.splice(l, 1);\n\t len--;\n\t } else {\n\t l++;\n\t }\n\t }\n\t\n\t function getSymbol(s) {\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t return chart.symbols[s.substring(0, startIndex - 1)];\n\t }\n\t return chart.symbols[s];\n\t }\n\t\n\t function getNextPath(s) {\n\t var next = 'next';\n\t var startIndex = s.indexOf('(') + 1;\n\t var endIndex = s.indexOf(')');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t next = flowSymb.substring(startIndex, endIndex);\n\t if (next.indexOf(',') < 0) {\n\t if (next !== 'yes' && next !== 'no') {\n\t next = 'next, ' + next;\n\t }\n\t }\n\t }\n\t return next;\n\t }\n\t\n\t while (lines.length > 0) {\n\t var line = lines.splice(0, 1)[0];\n\t\n\t if (line.indexOf('=>') >= 0) {\n\t // definition\n\t var parts = line.split('=>');\n\t var symbol = {\n\t key: parts[0],\n\t symbolType: parts[1],\n\t text: null,\n\t link: null,\n\t target: null,\n\t flowstate: null\n\t };\n\t\n\t var sub;\n\t\n\t if (symbol.symbolType.indexOf(': ') >= 0) {\n\t sub = symbol.symbolType.split(': ');\n\t symbol.symbolType = sub.shift();\n\t symbol.text = sub.join(': ');\n\t }\n\t\n\t if (symbol.text && symbol.text.indexOf(':>') >= 0) {\n\t sub = symbol.text.split(':>');\n\t symbol.text = sub.shift();\n\t symbol.link = sub.join(':>');\n\t } else if (symbol.symbolType.indexOf(':>') >= 0) {\n\t sub = symbol.symbolType.split(':>');\n\t symbol.symbolType = sub.shift();\n\t symbol.link = sub.join(':>');\n\t }\n\t\n\t if (symbol.symbolType.indexOf('\\n') >= 0) {\n\t symbol.symbolType = symbol.symbolType.split('\\n')[0];\n\t }\n\t\n\t /* adding support for links */\n\t if (symbol.link) {\n\t var startIndex = symbol.link.indexOf('[') + 1;\n\t var endIndex = symbol.link.indexOf(']');\n\t if (startIndex >= 0 && endIndex >= 0) {\n\t symbol.target = symbol.link.substring(startIndex, endIndex);\n\t symbol.link = symbol.link.substring(0, startIndex - 1);\n\t }\n\t }\n\t /* end of link support */\n\t\n\t /* adding support for flowstates */\n\t if (symbol.text) {\n\t if (symbol.text.indexOf('|') >= 0) {\n\t var txtAndState = symbol.text.split('|');\n\t symbol.flowstate = txtAndState.pop().trim();\n\t symbol.text = txtAndState.join('|');\n\t }\n\t }\n\t /* end of flowstate support */\n\t\n\t chart.symbols[symbol.key] = symbol;\n\t\n\t } else if (line.indexOf('->') >= 0) {\n\t // flow\n\t var flowSymbols = line.split('->');\n\t for (var i = 0, lenS = flowSymbols.length; i < lenS; i++) {\n\t var flowSymb = flowSymbols[i];\n\t\n\t var realSymb = getSymbol(flowSymb);\n\t var next = getNextPath(flowSymb);\n\t\n\t var direction = null;\n\t if (next.indexOf(',') >= 0) {\n\t var condOpt = next.split(',');\n\t next = condOpt[0];\n\t direction = condOpt[1].trim();\n\t }\n\t\n\t if (!chart.start) {\n\t chart.start = realSymb;\n\t }\n\t\n\t if (i + 1 < lenS) {\n\t var nextSymb = flowSymbols[i + 1];\n\t realSymb[next] = getSymbol(nextSymb);\n\t realSymb['direction_' + next] = direction;\n\t direction = null;\n\t }\n\t }\n\t }\n\t\n\t }\n\t return chart;\n\t}\n\t\n\tmodule.exports = parse;\n\n\n/***/ },\n/* 5 */\n/*!*******************************************!*\\\n !*** ./src/flowchart.symbol.condition.js ***!\n \\*******************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction Condition(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t this.yes_direction = 'bottom';\n\t this.no_direction = 'right';\n\t if (options.yes && options.direction_yes && options.no && !options.direction_no) {\n\t if (options.direction_yes === 'right') {\n\t this.no_direction = 'bottom';\n\t this.yes_direction = 'right';\n\t } else {\n\t this.no_direction = 'right';\n\t this.yes_direction = 'bottom';\n\t }\n\t } else if (options.yes && !options.direction_yes && options.no && options.direction_no) {\n\t if (options.direction_no === 'right') {\n\t this.yes_direction = 'bottom';\n\t this.no_direction = 'right';\n\t } else {\n\t this.yes_direction = 'right';\n\t this.no_direction = 'bottom';\n\t }\n\t } else {\n\t this.yes_direction = 'bottom';\n\t this.no_direction = 'right';\n\t }\n\t\n\t this.yes_direction = this.yes_direction || 'bottom';\n\t this.no_direction = this.no_direction || 'right';\n\t\n\t this.text.attr({\n\t x: this.textMargin * 2\n\t });\n\t\n\t var width = this.text.getBBox().width + 3 * this.textMargin;\n\t width += width/2;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t height += height/2;\n\t height = Math.max(width * 0.5, height);\n\t var startX = width/4;\n\t var startY = height/4;\n\t\n\t this.text.attr({\n\t x: startX + this.textMargin/2\n\t });\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - width/4, y: startY + height/4},\n\t {x: startX - width/4 + width/2, y: startY + height/4 + height/2},\n\t {x: startX - width/4 + width, y: startY + height/4},\n\t {x: startX - width/4 + width/2, y: startY + height/4 - height/2},\n\t {x: startX - width/4, y: startY + height/4}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t\n\t this.initialize();\n\t}\n\tinherits(Condition, Symbol);\n\t\n\tCondition.prototype.render = function() {\n\t\n\t if (this.yes_direction) {\n\t this[this.yes_direction + '_symbol'] = this.yes_symbol;\n\t }\n\t\n\t if (this.no_direction) {\n\t this[this.no_direction + '_symbol'] = this.no_symbol;\n\t }\n\t\n\t var lineLength = this.getAttr('line-length');\n\t\n\t if (this.bottom_symbol) {\n\t var bottomPoint = this.getBottom();\n\t\n\t if (!this.bottom_symbol.isPositioned) {\n\t this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n\t this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2);\n\t this.bottom_symbol.isPositioned = true;\n\t\n\t this.bottom_symbol.render();\n\t }\n\t }\n\t\n\t if (this.right_symbol) {\n\t var rightPoint = this.getRight();\n\t\n\t if (!this.right_symbol.isPositioned) {\n\t\n\t this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2);\n\t this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\t\n\t var self = this;\n\t (function shift() {\n\t var hasSymbolUnder = false;\n\t var symb;\n\t for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n\t symb = self.chart.symbols[i];\n\t\n\t var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n\t if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) {\n\t hasSymbolUnder = true;\n\t break;\n\t }\n\t }\n\t\n\t if (hasSymbolUnder) {\n\t self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n\t shift();\n\t }\n\t })();\n\t\n\t this.right_symbol.isPositioned = true;\n\t\n\t this.right_symbol.render();\n\t }\n\t }\n\t};\n\t\n\tCondition.prototype.renderLines = function() {\n\t if (this.yes_symbol) {\n\t this.drawLineTo(this.yes_symbol, this.getAttr('yes-text'), this.yes_direction);\n\t }\n\t\n\t if (this.no_symbol) {\n\t this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction);\n\t }\n\t};\n\t\n\tmodule.exports = Condition;\n\n\n/***/ },\n/* 6 */\n/*!********************************!*\\\n !*** ./src/flowchart.chart.js ***!\n \\********************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Raphael = __webpack_require__(/*! raphael */ 15);\n\tvar defaults = __webpack_require__(/*! ./flowchart.helpers */ 1).defaults;\n\tvar defaultOptions = __webpack_require__(/*! ./flowchart.defaults */ 7);\n\tvar Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5);\n\t\n\tfunction FlowChart(container, options) {\n\t options = options || {};\n\t\n\t this.paper = new Raphael(container);\n\t\n\t this.options = defaults(options, defaultOptions);\n\t\n\t this.symbols = [];\n\t this.lines = [];\n\t this.start = null;\n\t}\n\t\n\tFlowChart.prototype.handle = function(symbol) {\n\t if (this.symbols.indexOf(symbol) <= -1) {\n\t this.symbols.push(symbol);\n\t }\n\t\n\t var flowChart = this;\n\t\n\t if (symbol instanceof(Condition)) {\n\t symbol.yes = function(nextSymbol) {\n\t symbol.yes_symbol = nextSymbol;\n\t if(symbol.no_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t symbol.no = function(nextSymbol) {\n\t symbol.no_symbol = nextSymbol;\n\t if(symbol.yes_symbol) {\n\t symbol.pathOk = true;\n\t }\n\t return flowChart.handle(nextSymbol);\n\t };\n\t } else {\n\t symbol.then = function(nextSymbol) {\n\t symbol.next = nextSymbol;\n\t symbol.pathOk = true;\n\t return flowChart.handle(nextSymbol);\n\t };\n\t }\n\t\n\t return symbol;\n\t};\n\t\n\tFlowChart.prototype.startWith = function(symbol) {\n\t this.start = symbol;\n\t return this.handle(symbol);\n\t};\n\t\n\tFlowChart.prototype.render = function() {\n\t var maxWidth = 0,\n\t maxHeight = 0,\n\t i = 0,\n\t len = 0,\n\t maxX = 0,\n\t maxY = 0,\n\t symbol;\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t if (symbol.width > maxWidth) {\n\t maxWidth = symbol.width;\n\t }\n\t if (symbol.height > maxHeight) {\n\t maxHeight = symbol.height;\n\t }\n\t }\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']);\n\t symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']);\n\t }\n\t\n\t this.start.render();\n\t // for (i = 0, len = this.symbols.length; i < len; i++) {\n\t // symbol = this.symbols[i];\n\t // symbol.render();\n\t // }\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t symbol.renderLines();\n\t }\n\t\n\t maxX = this.maxXFromLine;\n\t\n\t for (i = 0, len = this.symbols.length; i < len; i++) {\n\t symbol = this.symbols[i];\n\t var x = symbol.getX() + symbol.width;\n\t var y = symbol.getY() + symbol.height;\n\t if (x > maxX) {\n\t maxX = x;\n\t }\n\t if (y > maxY) {\n\t maxY = y;\n\t }\n\t }\n\t\n\t var scale = this.options['scale'];\n\t var lineWidth = this.options['line-width'];\n\t this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale));\n\t this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true);\n\t};\n\t\n\tFlowChart.prototype.clean = function() {\n\t if (this.paper) {\n\t var paperDom = this.paper.canvas;\n\t paperDom.parentNode.removeChild(paperDom);\n\t }\n\t};\n\t\n\tmodule.exports = FlowChart;\n\n\n/***/ },\n/* 7 */\n/*!***********************************!*\\\n !*** ./src/flowchart.defaults.js ***!\n \\***********************************/\n/***/ function(module, exports) {\n\n\t// defaults\n\tmodule.exports = {\n\t 'x': 0,\n\t 'y': 0,\n\t 'line-width': 3,\n\t 'line-length': 50,\n\t 'text-margin': 10,\n\t 'font-size': 14,\n\t 'font-color': 'black',\n\t // 'font': 'normal',\n\t // 'font-family': 'calibri',\n\t // 'font-weight': 'normal',\n\t 'line-color': 'black',\n\t 'element-color': 'black',\n\t 'fill': 'white',\n\t 'yes-text': 'yes',\n\t 'no-text': 'no',\n\t 'arrow-end': 'block',\n\t 'class': 'flowchart',\n\t 'scale': 1,\n\t 'symbols': {\n\t 'start': {},\n\t 'end': {},\n\t 'condition': {},\n\t 'inputoutput': {},\n\t 'operation': {},\n\t 'subroutine': {}\n\t }//,\n\t // 'flowstate' : {\n\t // 'past' : { 'fill': '#CCCCCC', 'font-size': 12},\n\t // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'},\n\t // 'future' : { 'fill': '#FFFF99'},\n\t // 'invalid': {'fill': '#444444'}\n\t // }\n\t};\n\n\n/***/ },\n/* 8 */\n/*!*******************************!*\\\n !*** ./src/flowchart.shim.js ***!\n \\*******************************/\n/***/ function(module, exports) {\n\n\t// add indexOf to non ECMA-262 standard compliant browsers\n\tif (!Array.prototype.indexOf) {\n\t Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\n\t \"use strict\";\n\t if (this === null) {\n\t throw new TypeError();\n\t }\n\t var t = Object(this);\n\t var len = t.length >>> 0;\n\t if (len === 0) {\n\t return -1;\n\t }\n\t var n = 0;\n\t if (arguments.length > 0) {\n\t n = Number(arguments[1]);\n\t if (n != n) { // shortcut for verifying if it's NaN\n\t n = 0;\n\t } else if (n !== 0 && n != Infinity && n != -Infinity) {\n\t n = (n > 0 || -1) * Math.floor(Math.abs(n));\n\t }\n\t }\n\t if (n >= len) {\n\t return -1;\n\t }\n\t var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\n\t for (; k < len; k++) {\n\t if (k in t && t[k] === searchElement) {\n\t return k;\n\t }\n\t }\n\t return -1;\n\t };\n\t}\n\t\n\t// add lastIndexOf to non ECMA-262 standard compliant browsers\n\tif (!Array.prototype.lastIndexOf) {\n\t Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {\n\t \"use strict\";\n\t if (this === null) {\n\t throw new TypeError();\n\t }\n\t var t = Object(this);\n\t var len = t.length >>> 0;\n\t if (len === 0) {\n\t return -1;\n\t }\n\t var n = len;\n\t if (arguments.length > 1) {\n\t n = Number(arguments[1]);\n\t if (n != n) {\n\t n = 0;\n\t } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) {\n\t n = (n > 0 || -1) * Math.floor(Math.abs(n));\n\t }\n\t }\n\t var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);\n\t for (; k >= 0; k--) {\n\t if (k in t && t[k] === searchElement) {\n\t return k;\n\t }\n\t }\n\t return -1;\n\t };\n\t}\n\t\n\tif (!String.prototype.trim) {\n\t String.prototype.trim = function() {\n\t return this.replace(/^\\s+|\\s+$/g, '');\n\t };\n\t}\n\n/***/ },\n/* 9 */\n/*!*************************************!*\\\n !*** ./src/flowchart.symbol.end.js ***!\n \\*************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction End(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n\t options = options || {};\n\t options.text = options.text || 'End';\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(End, Symbol);\n\t\n\tmodule.exports = End;\n\n\n/***/ },\n/* 10 */\n/*!*********************************************!*\\\n !*** ./src/flowchart.symbol.inputoutput.js ***!\n \\*********************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\tvar drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3);\n\tvar drawPath = drawAPI.drawPath;\n\t\n\tfunction InputOutput(chart, options) {\n\t options = options || {};\n\t Symbol.call(this, chart, options);\n\t this.textMargin = this.getAttr('text-margin');\n\t\n\t this.text.attr({\n\t x: this.textMargin * 3\n\t });\n\t\n\t var width = this.text.getBBox().width + 4 * this.textMargin;\n\t var height = this.text.getBBox().height + 2 * this.textMargin;\n\t var startX = this.textMargin;\n\t var startY = height/2;\n\t\n\t var start = {x: startX, y: startY};\n\t var points = [\n\t {x: startX - this.textMargin, y: height},\n\t {x: startX - this.textMargin + width, y: height},\n\t {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n\t {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n\t {x: startX, y: startY}\n\t ];\n\t\n\t var symbol = drawPath(chart, start, points);\n\t\n\t symbol.attr({\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.link) { symbol.attr('href', options.link); }\n\t if (options.target) { symbol.attr('target', options.target); }\n\t if (options.key) { symbol.node.id = options.key; }\n\t symbol.node.setAttribute('class', this.getAttr('class'));\n\t\n\t this.text.attr({\n\t y: symbol.getBBox().height/2\n\t });\n\t\n\t this.group.push(symbol);\n\t symbol.insertBefore(this.text);\n\t\n\t this.initialize();\n\t}\n\tinherits(InputOutput, Symbol);\n\t\n\tInputOutput.prototype.getLeft = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tInputOutput.prototype.getRight = function() {\n\t var y = this.getY() + this.group.getBBox().height/2;\n\t var x = this.getX() + this.group.getBBox().width - this.textMargin;\n\t return {x: x, y: y};\n\t};\n\t\n\tmodule.exports = InputOutput;\n\n\n/***/ },\n/* 11 */\n/*!*******************************************!*\\\n !*** ./src/flowchart.symbol.operation.js ***!\n \\*******************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Operation(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(Operation, Symbol);\n\t\n\tmodule.exports = Operation;\n\n\n/***/ },\n/* 12 */\n/*!***************************************!*\\\n !*** ./src/flowchart.symbol.start.js ***!\n \\***************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Start(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n\t options = options || {};\n\t options.text = options.text || 'Start';\n\t Symbol.call(this, chart, options, symbol);\n\t}\n\tinherits(Start, Symbol);\n\t\n\tmodule.exports = Start;\n\t\n\t// Start.prototype.render = function() {\n\t// if (this.next) {\n\t// var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length'];\n\t\n\t// var bottomPoint = this.getBottom();\n\t// var topPoint = this.next.getTop();\n\t\n\t// if (!this.next.isPositioned) {\n\t// this.next.shiftY(this.getY() + this.height + lineLength);\n\t// this.next.setX(bottomPoint.x - this.next.width/2);\n\t// this.next.isPositioned = true;\n\t\n\t// this.next.render();\n\t// }\n\t// }\n\t// };\n\t\n\t// Start.prototype.renderLines = function() {\n\t// if (this.next) {\n\t// this.drawLineTo(this.next);\n\t// }\n\t// };\n\n\n/***/ },\n/* 13 */\n/*!********************************************!*\\\n !*** ./src/flowchart.symbol.subroutine.js ***!\n \\********************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2);\n\tvar inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits;\n\t\n\tfunction Subroutine(chart, options) {\n\t var symbol = chart.paper.rect(0, 0, 0, 0);\n\t options = options || {};\n\t Symbol.call(this, chart, options, symbol);\n\t\n\t symbol.attr({\n\t width: this.text.getBBox().width + 4 * this.getAttr('text-margin')\n\t });\n\t\n\t this.text.attr({\n\t 'x': 2 * this.getAttr('text-margin')\n\t });\n\t\n\t var innerWrap = chart.paper.rect(0, 0, 0, 0);\n\t innerWrap.attr({\n\t x: this.getAttr('text-margin'),\n\t stroke: this.getAttr('element-color'),\n\t 'stroke-width': this.getAttr('line-width'),\n\t width: this.text.getBBox().width + 2 * this.getAttr('text-margin'),\n\t height: this.text.getBBox().height + 2 * this.getAttr('text-margin'),\n\t fill: this.getAttr('fill')\n\t });\n\t if (options.key) { innerWrap.node.id = options.key + 'i'; }\n\t\n\t var font = this.getAttr('font');\n\t var fontF = this.getAttr('font-family');\n\t var fontW = this.getAttr('font-weight');\n\t\n\t if (font) innerWrap.attr({ 'font': font });\n\t if (fontF) innerWrap.attr({ 'font-family': fontF });\n\t if (fontW) innerWrap.attr({ 'font-weight': fontW });\n\t\n\t if (options.link) { innerWrap.attr('href', options.link); }\n\t if (options.target) { innerWrap.attr('target', options.target); }\n\t this.group.push(innerWrap);\n\t innerWrap.insertBefore(this.text);\n\t\n\t this.initialize();\n\t}\n\tinherits(Subroutine, Symbol);\n\t\n\tmodule.exports = Subroutine;\n\n\n/***/ },\n/* 14 */\n/*!******************************!*\\\n !*** ./src/jquery-plugin.js ***!\n \\******************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tif (typeof jQuery != 'undefined') {\n\t\tvar parse = __webpack_require__(/*! ./flowchart.parse */ 4);\n\t\t(function( $ ) {\n\t\t\t$.fn.flowChart = function( options ) {\n\t\t\t\treturn this.each(function() {\n\t\t\t\t\tvar $this = $(this);\n\t\t\t\t\tvar chart = parse($this.text());\n\t\t\t\t\t$this.html('');\n\t\t\t\t\tchart.drawSVG(this, options);\n\t\t\t\t});\n\t\t\t};\n\t\t})( jQuery ); // eslint-disable-line\n\t}\n\n\n/***/ },\n/* 15 */\n/*!**************************!*\\\n !*** external \"Raphael\" ***!\n \\**************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_15__;\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** flowchart.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 3956c0fd3abd37421728\n **/","require('./src/flowchart.shim');\nvar parse = require('./src/flowchart.parse');\nrequire('./src/jquery-plugin');\n\nvar FlowChart = {\n\tparse: parse\n};\n\nif (typeof window !== 'undefined') {\n\twindow.FlowChart = FlowChart;\n}\n\nmodule.exports = FlowChart;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./index.js\n ** module id = 0\n ** module chunks = 0\n **/","function _defaults(options, defaultOptions) {\n if (!options || typeof options === 'function') {\n return defaultOptions;\n }\n\n var merged = {};\n for (var attrname in defaultOptions) {\n merged[attrname] = defaultOptions[attrname];\n }\n\n for (attrname in options) {\n if (options[attrname]) {\n if (typeof merged[attrname] === 'object') {\n merged[attrname] = _defaults(merged[attrname], options[attrname]);\n } else {\n merged[attrname] = options[attrname];\n }\n }\n }\n return merged;\n}\n\nfunction _inherits(ctor, superCtor) {\n if (typeof(Object.create) === 'function') {\n // implementation from standard node.js 'util' module\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n } else {\n // old school shim for old browsers\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n}\n\n// move dependent functions to a container so that\n// they can be overriden easier in no jquery environment (node.js)\nmodule.exports = {\n defaults: _defaults,\n inherits: _inherits\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.helpers.js\n ** module id = 1\n ** module chunks = 0\n **/","var drawAPI = require('./flowchart.functions');\nvar drawLine = drawAPI.drawLine;\nvar checkLineIntersection = drawAPI.checkLineIntersection;\n\nfunction Symbol(chart, options, symbol) {\n this.chart = chart;\n this.group = this.chart.paper.set();\n this.symbol = symbol;\n this.connectedTo = [];\n this.symbolType = options.symbolType;\n this.flowstate = (options.flowstate || 'future');\n\n this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined;\n\n this.text = this.chart.paper.text(0, 0, options.text);\n //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t\n if (options.key) { this.text.node.id = options.key + 't'; }\n this.text.node.setAttribute('class', this.getAttr('class') + 't');\n\n this.text.attr({\n 'text-anchor': 'start',\n 'x' : this.getAttr('text-margin'),\n 'fill' : this.getAttr('font-color'),\n 'font-size' : this.getAttr('font-size')\n });\n\n var font = this.getAttr('font');\n var fontF = this.getAttr('font-family');\n var fontW = this.getAttr('font-weight');\n\n if (font) this.text.attr({ 'font': font });\n if (fontF) this.text.attr({ 'font-family': fontF });\n if (fontW) this.text.attr({ 'font-weight': fontW });\n\n if (options.link) { this.text.attr('href', options.link); }\n if (options.target) { this.text.attr('target', options.target); }\n\n var maxWidth = this.getAttr('maxWidth');\n if (maxWidth) {\n // using this approach: http://stackoverflow.com/a/3153457/22466\n var words = options.text.split(' ');\n var tempText = \"\";\n for (var i=0, ii=words.length; i maxWidth) {\n tempText += \"\\n\" + word;\n } else {\n tempText += \" \" + word;\n }\n }\n this.text.attr(\"text\", tempText.substring(1));\n }\n\n this.group.push(this.text);\n\n if (symbol) {\n var tmpMargin = this.getAttr('text-margin');\n\n symbol.attr({\n 'fill' : this.getAttr('fill'),\n 'stroke' : this.getAttr('element-color'),\n 'stroke-width' : this.getAttr('line-width'),\n 'width' : this.text.getBBox().width + 2 * tmpMargin,\n 'height' : this.text.getBBox().height + 2 * tmpMargin\n });\n\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n\n this.text.attr({\n 'y': symbol.getBBox().height/2\n });\n\n this.initialize();\n }\n\n}\n\n/* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */\nSymbol.prototype.getAttr = function(attName) {\n if (!this.chart) {\n return undefined;\n }\n var opt3 = (this.chart.options) ? this.chart.options[attName] : undefined;\n var opt2 = (this.chart.options.symbols) ? this.chart.options.symbols[this.symbolType][attName] : undefined;\n var opt1;\n if (this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate]) {\n opt1 = this.chart.options.flowstate[this.flowstate][attName];\n }\n return (opt1 || opt2 || opt3);\n};\n\nSymbol.prototype.initialize = function() {\n this.group.transform('t' + this.getAttr('line-width') + ',' + this.getAttr('line-width'));\n\n this.width = this.group.getBBox().width;\n this.height = this.group.getBBox().height;\n};\n\nSymbol.prototype.getCenter = function() {\n return {x: this.getX() + this.width/2,\n y: this.getY() + this.height/2};\n};\n\nSymbol.prototype.getX = function() {\n return this.group.getBBox().x;\n};\n\nSymbol.prototype.getY = function() {\n return this.group.getBBox().y;\n};\n\nSymbol.prototype.shiftX = function(x) {\n this.group.transform('t' + (this.getX() + x) + ',' + this.getY());\n};\n\nSymbol.prototype.setX = function(x) {\n this.group.transform('t' + x + ',' + this.getY());\n};\n\nSymbol.prototype.shiftY = function(y) {\n this.group.transform('t' + this.getX() + ',' + (this.getY() + y));\n};\n\nSymbol.prototype.setY = function(y) {\n this.group.transform('t' + this.getX() + ',' + y);\n};\n\nSymbol.prototype.getTop = function() {\n var y = this.getY();\n var x = this.getX() + this.width/2;\n return {x: x, y: y};\n};\n\nSymbol.prototype.getBottom = function() {\n var y = this.getY() + this.height;\n var x = this.getX() + this.width/2;\n return {x: x, y: y};\n};\n\nSymbol.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX();\n return {x: x, y: y};\n};\n\nSymbol.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width;\n return {x: x, y: y};\n};\n\nSymbol.prototype.render = function() {\n if (this.next) {\n\n var lineLength = this.getAttr('line-length');\n\n if (this.next_direction === 'right') {\n\n var rightPoint = this.getRight();\n\n if (!this.next.isPositioned) {\n\n this.next.setY(rightPoint.y - this.next.height/2);\n this.next.shiftX(this.group.getBBox().x + this.width + lineLength);\n\n var self = this;\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n var diff = Math.abs(symb.getCenter().x - self.next.getCenter().x);\n if (symb.getCenter().y > self.next.getCenter().y && diff <= self.next.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n\n if (hasSymbolUnder) {\n self.next.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.next.isPositioned = true;\n\n this.next.render();\n }\n } else {\n var bottomPoint = this.getBottom();\n\n if (!this.next.isPositioned) {\n this.next.shiftY(this.getY() + this.height + lineLength);\n this.next.setX(bottomPoint.x - this.next.width/2);\n this.next.isPositioned = true;\n\n this.next.render();\n }\n }\n }\n};\n\nSymbol.prototype.renderLines = function() {\n if (this.next) {\n if (this.next_direction) {\n this.drawLineTo(this.next, '', this.next_direction);\n } else {\n this.drawLineTo(this.next);\n }\n }\n};\n\nSymbol.prototype.drawLineTo = function(symbol, text, origin) {\n if (this.connectedTo.indexOf(symbol) < 0) {\n this.connectedTo.push(symbol);\n }\n\n var x = this.getCenter().x,\n y = this.getCenter().y,\n right = this.getRight(),\n bottom = this.getBottom(),\n left = this.getLeft();\n\n var symbolX = symbol.getCenter().x,\n symbolY = symbol.getCenter().y,\n symbolTop = symbol.getTop(),\n symbolRight = symbol.getRight(),\n symbolLeft = symbol.getLeft();\n\n var isOnSameColumn = x === symbolX,\n isOnSameLine = y === symbolY,\n isUnder = y < symbolY,\n isUpper = y > symbolY,\n isLeft = x > symbolX,\n isRight = x < symbolX;\n\n var maxX = 0,\n line,\n lineLength = this.getAttr('line-length'),\n lineWith = this.getAttr('line-width');\n\n if ((!origin || origin === 'bottom') && isOnSameColumn && isUnder) {\n line = drawLine(this.chart, bottom, symbolTop, text);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x;\n } else if ((!origin || origin === 'right') && isOnSameLine && isRight) {\n line = drawLine(this.chart, right, symbolLeft, text);\n this.rightStart = true;\n symbol.leftEnd = true;\n maxX = symbolLeft.x;\n } else if ((!origin || origin === 'left') && isOnSameLine && isLeft) {\n line = drawLine(this.chart, left, symbolRight, text);\n this.leftStart = true;\n symbol.rightEnd = true;\n maxX = symbolRight.x;\n } else if ((!origin || origin === 'right') && isOnSameColumn && isUpper) {\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((!origin || origin === 'right') && isOnSameColumn && isUnder) {\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((!origin || origin === 'bottom') && isLeft) {\n if (this.leftEnd && isUpper) {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n } else {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n }\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n } else if ((!origin || origin === 'bottom') && isRight) {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: bottom.y + lineLength/2},\n {x: bottom.x + (bottom.x - symbolTop.x)/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + (bottom.x - symbolTop.x)/2;\n } else if ((origin && origin === 'right') && isLeft) {\n line = drawLine(this.chart, right, [\n {x: right.x + lineLength/2, y: right.y},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((origin && origin === 'right') && isRight) {\n line = drawLine(this.chart, right, [\n {x: symbolTop.x, y: right.y},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.rightStart = true;\n symbol.topEnd = true;\n maxX = right.x + lineLength/2;\n } else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) {\n line = drawLine(this.chart, bottom, [\n {x: bottom.x, y: bottom.y + lineLength/2},\n {x: right.x + lineLength/2, y: bottom.y + lineLength/2},\n {x: right.x + lineLength/2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.bottomStart = true;\n symbol.topEnd = true;\n maxX = bottom.x + lineLength/2;\n } else if ((origin === 'left') && isOnSameColumn && isUpper) {\n var diffX = left.x - lineLength/2;\n if (symbolLeft.x < left.x) {\n diffX = symbolLeft.x - lineLength/2;\n }\n line = drawLine(this.chart, left, [\n {x: diffX, y: left.y},\n {x: diffX, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.leftStart = true;\n symbol.topEnd = true;\n maxX = left.x;\n } else if ((origin === 'left')) {\n line = drawLine(this.chart, left, [\n {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y},\n {x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y - lineLength/2},\n {x: symbolTop.x, y: symbolTop.y}\n ], text);\n this.leftStart = true;\n symbol.topEnd = true;\n maxX = left.x;\n }\n\n if (line) {\n for (var l = 0, llen = this.chart.lines.length; l < llen; l++) {\n var otherLine = this.chart.lines[l];\n var len;\n\n var ePath = otherLine.attr('path'),\n lPath = line.attr('path');\n\n for (var iP = 0, lenP = ePath.length - 1; iP < lenP; iP++) {\n var newPath = [];\n newPath.push(['M', ePath[iP][1], ePath[iP][2]]);\n newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]]);\n\n var line1_from_x = newPath[0][1];\n var line1_from_y = newPath[0][2];\n var line1_to_x = newPath[1][1];\n var line1_to_y = newPath[1][2];\n\n for (var lP = 0, lenlP = lPath.length - 1; lP < lenlP; lP++) {\n var newLinePath = [];\n newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]);\n newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]]);\n\n var line2_from_x = newLinePath[0][1];\n var line2_from_y = newLinePath[0][2];\n var line2_to_x = newLinePath[1][1];\n var line2_to_y = newLinePath[1][2];\n\n var res = checkLineIntersection(line1_from_x, line1_from_y, line1_to_x, line1_to_y, line2_from_x, line2_from_y, line2_to_x, line2_to_y);\n if (res.onLine1 && res.onLine2) {\n\n var newSegment;\n if (line2_from_y === line2_to_y) {\n if (line2_from_x > line2_to_x) {\n newSegment = ['L', res.x + lineWith * 2, line2_from_y];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', res.x + lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x - lineWith * 2, line2_from_y];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n } else {\n newSegment = ['L', res.x - lineWith * 2, line2_from_y];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', res.x - lineWith * 2, line2_from_y, res.x, line2_from_y - lineWith * 4, res.x + lineWith * 2, line2_from_y];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n }\n } else {\n if (line2_from_y > line2_to_y) {\n newSegment = ['L', line2_from_x, res.y + lineWith * 2];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', line2_from_x, res.y + lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y - lineWith * 2];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n } else {\n newSegment = ['L', line2_from_x, res.y - lineWith * 2];\n lPath.splice(lP + 1, 0, newSegment);\n newSegment = ['C', line2_from_x, res.y - lineWith * 2, line2_from_x + lineWith * 4, res.y, line2_from_x, res.y + lineWith * 2];\n lPath.splice(lP + 2, 0, newSegment);\n line.attr('path', lPath);\n }\n }\n\n lP += 2;\n len += 2;\n }\n }\n }\n }\n\n this.chart.lines.push(line);\n }\n\n if (!this.chart.maxXFromLine || (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) {\n this.chart.maxXFromLine = maxX;\n }\n};\n\nmodule.exports = Symbol;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.js\n ** module id = 2\n ** module chunks = 0\n **/","function drawPath(chart, location, points) {\n var i, len;\n var path = 'M{0},{1}';\n for (i = 2, len = 2 * points.length + 2; i < len; i+=2) {\n path += ' L{' + i + '},{' + (i + 1) + '}';\n }\n var pathValues = [location.x, location.y];\n for (i = 0, len = points.length; i < len; i++) {\n pathValues.push(points[i].x);\n pathValues.push(points[i].y);\n }\n var symbol = chart.paper.path(path, pathValues);\n symbol.attr('stroke', chart.options['element-color']);\n symbol.attr('stroke-width', chart.options['line-width']);\n\n var font = chart.options.font;\n var fontF = chart.options['font-family'];\n var fontW = chart.options['font-weight'];\n\n if (font) symbol.attr({ 'font': font });\n if (fontF) symbol.attr({ 'font-family': fontF });\n if (fontW) symbol.attr({ 'font-weight': fontW });\n\n return symbol;\n}\n\nfunction drawLine(chart, from, to, text) {\n var i, len;\n\n if (Object.prototype.toString.call(to) !== '[object Array]') {\n to = [to];\n }\n\n var path = 'M{0},{1}';\n for (i = 2, len = 2 * to.length + 2; i < len; i+=2) {\n path += ' L{' + i + '},{' + (i + 1) + '}';\n }\n var pathValues = [from.x, from.y];\n for (i = 0, len = to.length; i < len; i++) {\n pathValues.push(to[i].x);\n pathValues.push(to[i].y);\n }\n\n var line = chart.paper.path(path, pathValues);\n line.attr({\n stroke: chart.options['line-color'],\n 'stroke-width': chart.options['line-width'],\n 'arrow-end': chart.options['arrow-end']\n });\n\n var font = chart.options.font;\n var fontF = chart.options['font-family'];\n var fontW = chart.options['font-weight'];\n\n if (font) line.attr({ 'font': font });\n if (fontF) line.attr({ 'font-family': fontF });\n if (fontW) line.attr({ 'font-weight': fontW });\n\n if (text) {\n\n var centerText = false;\n\n var textPath = chart.paper.text(0, 0, text);\n\n var isHorizontal = false;\n var firstTo = to[0];\n\n if (from.y === firstTo.y) {\n isHorizontal = true;\n }\n\n var x = 0,\n y = 0;\n\n if (centerText) {\n if (from.x > firstTo.x) {\n x = from.x - (from.x - firstTo.x)/2;\n } else {\n x = firstTo.x - (firstTo.x - from.x)/2;\n }\n\n if (from.y > firstTo.y) {\n y = from.y - (from.y - firstTo.y)/2;\n } else {\n y = firstTo.y - (firstTo.y - from.y)/2;\n }\n\n if (isHorizontal) {\n x -= textPath.getBBox().width/2;\n y -= chart.options['text-margin'];\n } else {\n x += chart.options['text-margin'];\n y -= textPath.getBBox().height/2;\n }\n } else {\n x = from.x;\n y = from.y;\n\n if (isHorizontal) {\n x += chart.options['text-margin']/2;\n y -= chart.options['text-margin'];\n } else {\n x += chart.options['text-margin']/2;\n y += chart.options['text-margin'];\n }\n }\n\n textPath.attr({\n 'text-anchor': 'start',\n 'font-size': chart.options['font-size'],\n 'fill': chart.options['font-color'],\n x: x,\n y: y\n });\n\n if (font) textPath.attr({ 'font': font });\n if (fontF) textPath.attr({ 'font-family': fontF });\n if (fontW) textPath.attr({ 'font-weight': fontW });\n }\n\n return line;\n}\n\nfunction checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {\n // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point\n var denominator, a, b, numerator1, numerator2, result = {\n x: null,\n y: null,\n onLine1: false,\n onLine2: false\n };\n denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY));\n if (denominator === 0) {\n return result;\n }\n a = line1StartY - line2StartY;\n b = line1StartX - line2StartX;\n numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);\n numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);\n a = numerator1 / denominator;\n b = numerator2 / denominator;\n\n // if we cast these lines infinitely in both directions, they intersect here:\n result.x = line1StartX + (a * (line1EndX - line1StartX));\n result.y = line1StartY + (a * (line1EndY - line1StartY));\n /*\n // it is worth noting that this should be the same as:\n x = line2StartX + (b * (line2EndX - line2StartX));\n y = line2StartX + (b * (line2EndY - line2StartY));\n */\n // if line1 is a segment and line2 is infinite, they intersect if:\n if (a > 0 && a < 1) {\n result.onLine1 = true;\n }\n // if line2 is a segment and line1 is infinite, they intersect if:\n if (b > 0 && b < 1) {\n result.onLine2 = true;\n }\n // if line1 and line2 are segments, they intersect if both of the above are true\n return result;\n}\n\nmodule.exports = {\n\tdrawPath: drawPath,\n\tdrawLine: drawLine,\n\tcheckLineIntersection: checkLineIntersection\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.functions.js\n ** module id = 3\n ** module chunks = 0\n **/","var FlowChart = require('./flowchart.chart');\nvar Start = require('./flowchart.symbol.start');\nvar End = require('./flowchart.symbol.end');\nvar Operation = require('./flowchart.symbol.operation');\nvar InputOutput = require('./flowchart.symbol.inputoutput');\nvar Subroutine = require('./flowchart.symbol.subroutine');\nvar Condition = require('./flowchart.symbol.condition');\n\nfunction parse(input) {\n input = input || '';\n input = input.trim();\n\n var chart = {\n symbols: {},\n start: null,\n drawSVG: function(container, options) {\n var self = this;\n\n if (this.diagram) {\n this.diagram.clean();\n }\n\n var diagram = new FlowChart(container, options);\n this.diagram = diagram;\n var dispSymbols = {};\n\n function getDisplaySymbol(s) {\n if (dispSymbols[s.key]) {\n return dispSymbols[s.key];\n }\n\n switch (s.symbolType) {\n case 'start':\n dispSymbols[s.key] = new Start(diagram, s);\n break;\n case 'end':\n dispSymbols[s.key] = new End(diagram, s);\n break;\n case 'operation':\n dispSymbols[s.key] = new Operation(diagram, s);\n break;\n case 'inputoutput':\n dispSymbols[s.key] = new InputOutput(diagram, s);\n break;\n case 'subroutine':\n dispSymbols[s.key] = new Subroutine(diagram, s);\n break;\n case 'condition':\n dispSymbols[s.key] = new Condition(diagram, s);\n break;\n default:\n return new Error('Wrong symbol type!');\n }\n\n return dispSymbols[s.key];\n }\n\n (function constructChart(s, prevDisp, prev) {\n var dispSymb = getDisplaySymbol(s);\n\n if (self.start === s) {\n diagram.startWith(dispSymb);\n } else if (prevDisp && prev && !prevDisp.pathOk) {\n if (prevDisp instanceof(Condition)) {\n if (prev.yes === s) {\n prevDisp.yes(dispSymb);\n }\n if (prev.no === s) {\n prevDisp.no(dispSymb);\n }\n } else {\n prevDisp.then(dispSymb);\n }\n }\n\n if (dispSymb.pathOk) {\n return dispSymb;\n }\n\n if (dispSymb instanceof(Condition)) {\n if (s.yes) {\n constructChart(s.yes, dispSymb, s);\n }\n if (s.no) {\n constructChart(s.no, dispSymb, s);\n }\n } else if (s.next) {\n constructChart(s.next, dispSymb, s);\n }\n\n return dispSymb;\n })(this.start);\n\n diagram.render();\n },\n clean: function() {\n this.diagram.clean();\n }\n };\n\n var lines = [];\n var prevBreak = 0;\n for (var i0 = 1, i0len = input.length; i0 < i0len; i0++) {\n if(input[i0] === '\\n' && input[i0 - 1] !== '\\\\') {\n var line0 = input.substring(prevBreak, i0);\n prevBreak = i0 + 1;\n lines.push(line0.replace(/\\\\\\n/g, '\\n'));\n }\n }\n\n if(prevBreak < input.length) {\n lines.push(input.substr(prevBreak));\n }\n\n for (var l = 1, len = lines.length; l < len;) {\n var currentLine = lines[l];\n\n if (currentLine.indexOf('->') < 0 && currentLine.indexOf('=>') < 0) {\n lines[l - 1] += '\\n' + currentLine;\n lines.splice(l, 1);\n len--;\n } else {\n l++;\n }\n }\n\n function getSymbol(s) {\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n return chart.symbols[s.substring(0, startIndex - 1)];\n }\n return chart.symbols[s];\n }\n\n function getNextPath(s) {\n var next = 'next';\n var startIndex = s.indexOf('(') + 1;\n var endIndex = s.indexOf(')');\n if (startIndex >= 0 && endIndex >= 0) {\n next = flowSymb.substring(startIndex, endIndex);\n if (next.indexOf(',') < 0) {\n if (next !== 'yes' && next !== 'no') {\n next = 'next, ' + next;\n }\n }\n }\n return next;\n }\n\n while (lines.length > 0) {\n var line = lines.splice(0, 1)[0];\n\n if (line.indexOf('=>') >= 0) {\n // definition\n var parts = line.split('=>');\n var symbol = {\n key: parts[0],\n symbolType: parts[1],\n text: null,\n link: null,\n target: null,\n flowstate: null\n };\n\n var sub;\n\n if (symbol.symbolType.indexOf(': ') >= 0) {\n sub = symbol.symbolType.split(': ');\n symbol.symbolType = sub.shift();\n symbol.text = sub.join(': ');\n }\n\n if (symbol.text && symbol.text.indexOf(':>') >= 0) {\n sub = symbol.text.split(':>');\n symbol.text = sub.shift();\n symbol.link = sub.join(':>');\n } else if (symbol.symbolType.indexOf(':>') >= 0) {\n sub = symbol.symbolType.split(':>');\n symbol.symbolType = sub.shift();\n symbol.link = sub.join(':>');\n }\n\n if (symbol.symbolType.indexOf('\\n') >= 0) {\n symbol.symbolType = symbol.symbolType.split('\\n')[0];\n }\n\n /* adding support for links */\n if (symbol.link) {\n var startIndex = symbol.link.indexOf('[') + 1;\n var endIndex = symbol.link.indexOf(']');\n if (startIndex >= 0 && endIndex >= 0) {\n symbol.target = symbol.link.substring(startIndex, endIndex);\n symbol.link = symbol.link.substring(0, startIndex - 1);\n }\n }\n /* end of link support */\n\n /* adding support for flowstates */\n if (symbol.text) {\n if (symbol.text.indexOf('|') >= 0) {\n var txtAndState = symbol.text.split('|');\n symbol.flowstate = txtAndState.pop().trim();\n symbol.text = txtAndState.join('|');\n }\n }\n /* end of flowstate support */\n\n chart.symbols[symbol.key] = symbol;\n\n } else if (line.indexOf('->') >= 0) {\n // flow\n var flowSymbols = line.split('->');\n for (var i = 0, lenS = flowSymbols.length; i < lenS; i++) {\n var flowSymb = flowSymbols[i];\n\n var realSymb = getSymbol(flowSymb);\n var next = getNextPath(flowSymb);\n\n var direction = null;\n if (next.indexOf(',') >= 0) {\n var condOpt = next.split(',');\n next = condOpt[0];\n direction = condOpt[1].trim();\n }\n\n if (!chart.start) {\n chart.start = realSymb;\n }\n\n if (i + 1 < lenS) {\n var nextSymb = flowSymbols[i + 1];\n realSymb[next] = getSymbol(nextSymb);\n realSymb['direction_' + next] = direction;\n direction = null;\n }\n }\n }\n\n }\n return chart;\n}\n\nmodule.exports = parse;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.parse.js\n ** module id = 4\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction Condition(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n this.yes_direction = 'bottom';\n this.no_direction = 'right';\n if (options.yes && options.direction_yes && options.no && !options.direction_no) {\n if (options.direction_yes === 'right') {\n this.no_direction = 'bottom';\n this.yes_direction = 'right';\n } else {\n this.no_direction = 'right';\n this.yes_direction = 'bottom';\n }\n } else if (options.yes && !options.direction_yes && options.no && options.direction_no) {\n if (options.direction_no === 'right') {\n this.yes_direction = 'bottom';\n this.no_direction = 'right';\n } else {\n this.yes_direction = 'right';\n this.no_direction = 'bottom';\n }\n } else {\n this.yes_direction = 'bottom';\n this.no_direction = 'right';\n }\n\n this.yes_direction = this.yes_direction || 'bottom';\n this.no_direction = this.no_direction || 'right';\n\n this.text.attr({\n x: this.textMargin * 2\n });\n\n var width = this.text.getBBox().width + 3 * this.textMargin;\n width += width/2;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n height += height/2;\n height = Math.max(width * 0.5, height);\n var startX = width/4;\n var startY = height/4;\n\n this.text.attr({\n x: startX + this.textMargin/2\n });\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - width/4, y: startY + height/4},\n {x: startX - width/4 + width/2, y: startY + height/4 + height/2},\n {x: startX - width/4 + width, y: startY + height/4},\n {x: startX - width/4 + width/2, y: startY + height/4 - height/2},\n {x: startX - width/4, y: startY + height/4}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n\n this.initialize();\n}\ninherits(Condition, Symbol);\n\nCondition.prototype.render = function() {\n\n if (this.yes_direction) {\n this[this.yes_direction + '_symbol'] = this.yes_symbol;\n }\n\n if (this.no_direction) {\n this[this.no_direction + '_symbol'] = this.no_symbol;\n }\n\n var lineLength = this.getAttr('line-length');\n\n if (this.bottom_symbol) {\n var bottomPoint = this.getBottom();\n\n if (!this.bottom_symbol.isPositioned) {\n this.bottom_symbol.shiftY(this.getY() + this.height + lineLength);\n this.bottom_symbol.setX(bottomPoint.x - this.bottom_symbol.width/2);\n this.bottom_symbol.isPositioned = true;\n\n this.bottom_symbol.render();\n }\n }\n\n if (this.right_symbol) {\n var rightPoint = this.getRight();\n\n if (!this.right_symbol.isPositioned) {\n\n this.right_symbol.setY(rightPoint.y - this.right_symbol.height/2);\n this.right_symbol.shiftX(this.group.getBBox().x + this.width + lineLength);\n\n var self = this;\n (function shift() {\n var hasSymbolUnder = false;\n var symb;\n for (var i = 0, len = self.chart.symbols.length; i < len; i++) {\n symb = self.chart.symbols[i];\n\n var diff = Math.abs(symb.getCenter().x - self.right_symbol.getCenter().x);\n if (symb.getCenter().y > self.right_symbol.getCenter().y && diff <= self.right_symbol.width/2) {\n hasSymbolUnder = true;\n break;\n }\n }\n\n if (hasSymbolUnder) {\n self.right_symbol.setX(symb.getX() + symb.width + lineLength);\n shift();\n }\n })();\n\n this.right_symbol.isPositioned = true;\n\n this.right_symbol.render();\n }\n }\n};\n\nCondition.prototype.renderLines = function() {\n if (this.yes_symbol) {\n this.drawLineTo(this.yes_symbol, this.getAttr('yes-text'), this.yes_direction);\n }\n\n if (this.no_symbol) {\n this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction);\n }\n};\n\nmodule.exports = Condition;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.condition.js\n ** module id = 5\n ** module chunks = 0\n **/","var Raphael = require('raphael');\nvar defaults = require('./flowchart.helpers').defaults;\nvar defaultOptions = require('./flowchart.defaults');\nvar Condition = require('./flowchart.symbol.condition');\n\nfunction FlowChart(container, options) {\n options = options || {};\n\n this.paper = new Raphael(container);\n\n this.options = defaults(options, defaultOptions);\n\n this.symbols = [];\n this.lines = [];\n this.start = null;\n}\n\nFlowChart.prototype.handle = function(symbol) {\n if (this.symbols.indexOf(symbol) <= -1) {\n this.symbols.push(symbol);\n }\n\n var flowChart = this;\n\n if (symbol instanceof(Condition)) {\n symbol.yes = function(nextSymbol) {\n symbol.yes_symbol = nextSymbol;\n if(symbol.no_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n symbol.no = function(nextSymbol) {\n symbol.no_symbol = nextSymbol;\n if(symbol.yes_symbol) {\n symbol.pathOk = true;\n }\n return flowChart.handle(nextSymbol);\n };\n } else {\n symbol.then = function(nextSymbol) {\n symbol.next = nextSymbol;\n symbol.pathOk = true;\n return flowChart.handle(nextSymbol);\n };\n }\n\n return symbol;\n};\n\nFlowChart.prototype.startWith = function(symbol) {\n this.start = symbol;\n return this.handle(symbol);\n};\n\nFlowChart.prototype.render = function() {\n var maxWidth = 0,\n maxHeight = 0,\n i = 0,\n len = 0,\n maxX = 0,\n maxY = 0,\n symbol;\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n if (symbol.width > maxWidth) {\n maxWidth = symbol.width;\n }\n if (symbol.height > maxHeight) {\n maxHeight = symbol.height;\n }\n }\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']);\n symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']);\n }\n\n this.start.render();\n // for (i = 0, len = this.symbols.length; i < len; i++) {\n // symbol = this.symbols[i];\n // symbol.render();\n // }\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n symbol.renderLines();\n }\n\n maxX = this.maxXFromLine;\n\n for (i = 0, len = this.symbols.length; i < len; i++) {\n symbol = this.symbols[i];\n var x = symbol.getX() + symbol.width;\n var y = symbol.getY() + symbol.height;\n if (x > maxX) {\n maxX = x;\n }\n if (y > maxY) {\n maxY = y;\n }\n }\n\n var scale = this.options['scale'];\n var lineWidth = this.options['line-width'];\n this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale));\n this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true);\n};\n\nFlowChart.prototype.clean = function() {\n if (this.paper) {\n var paperDom = this.paper.canvas;\n paperDom.parentNode.removeChild(paperDom);\n }\n};\n\nmodule.exports = FlowChart;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.chart.js\n ** module id = 6\n ** module chunks = 0\n **/","// defaults\nmodule.exports = {\n 'x': 0,\n 'y': 0,\n 'line-width': 3,\n 'line-length': 50,\n 'text-margin': 10,\n 'font-size': 14,\n 'font-color': 'black',\n // 'font': 'normal',\n // 'font-family': 'calibri',\n // 'font-weight': 'normal',\n 'line-color': 'black',\n 'element-color': 'black',\n 'fill': 'white',\n 'yes-text': 'yes',\n 'no-text': 'no',\n 'arrow-end': 'block',\n 'class': 'flowchart',\n 'scale': 1,\n 'symbols': {\n 'start': {},\n 'end': {},\n 'condition': {},\n 'inputoutput': {},\n 'operation': {},\n 'subroutine': {}\n }//,\n // 'flowstate' : {\n // 'past' : { 'fill': '#CCCCCC', 'font-size': 12},\n // 'current' : {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'},\n // 'future' : { 'fill': '#FFFF99'},\n // 'invalid': {'fill': '#444444'}\n // }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.defaults.js\n ** module id = 7\n ** module chunks = 0\n **/","// add indexOf to non ECMA-262 standard compliant browsers\nif (!Array.prototype.indexOf) {\n Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\n \"use strict\";\n if (this === null) {\n throw new TypeError();\n }\n var t = Object(this);\n var len = t.length >>> 0;\n if (len === 0) {\n return -1;\n }\n var n = 0;\n if (arguments.length > 0) {\n n = Number(arguments[1]);\n if (n != n) { // shortcut for verifying if it's NaN\n n = 0;\n } else if (n !== 0 && n != Infinity && n != -Infinity) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n }\n if (n >= len) {\n return -1;\n }\n var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\n for (; k < len; k++) {\n if (k in t && t[k] === searchElement) {\n return k;\n }\n }\n return -1;\n };\n}\n\n// add lastIndexOf to non ECMA-262 standard compliant browsers\nif (!Array.prototype.lastIndexOf) {\n Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {\n \"use strict\";\n if (this === null) {\n throw new TypeError();\n }\n var t = Object(this);\n var len = t.length >>> 0;\n if (len === 0) {\n return -1;\n }\n var n = len;\n if (arguments.length > 1) {\n n = Number(arguments[1]);\n if (n != n) {\n n = 0;\n } else if (n !== 0 && n != (1 / 0) && n != -(1 / 0)) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n }\n var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);\n for (; k >= 0; k--) {\n if (k in t && t[k] === searchElement) {\n return k;\n }\n }\n return -1;\n };\n}\n\nif (!String.prototype.trim) {\n String.prototype.trim = function() {\n return this.replace(/^\\s+|\\s+$/g, '');\n };\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.shim.js\n ** module id = 8\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction End(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n options = options || {};\n options.text = options.text || 'End';\n Symbol.call(this, chart, options, symbol);\n}\ninherits(End, Symbol);\n\nmodule.exports = End;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.end.js\n ** module id = 9\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\nvar drawAPI = require('./flowchart.functions');\nvar drawPath = drawAPI.drawPath;\n\nfunction InputOutput(chart, options) {\n options = options || {};\n Symbol.call(this, chart, options);\n this.textMargin = this.getAttr('text-margin');\n\n this.text.attr({\n x: this.textMargin * 3\n });\n\n var width = this.text.getBBox().width + 4 * this.textMargin;\n var height = this.text.getBBox().height + 2 * this.textMargin;\n var startX = this.textMargin;\n var startY = height/2;\n\n var start = {x: startX, y: startY};\n var points = [\n {x: startX - this.textMargin, y: height},\n {x: startX - this.textMargin + width, y: height},\n {x: startX - this.textMargin + width + 2 * this.textMargin, y: 0},\n {x: startX - this.textMargin + 2 * this.textMargin, y: 0},\n {x: startX, y: startY}\n ];\n\n var symbol = drawPath(chart, start, points);\n\n symbol.attr({\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n fill: this.getAttr('fill')\n });\n if (options.link) { symbol.attr('href', options.link); }\n if (options.target) { symbol.attr('target', options.target); }\n if (options.key) { symbol.node.id = options.key; }\n symbol.node.setAttribute('class', this.getAttr('class'));\n\n this.text.attr({\n y: symbol.getBBox().height/2\n });\n\n this.group.push(symbol);\n symbol.insertBefore(this.text);\n\n this.initialize();\n}\ninherits(InputOutput, Symbol);\n\nInputOutput.prototype.getLeft = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.textMargin;\n return {x: x, y: y};\n};\n\nInputOutput.prototype.getRight = function() {\n var y = this.getY() + this.group.getBBox().height/2;\n var x = this.getX() + this.group.getBBox().width - this.textMargin;\n return {x: x, y: y};\n};\n\nmodule.exports = InputOutput;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.inputoutput.js\n ** module id = 10\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Operation(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n}\ninherits(Operation, Symbol);\n\nmodule.exports = Operation;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.operation.js\n ** module id = 11\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Start(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0, 20);\n options = options || {};\n options.text = options.text || 'Start';\n Symbol.call(this, chart, options, symbol);\n}\ninherits(Start, Symbol);\n\nmodule.exports = Start;\n\n// Start.prototype.render = function() {\n// if (this.next) {\n// var lineLength = this.chart.options.symbols[this.symbolType]['line-length'] || this.chart.options['line-length'];\n\n// var bottomPoint = this.getBottom();\n// var topPoint = this.next.getTop();\n\n// if (!this.next.isPositioned) {\n// this.next.shiftY(this.getY() + this.height + lineLength);\n// this.next.setX(bottomPoint.x - this.next.width/2);\n// this.next.isPositioned = true;\n\n// this.next.render();\n// }\n// }\n// };\n\n// Start.prototype.renderLines = function() {\n// if (this.next) {\n// this.drawLineTo(this.next);\n// }\n// };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.start.js\n ** module id = 12\n ** module chunks = 0\n **/","var Symbol = require('./flowchart.symbol');\nvar inherits = require('./flowchart.helpers').inherits;\n\nfunction Subroutine(chart, options) {\n var symbol = chart.paper.rect(0, 0, 0, 0);\n options = options || {};\n Symbol.call(this, chart, options, symbol);\n\n symbol.attr({\n width: this.text.getBBox().width + 4 * this.getAttr('text-margin')\n });\n\n this.text.attr({\n 'x': 2 * this.getAttr('text-margin')\n });\n\n var innerWrap = chart.paper.rect(0, 0, 0, 0);\n innerWrap.attr({\n x: this.getAttr('text-margin'),\n stroke: this.getAttr('element-color'),\n 'stroke-width': this.getAttr('line-width'),\n width: this.text.getBBox().width + 2 * this.getAttr('text-margin'),\n height: this.text.getBBox().height + 2 * this.getAttr('text-margin'),\n fill: this.getAttr('fill')\n });\n if (options.key) { innerWrap.node.id = options.key + 'i'; }\n\n var font = this.getAttr('font');\n var fontF = this.getAttr('font-family');\n var fontW = this.getAttr('font-weight');\n\n if (font) innerWrap.attr({ 'font': font });\n if (fontF) innerWrap.attr({ 'font-family': fontF });\n if (fontW) innerWrap.attr({ 'font-weight': fontW });\n\n if (options.link) { innerWrap.attr('href', options.link); }\n if (options.target) { innerWrap.attr('target', options.target); }\n this.group.push(innerWrap);\n innerWrap.insertBefore(this.text);\n\n this.initialize();\n}\ninherits(Subroutine, Symbol);\n\nmodule.exports = Subroutine;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/flowchart.symbol.subroutine.js\n ** module id = 13\n ** module chunks = 0\n **/","if (typeof jQuery != 'undefined') {\n\tvar parse = require('./flowchart.parse');\n\t(function( $ ) {\n\t\t$.fn.flowChart = function( options ) {\n\t\t\treturn this.each(function() {\n\t\t\t\tvar $this = $(this);\n\t\t\t\tvar chart = parse($this.text());\n\t\t\t\t$this.html('');\n\t\t\t\tchart.drawSVG(this, options);\n\t\t\t});\n\t\t};\n\t})( jQuery ); // eslint-disable-line\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/jquery-plugin.js\n ** module id = 14\n ** module chunks = 0\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_15__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"Raphael\"\n ** module id = 15\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/release/flowchart.min.map b/release/flowchart.min.map deleted file mode 100644 index 451433c6..00000000 --- a/release/flowchart.min.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flowchart.min.js","sources":["../bin/flowchart-latest.js"],"names":["_defaults","options","defaultOptions","merged","attrname","_inherits","ctor","superCtor","Object","super_","prototype","create","constructor","value","enumerable","writable","configurable","TempCtor","drawPath","chart","location","points","i","len","path","length","pathValues","x","y","push","symbol","paper","attr","font","fontF","fontW","font-family","font-weight","drawLine","from","to","text","toString","call","line","stroke","stroke-width","arrow-end","centerText","textPath","isHorizontal","firstTo","getBBox","width","height","text-anchor","font-size","fill","checkLineIntersection","line1StartX","line1StartY","line1EndX","line1EndY","line2StartX","line2StartY","line2EndX","line2EndY","denominator","a","b","numerator1","numerator2","result","onLine1","onLine2","FlowChart","container","this","Raphael","f","defaults","o","symbols","lines","start","Symbol","group","set","connectedTo","symbolType","flowstate","next_direction","next","undefined","key","node","id","setAttribute","getAttr","link","target","maxWidth","words","split","tempText","ii","word","substring","tmpMargin","insertBefore","initialize","Start","rect","End","Operation","Subroutine","innerWrap","InputOutput","textMargin","startX","startY","Condition","yes_direction","no_direction","yes","no","Math","max","parse","input","getSymbol","s","startIndex","indexOf","endIndex","getNextPath","flowSymb","trim","drawSVG","getDisplaySymbol","dispSymbols","diagram","Error","self","clean","constructChart","prevDisp","prev","dispSymb","startWith","pathOk","then","render","prevBreak","i0","i0len","line0","replace","substr","l","currentLine","splice","sub","parts","shift","join","txtAndState","pop","flowSymbols","lenS","realSymb","direction","condOpt","nextSymb","Array","searchElement","TypeError","t","n","arguments","Number","Infinity","floor","abs","k","lastIndexOf","min","String","root","flowchart","module","exports","line-width","line-length","text-margin","font-color","line-color","element-color","yes-text","no-text","class","scale","end","condition","inputoutput","operation","subroutine","inherits","handle","flowChart","nextSymbol","yes_symbol","no_symbol","maxHeight","maxX","maxY","shiftX","shiftY","renderLines","maxXFromLine","getX","getY","lineWidth","setSize","setViewBox","paperDom","canvas","parentNode","removeChild","attName","opt1","opt3","opt2","transform","getCenter","setX","setY","getTop","getBottom","getLeft","getRight","lineLength","rightPoint","isPositioned","symb","hasSymbolUnder","diff","bottomPoint","drawLineTo","origin","right","bottom","left","symbolX","symbolY","symbolTop","symbolRight","symbolLeft","isOnSameColumn","isOnSameLine","isUnder","isUpper","isLeft","isRight","lineWith","rightStart","topEnd","bottomStart","diffX","leftStart","leftEnd","rightEnd","llen","otherLine","ePath","lPath","iP","lenP","newPath","line1_from_x","line1_from_y","line1_to_x","line1_to_y","lP","lenlP","newLinePath","line2_from_x","line2_from_y","line2_to_x","line2_to_y","res","newSegment","bottom_symbol","right_symbol"],"mappings":";;;;;CAIA,WAuHE,QAASA,GAAUC,EAASC,GAC1B,IAAKD,GAA8B,kBAAZA,GACrB,MAAOC,EAGT,IAAIC,KACJ,KAAK,GAAIC,KAAYF,GACnBC,EAAOC,GAAYF,EAAeE,EAGpC,KAAKA,IAAYH,GACXA,EAAQG,KACsB,gBAArBD,GAAOC,GAChBD,EAAOC,GAAYJ,EAAUG,EAAOC,GAAWH,EAAQG,IAEvDD,EAAOC,GAAYH,EAAQG,GAIjC,OAAOD,GAGT,QAASE,GAAUC,EAAMC,GACvB,GAA8B,kBAAnBC,QAAa,OAEtBF,EAAKG,OAASF,EACdD,EAAKI,UAAYF,OAAOG,OAAOJ,EAAUG,WACvCE,aACEC,MAAOP,EACPQ,YAAY,EACZC,UAAU,EACVC,cAAc,SAGb,CAELV,EAAKG,OAASF,CACd,IAAIU,GAAW,YACfA,GAASP,UAA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,aAAa3D,YAAY/M,EACvE,IAAIyN,EAAKV,YAAY9M,EAAImH,EAAKsJ,aAAa3D,YAAY9M,GAAK0N,GAAQvG,EAAKsJ,aAAahP,MAAM,EAAG,CAC7FgM,GAAiB,CACjB,QAIAA,IACFtG,EAAKsJ,aAAa1D,KAAKS,EAAKxB,OAASwB,EAAK/L,MAAQ4L,GAClD7E,QAIJvF,KAAKwN,aAAalD,cAAe,EAEjCtK,KAAKwN,aAAa7I,YAKxB/B,EAAU/G,UAAUgN,YAAc,WAC5B7I,KAAKsI,YACPtI,KAAK2K,WAAW3K,KAAKsI,WAAYtI,KAAKqB,QAAQ,YAAarB,KAAK6C,eAG9D7C,KAAKuI,WACPvI,KAAK2K,WAAW3K,KAAKuI,UAAWvI,KAAKqB,QAAQ,WAAYrB,KAAK8C,eA8OlEkE,EAAU7D,MAAQA"} \ No newline at end of file diff --git a/release/flowchart.zip b/release/flowchart.zip deleted file mode 100644 index 5b4b0a0d..00000000 Binary files a/release/flowchart.zip and /dev/null differ diff --git a/src/amd.js b/src/amd.js deleted file mode 100644 index ab2c5b1d..00000000 --- a/src/amd.js +++ /dev/null @@ -1,34 +0,0 @@ -(function (root, factory) { - if (typeof exports === 'object') { - - module.exports = factory(); - - } else if (typeof define === 'function' && define.amd) { - - define([], factory); - - } -}(this, function () { - - //= flowchart.shim.js - - var root = this, - flowchart = {}; - - //= flowchart.defaults.js - //= flowchart.helpers.js - //= flowchart.functions.js - //= flowchart.chart.js - //= flowchart.symbol.js - //= flowchart.symbol.start.js - //= flowchart.symbol.end.js - //= flowchart.symbol.operation.js - //= flowchart.symbol.subroutine.js - //= flowchart.symbol.inputoutput.js - //= flowchart.symbol.condition.js - //= flowchart.parse.js - //= flowchart.api.js - - return flowchart; - -})); \ No newline at end of file diff --git a/src/flowchart.api.js b/src/flowchart.api.js deleted file mode 100644 index 81fc25e6..00000000 --- a/src/flowchart.api.js +++ /dev/null @@ -1,2 +0,0 @@ -// public api interface -flowchart.parse = parse; \ No newline at end of file diff --git a/src/flowchart.chart.js b/src/flowchart.chart.js index deb61e29..f1d7db8f 100644 --- a/src/flowchart.chart.js +++ b/src/flowchart.chart.js @@ -1,9 +1,14 @@ +var Raphael = require('raphael'); +var defaults = require('./flowchart.helpers').defaults; +var defaultOptions = require('./flowchart.defaults'); +var Condition = require('./flowchart.symbol.condition'); + function FlowChart(container, options) { options = options || {}; this.paper = new Raphael(container); - this.options = f.defaults(options, o); + this.options = defaults(options, defaultOptions); this.symbols = []; this.lines = []; @@ -110,3 +115,5 @@ FlowChart.prototype.clean = function() { paperDom.parentNode.removeChild(paperDom); } }; + +module.exports = FlowChart; diff --git a/src/flowchart.defaults.js b/src/flowchart.defaults.js index 93611489..5303530e 100644 --- a/src/flowchart.defaults.js +++ b/src/flowchart.defaults.js @@ -1,5 +1,5 @@ // defaults -var o = { +module.exports = { 'x': 0, 'y': 0, 'line-width': 3, diff --git a/src/flowchart.exports.js b/src/flowchart.exports.js deleted file mode 100644 index 49a23cf1..00000000 --- a/src/flowchart.exports.js +++ /dev/null @@ -1,8 +0,0 @@ -// Export the flowchart object for **CommonJS**. -// If we're not in CommonJS, add `flowchart` to the -// global object or to jquery. -if (typeof module !== 'undefined' && module.exports) { - module.exports = flowchart; -} else { - root.flowchart = root.flowchart || flowchart; -} \ No newline at end of file diff --git a/src/flowchart.functions.js b/src/flowchart.functions.js index b76b0aa8..23c62a86 100644 --- a/src/flowchart.functions.js +++ b/src/flowchart.functions.js @@ -13,7 +13,7 @@ function drawPath(chart, location, points) { symbol.attr('stroke', chart.options['element-color']); symbol.attr('stroke-width', chart.options['line-width']); - var font = chart.options['font']; + var font = chart.options.font; var fontF = chart.options['font-family']; var fontW = chart.options['font-weight']; @@ -48,7 +48,7 @@ function drawLine(chart, from, to, text) { 'arrow-end': chart.options['arrow-end'] }); - var font = chart.options['font']; + var font = chart.options.font; var fontF = chart.options['font-family']; var fontW = chart.options['font-weight']; @@ -158,4 +158,10 @@ function checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, l } // if line1 and line2 are segments, they intersect if both of the above are true return result; -} \ No newline at end of file +} + +module.exports = { + drawPath: drawPath, + drawLine: drawLine, + checkLineIntersection: checkLineIntersection +}; diff --git a/src/flowchart.helpers.js b/src/flowchart.helpers.js index b8b770c5..acb17cba 100644 --- a/src/flowchart.helpers.js +++ b/src/flowchart.helpers.js @@ -44,7 +44,7 @@ function _inherits(ctor, superCtor) { // move dependent functions to a container so that // they can be overriden easier in no jquery environment (node.js) -var f = { +module.exports = { defaults: _defaults, inherits: _inherits -}; \ No newline at end of file +}; diff --git a/src/flowchart.js b/src/flowchart.js deleted file mode 100644 index 91db07e7..00000000 --- a/src/flowchart.js +++ /dev/null @@ -1,23 +0,0 @@ -(function() { - - //= flowchart.shim.js - - var root = this, - flowchart = {}; - - //= flowchart.exports.js - //= flowchart.defaults.js - //= flowchart.helpers.js - //= flowchart.functions.js - //= flowchart.chart.js - //= flowchart.symbol.js - //= flowchart.symbol.start.js - //= flowchart.symbol.end.js - //= flowchart.symbol.operation.js - //= flowchart.symbol.subroutine.js - //= flowchart.symbol.inputoutput.js - //= flowchart.symbol.condition.js - //= flowchart.parse.js - //= flowchart.api.js - -})(); \ No newline at end of file diff --git a/src/flowchart.parse.js b/src/flowchart.parse.js index e6e8279a..b01d40dd 100644 --- a/src/flowchart.parse.js +++ b/src/flowchart.parse.js @@ -1,3 +1,11 @@ +var FlowChart = require('./flowchart.chart'); +var Start = require('./flowchart.symbol.start'); +var End = require('./flowchart.symbol.end'); +var Operation = require('./flowchart.symbol.operation'); +var InputOutput = require('./flowchart.symbol.inputoutput'); +var Subroutine = require('./flowchart.symbol.subroutine'); +var Condition = require('./flowchart.symbol.condition'); + function parse(input) { input = input || ''; input = input.trim(); @@ -232,3 +240,5 @@ function parse(input) { } return chart; } + +module.exports = parse; diff --git a/src/flowchart.symbol.condition.js b/src/flowchart.symbol.condition.js index 3c776478..27cb5c7c 100644 --- a/src/flowchart.symbol.condition.js +++ b/src/flowchart.symbol.condition.js @@ -1,19 +1,24 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; +var drawAPI = require('./flowchart.functions'); +var drawPath = drawAPI.drawPath; + function Condition(chart, options) { options = options || {}; Symbol.call(this, chart, options); this.textMargin = this.getAttr('text-margin'); this.yes_direction = 'bottom'; this.no_direction = 'right'; - if (options.yes && options['direction_yes'] && options.no && !options['direction_no']) { - if (options['direction_yes'] === 'right') { + if (options.yes && options.direction_yes && options.no && !options.direction_no) { + if (options.direction_yes === 'right') { this.no_direction = 'bottom'; this.yes_direction = 'right'; } else { this.no_direction = 'right'; this.yes_direction = 'bottom'; } - } else if (options.yes && !options['direction_yes'] && options.no && options['direction_no']) { - if (options['direction_no'] === 'right') { + } else if (options.yes && !options.direction_yes && options.no && options.direction_no) { + if (options.direction_no === 'right') { this.yes_direction = 'bottom'; this.no_direction = 'right'; } else { @@ -74,7 +79,7 @@ function Condition(chart, options) { this.initialize(); } -f.inherits(Condition, Symbol); +inherits(Condition, Symbol); Condition.prototype.render = function() { @@ -90,7 +95,6 @@ Condition.prototype.render = function() { if (this.bottom_symbol) { var bottomPoint = this.getBottom(); - var topPoint = this.bottom_symbol.getTop(); if (!this.bottom_symbol.isPositioned) { this.bottom_symbol.shiftY(this.getY() + this.height + lineLength); @@ -103,7 +107,6 @@ Condition.prototype.render = function() { if (this.right_symbol) { var rightPoint = this.getRight(); - var leftPoint = this.right_symbol.getLeft(); if (!this.right_symbol.isPositioned) { @@ -146,3 +149,5 @@ Condition.prototype.renderLines = function() { this.drawLineTo(this.no_symbol, this.getAttr('no-text'), this.no_direction); } }; + +module.exports = Condition; diff --git a/src/flowchart.symbol.end.js b/src/flowchart.symbol.end.js index 1da193db..4d8ee581 100644 --- a/src/flowchart.symbol.end.js +++ b/src/flowchart.symbol.end.js @@ -1,7 +1,12 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; + function End(chart, options) { var symbol = chart.paper.rect(0, 0, 0, 0, 20); options = options || {}; options.text = options.text || 'End'; Symbol.call(this, chart, options, symbol); } -f.inherits(End, Symbol); \ No newline at end of file +inherits(End, Symbol); + +module.exports = End; diff --git a/src/flowchart.symbol.inputoutput.js b/src/flowchart.symbol.inputoutput.js index cca3230b..411c691d 100644 --- a/src/flowchart.symbol.inputoutput.js +++ b/src/flowchart.symbol.inputoutput.js @@ -1,8 +1,13 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; +var drawAPI = require('./flowchart.functions'); +var drawPath = drawAPI.drawPath; + function InputOutput(chart, options) { options = options || {}; Symbol.call(this, chart, options); this.textMargin = this.getAttr('text-margin'); - + this.text.attr({ x: this.textMargin * 3 }); @@ -42,7 +47,7 @@ function InputOutput(chart, options) { this.initialize(); } -f.inherits(InputOutput, Symbol); +inherits(InputOutput, Symbol); InputOutput.prototype.getLeft = function() { var y = this.getY() + this.group.getBBox().height/2; @@ -55,3 +60,5 @@ InputOutput.prototype.getRight = function() { var x = this.getX() + this.group.getBBox().width - this.textMargin; return {x: x, y: y}; }; + +module.exports = InputOutput; diff --git a/src/flowchart.symbol.js b/src/flowchart.symbol.js index 507331df..fa03cdd5 100644 --- a/src/flowchart.symbol.js +++ b/src/flowchart.symbol.js @@ -1,3 +1,7 @@ +var drawAPI = require('./flowchart.functions'); +var drawLine = drawAPI.drawLine; +var checkLineIntersection = drawAPI.checkLineIntersection; + function Symbol(chart, options, symbol) { this.chart = chart; this.group = this.chart.paper.set(); @@ -7,12 +11,12 @@ function Symbol(chart, options, symbol) { this.flowstate = (options.flowstate || 'future'); this.next_direction = options.next && options['direction_next'] ? options['direction_next'] : undefined; - + this.text = this.chart.paper.text(0, 0, options.text); //Raphael does not support the svg group tag so setting the text node id to the symbol node id plus t if (options.key) { this.text.node.id = options.key + 't'; } this.text.node.setAttribute('class', this.getAttr('class') + 't'); - + this.text.attr({ 'text-anchor': 'start', 'x' : this.getAttr('text-margin'), @@ -47,12 +51,12 @@ function Symbol(chart, options, symbol) { } this.text.attr("text", tempText.substring(1)); } - + this.group.push(this.text); if (symbol) { var tmpMargin = this.getAttr('text-margin'); - + symbol.attr({ 'fill' : this.getAttr('fill'), 'stroke' : this.getAttr('element-color'), @@ -161,7 +165,6 @@ Symbol.prototype.render = function() { if (this.next_direction === 'right') { var rightPoint = this.getRight(); - var leftPoint = this.next.getLeft(); if (!this.next.isPositioned) { @@ -194,7 +197,6 @@ Symbol.prototype.render = function() { } } else { var bottomPoint = this.getBottom(); - var topPoint = this.next.getTop(); if (!this.next.isPositioned) { this.next.shiftY(this.getY() + this.height + lineLength); @@ -224,7 +226,6 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) { var x = this.getCenter().x, y = this.getCenter().y, - top = this.getTop(), right = this.getRight(), bottom = this.getBottom(), left = this.getLeft(); @@ -233,7 +234,6 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) { symbolY = symbol.getCenter().y, symbolTop = symbol.getTop(), symbolRight = symbol.getRight(), - symbolBottom = symbol.getBottom(), symbolLeft = symbol.getLeft(); var isOnSameColumn = x === symbolX, @@ -369,13 +369,9 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) { } if (line) { - var self = this; for (var l = 0, llen = this.chart.lines.length; l < llen; l++) { var otherLine = this.chart.lines[l]; - var i, - len, - intersections, - inter; + var len; var ePath = otherLine.attr('path'), lPath = line.attr('path'); @@ -448,3 +444,5 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) { this.chart.maxXFromLine = maxX; } }; + +module.exports = Symbol; diff --git a/src/flowchart.symbol.operation.js b/src/flowchart.symbol.operation.js index 1e938eda..ad3c108e 100644 --- a/src/flowchart.symbol.operation.js +++ b/src/flowchart.symbol.operation.js @@ -1,6 +1,11 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; + function Operation(chart, options) { var symbol = chart.paper.rect(0, 0, 0, 0); options = options || {}; Symbol.call(this, chart, options, symbol); } -f.inherits(Operation, Symbol); \ No newline at end of file +inherits(Operation, Symbol); + +module.exports = Operation; diff --git a/src/flowchart.symbol.start.js b/src/flowchart.symbol.start.js index f594080d..881d4d5a 100644 --- a/src/flowchart.symbol.start.js +++ b/src/flowchart.symbol.start.js @@ -1,11 +1,15 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; + function Start(chart, options) { var symbol = chart.paper.rect(0, 0, 0, 0, 20); options = options || {}; options.text = options.text || 'Start'; Symbol.call(this, chart, options, symbol); } -f.inherits(Start, Symbol); +inherits(Start, Symbol); +module.exports = Start; // Start.prototype.render = function() { // if (this.next) { @@ -28,4 +32,4 @@ f.inherits(Start, Symbol); // if (this.next) { // this.drawLineTo(this.next); // } -// }; \ No newline at end of file +// }; diff --git a/src/flowchart.symbol.subroutine.js b/src/flowchart.symbol.subroutine.js index c8fd7411..fdbf6535 100644 --- a/src/flowchart.symbol.subroutine.js +++ b/src/flowchart.symbol.subroutine.js @@ -1,3 +1,6 @@ +var Symbol = require('./flowchart.symbol'); +var inherits = require('./flowchart.helpers').inherits; + function Subroutine(chart, options) { var symbol = chart.paper.rect(0, 0, 0, 0); options = options || {}; @@ -37,4 +40,6 @@ function Subroutine(chart, options) { this.initialize(); } -f.inherits(Subroutine, Symbol); +inherits(Subroutine, Symbol); + +module.exports = Subroutine; diff --git a/src/jquery-plugin.js b/src/jquery-plugin.js new file mode 100644 index 00000000..ad644071 --- /dev/null +++ b/src/jquery-plugin.js @@ -0,0 +1,13 @@ +if (typeof jQuery != 'undefined') { + var parse = require('./flowchart.parse'); + (function( $ ) { + $.fn.flowChart = function( options ) { + return this.each(function() { + var $this = $(this); + var chart = parse($this.text()); + $this.html(''); + chart.drawSVG(this, options); + }); + }; + })( jQuery ); // eslint-disable-line +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000..e6202e7c --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,84 @@ +var path = require('path'); +var webpack = require('webpack'); +var moment = require('moment'); + +var component = require('./package.json'); +var banner = + '// ' + component.name + ', v' + component.version + '\n' + + '// Copyright (c)' + moment().format('yyyy') + ' Adriano Raiano (adrai).\n' + + '// Distributed under MIT license\n' + + '// http://adrai.github.io/flowchart.js\n'; + +var NODE_ENV = process.env.NODE_ENV || 'development'; +var defines = new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify(NODE_ENV) + } +}); + +var config = { + devtool: 'source-map', // always build source map + entry: [ + 'webpack-hot-middleware/client', + './index' + ], + output: { + path: path.join(__dirname, 'build'), + filename: component.name + '.js', + publicPath: '/build/' + }, + plugins: [ + new webpack.HotModuleReplacementPlugin(), + new webpack.NoErrorsPlugin(), + defines + ], + resolve: { + extensions: ['', '.js'], + modulesDirectories: ['src', 'node_modules'], + alias: { + 'dev/raphael.core.js': './dev/raphael.core.js', + 'raphael.core': './raphael.core.js', + 'raphael.svg': './dev/raphael.svg.js', + 'raphael.vml': './dev/raphael.vml.js' + } + } +}; + +if (NODE_ENV === 'production') { + var minified = process.env.MINIFIED == '1'; + var filename = minified ? component.name + '.min.js' : component.name + '.js'; + var uglifyOptions = { + sourceMap: true, + compressor: { + warnings: false, + dead_code: true + }, + output: { + preamble: banner, + comments: false + } + }; + if (!minified) { + uglifyOptions.beautify = true; + uglifyOptions.mangle = false; + uglifyOptions.output.comments = 'all'; + } + config.entry = './index'; + config.externals = { + raphael: 'Raphael' + }; + config.output = { + devtoolLineToLine: true, + sourceMapFilename: filename + '.map', + path: path.join(__dirname, 'release'), + filename: filename, + libraryTarget: 'umd' + }; + config.plugins = [ + new webpack.optimize.OccurenceOrderPlugin(), + defines, + new webpack.optimize.UglifyJsPlugin(uglifyOptions) + ]; +} + +module.exports = config;