bpmn-js 9.0.2 → 9.1.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-viewer v9.0.2
2
+ * bpmn-js - bpmn-viewer v9.1.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2022-02-23
11
+ * Date: 2022-05-18
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -58,29 +58,29 @@
58
58
  * @return {Array<?>}
59
59
  */
60
60
 
61
- var nativeToString = Object.prototype.toString;
62
- var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
63
- function isUndefined$1(obj) {
61
+ var nativeToString$2 = Object.prototype.toString;
62
+ var nativeHasOwnProperty$2 = Object.prototype.hasOwnProperty;
63
+ function isUndefined$3(obj) {
64
64
  return obj === undefined;
65
65
  }
66
66
  function isDefined(obj) {
67
67
  return obj !== undefined;
68
68
  }
69
- function isArray$1(obj) {
70
- return nativeToString.call(obj) === '[object Array]';
69
+ function isArray$3(obj) {
70
+ return nativeToString$2.call(obj) === '[object Array]';
71
71
  }
72
72
  function isObject(obj) {
73
- return nativeToString.call(obj) === '[object Object]';
73
+ return nativeToString$2.call(obj) === '[object Object]';
74
74
  }
75
75
  function isNumber(obj) {
76
- return nativeToString.call(obj) === '[object Number]';
76
+ return nativeToString$2.call(obj) === '[object Number]';
77
77
  }
78
78
  function isFunction(obj) {
79
- var tag = nativeToString.call(obj);
79
+ var tag = nativeToString$2.call(obj);
80
80
  return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object AsyncGeneratorFunction]' || tag === '[object Proxy]';
81
81
  }
82
82
  function isString(obj) {
83
- return nativeToString.call(obj) === '[object String]';
83
+ return nativeToString$2.call(obj) === '[object String]';
84
84
  }
85
85
  /**
86
86
  * Return true, if target owns a property with the given key.
@@ -91,8 +91,8 @@
91
91
  * @return {Boolean}
92
92
  */
93
93
 
94
- function has(target, key) {
95
- return nativeHasOwnProperty.call(target, key);
94
+ function has$2(target, key) {
95
+ return nativeHasOwnProperty$2.call(target, key);
96
96
  }
97
97
 
98
98
  /**
@@ -107,7 +107,7 @@
107
107
  function find(collection, matcher) {
108
108
  matcher = toMatcher(matcher);
109
109
  var match;
110
- forEach(collection, function (val, key) {
110
+ forEach$2(collection, function (val, key) {
111
111
  if (matcher(val, key)) {
112
112
  match = val;
113
113
  return false;
@@ -126,7 +126,7 @@
126
126
 
127
127
  function filter(collection, matcher) {
128
128
  var result = [];
129
- forEach(collection, function (val, key) {
129
+ forEach$2(collection, function (val, key) {
130
130
  if (matcher(val, key)) {
131
131
  result.push(val);
132
132
  }
@@ -143,17 +143,17 @@
143
143
  * @return {Object} return result that stopped the iteration
144
144
  */
145
145
 
146
- function forEach(collection, iterator) {
146
+ function forEach$2(collection, iterator) {
147
147
  var val, result;
148
148
 
149
- if (isUndefined$1(collection)) {
149
+ if (isUndefined$3(collection)) {
150
150
  return;
151
151
  }
152
152
 
153
- var convertKey = isArray$1(collection) ? toNum : identity;
153
+ var convertKey = isArray$3(collection) ? toNum$2 : identity$2;
154
154
 
155
155
  for (var key in collection) {
156
- if (has(collection, key)) {
156
+ if (has$2(collection, key)) {
157
157
  val = collection[key];
158
158
  result = iterator(val, convertKey(key));
159
159
 
@@ -174,7 +174,7 @@
174
174
  */
175
175
 
176
176
  function reduce(collection, iterator, result) {
177
- forEach(collection, function (value, idx) {
177
+ forEach$2(collection, function (value, idx) {
178
178
  result = iterator(result, value, idx);
179
179
  });
180
180
  return result;
@@ -217,9 +217,9 @@
217
217
  * @return {Array} transformed collection
218
218
  */
219
219
 
220
- function map$1(collection, fn) {
220
+ function map(collection, fn) {
221
221
  var result = [];
222
- forEach(collection, function (val, key) {
222
+ forEach$2(collection, function (val, key) {
223
223
  result.push(fn(val, key));
224
224
  });
225
225
  return result;
@@ -252,11 +252,11 @@
252
252
  };
253
253
  }
254
254
 
255
- function identity(arg) {
255
+ function identity$2(arg) {
256
256
  return arg;
257
257
  }
258
258
 
259
- function toNum(arg) {
259
+ function toNum$2(arg) {
260
260
  return Number(arg);
261
261
  }
262
262
 
@@ -338,7 +338,7 @@
338
338
  * @return {Function} bound function
339
339
  */
340
340
 
341
- function bind$2(fn, target) {
341
+ function bind(fn, target) {
342
342
  return fn.bind(target);
343
343
  }
344
344
 
@@ -388,7 +388,7 @@
388
388
  function pick(target, properties) {
389
389
  var result = {};
390
390
  var obj = Object(target);
391
- forEach(properties, function (prop) {
391
+ forEach$2(properties, function (prop) {
392
392
  if (prop in obj) {
393
393
  result[prop] = target[prop];
394
394
  }
@@ -407,7 +407,7 @@
407
407
  function omit(target, properties) {
408
408
  var result = {};
409
409
  var obj = Object(target);
410
- forEach(obj, function (prop, key) {
410
+ forEach$2(obj, function (prop, key) {
411
411
  if (properties.indexOf(key) === -1) {
412
412
  result[key] = prop;
413
413
  }
@@ -443,7 +443,7 @@
443
443
  }
444
444
  });
445
445
 
446
- eventBus.on([ 'render.getShapePath', 'render.getConnectionPath'], renderPriority, function(evt, element) {
446
+ eventBus.on([ 'render.getShapePath', 'render.getConnectionPath' ], renderPriority, function(evt, element) {
447
447
  if (self.canRender(element)) {
448
448
  if (evt.type === 'render.getShapePath') {
449
449
  return self.getShapePath(element);
@@ -516,6 +516,21 @@
516
516
  return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
517
517
  }
518
518
 
519
+
520
+ /**
521
+ * Return true if element has any of the given types.
522
+ *
523
+ * @param {djs.model.Base} element
524
+ * @param {Array<string>} types
525
+ *
526
+ * @return {boolean}
527
+ */
528
+ function isAny(element, types) {
529
+ return some(types, function(t) {
530
+ return is$1(element, t);
531
+ });
532
+ }
533
+
519
534
  /**
520
535
  * Return the business object for a given element.
521
536
  *
@@ -807,9 +822,9 @@
807
822
  return -1;
808
823
  }
809
824
 
810
- var re$1 = /\s+/;
825
+ var re$2 = /\s+/;
811
826
 
812
- var toString$1 = Object.prototype.toString;
827
+ var toString$2 = Object.prototype.toString;
813
828
 
814
829
  function defined(o) {
815
830
  return typeof o !== 'undefined';
@@ -823,11 +838,11 @@
823
838
  * @api public
824
839
  */
825
840
 
826
- function classes$1(el) {
827
- return new ClassList$1(el);
841
+ function classes$2(el) {
842
+ return new ClassList$2(el);
828
843
  }
829
844
 
830
- function ClassList$1(el) {
845
+ function ClassList$2(el) {
831
846
  if (!el || !el.nodeType) {
832
847
  throw new Error('A DOM element reference is required');
833
848
  }
@@ -843,7 +858,7 @@
843
858
  * @api public
844
859
  */
845
860
 
846
- ClassList$1.prototype.add = function(name) {
861
+ ClassList$2.prototype.add = function(name) {
847
862
 
848
863
  // classList
849
864
  if (this.list) {
@@ -877,8 +892,8 @@
877
892
  * @api public
878
893
  */
879
894
 
880
- ClassList$1.prototype.remove = function(name) {
881
- if ('[object RegExp]' === toString$1.call(name)) {
895
+ ClassList$2.prototype.remove = function(name) {
896
+ if ('[object RegExp]' === toString$2.call(name)) {
882
897
  return this.removeMatching(name);
883
898
  }
884
899
 
@@ -906,7 +921,7 @@
906
921
  * @api private
907
922
  */
908
923
 
909
- ClassList$1.prototype.removeMatching = function(re) {
924
+ ClassList$2.prototype.removeMatching = function(re) {
910
925
  var arr = this.array();
911
926
  for (var i = 0; i < arr.length; i++) {
912
927
  if (re.test(arr[i])) {
@@ -928,7 +943,7 @@
928
943
  * @api public
929
944
  */
930
945
 
931
- ClassList$1.prototype.toggle = function(name, force) {
946
+ ClassList$2.prototype.toggle = function(name, force) {
932
947
  // classList
933
948
  if (this.list) {
934
949
  if (defined(force)) {
@@ -966,10 +981,10 @@
966
981
  * @api public
967
982
  */
968
983
 
969
- ClassList$1.prototype.array = function() {
984
+ ClassList$2.prototype.array = function() {
970
985
  var className = this.el.getAttribute('class') || '';
971
986
  var str = className.replace(/^\s+|\s+$/g, '');
972
- var arr = str.split(re$1);
987
+ var arr = str.split(re$2);
973
988
  if ('' === arr[0]) {
974
989
  arr.shift();
975
990
  }
@@ -984,8 +999,8 @@
984
999
  * @api public
985
1000
  */
986
1001
 
987
- ClassList$1.prototype.has =
988
- ClassList$1.prototype.contains = function(name) {
1002
+ ClassList$2.prototype.has =
1003
+ ClassList$2.prototype.contains = function(name) {
989
1004
  return (
990
1005
  this.list ?
991
1006
  this.list.contains(name) :
@@ -993,7 +1008,7 @@
993
1008
  );
994
1009
  };
995
1010
 
996
- function remove$2(element) {
1011
+ function remove$3(element) {
997
1012
  var parent = element.parentNode;
998
1013
 
999
1014
  if (parent) {
@@ -1017,7 +1032,7 @@
1017
1032
  var child;
1018
1033
 
1019
1034
  while ((child = element.firstChild)) {
1020
- remove$2(child);
1035
+ remove$3(child);
1021
1036
  }
1022
1037
 
1023
1038
  return element;
@@ -1033,7 +1048,7 @@
1033
1048
 
1034
1049
  var SVG_START = '<svg xmlns="' + ns.svg + '"';
1035
1050
 
1036
- function parse$1(svg) {
1051
+ function parse$2(svg) {
1037
1052
 
1038
1053
  var unwrap = false;
1039
1054
 
@@ -1093,7 +1108,7 @@
1093
1108
  var element;
1094
1109
 
1095
1110
  if (name.charAt(0) === '<') {
1096
- element = parse$1(name).firstChild;
1111
+ element = parse$2(name).firstChild;
1097
1112
  element = document.importNode(element, true);
1098
1113
  } else {
1099
1114
  element = document.createElementNS(ns.svg, name);
@@ -1245,7 +1260,7 @@
1245
1260
 
1246
1261
  function set(element, svg) {
1247
1262
 
1248
- var parsed = parse$1(svg);
1263
+ var parsed = parse$2(svg);
1249
1264
 
1250
1265
  // clear element contents
1251
1266
  clear$1(element);
@@ -1524,34 +1539,104 @@
1524
1539
  }
1525
1540
 
1526
1541
  /**
1527
- * Set attribute `name` to `val`, or get attr `name`.
1542
+ * Flatten array, one level deep.
1528
1543
  *
1529
- * @param {Element} el
1530
- * @param {String} name
1531
- * @param {String} [val]
1532
- * @api public
1544
+ * @param {Array<?>} arr
1545
+ *
1546
+ * @return {Array<?>}
1533
1547
  */
1534
- function attr(el, name, val) {
1535
- // get
1536
- if (arguments.length == 2) {
1537
- return el.getAttribute(name);
1548
+
1549
+ var nativeToString$1 = Object.prototype.toString;
1550
+ var nativeHasOwnProperty$1 = Object.prototype.hasOwnProperty;
1551
+ function isUndefined$2(obj) {
1552
+ return obj === undefined;
1553
+ }
1554
+ function isArray$2(obj) {
1555
+ return nativeToString$1.call(obj) === '[object Array]';
1556
+ }
1557
+ /**
1558
+ * Return true, if target owns a property with the given key.
1559
+ *
1560
+ * @param {Object} target
1561
+ * @param {String} key
1562
+ *
1563
+ * @return {Boolean}
1564
+ */
1565
+
1566
+ function has$1(target, key) {
1567
+ return nativeHasOwnProperty$1.call(target, key);
1568
+ }
1569
+ /**
1570
+ * Iterate over collection; returning something
1571
+ * (non-undefined) will stop iteration.
1572
+ *
1573
+ * @param {Array|Object} collection
1574
+ * @param {Function} iterator
1575
+ *
1576
+ * @return {Object} return result that stopped the iteration
1577
+ */
1578
+
1579
+ function forEach$1(collection, iterator) {
1580
+ var val, result;
1581
+
1582
+ if (isUndefined$2(collection)) {
1583
+ return;
1538
1584
  }
1539
1585
 
1540
- // remove
1541
- if (val === null) {
1542
- return el.removeAttribute(name);
1586
+ var convertKey = isArray$2(collection) ? toNum$1 : identity$1;
1587
+
1588
+ for (var key in collection) {
1589
+ if (has$1(collection, key)) {
1590
+ val = collection[key];
1591
+ result = iterator(val, convertKey(key));
1592
+
1593
+ if (result === false) {
1594
+ return val;
1595
+ }
1596
+ }
1543
1597
  }
1598
+ }
1544
1599
 
1545
- // set
1546
- el.setAttribute(name, val);
1600
+ function identity$1(arg) {
1601
+ return arg;
1602
+ }
1547
1603
 
1548
- return el;
1604
+ function toNum$1(arg) {
1605
+ return Number(arg);
1549
1606
  }
1550
1607
 
1551
- var indexOf = [].indexOf;
1608
+ /**
1609
+ * Assigns style attributes in a style-src compliant way.
1610
+ *
1611
+ * @param {Element} element
1612
+ * @param {...Object} styleSources
1613
+ *
1614
+ * @return {Element} the element
1615
+ */
1616
+ function assign$1$1(element) {
1617
+ var target = element.style;
1552
1618
 
1553
- var indexof = function(arr, obj){
1554
- if (indexOf) return arr.indexOf(obj);
1619
+ for (var _len = arguments.length, styleSources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1620
+ styleSources[_key - 1] = arguments[_key];
1621
+ }
1622
+
1623
+ forEach$1(styleSources, function (style) {
1624
+ if (!style) {
1625
+ return;
1626
+ }
1627
+
1628
+ forEach$1(style, function (value, key) {
1629
+ target[key] = value;
1630
+ });
1631
+ });
1632
+
1633
+ return element;
1634
+ }
1635
+
1636
+ var indexOf$1 = [].indexOf;
1637
+
1638
+ var indexof$1 = function(arr, obj){
1639
+ if (indexOf$1) return arr.indexOf(obj);
1555
1640
  for (var i = 0; i < arr.length; ++i) {
1556
1641
  if (arr[i] === obj) return i;
1557
1642
  }
@@ -1568,13 +1653,13 @@
1568
1653
  * Whitespace regexp.
1569
1654
  */
1570
1655
 
1571
- var re = /\s+/;
1656
+ var re$1 = /\s+/;
1572
1657
 
1573
1658
  /**
1574
1659
  * toString reference.
1575
1660
  */
1576
1661
 
1577
- var toString = Object.prototype.toString;
1662
+ var toString$1 = Object.prototype.toString;
1578
1663
 
1579
1664
  /**
1580
1665
  * Wrap `el` in a `ClassList`.
@@ -1584,8 +1669,8 @@
1584
1669
  * @api public
1585
1670
  */
1586
1671
 
1587
- function classes(el) {
1588
- return new ClassList(el);
1672
+ function classes$1(el) {
1673
+ return new ClassList$1(el);
1589
1674
  }
1590
1675
 
1591
1676
  /**
@@ -1595,7 +1680,7 @@
1595
1680
  * @api private
1596
1681
  */
1597
1682
 
1598
- function ClassList(el) {
1683
+ function ClassList$1(el) {
1599
1684
  if (!el || !el.nodeType) {
1600
1685
  throw new Error('A DOM element reference is required');
1601
1686
  }
@@ -1611,7 +1696,7 @@
1611
1696
  * @api public
1612
1697
  */
1613
1698
 
1614
- ClassList.prototype.add = function (name) {
1699
+ ClassList$1.prototype.add = function (name) {
1615
1700
  // classList
1616
1701
  if (this.list) {
1617
1702
  this.list.add(name);
@@ -1620,7 +1705,7 @@
1620
1705
 
1621
1706
  // fallback
1622
1707
  var arr = this.array();
1623
- var i = indexof(arr, name);
1708
+ var i = indexof$1(arr, name);
1624
1709
  if (!~i) arr.push(name);
1625
1710
  this.el.className = arr.join(' ');
1626
1711
  return this;
@@ -1636,8 +1721,8 @@
1636
1721
  * @api public
1637
1722
  */
1638
1723
 
1639
- ClassList.prototype.remove = function (name) {
1640
- if ('[object RegExp]' == toString.call(name)) {
1724
+ ClassList$1.prototype.remove = function (name) {
1725
+ if ('[object RegExp]' == toString$1.call(name)) {
1641
1726
  return this.removeMatching(name);
1642
1727
  }
1643
1728
 
@@ -1649,7 +1734,7 @@
1649
1734
 
1650
1735
  // fallback
1651
1736
  var arr = this.array();
1652
- var i = indexof(arr, name);
1737
+ var i = indexof$1(arr, name);
1653
1738
  if (~i) arr.splice(i, 1);
1654
1739
  this.el.className = arr.join(' ');
1655
1740
  return this;
@@ -1663,7 +1748,7 @@
1663
1748
  * @api private
1664
1749
  */
1665
1750
 
1666
- ClassList.prototype.removeMatching = function (re) {
1751
+ ClassList$1.prototype.removeMatching = function (re) {
1667
1752
  var arr = this.array();
1668
1753
  for (var i = 0; i < arr.length; i++) {
1669
1754
  if (re.test(arr[i])) {
@@ -1685,7 +1770,7 @@
1685
1770
  * @api public
1686
1771
  */
1687
1772
 
1688
- ClassList.prototype.toggle = function (name, force) {
1773
+ ClassList$1.prototype.toggle = function (name, force) {
1689
1774
  // classList
1690
1775
  if (this.list) {
1691
1776
  if ('undefined' !== typeof force) {
@@ -1723,10 +1808,10 @@
1723
1808
  * @api public
1724
1809
  */
1725
1810
 
1726
- ClassList.prototype.array = function () {
1811
+ ClassList$1.prototype.array = function () {
1727
1812
  var className = this.el.getAttribute('class') || '';
1728
1813
  var str = className.replace(/^\s+|\s+$/g, '');
1729
- var arr = str.split(re);
1814
+ var arr = str.split(re$1);
1730
1815
  if ('' === arr[0]) arr.shift();
1731
1816
  return arr;
1732
1817
  };
@@ -1739,34 +1824,19 @@
1739
1824
  * @api public
1740
1825
  */
1741
1826
 
1742
- ClassList.prototype.has = ClassList.prototype.contains = function (name) {
1743
- return this.list ? this.list.contains(name) : !!~indexof(this.array(), name);
1827
+ ClassList$1.prototype.has = ClassList$1.prototype.contains = function (name) {
1828
+ return this.list ? this.list.contains(name) : !!~indexof$1(this.array(), name);
1744
1829
  };
1745
1830
 
1746
- /**
1747
- * Remove all children from the given element.
1748
- */
1749
- function clear(el) {
1750
-
1751
- var c;
1752
-
1753
- while (el.childNodes.length) {
1754
- c = el.childNodes[0];
1755
- el.removeChild(c);
1756
- }
1757
-
1758
- return el;
1759
- }
1760
-
1761
- var proto = typeof Element !== 'undefined' ? Element.prototype : {};
1762
- var vendor = proto.matches
1763
- || proto.matchesSelector
1764
- || proto.webkitMatchesSelector
1765
- || proto.mozMatchesSelector
1766
- || proto.msMatchesSelector
1767
- || proto.oMatchesSelector;
1831
+ var proto$1 = typeof Element !== 'undefined' ? Element.prototype : {};
1832
+ var vendor$1 = proto$1.matches
1833
+ || proto$1.matchesSelector
1834
+ || proto$1.webkitMatchesSelector
1835
+ || proto$1.mozMatchesSelector
1836
+ || proto$1.msMatchesSelector
1837
+ || proto$1.oMatchesSelector;
1768
1838
 
1769
- var matchesSelector = match;
1839
+ var matchesSelector$1 = match$1;
1770
1840
 
1771
1841
  /**
1772
1842
  * Match `el` to `selector`.
@@ -1777,9 +1847,9 @@
1777
1847
  * @api public
1778
1848
  */
1779
1849
 
1780
- function match(el, selector) {
1850
+ function match$1(el, selector) {
1781
1851
  if (!el || el.nodeType !== 1) return false;
1782
- if (vendor) return vendor.call(el, selector);
1852
+ if (vendor$1) return vendor$1.call(el, selector);
1783
1853
  var nodes = el.parentNode.querySelectorAll(selector);
1784
1854
  for (var i = 0; i < nodes.length; i++) {
1785
1855
  if (nodes[i] == el) return true;
@@ -1794,24 +1864,24 @@
1794
1864
  * @param {String} selector
1795
1865
  * @param {Boolean} checkYourSelf (optional)
1796
1866
  */
1797
- function closest (element, selector, checkYourSelf) {
1867
+ function closest$1 (element, selector, checkYourSelf) {
1798
1868
  var currentElem = checkYourSelf ? element : element.parentNode;
1799
1869
 
1800
1870
  while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
1801
1871
 
1802
- if (matchesSelector(currentElem, selector)) {
1872
+ if (matchesSelector$1(currentElem, selector)) {
1803
1873
  return currentElem;
1804
1874
  }
1805
1875
 
1806
1876
  currentElem = currentElem.parentNode;
1807
1877
  }
1808
1878
 
1809
- return matchesSelector(currentElem, selector) ? currentElem : null;
1879
+ return matchesSelector$1(currentElem, selector) ? currentElem : null;
1810
1880
  }
1811
1881
 
1812
- var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
1813
- unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
1814
- prefix$6 = bind !== 'addEventListener' ? 'on' : '';
1882
+ var bind$1$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
1883
+ unbind$2 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
1884
+ prefix$7 = bind$1$1 !== 'addEventListener' ? 'on' : '';
1815
1885
 
1816
1886
  /**
1817
1887
  * Bind `el` event `type` to `fn`.
@@ -1824,8 +1894,8 @@
1824
1894
  * @api public
1825
1895
  */
1826
1896
 
1827
- var bind_1 = function(el, type, fn, capture){
1828
- el[bind](prefix$6 + type, fn, capture || false);
1897
+ var bind_1$1 = function(el, type, fn, capture){
1898
+ el[bind$1$1](prefix$7 + type, fn, capture || false);
1829
1899
  return fn;
1830
1900
  };
1831
1901
 
@@ -1840,14 +1910,14 @@
1840
1910
  * @api public
1841
1911
  */
1842
1912
 
1843
- var unbind_1 = function(el, type, fn, capture){
1844
- el[unbind](prefix$6 + type, fn, capture || false);
1913
+ var unbind_1$1 = function(el, type, fn, capture){
1914
+ el[unbind$2](prefix$7 + type, fn, capture || false);
1845
1915
  return fn;
1846
1916
  };
1847
1917
 
1848
- var componentEvent = {
1849
- bind: bind_1,
1850
- unbind: unbind_1
1918
+ var componentEvent$1 = {
1919
+ bind: bind_1$1,
1920
+ unbind: unbind_1$1
1851
1921
  };
1852
1922
 
1853
1923
  /**
@@ -1870,16 +1940,16 @@
1870
1940
 
1871
1941
  // Some events don't bubble, so we want to bind to the capture phase instead
1872
1942
  // when delegating.
1873
- var forceCaptureEvents = ['focus', 'blur'];
1943
+ var forceCaptureEvents$1 = ['focus', 'blur'];
1874
1944
 
1875
- function bind$1(el, selector, type, fn, capture) {
1876
- if (forceCaptureEvents.indexOf(type) !== -1) {
1945
+ function bind$2$1(el, selector, type, fn, capture) {
1946
+ if (forceCaptureEvents$1.indexOf(type) !== -1) {
1877
1947
  capture = true;
1878
1948
  }
1879
1949
 
1880
- return componentEvent.bind(el, type, function (e) {
1950
+ return componentEvent$1.bind(el, type, function (e) {
1881
1951
  var target = e.target || e.srcElement;
1882
- e.delegateTarget = closest(target, selector, true);
1952
+ e.delegateTarget = closest$1(target, selector, true);
1883
1953
  if (e.delegateTarget) {
1884
1954
  fn.call(el, e);
1885
1955
  }
@@ -1895,75 +1965,75 @@
1895
1965
  * @param {Boolean} capture
1896
1966
  * @api public
1897
1967
  */
1898
- function unbind$1(el, type, fn, capture) {
1899
- if (forceCaptureEvents.indexOf(type) !== -1) {
1968
+ function unbind$1$1(el, type, fn, capture) {
1969
+ if (forceCaptureEvents$1.indexOf(type) !== -1) {
1900
1970
  capture = true;
1901
1971
  }
1902
1972
 
1903
- return componentEvent.unbind(el, type, fn, capture);
1973
+ return componentEvent$1.unbind(el, type, fn, capture);
1904
1974
  }
1905
1975
 
1906
- var delegate = {
1907
- bind: bind$1,
1908
- unbind: unbind$1
1976
+ var delegate$1 = {
1977
+ bind: bind$2$1,
1978
+ unbind: unbind$1$1
1909
1979
  };
1910
1980
 
1911
1981
  /**
1912
1982
  * Expose `parse`.
1913
1983
  */
1914
1984
 
1915
- var domify = parse;
1985
+ var domify$1 = parse$1;
1916
1986
 
1917
1987
  /**
1918
1988
  * Tests for browser support.
1919
1989
  */
1920
1990
 
1921
- var innerHTMLBug = false;
1922
- var bugTestDiv;
1991
+ var innerHTMLBug$1 = false;
1992
+ var bugTestDiv$1;
1923
1993
  if (typeof document !== 'undefined') {
1924
- bugTestDiv = document.createElement('div');
1994
+ bugTestDiv$1 = document.createElement('div');
1925
1995
  // Setup
1926
- bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
1996
+ bugTestDiv$1.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
1927
1997
  // Make sure that link elements get serialized correctly by innerHTML
1928
1998
  // This requires a wrapper element in IE
1929
- innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;
1930
- bugTestDiv = undefined;
1999
+ innerHTMLBug$1 = !bugTestDiv$1.getElementsByTagName('link').length;
2000
+ bugTestDiv$1 = undefined;
1931
2001
  }
1932
2002
 
1933
2003
  /**
1934
2004
  * Wrap map from jquery.
1935
2005
  */
1936
2006
 
1937
- var map = {
2007
+ var map$1$1 = {
1938
2008
  legend: [1, '<fieldset>', '</fieldset>'],
1939
2009
  tr: [2, '<table><tbody>', '</tbody></table>'],
1940
2010
  col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
1941
2011
  // for script/link/style tags to work in IE6-8, you have to wrap
1942
2012
  // in a div with a non-whitespace character in front, ha!
1943
- _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
2013
+ _default: innerHTMLBug$1 ? [1, 'X<div>', '</div>'] : [0, '', '']
1944
2014
  };
1945
2015
 
1946
- map.td =
1947
- map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
2016
+ map$1$1.td =
2017
+ map$1$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
1948
2018
 
1949
- map.option =
1950
- map.optgroup = [1, '<select multiple="multiple">', '</select>'];
2019
+ map$1$1.option =
2020
+ map$1$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
1951
2021
 
1952
- map.thead =
1953
- map.tbody =
1954
- map.colgroup =
1955
- map.caption =
1956
- map.tfoot = [1, '<table>', '</table>'];
2022
+ map$1$1.thead =
2023
+ map$1$1.tbody =
2024
+ map$1$1.colgroup =
2025
+ map$1$1.caption =
2026
+ map$1$1.tfoot = [1, '<table>', '</table>'];
1957
2027
 
1958
- map.polyline =
1959
- map.ellipse =
1960
- map.polygon =
1961
- map.circle =
1962
- map.text =
1963
- map.line =
1964
- map.path =
1965
- map.rect =
1966
- map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
2028
+ map$1$1.polyline =
2029
+ map$1$1.ellipse =
2030
+ map$1$1.polygon =
2031
+ map$1$1.circle =
2032
+ map$1$1.text =
2033
+ map$1$1.line =
2034
+ map$1$1.path =
2035
+ map$1$1.rect =
2036
+ map$1$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
1967
2037
 
1968
2038
  /**
1969
2039
  * Parse `html` and return a DOM Node instance, which could be a TextNode,
@@ -1976,7 +2046,7 @@
1976
2046
  * @api private
1977
2047
  */
1978
2048
 
1979
- function parse(html, doc) {
2049
+ function parse$1(html, doc) {
1980
2050
  if ('string' != typeof html) throw new TypeError('String expected');
1981
2051
 
1982
2052
  // default to the global `document` object
@@ -1998,7 +2068,7 @@
1998
2068
  }
1999
2069
 
2000
2070
  // wrap map
2001
- var wrap = map[tag] || map._default;
2071
+ var wrap = map$1$1[tag] || map$1$1._default;
2002
2072
  var depth = wrap[0];
2003
2073
  var prefix = wrap[1];
2004
2074
  var suffix = wrap[2];
@@ -2020,19 +2090,13 @@
2020
2090
  return fragment;
2021
2091
  }
2022
2092
 
2023
- function query(selector, el) {
2093
+ function query$1(selector, el) {
2024
2094
  el = el || document;
2025
2095
 
2026
2096
  return el.querySelector(selector);
2027
2097
  }
2028
2098
 
2029
- function all(selector, el) {
2030
- el = el || document;
2031
-
2032
- return el.querySelectorAll(selector);
2033
- }
2034
-
2035
- function remove$1(el) {
2099
+ function remove$2(el) {
2036
2100
  el.parentNode && el.parentNode.removeChild(el);
2037
2101
  }
2038
2102
 
@@ -2304,7 +2368,7 @@
2304
2368
  orient: 'auto'
2305
2369
  });
2306
2370
 
2307
- var defs = query('defs', canvas._svg);
2371
+ var defs = query$1('defs', canvas._svg);
2308
2372
 
2309
2373
  if (!defs) {
2310
2374
  defs = create$1('defs');
@@ -2646,7 +2710,7 @@
2646
2710
 
2647
2711
  var text = textRenderer.createText(label || '', options);
2648
2712
 
2649
- classes$1(text).add('djs-label');
2713
+ classes$2(text).add('djs-label');
2650
2714
 
2651
2715
  append(parentGfx, text);
2652
2716
 
@@ -4004,7 +4068,7 @@
4004
4068
  };
4005
4069
  }
4006
4070
 
4007
- forEach(taskMarkers, function(marker) {
4071
+ forEach$2(taskMarkers, function(marker) {
4008
4072
  renderer(marker)(parentGfx, element, position);
4009
4073
  });
4010
4074
 
@@ -4297,7 +4361,8 @@
4297
4361
  id: 'helper-svg',
4298
4362
  width: 0,
4299
4363
  height: 0,
4300
- style: 'visibility: hidden; position: fixed'
4364
+ visibility: 'hidden',
4365
+ position: 'fixed'
4301
4366
  });
4302
4367
 
4303
4368
  document.body.appendChild(helperSvg);
@@ -4424,7 +4489,7 @@
4424
4489
 
4425
4490
  // layout each line taking into account that parent
4426
4491
  // shape might resize to fit text size
4427
- forEach(layouted, function(line) {
4492
+ forEach$2(layouted, function(line) {
4428
4493
 
4429
4494
  var x;
4430
4495
 
@@ -4455,7 +4520,7 @@
4455
4520
  append(textElement, tspan);
4456
4521
  });
4457
4522
 
4458
- remove$2(helperText);
4523
+ remove$3(helperText);
4459
4524
 
4460
4525
  var dimensions = {
4461
4526
  width: maxLineWidth,
@@ -5521,123 +5586,731 @@
5521
5586
 
5522
5587
 
5523
5588
  /**
5524
- * add label for an element
5589
+ * add label for an element
5590
+ */
5591
+ BpmnImporter.prototype.addLabel = function(semantic, di, element) {
5592
+ var bounds,
5593
+ text,
5594
+ label;
5595
+
5596
+ bounds = getExternalLabelBounds(di, element);
5597
+
5598
+ text = getLabel(element);
5599
+
5600
+ if (text) {
5601
+
5602
+ // get corrected bounds from actual layouted text
5603
+ bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
5604
+ }
5605
+
5606
+ label = this._elementFactory.createLabel(elementData(semantic, di, {
5607
+ id: semantic.id + '_label',
5608
+ labelTarget: element,
5609
+ type: 'label',
5610
+ hidden: element.hidden || !getLabel(element),
5611
+ x: Math.round(bounds.x),
5612
+ y: Math.round(bounds.y),
5613
+ width: Math.round(bounds.width),
5614
+ height: Math.round(bounds.height)
5615
+ }));
5616
+
5617
+ return this._canvas.addShape(label, element.parent);
5618
+ };
5619
+
5620
+ /**
5621
+ * Return the drawn connection end based on the given side.
5622
+ *
5623
+ * @throws {Error} if the end is not yet drawn
5624
+ */
5625
+ BpmnImporter.prototype._getEnd = function(semantic, side) {
5626
+
5627
+ var element,
5628
+ refSemantic,
5629
+ type = semantic.$type,
5630
+ translate = this._translate;
5631
+
5632
+ refSemantic = semantic[side + 'Ref'];
5633
+
5634
+ // handle mysterious isMany DataAssociation#sourceRef
5635
+ if (side === 'source' && type === 'bpmn:DataInputAssociation') {
5636
+ refSemantic = refSemantic && refSemantic[0];
5637
+ }
5638
+
5639
+ // fix source / target for DataInputAssociation / DataOutputAssociation
5640
+ if (side === 'source' && type === 'bpmn:DataOutputAssociation' ||
5641
+ side === 'target' && type === 'bpmn:DataInputAssociation') {
5642
+
5643
+ refSemantic = semantic.$parent;
5644
+ }
5645
+
5646
+ element = refSemantic && this._getElement(refSemantic);
5647
+
5648
+ if (element) {
5649
+ return element;
5650
+ }
5651
+
5652
+ if (refSemantic) {
5653
+ throw notYetDrawn(translate, semantic, refSemantic, side + 'Ref');
5654
+ } else {
5655
+ throw new Error(translate('{semantic}#{side} Ref not specified', {
5656
+ semantic: elementToString(semantic),
5657
+ side: side
5658
+ }));
5659
+ }
5660
+ };
5661
+
5662
+ BpmnImporter.prototype._getSource = function(semantic) {
5663
+ return this._getEnd(semantic, 'source');
5664
+ };
5665
+
5666
+ BpmnImporter.prototype._getTarget = function(semantic) {
5667
+ return this._getEnd(semantic, 'target');
5668
+ };
5669
+
5670
+
5671
+ BpmnImporter.prototype._getElement = function(semantic) {
5672
+ return this._elementRegistry.get(semantic.id);
5673
+ };
5674
+
5675
+
5676
+ // helpers ////////////////////
5677
+
5678
+ function isPointInsideBBox(bbox, point) {
5679
+ var x = point.x,
5680
+ y = point.y;
5681
+
5682
+ return x >= bbox.x &&
5683
+ x <= bbox.x + bbox.width &&
5684
+ y >= bbox.y &&
5685
+ y <= bbox.y + bbox.height;
5686
+ }
5687
+
5688
+ function isFrameElement$1(semantic) {
5689
+ return is$1(semantic, 'bpmn:Group');
5690
+ }
5691
+
5692
+ var ImportModule = {
5693
+ __depends__: [
5694
+ TranslateModule
5695
+ ],
5696
+ bpmnImporter: [ 'type', BpmnImporter ]
5697
+ };
5698
+
5699
+ var CoreModule$1 = {
5700
+ __depends__: [
5701
+ DrawModule$1,
5702
+ ImportModule
5703
+ ]
5704
+ };
5705
+
5706
+ /**
5707
+ * Flatten array, one level deep.
5708
+ *
5709
+ * @param {Array<?>} arr
5710
+ *
5711
+ * @return {Array<?>}
5712
+ */
5713
+
5714
+ var nativeToString = Object.prototype.toString;
5715
+ var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
5716
+ function isUndefined$1(obj) {
5717
+ return obj === undefined;
5718
+ }
5719
+ function isArray$1(obj) {
5720
+ return nativeToString.call(obj) === '[object Array]';
5721
+ }
5722
+ /**
5723
+ * Return true, if target owns a property with the given key.
5724
+ *
5725
+ * @param {Object} target
5726
+ * @param {String} key
5727
+ *
5728
+ * @return {Boolean}
5729
+ */
5730
+
5731
+ function has(target, key) {
5732
+ return nativeHasOwnProperty.call(target, key);
5733
+ }
5734
+ /**
5735
+ * Iterate over collection; returning something
5736
+ * (non-undefined) will stop iteration.
5737
+ *
5738
+ * @param {Array|Object} collection
5739
+ * @param {Function} iterator
5740
+ *
5741
+ * @return {Object} return result that stopped the iteration
5742
+ */
5743
+
5744
+ function forEach(collection, iterator) {
5745
+ var val, result;
5746
+
5747
+ if (isUndefined$1(collection)) {
5748
+ return;
5749
+ }
5750
+
5751
+ var convertKey = isArray$1(collection) ? toNum : identity;
5752
+
5753
+ for (var key in collection) {
5754
+ if (has(collection, key)) {
5755
+ val = collection[key];
5756
+ result = iterator(val, convertKey(key));
5757
+
5758
+ if (result === false) {
5759
+ return val;
5760
+ }
5761
+ }
5762
+ }
5763
+ }
5764
+
5765
+ function identity(arg) {
5766
+ return arg;
5767
+ }
5768
+
5769
+ function toNum(arg) {
5770
+ return Number(arg);
5771
+ }
5772
+
5773
+ /**
5774
+ * Assigns style attributes in a style-src compliant way.
5775
+ *
5776
+ * @param {Element} element
5777
+ * @param {...Object} styleSources
5778
+ *
5779
+ * @return {Element} the element
5780
+ */
5781
+ function assign$1(element) {
5782
+ var target = element.style;
5783
+
5784
+ for (var _len = arguments.length, styleSources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5785
+ styleSources[_key - 1] = arguments[_key];
5786
+ }
5787
+
5788
+ forEach(styleSources, function (style) {
5789
+ if (!style) {
5790
+ return;
5791
+ }
5792
+
5793
+ forEach(style, function (value, key) {
5794
+ target[key] = value;
5795
+ });
5796
+ });
5797
+
5798
+ return element;
5799
+ }
5800
+
5801
+ /**
5802
+ * Set attribute `name` to `val`, or get attr `name`.
5803
+ *
5804
+ * @param {Element} el
5805
+ * @param {String} name
5806
+ * @param {String} [val]
5807
+ * @api public
5808
+ */
5809
+ function attr(el, name, val) {
5810
+ // get
5811
+ if (arguments.length == 2) {
5812
+ return el.getAttribute(name);
5813
+ }
5814
+
5815
+ // remove
5816
+ if (val === null) {
5817
+ return el.removeAttribute(name);
5818
+ }
5819
+
5820
+ // set
5821
+ el.setAttribute(name, val);
5822
+
5823
+ return el;
5824
+ }
5825
+
5826
+ var indexOf = [].indexOf;
5827
+
5828
+ var indexof = function(arr, obj){
5829
+ if (indexOf) return arr.indexOf(obj);
5830
+ for (var i = 0; i < arr.length; ++i) {
5831
+ if (arr[i] === obj) return i;
5832
+ }
5833
+ return -1;
5834
+ };
5835
+
5836
+ /**
5837
+ * Taken from https://github.com/component/classes
5838
+ *
5839
+ * Without the component bits.
5840
+ */
5841
+
5842
+ /**
5843
+ * Whitespace regexp.
5844
+ */
5845
+
5846
+ var re = /\s+/;
5847
+
5848
+ /**
5849
+ * toString reference.
5850
+ */
5851
+
5852
+ var toString = Object.prototype.toString;
5853
+
5854
+ /**
5855
+ * Wrap `el` in a `ClassList`.
5856
+ *
5857
+ * @param {Element} el
5858
+ * @return {ClassList}
5859
+ * @api public
5860
+ */
5861
+
5862
+ function classes(el) {
5863
+ return new ClassList(el);
5864
+ }
5865
+
5866
+ /**
5867
+ * Initialize a new ClassList for `el`.
5868
+ *
5869
+ * @param {Element} el
5870
+ * @api private
5871
+ */
5872
+
5873
+ function ClassList(el) {
5874
+ if (!el || !el.nodeType) {
5875
+ throw new Error('A DOM element reference is required');
5876
+ }
5877
+ this.el = el;
5878
+ this.list = el.classList;
5879
+ }
5880
+
5881
+ /**
5882
+ * Add class `name` if not already present.
5883
+ *
5884
+ * @param {String} name
5885
+ * @return {ClassList}
5886
+ * @api public
5887
+ */
5888
+
5889
+ ClassList.prototype.add = function (name) {
5890
+ // classList
5891
+ if (this.list) {
5892
+ this.list.add(name);
5893
+ return this;
5894
+ }
5895
+
5896
+ // fallback
5897
+ var arr = this.array();
5898
+ var i = indexof(arr, name);
5899
+ if (!~i) arr.push(name);
5900
+ this.el.className = arr.join(' ');
5901
+ return this;
5902
+ };
5903
+
5904
+ /**
5905
+ * Remove class `name` when present, or
5906
+ * pass a regular expression to remove
5907
+ * any which match.
5908
+ *
5909
+ * @param {String|RegExp} name
5910
+ * @return {ClassList}
5911
+ * @api public
5912
+ */
5913
+
5914
+ ClassList.prototype.remove = function (name) {
5915
+ if ('[object RegExp]' == toString.call(name)) {
5916
+ return this.removeMatching(name);
5917
+ }
5918
+
5919
+ // classList
5920
+ if (this.list) {
5921
+ this.list.remove(name);
5922
+ return this;
5923
+ }
5924
+
5925
+ // fallback
5926
+ var arr = this.array();
5927
+ var i = indexof(arr, name);
5928
+ if (~i) arr.splice(i, 1);
5929
+ this.el.className = arr.join(' ');
5930
+ return this;
5931
+ };
5932
+
5933
+ /**
5934
+ * Remove all classes matching `re`.
5935
+ *
5936
+ * @param {RegExp} re
5937
+ * @return {ClassList}
5938
+ * @api private
5939
+ */
5940
+
5941
+ ClassList.prototype.removeMatching = function (re) {
5942
+ var arr = this.array();
5943
+ for (var i = 0; i < arr.length; i++) {
5944
+ if (re.test(arr[i])) {
5945
+ this.remove(arr[i]);
5946
+ }
5947
+ }
5948
+ return this;
5949
+ };
5950
+
5951
+ /**
5952
+ * Toggle class `name`, can force state via `force`.
5953
+ *
5954
+ * For browsers that support classList, but do not support `force` yet,
5955
+ * the mistake will be detected and corrected.
5956
+ *
5957
+ * @param {String} name
5958
+ * @param {Boolean} force
5959
+ * @return {ClassList}
5960
+ * @api public
5961
+ */
5962
+
5963
+ ClassList.prototype.toggle = function (name, force) {
5964
+ // classList
5965
+ if (this.list) {
5966
+ if ('undefined' !== typeof force) {
5967
+ if (force !== this.list.toggle(name, force)) {
5968
+ this.list.toggle(name); // toggle again to correct
5969
+ }
5970
+ } else {
5971
+ this.list.toggle(name);
5972
+ }
5973
+ return this;
5974
+ }
5975
+
5976
+ // fallback
5977
+ if ('undefined' !== typeof force) {
5978
+ if (!force) {
5979
+ this.remove(name);
5980
+ } else {
5981
+ this.add(name);
5982
+ }
5983
+ } else {
5984
+ if (this.has(name)) {
5985
+ this.remove(name);
5986
+ } else {
5987
+ this.add(name);
5988
+ }
5989
+ }
5990
+
5991
+ return this;
5992
+ };
5993
+
5994
+ /**
5995
+ * Return an array of classes.
5996
+ *
5997
+ * @return {Array}
5998
+ * @api public
5999
+ */
6000
+
6001
+ ClassList.prototype.array = function () {
6002
+ var className = this.el.getAttribute('class') || '';
6003
+ var str = className.replace(/^\s+|\s+$/g, '');
6004
+ var arr = str.split(re);
6005
+ if ('' === arr[0]) arr.shift();
6006
+ return arr;
6007
+ };
6008
+
6009
+ /**
6010
+ * Check if class `name` is present.
6011
+ *
6012
+ * @param {String} name
6013
+ * @return {ClassList}
6014
+ * @api public
6015
+ */
6016
+
6017
+ ClassList.prototype.has = ClassList.prototype.contains = function (name) {
6018
+ return this.list ? this.list.contains(name) : !!~indexof(this.array(), name);
6019
+ };
6020
+
6021
+ /**
6022
+ * Remove all children from the given element.
6023
+ */
6024
+ function clear(el) {
6025
+
6026
+ var c;
6027
+
6028
+ while (el.childNodes.length) {
6029
+ c = el.childNodes[0];
6030
+ el.removeChild(c);
6031
+ }
6032
+
6033
+ return el;
6034
+ }
6035
+
6036
+ var proto = typeof Element !== 'undefined' ? Element.prototype : {};
6037
+ var vendor = proto.matches
6038
+ || proto.matchesSelector
6039
+ || proto.webkitMatchesSelector
6040
+ || proto.mozMatchesSelector
6041
+ || proto.msMatchesSelector
6042
+ || proto.oMatchesSelector;
6043
+
6044
+ var matchesSelector = match;
6045
+
6046
+ /**
6047
+ * Match `el` to `selector`.
6048
+ *
6049
+ * @param {Element} el
6050
+ * @param {String} selector
6051
+ * @return {Boolean}
6052
+ * @api public
6053
+ */
6054
+
6055
+ function match(el, selector) {
6056
+ if (!el || el.nodeType !== 1) return false;
6057
+ if (vendor) return vendor.call(el, selector);
6058
+ var nodes = el.parentNode.querySelectorAll(selector);
6059
+ for (var i = 0; i < nodes.length; i++) {
6060
+ if (nodes[i] == el) return true;
6061
+ }
6062
+ return false;
6063
+ }
6064
+
6065
+ /**
6066
+ * Closest
6067
+ *
6068
+ * @param {Element} el
6069
+ * @param {String} selector
6070
+ * @param {Boolean} checkYourSelf (optional)
6071
+ */
6072
+ function closest (element, selector, checkYourSelf) {
6073
+ var currentElem = checkYourSelf ? element : element.parentNode;
6074
+
6075
+ while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
6076
+
6077
+ if (matchesSelector(currentElem, selector)) {
6078
+ return currentElem;
6079
+ }
6080
+
6081
+ currentElem = currentElem.parentNode;
6082
+ }
6083
+
6084
+ return matchesSelector(currentElem, selector) ? currentElem : null;
6085
+ }
6086
+
6087
+ var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
6088
+ unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
6089
+ prefix$6 = bind$1 !== 'addEventListener' ? 'on' : '';
6090
+
6091
+ /**
6092
+ * Bind `el` event `type` to `fn`.
6093
+ *
6094
+ * @param {Element} el
6095
+ * @param {String} type
6096
+ * @param {Function} fn
6097
+ * @param {Boolean} capture
6098
+ * @return {Function}
6099
+ * @api public
6100
+ */
6101
+
6102
+ var bind_1 = function(el, type, fn, capture){
6103
+ el[bind$1](prefix$6 + type, fn, capture || false);
6104
+ return fn;
6105
+ };
6106
+
6107
+ /**
6108
+ * Unbind `el` event `type`'s callback `fn`.
6109
+ *
6110
+ * @param {Element} el
6111
+ * @param {String} type
6112
+ * @param {Function} fn
6113
+ * @param {Boolean} capture
6114
+ * @return {Function}
6115
+ * @api public
6116
+ */
6117
+
6118
+ var unbind_1 = function(el, type, fn, capture){
6119
+ el[unbind](prefix$6 + type, fn, capture || false);
6120
+ return fn;
6121
+ };
6122
+
6123
+ var componentEvent = {
6124
+ bind: bind_1,
6125
+ unbind: unbind_1
6126
+ };
6127
+
6128
+ /**
6129
+ * Module dependencies.
6130
+ */
6131
+
6132
+ /**
6133
+ * Delegate event `type` to `selector`
6134
+ * and invoke `fn(e)`. A callback function
6135
+ * is returned which may be passed to `.unbind()`.
6136
+ *
6137
+ * @param {Element} el
6138
+ * @param {String} selector
6139
+ * @param {String} type
6140
+ * @param {Function} fn
6141
+ * @param {Boolean} capture
6142
+ * @return {Function}
6143
+ * @api public
6144
+ */
6145
+
6146
+ // Some events don't bubble, so we want to bind to the capture phase instead
6147
+ // when delegating.
6148
+ var forceCaptureEvents = ['focus', 'blur'];
6149
+
6150
+ function bind$2(el, selector, type, fn, capture) {
6151
+ if (forceCaptureEvents.indexOf(type) !== -1) {
6152
+ capture = true;
6153
+ }
6154
+
6155
+ return componentEvent.bind(el, type, function (e) {
6156
+ var target = e.target || e.srcElement;
6157
+ e.delegateTarget = closest(target, selector, true);
6158
+ if (e.delegateTarget) {
6159
+ fn.call(el, e);
6160
+ }
6161
+ }, capture);
6162
+ }
6163
+
6164
+ /**
6165
+ * Unbind event `type`'s callback `fn`.
6166
+ *
6167
+ * @param {Element} el
6168
+ * @param {String} type
6169
+ * @param {Function} fn
6170
+ * @param {Boolean} capture
6171
+ * @api public
6172
+ */
6173
+ function unbind$1(el, type, fn, capture) {
6174
+ if (forceCaptureEvents.indexOf(type) !== -1) {
6175
+ capture = true;
6176
+ }
6177
+
6178
+ return componentEvent.unbind(el, type, fn, capture);
6179
+ }
6180
+
6181
+ var delegate = {
6182
+ bind: bind$2,
6183
+ unbind: unbind$1
6184
+ };
6185
+
6186
+ /**
6187
+ * Expose `parse`.
6188
+ */
6189
+
6190
+ var domify = parse;
6191
+
6192
+ /**
6193
+ * Tests for browser support.
5525
6194
  */
5526
- BpmnImporter.prototype.addLabel = function(semantic, di, element) {
5527
- var bounds,
5528
- text,
5529
- label;
5530
6195
 
5531
- bounds = getExternalLabelBounds(di, element);
6196
+ var innerHTMLBug = false;
6197
+ var bugTestDiv;
6198
+ if (typeof document !== 'undefined') {
6199
+ bugTestDiv = document.createElement('div');
6200
+ // Setup
6201
+ bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
6202
+ // Make sure that link elements get serialized correctly by innerHTML
6203
+ // This requires a wrapper element in IE
6204
+ innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;
6205
+ bugTestDiv = undefined;
6206
+ }
5532
6207
 
5533
- text = getLabel(element);
6208
+ /**
6209
+ * Wrap map from jquery.
6210
+ */
5534
6211
 
5535
- if (text) {
6212
+ var map$1 = {
6213
+ legend: [1, '<fieldset>', '</fieldset>'],
6214
+ tr: [2, '<table><tbody>', '</tbody></table>'],
6215
+ col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
6216
+ // for script/link/style tags to work in IE6-8, you have to wrap
6217
+ // in a div with a non-whitespace character in front, ha!
6218
+ _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
6219
+ };
5536
6220
 
5537
- // get corrected bounds from actual layouted text
5538
- bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
5539
- }
6221
+ map$1.td =
6222
+ map$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
5540
6223
 
5541
- label = this._elementFactory.createLabel(elementData(semantic, di, {
5542
- id: semantic.id + '_label',
5543
- labelTarget: element,
5544
- type: 'label',
5545
- hidden: element.hidden || !getLabel(element),
5546
- x: Math.round(bounds.x),
5547
- y: Math.round(bounds.y),
5548
- width: Math.round(bounds.width),
5549
- height: Math.round(bounds.height)
5550
- }));
6224
+ map$1.option =
6225
+ map$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
5551
6226
 
5552
- return this._canvas.addShape(label, element.parent);
5553
- };
6227
+ map$1.thead =
6228
+ map$1.tbody =
6229
+ map$1.colgroup =
6230
+ map$1.caption =
6231
+ map$1.tfoot = [1, '<table>', '</table>'];
6232
+
6233
+ map$1.polyline =
6234
+ map$1.ellipse =
6235
+ map$1.polygon =
6236
+ map$1.circle =
6237
+ map$1.text =
6238
+ map$1.line =
6239
+ map$1.path =
6240
+ map$1.rect =
6241
+ map$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
5554
6242
 
5555
6243
  /**
5556
- * Return the drawn connection end based on the given side.
6244
+ * Parse `html` and return a DOM Node instance, which could be a TextNode,
6245
+ * HTML DOM Node of some kind (<div> for example), or a DocumentFragment
6246
+ * instance, depending on the contents of the `html` string.
5557
6247
  *
5558
- * @throws {Error} if the end is not yet drawn
6248
+ * @param {String} html - HTML string to "domify"
6249
+ * @param {Document} doc - The `document` instance to create the Node for
6250
+ * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance
6251
+ * @api private
5559
6252
  */
5560
- BpmnImporter.prototype._getEnd = function(semantic, side) {
5561
6253
 
5562
- var element,
5563
- refSemantic,
5564
- type = semantic.$type,
5565
- translate = this._translate;
6254
+ function parse(html, doc) {
6255
+ if ('string' != typeof html) throw new TypeError('String expected');
5566
6256
 
5567
- refSemantic = semantic[side + 'Ref'];
6257
+ // default to the global `document` object
6258
+ if (!doc) doc = document;
5568
6259
 
5569
- // handle mysterious isMany DataAssociation#sourceRef
5570
- if (side === 'source' && type === 'bpmn:DataInputAssociation') {
5571
- refSemantic = refSemantic && refSemantic[0];
5572
- }
6260
+ // tag name
6261
+ var m = /<([\w:]+)/.exec(html);
6262
+ if (!m) return doc.createTextNode(html);
5573
6263
 
5574
- // fix source / target for DataInputAssociation / DataOutputAssociation
5575
- if (side === 'source' && type === 'bpmn:DataOutputAssociation' ||
5576
- side === 'target' && type === 'bpmn:DataInputAssociation') {
6264
+ html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
5577
6265
 
5578
- refSemantic = semantic.$parent;
6266
+ var tag = m[1];
6267
+
6268
+ // body support
6269
+ if (tag == 'body') {
6270
+ var el = doc.createElement('html');
6271
+ el.innerHTML = html;
6272
+ return el.removeChild(el.lastChild);
5579
6273
  }
5580
6274
 
5581
- element = refSemantic && this._getElement(refSemantic);
6275
+ // wrap map
6276
+ var wrap = map$1[tag] || map$1._default;
6277
+ var depth = wrap[0];
6278
+ var prefix = wrap[1];
6279
+ var suffix = wrap[2];
6280
+ var el = doc.createElement('div');
6281
+ el.innerHTML = prefix + html + suffix;
6282
+ while (depth--) el = el.lastChild;
5582
6283
 
5583
- if (element) {
5584
- return element;
6284
+ // one element
6285
+ if (el.firstChild == el.lastChild) {
6286
+ return el.removeChild(el.firstChild);
5585
6287
  }
5586
6288
 
5587
- if (refSemantic) {
5588
- throw notYetDrawn(translate, semantic, refSemantic, side + 'Ref');
5589
- } else {
5590
- throw new Error(translate('{semantic}#{side} Ref not specified', {
5591
- semantic: elementToString(semantic),
5592
- side: side
5593
- }));
6289
+ // several elements
6290
+ var fragment = doc.createDocumentFragment();
6291
+ while (el.firstChild) {
6292
+ fragment.appendChild(el.removeChild(el.firstChild));
5594
6293
  }
5595
- };
5596
6294
 
5597
- BpmnImporter.prototype._getSource = function(semantic) {
5598
- return this._getEnd(semantic, 'source');
5599
- };
5600
-
5601
- BpmnImporter.prototype._getTarget = function(semantic) {
5602
- return this._getEnd(semantic, 'target');
5603
- };
5604
-
5605
-
5606
- BpmnImporter.prototype._getElement = function(semantic) {
5607
- return this._elementRegistry.get(semantic.id);
5608
- };
6295
+ return fragment;
6296
+ }
5609
6297
 
6298
+ function query(selector, el) {
6299
+ el = el || document;
5610
6300
 
5611
- // helpers ////////////////////
6301
+ return el.querySelector(selector);
6302
+ }
5612
6303
 
5613
- function isPointInsideBBox(bbox, point) {
5614
- var x = point.x,
5615
- y = point.y;
6304
+ function all(selector, el) {
6305
+ el = el || document;
5616
6306
 
5617
- return x >= bbox.x &&
5618
- x <= bbox.x + bbox.width &&
5619
- y >= bbox.y &&
5620
- y <= bbox.y + bbox.height;
6307
+ return el.querySelectorAll(selector);
5621
6308
  }
5622
6309
 
5623
- function isFrameElement$1(semantic) {
5624
- return is$1(semantic, 'bpmn:Group');
6310
+ function remove$1(el) {
6311
+ el.parentNode && el.parentNode.removeChild(el);
5625
6312
  }
5626
6313
 
5627
- var ImportModule = {
5628
- __depends__: [
5629
- TranslateModule
5630
- ],
5631
- bpmnImporter: [ 'type', BpmnImporter ]
5632
- };
5633
-
5634
- var CoreModule$1 = {
5635
- __depends__: [
5636
- DrawModule$1,
5637
- ImportModule
5638
- ]
5639
- };
5640
-
5641
6314
  function getOriginal(event) {
5642
6315
  return event.originalEvent || event.srcEvent;
5643
6316
  }
@@ -5850,13 +6523,13 @@
5850
6523
  }
5851
6524
 
5852
6525
  function registerEvents(svg) {
5853
- forEach(bindings, function(val, key) {
6526
+ forEach$2(bindings, function(val, key) {
5854
6527
  registerEvent(svg, key, val);
5855
6528
  });
5856
6529
  }
5857
6530
 
5858
6531
  function unregisterEvents(svg) {
5859
- forEach(bindings, function(val, key) {
6532
+ forEach$2(bindings, function(val, key) {
5860
6533
  unregisterEvent(svg, key, val);
5861
6534
  });
5862
6535
  }
@@ -5916,10 +6589,13 @@
5916
6589
 
5917
6590
  var ALL_HIT_STYLE = createHitStyle('djs-hit djs-hit-all');
5918
6591
 
6592
+ var NO_MOVE_HIT_STYLE = createHitStyle('djs-hit djs-hit-no-move');
6593
+
5919
6594
  var HIT_TYPES = {
5920
6595
  'all': ALL_HIT_STYLE,
5921
6596
  'click-stroke': CLICK_STROKE_HIT_STYLE,
5922
- 'stroke': STROKE_HIT_STYLE
6597
+ 'stroke': STROKE_HIT_STYLE,
6598
+ 'no-move': NO_MOVE_HIT_STYLE
5923
6599
  };
5924
6600
 
5925
6601
  function createHitStyle(classNames, attrs) {
@@ -5963,7 +6639,7 @@
5963
6639
  this.removeHits = function(gfx) {
5964
6640
  var hits = all('.djs-hit', gfx);
5965
6641
 
5966
- forEach(hits, remove$2);
6642
+ forEach$2(hits, remove$3);
5967
6643
  };
5968
6644
 
5969
6645
  /**
@@ -6177,8 +6853,8 @@
6177
6853
  function getBBox(elements, stopRecursion) {
6178
6854
 
6179
6855
  stopRecursion = !!stopRecursion;
6180
- if (!isArray$1(elements)) {
6181
- elements = [elements];
6856
+ if (!isArray$3(elements)) {
6857
+ elements = [ elements ];
6182
6858
  }
6183
6859
 
6184
6860
  var minX,
@@ -6186,7 +6862,7 @@
6186
6862
  maxX,
6187
6863
  maxY;
6188
6864
 
6189
- forEach(elements, function(element) {
6865
+ forEach$2(elements, function(element) {
6190
6866
 
6191
6867
  // If element is a connection the bbox must be computed first
6192
6868
  var bbox = element;
@@ -6347,7 +7023,7 @@
6347
7023
  };
6348
7024
 
6349
7025
 
6350
- Outline.$inject = ['eventBus', 'styles', 'elementRegistry'];
7026
+ Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
6351
7027
 
6352
7028
  var OutlineModule = {
6353
7029
  __init__: [ 'outline' ],
@@ -6423,7 +7099,7 @@
6423
7099
  var selectedElements = this._selectedElements,
6424
7100
  oldSelection = selectedElements.slice();
6425
7101
 
6426
- if (!isArray$1(elements)) {
7102
+ if (!isArray$3(elements)) {
6427
7103
  elements = elements ? [ elements ] : [];
6428
7104
  }
6429
7105
 
@@ -6440,7 +7116,7 @@
6440
7116
  // selection may be cleared by passing an empty array or null
6441
7117
  // to the method
6442
7118
  if (add) {
6443
- forEach(elements, function(element) {
7119
+ forEach$2(elements, function(element) {
6444
7120
  if (selectedElements.indexOf(element) !== -1) {
6445
7121
 
6446
7122
  // already selected
@@ -6505,13 +7181,13 @@
6505
7181
  var oldSelection = event.oldSelection,
6506
7182
  newSelection = event.newSelection;
6507
7183
 
6508
- forEach(oldSelection, function(e) {
7184
+ forEach$2(oldSelection, function(e) {
6509
7185
  if (newSelection.indexOf(e) === -1) {
6510
7186
  deselect(e);
6511
7187
  }
6512
7188
  });
6513
7189
 
6514
- forEach(newSelection, function(e) {
7190
+ forEach$2(newSelection, function(e) {
6515
7191
  if (oldSelection.indexOf(e) === -1) {
6516
7192
  select(e);
6517
7193
  }
@@ -6543,7 +7219,7 @@
6543
7219
  return;
6544
7220
  }
6545
7221
 
6546
- if (isArray$1(autoSelect)) {
7222
+ if (isArray$3(autoSelect)) {
6547
7223
  selection.select(autoSelect);
6548
7224
  } else {
6549
7225
 
@@ -6911,13 +7587,13 @@
6911
7587
 
6912
7588
  var overlays = this.get(filter) || [];
6913
7589
 
6914
- if (!isArray$1(overlays)) {
7590
+ if (!isArray$3(overlays)) {
6915
7591
  overlays = [ overlays ];
6916
7592
  }
6917
7593
 
6918
7594
  var self = this;
6919
7595
 
6920
- forEach(overlays, function(overlay) {
7596
+ forEach$2(overlays, function(overlay) {
6921
7597
 
6922
7598
  var container = self._getOverlayContainer(overlay.element, true);
6923
7599
 
@@ -7026,7 +7702,8 @@
7026
7702
 
7027
7703
 
7028
7704
  Overlays.prototype._createOverlayContainer = function(element) {
7029
- var html = domify('<div class="djs-overlays" style="position: absolute" />');
7705
+ var html = domify('<div class="djs-overlays" />');
7706
+ assign$1(html, { position: 'absolute' });
7030
7707
 
7031
7708
  this._overlayRoot.appendChild(html);
7032
7709
 
@@ -7097,7 +7774,8 @@
7097
7774
 
7098
7775
  overlayContainer = this._getOverlayContainer(element);
7099
7776
 
7100
- htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '" style="position: absolute">');
7777
+ htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '">');
7778
+ assign$1(htmlContainer, { position: 'absolute' });
7101
7779
 
7102
7780
  htmlContainer.appendChild(html);
7103
7781
 
@@ -7187,7 +7865,7 @@
7187
7865
 
7188
7866
  var self = this;
7189
7867
 
7190
- forEach(this._overlays, function(overlay) {
7868
+ forEach$2(this._overlays, function(overlay) {
7191
7869
  self._updateOverlayVisibilty(overlay, viewbox);
7192
7870
  });
7193
7871
  };
@@ -7224,7 +7902,7 @@
7224
7902
  var element = e.element;
7225
7903
  var overlays = self.get({ element: element });
7226
7904
 
7227
- forEach(overlays, function(o) {
7905
+ forEach$2(overlays, function(o) {
7228
7906
  self.remove(o.id);
7229
7907
  });
7230
7908
 
@@ -7248,7 +7926,7 @@
7248
7926
  var container = self._getOverlayContainer(element, true);
7249
7927
 
7250
7928
  if (container) {
7251
- forEach(container.overlays, function(overlay) {
7929
+ forEach$2(container.overlays, function(overlay) {
7252
7930
  self._updateOverlay(overlay);
7253
7931
  });
7254
7932
 
@@ -7282,16 +7960,22 @@
7282
7960
 
7283
7961
  function createRoot(parentNode) {
7284
7962
  var root = domify(
7285
- '<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'
7963
+ '<div class="djs-overlay-container" />'
7286
7964
  );
7287
7965
 
7966
+ assign$1(root, {
7967
+ position: 'absolute',
7968
+ width: 0,
7969
+ height: 0
7970
+ });
7971
+
7288
7972
  parentNode.insertBefore(root, parentNode.firstChild);
7289
7973
 
7290
7974
  return root;
7291
7975
  }
7292
7976
 
7293
7977
  function setPosition(el, x, y) {
7294
- assign(el.style, { left: x + 'px', top: y + 'px' });
7978
+ assign$1(el, { left: x + 'px', top: y + 'px' });
7295
7979
  }
7296
7980
 
7297
7981
  function setVisible(el, visible) {
@@ -7377,7 +8061,7 @@
7377
8061
  ];
7378
8062
 
7379
8063
  var ChangeSupportModule = {
7380
- __init__: [ 'changeSupport'],
8064
+ __init__: [ 'changeSupport' ],
7381
8065
  changeSupport: [ 'type', ChangeSupport ]
7382
8066
  };
7383
8067
 
@@ -7455,13 +8139,13 @@
7455
8139
  throw new Error('handlerFn must be a function');
7456
8140
  }
7457
8141
 
7458
- if (!isArray$1(events)) {
8142
+ if (!isArray$3(events)) {
7459
8143
  events = [ events ];
7460
8144
  }
7461
8145
 
7462
8146
  var eventBus = this._eventBus;
7463
8147
 
7464
- forEach(events, function(event) {
8148
+ forEach$2(events, function(event) {
7465
8149
 
7466
8150
  // concat commandStack(.event)?(.hook)?
7467
8151
  var fullEvent = [ 'commandStack', event, hook ].filter(function(e) { return e; }).join('.');
@@ -7489,7 +8173,7 @@
7489
8173
  * This will generate the CommandInterceptor#(preExecute|...|reverted) methods
7490
8174
  * which will in term forward to CommandInterceptor#on.
7491
8175
  */
7492
- forEach(hooks, function(hook) {
8176
+ forEach$2(hooks, function(hook) {
7493
8177
 
7494
8178
  /**
7495
8179
  * {canExecute|preExecute|preExecuted|execute|executed|postExecute|postExecuted|revert|reverted}
@@ -7549,7 +8233,7 @@
7549
8233
 
7550
8234
  inherits$1(RootElementsBehavior, CommandInterceptor);
7551
8235
 
7552
- RootElementsBehavior.$inject = [ 'canvas', 'injector'];
8236
+ RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
7553
8237
 
7554
8238
  var RootElementsModule = {
7555
8239
  __init__: [ 'rootElementsBehavior' ],
@@ -7713,9 +8397,9 @@
7713
8397
  * @param {canvas} canvas
7714
8398
  */
7715
8399
  function DrilldownBreadcrumbs(eventBus, elementRegistry, overlays, canvas) {
7716
- var breadcrumbs = domify('<ul class="bjs-breadcrumbs"></ul>');
8400
+ var breadcrumbs = domify$1('<ul class="bjs-breadcrumbs"></ul>');
7717
8401
  var container = canvas.getContainer();
7718
- var containerClasses = classes(container);
8402
+ var containerClasses = classes$1(container);
7719
8403
  container.appendChild(breadcrumbs);
7720
8404
 
7721
8405
  var boParents = [];
@@ -7749,7 +8433,7 @@
7749
8433
 
7750
8434
  var path = boParents.map(function(parent) {
7751
8435
  var title = escapeHTML(parent.name || parent.id);
7752
- var link = domify('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
8436
+ var link = domify$1('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
7753
8437
 
7754
8438
  var parentPlane = canvas.findRoot(getPlaneIdFromShape(parent)) || canvas.findRoot(parent.id);
7755
8439
 
@@ -8009,7 +8693,7 @@
8009
8693
  collapsedElements.push(bo);
8010
8694
  }
8011
8695
 
8012
- if (is$1(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
8696
+ if (shouldMoveToPlane(bo, plane)) {
8013
8697
 
8014
8698
  // don't change the array while we iterate over it
8015
8699
  elementsToMove.push({ diElement: diElement, parent: parent });
@@ -8098,7 +8782,7 @@
8098
8782
  SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
8099
8783
 
8100
8784
 
8101
- // helpers
8785
+ // helpers //////////////////////////
8102
8786
 
8103
8787
  function findRootDiagram(element) {
8104
8788
  if (is$1(element, 'bpmndi:BPMNDiagram')) {
@@ -8130,6 +8814,23 @@
8130
8814
  return asBounds(planeTrbl);
8131
8815
  }
8132
8816
 
8817
+ function shouldMoveToPlane(bo, plane) {
8818
+ var parent = bo.$parent;
8819
+
8820
+ // don't move elements that are already on the plane
8821
+ if (!is$1(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
8822
+ return false;
8823
+ }
8824
+
8825
+ // dataAssociations are children of the subprocess but rendered on process level
8826
+ // cf. https://github.com/bpmn-io/bpmn-js/issues/1619
8827
+ if (isAny(bo, ['bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation'])) {
8828
+ return false;
8829
+ }
8830
+
8831
+ return true;
8832
+ }
8833
+
8133
8834
  var LOW_PRIORITY = 250;
8134
8835
  var ARROW_DOWN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>';
8135
8836
 
@@ -8205,7 +8906,7 @@
8205
8906
  }, true);
8206
8907
 
8207
8908
 
8208
- eventBus.on('import.done', function() {
8909
+ eventBus.on('import.render.complete', function() {
8209
8910
  elementRegistry.filter(function(e) {
8210
8911
  return self.canDrillDown(e);
8211
8912
  }).map(function(el) {
@@ -8254,7 +8955,7 @@
8254
8955
  }
8255
8956
 
8256
8957
  var hasContent = bo && bo.flowElements && bo.flowElements.length;
8257
- classes(overlay.html).toggle(EMPTY_MARKER, !hasContent);
8958
+ classes$1(overlay.html).toggle(EMPTY_MARKER, !hasContent);
8258
8959
  };
8259
8960
 
8260
8961
  /**
@@ -8272,7 +8973,7 @@
8272
8973
  this.removeOverlay(element);
8273
8974
  }
8274
8975
 
8275
- var button = domify('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
8976
+ var button = domify$1('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
8276
8977
 
8277
8978
  button.addEventListener('click', function() {
8278
8979
  canvas.setRootElement(canvas.findRoot(getPlaneIdFromShape(element)));
@@ -8713,11 +9414,11 @@
8713
9414
  height = shape.height;
8714
9415
 
8715
9416
  var shapePath = [
8716
- ['M', x, y],
8717
- ['l', width, 0],
8718
- ['l', 0, height],
8719
- ['l', -width, 0],
8720
- ['z']
9417
+ [ 'M', x, y ],
9418
+ [ 'l', width, 0 ],
9419
+ [ 'l', 0, height ],
9420
+ [ 'l', -width, 0 ],
9421
+ [ 'z' ]
8721
9422
  ];
8722
9423
 
8723
9424
  return componentsToPath(shapePath);
@@ -8788,7 +9489,7 @@
8788
9489
  */
8789
9490
  this.style = function(traits, additionalAttrs) {
8790
9491
 
8791
- if (!isArray$1(traits) && !additionalAttrs) {
9492
+ if (!isArray$3(traits) && !additionalAttrs) {
8792
9493
  additionalAttrs = traits;
8793
9494
  traits = [];
8794
9495
  }
@@ -8801,7 +9502,7 @@
8801
9502
  };
8802
9503
 
8803
9504
  this.computeStyle = function(custom, traits, defaultStyles) {
8804
- if (!isArray$1(traits)) {
9505
+ if (!isArray$3(traits)) {
8805
9506
  defaultStyles = traits;
8806
9507
  traits = [];
8807
9508
  }
@@ -8925,7 +9626,7 @@
8925
9626
  var parent = document.createElement('div');
8926
9627
  parent.setAttribute('class', 'djs-container');
8927
9628
 
8928
- assign(parent.style, {
9629
+ assign$1(parent, {
8929
9630
  position: 'relative',
8930
9631
  overflow: 'hidden',
8931
9632
  width: ensurePx(options.width),
@@ -8939,7 +9640,7 @@
8939
9640
 
8940
9641
  function createGroup(parent, cls, childIndex) {
8941
9642
  var group = create$1('g');
8942
- classes$1(group).add(cls);
9643
+ classes$2(group).add(cls);
8943
9644
 
8944
9645
  var index = childIndex !== undefined ? childIndex : parent.childNodes.length - 1;
8945
9646
 
@@ -9027,7 +9728,7 @@
9027
9728
  // debounce canvas.viewbox.changed events
9028
9729
  // for smoother diagram interaction
9029
9730
  if (config.deferUpdate !== false) {
9030
- this._viewboxChanged = debounce(bind$2(this._viewboxChanged, this), 300);
9731
+ this._viewboxChanged = debounce(bind(this._viewboxChanged, this), 300);
9031
9732
  }
9032
9733
 
9033
9734
  eventBus.on('diagram.init', function() {
@@ -9158,6 +9859,25 @@
9158
9859
  return layer.group;
9159
9860
  };
9160
9861
 
9862
+ /**
9863
+ * For a given index, return the number of layers that have a higher index and
9864
+ * are visible.
9865
+ *
9866
+ * This is used to determine the node a layer should be inserted at.
9867
+ *
9868
+ * @param {Number} index
9869
+ * @returns {Number}
9870
+ */
9871
+ Canvas.prototype._getChildIndex = function(index) {
9872
+ return reduce(this._layers, function(childIndex, layer) {
9873
+ if (layer.visible && index >= layer.index) {
9874
+ childIndex++;
9875
+ }
9876
+
9877
+ return childIndex;
9878
+ }, 0);
9879
+ };
9880
+
9161
9881
  /**
9162
9882
  * Creates a given layer and returns it.
9163
9883
  *
@@ -9172,19 +9892,80 @@
9172
9892
  index = UTILITY_LAYER_INDEX;
9173
9893
  }
9174
9894
 
9175
- var childIndex = reduce(this._layers, function(childIndex, layer) {
9176
- if (index >= layer.index) {
9177
- childIndex++;
9178
- }
9179
-
9180
- return childIndex;
9181
- }, 0);
9895
+ var childIndex = this._getChildIndex(index);
9182
9896
 
9183
9897
  return {
9184
9898
  group: createGroup(this._viewport, 'layer-' + name, childIndex),
9185
- index: index
9899
+ index: index,
9900
+ visible: true
9186
9901
  };
9902
+ };
9903
+
9904
+
9905
+ /**
9906
+ * Shows a given layer.
9907
+ *
9908
+ * @param {String} layer
9909
+ * @returns {SVGElement}
9910
+ */
9911
+ Canvas.prototype.showLayer = function(name) {
9912
+
9913
+ if (!name) {
9914
+ throw new Error('must specify a name');
9915
+ }
9916
+
9917
+ var layer = this._layers[name];
9918
+
9919
+ if (!layer) {
9920
+ throw new Error('layer <' + name + '> does not exist');
9921
+ }
9922
+
9923
+ var viewport = this._viewport;
9924
+ var group = layer.group;
9925
+ var index = layer.index;
9926
+
9927
+ if (layer.visible) {
9928
+ return group;
9929
+ }
9930
+
9931
+ var childIndex = this._getChildIndex(index);
9932
+
9933
+ viewport.insertBefore(group, viewport.childNodes[childIndex] || null);
9934
+
9935
+ layer.visible = true;
9936
+
9937
+ return group;
9938
+ };
9939
+
9940
+ /**
9941
+ * Hides a given layer.
9942
+ *
9943
+ * @param {String} layer
9944
+ * @returns {SVGElement}
9945
+ */
9946
+ Canvas.prototype.hideLayer = function(name) {
9187
9947
 
9948
+ if (!name) {
9949
+ throw new Error('must specify a name');
9950
+ }
9951
+
9952
+ var layer = this._layers[name];
9953
+
9954
+ if (!layer) {
9955
+ throw new Error('layer <' + name + '> does not exist');
9956
+ }
9957
+
9958
+ var group = layer.group;
9959
+
9960
+ if (!layer.visible) {
9961
+ return group;
9962
+ }
9963
+
9964
+ remove$3(group);
9965
+
9966
+ layer.visible = false;
9967
+
9968
+ return group;
9188
9969
  };
9189
9970
 
9190
9971
 
@@ -9195,7 +9976,7 @@
9195
9976
  if (layer) {
9196
9977
  delete this._layers[name];
9197
9978
 
9198
- remove$2(layer.group);
9979
+ remove$3(layer.group);
9199
9980
  }
9200
9981
  };
9201
9982
 
@@ -9283,14 +10064,14 @@
9283
10064
  return;
9284
10065
  }
9285
10066
 
9286
- forEach([ container.gfx, container.secondaryGfx ], function(gfx) {
10067
+ forEach$2([ container.gfx, container.secondaryGfx ], function(gfx) {
9287
10068
  if (gfx) {
9288
10069
 
9289
10070
  // invoke either addClass or removeClass based on mode
9290
10071
  if (add) {
9291
- classes$1(gfx).add(marker);
10072
+ classes$2(gfx).add(marker);
9292
10073
  } else {
9293
- classes$1(gfx).remove(marker);
10074
+ classes$2(gfx).remove(marker);
9294
10075
  }
9295
10076
  }
9296
10077
  });
@@ -9356,7 +10137,7 @@
9356
10137
 
9357
10138
  var gfx = this.getGraphics(element);
9358
10139
 
9359
- return classes$1(gfx).has(marker);
10140
+ return classes$2(gfx).has(marker);
9360
10141
  };
9361
10142
 
9362
10143
  /**
@@ -9427,7 +10208,7 @@
9427
10208
 
9428
10209
  var layer = this.getLayer(layerName, PLANE_LAYER_INDEX);
9429
10210
 
9430
- attr$1(layer, 'display', 'none');
10211
+ this.hideLayer(layerName);
9431
10212
 
9432
10213
  this._addRoot(rootElement, layer);
9433
10214
 
@@ -9546,17 +10327,13 @@
9546
10327
 
9547
10328
  var currentRoot = this._rootElement;
9548
10329
 
9549
- var currentLayer;
9550
-
9551
10330
  if (currentRoot) {
9552
10331
 
9553
10332
  // un-associate previous root element <svg>
9554
10333
  this._elementRegistry.updateGraphics(currentRoot, null, true);
9555
10334
 
9556
10335
  // hide previous layer
9557
- currentLayer = this._findPlaneForRoot(currentRoot).layer;
9558
-
9559
- attr$1(currentLayer, 'display', 'none');
10336
+ this.hideLayer(currentRoot.layer);
9560
10337
  }
9561
10338
 
9562
10339
  if (rootElement) {
@@ -9569,7 +10346,7 @@
9569
10346
  this._elementRegistry.updateGraphics(rootElement, this._svg, true);
9570
10347
 
9571
10348
  // show root layer
9572
- attr$1(layer, 'display', null);
10349
+ this.showLayer(rootElement.layer);
9573
10350
  }
9574
10351
 
9575
10352
  this._rootElement = rootElement;
@@ -11194,7 +11971,7 @@
11194
11971
  */
11195
11972
  EventBus.prototype.on = function(events, priority, callback, that) {
11196
11973
 
11197
- events = isArray$1(events) ? events : [ events ];
11974
+ events = isArray$3(events) ? events : [ events ];
11198
11975
 
11199
11976
  if (isFunction(priority)) {
11200
11977
  that = callback;
@@ -11209,7 +11986,7 @@
11209
11986
  var actualCallback = callback;
11210
11987
 
11211
11988
  if (that) {
11212
- actualCallback = bind$2(callback, that);
11989
+ actualCallback = bind(callback, that);
11213
11990
 
11214
11991
  // make sure we remember and are able to remove
11215
11992
  // bound callbacks via {@link #off} using the original
@@ -11279,7 +12056,7 @@
11279
12056
  */
11280
12057
  EventBus.prototype.off = function(events, callback) {
11281
12058
 
11282
- events = isArray$1(events) ? events : [ events ];
12059
+ events = isArray$3(events) ? events : [ events ];
11283
12060
 
11284
12061
  var self = this;
11285
12062
 
@@ -11645,7 +12422,7 @@
11645
12422
  childrenGfx = getChildren(gfx);
11646
12423
  if (!childrenGfx) {
11647
12424
  childrenGfx = create$1('g');
11648
- classes$1(childrenGfx).add('djs-children');
12425
+ classes$2(childrenGfx).add('djs-children');
11649
12426
 
11650
12427
  append(gfx.parentNode, childrenGfx);
11651
12428
  }
@@ -11697,7 +12474,7 @@
11697
12474
  type, childrenGfx, parentIndex, isFrame
11698
12475
  ) {
11699
12476
  var outerGfx = create$1('g');
11700
- classes$1(outerGfx).add('djs-group');
12477
+ classes$2(outerGfx).add('djs-group');
11701
12478
 
11702
12479
  // insert node at position
11703
12480
  if (typeof parentIndex !== 'undefined') {
@@ -11707,18 +12484,18 @@
11707
12484
  }
11708
12485
 
11709
12486
  var gfx = create$1('g');
11710
- classes$1(gfx).add('djs-element');
11711
- classes$1(gfx).add('djs-' + type);
12487
+ classes$2(gfx).add('djs-element');
12488
+ classes$2(gfx).add('djs-' + type);
11712
12489
 
11713
12490
  if (isFrame) {
11714
- classes$1(gfx).add('djs-frame');
12491
+ classes$2(gfx).add('djs-frame');
11715
12492
  }
11716
12493
 
11717
12494
  append(outerGfx, gfx);
11718
12495
 
11719
12496
  // create visual
11720
12497
  var visual = create$1('g');
11721
- classes$1(visual).add('djs-visual');
12498
+ classes$2(visual).add('djs-visual');
11722
12499
 
11723
12500
  append(gfx, visual);
11724
12501
 
@@ -11747,7 +12524,7 @@
11747
12524
 
11748
12525
  // update all parents of changed and reorganized their children
11749
12526
  // in the correct order (as indicated in our model)
11750
- forEach(parents, function(parent) {
12527
+ forEach$2(parents, function(parent) {
11751
12528
 
11752
12529
  var children = parent.children;
11753
12530
 
@@ -11757,7 +12534,7 @@
11757
12534
 
11758
12535
  var childrenGfx = self._getChildrenContainer(parent);
11759
12536
 
11760
- forEach(children.slice().reverse(), function(child) {
12537
+ forEach$2(children.slice().reverse(), function(child) {
11761
12538
  var childGfx = elementRegistry.getGraphics(child);
11762
12539
 
11763
12540
  prependTo(childGfx.parentNode, childrenGfx);
@@ -11822,7 +12599,7 @@
11822
12599
  var gfx = this._elementRegistry.getGraphics(element);
11823
12600
 
11824
12601
  // remove
11825
- remove$2(gfx.parentNode);
12602
+ remove$3(gfx.parentNode);
11826
12603
  };
11827
12604
 
11828
12605
 
@@ -11922,7 +12699,7 @@
11922
12699
  options = options || {};
11923
12700
 
11924
12701
  var configModule = {
11925
- 'config': ['value', options]
12702
+ 'config': [ 'value', options ]
11926
12703
  };
11927
12704
 
11928
12705
  var modules = [ configModule, CoreModule ].concat(options.modules || []);
@@ -12082,7 +12859,7 @@
12082
12859
  prototype = Object.create(Base.prototype);
12083
12860
 
12084
12861
  // initialize default values
12085
- forEach(descriptor.properties, function(p) {
12862
+ forEach$2(descriptor.properties, function(p) {
12086
12863
  if (!p.isMany && p.default !== undefined) {
12087
12864
  prototype[p.name] = p.default;
12088
12865
  }
@@ -12101,7 +12878,7 @@
12101
12878
  props.define(this, '$attrs', { value: {} });
12102
12879
  props.define(this, '$parent', { writable: true });
12103
12880
 
12104
- forEach(attrs, bind$2(function(val, key) {
12881
+ forEach$2(attrs, bind(function(val, key) {
12105
12882
  this.set(key, val);
12106
12883
  }, this));
12107
12884
  }
@@ -12390,7 +13167,7 @@
12390
13167
  return;
12391
13168
  }
12392
13169
 
12393
- forEach(t.properties, bind$2(function(p) {
13170
+ forEach$2(t.properties, bind(function(p) {
12394
13171
 
12395
13172
  // clone property to allow extensions
12396
13173
  p = assign({}, p, {
@@ -12437,7 +13214,7 @@
12437
13214
 
12438
13215
  this.properties = properties;
12439
13216
 
12440
- forEach(packages, bind$2(this.registerPackage, this));
13217
+ forEach$2(packages, bind(this.registerPackage, this));
12441
13218
  }
12442
13219
 
12443
13220
 
@@ -12461,7 +13238,7 @@
12461
13238
  ensureAvailable(pkgMap, pkg, 'uri');
12462
13239
 
12463
13240
  // register types
12464
- forEach(pkg.types, bind$2(function(descriptor) {
13241
+ forEach$2(pkg.types, bind(function(descriptor) {
12465
13242
  this.registerType(descriptor, pkg);
12466
13243
  }, this));
12467
13244
 
@@ -12487,7 +13264,7 @@
12487
13264
  propertiesByName = {};
12488
13265
 
12489
13266
  // parse properties
12490
- forEach(type.properties, bind$2(function(p) {
13267
+ forEach$2(type.properties, bind(function(p) {
12491
13268
 
12492
13269
  // namespace property names
12493
13270
  var propertyNs = parseName(p.name, ns.prefix),
@@ -12513,7 +13290,7 @@
12513
13290
  propertiesByName: propertiesByName
12514
13291
  });
12515
13292
 
12516
- forEach(type.extends, bind$2(function(extendsName) {
13293
+ forEach$2(type.extends, bind(function(extendsName) {
12517
13294
  var extended = this.typeMap[extendsName];
12518
13295
 
12519
13296
  extended.traits = extended.traits || [];
@@ -12567,12 +13344,12 @@
12567
13344
  throw new Error('unknown type <' + nsName.name + '>');
12568
13345
  }
12569
13346
 
12570
- forEach(type.superClass, trait ? traverseTrait : traverseSuper);
13347
+ forEach$2(type.superClass, trait ? traverseTrait : traverseSuper);
12571
13348
 
12572
13349
  // call iterator with (type, inherited=!trait)
12573
13350
  iterator(type, !trait);
12574
13351
 
12575
- forEach(type.traits, traverseTrait);
13352
+ forEach$2(type.traits, traverseTrait);
12576
13353
  };
12577
13354
 
12578
13355
 
@@ -12875,7 +13652,7 @@
12875
13652
  this.properties.define(element, '$parent', { enumerable: false, writable: true });
12876
13653
  this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
12877
13654
 
12878
- forEach(properties, function(a, key) {
13655
+ forEach$2(properties, function(a, key) {
12879
13656
  if (isObject(a) && a.value !== undefined) {
12880
13657
  element[a.name] = a.value;
12881
13658
  } else {
@@ -14337,7 +15114,7 @@
14337
15114
  model = this.model,
14338
15115
  propNameNs;
14339
15116
 
14340
- forEach(attributes, function(value, name) {
15117
+ forEach$2(attributes, function(value, name) {
14341
15118
 
14342
15119
  var prop = descriptor.propertiesByName[name],
14343
15120
  values;
@@ -14355,7 +15132,7 @@
14355
15132
  // IDREFS: parse references as whitespace-separated list
14356
15133
  values = value.split(' ');
14357
15134
 
14358
- forEach(values, function(v) {
15135
+ forEach$2(values, function(v) {
14359
15136
  context.addReference({
14360
15137
  element: instance,
14361
15138
  property: prop.ns.name,
@@ -15099,7 +15876,7 @@
15099
15876
  }
15100
15877
 
15101
15878
  // do not serialize defaults
15102
- if (!has(element, name)) {
15879
+ if (!has$2(element, name)) {
15103
15880
  return false;
15104
15881
  }
15105
15882
 
@@ -15328,7 +16105,7 @@
15328
16105
 
15329
16106
  var attributes = [];
15330
16107
 
15331
- forEach(element, function(val, key) {
16108
+ forEach$2(element, function(val, key) {
15332
16109
 
15333
16110
  var nonNsAttr;
15334
16111
 
@@ -15336,7 +16113,7 @@
15336
16113
  body.push(new BodySerializer().build({ type: 'String' }, val));
15337
16114
  } else
15338
16115
  if (key === '$children') {
15339
- forEach(val, function(child) {
16116
+ forEach$2(val, function(child) {
15340
16117
  body.push(new ElementSerializer(self).build(child));
15341
16118
  });
15342
16119
  } else
@@ -15406,7 +16183,7 @@
15406
16183
  // parse namespace attributes first
15407
16184
  // and log them. push non namespace attributes to a list
15408
16185
  // and process them later
15409
- forEach(genericAttrs, function(value, name) {
16186
+ forEach$2(genericAttrs, function(value, name) {
15410
16187
 
15411
16188
  var nonNsAttr = self.parseNsAttribute(element, name, value);
15412
16189
 
@@ -15422,7 +16199,7 @@
15422
16199
 
15423
16200
  var self = this;
15424
16201
 
15425
- forEach(attributes, function(attr) {
16202
+ forEach$2(attributes, function(attr) {
15426
16203
 
15427
16204
  // do not serialize xsi:type attribute
15428
16205
  // it is set manually based on the actual implementation type
@@ -15447,7 +16224,7 @@
15447
16224
  body = this.body,
15448
16225
  element = this.element;
15449
16226
 
15450
- forEach(properties, function(p) {
16227
+ forEach$2(properties, function(p) {
15451
16228
  var value = element.get(p.name),
15452
16229
  isReference = p.isReference,
15453
16230
  isMany = p.isMany;
@@ -15460,12 +16237,12 @@
15460
16237
  body.push(new BodySerializer().build(p, value[0]));
15461
16238
  } else
15462
16239
  if (isSimple(p.type)) {
15463
- forEach(value, function(v) {
16240
+ forEach$2(value, function(v) {
15464
16241
  body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v));
15465
16242
  });
15466
16243
  } else
15467
16244
  if (isReference) {
15468
- forEach(value, function(v) {
16245
+ forEach$2(value, function(v) {
15469
16246
  body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v));
15470
16247
  });
15471
16248
  } else {
@@ -15475,7 +16252,7 @@
15475
16252
  var asType = serializeAsType(p),
15476
16253
  asProperty = serializeAsProperty(p);
15477
16254
 
15478
- forEach(value, function(v) {
16255
+ forEach$2(value, function(v) {
15479
16256
  var serializer;
15480
16257
 
15481
16258
  if (asType) {
@@ -15583,7 +16360,7 @@
15583
16360
  var self = this,
15584
16361
  element = this.element;
15585
16362
 
15586
- forEach(properties, function(p) {
16363
+ forEach$2(properties, function(p) {
15587
16364
 
15588
16365
  var value = element.get(p.name);
15589
16366
 
@@ -15594,7 +16371,7 @@
15594
16371
  }
15595
16372
  else {
15596
16373
  var values = [];
15597
- forEach(value, function(v) {
16374
+ forEach$2(value, function(v) {
15598
16375
  values.push(v.id);
15599
16376
  });
15600
16377
 
@@ -15634,7 +16411,7 @@
15634
16411
  attrs = getNsAttrs(namespaces).concat(attrs);
15635
16412
  }
15636
16413
 
15637
- forEach(attrs, function(a) {
16414
+ forEach$2(attrs, function(a) {
15638
16415
  writer
15639
16416
  .append(' ')
15640
16417
  .append(nsName(a.name)).append('="').append(a.value).append('"');
@@ -15661,7 +16438,7 @@
15661
16438
  .indent();
15662
16439
  }
15663
16440
 
15664
- forEach(this.body, function(b) {
16441
+ forEach$2(this.body, function(b) {
15665
16442
  b.serializeTo(writer);
15666
16443
  });
15667
16444
 
@@ -19595,7 +20372,7 @@
19595
20372
  function ensureCompatDiRef(businessObject) {
19596
20373
 
19597
20374
  // bpmnElement can have multiple independent DIs
19598
- if (!has(businessObject, 'di')) {
20375
+ if (!has$2(businessObject, 'di')) {
19599
20376
  Object.defineProperty(businessObject, 'di', {
19600
20377
  get: function() {
19601
20378
  throw new Error(DI_ERROR_MESSAGE);
@@ -19729,7 +20506,7 @@
19729
20506
  function handlePlane(plane) {
19730
20507
  registerDi(plane);
19731
20508
 
19732
- forEach(plane.planeElement, handlePlaneElement);
20509
+ forEach$2(plane.planeElement, handlePlaneElement);
19733
20510
  }
19734
20511
 
19735
20512
  function handlePlaneElement(planeElement) {
@@ -19866,7 +20643,7 @@
19866
20643
  }
19867
20644
 
19868
20645
  function handleMessageFlows(messageFlows, context) {
19869
- forEach(messageFlows, contextual(handleMessageFlow, context));
20646
+ forEach$2(messageFlows, contextual(handleMessageFlow, context));
19870
20647
  }
19871
20648
 
19872
20649
  function handleDataAssociation(association, context) {
@@ -19892,7 +20669,7 @@
19892
20669
 
19893
20670
  function handleArtifacts(artifacts, context) {
19894
20671
 
19895
- forEach(artifacts, function(e) {
20672
+ forEach$2(artifacts, function(e) {
19896
20673
  if (is(e, 'bpmn:Association')) {
19897
20674
  deferred.push(function() {
19898
20675
  handleArtifact(e, context);
@@ -19909,8 +20686,8 @@
19909
20686
  return;
19910
20687
  }
19911
20688
 
19912
- forEach(ioSpecification.dataInputs, contextual(handleDataInput, context));
19913
- forEach(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
20689
+ forEach$2(ioSpecification.dataInputs, contextual(handleDataInput, context));
20690
+ forEach$2(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
19914
20691
  }
19915
20692
 
19916
20693
  function handleSubProcess(subProcess, context) {
@@ -19937,8 +20714,8 @@
19937
20714
  // * bpmn:CatchEvent
19938
20715
  //
19939
20716
  deferred.push(function() {
19940
- forEach(flowNode.dataInputAssociations, contextual(handleDataAssociation, context));
19941
- forEach(flowNode.dataOutputAssociations, contextual(handleDataAssociation, context));
20717
+ forEach$2(flowNode.dataInputAssociations, contextual(handleDataAssociation, context));
20718
+ forEach$2(flowNode.dataOutputAssociations, contextual(handleDataAssociation, context));
19942
20719
  });
19943
20720
  }
19944
20721
 
@@ -19965,11 +20742,11 @@
19965
20742
  }
19966
20743
 
19967
20744
  function handleLaneSet(laneSet, context) {
19968
- forEach(laneSet.lanes, contextual(handleLane, context));
20745
+ forEach$2(laneSet.lanes, contextual(handleLane, context));
19969
20746
  }
19970
20747
 
19971
20748
  function handleLaneSets(laneSets, context) {
19972
- forEach(laneSets, contextual(handleLaneSet, context));
20749
+ forEach$2(laneSets, contextual(handleLaneSet, context));
19973
20750
  }
19974
20751
 
19975
20752
  function handleFlowElementsContainer(container, context) {
@@ -19981,7 +20758,7 @@
19981
20758
  }
19982
20759
 
19983
20760
  function handleFlowElements(flowElements, context) {
19984
- forEach(flowElements, function(e) {
20761
+ forEach$2(flowElements, function(e) {
19985
20762
  if (is(e, 'bpmn:SequenceFlow')) {
19986
20763
  deferred.push(function() {
19987
20764
  handleSequenceFlow(e, context);
@@ -20019,7 +20796,7 @@
20019
20796
 
20020
20797
  function handleCollaboration(collaboration, context) {
20021
20798
 
20022
- forEach(collaboration.participants, contextual(handleParticipant, context));
20799
+ forEach$2(collaboration.participants, contextual(handleParticipant, context));
20023
20800
 
20024
20801
  handleArtifacts(collaboration.artifacts, context);
20025
20802
 
@@ -20033,7 +20810,7 @@
20033
20810
  function wireFlowNodeRefs(lane) {
20034
20811
 
20035
20812
  // wire the virtual flowNodeRefs <-> relationship
20036
- forEach(lane.flowNodeRef, function(flowNode) {
20813
+ forEach$2(lane.flowNodeRef, function(flowNode) {
20037
20814
  var lanes = flowNode.get('lanes');
20038
20815
 
20039
20816
  if (lanes) {
@@ -20127,7 +20904,7 @@
20127
20904
 
20128
20905
  // traverse BPMN 2.0 document model,
20129
20906
  // starting at definitions
20130
- forEach(diagramsToImport, function(diagram) {
20907
+ forEach$2(diagramsToImport, function(diagram) {
20131
20908
  walker.handleDefinitions(definitions, diagram);
20132
20909
  });
20133
20910
 
@@ -20167,7 +20944,7 @@
20167
20944
  }
20168
20945
 
20169
20946
  /**
20170
- * Returns all diagrams in the same hirarchy as the requested diagram.
20947
+ * Returns all diagrams in the same hierarchy as the requested diagram.
20171
20948
  * Includes all parent and sub process diagrams.
20172
20949
  *
20173
20950
  * @param {Array} definitions
@@ -20209,7 +20986,7 @@
20209
20986
 
20210
20987
  // all collaboration processes can contain sub-diagrams
20211
20988
  if (collaboration) {
20212
- rootElements = map$1(collaboration.participants, function(participant) {
20989
+ rootElements = map(collaboration.participants, function(participant) {
20213
20990
  return participant.processRef;
20214
20991
  });
20215
20992
 
@@ -20223,7 +21000,7 @@
20223
21000
  var diagramsToImport = [ bpmnDiagram ];
20224
21001
  var handledElements = [ bpmnElement ];
20225
21002
 
20226
- forEach(definitions.diagrams, function(diagram) {
21003
+ forEach$2(definitions.diagrams, function(diagram) {
20227
21004
  var businessObject = diagram.plane.bpmnElement;
20228
21005
 
20229
21006
  if (
@@ -20242,7 +21019,7 @@
20242
21019
  function selfAndAllFlowElements(elements) {
20243
21020
  var result = [];
20244
21021
 
20245
- forEach(elements, function(element) {
21022
+ forEach$2(elements, function(element) {
20246
21023
  if (!element) {
20247
21024
  return;
20248
21025
  }
@@ -20275,53 +21052,53 @@
20275
21052
 
20276
21053
 
20277
21054
  // inlined ../../resources/logo.svg
20278
- var BPMNIO_LOGO_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21" style="vertical-align:middle"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>';
21055
+ var BPMNIO_LOGO_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>';
20279
21056
 
20280
21057
  var BPMNIO_IMG = BPMNIO_LOGO_SVG;
20281
21058
 
20282
- function css(attrs) {
20283
- return attrs.join(';');
20284
- }
20285
-
20286
- var LINK_STYLES = css([
20287
- 'color: #404040'
20288
- ]);
20289
-
20290
- var LIGHTBOX_STYLES = css([
20291
- 'z-index: 1001',
20292
- 'position: fixed',
20293
- 'top: 0',
20294
- 'left: 0',
20295
- 'right: 0',
20296
- 'bottom: 0'
20297
- ]);
20298
-
20299
- var BACKDROP_STYLES = css([
20300
- 'width: 100%',
20301
- 'height: 100%',
20302
- 'background: rgba(40,40,40,0.2)'
20303
- ]);
20304
-
20305
- var NOTICE_STYLES = css([
20306
- 'position: absolute',
20307
- 'left: 50%',
20308
- 'top: 40%',
20309
- 'transform: translate(-50%)',
20310
- 'width: 260px',
20311
- 'padding: 10px',
20312
- 'background: white',
20313
- 'box-shadow: 0 1px 4px rgba(0,0,0,0.3)',
20314
- 'font-family: Helvetica, Arial, sans-serif',
20315
- 'font-size: 14px',
20316
- 'display: flex',
20317
- 'line-height: 1.3'
20318
- ]);
21059
+ var LOGO_STYLES = {
21060
+ verticalAlign: 'middle'
21061
+ };
21062
+
21063
+ var LINK_STYLES = {
21064
+ 'color': '#404040'
21065
+ };
21066
+
21067
+ var LIGHTBOX_STYLES = {
21068
+ 'zIndex': '1001',
21069
+ 'position': 'fixed',
21070
+ 'top': '0',
21071
+ 'left': '0',
21072
+ 'right': '0',
21073
+ 'bottom': '0'
21074
+ };
21075
+
21076
+ var BACKDROP_STYLES = {
21077
+ 'width': '100%',
21078
+ 'height': '100%',
21079
+ 'background': 'rgba(40,40,40,0.2)'
21080
+ };
21081
+
21082
+ var NOTICE_STYLES = {
21083
+ 'position': 'absolute',
21084
+ 'left': '50%',
21085
+ 'top': '40%',
21086
+ 'transform': 'translate(-50%)',
21087
+ 'width': '260px',
21088
+ 'padding': '10px',
21089
+ 'background': 'white',
21090
+ 'boxShadow': '0 1px 4px rgba(0,0,0,0.3)',
21091
+ 'fontFamily': 'Helvetica, Arial, sans-serif',
21092
+ 'fontSize': '14px',
21093
+ 'display': 'flex',
21094
+ 'lineHeight': '1.3'
21095
+ };
20319
21096
 
20320
21097
  var LIGHTBOX_MARKUP =
20321
- '<div class="bjs-powered-by-lightbox" style="' + LIGHTBOX_STYLES + '">' +
20322
- '<div class="backdrop" style="' + BACKDROP_STYLES + '"></div>' +
20323
- '<div class="notice" style="' + NOTICE_STYLES + '">' +
20324
- '<a href="https://bpmn.io" target="_blank" rel="noopener" style="margin: 15px 20px 15px 10px; align-self: center;' + LINK_STYLES + '">' +
21098
+ '<div class="bjs-powered-by-lightbox">' +
21099
+ '<div class="backdrop"></div>' +
21100
+ '<div class="notice">' +
21101
+ '<a href="https://bpmn.io" target="_blank" rel="noopener" class="link">' +
20325
21102
  BPMNIO_IMG +
20326
21103
  '</a>' +
20327
21104
  '<span>' +
@@ -20334,12 +21111,25 @@
20334
21111
 
20335
21112
  var lightbox;
20336
21113
 
21114
+ function createLightbox() {
21115
+ lightbox = domify$1(LIGHTBOX_MARKUP);
21116
+
21117
+ assign$1$1(lightbox, LIGHTBOX_STYLES);
21118
+ assign$1$1(query$1('svg', lightbox), LOGO_STYLES);
21119
+ assign$1$1(query$1('.backdrop', lightbox), BACKDROP_STYLES);
21120
+ assign$1$1(query$1('.notice', lightbox), NOTICE_STYLES);
21121
+ assign$1$1(query$1('.link', lightbox), LINK_STYLES, {
21122
+ 'margin': '15px 20px 15px 10px',
21123
+ 'alignSelf': 'center'
21124
+ });
21125
+ }
21126
+
20337
21127
  function open() {
20338
21128
 
20339
21129
  if (!lightbox) {
20340
- lightbox = domify(LIGHTBOX_MARKUP);
21130
+ createLightbox();
20341
21131
 
20342
- delegate.bind(lightbox, '.backdrop', 'click', function(event) {
21132
+ delegate$1.bind(lightbox, '.backdrop', 'click', function(event) {
20343
21133
  document.body.removeChild(lightbox);
20344
21134
  });
20345
21135
  }
@@ -20758,7 +21548,7 @@
20758
21548
  var canvas = self.get('canvas');
20759
21549
 
20760
21550
  var contentNode = canvas.getActiveLayer(),
20761
- defsNode = query('defs', canvas._svg);
21551
+ defsNode = query$1('defs', canvas._svg);
20762
21552
 
20763
21553
  var contents = innerSVG(contentNode),
20764
21554
  defs = defsNode ? '<defs>' + innerSVG(defsNode) + '</defs>' : '';
@@ -20860,7 +21650,7 @@
20860
21650
  Diagram.prototype.destroy.call(this);
20861
21651
 
20862
21652
  // dom detach
20863
- remove$1(this._container);
21653
+ remove$2(this._container);
20864
21654
  };
20865
21655
 
20866
21656
  /**
@@ -20903,7 +21693,7 @@
20903
21693
  }
20904
21694
 
20905
21695
  if (typeof parentNode === 'string') {
20906
- parentNode = query(parentNode);
21696
+ parentNode = query$1(parentNode);
20907
21697
  }
20908
21698
 
20909
21699
  parentNode.appendChild(this._container);
@@ -20971,9 +21761,9 @@
20971
21761
 
20972
21762
  BaseViewer.prototype._createContainer = function(options) {
20973
21763
 
20974
- var container = domify('<div class="bjs-container"></div>');
21764
+ var container = domify$1('<div class="bjs-container"></div>');
20975
21765
 
20976
- assign(container.style, {
21766
+ assign$1$1(container, {
20977
21767
  width: ensureUnit(options.width),
20978
21768
  height: ensureUnit(options.height),
20979
21769
  position: options.position
@@ -21063,15 +21853,23 @@
21063
21853
  'target="_blank" ' +
21064
21854
  'class="bjs-powered-by" ' +
21065
21855
  'title="Powered by bpmn.io" ' +
21066
- 'style="position: absolute; bottom: 15px; right: 15px; z-index: 100; ' + LINK_STYLES + '">' +
21856
+ '>' +
21067
21857
  img +
21068
21858
  '</a>';
21069
21859
 
21070
- var linkElement = domify(linkMarkup);
21860
+ var linkElement = domify$1(linkMarkup);
21861
+
21862
+ assign$1$1(query$1('svg', linkElement), LOGO_STYLES);
21863
+ assign$1$1(linkElement, LINK_STYLES, {
21864
+ position: 'absolute',
21865
+ bottom: '15px',
21866
+ right: '15px',
21867
+ zIndex: '100'
21868
+ });
21071
21869
 
21072
21870
  container.appendChild(linkElement);
21073
21871
 
21074
- componentEvent.bind(linkElement, 'click', function(event) {
21872
+ componentEvent$1.bind(linkElement, 'click', function(event) {
21075
21873
  open();
21076
21874
 
21077
21875
  event.preventDefault();