camunda-bpmn-js 0.15.2 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +312 -280
  2. package/LICENSE +20 -20
  3. package/README.md +84 -84
  4. package/dist/assets/base-modeler.css +4 -4
  5. package/dist/assets/base-navigated-viewer.css +1 -1
  6. package/dist/assets/base-viewer.css +1 -1
  7. package/dist/assets/camunda-cloud-modeler.css +1 -1
  8. package/dist/assets/camunda-platform-modeler.css +1 -1
  9. package/dist/base-modeler.development.js +37 -34
  10. package/dist/base-modeler.production.min.js +1 -1
  11. package/dist/base-navigated-viewer.development.js +7 -4
  12. package/dist/base-navigated-viewer.production.min.js +1 -1
  13. package/dist/base-viewer.development.js +7 -4
  14. package/dist/base-viewer.production.min.js +1 -1
  15. package/dist/camunda-cloud-modeler.development.js +367 -364
  16. package/dist/camunda-cloud-modeler.production.min.js +1 -1
  17. package/dist/camunda-cloud-navigated-viewer.development.js +42 -39
  18. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  19. package/dist/camunda-cloud-viewer.development.js +42 -39
  20. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  21. package/dist/camunda-platform-modeler.development.js +68 -65
  22. package/dist/camunda-platform-modeler.production.min.js +1 -1
  23. package/dist/camunda-platform-navigated-viewer.development.js +26 -23
  24. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  25. package/dist/camunda-platform-viewer.development.js +26 -23
  26. package/dist/camunda-platform-viewer.production.min.js +1 -1
  27. package/lib/base/Modeler.js +46 -46
  28. package/lib/base/NavigatedViewer.js +2 -2
  29. package/lib/base/Viewer.js +2 -2
  30. package/lib/camunda-cloud/Modeler.js +68 -68
  31. package/lib/camunda-cloud/NavigatedViewer.js +34 -34
  32. package/lib/camunda-cloud/Viewer.js +34 -34
  33. package/lib/camunda-cloud/features/context-pad/ContextPadOptions.js +15 -15
  34. package/lib/camunda-cloud/features/context-pad/index.js +6 -6
  35. package/lib/camunda-cloud/features/drilldown/index.js +3 -3
  36. package/lib/camunda-cloud/features/palette/PaletteOptions.js +14 -14
  37. package/lib/camunda-cloud/features/palette/PaletteProvider.js +31 -31
  38. package/lib/camunda-cloud/features/palette/index.js +6 -6
  39. package/lib/camunda-cloud/features/popup-menu/ReplaceMenuProvider.js +71 -71
  40. package/lib/camunda-cloud/features/popup-menu/ReplaceOptions.js +46 -46
  41. package/lib/camunda-cloud/features/popup-menu/index.js +6 -6
  42. package/lib/camunda-cloud/features/rules/BpmnRules.js +137 -137
  43. package/lib/camunda-cloud/features/rules/index.js +5 -5
  44. package/lib/camunda-cloud/util/commonModules.js +13 -13
  45. package/lib/camunda-platform/Modeler.js +46 -46
  46. package/lib/camunda-platform/NavigatedViewer.js +25 -25
  47. package/lib/camunda-platform/Viewer.js +24 -24
  48. package/lib/camunda-platform/util/commonModules.js +6 -6
  49. package/lib/util/ExtensionElementsUtil.js +59 -59
  50. package/package.json +109 -110
  51. package/styles/base-modeler.css +4 -4
  52. package/styles/base-navigated-viewer.css +1 -1
  53. package/styles/base-viewer.css +1 -1
  54. package/styles/camunda-cloud-modeler.css +1 -1
  55. package/styles/camunda-platform-modeler.css +1 -1
  56. package/util/index.js +39 -39
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BpmnModeler=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}function n(e){var t={exports:{}};return e(t,t.exports),t.exports}var r=n((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}}));function i(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}var o=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=e.exports=function(e,n){if(n||(n=16),void 0===e&&(e=128),e<=0)return"0";for(var r=Math.log(Math.pow(2,e))/Math.log(n),i=2;r===1/0;i*=2)r=Math.log(Math.pow(2,e/i))/Math.log(n)*i;var o=r-Math.floor(r),a="";for(i=0;i<Math.floor(r);i++){a=Math.floor(Math.random()*n).toString(n)+a}if(o){var s=Math.pow(n,o);a=Math.floor(Math.random()*s).toString(n)+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,e)?t(e,n):a};t.rack=function(e,n,r){var i=function(i){var a=0;do{if(a++>10){if(!r)throw new Error("too many ID collisions, use more bits");e+=r}var s=t(e,n)}while(Object.hasOwnProperty.call(o,s));return o[s]=i,s},o=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=n||16,i}}));function a(e){if(!(this instanceof a))return new a(e);e=e||[128,36,1],this._seed=e.length?o.rack(e[0],e[1],e[2]):e}function s(e){return Array.prototype.concat.apply([],e)}a.prototype.next=function(e){return this._seed(e||!0)},a.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},a.prototype.claim=function(e,t){this._seed.set(e,t||!0)},a.prototype.assigned=function(e){return this._seed.get(e)||!1},a.prototype.unclaim=function(e){delete this._seed.hats[e]},a.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var l=Object.prototype.toString,c=Object.prototype.hasOwnProperty;function p(e){return void 0===e}function u(e){return void 0!==e}function d(e){return null==e}function m(e){return"[object Array]"===l.call(e)}function h(e){return"[object Object]"===l.call(e)}function f(e){return"[object Number]"===l.call(e)}function g(e){var t=l.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function v(e){return"[object String]"===l.call(e)}function y(e){if(!m(e))throw new Error("must supply array")}function b(e,t){return c.call(e,t)}function x(e,t){var n;return t=L(t),E(e,(function(e,r){if(t(e,r))return n=e,!1})),n}function w(e,t){t=L(t);var n=m(e)?-1:void 0;return E(e,(function(e,r){if(t(e,r))return n=r,!1})),n}function _(e,t){var n=[];return E(e,(function(e,r){t(e,r)&&n.push(e)})),n}function E(e,t){var n;if(!p(e)){var r=m(e)?N:V;for(var i in e)if(b(e,i)&&!1===t(n=e[i],r(i)))return n}}function P(e,t){return p(e)?[]:(y(e),t=L(t),e.filter((function(e,n){return!t(e,n)})))}function S(e,t,n){return E(e,(function(e,r){n=t(n,e,r)})),n}function C(e,t){return!!S(e,(function(e,n,r){return e&&t(n,r)}),!0)}function O(e,t){return!!x(e,t)}function k(e,t){var n=[];return E(e,(function(e,r){n.push(t(e,r))})),n}function M(e){return e&&Object.keys(e)||[]}function A(e){return M(e).length}function T(e){return k(e,(function(e){return e}))}function R(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=I(t),E(e,(function(e){var r=t(e)||"_",i=n[r];i||(i=n[r]=[]),i.push(e)})),n}function D(e){e=I(e);for(var t={},n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];E(r,(function(n){return R(n,e,t)}));var o=k(t,(function(e,t){return e[0]}));return o}var B=D;function j(e,t){t=I(t);var n=[];return E(e,(function(e,r){for(var i=t(e,r),o={d:i,v:e},a=0;a<n.length;a++){if(i<n[a].d)return void n.splice(a,0,o)}n.push(o)})),k(n,(function(e){return e.v}))}function z(e){return function(t){return C(e,(function(e,n){return t[n]===e}))}}function I(e){return g(e)?e:function(t){return t[e]}}function L(e){return g(e)?e:function(t){return t===e}}function V(e){return e}function N(e){return Number(e)}function F(e,t){var n,r,i,o;function a(n){var a=Date.now(),c=n?0:o+t-a;if(c>0)return s(c);e.apply(i,r),l()}function s(e){n=setTimeout(a,e)}function l(){n&&clearTimeout(n),n=o=r=i=void 0}function c(){o=Date.now();for(var e=arguments.length,a=new Array(e),l=0;l<e;l++)a[l]=arguments[l];r=a,i=this,n||s(t)}return c.flush=function(){n&&a(!0),l()},c.cancel=l,c}function $(e,t){return e.bind(t)}function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(){return(q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function U(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return q.apply(void 0,[e].concat(n))}function G(e,t,n){var r=e;return E(t,(function(e,i){if("number"!=typeof e&&"string"!=typeof e)throw new Error("illegal key type: "+H(e)+". Key should be of type number or string.");if("constructor"===e)throw new Error("illegal key: constructor");if("__proto__"===e)throw new Error("illegal key: __proto__");var o=t[i+1],a=r[e];u(o)&&d(a)&&(a=r[e]=isNaN(+o)?{}:[]),p(o)?p(n)?delete r[e]:r[e]=n:r=a})),e}function W(e,t,n){var r=e;return E(t,(function(e){if(d(r))return r=void 0,!1;r=r[e]})),p(r)?n:r}function K(e,t){var n={},r=Object(e);return E(t,(function(t){t in r&&(n[t]=e[t])})),n}function Y(e,t){var n={};return E(Object(e),(function(e,r){-1===t.indexOf(r)&&(n[r]=e)})),n}var X=Object.freeze({__proto__:null,assign:U,bind:$,debounce:F,ensureArray:y,every:C,filter:_,find:x,findIndex:w,flatten:s,forEach:E,get:W,groupBy:R,has:b,isArray:m,isDefined:u,isFunction:g,isNil:d,isNumber:f,isObject:h,isString:v,isUndefined:p,keys:M,map:k,matchPattern:z,merge:function e(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.length?(E(r,(function(n){n&&h(n)&&E(n,(function(n,r){if("__proto__"!==r){var i=t[r];h(n)?(h(i)||(i={}),t[r]=e(i,n)):t[r]=n}}))})),t):t},omit:Y,pick:K,reduce:S,set:G,size:A,some:O,sortBy:j,throttle:function(e,t){var n=!1;return function(){n||(e.apply(void 0,arguments),n=!0,setTimeout((function(){n=!1}),t))}},unionBy:B,uniqueBy:D,values:T,without:P}),J=Object.prototype.toString,Z=Object.prototype.hasOwnProperty;function Q(e,t){return Z.call(e,t)}function ee(e,t){var n;if(void 0!==e){var r=function(e){return"[object Array]"===J.call(e)}(e)?ne:te;for(var i in e)if(Q(e,i)&&!1===t(n=e[i],r(i)))return n}}function te(e){return e}function ne(e){return Number(e)}function re(e){for(var t=e.style,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return ee(r,(function(e){e&&ee(e,(function(e,n){t[n]=e}))})),e}function ie(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var oe=[].indexOf,ae=function(e,t){if(oe)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},se=/\s+/,le=Object.prototype.toString;function ce(e){return new pe(e)}function pe(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function ue(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}pe.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~ae(t,e)||t.push(e),this.el.className=t.join(" "),this},pe.prototype.remove=function(e){if("[object RegExp]"==le.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=ae(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},pe.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},pe.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},pe.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(se);return""===e[0]&&e.shift(),e},pe.prototype.has=pe.prototype.contains=function(e){return this.list?this.list.contains(e):!!~ae(this.array(),e)};var de="undefined"!=typeof Element?Element.prototype:{},me=de.matches||de.matchesSelector||de.webkitMatchesSelector||de.mozMatchesSelector||de.msMatchesSelector||de.oMatchesSelector,he=function(e,t){if(!e||1!==e.nodeType)return!1;if(me)return me.call(e,t);for(var n=e.parentNode.querySelectorAll(t),r=0;r<n.length;r++)if(n[r]==e)return!0;return!1};function fe(e,t,n){for(var r=n?e:e.parentNode;r&&r.nodeType!==document.DOCUMENT_NODE&&r.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(he(r,t))return r;r=r.parentNode}return he(r,t)?r:null}var ge=window.addEventListener?"addEventListener":"attachEvent",ve=window.removeEventListener?"removeEventListener":"detachEvent",ye="addEventListener"!==ge?"on":"",be={bind:function(e,t,n,r){return e[ge](ye+t,n,r||!1),n},unbind:function(e,t,n,r){return e[ve](ye+t,n,r||!1),n}},xe=["focus","blur"];var we,_e={bind:function(e,t,n,r,i){return-1!==xe.indexOf(n)&&(i=!0),be.bind(e,n,(function(n){var i=n.target||n.srcElement;n.delegateTarget=fe(i,t,!0),n.delegateTarget&&r.call(e,n)}),i)},unbind:function(e,t,n,r){return-1!==xe.indexOf(t)&&(r=!0),be.unbind(e,t,n,r)}},Ee=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var r=n[1];if("body"==r){return(i=t.createElement("html")).innerHTML=e,i.removeChild(i.lastChild)}var i,o=Se[r]||Se._default,a=o[0],s=o[1],l=o[2];(i=t.createElement("div")).innerHTML=s+e+l;for(;a--;)i=i.lastChild;if(i.firstChild==i.lastChild)return i.removeChild(i.firstChild);var c=t.createDocumentFragment();for(;i.firstChild;)c.appendChild(i.removeChild(i.firstChild));return c},Pe=!1;"undefined"!=typeof document&&((we=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',Pe=!we.getElementsByTagName("link").length,we=void 0);var Se={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:Pe?[1,"X<div>","</div>"]:[0,"",""]};function Ce(e,t){return(t=t||document).querySelector(e)}function Oe(e,t){return(t=t||document).querySelectorAll(e)}function ke(e){e.parentNode&&e.parentNode.removeChild(e)}function Me(e,t){return t.appendChild(function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}(e,t))}function Ae(e,t){return Me(t,e),e}Se.td=Se.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Se.option=Se.optgroup=[1,'<select multiple="multiple">',"</select>"],Se.thead=Se.tbody=Se.colgroup=Se.caption=Se.tfoot=[1,"<table>","</table>"],Se.polyline=Se.ellipse=Se.polygon=Se.circle=Se.text=Se.line=Se.path=Se.rect=Se.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var Te={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":2,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":2,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Re(e,t,n){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=Te[r];i?(2===i&&"number"==typeof n&&(n=String(n)+"px"),e.style[r]=n):e.setAttributeNS(null,t,n)}function De(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return Te[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);Re(e,t,n)}else!function(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)Re(e,r,t[r])}(e,t);return e}function Be(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}var je=/\s+/,ze=Object.prototype.toString;function Ie(e){return void 0!==e}function Le(e){return new Ve(e)}function Ve(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Ne(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Fe(e){for(var t;t=e.firstChild;)Ne(t);return e}function $e(e){return e.cloneNode(!0)}Ve.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~Be(t,e)||t.push(e),Ie(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Ve.prototype.remove=function(e){if("[object RegExp]"===ze.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Be(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Ve.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Ve.prototype.toggle=function(e,t){return this.list?(Ie(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(Ie(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Ve.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(je);return""===e[0]&&e.shift(),e},Ve.prototype.has=Ve.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Be(this.array(),e)};var He="http://www.w3.org/2000/svg",qe='<svg xmlns="'+He+'"';function Ue(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(He)&&(e=qe+e.substring(4)):(e=qe+">"+e+"</svg>",t=!0);var n=function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e);if(!t)return n;for(var r=document.createDocumentFragment(),i=n.firstChild;i.firstChild;)r.appendChild(i.firstChild);return r}function Ge(e,t){var n;return"<"===e.charAt(0)?(n=Ue(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(He,e),t&&De(n,t),n}var We=Ge("svg");function Ke(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)e[r]=t[r];return e}function Ye(e){return e?We.createSVGTransformFromMatrix(e):We.createSVGTransform()}var Xe=/([&<>]{1})/g,Je=/([\n\r"]{1})/g,Ze={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Qe(e,t){return e.replace(t,(function(e,t){return Ze[t]||t}))}function et(e,t){var n,r,i,o,a;switch(e.nodeType){case 3:t.push(Qe(e.textContent,Xe));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,r=(i=e.attributes).length;n<r;++n)o=i.item(n),t.push(" ",o.name,'="',Qe(o.value,Je),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,r=(a=e.childNodes).length;n<r;++n)et(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Qe(e.nodeValue,Xe),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function tt(e,t){var n=Ue(t);if(Fe(e),t){(function(e){return"#document-fragment"===e.nodeName})(n)||(n=n.documentElement);for(var r,i=(r=n.childNodes,Array.prototype.slice.call(r)),o=0;o<i.length;o++)Me(i[o],e)}}function nt(e,t){if(void 0!==t){try{tt(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)et(t,n),t=t.nextSibling;return n.join("")}(e)}function rt(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function it(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,r;for(e.clear(),n=0;r=t[n];n++)e.appendItem(rt(e,r))}(n,t)),n.consolidate()}var ot=/^class /;function at(e){return"[object Array]"===Object.prototype.toString.call(e)}function st(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function lt(){var e=Array.prototype.slice.call(arguments);1===e.length&&at(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var ct=/constructor\s*[^(]*\(\s*([^)]*)\)/m,pt=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,ut=/\/\*([^*]*)\*\//m;function dt(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t=e.toString().match(function(e){return ot.test(e.toString())}(e)?ct:pt);if(!t)return[];var n=t[1]||t[2];return n&&n.split(",").map((function(e){var t=e.match(ut);return(t&&t[1]||e).trim()}))||[]}function mt(e,t){t=t||{get:function(e,t){if(n.push(e),!1===t)return null;throw a('No provider for "'+e+'"!')}};var n=[],r=this._providers=Object.create(t._providers||null),i=this._instances=Object.create(null),o=i.injector=this,a=function(e){var t=n.join(" -> ");return n.length=0,new Error(t?e+" (Resolving: "+t+")":e)};function s(e,o){if(!r[e]&&-1!==e.indexOf(".")){for(var l=e.split("."),c=s(l.shift());l.length;)c=c[l.shift()];return c}if(st(i,e))return i[e];if(st(r,e)){if(-1!==n.indexOf(e))throw n.push(e),a("Cannot resolve circular dependency!");return n.push(e),i[e]=r[e][0](r[e][1]),n.pop(),i[e]}return t.get(e,o)}function l(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!at(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=lt(e.slice())}return{fn:e,dependencies:(e.$inject||dt(e)).map((function(e){return st(t,e)?t[e]:s(e)}))}}function c(e){var t=l(e),n=t.fn,r=t.dependencies;return new(Function.prototype.bind.apply(n,[null].concat(r)))}function p(e,t,n){var r=l(e,n),i=r.fn,o=r.dependencies;return i.apply(t,o)}function u(e){return lt((function(t){return e.get(t)}))}function d(e,t){if(t&&t.length){var n,i,a,s,l=Object.create(null),c=Object.create(null),p=[],d=[],m=[];for(var h in r)n=r[h],-1!==t.indexOf(h)&&("private"===n[2]?-1===(i=p.indexOf(n[3]))?(s=u(a=n[3].createChild([],t)),p.push(n[3]),d.push(a),m.push(s),l[h]=[s,h,"private",a]):l[h]=[m[i],h,"private",d[i]]:l[h]=[n[2],n[1]],c[h]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach((function(e){-1!==n[1].$scope.indexOf(e)&&(l[h]=[n[2],n[1]],c[e]=!0)}));t.forEach((function(e){if(!c[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(l)}return new mt(e,o)}var m,h,f={factory:p,type:c,value:function(e){return e}};function g(e,t){var n=e.__init__||[];return function(){n.forEach((function(e){try{"string"==typeof e?t.get(e):t.invoke(e)}catch(e){if("undefined"!=typeof AggregateError)throw new AggregateError([e],"Failed to initialize!");throw new Error("Failed to initialize! "+e.message)}}))}}function v(e){var t=e.__exports__;if(t){var n=e.__modules__,i=Object.keys(e).reduce((function(t,n){return"__exports__"!==n&&"__modules__"!==n&&"__init__"!==n&&"__depends__"!==n&&(t[n]=e[n]),t}),Object.create(null)),a=d((n||[]).concat(i)),s=lt((function(e){return a.get(e)}));t.forEach((function(e){r[e]=[s,e,"private",a]}));var l=(e.__init__||[]).slice();return l.unshift((function(){a.init()})),g(e=Object.assign({},e,{__init__:l}),a)}return Object.keys(e).forEach((function(t){if("__init__"!==t&&"__depends__"!==t)if("private"!==e[t][2]){var n=e[t][0],i=e[t][1];r[t]=[f[n],ht(n,i),n]}else r[t]=e[t]})),g(e,o)}function y(e,t){return-1!==e.indexOf(t)||-1!==(e=(t.__depends__||[]).reduce(y,e)).indexOf(t)?e:e.concat(t)}this.get=s,this.invoke=p,this.instantiate=c,this.createChild=d,this.init=(m=e.reduce(y,[]).map(v),h=!1,function(){h||(h=!0,m.forEach((function(e){return e()})))})}function ht(e,t){return"value"!==e&&at(t)&&(t=lt(t.slice())),t}function ft(e,t){var n=this;t=t||1e3,e.on(["render.shape","render.connection"],t,(function(e,t){var r=e.type,i=t.element,o=t.gfx,a=t.attrs;if(n.canRender(i))return"render.shape"===r?n.drawShape(o,i,a):n.drawConnection(o,i,a)})),e.on(["render.getShapePath","render.getConnectionPath"],t,(function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)}))}function gt(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function vt(e){for(var t,n="",r=0;t=e[r];r++)n+=t.x+","+t.y+" ";return n}function yt(e,t){var n=Ge("polyline");return De(n,{points:vt(e)}),t&&De(n,t),n}function bt(e){return _(e,(function(t){return!x(e,(function(e){return e!==t&&xt(t,e)}))}))}function xt(e,t){if(t){if(e===t)return t;if(e.parent)return xt(e.parent,t)}}function wt(e,t,n){var r=!n||-1===e.indexOf(t);return r&&e.push(t),r}function _t(e,t,n){n=n||0,m(e)||(e=[e]),E(e,(function(e,r){var i=t(e,r,n);m(i)&&i.length&&_t(i,t,n+1)}))}function Et(e,t){return function(e,t,n){var r=[],i=[];return _t(e,(function(e,o,a){wt(r,e,t);var s=e.children;if((-1===n||a<n)&&s&&wt(i,s,t))return s})),r}(e,!t,-1)}function Pt(e,t){var n,r,i,o;return t=!!t,m(e)||(e=[e]),E(e,(function(e){var a=e;e.waypoints&&!t&&(a=Pt(e.waypoints,!0));var s=a.x,l=a.y,c=a.height||0,p=a.width||0;(s<n||void 0===n)&&(n=s),(l<r||void 0===r)&&(r=l),(s+p>i||void 0===i)&&(i=s+p),(l+c>o||void 0===o)&&(o=l+c)})),{x:n,y:r,height:o-r,width:i-n}}function St(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Ct(e){return!(!e||!e.isFrame)}function Ot(e,t){return U({},e||{},t||{})}ft.prototype.canRender=function(){},ft.prototype.drawShape=function(){},ft.prototype.drawConnection=function(){},ft.prototype.getShapePath=function(){},ft.prototype.getConnectionPath=function(){};function kt(e,t){ft.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}i(kt,ft),kt.prototype.canRender=function(){return!0},kt.prototype.drawShape=function(e,t,n){var r=Ge("rect");return De(r,{x:0,y:0,width:t.width||0,height:t.height||0}),Ct(t)?De(r,U({},this.FRAME_STYLE,n||{})):De(r,U({},this.SHAPE_STYLE,n||{})),Ae(e,r),r},kt.prototype.drawConnection=function(e,t,n){var r=yt(t.waypoints,U({},this.CONNECTION_STYLE,n||{}));return Ae(e,r),r},kt.prototype.getShapePath=function(e){var t=e.x,n=e.y,r=e.width;return gt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])},kt.prototype.getConnectionPath=function(e){var t,n,r=e.waypoints,i=[];for(t=0;n=r[t];t++)n=n.original||n,i.push([0===t?"M":"L",n.x,n.y]);return gt(i)},kt.$inject=["eventBus","styles"];var Mt={__init__:["defaultRenderer"],defaultRenderer:["type",kt],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){return U(this.style(t,n),{class:e})},this.style=function(t,n){m(t)||n||(n=t,t=[]);var r=S(t,(function(t,n){return U(t,e[n]||{})}),{});return n?U(r,n):r},this.computeStyle=function(e,n,r){return m(n)||(r=n,n=[]),t.style(n||[],U({},r,e||{}))}}]};function At(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function Tt(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var r=e.indexOf(t);if(-1!==r){if(r===n)return;if(-1===n)return;e.splice(r,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function Rt(e,t){return e&&t?e.indexOf(t):-1}var Dt=Object.freeze({__proto__:null,remove:At,add:Tt,indexOf:Rt});function Bt(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function jt(e,t,n,r){if(void 0===r&&(r=5),!e||!t||!n)return!1;var i=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Bt(e,t);return Math.abs(i/o)<=r}function zt(e,t){var n;return function(e,t){var n;n=m(e)?e:[e,t];var r=n.slice().shift();return C(n,(function(e){return Math.abs(r.y-e.y)<=2}))}(n=m(e)?e:[e,t])?"h":!!function(e,t){var n;n=m(e)?e:[e,t];var r=n.slice().shift();return C(n,(function(e){return Math.abs(r.x-e.x)<=2}))}(n)&&"v"}function It(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function Lt(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Vt=/,?([a-z]),?/gi,Nt=parseFloat,Ft=Math,$t=Ft.PI,Ht=Ft.min,qt=Ft.max,Ut=Ft.pow,Gt=Ft.abs,Wt=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Kt=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Yt=Array.isArray||function(e){return e instanceof Array};function Xt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Jt(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)Xt(e,n)&&(t[n]=Jt(e[n]));return t}function Zt(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function Qt(e){var t=Qt.ps=Qt.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)Xt(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function en(e,t,n,r){return 1===arguments.length&&(t=e.y,n=e.width,r=e.height,e=e.x),{x:e,y:t,width:n,height:r,x2:e+n,y2:t+r}}function tn(){return this.join(",").replace(Vt,"$1")}function nn(e){var t=Jt(e);return t.toString=tn,t}function rn(e,t,n,r,i,o,a,s,l){var c=1-l,p=Ut(c,3),u=Ut(c,2),d=l*l*l,m=p*t+3*u*l*r+3*c*l*l*o+d*s;return{x:pn(p*e+3*u*l*n+3*c*l*l*i+d*a),y:pn(m)}}function on(e){var t=vn.apply(null,e);return en(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function an(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function sn(e,t,n,r,i){return e*(e*(-3*t+9*n-9*r+3*i)+6*t-12*n+6*r)-3*t+3*n}function ln(e,t,n,r,i,o,a,s,l){null==l&&(l=1);for(var c=(l=l>1?1:l<0?0:l)/2,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<12;m++){var h=c*p[m]+c,f=sn(h,e,n,i,a),g=sn(h,t,r,o,s),v=f*f+g*g;d+=u[m]*Ft.sqrt(v)}return c*d}function cn(e,t,n,r,i,o,a,s){if(!(qt(e,n)<Ht(i,a)||Ht(e,n)>qt(i,a)||qt(t,r)<Ht(o,s)||Ht(t,r)>qt(o,s))){var l=(e*r-t*n)*(o-s)-(t-r)*(i*s-o*a),c=(e-n)*(o-s)-(t-r)*(i-a);if(c){var p=pn(((e*r-t*n)*(i-a)-(e-n)*(i*s-o*a))/c),u=pn(l/c),d=+p.toFixed(2),m=+u.toFixed(2);if(!(d<+Ht(e,n).toFixed(2)||d>+qt(e,n).toFixed(2)||d<+Ht(i,a).toFixed(2)||d>+qt(i,a).toFixed(2)||m<+Ht(t,r).toFixed(2)||m>+qt(t,r).toFixed(2)||m<+Ht(o,s).toFixed(2)||m>+qt(o,s).toFixed(2)))return{x:p,y:u}}}}function pn(e){return Math.round(1e11*e)/1e11}function un(e,t,n){if(!function(e,t){return e=en(e),an(t=en(t),e.x,e.y)||an(t,e.x2,e.y)||an(t,e.x,e.y2)||an(t,e.x2,e.y2)||an(e,t.x,t.y)||an(e,t.x2,t.y)||an(e,t.x,t.y2)||an(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(on(e),on(t)))return n?0:[];for(var r=ln.apply(0,e),i=ln.apply(0,t),o=mn(e)?1:~~(r/5)||1,a=mn(t)?1:~~(i/5)||1,s=[],l=[],c={},p=n?0:[],u=0;u<o+1;u++){var d=rn.apply(0,e.concat(u/o));s.push({x:d.x,y:d.y,t:u/o})}for(u=0;u<a+1;u++)d=rn.apply(0,t.concat(u/a)),l.push({x:d.x,y:d.y,t:u/a});for(u=0;u<o;u++)for(var m=0;m<a;m++){var h,f=s[u],g=s[u+1],v=l[m],y=l[m+1],b=Gt(g.x-f.x)<.01?"y":"x",x=Gt(y.x-v.x)<.01?"y":"x",w=cn(f.x,f.y,g.x,g.y,v.x,v.y,y.x,y.y);if(w){if(c[h=w.x.toFixed(9)+"#"+w.y.toFixed(9)])continue;c[h]=!0;var _=f.t+Gt((w[b]-f[b])/(g[b]-f[b]))*(g.t-f.t),E=v.t+Gt((w[x]-v[x])/(y[x]-v[x]))*(y.t-v.t);_>=0&&_<=1&&E>=0&&E<=1&&(n?p++:p.push({x:w.x,y:w.y,t1:_,t2:E}))}}return p}function dn(e){var t=Qt(e);if(t.abs)return nn(t.abs);if(Yt(e)&&Yt(e&&e[0])||(e=function(e){if(!e)return null;var t=Qt(e);if(t.arr)return Jt(t.arr);var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=[];return Yt(e)&&Yt(e[0])&&(r=Jt(e)),r.length||String(e).replace(Wt,(function(e,t,i){var o=[],a=t.toLowerCase();for(i.replace(Kt,(function(e,t){t&&o.push(+t)})),"m"==a&&o.length>2&&(r.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L");o.length>=n[a]&&(r.push([t].concat(o.splice(0,n[a]))),n[a]););})),r.toString=Qt.toString,t.arr=Jt(r),r}(e)),!e||!e.length)return[["M",0,0]];var n,r=[],i=0,o=0,a=0,s=0,l=0;"M"==e[0][0]&&(a=i=+e[0][1],s=o=+e[0][2],l++,r[0]=["M",i,o]);for(var c,p,u=l,d=e.length;u<d;u++){if(r.push(c=[]),(n=(p=e[u])[0])!=n.toUpperCase())switch(c[0]=n.toUpperCase(),c[0]){case"A":c[1]=p[1],c[2]=p[2],c[3]=p[3],c[4]=p[4],c[5]=p[5],c[6]=+p[6]+i,c[7]=+p[7]+o;break;case"V":c[1]=+p[1]+o;break;case"H":c[1]=+p[1]+i;break;case"M":a=+p[1]+i,s=+p[2]+o;default:for(var m=1,h=p.length;m<h;m++)c[m]=+p[m]+(m%2?i:o)}else for(var f=0,g=p.length;f<g;f++)c[f]=p[f];switch(n=n.toUpperCase(),c[0]){case"Z":i=+a,o=+s;break;case"H":i=c[1];break;case"V":o=c[1];break;case"M":a=c[c.length-2],s=c[c.length-1];default:i=c[c.length-2],o=c[c.length-1]}}return r.toString=tn,t.abs=nn(r),r}function mn(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function hn(e,t,n,r){return[e,t,n,r,n,r]}function fn(e,t,n,r,i,o){var a=1/3,s=2/3;return[a*e+s*n,a*t+s*r,a*i+s*n,a*o+s*r,i,o]}function gn(e,t,n,r,i,o,a,s,l,c){var p,u=120*$t/180,d=$t/180*(+i||0),m=[],h=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0),r=n.join("␀"),i=t.cache=t.cache||{},o=t.count=t.count||[];return Xt(i,r)?(Zt(o,r),i[r]):(o.length>=1e3&&delete i[o.shift()],o.push(r),i[r]=e.apply(0,n),i[r])}}((function(e,t,n){return{x:e*Ft.cos(n)-t*Ft.sin(n),y:e*Ft.sin(n)+t*Ft.cos(n)}}));if(c)E=c[0],P=c[1],w=c[2],_=c[3];else{e=(p=h(e,t,-d)).x,t=p.y;var f=(e-(s=(p=h(s,l,-d)).x))/2,g=(t-(l=p.y))/2,v=f*f/(n*n)+g*g/(r*r);v>1&&(n*=v=Ft.sqrt(v),r*=v);var y=n*n,b=r*r,x=(o==a?-1:1)*Ft.sqrt(Gt((y*b-y*g*g-b*f*f)/(y*g*g+b*f*f))),w=x*n*g/r+(e+s)/2,_=x*-r*f/n+(t+l)/2,E=Ft.asin(((t-_)/r).toFixed(9)),P=Ft.asin(((l-_)/r).toFixed(9));(E=e<w?$t-E:E)<0&&(E=2*$t+E),(P=s<w?$t-P:P)<0&&(P=2*$t+P),a&&E>P&&(E-=2*$t),!a&&P>E&&(P-=2*$t)}var S=P-E;if(Gt(S)>u){var C=P,O=s,k=l;P=E+u*(a&&P>E?1:-1),m=gn(s=w+n*Ft.cos(P),l=_+r*Ft.sin(P),n,r,i,0,a,O,k,[P,C,w,_])}S=P-E;var M=Ft.cos(E),A=Ft.sin(E),T=Ft.cos(P),R=Ft.sin(P),D=Ft.tan(S/4),B=4/3*n*D,j=4/3*r*D,z=[e,t],I=[e+B*A,t-j*M],L=[s+B*R,l-j*T],V=[s,l];if(I[0]=2*z[0]-I[0],I[1]=2*z[1]-I[1],c)return[I,L,V].concat(m);for(var N=[],F=0,$=(m=[I,L,V].concat(m).join().split(",")).length;F<$;F++)N[F]=F%2?h(m[F-1],m[F],d).y:h(m[F],m[F+1],d).x;return N}function vn(e,t,n,r,i,o,a,s){for(var l,c,p,u,d,m,h,f,g=[],v=[[],[]],y=0;y<2;++y)if(0==y?(c=6*e-12*n+6*i,l=-3*e+9*n-9*i+3*a,p=3*n-3*e):(c=6*t-12*r+6*o,l=-3*t+9*r-9*o+3*s,p=3*r-3*t),Gt(l)<1e-12){if(Gt(c)<1e-12)continue;0<(u=-p/c)&&u<1&&g.push(u)}else h=c*c-4*p*l,f=Ft.sqrt(h),h<0||(0<(d=(-c+f)/(2*l))&&d<1&&g.push(d),0<(m=(-c-f)/(2*l))&&m<1&&g.push(m));for(var b,x=g.length,w=x;x--;)b=1-(u=g[x]),v[0][x]=b*b*b*e+3*b*b*u*n+3*b*u*u*i+u*u*u*a,v[1][x]=b*b*b*t+3*b*b*u*r+3*b*u*u*o+u*u*u*s;return v[0][w]=e,v[1][w]=t,v[0][w+1]=a,v[1][w+1]=s,v[0].length=v[1].length=w+2,{x0:Ht.apply(0,v[0]),y0:Ht.apply(0,v[1]),x1:qt.apply(0,v[0]),y1:qt.apply(0,v[1])}}function yn(e){var t=Qt(e);if(t.curve)return nn(t.curve);for(var n=dn(e),r={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(e,t,n){var r,i;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(gn.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(r=2*t.x-t.bx,i=2*t.y-t.by):(r=t.x,i=t.y),e=["C",r,i].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(fn(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"].concat(fn(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(hn(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(hn(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(hn(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(hn(t.x,t.y,t.X,t.Y))}return e},o=function(e,t){if(e[t].length>7){e[t].shift();for(var r=e[t];r.length;)a[t]="A",e.splice(t++,0,["C"].concat(r.splice(0,6)));e.splice(t,1),p=n.length}},a=[],s="",l="",c=0,p=n.length;c<p;c++){n[c]&&(s=n[c][0]),"C"!=s&&(a[c]=s,c&&(l=a[c-1])),n[c]=i(n[c],r,l),"A"!=a[c]&&"C"==s&&(a[c]="C"),o(n,c);var u=n[c],d=u.length;r.x=u[d-2],r.y=u[d-1],r.bx=Nt(u[d-4])||r.x,r.by=Nt(u[d-3])||r.y}return t.curve=nn(n),n}var bn=function(e,t,n){e=yn(e),t=yn(t);for(var r,i,o,a,s,l,c,p,u,d,m=n?0:[],h=0,f=e.length;h<f;h++){var g=e[h];if("M"==g[0])r=s=g[1],i=l=g[2];else{"C"==g[0]?(u=[r,i].concat(g.slice(1)),r=u[6],i=u[7]):(u=[r,i,r,i,s,l,s,l],r=s,i=l);for(var v=0,y=t.length;v<y;v++){var b=t[v];if("M"==b[0])o=c=b[1],a=p=b[2];else{"C"==b[0]?(d=[o,a].concat(b.slice(1)),o=d[6],a=d[7]):(d=[o,a,o,a,c,p,c,p],o=c,a=p);var x=un(u,d,n);if(n)m+=x;else{for(var w=0,_=x.length;w<_;w++)x[w].segment1=h,x[w].segment2=v,x[w].bez1=u,x[w].bez2=d;m=m.concat(x)}}}}}return m};function xn(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function wn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function _n(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function En(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Pn(e){for(var t=e.waypoints,n=t.reduce((function(e,n,r){var i=t[r-1];if(i){var o=e[e.length-1],a=o&&o.endLength||0,s=function(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}(i,n);e.push({start:i,end:n,startLength:a,endLength:a+s,length:s})}return e}),[]),r=n.reduce((function(e,t){return e+t.length}),0)/2,i=0,o=n[i];o.endLength<r;)o=n[++i];var a=(r-o.startLength)/o.length;return{x:o.start.x+(o.end.x-o.start.x)*a,y:o.start.y+(o.end.y-o.start.y)*a}}function Sn(e){return function(e){return!!e.waypoints}(e)?Pn(e):wn({x:(t=e).x+(t.width||0)/2,y:t.y+(t.height||0)/2});var t}function Cn(e,t,n){h(n=n||0)||(n={x:n,y:n});var r=_n(e),i=_n(t),o=r.bottom+n.y<=i.top,a=r.left-n.x>=i.right,s=r.top-n.y>=i.bottom,l=o?"top":s?"bottom":null,c=r.right+n.x<=i.left?"left":a?"right":null;return c&&l?l+"-"+c:c||l||"intersect"}function On(e,t,n){var r=function(e,t){return bn(e,t)}(e,t);return 1===r.length||2===r.length&&Bt(r[0],r[1])<1?wn(r[0]):r.length>1?wn((r=j(r,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})))[n?0:r.length-1]):null}function kn(e,t){return Math.round(e*t)/t}function Mn(e){return f(e)?e+"px":e}function An(e,t,n){var r=Ge("g");Le(r).add(t);var i=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(r,e.childNodes[i]||null),r}var Tn={shape:["x","y","width","height"],connection:["waypoints"]};function Rn(e,t,n,r){this._eventBus=t,this._elementRegistry=r,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function Dn(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Rn.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Rn.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=U({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),re(n,{position:"relative",overflow:"hidden",width:Mn(e.width),height:Mn(e.height)}),t.appendChild(n),n}(e),r=this._svg=Ge("svg");De(r,{width:"100%",height:"100%"}),Ae(n,r);var i=this._viewport=An(r,"viewport");!1!==e.deferUpdate&&(this._viewboxChanged=F($(this._viewboxChanged,this),300)),t.on("diagram.init",(function(){t.fire("canvas.init",{svg:r,viewport:i})}),this),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(function(){delete this._cachedViewbox}),this),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Rn.prototype._destroy=function(e){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var t=this._container.parentNode;t&&t.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Rn.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach((function(t){var n=St(t);"root"===n?e.removeRootElement(t):e._removeElement(t,n)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Rn.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Rn.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");var n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),void 0!==t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Rn.prototype._getChildIndex=function(e){return S(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Rn.prototype._createLayer=function(e,t){void 0===t&&(t=1);var n=this._getChildIndex(t);return{group:An(this._viewport,"layer-"+e,n),index:t,visible:!0}},Rn.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");var n=this._viewport,r=t.group,i=t.index;if(t.visible)return r;var o=this._getChildIndex(i);return n.insertBefore(r,n.childNodes[o]||null),t.visible=!0,r},Rn.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");var n=t.group;return t.visible?(Ne(n),t.visible=!1,n):n},Rn.prototype._removeLayer=function(e){var t=this._layers[e];t&&(delete this._layers[e],Ne(t.group))},Rn.prototype.getActiveLayer=function(){var e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Rn.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),e)return(this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{}).rootElement},Rn.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Rn.prototype._findPlaneForRoot=function(e){return x(this._planes,(function(t){return t.rootElement===e}))},Rn.prototype.getContainer=function(){return this._container},Rn.prototype._updateMarker=function(e,t,n){var r;e.id||(e=this._elementRegistry.get(e)),(r=this._elementRegistry._elements[e.id])&&(E([r.gfx,r.secondaryGfx],(function(e){e&&(n?Le(e).add(t):Le(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:r.gfx,marker:t,add:!!n}))},Rn.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Rn.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Rn.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Le(this.getGraphics(e)).has(t)},Rn.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Rn.prototype.getRootElement=function(){var e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Rn.prototype.addRootElement=function(e){var t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});var n=e.layer="root-"+t;this._ensureValid("root",e);var r=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,r),this._planes.push({rootElement:e,layer:r}),e},Rn.prototype.removeRootElement=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter((function(t){return t.rootElement!==e})),this._rootElement===e&&(this._rootElement=null),e},Rn.prototype.setRootElement=function(e,t){if(u(t))throw new Error("override not supported");if(e!==this._rootElement){if(!e)throw new Error("rootElement required");return this._findPlaneForRoot(e)||(e=this.addRootElement(e)),this._setRoot(e),e}},Rn.prototype._removeRoot=function(e){var t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Rn.prototype._addRoot=function(e,t){var n=this._elementRegistry,r=this._eventBus;r.fire("root.add",{element:e}),n.add(e,t),r.fire("root.added",{element:e,gfx:t})},Rn.prototype._setRoot=function(e,t){var n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Rn.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");var n=Tn[e];if(!C(n,(function(e){return void 0!==t[e]})))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Rn.prototype._setParent=function(e,t,n){Tt(t.children,e,n),e.parent=t},Rn.prototype._addElement=function(e,t,n,r){n=n||this.getRootElement();var i=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),i.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,r);var a=o.create(e,t,r);return this._elementRegistry.add(t,a),o.update(e,t,a),i.fire(e+".added",{element:t,gfx:a}),t},Rn.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Rn.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Rn.prototype._removeElement=function(e,t){var n=this._elementRegistry,r=this._graphicsFactory,i=this._eventBus;if(e=n.get(e.id||e))return i.fire(t+".remove",{element:e}),r.remove(e),At(e.parent&&e.parent.children,e),e.parent=null,i.fire(t+".removed",{element:e}),n.remove(e),e},Rn.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Rn.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Rn.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Rn.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Rn.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Rn.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,r,i,o,a,s,l=this._viewport,c=this.getSize();return e?(this._changeViewbox((function(){o=Math.min(c.width/e.width,c.height/e.height);var t=this._svg.createSVGMatrix().scale(o).translate(-e.x,-e.y);it(l,t)})),e):(t=(r=this._rootElement?this.getActiveLayer():null)&&r.getBBox()||{},n=(i=it(l))?i.matrix:function(e,t,n,r,i,o){var a=We.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Ke(a,e);case 6:return Ke(a,{a:e,b:t,c:n,d:r,e:i,f:o})}}(),o=kn(n.a,1e3),a=kn(-n.e||0,1e3),s=kn(-n.f||0,1e3),e=this._cachedViewbox={x:a?a/o:0,y:s?s/o:0,width:c.width/o,height:c.height/o,scale:o,inner:{width:t.width||0,height:t.height||0,x:t.x||0,y:t.y||0},outer:c})},Rn.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox((function(){e=U({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Dn(t,n)})),{x:n.e,y:n.f}},Rn.prototype.scrollToElement=function(e,t){var n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));var r=this.findRoot(e);r!==this.getRootElement()&&this.setRootElement(r),t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};var i,o,a=Pt(e),s=_n(a),l=this.viewbox(),c=this.zoom();l.y+=t.top/c,l.x+=t.left/c,l.width-=(t.right+t.left)/c,l.height-=(t.bottom+t.top)/c;var p=_n(l);if(a.width<l.width&&a.height<l.height){var u=Math.max(0,s.right-p.right),d=Math.min(0,s.left-p.left),m=Math.max(0,s.bottom-p.bottom),h=Math.min(0,s.top-p.top);i=u||d,o=m||h}else i=a.x-l.x,o=a.y-l.y;this.scroll({dx:-i*c,dy:-o*c})},Rn.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),r=this._setZoom(e,t)})),kn(r.a,1e3)):this.viewbox(e).scale;var n,r},Rn.prototype._fitViewport=function(e){var t,n,r=this.viewbox(),i=r.outer,o=r.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=i.width&&o.y+o.height<=i.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,i.width),height:Math.max(o.height+o.y,i.height)}:(t=Math.min(1,i.width/o.width,i.height/o.height),n={x:o.x+(e?o.width/2-i.width/t/2:0),y:o.y+(e?o.height/2-i.height/t/2:0),width:i.width/t,height:i.height/t}),this.viewbox(n),this.viewbox(!1).scale},Rn.prototype._setZoom=function(e,t){var n,r,i,o,a=this._svg,s=this._viewport,l=a.createSVGMatrix(),c=a.createSVGPoint(),p=(r=s.getCTM()).a;return t?(n=U(c,t).matrixTransform(r.inverse()),i=l.translate(n.x,n.y).scale(1/p*e).translate(-n.x,-n.y),o=r.multiply(i)):o=l.scale(e),Dn(this._viewport,o),o},Rn.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Rn.prototype.getAbsoluteBBox=function(e){var t,n=this.viewbox();e.waypoints?t=this.getGraphics(e).getBBox():t=e;return{x:t.x*n.scale-n.x*n.scale,y:t.y*n.scale-n.y*n.scale,width:t.width*n.scale,height:t.height*n.scale}},Rn.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Bn="data-element-id";function jn(e){this._elements={},this._eventBus=e}jn.$inject=["eventBus"],jn.prototype.add=function(e,t,n){var r=e.id;this._validateId(r),De(t,Bn,r),n&&De(n,Bn,r),this._elements[r]={element:e,gfx:t,secondaryGfx:n}},jn.prototype.remove=function(e){var t=this._elements,n=e.id||e,r=n&&t[n];r&&(De(r.gfx,Bn,""),r.secondaryGfx&&De(r.secondaryGfx,Bn,""),delete t[n])},jn.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),r=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,r)},jn.prototype.updateGraphics=function(e,t,n){var r=e.id||e,i=this._elements[r];return n?i.secondaryGfx=t:i.gfx=t,t&&De(t,Bn,r),t},jn.prototype.get=function(e){var t;t="string"==typeof e?e:e&&De(e,Bn);var n=this._elements[t];return n&&n.element},jn.prototype.filter=function(e){var t=[];return this.forEach((function(n,r){e(n,r)&&t.push(n)})),t},jn.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),r=0;r<n.length;r++){var i=t[n[r]],o=i.element;if(e(o,i.gfx))return o}},jn.prototype.getAll=function(){return this.filter((function(e){return e}))},jn.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var r=t[n],i=r.element,o=r.gfx;return e(i,o)}))},jn.prototype.getGraphics=function(e,t){var n=e.id||e,r=this._elements[n];return r&&(t?r.secondaryGfx:r.gfx)},jn.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var zn={extend:function(e,t,n,r){var i=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,i,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var o=this.indexOf(e);if(void 0===n){if(-1!==o)return;n=this.length}-1!==o&&this.splice(o,1),this.splice(n,0,e),-1===o&&t.set(e,i,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function In(e,t,n){var r=zn.extend(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:r}),r.length&&r.forEach((function(r){e.set(r,t.inverse,n)}))}function Ln(e,t){if(!(this instanceof Ln))return new Ln(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ln.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?In(this,t,e):function(e,t,n){var r=t.inverse,i=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(t){if(t!==i){var o=i;i=null,o&&e.unset(o,r,n),i=t,e.set(i,r,n)}}})}(this,t,e)},Ln.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return zn.isExtended(n)||In(this,t,e),n},Ln.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Ln.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ln.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Vn=Ln,Nn=zn;Vn.Collection=Nn;var Fn=new Vn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),$n=new Vn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Hn=new Vn({name:"attachers",collection:!0},{name:"host"}),qn=new Vn({name:"outgoing",collection:!0},{name:"source"}),Un=new Vn({name:"incoming",collection:!0},{name:"target"});function Gn(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Fn.bind(this,"parent"),$n.bind(this,"labels"),qn.bind(this,"outgoing"),Un.bind(this,"incoming")}function Wn(){Gn.call(this),Fn.bind(this,"children"),Hn.bind(this,"host"),Hn.bind(this,"attachers")}function Kn(){Wn.call(this)}function Yn(){Wn.call(this),$n.bind(this,"labelTarget")}function Xn(){Gn.call(this),qn.bind(this,"source"),Un.bind(this,"target")}i(Wn,Gn),i(Kn,Wn),i(Yn,Wn),i(Xn,Gn);var Jn={connection:Xn,shape:Wn,label:Yn,root:Kn};function Zn(){this._uid=12}Zn.prototype.createRoot=function(e){return this.create("root",e)},Zn.prototype.createLabel=function(e){return this.create("label",e)},Zn.prototype.createShape=function(e){return this.create("shape",e)},Zn.prototype.createConnection=function(e){return this.create("connection",e)},Zn.prototype.create=function(e,t){return(t=U({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Jn[e];if(!n)throw new Error("unknown type: <"+e+">");return U(new n,t)}(e,t)};var Qn=Array.prototype.slice;function er(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function tr(){}function nr(e){return e.childNodes[0]}function rr(e,t,n,r,i){var o=Ye();o.setTranslate(t,n);var a=Ye();a.setRotate(r||0,0,0);var s=Ye();s.setScale(i||1,i||1),it(e,[o,a,s])}function ir(e,t,n){var r=Ye();r.setTranslate(t,n),it(e,r)}function or(e,t){var n=Ye();n.setRotate(t,0,0),it(e,n)}function ar(e,t){this._eventBus=e,this._elementRegistry=t}function sr(e,t,n){var r=n||t.firstChild;e!==r&&t.insertBefore(e,r)}er.prototype.on=function(e,t,n,r){if(e=m(e)?e:[e],g(t)&&(r=n,n=t,t=1e3),!f(t))throw new Error("priority must be a number");var i=n;r&&((i=$(n,r)).__fn=n.__fn||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:i,next:null})}))},er.prototype.once=function(e,t,n,r){var i=this;if(g(t)&&(r=n,n=t,t=1e3),!f(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var t=n.apply(r,arguments);return i.off(e,o),t}o.__fn=n,this.on(e,t,o)},er.prototype.off=function(e,t){e=m(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},er.prototype.createEvent=function(e){var t=new tr;return t.init(e),t},er.prototype.fire=function(e,t){var n,r,i,o;if(o=Qn.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(r=this._listeners[e]){n=t instanceof tr?t:this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{i=this._invokeListeners(n,o,r)}finally{e!==a&&(n.type=a)}return void 0===i&&n.defaultPrevented&&(i=!1),i}},er.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},er.prototype._destroy=function(){this._listeners={}},er.prototype._invokeListeners=function(e,t,n){for(var r;n&&!e.cancelBubble;)r=this._invokeListener(e,t,n),n=n.next;return r},er.prototype._invokeListener=function(e,t,n){var r;if(n.callback.__isTomb)return r;try{void 0!==(r=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=r,e.stopPropagation()),!1===r&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return r},er.prototype._addListener=function(e,t){var n,r=this._getListeners(e);if(r){for(;r;){if(r.priority<t.priority)return t.next=r,void(n?n.next=t:this._setListeners(e,t));n=r,r=r.next}n.next=t}else this._setListeners(e,t)},er.prototype._getListeners=function(e){return this._listeners[e]},er.prototype._setListeners=function(e,t){this._listeners[e]=t},er.prototype._removeListener=function(e,t){var n,r,i,o=this._getListeners(e);if(t)for(;o;)n=o.next,(i=o.callback)!==t&&i.__fn!==t||(r?r.next=n:this._setListeners(e,n)),r=o,o=n;else this._setListeners(e,null)},tr.prototype.stopPropagation=function(){this.cancelBubble=!0},tr.prototype.preventDefault=function(){this.defaultPrevented=!0},tr.prototype.init=function(e){U(this,e||{})},ar.$inject=["eventBus","elementRegistry"],ar.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n))||(Le(t=Ge("g")).add("djs-children"),Ae(n.parentNode,t)):t=n,t},ar.prototype._clear=function(e){var t=nr(e);return ue(t),t},ar.prototype._createContainer=function(e,t,n,r){var i=Ge("g");Le(i).add("djs-group"),void 0!==n?sr(i,t,t.childNodes[n]):Ae(t,i);var o=Ge("g");Le(o).add("djs-element"),Le(o).add("djs-"+e),r&&Le(o).add("djs-frame"),Ae(i,o);var a=Ge("g");return Le(a).add("djs-visual"),Ae(o,a),o},ar.prototype.create=function(e,t,n){var r=this._getChildrenContainer(t.parent);return this._createContainer(e,r,n,Ct(t))},ar.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry;E(S(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),(function(e){var r=e.children;if(r){var i=t._getChildrenContainer(e);E(r.slice().reverse(),(function(e){sr(n.getGraphics(e).parentNode,i)}))}}))},ar.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},ar.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},ar.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},ar.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},ar.prototype.update=function(e,t,n){if(t.parent){var r=this._clear(n);if("shape"===e)this.drawShape(r,t),ir(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(r,t)}t.hidden?De(n,"display","none"):De(n,"display","block")}},ar.prototype.remove=function(e){Ne(this._elementRegistry.getGraphics(e).parentNode)};var lr={__depends__:[Mt],__init__:["canvas"],canvas:["type",Rn],elementRegistry:["type",jn],elementFactory:["type",Zn],eventBus:["type",er],graphicsFactory:["type",ar]};function cr(e){return function(e){var t=new mt(e);return t.init(),t}([{config:["value",e=e||{}]},lr].concat(e.modules||[]))}function pr(e,t){this.injector=t=t||cr(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function ur(){}function dr(e,t){this.model=e,this.properties=t}pr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},pr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},ur.prototype.get=function(e){return this.$model.properties.get(this,e)},ur.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},dr.prototype.createType=function(e){var t=this.model,n=this.properties,r=Object.create(ur.prototype);E(e.properties,(function(e){e.isMany||void 0===e.default||(r[e.name]=e.default)})),n.defineModel(r,t),n.defineDescriptor(r,e);var i=e.ns.name;function o(e){n.define(this,"$type",{value:i,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),E(e,$((function(e,t){this.set(t,e)}),this))}return o.prototype=r,o.hasType=r.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var mr={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},hr={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}};function fr(e,t){var n=hr[e];return n?n(t):t}function gr(e){return!!mr[e]}function vr(e){return!!hr[e]}function yr(e,t){var n,r,i=e.split(/:/);if(1===i.length)n=e,r=t;else{if(2!==i.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=i[1],r=i[0]}return{name:e=(r?r+":":"")+n,prefix:r,localName:n}}function br(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function xr(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,E(e,$(this.registerPackage,this))}function wr(e,t,n){var r=t[n];if(r in e)throw new Error("package with "+n+" <"+r+"> already defined")}function _r(e){this.model=e}function Er(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Pr(e){this.properties=new _r(this),this.factory=new dr(this,this.properties),this.registry=new xr(e,this.properties),this.typeCache={}}br.prototype.build=function(){return K(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},br.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var r=this.properties;void 0!==t?r.splice(t,0,e):r.push(e)},br.prototype.replaceProperty=function(e,t,n){var r=e.ns,i=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=i.indexOf(e);if(-1===s)throw new Error("property <"+r.name+"> not found in property list");i.splice(s,1),this.addProperty(t,n?void 0:s,a),o[r.name]=o[r.localName]=t},br.prototype.redefineProperty=function(e,t,n){var r=e.ns.prefix,i=t.split("#"),o=yr(i[0],r),a=yr(i[1],o.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},br.prototype.addNamedProperty=function(e,t){var n=e.ns,r=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),r[n.name]=r[n.localName]=e},br.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},br.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},br.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},br.prototype.assertNotDefined=function(e,t){var n=e.name,r=this.propertiesByName[n];if(r)throw new Error("property <"+n+"> already defined; override of <"+r.definedBy.ns.name+"#"+r.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},br.prototype.hasProperty=function(e){return this.propertiesByName[e]},br.prototype.addTrait=function(e,t){var n=this.allTypesByName,r=this.allTypes,i=e.name;i in n||(E(e.properties,$((function(n){n=U({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var r=n.replaces,i=n.redefines;r||i?this.redefineProperty(n,r||i,r):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),r.push(e),n[i]=e)},xr.prototype.getPackage=function(e){return this.packageMap[e]},xr.prototype.getPackages=function(){return this.packages},xr.prototype.registerPackage=function(e){e=U({},e);var t=this.packageMap;wr(t,e,"prefix"),wr(t,e,"uri"),E(e.types,$((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},xr.prototype.registerType=function(e,t){var n=yr((e=U({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:U(e.meta||{})})).name,t.prefix),r=n.name,i={};E(e.properties,$((function(e){var t=yr(e.name,n.prefix),r=t.name;gr(e.type)||(e.type=yr(e.type,t.prefix).name),U(e,{ns:t,name:r}),i[r]=e}),this)),U(e,{ns:n,name:r,propertiesByName:i}),E(e.extends,$((function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(r)}),this)),this.definePackage(e,t),this.typeMap[r]=e},xr.prototype.mapTypes=function(e,t,n){var r=gr(e.name)?{name:e.name}:this.typeMap[e.name],i=this;function o(e){return a(e,!0)}function a(n,r){var o=yr(n,gr(n)?"":e.prefix);i.mapTypes(o,t,r)}if(!r)throw new Error("unknown type <"+e.name+">");E(r.superClass,n?o:a),t(r,!n),E(r.traits,o)},xr.prototype.getEffectiveDescriptor=function(e){var t=yr(e),n=new br(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var r=n.build();return this.definePackage(r,r.allTypes[r.allTypes.length-1].$pkg),r},xr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},_r.prototype.set=function(e,t,n){var r=this.model.getPropertyDescriptor(e,t),i=r&&r.name;void 0===n?r?delete e[i]:delete e.$attrs[t]:r?i in e?e[i]=n:Er(e,r,n):e.$attrs[t]=n},_r.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var r=n.name;return!e[r]&&n.isMany&&Er(e,n,[]),e[r]},_r.prototype.define=function(e,t,n){if(!n.writable){var r=n.value;delete(n=U({},n,{get:function(){return r}})).value}Object.defineProperty(e,t,n)},_r.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},_r.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pr.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Pr.prototype.getType=function(e){var t=this.typeCache,n=v(e)?e:e.ns.name,r=t[n];return r||(e=this.registry.getEffectiveDescriptor(n),r=t[n]=this.factory.createType(e)),r},Pr.prototype.createAny=function(e,t,n){var r=yr(e),i={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:r.prefix,localName:r.localName,uri:t}};return this.properties.defineDescriptor(i,o),this.properties.defineModel(i,this),this.properties.define(i,"$parent",{enumerable:!1,writable:!0}),this.properties.define(i,"$instanceOf",{enumerable:!1,writable:!0}),E(n,(function(e,t){h(e)&&void 0!==e.value?i[e.name]=e.value:i[t]=e})),i},Pr.prototype.getPackage=function(e){return this.registry.getPackage(e)},Pr.prototype.getPackages=function(){return this.registry.getPackages()},Pr.prototype.getElementDescriptor=function(e){return e.$descriptor},Pr.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},Pr.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Pr.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Sr=String.fromCharCode,Cr=Object.prototype.hasOwnProperty,Or=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,kr={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Mr(e,t,n,r){return r?Cr.call(kr,r)?kr[r]:"&"+r+";":Sr(t||parseInt(n,16))}function Ar(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(Or,Mr):e}Object.keys(kr).forEach((function(e){kr[e.toUpperCase()]=kr[e]}));var Tr="xsi:type",Rr="non-whitespace outside of root node";function Dr(e){return new Error(e)}function Br(e){return"missing namespace for prefix <"+e+">"}function jr(e){return{get:e,enumerable:!0}}function zr(e){var t,n={};for(t in e)n[t]=e[t];return n}function Ir(e){return e+"$uri"}function Lr(){return{line:0,column:0}}function Vr(e){throw e}function Nr(e){if(!this)return new Nr(e);var t,n,r,i,o,a,s,l,c,p=e&&e.proxy,u=Vr,d=Lr,m=!1,h=!1,f=null,g=!1;function v(e){e instanceof Error||(e=Dr(e)),f=e,u(e,d)}function y(e){o&&(e instanceof Error||(e=Dr(e)),o(e,d))}this.on=function(e,c){if("function"!=typeof c)throw Dr("required args <name, cb>");switch(e){case"openTag":n=c;break;case"text":t=c;break;case"closeTag":r=c;break;case"error":u=c;break;case"warn":o=c;break;case"cdata":i=c;break;case"attention":l=c;break;case"question":s=c;break;case"comment":a=c;break;default:throw Dr("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Dr("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",h=!0,c=n,this},this.parse=function(e){if("string"!=typeof e)throw Dr("required args <xml=string>");return f=null,function(e){var o,u,f,b,x,w,_,E,P,S,C,O=h?[]:null,k=h?function(e){var t,n,r={};for(t in e)r[n=e[t]]=n,r[Ir(n)]=t;return r}(c):null,M=[],A=0,T=!1,R=!1,D=0,B=0,j="",z=0;function I(){if(null!==C)return C;var e,t,n,r,i,o,a,s,l,p,u,d=h&&k.xmlns,f=h&&m?[]:null,g=z,v=j,b=v.length,x={},w={};e:for(;g<b;g++)if(l=!1,!(32===(p=v.charCodeAt(g))||p<14&&p>8)){for((p<65||p>122||p>90&&p<97)&&95!==p&&58!==p&&(y("illegal first char attribute name"),l=!0),u=g+1;u<b;u++)if(!((p=v.charCodeAt(u))>96&&p<123||p>64&&p<91||p>47&&p<59||46===p||45===p||95===p)){if(32===p||p<14&&p>8){y("missing attribute value"),g=u;continue e}if(61===p)break;y("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(s=v.substring(g,u))&&(y("illegal declaration of xmlns"),l=!0),34===(p=v.charCodeAt(u+1)))-1===(u=v.indexOf('"',g=u+2))&&-1!==(u=v.indexOf("'",g))&&(y("attribute value quote missmatch"),l=!0);else if(39===p)-1===(u=v.indexOf("'",g=u+2))&&-1!==(u=v.indexOf('"',g))&&(y("attribute value quote missmatch"),l=!0);else for(y("missing attribute value quotes"),l=!0,u+=1;u<b&&!(32===(p=v.charCodeAt(u+1))||p<14&&p>8);u++);for(-1===u&&(y("missing closing quotes"),u=b,l=!0),l||(o=v.substring(g,u)),g=u;u+1<b&&!(32===(p=v.charCodeAt(u+1))||p<14&&p>8);u++)g===u&&(y("illegal character after attribute end"),l=!0);if(g=u+1,!l)if(s in w)y("attribute <"+s+"> already defined");else if(w[s]=!0,h)if(m){if(null!==(i="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=Ar(o),t=Ir(i),!(a=c[e])){if("xmlns"===i||t in k&&k[t]!==e)do{a="ns"+A++}while(void 0!==k[a]);else a=i;c[e]=a}k[i]!==a&&(r||(k=zr(k),r=!0),k[i]=a,"xmlns"===i&&(k[Ir(a)]=e,d=a),k[t]=e),x[s]=o;continue}f.push(s,o)}else-1!==(p=s.indexOf(":"))?(n=k[s.substring(0,p)])?((s=d===n?s.substr(p+1):n+s.substr(p))===Tr&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=k[n]||n)+o.substring(p)):o=d+":"+o),x[s]=o):y(Br(s.substring(0,p))):x[s]=o;else x[s]=o}if(m)for(g=0,b=f.length;g<b;g++){if(s=f[g++],o=f[g],-1!==(p=s.indexOf(":"))){if(!(n=k[s.substring(0,p)])){y(Br(s.substring(0,p)));continue}(s=d===n?s.substr(p+1):n+s.substr(p))===Tr&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=k[n]||n)+o.substring(p)):o=d+":"+o)}x[s]=o}return C=x}function L(){for(var t,n,r=/(\r\n|\r|\n)/g,i=0,o=0,a=0,s=B;D>=a&&(t=r.exec(e))&&!((s=t[0].length+t.index)>D);)i+=1,a=s;return-1==D?(o=s,n=e.substring(B)):0===B?n=e.substring(B,D):(o=D-a,n=-1==B?e.substring(D):e.substring(D,B+1)),{data:n,line:i,column:o}}d=L,p&&(S=Object.create({},{name:jr((function(){return E})),originalName:jr((function(){return P})),attrs:jr(I),ns:jr((function(){return k}))}));for(;-1!==B;){if(-1===(D=60===e.charCodeAt(B)?B:e.indexOf("<",B)))return M.length?v("unexpected end of file"):0===B?v("missing start tag"):void(B<e.length&&e.substring(B).trim()&&y(Rr));if(B!==D)if(M.length){if(t&&(t(e.substring(B,D),Ar,d),g))return}else if(e.substring(B,D).trim()&&(y(Rr),g))return;if(33===(x=e.charCodeAt(D+1))){if(91===(b=e.charCodeAt(D+2))&&"CDATA["===e.substr(D+3,6)){if(-1===(B=e.indexOf("]]>",D)))return v("unclosed cdata");if(i&&(i(e.substring(D+9,B),d),g))return;B+=3;continue}if(45===b&&45===e.charCodeAt(D+3)){if(-1===(B=e.indexOf("--\x3e",D)))return v("unclosed comment");if(a&&(a(e.substring(D+4,B),Ar,d),g))return;B+=3;continue}}if(63!==x){for(u=D+1;;u++){if(w=e.charCodeAt(u),isNaN(w))return B=-1,v("unclosed tag");if(34===w)u=-1!==(b=e.indexOf('"',u+1))?b:u;else if(39===w)u=-1!==(b=e.indexOf("'",u+1))?b:u;else if(62===w){B=u;break}}if(33!==x){if(C={},47===x){if(T=!1,R=!0,!M.length)return v("missing open tag");if(u=E=M.pop(),b=D+2+u.length,e.substring(D+2,b)!==u)return v("closing tag mismatch");for(;b<B;b++)if(!(32===(x=e.charCodeAt(b))||x>8&&x<14))return v("close tag")}else{if(47===e.charCodeAt(B-1)?(u=E=e.substring(D+1,B-1),T=!0,R=!0):(u=E=e.substring(D+1,B),T=!0,R=!1),!(x>96&&x<123||x>64&&x<91||95===x||58===x))return v("illegal first char nodeName");for(b=1,f=u.length;b<f;b++)if(!((x=u.charCodeAt(b))>96&&x<123||x>64&&x<91||x>47&&x<59||45===x||95===x||46==x)){if(32===x||x<14&&x>8){E=u.substring(0,b),C=null;break}return v("invalid nodeName")}R||M.push(E)}if(h){if(o=k,T&&(R||O.push(o),null===C&&(m=-1!==u.indexOf("xmlns",b))&&(z=b,j=u,I(),m=!1)),P=E,-1!==(x=E.indexOf(":"))){if(!(_=k[E.substring(0,x)]))return v("missing namespace on <"+P+">");E=E.substr(x+1)}else _=k.xmlns;_&&(E=_+":"+E)}if(T&&(z=b,j=u,n&&(p?n(S,Ar,R,d):n(E,I,Ar,R,d),g)))return;if(R){if(r&&(r(p?S:E,Ar,T,d),g))return;h&&(k=T?o:O.pop())}B+=1}else{if(l&&(l(e.substring(D,B+1),Ar,d),g))return;B+=1}}else{if(-1===(B=e.indexOf("?>",D)))return v("unclosed question");if(s&&(s(e.substring(D,B+2),d),g))return;B+=2}}}(e),d=Lr,g=!1,f},this.stop=function(){g=!0}}function Fr(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var $r={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Hr="xsi:type";function qr(e){return e.xml&&e.xml.serialize}function Ur(e){return qr(e)===Hr}function Gr(e,t){return Fr(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Wr(e){return new Error(e)}function Kr(e){return e.$descriptor}function Yr(e){U(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Wr("expected element");var t,n=this.elementsById,r=Kr(e).idProperty;if(r&&(t=e.get(r.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Wr("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Xr(){}function Jr(){}function Zr(){}function Qr(e,t){this.property=e,this.context=t}function ei(e,t){this.element=t,this.propertyDesc=e}function ti(){}function ni(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function ri(e,t,n){ni.call(this,e,t,n)}function ii(e,t,n){this.model=e,this.context=n}function oi(e){e instanceof Pr&&(e={model:e}),U(this,{lax:!1},e)}Xr.prototype.handleEnd=function(){},Xr.prototype.handleText=function(){},Xr.prototype.handleNode=function(){},Jr.prototype=Object.create(Xr.prototype),Jr.prototype.handleNode=function(){return this},Zr.prototype=Object.create(Xr.prototype),Zr.prototype.handleText=function(e){this.body=(this.body||"")+e},Qr.prototype=Object.create(Zr.prototype),Qr.prototype.handleNode=function(e){if(this.element)throw Wr("expected no sub nodes");return this.element=this.createReference(e),this},Qr.prototype.handleEnd=function(){this.element.id=this.body},Qr.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},ei.prototype=Object.create(Zr.prototype),ei.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=fr(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},ti.prototype=Object.create(Zr.prototype),ti.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t},ni.prototype=Object.create(ti.prototype),ni.prototype.addReference=function(e){this.context.addReference(e)},ni.prototype.handleText=function(e){if(!Kr(this.element).bodyProperty)throw Wr("unexpected body text <"+e+">");Zr.prototype.handleText.call(this,e)},ni.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Kr(t).bodyProperty;n&&void 0!==e&&(e=fr(n.type,e),t.set(n.name,e))},ni.prototype.createElement=function(e){var t,n=e.attributes,r=this.type,i=Kr(r),o=this.context,a=new r({}),s=this.model;return E(n,(function(e,n){var r=i.propertiesByName[n];r&&r.isReference?r.isMany?E(e.split(" "),(function(e){o.addReference({element:a,property:r.ns.name,id:e})})):o.addReference({element:a,property:r.ns.name,id:e}):(r?e=fr(r.type,e):"xmlns"!==n&&(t=yr(n,i.ns.prefix),s.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:a,property:n,value:e})),a.set(n,e))})),a},ni.prototype.getPropertyForNode=function(e){var t,n,r=yr(e.name),i=this.type,o=this.model,a=Kr(i),s=r.name,l=a.propertiesByName[s];if(l&&!l.isAttr)return Ur(l)&&(t=e.attributes[Hr])?(t=function(e,t){var n=yr(e);return function(e,t){var n=e.name,r=e.localName,i=t.xml&&t.xml.typePrefix;return i&&0===r.indexOf(i)?e.prefix+":"+r.slice(i.length):n}(n,t.getPackage(n.prefix))}(t,o),U({},l,{effectiveType:Kr(n=o.getType(t)).name})):l;var c=o.getPackage(r.prefix);if(c){if(t=Gr(r,c),n=o.getType(t),l=x(a.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})))return U({},l,{effectiveType:Kr(n).name})}else if(l=x(a.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})))return l;throw Wr("unrecognized element <"+r.name+">")},ni.prototype.toString=function(){return"ElementDescriptor["+Kr(this.type).name+"]"},ni.prototype.valueHandler=function(e,t){return new ei(e,t)},ni.prototype.referenceHandler=function(e){return new Qr(e,this.context)},ni.prototype.handler=function(e){return"Element"===e?new ii(this.model,e,this.context):new ni(this.model,e,this.context)},ni.prototype.handleChild=function(e){var t,n,r,i;if(t=this.getPropertyForNode(e),r=this.element,vr(n=t.effectiveType||t.type))return this.valueHandler(t,r);var o=(i=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?r.get(t.name).push(o):r.set(t.name,o),t.isReference?(U(o,{element:r}),this.context.addReference(o)):o.$parent=r),i},ri.prototype=Object.create(ni.prototype),ri.prototype.createElement=function(e){var t=e.name,n=yr(t),r=this.model,i=this.type,o=r.getPackage(n.prefix),a=o&&Gr(n,o)||t;if(!i.hasType(a))throw Wr("unexpected element <"+e.originalName+">");return ni.prototype.createElement.call(this,e)},ii.prototype=Object.create(ti.prototype),ii.prototype.createElement=function(e){var t=e.name,n=yr(t).prefix,r=e.ns[n+"$uri"],i=e.attributes;return this.model.createAny(t,r,i)},ii.prototype.handleChild=function(e){var t=new ii(this.model,"Element",this.context).handleNode(e),n=this.element,r=t.element;return void 0!==r&&((n.$children=n.$children||[]).push(r),r.$parent=n),t},ii.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},oi.prototype.fromXML=function(e,t,n){var r=t.rootHandler;t instanceof ni?(r=t,t={}):"string"==typeof t?(r=this.handler(t),t={}):"string"==typeof r&&(r=this.handler(r));var i=this.model,o=this.lax,a=new Yr(U({},t,{rootHandler:r})),s=new Nr({proxy:!0}),l=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function c(e,t,n){var r=t(),i=r.line,o=r.column,s=r.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var l="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+i+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:l,error:e}),!0;throw Wr(l)}function p(e,t){return c(e,t,!0)}r.context=a,l.push(r);var u=/^<\?xml /i,d=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function h(e,t){try{l.peek().handleText(e)}catch(e){p(e,t)}}var f=i.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return s.ns(f).on("openTag",(function(e,t,n,r){var i=e.attrs||{},a=Object.keys(i).reduce((function(e,n){var r=t(i[n]);return e[n]=r,e}),{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,o)&&l.push(new Jr)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},r)})).on("question",(function(e){if(u.test(e)){var t=d.exec(e),n=t&&t[1];n&&!m.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){l.pop().handleEnd()})).on("cdata",h).on("text",(function(e,t,n){!function(e,t){e.trim()&&h(e,t)}(t(e),n)})).on("error",c).on("warn",p),new Promise((function(t,n){var i;try{s.parse(e),function(){var e,t,n=a.elementsById,r=a.references;for(e=0;t=r[e];e++){var i=t.element,o=n[t.id],s=Kr(i).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var l=i.get(s.name),c=l.indexOf(t);-1===c&&(c=l.length),o?l[c]=o:l.splice(c,1)}else i.set(s.name,o)}}()}catch(e){i=e}var o=r.element;i||o||(i=Wr("failed to parse document as <"+r.type.$descriptor.name+">"));var l=a.warnings,c=a.references,p=a.elementsById;return i?(i.warnings=l,n(i)):t({rootElement:o,elementsById:p,references:c,warnings:l})}))},oi.prototype.handler=function(e){return new ri(this.model,e)};var ai=/<|>|'|"|&|\n\r|\n/g,si=/<|>|&/g;function li(e){var t={},n={},r={},i=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?i.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},this.logUsed=function(t){var n=t.uri,i=this.getNSKey(t);r[i]=this.byUri(n),e&&e.logUsed(t)},this.getUsed=function(e){var t=this;return[].concat(i,o).filter((function(e){var n=t.getNSKey(e);return r[n]}))}}function ci(e,t){return Fr(t)?(n=e).charAt(0).toLowerCase()+n.slice(1):e;var n}function pi(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ui(e){return v(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var di={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},mi={"<":"lt",">":"gt","&":"amp"};function hi(e,t,n){return(e=v(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function fi(e){this.tagName=e}function gi(){}function vi(e){this.tagName=e}function yi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function bi(e,t){yi.call(this,e,t)}function xi(){this.value="",this.write=function(e){this.value+=e}}function wi(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function _i(e){return e=U({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var r=n||new xi,i=new wi(r,e.format);if(e.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new yi).build(t).serializeTo(i),!n)return r.value}}}function Ei(e,t){Pr.call(this,e,t)}fi.prototype.build=function(e){return this.element=e,this},fi.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},gi.prototype.serializeValue=gi.prototype.serializeTo=function(e){e.append(this.escape?hi(this.value,si,mi):this.value)},gi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(si)&&(this.escape=!0),this},pi(vi,gi),vi.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},yi.prototype.build=function(e){this.element=e;var t,n,r=e.$descriptor,i=this.propertyDescriptor,o=r.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=i?this.nsPropertyTagName(i):this.nsTagName(r),this.tagName=this.addTagName(this.ns),o||(n=function(e){return _(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!b(e,n))return!1;var r=e[n];return r!==t.default&&null!==r&&(!t.isMany||r.length)}))}(e),this.parseAttributes(_(n,(function(e){return e.isAttr}))),this.parseContainments(function(e){return _(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},yi.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?U({localName:t.ns.localName},e):U({localName:ci(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},yi.prototype.nsPropertyTagName=function(e){return function(e,t){return U({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},yi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},yi.prototype.nsAttributeName=function(e){var t;if(t=v(e)?yr(e):e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:U({localName:t.localName},n)},yi.prototype.parseGeneric=function(e){var t=this,n=this.body,r=[];return E(e,(function(i,o){"$body"===o?n.push((new gi).build({type:"String"},i)):"$children"===o?E(i,(function(e){n.push(new yi(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,i)&&r.push({name:o,value:i})})),r},yi.prototype.parseNsAttribute=function(e,t,n){var r,i=e.$model,o=yr(t);if("xmlns"===o.prefix&&(r={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},yi.prototype.parseNsAttributes=function(e,t){var n=this,r=e.$attrs,i=[];return E(r,(function(t,r){var o=n.parseNsAttribute(e,r,t);o&&i.push(o)})),i},yi.prototype.parseGenericAttributes=function(e,t){var n=this;E(t,(function(t){if(t.name!==Hr)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},yi.prototype.parseContainments=function(e){var t=this,n=this.body,r=this.element;E(e,(function(e){var i=r.get(e.name),o=e.isReference;if(e.isMany||(i=[i]),e.isBody)n.push((new gi).build(e,i[0]));else if(vr(e.type))E(i,(function(r){n.push(new vi(t.addTagName(t.nsPropertyTagName(e))).build(e,r))}));else if(o)E(i,(function(r){n.push(new fi(t.addTagName(t.nsPropertyTagName(e))).build(r))}));else{var a=Ur(e),s=function(e){return"property"===qr(e)}(e);E(i,(function(r){var i;i=a?new bi(t,e):s?new yi(t,e):new yi(t),n.push(i.build(r))}))}}))},yi.prototype.getNamespaces=function(e){var t,n=this.namespaces,r=this.parent;return n||(t=r&&r.getNamespaces(),e||!t?this.namespaces=n=new li(t):n=t),n},yi.prototype.logNamespace=function(e,t,n){var r=this.getNamespaces(n),i=e.uri,o=e.prefix;return r.byUri(i)&&!n||r.add(e,t),r.mapPrefix(o,i),e},yi.prototype.logNamespaceUsed=function(e,t){var n,r,i,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,l=e.uri;if(!s&&!l)return{localName:e.localName};if(i=$r[s]||o&&(o.getPackage(s)||{}).uri,!(l=l||i||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(l))){for(n=s,r=1;a.uriByPrefix(n);)n=s+"_"+r++;e=this.logNamespace({prefix:n,uri:l},i===l)}return s&&a.mapPrefix(s,l),e},yi.prototype.parseAttributes=function(e){var t=this,n=this.element;E(e,(function(e){var r=n.get(e.name);if(e.isReference)if(e.isMany){var i=[];E(r,(function(e){i.push(e.id)})),r=i.join(" ")}else r=r.id;t.addAttribute(t.nsAttributeName(e),r)}))},yi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ui(e)},yi.prototype.addAttribute=function(e,t){var n=this.attrs;v(t)&&(t=hi(t,ai,di)),n.push({name:e,value:t})},yi.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return e.getUsed().filter((function(e){return"xml"!==e.prefix})).map((function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}}))}(n).concat(t)),E(t,(function(t){e.append(" ").append(ui(t.name)).append('="').append(t.value).append('"')}))},yi.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==gi;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),E(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},pi(bi,yi),bi.prototype.parseNsAttributes=function(e){var t=yi.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var r=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var i=e.$model.getPackage(r.uri),o=i.xml&&i.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Hr),(r.prefix?r.prefix+":":"")+o+n.ns.localName),t},bi.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},Ei.prototype=Object.create(Pr.prototype),Ei.prototype.fromXML=function(e,t,n){v(t)||(n=t,t="bpmn:Definitions");var r=new oi(U({model:this,lax:!0},n)),i=r.handler(t);return r.fromXML(e,i)},Ei.prototype.toXML=function(e,t){var n=new _i(t);return new Promise((function(t,r){try{return t({xml:n.toXML(e)})}catch(e){return r(e)}}))};var Pi={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",prefix:"bpmn",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],enumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",prefix:"bpmndi",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],enumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[]},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",prefix:"dc",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",prefix:"di",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],associations:[],xml:{tagAlias:"lowerCase"}},bioc:{name:"bpmn.io colors for BPMN",uri:"http://bpmn.io/schema/bpmn/biocolor/1.0",prefix:"bioc",types:[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]},color:{name:"BPMN in Color",uri:"http://www.omg.org/spec/BPMN/non-normative/color/1.0",prefix:"color",types:[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}};function Si(e,t){return new Ei(U({},Pi,e),t)}function Ci(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Oi(e){return function(){if(!window.Promise)throw new Error("Promises is not supported in this environment. Please polyfill Promise.");var t=arguments.length;if(!(t>=1&&g(arguments[t-1])))return e.apply(this,arguments);var n=arguments[t-1];console.warn(new Error("Passing callbacks to "+e.name+" is deprecated and will be removed in a future major release. Please switch to promises: https://bpmn.io/l/moving-to-promises.html"));var r=Array.prototype.slice.call(arguments,0,-1);e.apply(this,r).then((function(e){var t=Object.keys(e)[0];return n(null,e[t])}),(function(e){return n(e,e.warnings)}))}}function ki(e){b(e,"di")||Object.defineProperty(e,"di",{get:function(){throw new Error("Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472")}})}function Mi(e,t){return e.$instanceOf(t)}function Ai(e,t){var n={},r=[],i={};function o(e,t){return function(n){e(n,t)}}function a(e){n[e.id]=e}function s(n,r){try{var o=i[n.id]&&function(n,r){if(n.gfx)throw new Error(t("already rendered {element}",{element:Ci(n)}));return e.element(n,i[n.id],r)}(n,r);return a(n),o}catch(e){l(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:Ci(n)})),console.error(e)}}function l(t,n){e.error(t,n)}function c(e){var n=e.bpmnElement;n?i[n.id]?l(t("multiple DI elements defined for {element}",{element:Ci(n)}),{element:n}):(i[n.id]=e,ki(n)):l(t("no bpmnElement referenced in {element}",{element:Ci(e)}),{element:e})}function p(e){var t;c(t=e.plane),E(t.planeElement,u)}function u(e){c(e)}function d(){for(;r.length;)r.shift()()}function m(e,t){M(e,t),w(e.ioSpecification,t),b(e.artifacts,t),a(e)}function h(e,t){s(e,t)}function f(e,t){s(e,t)}function g(e,t){s(e,t)}function v(e,t){s(e,t)}function y(e,t){s(e,t)}function b(e,t){E(e,(function(e){Mi(e,"bpmn:Association")?r.push((function(){y(e,t)})):y(e,t)}))}function w(e,t){e&&(E(e.dataInputs,o(g,t)),E(e.dataOutputs,o(v,t)))}function P(e,t){M(e,t),b(e.artifacts,t)}function S(e,t){var n=s(e,t);Mi(e,"bpmn:SubProcess")&&P(e,n||t),Mi(e,"bpmn:Activity")&&w(e.ioSpecification,t),r.push((function(){E(e.dataInputAssociations,o(f,t)),E(e.dataOutputAssociations,o(f,t))}))}function C(e,t){s(e,t)}function O(e,t){r.push((function(){var n=s(e,t);e.childLaneSet&&k(e.childLaneSet,n||t),function(e){E(e.flowNodeRef,(function(t){var n=t.get("lanes");n&&n.push(e)}))}(e)}))}function k(e,t){E(e.lanes,o(O,t))}function M(e,n){!function(e,n){E(e,(function(e){Mi(e,"bpmn:SequenceFlow")?r.push((function(){!function(e,t){s(e,t)}(e,n)})):Mi(e,"bpmn:BoundaryEvent")?r.unshift((function(){S(e,n)})):Mi(e,"bpmn:FlowNode")?S(e,n):Mi(e,"bpmn:DataObject")||(Mi(e,"bpmn:DataStoreReference")||Mi(e,"bpmn:DataObjectReference")?C(e,n):l(t("unrecognized flowElement {element} in context {context}",{element:Ci(e),context:n?Ci(n.businessObject):"null"}),{element:e,context:n}))}))}(e.flowElements,n),e.laneSets&&function(e,t){E(e,o(k,t))}(e.laneSets,n)}function A(e,t){var n=s(e,t),r=e.processRef;r&&m(r,n||t)}return{handleDeferred:d,handleDefinitions:function(a,s){var u=a.diagrams;if(s&&-1===u.indexOf(s))throw new Error(t("diagram not part of bpmn:Definitions"));if(!s&&u&&u.length&&(s=u[0]),!s)throw new Error(t("no diagram to display"));i={},p(s);var f=s.plane;if(!f)throw new Error(t("no plane for {element}",{element:Ci(s)}));var g=f.bpmnElement;if(!g){if(!(g=function(e){return x(e.rootElements,(function(e){return Mi(e,"bpmn:Process")||Mi(e,"bpmn:Collaboration")}))}(a)))throw new Error(t("no process or collaboration to display"));l(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:Ci(f),rootElement:Ci(g)})),f.bpmnElement=g,c(f)}var v,y,w=function(t,n){return e.root(t,i[t.id],n)}(g,f);if(Mi(g,"bpmn:Process")||Mi(g,"bpmn:SubProcess"))m(g,w);else{if(!Mi(g,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:Ci(f),rootElement:Ci(g)}));y=w,E((v=g).participants,o(A,y)),b(v.artifacts,y),r.push((function(){!function(e,t){E(e,o(h,t))}(v.messageFlows,y)})),function(e,t){_(e,(function(e){return!n[e.id]&&Mi(e,"bpmn:Process")&&e.laneSets})).forEach(o(m,t))}(a.rootElements,w)}d()},handleSubProcess:P,registerDi:c}}function Ti(e,t){var n=Di(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Ri(e,t){return O(t,(function(t){return Ti(e,t)}))}function Di(e){return e&&e.businessObject||e}function Bi(e){return e&&e.di}var ji=Object.freeze({__proto__:null,is:Ti,isAny:Ri,getBusinessObject:Di,getDi:Bi});function zi(e,t,n){var r,i,o,a,s=[];function l(e,t){var n=new Ai({root:function(e,t){return r.add(e,t)},element:function(e,t,n){return r.add(e,t,n)},error:function(e,t){s.push({message:e,context:t})}},o);t=t||e.diagrams&&e.diagrams[0];var i=function(e,t){if(!t)return;var n,r=t.plane.bpmnElement,i=r;Ti(r,"bpmn:Process")||Ti(r,"bpmn:Collaboration")||(i=function(e){var t=e;for(;t;){if(Ti(t,"bpmn:Process"))return t;t=t.$parent}}(r));n=Ti(i,"bpmn:Collaboration")?i:x(e.rootElements,(function(e){if(Ti(e,"bpmn:Collaboration"))return x(e.participants,(function(e){return e.processRef===i}))}));var o=[i];n&&(o=k(n.participants,(function(e){return e.processRef}))).push(n);var a=Ii(o),s=[t],l=[r];return E(e.diagrams,(function(e){var t=e.plane.bpmnElement;-1!==a.indexOf(t)&&-1===l.indexOf(t)&&(s.push(e),l.push(t))})),s}(e,t);if(!i)throw new Error(o("no diagram to display"));E(i,(function(t){n.handleDefinitions(e,t)}));var l=t.plane.bpmnElement.id;a.setRootElement(a.findRoot(l+"_plane")||a.findRoot(l))}return new Promise((function(c,p){try{return r=e.get("bpmnImporter"),i=e.get("eventBus"),o=e.get("translate"),a=e.get("canvas"),i.fire("import.render.start",{definitions:t}),l(t,n),i.fire("import.render.complete",{error:undefined,warnings:s}),c({warnings:s})}catch(e){return e.warnings=s,p(e)}}))}function Ii(e){var t=[];return E(e,(function(e){e&&(t.push(e),t=t.concat(Ii(e.flowElements)))})),t}var Li,Vi='<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>',Ni={verticalAlign:"middle"},Fi={color:"#404040"},$i={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Hi={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},qi={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"};function Ui(){Li||(re(Li=Ee('<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link"><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></a><span>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>'),$i),re(Ce("svg",Li),Ni),re(Ce(".backdrop",Li),Hi),re(Ce(".notice",Li),qi),re(Ce(".link",Li),Fi,{margin:"15px 20px 15px 10px",alignSelf:"center"}),_e.bind(Li,".backdrop","click",(function(e){document.body.removeChild(Li)}))),document.body.appendChild(Li)}function Gi(e){var t,n;e=U({},Ki,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,re(Ce("svg",n=Ee('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Vi+"</a>")),Ni),re(n,Fi,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),t.appendChild(n),be.bind(n,"click",(function(e){Ui(),e.preventDefault()})),this._init(this._container,this._moddle,e)}function Wi(e,t){return e.warnings=t,e}i(Gi,pr),Gi.prototype.importXML=Oi((function(e,t){var n=this;return new Promise((function(r,i){e=n._emit("import.parse.start",{xml:e})||e,n._moddle.fromXML(e,"bpmn:Definitions").then((function(e){var o,a,s=e.rootElement,l=e.references,c=e.warnings,p=e.elementsById;s=n._emit("import.parse.complete",(o={error:null,definitions:s,elementsById:p,references:l,warnings:c},a=n.get("eventBus").createEvent(o),Object.defineProperty(a,"context",{enumerable:!0,get:function(){return console.warn(new Error("import.parse.complete <context> is deprecated and will be removed in future library versions")),{warnings:o.warnings,references:o.references,elementsById:o.elementsById}}}),a))||s,n.importDefinitions(s,t).then((function(e){var t=[].concat(c,e.warnings||[]);return n._emit("import.done",{error:null,warnings:t}),r({warnings:t})})).catch((function(e){var t=[].concat(c,e.warnings||[]);return n._emit("import.done",{error:e,warnings:t}),i(Wi(e,t))}))})).catch((function(e){return n._emit("import.parse.complete",{error:e}),e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]);return e}(e),n._emit("import.done",{error:e,warnings:e.warnings}),i(e)}))}))})),Gi.prototype.importDefinitions=Oi((function(e,t){var n=this;return new Promise((function(r,i){n._setDefinitions(e),n.open(t).then((function(e){var t=e.warnings;return r({warnings:t})})).catch((function(e){return i(e)}))}))})),Gi.prototype.open=Oi((function(e){var t=this._definitions,n=e,r=this;return new Promise((function(i,o){if(!t){var a=new Error("no XML imported");return o(Wi(a,[]))}if("string"==typeof e&&!(n=function(e,t){if(!t)return null;return x(e.diagrams,(function(e){return e.id===t}))||null}(t,e))){var s=new Error("BPMNDiagram <"+e+"> not found");return o(Wi(s,[]))}try{r.clear()}catch(e){return o(Wi(e,[]))}zi(r,t,n).then((function(e){var t=e.warnings;return i({warnings:t})})).catch((function(e){return o(e)}))}))})),Gi.prototype.saveXML=Oi((function(e){e=e||{};var t=this,n=this._definitions;return new Promise((function(r){if(!n)return r({error:new Error("no definitions loaded")});n=t._emit("saveXML.start",{definitions:n})||n,t._moddle.toXML(n,e).then((function(e){var n=e.xml;return n=t._emit("saveXML.serialized",{xml:n})||n,r({xml:n})}))})).catch((function(e){return{error:e}})).then((function(e){t._emit("saveXML.done",e);var n=e.error;return n?Promise.reject(n):e}))})),Gi.prototype.saveSVG=Oi((function(e){var t=this;return new Promise((function(e,n){var r,i;t._emit("saveSVG.start");try{var o=t.get("canvas"),a=o.getActiveLayer(),s=Ce("defs",o._svg),l=nt(a),c=s?"<defs>"+nt(s)+"</defs>":"",p=a.getBBox();r='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+p.width+'" height="'+p.height+'" viewBox="'+p.x+" "+p.y+" "+p.width+" "+p.height+'" version="1.1">'+c+l+"</svg>"}catch(e){i=e}return t._emit("saveSVG.done",{error:i,svg:r}),i?n(i):e({svg:r})}))})),Gi.prototype._setDefinitions=function(e){this._definitions=e},Gi.prototype.getModules=function(){return this._modules},Gi.prototype.clear=function(){this.getDefinitions()&&pr.prototype.clear.call(this)},Gi.prototype.destroy=function(){pr.prototype.destroy.call(this),ke(this._container)},Gi.prototype.on=function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)},Gi.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gi.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=Ce(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gi.prototype.getDefinitions=function(){return this._definitions},Gi.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gi.prototype._init=function(e,t,n){var r=n.modules||this.getModules(),i=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],r,i),a=U(Y(n,["additionalModules"]),{canvas:U({},n.canvas,{container:e}),modules:o});pr.call(this,a),n&&n.container&&this.attachTo(n.container)},Gi.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gi.prototype._createContainer=function(e){var t=Ee('<div class="bjs-container"></div>');return re(t,{width:Yi(e.width),height:Yi(e.height),position:e.position}),t},Gi.prototype._createModdle=function(e){return new Si(U({},this._moddleExtensions,e.moddleExtensions))},Gi.prototype._modules=[];var Ki={width:"100%",height:"100%",position:"relative"};function Yi(e){return e+(f(e)?"px":"")}function Xi(e){Gi.call(this,e),this.on("import.parse.complete",(function(e){e.error||this._collectIds(e.definitions,e.elementsById)}),this),this.on("diagram.destroy",(function(){this.get("moddle").ids.clear()}),this)}function Ji(e,t){return!Ti(e,"bpmn:CallActivity")&&(Ti(e,"bpmn:SubProcess")?!(!(t=t||Bi(e))||!Ti(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded:!Ti(e,"bpmn:Participant")||!!Di(e).processRef)}function Zi(e){return e&&!1!==Di(e).isInterrupting}function Qi(e){return e&&!!Di(e).triggeredByEvent}function eo(e,t){var n=Di(e),r=!1;return n.eventDefinitions&&E(n.eventDefinitions,(function(e){Ti(e,t)&&(r=!0)})),r}function to(e){return Ti(e,"bpmn:FlowElement")||Ti(e,"bpmn:Participant")||Ti(e,"bpmn:Lane")||Ti(e,"bpmn:SequenceFlow")||Ti(e,"bpmn:MessageFlow")||Ti(e,"bpmn:DataInput")||Ti(e,"bpmn:DataOutput")?"name":Ti(e,"bpmn:TextAnnotation")?"text":Ti(e,"bpmn:Group")?"categoryValueRef":void 0}function no(e){var t=e.businessObject,n=to(t);if(n)return"categoryValueRef"===n?function(e){var t=e.categoryValueRef;return t&&t.value||""}(t):t[n]||""}function ro(e,t,n){var r=e.businessObject,i=to(r);return i&&("categoryValueRef"===i?r.categoryValueRef.value=t:r[i]=t),e}i(Xi,Gi),Xi.prototype._createModdle=function(e){var t=Gi.prototype._createModdle.call(this,e);return t.ids=new a([32,36,1]),t},Xi.prototype._collectIds=function(e,t){var n,r=e.$model.ids;for(n in r.clear(),t)r.claim(n,t[n])};var io="hsl(225, 10%, 15%)";function oo(e,t,n){return O(e.eventDefinitions,(function(r){return r.$type===t&&function(e,t){return C(t,(function(t,n){return e[n]==t}))}(e,n)}))}function ao(e){return e.businessObject}function so(e,t){var n=Bi(e);return n.get("color:background-color")||n.get("bioc:fill")||t||"white"}function lo(e,t){var n=Bi(e);return n.get("color:border-color")||n.get("bioc:stroke")||t||io}function co(e,t,n){var r=Bi(e).get("label");return r&&r.get("color:color")||t||lo(e,n)}var po=new a,uo=.95;function mo(e,t,n,r,i,o,a){ft.call(this,t,a);var s=e&&e.defaultFillColor,l=e&&e.defaultStrokeColor,c=e&&e.defaultLabelColor,p=po.next(),u={},d=n.computeStyle;function m(e,t){var n=U({fill:io,strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),r=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=Ge("marker");De(t.element,n),Ae(a,t.element),De(a,{id:e,viewBox:"0 0 20 20",refX:r.x,refY:r.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});var s=Ce("defs",i._svg);s||(s=Ge("defs"),Ae(i._svg,s)),Ae(s,a),u[e]=a}function f(e){return e.replace(/[^0-9a-zA-z]+/g,"_")}function g(e,t,n){var r=e+"-"+f(t)+"-"+f(n)+"-"+p;return u[r]||function(e,t,n,r){if("sequenceflow-end"===t){var i=Ge("path");De(i,{d:"M 1 5 L 11 10 L 1 15 Z"}),m(e,{element:i,ref:{x:11,y:10},scale:.5,attrs:{fill:r,stroke:r}})}if("messageflow-start"===t){var o=Ge("circle");De(o,{cx:6,cy:6,r:3.5}),m(e,{element:o,attrs:{fill:n,stroke:r},ref:{x:6,y:6}})}if("messageflow-end"===t){var a=Ge("path");De(a,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),m(e,{element:a,attrs:{fill:n,stroke:r,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var s=Ge("path");De(s,{d:"M 11 5 L 1 10 L 11 15"}),m(e,{element:s,attrs:{fill:"none",stroke:r,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var l=Ge("path");De(l,{d:"M 1 5 L 11 10 L 1 15"}),m(e,{element:l,attrs:{fill:"none",stroke:r,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var c=Ge("path");De(c,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),m(e,{element:c,attrs:{fill:n,stroke:r},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var p=Ge("path");De(p,{d:"M 6 4 L 10 16"}),m(e,{element:p,attrs:{stroke:r},ref:{x:0,y:10},scale:.5})}}(r,e,t,n),"url(#"+r+")"}function v(e,t,n,r,i){h(r)&&(i=r,r=0),r=r||0,"none"===(i=d(i,{stroke:io,strokeWidth:2,fill:"white"})).fill&&delete i.fillOpacity;var o=t/2,a=n/2,s=Ge("circle");return De(s,{cx:o,cy:a,r:Math.round((t+n)/4-r)}),De(s,i),Ae(e,s),s}function y(e,t,n,r,i,o){h(i)&&(o=i,i=0),i=i||0,o=d(o,{stroke:io,strokeWidth:2,fill:"white"});var a=Ge("rect");return De(a,{x:i,y:i,width:t-2*i,height:n-2*i,rx:r,ry:r}),De(a,o),Ae(e,a),a}function b(e,t,n){var r=yt(t,n=d(n,["no-fill"],{stroke:io,strokeWidth:2,fill:"none"}));return Ae(e,r),r}function x(e,t,n){n=d(n,["no-fill"],{strokeWidth:2,stroke:io});var r=Ge("path");return De(r,{d:t}),De(r,n),Ae(e,r),r}function w(e,t,n,r){return x(t,n,U({"data-marker":e},r))}function _(e){return A[e]}function P(e){return function(t,n){return _(e)(t,n)}}function S(e,t){var n=ao(e),r=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(n);return n.eventDefinitions&&n.eventDefinitions.length>1?n.parallelMultiple?_("bpmn:ParallelMultipleEventDefinition")(t,e,r):_("bpmn:MultipleEventDefinition")(t,e,r):oo(n,"bpmn:MessageEventDefinition")?_("bpmn:MessageEventDefinition")(t,e,r):oo(n,"bpmn:TimerEventDefinition")?_("bpmn:TimerEventDefinition")(t,e,r):oo(n,"bpmn:ConditionalEventDefinition")?_("bpmn:ConditionalEventDefinition")(t,e):oo(n,"bpmn:SignalEventDefinition")?_("bpmn:SignalEventDefinition")(t,e,r):oo(n,"bpmn:EscalationEventDefinition")?_("bpmn:EscalationEventDefinition")(t,e,r):oo(n,"bpmn:LinkEventDefinition")?_("bpmn:LinkEventDefinition")(t,e,r):oo(n,"bpmn:ErrorEventDefinition")?_("bpmn:ErrorEventDefinition")(t,e,r):oo(n,"bpmn:CancelEventDefinition")?_("bpmn:CancelEventDefinition")(t,e,r):oo(n,"bpmn:CompensateEventDefinition")?_("bpmn:CompensateEventDefinition")(t,e,r):oo(n,"bpmn:TerminateEventDefinition")?_("bpmn:TerminateEventDefinition")(t,e,r):null}function C(e,t,n){n=U({size:{width:100}},n);var r=o.createText(t||"",n);return Le(r).add("djs-label"),Ae(e,r),r}function O(e,t,n){return C(e,ao(t).name,{box:t,align:n,padding:5,style:{fill:co(t,c,l)}})}function k(e,t,n){rr(C(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:co(n,c,l)}}),0,-(-1*n.height),270)}function M(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,r=1;r<t.length;r++)n+="L"+t[r].x+","+t[r].y+" ";return n}var A=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=uo),v(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:so(t,s),stroke:lo(t,l)};ao(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:so(t,s),stroke:lo(t,l)});var r=_("bpmn:Event")(e,t,n);return S(t,e),r},"bpmn:MessageEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?lo(t,l):so(t,s),stroke:n?so(t,s):lo(t,l)})},"bpmn:TimerEventDefinition":function(e,t){var n=v(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:so(t,s),stroke:lo(t,l)});x(e,r.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:lo(t,l)});for(var i=0;i<12;i++){var o=r.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;x(e,o,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*i+","+t.height/2+","+a+")",stroke:lo(t,l)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:ConditionalEventDefinition":function(e,t){return x(e,r.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:lo(t,l)})},"bpmn:LinkEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:ErrorEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:CancelEventDefinition":function(e,t,n){var i=x(e,r.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)});return or(i,45),i},"bpmn:CompensateEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:SignalEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:MultipleEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?lo(t,l):"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return x(e,r.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)})},"bpmn:EndEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:4,fill:so(t,s),stroke:lo(t,l)});return S(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return v(e,t.width,t.height,8,{strokeWidth:4,fill:lo(t,l),stroke:lo(t,l)})},"bpmn:IntermediateEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)});return v(e,t.width,t.height,3,{strokeWidth:1,fill:so(t,"none"),stroke:lo(t,l)}),S(t,e),n},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=uo),y(e,t.width,t.height,10,n)},"bpmn:Task":function(e,t){var n={fill:so(t,s),stroke:lo(t,l)},r=_("bpmn:Activity")(e,t,n);return O(e,t,"center-middle"),T(e,t),r},"bpmn:ServiceTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)}),x(e,r.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:so(t,s)}),x(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)}),n},"bpmn:UserTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:so(t,s),stroke:lo(t,l)}),x(e,r.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:so(t,s),stroke:lo(t,l)}),x(e,r.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:lo(t,l),stroke:lo(t,l)}),n},"bpmn:ManualTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:so(t,s),stroke:lo(t,l)}),n},"bpmn:SendTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:lo(t,l),stroke:so(t,s)}),n},"bpmn:ReceiveTask":function(e,t){var n,i=ao(t),o=_("bpmn:Task")(e,t);return i.instantiate?(v(e,28,28,4.4,{strokeWidth:1}),n=r.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):n=r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(e,n,{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)}),o},"bpmn:ScriptTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:lo(t,l)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=_("bpmn:Task")(e,t);return De(x(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{strokeWidth:1,fill:so(t,"#aaaaaa"),stroke:lo(t,l)}),De(x(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:lo(t,l)}),n},"bpmn:SubProcess":function(e,t,n){n=U({fill:so(t,s),stroke:lo(t,l)},n);var r=_("bpmn:Activity")(e,t,n),i=Ji(t);return Qi(t)&&De(r,{strokeDasharray:"1,2"}),O(e,t,i?"center-top":"center-middle"),i?T(e,t):T(e,t,["SubProcessMarker"]),r},"bpmn:AdHocSubProcess":function(e,t){return _("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var r=_("bpmn:SubProcess")(e,t),i=n.style(["no-fill","no-events"],{stroke:lo(t,l)});return y(e,t.width,t.height,8,3,i),r},"bpmn:CallActivity":function(e,t){return _("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:uo,fill:so(t,s),stroke:lo(t,l)},r=_("bpmn:Lane")(e,t,n);Ji(t)?(b(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:lo(t,l)}),k(e,ao(t).name,t)):C(e,ao(t).name,{box:t,align:"center-middle",style:{fill:co(t,c,l)}});return!!ao(t).participantMultiplicity&&_("ParticipantMultiplicityMarker")(e,t),r},"bpmn:Lane":function(e,t,n){var r=y(e,t.width,t.height,0,U({fill:so(t,s),fillOpacity:.35,stroke:lo(t,l)},n)),i=ao(t);"bpmn:Lane"===i.$type&&k(e,i.name,t);return r},"bpmn:InclusiveGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return v(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:so(t,s),stroke:lo(t,l)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=_("bpmn:Gateway")(e,t),i=r.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Bi(t).isMarkerVisible&&x(e,i,{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)}),n},"bpmn:ComplexGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return x(e,r.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)}),n},"bpmn:ParallelGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return x(e,r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)}),n},"bpmn:EventBasedGateway":function(e,t){var n=ao(t),i=_("bpmn:Gateway")(e,t);v(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:lo(t,l)});var o=n.eventGatewayType,a=!!n.instantiate;if("Parallel"===o){var s=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});De(x(e,s),{strokeWidth:1,fill:"none"})}else if("Exclusive"===o){if(!a)De(v(e,t.width,t.height,.26*t.height),{strokeWidth:1,fill:"none",stroke:lo(t,l)});!function(){var n=r.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),i={strokeWidth:2,fill:so(t,"none"),stroke:lo(t,l)};x(e,n,i)}()}return i},"bpmn:Gateway":function(e,t){var n={fill:so(t,s),fillOpacity:uo,stroke:lo(t,l)};return function(e,t,n,r){var i=t/2,o=n/2,a=[{x:i,y:0},{x:t,y:o},{x:i,y:n},{x:0,y:o}].map((function(e){return e.x+","+e.y})).join(" ");r=d(r,{stroke:io,strokeWidth:2,fill:"white"});var s=Ge("polygon");return De(s,{points:a}),De(s,r),Ae(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,r=M(t),i=so(t,s),o=lo(t,l),a=x(e,r,{strokeLinejoin:"round",markerEnd:g("sequenceflow-end",i,o),stroke:lo(t,l)}),c=ao(t);return t.source&&(n=t.source.businessObject,c.conditionExpression&&n.$instanceOf("bpmn:Activity")&&De(a,{markerStart:g("conditional-flow-marker",i,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===c&&De(a,{markerStart:g("conditional-default-flow-marker",i,o)})),a},"bpmn:Association":function(e,t,n){var r=ao(t),i=so(t,s),o=lo(t,l);return n=U({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:lo(t,l)},n||{}),"One"!==r.associationDirection&&"Both"!==r.associationDirection||(n.markerEnd=g("association-end",i,o)),"Both"===r.associationDirection&&(n.markerStart=g("association-start",i,o)),b(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=so(t,s),r=lo(t,l);return _("bpmn:Association")(e,t,{markerEnd:g("association-end",n,r)})},"bpmn:DataOutputAssociation":function(e,t){var n=so(t,s),r=lo(t,l);return _("bpmn:Association")(e,t,{markerEnd:g("association-end",n,r)})},"bpmn:MessageFlow":function(e,t){var n=ao(t),i=Bi(t),o=so(t,s),a=lo(t,l),p=x(e,M(t),{markerEnd:g("messageflow-end",o,a),markerStart:g("messageflow-start",o,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:lo(t,l)});if(n.messageRef){var u=p.getPointAtLength(p.getTotalLength()/2),d=r.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),m={strokeWidth:1};"initiating"===i.messageVisibleKind?(m.fill="white",m.stroke=io):(m.fill="#888",m.stroke="white");var h=x(e,d,m),f=C(e,n.messageRef.name,{align:"center-top",fitBox:!0,style:{fill:lo(t,c)}}),v=h.getBBox(),y=f.getBBox();rr(f,u.x-y.width/2,u.y+v.height/2+10,0)}return p},"bpmn:DataObject":function(e,t){var n=x(e,r.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:so(t,s),fillOpacity:uo,stroke:lo(t,l)});return function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}(ao(t))&&function(e,t){var n=(t.height-18)/t.height,i=r.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.33,my:n}});x(e,i,{strokeWidth:2})}(e,t),n},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=r.getRawPath("DATA_ARROW"),i=_("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1}),i},"bpmn:DataOutput":function(e,t){var n=r.getRawPath("DATA_ARROW"),i=_("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1,fill:io}),i},"bpmn:DataStoreReference":function(e,t){return x(e,r.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:so(t,s),fillOpacity:uo,stroke:lo(t,l)})},"bpmn:BoundaryEvent":function(e,t){var n=ao(t).cancelActivity,r={strokeWidth:1,fill:so(t,s),stroke:lo(t,l)};n||(r.strokeDasharray="6",r.strokeLinecap="round");var i=U({},r,{fillOpacity:1}),o=U({},r,{fill:"none"}),a=_("bpmn:Event")(e,t,i);return v(e,t.width,t.height,3,o),S(t,e),a},"bpmn:Group":function(e,t){return y(e,t.width,t.height,10,{stroke:lo(t,l),strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return function(e,t){var n={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return C(e,no(t),{box:n,fitBox:!0,style:U({},o.getExternalStyle(),{fill:co(t,c,l)})})}(e,t)},"bpmn:TextAnnotation":function(e,t){var n=y(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return x(e,r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:lo(t,l)}),C(e,ao(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:co(t,c,l)}}),n},ParticipantMultiplicityMarker:function(e,t){w("participant-multiplicity",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}}),{strokeWidth:2,fill:so(t,s),stroke:lo(t,l)})},SubProcessMarker:function(e,t){ir(y(e,14,14,0,{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)}),t.width/2-7.5,t.height-20),w("sub-process",e,r.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}}),{fill:so(t,s),stroke:lo(t,l)})},ParallelMarker:function(e,t,n){w("parallel",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.parallel)/t.width,my:(t.height-20)/t.height}}),{fill:so(t,s),stroke:lo(t,l)})},SequentialMarker:function(e,t,n){w("sequential",e,r.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.seq)/t.width,my:(t.height-19)/t.height}}),{fill:so(t,s),stroke:lo(t,l)})},CompensationMarker:function(e,t,n){w("compensation",e,r.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)})},LoopMarker:function(e,t,n){w("loop",e,r.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:so(t,s),stroke:lo(t,l),strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){w("adhoc",e,r.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)})}};function T(e,t,n){var r,i=ao(t),o=n&&-1!==n.indexOf("SubProcessMarker");r=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},E(n,(function(n){_(n)(e,t,r)})),i.isForCompensation&&_("CompensationMarker")(e,t,r),"bpmn:AdHocSubProcess"===i.$type&&_("AdhocMarker")(e,t,r);var a=i.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&_("LoopMarker")(e,t,r),!1===s&&_("ParallelMarker")(e,t,r),!0===s&&_("SequentialMarker")(e,t,r))}this._drawPath=x,this._renderer=_}i(mo,ft),mo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],mo.prototype.canRender=function(e){return Ti(e,"bpmn:BaseElement")},mo.prototype.drawShape=function(e,t){var n=t.type;return this._renderer(n)(e,t)},mo.prototype.drawConnection=function(e,t){var n=t.type;return this._renderer(n)(e,t)},mo.prototype.getShapePath=function(e){return Ti(e,"bpmn:Event")?(n=(t=e).x+t.width/2,r=t.y+t.height/2,i=t.width/2,gt([["M",n,r],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]])):Ti(e,"bpmn:Activity")?function(e,t){var n=e.x,r=e.y,i=e.width,o=e.height;return gt([["M",n+t,r],["l",i-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-i,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])}(e,10):Ti(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return gt([["M",e.x+t,e.y],["l",t,n],["l",-t,n],["l",-t,-n],["z"]])}(e):function(e){var t=e.x,n=e.y,r=e.width;return gt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])}(e);var t,n,r,i};var ho={width:150,height:50};function fo(e,t){var n;t.textContent=e;try{var r,i=""===e;return t.textContent=i?"dummy":e,r={width:(n=t.getBBox()).width+2*n.x,height:n.height},i&&(r.width=0),r}catch(e){return{width:0,height:0}}}function go(e,t,n){for(var r,i=e.shift(),o=i;;){if((r=fo(o,n)).width=o?r.width:0," "===o||""===o||r.width<Math.round(t)||o.length<2)return vo(e,o,i,r);o=yo(o,r.width,t)}}function vo(e,t,n,r){if(t.length<n.length){var i=n.slice(t.length).trim();e.unshift(i)}return{width:r.width,height:r.height,text:t}}function yo(e,t,n){var r=Math.max(e.length*(n/t),1),i=function(e,t){var n,r=e.split(/(\s|-|\u00AD)/g),i=[],o=0;if(r.length>1)for(;n=r.shift();){if(!(n.length+o<t)){"-"!==n&&"­"!==n||i.pop();break}i.push(n),o+=n.length}var a=i[i.length-1];return a&&"­"===a&&(i[i.length-1]="-"),i.join("")}(e,r);return i||(i=e.slice(0,Math.max(Math.round(r-1),1))),i}function bo(e){this._config=U({},{size:ho,padding:0,style:{},align:"center-top"},e||{})}bo.prototype.createText=function(e,t){return this.layoutText(e,t).element},bo.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},bo.prototype.layoutText=function(e,t){var n=U({},this._config.size,t.box),r=U({},this._config.style,t.style),i=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return h(e)?U({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(r),l=e.split(/\u00AD?\r?\n/),c=[],p=n.width-o.left-o.right,u=Ge("text");for(De(u,{x:0,y:0}),De(u,r),Ae(function(){var e=document.getElementById("helper-svg");return e||(De(e=Ge("svg"),{id:"helper-svg",width:0,height:0,visibility:"hidden",position:"fixed"}),document.body.appendChild(e)),e}(),u);l.length;)c.push(go(l,p,u));"middle"===i.vertical&&(o.top=o.bottom=0);var d=S(c,(function(e,t,n){return e+(s||t.height)}),0)+o.top+o.bottom,m=S(c,(function(e,t,n){return t.width>e?t.width:e}),0),f=o.top;"middle"===i.vertical&&(f+=(n.height-d)/2),f-=(s||c[0].height)/4;var g=Ge("text");return De(g,r),E(c,(function(e){var t;switch(f+=s||e.height,i.horizontal){case"left":t=o.left;break;case"right":t=(a?m:p)-o.right-e.width;break;default:t=Math.max(((a?m:p)-e.width)/2+o.left,0)}var n=Ge("tspan");De(n,{x:t,y:f}),n.textContent=e.text,Ae(g,n)})),Ne(u),{dimensions:{width:m,height:d},element:g}};function xo(e){var t=U({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,r=U({},t,{fontSize:n},e&&e.externalStyle||{}),i=new bo({style:t});this.getExternalLabelBounds=function(e,t){var n=i.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:r});return{x:Math.round(e.x+e.width/2-n.width/2),y:Math.round(e.y),width:Math.ceil(n.width),height:Math.ceil(n.height)}},this.getTextAnnotationBounds=function(e,n){var r=i.getDimensions(n,{box:e,style:t,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(r.height))}},this.createText=function(e,t){return i.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return r}}xo.$inject=["config.textRenderer"];var wo=/\{([^{}]+)\}/g,_o=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Eo={__init__:["bpmnRenderer"],bpmnRenderer:["type",mo],textRenderer:["type",xo],pathMap:["type",function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,r,i=this.pathMap[e];t.abspos?(n=t.abspos.x,r=t.abspos.y):(n=t.containerWidth*t.position.mx,r=t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var l=t.containerHeight/i.height*t.yScaleFactor,c=t.containerWidth/i.width*t.xScaleFactor,p=0;p<i.heightElements.length;p++)s["y"+p]=i.heightElements[p]*l;for(var u=0;u<i.widthElements.length;u++)s["x"+u]=i.widthElements[u]*c}return o=i.d,a={mx:n,my:r,e:s},String(o).replace(wo,(function(e,t){return function(e,t,n){var r=n;return t.replace(_o,(function(e,t,n,i,o){t=t||i,r&&(t in r&&(r=r[t]),"function"==typeof r&&o&&(r=r()))})),r=(null==r||r==n?e:r)+""}(e,t,a)}))}}]};var Po={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]},So={width:90,height:20};function Co(e){return Ti(e,"bpmn:Event")||Ti(e,"bpmn:Gateway")||Ti(e,"bpmn:DataStoreReference")||Ti(e,"bpmn:DataObjectReference")||Ti(e,"bpmn:DataInput")||Ti(e,"bpmn:DataOutput")||Ti(e,"bpmn:SequenceFlow")||Ti(e,"bpmn:MessageFlow")||Ti(e,"bpmn:Group")}function Oo(e){return Ao(e.label)}function ko(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)],i=function(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)];return{x:n.x+(r.x-n.x)/2,y:n.y+(r.y-n.y)/2}}(e),o=Math.atan((r.y-n.y)/(r.x-n.x)),a=i.x,s=i.y;return Math.abs(o)<Math.PI/2?s-=15:a+=15,{x:a,y:s}}function Mo(e){return e.waypoints?ko(e.waypoints):Ti(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+So.height/2}:{x:e.x+e.width/2,y:e.y+e.height+So.height/2}}function Ao(e){return e&&!!e.labelTarget}function To(e,t,n){return U({id:e.id,type:e.$type,businessObject:e,di:t},n)}function Ro(e,t,n){var r=e.waypoint;return!r||r.length<2?[Sn(t),Sn(n)]:r.map((function(e){return{x:e.x,y:e.y}}))}function Do(e,t,n,r){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:Ci(n),referenced:Ci(t),property:r}))}function Bo(e,t,n,r,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=r,this._translate=i,this._textRenderer=o}Bo.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],Bo.prototype.add=function(e,t,n){var r,i,o,a=this._translate;if(Ti(t,"bpmndi:BPMNPlane")){var s=Ti(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};r=this._elementFactory.createRoot(To(e,t,s)),this._canvas.addRootElement(r)}else if(Ti(t,"bpmndi:BPMNShape")){var l=!Ji(e,t),c=function(e){return Ti(e,"bpmn:Group")}(e);i=n&&(n.hidden||n.collapsed);var p=t.bounds;r=this._elementFactory.createShape(To(e,t,{collapsed:l,hidden:i,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height),isFrame:c})),Ti(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,r),Ti(e,"bpmn:Lane")&&(o=0),Ti(e,"bpmn:DataStoreReference")&&(function(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}(n,Sn(p))||(n=this._canvas.findRoot(n))),this._canvas.addShape(r,n,o)}else{if(!Ti(t,"bpmndi:BPMNEdge"))throw new Error(a("unknown di {di} for element {semantic}",{di:Ci(t),semantic:Ci(e)}));var u=this._getSource(e),d=this._getTarget(e);i=n&&(n.hidden||n.collapsed),r=this._elementFactory.createConnection(To(e,t,{hidden:i,source:u,target:d,waypoints:Ro(t,u,d)})),Ti(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),Ti(e,"bpmn:SequenceFlow")&&(o=0),this._canvas.addConnection(r,n,o)}return Co(e)&&no(r)&&this.addLabel(e,t,r),this._eventBus.fire("bpmnElement.added",{element:r}),r},Bo.prototype._attachBoundary=function(e,t){var n=this._translate,r=e.attachedToRef;if(!r)throw new Error(n("missing {semantic}#attachedToRef",{semantic:Ci(e)}));var i=this._elementRegistry.get(r.id),o=i&&i.attachers;if(!i)throw Do(n,e,r,"attachedToRef");t.host=i,o||(i.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Bo.prototype.addLabel=function(e,t,n){var r,i,o;return r=function(e,t){var n,r,i,o=e.label;return o&&o.bounds?(i=o.bounds,r={width:Math.max(So.width,i.width),height:i.height},n={x:i.x+i.width/2,y:i.y+i.height/2}):(n=Mo(t),r=So),U({x:n.x-r.width/2,y:n.y-r.height/2},r)}(t,n),(i=no(n))&&(r=this._textRenderer.getExternalLabelBounds(r,i)),o=this._elementFactory.createLabel(To(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!no(n),x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)})),this._canvas.addShape(o,n.parent)},Bo.prototype._getEnd=function(e,t){var n,r,i=e.$type,o=this._translate;if(r=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===i&&(r=r&&r[0]),("source"===t&&"bpmn:DataOutputAssociation"===i||"target"===t&&"bpmn:DataInputAssociation"===i)&&(r=e.$parent),n=r&&this._getElement(r))return n;throw r?Do(o,e,r,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:Ci(e),side:t}))},Bo.prototype._getSource=function(e){return this._getEnd(e,"source")},Bo.prototype._getTarget=function(e){return this._getEnd(e,"target")},Bo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var jo={__depends__:[Eo,{__depends__:[Po],bpmnImporter:["type",Bo]}]};function zo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function Io(e){return e.originalEvent||e.srcEvent}function Lo(e,t){zo(e),zo(Io(e))}function Vo(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function No(e,t){return(Io(e)||e).button===t}function Fo(e){return No(e,0)}function $o(e){var t=Io(e)||e;return!!Fo(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function Ho(e){var t=Io(e)||e;return Fo(e)&&t.shiftKey}function qo(e){return!0}function Uo(e){return Fo(e)||function(e){return No(e,1)}(e)}function Go(e,t,n){var r=this;function i(n,r,i){var o,a;(function(e,t){return!(l[e]||Fo)(t)})(n,r)||(i?a=t.getGraphics(i):(o=r.delegateTarget||r.target)&&(a=o,i=t.get(a)),a&&i&&!1===e.fire(n,{element:i,gfx:a,originalEvent:r})&&(r.stopPropagation(),r.preventDefault()))}var o={};function a(e){return o[e]}var s={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":qo,"element.mousedown":Uo,"element.mouseup":Uo,"element.click":Uo,"element.dblclick":Uo};function c(e,t,n,r){var a=o[n]=function(e){i(n,e)};r&&(l[n]=r),a.$delegate=_e.bind(e,"svg, .djs-element",t,a)}function p(e,t,n){var r=a(n);r&&_e.unbind(e,t,r.$delegate)}e.on("canvas.destroy",(function(e){var t;t=e.svg,E(s,(function(e,n){p(t,n,e)}))})),e.on("canvas.init",(function(e){var t;t=e.svg,E(s,(function(e,n){c(t,n,e)}))})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:r})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:r})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;r.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;r.updateDefaultHit(t,n)}));var u=h("djs-hit djs-hit-stroke"),d=h("djs-hit djs-hit-click-stroke"),m={all:h("djs-hit djs-hit-all"),"click-stroke":d,stroke:u,"no-move":h("djs-hit djs-hit-no-move")};function h(e,t){return t=U({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function f(e,t){var n=m[t];if(!n)throw new Error("invalid hit type <"+t+">");return De(e,n),e}function g(e,t){Ae(e,t)}this.removeHits=function(e){E(Oe(".djs-hit",e),Ne)},this.createDefaultHit=function(e,t){var n,r=e.waypoints,i=e.isFrame;return r?this.createWaypointsHit(t,r):(n=i?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=yt(t);return f(n,"stroke"),g(e,n),n},this.createBoxHit=function(e,t,n){n=U({x:0,y:0},n);var r=Ge("rect");return f(r,t),De(r,n),g(e,r),r},this.updateDefaultHit=function(e,t){var n=Ce(".djs-hit",t);if(n)return e.waypoints?function(e,t){De(e,{points:vt(t)})}(n,e.waypoints):De(n,{width:e.width,height:e.height}),n},this.fire=i,this.triggerMouseEvent=function(e,t,n){var r=s[e];if(!r)throw new Error("unmapped DOM event name <"+e+">");return i(r,t,n)},this.mouseHandler=a,this.registerEvent=c,this.unregisterEvent=p}Go.$inject=["eventBus","elementRegistry","styles"];var Wo={__init__:["interactionEvents"],interactionEvents:["type",Go]};function Ko(e,t,n){this.offset=6;var r=t.cls("djs-outline",["no-fill"]),i=this;function o(e,t){var n=Ge("rect");return De(n,U({x:10,y:10,rx:3,width:100,height:100},r)),Ae(e,n),n}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,r=Ce(".djs-outline",n);r||(r=o(n)),i.updateShapeOutline(r,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,r=Ce(".djs-outline",n);r||(r=o(n)),i.updateConnectionOutline(r,t)}))}Ko.prototype.updateShapeOutline=function(e,t){De(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Ko.prototype.updateConnectionOutline=function(e,t){var n=Pt(t);De(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},Ko.$inject=["eventBus","styles","elementRegistry"];var Yo={__init__:["outline"],outline:["type",Ko]};function Xo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],(function(e){var t=e.element;n.deselect(t)})),e.on(["diagram.clear","root.set"],(function(e){n.select(null)}))}Xo.$inject=["eventBus","canvas"],Xo.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var r=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:t})}},Xo.prototype.get=function(){return this._selectedElements},Xo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Xo.prototype.select=function(e,t){var n=this._selectedElements,r=n.slice();m(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter((function(e){var t=i.findRoot(e);return o===t})),t?E(e,(function(e){-1===n.indexOf(e)&&n.push(e)})):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:n})};var Jo="hover",Zo="selected";function Qo(e,t,n){this._canvas=e;var r=this;function i(t,n){e.addMarker(t,n)}function o(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){i(e.element,Jo)})),t.on("element.out",(function(e){o(e.element,Jo)})),t.on("selection.changed",(function(e){var t=e.oldSelection,n=e.newSelection;E(t,(function(e){-1===n.indexOf(e)&&function(e){o(e,Zo)}(e)})),E(n,(function(e){-1===t.indexOf(e)&&function(e){i(e,Zo)}(e)})),r._updateSelectionOutline(n)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&r._updateSelectionOutline(n.get())}))}function ea(e,t,n,r){e.on("create.end",500,(function(e){var n=e.context,r=n.canExecute,i=n.elements,o=(n.hints||{}).autoSelect;if(r){if(!1===o)return;m(o)?t.select(o):t.select(i.filter(ta))}})),e.on("connect.end",500,(function(e){var n=e.context.connection;n&&t.select(n)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],i=r.get(e.context.shape.id);x(n,(function(e){return i.id===e.id}))||t.select(i)})),e.on("element.click",(function(e){if(Fo(e)){var r=e.element;r===n.getRootElement()&&(r=null);var i=t.isSelected(r),o=t.get().length>1,a=$o(e)||Ho(e);if(i&&o)return a?t.deselect(r):t.select(r);i?t.deselect(r):t.select(r,a)}}))}function ta(e){return!e.hidden}Qo.$inject=["canvas","eventBus","selection"],Qo.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Fe(t);var n=e.length>1;if(Le(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var r=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(Pt(e)),i=Ge("rect");De(i,U({rx:3},r)),Le(i).add("djs-selection-outline"),Ae(t,i)}},ea.$inject=["eventBus","selection","canvas","elementRegistry"];var na={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Wo,Yo],selection:["type",Xo],selectionVisuals:["type",Qo],selectionBehavior:["type",ea]};function ra(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}ra.prototype.next=function(){return this._prefix+ ++this._counter};var ia=new ra("ov");function oa(e,t,n,r){var i,o;this._eventBus=t,this._canvas=n,this._elementRegistry=r,this._ids=ia,this._overlayDefaults=U({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(i=n.getContainer(),re(o=Ee('<div class="djs-overlay-container" />'),{position:"absolute",width:0,height:0}),i.insertBefore(o,i.firstChild),o),this._init()}function aa(e,t,n){re(e,{left:t+"px",top:n+"px"})}function sa(e,t){e.style.display=!1===t?"none":""}function la(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}oa.$inject=["config.overlays","eventBus","canvas","elementRegistry"],oa.prototype.get=function(e){if(v(e)&&(e={id:e}),v(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?_(t.overlays,z({type:e.type})):t.overlays.slice():[]}return e.type?_(this._overlays,z({type:e.type})):e.id?this._overlays[e.id]:null},oa.prototype.add=function(e,t,n){if(h(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var r=this._ids.next();return n=U({},this._overlayDefaults,n,{id:r,type:t,element:e,html:n.html}),this._addOverlay(n),r},oa.prototype.remove=function(e){var t=this.get(e)||[];m(t)||(t=[t]);var n=this;E(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(ke(e.html),ke(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var r=t.overlays.indexOf(e);-1!==r&&t.overlays.splice(r,1)}}))},oa.prototype.show=function(){sa(this._overlayRoot)},oa.prototype.hide=function(){sa(this._overlayRoot,!1)},oa.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ue(this._overlayRoot)},oa.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,r=t.x,i=t.y;if(t.waypoints){var o=Pt(t);r=o.x,i=o.y}aa(n,r,i),ie(e.html,"data-container-id",t.id)},oa.prototype._updateOverlay=function(e){var t,n,r=e.position,i=e.htmlContainer,o=e.element,a=r.left,s=r.top;void 0!==r.right&&(t=o.waypoints?Pt(o).width:o.width,a=-1*r.right+t);void 0!==r.bottom&&(n=o.waypoints?Pt(o).height:o.height,s=-1*r.bottom+n);aa(i,a||0,s||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},oa.prototype._createOverlayContainer=function(e){var t=Ee('<div class="djs-overlays" />');re(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},oa.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";la(this._overlayRoot,n)},oa.prototype._getOverlayContainer=function(e,t){var n=x(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},oa.prototype._addOverlay=function(e){var t,n,r=e.id,i=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),v(o)&&(o=Ee(o)),n=this._getOverlayContainer(i),re(t=Ee('<div class="djs-overlay" data-overlay-id="'+r+'">'),{position:"absolute"}),t.appendChild(o),e.type&&ce(t).add("djs-overlay-"+e.type),sa(t,this._canvas.findRoot(i)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[r]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},oa.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,r=this._canvas.findRoot(e.element),i=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=!0;(r!==this._canvas.getRootElement()||n&&(u(i)&&i>t.scale||u(o)&&o<t.scale))&&(s=!1),sa(a,s),this._updateOverlayScale(e,t)},oa.prototype._updateOverlayScale=function(e,t){var n,r,i,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,r=1):(n=o.min,r=o.max),u(n)&&t.scale<n&&(i=(1/t.scale||1)*n),u(r)&&t.scale>r&&(i=(1/t.scale||1)*r)),u(i)&&(s="scale("+i+","+i+")"),la(a,s)},oa.prototype._updateOverlaysVisibilty=function(e){var t=this;E(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},oa.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",(function(e){t.hide()})),e.on("canvas.viewbox.changed",(function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()})),e.on(["shape.remove","connection.remove"],(function(e){var n=e.element;E(t.get({element:n}),(function(e){t.remove(e.id)}));var r=t._getOverlayContainer(n);if(r){ke(r.html);var i=t._overlayContainers.indexOf(r);-1!==i&&t._overlayContainers.splice(i,1)}})),e.on("element.changed",500,(function(e){var n=e.element,r=t._getOverlayContainer(n,!0);r&&(E(r.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(r))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&ce(n.html)[e.add?"add":"remove"](e.marker)})),e.on("root.set",(function(){t._updateOverlaysVisibilty(t._canvas.viewbox())})),e.on("diagram.clear",this.clear,this)};var ca={__init__:["overlays"],overlays:["type",oa]};function pa(e,t,n,r){e.on("element.changed",(function(r){var i=r.element;(i.parent||i===t.getRootElement())&&(r.gfx=n.getGraphics(i)),r.gfx&&e.fire(St(i)+".changed",r)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),r.updateContainments(n)})),e.on("shape.changed",(function(e){r.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){r.update("connection",e.element,e.gfx)}))}pa.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var ua={__init__:["changeSupport"],changeSupport:["type",pa]};function da(e){this._eventBus=e}da.$inject=["eventBus"],da.prototype.on=function(e,t,n,r,i,o){if((g(t)||f(t))&&(o=i,i=r,r=n,n=t,t=null),g(n)&&(o=i,i=r,r=n,n=1e3),h(i)&&(o=i,i=!1),!g(r))throw new Error("handlerFn must be a function");m(e)||(e=[e]);var a=this._eventBus;E(e,(function(e){var s=["commandStack",e,t].filter((function(e){return e})).join(".");a.on(s,n,i?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(r,o):r,o)}))};E(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],(function(e){da.prototype[e]=function(t,n,r,i,o){(g(t)||f(t))&&(o=i,i=r,r=n,n=t,t=null),this.on(t,e,n,r,i,o)}}));var ma=Object.freeze({__proto__:null,default:da});function ha(e,t){t.invoke(da,this),this.executed((function(t){var n=t.context;n.rootElement?e.setRootElement(n.rootElement):n.rootElement=e.getRootElement()})),this.revert((function(t){var n=t.context;n.rootElement&&e.setRootElement(n.rootElement)}))}i(ha,da),ha.$inject=["canvas","injector"];var fa={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ha]},ga=n((function(t,n){var r;r=e,t.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),r=n.length,i=-1,o="",a=n.charCodeAt(0);++i<r;)0!=(t=n.charCodeAt(i))?o+=t>=1&&t<=31||127==t||0==i&&t>=48&&t<=57||1==i&&t>=48&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==i&&1==r&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+n.charAt(i):n.charAt(i):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(r)})),va={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BpmnModeler=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}function n(e){var t={exports:{}};return e(t,t.exports),t.exports}var r=n((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}}));function i(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}var o=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=e.exports=function(e,n){if(n||(n=16),void 0===e&&(e=128),e<=0)return"0";for(var r=Math.log(Math.pow(2,e))/Math.log(n),i=2;r===1/0;i*=2)r=Math.log(Math.pow(2,e/i))/Math.log(n)*i;var o=r-Math.floor(r),a="";for(i=0;i<Math.floor(r);i++){a=Math.floor(Math.random()*n).toString(n)+a}if(o){var s=Math.pow(n,o);a=Math.floor(Math.random()*s).toString(n)+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,e)?t(e,n):a};t.rack=function(e,n,r){var i=function(i){var a=0;do{if(a++>10){if(!r)throw new Error("too many ID collisions, use more bits");e+=r}var s=t(e,n)}while(Object.hasOwnProperty.call(o,s));return o[s]=i,s},o=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=n||16,i}}));function a(e){if(!(this instanceof a))return new a(e);e=e||[128,36,1],this._seed=e.length?o.rack(e[0],e[1],e[2]):e}function s(e){return Array.prototype.concat.apply([],e)}a.prototype.next=function(e){return this._seed(e||!0)},a.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},a.prototype.claim=function(e,t){this._seed.set(e,t||!0)},a.prototype.assigned=function(e){return this._seed.get(e)||!1},a.prototype.unclaim=function(e){delete this._seed.hats[e]},a.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var l=Object.prototype.toString,c=Object.prototype.hasOwnProperty;function p(e){return void 0===e}function u(e){return void 0!==e}function d(e){return null==e}function m(e){return"[object Array]"===l.call(e)}function h(e){return"[object Object]"===l.call(e)}function f(e){return"[object Number]"===l.call(e)}function g(e){var t=l.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function v(e){return"[object String]"===l.call(e)}function y(e){if(!m(e))throw new Error("must supply array")}function b(e,t){return c.call(e,t)}function x(e,t){var n;return t=L(t),E(e,(function(e,r){if(t(e,r))return n=e,!1})),n}function w(e,t){t=L(t);var n=m(e)?-1:void 0;return E(e,(function(e,r){if(t(e,r))return n=r,!1})),n}function _(e,t){var n=[];return E(e,(function(e,r){t(e,r)&&n.push(e)})),n}function E(e,t){var n;if(!p(e)){var r=m(e)?N:V;for(var i in e)if(b(e,i)&&!1===t(n=e[i],r(i)))return n}}function P(e,t){return p(e)?[]:(y(e),t=L(t),e.filter((function(e,n){return!t(e,n)})))}function S(e,t,n){return E(e,(function(e,r){n=t(n,e,r)})),n}function C(e,t){return!!S(e,(function(e,n,r){return e&&t(n,r)}),!0)}function O(e,t){return!!x(e,t)}function k(e,t){var n=[];return E(e,(function(e,r){n.push(t(e,r))})),n}function M(e){return e&&Object.keys(e)||[]}function A(e){return M(e).length}function T(e){return k(e,(function(e){return e}))}function R(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=I(t),E(e,(function(e){var r=t(e)||"_",i=n[r];i||(i=n[r]=[]),i.push(e)})),n}function D(e){e=I(e);for(var t={},n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];E(r,(function(n){return R(n,e,t)}));var o=k(t,(function(e,t){return e[0]}));return o}var B=D;function j(e,t){t=I(t);var n=[];return E(e,(function(e,r){for(var i=t(e,r),o={d:i,v:e},a=0;a<n.length;a++){if(i<n[a].d)return void n.splice(a,0,o)}n.push(o)})),k(n,(function(e){return e.v}))}function z(e){return function(t){return C(e,(function(e,n){return t[n]===e}))}}function I(e){return g(e)?e:function(t){return t[e]}}function L(e){return g(e)?e:function(t){return t===e}}function V(e){return e}function N(e){return Number(e)}function F(e,t){var n,r,i,o;function a(n){var a=Date.now(),c=n?0:o+t-a;if(c>0)return s(c);e.apply(i,r),l()}function s(e){n=setTimeout(a,e)}function l(){n&&clearTimeout(n),n=o=r=i=void 0}function c(){o=Date.now();for(var e=arguments.length,a=new Array(e),l=0;l<e;l++)a[l]=arguments[l];r=a,i=this,n||s(t)}return c.flush=function(){n&&a(!0),l()},c.cancel=l,c}function $(e,t){return e.bind(t)}function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(){return(q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function U(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return q.apply(void 0,[e].concat(n))}function G(e,t,n){var r=e;return E(t,(function(e,i){if("number"!=typeof e&&"string"!=typeof e)throw new Error("illegal key type: "+H(e)+". Key should be of type number or string.");if("constructor"===e)throw new Error("illegal key: constructor");if("__proto__"===e)throw new Error("illegal key: __proto__");var o=t[i+1],a=r[e];u(o)&&d(a)&&(a=r[e]=isNaN(+o)?{}:[]),p(o)?p(n)?delete r[e]:r[e]=n:r=a})),e}function W(e,t,n){var r=e;return E(t,(function(e){if(d(r))return r=void 0,!1;r=r[e]})),p(r)?n:r}function K(e,t){var n={},r=Object(e);return E(t,(function(t){t in r&&(n[t]=e[t])})),n}function Y(e,t){var n={};return E(Object(e),(function(e,r){-1===t.indexOf(r)&&(n[r]=e)})),n}var X=Object.freeze({__proto__:null,assign:U,bind:$,debounce:F,ensureArray:y,every:C,filter:_,find:x,findIndex:w,flatten:s,forEach:E,get:W,groupBy:R,has:b,isArray:m,isDefined:u,isFunction:g,isNil:d,isNumber:f,isObject:h,isString:v,isUndefined:p,keys:M,map:k,matchPattern:z,merge:function e(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.length?(E(r,(function(n){n&&h(n)&&E(n,(function(n,r){if("__proto__"!==r){var i=t[r];h(n)?(h(i)||(i={}),t[r]=e(i,n)):t[r]=n}}))})),t):t},omit:Y,pick:K,reduce:S,set:G,size:A,some:O,sortBy:j,throttle:function(e,t){var n=!1;return function(){n||(e.apply(void 0,arguments),n=!0,setTimeout((function(){n=!1}),t))}},unionBy:B,uniqueBy:D,values:T,without:P}),J=Object.prototype.toString,Z=Object.prototype.hasOwnProperty;function Q(e,t){return Z.call(e,t)}function ee(e,t){var n;if(void 0!==e){var r=function(e){return"[object Array]"===J.call(e)}(e)?ne:te;for(var i in e)if(Q(e,i)&&!1===t(n=e[i],r(i)))return n}}function te(e){return e}function ne(e){return Number(e)}function re(e){for(var t=e.style,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return ee(r,(function(e){e&&ee(e,(function(e,n){t[n]=e}))})),e}function ie(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var oe=[].indexOf,ae=function(e,t){if(oe)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},se=/\s+/,le=Object.prototype.toString;function ce(e){return new pe(e)}function pe(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function ue(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}pe.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~ae(t,e)||t.push(e),this.el.className=t.join(" "),this},pe.prototype.remove=function(e){if("[object RegExp]"==le.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=ae(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},pe.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},pe.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},pe.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(se);return""===e[0]&&e.shift(),e},pe.prototype.has=pe.prototype.contains=function(e){return this.list?this.list.contains(e):!!~ae(this.array(),e)};var de="undefined"!=typeof Element?Element.prototype:{},me=de.matches||de.matchesSelector||de.webkitMatchesSelector||de.mozMatchesSelector||de.msMatchesSelector||de.oMatchesSelector,he=function(e,t){if(!e||1!==e.nodeType)return!1;if(me)return me.call(e,t);for(var n=e.parentNode.querySelectorAll(t),r=0;r<n.length;r++)if(n[r]==e)return!0;return!1};function fe(e,t,n){for(var r=n?e:e.parentNode;r&&r.nodeType!==document.DOCUMENT_NODE&&r.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(he(r,t))return r;r=r.parentNode}return he(r,t)?r:null}var ge=window.addEventListener?"addEventListener":"attachEvent",ve=window.removeEventListener?"removeEventListener":"detachEvent",ye="addEventListener"!==ge?"on":"",be={bind:function(e,t,n,r){return e[ge](ye+t,n,r||!1),n},unbind:function(e,t,n,r){return e[ve](ye+t,n,r||!1),n}},xe=["focus","blur"];var we,_e={bind:function(e,t,n,r,i){return-1!==xe.indexOf(n)&&(i=!0),be.bind(e,n,(function(n){var i=n.target||n.srcElement;n.delegateTarget=fe(i,t,!0),n.delegateTarget&&r.call(e,n)}),i)},unbind:function(e,t,n,r){return-1!==xe.indexOf(t)&&(r=!0),be.unbind(e,t,n,r)}},Ee=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var r=n[1];if("body"==r){return(i=t.createElement("html")).innerHTML=e,i.removeChild(i.lastChild)}var i,o=Se[r]||Se._default,a=o[0],s=o[1],l=o[2];(i=t.createElement("div")).innerHTML=s+e+l;for(;a--;)i=i.lastChild;if(i.firstChild==i.lastChild)return i.removeChild(i.firstChild);var c=t.createDocumentFragment();for(;i.firstChild;)c.appendChild(i.removeChild(i.firstChild));return c},Pe=!1;"undefined"!=typeof document&&((we=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',Pe=!we.getElementsByTagName("link").length,we=void 0);var Se={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:Pe?[1,"X<div>","</div>"]:[0,"",""]};function Ce(e,t){return(t=t||document).querySelector(e)}function Oe(e,t){return(t=t||document).querySelectorAll(e)}function ke(e){e.parentNode&&e.parentNode.removeChild(e)}function Me(e,t){return t.appendChild(function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}(e,t))}function Ae(e,t){return Me(t,e),e}Se.td=Se.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Se.option=Se.optgroup=[1,'<select multiple="multiple">',"</select>"],Se.thead=Se.tbody=Se.colgroup=Se.caption=Se.tfoot=[1,"<table>","</table>"],Se.polyline=Se.ellipse=Se.polygon=Se.circle=Se.text=Se.line=Se.path=Se.rect=Se.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var Te={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":2,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":2,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Re(e,t,n){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=Te[r];i?(2===i&&"number"==typeof n&&(n=String(n)+"px"),e.style[r]=n):e.setAttributeNS(null,t,n)}function De(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return Te[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);Re(e,t,n)}else!function(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)Re(e,r,t[r])}(e,t);return e}function Be(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}var je=/\s+/,ze=Object.prototype.toString;function Ie(e){return void 0!==e}function Le(e){return new Ve(e)}function Ve(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Ne(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Fe(e){for(var t;t=e.firstChild;)Ne(t);return e}function $e(e){return e.cloneNode(!0)}Ve.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~Be(t,e)||t.push(e),Ie(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Ve.prototype.remove=function(e){if("[object RegExp]"===ze.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Be(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Ve.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Ve.prototype.toggle=function(e,t){return this.list?(Ie(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(Ie(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Ve.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(je);return""===e[0]&&e.shift(),e},Ve.prototype.has=Ve.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Be(this.array(),e)};var He="http://www.w3.org/2000/svg",qe='<svg xmlns="'+He+'"';function Ue(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(He)&&(e=qe+e.substring(4)):(e=qe+">"+e+"</svg>",t=!0);var n=function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e);if(!t)return n;for(var r=document.createDocumentFragment(),i=n.firstChild;i.firstChild;)r.appendChild(i.firstChild);return r}function Ge(e,t){var n;return"<"===e.charAt(0)?(n=Ue(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(He,e),t&&De(n,t),n}var We=Ge("svg");function Ke(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)e[r]=t[r];return e}function Ye(e){return e?We.createSVGTransformFromMatrix(e):We.createSVGTransform()}var Xe=/([&<>]{1})/g,Je=/([\n\r"]{1})/g,Ze={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Qe(e,t){return e.replace(t,(function(e,t){return Ze[t]||t}))}function et(e,t){var n,r,i,o,a;switch(e.nodeType){case 3:t.push(Qe(e.textContent,Xe));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,r=(i=e.attributes).length;n<r;++n)o=i.item(n),t.push(" ",o.name,'="',Qe(o.value,Je),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,r=(a=e.childNodes).length;n<r;++n)et(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Qe(e.nodeValue,Xe),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function tt(e,t){var n=Ue(t);if(Fe(e),t){(function(e){return"#document-fragment"===e.nodeName})(n)||(n=n.documentElement);for(var r,i=(r=n.childNodes,Array.prototype.slice.call(r)),o=0;o<i.length;o++)Me(i[o],e)}}function nt(e,t){if(void 0!==t){try{tt(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)et(t,n),t=t.nextSibling;return n.join("")}(e)}function rt(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function it(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,r;for(e.clear(),n=0;r=t[n];n++)e.appendItem(rt(e,r))}(n,t)),n.consolidate()}var ot=/^class /;function at(e){return"[object Array]"===Object.prototype.toString.call(e)}function st(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function lt(){var e=Array.prototype.slice.call(arguments);1===e.length&&at(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var ct=/constructor\s*[^(]*\(\s*([^)]*)\)/m,pt=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,ut=/\/\*([^*]*)\*\//m;function dt(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t=e.toString().match(function(e){return ot.test(e.toString())}(e)?ct:pt);if(!t)return[];var n=t[1]||t[2];return n&&n.split(",").map((function(e){var t=e.match(ut);return(t&&t[1]||e).trim()}))||[]}function mt(e,t){t=t||{get:function(e,t){if(n.push(e),!1===t)return null;throw a('No provider for "'+e+'"!')}};var n=[],r=this._providers=Object.create(t._providers||null),i=this._instances=Object.create(null),o=i.injector=this,a=function(e){var t=n.join(" -> ");return n.length=0,new Error(t?e+" (Resolving: "+t+")":e)};function s(e,o){if(!r[e]&&-1!==e.indexOf(".")){for(var l=e.split("."),c=s(l.shift());l.length;)c=c[l.shift()];return c}if(st(i,e))return i[e];if(st(r,e)){if(-1!==n.indexOf(e))throw n.push(e),a("Cannot resolve circular dependency!");return n.push(e),i[e]=r[e][0](r[e][1]),n.pop(),i[e]}return t.get(e,o)}function l(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!at(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=lt(e.slice())}return{fn:e,dependencies:(e.$inject||dt(e)).map((function(e){return st(t,e)?t[e]:s(e)}))}}function c(e){var t=l(e),n=t.fn,r=t.dependencies;return new(Function.prototype.bind.apply(n,[null].concat(r)))}function p(e,t,n){var r=l(e,n),i=r.fn,o=r.dependencies;return i.apply(t,o)}function u(e){return lt((function(t){return e.get(t)}))}function d(e,t){if(t&&t.length){var n,i,a,s,l=Object.create(null),c=Object.create(null),p=[],d=[],m=[];for(var h in r)n=r[h],-1!==t.indexOf(h)&&("private"===n[2]?-1===(i=p.indexOf(n[3]))?(s=u(a=n[3].createChild([],t)),p.push(n[3]),d.push(a),m.push(s),l[h]=[s,h,"private",a]):l[h]=[m[i],h,"private",d[i]]:l[h]=[n[2],n[1]],c[h]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach((function(e){-1!==n[1].$scope.indexOf(e)&&(l[h]=[n[2],n[1]],c[e]=!0)}));t.forEach((function(e){if(!c[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(l)}return new mt(e,o)}var m,h,f={factory:p,type:c,value:function(e){return e}};function g(e,t){var n=e.__init__||[];return function(){n.forEach((function(e){try{"string"==typeof e?t.get(e):t.invoke(e)}catch(e){if("undefined"!=typeof AggregateError)throw new AggregateError([e],"Failed to initialize!");throw new Error("Failed to initialize! "+e.message)}}))}}function v(e){var t=e.__exports__;if(t){var n=e.__modules__,i=Object.keys(e).reduce((function(t,n){return"__exports__"!==n&&"__modules__"!==n&&"__init__"!==n&&"__depends__"!==n&&(t[n]=e[n]),t}),Object.create(null)),a=d((n||[]).concat(i)),s=lt((function(e){return a.get(e)}));t.forEach((function(e){r[e]=[s,e,"private",a]}));var l=(e.__init__||[]).slice();return l.unshift((function(){a.init()})),g(e=Object.assign({},e,{__init__:l}),a)}return Object.keys(e).forEach((function(t){if("__init__"!==t&&"__depends__"!==t)if("private"!==e[t][2]){var n=e[t][0],i=e[t][1];r[t]=[f[n],ht(n,i),n]}else r[t]=e[t]})),g(e,o)}function y(e,t){return-1!==e.indexOf(t)||-1!==(e=(t.__depends__||[]).reduce(y,e)).indexOf(t)?e:e.concat(t)}this.get=s,this.invoke=p,this.instantiate=c,this.createChild=d,this.init=(m=e.reduce(y,[]).map(v),h=!1,function(){h||(h=!0,m.forEach((function(e){return e()})))})}function ht(e,t){return"value"!==e&&at(t)&&(t=lt(t.slice())),t}function ft(e,t){var n=this;t=t||1e3,e.on(["render.shape","render.connection"],t,(function(e,t){var r=e.type,i=t.element,o=t.gfx,a=t.attrs;if(n.canRender(i))return"render.shape"===r?n.drawShape(o,i,a):n.drawConnection(o,i,a)})),e.on(["render.getShapePath","render.getConnectionPath"],t,(function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)}))}function gt(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function vt(e){for(var t,n="",r=0;t=e[r];r++)n+=t.x+","+t.y+" ";return n}function yt(e,t){var n=Ge("polyline");return De(n,{points:vt(e)}),t&&De(n,t),n}function bt(e){return _(e,(function(t){return!x(e,(function(e){return e!==t&&xt(t,e)}))}))}function xt(e,t){if(t){if(e===t)return t;if(e.parent)return xt(e.parent,t)}}function wt(e,t,n){var r=!n||-1===e.indexOf(t);return r&&e.push(t),r}function _t(e,t,n){n=n||0,m(e)||(e=[e]),E(e,(function(e,r){var i=t(e,r,n);m(i)&&i.length&&_t(i,t,n+1)}))}function Et(e,t){return function(e,t,n){var r=[],i=[];return _t(e,(function(e,o,a){wt(r,e,t);var s=e.children;if((-1===n||a<n)&&s&&wt(i,s,t))return s})),r}(e,!t,-1)}function Pt(e,t){var n,r,i,o;return t=!!t,m(e)||(e=[e]),E(e,(function(e){var a=e;e.waypoints&&!t&&(a=Pt(e.waypoints,!0));var s=a.x,l=a.y,c=a.height||0,p=a.width||0;(s<n||void 0===n)&&(n=s),(l<r||void 0===r)&&(r=l),(s+p>i||void 0===i)&&(i=s+p),(l+c>o||void 0===o)&&(o=l+c)})),{x:n,y:r,height:o-r,width:i-n}}function St(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Ct(e){return!(!e||!e.isFrame)}function Ot(e,t){return U({},e||{},t||{})}ft.prototype.canRender=function(){},ft.prototype.drawShape=function(){},ft.prototype.drawConnection=function(){},ft.prototype.getShapePath=function(){},ft.prototype.getConnectionPath=function(){};function kt(e,t){ft.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}i(kt,ft),kt.prototype.canRender=function(){return!0},kt.prototype.drawShape=function(e,t,n){var r=Ge("rect");return De(r,{x:0,y:0,width:t.width||0,height:t.height||0}),Ct(t)?De(r,U({},this.FRAME_STYLE,n||{})):De(r,U({},this.SHAPE_STYLE,n||{})),Ae(e,r),r},kt.prototype.drawConnection=function(e,t,n){var r=yt(t.waypoints,U({},this.CONNECTION_STYLE,n||{}));return Ae(e,r),r},kt.prototype.getShapePath=function(e){var t=e.x,n=e.y,r=e.width;return gt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])},kt.prototype.getConnectionPath=function(e){var t,n,r=e.waypoints,i=[];for(t=0;n=r[t];t++)n=n.original||n,i.push([0===t?"M":"L",n.x,n.y]);return gt(i)},kt.$inject=["eventBus","styles"];var Mt={__init__:["defaultRenderer"],defaultRenderer:["type",kt],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){return U(this.style(t,n),{class:e})},this.style=function(t,n){m(t)||n||(n=t,t=[]);var r=S(t,(function(t,n){return U(t,e[n]||{})}),{});return n?U(r,n):r},this.computeStyle=function(e,n,r){return m(n)||(r=n,n=[]),t.style(n||[],U({},r,e||{}))}}]};function At(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function Tt(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var r=e.indexOf(t);if(-1!==r){if(r===n)return;if(-1===n)return;e.splice(r,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function Rt(e,t){return e&&t?e.indexOf(t):-1}var Dt=Object.freeze({__proto__:null,remove:At,add:Tt,indexOf:Rt});function Bt(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function jt(e,t,n,r){if(void 0===r&&(r=5),!e||!t||!n)return!1;var i=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Bt(e,t);return Math.abs(i/o)<=r}function zt(e,t){var n;return function(e,t){var n;n=m(e)?e:[e,t];var r=n.slice().shift();return C(n,(function(e){return Math.abs(r.y-e.y)<=2}))}(n=m(e)?e:[e,t])?"h":!!function(e,t){var n;n=m(e)?e:[e,t];var r=n.slice().shift();return C(n,(function(e){return Math.abs(r.x-e.x)<=2}))}(n)&&"v"}function It(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function Lt(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Vt=/,?([a-z]),?/gi,Nt=parseFloat,Ft=Math,$t=Ft.PI,Ht=Ft.min,qt=Ft.max,Ut=Ft.pow,Gt=Ft.abs,Wt=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Kt=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Yt=Array.isArray||function(e){return e instanceof Array};function Xt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Jt(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)Xt(e,n)&&(t[n]=Jt(e[n]));return t}function Zt(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function Qt(e){var t=Qt.ps=Qt.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)Xt(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function en(e,t,n,r){return 1===arguments.length&&(t=e.y,n=e.width,r=e.height,e=e.x),{x:e,y:t,width:n,height:r,x2:e+n,y2:t+r}}function tn(){return this.join(",").replace(Vt,"$1")}function nn(e){var t=Jt(e);return t.toString=tn,t}function rn(e,t,n,r,i,o,a,s,l){var c=1-l,p=Ut(c,3),u=Ut(c,2),d=l*l*l,m=p*t+3*u*l*r+3*c*l*l*o+d*s;return{x:pn(p*e+3*u*l*n+3*c*l*l*i+d*a),y:pn(m)}}function on(e){var t=vn.apply(null,e);return en(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function an(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function sn(e,t,n,r,i){return e*(e*(-3*t+9*n-9*r+3*i)+6*t-12*n+6*r)-3*t+3*n}function ln(e,t,n,r,i,o,a,s,l){null==l&&(l=1);for(var c=(l=l>1?1:l<0?0:l)/2,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<12;m++){var h=c*p[m]+c,f=sn(h,e,n,i,a),g=sn(h,t,r,o,s),v=f*f+g*g;d+=u[m]*Ft.sqrt(v)}return c*d}function cn(e,t,n,r,i,o,a,s){if(!(qt(e,n)<Ht(i,a)||Ht(e,n)>qt(i,a)||qt(t,r)<Ht(o,s)||Ht(t,r)>qt(o,s))){var l=(e*r-t*n)*(o-s)-(t-r)*(i*s-o*a),c=(e-n)*(o-s)-(t-r)*(i-a);if(c){var p=pn(((e*r-t*n)*(i-a)-(e-n)*(i*s-o*a))/c),u=pn(l/c),d=+p.toFixed(2),m=+u.toFixed(2);if(!(d<+Ht(e,n).toFixed(2)||d>+qt(e,n).toFixed(2)||d<+Ht(i,a).toFixed(2)||d>+qt(i,a).toFixed(2)||m<+Ht(t,r).toFixed(2)||m>+qt(t,r).toFixed(2)||m<+Ht(o,s).toFixed(2)||m>+qt(o,s).toFixed(2)))return{x:p,y:u}}}}function pn(e){return Math.round(1e11*e)/1e11}function un(e,t,n){if(!function(e,t){return e=en(e),an(t=en(t),e.x,e.y)||an(t,e.x2,e.y)||an(t,e.x,e.y2)||an(t,e.x2,e.y2)||an(e,t.x,t.y)||an(e,t.x2,t.y)||an(e,t.x,t.y2)||an(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(on(e),on(t)))return n?0:[];for(var r=ln.apply(0,e),i=ln.apply(0,t),o=mn(e)?1:~~(r/5)||1,a=mn(t)?1:~~(i/5)||1,s=[],l=[],c={},p=n?0:[],u=0;u<o+1;u++){var d=rn.apply(0,e.concat(u/o));s.push({x:d.x,y:d.y,t:u/o})}for(u=0;u<a+1;u++)d=rn.apply(0,t.concat(u/a)),l.push({x:d.x,y:d.y,t:u/a});for(u=0;u<o;u++)for(var m=0;m<a;m++){var h,f=s[u],g=s[u+1],v=l[m],y=l[m+1],b=Gt(g.x-f.x)<.01?"y":"x",x=Gt(y.x-v.x)<.01?"y":"x",w=cn(f.x,f.y,g.x,g.y,v.x,v.y,y.x,y.y);if(w){if(c[h=w.x.toFixed(9)+"#"+w.y.toFixed(9)])continue;c[h]=!0;var _=f.t+Gt((w[b]-f[b])/(g[b]-f[b]))*(g.t-f.t),E=v.t+Gt((w[x]-v[x])/(y[x]-v[x]))*(y.t-v.t);_>=0&&_<=1&&E>=0&&E<=1&&(n?p++:p.push({x:w.x,y:w.y,t1:_,t2:E}))}}return p}function dn(e){var t=Qt(e);if(t.abs)return nn(t.abs);if(Yt(e)&&Yt(e&&e[0])||(e=function(e){if(!e)return null;var t=Qt(e);if(t.arr)return Jt(t.arr);var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=[];return Yt(e)&&Yt(e[0])&&(r=Jt(e)),r.length||String(e).replace(Wt,(function(e,t,i){var o=[],a=t.toLowerCase();for(i.replace(Kt,(function(e,t){t&&o.push(+t)})),"m"==a&&o.length>2&&(r.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L");o.length>=n[a]&&(r.push([t].concat(o.splice(0,n[a]))),n[a]););})),r.toString=Qt.toString,t.arr=Jt(r),r}(e)),!e||!e.length)return[["M",0,0]];var n,r=[],i=0,o=0,a=0,s=0,l=0;"M"==e[0][0]&&(a=i=+e[0][1],s=o=+e[0][2],l++,r[0]=["M",i,o]);for(var c,p,u=l,d=e.length;u<d;u++){if(r.push(c=[]),(n=(p=e[u])[0])!=n.toUpperCase())switch(c[0]=n.toUpperCase(),c[0]){case"A":c[1]=p[1],c[2]=p[2],c[3]=p[3],c[4]=p[4],c[5]=p[5],c[6]=+p[6]+i,c[7]=+p[7]+o;break;case"V":c[1]=+p[1]+o;break;case"H":c[1]=+p[1]+i;break;case"M":a=+p[1]+i,s=+p[2]+o;default:for(var m=1,h=p.length;m<h;m++)c[m]=+p[m]+(m%2?i:o)}else for(var f=0,g=p.length;f<g;f++)c[f]=p[f];switch(n=n.toUpperCase(),c[0]){case"Z":i=+a,o=+s;break;case"H":i=c[1];break;case"V":o=c[1];break;case"M":a=c[c.length-2],s=c[c.length-1];default:i=c[c.length-2],o=c[c.length-1]}}return r.toString=tn,t.abs=nn(r),r}function mn(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function hn(e,t,n,r){return[e,t,n,r,n,r]}function fn(e,t,n,r,i,o){var a=1/3,s=2/3;return[a*e+s*n,a*t+s*r,a*i+s*n,a*o+s*r,i,o]}function gn(e,t,n,r,i,o,a,s,l,c){var p,u=120*$t/180,d=$t/180*(+i||0),m=[],h=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0),r=n.join("␀"),i=t.cache=t.cache||{},o=t.count=t.count||[];return Xt(i,r)?(Zt(o,r),i[r]):(o.length>=1e3&&delete i[o.shift()],o.push(r),i[r]=e.apply(0,n),i[r])}}((function(e,t,n){return{x:e*Ft.cos(n)-t*Ft.sin(n),y:e*Ft.sin(n)+t*Ft.cos(n)}}));if(c)E=c[0],P=c[1],w=c[2],_=c[3];else{e=(p=h(e,t,-d)).x,t=p.y;var f=(e-(s=(p=h(s,l,-d)).x))/2,g=(t-(l=p.y))/2,v=f*f/(n*n)+g*g/(r*r);v>1&&(n*=v=Ft.sqrt(v),r*=v);var y=n*n,b=r*r,x=(o==a?-1:1)*Ft.sqrt(Gt((y*b-y*g*g-b*f*f)/(y*g*g+b*f*f))),w=x*n*g/r+(e+s)/2,_=x*-r*f/n+(t+l)/2,E=Ft.asin(((t-_)/r).toFixed(9)),P=Ft.asin(((l-_)/r).toFixed(9));(E=e<w?$t-E:E)<0&&(E=2*$t+E),(P=s<w?$t-P:P)<0&&(P=2*$t+P),a&&E>P&&(E-=2*$t),!a&&P>E&&(P-=2*$t)}var S=P-E;if(Gt(S)>u){var C=P,O=s,k=l;P=E+u*(a&&P>E?1:-1),m=gn(s=w+n*Ft.cos(P),l=_+r*Ft.sin(P),n,r,i,0,a,O,k,[P,C,w,_])}S=P-E;var M=Ft.cos(E),A=Ft.sin(E),T=Ft.cos(P),R=Ft.sin(P),D=Ft.tan(S/4),B=4/3*n*D,j=4/3*r*D,z=[e,t],I=[e+B*A,t-j*M],L=[s+B*R,l-j*T],V=[s,l];if(I[0]=2*z[0]-I[0],I[1]=2*z[1]-I[1],c)return[I,L,V].concat(m);for(var N=[],F=0,$=(m=[I,L,V].concat(m).join().split(",")).length;F<$;F++)N[F]=F%2?h(m[F-1],m[F],d).y:h(m[F],m[F+1],d).x;return N}function vn(e,t,n,r,i,o,a,s){for(var l,c,p,u,d,m,h,f,g=[],v=[[],[]],y=0;y<2;++y)if(0==y?(c=6*e-12*n+6*i,l=-3*e+9*n-9*i+3*a,p=3*n-3*e):(c=6*t-12*r+6*o,l=-3*t+9*r-9*o+3*s,p=3*r-3*t),Gt(l)<1e-12){if(Gt(c)<1e-12)continue;0<(u=-p/c)&&u<1&&g.push(u)}else h=c*c-4*p*l,f=Ft.sqrt(h),h<0||(0<(d=(-c+f)/(2*l))&&d<1&&g.push(d),0<(m=(-c-f)/(2*l))&&m<1&&g.push(m));for(var b,x=g.length,w=x;x--;)b=1-(u=g[x]),v[0][x]=b*b*b*e+3*b*b*u*n+3*b*u*u*i+u*u*u*a,v[1][x]=b*b*b*t+3*b*b*u*r+3*b*u*u*o+u*u*u*s;return v[0][w]=e,v[1][w]=t,v[0][w+1]=a,v[1][w+1]=s,v[0].length=v[1].length=w+2,{x0:Ht.apply(0,v[0]),y0:Ht.apply(0,v[1]),x1:qt.apply(0,v[0]),y1:qt.apply(0,v[1])}}function yn(e){var t=Qt(e);if(t.curve)return nn(t.curve);for(var n=dn(e),r={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(e,t,n){var r,i;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(gn.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(r=2*t.x-t.bx,i=2*t.y-t.by):(r=t.x,i=t.y),e=["C",r,i].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(fn(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"].concat(fn(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(hn(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(hn(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(hn(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(hn(t.x,t.y,t.X,t.Y))}return e},o=function(e,t){if(e[t].length>7){e[t].shift();for(var r=e[t];r.length;)a[t]="A",e.splice(t++,0,["C"].concat(r.splice(0,6)));e.splice(t,1),p=n.length}},a=[],s="",l="",c=0,p=n.length;c<p;c++){n[c]&&(s=n[c][0]),"C"!=s&&(a[c]=s,c&&(l=a[c-1])),n[c]=i(n[c],r,l),"A"!=a[c]&&"C"==s&&(a[c]="C"),o(n,c);var u=n[c],d=u.length;r.x=u[d-2],r.y=u[d-1],r.bx=Nt(u[d-4])||r.x,r.by=Nt(u[d-3])||r.y}return t.curve=nn(n),n}var bn=function(e,t,n){e=yn(e),t=yn(t);for(var r,i,o,a,s,l,c,p,u,d,m=n?0:[],h=0,f=e.length;h<f;h++){var g=e[h];if("M"==g[0])r=s=g[1],i=l=g[2];else{"C"==g[0]?(u=[r,i].concat(g.slice(1)),r=u[6],i=u[7]):(u=[r,i,r,i,s,l,s,l],r=s,i=l);for(var v=0,y=t.length;v<y;v++){var b=t[v];if("M"==b[0])o=c=b[1],a=p=b[2];else{"C"==b[0]?(d=[o,a].concat(b.slice(1)),o=d[6],a=d[7]):(d=[o,a,o,a,c,p,c,p],o=c,a=p);var x=un(u,d,n);if(n)m+=x;else{for(var w=0,_=x.length;w<_;w++)x[w].segment1=h,x[w].segment2=v,x[w].bez1=u,x[w].bez2=d;m=m.concat(x)}}}}}return m};function xn(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function wn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function _n(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function En(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Pn(e){for(var t=e.waypoints,n=t.reduce((function(e,n,r){var i=t[r-1];if(i){var o=e[e.length-1],a=o&&o.endLength||0,s=function(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}(i,n);e.push({start:i,end:n,startLength:a,endLength:a+s,length:s})}return e}),[]),r=n.reduce((function(e,t){return e+t.length}),0)/2,i=0,o=n[i];o.endLength<r;)o=n[++i];var a=(r-o.startLength)/o.length;return{x:o.start.x+(o.end.x-o.start.x)*a,y:o.start.y+(o.end.y-o.start.y)*a}}function Sn(e){return function(e){return!!e.waypoints}(e)?Pn(e):wn({x:(t=e).x+(t.width||0)/2,y:t.y+(t.height||0)/2});var t}function Cn(e,t,n){h(n=n||0)||(n={x:n,y:n});var r=_n(e),i=_n(t),o=r.bottom+n.y<=i.top,a=r.left-n.x>=i.right,s=r.top-n.y>=i.bottom,l=o?"top":s?"bottom":null,c=r.right+n.x<=i.left?"left":a?"right":null;return c&&l?l+"-"+c:c||l||"intersect"}function On(e,t,n){var r=function(e,t){return bn(e,t)}(e,t);return 1===r.length||2===r.length&&Bt(r[0],r[1])<1?wn(r[0]):r.length>1?wn((r=j(r,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})))[n?0:r.length-1]):null}function kn(e,t){return Math.round(e*t)/t}function Mn(e){return f(e)?e+"px":e}function An(e,t,n){var r=Ge("g");Le(r).add(t);var i=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(r,e.childNodes[i]||null),r}var Tn={shape:["x","y","width","height"],connection:["waypoints"]};function Rn(e,t,n,r){this._eventBus=t,this._elementRegistry=r,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function Dn(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Rn.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Rn.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=U({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),re(n,{position:"relative",overflow:"hidden",width:Mn(e.width),height:Mn(e.height)}),t.appendChild(n),n}(e),r=this._svg=Ge("svg");De(r,{width:"100%",height:"100%"}),Ae(n,r);var i=this._viewport=An(r,"viewport");!1!==e.deferUpdate&&(this._viewboxChanged=F($(this._viewboxChanged,this),300)),t.on("diagram.init",(function(){t.fire("canvas.init",{svg:r,viewport:i})}),this),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(function(){delete this._cachedViewbox}),this),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Rn.prototype._destroy=function(e){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var t=this._container.parentNode;t&&t.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Rn.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach((function(t){var n=St(t);"root"===n?e.removeRootElement(t):e._removeElement(t,n)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Rn.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Rn.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");var n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),void 0!==t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Rn.prototype._getChildIndex=function(e){return S(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Rn.prototype._createLayer=function(e,t){void 0===t&&(t=1);var n=this._getChildIndex(t);return{group:An(this._viewport,"layer-"+e,n),index:t,visible:!0}},Rn.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");var n=this._viewport,r=t.group,i=t.index;if(t.visible)return r;var o=this._getChildIndex(i);return n.insertBefore(r,n.childNodes[o]||null),t.visible=!0,r},Rn.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");var n=t.group;return t.visible?(Ne(n),t.visible=!1,n):n},Rn.prototype._removeLayer=function(e){var t=this._layers[e];t&&(delete this._layers[e],Ne(t.group))},Rn.prototype.getActiveLayer=function(){var e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Rn.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),e)return(this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{}).rootElement},Rn.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Rn.prototype._findPlaneForRoot=function(e){return x(this._planes,(function(t){return t.rootElement===e}))},Rn.prototype.getContainer=function(){return this._container},Rn.prototype._updateMarker=function(e,t,n){var r;e.id||(e=this._elementRegistry.get(e)),(r=this._elementRegistry._elements[e.id])&&(E([r.gfx,r.secondaryGfx],(function(e){e&&(n?Le(e).add(t):Le(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:r.gfx,marker:t,add:!!n}))},Rn.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Rn.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Rn.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Le(this.getGraphics(e)).has(t)},Rn.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Rn.prototype.getRootElement=function(){var e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Rn.prototype.addRootElement=function(e){var t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});var n=e.layer="root-"+t;this._ensureValid("root",e);var r=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,r),this._planes.push({rootElement:e,layer:r}),e},Rn.prototype.removeRootElement=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter((function(t){return t.rootElement!==e})),this._rootElement===e&&(this._rootElement=null),e},Rn.prototype.setRootElement=function(e,t){if(u(t))throw new Error("override not supported");if(e!==this._rootElement){if(!e)throw new Error("rootElement required");return this._findPlaneForRoot(e)||(e=this.addRootElement(e)),this._setRoot(e),e}},Rn.prototype._removeRoot=function(e){var t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Rn.prototype._addRoot=function(e,t){var n=this._elementRegistry,r=this._eventBus;r.fire("root.add",{element:e}),n.add(e,t),r.fire("root.added",{element:e,gfx:t})},Rn.prototype._setRoot=function(e,t){var n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Rn.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");var n=Tn[e];if(!C(n,(function(e){return void 0!==t[e]})))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Rn.prototype._setParent=function(e,t,n){Tt(t.children,e,n),e.parent=t},Rn.prototype._addElement=function(e,t,n,r){n=n||this.getRootElement();var i=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),i.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,r);var a=o.create(e,t,r);return this._elementRegistry.add(t,a),o.update(e,t,a),i.fire(e+".added",{element:t,gfx:a}),t},Rn.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Rn.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Rn.prototype._removeElement=function(e,t){var n=this._elementRegistry,r=this._graphicsFactory,i=this._eventBus;if(e=n.get(e.id||e))return i.fire(t+".remove",{element:e}),r.remove(e),At(e.parent&&e.parent.children,e),e.parent=null,i.fire(t+".removed",{element:e}),n.remove(e),e},Rn.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Rn.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Rn.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Rn.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Rn.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Rn.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,r,i,o,a,s,l=this._viewport,c=this.getSize();return e?(this._changeViewbox((function(){o=Math.min(c.width/e.width,c.height/e.height);var t=this._svg.createSVGMatrix().scale(o).translate(-e.x,-e.y);it(l,t)})),e):(t=(r=this._rootElement?this.getActiveLayer():null)&&r.getBBox()||{},n=(i=it(l))?i.matrix:function(e,t,n,r,i,o){var a=We.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Ke(a,e);case 6:return Ke(a,{a:e,b:t,c:n,d:r,e:i,f:o})}}(),o=kn(n.a,1e3),a=kn(-n.e||0,1e3),s=kn(-n.f||0,1e3),e=this._cachedViewbox={x:a?a/o:0,y:s?s/o:0,width:c.width/o,height:c.height/o,scale:o,inner:{width:t.width||0,height:t.height||0,x:t.x||0,y:t.y||0},outer:c})},Rn.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox((function(){e=U({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Dn(t,n)})),{x:n.e,y:n.f}},Rn.prototype.scrollToElement=function(e,t){var n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));var r=this.findRoot(e);r!==this.getRootElement()&&this.setRootElement(r),t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};var i,o,a=Pt(e),s=_n(a),l=this.viewbox(),c=this.zoom();l.y+=t.top/c,l.x+=t.left/c,l.width-=(t.right+t.left)/c,l.height-=(t.bottom+t.top)/c;var p=_n(l);if(a.width<l.width&&a.height<l.height){var u=Math.max(0,s.right-p.right),d=Math.min(0,s.left-p.left),m=Math.max(0,s.bottom-p.bottom),h=Math.min(0,s.top-p.top);i=u||d,o=m||h}else i=a.x-l.x,o=a.y-l.y;this.scroll({dx:-i*c,dy:-o*c})},Rn.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),r=this._setZoom(e,t)})),kn(r.a,1e3)):this.viewbox(e).scale;var n,r},Rn.prototype._fitViewport=function(e){var t,n,r=this.viewbox(),i=r.outer,o=r.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=i.width&&o.y+o.height<=i.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,i.width),height:Math.max(o.height+o.y,i.height)}:(t=Math.min(1,i.width/o.width,i.height/o.height),n={x:o.x+(e?o.width/2-i.width/t/2:0),y:o.y+(e?o.height/2-i.height/t/2:0),width:i.width/t,height:i.height/t}),this.viewbox(n),this.viewbox(!1).scale},Rn.prototype._setZoom=function(e,t){var n,r,i,o,a=this._svg,s=this._viewport,l=a.createSVGMatrix(),c=a.createSVGPoint(),p=(r=s.getCTM()).a;return t?(n=U(c,t).matrixTransform(r.inverse()),i=l.translate(n.x,n.y).scale(1/p*e).translate(-n.x,-n.y),o=r.multiply(i)):o=l.scale(e),Dn(this._viewport,o),o},Rn.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Rn.prototype.getAbsoluteBBox=function(e){var t,n=this.viewbox();e.waypoints?t=this.getGraphics(e).getBBox():t=e;return{x:t.x*n.scale-n.x*n.scale,y:t.y*n.scale-n.y*n.scale,width:t.width*n.scale,height:t.height*n.scale}},Rn.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Bn="data-element-id";function jn(e){this._elements={},this._eventBus=e}jn.$inject=["eventBus"],jn.prototype.add=function(e,t,n){var r=e.id;this._validateId(r),De(t,Bn,r),n&&De(n,Bn,r),this._elements[r]={element:e,gfx:t,secondaryGfx:n}},jn.prototype.remove=function(e){var t=this._elements,n=e.id||e,r=n&&t[n];r&&(De(r.gfx,Bn,""),r.secondaryGfx&&De(r.secondaryGfx,Bn,""),delete t[n])},jn.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),r=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,r)},jn.prototype.updateGraphics=function(e,t,n){var r=e.id||e,i=this._elements[r];return n?i.secondaryGfx=t:i.gfx=t,t&&De(t,Bn,r),t},jn.prototype.get=function(e){var t;t="string"==typeof e?e:e&&De(e,Bn);var n=this._elements[t];return n&&n.element},jn.prototype.filter=function(e){var t=[];return this.forEach((function(n,r){e(n,r)&&t.push(n)})),t},jn.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),r=0;r<n.length;r++){var i=t[n[r]],o=i.element;if(e(o,i.gfx))return o}},jn.prototype.getAll=function(){return this.filter((function(e){return e}))},jn.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var r=t[n],i=r.element,o=r.gfx;return e(i,o)}))},jn.prototype.getGraphics=function(e,t){var n=e.id||e,r=this._elements[n];return r&&(t?r.secondaryGfx:r.gfx)},jn.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var zn={extend:function(e,t,n,r){var i=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,i,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var o=this.indexOf(e);if(void 0===n){if(-1!==o)return;n=this.length}-1!==o&&this.splice(o,1),this.splice(n,0,e),-1===o&&t.set(e,i,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function In(e,t,n){var r=zn.extend(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:r}),r.length&&r.forEach((function(r){e.set(r,t.inverse,n)}))}function Ln(e,t){if(!(this instanceof Ln))return new Ln(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ln.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?In(this,t,e):function(e,t,n){var r=t.inverse,i=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(t){if(t!==i){var o=i;i=null,o&&e.unset(o,r,n),i=t,e.set(i,r,n)}}})}(this,t,e)},Ln.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return zn.isExtended(n)||In(this,t,e),n},Ln.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Ln.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ln.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Vn=Ln,Nn=zn;Vn.Collection=Nn;var Fn=new Vn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),$n=new Vn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Hn=new Vn({name:"attachers",collection:!0},{name:"host"}),qn=new Vn({name:"outgoing",collection:!0},{name:"source"}),Un=new Vn({name:"incoming",collection:!0},{name:"target"});function Gn(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Fn.bind(this,"parent"),$n.bind(this,"labels"),qn.bind(this,"outgoing"),Un.bind(this,"incoming")}function Wn(){Gn.call(this),Fn.bind(this,"children"),Hn.bind(this,"host"),Hn.bind(this,"attachers")}function Kn(){Wn.call(this)}function Yn(){Wn.call(this),$n.bind(this,"labelTarget")}function Xn(){Gn.call(this),qn.bind(this,"source"),Un.bind(this,"target")}i(Wn,Gn),i(Kn,Wn),i(Yn,Wn),i(Xn,Gn);var Jn={connection:Xn,shape:Wn,label:Yn,root:Kn};function Zn(){this._uid=12}Zn.prototype.createRoot=function(e){return this.create("root",e)},Zn.prototype.createLabel=function(e){return this.create("label",e)},Zn.prototype.createShape=function(e){return this.create("shape",e)},Zn.prototype.createConnection=function(e){return this.create("connection",e)},Zn.prototype.create=function(e,t){return(t=U({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Jn[e];if(!n)throw new Error("unknown type: <"+e+">");return U(new n,t)}(e,t)};var Qn=Array.prototype.slice;function er(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function tr(){}function nr(e){return e.childNodes[0]}function rr(e,t,n,r,i){var o=Ye();o.setTranslate(t,n);var a=Ye();a.setRotate(r||0,0,0);var s=Ye();s.setScale(i||1,i||1),it(e,[o,a,s])}function ir(e,t,n){var r=Ye();r.setTranslate(t,n),it(e,r)}function or(e,t){var n=Ye();n.setRotate(t,0,0),it(e,n)}function ar(e,t){this._eventBus=e,this._elementRegistry=t}function sr(e,t,n){var r=n||t.firstChild;e!==r&&t.insertBefore(e,r)}er.prototype.on=function(e,t,n,r){if(e=m(e)?e:[e],g(t)&&(r=n,n=t,t=1e3),!f(t))throw new Error("priority must be a number");var i=n;r&&((i=$(n,r)).__fn=n.__fn||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:i,next:null})}))},er.prototype.once=function(e,t,n,r){var i=this;if(g(t)&&(r=n,n=t,t=1e3),!f(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var t=n.apply(r,arguments);return i.off(e,o),t}o.__fn=n,this.on(e,t,o)},er.prototype.off=function(e,t){e=m(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},er.prototype.createEvent=function(e){var t=new tr;return t.init(e),t},er.prototype.fire=function(e,t){var n,r,i,o;if(o=Qn.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(r=this._listeners[e]){n=t instanceof tr?t:this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{i=this._invokeListeners(n,o,r)}finally{e!==a&&(n.type=a)}return void 0===i&&n.defaultPrevented&&(i=!1),i}},er.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},er.prototype._destroy=function(){this._listeners={}},er.prototype._invokeListeners=function(e,t,n){for(var r;n&&!e.cancelBubble;)r=this._invokeListener(e,t,n),n=n.next;return r},er.prototype._invokeListener=function(e,t,n){var r;if(n.callback.__isTomb)return r;try{void 0!==(r=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=r,e.stopPropagation()),!1===r&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return r},er.prototype._addListener=function(e,t){var n,r=this._getListeners(e);if(r){for(;r;){if(r.priority<t.priority)return t.next=r,void(n?n.next=t:this._setListeners(e,t));n=r,r=r.next}n.next=t}else this._setListeners(e,t)},er.prototype._getListeners=function(e){return this._listeners[e]},er.prototype._setListeners=function(e,t){this._listeners[e]=t},er.prototype._removeListener=function(e,t){var n,r,i,o=this._getListeners(e);if(t)for(;o;)n=o.next,(i=o.callback)!==t&&i.__fn!==t||(r?r.next=n:this._setListeners(e,n)),r=o,o=n;else this._setListeners(e,null)},tr.prototype.stopPropagation=function(){this.cancelBubble=!0},tr.prototype.preventDefault=function(){this.defaultPrevented=!0},tr.prototype.init=function(e){U(this,e||{})},ar.$inject=["eventBus","elementRegistry"],ar.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n))||(Le(t=Ge("g")).add("djs-children"),Ae(n.parentNode,t)):t=n,t},ar.prototype._clear=function(e){var t=nr(e);return ue(t),t},ar.prototype._createContainer=function(e,t,n,r){var i=Ge("g");Le(i).add("djs-group"),void 0!==n?sr(i,t,t.childNodes[n]):Ae(t,i);var o=Ge("g");Le(o).add("djs-element"),Le(o).add("djs-"+e),r&&Le(o).add("djs-frame"),Ae(i,o);var a=Ge("g");return Le(a).add("djs-visual"),Ae(o,a),o},ar.prototype.create=function(e,t,n){var r=this._getChildrenContainer(t.parent);return this._createContainer(e,r,n,Ct(t))},ar.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry;E(S(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),(function(e){var r=e.children;if(r){var i=t._getChildrenContainer(e);E(r.slice().reverse(),(function(e){sr(n.getGraphics(e).parentNode,i)}))}}))},ar.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},ar.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},ar.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},ar.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},ar.prototype.update=function(e,t,n){if(t.parent){var r=this._clear(n);if("shape"===e)this.drawShape(r,t),ir(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(r,t)}t.hidden?De(n,"display","none"):De(n,"display","block")}},ar.prototype.remove=function(e){Ne(this._elementRegistry.getGraphics(e).parentNode)};var lr={__depends__:[Mt],__init__:["canvas"],canvas:["type",Rn],elementRegistry:["type",jn],elementFactory:["type",Zn],eventBus:["type",er],graphicsFactory:["type",ar]};function cr(e){return function(e){var t=new mt(e);return t.init(),t}([{config:["value",e=e||{}]},lr].concat(e.modules||[]))}function pr(e,t){this.injector=t=t||cr(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function ur(){}function dr(e,t){this.model=e,this.properties=t}pr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},pr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},ur.prototype.get=function(e){return this.$model.properties.get(this,e)},ur.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},dr.prototype.createType=function(e){var t=this.model,n=this.properties,r=Object.create(ur.prototype);E(e.properties,(function(e){e.isMany||void 0===e.default||(r[e.name]=e.default)})),n.defineModel(r,t),n.defineDescriptor(r,e);var i=e.ns.name;function o(e){n.define(this,"$type",{value:i,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),E(e,$((function(e,t){this.set(t,e)}),this))}return o.prototype=r,o.hasType=r.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var mr={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},hr={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}};function fr(e,t){var n=hr[e];return n?n(t):t}function gr(e){return!!mr[e]}function vr(e){return!!hr[e]}function yr(e,t){var n,r,i=e.split(/:/);if(1===i.length)n=e,r=t;else{if(2!==i.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=i[1],r=i[0]}return{name:e=(r?r+":":"")+n,prefix:r,localName:n}}function br(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function xr(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,E(e,$(this.registerPackage,this))}function wr(e,t,n){var r=t[n];if(r in e)throw new Error("package with "+n+" <"+r+"> already defined")}function _r(e){this.model=e}function Er(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Pr(e){this.properties=new _r(this),this.factory=new dr(this,this.properties),this.registry=new xr(e,this.properties),this.typeCache={}}br.prototype.build=function(){return K(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},br.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var r=this.properties;void 0!==t?r.splice(t,0,e):r.push(e)},br.prototype.replaceProperty=function(e,t,n){var r=e.ns,i=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=i.indexOf(e);if(-1===s)throw new Error("property <"+r.name+"> not found in property list");i.splice(s,1),this.addProperty(t,n?void 0:s,a),o[r.name]=o[r.localName]=t},br.prototype.redefineProperty=function(e,t,n){var r=e.ns.prefix,i=t.split("#"),o=yr(i[0],r),a=yr(i[1],o.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},br.prototype.addNamedProperty=function(e,t){var n=e.ns,r=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),r[n.name]=r[n.localName]=e},br.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},br.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},br.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},br.prototype.assertNotDefined=function(e,t){var n=e.name,r=this.propertiesByName[n];if(r)throw new Error("property <"+n+"> already defined; override of <"+r.definedBy.ns.name+"#"+r.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},br.prototype.hasProperty=function(e){return this.propertiesByName[e]},br.prototype.addTrait=function(e,t){var n=this.allTypesByName,r=this.allTypes,i=e.name;i in n||(E(e.properties,$((function(n){n=U({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var r=n.replaces,i=n.redefines;r||i?this.redefineProperty(n,r||i,r):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),r.push(e),n[i]=e)},xr.prototype.getPackage=function(e){return this.packageMap[e]},xr.prototype.getPackages=function(){return this.packages},xr.prototype.registerPackage=function(e){e=U({},e);var t=this.packageMap;wr(t,e,"prefix"),wr(t,e,"uri"),E(e.types,$((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},xr.prototype.registerType=function(e,t){var n=yr((e=U({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:U(e.meta||{})})).name,t.prefix),r=n.name,i={};E(e.properties,$((function(e){var t=yr(e.name,n.prefix),r=t.name;gr(e.type)||(e.type=yr(e.type,t.prefix).name),U(e,{ns:t,name:r}),i[r]=e}),this)),U(e,{ns:n,name:r,propertiesByName:i}),E(e.extends,$((function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(r)}),this)),this.definePackage(e,t),this.typeMap[r]=e},xr.prototype.mapTypes=function(e,t,n){var r=gr(e.name)?{name:e.name}:this.typeMap[e.name],i=this;function o(e){return a(e,!0)}function a(n,r){var o=yr(n,gr(n)?"":e.prefix);i.mapTypes(o,t,r)}if(!r)throw new Error("unknown type <"+e.name+">");E(r.superClass,n?o:a),t(r,!n),E(r.traits,o)},xr.prototype.getEffectiveDescriptor=function(e){var t=yr(e),n=new br(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var r=n.build();return this.definePackage(r,r.allTypes[r.allTypes.length-1].$pkg),r},xr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},_r.prototype.set=function(e,t,n){var r=this.model.getPropertyDescriptor(e,t),i=r&&r.name;void 0===n?r?delete e[i]:delete e.$attrs[t]:r?i in e?e[i]=n:Er(e,r,n):e.$attrs[t]=n},_r.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var r=n.name;return!e[r]&&n.isMany&&Er(e,n,[]),e[r]},_r.prototype.define=function(e,t,n){if(!n.writable){var r=n.value;delete(n=U({},n,{get:function(){return r}})).value}Object.defineProperty(e,t,n)},_r.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},_r.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pr.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Pr.prototype.getType=function(e){var t=this.typeCache,n=v(e)?e:e.ns.name,r=t[n];return r||(e=this.registry.getEffectiveDescriptor(n),r=t[n]=this.factory.createType(e)),r},Pr.prototype.createAny=function(e,t,n){var r=yr(e),i={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:r.prefix,localName:r.localName,uri:t}};return this.properties.defineDescriptor(i,o),this.properties.defineModel(i,this),this.properties.define(i,"$parent",{enumerable:!1,writable:!0}),this.properties.define(i,"$instanceOf",{enumerable:!1,writable:!0}),E(n,(function(e,t){h(e)&&void 0!==e.value?i[e.name]=e.value:i[t]=e})),i},Pr.prototype.getPackage=function(e){return this.registry.getPackage(e)},Pr.prototype.getPackages=function(){return this.registry.getPackages()},Pr.prototype.getElementDescriptor=function(e){return e.$descriptor},Pr.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},Pr.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Pr.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Sr=String.fromCharCode,Cr=Object.prototype.hasOwnProperty,Or=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,kr={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Mr(e,t,n,r){return r?Cr.call(kr,r)?kr[r]:"&"+r+";":Sr(t||parseInt(n,16))}function Ar(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(Or,Mr):e}Object.keys(kr).forEach((function(e){kr[e.toUpperCase()]=kr[e]}));var Tr="xsi:type",Rr="non-whitespace outside of root node";function Dr(e){return new Error(e)}function Br(e){return"missing namespace for prefix <"+e+">"}function jr(e){return{get:e,enumerable:!0}}function zr(e){var t,n={};for(t in e)n[t]=e[t];return n}function Ir(e){return e+"$uri"}function Lr(){return{line:0,column:0}}function Vr(e){throw e}function Nr(e){if(!this)return new Nr(e);var t,n,r,i,o,a,s,l,c,p=e&&e.proxy,u=Vr,d=Lr,m=!1,h=!1,f=null,g=!1;function v(e){e instanceof Error||(e=Dr(e)),f=e,u(e,d)}function y(e){o&&(e instanceof Error||(e=Dr(e)),o(e,d))}this.on=function(e,c){if("function"!=typeof c)throw Dr("required args <name, cb>");switch(e){case"openTag":n=c;break;case"text":t=c;break;case"closeTag":r=c;break;case"error":u=c;break;case"warn":o=c;break;case"cdata":i=c;break;case"attention":l=c;break;case"question":s=c;break;case"comment":a=c;break;default:throw Dr("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Dr("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",h=!0,c=n,this},this.parse=function(e){if("string"!=typeof e)throw Dr("required args <xml=string>");return f=null,function(e){var o,u,f,b,x,w,_,E,P,S,C,O=h?[]:null,k=h?function(e){var t,n,r={};for(t in e)r[n=e[t]]=n,r[Ir(n)]=t;return r}(c):null,M=[],A=0,T=!1,R=!1,D=0,B=0,j="",z=0;function I(){if(null!==C)return C;var e,t,n,r,i,o,a,s,l,p,u,d=h&&k.xmlns,f=h&&m?[]:null,g=z,v=j,b=v.length,x={},w={};e:for(;g<b;g++)if(l=!1,!(32===(p=v.charCodeAt(g))||p<14&&p>8)){for((p<65||p>122||p>90&&p<97)&&95!==p&&58!==p&&(y("illegal first char attribute name"),l=!0),u=g+1;u<b;u++)if(!((p=v.charCodeAt(u))>96&&p<123||p>64&&p<91||p>47&&p<59||46===p||45===p||95===p)){if(32===p||p<14&&p>8){y("missing attribute value"),g=u;continue e}if(61===p)break;y("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(s=v.substring(g,u))&&(y("illegal declaration of xmlns"),l=!0),34===(p=v.charCodeAt(u+1)))-1===(u=v.indexOf('"',g=u+2))&&-1!==(u=v.indexOf("'",g))&&(y("attribute value quote missmatch"),l=!0);else if(39===p)-1===(u=v.indexOf("'",g=u+2))&&-1!==(u=v.indexOf('"',g))&&(y("attribute value quote missmatch"),l=!0);else for(y("missing attribute value quotes"),l=!0,u+=1;u<b&&!(32===(p=v.charCodeAt(u+1))||p<14&&p>8);u++);for(-1===u&&(y("missing closing quotes"),u=b,l=!0),l||(o=v.substring(g,u)),g=u;u+1<b&&!(32===(p=v.charCodeAt(u+1))||p<14&&p>8);u++)g===u&&(y("illegal character after attribute end"),l=!0);if(g=u+1,!l)if(s in w)y("attribute <"+s+"> already defined");else if(w[s]=!0,h)if(m){if(null!==(i="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=Ar(o),t=Ir(i),!(a=c[e])){if("xmlns"===i||t in k&&k[t]!==e)do{a="ns"+A++}while(void 0!==k[a]);else a=i;c[e]=a}k[i]!==a&&(r||(k=zr(k),r=!0),k[i]=a,"xmlns"===i&&(k[Ir(a)]=e,d=a),k[t]=e),x[s]=o;continue}f.push(s,o)}else-1!==(p=s.indexOf(":"))?(n=k[s.substring(0,p)])?((s=d===n?s.substr(p+1):n+s.substr(p))===Tr&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=k[n]||n)+o.substring(p)):o=d+":"+o),x[s]=o):y(Br(s.substring(0,p))):x[s]=o;else x[s]=o}if(m)for(g=0,b=f.length;g<b;g++){if(s=f[g++],o=f[g],-1!==(p=s.indexOf(":"))){if(!(n=k[s.substring(0,p)])){y(Br(s.substring(0,p)));continue}(s=d===n?s.substr(p+1):n+s.substr(p))===Tr&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=k[n]||n)+o.substring(p)):o=d+":"+o)}x[s]=o}return C=x}function L(){for(var t,n,r=/(\r\n|\r|\n)/g,i=0,o=0,a=0,s=B;D>=a&&(t=r.exec(e))&&!((s=t[0].length+t.index)>D);)i+=1,a=s;return-1==D?(o=s,n=e.substring(B)):0===B?n=e.substring(B,D):(o=D-a,n=-1==B?e.substring(D):e.substring(D,B+1)),{data:n,line:i,column:o}}d=L,p&&(S=Object.create({},{name:jr((function(){return E})),originalName:jr((function(){return P})),attrs:jr(I),ns:jr((function(){return k}))}));for(;-1!==B;){if(-1===(D=60===e.charCodeAt(B)?B:e.indexOf("<",B)))return M.length?v("unexpected end of file"):0===B?v("missing start tag"):void(B<e.length&&e.substring(B).trim()&&y(Rr));if(B!==D)if(M.length){if(t&&(t(e.substring(B,D),Ar,d),g))return}else if(e.substring(B,D).trim()&&(y(Rr),g))return;if(33===(x=e.charCodeAt(D+1))){if(91===(b=e.charCodeAt(D+2))&&"CDATA["===e.substr(D+3,6)){if(-1===(B=e.indexOf("]]>",D)))return v("unclosed cdata");if(i&&(i(e.substring(D+9,B),d),g))return;B+=3;continue}if(45===b&&45===e.charCodeAt(D+3)){if(-1===(B=e.indexOf("--\x3e",D)))return v("unclosed comment");if(a&&(a(e.substring(D+4,B),Ar,d),g))return;B+=3;continue}}if(63!==x){for(u=D+1;;u++){if(w=e.charCodeAt(u),isNaN(w))return B=-1,v("unclosed tag");if(34===w)u=-1!==(b=e.indexOf('"',u+1))?b:u;else if(39===w)u=-1!==(b=e.indexOf("'",u+1))?b:u;else if(62===w){B=u;break}}if(33!==x){if(C={},47===x){if(T=!1,R=!0,!M.length)return v("missing open tag");if(u=E=M.pop(),b=D+2+u.length,e.substring(D+2,b)!==u)return v("closing tag mismatch");for(;b<B;b++)if(!(32===(x=e.charCodeAt(b))||x>8&&x<14))return v("close tag")}else{if(47===e.charCodeAt(B-1)?(u=E=e.substring(D+1,B-1),T=!0,R=!0):(u=E=e.substring(D+1,B),T=!0,R=!1),!(x>96&&x<123||x>64&&x<91||95===x||58===x))return v("illegal first char nodeName");for(b=1,f=u.length;b<f;b++)if(!((x=u.charCodeAt(b))>96&&x<123||x>64&&x<91||x>47&&x<59||45===x||95===x||46==x)){if(32===x||x<14&&x>8){E=u.substring(0,b),C=null;break}return v("invalid nodeName")}R||M.push(E)}if(h){if(o=k,T&&(R||O.push(o),null===C&&(m=-1!==u.indexOf("xmlns",b))&&(z=b,j=u,I(),m=!1)),P=E,-1!==(x=E.indexOf(":"))){if(!(_=k[E.substring(0,x)]))return v("missing namespace on <"+P+">");E=E.substr(x+1)}else _=k.xmlns;_&&(E=_+":"+E)}if(T&&(z=b,j=u,n&&(p?n(S,Ar,R,d):n(E,I,Ar,R,d),g)))return;if(R){if(r&&(r(p?S:E,Ar,T,d),g))return;h&&(k=T?o:O.pop())}B+=1}else{if(l&&(l(e.substring(D,B+1),Ar,d),g))return;B+=1}}else{if(-1===(B=e.indexOf("?>",D)))return v("unclosed question");if(s&&(s(e.substring(D,B+2),d),g))return;B+=2}}}(e),d=Lr,g=!1,f},this.stop=function(){g=!0}}function Fr(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var $r={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Hr="xsi:type";function qr(e){return e.xml&&e.xml.serialize}function Ur(e){return qr(e)===Hr}function Gr(e,t){return Fr(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Wr(e){return new Error(e)}function Kr(e){return e.$descriptor}function Yr(e){U(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Wr("expected element");var t,n=this.elementsById,r=Kr(e).idProperty;if(r&&(t=e.get(r.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Wr("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Xr(){}function Jr(){}function Zr(){}function Qr(e,t){this.property=e,this.context=t}function ei(e,t){this.element=t,this.propertyDesc=e}function ti(){}function ni(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function ri(e,t,n){ni.call(this,e,t,n)}function ii(e,t,n){this.model=e,this.context=n}function oi(e){e instanceof Pr&&(e={model:e}),U(this,{lax:!1},e)}Xr.prototype.handleEnd=function(){},Xr.prototype.handleText=function(){},Xr.prototype.handleNode=function(){},Jr.prototype=Object.create(Xr.prototype),Jr.prototype.handleNode=function(){return this},Zr.prototype=Object.create(Xr.prototype),Zr.prototype.handleText=function(e){this.body=(this.body||"")+e},Qr.prototype=Object.create(Zr.prototype),Qr.prototype.handleNode=function(e){if(this.element)throw Wr("expected no sub nodes");return this.element=this.createReference(e),this},Qr.prototype.handleEnd=function(){this.element.id=this.body},Qr.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},ei.prototype=Object.create(Zr.prototype),ei.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=fr(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},ti.prototype=Object.create(Zr.prototype),ti.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t},ni.prototype=Object.create(ti.prototype),ni.prototype.addReference=function(e){this.context.addReference(e)},ni.prototype.handleText=function(e){if(!Kr(this.element).bodyProperty)throw Wr("unexpected body text <"+e+">");Zr.prototype.handleText.call(this,e)},ni.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Kr(t).bodyProperty;n&&void 0!==e&&(e=fr(n.type,e),t.set(n.name,e))},ni.prototype.createElement=function(e){var t,n=e.attributes,r=this.type,i=Kr(r),o=this.context,a=new r({}),s=this.model;return E(n,(function(e,n){var r=i.propertiesByName[n];r&&r.isReference?r.isMany?E(e.split(" "),(function(e){o.addReference({element:a,property:r.ns.name,id:e})})):o.addReference({element:a,property:r.ns.name,id:e}):(r?e=fr(r.type,e):"xmlns"!==n&&(t=yr(n,i.ns.prefix),s.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:a,property:n,value:e})),a.set(n,e))})),a},ni.prototype.getPropertyForNode=function(e){var t,n,r=yr(e.name),i=this.type,o=this.model,a=Kr(i),s=r.name,l=a.propertiesByName[s];if(l&&!l.isAttr)return Ur(l)&&(t=e.attributes[Hr])?(t=function(e,t){var n=yr(e);return function(e,t){var n=e.name,r=e.localName,i=t.xml&&t.xml.typePrefix;return i&&0===r.indexOf(i)?e.prefix+":"+r.slice(i.length):n}(n,t.getPackage(n.prefix))}(t,o),U({},l,{effectiveType:Kr(n=o.getType(t)).name})):l;var c=o.getPackage(r.prefix);if(c){if(t=Gr(r,c),n=o.getType(t),l=x(a.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})))return U({},l,{effectiveType:Kr(n).name})}else if(l=x(a.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})))return l;throw Wr("unrecognized element <"+r.name+">")},ni.prototype.toString=function(){return"ElementDescriptor["+Kr(this.type).name+"]"},ni.prototype.valueHandler=function(e,t){return new ei(e,t)},ni.prototype.referenceHandler=function(e){return new Qr(e,this.context)},ni.prototype.handler=function(e){return"Element"===e?new ii(this.model,e,this.context):new ni(this.model,e,this.context)},ni.prototype.handleChild=function(e){var t,n,r,i;if(t=this.getPropertyForNode(e),r=this.element,vr(n=t.effectiveType||t.type))return this.valueHandler(t,r);var o=(i=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?r.get(t.name).push(o):r.set(t.name,o),t.isReference?(U(o,{element:r}),this.context.addReference(o)):o.$parent=r),i},ri.prototype=Object.create(ni.prototype),ri.prototype.createElement=function(e){var t=e.name,n=yr(t),r=this.model,i=this.type,o=r.getPackage(n.prefix),a=o&&Gr(n,o)||t;if(!i.hasType(a))throw Wr("unexpected element <"+e.originalName+">");return ni.prototype.createElement.call(this,e)},ii.prototype=Object.create(ti.prototype),ii.prototype.createElement=function(e){var t=e.name,n=yr(t).prefix,r=e.ns[n+"$uri"],i=e.attributes;return this.model.createAny(t,r,i)},ii.prototype.handleChild=function(e){var t=new ii(this.model,"Element",this.context).handleNode(e),n=this.element,r=t.element;return void 0!==r&&((n.$children=n.$children||[]).push(r),r.$parent=n),t},ii.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},oi.prototype.fromXML=function(e,t,n){var r=t.rootHandler;t instanceof ni?(r=t,t={}):"string"==typeof t?(r=this.handler(t),t={}):"string"==typeof r&&(r=this.handler(r));var i=this.model,o=this.lax,a=new Yr(U({},t,{rootHandler:r})),s=new Nr({proxy:!0}),l=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function c(e,t,n){var r=t(),i=r.line,o=r.column,s=r.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var l="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+i+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:l,error:e}),!0;throw Wr(l)}function p(e,t){return c(e,t,!0)}r.context=a,l.push(r);var u=/^<\?xml /i,d=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function h(e,t){try{l.peek().handleText(e)}catch(e){p(e,t)}}var f=i.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return s.ns(f).on("openTag",(function(e,t,n,r){var i=e.attrs||{},a=Object.keys(i).reduce((function(e,n){var r=t(i[n]);return e[n]=r,e}),{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,o)&&l.push(new Jr)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},r)})).on("question",(function(e){if(u.test(e)){var t=d.exec(e),n=t&&t[1];n&&!m.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){l.pop().handleEnd()})).on("cdata",h).on("text",(function(e,t,n){!function(e,t){e.trim()&&h(e,t)}(t(e),n)})).on("error",c).on("warn",p),new Promise((function(t,n){var i;try{s.parse(e),function(){var e,t,n=a.elementsById,r=a.references;for(e=0;t=r[e];e++){var i=t.element,o=n[t.id],s=Kr(i).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var l=i.get(s.name),c=l.indexOf(t);-1===c&&(c=l.length),o?l[c]=o:l.splice(c,1)}else i.set(s.name,o)}}()}catch(e){i=e}var o=r.element;i||o||(i=Wr("failed to parse document as <"+r.type.$descriptor.name+">"));var l=a.warnings,c=a.references,p=a.elementsById;return i?(i.warnings=l,n(i)):t({rootElement:o,elementsById:p,references:c,warnings:l})}))},oi.prototype.handler=function(e){return new ri(this.model,e)};var ai=/<|>|'|"|&|\n\r|\n/g,si=/<|>|&/g;function li(e){var t={},n={},r={},i=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?i.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},this.logUsed=function(t){var n=t.uri,i=this.getNSKey(t);r[i]=this.byUri(n),e&&e.logUsed(t)},this.getUsed=function(e){var t=this;return[].concat(i,o).filter((function(e){var n=t.getNSKey(e);return r[n]}))}}function ci(e,t){return Fr(t)?(n=e).charAt(0).toLowerCase()+n.slice(1):e;var n}function pi(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ui(e){return v(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var di={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},mi={"<":"lt",">":"gt","&":"amp"};function hi(e,t,n){return(e=v(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function fi(e){this.tagName=e}function gi(){}function vi(e){this.tagName=e}function yi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function bi(e,t){yi.call(this,e,t)}function xi(){this.value="",this.write=function(e){this.value+=e}}function wi(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function _i(e){return e=U({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var r=n||new xi,i=new wi(r,e.format);if(e.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new yi).build(t).serializeTo(i),!n)return r.value}}}function Ei(e,t){Pr.call(this,e,t)}fi.prototype.build=function(e){return this.element=e,this},fi.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},gi.prototype.serializeValue=gi.prototype.serializeTo=function(e){e.append(this.escape?hi(this.value,si,mi):this.value)},gi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(si)&&(this.escape=!0),this},pi(vi,gi),vi.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},yi.prototype.build=function(e){this.element=e;var t,n,r=e.$descriptor,i=this.propertyDescriptor,o=r.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=i?this.nsPropertyTagName(i):this.nsTagName(r),this.tagName=this.addTagName(this.ns),o||(n=function(e){return _(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!b(e,n))return!1;var r=e[n];return r!==t.default&&null!==r&&(!t.isMany||r.length)}))}(e),this.parseAttributes(_(n,(function(e){return e.isAttr}))),this.parseContainments(function(e){return _(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},yi.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?U({localName:t.ns.localName},e):U({localName:ci(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},yi.prototype.nsPropertyTagName=function(e){return function(e,t){return U({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},yi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},yi.prototype.nsAttributeName=function(e){var t;if(t=v(e)?yr(e):e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:U({localName:t.localName},n)},yi.prototype.parseGeneric=function(e){var t=this,n=this.body,r=[];return E(e,(function(i,o){"$body"===o?n.push((new gi).build({type:"String"},i)):"$children"===o?E(i,(function(e){n.push(new yi(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,i)&&r.push({name:o,value:i})})),r},yi.prototype.parseNsAttribute=function(e,t,n){var r,i=e.$model,o=yr(t);if("xmlns"===o.prefix&&(r={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},yi.prototype.parseNsAttributes=function(e,t){var n=this,r=e.$attrs,i=[];return E(r,(function(t,r){var o=n.parseNsAttribute(e,r,t);o&&i.push(o)})),i},yi.prototype.parseGenericAttributes=function(e,t){var n=this;E(t,(function(t){if(t.name!==Hr)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},yi.prototype.parseContainments=function(e){var t=this,n=this.body,r=this.element;E(e,(function(e){var i=r.get(e.name),o=e.isReference;if(e.isMany||(i=[i]),e.isBody)n.push((new gi).build(e,i[0]));else if(vr(e.type))E(i,(function(r){n.push(new vi(t.addTagName(t.nsPropertyTagName(e))).build(e,r))}));else if(o)E(i,(function(r){n.push(new fi(t.addTagName(t.nsPropertyTagName(e))).build(r))}));else{var a=Ur(e),s=function(e){return"property"===qr(e)}(e);E(i,(function(r){var i;i=a?new bi(t,e):s?new yi(t,e):new yi(t),n.push(i.build(r))}))}}))},yi.prototype.getNamespaces=function(e){var t,n=this.namespaces,r=this.parent;return n||(t=r&&r.getNamespaces(),e||!t?this.namespaces=n=new li(t):n=t),n},yi.prototype.logNamespace=function(e,t,n){var r=this.getNamespaces(n),i=e.uri,o=e.prefix;return r.byUri(i)&&!n||r.add(e,t),r.mapPrefix(o,i),e},yi.prototype.logNamespaceUsed=function(e,t){var n,r,i,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,l=e.uri;if(!s&&!l)return{localName:e.localName};if(i=$r[s]||o&&(o.getPackage(s)||{}).uri,!(l=l||i||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(l))){for(n=s,r=1;a.uriByPrefix(n);)n=s+"_"+r++;e=this.logNamespace({prefix:n,uri:l},i===l)}return s&&a.mapPrefix(s,l),e},yi.prototype.parseAttributes=function(e){var t=this,n=this.element;E(e,(function(e){var r=n.get(e.name);if(e.isReference)if(e.isMany){var i=[];E(r,(function(e){i.push(e.id)})),r=i.join(" ")}else r=r.id;t.addAttribute(t.nsAttributeName(e),r)}))},yi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ui(e)},yi.prototype.addAttribute=function(e,t){var n=this.attrs;v(t)&&(t=hi(t,ai,di)),n.push({name:e,value:t})},yi.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return e.getUsed().filter((function(e){return"xml"!==e.prefix})).map((function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}}))}(n).concat(t)),E(t,(function(t){e.append(" ").append(ui(t.name)).append('="').append(t.value).append('"')}))},yi.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==gi;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),E(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},pi(bi,yi),bi.prototype.parseNsAttributes=function(e){var t=yi.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var r=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var i=e.$model.getPackage(r.uri),o=i.xml&&i.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Hr),(r.prefix?r.prefix+":":"")+o+n.ns.localName),t},bi.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},Ei.prototype=Object.create(Pr.prototype),Ei.prototype.fromXML=function(e,t,n){v(t)||(n=t,t="bpmn:Definitions");var r=new oi(U({model:this,lax:!0},n)),i=r.handler(t);return r.fromXML(e,i)},Ei.prototype.toXML=function(e,t){var n=new _i(t);return new Promise((function(t,r){try{return t({xml:n.toXML(e)})}catch(e){return r(e)}}))};var Pi={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",prefix:"bpmn",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],enumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",prefix:"bpmndi",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],enumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[]},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",prefix:"dc",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",prefix:"di",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],associations:[],xml:{tagAlias:"lowerCase"}},bioc:{name:"bpmn.io colors for BPMN",uri:"http://bpmn.io/schema/bpmn/biocolor/1.0",prefix:"bioc",types:[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]},color:{name:"BPMN in Color",uri:"http://www.omg.org/spec/BPMN/non-normative/color/1.0",prefix:"color",types:[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}};function Si(e,t){return new Ei(U({},Pi,e),t)}function Ci(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Oi(e){return function(){if(!window.Promise)throw new Error("Promises is not supported in this environment. Please polyfill Promise.");var t=arguments.length;if(!(t>=1&&g(arguments[t-1])))return e.apply(this,arguments);var n=arguments[t-1];console.warn(new Error("Passing callbacks to "+e.name+" is deprecated and will be removed in a future major release. Please switch to promises: https://bpmn.io/l/moving-to-promises.html"));var r=Array.prototype.slice.call(arguments,0,-1);e.apply(this,r).then((function(e){var t=Object.keys(e)[0];return n(null,e[t])}),(function(e){return n(e,e.warnings)}))}}function ki(e){b(e,"di")||Object.defineProperty(e,"di",{get:function(){throw new Error("Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472")}})}function Mi(e,t){return e.$instanceOf(t)}function Ai(e,t){var n={},r=[],i={};function o(e,t){return function(n){e(n,t)}}function a(e){n[e.id]=e}function s(n,r){try{var o=i[n.id]&&function(n,r){if(n.gfx)throw new Error(t("already rendered {element}",{element:Ci(n)}));return e.element(n,i[n.id],r)}(n,r);return a(n),o}catch(e){l(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:Ci(n)})),console.error(e)}}function l(t,n){e.error(t,n)}function c(e){var n=e.bpmnElement;n?i[n.id]?l(t("multiple DI elements defined for {element}",{element:Ci(n)}),{element:n}):(i[n.id]=e,ki(n)):l(t("no bpmnElement referenced in {element}",{element:Ci(e)}),{element:e})}function p(e){var t;c(t=e.plane),E(t.planeElement,u)}function u(e){c(e)}function d(){for(;r.length;)r.shift()()}function m(e,t){M(e,t),w(e.ioSpecification,t),b(e.artifacts,t),a(e)}function h(e,t){s(e,t)}function f(e,t){s(e,t)}function g(e,t){s(e,t)}function v(e,t){s(e,t)}function y(e,t){s(e,t)}function b(e,t){E(e,(function(e){Mi(e,"bpmn:Association")?r.push((function(){y(e,t)})):y(e,t)}))}function w(e,t){e&&(E(e.dataInputs,o(g,t)),E(e.dataOutputs,o(v,t)))}function P(e,t){M(e,t),b(e.artifacts,t)}function S(e,t){var n=s(e,t);Mi(e,"bpmn:SubProcess")&&P(e,n||t),Mi(e,"bpmn:Activity")&&w(e.ioSpecification,t),r.push((function(){E(e.dataInputAssociations,o(f,t)),E(e.dataOutputAssociations,o(f,t))}))}function C(e,t){s(e,t)}function O(e,t){r.push((function(){var n=s(e,t);e.childLaneSet&&k(e.childLaneSet,n||t),function(e){E(e.flowNodeRef,(function(t){var n=t.get("lanes");n&&n.push(e)}))}(e)}))}function k(e,t){E(e.lanes,o(O,t))}function M(e,n){!function(e,n){E(e,(function(e){Mi(e,"bpmn:SequenceFlow")?r.push((function(){!function(e,t){s(e,t)}(e,n)})):Mi(e,"bpmn:BoundaryEvent")?r.unshift((function(){S(e,n)})):Mi(e,"bpmn:FlowNode")?S(e,n):Mi(e,"bpmn:DataObject")||(Mi(e,"bpmn:DataStoreReference")||Mi(e,"bpmn:DataObjectReference")?C(e,n):l(t("unrecognized flowElement {element} in context {context}",{element:Ci(e),context:n?Ci(n.businessObject):"null"}),{element:e,context:n}))}))}(e.flowElements,n),e.laneSets&&function(e,t){E(e,o(k,t))}(e.laneSets,n)}function A(e,t){var n=s(e,t),r=e.processRef;r&&m(r,n||t)}return{handleDeferred:d,handleDefinitions:function(a,s){var u=a.diagrams;if(s&&-1===u.indexOf(s))throw new Error(t("diagram not part of bpmn:Definitions"));if(!s&&u&&u.length&&(s=u[0]),!s)throw new Error(t("no diagram to display"));i={},p(s);var f=s.plane;if(!f)throw new Error(t("no plane for {element}",{element:Ci(s)}));var g=f.bpmnElement;if(!g){if(!(g=function(e){return x(e.rootElements,(function(e){return Mi(e,"bpmn:Process")||Mi(e,"bpmn:Collaboration")}))}(a)))throw new Error(t("no process or collaboration to display"));l(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:Ci(f),rootElement:Ci(g)})),f.bpmnElement=g,c(f)}var v,y,w=function(t,n){return e.root(t,i[t.id],n)}(g,f);if(Mi(g,"bpmn:Process")||Mi(g,"bpmn:SubProcess"))m(g,w);else{if(!Mi(g,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:Ci(f),rootElement:Ci(g)}));y=w,E((v=g).participants,o(A,y)),b(v.artifacts,y),r.push((function(){!function(e,t){E(e,o(h,t))}(v.messageFlows,y)})),function(e,t){_(e,(function(e){return!n[e.id]&&Mi(e,"bpmn:Process")&&e.laneSets})).forEach(o(m,t))}(a.rootElements,w)}d()},handleSubProcess:P,registerDi:c}}function Ti(e,t){var n=Di(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Ri(e,t){return O(t,(function(t){return Ti(e,t)}))}function Di(e){return e&&e.businessObject||e}function Bi(e){return e&&e.di}var ji=Object.freeze({__proto__:null,is:Ti,isAny:Ri,getBusinessObject:Di,getDi:Bi});function zi(e,t,n){var r,i,o,a,s=[];function l(e,t){var n=new Ai({root:function(e,t){return r.add(e,t)},element:function(e,t,n){return r.add(e,t,n)},error:function(e,t){s.push({message:e,context:t})}},o);t=t||e.diagrams&&e.diagrams[0];var i=function(e,t){if(!t)return;var n,r=t.plane.bpmnElement,i=r;Ti(r,"bpmn:Process")||Ti(r,"bpmn:Collaboration")||(i=function(e){var t=e;for(;t;){if(Ti(t,"bpmn:Process"))return t;t=t.$parent}}(r));n=Ti(i,"bpmn:Collaboration")?i:x(e.rootElements,(function(e){if(Ti(e,"bpmn:Collaboration"))return x(e.participants,(function(e){return e.processRef===i}))}));var o=[i];n&&(o=k(n.participants,(function(e){return e.processRef}))).push(n);var a=Ii(o),s=[t],l=[r];return E(e.diagrams,(function(e){var t=e.plane.bpmnElement;-1!==a.indexOf(t)&&-1===l.indexOf(t)&&(s.push(e),l.push(t))})),s}(e,t);if(!i)throw new Error(o("no diagram to display"));E(i,(function(t){n.handleDefinitions(e,t)}));var l=t.plane.bpmnElement.id;a.setRootElement(a.findRoot(l+"_plane")||a.findRoot(l))}return new Promise((function(c,p){try{return r=e.get("bpmnImporter"),i=e.get("eventBus"),o=e.get("translate"),a=e.get("canvas"),i.fire("import.render.start",{definitions:t}),l(t,n),i.fire("import.render.complete",{error:undefined,warnings:s}),c({warnings:s})}catch(e){return e.warnings=s,p(e)}}))}function Ii(e){var t=[];return E(e,(function(e){e&&(t.push(e),t=t.concat(Ii(e.flowElements)))})),t}var Li,Vi='<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>',Ni={verticalAlign:"middle"},Fi={color:"#404040"},$i={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Hi={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},qi={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"};function Ui(){Li||(re(Li=Ee('<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link"><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></a><span>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>'),$i),re(Ce("svg",Li),Ni),re(Ce(".backdrop",Li),Hi),re(Ce(".notice",Li),qi),re(Ce(".link",Li),Fi,{margin:"15px 20px 15px 10px",alignSelf:"center"}),_e.bind(Li,".backdrop","click",(function(e){document.body.removeChild(Li)}))),document.body.appendChild(Li)}function Gi(e){var t,n;e=U({},Ki,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,re(Ce("svg",n=Ee('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Vi+"</a>")),Ni),re(n,Fi,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),t.appendChild(n),be.bind(n,"click",(function(e){Ui(),e.preventDefault()})),this._init(this._container,this._moddle,e)}function Wi(e,t){return e.warnings=t,e}i(Gi,pr),Gi.prototype.importXML=Oi((function(e,t){var n=this;return new Promise((function(r,i){e=n._emit("import.parse.start",{xml:e})||e,n._moddle.fromXML(e,"bpmn:Definitions").then((function(e){var o,a,s=e.rootElement,l=e.references,c=e.warnings,p=e.elementsById;s=n._emit("import.parse.complete",(o={error:null,definitions:s,elementsById:p,references:l,warnings:c},a=n.get("eventBus").createEvent(o),Object.defineProperty(a,"context",{enumerable:!0,get:function(){return console.warn(new Error("import.parse.complete <context> is deprecated and will be removed in future library versions")),{warnings:o.warnings,references:o.references,elementsById:o.elementsById}}}),a))||s,n.importDefinitions(s,t).then((function(e){var t=[].concat(c,e.warnings||[]);return n._emit("import.done",{error:null,warnings:t}),r({warnings:t})})).catch((function(e){var t=[].concat(c,e.warnings||[]);return n._emit("import.done",{error:e,warnings:t}),i(Wi(e,t))}))})).catch((function(e){return n._emit("import.parse.complete",{error:e}),e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]);return e}(e),n._emit("import.done",{error:e,warnings:e.warnings}),i(e)}))}))})),Gi.prototype.importDefinitions=Oi((function(e,t){var n=this;return new Promise((function(r,i){n._setDefinitions(e),n.open(t).then((function(e){var t=e.warnings;return r({warnings:t})})).catch((function(e){return i(e)}))}))})),Gi.prototype.open=Oi((function(e){var t=this._definitions,n=e,r=this;return new Promise((function(i,o){if(!t){var a=new Error("no XML imported");return o(Wi(a,[]))}if("string"==typeof e&&!(n=function(e,t){if(!t)return null;return x(e.diagrams,(function(e){return e.id===t}))||null}(t,e))){var s=new Error("BPMNDiagram <"+e+"> not found");return o(Wi(s,[]))}try{r.clear()}catch(e){return o(Wi(e,[]))}zi(r,t,n).then((function(e){var t=e.warnings;return i({warnings:t})})).catch((function(e){return o(e)}))}))})),Gi.prototype.saveXML=Oi((function(e){e=e||{};var t=this,n=this._definitions;return new Promise((function(r){if(!n)return r({error:new Error("no definitions loaded")});n=t._emit("saveXML.start",{definitions:n})||n,t._moddle.toXML(n,e).then((function(e){var n=e.xml;return n=t._emit("saveXML.serialized",{xml:n})||n,r({xml:n})}))})).catch((function(e){return{error:e}})).then((function(e){t._emit("saveXML.done",e);var n=e.error;return n?Promise.reject(n):e}))})),Gi.prototype.saveSVG=Oi((function(e){var t=this;return new Promise((function(e,n){var r,i;t._emit("saveSVG.start");try{var o=t.get("canvas"),a=o.getActiveLayer(),s=Ce("defs",o._svg),l=nt(a),c=s?"<defs>"+nt(s)+"</defs>":"",p=a.getBBox();r='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+p.width+'" height="'+p.height+'" viewBox="'+p.x+" "+p.y+" "+p.width+" "+p.height+'" version="1.1">'+c+l+"</svg>"}catch(e){i=e}return t._emit("saveSVG.done",{error:i,svg:r}),i?n(i):e({svg:r})}))})),Gi.prototype._setDefinitions=function(e){this._definitions=e},Gi.prototype.getModules=function(){return this._modules},Gi.prototype.clear=function(){this.getDefinitions()&&pr.prototype.clear.call(this)},Gi.prototype.destroy=function(){pr.prototype.destroy.call(this),ke(this._container)},Gi.prototype.on=function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)},Gi.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gi.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=Ce(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gi.prototype.getDefinitions=function(){return this._definitions},Gi.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gi.prototype._init=function(e,t,n){var r=n.modules||this.getModules(),i=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],r,i),a=U(Y(n,["additionalModules"]),{canvas:U({},n.canvas,{container:e}),modules:o});pr.call(this,a),n&&n.container&&this.attachTo(n.container)},Gi.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gi.prototype._createContainer=function(e){var t=Ee('<div class="bjs-container"></div>');return re(t,{width:Yi(e.width),height:Yi(e.height),position:e.position}),t},Gi.prototype._createModdle=function(e){return new Si(U({},this._moddleExtensions,e.moddleExtensions))},Gi.prototype._modules=[];var Ki={width:"100%",height:"100%",position:"relative"};function Yi(e){return e+(f(e)?"px":"")}function Xi(e){Gi.call(this,e),this.on("import.parse.complete",(function(e){e.error||this._collectIds(e.definitions,e.elementsById)}),this),this.on("diagram.destroy",(function(){this.get("moddle").ids.clear()}),this)}function Ji(e,t){return!Ti(e,"bpmn:CallActivity")&&(Ti(e,"bpmn:SubProcess")?!(!(t=t||Bi(e))||!Ti(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded:!Ti(e,"bpmn:Participant")||!!Di(e).processRef)}function Zi(e){return e&&!1!==Di(e).isInterrupting}function Qi(e){return e&&!!Di(e).triggeredByEvent}function eo(e,t){var n=Di(e),r=!1;return n.eventDefinitions&&E(n.eventDefinitions,(function(e){Ti(e,t)&&(r=!0)})),r}function to(e){return Ti(e,"bpmn:FlowElement")||Ti(e,"bpmn:Participant")||Ti(e,"bpmn:Lane")||Ti(e,"bpmn:SequenceFlow")||Ti(e,"bpmn:MessageFlow")||Ti(e,"bpmn:DataInput")||Ti(e,"bpmn:DataOutput")?"name":Ti(e,"bpmn:TextAnnotation")?"text":Ti(e,"bpmn:Group")?"categoryValueRef":void 0}function no(e){var t=e.businessObject,n=to(t);if(n)return"categoryValueRef"===n?function(e){var t=e.categoryValueRef;return t&&t.value||""}(t):t[n]||""}function ro(e,t,n){var r=e.businessObject,i=to(r);return i&&("categoryValueRef"===i?r.categoryValueRef.value=t:r[i]=t),e}i(Xi,Gi),Xi.prototype._createModdle=function(e){var t=Gi.prototype._createModdle.call(this,e);return t.ids=new a([32,36,1]),t},Xi.prototype._collectIds=function(e,t){var n,r=e.$model.ids;for(n in r.clear(),t)r.claim(n,t[n])};var io="hsl(225, 10%, 15%)";function oo(e,t,n){return O(e.eventDefinitions,(function(r){return r.$type===t&&function(e,t){return C(t,(function(t,n){return e[n]==t}))}(e,n)}))}function ao(e){return e.businessObject}function so(e,t){var n=Bi(e);return n.get("color:background-color")||n.get("bioc:fill")||t||"white"}function lo(e,t){var n=Bi(e);return n.get("color:border-color")||n.get("bioc:stroke")||t||io}function co(e,t,n){var r=Bi(e).get("label");return r&&r.get("color:color")||t||lo(e,n)}var po=new a,uo=.95;function mo(e,t,n,r,i,o,a){ft.call(this,t,a);var s=e&&e.defaultFillColor,l=e&&e.defaultStrokeColor,c=e&&e.defaultLabelColor,p=po.next(),u={},d=n.computeStyle;function m(e,t){var n=U({fill:io,strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),r=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=Ge("marker");De(t.element,n),Ae(a,t.element),De(a,{id:e,viewBox:"0 0 20 20",refX:r.x,refY:r.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});var s=Ce("defs",i._svg);s||(s=Ge("defs"),Ae(i._svg,s)),Ae(s,a),u[e]=a}function f(e){return e.replace(/[^0-9a-zA-z]+/g,"_")}function g(e,t,n){var r=e+"-"+f(t)+"-"+f(n)+"-"+p;return u[r]||function(e,t,n,r){if("sequenceflow-end"===t){var i=Ge("path");De(i,{d:"M 1 5 L 11 10 L 1 15 Z"}),m(e,{element:i,ref:{x:11,y:10},scale:.5,attrs:{fill:r,stroke:r}})}if("messageflow-start"===t){var o=Ge("circle");De(o,{cx:6,cy:6,r:3.5}),m(e,{element:o,attrs:{fill:n,stroke:r},ref:{x:6,y:6}})}if("messageflow-end"===t){var a=Ge("path");De(a,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),m(e,{element:a,attrs:{fill:n,stroke:r,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var s=Ge("path");De(s,{d:"M 11 5 L 1 10 L 11 15"}),m(e,{element:s,attrs:{fill:"none",stroke:r,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var l=Ge("path");De(l,{d:"M 1 5 L 11 10 L 1 15"}),m(e,{element:l,attrs:{fill:"none",stroke:r,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var c=Ge("path");De(c,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),m(e,{element:c,attrs:{fill:n,stroke:r},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var p=Ge("path");De(p,{d:"M 6 4 L 10 16"}),m(e,{element:p,attrs:{stroke:r},ref:{x:0,y:10},scale:.5})}}(r,e,t,n),"url(#"+r+")"}function v(e,t,n,r,i){h(r)&&(i=r,r=0),r=r||0,"none"===(i=d(i,{stroke:io,strokeWidth:2,fill:"white"})).fill&&delete i.fillOpacity;var o=t/2,a=n/2,s=Ge("circle");return De(s,{cx:o,cy:a,r:Math.round((t+n)/4-r)}),De(s,i),Ae(e,s),s}function y(e,t,n,r,i,o){h(i)&&(o=i,i=0),i=i||0,o=d(o,{stroke:io,strokeWidth:2,fill:"white"});var a=Ge("rect");return De(a,{x:i,y:i,width:t-2*i,height:n-2*i,rx:r,ry:r}),De(a,o),Ae(e,a),a}function b(e,t,n){var r=yt(t,n=d(n,["no-fill"],{stroke:io,strokeWidth:2,fill:"none"}));return Ae(e,r),r}function x(e,t,n){n=d(n,["no-fill"],{strokeWidth:2,stroke:io});var r=Ge("path");return De(r,{d:t}),De(r,n),Ae(e,r),r}function w(e,t,n,r){return x(t,n,U({"data-marker":e},r))}function _(e){return A[e]}function P(e){return function(t,n){return _(e)(t,n)}}function S(e,t){var n=ao(e),r=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(n);return n.eventDefinitions&&n.eventDefinitions.length>1?n.parallelMultiple?_("bpmn:ParallelMultipleEventDefinition")(t,e,r):_("bpmn:MultipleEventDefinition")(t,e,r):oo(n,"bpmn:MessageEventDefinition")?_("bpmn:MessageEventDefinition")(t,e,r):oo(n,"bpmn:TimerEventDefinition")?_("bpmn:TimerEventDefinition")(t,e,r):oo(n,"bpmn:ConditionalEventDefinition")?_("bpmn:ConditionalEventDefinition")(t,e):oo(n,"bpmn:SignalEventDefinition")?_("bpmn:SignalEventDefinition")(t,e,r):oo(n,"bpmn:EscalationEventDefinition")?_("bpmn:EscalationEventDefinition")(t,e,r):oo(n,"bpmn:LinkEventDefinition")?_("bpmn:LinkEventDefinition")(t,e,r):oo(n,"bpmn:ErrorEventDefinition")?_("bpmn:ErrorEventDefinition")(t,e,r):oo(n,"bpmn:CancelEventDefinition")?_("bpmn:CancelEventDefinition")(t,e,r):oo(n,"bpmn:CompensateEventDefinition")?_("bpmn:CompensateEventDefinition")(t,e,r):oo(n,"bpmn:TerminateEventDefinition")?_("bpmn:TerminateEventDefinition")(t,e,r):null}function C(e,t,n){n=U({size:{width:100}},n);var r=o.createText(t||"",n);return Le(r).add("djs-label"),Ae(e,r),r}function O(e,t,n){return C(e,ao(t).name,{box:t,align:n,padding:5,style:{fill:co(t,c,l)}})}function k(e,t,n){rr(C(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:co(n,c,l)}}),0,-(-1*n.height),270)}function M(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,r=1;r<t.length;r++)n+="L"+t[r].x+","+t[r].y+" ";return n}var A=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=uo),v(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:so(t,s),stroke:lo(t,l)};ao(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:so(t,s),stroke:lo(t,l)});var r=_("bpmn:Event")(e,t,n);return S(t,e),r},"bpmn:MessageEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?lo(t,l):so(t,s),stroke:n?so(t,s):lo(t,l)})},"bpmn:TimerEventDefinition":function(e,t){var n=v(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:so(t,s),stroke:lo(t,l)});x(e,r.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:lo(t,l)});for(var i=0;i<12;i++){var o=r.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;x(e,o,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*i+","+t.height/2+","+a+")",stroke:lo(t,l)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:ConditionalEventDefinition":function(e,t){return x(e,r.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:lo(t,l)})},"bpmn:LinkEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:ErrorEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:CancelEventDefinition":function(e,t,n){var i=x(e,r.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)});return or(i,45),i},"bpmn:CompensateEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:SignalEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?lo(t,l):"none",stroke:lo(t,l)})},"bpmn:MultipleEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?lo(t,l):"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return x(e,r.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)})},"bpmn:EndEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:4,fill:so(t,s),stroke:lo(t,l)});return S(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return v(e,t.width,t.height,8,{strokeWidth:4,fill:lo(t,l),stroke:lo(t,l)})},"bpmn:IntermediateEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)});return v(e,t.width,t.height,3,{strokeWidth:1,fill:so(t,"none"),stroke:lo(t,l)}),S(t,e),n},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=uo),y(e,t.width,t.height,10,n)},"bpmn:Task":function(e,t){var n={fill:so(t,s),stroke:lo(t,l)},r=_("bpmn:Activity")(e,t,n);return O(e,t,"center-middle"),T(e,t),r},"bpmn:ServiceTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)}),x(e,r.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:so(t,s)}),x(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)}),n},"bpmn:UserTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:so(t,s),stroke:lo(t,l)}),x(e,r.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:so(t,s),stroke:lo(t,l)}),x(e,r.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:lo(t,l),stroke:lo(t,l)}),n},"bpmn:ManualTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:so(t,s),stroke:lo(t,l)}),n},"bpmn:SendTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:lo(t,l),stroke:so(t,s)}),n},"bpmn:ReceiveTask":function(e,t){var n,i=ao(t),o=_("bpmn:Task")(e,t);return i.instantiate?(v(e,28,28,4.4,{strokeWidth:1}),n=r.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):n=r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(e,n,{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)}),o},"bpmn:ScriptTask":function(e,t){var n=_("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:lo(t,l)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=_("bpmn:Task")(e,t);return De(x(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{strokeWidth:1,fill:so(t,"#aaaaaa"),stroke:lo(t,l)}),De(x(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:lo(t,l)}),n},"bpmn:SubProcess":function(e,t,n){n=U({fill:so(t,s),stroke:lo(t,l)},n);var r=_("bpmn:Activity")(e,t,n),i=Ji(t);return Qi(t)&&De(r,{strokeDasharray:"1,2"}),O(e,t,i?"center-top":"center-middle"),i?T(e,t):T(e,t,["SubProcessMarker"]),r},"bpmn:AdHocSubProcess":function(e,t){return _("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var r=_("bpmn:SubProcess")(e,t),i=n.style(["no-fill","no-events"],{stroke:lo(t,l)});return y(e,t.width,t.height,8,3,i),r},"bpmn:CallActivity":function(e,t){return _("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:uo,fill:so(t,s),stroke:lo(t,l)},r=_("bpmn:Lane")(e,t,n);Ji(t)?(b(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:lo(t,l)}),k(e,ao(t).name,t)):C(e,ao(t).name,{box:t,align:"center-middle",style:{fill:co(t,c,l)}});return!!ao(t).participantMultiplicity&&_("ParticipantMultiplicityMarker")(e,t),r},"bpmn:Lane":function(e,t,n){var r=y(e,t.width,t.height,0,U({fill:so(t,s),fillOpacity:.35,stroke:lo(t,l)},n)),i=ao(t);"bpmn:Lane"===i.$type&&k(e,i.name,t);return r},"bpmn:InclusiveGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return v(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:so(t,s),stroke:lo(t,l)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=_("bpmn:Gateway")(e,t),i=r.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Bi(t).isMarkerVisible&&x(e,i,{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)}),n},"bpmn:ComplexGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return x(e,r.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)}),n},"bpmn:ParallelGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return x(e,r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)}),n},"bpmn:EventBasedGateway":function(e,t){var n=ao(t),i=_("bpmn:Gateway")(e,t);v(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:lo(t,l)});var o=n.eventGatewayType,a=!!n.instantiate;if("Parallel"===o){var s=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});De(x(e,s),{strokeWidth:1,fill:"none"})}else if("Exclusive"===o){if(!a)De(v(e,t.width,t.height,.26*t.height),{strokeWidth:1,fill:"none",stroke:lo(t,l)});!function(){var n=r.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),i={strokeWidth:2,fill:so(t,"none"),stroke:lo(t,l)};x(e,n,i)}()}return i},"bpmn:Gateway":function(e,t){var n={fill:so(t,s),fillOpacity:uo,stroke:lo(t,l)};return function(e,t,n,r){var i=t/2,o=n/2,a=[{x:i,y:0},{x:t,y:o},{x:i,y:n},{x:0,y:o}].map((function(e){return e.x+","+e.y})).join(" ");r=d(r,{stroke:io,strokeWidth:2,fill:"white"});var s=Ge("polygon");return De(s,{points:a}),De(s,r),Ae(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,r=M(t),i=so(t,s),o=lo(t,l),a=x(e,r,{strokeLinejoin:"round",markerEnd:g("sequenceflow-end",i,o),stroke:lo(t,l)}),c=ao(t);return t.source&&(n=t.source.businessObject,c.conditionExpression&&n.$instanceOf("bpmn:Activity")&&De(a,{markerStart:g("conditional-flow-marker",i,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===c&&De(a,{markerStart:g("conditional-default-flow-marker",i,o)})),a},"bpmn:Association":function(e,t,n){var r=ao(t),i=so(t,s),o=lo(t,l);return n=U({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:lo(t,l)},n||{}),"One"!==r.associationDirection&&"Both"!==r.associationDirection||(n.markerEnd=g("association-end",i,o)),"Both"===r.associationDirection&&(n.markerStart=g("association-start",i,o)),b(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=so(t,s),r=lo(t,l);return _("bpmn:Association")(e,t,{markerEnd:g("association-end",n,r)})},"bpmn:DataOutputAssociation":function(e,t){var n=so(t,s),r=lo(t,l);return _("bpmn:Association")(e,t,{markerEnd:g("association-end",n,r)})},"bpmn:MessageFlow":function(e,t){var n=ao(t),i=Bi(t),o=so(t,s),a=lo(t,l),p=x(e,M(t),{markerEnd:g("messageflow-end",o,a),markerStart:g("messageflow-start",o,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:lo(t,l)});if(n.messageRef){var u=p.getPointAtLength(p.getTotalLength()/2),d=r.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),m={strokeWidth:1};"initiating"===i.messageVisibleKind?(m.fill="white",m.stroke=io):(m.fill="#888",m.stroke="white");var h=x(e,d,m),f=C(e,n.messageRef.name,{align:"center-top",fitBox:!0,style:{fill:lo(t,c)}}),v=h.getBBox(),y=f.getBBox();rr(f,u.x-y.width/2,u.y+v.height/2+10,0)}return p},"bpmn:DataObject":function(e,t){var n=x(e,r.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:so(t,s),fillOpacity:uo,stroke:lo(t,l)});return function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}(ao(t))&&function(e,t){var n=(t.height-18)/t.height,i=r.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.33,my:n}});x(e,i,{strokeWidth:2})}(e,t),n},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=r.getRawPath("DATA_ARROW"),i=_("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1}),i},"bpmn:DataOutput":function(e,t){var n=r.getRawPath("DATA_ARROW"),i=_("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1,fill:io}),i},"bpmn:DataStoreReference":function(e,t){return x(e,r.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:so(t,s),fillOpacity:uo,stroke:lo(t,l)})},"bpmn:BoundaryEvent":function(e,t){var n=ao(t).cancelActivity,r={strokeWidth:1,fill:so(t,s),stroke:lo(t,l)};n||(r.strokeDasharray="6",r.strokeLinecap="round");var i=U({},r,{fillOpacity:1}),o=U({},r,{fill:"none"}),a=_("bpmn:Event")(e,t,i);return v(e,t.width,t.height,3,o),S(t,e),a},"bpmn:Group":function(e,t){return y(e,t.width,t.height,10,{stroke:lo(t,l),strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return function(e,t){var n={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return C(e,no(t),{box:n,fitBox:!0,style:U({},o.getExternalStyle(),{fill:co(t,c,l)})})}(e,t)},"bpmn:TextAnnotation":function(e,t){var n=y(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return x(e,r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:lo(t,l)}),C(e,ao(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:co(t,c,l)}}),n},ParticipantMultiplicityMarker:function(e,t){w("participant-multiplicity",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}}),{strokeWidth:2,fill:so(t,s),stroke:lo(t,l)})},SubProcessMarker:function(e,t){ir(y(e,14,14,0,{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)}),t.width/2-7.5,t.height-20),w("sub-process",e,r.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}}),{fill:so(t,s),stroke:lo(t,l)})},ParallelMarker:function(e,t,n){w("parallel",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.parallel)/t.width,my:(t.height-20)/t.height}}),{fill:so(t,s),stroke:lo(t,l)})},SequentialMarker:function(e,t,n){w("sequential",e,r.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.seq)/t.width,my:(t.height-19)/t.height}}),{fill:so(t,s),stroke:lo(t,l)})},CompensationMarker:function(e,t,n){w("compensation",e,r.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1,fill:so(t,s),stroke:lo(t,l)})},LoopMarker:function(e,t,n){w("loop",e,r.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:so(t,s),stroke:lo(t,l),strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){w("adhoc",e,r.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:lo(t,l),stroke:lo(t,l)})}};function T(e,t,n){var r,i=ao(t),o=n&&-1!==n.indexOf("SubProcessMarker");r=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},E(n,(function(n){_(n)(e,t,r)})),i.isForCompensation&&_("CompensationMarker")(e,t,r),"bpmn:AdHocSubProcess"===i.$type&&_("AdhocMarker")(e,t,r);var a=i.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&_("LoopMarker")(e,t,r),!1===s&&_("ParallelMarker")(e,t,r),!0===s&&_("SequentialMarker")(e,t,r))}this._drawPath=x,this._renderer=_}i(mo,ft),mo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],mo.prototype.canRender=function(e){return Ti(e,"bpmn:BaseElement")},mo.prototype.drawShape=function(e,t){var n=t.type;return this._renderer(n)(e,t)},mo.prototype.drawConnection=function(e,t){var n=t.type;return this._renderer(n)(e,t)},mo.prototype.getShapePath=function(e){return Ti(e,"bpmn:Event")?(n=(t=e).x+t.width/2,r=t.y+t.height/2,i=t.width/2,gt([["M",n,r],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]])):Ti(e,"bpmn:Activity")?function(e,t){var n=e.x,r=e.y,i=e.width,o=e.height;return gt([["M",n+t,r],["l",i-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-i,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])}(e,10):Ti(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return gt([["M",e.x+t,e.y],["l",t,n],["l",-t,n],["l",-t,-n],["z"]])}(e):function(e){var t=e.x,n=e.y,r=e.width;return gt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])}(e);var t,n,r,i};var ho={width:150,height:50};function fo(e,t){var n;t.textContent=e;try{var r,i=""===e;return t.textContent=i?"dummy":e,r={width:(n=t.getBBox()).width+2*n.x,height:n.height},i&&(r.width=0),r}catch(e){return{width:0,height:0}}}function go(e,t,n){for(var r,i=e.shift(),o=i;;){if((r=fo(o,n)).width=o?r.width:0," "===o||""===o||r.width<Math.round(t)||o.length<2)return vo(e,o,i,r);o=yo(o,r.width,t)}}function vo(e,t,n,r){if(t.length<n.length){var i=n.slice(t.length).trim();e.unshift(i)}return{width:r.width,height:r.height,text:t}}function yo(e,t,n){var r=Math.max(e.length*(n/t),1),i=function(e,t){var n,r=e.split(/(\s|-|\u00AD)/g),i=[],o=0;if(r.length>1)for(;n=r.shift();){if(!(n.length+o<t)){"-"!==n&&"­"!==n||i.pop();break}i.push(n),o+=n.length}var a=i[i.length-1];return a&&"­"===a&&(i[i.length-1]="-"),i.join("")}(e,r);return i||(i=e.slice(0,Math.max(Math.round(r-1),1))),i}function bo(e){this._config=U({},{size:ho,padding:0,style:{},align:"center-top"},e||{})}bo.prototype.createText=function(e,t){return this.layoutText(e,t).element},bo.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},bo.prototype.layoutText=function(e,t){var n=U({},this._config.size,t.box),r=U({},this._config.style,t.style),i=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return h(e)?U({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(r),l=e.split(/\u00AD?\r?\n/),c=[],p=n.width-o.left-o.right,u=Ge("text");for(De(u,{x:0,y:0}),De(u,r),Ae(function(){var e=document.getElementById("helper-svg");return e||(De(e=Ge("svg"),{id:"helper-svg"}),re(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}(),u);l.length;)c.push(go(l,p,u));"middle"===i.vertical&&(o.top=o.bottom=0);var d=S(c,(function(e,t,n){return e+(s||t.height)}),0)+o.top+o.bottom,m=S(c,(function(e,t,n){return t.width>e?t.width:e}),0),f=o.top;"middle"===i.vertical&&(f+=(n.height-d)/2),f-=(s||c[0].height)/4;var g=Ge("text");return De(g,r),E(c,(function(e){var t;switch(f+=s||e.height,i.horizontal){case"left":t=o.left;break;case"right":t=(a?m:p)-o.right-e.width;break;default:t=Math.max(((a?m:p)-e.width)/2+o.left,0)}var n=Ge("tspan");De(n,{x:t,y:f}),n.textContent=e.text,Ae(g,n)})),Ne(u),{dimensions:{width:m,height:d},element:g}};function xo(e){var t=U({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,r=U({},t,{fontSize:n},e&&e.externalStyle||{}),i=new bo({style:t});this.getExternalLabelBounds=function(e,t){var n=i.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:r});return{x:Math.round(e.x+e.width/2-n.width/2),y:Math.round(e.y),width:Math.ceil(n.width),height:Math.ceil(n.height)}},this.getTextAnnotationBounds=function(e,n){var r=i.getDimensions(n,{box:e,style:t,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(r.height))}},this.createText=function(e,t){return i.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return r}}xo.$inject=["config.textRenderer"];var wo=/\{([^{}]+)\}/g,_o=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Eo={__init__:["bpmnRenderer"],bpmnRenderer:["type",mo],textRenderer:["type",xo],pathMap:["type",function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,r,i=this.pathMap[e];t.abspos?(n=t.abspos.x,r=t.abspos.y):(n=t.containerWidth*t.position.mx,r=t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var l=t.containerHeight/i.height*t.yScaleFactor,c=t.containerWidth/i.width*t.xScaleFactor,p=0;p<i.heightElements.length;p++)s["y"+p]=i.heightElements[p]*l;for(var u=0;u<i.widthElements.length;u++)s["x"+u]=i.widthElements[u]*c}return o=i.d,a={mx:n,my:r,e:s},String(o).replace(wo,(function(e,t){return function(e,t,n){var r=n;return t.replace(_o,(function(e,t,n,i,o){t=t||i,r&&(t in r&&(r=r[t]),"function"==typeof r&&o&&(r=r()))})),r=(null==r||r==n?e:r)+""}(e,t,a)}))}}]};var Po={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]},So={width:90,height:20};function Co(e){return Ti(e,"bpmn:Event")||Ti(e,"bpmn:Gateway")||Ti(e,"bpmn:DataStoreReference")||Ti(e,"bpmn:DataObjectReference")||Ti(e,"bpmn:DataInput")||Ti(e,"bpmn:DataOutput")||Ti(e,"bpmn:SequenceFlow")||Ti(e,"bpmn:MessageFlow")||Ti(e,"bpmn:Group")}function Oo(e){return Ao(e.label)}function ko(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)],i=function(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)];return{x:n.x+(r.x-n.x)/2,y:n.y+(r.y-n.y)/2}}(e),o=Math.atan((r.y-n.y)/(r.x-n.x)),a=i.x,s=i.y;return Math.abs(o)<Math.PI/2?s-=15:a+=15,{x:a,y:s}}function Mo(e){return e.waypoints?ko(e.waypoints):Ti(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+So.height/2}:{x:e.x+e.width/2,y:e.y+e.height+So.height/2}}function Ao(e){return e&&!!e.labelTarget}function To(e,t,n){return U({id:e.id,type:e.$type,businessObject:e,di:t},n)}function Ro(e,t,n){var r=e.waypoint;return!r||r.length<2?[Sn(t),Sn(n)]:r.map((function(e){return{x:e.x,y:e.y}}))}function Do(e,t,n,r){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:Ci(n),referenced:Ci(t),property:r}))}function Bo(e,t,n,r,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=r,this._translate=i,this._textRenderer=o}Bo.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],Bo.prototype.add=function(e,t,n){var r,i,o,a=this._translate;if(Ti(t,"bpmndi:BPMNPlane")){var s=Ti(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};r=this._elementFactory.createRoot(To(e,t,s)),this._canvas.addRootElement(r)}else if(Ti(t,"bpmndi:BPMNShape")){var l=!Ji(e,t),c=function(e){return Ti(e,"bpmn:Group")}(e);i=n&&(n.hidden||n.collapsed);var p=t.bounds;r=this._elementFactory.createShape(To(e,t,{collapsed:l,hidden:i,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height),isFrame:c})),Ti(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,r),Ti(e,"bpmn:Lane")&&(o=0),Ti(e,"bpmn:DataStoreReference")&&(function(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}(n,Sn(p))||(n=this._canvas.findRoot(n))),this._canvas.addShape(r,n,o)}else{if(!Ti(t,"bpmndi:BPMNEdge"))throw new Error(a("unknown di {di} for element {semantic}",{di:Ci(t),semantic:Ci(e)}));var u=this._getSource(e),d=this._getTarget(e);i=n&&(n.hidden||n.collapsed),r=this._elementFactory.createConnection(To(e,t,{hidden:i,source:u,target:d,waypoints:Ro(t,u,d)})),Ti(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),Ti(e,"bpmn:SequenceFlow")&&(o=0),this._canvas.addConnection(r,n,o)}return Co(e)&&no(r)&&this.addLabel(e,t,r),this._eventBus.fire("bpmnElement.added",{element:r}),r},Bo.prototype._attachBoundary=function(e,t){var n=this._translate,r=e.attachedToRef;if(!r)throw new Error(n("missing {semantic}#attachedToRef",{semantic:Ci(e)}));var i=this._elementRegistry.get(r.id),o=i&&i.attachers;if(!i)throw Do(n,e,r,"attachedToRef");t.host=i,o||(i.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Bo.prototype.addLabel=function(e,t,n){var r,i,o;return r=function(e,t){var n,r,i,o=e.label;return o&&o.bounds?(i=o.bounds,r={width:Math.max(So.width,i.width),height:i.height},n={x:i.x+i.width/2,y:i.y+i.height/2}):(n=Mo(t),r=So),U({x:n.x-r.width/2,y:n.y-r.height/2},r)}(t,n),(i=no(n))&&(r=this._textRenderer.getExternalLabelBounds(r,i)),o=this._elementFactory.createLabel(To(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!no(n),x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)})),this._canvas.addShape(o,n.parent)},Bo.prototype._getEnd=function(e,t){var n,r,i=e.$type,o=this._translate;if(r=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===i&&(r=r&&r[0]),("source"===t&&"bpmn:DataOutputAssociation"===i||"target"===t&&"bpmn:DataInputAssociation"===i)&&(r=e.$parent),n=r&&this._getElement(r))return n;throw r?Do(o,e,r,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:Ci(e),side:t}))},Bo.prototype._getSource=function(e){return this._getEnd(e,"source")},Bo.prototype._getTarget=function(e){return this._getEnd(e,"target")},Bo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var jo={__depends__:[Eo,{__depends__:[Po],bpmnImporter:["type",Bo]}]};function zo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function Io(e){return e.originalEvent||e.srcEvent}function Lo(e,t){zo(e),zo(Io(e))}function Vo(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function No(e,t){return(Io(e)||e).button===t}function Fo(e){return No(e,0)}function $o(e){var t=Io(e)||e;return!!Fo(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function Ho(e){var t=Io(e)||e;return Fo(e)&&t.shiftKey}function qo(e){return!0}function Uo(e){return Fo(e)||function(e){return No(e,1)}(e)}function Go(e,t,n){var r=this;function i(n,r,i){var o,a;(function(e,t){return!(l[e]||Fo)(t)})(n,r)||(i?a=t.getGraphics(i):(o=r.delegateTarget||r.target)&&(a=o,i=t.get(a)),a&&i&&!1===e.fire(n,{element:i,gfx:a,originalEvent:r})&&(r.stopPropagation(),r.preventDefault()))}var o={};function a(e){return o[e]}var s={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":qo,"element.mousedown":Uo,"element.mouseup":Uo,"element.click":Uo,"element.dblclick":Uo};function c(e,t,n,r){var a=o[n]=function(e){i(n,e)};r&&(l[n]=r),a.$delegate=_e.bind(e,"svg, .djs-element",t,a)}function p(e,t,n){var r=a(n);r&&_e.unbind(e,t,r.$delegate)}e.on("canvas.destroy",(function(e){var t;t=e.svg,E(s,(function(e,n){p(t,n,e)}))})),e.on("canvas.init",(function(e){var t;t=e.svg,E(s,(function(e,n){c(t,n,e)}))})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:r})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:r})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;r.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;r.updateDefaultHit(t,n)}));var u=h("djs-hit djs-hit-stroke"),d=h("djs-hit djs-hit-click-stroke"),m={all:h("djs-hit djs-hit-all"),"click-stroke":d,stroke:u,"no-move":h("djs-hit djs-hit-no-move")};function h(e,t){return t=U({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function f(e,t){var n=m[t];if(!n)throw new Error("invalid hit type <"+t+">");return De(e,n),e}function g(e,t){Ae(e,t)}this.removeHits=function(e){E(Oe(".djs-hit",e),Ne)},this.createDefaultHit=function(e,t){var n,r=e.waypoints,i=e.isFrame;return r?this.createWaypointsHit(t,r):(n=i?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=yt(t);return f(n,"stroke"),g(e,n),n},this.createBoxHit=function(e,t,n){n=U({x:0,y:0},n);var r=Ge("rect");return f(r,t),De(r,n),g(e,r),r},this.updateDefaultHit=function(e,t){var n=Ce(".djs-hit",t);if(n)return e.waypoints?function(e,t){De(e,{points:vt(t)})}(n,e.waypoints):De(n,{width:e.width,height:e.height}),n},this.fire=i,this.triggerMouseEvent=function(e,t,n){var r=s[e];if(!r)throw new Error("unmapped DOM event name <"+e+">");return i(r,t,n)},this.mouseHandler=a,this.registerEvent=c,this.unregisterEvent=p}Go.$inject=["eventBus","elementRegistry","styles"];var Wo={__init__:["interactionEvents"],interactionEvents:["type",Go]};function Ko(e,t,n){this.offset=6;var r=t.cls("djs-outline",["no-fill"]),i=this;function o(e,t){var n=Ge("rect");return De(n,U({x:10,y:10,rx:3,width:100,height:100},r)),Ae(e,n),n}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,r=Ce(".djs-outline",n);r||(r=o(n)),i.updateShapeOutline(r,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,r=Ce(".djs-outline",n);r||(r=o(n)),i.updateConnectionOutline(r,t)}))}Ko.prototype.updateShapeOutline=function(e,t){De(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Ko.prototype.updateConnectionOutline=function(e,t){var n=Pt(t);De(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},Ko.$inject=["eventBus","styles","elementRegistry"];var Yo={__init__:["outline"],outline:["type",Ko]};function Xo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],(function(e){var t=e.element;n.deselect(t)})),e.on(["diagram.clear","root.set"],(function(e){n.select(null)}))}Xo.$inject=["eventBus","canvas"],Xo.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var r=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:t})}},Xo.prototype.get=function(){return this._selectedElements},Xo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Xo.prototype.select=function(e,t){var n=this._selectedElements,r=n.slice();m(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter((function(e){var t=i.findRoot(e);return o===t})),t?E(e,(function(e){-1===n.indexOf(e)&&n.push(e)})):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:n})};var Jo="hover",Zo="selected";function Qo(e,t,n){this._canvas=e;var r=this;function i(t,n){e.addMarker(t,n)}function o(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){i(e.element,Jo)})),t.on("element.out",(function(e){o(e.element,Jo)})),t.on("selection.changed",(function(e){var t=e.oldSelection,n=e.newSelection;E(t,(function(e){-1===n.indexOf(e)&&function(e){o(e,Zo)}(e)})),E(n,(function(e){-1===t.indexOf(e)&&function(e){i(e,Zo)}(e)})),r._updateSelectionOutline(n)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&r._updateSelectionOutline(n.get())}))}function ea(e,t,n,r){e.on("create.end",500,(function(e){var n=e.context,r=n.canExecute,i=n.elements,o=(n.hints||{}).autoSelect;if(r){if(!1===o)return;m(o)?t.select(o):t.select(i.filter(ta))}})),e.on("connect.end",500,(function(e){var n=e.context.connection;n&&t.select(n)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],i=r.get(e.context.shape.id);x(n,(function(e){return i.id===e.id}))||t.select(i)})),e.on("element.click",(function(e){if(Fo(e)){var r=e.element;r===n.getRootElement()&&(r=null);var i=t.isSelected(r),o=t.get().length>1,a=$o(e)||Ho(e);if(i&&o)return a?t.deselect(r):t.select(r);i?t.deselect(r):t.select(r,a)}}))}function ta(e){return!e.hidden}Qo.$inject=["canvas","eventBus","selection"],Qo.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Fe(t);var n=e.length>1;if(Le(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var r=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(Pt(e)),i=Ge("rect");De(i,U({rx:3},r)),Le(i).add("djs-selection-outline"),Ae(t,i)}},ea.$inject=["eventBus","selection","canvas","elementRegistry"];var na={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Wo,Yo],selection:["type",Xo],selectionVisuals:["type",Qo],selectionBehavior:["type",ea]};function ra(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}ra.prototype.next=function(){return this._prefix+ ++this._counter};var ia=new ra("ov");function oa(e,t,n,r){var i,o;this._eventBus=t,this._canvas=n,this._elementRegistry=r,this._ids=ia,this._overlayDefaults=U({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(i=n.getContainer(),re(o=Ee('<div class="djs-overlay-container" />'),{position:"absolute",width:0,height:0}),i.insertBefore(o,i.firstChild),o),this._init()}function aa(e,t,n){re(e,{left:t+"px",top:n+"px"})}function sa(e,t){e.style.display=!1===t?"none":""}function la(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}oa.$inject=["config.overlays","eventBus","canvas","elementRegistry"],oa.prototype.get=function(e){if(v(e)&&(e={id:e}),v(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?_(t.overlays,z({type:e.type})):t.overlays.slice():[]}return e.type?_(this._overlays,z({type:e.type})):e.id?this._overlays[e.id]:null},oa.prototype.add=function(e,t,n){if(h(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var r=this._ids.next();return n=U({},this._overlayDefaults,n,{id:r,type:t,element:e,html:n.html}),this._addOverlay(n),r},oa.prototype.remove=function(e){var t=this.get(e)||[];m(t)||(t=[t]);var n=this;E(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(ke(e.html),ke(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var r=t.overlays.indexOf(e);-1!==r&&t.overlays.splice(r,1)}}))},oa.prototype.show=function(){sa(this._overlayRoot)},oa.prototype.hide=function(){sa(this._overlayRoot,!1)},oa.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ue(this._overlayRoot)},oa.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,r=t.x,i=t.y;if(t.waypoints){var o=Pt(t);r=o.x,i=o.y}aa(n,r,i),ie(e.html,"data-container-id",t.id)},oa.prototype._updateOverlay=function(e){var t,n,r=e.position,i=e.htmlContainer,o=e.element,a=r.left,s=r.top;void 0!==r.right&&(t=o.waypoints?Pt(o).width:o.width,a=-1*r.right+t);void 0!==r.bottom&&(n=o.waypoints?Pt(o).height:o.height,s=-1*r.bottom+n);aa(i,a||0,s||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},oa.prototype._createOverlayContainer=function(e){var t=Ee('<div class="djs-overlays" />');re(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},oa.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";la(this._overlayRoot,n)},oa.prototype._getOverlayContainer=function(e,t){var n=x(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},oa.prototype._addOverlay=function(e){var t,n,r=e.id,i=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),v(o)&&(o=Ee(o)),n=this._getOverlayContainer(i),re(t=Ee('<div class="djs-overlay" data-overlay-id="'+r+'">'),{position:"absolute"}),t.appendChild(o),e.type&&ce(t).add("djs-overlay-"+e.type),sa(t,this._canvas.findRoot(i)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[r]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},oa.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,r=this._canvas.findRoot(e.element),i=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=!0;(r!==this._canvas.getRootElement()||n&&(u(i)&&i>t.scale||u(o)&&o<t.scale))&&(s=!1),sa(a,s),this._updateOverlayScale(e,t)},oa.prototype._updateOverlayScale=function(e,t){var n,r,i,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,r=1):(n=o.min,r=o.max),u(n)&&t.scale<n&&(i=(1/t.scale||1)*n),u(r)&&t.scale>r&&(i=(1/t.scale||1)*r)),u(i)&&(s="scale("+i+","+i+")"),la(a,s)},oa.prototype._updateOverlaysVisibilty=function(e){var t=this;E(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},oa.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",(function(e){t.hide()})),e.on("canvas.viewbox.changed",(function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()})),e.on(["shape.remove","connection.remove"],(function(e){var n=e.element;E(t.get({element:n}),(function(e){t.remove(e.id)}));var r=t._getOverlayContainer(n);if(r){ke(r.html);var i=t._overlayContainers.indexOf(r);-1!==i&&t._overlayContainers.splice(i,1)}})),e.on("element.changed",500,(function(e){var n=e.element,r=t._getOverlayContainer(n,!0);r&&(E(r.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(r))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&ce(n.html)[e.add?"add":"remove"](e.marker)})),e.on("root.set",(function(){t._updateOverlaysVisibilty(t._canvas.viewbox())})),e.on("diagram.clear",this.clear,this)};var ca={__init__:["overlays"],overlays:["type",oa]};function pa(e,t,n,r){e.on("element.changed",(function(r){var i=r.element;(i.parent||i===t.getRootElement())&&(r.gfx=n.getGraphics(i)),r.gfx&&e.fire(St(i)+".changed",r)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),r.updateContainments(n)})),e.on("shape.changed",(function(e){r.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){r.update("connection",e.element,e.gfx)}))}pa.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var ua={__init__:["changeSupport"],changeSupport:["type",pa]};function da(e){this._eventBus=e}da.$inject=["eventBus"],da.prototype.on=function(e,t,n,r,i,o){if((g(t)||f(t))&&(o=i,i=r,r=n,n=t,t=null),g(n)&&(o=i,i=r,r=n,n=1e3),h(i)&&(o=i,i=!1),!g(r))throw new Error("handlerFn must be a function");m(e)||(e=[e]);var a=this._eventBus;E(e,(function(e){var s=["commandStack",e,t].filter((function(e){return e})).join(".");a.on(s,n,i?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(r,o):r,o)}))};E(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],(function(e){da.prototype[e]=function(t,n,r,i,o){(g(t)||f(t))&&(o=i,i=r,r=n,n=t,t=null),this.on(t,e,n,r,i,o)}}));var ma=Object.freeze({__proto__:null,default:da});function ha(e,t){t.invoke(da,this),this.executed((function(t){var n=t.context;n.rootElement?e.setRootElement(n.rootElement):n.rootElement=e.getRootElement()})),this.revert((function(t){var n=t.context;n.rootElement&&e.setRootElement(n.rootElement)}))}i(ha,da),ha.$inject=["canvas","injector"];var fa={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ha]},ga=n((function(t,n){var r;r=e,t.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),r=n.length,i=-1,o="",a=n.charCodeAt(0);++i<r;)0!=(t=n.charCodeAt(i))?o+=t>=1&&t<=31||127==t||0==i&&t>=48&&t<=57||1==i&&t>=48&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==i&&1==r&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+n.charAt(i):n.charAt(i):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(r)})),va={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};
2
2
  /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */function ya(e){return(e=""+e)&&e.replace(/[&<>"']/g,(function(e){return va[e]}))}var ba="_plane";function xa(e){return function(e){return e.replace(new RegExp("_plane$"),"")}(e.id)}function wa(e){var t=e.id;return Ti(e,"bpmn:SubProcess")?Pa(t):t}function _a(e){return Pa(e)}function Ea(e){return Ti(Bi(e),"bpmndi:BPMNPlane")}function Pa(e){return e+ba}function Sa(e,t,n,r){var i=Ee('<ul class="bjs-breadcrumbs"></ul>'),o=r.getContainer(),a=ce(o);o.appendChild(i);var s=[];function l(e){e&&(s=function(e){for(var t=Di(e),n=[],r=t;r;r=r.$parent)(Ti(r,"bpmn:SubProcess")||Ti(r,"bpmn:Process"))&&n.push(r);return n.reverse()}(e));var n=s.map((function(e){var n=ya(e.name||e.id),i=Ee('<li><span class="bjs-crumb"><a title="'+n+'">'+n+"</a></span></li>"),o=r.findRoot(wa(e))||r.findRoot(e.id);if(!o&&Ti(e,"bpmn:Process")){var a=t.find((function(t){var n=Di(t);return n&&n.processRef&&n.processRef===e}));o=r.findRoot(a.id)}return i.addEventListener("click",(function(){r.setRootElement(o)})),i}));i.innerHTML="";var o=n.length>1;a.toggle("bjs-breadcrumbs-shown",o),n.forEach((function(e){i.appendChild(e)}))}e.on("element.changed",(function(e){var t=Di(e.element);x(s,(function(e){return e===t}))&&l()})),e.on("root.set",(function(e){l(e.element)}))}function Ca(e,t){var n=null,r=new Oa;e.on("root.set",(function(e){var i=e.element,o=t.viewbox(),a=r.get(i);if(r.set(n,{x:o.x,y:o.y,zoom:o.scale}),n=i,!Ti(i,"bpmn:Collaboration")||a){a=a||{x:0,y:0,zoom:1};var s=(o.x-a.x)*o.scale,l=(o.y-a.y)*o.scale;0===s&&0===l||t.scroll({dx:s,dy:l}),a.zoom!==o.scale&&t.zoom(a.zoom,{x:0,y:0})}})),e.on("diagram.clear",(function(){r.clear(),n=null}))}function Oa(){this._entries=[],this.set=function(e,t){var n=!1;for(var r in this._entries)if(this._entries[r][0]===e){this._entries[r][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}-1!==t&&this._entries.splice(t,1)}}Sa.$inject=["eventBus","elementRegistry","overlays","canvas"],Ca.$inject=["eventBus","canvas"];var ka=180,Ma=160;function Aa(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,(function(e,t){n.handleImport(t.definitions)}))}function Ta(e){return Ti(e,"bpmndi:BPMNDiagram")?e:Ta(e.$parent)}Aa.prototype.handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach((function(e){e.plane&&e.plane.bpmnElement&&(t._processToDiagramMap[e.plane.bpmnElement.id]=e)}));var n=[];e.diagrams.forEach((function(e){var r=t.createNewDiagrams(e.plane);Array.prototype.push.apply(n,r)})),n.forEach((function(e){t.movePlaneElementsToOrigin(e.plane)}))}},Aa.prototype.createNewDiagrams=function(e){var t=this,n=[],r=[];e.get("planeElement").forEach((function(t){var i=t.bpmnElement;if(i){var o=i.$parent;Ti(i,"bpmn:SubProcess")&&!t.isExpanded&&n.push(i),function(e,t){var n=e.$parent;if(!Ti(n,"bpmn:SubProcess")||n===t.bpmnElement)return!1;if(Ri(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))return!1;return!0}(i,e)&&r.push({diElement:t,parent:o})}}));var i=[];return n.forEach((function(e){if(!t._processToDiagramMap[e.id]){var n=t.createDiagram(e);t._processToDiagramMap[e.id]=n,i.push(n)}})),r.forEach((function(e){for(var r=e.diElement,i=e.parent;i&&-1===n.indexOf(i);)i=i.$parent;if(i){var o=t._processToDiagramMap[i.id];t.moveToDiPlane(r,o.plane)}})),i},Aa.prototype.movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=function(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach((function(e){if(e.bounds){var n=_n(e.bounds);t.top=Math.min(n.top,t.top),t.left=Math.min(n.left,t.left)}})),En(t)}(e),r=n.x-ka,i=n.y-Ma;t.forEach((function(e){e.waypoint?e.waypoint.forEach((function(e){e.x=e.x-r,e.y=e.y-i})):e.bounds&&(e.bounds.x=e.bounds.x-r,e.bounds.y=e.bounds.y-i)}))},Aa.prototype.moveToDiPlane=function(e,t){var n=Ta(e).plane.get("planeElement");n.splice(n.indexOf(e),1),t.get("planeElement").push(e)},Aa.prototype.createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Aa.$inject=["eventBus","moddle"];var Ra=250;function Da(e,t,n,r){da.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=r;var i=this;this.executed("shape.toggleCollapse",Ra,(function(e){var t=e.shape;i.canDrillDown(t)?i.addOverlay(t):i.removeOverlay(t)}),!0),this.reverted("shape.toggleCollapse",Ra,(function(e){var t=e.shape;i.canDrillDown(t)?i.addOverlay(t):i.removeOverlay(t)}),!0),this.executed(["shape.create","shape.move","shape.delete"],Ra,(function(e){var t=e.oldParent,n=e.newParent||e.parent,r=e.shape;i.canDrillDown(r)&&i.addOverlay(r),i.updateDrilldownOverlay(t),i.updateDrilldownOverlay(n),i.updateDrilldownOverlay(r)}),!0),this.reverted(["shape.create","shape.move","shape.delete"],Ra,(function(e){var t=e.oldParent,n=e.newParent||e.parent,r=e.shape;i.canDrillDown(r)&&i.addOverlay(r),i.updateDrilldownOverlay(t),i.updateDrilldownOverlay(n),i.updateDrilldownOverlay(r)}),!0),t.on("import.render.complete",(function(){n.filter((function(e){return i.canDrillDown(e)})).map((function(e){i.addOverlay(e)}))}))}i(Da,da),Da.prototype.updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this.updateOverlayVisibility(n)}},Da.prototype.canDrillDown=function(e){var t=this._canvas;return Ti(e,"bpmn:SubProcess")&&t.findRoot(wa(e))},Da.prototype.updateOverlayVisibility=function(e){var t=this._overlays,n=e.businessObject,r=t.get({element:n.id,type:"drilldown"})[0];if(r){var i=n&&n.flowElements&&n.flowElements.length;ce(r.html).toggle("bjs-drilldown-empty",!i)}},Da.prototype.addOverlay=function(e){var t=this._canvas,n=this._overlays;n.get({element:e,type:"drilldown"}).length&&this.removeOverlay(e);var r=Ee('<button class="bjs-drilldown"><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></button>');r.addEventListener("click",(function(){t.setRootElement(t.findRoot(wa(e)))})),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this.updateOverlayVisibility(e)},Da.prototype.removeOverlay=function(e){this._overlays.remove({element:e,type:"drilldown"})},Da.$inject=["canvas","eventBus","elementRegistry","overlays"];var Ba={__depends__:[ca,ua,fa],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Sa],drilldownCentering:["type",Ca],drilldownOverlayBehavior:["type",Da],subprocessCompatibility:["type",Aa]};function ja(e){Gi.call(this,e)}function za(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Ia(e,t){return-1!==(e=m(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.keyCode)}function La(e){return e.shiftKey}i(ja,Gi),ja.prototype._modules=[jo,Po,na,ca,Ba],ja.prototype._moddleExtensions={};var Va="keyboard.keydown",Na="input-handle-modified-keys";function Fa(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",(function(){n._fire("destroy"),n.unbind()})),t.on("diagram.init",(function(){n._fire("init")})),t.on("attach",(function(){e&&e.bindTo&&n.bind(e.bindTo)})),t.on("detach",(function(){n.unbind()}))}Fa.$inject=["config.keyboard","eventBus"],Fa.prototype._keydownHandler=function(e){this._keyHandler(e,Va)},Fa.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Fa.prototype._keyHandler=function(e,t){if(!this._isEventIgnored(e)){var n={keyEvent:e};this._eventBus.fire(t||Va,n)&&e.preventDefault()}},Fa.prototype._isEventIgnored=function(e){return(t=e.target)&&(he(t,"input, textarea")||"true"===t.contentEditable)&&this._isModifiedKeyIgnored(e);var t},Fa.prototype._isModifiedKeyIgnored=function(e){return!za(e)||-1===this._getAllowedModifiers(e.target).indexOf(e.key)},Fa.prototype._getAllowedModifiers=function(e){var t=fe(e,"[input-handle-modified-keys]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(Na).split(",")},Fa.prototype.bind=function(e){this.unbind(),this._node=e,be.bind(e,"keydown",this._keydownHandler,!0),be.bind(e,"keyup",this._keyupHandler,!0),this._fire("bind")},Fa.prototype.getBinding=function(){return this._node},Fa.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),be.unbind(e,"keydown",this._keydownHandler,!0),be.unbind(e,"keyup",this._keyupHandler,!0)),this._node=null},Fa.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Fa.prototype.addListener=function(e,t,n){g(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Va,e,t)},Fa.prototype.removeListener=function(e,t){this._eventBus.off(t||Va,e)},Fa.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Fa.prototype.isCmd=za,Fa.prototype.isShift=La,Fa.prototype.isKey=Ia;var $a=["c","C",67],Ha=["v","V",86],qa=["y","Y",89],Ua=["z","Z",90];function Ga(e,t){var n=this;e.on("editorActions.init",500,(function(e){var r=e.editorActions;n.registerBindings(t,r)}))}Ga.$inject=["eventBus","keyboard"],Ga.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}n("undo",(function(e){var n=e.keyEvent;if(za(n)&&!La(n)&&Ia(Ua,n))return t.trigger("undo"),!0})),n("redo",(function(e){var n=e.keyEvent;if(za(n)&&(Ia(qa,n)||Ia(Ua,n)&&La(n)))return t.trigger("redo"),!0})),n("copy",(function(e){var n=e.keyEvent;if(za(n)&&Ia($a,n))return t.trigger("copy"),!0})),n("paste",(function(e){var n=e.keyEvent;if(za(n)&&Ia(Ha,n))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Ia(["+","Add","="],n)&&za(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Ia(["-","Subtract"],n)&&za(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(Ia("0",n)&&za(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){if(Ia(["Backspace","Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0}))};var Wa={__init__:["keyboard","keyboardBindings"],keyboard:["type",Fa],keyboardBindings:["type",Ga]},Ka={moveSpeed:50,moveSpeedAccelerated:200};function Ya(e,t,n){var r=this;this._config=U({},Ka,e||{}),t.addListener((function(e){var n=e.keyEvent,i=r._config;if(!t.isCmd(n))return;if(t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],n)){var o,a=t.isShift(n)?i.moveSpeedAccelerated:i.moveSpeed;switch(n.key){case"ArrowLeft":case"Left":o="left";break;case"ArrowUp":case"Up":o="up";break;case"ArrowRight":case"Right":o="right";break;case"ArrowDown":case"Down":o="down"}return r.moveCanvas({speed:a,direction:o}),!0}})),this.moveCanvas=function(e){var t=0,r=0,i=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case"left":t=i;break;case"up":r=i;break;case"right":t=-i;break;case"down":r=-i}n.scroll({dx:t,dy:r})}}Ya.$inject=["config.keyboardMove","keyboard","canvas"];var Xa={__depends__:[Wa],__init__:["keyboardMove"],keyboardMove:["type",Ya]},Ja=/^djs-cursor-.*$/;function Za(e){var t=ce(document.body);t.removeMatching(Ja),e&&t.add("djs-cursor-"+e)}function Qa(){Za(null)}function es(e,t){function n(){return!1}return t=t||"element.click",e.once(t,5e3,n),function(){e.off(t,n)}}function ts(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ns(e,t){return{x:e.x-t.x,y:e.y-t.y}}function rs(e,t){var n;function r(r){var i,o=n.start,a=n.button,s=Vo(r),l=ns(s,o);(!n.dragging&&(i=l,Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))>15)&&(n.dragging=!0,0===a&&es(e),Za("grab")),n.dragging)&&(l=ns(s,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=s);r.preventDefault()}function i(e){be.unbind(document,"mousemove",r),be.unbind(document,"mouseup",i),n=null,Qa()}e.on("element.mousedown",500,(function(e){return function(e){if(fe(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:Vo(e)},be.bind(document,"mousemove",r),be.bind(document,"mouseup",i),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}rs.$inject=["eventBus","canvas"];var is={__init__:["moveCanvas"],moveCanvas:["type",rs]};function os(e){return Math.log(e)/Math.log(10)}function as(e,t){var n=os(e.min),r=os(e.max);return(Math.abs(n)+Math.abs(r))/t}var ss=Math.sign||function(e){return e>=0?1:-1},ls={min:.2,max:4};function cs(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=$(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||.75;var r=this;t.on("canvas.init",(function(t){r._init(!1!==e.enabled)}))}cs.$inject=["config.zoomScroll","eventBus","canvas"],cs.prototype.scroll=function(e){this._canvas.scroll(e)},cs.prototype.reset=function(){this._canvas.zoom("fit-viewport")},cs.prototype.zoom=function(e,t){var n=as(ls,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},cs.prototype._handleWheel=function(e){if(!fe(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,r=e.ctrlKey,i=e.shiftKey,o=-1*this._scale;if(o*=r?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,r){var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*ss(e.deltaY)*o,this.zoom(n,s)}else n=i?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},cs.prototype.stepZoom=function(e,t){var n=as(ls,10);this._zoom(e,t,n)},cs.prototype._zoom=function(e,t,n){var r=this._canvas,i=e>0?1:-1,o=os(r.zoom()),a=Math.round(o/n)*n;a+=n*i;var s,l,c=Math.pow(10,a);r.zoom((s=ls,l=c,Math.max(s.min,Math.min(s.max,l))),t)},cs.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,r=this._enabled;return void 0===e&&(e=!r),r!==e&&be[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},cs.prototype._init=function(e){this.toggle(e)};var ps={__init__:["zoomScroll"],zoomScroll:["type",cs]};function us(e){ja.call(this,e)}i(us,ja),us.prototype._navigationModules=[Xa,is,ps],us.prototype._modules=[].concat(ja.prototype._modules,us.prototype._navigationModules);
3
3
  /*! Hammer.JS - v2.0.7 - 2016-04-22
4
4
  * http://hammerjs.github.io/