@umoteam/editor-external 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/build.js +3 -1
  2. package/edgeone.json +17 -0
  3. package/libs/flowchart/flowchart.js +2767 -0
  4. package/libs/flowchart/raphael.min.js +6058 -0
  5. package/libs/mammoth/mammoth.browser.min.js +14 -14
  6. package/libs/plantuml/plantuml-encoder.min.js +1904 -0
  7. package/package.json +3 -2
  8. package/imgly/background-removal-data/12086412521285f855c2921ae13d3370ab243c9a250ebe340430075780f4624b +0 -0
  9. package/imgly/background-removal-data/26a663c5a768f39155009f52e0f66815f36983ae275eec676365f7d09ef97edd +0 -0
  10. package/imgly/background-removal-data/378cd0ab154b324c0b1fe3136a605a8618865d4ce38824a30c938cc1e6312ce4 +0 -0
  11. package/imgly/background-removal-data/391ce9664d3a506e4333adb82581fc2dc6fbef0354f497ab417c050cb6eba6c4 +0 -0
  12. package/imgly/background-removal-data/417316220b16ddd1c2a4730a315206ec0405aac7b64a878bdbe514e687b07b6f +0 -0
  13. package/imgly/background-removal-data/7b64520a3747dd5dcf6ac48f612504bb3b1e273a08b42b5a7efd614b9e4a397c +0 -0
  14. package/imgly/background-removal-data/7b95dd2733643f999b985105afb755122ca36de12decadc7855ebfbdab6920e6 +0 -0
  15. package/imgly/background-removal-data/8b993f75a6dc28aab79d1f216e62b59aaa6b3a15e62159bcad4a2ac197c4db0a +0 -0
  16. package/imgly/background-removal-data/90741e8ae8b47de7666ae4163ba26087500d534973a853bbd02cea715f24b5ee +0 -0
  17. package/imgly/background-removal-data/9f0512f9be98be0f44ad2f9ec9fe706ae626f2037aca910df6d1396a06a30d41 +0 -0
  18. package/imgly/background-removal-data/a2a1f2d68cd58b5a6262755e434dee496fc0f27c0ba8fcbb5d57c56ffa1bb15f +0 -0
  19. package/imgly/background-removal-data/a984abd436e7a8119dc170730260a37436ce0d0542984b71c5a1a386777ab7fd +0 -0
  20. package/imgly/background-removal-data/af8fb2b72ffb03ed999778c4de73fd4ade196890be6e0253230b198dd11e9db0 +0 -0
  21. package/imgly/background-removal-data/b53229786ebfbaabcfec4955c248135ba47a13972bf700116a2ff85b86507d2e +0 -0
  22. package/imgly/background-removal-data/bbf8e366b8f11bb64e60c8532fc2ffed21535fa1cf981464ac45485972107855 +0 -0
  23. package/imgly/background-removal-data/c1eba9d5d2ee58ba832bf98b50624ea8813f2279505643401c23674c6b326d0b +0 -0
  24. package/imgly/background-removal-data/c9f954707cb992edf62319d9aed365b4fc9ec3f08693a020db30040c0f953198 +0 -0
  25. package/imgly/background-removal-data/cad6b95099faeba3ea1299d717990453208cc075b53332db9123a4e2bdaf160c +0 -0
  26. package/imgly/background-removal-data/dd4fad06953738263bc4d5f94974376467fc74081cba665cef18af8223894ed4 +0 -0
  27. package/imgly/background-removal-data/e9445ca5ac21e04579658183cd886440f3524caafe6a8947dd20a73b34fba5b0 +0 -0
  28. package/imgly/background-removal-data/ea46f83f60203065638f183fc8a5446dfc28a163d7ba1922fc3bc6cf40347fa2 +0 -0
  29. package/imgly/background-removal-data/ef7fb517ae63534f48efa657702b3821fb5d59e4fd372016793edc0389341cc0 +0 -0
  30. package/imgly/background-removal-data/f69890cf74d0a687904dd088c0aaadce598c8bc217366ebee6993eadd4d56208 +0 -0
  31. package/imgly/background-removal-data/f6e7e01556358ed875f260bdfb22fb6f7213ac6fd4098ed72c0e7af081f0c23c +0 -0
  32. package/imgly/background-removal-data/fa3e4102c796fb6d1dab5417c5c0b4b5d219e6b9624d045d7361a033e7db183f +0 -0
  33. package/imgly/background-removal-data/resources.json +0 -462
  34. package/mammoth/mammoth.browser.min.js +0 -21
@@ -0,0 +1,2767 @@
1
+ // flowchart.js, v1.18.0
2
+ // Copyright (c)2023 Adriano Raiano (adrai).
3
+ // Distributed under MIT license
4
+ // http://adrai.github.io/flowchart.js
5
+
6
+ !(function (root, factory) {
7
+ if ('object' == typeof exports && 'object' == typeof module)
8
+ module.exports = factory(require('Raphael'))
9
+ else if ('function' == typeof define && define.amd)
10
+ define(['Raphael'], factory)
11
+ else {
12
+ var a = factory(
13
+ 'object' == typeof exports ? require('Raphael') : root.Raphael,
14
+ )
15
+ for (var i in a) ('object' == typeof exports ? exports : root)[i] = a[i]
16
+ }
17
+ })(this, function (__WEBPACK_EXTERNAL_MODULE_18__) {
18
+ /******/
19
+ return (function (modules) {
20
+ /******/
21
+ /******/
22
+ // The require function
23
+ /******/
24
+ function __webpack_require__(moduleId) {
25
+ /******/
26
+ /******/
27
+ // Check if module is in cache
28
+ /******/
29
+ if (installedModules[moduleId])
30
+ /******/
31
+ return installedModules[moduleId].exports
32
+ /******/
33
+ /******/
34
+ // Create a new module (and put it into the cache)
35
+ /******/
36
+ var module = (installedModules[moduleId] = {
37
+ /******/
38
+ exports: {},
39
+ /******/
40
+ id: moduleId,
41
+ /******/
42
+ loaded: !1,
43
+ })
44
+ /******/
45
+ /******/
46
+ // Return the exports of the module
47
+ /******/
48
+ /******/
49
+ /******/
50
+ // Execute the module function
51
+ /******/
52
+ /******/
53
+ /******/
54
+ // Flag the module as loaded
55
+ /******/
56
+ return (
57
+ modules[moduleId].call(
58
+ module.exports,
59
+ module,
60
+ module.exports,
61
+ __webpack_require__,
62
+ ),
63
+ (module.loaded = !0),
64
+ module.exports
65
+ )
66
+ }
67
+ // webpackBootstrap
68
+ /******/
69
+ // The module cache
70
+ /******/
71
+ var installedModules = {}
72
+ /******/
73
+ /******/
74
+ // Load entry module and return exports
75
+ /******/
76
+ /******/
77
+ /******/
78
+ /******/
79
+ // expose the modules object (__webpack_modules__)
80
+ /******/
81
+ /******/
82
+ /******/
83
+ // expose the module cache
84
+ /******/
85
+ /******/
86
+ /******/
87
+ // __webpack_public_path__
88
+ /******/
89
+ return (
90
+ (__webpack_require__.m = modules),
91
+ (__webpack_require__.c = installedModules),
92
+ (__webpack_require__.p = ''),
93
+ __webpack_require__(0)
94
+ )
95
+ })([
96
+ /* 0 */
97
+ /*!******************!*\
98
+ !*** ./index.js ***!
99
+ \******************/
100
+ /***/
101
+ function (module, exports, __webpack_require__) {
102
+ __webpack_require__(/*! ./src/flowchart.shim */ 9)
103
+ var parse = __webpack_require__(/*! ./src/flowchart.parse */ 4)
104
+ __webpack_require__(/*! ./src/jquery-plugin */ 17)
105
+ var FlowChart = {
106
+ parse: parse,
107
+ }
108
+ 'undefined' != typeof window && (window.flowchart = FlowChart),
109
+ (module.exports = FlowChart)
110
+ } /* 1 */,
111
+ /*!**********************************!*\
112
+ !*** ./src/flowchart.helpers.js ***!
113
+ \**********************************/
114
+ /***/
115
+ function (module, exports) {
116
+ function _defaults(options, defaultOptions) {
117
+ if (!options || 'function' == typeof options) return defaultOptions
118
+ var merged = {}
119
+ for (var attrname in defaultOptions)
120
+ merged[attrname] = defaultOptions[attrname]
121
+ for (attrname in options)
122
+ options[attrname] &&
123
+ ('object' == typeof merged[attrname]
124
+ ? (merged[attrname] = _defaults(
125
+ merged[attrname],
126
+ options[attrname],
127
+ ))
128
+ : (merged[attrname] = options[attrname]))
129
+ return merged
130
+ }
131
+ function _inherits(ctor, superCtor) {
132
+ if ('function' == typeof Object.create)
133
+ // implementation from standard node.js 'util' module
134
+ (ctor.super_ = superCtor),
135
+ (ctor.prototype = Object.create(superCtor.prototype, {
136
+ constructor: {
137
+ value: ctor,
138
+ enumerable: !1,
139
+ writable: !0,
140
+ configurable: !0,
141
+ },
142
+ }))
143
+ else {
144
+ // old school shim for old browsers
145
+ ctor.super_ = superCtor
146
+ var TempCtor = function () {}
147
+ ;(TempCtor.prototype = superCtor.prototype),
148
+ (ctor.prototype = new TempCtor()),
149
+ (ctor.prototype.constructor = ctor)
150
+ }
151
+ }
152
+ // move dependent functions to a container so that
153
+ // they can be overriden easier in no jquery environment (node.js)
154
+ module.exports = {
155
+ defaults: _defaults,
156
+ inherits: _inherits,
157
+ }
158
+ } /* 2 */,
159
+ /*!*********************************!*\
160
+ !*** ./src/flowchart.symbol.js ***!
161
+ \*********************************/
162
+ /***/
163
+ function (module, exports, __webpack_require__) {
164
+ function Symbol(chart, options, symbol) {
165
+ ;(this.chart = chart),
166
+ (this.group = this.chart.paper.set()),
167
+ (this.symbol = symbol),
168
+ (this.connectedTo = []),
169
+ (this.symbolType = options.symbolType),
170
+ (this.flowstate = options.flowstate || 'future'),
171
+ (this.lineStyle = options.lineStyle || {}),
172
+ (this.key = options.key || ''),
173
+ (this.leftLines = []),
174
+ (this.rightLines = []),
175
+ (this.topLines = []),
176
+ (this.bottomLines = []),
177
+ (this.params = options.params),
178
+ (this.next_direction =
179
+ options.next && options.direction_next
180
+ ? options.direction_next
181
+ : void 0),
182
+ (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
183
+ options.key && (this.text.node.id = options.key + 't'),
184
+ this.text.node.setAttribute('class', this.getAttr('class') + 't'),
185
+ this.text.attr({
186
+ 'text-anchor': 'start',
187
+ x: this.getAttr('text-margin'),
188
+ fill: this.getAttr('font-color'),
189
+ 'font-size': this.getAttr('font-size'),
190
+ })
191
+ var font = this.getAttr('font'),
192
+ fontF = this.getAttr('font-family'),
193
+ fontW = this.getAttr('font-weight')
194
+ font &&
195
+ this.text.attr({
196
+ font: font,
197
+ }),
198
+ fontF &&
199
+ this.text.attr({
200
+ 'font-family': fontF,
201
+ }),
202
+ fontW &&
203
+ this.text.attr({
204
+ 'font-weight': fontW,
205
+ }),
206
+ options.link && this.text.attr('href', options.link), //ndrqu Add click function with event and options params
207
+ options.function &&
208
+ (this.text.attr({
209
+ cursor: 'pointer',
210
+ }),
211
+ this.text.node.addEventListener(
212
+ 'click',
213
+ function (evt) {
214
+ window[options.function](evt, options)
215
+ },
216
+ !1,
217
+ )),
218
+ options.target && this.text.attr('target', options.target)
219
+ var maxWidth = this.getAttr('maxWidth')
220
+ if (maxWidth) {
221
+ for (
222
+ var words = options.text.split(' '),
223
+ tempText = '',
224
+ i = 0,
225
+ ii = words.length;
226
+ i < ii;
227
+ i++
228
+ ) {
229
+ var word = words[i]
230
+ this.text.attr('text', tempText + ' ' + word),
231
+ (tempText +=
232
+ this.text.getBBox().width > maxWidth ? '\n' + word : ' ' + word)
233
+ }
234
+ this.text.attr('text', tempText.substring(1))
235
+ }
236
+ if ((this.group.push(this.text), symbol)) {
237
+ var tmpMargin = this.getAttr('text-margin')
238
+ symbol.attr({
239
+ fill: this.getAttr('fill'),
240
+ stroke: this.getAttr('element-color'),
241
+ 'stroke-width': this.getAttr('line-width'),
242
+ width: this.text.getBBox().width + 2 * tmpMargin,
243
+ height: this.text.getBBox().height + 2 * tmpMargin,
244
+ }),
245
+ symbol.node.setAttribute('class', this.getAttr('class'))
246
+ var roundness = this.getAttr('roundness')
247
+ isNaN(roundness) ||
248
+ (symbol.node.setAttribute('ry', roundness),
249
+ symbol.node.setAttribute('rx', roundness)),
250
+ options.link && symbol.attr('href', options.link),
251
+ options.target && symbol.attr('target', options.target),
252
+ //ndrqu Add click function with event and options params
253
+ options.function &&
254
+ (symbol.node.addEventListener(
255
+ 'click',
256
+ function (evt) {
257
+ window[options.function](evt, options)
258
+ },
259
+ !1,
260
+ ),
261
+ symbol.attr({
262
+ cursor: 'pointer',
263
+ })),
264
+ options.key && (symbol.node.id = options.key),
265
+ this.group.push(symbol),
266
+ symbol.insertBefore(this.text),
267
+ this.text.attr({
268
+ y: symbol.getBBox().height / 2,
269
+ }),
270
+ this.initialize()
271
+ }
272
+ }
273
+ var drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3),
274
+ drawLine = drawAPI.drawLine,
275
+ checkLineIntersection = drawAPI.checkLineIntersection
276
+ /* Gets the attribute based on Flowstate, Symbol-Name and default, first found wins */
277
+ ;(Symbol.prototype.getAttr = function (attName) {
278
+ if (this.chart) {
279
+ var opt1,
280
+ opt3 = this.chart.options ? this.chart.options[attName] : void 0,
281
+ opt2 = this.chart.options.symbols
282
+ ? this.chart.options.symbols[this.symbolType][attName]
283
+ : void 0
284
+ return (
285
+ this.chart.options.flowstate &&
286
+ this.chart.options.flowstate[this.flowstate] &&
287
+ (opt1 = this.chart.options.flowstate[this.flowstate][attName]),
288
+ opt1 || opt2 || opt3
289
+ )
290
+ }
291
+ }),
292
+ (Symbol.prototype.initialize = function () {
293
+ this.group.transform(
294
+ 't' + this.getAttr('line-width') + ',' + this.getAttr('line-width'),
295
+ ),
296
+ (this.width = this.group.getBBox().width),
297
+ (this.height = this.group.getBBox().height)
298
+ }),
299
+ (Symbol.prototype.getCenter = function () {
300
+ return {
301
+ x: this.getX() + this.width / 2,
302
+ y: this.getY() + this.height / 2,
303
+ }
304
+ }),
305
+ (Symbol.prototype.getX = function () {
306
+ return this.group.getBBox().x
307
+ }),
308
+ (Symbol.prototype.getY = function () {
309
+ return this.group.getBBox().y
310
+ }),
311
+ (Symbol.prototype.shiftX = function (x) {
312
+ this.group.transform('t' + (this.getX() + x) + ',' + this.getY())
313
+ }),
314
+ (Symbol.prototype.setX = function (x) {
315
+ this.group.transform('t' + x + ',' + this.getY())
316
+ }),
317
+ (Symbol.prototype.shiftY = function (y) {
318
+ this.group.transform('t' + this.getX() + ',' + (this.getY() + y))
319
+ }),
320
+ (Symbol.prototype.setY = function (y) {
321
+ this.group.transform('t' + this.getX() + ',' + y)
322
+ }),
323
+ (Symbol.prototype.getTop = function () {
324
+ var y = this.getY(),
325
+ x = this.getX() + this.width / 2
326
+ return {
327
+ x: x,
328
+ y: y,
329
+ }
330
+ }),
331
+ (Symbol.prototype.getBottom = function () {
332
+ var y = this.getY() + this.height,
333
+ x = this.getX() + this.width / 2
334
+ return {
335
+ x: x,
336
+ y: y,
337
+ }
338
+ }),
339
+ (Symbol.prototype.getLeft = function () {
340
+ var y = this.getY() + this.group.getBBox().height / 2,
341
+ x = this.getX()
342
+ return {
343
+ x: x,
344
+ y: y,
345
+ }
346
+ }),
347
+ (Symbol.prototype.getRight = function () {
348
+ var y = this.getY() + this.group.getBBox().height / 2,
349
+ x = this.getX() + this.group.getBBox().width
350
+ return {
351
+ x: x,
352
+ y: y,
353
+ }
354
+ }),
355
+ (Symbol.prototype.render = function () {
356
+ if (this.next) {
357
+ var self = this,
358
+ lineLength = this.getAttr('line-length')
359
+ if ('right' === this.next_direction) {
360
+ var rightPoint = this.getRight()
361
+ this.next.isPositioned ||
362
+ (this.next.setY(rightPoint.y - this.next.height / 2),
363
+ this.next.shiftX(
364
+ this.group.getBBox().x + this.width + lineLength,
365
+ ),
366
+ (function shift() {
367
+ for (
368
+ var symb,
369
+ hasSymbolUnder = !1,
370
+ i = 0,
371
+ len = self.chart.symbols.length;
372
+ i < len;
373
+ i++
374
+ ) {
375
+ symb = self.chart.symbols[i]
376
+ var diff = Math.abs(
377
+ symb.getCenter().x - self.next.getCenter().x,
378
+ )
379
+ if (
380
+ symb.getCenter().y > self.next.getCenter().y &&
381
+ diff <= self.next.width / 2
382
+ ) {
383
+ hasSymbolUnder = !0
384
+ break
385
+ }
386
+ }
387
+ if (hasSymbolUnder) {
388
+ if ('end' === self.next.symbolType) return
389
+ self.next.setX(symb.getX() + symb.width + lineLength),
390
+ shift()
391
+ }
392
+ })(),
393
+ (this.next.isPositioned = !0),
394
+ this.next.render())
395
+ } else if ('left' === this.next_direction) {
396
+ var leftPoint = this.getLeft()
397
+ this.next.isPositioned ||
398
+ (this.next.setY(leftPoint.y - this.next.height / 2),
399
+ this.next.shiftX(
400
+ -(this.group.getBBox().x + this.width + lineLength),
401
+ ),
402
+ (function shift() {
403
+ for (
404
+ var symb,
405
+ hasSymbolUnder = !1,
406
+ i = 0,
407
+ len = self.chart.symbols.length;
408
+ i < len;
409
+ i++
410
+ ) {
411
+ symb = self.chart.symbols[i]
412
+ var diff = Math.abs(
413
+ symb.getCenter().x - self.next.getCenter().x,
414
+ )
415
+ if (
416
+ symb.getCenter().y > self.next.getCenter().y &&
417
+ diff <= self.next.width / 2
418
+ ) {
419
+ hasSymbolUnder = !0
420
+ break
421
+ }
422
+ }
423
+ if (hasSymbolUnder) {
424
+ if ('end' === self.next.symbolType) return
425
+ self.next.setX(symb.getX() + symb.width + lineLength),
426
+ shift()
427
+ }
428
+ })(),
429
+ (this.next.isPositioned = !0),
430
+ this.next.render())
431
+ } else {
432
+ var bottomPoint = this.getBottom()
433
+ this.next.isPositioned ||
434
+ (this.next.shiftY(this.getY() + this.height + lineLength),
435
+ this.next.setX(bottomPoint.x - this.next.width / 2),
436
+ (this.next.isPositioned = !0),
437
+ this.next.render())
438
+ }
439
+ }
440
+ }),
441
+ (Symbol.prototype.renderLines = function () {
442
+ this.next &&
443
+ (this.next_direction
444
+ ? this.drawLineTo(
445
+ this.next,
446
+ this.getAttr('arrow-text') || '',
447
+ this.next_direction,
448
+ )
449
+ : this.drawLineTo(this.next, this.getAttr('arrow-text') || ''))
450
+ }),
451
+ (Symbol.prototype.drawLineTo = function (symbol, text, origin) {
452
+ this.connectedTo.indexOf(symbol) < 0 && this.connectedTo.push(symbol)
453
+ var line,
454
+ yOffset,
455
+ x = this.getCenter().x,
456
+ y = this.getCenter().y,
457
+ right = this.getRight(),
458
+ bottom = this.getBottom(),
459
+ top = this.getTop(),
460
+ left = this.getLeft(),
461
+ symbolX = symbol.getCenter().x,
462
+ symbolY = symbol.getCenter().y,
463
+ symbolTop = symbol.getTop(),
464
+ symbolRight = symbol.getRight(),
465
+ symbolLeft = symbol.getLeft(),
466
+ isOnSameColumn = x === symbolX,
467
+ isOnSameLine = y === symbolY,
468
+ isUnder = y < symbolY,
469
+ isUpper = y > symbolY || this === symbol,
470
+ isLeft = x > symbolX,
471
+ isRight = x < symbolX,
472
+ maxX = 0,
473
+ lineLength = this.getAttr('line-length'),
474
+ lineWith = this.getAttr('line-width')
475
+ if ((origin && 'bottom' !== origin) || !isOnSameColumn || !isUnder)
476
+ if ((origin && 'right' !== origin) || !isOnSameLine || !isRight)
477
+ if ((origin && 'left' !== origin) || !isOnSameLine || !isLeft)
478
+ if (
479
+ (origin && 'right' !== origin) ||
480
+ !isOnSameColumn ||
481
+ !isUpper
482
+ )
483
+ if (
484
+ (origin && 'right' !== origin) ||
485
+ !isOnSameColumn ||
486
+ !isUnder
487
+ )
488
+ if ((origin && 'bottom' !== origin) || !isLeft)
489
+ if (
490
+ (origin && 'bottom' !== origin) ||
491
+ !isRight ||
492
+ !isUnder
493
+ )
494
+ if ((origin && 'bottom' !== origin) || !isRight)
495
+ if (origin && 'right' === origin && isLeft)
496
+ (yOffset =
497
+ 10 *
498
+ Math.max(
499
+ symbol.topLines.length,
500
+ this.rightLines.length,
501
+ )),
502
+ (line = drawLine(
503
+ this.chart,
504
+ right,
505
+ [
506
+ {
507
+ x: right.x + lineLength / 2,
508
+ y: right.y,
509
+ },
510
+ {
511
+ x: right.x + lineLength / 2,
512
+ y: symbolTop.y - lineLength / 2 - yOffset,
513
+ },
514
+ {
515
+ x: symbolTop.x,
516
+ y: symbolTop.y - lineLength / 2 - yOffset,
517
+ },
518
+ {
519
+ x: symbolTop.x,
520
+ y: symbolTop.y,
521
+ },
522
+ ],
523
+ text,
524
+ )),
525
+ this.rightLines.push(line),
526
+ symbol.topLines.push(line),
527
+ (this.rightStart = !0),
528
+ (symbol.topEnd = !0),
529
+ (maxX = right.x + lineLength / 2)
530
+ else if (origin && 'right' === origin && isRight)
531
+ (yOffset =
532
+ 10 *
533
+ Math.max(
534
+ symbol.topLines.length,
535
+ this.rightLines.length,
536
+ )),
537
+ (line = drawLine(
538
+ this.chart,
539
+ right,
540
+ [
541
+ {
542
+ x: symbolTop.x,
543
+ y: right.y - yOffset,
544
+ },
545
+ {
546
+ x: symbolTop.x,
547
+ y: symbolTop.y - yOffset,
548
+ },
549
+ ],
550
+ text,
551
+ )),
552
+ this.rightLines.push(line),
553
+ symbol.topLines.push(line),
554
+ (this.rightStart = !0),
555
+ (symbol.topEnd = !0),
556
+ (maxX = right.x + lineLength / 2)
557
+ else if (
558
+ origin &&
559
+ 'bottom' === origin &&
560
+ isOnSameColumn &&
561
+ isUpper
562
+ )
563
+ (yOffset =
564
+ 10 *
565
+ Math.max(
566
+ symbol.topLines.length,
567
+ this.bottomLines.length,
568
+ )),
569
+ (line = drawLine(
570
+ this.chart,
571
+ bottom,
572
+ [
573
+ {
574
+ x: bottom.x,
575
+ y: bottom.y + lineLength / 2 - yOffset,
576
+ },
577
+ {
578
+ x: right.x + lineLength / 2,
579
+ y: bottom.y + lineLength / 2 - yOffset,
580
+ },
581
+ {
582
+ x: right.x + lineLength / 2,
583
+ y: symbolTop.y - lineLength / 2 - yOffset,
584
+ },
585
+ {
586
+ x: symbolTop.x,
587
+ y: symbolTop.y - lineLength / 2 - yOffset,
588
+ },
589
+ {
590
+ x: symbolTop.x,
591
+ y: symbolTop.y,
592
+ },
593
+ ],
594
+ text,
595
+ )),
596
+ this.bottomLines.push(line),
597
+ symbol.topLines.push(line),
598
+ (this.bottomStart = !0),
599
+ (symbol.topEnd = !0),
600
+ (maxX = bottom.x + lineLength / 2)
601
+ else if (
602
+ 'left' === origin &&
603
+ isOnSameColumn &&
604
+ isUpper
605
+ ) {
606
+ var diffX = left.x - lineLength / 2
607
+ symbolLeft.x < left.x &&
608
+ (diffX = symbolLeft.x - lineLength / 2),
609
+ (yOffset =
610
+ 10 *
611
+ Math.max(
612
+ symbol.topLines.length,
613
+ this.leftLines.length,
614
+ )),
615
+ (line = drawLine(
616
+ this.chart,
617
+ left,
618
+ [
619
+ {
620
+ x: diffX,
621
+ y: left.y - yOffset,
622
+ },
623
+ {
624
+ x: diffX,
625
+ y: symbolTop.y - lineLength / 2 - yOffset,
626
+ },
627
+ {
628
+ x: symbolTop.x,
629
+ y: symbolTop.y - lineLength / 2 - yOffset,
630
+ },
631
+ {
632
+ x: symbolTop.x,
633
+ y: symbolTop.y,
634
+ },
635
+ ],
636
+ text,
637
+ )),
638
+ this.leftLines.push(line),
639
+ symbol.topLines.push(line),
640
+ (this.leftStart = !0),
641
+ (symbol.topEnd = !0),
642
+ (maxX = left.x)
643
+ } else
644
+ 'left' === origin
645
+ ? ((yOffset =
646
+ 10 *
647
+ Math.max(
648
+ symbol.topLines.length,
649
+ this.leftLines.length,
650
+ )),
651
+ (line = drawLine(
652
+ this.chart,
653
+ left,
654
+ [
655
+ {
656
+ x:
657
+ symbolTop.x +
658
+ (left.x - symbolTop.x) / 2,
659
+ y: left.y,
660
+ },
661
+ {
662
+ x:
663
+ symbolTop.x +
664
+ (left.x - symbolTop.x) / 2,
665
+ y: symbolTop.y - lineLength / 2 - yOffset,
666
+ },
667
+ {
668
+ x: symbolTop.x,
669
+ y: symbolTop.y - lineLength / 2 - yOffset,
670
+ },
671
+ {
672
+ x: symbolTop.x,
673
+ y: symbolTop.y,
674
+ },
675
+ ],
676
+ text,
677
+ )),
678
+ this.leftLines.push(line),
679
+ symbol.topLines.push(line),
680
+ (this.leftStart = !0),
681
+ (symbol.topEnd = !0),
682
+ (maxX = left.x))
683
+ : 'top' === origin &&
684
+ ((yOffset =
685
+ 10 *
686
+ Math.max(
687
+ symbol.topLines.length,
688
+ this.topLines.length,
689
+ )),
690
+ (line = drawLine(
691
+ this.chart,
692
+ top,
693
+ [
694
+ {
695
+ x: top.x,
696
+ y: symbolTop.y - lineLength / 2 - yOffset,
697
+ },
698
+ {
699
+ x: symbolTop.x,
700
+ y: symbolTop.y - lineLength / 2 - yOffset,
701
+ },
702
+ {
703
+ x: symbolTop.x,
704
+ y: symbolTop.y,
705
+ },
706
+ ],
707
+ text,
708
+ )),
709
+ this.topLines.push(line),
710
+ symbol.topLines.push(line),
711
+ (this.topStart = !0),
712
+ (symbol.topEnd = !0),
713
+ (maxX = top.x))
714
+ else
715
+ (yOffset =
716
+ 10 *
717
+ Math.max(
718
+ symbol.topLines.length,
719
+ this.bottomLines.length,
720
+ )),
721
+ (line = drawLine(
722
+ this.chart,
723
+ bottom,
724
+ [
725
+ {
726
+ x: bottom.x,
727
+ y: bottom.y + lineLength / 2 - yOffset,
728
+ },
729
+ {
730
+ x: bottom.x + (bottom.x - symbolTop.x) / 2,
731
+ y: bottom.y + lineLength / 2 - yOffset,
732
+ },
733
+ {
734
+ x: bottom.x + (bottom.x - symbolTop.x) / 2,
735
+ y: symbolTop.y - lineLength / 2 - yOffset,
736
+ },
737
+ {
738
+ x: symbolTop.x,
739
+ y: symbolTop.y - lineLength / 2 - yOffset,
740
+ },
741
+ {
742
+ x: symbolTop.x,
743
+ y: symbolTop.y,
744
+ },
745
+ ],
746
+ text,
747
+ )),
748
+ this.bottomLines.push(line),
749
+ symbol.topLines.push(line),
750
+ (this.bottomStart = !0),
751
+ (symbol.topEnd = !0),
752
+ (maxX = bottom.x + (bottom.x - symbolTop.x) / 2)
753
+ else
754
+ (yOffset =
755
+ 10 *
756
+ Math.max(
757
+ symbol.topLines.length,
758
+ this.bottomLines.length,
759
+ )),
760
+ (line = drawLine(
761
+ this.chart,
762
+ bottom,
763
+ [
764
+ {
765
+ x: bottom.x,
766
+ y: symbolTop.y - lineLength / 2 - yOffset,
767
+ },
768
+ {
769
+ x: symbolTop.x,
770
+ y: symbolTop.y - lineLength / 2 - yOffset,
771
+ },
772
+ {
773
+ x: symbolTop.x,
774
+ y: symbolTop.y,
775
+ },
776
+ ],
777
+ text,
778
+ )),
779
+ this.bottomLines.push(line),
780
+ symbol.topLines.push(line),
781
+ (this.bottomStart = !0),
782
+ (symbol.topEnd = !0),
783
+ (maxX = bottom.x),
784
+ symbolTop.x > maxX && (maxX = symbolTop.x)
785
+ else
786
+ (yOffset =
787
+ 10 *
788
+ Math.max(
789
+ symbol.topLines.length,
790
+ this.bottomLines.length,
791
+ )),
792
+ (line =
793
+ this.leftEnd && isUpper
794
+ ? drawLine(
795
+ this.chart,
796
+ bottom,
797
+ [
798
+ {
799
+ x: bottom.x,
800
+ y: bottom.y + lineLength / 2 - yOffset,
801
+ },
802
+ {
803
+ x: bottom.x + (bottom.x - symbolTop.x) / 2,
804
+ y: bottom.y + lineLength / 2 - yOffset,
805
+ },
806
+ {
807
+ x: bottom.x + (bottom.x - symbolTop.x) / 2,
808
+ y: symbolTop.y - lineLength / 2 - yOffset,
809
+ },
810
+ {
811
+ x: symbolTop.x,
812
+ y: symbolTop.y - lineLength / 2 - yOffset,
813
+ },
814
+ {
815
+ x: symbolTop.x,
816
+ y: symbolTop.y,
817
+ },
818
+ ],
819
+ text,
820
+ )
821
+ : drawLine(
822
+ this.chart,
823
+ bottom,
824
+ [
825
+ {
826
+ x: bottom.x,
827
+ y: symbolTop.y - lineLength / 2 - yOffset,
828
+ },
829
+ {
830
+ x: symbolTop.x,
831
+ y: symbolTop.y - lineLength / 2 - yOffset,
832
+ },
833
+ {
834
+ x: symbolTop.x,
835
+ y: symbolTop.y,
836
+ },
837
+ ],
838
+ text,
839
+ )),
840
+ this.bottomLines.push(line),
841
+ symbol.topLines.push(line),
842
+ (this.bottomStart = !0),
843
+ (symbol.topEnd = !0),
844
+ (maxX = bottom.x + (bottom.x - symbolTop.x) / 2)
845
+ else
846
+ (yOffset =
847
+ 10 *
848
+ Math.max(symbol.topLines.length, this.rightLines.length)),
849
+ (line = drawLine(
850
+ this.chart,
851
+ right,
852
+ [
853
+ {
854
+ x: right.x + lineLength / 2,
855
+ y: right.y - yOffset,
856
+ },
857
+ {
858
+ x: right.x + lineLength / 2,
859
+ y: symbolTop.y - lineLength / 2 - yOffset,
860
+ },
861
+ {
862
+ x: symbolTop.x,
863
+ y: symbolTop.y - lineLength / 2 - yOffset,
864
+ },
865
+ {
866
+ x: symbolTop.x,
867
+ y: symbolTop.y,
868
+ },
869
+ ],
870
+ text,
871
+ )),
872
+ this.rightLines.push(line),
873
+ symbol.topLines.push(line),
874
+ (this.rightStart = !0),
875
+ (symbol.topEnd = !0),
876
+ (maxX = right.x + lineLength / 2)
877
+ else
878
+ (yOffset =
879
+ 10 *
880
+ Math.max(symbol.topLines.length, this.rightLines.length)),
881
+ (line = drawLine(
882
+ this.chart,
883
+ right,
884
+ [
885
+ {
886
+ x: right.x + lineLength / 2,
887
+ y: right.y - yOffset,
888
+ },
889
+ {
890
+ x: right.x + lineLength / 2,
891
+ y: symbolTop.y - lineLength / 2 - yOffset,
892
+ },
893
+ {
894
+ x: symbolTop.x,
895
+ y: symbolTop.y - lineLength / 2 - yOffset,
896
+ },
897
+ {
898
+ x: symbolTop.x,
899
+ y: symbolTop.y,
900
+ },
901
+ ],
902
+ text,
903
+ )),
904
+ this.rightLines.push(line),
905
+ symbol.topLines.push(line),
906
+ (this.rightStart = !0),
907
+ (symbol.topEnd = !0),
908
+ (maxX = right.x + lineLength / 2)
909
+ else
910
+ 0 === symbol.rightLines.length && 0 === this.leftLines.length
911
+ ? (line = drawLine(this.chart, left, symbolRight, text))
912
+ : ((yOffset =
913
+ 10 *
914
+ Math.max(
915
+ symbol.rightLines.length,
916
+ this.leftLines.length,
917
+ )),
918
+ (line = drawLine(
919
+ this.chart,
920
+ right,
921
+ [
922
+ {
923
+ x: right.x,
924
+ y: right.y - yOffset,
925
+ },
926
+ {
927
+ x: right.x,
928
+ y: symbolRight.y - yOffset,
929
+ },
930
+ {
931
+ x: symbolRight.x,
932
+ y: symbolRight.y - yOffset,
933
+ },
934
+ {
935
+ x: symbolRight.x,
936
+ y: symbolRight.y,
937
+ },
938
+ ],
939
+ text,
940
+ ))),
941
+ this.leftLines.push(line),
942
+ symbol.rightLines.push(line),
943
+ (this.leftStart = !0),
944
+ (symbol.rightEnd = !0),
945
+ (maxX = symbolRight.x)
946
+ else
947
+ 0 === symbol.leftLines.length && 0 === this.rightLines.length
948
+ ? (line = drawLine(this.chart, right, symbolLeft, text))
949
+ : ((yOffset =
950
+ 10 *
951
+ Math.max(symbol.leftLines.length, this.rightLines.length)),
952
+ (line = drawLine(
953
+ this.chart,
954
+ right,
955
+ [
956
+ {
957
+ x: right.x,
958
+ y: right.y - yOffset,
959
+ },
960
+ {
961
+ x: right.x,
962
+ y: symbolLeft.y - yOffset,
963
+ },
964
+ {
965
+ x: symbolLeft.x,
966
+ y: symbolLeft.y - yOffset,
967
+ },
968
+ {
969
+ x: symbolLeft.x,
970
+ y: symbolLeft.y,
971
+ },
972
+ ],
973
+ text,
974
+ ))),
975
+ this.rightLines.push(line),
976
+ symbol.leftLines.push(line),
977
+ (this.rightStart = !0),
978
+ (symbol.leftEnd = !0),
979
+ (maxX = symbolLeft.x)
980
+ else
981
+ 0 === symbol.topLines.length && 0 === this.bottomLines.length
982
+ ? (line = drawLine(this.chart, bottom, symbolTop, text))
983
+ : ((yOffset =
984
+ 10 *
985
+ Math.max(symbol.topLines.length, this.bottomLines.length)),
986
+ (line = drawLine(
987
+ this.chart,
988
+ bottom,
989
+ [
990
+ {
991
+ x: symbolTop.x,
992
+ y: symbolTop.y - yOffset,
993
+ },
994
+ {
995
+ x: symbolTop.x,
996
+ y: symbolTop.y,
997
+ },
998
+ ],
999
+ text,
1000
+ ))),
1001
+ this.bottomLines.push(line),
1002
+ symbol.topLines.push(line),
1003
+ (this.bottomStart = !0),
1004
+ (symbol.topEnd = !0),
1005
+ (maxX = bottom.x)
1006
+ if (
1007
+ //update line style
1008
+ (this.lineStyle[symbol.key] &&
1009
+ line &&
1010
+ line.attr(this.lineStyle[symbol.key]),
1011
+ line)
1012
+ ) {
1013
+ for (var l = 0, llen = this.chart.lines.length; l < llen; l++)
1014
+ for (
1015
+ var otherLine = this.chart.lines[l],
1016
+ ePath = otherLine.attr('path'),
1017
+ lPath = line.attr('path'),
1018
+ iP = 0,
1019
+ lenP = ePath.length - 1;
1020
+ iP < lenP;
1021
+ iP++
1022
+ ) {
1023
+ var newPath = []
1024
+ newPath.push(['M', ePath[iP][1], ePath[iP][2]]),
1025
+ newPath.push(['L', ePath[iP + 1][1], ePath[iP + 1][2]])
1026
+ for (
1027
+ var line1_from_x = newPath[0][1],
1028
+ line1_from_y = newPath[0][2],
1029
+ line1_to_x = newPath[1][1],
1030
+ line1_to_y = newPath[1][2],
1031
+ lP = 0,
1032
+ lenlP = lPath.length - 1;
1033
+ lP < lenlP;
1034
+ lP++
1035
+ ) {
1036
+ var newLinePath = []
1037
+ newLinePath.push(['M', lPath[lP][1], lPath[lP][2]]),
1038
+ newLinePath.push(['L', lPath[lP + 1][1], lPath[lP + 1][2]])
1039
+ var line2_from_x = newLinePath[0][1],
1040
+ line2_from_y = newLinePath[0][2],
1041
+ line2_to_x = newLinePath[1][1],
1042
+ line2_to_y = newLinePath[1][2],
1043
+ res = checkLineIntersection(
1044
+ line1_from_x,
1045
+ line1_from_y,
1046
+ line1_to_x,
1047
+ line1_to_y,
1048
+ line2_from_x,
1049
+ line2_from_y,
1050
+ line2_to_x,
1051
+ line2_to_y,
1052
+ )
1053
+ if (res.onLine1 && res.onLine2) {
1054
+ var newSegment
1055
+ line2_from_y === line2_to_y
1056
+ ? line2_from_x > line2_to_x
1057
+ ? ((newSegment = [
1058
+ 'L',
1059
+ res.x + 2 * lineWith,
1060
+ line2_from_y,
1061
+ ]),
1062
+ lPath.splice(lP + 1, 0, newSegment),
1063
+ (newSegment = [
1064
+ 'C',
1065
+ res.x + 2 * lineWith,
1066
+ line2_from_y,
1067
+ res.x,
1068
+ line2_from_y - 4 * lineWith,
1069
+ res.x - 2 * lineWith,
1070
+ line2_from_y,
1071
+ ]),
1072
+ lPath.splice(lP + 2, 0, newSegment),
1073
+ line.attr('path', lPath))
1074
+ : ((newSegment = [
1075
+ 'L',
1076
+ res.x - 2 * lineWith,
1077
+ line2_from_y,
1078
+ ]),
1079
+ lPath.splice(lP + 1, 0, newSegment),
1080
+ (newSegment = [
1081
+ 'C',
1082
+ res.x - 2 * lineWith,
1083
+ line2_from_y,
1084
+ res.x,
1085
+ line2_from_y - 4 * lineWith,
1086
+ res.x + 2 * lineWith,
1087
+ line2_from_y,
1088
+ ]),
1089
+ lPath.splice(lP + 2, 0, newSegment),
1090
+ line.attr('path', lPath))
1091
+ : line2_from_y > line2_to_y
1092
+ ? ((newSegment = [
1093
+ 'L',
1094
+ line2_from_x,
1095
+ res.y + 2 * lineWith,
1096
+ ]),
1097
+ lPath.splice(lP + 1, 0, newSegment),
1098
+ (newSegment = [
1099
+ 'C',
1100
+ line2_from_x,
1101
+ res.y + 2 * lineWith,
1102
+ line2_from_x + 4 * lineWith,
1103
+ res.y,
1104
+ line2_from_x,
1105
+ res.y - 2 * lineWith,
1106
+ ]),
1107
+ lPath.splice(lP + 2, 0, newSegment),
1108
+ line.attr('path', lPath))
1109
+ : ((newSegment = [
1110
+ 'L',
1111
+ line2_from_x,
1112
+ res.y - 2 * lineWith,
1113
+ ]),
1114
+ lPath.splice(lP + 1, 0, newSegment),
1115
+ (newSegment = [
1116
+ 'C',
1117
+ line2_from_x,
1118
+ res.y - 2 * lineWith,
1119
+ line2_from_x + 4 * lineWith,
1120
+ res.y,
1121
+ line2_from_x,
1122
+ res.y + 2 * lineWith,
1123
+ ]),
1124
+ lPath.splice(lP + 2, 0, newSegment),
1125
+ line.attr('path', lPath)),
1126
+ (lP += 2)
1127
+ }
1128
+ }
1129
+ }
1130
+ this.chart.lines.push(line),
1131
+ (void 0 === this.chart.minXFromSymbols ||
1132
+ this.chart.minXFromSymbols > left.x) &&
1133
+ (this.chart.minXFromSymbols = left.x)
1134
+ }
1135
+ ;(!this.chart.maxXFromLine ||
1136
+ (this.chart.maxXFromLine && maxX > this.chart.maxXFromLine)) &&
1137
+ (this.chart.maxXFromLine = maxX)
1138
+ }),
1139
+ (module.exports = Symbol)
1140
+ } /* 3 */,
1141
+ /*!************************************!*\
1142
+ !*** ./src/flowchart.functions.js ***!
1143
+ \************************************/
1144
+ /***/
1145
+ function (module, exports) {
1146
+ function drawPath(chart, location, points) {
1147
+ var i,
1148
+ len,
1149
+ path = 'M{0},{1}'
1150
+ for (i = 2, len = 2 * points.length + 2; i < len; i += 2)
1151
+ path += ' L{' + i + '},{' + (i + 1) + '}'
1152
+ var pathValues = [location.x, location.y]
1153
+ for (i = 0, len = points.length; i < len; i++)
1154
+ pathValues.push(points[i].x), pathValues.push(points[i].y)
1155
+ var symbol = chart.paper.path(path, pathValues)
1156
+ symbol.attr('stroke', chart.options['element-color']),
1157
+ symbol.attr('stroke-width', chart.options['line-width'])
1158
+ var font = chart.options.font,
1159
+ fontF = chart.options['font-family'],
1160
+ fontW = chart.options['font-weight']
1161
+ return (
1162
+ font &&
1163
+ symbol.attr({
1164
+ font: font,
1165
+ }),
1166
+ fontF &&
1167
+ symbol.attr({
1168
+ 'font-family': fontF,
1169
+ }),
1170
+ fontW &&
1171
+ symbol.attr({
1172
+ 'font-weight': fontW,
1173
+ }),
1174
+ symbol
1175
+ )
1176
+ }
1177
+ function drawLine(chart, from, to, text) {
1178
+ var i, len
1179
+ '[object Array]' !== Object.prototype.toString.call(to) && (to = [to])
1180
+ var path = 'M{0},{1}'
1181
+ for (i = 2, len = 2 * to.length + 2; i < len; i += 2)
1182
+ path += ' L{' + i + '},{' + (i + 1) + '}'
1183
+ var pathValues = [from.x, from.y]
1184
+ for (i = 0, len = to.length; i < len; i++)
1185
+ pathValues.push(to[i].x), pathValues.push(to[i].y)
1186
+ var line = chart.paper.path(path, pathValues)
1187
+ line.attr({
1188
+ stroke: chart.options['line-color'],
1189
+ 'stroke-width': chart.options['line-width'],
1190
+ 'arrow-end': chart.options['arrow-end'],
1191
+ })
1192
+ var font = chart.options.font,
1193
+ fontF = chart.options['font-family'],
1194
+ fontW = chart.options['font-weight']
1195
+ if (
1196
+ (font &&
1197
+ line.attr({
1198
+ font: font,
1199
+ }),
1200
+ fontF &&
1201
+ line.attr({
1202
+ 'font-family': fontF,
1203
+ }),
1204
+ fontW &&
1205
+ line.attr({
1206
+ 'font-weight': fontW,
1207
+ }),
1208
+ text)
1209
+ ) {
1210
+ var centerText = !1,
1211
+ textPath = chart.paper.text(0, 0, text),
1212
+ textAnchor = 'start',
1213
+ isHorizontal = !1,
1214
+ firstTo = to[0]
1215
+ from.y === firstTo.y && (isHorizontal = !0)
1216
+ var x = 0,
1217
+ y = 0
1218
+ centerText
1219
+ ? ((x =
1220
+ from.x > firstTo.x
1221
+ ? from.x - (from.x - firstTo.x) / 2
1222
+ : firstTo.x - (firstTo.x - from.x) / 2),
1223
+ (y =
1224
+ from.y > firstTo.y
1225
+ ? from.y - (from.y - firstTo.y) / 2
1226
+ : firstTo.y - (firstTo.y - from.y) / 2),
1227
+ isHorizontal
1228
+ ? ((x -= textPath.getBBox().width / 2),
1229
+ (y -= chart.options['text-margin']))
1230
+ : ((x += chart.options['text-margin']),
1231
+ (y -= textPath.getBBox().height / 2)))
1232
+ : ((x = from.x),
1233
+ (y = from.y),
1234
+ isHorizontal
1235
+ ? (from.x > firstTo.x
1236
+ ? ((x -= chart.options['text-margin'] / 2),
1237
+ (textAnchor = 'end'))
1238
+ : (x += chart.options['text-margin'] / 2),
1239
+ (y -= chart.options['text-margin']))
1240
+ : ((x += chart.options['text-margin'] / 2),
1241
+ (y += chart.options['text-margin']),
1242
+ from.y > firstTo.y &&
1243
+ (y -= 2 * chart.options['text-margin']))),
1244
+ textPath.attr({
1245
+ 'text-anchor': textAnchor,
1246
+ 'font-size': chart.options['font-size'],
1247
+ fill: chart.options['font-color'],
1248
+ x: x,
1249
+ y: y,
1250
+ }),
1251
+ font &&
1252
+ textPath.attr({
1253
+ font: font,
1254
+ }),
1255
+ fontF &&
1256
+ textPath.attr({
1257
+ 'font-family': fontF,
1258
+ }),
1259
+ fontW &&
1260
+ textPath.attr({
1261
+ 'font-weight': fontW,
1262
+ })
1263
+ }
1264
+ return line
1265
+ }
1266
+ function checkLineIntersection(
1267
+ line1StartX,
1268
+ line1StartY,
1269
+ line1EndX,
1270
+ line1EndY,
1271
+ line2StartX,
1272
+ line2StartY,
1273
+ line2EndX,
1274
+ line2EndY,
1275
+ ) {
1276
+ // 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
1277
+ var denominator,
1278
+ a,
1279
+ b,
1280
+ numerator1,
1281
+ numerator2,
1282
+ result = {
1283
+ x: null,
1284
+ y: null,
1285
+ onLine1: !1,
1286
+ onLine2: !1,
1287
+ }
1288
+ // if we cast these lines infinitely in both directions, they intersect here:
1289
+ /*
1290
+ // it is worth noting that this should be the same as:
1291
+ x = line2StartX + (b * (line2EndX - line2StartX));
1292
+ y = line2StartX + (b * (line2EndY - line2StartY));
1293
+ */
1294
+ // if line1 is a segment and line2 is infinite, they intersect if:
1295
+ // if line2 is a segment and line1 is infinite, they intersect if:
1296
+ return (
1297
+ (denominator =
1298
+ (line2EndY - line2StartY) * (line1EndX - line1StartX) -
1299
+ (line2EndX - line2StartX) * (line1EndY - line1StartY)),
1300
+ 0 === denominator
1301
+ ? result
1302
+ : ((a = line1StartY - line2StartY),
1303
+ (b = line1StartX - line2StartX),
1304
+ (numerator1 =
1305
+ (line2EndX - line2StartX) * a - (line2EndY - line2StartY) * b),
1306
+ (numerator2 =
1307
+ (line1EndX - line1StartX) * a - (line1EndY - line1StartY) * b),
1308
+ (a = numerator1 / denominator),
1309
+ (b = numerator2 / denominator),
1310
+ (result.x = line1StartX + a * (line1EndX - line1StartX)),
1311
+ (result.y = line1StartY + a * (line1EndY - line1StartY)),
1312
+ a > 0 && a < 1 && (result.onLine1 = !0),
1313
+ b > 0 && b < 1 && (result.onLine2 = !0),
1314
+ result)
1315
+ )
1316
+ }
1317
+ module.exports = {
1318
+ drawPath: drawPath,
1319
+ drawLine: drawLine,
1320
+ checkLineIntersection: checkLineIntersection,
1321
+ }
1322
+ } /* 4 */,
1323
+ /*!********************************!*\
1324
+ !*** ./src/flowchart.parse.js ***!
1325
+ \********************************/
1326
+ /***/
1327
+ function (module, exports, __webpack_require__) {
1328
+ function parse(input) {
1329
+ function getStyle(s) {
1330
+ var startIndex = s.indexOf('(') + 1,
1331
+ endIndex = s.indexOf(')')
1332
+ return startIndex >= 0 && endIndex >= 0
1333
+ ? s.substring(startIndex, endIndex)
1334
+ : '{}'
1335
+ }
1336
+ function getSymbValue(s) {
1337
+ var startIndex = s.indexOf('(') + 1,
1338
+ endIndex = s.indexOf(')')
1339
+ return startIndex >= 0 && endIndex >= 0
1340
+ ? s.substring(startIndex, endIndex)
1341
+ : ''
1342
+ }
1343
+ function getSymbol(s) {
1344
+ var startIndex = s.indexOf('(') + 1,
1345
+ endIndex = s.indexOf(')')
1346
+ return startIndex >= 0 && endIndex >= 0
1347
+ ? chart.symbols[s.substring(0, startIndex - 1)]
1348
+ : chart.symbols[s]
1349
+ }
1350
+ function getNextPath(s) {
1351
+ var next = 'next',
1352
+ startIndex = s.indexOf('(') + 1,
1353
+ endIndex = s.indexOf(')')
1354
+ return (
1355
+ startIndex >= 0 &&
1356
+ endIndex >= 0 &&
1357
+ ((next = flowSymb.substring(startIndex, endIndex)),
1358
+ next.indexOf(',') < 0 &&
1359
+ 'yes' !== next &&
1360
+ 'no' !== next &&
1361
+ (next = 'next, ' + next)),
1362
+ next
1363
+ )
1364
+ }
1365
+ function getAnnotation(s) {
1366
+ var startIndex = s.indexOf('(') + 1,
1367
+ endIndex = s.indexOf(')'),
1368
+ tmp = s.substring(startIndex, endIndex)
1369
+ tmp.indexOf(',') > 0 && (tmp = tmp.substring(0, tmp.indexOf(',')))
1370
+ var tmp_split = tmp.split('@')
1371
+ if (tmp_split.length > 1)
1372
+ return startIndex >= 0 && endIndex >= 0 ? tmp_split[1] : ''
1373
+ }
1374
+ ;(input = input || ''), (input = input.trim())
1375
+ for (
1376
+ var chart = {
1377
+ symbols: {},
1378
+ start: null,
1379
+ drawSVG: function (container, options) {
1380
+ function getDisplaySymbol(s) {
1381
+ if (dispSymbols[s.key]) return dispSymbols[s.key]
1382
+ switch (s.symbolType) {
1383
+ case 'start':
1384
+ dispSymbols[s.key] = new Start(diagram, s)
1385
+ break
1386
+
1387
+ case 'end':
1388
+ dispSymbols[s.key] = new End(diagram, s)
1389
+ break
1390
+
1391
+ case 'operation':
1392
+ dispSymbols[s.key] = new Operation(diagram, s)
1393
+ break
1394
+
1395
+ case 'inputoutput':
1396
+ dispSymbols[s.key] = new InputOutput(diagram, s)
1397
+ break
1398
+
1399
+ case 'input':
1400
+ dispSymbols[s.key] = new Input(diagram, s)
1401
+ //tds
1402
+ break
1403
+
1404
+ case 'output':
1405
+ dispSymbols[s.key] = new Output(diagram, s)
1406
+ //tds
1407
+ break
1408
+
1409
+ case 'subroutine':
1410
+ dispSymbols[s.key] = new Subroutine(diagram, s)
1411
+ break
1412
+
1413
+ case 'condition':
1414
+ dispSymbols[s.key] = new Condition(diagram, s)
1415
+ break
1416
+
1417
+ case 'parallel':
1418
+ dispSymbols[s.key] = new Parallel(diagram, s)
1419
+ break
1420
+
1421
+ default:
1422
+ return new Error('Wrong symbol type!')
1423
+ }
1424
+ return dispSymbols[s.key]
1425
+ }
1426
+ var self = this
1427
+ this.diagram && this.diagram.clean()
1428
+ var diagram = new FlowChart(container, options)
1429
+ this.diagram = diagram
1430
+ var dispSymbols = {}
1431
+ !(function constructChart(s, prevDisp, prev) {
1432
+ var dispSymb = getDisplaySymbol(s)
1433
+ return (
1434
+ self.start === s
1435
+ ? diagram.startWith(dispSymb)
1436
+ : prevDisp &&
1437
+ prev &&
1438
+ !prevDisp.pathOk &&
1439
+ (prevDisp instanceof Condition
1440
+ ? (prev.yes === s && prevDisp.yes(dispSymb),
1441
+ prev.no === s && prevDisp.no(dispSymb))
1442
+ : prevDisp instanceof Parallel
1443
+ ? (prev.path1 === s && prevDisp.path1(dispSymb),
1444
+ prev.path2 === s && prevDisp.path2(dispSymb),
1445
+ prev.path3 === s && prevDisp.path3(dispSymb))
1446
+ : prevDisp.then(dispSymb)),
1447
+ dispSymb.pathOk
1448
+ ? dispSymb
1449
+ : (dispSymb instanceof Condition
1450
+ ? (s.yes && constructChart(s.yes, dispSymb, s),
1451
+ s.no && constructChart(s.no, dispSymb, s))
1452
+ : dispSymb instanceof Parallel
1453
+ ? (s.path1 && constructChart(s.path1, dispSymb, s),
1454
+ s.path2 && constructChart(s.path2, dispSymb, s),
1455
+ s.path3 && constructChart(s.path3, dispSymb, s))
1456
+ : s.next && constructChart(s.next, dispSymb, s),
1457
+ dispSymb)
1458
+ )
1459
+ })(this.start),
1460
+ diagram.render()
1461
+ },
1462
+ clean: function () {
1463
+ this.diagram.clean()
1464
+ },
1465
+ options: function () {
1466
+ return this.diagram.options
1467
+ },
1468
+ },
1469
+ lines = [],
1470
+ prevBreak = 0,
1471
+ i0 = 1,
1472
+ i0len = input.length;
1473
+ i0 < i0len;
1474
+ i0++
1475
+ )
1476
+ if ('\n' === input[i0] && '\\' !== input[i0 - 1]) {
1477
+ var line0 = input.substring(prevBreak, i0)
1478
+ ;(prevBreak = i0 + 1), lines.push(line0.replace(/\\\n/g, '\n'))
1479
+ }
1480
+ prevBreak < input.length && lines.push(input.substr(prevBreak))
1481
+ for (var l = 1, len = lines.length; l < len; ) {
1482
+ var currentLine = lines[l]
1483
+ currentLine.indexOf('->') < 0 &&
1484
+ currentLine.indexOf('=>') < 0 &&
1485
+ currentLine.indexOf('@>') < 0
1486
+ ? ((lines[l - 1] += '\n' + currentLine), lines.splice(l, 1), len--)
1487
+ : l++
1488
+ }
1489
+ for (; lines.length > 0; ) {
1490
+ var line = lines.splice(0, 1)[0].trim()
1491
+ if (line.indexOf('=>') >= 0) {
1492
+ // definition
1493
+ var parts = line.split('=>'),
1494
+ symbol = {
1495
+ key: parts[0].replace(/\(.*\)/, ''),
1496
+ symbolType: parts[1],
1497
+ text: null,
1498
+ link: null,
1499
+ target: null,
1500
+ flowstate: null,
1501
+ function: null,
1502
+ lineStyle: {},
1503
+ params: {},
1504
+ },
1505
+ params = parts[0].match(/\((.*)\)/)
1506
+ if (params && params.length > 1)
1507
+ for (
1508
+ var entries = params[1].split(','), i = 0;
1509
+ i < entries.length;
1510
+ i++
1511
+ ) {
1512
+ var entry = entries[i].split('=')
1513
+ 2 == entry.length && (symbol.params[entry[0]] = entry[1])
1514
+ }
1515
+ var sub
1516
+ /* adding support for links */
1517
+ if (
1518
+ (symbol.symbolType.indexOf(': ') >= 0 &&
1519
+ ((sub = symbol.symbolType.split(': ')),
1520
+ (symbol.symbolType = sub.shift()),
1521
+ (symbol.text = sub.join(': '))),
1522
+ symbol.text && symbol.text.indexOf(':$') >= 0
1523
+ ? ((sub = symbol.text.split(':$')),
1524
+ (symbol.text = sub.shift()),
1525
+ (symbol.function = sub.join(':$')))
1526
+ : symbol.symbolType.indexOf(':$') >= 0
1527
+ ? ((sub = symbol.symbolType.split(':$')),
1528
+ (symbol.symbolType = sub.shift()),
1529
+ (symbol.function = sub.join(':$')))
1530
+ : symbol.text && symbol.text.indexOf(':>') >= 0
1531
+ ? ((sub = symbol.text.split(':>')),
1532
+ (symbol.text = sub.shift()),
1533
+ (symbol.link = sub.join(':>')))
1534
+ : symbol.symbolType.indexOf(':>') >= 0 &&
1535
+ ((sub = symbol.symbolType.split(':>')),
1536
+ (symbol.symbolType = sub.shift()),
1537
+ (symbol.link = sub.join(':>'))),
1538
+ symbol.symbolType.indexOf('\n') >= 0 &&
1539
+ (symbol.symbolType = symbol.symbolType.split('\n')[0]),
1540
+ symbol.link)
1541
+ ) {
1542
+ var startIndex = symbol.link.indexOf('[') + 1,
1543
+ endIndex = symbol.link.indexOf(']')
1544
+ startIndex >= 0 &&
1545
+ endIndex >= 0 &&
1546
+ ((symbol.target = symbol.link.substring(startIndex, endIndex)),
1547
+ (symbol.link = symbol.link.substring(0, startIndex - 1)))
1548
+ }
1549
+ /* end of link support */
1550
+ /* adding support for flowstates */
1551
+ if (symbol.text && symbol.text.indexOf('|') >= 0) {
1552
+ var txtAndState = symbol.text.split('|')
1553
+ ;(symbol.flowstate = txtAndState.pop().trim()),
1554
+ (symbol.text = txtAndState.join('|'))
1555
+ }
1556
+ /* end of flowstate support */
1557
+ chart.symbols[symbol.key] = symbol
1558
+ } else if (line.indexOf('->') >= 0) {
1559
+ var ann = getAnnotation(line)
1560
+ ann && (line = line.replace('@' + ann, ''))
1561
+ for (
1562
+ var flowSymbols = line.split('->'),
1563
+ iS = 0,
1564
+ lenS = flowSymbols.length;
1565
+ iS < lenS;
1566
+ iS++
1567
+ ) {
1568
+ var flowSymb = flowSymbols[iS],
1569
+ symbVal = getSymbValue(flowSymb)
1570
+ ;('true' !== symbVal && 'false' !== symbVal) || // map true or false to yes or no respectively
1571
+ ((flowSymb = flowSymb.replace('true', 'yes')),
1572
+ (flowSymb = flowSymb.replace('false', 'no')))
1573
+ var next = getNextPath(flowSymb),
1574
+ realSymb = getSymbol(flowSymb),
1575
+ direction = null
1576
+ if (next.indexOf(',') >= 0) {
1577
+ var condOpt = next.split(',')
1578
+ ;(next = condOpt[0]), (direction = condOpt[1].trim())
1579
+ }
1580
+ if (
1581
+ (ann &&
1582
+ ('condition' === realSymb.symbolType
1583
+ ? 'yes' === next || 'true' === next
1584
+ ? (realSymb.yes_annotation = ann)
1585
+ : (realSymb.no_annotation = ann)
1586
+ : 'parallel' === realSymb.symbolType &&
1587
+ ('path1' === next
1588
+ ? (realSymb.path1_annotation = ann)
1589
+ : 'path2' === next
1590
+ ? (realSymb.path2_annotation = ann)
1591
+ : 'path3' === next &&
1592
+ (realSymb.path3_annotation = ann)),
1593
+ (ann = null)),
1594
+ chart.start || (chart.start = realSymb),
1595
+ iS + 1 < lenS)
1596
+ ) {
1597
+ var nextSymb = flowSymbols[iS + 1]
1598
+ ;(realSymb[next] = getSymbol(nextSymb)),
1599
+ (realSymb['direction_' + next] = direction),
1600
+ (direction = null)
1601
+ }
1602
+ }
1603
+ } else if (line.indexOf('@>') >= 0)
1604
+ for (
1605
+ var lineStyleSymbols = line.split('@>'),
1606
+ iSS = 0,
1607
+ lenSS = lineStyleSymbols.length;
1608
+ iSS < lenSS;
1609
+ iSS++
1610
+ )
1611
+ if (iSS + 1 !== lenSS) {
1612
+ var curSymb = getSymbol(lineStyleSymbols[iSS]),
1613
+ nextSymbol = getSymbol(lineStyleSymbols[iSS + 1])
1614
+ curSymb.lineStyle[nextSymbol.key] = JSON.parse(
1615
+ getStyle(lineStyleSymbols[iSS + 1]),
1616
+ )
1617
+ }
1618
+ }
1619
+ return chart
1620
+ }
1621
+ var FlowChart = __webpack_require__(/*! ./flowchart.chart */ 7),
1622
+ Start = __webpack_require__(/*! ./flowchart.symbol.start */ 15),
1623
+ End = __webpack_require__(/*! ./flowchart.symbol.end */ 10),
1624
+ Operation = __webpack_require__(/*! ./flowchart.symbol.operation */ 13),
1625
+ InputOutput = __webpack_require__(
1626
+ /*! ./flowchart.symbol.inputoutput */ 12,
1627
+ ),
1628
+ Input = __webpack_require__(/*! ./flowchart.symbol.input */ 11),
1629
+ Output = __webpack_require__(/*! ./flowchart.symbol.output */ 14),
1630
+ Subroutine = __webpack_require__(
1631
+ /*! ./flowchart.symbol.subroutine */ 16,
1632
+ ),
1633
+ Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5),
1634
+ Parallel = __webpack_require__(/*! ./flowchart.symbol.parallel */ 6)
1635
+ module.exports = parse
1636
+ } /* 5 */,
1637
+ /*!*******************************************!*\
1638
+ !*** ./src/flowchart.symbol.condition.js ***!
1639
+ \*******************************************/
1640
+ /***/
1641
+ function (module, exports, __webpack_require__) {
1642
+ function Condition(chart, options) {
1643
+ ;(options = options || {}),
1644
+ Symbol.call(this, chart, options),
1645
+ (this.yes_annotation = options.yes_annotation),
1646
+ (this.no_annotation = options.no_annotation),
1647
+ (this.textMargin = this.getAttr('text-margin')),
1648
+ (this.yes_direction = options.direction_yes),
1649
+ (this.no_direction = options.direction_no),
1650
+ this.no_direction || 'right' !== this.yes_direction
1651
+ ? this.yes_direction ||
1652
+ 'bottom' !== this.no_direction ||
1653
+ (this.yes_direction = 'right')
1654
+ : (this.no_direction = 'bottom'),
1655
+ (this.yes_direction = this.yes_direction || 'bottom'),
1656
+ (this.no_direction = this.no_direction || 'right'),
1657
+ this.text.attr({
1658
+ x: 2 * this.textMargin,
1659
+ })
1660
+ var width = this.text.getBBox().width + 3 * this.textMargin
1661
+ width += width / 2
1662
+ var height = this.text.getBBox().height + 2 * this.textMargin
1663
+ ;(height += height / 2), (height = Math.max(0.5 * width, height))
1664
+ var startX = width / 4,
1665
+ startY = height / 4
1666
+ this.text.attr({
1667
+ x: startX + this.textMargin / 2,
1668
+ })
1669
+ var start = {
1670
+ x: startX,
1671
+ y: startY,
1672
+ },
1673
+ points = [
1674
+ {
1675
+ x: startX - width / 4,
1676
+ y: startY + height / 4,
1677
+ },
1678
+ {
1679
+ x: startX - width / 4 + width / 2,
1680
+ y: startY + height / 4 + height / 2,
1681
+ },
1682
+ {
1683
+ x: startX - width / 4 + width,
1684
+ y: startY + height / 4,
1685
+ },
1686
+ {
1687
+ x: startX - width / 4 + width / 2,
1688
+ y: startY + height / 4 - height / 2,
1689
+ },
1690
+ {
1691
+ x: startX - width / 4,
1692
+ y: startY + height / 4,
1693
+ },
1694
+ ],
1695
+ symbol = drawPath(chart, start, points)
1696
+ symbol.attr({
1697
+ stroke: this.getAttr('element-color'),
1698
+ 'stroke-width': this.getAttr('line-width'),
1699
+ fill: this.getAttr('fill'),
1700
+ }),
1701
+ options.link && symbol.attr('href', options.link),
1702
+ options.target && symbol.attr('target', options.target),
1703
+ options.key && (symbol.node.id = options.key),
1704
+ symbol.node.setAttribute('class', this.getAttr('class')),
1705
+ this.text.attr({
1706
+ y: symbol.getBBox().height / 2,
1707
+ }),
1708
+ this.group.push(symbol),
1709
+ symbol.insertBefore(this.text),
1710
+ (this.symbol = symbol),
1711
+ this.initialize()
1712
+ }
1713
+ var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2),
1714
+ inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits,
1715
+ drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3),
1716
+ drawPath = drawAPI.drawPath
1717
+ inherits(Condition, Symbol),
1718
+ (Condition.prototype.render = function () {
1719
+ var self = this
1720
+ this.yes_direction &&
1721
+ (this[this.yes_direction + '_symbol'] = this.yes_symbol),
1722
+ this.no_direction &&
1723
+ (this[this.no_direction + '_symbol'] = this.no_symbol)
1724
+ var lineLength = this.getAttr('line-length')
1725
+ if (this.bottom_symbol) {
1726
+ var bottomPoint = this.getBottom()
1727
+ this.bottom_symbol.isPositioned ||
1728
+ (this.bottom_symbol.shiftY(
1729
+ this.getY() + this.height + lineLength,
1730
+ ),
1731
+ this.bottom_symbol.setX(
1732
+ bottomPoint.x - this.bottom_symbol.width / 2,
1733
+ ),
1734
+ (this.bottom_symbol.isPositioned = !0),
1735
+ this.bottom_symbol.render())
1736
+ }
1737
+ if (this.right_symbol) {
1738
+ var rightPoint = this.getRight()
1739
+ this.right_symbol.isPositioned ||
1740
+ (this.right_symbol.setY(
1741
+ rightPoint.y - this.right_symbol.height / 2,
1742
+ ),
1743
+ this.right_symbol.shiftX(
1744
+ this.group.getBBox().x + this.width + lineLength,
1745
+ ),
1746
+ (function shift() {
1747
+ for (
1748
+ var symb,
1749
+ hasSymbolUnder = !1,
1750
+ i = 0,
1751
+ len = self.chart.symbols.length;
1752
+ i < len;
1753
+ i++
1754
+ )
1755
+ if (
1756
+ ((symb = self.chart.symbols[i]),
1757
+ !self.params['align-next'] ||
1758
+ 'no' !== self.params['align-next'])
1759
+ ) {
1760
+ var diff = Math.abs(
1761
+ symb.getCenter().x - self.right_symbol.getCenter().x,
1762
+ )
1763
+ if (
1764
+ symb.getCenter().y > self.right_symbol.getCenter().y &&
1765
+ diff <= self.right_symbol.width / 2
1766
+ ) {
1767
+ hasSymbolUnder = !0
1768
+ break
1769
+ }
1770
+ }
1771
+ if (hasSymbolUnder) {
1772
+ if ('end' === self.right_symbol.symbolType) return
1773
+ self.right_symbol.setX(symb.getX() + symb.width + lineLength),
1774
+ shift()
1775
+ }
1776
+ })(),
1777
+ (this.right_symbol.isPositioned = !0),
1778
+ this.right_symbol.render())
1779
+ }
1780
+ if (this.left_symbol) {
1781
+ var leftPoint = this.getLeft()
1782
+ this.left_symbol.isPositioned ||
1783
+ (this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2),
1784
+ this.left_symbol.shiftX(
1785
+ -(this.group.getBBox().x + this.width + lineLength),
1786
+ ),
1787
+ (function shift() {
1788
+ for (
1789
+ var symb,
1790
+ hasSymbolUnder = !1,
1791
+ i = 0,
1792
+ len = self.chart.symbols.length;
1793
+ i < len;
1794
+ i++
1795
+ )
1796
+ if (
1797
+ ((symb = self.chart.symbols[i]),
1798
+ !self.params['align-next'] ||
1799
+ 'no' !== self.params['align-next'])
1800
+ ) {
1801
+ var diff = Math.abs(
1802
+ symb.getCenter().x - self.left_symbol.getCenter().x,
1803
+ )
1804
+ if (
1805
+ symb.getCenter().y > self.left_symbol.getCenter().y &&
1806
+ diff <= self.left_symbol.width / 2
1807
+ ) {
1808
+ hasSymbolUnder = !0
1809
+ break
1810
+ }
1811
+ }
1812
+ if (hasSymbolUnder) {
1813
+ if ('end' === self.left_symbol.symbolType) return
1814
+ self.left_symbol.setX(symb.getX() + symb.width + lineLength),
1815
+ shift()
1816
+ }
1817
+ })(),
1818
+ (this.left_symbol.isPositioned = !0),
1819
+ this.left_symbol.render())
1820
+ }
1821
+ }),
1822
+ (Condition.prototype.renderLines = function () {
1823
+ this.yes_symbol &&
1824
+ this.drawLineTo(
1825
+ this.yes_symbol,
1826
+ this.yes_annotation
1827
+ ? this.yes_annotation
1828
+ : this.getAttr('yes-text'),
1829
+ this.yes_direction,
1830
+ ),
1831
+ this.no_symbol &&
1832
+ this.drawLineTo(
1833
+ this.no_symbol,
1834
+ this.no_annotation
1835
+ ? this.no_annotation
1836
+ : this.getAttr('no-text'),
1837
+ this.no_direction,
1838
+ )
1839
+ }),
1840
+ (module.exports = Condition)
1841
+ } /* 6 */,
1842
+ /*!******************************************!*\
1843
+ !*** ./src/flowchart.symbol.parallel.js ***!
1844
+ \******************************************/
1845
+ /***/
1846
+ function (module, exports, __webpack_require__) {
1847
+ function Parallel(chart, options) {
1848
+ var symbol = chart.paper.rect(0, 0, 0, 0)
1849
+ ;(options = options || {}),
1850
+ Symbol.call(this, chart, options, symbol),
1851
+ (this.path1_annotation = options.path1_annotation || ''),
1852
+ (this.path2_annotation = options.path2_annotation || ''),
1853
+ (this.path3_annotation = options.path3_annotation || ''),
1854
+ (this.textMargin = this.getAttr('text-margin')),
1855
+ (this.path1_direction = 'bottom'),
1856
+ (this.path2_direction = 'right'),
1857
+ (this.path3_direction = 'top'),
1858
+ (this.params = options.params),
1859
+ 'path1' === options.direction_next &&
1860
+ !options[options.direction_next] &&
1861
+ options.next &&
1862
+ (options[options.direction_next] = options.next),
1863
+ 'path2' === options.direction_next &&
1864
+ !options[options.direction_next] &&
1865
+ options.next &&
1866
+ (options[options.direction_next] = options.next),
1867
+ 'path3' === options.direction_next &&
1868
+ !options[options.direction_next] &&
1869
+ options.next &&
1870
+ (options[options.direction_next] = options.next),
1871
+ options.path1 &&
1872
+ options.direction_path1 &&
1873
+ options.path2 &&
1874
+ !options.direction_path2 &&
1875
+ options.path3 &&
1876
+ !options.direction_path3
1877
+ ? 'right' === options.direction_path1
1878
+ ? ((this.path2_direction = 'bottom'),
1879
+ (this.path1_direction = 'right'),
1880
+ (this.path3_direction = 'top'))
1881
+ : 'top' === options.direction_path1
1882
+ ? ((this.path2_direction = 'right'),
1883
+ (this.path1_direction = 'top'),
1884
+ (this.path3_direction = 'bottom'))
1885
+ : 'left' === options.direction_path1
1886
+ ? ((this.path2_direction = 'right'),
1887
+ (this.path1_direction = 'left'),
1888
+ (this.path3_direction = 'bottom'))
1889
+ : ((this.path2_direction = 'right'),
1890
+ (this.path1_direction = 'bottom'),
1891
+ (this.path3_direction = 'top'))
1892
+ : options.path1 &&
1893
+ !options.direction_path1 &&
1894
+ options.path2 &&
1895
+ options.direction_path2 &&
1896
+ options.path3 &&
1897
+ !options.direction_path3
1898
+ ? 'right' === options.direction_path2
1899
+ ? ((this.path1_direction = 'bottom'),
1900
+ (this.path2_direction = 'right'),
1901
+ (this.path3_direction = 'top'))
1902
+ : 'left' === options.direction_path2
1903
+ ? ((this.path1_direction = 'bottom'),
1904
+ (this.path2_direction = 'left'),
1905
+ (this.path3_direction = 'right'))
1906
+ : ((this.path1_direction = 'right'),
1907
+ (this.path2_direction = 'bottom'),
1908
+ (this.path3_direction = 'top'))
1909
+ : options.path1 &&
1910
+ !options.direction_path1 &&
1911
+ options.path2 &&
1912
+ !options.direction_path2 &&
1913
+ options.path3 &&
1914
+ options.direction_path3
1915
+ ? 'right' === options.direction_path2
1916
+ ? ((this.path1_direction = 'bottom'),
1917
+ (this.path2_direction = 'top'),
1918
+ (this.path3_direction = 'right'))
1919
+ : 'left' === options.direction_path2
1920
+ ? ((this.path1_direction = 'bottom'),
1921
+ (this.path2_direction = 'right'),
1922
+ (this.path3_direction = 'left'))
1923
+ : ((this.path1_direction = 'right'),
1924
+ (this.path2_direction = 'bottom'),
1925
+ (this.path3_direction = 'top'))
1926
+ : ((this.path1_direction = options.direction_path1),
1927
+ (this.path2_direction = options.direction_path2),
1928
+ (this.path3_direction = options.direction_path3)),
1929
+ (this.path1_direction = this.path1_direction || 'bottom'),
1930
+ (this.path2_direction = this.path2_direction || 'right'),
1931
+ (this.path3_direction = this.path3_direction || 'top'),
1932
+ this.initialize()
1933
+ }
1934
+ var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2),
1935
+ inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits
1936
+ inherits(Parallel, Symbol),
1937
+ (Parallel.prototype.render = function () {
1938
+ this.path1_direction &&
1939
+ (this[this.path1_direction + '_symbol'] = this.path1_symbol),
1940
+ this.path2_direction &&
1941
+ (this[this.path2_direction + '_symbol'] = this.path2_symbol),
1942
+ this.path3_direction &&
1943
+ (this[this.path3_direction + '_symbol'] = this.path3_symbol)
1944
+ var lineLength = this.getAttr('line-length')
1945
+ if (this.bottom_symbol) {
1946
+ var bottomPoint = this.getBottom()
1947
+ this.bottom_symbol.isPositioned ||
1948
+ (this.bottom_symbol.shiftY(
1949
+ this.getY() + this.height + lineLength,
1950
+ ),
1951
+ this.bottom_symbol.setX(
1952
+ bottomPoint.x - this.bottom_symbol.width / 2,
1953
+ ),
1954
+ (this.bottom_symbol.isPositioned = !0),
1955
+ this.bottom_symbol.render())
1956
+ }
1957
+ if (this.top_symbol) {
1958
+ var topPoint = this.getTop()
1959
+ this.top_symbol.isPositioned ||
1960
+ (this.top_symbol.shiftY(
1961
+ this.getY() - this.top_symbol.height - lineLength,
1962
+ ),
1963
+ this.top_symbol.setX(topPoint.x + this.top_symbol.width),
1964
+ (this.top_symbol.isPositioned = !0),
1965
+ this.top_symbol.render())
1966
+ }
1967
+ var self = this
1968
+ if (this.left_symbol) {
1969
+ var leftPoint = this.getLeft()
1970
+ this.left_symbol.isPositioned ||
1971
+ (this.left_symbol.setY(leftPoint.y - this.left_symbol.height / 2),
1972
+ this.left_symbol.shiftX(
1973
+ -(this.group.getBBox().x + this.width + lineLength),
1974
+ ),
1975
+ (function shift() {
1976
+ for (
1977
+ var symb,
1978
+ hasSymbolUnder = !1,
1979
+ i = 0,
1980
+ len = self.chart.symbols.length;
1981
+ i < len;
1982
+ i++
1983
+ )
1984
+ if (
1985
+ ((symb = self.chart.symbols[i]),
1986
+ !self.params['align-next'] ||
1987
+ 'no' !== self.params['align-next'])
1988
+ ) {
1989
+ var diff = Math.abs(
1990
+ symb.getCenter().x - self.left_symbol.getCenter().x,
1991
+ )
1992
+ if (
1993
+ symb.getCenter().y > self.left_symbol.getCenter().y &&
1994
+ diff <= self.left_symbol.width / 2
1995
+ ) {
1996
+ hasSymbolUnder = !0
1997
+ break
1998
+ }
1999
+ }
2000
+ if (hasSymbolUnder) {
2001
+ if ('end' === self.left_symbol.symbolType) return
2002
+ self.left_symbol.setX(symb.getX() + symb.width + lineLength),
2003
+ shift()
2004
+ }
2005
+ })(),
2006
+ (this.left_symbol.isPositioned = !0),
2007
+ this.left_symbol.render())
2008
+ }
2009
+ if (this.right_symbol) {
2010
+ var rightPoint = this.getRight()
2011
+ this.right_symbol.isPositioned ||
2012
+ (this.right_symbol.setY(
2013
+ rightPoint.y - this.right_symbol.height / 2,
2014
+ ),
2015
+ this.right_symbol.shiftX(
2016
+ this.group.getBBox().x + this.width + lineLength,
2017
+ ),
2018
+ (function shift() {
2019
+ for (
2020
+ var symb,
2021
+ hasSymbolUnder = !1,
2022
+ i = 0,
2023
+ len = self.chart.symbols.length;
2024
+ i < len;
2025
+ i++
2026
+ )
2027
+ if (
2028
+ ((symb = self.chart.symbols[i]),
2029
+ !self.params['align-next'] ||
2030
+ 'no' !== self.params['align-next'])
2031
+ ) {
2032
+ var diff = Math.abs(
2033
+ symb.getCenter().x - self.right_symbol.getCenter().x,
2034
+ )
2035
+ if (
2036
+ symb.getCenter().y > self.right_symbol.getCenter().y &&
2037
+ diff <= self.right_symbol.width / 2
2038
+ ) {
2039
+ hasSymbolUnder = !0
2040
+ break
2041
+ }
2042
+ }
2043
+ if (hasSymbolUnder) {
2044
+ if ('end' === self.right_symbol.symbolType) return
2045
+ self.right_symbol.setX(symb.getX() + symb.width + lineLength),
2046
+ shift()
2047
+ }
2048
+ })(),
2049
+ (this.right_symbol.isPositioned = !0),
2050
+ this.right_symbol.render())
2051
+ }
2052
+ }),
2053
+ (Parallel.prototype.renderLines = function () {
2054
+ this.path1_symbol &&
2055
+ this.drawLineTo(
2056
+ this.path1_symbol,
2057
+ this.path1_annotation,
2058
+ this.path1_direction,
2059
+ ),
2060
+ this.path2_symbol &&
2061
+ this.drawLineTo(
2062
+ this.path2_symbol,
2063
+ this.path2_annotation,
2064
+ this.path2_direction,
2065
+ ),
2066
+ this.path3_symbol &&
2067
+ this.drawLineTo(
2068
+ this.path3_symbol,
2069
+ this.path3_annotation,
2070
+ this.path3_direction,
2071
+ )
2072
+ }),
2073
+ (module.exports = Parallel)
2074
+ } /* 7 */,
2075
+ /*!********************************!*\
2076
+ !*** ./src/flowchart.chart.js ***!
2077
+ \********************************/
2078
+ /***/
2079
+ function (module, exports, __webpack_require__) {
2080
+ function FlowChart(container, options) {
2081
+ ;(options = options || {}),
2082
+ (this.paper = new Raphael(container)),
2083
+ (this.options = defaults(options, defaultOptions)),
2084
+ (this.symbols = []),
2085
+ (this.lines = []),
2086
+ (this.start = null)
2087
+ }
2088
+ var Raphael = __webpack_require__(/*! raphael */ 18),
2089
+ defaults = __webpack_require__(/*! ./flowchart.helpers */ 1).defaults,
2090
+ defaultOptions = __webpack_require__(/*! ./flowchart.defaults */ 8),
2091
+ Condition = __webpack_require__(/*! ./flowchart.symbol.condition */ 5),
2092
+ Parallel = __webpack_require__(/*! ./flowchart.symbol.parallel */ 6)
2093
+ ;(FlowChart.prototype.handle = function (symbol) {
2094
+ this.symbols.indexOf(symbol) <= -1 && this.symbols.push(symbol)
2095
+ var flowChart = this
2096
+ return (
2097
+ symbol instanceof Condition
2098
+ ? ((symbol.yes = function (nextSymbol) {
2099
+ return (
2100
+ (symbol.yes_symbol = nextSymbol),
2101
+ symbol.no_symbol && (symbol.pathOk = !0),
2102
+ flowChart.handle(nextSymbol)
2103
+ )
2104
+ }),
2105
+ (symbol.no = function (nextSymbol) {
2106
+ return (
2107
+ (symbol.no_symbol = nextSymbol),
2108
+ symbol.yes_symbol && (symbol.pathOk = !0),
2109
+ flowChart.handle(nextSymbol)
2110
+ )
2111
+ }))
2112
+ : symbol instanceof Parallel
2113
+ ? ((symbol.path1 = function (nextSymbol) {
2114
+ return (
2115
+ (symbol.path1_symbol = nextSymbol),
2116
+ symbol.path2_symbol && (symbol.pathOk = !0),
2117
+ flowChart.handle(nextSymbol)
2118
+ )
2119
+ }),
2120
+ (symbol.path2 = function (nextSymbol) {
2121
+ return (
2122
+ (symbol.path2_symbol = nextSymbol),
2123
+ symbol.path3_symbol && (symbol.pathOk = !0),
2124
+ flowChart.handle(nextSymbol)
2125
+ )
2126
+ }),
2127
+ (symbol.path3 = function (nextSymbol) {
2128
+ return (
2129
+ (symbol.path3_symbol = nextSymbol),
2130
+ symbol.path1_symbol && (symbol.pathOk = !0),
2131
+ flowChart.handle(nextSymbol)
2132
+ )
2133
+ }))
2134
+ : (symbol.then = function (nextSymbol) {
2135
+ return (
2136
+ (symbol.next = nextSymbol),
2137
+ (symbol.pathOk = !0),
2138
+ flowChart.handle(nextSymbol)
2139
+ )
2140
+ }),
2141
+ symbol
2142
+ )
2143
+ }),
2144
+ (FlowChart.prototype.startWith = function (symbol) {
2145
+ return (this.start = symbol), this.handle(symbol)
2146
+ }),
2147
+ (FlowChart.prototype.render = function () {
2148
+ var symbol,
2149
+ line,
2150
+ maxWidth = 0,
2151
+ maxHeight = 0,
2152
+ i = 0,
2153
+ len = 0,
2154
+ maxX = 0,
2155
+ maxY = 0,
2156
+ minX = 0,
2157
+ minY = 0
2158
+ for (i = 0, len = this.symbols.length; i < len; i++)
2159
+ (symbol = this.symbols[i]),
2160
+ symbol.width > maxWidth && (maxWidth = symbol.width),
2161
+ symbol.height > maxHeight && (maxHeight = symbol.height)
2162
+ for (i = 0, len = this.symbols.length; i < len; i++)
2163
+ (symbol = this.symbols[i]),
2164
+ symbol.shiftX(
2165
+ this.options.x +
2166
+ (maxWidth - symbol.width) / 2 +
2167
+ this.options['line-width'],
2168
+ ),
2169
+ symbol.shiftY(
2170
+ this.options.y +
2171
+ (maxHeight - symbol.height) / 2 +
2172
+ this.options['line-width'],
2173
+ )
2174
+ // for (i = 0, len = this.symbols.length; i < len; i++) {
2175
+ // symbol = this.symbols[i];
2176
+ // symbol.render();
2177
+ // }
2178
+ for (
2179
+ this.start.render(), i = 0, len = this.symbols.length;
2180
+ i < len;
2181
+ i++
2182
+ )
2183
+ (symbol = this.symbols[i]), symbol.renderLines()
2184
+ maxX = this.maxXFromLine
2185
+ var x, y
2186
+ for (i = 0, len = this.symbols.length; i < len; i++) {
2187
+ symbol = this.symbols[i]
2188
+ var leftX = symbol.getX()
2189
+ ;(x = leftX + symbol.width),
2190
+ (y = symbol.getY() + symbol.height),
2191
+ leftX < minX && (minX = leftX),
2192
+ x > maxX && (maxX = x),
2193
+ y > maxY && (maxY = y)
2194
+ }
2195
+ for (i = 0, len = this.lines.length; i < len; i++) {
2196
+ ;(line = this.lines[i].getBBox()), (x = line.x), (y = line.y)
2197
+ var x2 = line.x2,
2198
+ y2 = line.y2
2199
+ x < minX && (minX = x),
2200
+ y < minY && (minY = y),
2201
+ x2 > maxX && (maxX = x2),
2202
+ y2 > maxY && (maxY = y2)
2203
+ }
2204
+ var scale = this.options.scale,
2205
+ lineWidth = this.options['line-width']
2206
+ this.minXFromSymbols < minX && (minX = this.minXFromSymbols),
2207
+ minX < 0 && (minX -= lineWidth),
2208
+ minY < 0 && (minY -= lineWidth)
2209
+ var width = maxX + lineWidth - minX,
2210
+ height = maxY + lineWidth - minY
2211
+ this.paper.setSize(width * scale, height * scale),
2212
+ this.paper.setViewBox(minX, minY, width, height, !0)
2213
+ }),
2214
+ (FlowChart.prototype.clean = function () {
2215
+ if (this.paper) {
2216
+ var paperDom = this.paper.canvas
2217
+ paperDom.parentNode && paperDom.parentNode.removeChild(paperDom)
2218
+ }
2219
+ }),
2220
+ (module.exports = FlowChart)
2221
+ } /* 8 */,
2222
+ /*!***********************************!*\
2223
+ !*** ./src/flowchart.defaults.js ***!
2224
+ \***********************************/
2225
+ /***/
2226
+ function (module, exports) {
2227
+ // defaults
2228
+ module.exports = {
2229
+ x: 0,
2230
+ y: 0,
2231
+ // 'roundness': 0,
2232
+ 'line-width': 3,
2233
+ 'line-length': 50,
2234
+ 'text-margin': 10,
2235
+ 'font-size': 14,
2236
+ 'font-color': 'black',
2237
+ // 'font': 'normal',
2238
+ // 'font-family': 'calibri',
2239
+ // 'font-weight': 'normal',
2240
+ 'line-color': 'black',
2241
+ 'element-color': 'black',
2242
+ fill: 'white',
2243
+ 'yes-text': 'yes',
2244
+ 'no-text': 'no',
2245
+ 'arrow-end': 'block',
2246
+ class: 'flowchart',
2247
+ scale: 1,
2248
+ symbols: {
2249
+ start: {},
2250
+ end: {},
2251
+ condition: {},
2252
+ inputoutput: {},
2253
+ input: {},
2254
+ //tds
2255
+ output: {},
2256
+ //tds
2257
+ operation: {},
2258
+ subroutine: {},
2259
+ parallel: {},
2260
+ },
2261
+ }
2262
+ } /* 9 */,
2263
+ /*!*******************************!*\
2264
+ !*** ./src/flowchart.shim.js ***!
2265
+ \*******************************/
2266
+ /***/
2267
+ function (module, exports) {
2268
+ // add indexOf to non ECMA-262 standard compliant browsers
2269
+ Array.prototype.indexOf ||
2270
+ (Array.prototype.indexOf = function (searchElement) {
2271
+ 'use strict'
2272
+ if (null === this) throw new TypeError()
2273
+ var t = Object(this),
2274
+ len = t.length >>> 0
2275
+ if (0 === len) return -1
2276
+ var n = 0
2277
+ if (
2278
+ (arguments.length > 0 &&
2279
+ ((n = Number(arguments[1])),
2280
+ n != n // shortcut for verifying if it's NaN
2281
+ ? (n = 0)
2282
+ : 0 !== n &&
2283
+ n != 1 / 0 &&
2284
+ n != -(1 / 0) &&
2285
+ (n = (n > 0 || -1) * Math.floor(Math.abs(n)))),
2286
+ n >= len)
2287
+ )
2288
+ return -1
2289
+ for (
2290
+ var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
2291
+ k < len;
2292
+ k++
2293
+ )
2294
+ if (k in t && t[k] === searchElement) return k
2295
+ return -1
2296
+ }), // add lastIndexOf to non ECMA-262 standard compliant browsers
2297
+ Array.prototype.lastIndexOf ||
2298
+ (Array.prototype.lastIndexOf = function (searchElement) {
2299
+ 'use strict'
2300
+ if (null === this) throw new TypeError()
2301
+ var t = Object(this),
2302
+ len = t.length >>> 0
2303
+ if (0 === len) return -1
2304
+ var n = len
2305
+ arguments.length > 1 &&
2306
+ ((n = Number(arguments[1])),
2307
+ n != n
2308
+ ? (n = 0)
2309
+ : 0 !== n &&
2310
+ n != 1 / 0 &&
2311
+ n != -(1 / 0) &&
2312
+ (n = (n > 0 || -1) * Math.floor(Math.abs(n))))
2313
+ for (
2314
+ var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);
2315
+ k >= 0;
2316
+ k--
2317
+ )
2318
+ if (k in t && t[k] === searchElement) return k
2319
+ return -1
2320
+ }),
2321
+ String.prototype.trim ||
2322
+ (String.prototype.trim = function () {
2323
+ return this.replace(/^\s+|\s+$/g, '')
2324
+ })
2325
+ } /* 10 */,
2326
+ /*!*************************************!*\
2327
+ !*** ./src/flowchart.symbol.end.js ***!
2328
+ \*************************************/
2329
+ /***/
2330
+ function (module, exports, __webpack_require__) {
2331
+ function End(chart, options) {
2332
+ var symbol = chart.paper.rect(0, 0, 0, 0, 20)
2333
+ ;(options = options || {}),
2334
+ (options.text = options.text || 'End'),
2335
+ Symbol.call(this, chart, options, symbol)
2336
+ }
2337
+ var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2),
2338
+ inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits
2339
+ inherits(End, Symbol), (module.exports = End)
2340
+ } /* 11 */,
2341
+ /*!***************************************!*\
2342
+ !*** ./src/flowchart.symbol.input.js ***!
2343
+ \***************************************/
2344
+ /***/
2345
+ function (module, exports, __webpack_require__) {
2346
+ function Input(chart, options) {
2347
+ ;(options = options || {}),
2348
+ Symbol.call(this, chart, options),
2349
+ (this.textMargin = this.getAttr('text-margin')),
2350
+ this.text.attr({
2351
+ x: 3 * this.textMargin,
2352
+ })
2353
+ var width = this.text.getBBox().width + 4 * this.textMargin,
2354
+ height = this.text.getBBox().height + 2 * this.textMargin,
2355
+ startX = this.textMargin,
2356
+ startY = height / 2,
2357
+ start = {
2358
+ x: startX,
2359
+ y: startY,
2360
+ },
2361
+ points = [
2362
+ {
2363
+ x: startX - this.textMargin + 2 * this.textMargin,
2364
+ y: height,
2365
+ },
2366
+ {
2367
+ x: startX - this.textMargin + width,
2368
+ y: height,
2369
+ },
2370
+ {
2371
+ x: startX - this.textMargin + width + 2 * this.textMargin,
2372
+ y: 0,
2373
+ },
2374
+ {
2375
+ x: startX - this.textMargin,
2376
+ y: 0,
2377
+ },
2378
+ {
2379
+ x: startX,
2380
+ y: startY,
2381
+ },
2382
+ ],
2383
+ symbol = drawPath(chart, start, points)
2384
+ symbol.attr({
2385
+ stroke: this.getAttr('element-color'),
2386
+ 'stroke-width': this.getAttr('line-width'),
2387
+ fill: this.getAttr('fill'),
2388
+ }),
2389
+ options.link && symbol.attr('href', options.link),
2390
+ options.target && symbol.attr('target', options.target),
2391
+ options.key && (symbol.node.id = options.key),
2392
+ symbol.node.setAttribute('class', this.getAttr('class')),
2393
+ this.text.attr({
2394
+ y: symbol.getBBox().height / 2,
2395
+ }),
2396
+ this.group.push(symbol),
2397
+ symbol.insertBefore(this.text),
2398
+ (this.symbol = symbol),
2399
+ this.initialize()
2400
+ }
2401
+ var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2),
2402
+ inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits,
2403
+ drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3),
2404
+ drawPath = drawAPI.drawPath
2405
+ inherits(Input, Symbol),
2406
+ (Input.prototype.getLeft = function () {
2407
+ var y = this.getY() + this.group.getBBox().height / 2,
2408
+ x = this.getX() + this.textMargin
2409
+ return {
2410
+ x: x,
2411
+ y: y,
2412
+ }
2413
+ }),
2414
+ (Input.prototype.getRight = function () {
2415
+ var y = this.getY() + this.group.getBBox().height / 2,
2416
+ x = this.getX() + this.group.getBBox().width - this.textMargin
2417
+ return {
2418
+ x: x,
2419
+ y: y,
2420
+ }
2421
+ }),
2422
+ (module.exports = Input)
2423
+ } /* 12 */,
2424
+ /*!*********************************************!*\
2425
+ !*** ./src/flowchart.symbol.inputoutput.js ***!
2426
+ \*********************************************/
2427
+ /***/
2428
+ function (module, exports, __webpack_require__) {
2429
+ function InputOutput(chart, options) {
2430
+ ;(options = options || {}),
2431
+ Symbol.call(this, chart, options),
2432
+ (this.textMargin = this.getAttr('text-margin')),
2433
+ this.text.attr({
2434
+ x: 3 * this.textMargin,
2435
+ })
2436
+ var width = this.text.getBBox().width + 4 * this.textMargin,
2437
+ height = this.text.getBBox().height + 2 * this.textMargin,
2438
+ startX = this.textMargin,
2439
+ startY = height / 2,
2440
+ start = {
2441
+ x: startX,
2442
+ y: startY,
2443
+ },
2444
+ points = [
2445
+ {
2446
+ x: startX - this.textMargin,
2447
+ y: height,
2448
+ },
2449
+ {
2450
+ x: startX - this.textMargin + width,
2451
+ y: height,
2452
+ },
2453
+ {
2454
+ x: startX - this.textMargin + width + 2 * this.textMargin,
2455
+ y: 0,
2456
+ },
2457
+ {
2458
+ x: startX - this.textMargin + 2 * this.textMargin,
2459
+ y: 0,
2460
+ },
2461
+ {
2462
+ x: startX,
2463
+ y: startY,
2464
+ },
2465
+ ],
2466
+ symbol = drawPath(chart, start, points)
2467
+ symbol.attr({
2468
+ stroke: this.getAttr('element-color'),
2469
+ 'stroke-width': this.getAttr('line-width'),
2470
+ fill: this.getAttr('fill'),
2471
+ }),
2472
+ options.link && symbol.attr('href', options.link),
2473
+ options.target && symbol.attr('target', options.target),
2474
+ options.key && (symbol.node.id = options.key),
2475
+ symbol.node.setAttribute('class', this.getAttr('class')),
2476
+ this.text.attr({
2477
+ y: symbol.getBBox().height / 2,
2478
+ }),
2479
+ this.group.push(symbol),
2480
+ symbol.insertBefore(this.text),
2481
+ (this.symbol = symbol),
2482
+ this.initialize()
2483
+ }
2484
+ var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2),
2485
+ inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits,
2486
+ drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3),
2487
+ drawPath = drawAPI.drawPath
2488
+ inherits(InputOutput, Symbol),
2489
+ (InputOutput.prototype.getLeft = function () {
2490
+ var y = this.getY() + this.group.getBBox().height / 2,
2491
+ x = this.getX() + this.textMargin
2492
+ return {
2493
+ x: x,
2494
+ y: y,
2495
+ }
2496
+ }),
2497
+ (InputOutput.prototype.getRight = function () {
2498
+ var y = this.getY() + this.group.getBBox().height / 2,
2499
+ x = this.getX() + this.group.getBBox().width - this.textMargin
2500
+ return {
2501
+ x: x,
2502
+ y: y,
2503
+ }
2504
+ }),
2505
+ (module.exports = InputOutput)
2506
+ } /* 13 */,
2507
+ /*!*******************************************!*\
2508
+ !*** ./src/flowchart.symbol.operation.js ***!
2509
+ \*******************************************/
2510
+ /***/
2511
+ function (module, exports, __webpack_require__) {
2512
+ function Operation(chart, options) {
2513
+ var symbol = chart.paper.rect(0, 0, 0, 0)
2514
+ ;(options = options || {}), Symbol.call(this, chart, options, symbol)
2515
+ }
2516
+ var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2),
2517
+ inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits
2518
+ inherits(Operation, Symbol), (module.exports = Operation)
2519
+ } /* 14 */,
2520
+ /*!****************************************!*\
2521
+ !*** ./src/flowchart.symbol.output.js ***!
2522
+ \****************************************/
2523
+ /***/
2524
+ function (module, exports, __webpack_require__) {
2525
+ function Output(chart, options) {
2526
+ ;(options = options || {}),
2527
+ Symbol.call(this, chart, options),
2528
+ (this.textMargin = this.getAttr('text-margin')),
2529
+ this.text.attr({
2530
+ x: 3 * this.textMargin,
2531
+ })
2532
+ var width = this.text.getBBox().width + 4 * this.textMargin,
2533
+ height = this.text.getBBox().height + 2 * this.textMargin,
2534
+ startX = this.textMargin,
2535
+ startY = height / 2,
2536
+ start = {
2537
+ x: startX,
2538
+ y: startY,
2539
+ },
2540
+ points = [
2541
+ {
2542
+ x: startX - this.textMargin,
2543
+ y: height,
2544
+ },
2545
+ {
2546
+ x: startX - this.textMargin + width + 2 * this.textMargin,
2547
+ y: height,
2548
+ },
2549
+ {
2550
+ x: startX - this.textMargin + width,
2551
+ y: 0,
2552
+ },
2553
+ {
2554
+ x: startX - this.textMargin + 2 * this.textMargin,
2555
+ y: 0,
2556
+ },
2557
+ {
2558
+ x: startX,
2559
+ y: startY,
2560
+ },
2561
+ ],
2562
+ symbol = drawPath(chart, start, points)
2563
+ symbol.attr({
2564
+ stroke: this.getAttr('element-color'),
2565
+ 'stroke-width': this.getAttr('line-width'),
2566
+ fill: this.getAttr('fill'),
2567
+ }),
2568
+ options.link && symbol.attr('href', options.link),
2569
+ options.target && symbol.attr('target', options.target),
2570
+ options.key && (symbol.node.id = options.key),
2571
+ symbol.node.setAttribute('class', this.getAttr('class')),
2572
+ this.text.attr({
2573
+ y: symbol.getBBox().height / 2,
2574
+ }),
2575
+ this.group.push(symbol),
2576
+ symbol.insertBefore(this.text),
2577
+ (this.symbol = symbol),
2578
+ this.initialize()
2579
+ }
2580
+ var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2),
2581
+ inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits,
2582
+ drawAPI = __webpack_require__(/*! ./flowchart.functions */ 3),
2583
+ drawPath = drawAPI.drawPath
2584
+ inherits(Output, Symbol),
2585
+ (Output.prototype.getLeft = function () {
2586
+ var y = this.getY() + this.group.getBBox().height / 2,
2587
+ x = this.getX() + this.textMargin
2588
+ return {
2589
+ x: x,
2590
+ y: y,
2591
+ }
2592
+ }),
2593
+ (Output.prototype.getRight = function () {
2594
+ var y = this.getY() + this.group.getBBox().height / 2,
2595
+ x = this.getX() + this.group.getBBox().width - this.textMargin
2596
+ return {
2597
+ x: x,
2598
+ y: y,
2599
+ }
2600
+ }),
2601
+ (module.exports = Output)
2602
+ } /* 15 */,
2603
+ /*!***************************************!*\
2604
+ !*** ./src/flowchart.symbol.start.js ***!
2605
+ \***************************************/
2606
+ /***/
2607
+ function (module, exports, __webpack_require__) {
2608
+ function Start(chart, options) {
2609
+ var symbol = chart.paper.rect(0, 0, 0, 0, 20)
2610
+ ;(options = options || {}),
2611
+ (options.text = options.text || 'Start'),
2612
+ Symbol.call(this, chart, options, symbol)
2613
+ }
2614
+ var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2),
2615
+ inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits
2616
+ inherits(Start, Symbol), (module.exports = Start)
2617
+ } /* 16 */,
2618
+ /*!********************************************!*\
2619
+ !*** ./src/flowchart.symbol.subroutine.js ***!
2620
+ \********************************************/
2621
+ /***/
2622
+ function (module, exports, __webpack_require__) {
2623
+ function Subroutine(chart, options) {
2624
+ var symbol = chart.paper.rect(0, 0, 0, 0)
2625
+ ;(options = options || {}),
2626
+ Symbol.call(this, chart, options, symbol),
2627
+ symbol.attr({
2628
+ width: this.text.getBBox().width + 4 * this.getAttr('text-margin'),
2629
+ }),
2630
+ this.text.attr({
2631
+ x: 2 * this.getAttr('text-margin'),
2632
+ })
2633
+ var innerWrap = chart.paper.rect(0, 0, 0, 0)
2634
+ innerWrap.attr({
2635
+ x: this.getAttr('text-margin'),
2636
+ stroke: this.getAttr('element-color'),
2637
+ 'stroke-width': this.getAttr('line-width'),
2638
+ width: this.text.getBBox().width + 2 * this.getAttr('text-margin'),
2639
+ height: this.text.getBBox().height + 2 * this.getAttr('text-margin'),
2640
+ fill: this.getAttr('fill'),
2641
+ }),
2642
+ options.key && (innerWrap.node.id = options.key + 'i')
2643
+ var font = this.getAttr('font'),
2644
+ fontF = this.getAttr('font-family'),
2645
+ fontW = this.getAttr('font-weight')
2646
+ font &&
2647
+ innerWrap.attr({
2648
+ font: font,
2649
+ }),
2650
+ fontF &&
2651
+ innerWrap.attr({
2652
+ 'font-family': fontF,
2653
+ }),
2654
+ fontW &&
2655
+ innerWrap.attr({
2656
+ 'font-weight': fontW,
2657
+ }),
2658
+ options.link && innerWrap.attr('href', options.link),
2659
+ options.target && innerWrap.attr('target', options.target),
2660
+ this.group.push(innerWrap),
2661
+ innerWrap.insertBefore(this.text),
2662
+ this.initialize()
2663
+ }
2664
+ var Symbol = __webpack_require__(/*! ./flowchart.symbol */ 2),
2665
+ inherits = __webpack_require__(/*! ./flowchart.helpers */ 1).inherits
2666
+ inherits(Subroutine, Symbol), (module.exports = Subroutine)
2667
+ } /* 17 */,
2668
+ /*!******************************!*\
2669
+ !*** ./src/jquery-plugin.js ***!
2670
+ \******************************/
2671
+ /***/
2672
+ function (module, exports, __webpack_require__) {
2673
+ if ('undefined' != typeof jQuery) {
2674
+ var parse = __webpack_require__(/*! ./flowchart.parse */ 4)
2675
+ !(function ($) {
2676
+ function paramFit(needle, haystack) {
2677
+ return (
2678
+ needle == haystack ||
2679
+ (Array.isArray(haystack) &&
2680
+ (haystack.includes(needle) ||
2681
+ haystack.includes(Number(needle))))
2682
+ )
2683
+ }
2684
+ var methods = {
2685
+ init: function (options) {
2686
+ return this.each(function () {
2687
+ var $this = $(this)
2688
+ ;(this.chart = parse($this.text())),
2689
+ $this.html(''),
2690
+ this.chart.drawSVG(this, options)
2691
+ })
2692
+ },
2693
+ setFlowStateByParam: function (param, paramValue, newFlowState) {
2694
+ return this.each(function () {
2695
+ var chart = this.chart,
2696
+ nextSymbolKeys = [
2697
+ 'next',
2698
+ 'yes',
2699
+ 'no',
2700
+ 'path1',
2701
+ 'path2',
2702
+ 'path3',
2703
+ ]
2704
+ for (var property in chart.symbols)
2705
+ if (chart.symbols.hasOwnProperty(property)) {
2706
+ var symbol = chart.symbols[property],
2707
+ val = symbol.params[param]
2708
+ if (paramFit(val, paramValue)) {
2709
+ symbol.flowstate = newFlowState
2710
+ for (var nski = 0; nski < nextSymbolKeys.length; nski++) {
2711
+ var nextSymbolKey = nextSymbolKeys[nski]
2712
+ symbol[nextSymbolKey] &&
2713
+ symbol[nextSymbolKey].params &&
2714
+ symbol[nextSymbolKey].params[param] &&
2715
+ paramFit(
2716
+ symbol[nextSymbolKey].params[param],
2717
+ paramValue,
2718
+ ) &&
2719
+ (symbol.lineStyle[symbol[nextSymbolKey].key] = {
2720
+ stroke:
2721
+ chart.options().flowstate[newFlowState].fill,
2722
+ })
2723
+ }
2724
+ }
2725
+ }
2726
+ chart.clean(), chart.drawSVG(this)
2727
+ })
2728
+ },
2729
+ clearFlowState: function () {
2730
+ return this.each(function () {
2731
+ var chart = this.chart
2732
+ for (var property in chart.symbols)
2733
+ if (chart.symbols.hasOwnProperty(property)) {
2734
+ var node = chart.symbols[property]
2735
+ node.flowstate = ''
2736
+ }
2737
+ chart.clean(), chart.drawSVG(this)
2738
+ })
2739
+ },
2740
+ }
2741
+ $.fn.flowChart = function (methodOrOptions) {
2742
+ return methods[methodOrOptions]
2743
+ ? methods[methodOrOptions].apply(
2744
+ this,
2745
+ Array.prototype.slice.call(arguments, 1),
2746
+ )
2747
+ : 'object' != typeof methodOrOptions && methodOrOptions
2748
+ ? void $.error(
2749
+ 'Method ' +
2750
+ methodOrOptions +
2751
+ ' does not exist on jQuery.flowChart',
2752
+ )
2753
+ : methods.init.apply(this, arguments)
2754
+ }
2755
+ })(jQuery)
2756
+ }
2757
+ } /* 18 */,
2758
+ /*!**************************!*\
2759
+ !*** external "Raphael" ***!
2760
+ \**************************/
2761
+ /***/
2762
+ function (module, exports) {
2763
+ module.exports = __WEBPACK_EXTERNAL_MODULE_18__
2764
+ },
2765
+ ])
2766
+ })
2767
+ //# sourceMappingURL=flowchart.js.map